goatcode-sh 0.0.1 → 0.1.2
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/.github/workflows/ci.yml +85 -0
- package/.github/workflows/release.yml +107 -0
- package/.opencode/plugins/goatcode.js +1 -0
- package/AGENTS.md +59 -0
- package/CONTRIBUTING.md +110 -0
- package/LICENSE +21 -0
- package/README.md +106 -12
- package/bun.lock +2081 -0
- package/bunfig.toml +3 -0
- package/dist/agents/advisor/config.d.ts +4 -0
- package/dist/agents/advisor/index.d.ts +2 -0
- package/dist/agents/advisor/plugin.d.ts +1 -0
- package/dist/agents/advisor/prompt-meta.d.ts +2 -0
- package/dist/agents/advisor/prompt.d.ts +1 -0
- package/dist/agents/agent-builder.d.ts +10 -0
- package/dist/agents/agent-registry.d.ts +8 -0
- package/dist/agents/builtin-agents.d.ts +2 -0
- package/dist/agents/deep-worker/config.d.ts +4 -0
- package/dist/agents/deep-worker/index.d.ts +2 -0
- package/dist/agents/deep-worker/plugin.d.ts +1 -0
- package/dist/agents/deep-worker/prompt-meta.d.ts +2 -0
- package/dist/agents/deep-worker/prompt.d.ts +1 -0
- package/dist/agents/explorer/config.d.ts +4 -0
- package/dist/agents/explorer/index.d.ts +2 -0
- package/dist/agents/explorer/plugin.d.ts +1 -0
- package/dist/agents/explorer/prompt-meta.d.ts +2 -0
- package/dist/agents/explorer/prompt.d.ts +1 -0
- package/dist/agents/fallback-chains.d.ts +2 -0
- package/dist/agents/index.d.ts +14 -0
- package/dist/agents/orchestrator/config.d.ts +4 -0
- package/dist/agents/orchestrator/index.d.ts +2 -0
- package/dist/agents/orchestrator/plugin.d.ts +1 -0
- package/dist/agents/orchestrator/prompt-meta.d.ts +2 -0
- package/dist/agents/orchestrator/prompt.d.ts +1 -0
- package/dist/agents/planner/config.d.ts +4 -0
- package/dist/agents/planner/index.d.ts +2 -0
- package/dist/agents/planner/plugin.d.ts +1 -0
- package/dist/agents/planner/prompt-meta.d.ts +2 -0
- package/dist/agents/planner/prompt.d.ts +1 -0
- package/dist/agents/prompt-meta.d.ts +11 -0
- package/dist/agents/prompt-registry.d.ts +4 -0
- package/dist/agents/researcher/config.d.ts +4 -0
- package/dist/agents/researcher/index.d.ts +2 -0
- package/dist/agents/researcher/plugin.d.ts +1 -0
- package/dist/agents/researcher/prompt-meta.d.ts +2 -0
- package/dist/agents/researcher/prompt.d.ts +1 -0
- package/dist/agents/tool-restrictions.d.ts +7 -0
- package/dist/agents/worker/config.d.ts +4 -0
- package/dist/agents/worker/index.d.ts +2 -0
- package/dist/agents/worker/plugin.d.ts +1 -0
- package/dist/agents/worker/prompt-meta.d.ts +2 -0
- package/dist/agents/worker/prompt.d.ts +1 -0
- package/dist/bootstrap.d.ts +3 -0
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/commands/install.d.ts +12 -0
- package/dist/cli/commands/update.d.ts +1 -0
- package/dist/cli/config-generator.d.ts +26 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/define-config.d.ts +27 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/loader.d.ts +3 -0
- package/dist/config/paths.d.ts +4 -0
- package/dist/config/schema.d.ts +273 -0
- package/dist/config/validator.d.ts +9 -0
- package/dist/features/auto-update/index.d.ts +3 -0
- package/dist/features/auto-update/plugin.d.ts +2 -0
- package/dist/features/auto-update/update-checker.d.ts +7 -0
- package/dist/features/background-agent/concurrency.d.ts +10 -0
- package/dist/features/background-agent/index.d.ts +6 -0
- package/dist/features/background-agent/manager.d.ts +18 -0
- package/dist/features/background-agent/poller.d.ts +17 -0
- package/dist/features/background-agent/singleton.d.ts +7 -0
- package/dist/features/background-agent/spawner.d.ts +6 -0
- package/dist/features/background-agent/types.d.ts +18 -0
- package/dist/features/builtin-features.d.ts +2 -0
- package/dist/features/categories/category-config.d.ts +9 -0
- package/dist/features/categories/category-resolver.d.ts +6 -0
- package/dist/features/categories/index.d.ts +3 -0
- package/dist/features/categories/prompt-appends.d.ts +10 -0
- package/dist/features/loops/file-store.d.ts +22 -0
- package/dist/features/loops/handler.d.ts +9 -0
- package/dist/features/loops/index.d.ts +5 -0
- package/dist/features/loops/memory-store.d.ts +11 -0
- package/dist/features/loops/plugin.d.ts +34 -0
- package/dist/features/loops/shared/event-utils.d.ts +7 -0
- package/dist/features/loops/state.d.ts +22 -0
- package/dist/features/prompt-builder/agent-table-builder.d.ts +6 -0
- package/dist/features/prompt-builder/category-section-builder.d.ts +2 -0
- package/dist/features/prompt-builder/dynamic-prompt-builder.d.ts +9 -0
- package/dist/features/prompt-builder/index.d.ts +7 -0
- package/dist/features/prompt-builder/skill-section-builder.d.ts +5 -0
- package/dist/features/session-state/index.d.ts +5 -0
- package/dist/features/session-state/session-cursor.d.ts +13 -0
- package/dist/features/session-state/session-store.d.ts +12 -0
- package/dist/features/session-state/session-tools-store.d.ts +4 -0
- package/dist/features/skills/builtin/git-master.d.ts +2 -0
- package/dist/features/skills/index.d.ts +10 -0
- package/dist/features/skills/skill-loader.d.ts +22 -0
- package/dist/features/skills/skill-merger.d.ts +2 -0
- package/dist/features/slash-commands/command-registry.d.ts +3 -0
- package/dist/features/slash-commands/commands/cancel-loop.d.ts +2 -0
- package/dist/features/slash-commands/commands/handoff.d.ts +2 -0
- package/dist/features/slash-commands/commands/init-deep.d.ts +2 -0
- package/dist/features/slash-commands/commands/loop.d.ts +2 -0
- package/dist/features/slash-commands/commands/start-work.d.ts +2 -0
- package/dist/features/slash-commands/commands/stop-continuation.d.ts +2 -0
- package/dist/features/slash-commands/index.d.ts +2 -0
- package/dist/features/slash-commands/types.d.ts +5 -0
- package/dist/hooks/anthropic-effort/handler.d.ts +5 -0
- package/dist/hooks/anthropic-effort/index.d.ts +3 -0
- package/dist/hooks/anthropic-effort/plugin.d.ts +1 -0
- package/dist/hooks/builtin-hooks.d.ts +2 -0
- package/dist/hooks/comment-checker/handler.d.ts +5 -0
- package/dist/hooks/comment-checker/index.d.ts +2 -0
- package/dist/hooks/comment-checker/plugin.d.ts +1 -0
- package/dist/hooks/compaction-context/handler.d.ts +2 -0
- package/dist/hooks/compaction-context/index.d.ts +2 -0
- package/dist/hooks/compaction-context/plugin.d.ts +1 -0
- package/dist/hooks/compaction-todo-preserver/handler.d.ts +4 -0
- package/dist/hooks/compaction-todo-preserver/index.d.ts +2 -0
- package/dist/hooks/compaction-todo-preserver/plugin.d.ts +1 -0
- package/dist/hooks/context-injector/handlers/agents.d.ts +1 -0
- package/dist/hooks/context-injector/handlers/readme.d.ts +1 -0
- package/dist/hooks/context-injector/handlers/rules.d.ts +1 -0
- package/dist/hooks/context-injector/index.d.ts +4 -0
- package/dist/hooks/context-injector/plugin.d.ts +1 -0
- package/dist/hooks/context-window-limit/handler.d.ts +6 -0
- package/dist/hooks/context-window-limit/index.d.ts +2 -0
- package/dist/hooks/context-window-limit/plugin.d.ts +1 -0
- package/dist/hooks/delegate-retry/handler.d.ts +16 -0
- package/dist/hooks/delegate-retry/index.d.ts +3 -0
- package/dist/hooks/delegate-retry/plugin.d.ts +1 -0
- package/dist/hooks/edit-error/handler.d.ts +6 -0
- package/dist/hooks/edit-error/index.d.ts +2 -0
- package/dist/hooks/edit-error/plugin.d.ts +1 -0
- package/dist/hooks/empty-response-detector/handler.d.ts +5 -0
- package/dist/hooks/empty-response-detector/index.d.ts +2 -0
- package/dist/hooks/empty-response-detector/plugin.d.ts +1 -0
- package/dist/hooks/error-diagnostics/handler.d.ts +6 -0
- package/dist/hooks/error-diagnostics/patterns.d.ts +3 -0
- package/dist/hooks/error-diagnostics/plugin.d.ts +1 -0
- package/dist/hooks/error-diagnostics/types.d.ts +14 -0
- package/dist/hooks/foreground-fallback/handler.d.ts +22 -0
- package/dist/hooks/foreground-fallback/index.d.ts +2 -0
- package/dist/hooks/foreground-fallback/plugin.d.ts +1 -0
- package/dist/hooks/hashline-diff-enhancer/handler.d.ts +28 -0
- package/dist/hooks/hashline-diff-enhancer/index.d.ts +2 -0
- package/dist/hooks/hashline-diff-enhancer/plugin.d.ts +1 -0
- package/dist/hooks/hashline-read-enhancer/handler.d.ts +4 -0
- package/dist/hooks/hashline-read-enhancer/index.d.ts +2 -0
- package/dist/hooks/hashline-read-enhancer/plugin.d.ts +1 -0
- package/dist/hooks/hook-composer.d.ts +4 -0
- package/dist/hooks/hook-ordering.d.ts +9 -0
- package/dist/hooks/hook-types.d.ts +3 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/json-error/handler.d.ts +6 -0
- package/dist/hooks/json-error/index.d.ts +2 -0
- package/dist/hooks/json-error/plugin.d.ts +1 -0
- package/dist/hooks/keyword-detector/handler.d.ts +8 -0
- package/dist/hooks/keyword-detector/index.d.ts +3 -0
- package/dist/hooks/keyword-detector/plugin.d.ts +1 -0
- package/dist/hooks/model-fallback/handler.d.ts +21 -0
- package/dist/hooks/model-fallback/index.d.ts +2 -0
- package/dist/hooks/model-fallback/plugin.d.ts +1 -0
- package/dist/hooks/phase-reminder/handler.d.ts +5 -0
- package/dist/hooks/phase-reminder/index.d.ts +2 -0
- package/dist/hooks/phase-reminder/plugin.d.ts +1 -0
- package/dist/hooks/post-read-nudge/handler.d.ts +5 -0
- package/dist/hooks/post-read-nudge/index.d.ts +2 -0
- package/dist/hooks/post-read-nudge/plugin.d.ts +1 -0
- package/dist/hooks/preemptive-compaction/handler.d.ts +31 -0
- package/dist/hooks/preemptive-compaction/index.d.ts +2 -0
- package/dist/hooks/preemptive-compaction/plugin.d.ts +1 -0
- package/dist/hooks/runtime-fallback/handler.d.ts +21 -0
- package/dist/hooks/runtime-fallback/index.d.ts +2 -0
- package/dist/hooks/runtime-fallback/plugin.d.ts +1 -0
- package/dist/hooks/safe-hook-wrapper.d.ts +2 -0
- package/dist/hooks/session-recovery/handler.d.ts +6 -0
- package/dist/hooks/session-recovery/index.d.ts +2 -0
- package/dist/hooks/session-recovery/plugin.d.ts +1 -0
- package/dist/hooks/skill-discovery/plugin.d.ts +1 -0
- package/dist/hooks/stop-guard/handler.d.ts +4 -0
- package/dist/hooks/stop-guard/index.d.ts +2 -0
- package/dist/hooks/stop-guard/plugin.d.ts +1 -0
- package/dist/hooks/task-resume-info/handler.d.ts +4 -0
- package/dist/hooks/task-resume-info/index.d.ts +2 -0
- package/dist/hooks/task-resume-info/plugin.d.ts +1 -0
- package/dist/hooks/think-mode/handler.d.ts +4 -0
- package/dist/hooks/think-mode/index.d.ts +2 -0
- package/dist/hooks/think-mode/plugin.d.ts +1 -0
- package/dist/hooks/thinking-block-validator/handler.d.ts +4 -0
- package/dist/hooks/thinking-block-validator/index.d.ts +2 -0
- package/dist/hooks/thinking-block-validator/plugin.d.ts +1 -0
- package/dist/hooks/todo-enforcer/handler.d.ts +4 -0
- package/dist/hooks/todo-enforcer/index.d.ts +2 -0
- package/dist/hooks/todo-enforcer/plugin.d.ts +1 -0
- package/dist/hooks/todowrite-disabler/handler.d.ts +6 -0
- package/dist/hooks/todowrite-disabler/index.d.ts +2 -0
- package/dist/hooks/todowrite-disabler/plugin.d.ts +1 -0
- package/dist/hooks/tool-output-truncator/handler.d.ts +4 -0
- package/dist/hooks/tool-output-truncator/index.d.ts +2 -0
- package/dist/hooks/tool-output-truncator/plugin.d.ts +1 -0
- package/dist/hooks/write-file-guard/handler.d.ts +7 -0
- package/dist/hooks/write-file-guard/index.d.ts +2 -0
- package/dist/hooks/write-file-guard/plugin.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8547 -0
- package/dist/plugin/compositor.d.ts +9 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin-api/define-plugin.d.ts +33 -0
- package/dist/plugin-api/index.d.ts +3 -0
- package/dist/plugin-api/types.d.ts +10 -0
- package/dist/registry/agent-aggregator.d.ts +3 -0
- package/dist/registry/contribution-aggregator.d.ts +10 -0
- package/dist/registry/dependency-resolver.d.ts +3 -0
- package/dist/registry/hook-aggregator.d.ts +2 -0
- package/dist/registry/index.d.ts +6 -0
- package/dist/registry/plugin-registry.d.ts +16 -0
- package/dist/registry/tool-aggregator.d.ts +3 -0
- package/dist/registry/types.d.ts +9 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/shared/data-path.d.ts +4 -0
- package/dist/shared/deep-merge.d.ts +13 -0
- package/dist/shared/fallback-chain.d.ts +1 -0
- package/dist/shared/index.d.ts +19 -0
- package/dist/shared/logger.d.ts +4 -0
- package/dist/shared/model-availability.d.ts +1 -0
- package/dist/shared/model-normalization.d.ts +6 -0
- package/dist/shared/model-prefix-map.d.ts +11 -0
- package/dist/shared/model-resolution-pipeline.d.ts +14 -0
- package/dist/shared/models-dev.d.ts +29 -0
- package/dist/shared/provider-discovery.d.ts +28 -0
- package/dist/shared/provider-registry.d.ts +16 -0
- package/dist/shared/safe-create-hook.d.ts +3 -0
- package/dist/shared/snake-case.d.ts +1 -0
- package/dist/shared/truncate-description.d.ts +1 -0
- package/dist/test-utils/index.d.ts +6 -0
- package/dist/test-utils/mock-agent-config.d.ts +5 -0
- package/dist/test-utils/mock-hook-inputs.d.ts +20 -0
- package/dist/test-utils/mock-hook-outputs.d.ts +20 -0
- package/dist/test-utils/mock-plugin-context.d.ts +6 -0
- package/dist/test-utils/mock-sdk-client.d.ts +41 -0
- package/dist/test-utils/mock-tool-context.d.ts +6 -0
- package/dist/tools/ast-grep/index.d.ts +4 -0
- package/dist/tools/ast-grep/replace/handler.d.ts +7 -0
- package/dist/tools/ast-grep/replace/plugin.d.ts +1 -0
- package/dist/tools/ast-grep/replace/types.d.ts +37 -0
- package/dist/tools/ast-grep/search/handler.d.ts +14 -0
- package/dist/tools/ast-grep/search/plugin.d.ts +1 -0
- package/dist/tools/ast-grep/search/types.d.ts +37 -0
- package/dist/tools/background-task/cancel/handler.d.ts +4 -0
- package/dist/tools/background-task/cancel/plugin.d.ts +2 -0
- package/dist/tools/background-task/cancel/types.d.ts +4 -0
- package/dist/tools/background-task/index.d.ts +2 -0
- package/dist/tools/background-task/output/handler.d.ts +3 -0
- package/dist/tools/background-task/output/plugin.d.ts +2 -0
- package/dist/tools/background-task/output/types.d.ts +11 -0
- package/dist/tools/bridge.d.ts +7 -0
- package/dist/tools/builtin-tools.d.ts +2 -0
- package/dist/tools/delegate-task/category-resolver.d.ts +4 -0
- package/dist/tools/delegate-task/constants.d.ts +3 -0
- package/dist/tools/delegate-task/executor.d.ts +10 -0
- package/dist/tools/delegate-task/handler.d.ts +3 -0
- package/dist/tools/delegate-task/index.d.ts +7 -0
- package/dist/tools/delegate-task/plugin.d.ts +2 -0
- package/dist/tools/delegate-task/types.d.ts +17 -0
- package/dist/tools/glob/handler.d.ts +7 -0
- package/dist/tools/glob/index.d.ts +2 -0
- package/dist/tools/glob/plugin.d.ts +1 -0
- package/dist/tools/glob/types.d.ts +7 -0
- package/dist/tools/grep/handler.d.ts +13 -0
- package/dist/tools/grep/index.d.ts +2 -0
- package/dist/tools/grep/plugin.d.ts +1 -0
- package/dist/tools/grep/types.d.ts +15 -0
- package/dist/tools/hashline-edit/constants.d.ts +4 -0
- package/dist/tools/hashline-edit/edit-operations.d.ts +4 -0
- package/dist/tools/hashline-edit/handler.d.ts +5 -0
- package/dist/tools/hashline-edit/hash-computation.d.ts +2 -0
- package/dist/tools/hashline-edit/index.d.ts +5 -0
- package/dist/tools/hashline-edit/plugin.d.ts +3 -0
- package/dist/tools/hashline-edit/types.d.ts +21 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/look-at/handler.d.ts +6 -0
- package/dist/tools/look-at/index.d.ts +3 -0
- package/dist/tools/look-at/plugin.d.ts +1 -0
- package/dist/tools/look-at/types.d.ts +9 -0
- package/dist/tools/lsp/client.d.ts +7 -0
- package/dist/tools/lsp/diagnostics/handler.d.ts +2 -0
- package/dist/tools/lsp/diagnostics/plugin.d.ts +1 -0
- package/dist/tools/lsp/diagnostics/types.d.ts +13 -0
- package/dist/tools/lsp/find-references/handler.d.ts +2 -0
- package/dist/tools/lsp/find-references/plugin.d.ts +1 -0
- package/dist/tools/lsp/find-references/types.d.ts +8 -0
- package/dist/tools/lsp/goto-definition/handler.d.ts +2 -0
- package/dist/tools/lsp/goto-definition/plugin.d.ts +1 -0
- package/dist/tools/lsp/goto-definition/types.d.ts +7 -0
- package/dist/tools/lsp/index.d.ts +6 -0
- package/dist/tools/lsp/prepare-rename/handler.d.ts +2 -0
- package/dist/tools/lsp/prepare-rename/plugin.d.ts +1 -0
- package/dist/tools/lsp/prepare-rename/types.d.ts +7 -0
- package/dist/tools/lsp/rename/handler.d.ts +2 -0
- package/dist/tools/lsp/rename/plugin.d.ts +1 -0
- package/dist/tools/lsp/rename/types.d.ts +8 -0
- package/dist/tools/lsp/symbols/handler.d.ts +2 -0
- package/dist/tools/lsp/symbols/plugin.d.ts +1 -0
- package/dist/tools/lsp/symbols/types.d.ts +11 -0
- package/dist/tools/session-manager/client-context.d.ts +3 -0
- package/dist/tools/session-manager/index.d.ts +5 -0
- package/dist/tools/session-manager/info/handler.d.ts +3 -0
- package/dist/tools/session-manager/info/plugin.d.ts +1 -0
- package/dist/tools/session-manager/info/types.d.ts +3 -0
- package/dist/tools/session-manager/list/handler.d.ts +3 -0
- package/dist/tools/session-manager/list/plugin.d.ts +1 -0
- package/dist/tools/session-manager/list/types.d.ts +6 -0
- package/dist/tools/session-manager/read/handler.d.ts +3 -0
- package/dist/tools/session-manager/read/plugin.d.ts +1 -0
- package/dist/tools/session-manager/read/types.d.ts +6 -0
- package/dist/tools/session-manager/search/handler.d.ts +3 -0
- package/dist/tools/session-manager/search/plugin.d.ts +1 -0
- package/dist/tools/session-manager/search/types.d.ts +6 -0
- package/dist/tools/session-manager/session-formatter.d.ts +29 -0
- package/dist/tools/session-manager/types.d.ts +36 -0
- package/dist/tools/shared/constants.d.ts +3 -0
- package/dist/tools/skill/handler.d.ts +4 -0
- package/dist/tools/skill/index.d.ts +3 -0
- package/dist/tools/skill/plugin.d.ts +1 -0
- package/dist/tools/skill/types.d.ts +12 -0
- package/dist/tools/skill-mcp/handler.d.ts +5 -0
- package/dist/tools/skill-mcp/index.d.ts +3 -0
- package/dist/tools/skill-mcp/plugin.d.ts +1 -0
- package/dist/tools/skill-mcp/types.d.ts +13 -0
- package/dist/tools/task/create/handler.d.ts +2 -0
- package/dist/tools/task/create/plugin.d.ts +1 -0
- package/dist/tools/task/format-task.d.ts +2 -0
- package/dist/tools/task/get/handler.d.ts +2 -0
- package/dist/tools/task/get/plugin.d.ts +1 -0
- package/dist/tools/task/index.d.ts +4 -0
- package/dist/tools/task/list/handler.d.ts +2 -0
- package/dist/tools/task/list/plugin.d.ts +1 -0
- package/dist/tools/task/storage.d.ts +7 -0
- package/dist/tools/task/types.d.ts +84 -0
- package/dist/tools/task/update/handler.d.ts +2 -0
- package/dist/tools/task/update/plugin.d.ts +1 -0
- package/dist/tools/tool-builder.d.ts +7 -0
- package/dist/tools/tool-registry-adapter.d.ts +3 -0
- package/dist/types/agent.d.ts +40 -0
- package/dist/types/category.d.ts +22 -0
- package/dist/types/config.d.ts +23 -0
- package/dist/types/hook.d.ts +18 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/plugin.d.ts +41 -0
- package/dist/types/tool.d.ts +7 -0
- package/eval/README.md +160 -0
- package/eval/ablation-config.yaml +43 -0
- package/eval/assertions/ablation-scorer.ts +81 -0
- package/eval/assertions/hook-impact.ts +152 -0
- package/eval/assertions/task-completion.ts +65 -0
- package/eval/assertions/tool-accuracy.ts +56 -0
- package/eval/promptfooconfig.yaml +42 -0
- package/eval/providers/opencode-baseline.ts +63 -0
- package/eval/providers/opencode-client.ts +112 -0
- package/eval/providers/opencode-provider.ts +66 -0
- package/eval/spike/config.yaml +13 -0
- package/eval/spike/provider.ts +15 -0
- package/npm-reserve/README.md +19 -0
- package/npm-reserve/package.json +24 -0
- package/opencode.json +6 -0
- package/package.json +47 -8
- package/src/agents/advisor/config.ts +6 -0
- package/src/agents/advisor/index.ts +2 -0
- package/src/agents/advisor/plugin.test.ts +48 -0
- package/src/agents/advisor/plugin.ts +17 -0
- package/src/agents/advisor/prompt-meta.ts +14 -0
- package/src/agents/advisor/prompt.ts +93 -0
- package/src/agents/agent-builder.test.ts +66 -0
- package/src/agents/agent-builder.ts +97 -0
- package/src/agents/agent-plugins.test.ts +98 -0
- package/src/agents/agent-registry.ts +25 -0
- package/src/agents/builtin-agents.ts +18 -0
- package/src/agents/deep-worker/config.ts +6 -0
- package/src/agents/deep-worker/index.ts +2 -0
- package/src/agents/deep-worker/plugin.test.ts +31 -0
- package/src/agents/deep-worker/plugin.ts +16 -0
- package/src/agents/deep-worker/prompt-meta.ts +14 -0
- package/src/agents/deep-worker/prompt.ts +121 -0
- package/src/agents/disabled/analyst/config.ts +6 -0
- package/src/agents/disabled/analyst/index.ts +2 -0
- package/src/agents/disabled/analyst/plugin.ts +16 -0
- package/src/agents/disabled/analyst/prompt.ts +1 -0
- package/src/agents/disabled/executor/config.ts +9 -0
- package/src/agents/disabled/executor/index.ts +2 -0
- package/src/agents/disabled/executor/plugin.ts +16 -0
- package/src/agents/disabled/executor/prompt.ts +1 -0
- package/src/agents/disabled/inspector/config.ts +6 -0
- package/src/agents/disabled/inspector/index.ts +2 -0
- package/src/agents/disabled/inspector/plugin.ts +18 -0
- package/src/agents/disabled/inspector/prompt.ts +1 -0
- package/src/agents/disabled/reviewer/config.ts +6 -0
- package/src/agents/disabled/reviewer/index.ts +2 -0
- package/src/agents/disabled/reviewer/plugin.ts +18 -0
- package/src/agents/disabled/reviewer/prompt.ts +1 -0
- package/src/agents/explorer/config.ts +6 -0
- package/src/agents/explorer/index.ts +2 -0
- package/src/agents/explorer/plugin.test.ts +36 -0
- package/src/agents/explorer/plugin.ts +15 -0
- package/src/agents/explorer/prompt-meta.ts +14 -0
- package/src/agents/explorer/prompt.ts +96 -0
- package/src/agents/fallback-chains.ts +13 -0
- package/src/agents/index.ts +18 -0
- package/src/agents/model-resolution.test.ts +79 -0
- package/src/agents/orchestrator/config.ts +10 -0
- package/src/agents/orchestrator/index.ts +2 -0
- package/src/agents/orchestrator/plugin.test.ts +31 -0
- package/src/agents/orchestrator/plugin.ts +16 -0
- package/src/agents/orchestrator/prompt-meta.ts +14 -0
- package/src/agents/orchestrator/prompt.ts +143 -0
- package/src/agents/planner/config.ts +6 -0
- package/src/agents/planner/index.ts +2 -0
- package/src/agents/planner/plugin.test.ts +31 -0
- package/src/agents/planner/plugin.ts +16 -0
- package/src/agents/planner/prompt-meta.ts +14 -0
- package/src/agents/planner/prompt.ts +138 -0
- package/src/agents/prompt-meta.ts +12 -0
- package/src/agents/prompt-registry.test.ts +98 -0
- package/src/agents/prompt-registry.ts +22 -0
- package/src/agents/researcher/config.ts +6 -0
- package/src/agents/researcher/index.ts +2 -0
- package/src/agents/researcher/plugin.test.ts +31 -0
- package/src/agents/researcher/plugin.ts +16 -0
- package/src/agents/researcher/prompt-meta.ts +14 -0
- package/src/agents/researcher/prompt.ts +116 -0
- package/src/agents/tool-restrictions.ts +87 -0
- package/src/agents/worker/config.ts +6 -0
- package/src/agents/worker/index.ts +2 -0
- package/src/agents/worker/plugin.test.ts +31 -0
- package/src/agents/worker/plugin.ts +15 -0
- package/src/agents/worker/prompt-meta.ts +14 -0
- package/src/agents/worker/prompt.ts +83 -0
- package/src/bootstrap.integration.test.ts +168 -0
- package/src/bootstrap.ts +171 -0
- package/src/cli/cli.ts +42 -0
- package/src/cli/commands/install.test.ts +40 -0
- package/src/cli/commands/install.ts +125 -0
- package/src/cli/commands/update.test.ts +84 -0
- package/src/cli/commands/update.ts +45 -0
- package/src/cli/config-generator.test.ts +178 -0
- package/src/cli/config-generator.ts +119 -0
- package/src/cli/index.test.ts +34 -0
- package/src/cli/index.ts +4 -0
- package/src/config/defaults.ts +24 -0
- package/src/config/define-config.ts +38 -0
- package/src/config/index.ts +6 -0
- package/src/config/loader.test.ts +218 -0
- package/src/config/loader.ts +89 -0
- package/src/config/paths.ts +30 -0
- package/src/config/schema.test.ts +69 -0
- package/src/config/schema.ts +57 -0
- package/src/config/validator.ts +24 -0
- package/src/features/auto-update/auto-update.test.ts +105 -0
- package/src/features/auto-update/index.ts +4 -0
- package/src/features/auto-update/plugin.ts +45 -0
- package/src/features/auto-update/update-checker.ts +66 -0
- package/src/features/background-agent/concurrency.test.ts +65 -0
- package/src/features/background-agent/concurrency.ts +44 -0
- package/src/features/background-agent/index.ts +12 -0
- package/src/features/background-agent/manager.ts +214 -0
- package/src/features/background-agent/poller.test.ts +33 -0
- package/src/features/background-agent/poller.ts +75 -0
- package/src/features/background-agent/singleton.ts +26 -0
- package/src/features/background-agent/spawner.ts +51 -0
- package/src/features/background-agent/types.ts +20 -0
- package/src/features/builtin-features.ts +5 -0
- package/src/features/categories/categories.test.ts +68 -0
- package/src/features/categories/category-config.ts +70 -0
- package/src/features/categories/category-resolver.ts +36 -0
- package/src/features/categories/index.ts +8 -0
- package/src/features/categories/prompt-appends.ts +38 -0
- package/src/features/loops/file-store.ts +151 -0
- package/src/features/loops/handler.ts +89 -0
- package/src/features/loops/index.ts +28 -0
- package/src/features/loops/loops.test.ts +175 -0
- package/src/features/loops/memory-store.ts +53 -0
- package/src/features/loops/plugin.ts +107 -0
- package/src/features/loops/shared/event-utils.ts +50 -0
- package/src/features/loops/state.ts +44 -0
- package/src/features/prompt-builder/agent-table-builder.ts +23 -0
- package/src/features/prompt-builder/category-section-builder.ts +21 -0
- package/src/features/prompt-builder/dynamic-prompt-builder.ts +42 -0
- package/src/features/prompt-builder/index.ts +7 -0
- package/src/features/prompt-builder/prompt-builder.test.ts +244 -0
- package/src/features/prompt-builder/skill-section-builder.ts +25 -0
- package/src/features/session-state/index.ts +17 -0
- package/src/features/session-state/session-cursor.test.ts +137 -0
- package/src/features/session-state/session-cursor.ts +80 -0
- package/src/features/session-state/session-store.test.ts +82 -0
- package/src/features/session-state/session-store.ts +37 -0
- package/src/features/session-state/session-tools-store.ts +18 -0
- package/src/features/skills/builtin/git-master.ts +109 -0
- package/src/features/skills/index.ts +97 -0
- package/src/features/skills/skill-loader.ts +133 -0
- package/src/features/skills/skill-merger.ts +15 -0
- package/src/features/skills/skills.test.ts +120 -0
- package/src/features/slash-commands/command-registry.ts +36 -0
- package/src/features/slash-commands/commands/cancel-loop.ts +17 -0
- package/src/features/slash-commands/commands/handoff.ts +59 -0
- package/src/features/slash-commands/commands/init-deep.ts +40 -0
- package/src/features/slash-commands/commands/loop.ts +39 -0
- package/src/features/slash-commands/commands/start-work.ts +39 -0
- package/src/features/slash-commands/commands/stop-continuation.ts +21 -0
- package/src/features/slash-commands/index.ts +2 -0
- package/src/features/slash-commands/slash-commands.test.ts +68 -0
- package/src/features/slash-commands/types.ts +5 -0
- package/src/hooks/anthropic-effort/handler.test.ts +156 -0
- package/src/hooks/anthropic-effort/handler.ts +64 -0
- package/src/hooks/anthropic-effort/index.ts +3 -0
- package/src/hooks/anthropic-effort/plugin.ts +17 -0
- package/src/hooks/builtin-hooks.ts +64 -0
- package/src/hooks/comment-checker/handler.test.ts +65 -0
- package/src/hooks/comment-checker/handler.ts +60 -0
- package/src/hooks/comment-checker/index.ts +2 -0
- package/src/hooks/comment-checker/plugin.ts +15 -0
- package/src/hooks/compaction-context/handler.test.ts +160 -0
- package/src/hooks/compaction-context/handler.ts +179 -0
- package/src/hooks/compaction-context/index.ts +5 -0
- package/src/hooks/compaction-context/plugin.ts +40 -0
- package/src/hooks/compaction-todo-preserver/handler.test.ts +155 -0
- package/src/hooks/compaction-todo-preserver/handler.ts +129 -0
- package/src/hooks/compaction-todo-preserver/index.ts +2 -0
- package/src/hooks/compaction-todo-preserver/plugin.ts +18 -0
- package/src/hooks/context-injection.test.ts +124 -0
- package/src/hooks/context-injector/handlers/agents.test.ts +90 -0
- package/src/hooks/context-injector/handlers/agents.ts +81 -0
- package/src/hooks/context-injector/handlers/readme.ts +55 -0
- package/src/hooks/context-injector/handlers/rules.ts +62 -0
- package/src/hooks/context-injector/index.ts +4 -0
- package/src/hooks/context-injector/plugin.ts +56 -0
- package/src/hooks/context-window-limit/handler.test.ts +103 -0
- package/src/hooks/context-window-limit/handler.ts +128 -0
- package/src/hooks/context-window-limit/index.ts +6 -0
- package/src/hooks/context-window-limit/plugin.ts +15 -0
- package/src/hooks/continuation.test.ts +103 -0
- package/src/hooks/delegate-retry/handler.test.ts +212 -0
- package/src/hooks/delegate-retry/handler.ts +137 -0
- package/src/hooks/delegate-retry/index.ts +8 -0
- package/src/hooks/delegate-retry/plugin.ts +15 -0
- package/src/hooks/edit-error/handler.test.ts +82 -0
- package/src/hooks/edit-error/handler.ts +50 -0
- package/src/hooks/edit-error/index.ts +6 -0
- package/src/hooks/edit-error/plugin.ts +15 -0
- package/src/hooks/empty-response-detector/handler.test.ts +133 -0
- package/src/hooks/empty-response-detector/handler.ts +62 -0
- package/src/hooks/empty-response-detector/index.ts +2 -0
- package/src/hooks/empty-response-detector/plugin.ts +18 -0
- package/src/hooks/error-diagnostics/error-diagnostics.test.ts +116 -0
- package/src/hooks/error-diagnostics/handler.test.ts +147 -0
- package/src/hooks/error-diagnostics/handler.ts +135 -0
- package/src/hooks/error-diagnostics/patterns.ts +93 -0
- package/src/hooks/error-diagnostics/plugin.ts +11 -0
- package/src/hooks/error-diagnostics/types.ts +26 -0
- package/src/hooks/error-recovery.test.ts +85 -0
- package/src/hooks/foreground-fallback/handler.test.ts +229 -0
- package/src/hooks/foreground-fallback/handler.ts +294 -0
- package/src/hooks/foreground-fallback/index.ts +2 -0
- package/src/hooks/foreground-fallback/plugin.ts +18 -0
- package/src/hooks/hashline-diff-enhancer/handler.test.ts +166 -0
- package/src/hooks/hashline-diff-enhancer/handler.ts +186 -0
- package/src/hooks/hashline-diff-enhancer/index.ts +6 -0
- package/src/hooks/hashline-diff-enhancer/plugin.ts +24 -0
- package/src/hooks/hashline-read-enhancer/handler.test.ts +121 -0
- package/src/hooks/hashline-read-enhancer/handler.ts +165 -0
- package/src/hooks/hashline-read-enhancer/index.ts +2 -0
- package/src/hooks/hashline-read-enhancer/plugin.ts +18 -0
- package/src/hooks/hook-composer.test.ts +52 -0
- package/src/hooks/hook-composer.ts +17 -0
- package/src/hooks/hook-composition.integration.test.ts +274 -0
- package/src/hooks/hook-ordering.ts +41 -0
- package/src/hooks/hook-types.ts +22 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/json-error/handler.test.ts +95 -0
- package/src/hooks/json-error/handler.ts +82 -0
- package/src/hooks/json-error/index.ts +6 -0
- package/src/hooks/json-error/plugin.ts +15 -0
- package/src/hooks/keyword-detector/handler.test.ts +113 -0
- package/src/hooks/keyword-detector/handler.ts +73 -0
- package/src/hooks/keyword-detector/index.ts +8 -0
- package/src/hooks/keyword-detector/plugin.ts +24 -0
- package/src/hooks/model-fallback/handler.test.ts +163 -0
- package/src/hooks/model-fallback/handler.ts +178 -0
- package/src/hooks/model-fallback/index.ts +2 -0
- package/src/hooks/model-fallback/plugin.ts +11 -0
- package/src/hooks/model-management.test.ts +121 -0
- package/src/hooks/phase-reminder/handler.test.ts +105 -0
- package/src/hooks/phase-reminder/handler.ts +54 -0
- package/src/hooks/phase-reminder/index.ts +2 -0
- package/src/hooks/phase-reminder/plugin.ts +18 -0
- package/src/hooks/post-read-nudge/handler.test.ts +106 -0
- package/src/hooks/post-read-nudge/handler.ts +28 -0
- package/src/hooks/post-read-nudge/index.ts +2 -0
- package/src/hooks/post-read-nudge/plugin.ts +18 -0
- package/src/hooks/preemptive-compaction/handler.test.ts +130 -0
- package/src/hooks/preemptive-compaction/handler.ts +84 -0
- package/src/hooks/preemptive-compaction/index.ts +2 -0
- package/src/hooks/preemptive-compaction/plugin.ts +15 -0
- package/src/hooks/productivity.test.ts +332 -0
- package/src/hooks/quality.test.ts +330 -0
- package/src/hooks/runtime-fallback/handler.test.ts +142 -0
- package/src/hooks/runtime-fallback/handler.ts +171 -0
- package/src/hooks/runtime-fallback/index.ts +2 -0
- package/src/hooks/runtime-fallback/plugin.ts +13 -0
- package/src/hooks/safe-hook-wrapper.test.ts +35 -0
- package/src/hooks/safe-hook-wrapper.ts +12 -0
- package/src/hooks/session-recovery/handler.test.ts +88 -0
- package/src/hooks/session-recovery/handler.ts +87 -0
- package/src/hooks/session-recovery/index.ts +6 -0
- package/src/hooks/session-recovery/plugin.ts +15 -0
- package/src/hooks/skill-discovery/plugin.ts +45 -0
- package/src/hooks/stop-guard/handler.test.ts +147 -0
- package/src/hooks/stop-guard/handler.ts +127 -0
- package/src/hooks/stop-guard/index.ts +2 -0
- package/src/hooks/stop-guard/plugin.ts +15 -0
- package/src/hooks/task-hooks.test.ts +324 -0
- package/src/hooks/task-resume-info/handler.test.ts +180 -0
- package/src/hooks/task-resume-info/handler.ts +61 -0
- package/src/hooks/task-resume-info/index.ts +2 -0
- package/src/hooks/task-resume-info/plugin.ts +15 -0
- package/src/hooks/think-mode/handler.test.ts +139 -0
- package/src/hooks/think-mode/handler.ts +50 -0
- package/src/hooks/think-mode/index.ts +2 -0
- package/src/hooks/think-mode/plugin.ts +15 -0
- package/src/hooks/thinking-block-validator/handler.test.ts +79 -0
- package/src/hooks/thinking-block-validator/handler.ts +93 -0
- package/src/hooks/thinking-block-validator/index.ts +2 -0
- package/src/hooks/thinking-block-validator/plugin.ts +18 -0
- package/src/hooks/todo-enforcer/handler.test.ts +153 -0
- package/src/hooks/todo-enforcer/handler.ts +100 -0
- package/src/hooks/todo-enforcer/index.ts +2 -0
- package/src/hooks/todo-enforcer/plugin.ts +15 -0
- package/src/hooks/todowrite-disabler/handler.test.ts +119 -0
- package/src/hooks/todowrite-disabler/handler.ts +50 -0
- package/src/hooks/todowrite-disabler/index.ts +6 -0
- package/src/hooks/todowrite-disabler/plugin.ts +46 -0
- package/src/hooks/tool-output-truncator/handler.test.ts +113 -0
- package/src/hooks/tool-output-truncator/handler.ts +83 -0
- package/src/hooks/tool-output-truncator/index.ts +2 -0
- package/src/hooks/tool-output-truncator/plugin.ts +18 -0
- package/src/hooks/tool-output.test.ts +238 -0
- package/src/hooks/workflow-reminders.test.ts +187 -0
- package/src/hooks/write-file-guard/handler.test.ts +107 -0
- package/src/hooks/write-file-guard/handler.ts +166 -0
- package/src/hooks/write-file-guard/index.ts +2 -0
- package/src/hooks/write-file-guard/plugin.ts +23 -0
- package/src/index.ts +8 -0
- package/src/plugin/compositor.ts +99 -0
- package/src/plugin/index.ts +1 -0
- package/src/plugin-api/define-plugin.test.ts +66 -0
- package/src/plugin-api/define-plugin.ts +36 -0
- package/src/plugin-api/index.ts +26 -0
- package/src/plugin-api/types.ts +28 -0
- package/src/registry/agent-aggregator.ts +13 -0
- package/src/registry/contribution-aggregator.test.ts +62 -0
- package/src/registry/contribution-aggregator.ts +114 -0
- package/src/registry/contribution-conflicts.integration.test.ts +186 -0
- package/src/registry/dependency-resolver.test.ts +35 -0
- package/src/registry/dependency-resolver.ts +64 -0
- package/src/registry/hook-aggregator.test.ts +78 -0
- package/src/registry/hook-aggregator.ts +63 -0
- package/src/registry/index.ts +6 -0
- package/src/registry/plugin-lifecycle.integration.test.ts +94 -0
- package/src/registry/plugin-overrides.integration.test.ts +140 -0
- package/src/registry/plugin-registry.test.ts +56 -0
- package/src/registry/plugin-registry.ts +82 -0
- package/src/registry/tool-aggregator.ts +13 -0
- package/src/registry/types.ts +11 -0
- package/src/runtime/index.ts +43 -0
- package/src/shared/data-path.ts +18 -0
- package/src/shared/deep-merge.test.ts +36 -0
- package/src/shared/deep-merge.ts +61 -0
- package/src/shared/fallback-chain.ts +8 -0
- package/src/shared/index.ts +59 -0
- package/src/shared/logger.ts +54 -0
- package/src/shared/model-availability.ts +18 -0
- package/src/shared/model-normalization.test.ts +75 -0
- package/src/shared/model-normalization.ts +28 -0
- package/src/shared/model-prefix-map.test.ts +75 -0
- package/src/shared/model-prefix-map.ts +58 -0
- package/src/shared/model-resolution-pipeline.test.ts +111 -0
- package/src/shared/model-resolution-pipeline.ts +55 -0
- package/src/shared/models-dev.test.ts +277 -0
- package/src/shared/models-dev.ts +176 -0
- package/src/shared/provider-discovery.test.ts +97 -0
- package/src/shared/provider-discovery.ts +73 -0
- package/src/shared/provider-registry.test.ts +212 -0
- package/src/shared/provider-registry.ts +157 -0
- package/src/shared/safe-create-hook.ts +15 -0
- package/src/shared/snake-case.ts +7 -0
- package/src/shared/truncate-description.ts +6 -0
- package/src/test-utils/index.ts +6 -0
- package/src/test-utils/mock-agent-config.ts +13 -0
- package/src/test-utils/mock-hook-inputs.ts +148 -0
- package/src/test-utils/mock-hook-outputs.ts +153 -0
- package/src/test-utils/mock-plugin-context.test.ts +32 -0
- package/src/test-utils/mock-plugin-context.ts +21 -0
- package/src/test-utils/mock-sdk-client.ts +52 -0
- package/src/test-utils/mock-tool-context.ts +24 -0
- package/src/tools/ast-grep/index.ts +4 -0
- package/src/tools/ast-grep/replace/handler.test.ts +93 -0
- package/src/tools/ast-grep/replace/handler.ts +89 -0
- package/src/tools/ast-grep/replace/plugin.ts +10 -0
- package/src/tools/ast-grep/replace/types.ts +14 -0
- package/src/tools/ast-grep/search/handler.test.ts +94 -0
- package/src/tools/ast-grep/search/handler.ts +93 -0
- package/src/tools/ast-grep/search/plugin.ts +10 -0
- package/src/tools/ast-grep/search/types.ts +42 -0
- package/src/tools/background-task/background-task.test.ts +185 -0
- package/src/tools/background-task/cancel/handler.test.ts +141 -0
- package/src/tools/background-task/cancel/handler.ts +52 -0
- package/src/tools/background-task/cancel/plugin.ts +30 -0
- package/src/tools/background-task/cancel/types.ts +4 -0
- package/src/tools/background-task/index.ts +2 -0
- package/src/tools/background-task/output/handler.test.ts +142 -0
- package/src/tools/background-task/output/handler.ts +93 -0
- package/src/tools/background-task/output/plugin.ts +60 -0
- package/src/tools/background-task/output/types.ts +11 -0
- package/src/tools/bridge.test.ts +55 -0
- package/src/tools/bridge.ts +13 -0
- package/src/tools/builtin-tools.ts +54 -0
- package/src/tools/code-search.test.ts +203 -0
- package/src/tools/delegate-task/category-resolver.ts +18 -0
- package/src/tools/delegate-task/constants.ts +43 -0
- package/src/tools/delegate-task/delegate-task.test.ts +245 -0
- package/src/tools/delegate-task/executor.ts +157 -0
- package/src/tools/delegate-task/handler.ts +74 -0
- package/src/tools/delegate-task/index.ts +7 -0
- package/src/tools/delegate-task/plugin.ts +21 -0
- package/src/tools/delegate-task/types.ts +19 -0
- package/src/tools/glob/handler.test.ts +80 -0
- package/src/tools/glob/handler.ts +74 -0
- package/src/tools/glob/index.ts +2 -0
- package/src/tools/glob/plugin.ts +10 -0
- package/src/tools/glob/types.ts +14 -0
- package/src/tools/grep/handler.test.ts +79 -0
- package/src/tools/grep/handler.ts +104 -0
- package/src/tools/grep/index.ts +2 -0
- package/src/tools/grep/plugin.ts +10 -0
- package/src/tools/grep/types.ts +28 -0
- package/src/tools/hashline-edit/constants.ts +10 -0
- package/src/tools/hashline-edit/edit-operations.ts +115 -0
- package/src/tools/hashline-edit/handler.test.ts +105 -0
- package/src/tools/hashline-edit/handler.ts +33 -0
- package/src/tools/hashline-edit/hash-computation.ts +20 -0
- package/src/tools/hashline-edit/hashline-edit.test.ts +62 -0
- package/src/tools/hashline-edit/index.ts +5 -0
- package/src/tools/hashline-edit/plugin.ts +28 -0
- package/src/tools/hashline-edit/types.ts +42 -0
- package/src/tools/index.ts +4 -0
- package/src/tools/look-at/handler.test.ts +189 -0
- package/src/tools/look-at/handler.ts +232 -0
- package/src/tools/look-at/index.ts +3 -0
- package/src/tools/look-at/look-at.test.ts +200 -0
- package/src/tools/look-at/plugin.ts +10 -0
- package/src/tools/look-at/types.ts +17 -0
- package/src/tools/lsp/client.ts +145 -0
- package/src/tools/lsp/diagnostics/handler.test.ts +94 -0
- package/src/tools/lsp/diagnostics/handler.ts +39 -0
- package/src/tools/lsp/diagnostics/plugin.ts +10 -0
- package/src/tools/lsp/diagnostics/types.ts +15 -0
- package/src/tools/lsp/find-references/handler.test.ts +79 -0
- package/src/tools/lsp/find-references/handler.ts +38 -0
- package/src/tools/lsp/find-references/plugin.ts +10 -0
- package/src/tools/lsp/find-references/types.ts +10 -0
- package/src/tools/lsp/goto-definition/handler.test.ts +80 -0
- package/src/tools/lsp/goto-definition/handler.ts +38 -0
- package/src/tools/lsp/goto-definition/plugin.ts +10 -0
- package/src/tools/lsp/goto-definition/types.ts +9 -0
- package/src/tools/lsp/index.ts +6 -0
- package/src/tools/lsp/lsp-tools.test.ts +150 -0
- package/src/tools/lsp/prepare-rename/handler.test.ts +81 -0
- package/src/tools/lsp/prepare-rename/handler.ts +34 -0
- package/src/tools/lsp/prepare-rename/plugin.ts +10 -0
- package/src/tools/lsp/prepare-rename/types.ts +9 -0
- package/src/tools/lsp/rename/handler.test.ts +87 -0
- package/src/tools/lsp/rename/handler.ts +34 -0
- package/src/tools/lsp/rename/plugin.ts +10 -0
- package/src/tools/lsp/rename/types.ts +10 -0
- package/src/tools/lsp/symbols/handler.test.ts +108 -0
- package/src/tools/lsp/symbols/handler.ts +43 -0
- package/src/tools/lsp/symbols/plugin.ts +10 -0
- package/src/tools/lsp/symbols/types.ts +13 -0
- package/src/tools/session-manager/client-context.ts +16 -0
- package/src/tools/session-manager/index.ts +5 -0
- package/src/tools/session-manager/info/handler.test.ts +100 -0
- package/src/tools/session-manager/info/handler.ts +27 -0
- package/src/tools/session-manager/info/plugin.ts +40 -0
- package/src/tools/session-manager/info/types.ts +3 -0
- package/src/tools/session-manager/list/handler.test.ts +122 -0
- package/src/tools/session-manager/list/handler.ts +56 -0
- package/src/tools/session-manager/list/plugin.ts +52 -0
- package/src/tools/session-manager/list/types.ts +6 -0
- package/src/tools/session-manager/read/handler.test.ts +114 -0
- package/src/tools/session-manager/read/handler.ts +36 -0
- package/src/tools/session-manager/read/plugin.ts +57 -0
- package/src/tools/session-manager/read/types.ts +6 -0
- package/src/tools/session-manager/search/handler.test.ts +115 -0
- package/src/tools/session-manager/search/handler.ts +72 -0
- package/src/tools/session-manager/search/plugin.ts +57 -0
- package/src/tools/session-manager/search/types.ts +6 -0
- package/src/tools/session-manager/session-formatter.ts +315 -0
- package/src/tools/session-manager/session-manager.test.ts +254 -0
- package/src/tools/session-manager/types.ts +41 -0
- package/src/tools/shared/constants.ts +3 -0
- package/src/tools/skill/handler.test.ts +57 -0
- package/src/tools/skill/handler.ts +27 -0
- package/src/tools/skill/index.ts +3 -0
- package/src/tools/skill/plugin.ts +41 -0
- package/src/tools/skill/types.ts +14 -0
- package/src/tools/skill-mcp/handler.test.ts +68 -0
- package/src/tools/skill-mcp/handler.ts +84 -0
- package/src/tools/skill-mcp/index.ts +3 -0
- package/src/tools/skill-mcp/plugin.ts +37 -0
- package/src/tools/skill-mcp/types.ts +15 -0
- package/src/tools/skill-tools.test.ts +172 -0
- package/src/tools/task/create/handler.test.ts +64 -0
- package/src/tools/task/create/handler.ts +43 -0
- package/src/tools/task/create/plugin.ts +10 -0
- package/src/tools/task/format-task.test.ts +37 -0
- package/src/tools/task/format-task.ts +19 -0
- package/src/tools/task/get/handler.test.ts +76 -0
- package/src/tools/task/get/handler.ts +35 -0
- package/src/tools/task/get/plugin.ts +10 -0
- package/src/tools/task/index.ts +4 -0
- package/src/tools/task/list/handler.test.ts +70 -0
- package/src/tools/task/list/handler.ts +48 -0
- package/src/tools/task/list/plugin.ts +10 -0
- package/src/tools/task/storage.ts +14 -0
- package/src/tools/task/task.test.ts +165 -0
- package/src/tools/task/types.ts +51 -0
- package/src/tools/task/update/handler.test.ts +86 -0
- package/src/tools/task/update/handler.ts +54 -0
- package/src/tools/task/update/plugin.ts +10 -0
- package/src/tools/tool-builder.test.ts +32 -0
- package/src/tools/tool-builder.ts +24 -0
- package/src/tools/tool-registry-adapter.test.ts +51 -0
- package/src/tools/tool-registry-adapter.ts +19 -0
- package/src/types/agent.ts +53 -0
- package/src/types/category.ts +32 -0
- package/src/types/config.ts +26 -0
- package/src/types/hook.ts +44 -0
- package/src/types/index.ts +12 -0
- package/src/types/plugin.ts +47 -0
- package/src/types/tool.ts +10 -0
- package/test-setup.ts +8 -0
- package/tsconfig.json +20 -0
- /package/{index.js → npm-reserve/index.js} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from "bun:test";
|
|
2
|
+
import { consumeNewMessages, resetMessageCursor } from "./session-cursor";
|
|
3
|
+
|
|
4
|
+
describe("session-cursor", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
resetMessageCursor();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe("#given no prior cursor state", () => {
|
|
10
|
+
describe("#when consumeNewMessages is called with messages", () => {
|
|
11
|
+
it("#then returns all messages on first call", () => {
|
|
12
|
+
const messages = [
|
|
13
|
+
{ info: { id: "msg-1" } },
|
|
14
|
+
{ info: { id: "msg-2" } },
|
|
15
|
+
{ info: { id: "msg-3" } },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const result = consumeNewMessages("session-1", messages);
|
|
19
|
+
expect(result).toHaveLength(3);
|
|
20
|
+
expect(result).toEqual(messages);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("#when consumeNewMessages is called with empty array", () => {
|
|
25
|
+
it("#then returns empty array", () => {
|
|
26
|
+
const result = consumeNewMessages("session-1", []);
|
|
27
|
+
expect(result).toHaveLength(0);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("#when sessionId is undefined", () => {
|
|
32
|
+
it("#then returns all messages without tracking", () => {
|
|
33
|
+
const messages = [{ info: { id: "msg-1" } }, { info: { id: "msg-2" } }];
|
|
34
|
+
const result = consumeNewMessages(undefined, messages);
|
|
35
|
+
expect(result).toHaveLength(2);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe("#given messages already consumed", () => {
|
|
41
|
+
describe("#when consumeNewMessages is called again with same messages", () => {
|
|
42
|
+
it("#then returns empty array (no new messages)", () => {
|
|
43
|
+
const messages = [{ info: { id: "msg-1" } }, { info: { id: "msg-2" } }];
|
|
44
|
+
|
|
45
|
+
consumeNewMessages("session-2", messages);
|
|
46
|
+
const result = consumeNewMessages("session-2", messages);
|
|
47
|
+
|
|
48
|
+
expect(result).toHaveLength(0);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("#when consumeNewMessages is called with additional messages", () => {
|
|
53
|
+
it("#then returns only the new messages", () => {
|
|
54
|
+
const initial = [{ info: { id: "msg-1" } }, { info: { id: "msg-2" } }];
|
|
55
|
+
const extended = [
|
|
56
|
+
{ info: { id: "msg-1" } },
|
|
57
|
+
{ info: { id: "msg-2" } },
|
|
58
|
+
{ info: { id: "msg-3" } },
|
|
59
|
+
{ info: { id: "msg-4" } },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
consumeNewMessages("session-3", initial);
|
|
63
|
+
const result = consumeNewMessages("session-3", extended);
|
|
64
|
+
|
|
65
|
+
expect(result).toHaveLength(2);
|
|
66
|
+
expect(result[0].info?.id).toBe("msg-3");
|
|
67
|
+
expect(result[1].info?.id).toBe("msg-4");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("#when message list shrinks (history reset)", () => {
|
|
72
|
+
it("#then returns all messages from the beginning", () => {
|
|
73
|
+
const large = [
|
|
74
|
+
{ info: { id: "msg-1" } },
|
|
75
|
+
{ info: { id: "msg-2" } },
|
|
76
|
+
{ info: { id: "msg-3" } },
|
|
77
|
+
];
|
|
78
|
+
const small = [{ info: { id: "msg-new-1" } }];
|
|
79
|
+
|
|
80
|
+
consumeNewMessages("session-4", large);
|
|
81
|
+
const result = consumeNewMessages("session-4", small);
|
|
82
|
+
|
|
83
|
+
expect(result).toHaveLength(1);
|
|
84
|
+
expect(result[0].info?.id).toBe("msg-new-1");
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("#given messages with timestamp-based keys", () => {
|
|
90
|
+
describe("#when consumeNewMessages is called with time-based messages", () => {
|
|
91
|
+
it("#then tracks cursor by timestamp", () => {
|
|
92
|
+
const initial = [{ info: { time: 1000 } }, { info: { time: 2000 } }];
|
|
93
|
+
const extended = [
|
|
94
|
+
{ info: { time: 1000 } },
|
|
95
|
+
{ info: { time: 2000 } },
|
|
96
|
+
{ info: { time: 3000 } },
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
consumeNewMessages("session-5", initial);
|
|
100
|
+
const result = consumeNewMessages("session-5", extended);
|
|
101
|
+
|
|
102
|
+
expect(result).toHaveLength(1);
|
|
103
|
+
expect(result[0].info?.time).toBe(3000);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe("#given a cursor that was reset", () => {
|
|
109
|
+
describe("#when resetMessageCursor is called for a specific session", () => {
|
|
110
|
+
it("#then that session returns all messages again", () => {
|
|
111
|
+
const messages = [{ info: { id: "msg-1" } }, { info: { id: "msg-2" } }];
|
|
112
|
+
|
|
113
|
+
consumeNewMessages("session-6", messages);
|
|
114
|
+
resetMessageCursor("session-6");
|
|
115
|
+
|
|
116
|
+
const result = consumeNewMessages("session-6", messages);
|
|
117
|
+
expect(result).toHaveLength(2);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("#when resetMessageCursor is called without session ID", () => {
|
|
122
|
+
it("#then all sessions return all messages again", () => {
|
|
123
|
+
const messages = [{ info: { id: "msg-1" } }];
|
|
124
|
+
|
|
125
|
+
consumeNewMessages("session-7", messages);
|
|
126
|
+
consumeNewMessages("session-8", messages);
|
|
127
|
+
resetMessageCursor();
|
|
128
|
+
|
|
129
|
+
const result7 = consumeNewMessages("session-7", messages);
|
|
130
|
+
const result8 = consumeNewMessages("session-8", messages);
|
|
131
|
+
|
|
132
|
+
expect(result7).toHaveLength(1);
|
|
133
|
+
expect(result8).toHaveLength(1);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
type MessageTime = { created?: number | string } | number | string | undefined;
|
|
2
|
+
|
|
3
|
+
type MessageInfo = {
|
|
4
|
+
id?: string;
|
|
5
|
+
time?: MessageTime;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type CursorMessage = {
|
|
9
|
+
info?: MessageInfo;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface CursorState {
|
|
13
|
+
lastKey?: string;
|
|
14
|
+
lastCount: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const sessionCursors = new Map<string, CursorState>();
|
|
18
|
+
|
|
19
|
+
function buildMessageKey(message: CursorMessage, index: number): string {
|
|
20
|
+
const id = message.info?.id;
|
|
21
|
+
if (id) return `id:${id}`;
|
|
22
|
+
|
|
23
|
+
const time = message.info?.time;
|
|
24
|
+
if (typeof time === "number" || typeof time === "string") {
|
|
25
|
+
return `t:${time}:${index}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const created = (time as { created?: number | string } | undefined)?.created;
|
|
29
|
+
if (typeof created === "number") {
|
|
30
|
+
return `t:${created}:${index}`;
|
|
31
|
+
}
|
|
32
|
+
if (typeof created === "string") {
|
|
33
|
+
return `t:${created}:${index}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return `i:${index}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function consumeNewMessages<T extends CursorMessage>(
|
|
40
|
+
sessionId: string | undefined,
|
|
41
|
+
messages: T[],
|
|
42
|
+
): T[] {
|
|
43
|
+
if (!sessionId) return messages;
|
|
44
|
+
|
|
45
|
+
const keys = messages.map((message, index) => buildMessageKey(message, index));
|
|
46
|
+
const cursor = sessionCursors.get(sessionId);
|
|
47
|
+
let startIndex = 0;
|
|
48
|
+
|
|
49
|
+
if (cursor) {
|
|
50
|
+
if (cursor.lastCount > messages.length) {
|
|
51
|
+
startIndex = 0;
|
|
52
|
+
} else if (cursor.lastKey) {
|
|
53
|
+
const lastIndex = keys.lastIndexOf(cursor.lastKey);
|
|
54
|
+
if (lastIndex >= 0) {
|
|
55
|
+
startIndex = lastIndex + 1;
|
|
56
|
+
} else {
|
|
57
|
+
startIndex = 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (messages.length === 0) {
|
|
63
|
+
sessionCursors.delete(sessionId);
|
|
64
|
+
} else {
|
|
65
|
+
sessionCursors.set(sessionId, {
|
|
66
|
+
lastKey: keys[keys.length - 1],
|
|
67
|
+
lastCount: messages.length,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return messages.slice(startIndex);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function resetMessageCursor(sessionId?: string): void {
|
|
75
|
+
if (sessionId) {
|
|
76
|
+
sessionCursors.delete(sessionId);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
sessionCursors.clear();
|
|
80
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
setSessionState,
|
|
4
|
+
getSessionState,
|
|
5
|
+
deleteSessionState,
|
|
6
|
+
clearSessionStore,
|
|
7
|
+
} from "./session-store";
|
|
8
|
+
|
|
9
|
+
describe("session-store", () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
clearSessionStore();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("#given a new session ID", () => {
|
|
15
|
+
describe("#when setSessionState is called", () => {
|
|
16
|
+
it("#then creates a new session entry with defaults", () => {
|
|
17
|
+
const before = Date.now();
|
|
18
|
+
setSessionState("session-1", { model: "claude-opus", status: "active" });
|
|
19
|
+
const after = Date.now();
|
|
20
|
+
|
|
21
|
+
const state = getSessionState("session-1");
|
|
22
|
+
expect(state).toBeDefined();
|
|
23
|
+
expect(state?.sessionId).toBe("session-1");
|
|
24
|
+
expect(state?.model).toBe("claude-opus");
|
|
25
|
+
expect(state?.status).toBe("active");
|
|
26
|
+
expect(state?.createdAt).toBeGreaterThanOrEqual(before);
|
|
27
|
+
expect(state?.createdAt).toBeLessThanOrEqual(after);
|
|
28
|
+
expect(state?.updatedAt).toBeGreaterThanOrEqual(before);
|
|
29
|
+
expect(state?.updatedAt).toBeLessThanOrEqual(after);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("#when getSessionState is called before any set", () => {
|
|
34
|
+
it("#then returns undefined", () => {
|
|
35
|
+
const state = getSessionState("nonexistent");
|
|
36
|
+
expect(state).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("#given an existing session", () => {
|
|
42
|
+
describe("#when setSessionState is called again", () => {
|
|
43
|
+
it("#then updates fields while preserving createdAt", () => {
|
|
44
|
+
setSessionState("session-2", { model: "gpt-4", status: "active" });
|
|
45
|
+
const first = getSessionState("session-2");
|
|
46
|
+
const originalCreatedAt = first?.createdAt;
|
|
47
|
+
|
|
48
|
+
setSessionState("session-2", { status: "idle" });
|
|
49
|
+
const updated = getSessionState("session-2");
|
|
50
|
+
|
|
51
|
+
expect(updated?.createdAt).toBe(originalCreatedAt);
|
|
52
|
+
expect(updated?.status).toBe("idle");
|
|
53
|
+
expect(updated?.model).toBe("gpt-4");
|
|
54
|
+
expect(updated?.updatedAt).toBeGreaterThanOrEqual(first?.updatedAt ?? 0);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("#when deleteSessionState is called", () => {
|
|
59
|
+
it("#then removes the session entry", () => {
|
|
60
|
+
setSessionState("session-3", { agent: "sisyphus" });
|
|
61
|
+
expect(getSessionState("session-3")).toBeDefined();
|
|
62
|
+
|
|
63
|
+
deleteSessionState("session-3");
|
|
64
|
+
expect(getSessionState("session-3")).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("#given multiple sessions", () => {
|
|
70
|
+
describe("#when clearSessionStore is called", () => {
|
|
71
|
+
it("#then removes all session entries", () => {
|
|
72
|
+
setSessionState("session-a", { model: "claude" });
|
|
73
|
+
setSessionState("session-b", { model: "gpt" });
|
|
74
|
+
|
|
75
|
+
clearSessionStore();
|
|
76
|
+
|
|
77
|
+
expect(getSessionState("session-a")).toBeUndefined();
|
|
78
|
+
expect(getSessionState("session-b")).toBeUndefined();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface SessionState {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
model?: string;
|
|
4
|
+
agent?: string;
|
|
5
|
+
status?: "active" | "idle" | "completed";
|
|
6
|
+
createdAt: number;
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const store = new Map<string, SessionState>();
|
|
11
|
+
|
|
12
|
+
export function setSessionState(
|
|
13
|
+
sessionId: string,
|
|
14
|
+
state: Partial<Omit<SessionState, "sessionId" | "createdAt">>,
|
|
15
|
+
): void {
|
|
16
|
+
const existing = store.get(sessionId);
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
store.set(sessionId, {
|
|
19
|
+
...existing,
|
|
20
|
+
...state,
|
|
21
|
+
sessionId,
|
|
22
|
+
createdAt: existing?.createdAt ?? now,
|
|
23
|
+
updatedAt: now,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getSessionState(sessionId: string): SessionState | undefined {
|
|
28
|
+
return store.get(sessionId);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function deleteSessionState(sessionId: string): void {
|
|
32
|
+
store.delete(sessionId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function clearSessionStore(): void {
|
|
36
|
+
store.clear();
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const store = new Map<string, Record<string, boolean>>();
|
|
2
|
+
|
|
3
|
+
export function setSessionTools(sessionId: string, tools: Record<string, boolean>): void {
|
|
4
|
+
store.set(sessionId, { ...tools });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getSessionTools(sessionId: string): Record<string, boolean> | undefined {
|
|
8
|
+
const tools = store.get(sessionId);
|
|
9
|
+
return tools ? { ...tools } : undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function deleteSessionTools(sessionId: string): void {
|
|
13
|
+
store.delete(sessionId);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function clearSessionTools(): void {
|
|
17
|
+
store.clear();
|
|
18
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Skill } from "../skill-loader";
|
|
2
|
+
|
|
3
|
+
export const gitMasterSkill: Skill = {
|
|
4
|
+
name: "git-master",
|
|
5
|
+
description:
|
|
6
|
+
"MUST USE for any git operations. Atomic commits, branch strategy, rebase safety, and PR readiness workflow.",
|
|
7
|
+
template: `# Git Master
|
|
8
|
+
|
|
9
|
+
You are a Git specialist focused on clean history, safe collaboration, and reviewer-friendly pull requests.
|
|
10
|
+
|
|
11
|
+
## Operating Principles
|
|
12
|
+
|
|
13
|
+
1. Make atomic commits that can be reverted independently.
|
|
14
|
+
2. Keep branch history readable for reviewers.
|
|
15
|
+
3. Never run destructive git commands unless explicitly asked.
|
|
16
|
+
4. Prefer safe defaults: \`--force-with-lease\` over \`--force\`, never rewrite shared main/master history.
|
|
17
|
+
|
|
18
|
+
## Commit Strategy
|
|
19
|
+
|
|
20
|
+
### Before committing
|
|
21
|
+
|
|
22
|
+
- Inspect status and both staged/unstaged diff.
|
|
23
|
+
- Detect existing commit-message style from recent history.
|
|
24
|
+
- Group changes by concern, not by file extension.
|
|
25
|
+
- Pair implementation and tests in the same commit.
|
|
26
|
+
|
|
27
|
+
### Atomic grouping rules
|
|
28
|
+
|
|
29
|
+
- 3+ changed files across unrelated concerns must be split.
|
|
30
|
+
- Different directories generally imply different commits.
|
|
31
|
+
- A commit message should explain intent and impact, not file list.
|
|
32
|
+
|
|
33
|
+
### Message style
|
|
34
|
+
|
|
35
|
+
- Follow repository conventions (semantic or plain style based on git log).
|
|
36
|
+
- Keep messages concise and specific.
|
|
37
|
+
- Avoid vague messages like "update" or "fix stuff".
|
|
38
|
+
|
|
39
|
+
## Branch Naming
|
|
40
|
+
|
|
41
|
+
Use descriptive branch names:
|
|
42
|
+
|
|
43
|
+
- \`feat/<short-feature>\`
|
|
44
|
+
- \`fix/<bug-summary>\`
|
|
45
|
+
- \`refactor/<scope>\`
|
|
46
|
+
- \`chore/<task>\`
|
|
47
|
+
|
|
48
|
+
Examples:
|
|
49
|
+
|
|
50
|
+
- \`feat/skill-loader-project-overrides\`
|
|
51
|
+
- \`fix/retry-timeout-handling\`
|
|
52
|
+
|
|
53
|
+
## Rebase and History Cleanup
|
|
54
|
+
|
|
55
|
+
### Safe rebase policy
|
|
56
|
+
|
|
57
|
+
- Never rebase main/master directly.
|
|
58
|
+
- Rebase feature branches onto latest base branch before PR.
|
|
59
|
+
- If branch was pushed and rewritten, communicate clearly and use \`--force-with-lease\`.
|
|
60
|
+
|
|
61
|
+
### Conflict handling
|
|
62
|
+
|
|
63
|
+
1. Resolve conflicts file-by-file.
|
|
64
|
+
2. Keep intended behavior and tests intact.
|
|
65
|
+
3. Run validation again after conflict resolution.
|
|
66
|
+
|
|
67
|
+
## Pull Request Workflow
|
|
68
|
+
|
|
69
|
+
### Pre-PR checklist
|
|
70
|
+
|
|
71
|
+
- Working tree clean.
|
|
72
|
+
- Typecheck and tests pass.
|
|
73
|
+
- Commits are logically split and ordered.
|
|
74
|
+
- PR diff is scoped and reviewable.
|
|
75
|
+
|
|
76
|
+
### PR content
|
|
77
|
+
|
|
78
|
+
- Title: concise summary of user value.
|
|
79
|
+
- Body should include:
|
|
80
|
+
- Summary
|
|
81
|
+
- Validation done
|
|
82
|
+
- Risks / follow-ups
|
|
83
|
+
|
|
84
|
+
## Safety Rules
|
|
85
|
+
|
|
86
|
+
- Never commit secrets (\`.env\`, credential files, tokens).
|
|
87
|
+
- Never bypass hooks unless explicitly requested.
|
|
88
|
+
- Never force-push to main/master.
|
|
89
|
+
- Prefer a new commit over amend after hook failure.
|
|
90
|
+
|
|
91
|
+
## Quick Command Sequence
|
|
92
|
+
|
|
93
|
+
\`\`\`bash
|
|
94
|
+
git status
|
|
95
|
+
git diff --staged --stat
|
|
96
|
+
git diff --stat
|
|
97
|
+
git log -20 --pretty=format:"%s"
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
Then create focused commits in dependency order and verify with:
|
|
101
|
+
|
|
102
|
+
\`\`\`bash
|
|
103
|
+
git status
|
|
104
|
+
git log --oneline --decorate -20
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
Apply this workflow for all git operations unless the user gives explicit alternative constraints.
|
|
108
|
+
`,
|
|
109
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { log } from "../../shared/logger";
|
|
4
|
+
import { getDataDir } from "../../shared/data-path";
|
|
5
|
+
import { gitMasterSkill } from "./builtin/git-master";
|
|
6
|
+
import {
|
|
7
|
+
createProjectSkillLoader,
|
|
8
|
+
loadProjectSkills,
|
|
9
|
+
type Skill,
|
|
10
|
+
type SkillLoader,
|
|
11
|
+
} from "./skill-loader";
|
|
12
|
+
import { mergeSkills } from "./skill-merger";
|
|
13
|
+
import * as skillHandler from "../../tools/skill/handler";
|
|
14
|
+
|
|
15
|
+
export { gitMasterSkill } from "./builtin/git-master";
|
|
16
|
+
export { createProjectSkillLoader, loadProjectSkills } from "./skill-loader";
|
|
17
|
+
export { mergeSkills } from "./skill-merger";
|
|
18
|
+
export type { Skill, SkillInfo, SkillLoader } from "./skill-loader";
|
|
19
|
+
|
|
20
|
+
export function getBuiltinSkills(): Skill[] {
|
|
21
|
+
return [gitMasterSkill];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function skillToMarkdown(skill: Skill): string {
|
|
25
|
+
return `---\nname: ${skill.name}\ndescription: ${skill.description}\n---\n\n${skill.template.trim()}\n`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getBuiltinSkillsDir(): string | null {
|
|
29
|
+
try {
|
|
30
|
+
return join(getDataDir(), "goatcode-sh", "skills");
|
|
31
|
+
} catch (err) {
|
|
32
|
+
log("[skills] Failed to resolve built-in skills directory", { err });
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function syncBuiltinSkillFiles(): string | null {
|
|
38
|
+
const skillsDir = getBuiltinSkillsDir();
|
|
39
|
+
if (!skillsDir) return null;
|
|
40
|
+
|
|
41
|
+
const builtinSkills = getBuiltinSkills();
|
|
42
|
+
const expected = new Set(builtinSkills.map((skill) => skill.name));
|
|
43
|
+
let syncFailed = false;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
mkdirSync(skillsDir, { recursive: true });
|
|
47
|
+
for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
|
|
48
|
+
if (entry.isDirectory() && !expected.has(entry.name)) {
|
|
49
|
+
rmSync(join(skillsDir, entry.name), { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
syncFailed = true;
|
|
54
|
+
log("[skills] Failed to reconcile built-in skills directory", { err });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (const skill of builtinSkills) {
|
|
58
|
+
const skillDir = join(skillsDir, skill.name);
|
|
59
|
+
const skillFile = join(skillDir, "SKILL.md");
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
mkdirSync(skillDir, { recursive: true });
|
|
63
|
+
writeFileSync(skillFile, skillToMarkdown(skill), "utf8");
|
|
64
|
+
} catch (err) {
|
|
65
|
+
syncFailed = true;
|
|
66
|
+
log(`[skills] Failed to write skill file: ${skillFile}`, { err });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return syncFailed ? null : skillsDir;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function createMergedSkillLoader(directory: string): SkillLoader {
|
|
73
|
+
const projectSkills = loadProjectSkills(directory);
|
|
74
|
+
const mergedSkills = mergeSkills(getBuiltinSkills(), projectSkills);
|
|
75
|
+
const byName = new Map(mergedSkills.map((skill) => [skill.name, skill.template]));
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
load(name: string): string | undefined {
|
|
79
|
+
return byName.get(name);
|
|
80
|
+
},
|
|
81
|
+
list() {
|
|
82
|
+
return mergedSkills.map((s) => ({ name: s.name, description: s.description }));
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function registerProjectSkillLoader(directory: string): void {
|
|
88
|
+
syncBuiltinSkillFiles();
|
|
89
|
+
|
|
90
|
+
if (typeof skillHandler.registerSkillLoader === "function") {
|
|
91
|
+
const loader = createMergedSkillLoader(directory);
|
|
92
|
+
skillHandler.registerSkillLoader(loader);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
log("[skills] registerSkillLoader not available in handler module");
|
|
97
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
import { log } from "../../shared/logger";
|
|
4
|
+
|
|
5
|
+
export type Skill = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
template: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type SkillInfo = {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type SkillLoader = {
|
|
17
|
+
load(name: string): string | undefined;
|
|
18
|
+
list(): SkillInfo[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type ParsedSkillFrontmatter = {
|
|
22
|
+
name?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
body: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const SKILLS_RELATIVE_DIR = ".opencode/skills";
|
|
28
|
+
|
|
29
|
+
export function parseSkillMarkdown(markdown: string): ParsedSkillFrontmatter {
|
|
30
|
+
const normalized = markdown.replace(/\r\n/g, "\n");
|
|
31
|
+
if (!normalized.startsWith("---\n")) {
|
|
32
|
+
return { body: normalized.trim() };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const closingIndex = normalized.indexOf("\n---\n", 4);
|
|
36
|
+
if (closingIndex < 0) {
|
|
37
|
+
return { body: normalized.trim() };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const frontmatterBlock = normalized.slice(4, closingIndex);
|
|
41
|
+
const body = normalized.slice(closingIndex + 5).trim();
|
|
42
|
+
const parsed: ParsedSkillFrontmatter = { body };
|
|
43
|
+
|
|
44
|
+
for (const line of frontmatterBlock.split("\n")) {
|
|
45
|
+
const separatorIndex = line.indexOf(":");
|
|
46
|
+
if (separatorIndex <= 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const key = line.slice(0, separatorIndex).trim();
|
|
51
|
+
const rawValue = line.slice(separatorIndex + 1).trim();
|
|
52
|
+
const value = stripSurroundingQuotes(rawValue);
|
|
53
|
+
|
|
54
|
+
if (key === "name") {
|
|
55
|
+
parsed.name = value;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (key === "description") {
|
|
60
|
+
parsed.description = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function loadProjectSkills(directory: string): Skill[] {
|
|
68
|
+
const skillsDir = join(directory, SKILLS_RELATIVE_DIR);
|
|
69
|
+
if (!existsSync(skillsDir)) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const files = readdirSync(skillsDir).filter((entry) => entry.endsWith(".md"));
|
|
74
|
+
const skills: Skill[] = [];
|
|
75
|
+
|
|
76
|
+
for (const fileName of files) {
|
|
77
|
+
const filePath = join(skillsDir, fileName);
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const content = readFileSync(filePath, "utf8");
|
|
81
|
+
const parsed = parseSkillMarkdown(content);
|
|
82
|
+
const fallbackName = basename(fileName, ".md");
|
|
83
|
+
const name = parsed.name?.trim() || fallbackName;
|
|
84
|
+
const description = parsed.description?.trim() || "";
|
|
85
|
+
const template = parsed.body.trim();
|
|
86
|
+
|
|
87
|
+
if (!name || !template) {
|
|
88
|
+
log("[skills] skipped invalid project skill", {
|
|
89
|
+
filePath,
|
|
90
|
+
name,
|
|
91
|
+
hasTemplate: template.length > 0,
|
|
92
|
+
});
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
skills.push({ name, description, template });
|
|
97
|
+
} catch (error) {
|
|
98
|
+
log("[skills] failed to load project skill file", { filePath, error });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return skills;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function createProjectSkillLoader(directory: string): SkillLoader {
|
|
106
|
+
const skills = loadProjectSkills(directory);
|
|
107
|
+
const byName = new Map(skills.map((skill) => [skill.name, skill.template]));
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
load(name: string): string | undefined {
|
|
111
|
+
return byName.get(name);
|
|
112
|
+
},
|
|
113
|
+
list(): SkillInfo[] {
|
|
114
|
+
return skills.map((s) => ({ name: s.name, description: s.description }));
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function stripSurroundingQuotes(value: string): string {
|
|
120
|
+
if (value.length < 2) {
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
125
|
+
return value.slice(1, -1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (value.startsWith("'") && value.endsWith("'")) {
|
|
129
|
+
return value.slice(1, -1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return value;
|
|
133
|
+
}
|