@tomsun28/pizza 0.0.9 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -143
- package/README.zh-CN.md +36 -0
- package/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +6 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +3 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.js +330 -0
- package/dist/cli/config-selector.d.ts +13 -0
- package/dist/cli/config-selector.js +30 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +82 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +21 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +96 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +68 -0
- package/dist/config.d.ts +79 -0
- package/dist/config.js +223 -0
- package/dist/core/agent/index.d.ts +6 -0
- package/dist/core/agent/index.js +6 -0
- package/dist/core/agent/types.d.ts +202 -0
- package/dist/core/agent/types.js +51 -0
- package/dist/core/auth-storage.d.ts +135 -0
- package/dist/core/auth-storage.js +417 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +107 -0
- package/dist/core/compaction/branch-summarization.d.ts +87 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/compaction-engine.d.ts +40 -0
- package/dist/core/compaction/compaction-engine.js +292 -0
- package/dist/core/compaction/compaction.d.ts +106 -0
- package/dist/core/compaction/compaction.js +295 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +152 -0
- package/dist/core/defaults.d.ts +2 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/diagnostics.js +1 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +24 -0
- package/dist/core/event-store/events.d.ts +465 -0
- package/dist/core/event-store/events.js +6 -0
- package/dist/core/event-store/index.d.ts +10 -0
- package/dist/core/event-store/index.js +10 -0
- package/dist/core/event-store/sqlite-store.d.ts +27 -0
- package/dist/core/event-store/sqlite-store.js +275 -0
- package/dist/core/event-store/store.d.ts +91 -0
- package/dist/core/event-store/store.js +7 -0
- package/dist/core/event-store/thread-scoped-store.d.ts +29 -0
- package/dist/core/event-store/thread-scoped-store.js +50 -0
- package/dist/core/event-store/types.d.ts +70 -0
- package/dist/core/event-store/types.js +7 -0
- package/dist/core/event-store/workspace.d.ts +37 -0
- package/dist/core/event-store/workspace.js +71 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +74 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +248 -0
- package/dist/core/export-html/index.d.ts +29 -0
- package/dist/core/export-html/index.js +186 -0
- package/dist/core/export-html/template.css +1017 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1742 -0
- package/dist/core/export-html/tool-renderer.d.ts +39 -0
- package/dist/core/export-html/tool-renderer.js +94 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.js +492 -0
- package/dist/core/extensions/runner.d.ts +167 -0
- package/dist/core/extensions/runner.js +898 -0
- package/dist/core/extensions/session-context.d.ts +67 -0
- package/dist/core/extensions/session-context.js +272 -0
- package/dist/core/extensions/types.d.ts +1147 -0
- package/dist/core/extensions/types.js +44 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +21 -0
- package/dist/core/footer-data-provider.d.ts +47 -0
- package/dist/core/footer-data-provider.js +321 -0
- package/dist/core/goal/index.d.ts +3 -0
- package/dist/core/goal/index.js +1 -0
- package/dist/core/goal/scheduler.d.ts +83 -0
- package/dist/core/goal/scheduler.js +154 -0
- package/dist/core/goal/types.d.ts +182 -0
- package/dist/core/goal/types.js +11 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.js +8 -0
- package/dist/core/intent/classifier.d.ts +53 -0
- package/dist/core/intent/classifier.js +353 -0
- package/dist/core/intent/index.d.ts +8 -0
- package/dist/core/intent/index.js +8 -0
- package/dist/core/intent/tool-adapter.d.ts +31 -0
- package/dist/core/intent/tool-adapter.js +168 -0
- package/dist/core/intent/types.d.ts +71 -0
- package/dist/core/intent/types.js +6 -0
- package/dist/core/keybindings.d.ts +297 -0
- package/dist/core/keybindings.js +250 -0
- package/dist/core/messages.d.ts +30 -0
- package/dist/core/messages.js +134 -0
- package/dist/core/model-registry.d.ts +131 -0
- package/dist/core/model-registry.js +634 -0
- package/dist/core/model-resolver.d.ts +109 -0
- package/dist/core/model-resolver.js +486 -0
- package/dist/core/output-guard.d.ts +5 -0
- package/dist/core/output-guard.js +58 -0
- package/dist/core/package-manager.d.ts +196 -0
- package/dist/core/package-manager.js +1873 -0
- package/dist/core/projection/boundary-inferrer.d.ts +58 -0
- package/dist/core/projection/boundary-inferrer.js +122 -0
- package/dist/core/projection/event-to-message.d.ts +35 -0
- package/dist/core/projection/event-to-message.js +253 -0
- package/dist/core/projection/goal-projection.d.ts +67 -0
- package/dist/core/projection/goal-projection.js +339 -0
- package/dist/core/projection/index.d.ts +13 -0
- package/dist/core/projection/index.js +13 -0
- package/dist/core/projection/session-manager.d.ts +100 -0
- package/dist/core/projection/session-manager.js +331 -0
- package/dist/core/projection/session-projection.d.ts +58 -0
- package/dist/core/projection/session-projection.js +257 -0
- package/dist/core/projection/task-history.d.ts +13 -0
- package/dist/core/projection/task-history.js +61 -0
- package/dist/core/projection/timeline-projection.d.ts +82 -0
- package/dist/core/projection/timeline-projection.js +276 -0
- package/dist/core/projection/types.d.ts +69 -0
- package/dist/core/projection/types.js +6 -0
- package/dist/core/prompt-templates.d.ts +51 -0
- package/dist/core/prompt-templates.js +249 -0
- package/dist/core/resolve-config-value.d.ts +22 -0
- package/dist/core/resolve-config-value.js +125 -0
- package/dist/core/resource-loader.d.ts +193 -0
- package/dist/core/resource-loader.js +685 -0
- package/dist/core/runtime/ai-client.d.ts +12 -0
- package/dist/core/runtime/ai-client.js +153 -0
- package/dist/core/runtime/checkpoint.d.ts +12 -0
- package/dist/core/runtime/checkpoint.js +78 -0
- package/dist/core/runtime/index.d.ts +12 -0
- package/dist/core/runtime/index.js +12 -0
- package/dist/core/runtime/llm-types.d.ts +99 -0
- package/dist/core/runtime/llm-types.js +6 -0
- package/dist/core/runtime/local-runtime.d.ts +23 -0
- package/dist/core/runtime/local-runtime.js +59 -0
- package/dist/core/runtime/policies.d.ts +72 -0
- package/dist/core/runtime/policies.js +37 -0
- package/dist/core/runtime/reactor.d.ts +213 -0
- package/dist/core/runtime/reactor.js +992 -0
- package/dist/core/runtime/runtime.d.ts +191 -0
- package/dist/core/runtime/runtime.js +449 -0
- package/dist/core/runtime/types.d.ts +42 -0
- package/dist/core/runtime/types.js +1 -0
- package/dist/core/sdk.d.ts +12 -0
- package/dist/core/sdk.js +10 -0
- package/dist/core/session-context-builder.d.ts +9 -0
- package/dist/core/session-context-builder.js +87 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +36 -0
- package/dist/core/session-facade-factory.d.ts +79 -0
- package/dist/core/session-facade-factory.js +460 -0
- package/dist/core/session-facade.d.ts +57 -0
- package/dist/core/session-facade.js +91 -0
- package/dist/core/session-listing.d.ts +30 -0
- package/dist/core/session-listing.js +168 -0
- package/dist/core/session-reader.d.ts +19 -0
- package/dist/core/session-reader.js +101 -0
- package/dist/core/session-ref.d.ts +7 -0
- package/dist/core/session-ref.js +25 -0
- package/dist/core/session-services.d.ts +51 -0
- package/dist/core/session-services.js +90 -0
- package/dist/core/session-stats.d.ts +43 -0
- package/dist/core/session-stats.js +41 -0
- package/dist/core/settings-manager.d.ts +236 -0
- package/dist/core/settings-manager.js +706 -0
- package/dist/core/skill-block-parser.d.ts +12 -0
- package/dist/core/skill-block-parser.js +15 -0
- package/dist/core/skills.d.ts +59 -0
- package/dist/core/skills.js +408 -0
- package/dist/core/slash-commands.d.ts +13 -0
- package/dist/core/slash-commands.js +17 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +18 -0
- package/dist/core/system-prompt.d.ts +27 -0
- package/dist/core/system-prompt.js +179 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.js +30 -0
- package/dist/core/tools/bash.d.ts +95 -0
- package/dist/core/tools/bash.js +513 -0
- package/dist/core/tools/builtin-commands.d.ts +75 -0
- package/dist/core/tools/builtin-commands.js +503 -0
- package/dist/core/tools/compat-commands.d.ts +12 -0
- package/dist/core/tools/compat-commands.js +1280 -0
- package/dist/core/tools/edit-diff.d.ts +59 -0
- package/dist/core/tools/edit-diff.js +263 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.js +340 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +36 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +459 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +422 -0
- package/dist/core/tools/index.d.ts +70 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/line-anchors.d.ts +33 -0
- package/dist/core/tools/line-anchors.js +151 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +268 -0
- package/dist/core/tools/path-utils.d.ts +7 -0
- package/dist/core/tools/path-utils.js +80 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.js +244 -0
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.js +48 -0
- package/dist/core/tools/session-split.d.ts +9 -0
- package/dist/core/tools/session-split.js +77 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +32 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +204 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +211 -0
- package/dist/core/types/session-types.d.ts +123 -0
- package/dist/core/types/session-types.js +8 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +38 -0
- package/dist/main.d.ts +11 -2
- package/dist/main.js +577 -149
- package/dist/modes/event-mapper.d.ts +115 -0
- package/dist/modes/event-mapper.js +200 -0
- package/dist/modes/gui/server.d.ts +14 -0
- package/dist/modes/gui/server.js +1032 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.js +9 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +328 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
- package/dist/modes/interactive/components/assistant-message.js +115 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +169 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +50 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +41 -0
- package/dist/modes/interactive/components/brand-header.d.ts +33 -0
- package/dist/modes/interactive/components/brand-header.js +235 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +42 -0
- package/dist/modes/interactive/components/config-selector.d.ts +70 -0
- package/dist/modes/interactive/components/config-selector.js +469 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +27 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +27 -0
- package/dist/modes/interactive/components/custom-editor.js +94 -0
- package/dist/modes/interactive/components/custom-message.d.ts +19 -0
- package/dist/modes/interactive/components/custom-message.js +73 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +137 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +132 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +19 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +39 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +54 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +23 -0
- package/dist/modes/interactive/components/extension-selector.js +70 -0
- package/dist/modes/interactive/components/footer.d.ts +55 -0
- package/dist/modes/interactive/components/footer.js +207 -0
- package/dist/modes/interactive/components/index.d.ts +31 -0
- package/dist/modes/interactive/components/index.js +32 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.js +21 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +41 -0
- package/dist/modes/interactive/components/login-dialog.js +138 -0
- package/dist/modes/interactive/components/model-selector.d.ts +32 -0
- package/dist/modes/interactive/components/model-selector.js +209 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +18 -0
- package/dist/modes/interactive/components/oauth-selector.js +91 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +57 -0
- package/dist/modes/interactive/components/settings-selector.js +299 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +37 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +50 -0
- package/dist/modes/interactive/components/timeline-view.d.ts +31 -0
- package/dist/modes/interactive/components/timeline-view.js +81 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +64 -0
- package/dist/modes/interactive/components/tool-execution.js +305 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
- package/dist/modes/interactive/components/tree-selector.js +1072 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.js +27 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/modes/interactive/interactive-mode.js +4116 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +80 -0
- package/dist/modes/interactive/theme/theme.js +973 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +102 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +48 -0
- package/dist/modes/rpc/rpc-client.d.ts +219 -0
- package/dist/modes/rpc/rpc-client.js +405 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +381 -0
- package/dist/modes/rpc/rpc-types.d.ts +406 -0
- package/dist/modes/rpc/rpc-types.js +7 -0
- package/dist/package-manager-cli.d.ts +3 -0
- package/dist/package-manager-cli.js +233 -0
- package/dist/utils/changelog.d.ts +20 -0
- package/dist/utils/changelog.js +86 -0
- package/dist/utils/child-process.d.ts +10 -0
- package/dist/utils/child-process.js +77 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +244 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.js +13 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +77 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +157 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +25 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +162 -0
- package/dist/utils/image-convert.d.ts +8 -0
- package/dist/utils/image-convert.js +38 -0
- package/dist/utils/image-resize.d.ts +35 -0
- package/dist/utils/image-resize.js +136 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.js +25 -0
- package/dist/utils/path-shims.d.ts +1 -0
- package/dist/utils/path-shims.js +90 -0
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.js +18 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +120 -0
- package/dist/utils/shell.d.ts +29 -0
- package/dist/utils/shell.js +189 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +16 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.js +101 -0
- package/dist/vendor/bin/darwin-arm64/fd +0 -0
- package/dist/vendor/bin/darwin-arm64/rg +0 -0
- package/dist/vendor/bin/darwin-x64/fd +0 -0
- package/dist/vendor/bin/darwin-x64/rg +0 -0
- package/dist/vendor/bin/linux-arm64/fd +0 -0
- package/dist/vendor/bin/linux-arm64/rg +0 -0
- package/dist/vendor/bin/linux-x64/fd +0 -0
- package/dist/vendor/bin/linux-x64/rg +0 -0
- package/dist/vendor/bin/win32-arm64/fd.exe +0 -0
- package/dist/vendor/bin/win32-arm64/rg.exe +0 -0
- package/dist/vendor/bin/win32-x64/fd.exe +0 -0
- package/dist/vendor/bin/win32-x64/rg.exe +0 -0
- package/package.json +90 -26
- package/dist/extension/core.d.ts +0 -69
- package/dist/extension/core.js +0 -270
- package/dist/extension/core.js.map +0 -1
- package/dist/extension/index.d.ts +0 -25
- package/dist/extension/index.js +0 -303
- package/dist/extension/index.js.map +0 -1
- package/dist/main.js.map +0 -1
- package/themes/pizza.json +0 -87
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Parsed skill block from a user message */
|
|
2
|
+
export interface ParsedSkillBlock {
|
|
3
|
+
name: string;
|
|
4
|
+
location: string;
|
|
5
|
+
content: string;
|
|
6
|
+
userMessage: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse a skill block from message text.
|
|
10
|
+
* Returns null if the text doesn't contain a skill block.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseSkillBlock(text: string): ParsedSkillBlock | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a skill block from message text.
|
|
3
|
+
* Returns null if the text doesn't contain a skill block.
|
|
4
|
+
*/
|
|
5
|
+
export function parseSkillBlock(text) {
|
|
6
|
+
const match = text.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);
|
|
7
|
+
if (!match)
|
|
8
|
+
return null;
|
|
9
|
+
return {
|
|
10
|
+
name: match[1],
|
|
11
|
+
location: match[2],
|
|
12
|
+
content: match[3],
|
|
13
|
+
userMessage: match[4]?.trim() || undefined,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ResourceDiagnostic } from "./diagnostics.js";
|
|
2
|
+
import { type SourceInfo } from "./source-info.js";
|
|
3
|
+
export interface SkillFrontmatter {
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
"disable-model-invocation"?: boolean;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface Skill {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
baseDir: string;
|
|
14
|
+
sourceInfo: SourceInfo;
|
|
15
|
+
disableModelInvocation: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface LoadSkillsResult {
|
|
18
|
+
skills: Skill[];
|
|
19
|
+
diagnostics: ResourceDiagnostic[];
|
|
20
|
+
}
|
|
21
|
+
export interface LoadSkillsFromDirOptions {
|
|
22
|
+
/** Directory to scan for skills */
|
|
23
|
+
dir: string;
|
|
24
|
+
/** Source identifier for these skills */
|
|
25
|
+
source: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load skills from a directory.
|
|
29
|
+
*
|
|
30
|
+
* Discovery rules:
|
|
31
|
+
* - if a directory contains SKILL.md, treat it as a skill root and do not recurse further
|
|
32
|
+
* - otherwise, load direct .md children in the root
|
|
33
|
+
* - recurse into subdirectories to find SKILL.md
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadSkillsFromDir(options: LoadSkillsFromDirOptions): LoadSkillsResult;
|
|
36
|
+
/**
|
|
37
|
+
* Format skills for inclusion in a system prompt.
|
|
38
|
+
* Uses XML format per Agent Skills standard.
|
|
39
|
+
* See: https://agentskills.io/integrate-skills
|
|
40
|
+
*
|
|
41
|
+
* Skills with disableModelInvocation=true are excluded from the prompt
|
|
42
|
+
* (they can only be invoked explicitly via /skill:name commands).
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatSkillsForPrompt(skills: Skill[]): string;
|
|
45
|
+
export interface LoadSkillsOptions {
|
|
46
|
+
/** Working directory for project-local skills. */
|
|
47
|
+
cwd: string;
|
|
48
|
+
/** Agent config directory for global skills. */
|
|
49
|
+
agentDir: string;
|
|
50
|
+
/** Explicit skill paths (files or directories) */
|
|
51
|
+
skillPaths: string[];
|
|
52
|
+
/** Include default skills directories. */
|
|
53
|
+
includeDefaults: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Load skills from all configured locations.
|
|
57
|
+
* Returns skills and any validation diagnostics.
|
|
58
|
+
*/
|
|
59
|
+
export declare function loadSkills(options: LoadSkillsOptions): LoadSkillsResult;
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "fs";
|
|
2
|
+
import ignore from "ignore";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
5
|
+
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
6
|
+
import { parseFrontmatter } from "../utils/frontmatter.js";
|
|
7
|
+
import { createSyntheticSourceInfo } from "./source-info.js";
|
|
8
|
+
/** Max name length per spec */
|
|
9
|
+
const MAX_NAME_LENGTH = 64;
|
|
10
|
+
/** Max description length per spec */
|
|
11
|
+
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
12
|
+
const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
|
|
13
|
+
function toPosixPath(p) {
|
|
14
|
+
return p.split(sep).join("/");
|
|
15
|
+
}
|
|
16
|
+
function prefixIgnorePattern(line, prefix) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
if (!trimmed)
|
|
19
|
+
return null;
|
|
20
|
+
if (trimmed.startsWith("#") && !trimmed.startsWith("\\#"))
|
|
21
|
+
return null;
|
|
22
|
+
let pattern = line;
|
|
23
|
+
let negated = false;
|
|
24
|
+
if (pattern.startsWith("!")) {
|
|
25
|
+
negated = true;
|
|
26
|
+
pattern = pattern.slice(1);
|
|
27
|
+
}
|
|
28
|
+
else if (pattern.startsWith("\\!")) {
|
|
29
|
+
pattern = pattern.slice(1);
|
|
30
|
+
}
|
|
31
|
+
if (pattern.startsWith("/")) {
|
|
32
|
+
pattern = pattern.slice(1);
|
|
33
|
+
}
|
|
34
|
+
const prefixed = prefix ? `${prefix}${pattern}` : pattern;
|
|
35
|
+
return negated ? `!${prefixed}` : prefixed;
|
|
36
|
+
}
|
|
37
|
+
function addIgnoreRules(ig, dir, rootDir) {
|
|
38
|
+
const relativeDir = relative(rootDir, dir);
|
|
39
|
+
const prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : "";
|
|
40
|
+
for (const filename of IGNORE_FILE_NAMES) {
|
|
41
|
+
const ignorePath = join(dir, filename);
|
|
42
|
+
if (!existsSync(ignorePath))
|
|
43
|
+
continue;
|
|
44
|
+
try {
|
|
45
|
+
const content = readFileSync(ignorePath, "utf-8");
|
|
46
|
+
const patterns = content
|
|
47
|
+
.split(/\r?\n/)
|
|
48
|
+
.map((line) => prefixIgnorePattern(line, prefix))
|
|
49
|
+
.filter((line) => Boolean(line));
|
|
50
|
+
if (patterns.length > 0) {
|
|
51
|
+
ig.add(patterns);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Validate skill name per Agent Skills spec.
|
|
59
|
+
* Returns array of validation error messages (empty if valid).
|
|
60
|
+
*/
|
|
61
|
+
function validateName(name, parentDirName) {
|
|
62
|
+
const errors = [];
|
|
63
|
+
if (name !== parentDirName) {
|
|
64
|
+
errors.push(`name "${name}" does not match parent directory "${parentDirName}"`);
|
|
65
|
+
}
|
|
66
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
67
|
+
errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);
|
|
68
|
+
}
|
|
69
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
70
|
+
errors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);
|
|
71
|
+
}
|
|
72
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
73
|
+
errors.push(`name must not start or end with a hyphen`);
|
|
74
|
+
}
|
|
75
|
+
if (name.includes("--")) {
|
|
76
|
+
errors.push(`name must not contain consecutive hyphens`);
|
|
77
|
+
}
|
|
78
|
+
return errors;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validate description per Agent Skills spec.
|
|
82
|
+
*/
|
|
83
|
+
function validateDescription(description) {
|
|
84
|
+
const errors = [];
|
|
85
|
+
if (!description || description.trim() === "") {
|
|
86
|
+
errors.push("description is required");
|
|
87
|
+
}
|
|
88
|
+
else if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
89
|
+
errors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);
|
|
90
|
+
}
|
|
91
|
+
return errors;
|
|
92
|
+
}
|
|
93
|
+
function createSkillSourceInfo(filePath, baseDir, source) {
|
|
94
|
+
switch (source) {
|
|
95
|
+
case "user":
|
|
96
|
+
return createSyntheticSourceInfo(filePath, {
|
|
97
|
+
source: "local",
|
|
98
|
+
scope: "user",
|
|
99
|
+
baseDir,
|
|
100
|
+
});
|
|
101
|
+
case "project":
|
|
102
|
+
return createSyntheticSourceInfo(filePath, {
|
|
103
|
+
source: "local",
|
|
104
|
+
scope: "project",
|
|
105
|
+
baseDir,
|
|
106
|
+
});
|
|
107
|
+
case "path":
|
|
108
|
+
return createSyntheticSourceInfo(filePath, {
|
|
109
|
+
source: "local",
|
|
110
|
+
baseDir,
|
|
111
|
+
});
|
|
112
|
+
default:
|
|
113
|
+
return createSyntheticSourceInfo(filePath, { source, baseDir });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Load skills from a directory.
|
|
118
|
+
*
|
|
119
|
+
* Discovery rules:
|
|
120
|
+
* - if a directory contains SKILL.md, treat it as a skill root and do not recurse further
|
|
121
|
+
* - otherwise, load direct .md children in the root
|
|
122
|
+
* - recurse into subdirectories to find SKILL.md
|
|
123
|
+
*/
|
|
124
|
+
export function loadSkillsFromDir(options) {
|
|
125
|
+
const { dir, source } = options;
|
|
126
|
+
return loadSkillsFromDirInternal(dir, source, true);
|
|
127
|
+
}
|
|
128
|
+
function loadSkillsFromDirInternal(dir, source, includeRootFiles, ignoreMatcher, rootDir) {
|
|
129
|
+
const skills = [];
|
|
130
|
+
const diagnostics = [];
|
|
131
|
+
if (!existsSync(dir)) {
|
|
132
|
+
return { skills, diagnostics };
|
|
133
|
+
}
|
|
134
|
+
const root = rootDir ?? dir;
|
|
135
|
+
const ig = ignoreMatcher ?? ignore();
|
|
136
|
+
addIgnoreRules(ig, dir, root);
|
|
137
|
+
try {
|
|
138
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
139
|
+
for (const entry of entries) {
|
|
140
|
+
if (entry.name !== "SKILL.md") {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const fullPath = join(dir, entry.name);
|
|
144
|
+
let isFile = entry.isFile();
|
|
145
|
+
if (entry.isSymbolicLink()) {
|
|
146
|
+
try {
|
|
147
|
+
isFile = statSync(fullPath).isFile();
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const relPath = toPosixPath(relative(root, fullPath));
|
|
154
|
+
if (!isFile || ig.ignores(relPath)) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const result = loadSkillFromFile(fullPath, source);
|
|
158
|
+
if (result.skill) {
|
|
159
|
+
skills.push(result.skill);
|
|
160
|
+
}
|
|
161
|
+
diagnostics.push(...result.diagnostics);
|
|
162
|
+
return { skills, diagnostics };
|
|
163
|
+
}
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
if (entry.name.startsWith(".")) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Skip node_modules to avoid scanning dependencies
|
|
169
|
+
if (entry.name === "node_modules") {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const fullPath = join(dir, entry.name);
|
|
173
|
+
// For symlinks, check if they point to a directory and follow them
|
|
174
|
+
let isDirectory = entry.isDirectory();
|
|
175
|
+
let isFile = entry.isFile();
|
|
176
|
+
if (entry.isSymbolicLink()) {
|
|
177
|
+
try {
|
|
178
|
+
const stats = statSync(fullPath);
|
|
179
|
+
isDirectory = stats.isDirectory();
|
|
180
|
+
isFile = stats.isFile();
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// Broken symlink, skip it
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const relPath = toPosixPath(relative(root, fullPath));
|
|
188
|
+
const ignorePath = isDirectory ? `${relPath}/` : relPath;
|
|
189
|
+
if (ig.ignores(ignorePath)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (isDirectory) {
|
|
193
|
+
const subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);
|
|
194
|
+
skills.push(...subResult.skills);
|
|
195
|
+
diagnostics.push(...subResult.diagnostics);
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (!isFile || !includeRootFiles || !entry.name.endsWith(".md")) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const result = loadSkillFromFile(fullPath, source);
|
|
202
|
+
if (result.skill) {
|
|
203
|
+
skills.push(result.skill);
|
|
204
|
+
}
|
|
205
|
+
diagnostics.push(...result.diagnostics);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch { }
|
|
209
|
+
return { skills, diagnostics };
|
|
210
|
+
}
|
|
211
|
+
function loadSkillFromFile(filePath, source) {
|
|
212
|
+
const diagnostics = [];
|
|
213
|
+
try {
|
|
214
|
+
const rawContent = readFileSync(filePath, "utf-8");
|
|
215
|
+
const { frontmatter } = parseFrontmatter(rawContent);
|
|
216
|
+
const skillDir = dirname(filePath);
|
|
217
|
+
const parentDirName = basename(skillDir);
|
|
218
|
+
// Validate description
|
|
219
|
+
const descErrors = validateDescription(frontmatter.description);
|
|
220
|
+
for (const error of descErrors) {
|
|
221
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
222
|
+
}
|
|
223
|
+
// Use name from frontmatter, or fall back to parent directory name
|
|
224
|
+
const name = frontmatter.name || parentDirName;
|
|
225
|
+
// Validate name
|
|
226
|
+
const nameErrors = validateName(name, parentDirName);
|
|
227
|
+
for (const error of nameErrors) {
|
|
228
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
229
|
+
}
|
|
230
|
+
// Still load the skill even with warnings (unless description is completely missing)
|
|
231
|
+
if (!frontmatter.description || frontmatter.description.trim() === "") {
|
|
232
|
+
return { skill: null, diagnostics };
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
skill: {
|
|
236
|
+
name,
|
|
237
|
+
description: frontmatter.description,
|
|
238
|
+
filePath,
|
|
239
|
+
baseDir: skillDir,
|
|
240
|
+
sourceInfo: createSkillSourceInfo(filePath, skillDir, source),
|
|
241
|
+
disableModelInvocation: frontmatter["disable-model-invocation"] === true,
|
|
242
|
+
},
|
|
243
|
+
diagnostics,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
const message = error instanceof Error ? error.message : "failed to parse skill file";
|
|
248
|
+
diagnostics.push({ type: "warning", message, path: filePath });
|
|
249
|
+
return { skill: null, diagnostics };
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Format skills for inclusion in a system prompt.
|
|
254
|
+
* Uses XML format per Agent Skills standard.
|
|
255
|
+
* See: https://agentskills.io/integrate-skills
|
|
256
|
+
*
|
|
257
|
+
* Skills with disableModelInvocation=true are excluded from the prompt
|
|
258
|
+
* (they can only be invoked explicitly via /skill:name commands).
|
|
259
|
+
*/
|
|
260
|
+
export function formatSkillsForPrompt(skills) {
|
|
261
|
+
const visibleSkills = skills.filter((s) => !s.disableModelInvocation);
|
|
262
|
+
if (visibleSkills.length === 0) {
|
|
263
|
+
return "";
|
|
264
|
+
}
|
|
265
|
+
const lines = [
|
|
266
|
+
"\n\nThe following skills provide specialized instructions for specific tasks.",
|
|
267
|
+
"Use the read tool to load a skill's file when the task matches its description.",
|
|
268
|
+
"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.",
|
|
269
|
+
"",
|
|
270
|
+
"<available_skills>",
|
|
271
|
+
];
|
|
272
|
+
for (const skill of visibleSkills) {
|
|
273
|
+
lines.push(" <skill>");
|
|
274
|
+
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
275
|
+
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
276
|
+
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
|
|
277
|
+
lines.push(" </skill>");
|
|
278
|
+
}
|
|
279
|
+
lines.push("</available_skills>");
|
|
280
|
+
return lines.join("\n");
|
|
281
|
+
}
|
|
282
|
+
function escapeXml(str) {
|
|
283
|
+
return str
|
|
284
|
+
.replace(/&/g, "&")
|
|
285
|
+
.replace(/</g, "<")
|
|
286
|
+
.replace(/>/g, ">")
|
|
287
|
+
.replace(/"/g, """)
|
|
288
|
+
.replace(/'/g, "'");
|
|
289
|
+
}
|
|
290
|
+
function normalizePath(input) {
|
|
291
|
+
const trimmed = input.trim();
|
|
292
|
+
if (trimmed === "~")
|
|
293
|
+
return homedir();
|
|
294
|
+
if (trimmed.startsWith("~/"))
|
|
295
|
+
return join(homedir(), trimmed.slice(2));
|
|
296
|
+
if (trimmed.startsWith("~"))
|
|
297
|
+
return join(homedir(), trimmed.slice(1));
|
|
298
|
+
return trimmed;
|
|
299
|
+
}
|
|
300
|
+
function resolveSkillPath(p, cwd) {
|
|
301
|
+
const normalized = normalizePath(p);
|
|
302
|
+
return isAbsolute(normalized) ? normalized : resolve(cwd, normalized);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Load skills from all configured locations.
|
|
306
|
+
* Returns skills and any validation diagnostics.
|
|
307
|
+
*/
|
|
308
|
+
export function loadSkills(options) {
|
|
309
|
+
const { cwd, agentDir, skillPaths, includeDefaults } = options;
|
|
310
|
+
// Resolve agentDir - if not provided, use default from config
|
|
311
|
+
const resolvedAgentDir = agentDir ?? getAgentDir();
|
|
312
|
+
const skillMap = new Map();
|
|
313
|
+
const realPathSet = new Set();
|
|
314
|
+
const allDiagnostics = [];
|
|
315
|
+
const collisionDiagnostics = [];
|
|
316
|
+
function addSkills(result) {
|
|
317
|
+
allDiagnostics.push(...result.diagnostics);
|
|
318
|
+
for (const skill of result.skills) {
|
|
319
|
+
// Resolve symlinks to detect duplicate files
|
|
320
|
+
let realPath;
|
|
321
|
+
try {
|
|
322
|
+
realPath = realpathSync(skill.filePath);
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
realPath = skill.filePath;
|
|
326
|
+
}
|
|
327
|
+
// Skip silently if we've already loaded this exact file (via symlink)
|
|
328
|
+
if (realPathSet.has(realPath)) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const existing = skillMap.get(skill.name);
|
|
332
|
+
if (existing) {
|
|
333
|
+
collisionDiagnostics.push({
|
|
334
|
+
type: "collision",
|
|
335
|
+
message: `name "${skill.name}" collision`,
|
|
336
|
+
path: skill.filePath,
|
|
337
|
+
collision: {
|
|
338
|
+
resourceType: "skill",
|
|
339
|
+
name: skill.name,
|
|
340
|
+
winnerPath: existing.filePath,
|
|
341
|
+
loserPath: skill.filePath,
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
skillMap.set(skill.name, skill);
|
|
347
|
+
realPathSet.add(realPath);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (includeDefaults) {
|
|
352
|
+
addSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, "skills"), "user", true));
|
|
353
|
+
addSkills(loadSkillsFromDirInternal(resolve(cwd, CONFIG_DIR_NAME, "skills"), "project", true));
|
|
354
|
+
}
|
|
355
|
+
const userSkillsDir = join(resolvedAgentDir, "skills");
|
|
356
|
+
const projectSkillsDir = resolve(cwd, CONFIG_DIR_NAME, "skills");
|
|
357
|
+
const isUnderPath = (target, root) => {
|
|
358
|
+
const normalizedRoot = resolve(root);
|
|
359
|
+
if (target === normalizedRoot) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
const prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;
|
|
363
|
+
return target.startsWith(prefix);
|
|
364
|
+
};
|
|
365
|
+
const getSource = (resolvedPath) => {
|
|
366
|
+
if (!includeDefaults) {
|
|
367
|
+
if (isUnderPath(resolvedPath, userSkillsDir))
|
|
368
|
+
return "user";
|
|
369
|
+
if (isUnderPath(resolvedPath, projectSkillsDir))
|
|
370
|
+
return "project";
|
|
371
|
+
}
|
|
372
|
+
return "path";
|
|
373
|
+
};
|
|
374
|
+
for (const rawPath of skillPaths) {
|
|
375
|
+
const resolvedPath = resolveSkillPath(rawPath, cwd);
|
|
376
|
+
if (!existsSync(resolvedPath)) {
|
|
377
|
+
allDiagnostics.push({ type: "warning", message: "skill path does not exist", path: resolvedPath });
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
try {
|
|
381
|
+
const stats = statSync(resolvedPath);
|
|
382
|
+
const source = getSource(resolvedPath);
|
|
383
|
+
if (stats.isDirectory()) {
|
|
384
|
+
addSkills(loadSkillsFromDirInternal(resolvedPath, source, true));
|
|
385
|
+
}
|
|
386
|
+
else if (stats.isFile() && resolvedPath.endsWith(".md")) {
|
|
387
|
+
const result = loadSkillFromFile(resolvedPath, source);
|
|
388
|
+
if (result.skill) {
|
|
389
|
+
addSkills({ skills: [result.skill], diagnostics: result.diagnostics });
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
allDiagnostics.push(...result.diagnostics);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
allDiagnostics.push({ type: "warning", message: "skill path is not a markdown file", path: resolvedPath });
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
const message = error instanceof Error ? error.message : "failed to read skill path";
|
|
401
|
+
allDiagnostics.push({ type: "warning", message, path: resolvedPath });
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
skills: Array.from(skillMap.values()),
|
|
406
|
+
diagnostics: [...allDiagnostics, ...collisionDiagnostics],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SourceInfo } from "./source-info.js";
|
|
2
|
+
export type SlashCommandSource = "extension" | "prompt" | "skill";
|
|
3
|
+
export interface SlashCommandInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
source: SlashCommandSource;
|
|
7
|
+
sourceInfo: SourceInfo;
|
|
8
|
+
}
|
|
9
|
+
export interface BuiltinSlashCommand {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const BUILTIN_SLASH_COMMANDS = [
|
|
2
|
+
{ name: "settings", description: "Open settings menu" },
|
|
3
|
+
{ name: "model", description: "Select model (opens selector UI)" },
|
|
4
|
+
{ name: "export", description: "Export session to HTML" },
|
|
5
|
+
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
6
|
+
{ name: "copy", description: "Copy last agent message to clipboard" },
|
|
7
|
+
{ name: "stats", description: "Show session statistics" },
|
|
8
|
+
{ name: "hotkeys", description: "Show all keyboard shortcuts" },
|
|
9
|
+
{ name: "rewind", description: "Create a new fork from a previous user message" },
|
|
10
|
+
{ name: "history", description: "Navigate session tree (switch branches)" },
|
|
11
|
+
{ name: "login", description: "Login with OAuth provider" },
|
|
12
|
+
{ name: "logout", description: "Logout from OAuth provider" },
|
|
13
|
+
{ name: "compact", description: "Manually compact the session context" },
|
|
14
|
+
{ name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" },
|
|
15
|
+
{ name: "debug", description: "Show debug information" },
|
|
16
|
+
{ name: "quit", description: "Quit Pizza" },
|
|
17
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PathMetadata } from "./package-manager.js";
|
|
2
|
+
export type SourceScope = "user" | "project" | "temporary";
|
|
3
|
+
export type SourceOrigin = "package" | "top-level";
|
|
4
|
+
export interface SourceInfo {
|
|
5
|
+
path: string;
|
|
6
|
+
source: string;
|
|
7
|
+
scope: SourceScope;
|
|
8
|
+
origin: SourceOrigin;
|
|
9
|
+
baseDir?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createSourceInfo(path: string, metadata: PathMetadata): SourceInfo;
|
|
12
|
+
export declare function createSyntheticSourceInfo(path: string, options: {
|
|
13
|
+
source: string;
|
|
14
|
+
scope?: SourceScope;
|
|
15
|
+
origin?: SourceOrigin;
|
|
16
|
+
baseDir?: string;
|
|
17
|
+
}): SourceInfo;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function createSourceInfo(path, metadata) {
|
|
2
|
+
return {
|
|
3
|
+
path,
|
|
4
|
+
source: metadata.source,
|
|
5
|
+
scope: metadata.scope,
|
|
6
|
+
origin: metadata.origin,
|
|
7
|
+
baseDir: metadata.baseDir,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function createSyntheticSourceInfo(path, options) {
|
|
11
|
+
return {
|
|
12
|
+
path,
|
|
13
|
+
source: options.source,
|
|
14
|
+
scope: options.scope ?? "temporary",
|
|
15
|
+
origin: options.origin ?? "top-level",
|
|
16
|
+
baseDir: options.baseDir,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt construction and project context loading
|
|
3
|
+
*/
|
|
4
|
+
import { type Skill } from "./skills.js";
|
|
5
|
+
export interface BuildSystemPromptOptions {
|
|
6
|
+
/** Custom system prompt (replaces default). */
|
|
7
|
+
customPrompt?: string;
|
|
8
|
+
/** Tools to include in prompt. Default: [bash] */
|
|
9
|
+
selectedTools?: string[];
|
|
10
|
+
/** Optional one-line tool snippets keyed by tool name. */
|
|
11
|
+
toolSnippets?: Record<string, string>;
|
|
12
|
+
/** Additional guideline bullets appended to the default system prompt guidelines. */
|
|
13
|
+
promptGuidelines?: string[];
|
|
14
|
+
/** Text to append to system prompt. */
|
|
15
|
+
appendSystemPrompt?: string;
|
|
16
|
+
/** Working directory. */
|
|
17
|
+
cwd: string;
|
|
18
|
+
/** Pre-loaded context files. */
|
|
19
|
+
contextFiles?: Array<{
|
|
20
|
+
path: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Pre-loaded skills. */
|
|
24
|
+
skills?: Skill[];
|
|
25
|
+
}
|
|
26
|
+
/** Build the system prompt with tools, guidelines, and context */
|
|
27
|
+
export declare function buildSystemPrompt(options: BuildSystemPromptOptions): string;
|