From d9973f1933c7f7ce607426713146cc06b492eb2c Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 13:36:36 +0000 Subject: [PATCH 01/12] Update model options and modify binary files across multiple paths --- docs/genaisrc/genaiscript.d.ts | 8 ++++---- genaisrc/genaiscript.d.ts | 8 ++++---- packages/auto/genaiscript.d.ts | 8 ++++---- packages/core/src/genaisrc/genaiscript.d.ts | 8 ++++---- packages/core/src/types/prompt_template.d.ts | 8 ++++---- packages/sample/genaisrc/blog/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/node/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/python/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/style/genaiscript.d.ts | 8 ++++---- packages/sample/src/aici/genaiscript.d.ts | 8 ++++---- packages/sample/src/errors/genaiscript.d.ts | 8 ++++---- packages/sample/src/genaiscript.d.ts | 8 ++++---- packages/sample/src/makecode/genaiscript.d.ts | 8 ++++---- packages/sample/src/tla/genaiscript.d.ts | 8 ++++---- packages/sample/src/vision/genaiscript.d.ts | 8 ++++---- packages/vscode/genaisrc/genaiscript.d.ts | 8 ++++---- slides/genaisrc/genaiscript.d.ts | 8 ++++---- 18 files changed, 72 insertions(+), 72 deletions(-) diff --git a/docs/genaisrc/genaiscript.d.ts b/docs/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/docs/genaisrc/genaiscript.d.ts +++ b/docs/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/genaisrc/genaiscript.d.ts b/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/genaisrc/genaiscript.d.ts +++ b/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/auto/genaiscript.d.ts b/packages/auto/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/auto/genaiscript.d.ts +++ b/packages/auto/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/core/src/genaisrc/genaiscript.d.ts b/packages/core/src/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/core/src/genaisrc/genaiscript.d.ts +++ b/packages/core/src/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index 6ae947cfee..894e7e1f9e 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -115,16 +115,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/genaisrc/blog/genaiscript.d.ts b/packages/sample/genaisrc/blog/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/genaisrc/blog/genaiscript.d.ts +++ b/packages/sample/genaisrc/blog/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/genaisrc/genaiscript.d.ts b/packages/sample/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/genaisrc/genaiscript.d.ts +++ b/packages/sample/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/genaisrc/node/genaiscript.d.ts b/packages/sample/genaisrc/node/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/genaisrc/node/genaiscript.d.ts +++ b/packages/sample/genaisrc/node/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/genaisrc/python/genaiscript.d.ts b/packages/sample/genaisrc/python/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/genaisrc/python/genaiscript.d.ts +++ b/packages/sample/genaisrc/python/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/genaisrc/style/genaiscript.d.ts b/packages/sample/genaisrc/style/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/genaisrc/style/genaiscript.d.ts +++ b/packages/sample/genaisrc/style/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/aici/genaiscript.d.ts b/packages/sample/src/aici/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/aici/genaiscript.d.ts +++ b/packages/sample/src/aici/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/errors/genaiscript.d.ts b/packages/sample/src/errors/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/errors/genaiscript.d.ts +++ b/packages/sample/src/errors/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/genaiscript.d.ts b/packages/sample/src/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/genaiscript.d.ts +++ b/packages/sample/src/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/makecode/genaiscript.d.ts b/packages/sample/src/makecode/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/makecode/genaiscript.d.ts +++ b/packages/sample/src/makecode/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/tla/genaiscript.d.ts b/packages/sample/src/tla/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/tla/genaiscript.d.ts +++ b/packages/sample/src/tla/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/sample/src/vision/genaiscript.d.ts b/packages/sample/src/vision/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/sample/src/vision/genaiscript.d.ts +++ b/packages/sample/src/vision/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/packages/vscode/genaisrc/genaiscript.d.ts b/packages/vscode/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/packages/vscode/genaisrc/genaiscript.d.ts +++ b/packages/vscode/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { diff --git a/slides/genaisrc/genaiscript.d.ts b/slides/genaisrc/genaiscript.d.ts index 0726ff3dd9..9e4ed0b35c 100644 --- a/slides/genaisrc/genaiscript.d.ts +++ b/slides/genaisrc/genaiscript.d.ts @@ -148,16 +148,16 @@ interface ModelConnectionOptions { * @default gpt-4 * @example gpt-4 */ - model?: - | "openai:gpt-4" - | "openai:gpt-4-turbo" + model?: OptionsOrString< | "openai:gpt-4o" | "openai:gpt-4o-mini" + | "openai:gpt-4" + | "openai:gpt-4-turbo" | "openai:gpt-3.5-turbo" | "ollama:phi3" | "ollama:llama3" | "ollama:mixtral" - | string + > } interface ModelOptions extends ModelConnectionOptions { From ff8184f5e75236f590f60ce8692cb6248f00bb73 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 13:52:18 +0000 Subject: [PATCH 02/12] update shellParse logic and improve diff command handling --- docs/genaisrc/genaiscript.d.ts | 2 +- genaisrc/genaiscript.d.ts | 2 +- packages/auto/genaiscript.d.ts | 2 +- packages/core/src/genaisrc/genaiscript.d.ts | 2 +- packages/core/src/shell.ts | 10 +++++++++- packages/core/src/types/prompt_template.d.ts | 2 +- packages/sample/genaisrc/blog/genaiscript.d.ts | 2 +- packages/sample/genaisrc/genaiscript.d.ts | 2 +- packages/sample/genaisrc/node/genaiscript.d.ts | 2 +- packages/sample/genaisrc/python/genaiscript.d.ts | 2 +- packages/sample/genaisrc/style/genaiscript.d.ts | 2 +- packages/sample/src/aici/genaiscript.d.ts | 2 +- packages/sample/src/errors/genaiscript.d.ts | 2 +- packages/sample/src/genaiscript.d.ts | 2 +- packages/sample/src/makecode/genaiscript.d.ts | 2 +- packages/sample/src/tla/genaiscript.d.ts | 2 +- packages/sample/src/vision/genaiscript.d.ts | 2 +- packages/vscode/genaisrc/gcm.genai.mts | 11 ++++++----- packages/vscode/genaisrc/genaiscript.d.ts | 2 +- slides/genaisrc/genaiscript.d.ts | 2 +- 20 files changed, 33 insertions(+), 24 deletions(-) diff --git a/docs/genaisrc/genaiscript.d.ts b/docs/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/docs/genaisrc/genaiscript.d.ts +++ b/docs/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/genaisrc/genaiscript.d.ts b/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/genaisrc/genaiscript.d.ts +++ b/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/auto/genaiscript.d.ts b/packages/auto/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/auto/genaiscript.d.ts +++ b/packages/auto/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/core/src/genaisrc/genaiscript.d.ts b/packages/core/src/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/core/src/genaisrc/genaiscript.d.ts +++ b/packages/core/src/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/core/src/shell.ts b/packages/core/src/shell.ts index aff4513346..058bc6946b 100644 --- a/packages/core/src/shell.ts +++ b/packages/core/src/shell.ts @@ -2,7 +2,15 @@ import { parse, quote } from "shell-quote" export function shellParse(cmd: string): string[] { const res = parse(cmd) - return res.filter((e) => typeof e === "string") + return res + .filter((e) => !(e as any).comment) + .map((e) => + typeof e === "string" + ? e + : (e as any).op === "glob" + ? (e as any).pattern + : (e as any).op + ) } export function shellQuote(args: string[]): string { diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index 894e7e1f9e..32024ca2cc 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -384,7 +384,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/genaisrc/blog/genaiscript.d.ts b/packages/sample/genaisrc/blog/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/genaisrc/blog/genaiscript.d.ts +++ b/packages/sample/genaisrc/blog/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/genaisrc/genaiscript.d.ts b/packages/sample/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/genaisrc/genaiscript.d.ts +++ b/packages/sample/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/genaisrc/node/genaiscript.d.ts b/packages/sample/genaisrc/node/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/genaisrc/node/genaiscript.d.ts +++ b/packages/sample/genaisrc/node/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/genaisrc/python/genaiscript.d.ts b/packages/sample/genaisrc/python/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/genaisrc/python/genaiscript.d.ts +++ b/packages/sample/genaisrc/python/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/genaisrc/style/genaiscript.d.ts b/packages/sample/genaisrc/style/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/genaisrc/style/genaiscript.d.ts +++ b/packages/sample/genaisrc/style/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/aici/genaiscript.d.ts b/packages/sample/src/aici/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/aici/genaiscript.d.ts +++ b/packages/sample/src/aici/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/errors/genaiscript.d.ts b/packages/sample/src/errors/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/errors/genaiscript.d.ts +++ b/packages/sample/src/errors/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/genaiscript.d.ts b/packages/sample/src/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/genaiscript.d.ts +++ b/packages/sample/src/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/makecode/genaiscript.d.ts b/packages/sample/src/makecode/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/makecode/genaiscript.d.ts +++ b/packages/sample/src/makecode/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/tla/genaiscript.d.ts b/packages/sample/src/tla/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/tla/genaiscript.d.ts +++ b/packages/sample/src/tla/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/sample/src/vision/genaiscript.d.ts b/packages/sample/src/vision/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/sample/src/vision/genaiscript.d.ts +++ b/packages/sample/src/vision/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/packages/vscode/genaisrc/gcm.genai.mts b/packages/vscode/genaisrc/gcm.genai.mts index 2c4d3e7dd7..5631b4fb57 100644 --- a/packages/vscode/genaisrc/gcm.genai.mts +++ b/packages/vscode/genaisrc/gcm.genai.mts @@ -7,8 +7,11 @@ script({ model: "openai:gpt-4o", }) +// TODO: update this diff command to match your workspace +const diffCmd = "git diff --cached -- . :!**/genaiscript.d.ts" + // Check for staged changes and stage all changes if none are staged -let diff = await host.exec("git diff --cached") +let diff = await host.exec(diffCmd) if (!diff.stdout) { /** * Ask user to stage all changes if none are staged @@ -19,7 +22,7 @@ if (!diff.stdout) { if (stage) { // Stage all changes and recompute diff await host.exec("git add .") - diff = await host.exec("git diff --cached -- . :!**/genaiscript.d.ts") + diff = await host.exec(diffCmd) } if (!diff.stdout) cancel("no staged changes") } @@ -77,9 +80,7 @@ Please generate a concise, one-line commit message for these changes. } // Regenerate message if (choice === "commit" && message) { - console.log( - (await host.exec("git", ["commit", "-m", message])).stdout - ) + console.log((await host.exec("git", ["commit", "-m", message])).stdout) if (await host.confirm("Push changes?", { default: true })) console.log((await host.exec("git push")).stdout) break diff --git a/packages/vscode/genaisrc/genaiscript.d.ts b/packages/vscode/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/packages/vscode/genaisrc/genaiscript.d.ts +++ b/packages/vscode/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** diff --git a/slides/genaisrc/genaiscript.d.ts b/slides/genaisrc/genaiscript.d.ts index 9e4ed0b35c..e6d9bce429 100644 --- a/slides/genaisrc/genaiscript.d.ts +++ b/slides/genaisrc/genaiscript.d.ts @@ -417,7 +417,7 @@ interface PromptScript } /** - * Represent a file linked from a `.gpsec.md` document. + * Represent a workspace file and optional content. */ interface WorkspaceFile { /** From 2ff4763fc6c512c1bbebefd3d2c7f280ef6cb233 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 13:55:16 +0000 Subject: [PATCH 03/12] Add new entries in settings.json and fix typos in prompt_template.d.ts --- .vscode/settings.json | 3 +++ docs/genaisrc/genaiscript.d.ts | 8 ++++---- genaisrc/genaiscript.d.ts | 8 ++++---- packages/auto/genaiscript.d.ts | 8 ++++---- packages/core/src/genaisrc/genaiscript.d.ts | 8 ++++---- packages/core/src/types/prompt_template.d.ts | 8 ++++---- packages/sample/genaisrc/blog/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/node/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/python/genaiscript.d.ts | 8 ++++---- packages/sample/genaisrc/style/genaiscript.d.ts | 8 ++++---- packages/sample/src/aici/genaiscript.d.ts | 8 ++++---- packages/sample/src/errors/genaiscript.d.ts | 8 ++++---- packages/sample/src/genaiscript.d.ts | 8 ++++---- packages/sample/src/makecode/genaiscript.d.ts | 8 ++++---- packages/sample/src/tla/genaiscript.d.ts | 8 ++++---- packages/sample/src/vision/genaiscript.d.ts | 8 ++++---- packages/vscode/genaisrc/genaiscript.d.ts | 8 ++++---- slides/genaisrc/genaiscript.d.ts | 8 ++++---- 19 files changed, 75 insertions(+), 72 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b939ee639..b26e904bf4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,6 +10,7 @@ "codelion", "Codespaces", "compactable", + "createfile", "demux", "devcontainers", "dockerode", @@ -27,6 +28,8 @@ "gptools", "gptoolsjs", "hostpath", + "icontains", + "labelledby", "limitrows", "llmify", "llmrequest", diff --git a/docs/genaisrc/genaiscript.d.ts b/docs/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/docs/genaisrc/genaiscript.d.ts +++ b/docs/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/genaisrc/genaiscript.d.ts b/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/genaisrc/genaiscript.d.ts +++ b/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/auto/genaiscript.d.ts b/packages/auto/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/auto/genaiscript.d.ts +++ b/packages/auto/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/core/src/genaisrc/genaiscript.d.ts b/packages/core/src/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/core/src/genaisrc/genaiscript.d.ts +++ b/packages/core/src/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index 32024ca2cc..5ce744e8db 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -583,7 +583,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -710,7 +710,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -970,7 +970,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1439,7 +1439,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/genaisrc/blog/genaiscript.d.ts b/packages/sample/genaisrc/blog/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/genaisrc/blog/genaiscript.d.ts +++ b/packages/sample/genaisrc/blog/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/genaisrc/genaiscript.d.ts b/packages/sample/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/genaisrc/genaiscript.d.ts +++ b/packages/sample/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/genaisrc/node/genaiscript.d.ts b/packages/sample/genaisrc/node/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/genaisrc/node/genaiscript.d.ts +++ b/packages/sample/genaisrc/node/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/genaisrc/python/genaiscript.d.ts b/packages/sample/genaisrc/python/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/genaisrc/python/genaiscript.d.ts +++ b/packages/sample/genaisrc/python/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/genaisrc/style/genaiscript.d.ts b/packages/sample/genaisrc/style/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/genaisrc/style/genaiscript.d.ts +++ b/packages/sample/genaisrc/style/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/aici/genaiscript.d.ts b/packages/sample/src/aici/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/aici/genaiscript.d.ts +++ b/packages/sample/src/aici/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/errors/genaiscript.d.ts b/packages/sample/src/errors/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/errors/genaiscript.d.ts +++ b/packages/sample/src/errors/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/genaiscript.d.ts b/packages/sample/src/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/genaiscript.d.ts +++ b/packages/sample/src/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/makecode/genaiscript.d.ts b/packages/sample/src/makecode/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/makecode/genaiscript.d.ts +++ b/packages/sample/src/makecode/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/tla/genaiscript.d.ts b/packages/sample/src/tla/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/tla/genaiscript.d.ts +++ b/packages/sample/src/tla/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/sample/src/vision/genaiscript.d.ts b/packages/sample/src/vision/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/sample/src/vision/genaiscript.d.ts +++ b/packages/sample/src/vision/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/packages/vscode/genaisrc/genaiscript.d.ts b/packages/vscode/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/packages/vscode/genaisrc/genaiscript.d.ts +++ b/packages/vscode/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } diff --git a/slides/genaisrc/genaiscript.d.ts b/slides/genaisrc/genaiscript.d.ts index e6d9bce429..df355fd9fa 100644 --- a/slides/genaisrc/genaiscript.d.ts +++ b/slides/genaisrc/genaiscript.d.ts @@ -616,7 +616,7 @@ interface WorkspaceFileSystem { /** * Opens a key-value cache for the given cache name. - * The cache is persisted accross runs of the script. Entries are dropped when the cache grows too large. + * The cache is persisted across runs of the script. Entries are dropped when the cache grows too large. * @param cacheName */ cache( @@ -743,7 +743,7 @@ interface FenceOptions { interface ContextExpansionOptions { /** - * Specifies an maximum of estimated tokesn for this entry; after which it will be truncated. + * Specifies an maximum of estimated tokens for this entry; after which it will be truncated. */ maxTokens?: number /* @@ -1003,7 +1003,7 @@ interface Parsers { JSONL(content: string | WorkspaceFile): any[] | undefined /** - * Parses text as a YAML paylaod + * Parses text as a YAML payload */ YAML( content: string | WorkspaceFile, @@ -1472,7 +1472,7 @@ interface DefDataOptions extends Omit, DataFilter { /** - * Output format in the prompt. Defaults to markdownified CSV + * Output format in the prompt. Defaults to Markdown table rendering. */ format?: "json" | "yaml" | "csv" } From 85ab2f6100d3978010d3186a65d2499cffceeb88 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:01:17 +0000 Subject: [PATCH 04/12] Update dependencies and licenses across multiple packages and remove unused package --- THIRD_PARTY_LICENSES.md | 34 +-- docs/package.json | 2 +- .../content/docs/reference/cli/commands.md | 2 +- docs/yarn.lock | 210 +++++++++--------- packages/cli/package.json | 4 +- packages/core/package.json | 2 +- slides/yarn.lock | 202 ++++++++--------- yarn.lock | 39 ++-- 8 files changed, 235 insertions(+), 260 deletions(-) diff --git a/THIRD_PARTY_LICENSES.md b/THIRD_PARTY_LICENSES.md index 734ac2db6d..0ff2fdad84 100644 --- a/THIRD_PARTY_LICENSES.md +++ b/THIRD_PARTY_LICENSES.md @@ -1099,7 +1099,7 @@ MIT License The following npm package may be included in this product: - - genaiscript-vscode@1.55.2 + - genaiscript-vscode@1.55.3 This package contains the following license and notice below: @@ -4188,9 +4188,9 @@ The following npm packages may be included in this product: - @tokenizer/token@0.3.0 - agent-base@6.0.2 - canvas@2.11.2 - - genaiscript-core-internal@1.55.2 - - genaiscript-sample@1.55.2 - - genaiscript@1.55.2 + - genaiscript-core-internal@1.55.3 + - genaiscript-sample@1.55.3 + - genaiscript@1.55.3 - https-proxy-agent@5.0.1 - isarray@1.0.0 - javascript-natural-sort@0.7.1 @@ -4751,7 +4751,7 @@ SOFTWARE. The following npm package may be included in this product: - - @azure/msal-node@2.13.1 + - @azure/msal-node@2.14.0 This package contains the following license and notice below: @@ -4871,7 +4871,7 @@ SOFTWARE. The following npm package may be included in this product: - - gpt-tokenizer@2.2.3 + - gpt-tokenizer@2.3.0 This package contains the following license and notice below: @@ -5090,8 +5090,8 @@ SOFTWARE. The following npm packages may be included in this product: - - @azure/msal-browser@3.23.0 - - @azure/msal-common@14.14.2 + - @azure/msal-browser@3.24.0 + - @azure/msal-common@14.15.0 These packages each contain the following license and notice below: @@ -7102,24 +7102,6 @@ THE SOFTWARE. ----------- -The following npm package may be included in this product: - - - rfc4648@1.5.3 - -This package contains the following license and notice below: - -The MIT License (MIT) - -Copyright © 2022 William R Swanson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ------------ - The following npm package may be included in this product: - jsonwebtoken@9.0.2 diff --git a/docs/package.json b/docs/package.json index 1389342cd4..96e9cca1e3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@astrojs/check": "^0.9.3", - "@astrojs/starlight": "^0.28.1", + "@astrojs/starlight": "^0.28.2", "astro": "^4.15.8", "typescript": "5.6.2" }, diff --git a/docs/src/content/docs/reference/cli/commands.md b/docs/src/content/docs/reference/cli/commands.md index 4df8130f02..45a8e8000c 100644 --- a/docs/src/content/docs/reference/cli/commands.md +++ b/docs/src/content/docs/reference/cli/commands.md @@ -89,7 +89,7 @@ Options: -td, --test-delay delay between tests in seconds --cache enable LLM result cache -v, --verbose verbose output - -pv, --promptfoo-version [version] promptfoo version, default is 0.82.0 + -pv, --promptfoo-version [version] promptfoo version, default is 0.89.3 -os, --out-summary append output summary in file --groups groups to include or exclude. Use :! prefix to exclude diff --git a/docs/yarn.lock b/docs/yarn.lock index 9c7f9e8c8a..c0e4341d1e 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -124,10 +124,10 @@ stream-replace-string "^2.0.0" zod "^3.23.8" -"@astrojs/starlight@^0.28.1": - version "0.28.1" - resolved "https://registry.yarnpkg.com/@astrojs/starlight/-/starlight-0.28.1.tgz#b8bbcf4c4fd393f4312073a115e8134957384ca0" - integrity sha512-aEBy6k1w8L25lP+jV1WYvujxfigFxh10NFPxHCW76J695Xgw1jC1TVALbhkctIuCdIAmzUElpXfuOuOiARJf0g== +"@astrojs/starlight@^0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@astrojs/starlight/-/starlight-0.28.2.tgz#108f847ed533be6024a83389b0e94f6b236fe6f0" + integrity sha512-Q1/Ujl2EzWX71qwqdt/0KP3wOyX6Rvyzcep/zD3hRCtw/Vi2TReh4Q2wLwz7mnbuYU9H7YvBKYknbkmjC+K/0w== dependencies: "@astrojs/mdx" "^3.1.3" "@astrojs/sitemap" "^3.1.6" @@ -808,85 +808,85 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.0.tgz#e8c16c336f060b4cb592f62eb4f0e543d79d51fe" - integrity sha512-/IZQvg6ZR0tAkEi4tdXOraQoWeJy9gbQ/cx4I7k9dJaCk9qrXEcdouxRVz5kZXt5C2bQ9pILoAA+KB4C/d3pfw== - -"@rollup/rollup-android-arm64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.0.tgz#7a44160a14017fa744912d7037c7d81d6f8a46e7" - integrity sha512-ETHi4bxrYnvOtXeM7d4V4kZWixib2jddFacJjsOjwbgYSRsyXYtZHC4ht134OsslPIcnkqT+TKV4eU8rNBKyyQ== - -"@rollup/rollup-darwin-arm64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.0.tgz#6122dc37d4a09521d8abe18925956d3b46cfbac9" - integrity sha512-ZWgARzhSKE+gVUX7QWaECoRQsPwaD8ZR0Oxb3aUpzdErTvlEadfQpORPXkKSdKbFci9v8MJfkTtoEHnnW9Ulng== - -"@rollup/rollup-darwin-x64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.0.tgz#453f345899cbf544aa0d6f5808d24d2e42f605b7" - integrity sha512-h0ZAtOfHyio8Az6cwIGS+nHUfRMWBDO5jXB8PQCARVF6Na/G6XS2SFxDl8Oem+S5ZsHQgtsI7RT4JQnI1qrlaw== - -"@rollup/rollup-linux-arm-gnueabihf@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.0.tgz#3a32fa4e80a62a6d733014838b1123fe76b060fe" - integrity sha512-9pxQJSPwFsVi0ttOmqLY4JJ9pg9t1gKhK0JDbV1yUEETSx55fdyCjt39eBQ54OQCzAF0nVGO6LfEH1KnCPvelA== - -"@rollup/rollup-linux-arm-musleabihf@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.0.tgz#55d3953c54419e93efe124882a3103c8a2f65641" - integrity sha512-YJ5Ku5BmNJZb58A4qSEo3JlIG4d3G2lWyBi13ABlXzO41SsdnUKi3HQHe83VpwBVG4jHFTW65jOQb8qyoR+qzg== - -"@rollup/rollup-linux-arm64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.0.tgz#cd626963b9962baf8e09d792e67b87269a5bcfff" - integrity sha512-U4G4u7f+QCqHlVg1Nlx+qapZy+QoG+NV6ux+upo/T7arNGwKvKP2kmGM4W5QTbdewWFgudQxi3kDNST9GT1/mg== - -"@rollup/rollup-linux-arm64-musl@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.0.tgz#ad209270c9937a27346fce5b0670cbdfb1e6a0a6" - integrity sha512-aQpNlKmx3amwkA3a5J6nlXSahE1ijl0L9KuIjVOUhfOh7uw2S4piR3mtpxpRtbnK809SBtyPsM9q15CPTsY7HQ== - -"@rollup/rollup-linux-powerpc64le-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.0.tgz#fdd173929a5bba8b7e8b37314380213d9604088f" - integrity sha512-9fx6Zj/7vve/Fp4iexUFRKb5+RjLCff6YTRQl4CoDhdMfDoobWmhAxQWV3NfShMzQk1Q/iCnageFyGfqnsmeqQ== - -"@rollup/rollup-linux-riscv64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.0.tgz#90b11314fbf45d04083f658e08dc3b32fd713061" - integrity sha512-VWQiCcN7zBgZYLjndIEh5tamtnKg5TGxyZPWcN9zBtXBwfcGSZ5cHSdQZfQH/GB4uRxk0D3VYbOEe/chJhPGLQ== - -"@rollup/rollup-linux-s390x-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.0.tgz#46bb2f1135aeec646b720d6032d7c86915f8b2ec" - integrity sha512-EHmPnPWvyYqncObwqrosb/CpH3GOjE76vWVs0g4hWsDRUVhg61hBmlVg5TPXqF+g+PvIbqkC7i3h8wbn4Gp2Fg== - -"@rollup/rollup-linux-x64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.0.tgz#d731a19af5f05eabcba871bda2eeb2fa8c8adb67" - integrity sha512-tsSWy3YQzmpjDKnQ1Vcpy3p9Z+kMFbSIesCdMNgLizDWFhrLZIoN21JSq01g+MZMDFF+Y1+4zxgrlqPjid5ohg== - -"@rollup/rollup-linux-x64-musl@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.0.tgz#5438b2dc38fe467444cf769146098be083022d0f" - integrity sha512-anr1Y11uPOQrpuU8XOikY5lH4Qu94oS6j0xrulHk3NkLDq19MlX8Ng/pVipjxBJ9a2l3+F39REZYyWQFkZ4/fw== - -"@rollup/rollup-win32-arm64-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.0.tgz#6bd66c198f80c8e7050cfd901701cfb9555d768a" - integrity sha512-7LB+Bh+Ut7cfmO0m244/asvtIGQr5pG5Rvjz/l1Rnz1kDzM02pSX9jPaS0p+90H5I1x4d1FkCew+B7MOnoatNw== - -"@rollup/rollup-win32-ia32-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.0.tgz#58daea1f1e65143c44c8f3311f30ff8eefa62bae" - integrity sha512-+3qZ4rer7t/QsC5JwMpcvCVPRcJt1cJrYS/TMJZzXIJbxWFQEVhrIc26IhB+5Z9fT9umfVc+Es2mOZgl+7jdJQ== - -"@rollup/rollup-win32-x64-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.0.tgz#956948629f6b87de0bdf526b28d940221540bbb6" - integrity sha512-YdicNOSJONVx/vuPkgPTyRoAPx3GbknBZRCOUkK84FJ/YTfs/F0vl/YsMscrB6Y177d+yDRcj+JWMPMCgshwrA== +"@rollup/rollup-android-arm-eabi@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.2.tgz#4e0c4c462692ecb7ae2b008f25af4cced05ac4f9" + integrity sha512-8Ao+EDmTPjZ1ZBABc1ohN7Ylx7UIYcjReZinigedTOnGFhIctyGPxY2II+hJ6gD2/vkDKZTyQ0e7++kwv6wDrw== + +"@rollup/rollup-android-arm64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.2.tgz#d97ed02a950061adc2056d6d2d6df8f05d877ae9" + integrity sha512-I+B1v0a4iqdS9DvYt1RJZ3W+Oh9EVWjbY6gp79aAYipIbxSLEoQtFQlZEnUuwhDXCqMxJ3hluxKAdPD+GiluFQ== + +"@rollup/rollup-darwin-arm64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.2.tgz#06dec35316de9fe433d66c849ecc056e221ba422" + integrity sha512-BTHO7rR+LC67OP7I8N8GvdvnQqzFujJYWo7qCQ8fGdQcb8Gn6EQY+K1P+daQLnDCuWKbZ+gHAQZuKiQkXkqIYg== + +"@rollup/rollup-darwin-x64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.2.tgz#22ee27a0ccfdc045c2a37f6980351329516ce119" + integrity sha512-1esGwDNFe2lov4I6GsEeYaAMHwkqk0IbuGH7gXGdBmd/EP9QddJJvTtTF/jv+7R8ZTYPqwcdLpMTxK8ytP6k6Q== + +"@rollup/rollup-linux-arm-gnueabihf@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.2.tgz#d86df2d8c600ebdd7251110a3357c53e0a583ace" + integrity sha512-GBHuY07x96OTEM3OQLNaUSUwrOhdMea/LDmlFHi/HMonrgF6jcFrrFFwJhhe84XtA1oK/Qh4yFS+VMREf6dobg== + +"@rollup/rollup-linux-arm-musleabihf@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.2.tgz#a8b7b6a805356c8bd0409e4c5f56664d80a50aaa" + integrity sha512-Dbfa9Sc1G1lWxop0gNguXOfGhaXQWAGhZUcqA0Vs6CnJq8JW/YOw/KvyGtQFmz4yDr0H4v9X248SM7bizYj4yQ== + +"@rollup/rollup-linux-arm64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.2.tgz#766064021d2bfc42f13f4653f8870a9b8bbdc31d" + integrity sha512-Z1YpgBvFYhZIyBW5BoopwSg+t7yqEhs5HCei4JbsaXnhz/eZehT18DaXl957aaE9QK7TRGFryCAtStZywcQe1A== + +"@rollup/rollup-linux-arm64-musl@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.2.tgz#490f49236102b97738d9406eaf5cd8d9dad35c15" + integrity sha512-66Zszr7i/JaQ0u/lefcfaAw16wh3oT72vSqubIMQqWzOg85bGCPhoeykG/cC5uvMzH80DQa2L539IqKht6twVA== + +"@rollup/rollup-linux-powerpc64le-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.2.tgz#03a67f1476dd80f115ce35bc9b0d03c50c16679d" + integrity sha512-HpJCMnlMTfEhwo19bajvdraQMcAq3FX08QDx3OfQgb+414xZhKNf3jNvLFYKbbDSGBBrQh5yNwWZrdK0g0pokg== + +"@rollup/rollup-linux-riscv64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.2.tgz#d86e9b7b5b242652cd691c46d1939130c35cb68d" + integrity sha512-/egzQzbOSRef2vYCINKITGrlwkzP7uXRnL+xU2j75kDVp3iPdcF0TIlfwTRF8woBZllhk3QaxNOEj2Ogh3t9hg== + +"@rollup/rollup-linux-s390x-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.2.tgz#c8fca373bec6df8550b31b3dbb56e2b241bc8718" + integrity sha512-qgYbOEbrPfEkH/OnUJd1/q4s89FvNJQIUldx8X2F/UM5sEbtkqZpf2s0yly2jSCKr1zUUOY1hnTP2J1WOzMAdA== + +"@rollup/rollup-linux-x64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.2.tgz#be182ef761c9b0147496e647ace44fd1b912344f" + integrity sha512-a0lkvNhFLhf+w7A95XeBqGQaG0KfS3hPFJnz1uraSdUe/XImkp/Psq0Ca0/UdD5IEAGoENVmnYrzSC9Y2a2uKQ== + +"@rollup/rollup-linux-x64-musl@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.2.tgz#c280202d5b54d04f1e2b810359fe73c4973e8b72" + integrity sha512-sSWBVZgzwtsuG9Dxi9kjYOUu/wKW+jrbzj4Cclabqnfkot8Z3VEHcIgyenA3lLn/Fu11uDviWjhctulkhEO60g== + +"@rollup/rollup-win32-arm64-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.2.tgz#8ae561401b92acb8ca7a842ffadececb22a2247e" + integrity sha512-t/YgCbZ638R/r7IKb9yCM6nAek1RUvyNdfU0SHMDLOf6GFe/VG1wdiUAsxTWHKqjyzkRGg897ZfCpdo1bsCSsA== + +"@rollup/rollup-win32-ia32-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.2.tgz#c3a8b081595026eab9fccfe581624cb31af0d6f8" + integrity sha512-kTmX5uGs3WYOA+gYDgI6ITkZng9SP71FEMoHNkn+cnmb9Zuyyay8pf0oO5twtTwSjNGy1jlaWooTIr+Dw4tIbw== + +"@rollup/rollup-win32-x64-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.2.tgz#c770006ccc780b2de7b2151fc7f37b49121a21c1" + integrity sha512-Yy8So+SoRz8I3NS4Bjh91BICPOSVgdompTIPYTByUqU66AXSIOgmW3Lv1ke3NORPqxdF+RdrZET+8vYai6f4aA== "@shikijs/core@1.18.0": version "1.18.0" @@ -1653,9 +1653,9 @@ eastasianwidth@^0.2.0: integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== electron-to-chromium@^1.5.4: - version "1.5.25" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.25.tgz#492ade1cde401332b9b75aa0c55fd5e1550ca66c" - integrity sha512-kMb204zvK3PsSlgvvwzI3wBIcAw15tRkYk+NQdsjdDtcQWTp2RABbMQ9rUBy8KNEOM+/E6ep+XC3AykiWZld4g== + version "1.5.26" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.26.tgz#449b4fa90e83ab98abbe3b6a96c8ee395de94452" + integrity sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ== emmet@^2.4.3: version "2.4.8" @@ -3590,28 +3590,28 @@ reusify@^1.0.4: integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== rollup@^4.20.0: - version "4.22.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.22.0.tgz#23cd9e4565a458587683accc34a054660c01f351" - integrity sha512-W21MUIFPZ4+O2Je/EU+GP3iz7PH4pVPUXSbEZdatQnxo29+3rsUjgrJmzuAZU24z7yRAnFN6ukxeAhZh/c7hzg== + version "4.22.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.22.2.tgz#d762fa52c6ddb1307c1d6e8b463ba79432ffbb6b" + integrity sha512-JWWpTrZmqQGQWt16xvNn6KVIUz16VtZwl984TKw0dfqqRpFwtLJYYk1/4BTgplndMQKWUk/yB4uOShYmMzA2Vg== dependencies: "@types/estree" "1.0.5" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.22.0" - "@rollup/rollup-android-arm64" "4.22.0" - "@rollup/rollup-darwin-arm64" "4.22.0" - "@rollup/rollup-darwin-x64" "4.22.0" - "@rollup/rollup-linux-arm-gnueabihf" "4.22.0" - "@rollup/rollup-linux-arm-musleabihf" "4.22.0" - "@rollup/rollup-linux-arm64-gnu" "4.22.0" - "@rollup/rollup-linux-arm64-musl" "4.22.0" - "@rollup/rollup-linux-powerpc64le-gnu" "4.22.0" - "@rollup/rollup-linux-riscv64-gnu" "4.22.0" - "@rollup/rollup-linux-s390x-gnu" "4.22.0" - "@rollup/rollup-linux-x64-gnu" "4.22.0" - "@rollup/rollup-linux-x64-musl" "4.22.0" - "@rollup/rollup-win32-arm64-msvc" "4.22.0" - "@rollup/rollup-win32-ia32-msvc" "4.22.0" - "@rollup/rollup-win32-x64-msvc" "4.22.0" + "@rollup/rollup-android-arm-eabi" "4.22.2" + "@rollup/rollup-android-arm64" "4.22.2" + "@rollup/rollup-darwin-arm64" "4.22.2" + "@rollup/rollup-darwin-x64" "4.22.2" + "@rollup/rollup-linux-arm-gnueabihf" "4.22.2" + "@rollup/rollup-linux-arm-musleabihf" "4.22.2" + "@rollup/rollup-linux-arm64-gnu" "4.22.2" + "@rollup/rollup-linux-arm64-musl" "4.22.2" + "@rollup/rollup-linux-powerpc64le-gnu" "4.22.2" + "@rollup/rollup-linux-riscv64-gnu" "4.22.2" + "@rollup/rollup-linux-s390x-gnu" "4.22.2" + "@rollup/rollup-linux-x64-gnu" "4.22.2" + "@rollup/rollup-linux-x64-musl" "4.22.2" + "@rollup/rollup-win32-arm64-msvc" "4.22.2" + "@rollup/rollup-win32-ia32-msvc" "4.22.2" + "@rollup/rollup-win32-x64-msvc" "4.22.2" fsevents "~2.3.2" run-parallel@^1.1.9: diff --git a/packages/cli/package.json b/packages/cli/package.json index d4689a0584..fd7baac27d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -35,7 +35,7 @@ "@inquirer/prompts": "^6.0.1", "@lvce-editor/ripgrep": "^1.2.0", "dockerode": "^4.0.2", - "gpt-tokenizer": "^2.2.3", + "gpt-tokenizer": "^2.3.0", "jimp": "^1.6.0", "mammoth": "^1.8.0", "mathjs": "^13.1.1", @@ -52,7 +52,7 @@ "node": ">=20.0.0" }, "peerDependencies": { - "promptfoo": "0.82.0" + "promptfoo": "0.89.3" }, "devDependencies": { "@types/dockerode": "^3.3.31", diff --git a/packages/core/package.json b/packages/core/package.json index 0733d51605..4cfbfed10e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -38,7 +38,7 @@ "fetch-retry": "^6.0.0", "fflate": "^0.8.2", "file-type": "19.1.1", - "gpt-tokenizer": "^2.2.3", + "gpt-tokenizer": "^2.3.0", "html-escaper": "^3.0.3", "html-to-text": "^9.0.5", "ignore": "^6.0.2", diff --git a/slides/yarn.lock b/slides/yarn.lock index baaf4c5a29..209d74d5c4 100644 --- a/slides/yarn.lock +++ b/slides/yarn.lock @@ -775,85 +775,85 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.0.tgz#e8c16c336f060b4cb592f62eb4f0e543d79d51fe" - integrity sha512-/IZQvg6ZR0tAkEi4tdXOraQoWeJy9gbQ/cx4I7k9dJaCk9qrXEcdouxRVz5kZXt5C2bQ9pILoAA+KB4C/d3pfw== - -"@rollup/rollup-android-arm64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.0.tgz#7a44160a14017fa744912d7037c7d81d6f8a46e7" - integrity sha512-ETHi4bxrYnvOtXeM7d4V4kZWixib2jddFacJjsOjwbgYSRsyXYtZHC4ht134OsslPIcnkqT+TKV4eU8rNBKyyQ== - -"@rollup/rollup-darwin-arm64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.0.tgz#6122dc37d4a09521d8abe18925956d3b46cfbac9" - integrity sha512-ZWgARzhSKE+gVUX7QWaECoRQsPwaD8ZR0Oxb3aUpzdErTvlEadfQpORPXkKSdKbFci9v8MJfkTtoEHnnW9Ulng== - -"@rollup/rollup-darwin-x64@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.0.tgz#453f345899cbf544aa0d6f5808d24d2e42f605b7" - integrity sha512-h0ZAtOfHyio8Az6cwIGS+nHUfRMWBDO5jXB8PQCARVF6Na/G6XS2SFxDl8Oem+S5ZsHQgtsI7RT4JQnI1qrlaw== - -"@rollup/rollup-linux-arm-gnueabihf@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.0.tgz#3a32fa4e80a62a6d733014838b1123fe76b060fe" - integrity sha512-9pxQJSPwFsVi0ttOmqLY4JJ9pg9t1gKhK0JDbV1yUEETSx55fdyCjt39eBQ54OQCzAF0nVGO6LfEH1KnCPvelA== - -"@rollup/rollup-linux-arm-musleabihf@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.0.tgz#55d3953c54419e93efe124882a3103c8a2f65641" - integrity sha512-YJ5Ku5BmNJZb58A4qSEo3JlIG4d3G2lWyBi13ABlXzO41SsdnUKi3HQHe83VpwBVG4jHFTW65jOQb8qyoR+qzg== - -"@rollup/rollup-linux-arm64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.0.tgz#cd626963b9962baf8e09d792e67b87269a5bcfff" - integrity sha512-U4G4u7f+QCqHlVg1Nlx+qapZy+QoG+NV6ux+upo/T7arNGwKvKP2kmGM4W5QTbdewWFgudQxi3kDNST9GT1/mg== - -"@rollup/rollup-linux-arm64-musl@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.0.tgz#ad209270c9937a27346fce5b0670cbdfb1e6a0a6" - integrity sha512-aQpNlKmx3amwkA3a5J6nlXSahE1ijl0L9KuIjVOUhfOh7uw2S4piR3mtpxpRtbnK809SBtyPsM9q15CPTsY7HQ== - -"@rollup/rollup-linux-powerpc64le-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.0.tgz#fdd173929a5bba8b7e8b37314380213d9604088f" - integrity sha512-9fx6Zj/7vve/Fp4iexUFRKb5+RjLCff6YTRQl4CoDhdMfDoobWmhAxQWV3NfShMzQk1Q/iCnageFyGfqnsmeqQ== - -"@rollup/rollup-linux-riscv64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.0.tgz#90b11314fbf45d04083f658e08dc3b32fd713061" - integrity sha512-VWQiCcN7zBgZYLjndIEh5tamtnKg5TGxyZPWcN9zBtXBwfcGSZ5cHSdQZfQH/GB4uRxk0D3VYbOEe/chJhPGLQ== - -"@rollup/rollup-linux-s390x-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.0.tgz#46bb2f1135aeec646b720d6032d7c86915f8b2ec" - integrity sha512-EHmPnPWvyYqncObwqrosb/CpH3GOjE76vWVs0g4hWsDRUVhg61hBmlVg5TPXqF+g+PvIbqkC7i3h8wbn4Gp2Fg== - -"@rollup/rollup-linux-x64-gnu@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.0.tgz#d731a19af5f05eabcba871bda2eeb2fa8c8adb67" - integrity sha512-tsSWy3YQzmpjDKnQ1Vcpy3p9Z+kMFbSIesCdMNgLizDWFhrLZIoN21JSq01g+MZMDFF+Y1+4zxgrlqPjid5ohg== - -"@rollup/rollup-linux-x64-musl@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.0.tgz#5438b2dc38fe467444cf769146098be083022d0f" - integrity sha512-anr1Y11uPOQrpuU8XOikY5lH4Qu94oS6j0xrulHk3NkLDq19MlX8Ng/pVipjxBJ9a2l3+F39REZYyWQFkZ4/fw== - -"@rollup/rollup-win32-arm64-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.0.tgz#6bd66c198f80c8e7050cfd901701cfb9555d768a" - integrity sha512-7LB+Bh+Ut7cfmO0m244/asvtIGQr5pG5Rvjz/l1Rnz1kDzM02pSX9jPaS0p+90H5I1x4d1FkCew+B7MOnoatNw== - -"@rollup/rollup-win32-ia32-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.0.tgz#58daea1f1e65143c44c8f3311f30ff8eefa62bae" - integrity sha512-+3qZ4rer7t/QsC5JwMpcvCVPRcJt1cJrYS/TMJZzXIJbxWFQEVhrIc26IhB+5Z9fT9umfVc+Es2mOZgl+7jdJQ== - -"@rollup/rollup-win32-x64-msvc@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.0.tgz#956948629f6b87de0bdf526b28d940221540bbb6" - integrity sha512-YdicNOSJONVx/vuPkgPTyRoAPx3GbknBZRCOUkK84FJ/YTfs/F0vl/YsMscrB6Y177d+yDRcj+JWMPMCgshwrA== +"@rollup/rollup-android-arm-eabi@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.2.tgz#4e0c4c462692ecb7ae2b008f25af4cced05ac4f9" + integrity sha512-8Ao+EDmTPjZ1ZBABc1ohN7Ylx7UIYcjReZinigedTOnGFhIctyGPxY2II+hJ6gD2/vkDKZTyQ0e7++kwv6wDrw== + +"@rollup/rollup-android-arm64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.2.tgz#d97ed02a950061adc2056d6d2d6df8f05d877ae9" + integrity sha512-I+B1v0a4iqdS9DvYt1RJZ3W+Oh9EVWjbY6gp79aAYipIbxSLEoQtFQlZEnUuwhDXCqMxJ3hluxKAdPD+GiluFQ== + +"@rollup/rollup-darwin-arm64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.2.tgz#06dec35316de9fe433d66c849ecc056e221ba422" + integrity sha512-BTHO7rR+LC67OP7I8N8GvdvnQqzFujJYWo7qCQ8fGdQcb8Gn6EQY+K1P+daQLnDCuWKbZ+gHAQZuKiQkXkqIYg== + +"@rollup/rollup-darwin-x64@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.2.tgz#22ee27a0ccfdc045c2a37f6980351329516ce119" + integrity sha512-1esGwDNFe2lov4I6GsEeYaAMHwkqk0IbuGH7gXGdBmd/EP9QddJJvTtTF/jv+7R8ZTYPqwcdLpMTxK8ytP6k6Q== + +"@rollup/rollup-linux-arm-gnueabihf@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.2.tgz#d86df2d8c600ebdd7251110a3357c53e0a583ace" + integrity sha512-GBHuY07x96OTEM3OQLNaUSUwrOhdMea/LDmlFHi/HMonrgF6jcFrrFFwJhhe84XtA1oK/Qh4yFS+VMREf6dobg== + +"@rollup/rollup-linux-arm-musleabihf@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.2.tgz#a8b7b6a805356c8bd0409e4c5f56664d80a50aaa" + integrity sha512-Dbfa9Sc1G1lWxop0gNguXOfGhaXQWAGhZUcqA0Vs6CnJq8JW/YOw/KvyGtQFmz4yDr0H4v9X248SM7bizYj4yQ== + +"@rollup/rollup-linux-arm64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.2.tgz#766064021d2bfc42f13f4653f8870a9b8bbdc31d" + integrity sha512-Z1YpgBvFYhZIyBW5BoopwSg+t7yqEhs5HCei4JbsaXnhz/eZehT18DaXl957aaE9QK7TRGFryCAtStZywcQe1A== + +"@rollup/rollup-linux-arm64-musl@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.2.tgz#490f49236102b97738d9406eaf5cd8d9dad35c15" + integrity sha512-66Zszr7i/JaQ0u/lefcfaAw16wh3oT72vSqubIMQqWzOg85bGCPhoeykG/cC5uvMzH80DQa2L539IqKht6twVA== + +"@rollup/rollup-linux-powerpc64le-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.2.tgz#03a67f1476dd80f115ce35bc9b0d03c50c16679d" + integrity sha512-HpJCMnlMTfEhwo19bajvdraQMcAq3FX08QDx3OfQgb+414xZhKNf3jNvLFYKbbDSGBBrQh5yNwWZrdK0g0pokg== + +"@rollup/rollup-linux-riscv64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.2.tgz#d86e9b7b5b242652cd691c46d1939130c35cb68d" + integrity sha512-/egzQzbOSRef2vYCINKITGrlwkzP7uXRnL+xU2j75kDVp3iPdcF0TIlfwTRF8woBZllhk3QaxNOEj2Ogh3t9hg== + +"@rollup/rollup-linux-s390x-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.2.tgz#c8fca373bec6df8550b31b3dbb56e2b241bc8718" + integrity sha512-qgYbOEbrPfEkH/OnUJd1/q4s89FvNJQIUldx8X2F/UM5sEbtkqZpf2s0yly2jSCKr1zUUOY1hnTP2J1WOzMAdA== + +"@rollup/rollup-linux-x64-gnu@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.2.tgz#be182ef761c9b0147496e647ace44fd1b912344f" + integrity sha512-a0lkvNhFLhf+w7A95XeBqGQaG0KfS3hPFJnz1uraSdUe/XImkp/Psq0Ca0/UdD5IEAGoENVmnYrzSC9Y2a2uKQ== + +"@rollup/rollup-linux-x64-musl@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.2.tgz#c280202d5b54d04f1e2b810359fe73c4973e8b72" + integrity sha512-sSWBVZgzwtsuG9Dxi9kjYOUu/wKW+jrbzj4Cclabqnfkot8Z3VEHcIgyenA3lLn/Fu11uDviWjhctulkhEO60g== + +"@rollup/rollup-win32-arm64-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.2.tgz#8ae561401b92acb8ca7a842ffadececb22a2247e" + integrity sha512-t/YgCbZ638R/r7IKb9yCM6nAek1RUvyNdfU0SHMDLOf6GFe/VG1wdiUAsxTWHKqjyzkRGg897ZfCpdo1bsCSsA== + +"@rollup/rollup-win32-ia32-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.2.tgz#c3a8b081595026eab9fccfe581624cb31af0d6f8" + integrity sha512-kTmX5uGs3WYOA+gYDgI6ITkZng9SP71FEMoHNkn+cnmb9Zuyyay8pf0oO5twtTwSjNGy1jlaWooTIr+Dw4tIbw== + +"@rollup/rollup-win32-x64-msvc@4.22.2": + version "4.22.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.2.tgz#c770006ccc780b2de7b2151fc7f37b49121a21c1" + integrity sha512-Yy8So+SoRz8I3NS4Bjh91BICPOSVgdompTIPYTByUqU66AXSIOgmW3Lv1ke3NORPqxdF+RdrZET+8vYai6f4aA== "@shikijs/core@1.18.0": version "1.18.0" @@ -2569,9 +2569,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.5.4: - version "1.5.25" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.25.tgz#492ade1cde401332b9b75aa0c55fd5e1550ca66c" - integrity sha512-kMb204zvK3PsSlgvvwzI3wBIcAw15tRkYk+NQdsjdDtcQWTp2RABbMQ9rUBy8KNEOM+/E6ep+XC3AykiWZld4g== + version "1.5.26" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.26.tgz#449b4fa90e83ab98abbe3b6a96c8ee395de94452" + integrity sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ== emoji-regex@^8.0.0: version "8.0.0" @@ -4315,28 +4315,28 @@ robust-predicates@^3.0.2: integrity sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg== rollup@^4.20.0: - version "4.22.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.22.0.tgz#23cd9e4565a458587683accc34a054660c01f351" - integrity sha512-W21MUIFPZ4+O2Je/EU+GP3iz7PH4pVPUXSbEZdatQnxo29+3rsUjgrJmzuAZU24z7yRAnFN6ukxeAhZh/c7hzg== + version "4.22.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.22.2.tgz#d762fa52c6ddb1307c1d6e8b463ba79432ffbb6b" + integrity sha512-JWWpTrZmqQGQWt16xvNn6KVIUz16VtZwl984TKw0dfqqRpFwtLJYYk1/4BTgplndMQKWUk/yB4uOShYmMzA2Vg== dependencies: "@types/estree" "1.0.5" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.22.0" - "@rollup/rollup-android-arm64" "4.22.0" - "@rollup/rollup-darwin-arm64" "4.22.0" - "@rollup/rollup-darwin-x64" "4.22.0" - "@rollup/rollup-linux-arm-gnueabihf" "4.22.0" - "@rollup/rollup-linux-arm-musleabihf" "4.22.0" - "@rollup/rollup-linux-arm64-gnu" "4.22.0" - "@rollup/rollup-linux-arm64-musl" "4.22.0" - "@rollup/rollup-linux-powerpc64le-gnu" "4.22.0" - "@rollup/rollup-linux-riscv64-gnu" "4.22.0" - "@rollup/rollup-linux-s390x-gnu" "4.22.0" - "@rollup/rollup-linux-x64-gnu" "4.22.0" - "@rollup/rollup-linux-x64-musl" "4.22.0" - "@rollup/rollup-win32-arm64-msvc" "4.22.0" - "@rollup/rollup-win32-ia32-msvc" "4.22.0" - "@rollup/rollup-win32-x64-msvc" "4.22.0" + "@rollup/rollup-android-arm-eabi" "4.22.2" + "@rollup/rollup-android-arm64" "4.22.2" + "@rollup/rollup-darwin-arm64" "4.22.2" + "@rollup/rollup-darwin-x64" "4.22.2" + "@rollup/rollup-linux-arm-gnueabihf" "4.22.2" + "@rollup/rollup-linux-arm-musleabihf" "4.22.2" + "@rollup/rollup-linux-arm64-gnu" "4.22.2" + "@rollup/rollup-linux-arm64-musl" "4.22.2" + "@rollup/rollup-linux-powerpc64le-gnu" "4.22.2" + "@rollup/rollup-linux-riscv64-gnu" "4.22.2" + "@rollup/rollup-linux-s390x-gnu" "4.22.2" + "@rollup/rollup-linux-x64-gnu" "4.22.2" + "@rollup/rollup-linux-x64-musl" "4.22.2" + "@rollup/rollup-win32-arm64-msvc" "4.22.2" + "@rollup/rollup-win32-ia32-msvc" "4.22.2" + "@rollup/rollup-win32-x64-msvc" "4.22.2" fsevents "~2.3.2" roughjs@^4.6.6: diff --git a/yarn.lock b/yarn.lock index aa7e49e93d..0a98e31aa0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -164,23 +164,23 @@ tslib "^2.6.2" "@azure/msal-browser@^3.14.0": - version "3.23.0" - resolved "https://registry.yarnpkg.com/@azure/msal-browser/-/msal-browser-3.23.0.tgz#446aaf268247e5943f464f007d3aa3a04abfe95b" - integrity sha512-+QgdMvaeEpdtgRTD7AHHq9aw8uga7mXVHV1KshO1RQ2uI5B55xJ4aEpGlg/ga3H+0arEVcRfT4ZVmX7QLXiCVw== + version "3.24.0" + resolved "https://registry.yarnpkg.com/@azure/msal-browser/-/msal-browser-3.24.0.tgz#3208047672d0b0c943b0bef5f995d510d6582ae4" + integrity sha512-JGNV9hTYAa7lsum9IMIibn2kKczAojNihGo1hi7pG0kNrcKej530Fl6jxwM05A44/6I079CSn6WxYxbVhKUmWg== dependencies: - "@azure/msal-common" "14.14.2" + "@azure/msal-common" "14.15.0" -"@azure/msal-common@14.14.2": - version "14.14.2" - resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-14.14.2.tgz#583b4ac9c089953718d7a5e2f3b8df2d4dbb17f4" - integrity sha512-XV0P5kSNwDwCA/SjIxTe9mEAsKB0NqGNSuaVrkCCE2lAyBr/D6YtD80Vkdp4tjWnPFwjzkwldjr1xU/facOJog== +"@azure/msal-common@14.15.0": + version "14.15.0" + resolved "https://registry.yarnpkg.com/@azure/msal-common/-/msal-common-14.15.0.tgz#0e27ac0bb88fe100f4f8d1605b64d5c268636a55" + integrity sha512-ImAQHxmpMneJ/4S8BRFhjt1MZ3bppmpRPYYNyzeQPeFN288YKbb8TmmISQEbtfkQ1BPASvYZU5doIZOPBAqENQ== "@azure/msal-node@^2.9.2": - version "2.13.1" - resolved "https://registry.yarnpkg.com/@azure/msal-node/-/msal-node-2.13.1.tgz#f144371275b7c3cbe564762b84772a9732457a47" - integrity sha512-sijfzPNorKt6+9g1/miHwhj6Iapff4mPQx1azmmZExgzUROqWTM1o3ACyxDja0g47VpowFy/sxTM/WsuCyXTiw== + version "2.14.0" + resolved "https://registry.yarnpkg.com/@azure/msal-node/-/msal-node-2.14.0.tgz#7881895d41b03d8b9b38a29550ba3bbb15f73b3c" + integrity sha512-rrfzIpG3Q1rHjVYZmHAEDidWAZZ2cgkxlIcMQ8dHebRISaZ2KCV33Q8Vs+uaV6lxweROabNxKFlR2lIKagZqYg== dependencies: - "@azure/msal-common" "14.14.2" + "@azure/msal-common" "14.15.0" jsonwebtoken "^9.0.0" uuid "^8.3.0" @@ -2924,12 +2924,10 @@ gpt-3-encoder@1.1.4: resolved "https://registry.yarnpkg.com/gpt-3-encoder/-/gpt-3-encoder-1.1.4.tgz#d6cdaacf5824857e133b6065247c757fc7e4fa72" integrity sha512-fSQRePV+HUAhCn7+7HL7lNIXNm6eaFWFbNLOOGtmSJ0qJycyQvj60OvRlH7mee8xAMjBDNRdMXlMwjAbMTDjkg== -gpt-tokenizer@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/gpt-tokenizer/-/gpt-tokenizer-2.2.3.tgz#97ce5505f151eb2eff2f6c2a37b0fe6d9f09df36" - integrity sha512-EOHvuE+J/sDw36QSWYX3d9fypAPMDvevi/W2XW0Bh+n76Iq3yHuNMHXXe5VmSQfcxIC9CVqyZgPOSxgjgAyQtQ== - dependencies: - rfc4648 "^1.5.3" +gpt-tokenizer@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/gpt-tokenizer/-/gpt-tokenizer-2.3.0.tgz#a500f90a69be35a6d290b7a8094b9293e0b0d43b" + integrity sha512-hmY2ECvld67c0j9MCjSN98lQmRdLQV8S3OkpLwOLlqgTqm0ALCzcUjgdMYrthDPS5eGP7qwVpcH+EQ4R9PsCFQ== graceful-fs@^4.1.6, graceful-fs@^4.2.0: version "4.2.11" @@ -4818,11 +4816,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rfc4648@^1.5.3: - version "1.5.3" - resolved "https://registry.yarnpkg.com/rfc4648/-/rfc4648-1.5.3.tgz#e62b81736c10361ca614efe618a566e93d0b41c0" - integrity sha512-MjOWxM065+WswwnmNONOT+bD1nXzY9Km6u3kzvnx8F8/HXGZdz3T6e6vZJ8Q/RIMUSp/nxqjH3GwvJDy8ijeQQ== - rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" From 46f8676b0c82180afa085d9fafe50d5883075c09 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:05:43 +0000 Subject: [PATCH 05/12] Add defaultBranch parameter to pr-describe.genai.js configuration --- packages/sample/genaisrc/pr-describe.genai.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/sample/genaisrc/pr-describe.genai.js b/packages/sample/genaisrc/pr-describe.genai.js index d0f41690df..5525731ebd 100644 --- a/packages/sample/genaisrc/pr-describe.genai.js +++ b/packages/sample/genaisrc/pr-describe.genai.js @@ -4,9 +4,16 @@ script({ temperature: 1, title: "pr-describe", system: ["system", "system.fs_find_files", "system.fs_read_file"], + parameters: { + defaultBranch: { + type: "string", + description: "The default branch of the repository", + default: "main", + } + } }) -const defaultBranch = (env.vars.defaultBranch || "main") + "" +const defaultBranch = env.vars.defaultBranch const { stdout: changes } = await host.exec("git", [ "diff", defaultBranch, From af70785d1466ed1bcf228d3ab727d820510d283b Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:12:14 +0000 Subject: [PATCH 06/12] Update settings, improve PR description handling, and fix shell parsing logic --- .vscode/settings.json | 2 ++ packages/cli/src/run.ts | 8 +++++--- packages/core/src/shell.ts | 5 +++-- packages/sample/genaisrc/pr-describe.genai.js | 5 +++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b26e904bf4..93895e7332 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "devicescript.devtools.autoStart": false, "cSpell.words": [ + "adoinfo", "Agentic", "AICI", "arrayify", @@ -22,6 +23,7 @@ "genai", "Genaiscript", "genaisrc", + "ghinfo", "gpspec", "gpspecs", "gptool", diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index f2e3cdd6db..800c5006c0 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -465,7 +465,7 @@ export async function runScript( } if (pullRequestDescription && result.text) { - // github + // github action const ghinfo = githubParseEnv(process.env) if (ghinfo?.repository && ghinfo?.issue) { await githubUpdatePullRequestDescription( @@ -477,7 +477,7 @@ export async function runScript( : script.id ) } else { - // azure devops + // azure devops pipeline const adoinfo = azureDevOpsParseEnv(process.env) if (adoinfo?.collectionUri) { await azureDevOpsUpdatePullRequestDescription( @@ -489,8 +489,10 @@ export async function runScript( : script.id ) } else { + // try github gh cli + logError( - "pull request review: no pull request information found" + "pull request description: no pull request information found" ) } } diff --git a/packages/core/src/shell.ts b/packages/core/src/shell.ts index 058bc6946b..d776ec871c 100644 --- a/packages/core/src/shell.ts +++ b/packages/core/src/shell.ts @@ -1,8 +1,8 @@ import { parse, quote } from "shell-quote" export function shellParse(cmd: string): string[] { - const res = parse(cmd) - return res + const args = parse(cmd) + const res = args .filter((e) => !(e as any).comment) .map((e) => typeof e === "string" @@ -11,6 +11,7 @@ export function shellParse(cmd: string): string[] { ? (e as any).pattern : (e as any).op ) + return res } export function shellQuote(args: string[]): string { diff --git a/packages/sample/genaisrc/pr-describe.genai.js b/packages/sample/genaisrc/pr-describe.genai.js index 5525731ebd..8c46016bc0 100644 --- a/packages/sample/genaisrc/pr-describe.genai.js +++ b/packages/sample/genaisrc/pr-describe.genai.js @@ -9,14 +9,15 @@ script({ type: "string", description: "The default branch of the repository", default: "main", - } - } + }, + }, }) const defaultBranch = env.vars.defaultBranch const { stdout: changes } = await host.exec("git", [ "diff", defaultBranch, + "--cached", "--", ".", ":!**/genaiscript.d.ts", From a57b972bc429c26a75fb2babcc6a0af85277f09b Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:35:19 +0000 Subject: [PATCH 07/12] Add GitHub CLI support for querying environment and updating PR descriptions --- packages/cli/src/run.ts | 20 +++++++++++--- packages/core/src/github.ts | 54 +++++++++++++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 800c5006c0..74f6b9a910 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -13,6 +13,7 @@ import { githubCreatePullRequestReviews, githubUpdatePullRequestDescription, githubParseEnv, + githubQueryEnvUsingCli, } from "../../core/src/github" import { HTTPS_REGEX, @@ -490,10 +491,21 @@ export async function runScript( ) } else { // try github gh cli - - logError( - "pull request description: no pull request information found" - ) + const ghcliinfo = await githubQueryEnvUsingCli(process.env) + if (ghcliinfo?.repository && ghcliinfo?.issue) { + await githubUpdatePullRequestDescription( + script, + ghcliinfo, + result.text, + typeof pullRequestDescription === "string" + ? pullRequestDescription + : script.id + ) + } else { + logError( + "pull request description: no pull request information found" + ) + } } } } diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index 92f264b783..e0fb877883 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -1,4 +1,3 @@ -import { assert } from "node:console" import { GITHUB_API_VERSION, GITHUB_PULL_REQUEST_REVIEW_COMMENT_LINE_DISTANCE, @@ -7,7 +6,7 @@ import { import { createFetch } from "./fetch" import { runtimeHost } from "./host" import { link, prettifyMarkdown } from "./markdown" -import { logError, logVerbose, normalizeInt } from "./util" +import { assert, logError, logVerbose, normalizeInt } from "./util" export interface GithubConnectionInfo { token: string @@ -59,15 +58,60 @@ export function githubParseEnv( } } +export async function githubQueryEnvUsingCli( + env: Record +): Promise< + Pick +> { + try { + const res = githubParseEnv(env) + if (!res.owner || !res.repo || !res.repository) { + const { name: repo, owner } = JSON.parse( + ( + await runtimeHost.exec( + undefined, + "gh", + ["repo", "view", "--json", "url,name,owner"], + {} + ) + ).stdout + ) + res.repo = repo + res.owner = owner.login + res.repository = res.owner + "/" + res.repo + } + if (!res.issue) { + const { number: issue } = JSON.parse( + ( + await runtimeHost.exec( + undefined, + "gh", + ["pr", "view", "--json", "number"], + {} + ) + ).stdout + ) + if (!isNaN(issue)) res.issue = issue + } + return res + } catch (e) { + logVerbose("github query failed") + return undefined + } +} + // https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request export async function githubUpdatePullRequestDescription( script: PromptScript, - info: GithubConnectionInfo, + info: Pick< + GithubConnectionInfo, + "apiUrl" | "repository" | "issue" | "runUrl" + >, text: string, commentTag: string ) { const { apiUrl, repository, issue } = info - assert(commentTag) + assert(!!commentTag) if (!issue) return { updated: false, statusText: "missing issue number" } const token = await runtimeHost.readSecret(GITHUB_TOKEN) @@ -243,7 +287,7 @@ async function githubCreatePullRequestReview( annotation: Diagnostic, existingComments: { id: string; path: string; line: number; body: string }[] ) { - assert(token) + assert(!!token) const { apiUrl, repository, issue, commitSha } = info const prettyMessage = prettifyMarkdown(annotation.message) From 419d19e66bafc139c0562f2d12b44f1ee0dfa8e0 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:56:35 +0000 Subject: [PATCH 08/12] Make environment parsing asynchronous and update vscode settings. --- .vscode/settings.json | 2 ++ packages/cli/src/run.ts | 39 ++++++++++++-------------------- packages/core/src/azuredevops.ts | 4 ++-- packages/core/src/github.ts | 21 ++++++----------- 4 files changed, 25 insertions(+), 41 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 93895e7332..705f646724 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,6 +23,7 @@ "genai", "Genaiscript", "genaisrc", + "ghcliinfo", "ghinfo", "gpspec", "gpspecs", @@ -47,6 +48,7 @@ "pelikhan", "promptdom", "promptfoo", + "promptjson", "prompty", "quoteify", "socketserver", diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 74f6b9a910..46a8688d6c 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -426,7 +426,8 @@ export async function runScript( } if (pullRequestReviews && result.annotations?.length) { - const info = githubParseEnv(process.env) + // github action or repo + const info = await githubParseEnv(process.env) if (info.repository && info.issue) { await githubCreatePullRequestReviews( script, @@ -437,7 +438,8 @@ export async function runScript( } if (pullRequestComment && result.text) { - const info = githubParseEnv(process.env) + // github action or repo + const info = await githubParseEnv(process.env) if (info.repository && info.issue) { await githubCreateIssueComment( script, @@ -448,8 +450,8 @@ export async function runScript( : script.id ) } else { - const adoinfo = azureDevOpsParseEnv(process.env) - if (adoinfo?.collectionUri) { + const adoinfo = await azureDevOpsParseEnv(process.env) + if (adoinfo.collectionUri) { await azureDevOpsCreateIssueComment( script, adoinfo, @@ -466,9 +468,9 @@ export async function runScript( } if (pullRequestDescription && result.text) { - // github action - const ghinfo = githubParseEnv(process.env) - if (ghinfo?.repository && ghinfo?.issue) { + // github action or repo + const ghinfo = await githubParseEnv(process.env) + if (ghinfo.repository && ghinfo.issue) { await githubUpdatePullRequestDescription( script, ghinfo, @@ -479,8 +481,8 @@ export async function runScript( ) } else { // azure devops pipeline - const adoinfo = azureDevOpsParseEnv(process.env) - if (adoinfo?.collectionUri) { + const adoinfo = await azureDevOpsParseEnv(process.env) + if (adoinfo.collectionUri) { await azureDevOpsUpdatePullRequestDescription( script, adoinfo, @@ -490,22 +492,9 @@ export async function runScript( : script.id ) } else { - // try github gh cli - const ghcliinfo = await githubQueryEnvUsingCli(process.env) - if (ghcliinfo?.repository && ghcliinfo?.issue) { - await githubUpdatePullRequestDescription( - script, - ghcliinfo, - result.text, - typeof pullRequestDescription === "string" - ? pullRequestDescription - : script.id - ) - } else { - logError( - "pull request description: no pull request information found" - ) - } + logError( + "pull request description: no pull request information found" + ) } } } diff --git a/packages/core/src/azuredevops.ts b/packages/core/src/azuredevops.ts index c18915d70d..174a9fa031 100644 --- a/packages/core/src/azuredevops.ts +++ b/packages/core/src/azuredevops.ts @@ -16,9 +16,9 @@ export interface AzureDevOpsEnv { } // https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml -export function azureDevOpsParseEnv( +export async function azureDevOpsParseEnv( env: Record -): AzureDevOpsEnv { +): Promise { const fork = env.SYSTEM_PULLREQUEST_ISFORK !== "False" const accessToken = env.SYSTEM_ACCESSTOKEN const collectionUri = env.SYSTEM_COLLECTIONURI // https://dev.azure.com/msresearch/ diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index e0fb877883..cf2c0df4f9 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -22,9 +22,7 @@ export interface GithubConnectionInfo { commitSha?: string } -export function githubParseEnv( - env: Record -): GithubConnectionInfo { +function githubFromEnv(env: Record): GithubConnectionInfo { const token = env.GITHUB_TOKEN const apiUrl = env.GITHUB_API_URL || "https://api.github.com" const repository = env.GITHUB_REPOSITORY @@ -58,13 +56,11 @@ export function githubParseEnv( } } -export async function githubQueryEnvUsingCli( +export async function githubParseEnv( env: Record -): Promise< - Pick -> { +): Promise { + const res = githubFromEnv(env) try { - const res = githubParseEnv(env) if (!res.owner || !res.repo || !res.repository) { const { name: repo, owner } = JSON.parse( ( @@ -93,11 +89,8 @@ export async function githubQueryEnvUsingCli( ) if (!isNaN(issue)) res.issue = issue } - return res - } catch (e) { - logVerbose("github query failed") - return undefined - } + } catch (e) {} + return res } // https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request @@ -163,7 +156,7 @@ export function mergeDescription( text: string ) { body = body ?? "" - const tag = `` + const tag = `
` const endTag = `` const sep = "\n\n" From 7024e6eab832420bb658e64db9f9f47a1070552f Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 14:57:33 +0000 Subject: [PATCH 09/12] Remove horizontal rule tags from GitHub script comments --- packages/core/src/github.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index cf2c0df4f9..61256f91ea 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -156,7 +156,7 @@ export function mergeDescription( text: string ) { body = body ?? "" - const tag = `
` + const tag = `` const endTag = `` const sep = "\n\n" @@ -190,7 +190,7 @@ export function appendGeneratedComment( ) { const { message, code, severity } = annotation return prettifyMarkdown( - ` + `
${message} ${generatedByFooter(script, info, code)}` ) From 6374bacb5972cfe8118592a9012a788e70af2bad Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 15:04:08 +0000 Subject: [PATCH 10/12] Remove unused import and update markdown formatting in GitHub functions --- packages/cli/src/run.ts | 1 - packages/core/src/github.ts | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 46a8688d6c..b885e62758 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -13,7 +13,6 @@ import { githubCreatePullRequestReviews, githubUpdatePullRequestDescription, githubParseEnv, - githubQueryEnvUsingCli, } from "../../core/src/github" import { HTTPS_REGEX, diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index 61256f91ea..3131bd3408 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -162,15 +162,17 @@ export function mergeDescription( const start = body.indexOf(tag) const end = body.indexOf(endTag) + const header = "
" if (start > -1 && end > -1 && start < end) { body = body.slice(0, start + tag.length) + + header + sep + text + sep + body.slice(end) } else { - body = body + sep + tag + sep + text + sep + endTag + sep + body = body + sep + tag + header + sep + text + sep + endTag + sep } return body } @@ -190,7 +192,7 @@ export function appendGeneratedComment( ) { const { message, code, severity } = annotation return prettifyMarkdown( - `
+ ` ${message} ${generatedByFooter(script, info, code)}` ) From 978b6557213992a167776c85b34d0764f95eb573 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 15:12:14 +0000 Subject: [PATCH 11/12] Ensure commit SHA is required for PR reviews and refactor GitHub connection info usage --- packages/cli/src/run.ts | 2 +- packages/core/src/github.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index b885e62758..74c4007d98 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -427,7 +427,7 @@ export async function runScript( if (pullRequestReviews && result.annotations?.length) { // github action or repo const info = await githubParseEnv(process.env) - if (info.repository && info.issue) { + if (info.repository && info.issue && info.commitSha) { await githubCreatePullRequestReviews( script, info, diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index 3131bd3408..bfe8b44ecc 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -201,7 +201,10 @@ ${generatedByFooter(script, info, code)}` // https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment export async function githubCreateIssueComment( script: PromptScript, - info: GithubConnectionInfo, + info: Pick< + GithubConnectionInfo, + "apiUrl" | "repository" | "issue" | "runUrl" + >, body: string, commentTag: string ): Promise<{ created: boolean; statusText: string; html_url?: string }> { @@ -277,7 +280,10 @@ export async function githubCreateIssueComment( async function githubCreatePullRequestReview( script: PromptScript, - info: GithubConnectionInfo, + info: Pick< + GithubConnectionInfo, + "apiUrl" | "repository" | "issue" | "runUrl" | "commitSha" + >, token: string, annotation: Diagnostic, existingComments: { id: string; path: string; line: number; body: string }[] @@ -338,17 +344,20 @@ async function githubCreatePullRequestReview( export async function githubCreatePullRequestReviews( script: PromptScript, - info: GithubConnectionInfo, + info: Pick< + GithubConnectionInfo, + "apiUrl" | "repository" | "issue" | "runUrl" | "commitSha" + >, annotations: Diagnostic[] ): Promise { - const { repository, issue, sha, apiUrl } = info + const { repository, issue, commitSha, apiUrl } = info if (!annotations?.length) return true if (!issue) { logError("missing pull request number") return false } - if (!sha) { + if (!commitSha) { logError("missing commit sha") return false } From 41ace059b54ef9c011d36a52183f8a11ceeecabb Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 20 Sep 2024 15:26:24 +0000 Subject: [PATCH 12/12] Add documentation and script for generating pull request descriptions with GenAI --- .../docs/reference/vscode/samples/prd.mdx | 102 ++++++++++++++++++ packages/vscode/genaisrc/prd.genai.mts | 53 +++++++++ 2 files changed, 155 insertions(+) create mode 100644 docs/src/content/docs/reference/vscode/samples/prd.mdx create mode 100644 packages/vscode/genaisrc/prd.genai.mts diff --git a/docs/src/content/docs/reference/vscode/samples/prd.mdx b/docs/src/content/docs/reference/vscode/samples/prd.mdx new file mode 100644 index 0000000000..4fbe0e5287 --- /dev/null +++ b/docs/src/content/docs/reference/vscode/samples/prd.mdx @@ -0,0 +1,102 @@ +--- +title: "Pull Request Descriptor" +keywords: ["GenAI", "pull request", "software development", "git"] +--- + +import { Code } from "@astrojs/starlight/components" +import source from "../../../../../../../packages/vscode/genaisrc/prd.genai.mts?raw" + +Pull requests are an integral part of collaborative software development. They allow developers to review code changes before merging them into the main codebase. Creating informative and concise pull request descriptions can be a time-consuming task, especially when dealing with large or complex changes. This is where GenAI comes in, streamlining the process with a smart script that generates pull request descriptions automatically. 🚀 + +### Script Metadata + +```ts +script({ + title: "Pull Request Descriptor", + description: "Generate a pull request description from the git diff", + tools: ["fs"], + temperature: 0.5, + parameters: { + defaultBranch: { + type: "string", + description: "The default branch of the repository", + default: "main", + }, + }, +}) +``` + +The `script` function is used to set up the script's metadata. It's the first thing you'll notice, and here's what each property means: + +- `title`: This is the name of the script, which is "Pull Request Descriptor." +- `description`: A brief explanation of what the script does. +- `tools`: An array of tools that the script will use. In this case, it uses the filesystem (`fs`) tool. +- `temperature`: Sets the creativity level for the AI model. A lower temperature means less creativity, and `0.5` is a balanced choice. +- `parameters`: Defines the inputs that the script accepts. Here, it takes `defaultBranch` as a parameter, which is the branch against which the pull request will be compared. + +### Gathering Changes with Git + +```ts +const defaultBranch = env.vars.defaultBranch +const { stdout: changes } = await host.exec("git", [ + "diff", + defaultBranch, + "--cached", + "--", + ".", + ":!.vscode/*", + ":!*yarn.lock", + ":!*THIRD_PARTY_LICENSES.md", +]) +``` + +The script captures the difference between the current branch and the `defaultBranch`. It uses the `exec` function to run the `git diff` command, excluding certain files and directories like `.vscode` and `yarn.lock`. + +### Defining the Git Diff Output + +```ts +def("GIT_DIFF", changes, { + language: "diff", + maxTokens: 20000, +}) +``` + +Here, `def` is used to define a variable called `GIT_DIFF` that holds the changes from the git diff command. It specifies that the content is in `diff` format and allows up to `20000` tokens (a measure of content length for the AI model). + +### Generating the Pull Request Description + +```ts +$`You are an expert software developer and architect. + +## Task + +- Describe a high level summary of the changes in GIT_DIFF in a way that a software engineer will understand. + +## Instructions + +- do NOT explain that GIT_DIFF displays changes in the codebase +- try to extract the intent of the changes, don't focus on the details +- use bullet points to list the changes +- use emojis to make the description more engaging +- focus on the most important changes +- ignore comments about imports (like added, remove, changed, etc.) +` +``` + +The template literal, denoted by `$`, is where the AI model is given a prompt to generate the pull request description. The instructions are clearly laid out: summarize the changes without going into details and make the description easy to understand by using bullet points and emojis. + +## Running the Script + +To use this script, you need the GenAIScript CLI installed. If you haven't installed it yet, please refer to the [installation guide](https://microsoft.github.io/genaiscript/getting-started/installation). + +Once you have the CLI set up, run the following command: + +```shell +genaiscript run prd -prd +``` + +This will execute the `prd` script and give you a pull request description. The script's filename is `prd.genai.mts`, but we use `prd` without the file extension when invoking it through the CLI. + +## Full source ([GitHub](https://github.com/microsoft/genaiscript/blob/main/packages/vscode/genaisrc/prd.genai.mts)) + + diff --git a/packages/vscode/genaisrc/prd.genai.mts b/packages/vscode/genaisrc/prd.genai.mts new file mode 100644 index 0000000000..f2386e56a2 --- /dev/null +++ b/packages/vscode/genaisrc/prd.genai.mts @@ -0,0 +1,53 @@ +script({ + title: "Pull Request Descriptor", + description: "Generate a pull request description from the git diff", + tools: ["fs"], + temperature: 0.5, + parameters: { + defaultBranch: { + type: "string", + description: "The default branch of the repository", + default: "main", + }, + }, +}) + +// configuration +const defaultBranch = env.vars.defaultBranch + +// context +// compute diff with the default branch +const { stdout: changes } = await host.exec("git", [ + "diff", + defaultBranch, + "--cached", + "--", + ".", + ":!.vscode/*", + ":!*yarn.lock", + ":!*THIRD_PARTY_LICENSES.md", +]) + +def("GIT_DIFF", changes, { + language: "diff", + maxTokens: 20000, +}) + +// task +$`You are an expert software developer and architect. + +## Task + +- Describe a high level summary of the changes in GIT_DIFF in a way that a software engineer will understand. + +## Instructions + +- do NOT explain that GIT_DIFF displays changes in the codebase +- try to extract the intent of the changes, don't focus on the details +- use bullet points to list the changes +- use emojis to make the description more engaging +- focus on the most important changes +- ignore comments about imports (like added, remove, changed, etc.) +` + +// running: make sure to add the -prd flag