Skip to content

Commit 6b0bc7f

Browse files
Copilotpelikhan
andauthored
Add activation field to PromptSystemArgs for keyword-based system prompt activation (#1887)
* Initial plan * Add activation field to PromptSystemArgs and implement activation-based system resolution Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Complete implementation of activation field for system prompts with tests and integration Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Merge branch 'dev' into copilot/fix-e05d1306-4cde-4fa5-adce-543abae6d79c * Add explanatory comment for word boundary regex in activation keyword matching Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Merge branch 'dev' into copilot/fix-e05d1306-4cde-4fa5-adce-543abae6d79c * Add activation keywords for system.resources and support singular annotation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 233d006 commit 6b0bc7f

14 files changed

Lines changed: 459 additions & 37 deletions

docs/public/genaiscript.d.ts

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/content/docs/reference/scripts/system.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ system({
821821
description:
822822
"GitHub Actions workflows support annotations ([Read more...](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message)).",
823823
lineNumbers: true,
824+
activation: ["annotations", "warnings", "errors"],
824825
})
825826

826827
export default function (ctx: ChatGenerationContext) {
@@ -926,6 +927,7 @@ Generate changelog formatter edits
926927
system({
927928
title: "Generate changelog formatter edits",
928929
lineNumbers: true,
930+
activation: ["changelog"],
929931
})
930932

931933
export default function (ctx: ChatGenerationContext) {
@@ -1074,6 +1076,7 @@ Generate diagrams
10741076
`````js wrap title="system.diagrams"
10751077
system({
10761078
title: "Generate diagrams",
1079+
activation: ["diagram", "chart"],
10771080
parameters: {
10781081
repair: {
10791082
type: "integer",
@@ -1357,6 +1360,7 @@ Teaches the file format supported by GenAIScripts
13571360
system({
13581361
title: "File generation",
13591362
description: "Teaches the file format supported by GenAIScripts",
1363+
activation: ["file", "files"],
13601364
})
13611365

13621366
export default function (ctx: ChatGenerationContext) {
@@ -2130,6 +2134,7 @@ Git repository information
21302134
`````js wrap title="system.git_info"
21312135
system({
21322136
title: "Git repository information",
2137+
activation: ["git"],
21332138
parameters: {
21342139
cwd: {
21352140
type: "string",
@@ -2414,6 +2419,7 @@ General GitHub information.
24142419
`````js wrap title="system.github_info"
24152420
system({
24162421
title: "General GitHub information.",
2422+
activation: ["github"],
24172423
})
24182424

24192425
export default async function (ctx: ChatGenerationContext) {
@@ -4734,6 +4740,7 @@ Today's date.
47344740
`````js wrap title="system.today"
47354741
system({
47364742
title: "Today's date.",
4743+
activation: ["today"],
47374744
})
47384745
export default function (ctx: ChatGenerationContext) {
47394746
const { $ } = ctx

packages/core/genaisrc/system.annotations.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ system({
33
description:
44
"GitHub Actions workflows support annotations ([Read more...](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message)).",
55
lineNumbers: true,
6+
activation: ["annotation", "annotations", "warnings", "errors"],
67
})
78

89
export default function (ctx: ChatGenerationContext) {

packages/core/genaisrc/system.changelog.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
system({
22
title: "Generate changelog formatter edits",
33
lineNumbers: true,
4+
activation: ["changelog"],
45
})
56

67
export default function (ctx: ChatGenerationContext) {

packages/core/genaisrc/system.diagrams.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
system({
22
title: "Generate diagrams",
3+
activation: ["diagram", "chart"],
34
parameters: {
45
repair: {
56
type: "integer",

packages/core/genaisrc/system.files.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
system({
22
title: "File generation",
33
description: "Teaches the file format supported by GenAIScripts",
4+
activation: ["file", "files"],
45
})
56

67
export default function (ctx: ChatGenerationContext) {

packages/core/genaisrc/system.git_info.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
system({
22
title: "Git repository information",
3+
activation: ["git"],
34
parameters: {
45
cwd: {
56
type: "string",

packages/core/genaisrc/system.github_info.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
system({
22
title: "General GitHub information.",
3+
activation: ["github"],
34
})
45

56
export default async function (ctx: ChatGenerationContext) {

packages/core/genaisrc/system.resources.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ system({
22
title: "Read resource content from a URL using MCP resource resolution",
33
description:
44
"Provides a tool that can read and return the content of resources from URLs using the host's resolveResource function. Supports various protocols including https, file, git, gist, and vscode.",
5+
activation: ["resource", "resources"],
56
});
67

78
export default function (ctx: ChatGenerationContext) {

packages/core/genaisrc/system.today.genai.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
system({
22
title: "Today's date.",
3+
activation: ["today"],
34
})
45
export default function (ctx: ChatGenerationContext) {
56
const { $ } = ctx

0 commit comments

Comments
 (0)