@sayknow-cli/coding-agent 0.7.10 → 0.7.12

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.
Files changed (425) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/types/async/result-formatting.d.ts +2 -0
  3. package/dist/types/capability/fs.d.ts +22 -3
  4. package/dist/types/capability/mcp.d.ts +2 -0
  5. package/dist/types/cli/append-system-prompt.d.ts +6 -0
  6. package/dist/types/cli/update-cli.d.ts +3 -0
  7. package/dist/types/commands/contribution-prep.d.ts +0 -3
  8. package/dist/types/commands/migrate.d.ts +1 -1
  9. package/dist/types/commands/sdk.d.ts +9 -0
  10. package/dist/types/commit/changelog/index.d.ts +1 -0
  11. package/dist/types/config/settings-schema.d.ts +14 -0
  12. package/dist/types/config/settings.d.ts +7 -1
  13. package/dist/types/coordinator-mcp/session-reaper.d.ts +5 -0
  14. package/dist/types/cursor-delete-path.d.ts +1 -0
  15. package/dist/types/cursor-mcp-name.d.ts +8 -0
  16. package/dist/types/dap/config.d.ts +8 -4
  17. package/dist/types/dap/session.d.ts +11 -2
  18. package/dist/types/debug/report-bundle-parent.d.ts +2 -0
  19. package/dist/types/debug/system-info.d.ts +6 -1
  20. package/dist/types/discovery/helpers.d.ts +11 -3
  21. package/dist/types/discovery/mcp-json.d.ts +1 -0
  22. package/dist/types/edit/file-read-cache.d.ts +4 -0
  23. package/dist/types/edit/modes/patch.d.ts +14 -0
  24. package/dist/types/edit/modes/replace.d.ts +8 -0
  25. package/dist/types/eval/py/runtime.d.ts +9 -0
  26. package/dist/types/exa/mcp-client.d.ts +11 -6
  27. package/dist/types/exec/bash-executor.d.ts +18 -1
  28. package/dist/types/export/html/css-color.d.ts +2 -0
  29. package/dist/types/export/html/html-export-destination.d.ts +2 -0
  30. package/dist/types/export/html/template.generated.d.ts +1 -1
  31. package/dist/types/extensibility/custom-tools/loader.d.ts +3 -2
  32. package/dist/types/extensibility/custom-tools/types.d.ts +3 -1
  33. package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
  34. package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
  35. package/dist/types/goals/runtime.d.ts +6 -0
  36. package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
  37. package/dist/types/hindsight/content.d.ts +5 -6
  38. package/dist/types/internal-urls/skill-path.d.ts +1 -0
  39. package/dist/types/internal-urls/types.d.ts +2 -0
  40. package/dist/types/lsp/clients/swiftlint-client.d.ts +0 -4
  41. package/dist/types/lsp/config.d.ts +8 -5
  42. package/dist/types/lsp/workspace-path.d.ts +1 -0
  43. package/dist/types/migrate/adapters/codex.d.ts +2 -1
  44. package/dist/types/migrate/adapters/index.d.ts +10 -1
  45. package/dist/types/migrate/executor.d.ts +3 -1
  46. package/dist/types/migrate/types.d.ts +15 -3
  47. package/dist/types/modes/components/custom-editor.d.ts +6 -0
  48. package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
  49. package/dist/types/modes/components/model-selector.d.ts +46 -0
  50. package/dist/types/modes/controllers/input-controller.d.ts +9 -0
  51. package/dist/types/modes/interactive-mode.d.ts +1 -0
  52. package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
  53. package/dist/types/runtime-mcp/content-limits.d.ts +4 -0
  54. package/dist/types/runtime-mcp/manager.d.ts +9 -1
  55. package/dist/types/runtime-mcp/mcp-redirect.d.ts +9 -0
  56. package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
  57. package/dist/types/runtime-mcp/plugin-mcp-name-filter.d.ts +22 -0
  58. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
  59. package/dist/types/runtime-mcp/project-host-values.d.ts +33 -0
  60. package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
  61. package/dist/types/runtime-mcp/tool-bridge.d.ts +4 -0
  62. package/dist/types/runtime-mcp/types.d.ts +6 -0
  63. package/dist/types/sdk/broker/ensure.d.ts +2 -0
  64. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +5 -1
  65. package/dist/types/sdk/broker/runtime.d.ts +1 -1
  66. package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
  67. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
  68. package/dist/types/sdk/bus/telegram-daemon.d.ts +1 -0
  69. package/dist/types/sdk/host/events.d.ts +4 -0
  70. package/dist/types/session/agent-session.d.ts +20 -1
  71. package/dist/types/session/messages.d.ts +5 -1
  72. package/dist/types/session/session-manager.d.ts +13 -0
  73. package/dist/types/session/session-storage.d.ts +8 -0
  74. package/dist/types/session/streaming-output.d.ts +11 -0
  75. package/dist/types/session-import/redact.d.ts +1 -1
  76. package/dist/types/skc-runtime/managed-owner-admission.d.ts +3 -0
  77. package/dist/types/skc-runtime/psmux-detect.d.ts +5 -4
  78. package/dist/types/skc-runtime/ralplan-runtime.d.ts +5 -0
  79. package/dist/types/skc-runtime/sidecar-bootstrap-env.d.ts +6 -0
  80. package/dist/types/skc-runtime/state-writer.d.ts +4 -1
  81. package/dist/types/skc-runtime/tmux-sessions.d.ts +24 -0
  82. package/dist/types/skc-runtime/ultragoal-runtime.d.ts +4 -0
  83. package/dist/types/skill-state/workflow-mutation-guard.d.ts +20 -1
  84. package/dist/types/slash-commands/helpers/mcp.d.ts +5 -0
  85. package/dist/types/ssh/ssh-executor.d.ts +3 -1
  86. package/dist/types/system-prompt.d.ts +5 -2
  87. package/dist/types/task/executor.d.ts +17 -3
  88. package/dist/types/task/isolation-dir.d.ts +26 -0
  89. package/dist/types/task/role-body.d.ts +11 -0
  90. package/dist/types/task/token-log-mode.test.d.ts +1 -0
  91. package/dist/types/tools/ask.d.ts +77 -254
  92. package/dist/types/tools/ast-edit-write-path.d.ts +23 -0
  93. package/dist/types/tools/atomic-file-write.d.ts +74 -0
  94. package/dist/types/tools/auto-generated-guard.d.ts +5 -2
  95. package/dist/types/tools/bash-allowed-prefixes.d.ts +16 -0
  96. package/dist/types/tools/bash-interactive.d.ts +2 -0
  97. package/dist/types/tools/bash-skill-urls.d.ts +5 -1
  98. package/dist/types/tools/bash.d.ts +1 -0
  99. package/dist/types/tools/browser/cdp-url.d.ts +2 -0
  100. package/dist/types/tools/browser/tab-worker.d.ts +2 -0
  101. package/dist/types/tools/debug.d.ts +2 -2
  102. package/dist/types/tools/explicit-artifact.d.ts +8 -0
  103. package/dist/types/tools/fetch.d.ts +7 -4
  104. package/dist/types/tools/github-side-effect.d.ts +22 -0
  105. package/dist/types/tools/index.d.ts +3 -0
  106. package/dist/types/tools/monitor-mutation.d.ts +9 -0
  107. package/dist/types/tools/recipe/index.d.ts +2 -0
  108. package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
  109. package/dist/types/tools/restricted-cwd.d.ts +1 -0
  110. package/dist/types/tools/reverse-engineer.d.ts +81 -0
  111. package/dist/types/tools/search-tool-bm25.d.ts +2 -0
  112. package/dist/types/tools/tmux-self-injection-guard.d.ts +17 -0
  113. package/dist/types/tools/untrusted-content.d.ts +12 -0
  114. package/dist/types/utils/file-mentions.d.ts +5 -0
  115. package/dist/types/utils/open.d.ts +0 -1
  116. package/dist/types/utils/shell-snapshot.d.ts +2 -0
  117. package/dist/types/utils/title-generator.d.ts +12 -2
  118. package/dist/types/utils/tools-checksum.d.ts +7 -0
  119. package/dist/types/utils/xml-escape.d.ts +2 -0
  120. package/dist/types/web/scrapers/types.d.ts +8 -1
  121. package/dist/types/web/search/providers/codex.d.ts +6 -7
  122. package/dist/types/web/search/providers/insane.d.ts +7 -1
  123. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  124. package/dist/types/web/search/providers/searxng.d.ts +7 -0
  125. package/dist/types/web/search/providers/xai.d.ts +2 -0
  126. package/package.json +7 -7
  127. package/scripts/generate-sdk-operation-inventory.ts +4 -0
  128. package/src/async/job-manager.ts +23 -9
  129. package/src/async/result-formatting.ts +40 -0
  130. package/src/capability/fs.ts +78 -11
  131. package/src/capability/mcp.ts +2 -0
  132. package/src/cli/append-system-prompt.ts +12 -0
  133. package/src/cli/auth-broker-cli.ts +22 -12
  134. package/src/cli/config-cli.ts +8 -18
  135. package/src/cli/migrate-cli.ts +7 -5
  136. package/src/cli/ssh-cli.ts +6 -3
  137. package/src/cli/stats-cli.ts +9 -4
  138. package/src/cli/update-cli.ts +42 -0
  139. package/src/cli/web-search-cli.ts +9 -3
  140. package/src/cli.ts +5 -9
  141. package/src/commands/commit.ts +2 -2
  142. package/src/commands/contribution-prep.ts +1 -3
  143. package/src/commands/harness.ts +25 -15
  144. package/src/commands/launch.ts +1 -1
  145. package/src/commands/migrate.ts +3 -3
  146. package/src/commands/sdk.ts +115 -14
  147. package/src/commands/ultragoal.ts +14 -8
  148. package/src/commit/agentic/agent.ts +6 -6
  149. package/src/commit/analysis/conventional.ts +14 -5
  150. package/src/commit/changelog/index.ts +39 -1
  151. package/src/commit/message.ts +10 -3
  152. package/src/config/config-file.ts +106 -3
  153. package/src/config/keybindings.ts +154 -7
  154. package/src/config/mcp-schema.json +4 -0
  155. package/src/config/model-registry.ts +10 -2
  156. package/src/config/settings-schema.ts +18 -0
  157. package/src/config/settings.ts +32 -4
  158. package/src/coordinator-mcp/policy.ts +14 -4
  159. package/src/coordinator-mcp/server.ts +44 -4
  160. package/src/coordinator-mcp/session-reaper.ts +9 -1
  161. package/src/cursor-delete-path.ts +10 -0
  162. package/src/cursor-mcp-name.ts +15 -0
  163. package/src/cursor.ts +13 -2
  164. package/src/dap/client.ts +9 -2
  165. package/src/dap/config.ts +33 -13
  166. package/src/dap/defaults.json +1 -1
  167. package/src/dap/session.ts +161 -36
  168. package/src/debug/crash-diagnostics.ts +89 -6
  169. package/src/debug/report-bundle-parent.ts +22 -0
  170. package/src/debug/report-bundle.ts +100 -3
  171. package/src/debug/system-info.ts +21 -4
  172. package/src/defaults/skc/extensions/grok-cli-vendor/src/shared/base-url.ts +21 -7
  173. package/src/defaults/skc/skills/deep-interview/SKILL.md +1 -1
  174. package/src/discovery/agents-md.ts +3 -2
  175. package/src/discovery/agents.ts +3 -2
  176. package/src/discovery/builtin.ts +21 -11
  177. package/src/discovery/claude.ts +5 -4
  178. package/src/discovery/cline.ts +2 -2
  179. package/src/discovery/codex.ts +6 -5
  180. package/src/discovery/cursor.ts +11 -2
  181. package/src/discovery/gemini.ts +4 -3
  182. package/src/discovery/github.ts +2 -2
  183. package/src/discovery/helpers.ts +51 -11
  184. package/src/discovery/mcp-json.ts +28 -12
  185. package/src/discovery/opencode.ts +2 -1
  186. package/src/discovery/ssh.ts +11 -6
  187. package/src/discovery/substitute-plugin-root.ts +3 -1
  188. package/src/discovery/vscode.ts +3 -3
  189. package/src/edit/apply-patch/index.ts +12 -1
  190. package/src/edit/file-read-cache.ts +24 -6
  191. package/src/edit/index.ts +90 -20
  192. package/src/edit/modes/patch.ts +215 -9
  193. package/src/edit/modes/replace.ts +141 -0
  194. package/src/eval/js/context-manager.ts +29 -3
  195. package/src/eval/js/worker-entry.ts +51 -18
  196. package/src/eval/py/runner.py +144 -5
  197. package/src/eval/py/runtime.ts +44 -4
  198. package/src/eval/py/tool-bridge.ts +4 -0
  199. package/src/exa/mcp-client.ts +53 -11
  200. package/src/exec/bash-executor.ts +87 -4
  201. package/src/exec/non-interactive-env.ts +0 -1
  202. package/src/export/html/css-color.ts +9 -0
  203. package/src/export/html/html-export-destination.ts +16 -0
  204. package/src/export/html/index.ts +102 -8
  205. package/src/export/html/template.generated.ts +1 -1
  206. package/src/extensibility/custom-tools/loader.ts +13 -3
  207. package/src/extensibility/custom-tools/types.ts +3 -1
  208. package/src/extensibility/custom-tools/wrapper.ts +3 -1
  209. package/src/extensibility/plugins/manager.ts +3 -2
  210. package/src/extensibility/plugins/marketplace/cache.ts +15 -0
  211. package/src/extensibility/plugins/marketplace/fetcher.ts +2 -2
  212. package/src/extensibility/plugins/marketplace/manager.ts +5 -3
  213. package/src/extensibility/plugins/plugin-link-path.ts +12 -0
  214. package/src/extensibility/skc-plugins/mcp-policy.ts +2 -1
  215. package/src/goals/runtime.ts +30 -8
  216. package/src/harness-control-plane/finalize.ts +10 -0
  217. package/src/harness-control-plane/operate.ts +12 -4
  218. package/src/harness-control-plane/owner.ts +8 -1
  219. package/src/harness-control-plane/receipt-spool.ts +105 -28
  220. package/src/harness-control-plane/storage.ts +124 -6
  221. package/src/hashline/execute.ts +3 -3
  222. package/src/hashline/recovery.ts +85 -2
  223. package/src/hindsight/config.ts +9 -3
  224. package/src/hindsight/content.ts +116 -16
  225. package/src/hindsight/mental-models.ts +22 -10
  226. package/src/hindsight/state.ts +7 -4
  227. package/src/hooks/native-skill-hook.ts +17 -12
  228. package/src/i18n/messages/de.settings.ts +3 -0
  229. package/src/i18n/messages/es.settings.ts +3 -0
  230. package/src/i18n/messages/fr.settings.ts +3 -0
  231. package/src/i18n/messages/ja.settings.ts +3 -0
  232. package/src/i18n/messages/ko.settings.ts +3 -0
  233. package/src/i18n/messages/zh.settings.ts +3 -0
  234. package/src/internal-urls/artifact-protocol.ts +3 -1
  235. package/src/internal-urls/docs-index.generated.ts +10 -10
  236. package/src/internal-urls/local-protocol.ts +167 -8
  237. package/src/internal-urls/skill-path.ts +18 -0
  238. package/src/internal-urls/skill-protocol.ts +2 -0
  239. package/src/internal-urls/types.ts +2 -0
  240. package/src/lsp/client.ts +2 -1
  241. package/src/lsp/clients/biome-client.ts +2 -0
  242. package/src/lsp/clients/swiftlint-client.ts +2 -0
  243. package/src/lsp/config.ts +18 -62
  244. package/src/lsp/edits.ts +6 -0
  245. package/src/lsp/index.ts +29 -0
  246. package/src/lsp/workspace-path.ts +75 -0
  247. package/src/main.ts +33 -11
  248. package/src/memories/index.ts +141 -9
  249. package/src/migrate/action-planner.ts +57 -0
  250. package/src/migrate/adapters/claude-code.ts +23 -4
  251. package/src/migrate/adapters/codex.ts +22 -4
  252. package/src/migrate/adapters/index.ts +22 -4
  253. package/src/migrate/adapters/opencode.ts +6 -1
  254. package/src/migrate/executor.ts +84 -7
  255. package/src/migrate/report.ts +19 -2
  256. package/src/migrate/types.ts +14 -4
  257. package/src/modes/DESIGN.md +5 -0
  258. package/src/modes/acp/acp-agent.ts +35 -2
  259. package/src/modes/acp/permission-mode.ts +18 -1
  260. package/src/modes/components/custom-editor.ts +14 -0
  261. package/src/modes/components/extensions/extension-dashboard.ts +2 -2
  262. package/src/modes/components/extensions/inspector-panel.ts +9 -5
  263. package/src/modes/components/extensions/state-manager.ts +15 -5
  264. package/src/modes/components/model-selector.ts +144 -94
  265. package/src/modes/components/welcome.ts +3 -2
  266. package/src/modes/controllers/command-controller.ts +300 -9
  267. package/src/modes/controllers/event-controller.ts +1 -1
  268. package/src/modes/controllers/extension-ui-controller.ts +32 -19
  269. package/src/modes/controllers/input-controller.ts +62 -26
  270. package/src/modes/controllers/plan-mode-controller.ts +17 -7
  271. package/src/modes/controllers/runtime-mcp-command-controller.ts +25 -20
  272. package/src/modes/controllers/ssh-command-controller.ts +3 -1
  273. package/src/modes/interactive-mode.ts +10 -0
  274. package/src/modes/utils/macos-option-forwarding.ts +80 -0
  275. package/src/prompts/system/irc-incoming.md +3 -1
  276. package/src/prompts/system/project-prompt.md +19 -0
  277. package/src/prompts/system/system-prompt.md +3 -0
  278. package/src/prompts/tools/ask.md +2 -0
  279. package/src/prompts/tools/debug.md +1 -1
  280. package/src/prompts/tools/monitor.md +7 -5
  281. package/src/prompts/tools/reverse-engineer.md +29 -0
  282. package/src/runtime-credential-selector.ts +2 -2
  283. package/src/runtime-mcp/config-writer.ts +10 -6
  284. package/src/runtime-mcp/config.ts +1 -0
  285. package/src/runtime-mcp/content-limits.ts +7 -0
  286. package/src/runtime-mcp/json-rpc.ts +2 -1
  287. package/src/runtime-mcp/manager.ts +57 -9
  288. package/src/runtime-mcp/mcp-redirect.ts +73 -0
  289. package/src/runtime-mcp/oauth-flow.ts +43 -5
  290. package/src/runtime-mcp/oauth-public-url.ts +8 -0
  291. package/src/runtime-mcp/plugin-mcp-name-filter.ts +62 -0
  292. package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
  293. package/src/runtime-mcp/project-host-values.ts +50 -0
  294. package/src/runtime-mcp/render.ts +16 -1
  295. package/src/runtime-mcp/smithery-registry.ts +22 -3
  296. package/src/runtime-mcp/tool-bridge.ts +194 -21
  297. package/src/runtime-mcp/transports/http.ts +4 -3
  298. package/src/runtime-mcp/transports/stdio.ts +2 -1
  299. package/src/runtime-mcp/types.ts +6 -0
  300. package/src/sdk/broker/broker.ts +11 -2
  301. package/src/sdk/broker/ensure.ts +131 -10
  302. package/src/sdk/broker/lifecycle-ledger.ts +18 -3
  303. package/src/sdk/broker/lifecycle.ts +21 -19
  304. package/src/sdk/broker/runtime.ts +1 -1
  305. package/src/sdk/bus/chat-daemon-cli.ts +38 -1
  306. package/src/sdk/bus/chat-daemon-control.ts +5 -3
  307. package/src/sdk/bus/index.ts +5 -3
  308. package/src/sdk/bus/lifecycle-control-runtime.ts +9 -2
  309. package/src/sdk/bus/session-control.ts +2 -0
  310. package/src/sdk/bus/slack-daemon.ts +8 -1
  311. package/src/sdk/bus/slack-live-provider.ts +3 -1
  312. package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
  313. package/src/sdk/bus/telegram-daemon-control.ts +17 -12
  314. package/src/sdk/bus/telegram-daemon.ts +41 -1
  315. package/src/sdk/host/events.ts +67 -4
  316. package/src/sdk/mcp/server.ts +16 -3
  317. package/src/sdk/protocol/operation-inventory.generated.json +22 -0
  318. package/src/sdk/session.ts +18 -25
  319. package/src/secrets/obfuscator.ts +92 -12
  320. package/src/session/agent-session.ts +395 -79
  321. package/src/session/artifacts.ts +3 -1
  322. package/src/session/history-storage.ts +172 -8
  323. package/src/session/internal/managed-session-scope.ts +130 -52
  324. package/src/session/messages.ts +47 -6
  325. package/src/session/session-manager.ts +170 -10
  326. package/src/session/session-storage.ts +31 -1
  327. package/src/session/streaming-output.ts +263 -4
  328. package/src/session-import/redact.ts +76 -3
  329. package/src/setup/hermes-setup.ts +4 -1
  330. package/src/skc-runtime/gc-runtime.ts +26 -4
  331. package/src/skc-runtime/launch-tmux.ts +21 -11
  332. package/src/skc-runtime/launch-worktree.ts +42 -3
  333. package/src/skc-runtime/managed-owner-admission.ts +46 -2
  334. package/src/skc-runtime/psmux-detect.ts +29 -5
  335. package/src/skc-runtime/ralplan-runtime.ts +14 -1
  336. package/src/skc-runtime/session-resolution.ts +38 -6
  337. package/src/skc-runtime/sidecar-bootstrap-env.ts +19 -0
  338. package/src/skc-runtime/state-writer.ts +134 -16
  339. package/src/skc-runtime/tmux-sessions.ts +85 -4
  340. package/src/skc-runtime/ultragoal-change-set.ts +18 -2
  341. package/src/skc-runtime/ultragoal-guard.ts +9 -1
  342. package/src/skc-runtime/ultragoal-runtime.ts +26 -9
  343. package/src/skill-state/active-state.ts +13 -0
  344. package/src/skill-state/workflow-mutation-guard.ts +3297 -180
  345. package/src/slash-commands/builtin-registry.ts +14 -8
  346. package/src/slash-commands/helpers/mcp.ts +20 -7
  347. package/src/ssh/ssh-executor.ts +3 -1
  348. package/src/stt/recorder.ts +26 -9
  349. package/src/system-prompt.ts +65 -16
  350. package/src/task/commands.ts +3 -1
  351. package/src/task/executor.ts +52 -7
  352. package/src/task/index.ts +28 -0
  353. package/src/task/isolation-dir.ts +143 -0
  354. package/src/task/role-body.ts +84 -0
  355. package/src/task/token-log-mode.test.ts +162 -0
  356. package/src/task/token-log.ts +91 -2
  357. package/src/task/worktree.ts +16 -7
  358. package/src/tools/archive-reader.ts +653 -31
  359. package/src/tools/ask.ts +86 -14
  360. package/src/tools/ast-edit-write-path.ts +133 -0
  361. package/src/tools/ast-edit.ts +27 -1
  362. package/src/tools/ast-grep.ts +7 -2
  363. package/src/tools/atomic-file-write.ts +625 -0
  364. package/src/tools/auto-generated-guard.ts +28 -8
  365. package/src/tools/bash-allowed-prefixes.ts +225 -6
  366. package/src/tools/bash-interactive.ts +12 -0
  367. package/src/tools/bash-skill-urls.ts +113 -7
  368. package/src/tools/bash.ts +152 -20
  369. package/src/tools/browser/cdp-url.ts +18 -0
  370. package/src/tools/browser/tab-worker.ts +49 -14
  371. package/src/tools/browser.ts +25 -8
  372. package/src/tools/cron.ts +10 -1
  373. package/src/tools/debug.ts +16 -8
  374. package/src/tools/eval.ts +71 -34
  375. package/src/tools/explicit-artifact.ts +89 -0
  376. package/src/tools/fetch.ts +26 -17
  377. package/src/tools/gh.ts +40 -12
  378. package/src/tools/github-side-effect.ts +112 -0
  379. package/src/tools/image-gen.ts +24 -10
  380. package/src/tools/index.ts +6 -0
  381. package/src/tools/monitor-mutation.ts +27 -0
  382. package/src/tools/monitor.ts +28 -1
  383. package/src/tools/output-meta.ts +74 -5
  384. package/src/tools/read.ts +24 -36
  385. package/src/tools/recipe/index.ts +12 -0
  386. package/src/tools/recipe/recipe-guard.ts +19 -0
  387. package/src/tools/recipe/runner.ts +23 -12
  388. package/src/tools/render-utils.ts +2 -2
  389. package/src/tools/restricted-cwd.ts +10 -0
  390. package/src/tools/reverse-engineer.ts +497 -0
  391. package/src/tools/search-tool-bm25.ts +14 -3
  392. package/src/tools/search.ts +3 -2
  393. package/src/tools/ssh.ts +235 -8
  394. package/src/tools/subagent-render.ts +43 -7
  395. package/src/tools/subagent.ts +7 -3
  396. package/src/tools/tmux-self-injection-guard.ts +3538 -0
  397. package/src/tools/todo-write.ts +41 -3
  398. package/src/tools/untrusted-content.ts +23 -0
  399. package/src/tools/vim.ts +2 -2
  400. package/src/tools/write.ts +37 -4
  401. package/src/tui/tree-list.ts +15 -1
  402. package/src/utils/commit-message-generator.ts +9 -2
  403. package/src/utils/external-editor.ts +21 -7
  404. package/src/utils/file-mentions.ts +75 -7
  405. package/src/utils/git.ts +38 -7
  406. package/src/utils/open.ts +73 -4
  407. package/src/utils/shell-snapshot.ts +9 -1
  408. package/src/utils/title-generator.ts +61 -16
  409. package/src/utils/tools-checksum.ts +34 -0
  410. package/src/utils/tools-manager.ts +24 -6
  411. package/src/utils/xml-escape.ts +14 -0
  412. package/src/web/insane/url-guard.ts +2 -1
  413. package/src/web/scrapers/types.ts +8 -0
  414. package/src/web/scrapers/youtube.ts +3 -2
  415. package/src/web/search/index.ts +4 -3
  416. package/src/web/search/providers/anthropic.ts +4 -4
  417. package/src/web/search/providers/codex.ts +31 -34
  418. package/src/web/search/providers/insane.ts +145 -28
  419. package/src/web/search/providers/kimi.ts +15 -5
  420. package/src/web/search/providers/searxng.ts +47 -4
  421. package/src/web/search/providers/xai.ts +7 -2
  422. package/dist/types/cli/shell-cli.d.ts +0 -8
  423. package/dist/types/commands/shell.d.ts +0 -21
  424. package/src/cli/shell-cli.ts +0 -176
  425. package/src/commands/shell.ts +0 -29
