@sayknow-cli/coding-agent 0.7.11 → 0.7.13
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/CHANGELOG.md +16 -0
- package/dist/types/async/result-formatting.d.ts +2 -0
- package/dist/types/capability/fs.d.ts +22 -3
- package/dist/types/capability/mcp.d.ts +2 -0
- package/dist/types/cli/append-system-prompt.d.ts +6 -0
- package/dist/types/cli/update-cli.d.ts +3 -0
- package/dist/types/commands/contribution-prep.d.ts +0 -3
- package/dist/types/commands/migrate.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +9 -0
- package/dist/types/commit/changelog/index.d.ts +1 -0
- package/dist/types/config/settings-schema.d.ts +14 -0
- package/dist/types/config/settings.d.ts +7 -1
- package/dist/types/coordinator-mcp/session-reaper.d.ts +5 -0
- package/dist/types/cursor-delete-path.d.ts +1 -0
- package/dist/types/cursor-mcp-name.d.ts +8 -0
- package/dist/types/dap/config.d.ts +8 -4
- package/dist/types/dap/session.d.ts +11 -2
- package/dist/types/debug/report-bundle-parent.d.ts +2 -0
- package/dist/types/debug/system-info.d.ts +6 -1
- package/dist/types/discovery/helpers.d.ts +11 -3
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/edit/file-read-cache.d.ts +4 -0
- package/dist/types/edit/modes/patch.d.ts +14 -0
- package/dist/types/edit/modes/replace.d.ts +8 -0
- package/dist/types/eval/py/runtime.d.ts +9 -0
- package/dist/types/exa/mcp-client.d.ts +11 -6
- package/dist/types/exec/bash-executor.d.ts +18 -1
- package/dist/types/export/html/css-color.d.ts +2 -0
- package/dist/types/export/html/html-export-destination.d.ts +2 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/loader.d.ts +3 -2
- package/dist/types/extensibility/custom-tools/types.d.ts +3 -1
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
- package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
- package/dist/types/goals/runtime.d.ts +6 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/content.d.ts +5 -6
- package/dist/types/internal-urls/skill-path.d.ts +1 -0
- package/dist/types/internal-urls/types.d.ts +2 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +0 -4
- package/dist/types/lsp/config.d.ts +8 -5
- package/dist/types/lsp/workspace-path.d.ts +1 -0
- package/dist/types/migrate/adapters/codex.d.ts +2 -1
- package/dist/types/migrate/adapters/index.d.ts +10 -1
- package/dist/types/migrate/executor.d.ts +3 -1
- package/dist/types/migrate/types.d.ts +15 -3
- package/dist/types/modes/components/custom-editor.d.ts +6 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
- package/dist/types/modes/components/model-selector.d.ts +46 -0
- package/dist/types/modes/controllers/input-controller.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +4 -0
- package/dist/types/runtime-mcp/manager.d.ts +9 -1
- package/dist/types/runtime-mcp/mcp-redirect.d.ts +9 -0
- package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
- package/dist/types/runtime-mcp/plugin-mcp-name-filter.d.ts +22 -0
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
- package/dist/types/runtime-mcp/project-host-values.d.ts +33 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +4 -0
- package/dist/types/runtime-mcp/types.d.ts +6 -0
- package/dist/types/sdk/broker/ensure.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +5 -1
- package/dist/types/sdk/broker/runtime.d.ts +1 -1
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +1 -0
- package/dist/types/sdk/host/events.d.ts +4 -0
- package/dist/types/session/agent-session.d.ts +22 -2
- package/dist/types/session/auto-resume.d.ts +5 -0
- package/dist/types/session/messages.d.ts +5 -1
- package/dist/types/session/session-manager.d.ts +13 -0
- package/dist/types/session/session-storage.d.ts +8 -0
- package/dist/types/session/streaming-output.d.ts +11 -0
- package/dist/types/session-import/redact.d.ts +1 -1
- package/dist/types/skc-runtime/managed-owner-admission.d.ts +3 -0
- package/dist/types/skc-runtime/psmux-detect.d.ts +5 -4
- package/dist/types/skc-runtime/ralplan-runtime.d.ts +5 -0
- package/dist/types/skc-runtime/sidecar-bootstrap-env.d.ts +6 -0
- package/dist/types/skc-runtime/state-writer.d.ts +4 -1
- package/dist/types/skc-runtime/tmux-sessions.d.ts +24 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +4 -0
- package/dist/types/skill-state/workflow-mutation-guard.d.ts +20 -1
- package/dist/types/slash-commands/helpers/mcp.d.ts +5 -0
- package/dist/types/ssh/ssh-executor.d.ts +3 -1
- package/dist/types/system-prompt.d.ts +5 -2
- package/dist/types/task/executor.d.ts +17 -3
- package/dist/types/task/isolation-dir.d.ts +26 -0
- package/dist/types/task/role-body.d.ts +11 -0
- package/dist/types/task/token-log-mode.test.d.ts +1 -0
- package/dist/types/tools/ask.d.ts +77 -254
- package/dist/types/tools/ast-edit-write-path.d.ts +23 -0
- package/dist/types/tools/atomic-file-write.d.ts +74 -0
- package/dist/types/tools/auto-generated-guard.d.ts +5 -2
- package/dist/types/tools/bash-allowed-prefixes.d.ts +16 -0
- package/dist/types/tools/bash-interactive.d.ts +2 -0
- package/dist/types/tools/bash-skill-urls.d.ts +5 -1
- package/dist/types/tools/bash.d.ts +1 -0
- package/dist/types/tools/browser/cdp-url.d.ts +2 -0
- package/dist/types/tools/browser/tab-worker.d.ts +2 -0
- package/dist/types/tools/debug.d.ts +2 -2
- package/dist/types/tools/explicit-artifact.d.ts +8 -0
- package/dist/types/tools/fetch.d.ts +7 -4
- package/dist/types/tools/github-side-effect.d.ts +22 -0
- package/dist/types/tools/index.d.ts +3 -0
- package/dist/types/tools/monitor-mutation.d.ts +9 -0
- package/dist/types/tools/recipe/index.d.ts +2 -0
- package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
- package/dist/types/tools/restricted-cwd.d.ts +1 -0
- package/dist/types/tools/reverse-engineer.d.ts +81 -0
- package/dist/types/tools/search-tool-bm25.d.ts +2 -0
- package/dist/types/tools/tmux-self-injection-guard.d.ts +17 -0
- package/dist/types/tools/untrusted-content.d.ts +12 -0
- package/dist/types/utils/file-mentions.d.ts +5 -0
- package/dist/types/utils/open.d.ts +0 -1
- package/dist/types/utils/shell-snapshot.d.ts +2 -0
- package/dist/types/utils/title-generator.d.ts +12 -2
- package/dist/types/utils/tools-checksum.d.ts +7 -0
- package/dist/types/utils/xml-escape.d.ts +2 -0
- package/dist/types/web/scrapers/types.d.ts +8 -1
- package/dist/types/web/search/providers/codex.d.ts +6 -7
- package/dist/types/web/search/providers/insane.d.ts +7 -1
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +7 -7
- package/scripts/generate-sdk-operation-inventory.ts +4 -0
- package/src/async/job-manager.ts +23 -9
- package/src/async/result-formatting.ts +40 -0
- package/src/capability/fs.ts +78 -11
- package/src/capability/mcp.ts +2 -0
- package/src/cli/append-system-prompt.ts +12 -0
- package/src/cli/auth-broker-cli.ts +22 -12
- package/src/cli/config-cli.ts +8 -18
- package/src/cli/migrate-cli.ts +7 -5
- package/src/cli/ssh-cli.ts +6 -3
- package/src/cli/stats-cli.ts +9 -4
- package/src/cli/update-cli.ts +42 -0
- package/src/cli/web-search-cli.ts +9 -3
- package/src/cli.ts +5 -9
- package/src/commands/commit.ts +2 -2
- package/src/commands/contribution-prep.ts +1 -3
- package/src/commands/harness.ts +25 -15
- package/src/commands/launch.ts +1 -1
- package/src/commands/migrate.ts +3 -3
- package/src/commands/sdk.ts +115 -14
- package/src/commands/ultragoal.ts +14 -8
- package/src/commit/agentic/agent.ts +6 -6
- package/src/commit/analysis/conventional.ts +14 -5
- package/src/commit/changelog/index.ts +39 -1
- package/src/commit/message.ts +10 -3
- package/src/config/config-file.ts +106 -3
- package/src/config/keybindings.ts +154 -7
- package/src/config/mcp-schema.json +4 -0
- package/src/config/model-registry.ts +10 -2
- package/src/config/settings-schema.ts +18 -0
- package/src/config/settings.ts +32 -4
- package/src/coordinator-mcp/policy.ts +14 -4
- package/src/coordinator-mcp/server.ts +44 -4
- package/src/coordinator-mcp/session-reaper.ts +9 -1
- package/src/cursor-delete-path.ts +10 -0
- package/src/cursor-mcp-name.ts +15 -0
- package/src/cursor.ts +13 -2
- package/src/dap/client.ts +9 -2
- package/src/dap/config.ts +33 -13
- package/src/dap/defaults.json +1 -1
- package/src/dap/session.ts +161 -36
- package/src/debug/crash-diagnostics.ts +89 -6
- package/src/debug/report-bundle-parent.ts +22 -0
- package/src/debug/report-bundle.ts +100 -3
- package/src/debug/system-info.ts +21 -4
- package/src/defaults/skc/extensions/grok-cli-vendor/src/shared/base-url.ts +21 -7
- package/src/defaults/skc/skills/deep-interview/SKILL.md +1 -1
- package/src/discovery/agents-md.ts +3 -2
- package/src/discovery/agents.ts +3 -2
- package/src/discovery/builtin.ts +21 -11
- package/src/discovery/claude.ts +5 -4
- package/src/discovery/cline.ts +2 -2
- package/src/discovery/codex.ts +6 -5
- package/src/discovery/cursor.ts +11 -2
- package/src/discovery/gemini.ts +4 -3
- package/src/discovery/github.ts +2 -2
- package/src/discovery/helpers.ts +51 -11
- package/src/discovery/mcp-json.ts +28 -12
- package/src/discovery/opencode.ts +2 -1
- package/src/discovery/ssh.ts +11 -6
- package/src/discovery/substitute-plugin-root.ts +3 -1
- package/src/discovery/vscode.ts +3 -3
- package/src/edit/apply-patch/index.ts +12 -1
- package/src/edit/file-read-cache.ts +24 -6
- package/src/edit/index.ts +90 -20
- package/src/edit/modes/patch.ts +215 -9
- package/src/edit/modes/replace.ts +141 -0
- package/src/eval/js/context-manager.ts +29 -3
- package/src/eval/js/worker-entry.ts +51 -18
- package/src/eval/py/runner.py +144 -5
- package/src/eval/py/runtime.ts +44 -4
- package/src/eval/py/tool-bridge.ts +4 -0
- package/src/exa/mcp-client.ts +53 -11
- package/src/exec/bash-executor.ts +87 -4
- package/src/exec/non-interactive-env.ts +0 -1
- package/src/export/html/css-color.ts +9 -0
- package/src/export/html/html-export-destination.ts +16 -0
- package/src/export/html/index.ts +102 -8
- package/src/export/html/template.generated.ts +1 -1
- package/src/extensibility/custom-tools/loader.ts +13 -3
- package/src/extensibility/custom-tools/types.ts +3 -1
- package/src/extensibility/custom-tools/wrapper.ts +3 -1
- package/src/extensibility/plugins/manager.ts +3 -2
- package/src/extensibility/plugins/marketplace/cache.ts +15 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +2 -2
- package/src/extensibility/plugins/marketplace/manager.ts +5 -3
- package/src/extensibility/plugins/plugin-link-path.ts +12 -0
- package/src/extensibility/skc-plugins/mcp-policy.ts +2 -1
- package/src/goals/runtime.ts +30 -8
- package/src/harness-control-plane/finalize.ts +10 -0
- package/src/harness-control-plane/operate.ts +12 -4
- package/src/harness-control-plane/owner.ts +8 -1
- package/src/harness-control-plane/receipt-spool.ts +105 -28
- package/src/harness-control-plane/storage.ts +124 -6
- package/src/hashline/execute.ts +3 -3
- package/src/hashline/recovery.ts +85 -2
- package/src/hindsight/config.ts +9 -3
- package/src/hindsight/content.ts +116 -16
- package/src/hindsight/mental-models.ts +22 -10
- package/src/hindsight/state.ts +7 -4
- package/src/hooks/native-skill-hook.ts +17 -12
- package/src/i18n/messages/de.settings.ts +3 -0
- package/src/i18n/messages/es.settings.ts +3 -0
- package/src/i18n/messages/fr.settings.ts +3 -0
- package/src/i18n/messages/ja.settings.ts +3 -0
- package/src/i18n/messages/ko.settings.ts +3 -0
- package/src/i18n/messages/zh.settings.ts +3 -0
- package/src/internal-urls/artifact-protocol.ts +3 -1
- package/src/internal-urls/docs-index.generated.ts +10 -10
- package/src/internal-urls/local-protocol.ts +167 -8
- package/src/internal-urls/skill-path.ts +18 -0
- package/src/internal-urls/skill-protocol.ts +2 -0
- package/src/internal-urls/types.ts +2 -0
- package/src/lsp/client.ts +2 -1
- package/src/lsp/clients/biome-client.ts +2 -0
- package/src/lsp/clients/swiftlint-client.ts +2 -0
- package/src/lsp/config.ts +18 -62
- package/src/lsp/edits.ts +6 -0
- package/src/lsp/index.ts +29 -0
- package/src/lsp/workspace-path.ts +75 -0
- package/src/main.ts +33 -11
- package/src/memories/index.ts +141 -9
- package/src/migrate/action-planner.ts +57 -0
- package/src/migrate/adapters/claude-code.ts +23 -4
- package/src/migrate/adapters/codex.ts +22 -4
- package/src/migrate/adapters/index.ts +22 -4
- package/src/migrate/adapters/opencode.ts +6 -1
- package/src/migrate/executor.ts +84 -7
- package/src/migrate/report.ts +19 -2
- package/src/migrate/types.ts +14 -4
- package/src/modes/DESIGN.md +5 -0
- package/src/modes/acp/acp-agent.ts +35 -2
- package/src/modes/acp/permission-mode.ts +18 -1
- package/src/modes/components/custom-editor.ts +14 -0
- package/src/modes/components/extensions/extension-dashboard.ts +2 -2
- package/src/modes/components/extensions/inspector-panel.ts +9 -5
- package/src/modes/components/extensions/state-manager.ts +15 -5
- package/src/modes/components/model-selector.ts +144 -94
- package/src/modes/components/welcome.ts +3 -2
- package/src/modes/controllers/command-controller.ts +300 -9
- package/src/modes/controllers/event-controller.ts +1 -1
- package/src/modes/controllers/extension-ui-controller.ts +32 -19
- package/src/modes/controllers/input-controller.ts +62 -26
- package/src/modes/controllers/plan-mode-controller.ts +17 -7
- package/src/modes/controllers/runtime-mcp-command-controller.ts +25 -20
- package/src/modes/controllers/ssh-command-controller.ts +3 -1
- package/src/modes/interactive-mode.ts +10 -0
- package/src/modes/utils/macos-option-forwarding.ts +80 -0
- package/src/prompts/system/irc-incoming.md +3 -1
- package/src/prompts/system/project-prompt.md +19 -0
- package/src/prompts/system/system-prompt.md +3 -0
- package/src/prompts/tools/ask.md +2 -0
- package/src/prompts/tools/debug.md +1 -1
- package/src/prompts/tools/monitor.md +7 -5
- package/src/prompts/tools/reverse-engineer.md +29 -0
- package/src/runtime-credential-selector.ts +2 -2
- package/src/runtime-mcp/config-writer.ts +10 -6
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/content-limits.ts +7 -0
- package/src/runtime-mcp/json-rpc.ts +2 -1
- package/src/runtime-mcp/manager.ts +57 -9
- package/src/runtime-mcp/mcp-redirect.ts +73 -0
- package/src/runtime-mcp/oauth-flow.ts +43 -5
- package/src/runtime-mcp/oauth-public-url.ts +8 -0
- package/src/runtime-mcp/plugin-mcp-name-filter.ts +62 -0
- package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
- package/src/runtime-mcp/project-host-values.ts +50 -0
- package/src/runtime-mcp/render.ts +16 -1
- package/src/runtime-mcp/smithery-registry.ts +22 -3
- package/src/runtime-mcp/tool-bridge.ts +194 -21
- package/src/runtime-mcp/transports/http.ts +4 -3
- package/src/runtime-mcp/transports/stdio.ts +2 -1
- package/src/runtime-mcp/types.ts +6 -0
- package/src/sdk/broker/broker.ts +11 -2
- package/src/sdk/broker/ensure.ts +131 -10
- package/src/sdk/broker/lifecycle-ledger.ts +18 -3
- package/src/sdk/broker/lifecycle.ts +21 -19
- package/src/sdk/broker/runtime.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +38 -1
- package/src/sdk/bus/chat-daemon-control.ts +5 -3
- package/src/sdk/bus/index.ts +5 -3
- package/src/sdk/bus/lifecycle-control-runtime.ts +9 -2
- package/src/sdk/bus/session-control.ts +2 -0
- package/src/sdk/bus/slack-daemon.ts +8 -1
- package/src/sdk/bus/slack-live-provider.ts +3 -1
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/bus/telegram-daemon-control.ts +17 -12
- package/src/sdk/bus/telegram-daemon.ts +41 -1
- package/src/sdk/host/events.ts +67 -4
- package/src/sdk/mcp/server.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +22 -0
- package/src/sdk/session.ts +18 -25
- package/src/secrets/obfuscator.ts +92 -12
- package/src/session/agent-session.ts +466 -100
- package/src/session/artifacts.ts +3 -1
- package/src/session/auto-resume.ts +45 -8
- package/src/session/history-storage.ts +172 -8
- package/src/session/internal/managed-session-scope.ts +130 -52
- package/src/session/messages.ts +47 -6
- package/src/session/session-manager.ts +116 -8
- package/src/session/session-storage.ts +31 -1
- package/src/session/streaming-output.ts +263 -4
- package/src/session-import/redact.ts +76 -3
- package/src/setup/hermes-setup.ts +4 -1
- package/src/skc-runtime/gc-runtime.ts +26 -4
- package/src/skc-runtime/launch-tmux.ts +21 -11
- package/src/skc-runtime/launch-worktree.ts +42 -3
- package/src/skc-runtime/managed-owner-admission.ts +46 -2
- package/src/skc-runtime/psmux-detect.ts +29 -5
- package/src/skc-runtime/ralplan-runtime.ts +14 -1
- package/src/skc-runtime/session-resolution.ts +38 -6
- package/src/skc-runtime/sidecar-bootstrap-env.ts +19 -0
- package/src/skc-runtime/state-writer.ts +134 -16
- package/src/skc-runtime/tmux-sessions.ts +85 -4
- package/src/skc-runtime/ultragoal-change-set.ts +18 -2
- package/src/skc-runtime/ultragoal-guard.ts +9 -1
- package/src/skc-runtime/ultragoal-runtime.ts +26 -9
- package/src/skill-state/active-state.ts +13 -0
- package/src/skill-state/workflow-mutation-guard.ts +3297 -180
- package/src/slash-commands/builtin-registry.ts +14 -8
- package/src/slash-commands/helpers/mcp.ts +20 -7
- package/src/ssh/ssh-executor.ts +3 -1
- package/src/stt/recorder.ts +26 -9
- package/src/system-prompt.ts +65 -16
- package/src/task/commands.ts +3 -1
- package/src/task/executor.ts +52 -7
- package/src/task/index.ts +28 -0
- package/src/task/isolation-dir.ts +143 -0
- package/src/task/role-body.ts +84 -0
- package/src/task/token-log-mode.test.ts +162 -0
- package/src/task/token-log.ts +91 -2
- package/src/task/worktree.ts +16 -7
- package/src/tools/archive-reader.ts +653 -31
- package/src/tools/ask.ts +86 -14
- package/src/tools/ast-edit-write-path.ts +133 -0
- package/src/tools/ast-edit.ts +27 -1
- package/src/tools/ast-grep.ts +7 -2
- package/src/tools/atomic-file-write.ts +625 -0
- package/src/tools/auto-generated-guard.ts +28 -8
- package/src/tools/bash-allowed-prefixes.ts +225 -6
- package/src/tools/bash-interactive.ts +12 -0
- package/src/tools/bash-skill-urls.ts +113 -7
- package/src/tools/bash.ts +152 -20
- package/src/tools/browser/cdp-url.ts +18 -0
- package/src/tools/browser/tab-worker.ts +49 -14
- package/src/tools/browser.ts +25 -8
- package/src/tools/cron.ts +10 -1
- package/src/tools/debug.ts +16 -8
- package/src/tools/eval.ts +71 -34
- package/src/tools/explicit-artifact.ts +89 -0
- package/src/tools/fetch.ts +26 -17
- package/src/tools/gh.ts +40 -12
- package/src/tools/github-side-effect.ts +112 -0
- package/src/tools/image-gen.ts +24 -10
- package/src/tools/index.ts +6 -0
- package/src/tools/monitor-mutation.ts +27 -0
- package/src/tools/monitor.ts +28 -1
- package/src/tools/output-meta.ts +74 -5
- package/src/tools/read.ts +24 -36
- package/src/tools/recipe/index.ts +12 -0
- package/src/tools/recipe/recipe-guard.ts +19 -0
- package/src/tools/recipe/runner.ts +23 -12
- package/src/tools/render-utils.ts +2 -2
- package/src/tools/restricted-cwd.ts +10 -0
- package/src/tools/reverse-engineer.ts +497 -0
- package/src/tools/search-tool-bm25.ts +14 -3
- package/src/tools/search.ts +3 -2
- package/src/tools/ssh.ts +235 -8
- package/src/tools/subagent-render.ts +43 -7
- package/src/tools/subagent.ts +7 -3
- package/src/tools/tmux-self-injection-guard.ts +3538 -0
- package/src/tools/todo-write.ts +41 -3
- package/src/tools/untrusted-content.ts +23 -0
- package/src/tools/vim.ts +2 -2
- package/src/tools/write.ts +37 -4
- package/src/tui/tree-list.ts +15 -1
- package/src/utils/commit-message-generator.ts +9 -2
- package/src/utils/external-editor.ts +21 -7
- package/src/utils/file-mentions.ts +75 -7
- package/src/utils/git.ts +38 -7
- package/src/utils/open.ts +73 -4
- package/src/utils/shell-snapshot.ts +9 -1
- package/src/utils/title-generator.ts +61 -16
- package/src/utils/tools-checksum.ts +34 -0
- package/src/utils/tools-manager.ts +24 -6
- package/src/utils/xml-escape.ts +14 -0
- package/src/web/insane/url-guard.ts +2 -1
- package/src/web/scrapers/types.ts +8 -0
- package/src/web/scrapers/youtube.ts +3 -2
- package/src/web/search/index.ts +4 -3
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +31 -34
- package/src/web/search/providers/insane.ts +145 -28
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/cli/shell-cli.d.ts +0 -8
- package/dist/types/commands/shell.d.ts +0 -21
- package/src/cli/shell-cli.ts +0 -176
- package/src/commands/shell.ts +0 -29
|
@@ -248,7 +248,7 @@ Is that topology right? Should any component be added, removed, merged, split, o
|
|
|
248
248
|
|
|
249
249
|
Options should include contextually relevant choices such as **Looks right**, **Add/remove/merge components**, **Defer one or more components**, plus free-text, translated/localized according to `language.instruction` when present. This is the only pre-scoring question and preserves the one-question-per-round rule.
|
|
250
250
|
|
|
251
|
-
The Round 0 `ask` call MUST include `deepInterview.round = 0`, `deepInterview.component = "review-topology"`, `deepInterview.dimension = "topology"`, `deepInterview.intent_contract.items` containing the exact displayed locked-intent items, and `deepInterview.intent_contract.confirmation_options` listing only the displayed affirmative labels that lock the proposal (normally **Looks right**). The runtime recorder canonicalizes and locks this contract only when the user selects one of those labels; correction, deferral, free-text, and clarification answers never lock the pre-question proposal. Do not manually copy raw free text into intent evidence, and do not continue if this required recorder write fails.
|
|
251
|
+
While state is in the `interviewing` phase, every `ask` MUST contain exactly one non-empty question with structured `deepInterview` metadata on that question; never add an empty `metadata` or `ignore` question. The entire `deepInterview` object is required, not merely the prose round header or `workflowGate`. After native final-spec persistence transitions to `handoff`, Phase 5 next-workflow/approval asks are ordinary asks without interview round metadata. The Round 0 `ask` call MUST include `deepInterview.round = 0`, `deepInterview.component = "review-topology"`, `deepInterview.dimension = "topology"`, `deepInterview.intent_contract.items` containing the exact displayed locked-intent items, and `deepInterview.intent_contract.confirmation_options` listing only the displayed affirmative labels that lock the proposal (normally **Looks right**). The runtime recorder canonicalizes and locks this contract only when the user selects one of those labels; correction, deferral, free-text, and clarification answers never lock the pre-question proposal. Do not manually copy raw free text into intent evidence, and do not continue if this required recorder write fails.
|
|
252
252
|
|
|
253
253
|
3. **Lock topology into state** after the answer. Store a normalized component list and confirmation timestamp:
|
|
254
254
|
|
|
@@ -10,7 +10,7 @@ import { registerProvider } from "../capability";
|
|
|
10
10
|
import { type ContextFile, contextFileCapability } from "../capability/context-file";
|
|
11
11
|
import { readFile } from "../capability/fs";
|
|
12
12
|
import type { LoadContext, LoadResult } from "../capability/types";
|
|
13
|
-
import { calculateDepth, createSourceMeta } from "./helpers";
|
|
13
|
+
import { calculateDepth, createSourceMeta, getReadOptions } from "./helpers";
|
|
14
14
|
|
|
15
15
|
const PROVIDER_ID = "agents-md";
|
|
16
16
|
const DISPLAY_NAME = "AGENTS.md";
|
|
@@ -24,10 +24,11 @@ async function loadAgentsMd(ctx: LoadContext): Promise<LoadResult<ContextFile>>
|
|
|
24
24
|
|
|
25
25
|
// Walk up from cwd looking for AGENTS.md files
|
|
26
26
|
let current = ctx.cwd;
|
|
27
|
+
const readOptions = getReadOptions(ctx, "project");
|
|
27
28
|
|
|
28
29
|
while (true) {
|
|
29
30
|
const candidate = path.join(current, "AGENTS.md");
|
|
30
|
-
const content = await readFile(candidate);
|
|
31
|
+
const content = await readFile(candidate, readOptions);
|
|
31
32
|
|
|
32
33
|
if (content !== null) {
|
|
33
34
|
const parent = path.dirname(candidate);
|
package/src/discovery/agents.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
buildRuleFromMarkdown,
|
|
20
20
|
calculateDepth,
|
|
21
21
|
createSourceMeta,
|
|
22
|
+
getReadOptions,
|
|
22
23
|
loadFilesFromDir,
|
|
23
24
|
scanSkillsFromDir,
|
|
24
25
|
} from "./helpers";
|
|
@@ -181,7 +182,7 @@ registerProvider<SlashCommand>(slashCommandCapability.id, {
|
|
|
181
182
|
// Context Files (AGENTS.md)
|
|
182
183
|
async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFile>> {
|
|
183
184
|
const load = async (filePath: string, level: "user" | "project"): Promise<ContextFile | null> => {
|
|
184
|
-
const content = await readFile(filePath);
|
|
185
|
+
const content = await readFile(filePath, getReadOptions(ctx, level));
|
|
185
186
|
if (!content) return null;
|
|
186
187
|
// filePath is <ancestor>/.agent(s)/AGENTS.md — go up past the config dir to the ancestor
|
|
187
188
|
const ancestorDir = path.dirname(path.dirname(filePath));
|
|
@@ -208,7 +209,7 @@ registerProvider<ContextFile>(contextFileCapability.id, {
|
|
|
208
209
|
// System Prompt (SYSTEM.md)
|
|
209
210
|
async function loadSystemPrompt(ctx: LoadContext): Promise<LoadResult<SystemPrompt>> {
|
|
210
211
|
const load = async (filePath: string, level: "user" | "project"): Promise<SystemPrompt | null> => {
|
|
211
|
-
const content = await readFile(filePath);
|
|
212
|
+
const content = await readFile(filePath, getReadOptions(ctx, level));
|
|
212
213
|
if (!content) return null;
|
|
213
214
|
return { path: filePath, content, level, _source: createSourceMeta(PROVIDER_ID, filePath, level) };
|
|
214
215
|
};
|
package/src/discovery/builtin.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
discoverExtensionModulePaths,
|
|
30
30
|
expandEnvVarsDeep,
|
|
31
31
|
getExtensionNameFromPath,
|
|
32
|
+
getReadOptions,
|
|
32
33
|
loadFilesFromDir,
|
|
33
34
|
SOURCE_PATHS,
|
|
34
35
|
scanSkillsFromDir,
|
|
@@ -118,7 +119,9 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
118
119
|
const data = tryParseJson<{ mcpServers?: Record<string, unknown> }>(content);
|
|
119
120
|
if (!data?.mcpServers) return result;
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
// Project mcp.json is repo content. Skip secret-named ${VAR} the same way
|
|
123
|
+
// project ssh.json does; user scope still expands those names.
|
|
124
|
+
const expanded = expandEnvVarsDeep(data.mcpServers, undefined, level === "project");
|
|
122
125
|
for (const [serverName, config] of Object.entries(expanded)) {
|
|
123
126
|
const serverConfig = config as Record<string, unknown>;
|
|
124
127
|
|
|
@@ -201,6 +204,7 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
201
204
|
cwd: serverConfig.cwd as string | undefined,
|
|
202
205
|
url: serverConfig.url as string | undefined,
|
|
203
206
|
headers: serverConfig.headers as Record<string, string> | undefined,
|
|
207
|
+
publicNetwork: serverConfig.publicNetwork === true ? true : undefined,
|
|
204
208
|
auth: serverConfig.auth as
|
|
205
209
|
| {
|
|
206
210
|
type: "oauth" | "apikey";
|
|
@@ -239,7 +243,7 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
239
243
|
|
|
240
244
|
const contents = await Promise.allSettled(
|
|
241
245
|
paths.map(async p => {
|
|
242
|
-
const content = await readFile(p.path);
|
|
246
|
+
const content = await readFile(p.path, getReadOptions(ctx, p.level));
|
|
243
247
|
if (content) {
|
|
244
248
|
return { path: p.path, content, level: p.level };
|
|
245
249
|
}
|
|
@@ -285,7 +289,7 @@ async function loadSystemPrompt(ctx: LoadContext): Promise<LoadResult<SystemProm
|
|
|
285
289
|
const nearestProjectConfigDir = await findNearestProjectConfigDir(ctx.cwd, ctx.repoRoot);
|
|
286
290
|
if (nearestProjectConfigDir) {
|
|
287
291
|
const projectPath = path.join(nearestProjectConfigDir.dir, "SYSTEM.md");
|
|
288
|
-
const projectContent = await readFile(projectPath);
|
|
292
|
+
const projectContent = await readFile(projectPath, getReadOptions(ctx, "project"));
|
|
289
293
|
if (projectContent) {
|
|
290
294
|
items.push({
|
|
291
295
|
path: projectPath,
|
|
@@ -403,14 +407,14 @@ async function loadRules(ctx: LoadContext): Promise<LoadResult<Rule>> {
|
|
|
403
407
|
// Project scope: nearest .skc/RULES.md walking up from cwd to repoRoot
|
|
404
408
|
for (const userAgentDir of getUserAgentDirs()) {
|
|
405
409
|
const userRulesFile = path.join(ctx.home, userAgentDir, "RULES.md");
|
|
406
|
-
const userRule = await loadStickyRulesFile(userRulesFile, "user");
|
|
410
|
+
const userRule = await loadStickyRulesFile(ctx, userRulesFile, "user");
|
|
407
411
|
if (userRule) items.push(userRule);
|
|
408
412
|
}
|
|
409
413
|
|
|
410
414
|
const nearestProjectConfigDir = await findNearestProjectConfigDir(ctx.cwd, ctx.repoRoot);
|
|
411
415
|
if (nearestProjectConfigDir) {
|
|
412
416
|
const projectRulesFile = path.join(nearestProjectConfigDir.dir, "RULES.md");
|
|
413
|
-
const projectRule = await loadStickyRulesFile(projectRulesFile, "project");
|
|
417
|
+
const projectRule = await loadStickyRulesFile(ctx, projectRulesFile, "project");
|
|
414
418
|
if (projectRule) items.push(projectRule);
|
|
415
419
|
}
|
|
416
420
|
|
|
@@ -421,8 +425,12 @@ async function loadRules(ctx: LoadContext): Promise<LoadResult<Rule>> {
|
|
|
421
425
|
* Read a top-level `RULES.md` and synthesize an always-apply rule.
|
|
422
426
|
* Returns null when the file is absent or empty so callers can short-circuit.
|
|
423
427
|
*/
|
|
424
|
-
async function loadStickyRulesFile(
|
|
425
|
-
|
|
428
|
+
async function loadStickyRulesFile(
|
|
429
|
+
ctx: LoadContext,
|
|
430
|
+
filePath: string,
|
|
431
|
+
level: "user" | "project",
|
|
432
|
+
): Promise<Rule | null> {
|
|
433
|
+
const content = await readFile(filePath, getReadOptions(ctx, level));
|
|
426
434
|
if (!content) return null;
|
|
427
435
|
const source = createSourceMeta(PROVIDER_ID, filePath, level);
|
|
428
436
|
const rule = buildRuleFromMarkdown("RULES.md", content, filePath, source, { ruleName: "RULES" });
|
|
@@ -494,7 +502,9 @@ async function loadExtensionModules(ctx: LoadContext): Promise<LoadResult<Extens
|
|
|
494
502
|
|
|
495
503
|
const [discoveredResults, settingsResults] = await Promise.all([
|
|
496
504
|
Promise.all(configDirs.map(({ dir }) => discoverExtensionModulePaths(ctx, path.join(dir, "extensions")))),
|
|
497
|
-
Promise.all(
|
|
505
|
+
Promise.all(
|
|
506
|
+
configDirs.map(({ dir, level }) => readFile(path.join(dir, "settings.json"), getReadOptions(ctx, level))),
|
|
507
|
+
),
|
|
498
508
|
]);
|
|
499
509
|
|
|
500
510
|
for (let i = 0; i < configDirs.length; i++) {
|
|
@@ -874,7 +884,7 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
874
884
|
|
|
875
885
|
for (const { dir, level } of await getConfigDirs(ctx)) {
|
|
876
886
|
const settingsPath = path.join(dir, "settings.json");
|
|
877
|
-
const settingsContent = await readFile(settingsPath);
|
|
887
|
+
const settingsContent = await readFile(settingsPath, getReadOptions(ctx, level));
|
|
878
888
|
if (settingsContent) {
|
|
879
889
|
const data = tryParseJson<Record<string, unknown>>(settingsContent);
|
|
880
890
|
if (data) {
|
|
@@ -890,7 +900,7 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
890
900
|
}
|
|
891
901
|
|
|
892
902
|
const configPath = path.join(dir, "config.yml");
|
|
893
|
-
const configContent = await readFile(configPath);
|
|
903
|
+
const configContent = await readFile(configPath, getReadOptions(ctx, level));
|
|
894
904
|
if (!configContent) continue;
|
|
895
905
|
|
|
896
906
|
const data = parseYamlSettings(configContent, configPath);
|
|
@@ -934,7 +944,7 @@ async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFil
|
|
|
934
944
|
const nearestProjectConfigDir = await findNearestProjectConfigDir(ctx.cwd, ctx.repoRoot);
|
|
935
945
|
if (nearestProjectConfigDir) {
|
|
936
946
|
const projectPath = path.join(nearestProjectConfigDir.dir, "AGENTS.md");
|
|
937
|
-
const projectContent = await readFile(projectPath);
|
|
947
|
+
const projectContent = await readFile(projectPath, getReadOptions(ctx, "project"));
|
|
938
948
|
if (projectContent) {
|
|
939
949
|
items.push({
|
|
940
950
|
path: projectPath,
|
package/src/discovery/claude.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
discoverExtensionModulePaths,
|
|
26
26
|
expandEnvVarsDeep,
|
|
27
27
|
getExtensionNameFromPath,
|
|
28
|
+
getReadOptions,
|
|
28
29
|
loadFilesFromDir,
|
|
29
30
|
scanSkillsFromDir,
|
|
30
31
|
} from "./helpers";
|
|
@@ -46,7 +47,7 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
46
47
|
const items: MCPServer[] = [];
|
|
47
48
|
const projectBase = getProjectClaude(ctx);
|
|
48
49
|
const projectPaths = [path.join(projectBase, ".mcp.json"), path.join(projectBase, "mcp.json")];
|
|
49
|
-
const contents = await Promise.all(projectPaths.map(filePath => readFile(filePath)));
|
|
50
|
+
const contents = await Promise.all(projectPaths.map(filePath => readFile(filePath, getReadOptions(ctx, "project"))));
|
|
50
51
|
|
|
51
52
|
const parseMcpServers = (content: string | null, filePath: string): MCPServer[] => {
|
|
52
53
|
if (!content) return [];
|
|
@@ -85,7 +86,7 @@ async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFil
|
|
|
85
86
|
const items: ContextFile[] = [];
|
|
86
87
|
const projectBase = getProjectClaude(ctx);
|
|
87
88
|
const projectClaudeMd = path.join(projectBase, "CLAUDE.md");
|
|
88
|
-
const projectContent = await readFile(projectClaudeMd);
|
|
89
|
+
const projectContent = await readFile(projectClaudeMd, getReadOptions(ctx, "project"));
|
|
89
90
|
if (projectContent !== null) {
|
|
90
91
|
const depth = calculateDepth(ctx.cwd, path.dirname(projectBase), path.sep);
|
|
91
92
|
items.push({
|
|
@@ -202,7 +203,7 @@ async function loadTools(ctx: LoadContext): Promise<LoadResult<CustomTool>> {
|
|
|
202
203
|
|
|
203
204
|
async function loadSystemPrompts(ctx: LoadContext): Promise<LoadResult<SystemPrompt>> {
|
|
204
205
|
const projectSystemMd = path.join(getProjectClaude(ctx), "SYSTEM.md");
|
|
205
|
-
const content = await readFile(projectSystemMd);
|
|
206
|
+
const content = await readFile(projectSystemMd, getReadOptions(ctx, "project"));
|
|
206
207
|
return {
|
|
207
208
|
items:
|
|
208
209
|
content === null
|
|
@@ -223,7 +224,7 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
223
224
|
const items: Settings[] = [];
|
|
224
225
|
const warnings: string[] = [];
|
|
225
226
|
const projectSettingsJson = path.join(getProjectClaude(ctx), "settings.json");
|
|
226
|
-
const projectContent = await readFile(projectSettingsJson);
|
|
227
|
+
const projectContent = await readFile(projectSettingsJson, getReadOptions(ctx, "project"));
|
|
227
228
|
if (projectContent) {
|
|
228
229
|
const data = tryParseJson<Record<string, unknown>>(projectContent);
|
|
229
230
|
if (data) {
|
package/src/discovery/cline.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { readDirEntries, readFile } from "../capability/fs";
|
|
|
10
10
|
import type { Rule } from "../capability/rule";
|
|
11
11
|
import { ruleCapability } from "../capability/rule";
|
|
12
12
|
import type { LoadContext, LoadResult } from "../capability/types";
|
|
13
|
-
import { buildRuleFromMarkdown, createSourceMeta, loadFilesFromDir } from "./helpers";
|
|
13
|
+
import { buildRuleFromMarkdown, createSourceMeta, getReadOptions, loadFilesFromDir } from "./helpers";
|
|
14
14
|
|
|
15
15
|
const PROVIDER_ID = "cline";
|
|
16
16
|
const DISPLAY_NAME = "Cline";
|
|
@@ -60,7 +60,7 @@ async function loadRules(ctx: LoadContext): Promise<LoadResult<Rule>> {
|
|
|
60
60
|
if (result.warnings) warnings.push(...result.warnings);
|
|
61
61
|
} else {
|
|
62
62
|
// Single file format
|
|
63
|
-
const content = await readFile(found.path);
|
|
63
|
+
const content = await readFile(found.path, getReadOptions(ctx, "project"));
|
|
64
64
|
if (content === null) {
|
|
65
65
|
warnings.push(`Failed to read .clinerules at ${found.path}`);
|
|
66
66
|
return { items, warnings };
|
package/src/discovery/codex.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
buildExtensionModuleItems,
|
|
32
32
|
createSourceMeta,
|
|
33
33
|
discoverExtensionModulePaths,
|
|
34
|
+
getReadOptions,
|
|
34
35
|
loadFilesFromDir,
|
|
35
36
|
scanSkillsFromDir,
|
|
36
37
|
} from "./helpers";
|
|
@@ -46,7 +47,7 @@ function getProjectCodexDir(ctx: LoadContext): string {
|
|
|
46
47
|
async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFile>> {
|
|
47
48
|
const items: ContextFile[] = [];
|
|
48
49
|
const agentsMd = path.join(getProjectCodexDir(ctx), "AGENTS.md");
|
|
49
|
-
const agentsContent = await readFile(agentsMd);
|
|
50
|
+
const agentsContent = await readFile(agentsMd, getReadOptions(ctx, "project"));
|
|
50
51
|
if (agentsContent) {
|
|
51
52
|
items.push({
|
|
52
53
|
path: agentsMd,
|
|
@@ -62,7 +63,7 @@ async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFil
|
|
|
62
63
|
async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>> {
|
|
63
64
|
const warnings: string[] = [];
|
|
64
65
|
const projectConfigPath = path.join(getProjectCodexDir(ctx), "config.toml");
|
|
65
|
-
const projectConfig = await loadTomlConfig(projectConfigPath);
|
|
66
|
+
const projectConfig = await loadTomlConfig(ctx, projectConfigPath);
|
|
66
67
|
const items: MCPServer[] = [];
|
|
67
68
|
if (projectConfig) {
|
|
68
69
|
const servers = extractMCPServersFromToml(projectConfig);
|
|
@@ -77,8 +78,8 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
77
78
|
return { items, warnings };
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
async function loadTomlConfig(filePath: string): Promise<Record<string, unknown> | null> {
|
|
81
|
-
const content = await readFile(filePath);
|
|
81
|
+
async function loadTomlConfig(ctx: LoadContext, filePath: string): Promise<Record<string, unknown> | null> {
|
|
82
|
+
const content = await readFile(filePath, getReadOptions(ctx, "project"));
|
|
82
83
|
if (!content) return null;
|
|
83
84
|
try {
|
|
84
85
|
return Bun.TOML.parse(content) as Record<string, unknown>;
|
|
@@ -243,7 +244,7 @@ async function loadTools(ctx: LoadContext): Promise<LoadResult<CustomTool>> {
|
|
|
243
244
|
|
|
244
245
|
async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
245
246
|
const projectConfigPath = path.join(getProjectCodexDir(ctx), "config.toml");
|
|
246
|
-
const projectConfig = await loadTomlConfig(projectConfigPath);
|
|
247
|
+
const projectConfig = await loadTomlConfig(ctx, projectConfigPath);
|
|
247
248
|
return {
|
|
248
249
|
items: projectConfig
|
|
249
250
|
? [
|
package/src/discovery/cursor.ts
CHANGED
|
@@ -25,7 +25,14 @@ import { ruleCapability } from "../capability/rule";
|
|
|
25
25
|
import type { Settings } from "../capability/settings";
|
|
26
26
|
import { settingsCapability } from "../capability/settings";
|
|
27
27
|
import type { LoadContext, LoadResult, SourceMeta } from "../capability/types";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
buildRuleFromMarkdown,
|
|
30
|
+
createSourceMeta,
|
|
31
|
+
getProjectPath,
|
|
32
|
+
getReadOptions,
|
|
33
|
+
getUserPath,
|
|
34
|
+
loadFilesFromDir,
|
|
35
|
+
} from "./helpers";
|
|
29
36
|
|
|
30
37
|
const PROVIDER_ID = "cursor";
|
|
31
38
|
const DISPLAY_NAME = "Cursor";
|
|
@@ -86,7 +93,9 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
86
93
|
getProjectPath(ctx, "cursor", "settings.json"),
|
|
87
94
|
]);
|
|
88
95
|
|
|
89
|
-
const projectContentPromise = projectPath
|
|
96
|
+
const projectContentPromise = projectPath
|
|
97
|
+
? readFile(projectPath, getReadOptions(ctx, "project"))
|
|
98
|
+
: Promise.resolve(null);
|
|
90
99
|
|
|
91
100
|
if (userContent && userPath) {
|
|
92
101
|
const parsed = tryParseJson<Record<string, unknown>>(userContent);
|
package/src/discovery/gemini.ts
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
createSourceMeta,
|
|
34
34
|
discoverExtensionModulePaths,
|
|
35
35
|
getProjectPath,
|
|
36
|
+
getReadOptions,
|
|
36
37
|
getUserPath,
|
|
37
38
|
} from "./helpers";
|
|
38
39
|
|
|
@@ -65,7 +66,7 @@ async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFil
|
|
|
65
66
|
// Project-level: .gemini/GEMINI.md
|
|
66
67
|
const projectGeminiMd = getProjectPath(ctx, "gemini", "GEMINI.md");
|
|
67
68
|
if (projectGeminiMd) {
|
|
68
|
-
const content = await readFile(projectGeminiMd);
|
|
69
|
+
const content = await readFile(projectGeminiMd, getReadOptions(ctx, "project"));
|
|
69
70
|
if (content) {
|
|
70
71
|
const projectBase = getProjectPath(ctx, "gemini", "");
|
|
71
72
|
const depth = projectBase ? calculateDepth(ctx.cwd, projectBase, path.sep) : 0;
|
|
@@ -195,7 +196,7 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
195
196
|
// Project-level: .gemini/settings.json
|
|
196
197
|
const projectPath = getProjectPath(ctx, "gemini", "settings.json");
|
|
197
198
|
if (projectPath) {
|
|
198
|
-
const content = await readFile(projectPath);
|
|
199
|
+
const content = await readFile(projectPath, getReadOptions(ctx, "project"));
|
|
199
200
|
if (content) {
|
|
200
201
|
const parsed = tryParseJson<Record<string, unknown>>(content);
|
|
201
202
|
if (parsed) {
|
|
@@ -250,7 +251,7 @@ async function loadSystemPrompt(ctx: LoadContext): Promise<LoadResult<SystemProm
|
|
|
250
251
|
// Project-level: .gemini/system.md
|
|
251
252
|
const projectSystemMd = getProjectPath(ctx, "gemini", "system.md");
|
|
252
253
|
if (projectSystemMd) {
|
|
253
|
-
const content = await readFile(projectSystemMd);
|
|
254
|
+
const content = await readFile(projectSystemMd, getReadOptions(ctx, "project"));
|
|
254
255
|
if (content) {
|
|
255
256
|
items.push({
|
|
256
257
|
path: projectSystemMd,
|
package/src/discovery/github.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { readFile } from "../capability/fs";
|
|
|
19
19
|
import { type Instruction, instructionCapability } from "../capability/instruction";
|
|
20
20
|
import type { LoadContext, LoadResult, SourceMeta } from "../capability/types";
|
|
21
21
|
|
|
22
|
-
import { calculateDepth, createSourceMeta, getProjectPath, loadFilesFromDir } from "./helpers";
|
|
22
|
+
import { calculateDepth, createSourceMeta, getProjectPath, getReadOptions, loadFilesFromDir } from "./helpers";
|
|
23
23
|
|
|
24
24
|
const PROVIDER_ID = "github";
|
|
25
25
|
const DISPLAY_NAME = "GitHub Copilot";
|
|
@@ -35,7 +35,7 @@ async function loadContextFiles(ctx: LoadContext): Promise<LoadResult<ContextFil
|
|
|
35
35
|
|
|
36
36
|
const copilotInstructionsPath = getProjectPath(ctx, "github", "copilot-instructions.md");
|
|
37
37
|
if (copilotInstructionsPath) {
|
|
38
|
-
const content = await readFile(copilotInstructionsPath);
|
|
38
|
+
const content = await readFile(copilotInstructionsPath, getReadOptions(ctx, "project"));
|
|
39
39
|
if (content) {
|
|
40
40
|
const fileDir = path.dirname(copilotInstructionsPath);
|
|
41
41
|
const depth = calculateDepth(ctx.cwd, fileDir, path.sep);
|
package/src/discovery/helpers.ts
CHANGED
|
@@ -13,7 +13,14 @@ import {
|
|
|
13
13
|
tryParseJson,
|
|
14
14
|
} from "@sayknow-cli/utils";
|
|
15
15
|
import type { ExtensionModule } from "../capability/extension-module";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
containmentRefusalTarget,
|
|
18
|
+
invalidate as invalidateFsCache,
|
|
19
|
+
type ReadFileOptions,
|
|
20
|
+
type ReadScope,
|
|
21
|
+
readDirEntries,
|
|
22
|
+
readFile,
|
|
23
|
+
} from "../capability/fs";
|
|
17
24
|
import { parseRuleConditionAndScope, type Rule, type RuleFrontmatter } from "../capability/rule";
|
|
18
25
|
import type { Skill, SkillFrontmatter } from "../capability/skill";
|
|
19
26
|
import type { LoadContext, LoadResult, SourceMeta } from "../capability/types";
|
|
@@ -101,6 +108,19 @@ export function getProjectPath(ctx: LoadContext, source: SourceId, subpath: stri
|
|
|
101
108
|
return path.join(ctx.cwd, paths.projectDir, subpath);
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Filesystem authority for a provider read. Project reads are bounded by the
|
|
113
|
+
* repository (or the opened directory without one): a repository symlink to a
|
|
114
|
+
* file outside it must not be loaded into the prompt as its external target.
|
|
115
|
+
*/
|
|
116
|
+
export function getReadOptions(
|
|
117
|
+
ctx: Pick<LoadContext, "cwd" | "repoRoot">,
|
|
118
|
+
scope: ReadScope,
|
|
119
|
+
): ReadFileOptions | undefined {
|
|
120
|
+
if (scope !== "project") return undefined;
|
|
121
|
+
return { containmentRoot: ctx.repoRoot ?? ctx.cwd, scope };
|
|
122
|
+
}
|
|
123
|
+
|
|
104
124
|
/**
|
|
105
125
|
* Create source metadata for an item.
|
|
106
126
|
*/
|
|
@@ -341,12 +361,13 @@ export function compareSkillOrder(aName: string, aPath: string, bName: string, b
|
|
|
341
361
|
}
|
|
342
362
|
|
|
343
363
|
export async function scanSkillsFromDir(
|
|
344
|
-
|
|
364
|
+
ctx: LoadContext,
|
|
345
365
|
options: ScanSkillsFromDirOptions,
|
|
346
366
|
): Promise<LoadResult<Skill>> {
|
|
347
367
|
const items: Skill[] = [];
|
|
348
368
|
const warnings: string[] = [];
|
|
349
369
|
const { dir, level, providerId, requireDescription = false } = options;
|
|
370
|
+
const readOptions = getReadOptions(ctx, level);
|
|
350
371
|
|
|
351
372
|
let entries: fs.Dirent[];
|
|
352
373
|
try {
|
|
@@ -359,8 +380,17 @@ export async function scanSkillsFromDir(
|
|
|
359
380
|
}
|
|
360
381
|
const loadSkill = async (skillPath: string) => {
|
|
361
382
|
try {
|
|
362
|
-
const content = await readFile(skillPath);
|
|
363
|
-
if (!content)
|
|
383
|
+
const content = await readFile(skillPath, readOptions);
|
|
384
|
+
if (!content) {
|
|
385
|
+
const refusedTarget = await containmentRefusalTarget(skillPath, readOptions);
|
|
386
|
+
// Name the resolved file and the setting that loads it, so a symlinked skills repo is fixable (#6371).
|
|
387
|
+
if (refusedTarget) {
|
|
388
|
+
warnings.push(
|
|
389
|
+
`Refusing skill path outside project root: ${skillPath} (resolves to ${refusedTarget}; add ${path.dirname(path.dirname(refusedTarget))} to skills.customDirectories to load it)`,
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
364
394
|
const { frontmatter, body } = parseFrontmatter(content, { source: skillPath });
|
|
365
395
|
if (frontmatter.enabled === false) {
|
|
366
396
|
return;
|
|
@@ -405,8 +435,17 @@ export async function scanSkillsFromDir(
|
|
|
405
435
|
* Expand environment variables in a string.
|
|
406
436
|
* Supports ${VAR} and ${VAR:-default} syntax.
|
|
407
437
|
*/
|
|
408
|
-
|
|
438
|
+
const SENSITIVE_ENV_NAME = /key|secret|token|pass|auth|credential|cookie|dsn|url$/i;
|
|
439
|
+
|
|
440
|
+
export function isSensitiveEnvName(name: string): boolean {
|
|
441
|
+
return SENSITIVE_ENV_NAME.test(name);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function expandEnvVars(value: string, extraEnv?: Record<string, string>, skipSensitiveNames = false): string {
|
|
409
445
|
return value.replace(/\$\{([^}:]+)(?::-([^}]*))?\}/g, (_, varName: string, defaultValue?: string) => {
|
|
446
|
+
if (skipSensitiveNames && isSensitiveEnvName(varName)) {
|
|
447
|
+
return defaultValue !== undefined ? defaultValue : `\${${varName}}`;
|
|
448
|
+
}
|
|
410
449
|
const envValue = extraEnv?.[varName] ?? Bun.env[varName];
|
|
411
450
|
if (envValue !== undefined) return envValue;
|
|
412
451
|
if (defaultValue !== undefined) return defaultValue;
|
|
@@ -417,17 +456,17 @@ function expandEnvVars(value: string, extraEnv?: Record<string, string>): string
|
|
|
417
456
|
/**
|
|
418
457
|
* Recursively expand environment variables in an object.
|
|
419
458
|
*/
|
|
420
|
-
export function expandEnvVarsDeep<T>(obj: T, extraEnv?: Record<string, string
|
|
459
|
+
export function expandEnvVarsDeep<T>(obj: T, extraEnv?: Record<string, string>, skipSensitiveNames = false): T {
|
|
421
460
|
if (typeof obj === "string") {
|
|
422
|
-
return expandEnvVars(obj, extraEnv) as T;
|
|
461
|
+
return expandEnvVars(obj, extraEnv, skipSensitiveNames) as T;
|
|
423
462
|
}
|
|
424
463
|
if (Array.isArray(obj)) {
|
|
425
|
-
return obj.map(item => expandEnvVarsDeep(item, extraEnv)) as T;
|
|
464
|
+
return obj.map(item => expandEnvVarsDeep(item, extraEnv, skipSensitiveNames)) as T;
|
|
426
465
|
}
|
|
427
466
|
if (obj !== null && typeof obj === "object") {
|
|
428
467
|
const result: Record<string, unknown> = {};
|
|
429
468
|
for (const [key, value] of Object.entries(obj)) {
|
|
430
|
-
result[key] = expandEnvVarsDeep(value, extraEnv);
|
|
469
|
+
result[key] = expandEnvVarsDeep(value, extraEnv, skipSensitiveNames);
|
|
431
470
|
}
|
|
432
471
|
return result as T;
|
|
433
472
|
}
|
|
@@ -439,7 +478,7 @@ export function expandEnvVarsDeep<T>(obj: T, extraEnv?: Record<string, string>):
|
|
|
439
478
|
* Uses native glob for fast filesystem scanning with gitignore support.
|
|
440
479
|
*/
|
|
441
480
|
export async function loadFilesFromDir<T>(
|
|
442
|
-
|
|
481
|
+
ctx: LoadContext,
|
|
443
482
|
dir: string,
|
|
444
483
|
provider: string,
|
|
445
484
|
level: "user" | "project",
|
|
@@ -456,6 +495,7 @@ export async function loadFilesFromDir<T>(
|
|
|
456
495
|
const warnings: string[] = [];
|
|
457
496
|
// Build glob pattern based on extensions and recursion
|
|
458
497
|
const { extensions, recursive = false } = options;
|
|
498
|
+
const readOptions = getReadOptions(ctx, level);
|
|
459
499
|
|
|
460
500
|
let pattern: string;
|
|
461
501
|
if (extensions && extensions.length > 0) {
|
|
@@ -485,7 +525,7 @@ export async function loadFilesFromDir<T>(
|
|
|
485
525
|
const fileResults = await Promise.all(
|
|
486
526
|
matches.map(async match => {
|
|
487
527
|
const filePath = path.join(dir, match.path);
|
|
488
|
-
const content = await readFile(filePath);
|
|
528
|
+
const content = await readFile(filePath, readOptions);
|
|
489
529
|
return { filePath, content };
|
|
490
530
|
}),
|
|
491
531
|
);
|
|
@@ -147,7 +147,12 @@ function validateExactMCPConfig(config: unknown): {
|
|
|
147
147
|
/**
|
|
148
148
|
* Transform raw MCP config to canonical MCPServer format.
|
|
149
149
|
*/
|
|
150
|
-
function transformMCPConfig(
|
|
150
|
+
function transformMCPConfig(
|
|
151
|
+
config: MCPConfigFile,
|
|
152
|
+
source: SourceMeta,
|
|
153
|
+
quiet = false,
|
|
154
|
+
skipSensitiveEnvNames = false,
|
|
155
|
+
): MCPServer[] {
|
|
151
156
|
const servers: MCPServer[] = [];
|
|
152
157
|
|
|
153
158
|
if (config.mcpServers) {
|
|
@@ -208,6 +213,12 @@ function transformMCPConfig(config: MCPConfigFile, source: SourceMeta, quiet = f
|
|
|
208
213
|
cwd: serverConfig.cwd,
|
|
209
214
|
url: serverConfig.url,
|
|
210
215
|
headers: serverConfig.headers,
|
|
216
|
+
publicNetwork:
|
|
217
|
+
serverConfig.type === "http" &&
|
|
218
|
+
"publicNetwork" in serverConfig &&
|
|
219
|
+
(serverConfig as { publicNetwork?: boolean }).publicNetwork === true
|
|
220
|
+
? true
|
|
221
|
+
: undefined,
|
|
211
222
|
auth: serverConfig.auth,
|
|
212
223
|
oauth: serverConfig.oauth,
|
|
213
224
|
transport: serverConfig.type,
|
|
@@ -215,14 +226,17 @@ function transformMCPConfig(config: MCPConfigFile, source: SourceMeta, quiet = f
|
|
|
215
226
|
};
|
|
216
227
|
|
|
217
228
|
// Expand environment variables
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (server.
|
|
222
|
-
if (server.
|
|
223
|
-
if (server.
|
|
224
|
-
if (server.
|
|
225
|
-
if (server.
|
|
229
|
+
// Repo-root mcp.json is project content. Exact `--mcp-config` passes
|
|
230
|
+
// skipSensitiveEnvNames false so a trusted file can still reference secrets.
|
|
231
|
+
const expand = <T>(value: T): T => expandEnvVarsDeep(value, undefined, skipSensitiveEnvNames);
|
|
232
|
+
if (server.command) server.command = expand(server.command);
|
|
233
|
+
if (server.args) server.args = expand(server.args);
|
|
234
|
+
if (server.env) server.env = expand(server.env);
|
|
235
|
+
if (server.cwd) server.cwd = expand(server.cwd);
|
|
236
|
+
if (server.url) server.url = expand(server.url);
|
|
237
|
+
if (server.headers) server.headers = expand(server.headers);
|
|
238
|
+
if (server.auth) server.auth = expand(server.auth);
|
|
239
|
+
if (server.oauth) server.oauth = expand(server.oauth);
|
|
226
240
|
servers.push(server);
|
|
227
241
|
}
|
|
228
242
|
}
|
|
@@ -431,7 +445,7 @@ async function readExactMCPConfigFile(filePath: string): Promise<string | null>
|
|
|
431
445
|
export async function loadMCPJsonFile(
|
|
432
446
|
filePath: string,
|
|
433
447
|
level: "user" | "project",
|
|
434
|
-
options?: { quiet?: boolean; useCache?: boolean },
|
|
448
|
+
options?: { quiet?: boolean; useCache?: boolean; skipSensitiveEnvNames?: boolean },
|
|
435
449
|
): Promise<MCPJsonLoadResult> {
|
|
436
450
|
const warnings: string[] = [];
|
|
437
451
|
const items: MCPServer[] = [];
|
|
@@ -466,7 +480,7 @@ export async function loadMCPJsonFile(
|
|
|
466
480
|
validConfig = config as MCPConfigFile;
|
|
467
481
|
}
|
|
468
482
|
const source = createSourceMeta(PROVIDER_ID, filePath, level);
|
|
469
|
-
items.push(...transformMCPConfig(validConfig, source, options?.quiet));
|
|
483
|
+
items.push(...transformMCPConfig(validConfig, source, options?.quiet, options?.skipSensitiveEnvNames === true));
|
|
470
484
|
|
|
471
485
|
return {
|
|
472
486
|
items,
|
|
@@ -481,7 +495,9 @@ export async function loadMCPJsonFile(
|
|
|
481
495
|
async function load(ctx: LoadContext): Promise<LoadResult<MCPServer>> {
|
|
482
496
|
const filenames = ["mcp.json", ".mcp.json"];
|
|
483
497
|
const results = await Promise.all(
|
|
484
|
-
filenames.map(filename =>
|
|
498
|
+
filenames.map(filename =>
|
|
499
|
+
loadMCPJsonFile(path.join(ctx.cwd, filename), "project", { skipSensitiveEnvNames: true }),
|
|
500
|
+
),
|
|
485
501
|
);
|
|
486
502
|
|
|
487
503
|
const allItems = results.flatMap(r => r.items);
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
createSourceMeta,
|
|
36
36
|
discoverExtensionModulePaths,
|
|
37
37
|
getProjectPath,
|
|
38
|
+
getReadOptions,
|
|
38
39
|
getUserPath,
|
|
39
40
|
loadFilesFromDir,
|
|
40
41
|
scanSkillsFromDir,
|
|
@@ -218,7 +219,7 @@ async function loadSettings(ctx: LoadContext): Promise<LoadResult<Settings>> {
|
|
|
218
219
|
|
|
219
220
|
// Project-level: opencode.json in project root
|
|
220
221
|
const projectConfigPath = path.join(ctx.cwd, "opencode.json");
|
|
221
|
-
const content = await readFile(projectConfigPath);
|
|
222
|
+
const content = await readFile(projectConfigPath, getReadOptions(ctx, "project"));
|
|
222
223
|
if (content) {
|
|
223
224
|
const parsed = tryParseJson<Record<string, unknown>>(content);
|
|
224
225
|
if (parsed) {
|
package/src/discovery/ssh.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { type SSHHost, sshCapability } from "../capability/ssh";
|
|
|
12
12
|
import type { LoadContext, LoadResult, SourceMeta } from "../capability/types";
|
|
13
13
|
import { validateSshDestination } from "../ssh/utils";
|
|
14
14
|
import { expandTilde } from "../tools/path-utils";
|
|
15
|
-
import { createSourceMeta, expandEnvVarsDeep } from "./helpers";
|
|
15
|
+
import { createSourceMeta, expandEnvVarsDeep, getReadOptions } from "./helpers";
|
|
16
16
|
|
|
17
17
|
const PROVIDER_ID = "ssh-json";
|
|
18
18
|
const DISPLAY_NAME = "SSH Config";
|
|
@@ -34,9 +34,14 @@ interface SSHConfigFile {
|
|
|
34
34
|
|
|
35
35
|
function parsePort(value: number | string | undefined): number | undefined {
|
|
36
36
|
if (value === undefined) return undefined;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// The JSON is not validated against SSHConfigFile, so anything else (e.g. an
|
|
38
|
+
// array, which parseInt would coerce: parseInt([2222]) === 2222) is rejected.
|
|
39
|
+
if (typeof value !== "number" && typeof value !== "string") return undefined;
|
|
40
|
+
// `Number.parseInt` accepts trailing garbage (parseInt("22oops") === 22), so a
|
|
41
|
+
// string must be plain digits.
|
|
42
|
+
if (typeof value === "string" && !/^\d+$/.test(value)) return undefined;
|
|
43
|
+
const port = typeof value === "number" ? value : Number.parseInt(value, 10);
|
|
44
|
+
return Number.isInteger(port) && port >= 1 && port <= 65535 ? port : undefined;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
function parseCompat(value: boolean | string | undefined): boolean | undefined {
|
|
@@ -102,7 +107,7 @@ async function loadSshJsonFile(
|
|
|
102
107
|
): Promise<LoadResult<SSHHost>> {
|
|
103
108
|
const items: SSHHost[] = [];
|
|
104
109
|
const warnings: string[] = [];
|
|
105
|
-
const content = await readFile(filePath);
|
|
110
|
+
const content = await readFile(filePath, getReadOptions(ctx, level));
|
|
106
111
|
if (content === null) {
|
|
107
112
|
return { items, warnings };
|
|
108
113
|
}
|
|
@@ -111,7 +116,7 @@ async function loadSshJsonFile(
|
|
|
111
116
|
warnings.push(`Failed to parse JSON in ${filePath}`);
|
|
112
117
|
return { items, warnings };
|
|
113
118
|
}
|
|
114
|
-
const config = expandEnvVarsDeep(parsed);
|
|
119
|
+
const config = expandEnvVarsDeep(parsed, undefined, level === "project");
|
|
115
120
|
if (!config.hosts || typeof config.hosts !== "object") {
|
|
116
121
|
warnings.push(`Missing hosts in ${filePath}`);
|
|
117
122
|
return { items, warnings };
|
|
@@ -8,7 +8,9 @@ const SKC_VAR = "$" + "{SKC_PLUGIN_ROOT}";
|
|
|
8
8
|
|
|
9
9
|
export function substitutePluginRoot<T>(value: T, rootPath: string): T {
|
|
10
10
|
if (typeof value === "string") {
|
|
11
|
-
|
|
11
|
+
// Function replacers: a string replacement would expand `$&`, `$$`, `` $` ``
|
|
12
|
+
// and `$'` inside the install path instead of inserting it verbatim.
|
|
13
|
+
return value.replaceAll(CLAUDE_VAR, () => rootPath).replaceAll(SKC_VAR, () => rootPath) as T;
|
|
12
14
|
}
|
|
13
15
|
if (Array.isArray(value)) {
|
|
14
16
|
return value.map(v => substitutePluginRoot(v, rootPath)) as T;
|