@@ -4,38 +4,104 @@ import * as path from "node:path";
4
4
  const contentCache = new Map<string, string | null>();
5
5
  const dirCache = new Map<string, fs.Dirent[]>();
6
6
 
7
+ /** Authority a discovery read runs under. */
8
+ export type ReadScope = "project" | "user";
9
+
10
+ export interface ReadFileOptions {
11
+ readonly scope?: ReadScope;
12
+ /** Skip the shared lexical cache for this operation. */
13
+ readonly bypassCache?: boolean;
14
+ /**
15
+ * Physical root a target lexically inside it must stay inside after
16
+ * realpath, so a repository symlink cannot be read as its external target.
17
+ */
18
+ readonly containmentRoot?: string;
19
+ }
20
+
7
21
  function resolvePath(filePath: string): string {
8
22
  return path.resolve(filePath);
9
23
  }
10
24
 
11
- export async function readFile(filePath: string): Promise<string | null> {
25
+ function isWithinOrEqual(root: string, candidate: string): boolean {
26
+ const relative = path.relative(root, candidate);
27
+ return relative === "" || (!relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative));
28
+ }
29
+
30
+ /**
31
+ * A lexical path outside the boundary keeps the historical read. A path inside
32
+ * the boundary must still be inside after realpath; otherwise it is unreadable.
33
+ */
34
+ async function containedReadPath(abs: string, options?: ReadFileOptions): Promise<string | null> {
35
+ const root = options?.containmentRoot;
36
+ if (!root) return abs;
37
+ const boundary = path.resolve(root);
38
+ if (!isWithinOrEqual(boundary, abs)) return abs;
39
+ try {
40
+ const [boundaryReal, targetReal] = await Promise.all([fs.promises.realpath(boundary), fs.promises.realpath(abs)]);
41
+ return isWithinOrEqual(boundaryReal, targetReal) ? targetReal : null;
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * The real target a contained read refused: the path is lexically inside the
49
+ * containment root but resolves outside it. Null when the read was not refused
50
+ * for containment (no root, outside lexically, inside after realpath, missing).
51
+ */
52
+ export async function containmentRefusalTarget(filePath: string, options?: ReadFileOptions): Promise<string | null> {
53
+ const root = options?.containmentRoot;
54
+ if (!root) return null;
55
+ const abs = resolvePath(filePath);
56
+ const boundary = path.resolve(root);
57
+ if (!isWithinOrEqual(boundary, abs)) return null;
58
+ try {
59
+ const [boundaryReal, targetReal] = await Promise.all([fs.promises.realpath(boundary), fs.promises.realpath(abs)]);
60
+ return isWithinOrEqual(boundaryReal, targetReal) ? null : targetReal;
61
+ } catch {
62
+ return null;
63
+ }
64
+ }
65
+
66
+ export async function readFile(filePath: string, options?: ReadFileOptions): Promise<string | null> {
12
67
  const abs = resolvePath(filePath);
13
- if (contentCache.has(abs)) {
68
+ // A contained read must not share the lexical cache with a different boundary.
69
+ const useCache = !options?.bypassCache && !options?.containmentRoot;
70
+ if (useCache && contentCache.has(abs)) {
14
71
  return contentCache.get(abs) ?? null;
15
72
  }
16
73
 
74
+ const readable = await containedReadPath(abs, options);
75
+ if (readable === null) {
76
+ if (useCache) contentCache.set(abs, null);
77
+ return null;
78
+ }
17
79
  try {
18
- const content = await Bun.file(abs).text();
19
- contentCache.set(abs, content);
80
+ const content = await Bun.file(readable).text();
81
+ if (useCache) contentCache.set(abs, content);
20
82
  return content;
21
83
  } catch {
22
- contentCache.set(abs, null);
84
+ if (useCache) contentCache.set(abs, null);
23
85
  return null;
24
86
  }
25
87
  }
26
88
 
27
- export async function readDirEntries(dirPath: string): Promise<fs.Dirent[]> {
89
+ export async function readDirEntries(
90
+ dirPath: string,
91
+ options?: Pick<ReadFileOptions, "bypassCache">,
92
+ ): Promise<fs.Dirent[]> {
28
93
  const abs = resolvePath(dirPath);
29
- if (dirCache.has(abs)) {
94
+ const useCache = !options?.bypassCache;
95
+ if (useCache && dirCache.has(abs)) {
30
96
  return dirCache.get(abs) ?? [];
31
97
  }
32
98
 
33
99
  try {
34
100
  const entries = await fs.promises.readdir(abs, { withFileTypes: true });
35
- dirCache.set(abs, entries);
101
+ if (useCache) dirCache.set(abs, entries);
36
102
  return entries;
37
103
  } catch {
38
- dirCache.set(abs, []);
104
+ if (useCache) dirCache.set(abs, []);
39
105
  return [];
40
106
  }
41
107
  }
@@ -69,12 +135,13 @@ export async function walkUp(
69
135
  /**
70
136
  * Walk up from startDir looking for a `.git` entry (file or directory).
71
137
  * Returns the directory containing `.git` (the repo root), or null if not in a git repo.
72
- * Results are based on the cached readDirEntries, so repeated calls are cheap.
138
+ * Reads bypass the directory cache: the repository root is the project read
139
+ * boundary, so a `.git` created after an earlier discovery must narrow it.
73
140
  */
74
141
  export async function findRepoRoot(startDir: string): Promise<string | null> {
75
142
  let current = resolvePath(startDir);
76
143
  while (true) {
77
- const entries = await readDirEntries(current);
144
+ const entries = await readDirEntries(current, { bypassCache: true });
78
145
  if (entries.some(e => e.name === ".git")) {
79
146
  return current;
80
147
  }
@@ -33,6 +33,8 @@ export interface MCPServer {
33
33
  url?: string;
34
34
  /** HTTP headers (for HTTP transport) */
35
35
  headers?: Record<string, string>;
36
+ /** Persisted public-network requirement for an HTTP MCP endpoint. */
37
+ publicNetwork?: boolean;
36
38
  /** Authentication configuration */
37
39
  auth?: {
38
40
  type: "oauth" | "apikey";
@@ -0,0 +1,12 @@
1
+ export interface AppendSystemPromptCandidate {
2
+ level: "user" | "project";
3
+ path: string;
4
+ }
5
+
6
+ /** First user file. A repository copy is untrusted project text and is never selected. */
7
+ export function selectAppendSystemPromptFile(candidates: readonly AppendSystemPromptCandidate[]): string | undefined {
8
+ for (const candidate of candidates) {
9
+ if (candidate.level === "user") return candidate.path;
10
+ }
11
+ return undefined;
12
+ }
@@ -23,6 +23,7 @@ import {
23
23
  AuthStorage,
24
24
  type CredentialDisabledEvent,
25
25
  DEFAULT_AUTH_BROKER_BIND,
26
+ formatOAuthIdentityLabel,
26
27
  getEnvApiKey,
27
28
  getOAuthProviders,
28
29
  listProvidersWithEnvKey,
@@ -397,7 +398,7 @@ async function runImport(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
397
398
  if (!target) {
398
399
  throw new Error("Usage: skc auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]");
399
400
  }
400
- const resolvedTarget = path.resolve(target.startsWith("~") ? target.replace(/^~/, os.homedir()) : target);
401
+ const resolvedTarget = path.resolve(target.startsWith("~") ? target.replace(/^~/, () => os.homedir()) : target);
401
402
  const { entries, skipped } = await loadImportPlan(resolvedTarget, flags.provider, flags.includeDisabled === true);
402
403
 
403
404
  if (flags.json) {
@@ -490,19 +491,21 @@ interface MigrateSkip {
490
491
 
491
492
  function credentialIdentity(provider: string, credential: AuthCredential): string {
492
493
  if (credential.type === "api_key") return "(api key)";
493
- return credential.email ?? credential.accountId ?? credential.projectId ?? `<${provider} oauth>`;
494
+ return formatOAuthIdentityLabel(credential) ?? `<${provider} oauth>`;
494
495
  }
495
496
 
496
497
  /**
497
498
  * Build the set of "identities already on the broker" so re-runs are idempotent.
498
- * For OAuth, identity = email|accountId|projectId. For api_key, we collapse
499
- * to a single marker per provider (broker has no concept of "multiple api keys
500
- * per provider with different identities"; upsert would coalesce them).
499
+ * For OAuth, identity = email|accountId|projectId, scoped to the organization
500
+ * when the credential carries one (one account can sign in to several
501
+ * organizations). For api_key, we collapse to a single marker per provider
502
+ * (broker has no concept of "multiple api keys per provider with different
503
+ * identities"; upsert would coalesce them).
501
504
  */
502
505
  function indexBrokerSnapshot(snapshot: {
503
506
  credentials: Array<{
504
507
  provider: string;
505
- credential: { type: string; email?: string; accountId?: string; projectId?: string };
508
+ credential: { type: string; email?: string; accountId?: string; projectId?: string; organizationId?: string };
506
509
  }>;
507
510
  }): Map<string, Set<string>> {
508
511
  const out = new Map<string, Set<string>>();
@@ -511,22 +514,29 @@ function indexBrokerSnapshot(snapshot: {
511
514
  if (entry.credential.type === "api_key") {
512
515
  ids.add("@api_key");
513
516
  } else {
514
- if (entry.credential.email) ids.add(`email:${entry.credential.email}`);
515
- if (entry.credential.accountId) ids.add(`accountId:${entry.credential.accountId}`);
516
- if (entry.credential.projectId) ids.add(`projectId:${entry.credential.projectId}`);
517
+ const org = organizationSuffix(entry.credential.organizationId);
518
+ if (entry.credential.email) ids.add(`email:${entry.credential.email}${org}`);
519
+ if (entry.credential.accountId) ids.add(`accountId:${entry.credential.accountId}${org}`);
520
+ if (entry.credential.projectId) ids.add(`projectId:${entry.credential.projectId}${org}`);
517
521
  }
518
522
  out.set(entry.provider, ids);
519
523
  }
520
524
  return out;
521
525
  }
522
526
 
527
+ function organizationSuffix(organizationId: string | undefined): string {
528
+ const trimmed = organizationId?.trim();
529
+ return trimmed ? `|org:${trimmed}` : "";
530
+ }
531
+
523
532
  function brokerAlreadyHas(existing: Map<string, Set<string>>, provider: string, credential: AuthCredential): boolean {
524
533
  const ids = existing.get(provider);
525
534
  if (!ids) return false;
526
535
  if (credential.type === "api_key") return ids.has("@api_key");
527
- if (credential.email && ids.has(`email:${credential.email}`)) return true;
528
- if (credential.accountId && ids.has(`accountId:${credential.accountId}`)) return true;
529
- if (credential.projectId && ids.has(`projectId:${credential.projectId}`)) return true;
536
+ const org = organizationSuffix(credential.organizationId);
537
+ if (credential.email && ids.has(`email:${credential.email}${org}`)) return true;
538
+ if (credential.accountId && ids.has(`accountId:${credential.accountId}${org}`)) return true;
539
+ if (credential.projectId && ids.has(`projectId:${credential.projectId}${org}`)) return true;
530
540
  return false;
531
541
  }
532
542
 
@@ -53,29 +53,19 @@ type CliSettingDef = {
53
53
  const ALL_SETTING_PATHS = Object.keys(SETTINGS_SCHEMA) as SettingPath[];
54
54
  const REDACTED_SECRET_VALUE = "<redacted>";
55
55
  const SECRET_SETTING_WORDS = new Set(["token", "secret", "password", "passwd", "pwd", "credential", "credentials"]);
56
- const SECRET_SETTING_COMPOUND_PREFIXES = [
57
- "api",
58
- "auth",
59
- "access",
60
- "refresh",
61
- "bearer",
62
- "session",
63
- "client",
64
- "broker",
65
- "bot",
66
- "basic",
67
- ];
68
- const SECRET_SETTING_COMPOUND_SUFFIXES = ["token", "secret", "password", "credential"];
56
+ /**
57
+ * camelCase segments (`appToken`, `basicPassword`) do not split on `-`/`_`, so any segment whose
58
+ * normalized form ends in a secret word is secret. Plural budget names (`maxTokens`) and words that
59
+ * merely contain one (`showTokenUsage`) stay visible.
60
+ */
61
+ const SECRET_SETTING_SUFFIX = /(?:token|secret|password|passwd|pwd|credentials?)$/;
69
62
 
70
63
  function isSecretSettingSegment(segment: string): boolean {
71
64
  const normalized = segment.toLowerCase();
72
- if (SECRET_SETTING_WORDS.has(normalized)) return true;
65
+ if (SECRET_SETTING_SUFFIX.test(normalized)) return true;
73
66
  if (/api[-_]?key/i.test(segment)) return true;
74
67
  const words = normalized.split(/[-_]/).filter(Boolean);
75
- if (words.some(word => SECRET_SETTING_WORDS.has(word))) return true;
76
- return SECRET_SETTING_COMPOUND_PREFIXES.some(prefix =>
77
- SECRET_SETTING_COMPOUND_SUFFIXES.some(suffix => normalized === `${prefix}${suffix}`),
78
- );
68
+ return words.some(word => SECRET_SETTING_WORDS.has(word));
79
69
  }
80
70
 
81
71
  function isSecretSettingPath(path: string): boolean {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `skc migrate` — import MCP servers and skills from other coding agents.
2
+ * `skc migrate` — import MCP servers, skills, and instruction files from other coding agents.
3
3
  */
4
4
  import * as os from "node:os";
5
5
  import * as path from "node:path";
@@ -53,8 +53,10 @@ export function resolveSources(from: string[]): MigrateSource[] {
53
53
 
54
54
  function resolveDestinations(project: boolean, cwd: string): MigrateDestinations {
55
55
  const scope = project ? "project" : "user";
56
- const skillsDir = project ? path.join(getProjectAgentDir(cwd), "skills") : path.join(getAgentDir(), "skills");
57
- return { mcpConfigPath: getMCPConfigPath(scope, cwd), skillsDir };
56
+ const agentDir = project ? getProjectAgentDir(cwd) : getAgentDir();
57
+ const skillsDir = path.join(agentDir, "skills");
58
+ const instructionsPath = path.join(agentDir, "AGENTS.md");
59
+ return { mcpConfigPath: getMCPConfigPath(scope, cwd), skillsDir, instructionsPath };
58
60
  }
59
61
 
60
62
  /** Run the migration and return the report (does not set process.exitCode). */
@@ -66,11 +68,11 @@ export async function runMigrate(args: MigrateCommandArgs): Promise<MigrateRepor
66
68
 
67
69
  const results: AdapterResult[] = [];
68
70
  for (const source of sources) {
69
- results.push(await getAdapter(source).collect({ homeDir }));
71
+ results.push(await getAdapter(source).collect({ homeDir, cwd, scope: args.project ? "project" : "user" }));
70
72
  }
71
73
 
72
74
  const { actions, warnings } = await planMigration({ results, destinations, force: args.force });
73
- const finalActions = args.dryRun ? actions : await executeActions(actions);
75
+ const finalActions = args.dryRun ? actions : await executeActions(actions, { project: args.project });
74
76
 
75
77
  return buildReport({
76
78
  actions: finalActions,
@@ -74,9 +74,12 @@ async function handleAdd(cmd: SSHCommandArgs): Promise<void> {
74
74
  return;
75
75
  }
76
76
 
77
- // Validate port if provided
77
+ // Validate port if provided. `Number.parseInt` accepts trailing garbage
78
+ // (parseInt("22oops") === 22, parseInt("2222.5") === 2222), so require
79
+ // the whole token to be digits before parsing.
80
+ let port: number | undefined;
78
81
  if (cmd.flags.port !== undefined) {
79
- const port = Number.parseInt(cmd.flags.port, 10);
82
+ port = /^\d+$/.test(cmd.flags.port) ? Number.parseInt(cmd.flags.port, 10) : Number.NaN;
80
83
  if (Number.isNaN(port) || port < 1 || port > 65535) {
81
84
  process.stdout.write(chalk.red("Error: Port must be an integer between 1 and 65535\n"));
82
85
  process.exitCode = 1;
@@ -86,7 +89,7 @@ async function handleAdd(cmd: SSHCommandArgs): Promise<void> {
86
89
 
87
90
  const hostConfig: SSHHostConfig = { host };
88
91
  if (cmd.flags.user) hostConfig.username = cmd.flags.user;
89
- if (cmd.flags.port) hostConfig.port = Number.parseInt(cmd.flags.port, 10);
92
+ if (port !== undefined) hostConfig.port = port;
90
93
  if (cmd.flags.key) hostConfig.keyPath = cmd.flags.key;
91
94
  if (cmd.flags.desc) hostConfig.description = cmd.flags.desc;
92
95
  if (cmd.flags.compat) hostConfig.compat = true;
@@ -4,7 +4,7 @@
4
4
  * Handles `skc stats` subcommand for viewing AI usage statistics.
5
5
  */
6
6
 
7
- import { APP_NAME, formatDuration, formatNumber, formatPercent } from "@sayknow-cli/utils";
7
+ import { APP_NAME, formatDuration, formatNumber, formatPercent, sanitizeDisplayLine } from "@sayknow-cli/utils";
8
8
  import chalk from "chalk";
9
9
  import { openPath } from "../utils/open";
10
10
 
@@ -131,7 +131,10 @@ export async function runStatsCommand(cmd: StatsCommandArgs): Promise<void> {
131
131
  const { processed, files } = await syncAllSessions({ onProgress: progress.onProgress });
132
132
  progress.finish();
133
133
  const total = await getTotalMessageCount();
134
- console.log(`Synced ${processed} new entries from ${files} files (${total} total)\n`);
134
+ const synced = `Synced ${processed} new entries from ${files} files (${total} total)\n`;
135
+ // `--json` stdout must be exactly the JSON document so it can be piped into a parser.
136
+ if (cmd.json) process.stderr.write(`${synced}\n`);
137
+ else console.log(synced);
135
138
 
136
139
  if (cmd.json) {
137
140
  const stats = await getDashboardStats();
@@ -191,7 +194,7 @@ async function printStatsSummary(): Promise<void> {
191
194
  console.log(chalk.bold("\nBy Model:"));
192
195
  for (const m of byModel.slice(0, 10)) {
193
196
  console.log(
194
- ` ${m.model}: ${formatNumber(m.totalRequests)} reqs, ${formatCost(m.totalCost)}, ${formatPercent(m.cacheRate)} cache`,
197
+ ` ${sanitizeDisplayLine(m.model)}: ${formatNumber(m.totalRequests)} reqs, ${formatCost(m.totalCost)}, ${formatPercent(m.cacheRate)} cache`,
195
198
  );
196
199
  }
197
200
  }
@@ -199,7 +202,9 @@ async function printStatsSummary(): Promise<void> {
199
202
  if (byFolder.length > 0) {
200
203
  console.log(chalk.bold("\nBy Folder:"));
201
204
  for (const f of byFolder.slice(0, 10)) {
202
- console.log(` ${f.folder}: ${formatNumber(f.totalRequests)} reqs, ${formatCost(f.totalCost)}`);
205
+ console.log(
206
+ ` ${sanitizeDisplayLine(f.folder)}: ${formatNumber(f.totalRequests)} reqs, ${formatCost(f.totalCost)}`,
207
+ );
203
208
  }
204
209
  }
205
210
 
@@ -166,6 +166,40 @@ function resolveNpmManagedTarget(
166
166
  return undefined;
167
167
  }
168
168
 
169
+ /**
170
+ * Detect a project-local package install: `<...>/node_modules/.bin/<name>` with
171
+ * or without an executable extension.
172
+ *
173
+ * On Windows a dependency-installed CLI is a real `.exe` copied into
174
+ * `node_modules/.bin`, so the `.cmd`/`.ps1` shim rules never match it and
175
+ * `skc update` used to treat it as a standalone binary and try to replace it.
176
+ * That file belongs to the package manager and to the project's dependency
177
+ * tree: replacing it breaks the lockfile contract and, on Windows, fails on the
178
+ * file's ACL. The caller must redirect to the package manager instead of
179
+ * downloading a replacement.
180
+ */
181
+ function resolveProjectLocalPackageInstall(
182
+ ompPath: string,
183
+ platform: PathPlatform = process.platform,
184
+ ): { packageRoot: string } | undefined {
185
+ const pathApi = pathApiForPlatform(platform);
186
+ const resolved = pathApi.normalize(ompPath);
187
+ const binDir = pathApi.dirname(resolved);
188
+ if (pathApi.basename(binDir).toLowerCase() !== ".bin") return undefined;
189
+ if (pathApi.basename(pathApi.dirname(binDir)).toLowerCase() !== "node_modules") return undefined;
190
+ const extension = pathApi.extname(resolved).toLowerCase();
191
+ const basename = extension ? pathApi.basename(resolved, extension) : pathApi.basename(resolved);
192
+ if (basename.toLowerCase() !== APP_NAME.toLowerCase()) return undefined;
193
+ return { packageRoot: pathApi.dirname(binDir) };
194
+ }
195
+
196
+ export function resolveProjectLocalPackageInstallForTest(
197
+ ompPath: string,
198
+ platform: PathPlatform,
199
+ ): { packageRoot: string } | undefined {
200
+ return resolveProjectLocalPackageInstall(ompPath, platform);
201
+ }
202
+
169
203
  function resolveUpdateMethod(ompPath: string, bunBinDir: string | undefined): "bun" | "npm" | "binary" {
170
204
  if (resolveNpmManagedTarget(ompPath)) return "npm";
171
205
  if (!bunBinDir) return "binary";
@@ -187,6 +221,14 @@ async function resolveUpdateTarget(): Promise<UpdateTarget> {
187
221
  const bunBinDir = await getBunGlobalBinDir();
188
222
  const ompPath = resolveSkcPath();
189
223
 
224
+ if (ompPath && resolveProjectLocalPackageInstall(ompPath)) {
225
+ throw new Error(
226
+ formatUnsupportedTargetMessage(
227
+ `${APP_NAME} at ${ompPath} is installed by a package manager in this project's node_modules; update the dependency instead of replacing that file`,
228
+ ),
229
+ );
230
+ }
231
+
190
232
  if (ompPath) {
191
233
  const npmTarget = resolveNpmManagedTarget(ompPath);
192
234
  if (npmTarget) return { method: "npm", packageName: npmTarget.packageName };
@@ -95,7 +95,10 @@ export function parseSearchArgs(args: string[]): SearchCommandArgs | undefined {
95
95
  result.recency = value() as SearchCommandArgs["recency"];
96
96
  consumeSeparateValue();
97
97
  } else if (arg === "--limit" || arg === "-l") {
98
- result.limit = Number.parseInt(value(), 10);
98
+ const raw = value();
99
+ // `Number.parseInt` accepts trailing garbage ("5x" -> 5); leave
100
+ // anything that is not plain digits as NaN so it is rejected below.
101
+ result.limit = /^\d+$/.test(raw) ? Number.parseInt(raw, 10) : Number.NaN;
99
102
  consumeSeparateValue();
100
103
  } else if (arg === "--xai-mode") {
101
104
  result.xaiSearchMode = value() as SearchCommandArgs["xaiSearchMode"];
@@ -164,8 +167,11 @@ export async function runSearchCommand(cmd: SearchCommandArgs): Promise<void> {
164
167
  process.exit(1);
165
168
  }
166
169
 
167
- if (cmd.limit !== undefined && Number.isNaN(cmd.limit)) {
168
- process.stderr.write(`${chalk.red("Error: --limit must be a number")}\n`);
170
+ // `Flags.integer` accepts `0` and negative values; providers forward them
171
+ // as `num_results` and several slice sources with them (`slice(0, -3)`
172
+ // silently drops the last three results).
173
+ if (cmd.limit !== undefined && (!Number.isSafeInteger(cmd.limit) || cmd.limit < 1)) {
174
+ process.stderr.write(`${chalk.red("Error: --limit must be a positive integer")}\n`);
169
175
  process.exit(1);
170
176
  }
171
177
 
package/src/cli.ts CHANGED
@@ -82,14 +82,10 @@ async function showHelp(config: CliConfig): Promise<void> {
82
82
  }
83
83
 
84
84
  async function installRuntimeGlobals(): Promise<void> {
85
- const { installH2Fetch } = await import("@sayknow-cli/ai/utils/h2-fetch");
86
- // Activate HTTP/2 for all `fetch()` calls (provider streams, OAuth, model
87
- // discovery, web tools). Bun's HTTP/2 client is gated on a startup flag we
88
- // can't toggle from JS, so we patch globalThis.fetch to pass
89
- // `protocol: "http2"` per request, with transparent HTTP/1.1 fallback on
90
- // `HTTP2Unsupported`. See @sayknow-cli/ai/utils/h2-fetch for details.
91
- installH2Fetch();
92
-
85
+ // fetch() deliberately stays on HTTP/1.1. Bun's HTTP/2 client (per-request
86
+ // `protocol: "http2"`) wedges a pooled connection while uploading large
87
+ // request bodies (~300KB): every later request on it waits forever for
88
+ // response headers. Do not re-enable HTTP/2 without re-running that probe.
93
89
  const { warnIfMacOSNoFileLimitTooLow } = await import("./cli/nofile-limit");
94
90
  warnIfMacOSNoFileLimitTooLow();
95
91
 
@@ -265,7 +261,7 @@ export class RootHelpCommand extends Command {
265
261
  "api-key": Flags.string({ description: "API key (defaults to env vars)" }),
266
262
  credential: Flags.string({
267
263
  description:
268
- "Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, or provider/email:<addr>",
264
+ "Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, org:<organization id or name>, or provider/email:<addr>",
269
265
  }),
270
266
  "system-prompt": Flags.string({ description: "System prompt (default: coding assistant prompt)" }),
271
267
  "append-system-prompt": Flags.string({ description: "Append text or file contents to the system prompt" }),
@@ -32,8 +32,8 @@ export default class Commit extends Command {
32
32
  };
33
33
 
34
34
  await initTheme();
35
- // The agentic commit flow opens HTTP/2 keep-alive sockets to the model
36
- // provider (via `installH2Fetch`) and spins up an AgentSession with
35
+ // The agentic commit flow opens keep-alive sockets to the model
36
+ // provider and spins up an AgentSession with
37
37
  // background async-job + extension machinery. `session.dispose()` releases
38
38
  // what it can, but Bun's fetch keeps idle connections warm and a few
39
39
  // timers (Settings autosave, OAuth refresh) stay armed long enough to
@@ -9,12 +9,11 @@ export default class ContributionPrep extends Command {
9
9
  static strict = false;
10
10
 
11
11
  static flags = {
12
- "no-spawn": Flags.boolean({ description: "Only write artifacts; do not spawn a fresh SKC worker" }),
13
12
  "source-session-id": Flags.string({ description: "Source session id to record in the manifest" }),
14
13
  "artifact-root": Flags.string({ description: "Directory where contribute-pr artifacts are written" }),
15
14
  };
16
15
 
17
- static examples = ["skc contribute-pr", "skc contribute-pr --no-spawn"];
16
+ static examples = ["skc contribute-pr"];
18
17
 
19
18
  async run(): Promise<void> {
20
19
  const { flags } = await this.parse(ContributionPrep);
@@ -27,7 +26,6 @@ export default class ContributionPrep extends Command {
27
26
  messages: [],
28
27
  },
29
28
  {
30
- spawnWorker: !flags["no-spawn"],
31
29
  artifactRoot: flags["artifact-root"],
32
30
  },
33
31
  );
@@ -26,7 +26,11 @@ import {
26
26
  } from "../harness-control-plane/lifecycle-reconciliation";
27
27
  import { type ResolvedOwner, RuntimeOwner, resolveOwner, resolveOwnerLive } from "../harness-control-plane/owner";
28
28
  import { preserveDirtyWorktree } from "../harness-control-plane/preserve";
29
- import { RECEIPT_SPOOL_DIR_ENV } from "../harness-control-plane/receipt-spool";
29
+ import {
30
+ RECEIPT_SPOOL_DIR_ENV,
31
+ resolveReceiptSpoolDir,
32
+ trustedReceiptSpoolDir,
33
+ } from "../harness-control-plane/receipt-spool";
30
34
  import { buildReceipt, requiresVanishBeforeAction, type VanishEvidence } from "../harness-control-plane/receipts";
31
35
  import { createSdkSessionTransport, spawnNormalHarnessSession } from "../harness-control-plane/sdk-transport";
32
36
  import { classifyLeaseStatus, readLease } from "../harness-control-plane/session-lease";
@@ -1004,8 +1008,9 @@ export default class Harness extends Command {
1004
1008
  `${SKC_TMUX_OWNER_STATE_DIR_ENV}=${shellQuote(ownerStateDir)}`,
1005
1009
  `${SKC_TMUX_OWNER_SERVER_KEY_ENV}=${shellQuote(socketKey)}`,
1006
1010
  ];
1007
- if (process.env[RECEIPT_SPOOL_DIR_ENV])
1008
- envAssignments.push(`${RECEIPT_SPOOL_DIR_ENV}=${shellQuote(process.env[RECEIPT_SPOOL_DIR_ENV])}`);
1011
+ const trustedSpoolDir = resolveReceiptSpoolDir();
1012
+ if (trustedSpoolDir) envAssignments.push(`${RECEIPT_SPOOL_DIR_ENV}=${shellQuote(trustedSpoolDir)}`);
1013
+ else envAssignments.unshift(`-u ${RECEIPT_SPOOL_DIR_ENV}`);
1009
1014
  if (process.env.SKC_HARNESS_TEST_NODE_MODULES)
1010
1015
  envAssignments.push(`SKC_HARNESS_TEST_NODE_MODULES=${shellQuote(process.env.SKC_HARNESS_TEST_NODE_MODULES)}`);
1011
1016
  if (process.env.SKC_SDK_DISABLE)
@@ -1203,19 +1208,20 @@ export default class Harness extends Command {
1203
1208
  }
1204
1209
  const fallbackReason = tmux.reason;
1205
1210
  const cmd = this.#buildOwnerCommand(sessionId);
1211
+ const trustedSpoolDir = resolveReceiptSpoolDir();
1212
+ const childEnv: NodeJS.ProcessEnv = {
1213
+ ...process.env,
1214
+ SKC_HARNESS_STATE_ROOT: root,
1215
+ ...(process.env.SKC_HARNESS_TEST_NODE_MODULES
1216
+ ? { SKC_HARNESS_TEST_NODE_MODULES: process.env.SKC_HARNESS_TEST_NODE_MODULES }
1217
+ : {}),
1218
+ ...(process.env.SKC_SDK_DISABLE ? { SKC_SDK_DISABLE: process.env.SKC_SDK_DISABLE } : {}),
1219
+ };
1220
+ if (trustedSpoolDir) childEnv[RECEIPT_SPOOL_DIR_ENV] = trustedSpoolDir;
1221
+ else delete childEnv[RECEIPT_SPOOL_DIR_ENV];
1206
1222
  const child = Bun.spawn(cmd, {
1207
1223
  cwd,
1208
- env: {
1209
- ...process.env,
1210
- SKC_HARNESS_STATE_ROOT: root,
1211
- ...(process.env[RECEIPT_SPOOL_DIR_ENV]
1212
- ? { [RECEIPT_SPOOL_DIR_ENV]: process.env[RECEIPT_SPOOL_DIR_ENV] }
1213
- : {}),
1214
- ...(process.env.SKC_HARNESS_TEST_NODE_MODULES
1215
- ? { SKC_HARNESS_TEST_NODE_MODULES: process.env.SKC_HARNESS_TEST_NODE_MODULES }
1216
- : {}),
1217
- ...(process.env.SKC_SDK_DISABLE ? { SKC_SDK_DISABLE: process.env.SKC_SDK_DISABLE } : {}),
1218
- },
1224
+ env: childEnv,
1219
1225
  stdout: "ignore",
1220
1226
  stderr: "ignore",
1221
1227
  stdin: "ignore",
@@ -1374,7 +1380,11 @@ export default class Harness extends Command {
1374
1380
  if (!owner.live || !owner.socketPath) return false;
1375
1381
  const priorSpoolDir = input[RECEIPT_SPOOL_DIR_ENV];
1376
1382
  try {
1377
- if (process.env[RECEIPT_SPOOL_DIR_ENV]) input[RECEIPT_SPOOL_DIR_ENV] = process.env[RECEIPT_SPOOL_DIR_ENV];
1383
+ const fromEnv = resolveReceiptSpoolDir();
1384
+ const fromInput = trustedReceiptSpoolDir(typeof priorSpoolDir === "string" ? priorSpoolDir : undefined);
1385
+ const trustedSpoolDir = fromEnv ?? fromInput;
1386
+ if (trustedSpoolDir) input[RECEIPT_SPOOL_DIR_ENV] = trustedSpoolDir;
1387
+ else delete input[RECEIPT_SPOOL_DIR_ENV];
1378
1388
  const res = (await callEndpoint(owner.socketPath, { verb, input })) as { ok?: boolean };
1379
1389
  writeJson(res);
1380
1390
  if (res?.ok === false) process.exitCode = 1;
@@ -97,7 +97,7 @@ export default class Index extends Command {
97
97
  }),
98
98
  credential: Flags.string({
99
99
  description:
100
- "Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, or provider/email:<addr>",
100
+ "Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, org:<organization id or name>, or provider/email:<addr>",
101
101
  }),
102
102
  "system-prompt": Flags.string({
103
103
  description: "System prompt (default: coding assistant prompt)",
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Import MCP servers and skills from other coding agents into SKC.
2
+ * Import MCP servers, skills, and instructions from other coding agents into SKC.
3
3
  */
4
4
  import { Command, Flags } from "@sayknow-cli/utils/cli";
5
5
  import { type MigrateCommandArgs, runMigrateCommand } from "../cli/migrate-cli";
6
6
 
7
7
  export default class Migrate extends Command {
8
- static description = "Import MCP servers and skills from Claude Code, Codex, or OpenCode";
8
+ static description = "Import MCP servers and skills, plus Claude Code/Codex instructions";
9
9
 
10
10
  static examples = [
11
11
  "skc migrate --from claude-code",
@@ -25,7 +25,7 @@ export default class Migrate extends Command {
25
25
  default: false,
26
26
  }),
27
27
  force: Flags.boolean({
28
- description: "Overwrite existing skills/MCP servers instead of skipping them",
28
+ description: "Overwrite existing skills, MCP servers, or instruction files instead of skipping them",
29
29
  default: false,
30
30
  }),
31
31
  "dry-run": Flags.boolean({ description: "Preview the migration without writing anything", default: false }),