sneakoscope 7.1.1 → 7.3.0

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 (522) hide show
  1. package/README.md +3 -1
  2. package/config/architecture-budgets.v1.json +1 -8
  3. package/crates/sks-core/Cargo.lock +225 -1
  4. package/crates/sks-core/Cargo.toml +8 -1
  5. package/crates/sks-core/src/main.rs +7 -1
  6. package/crates/sks-core/src/search/files.rs +114 -0
  7. package/crates/sks-core/src/search/mod.rs +274 -0
  8. package/crates/sks-core/src/search/text.rs +175 -0
  9. package/dist/bin/sks-dispatch.js +4 -3
  10. package/dist/cli/command-manifest-lite.js +176 -5
  11. package/dist/cli/command-registry.js +41 -7
  12. package/dist/cli/help.js +30 -0
  13. package/dist/cli/install-helpers-codex-lb-config.js +9 -6
  14. package/dist/cli/install-helpers-codex-lb-selftest-chain.js +1 -1
  15. package/dist/cli/install-helpers-install-support.js +1 -1
  16. package/dist/cli/install-helpers.js +19 -9
  17. package/dist/cli/router.js +16 -3
  18. package/dist/commands/codex-app.js +13 -5
  19. package/dist/commands/doctor-profile.js +1 -1
  20. package/dist/commands/doctor.js +10 -2
  21. package/dist/commands/search.js +4 -0
  22. package/dist/config/skills-manifest.json +53 -60
  23. package/dist/core/agent-bridge/agent-manifest.js +22 -26
  24. package/dist/core/agent-bridge/host-capability-policy.js +109 -8
  25. package/dist/core/agent-bridge/host-capability-runtime.js +144 -27
  26. package/dist/core/agent-guidance/directive-registry.js +123 -0
  27. package/dist/core/agents/agent-effort-policy.js +45 -6
  28. package/dist/core/agents/agent-worker-pipeline.js +1 -3
  29. package/dist/core/agents/native-worker-backend-router.js +43 -19
  30. package/dist/core/auto-review.js +1 -3
  31. package/dist/core/code-structure.js +282 -19
  32. package/dist/core/codex/codex-config-guard.js +14 -4
  33. package/dist/core/codex/codex-config-toml.js +1 -3
  34. package/dist/core/codex-app/codex-agent-role-sync.js +1 -3
  35. package/dist/core/codex-app/codex-app-fast-ui-repair.js +14 -1
  36. package/dist/core/codex-app/codex-app-types.js +2 -3
  37. package/dist/core/codex-app/codex-desktop-routing-ownership.js +91 -0
  38. package/dist/core/codex-app/codex-hook-approval-probe.js +1 -3
  39. package/dist/core/codex-app/codex-hook-lifecycle.js +1 -3
  40. package/dist/core/codex-app/codex-init-deep.js +22 -10
  41. package/dist/core/codex-app/codex-model-catalog.js +23 -10
  42. package/dist/core/codex-app/codex-models-cache.js +160 -0
  43. package/dist/core/codex-app/desktop-routing-snapshot.js +233 -0
  44. package/dist/core/codex-app/glm-profile-installer.js +1 -3
  45. package/dist/core/codex-app/mcp-manager.js +1 -3
  46. package/dist/core/codex-app/menubar/constants.js +2 -0
  47. package/dist/core/codex-app/multi-provider-router-support.js +6 -10
  48. package/dist/core/codex-app/multi-provider-router.js +66 -4
  49. package/dist/core/codex-app/openrouter-activate.js +189 -26
  50. package/dist/core/codex-app/openrouter-base-instructions.js +1 -0
  51. package/dist/core/codex-app/openrouter-model-catalog.js +217 -0
  52. package/dist/core/codex-app/role-model-catalog-priority.js +61 -0
  53. package/dist/core/codex-app.js +30 -6
  54. package/dist/core/codex-compat/codex-hook-semantic-validator.js +1 -3
  55. package/dist/core/codex-lb/codex-lb-env.js +1 -3
  56. package/dist/core/codex-lb/codex-lb-tool-catalog.js +6 -1
  57. package/dist/core/codex-native/codex-native-feature-broker.js +2 -6
  58. package/dist/core/codex-native/codex-native-interop-policy.js +1 -3
  59. package/dist/core/codex-native/codex-native-reference-cache.js +1 -3
  60. package/dist/core/codex-native/codex-native-reference-source.js +1 -3
  61. package/dist/core/codex-native/codex-native-repair-transaction.js +1 -3
  62. package/dist/core/codex-native/core-skill-manifest.js +3 -2
  63. package/dist/core/codex-native/native-capability-repair-matrix.js +1 -3
  64. package/dist/core/codex-plugins/codex-plugin-repair.js +1 -3
  65. package/dist/core/codex-runtime/codex-desktop-config-policy.js +2 -4
  66. package/dist/core/commands/agent-bridge-command.js +24 -3
  67. package/dist/core/commands/image-ux-review-command.js +5 -11
  68. package/dist/core/commands/menubar-command.js +1 -1
  69. package/dist/core/commands/naruto-command.js +40 -13
  70. package/dist/core/commands/pipeline-command.js +5 -2
  71. package/dist/core/commands/release-command.js +63 -1
  72. package/dist/core/commands/remote-command.js +18 -0
  73. package/dist/core/commands/search-command.js +151 -0
  74. package/dist/core/commands/telegram-command.js +27 -0
  75. package/dist/core/commands/uninstall-command.js +1 -1
  76. package/dist/core/config/secret-preservation.js +1 -3
  77. package/dist/core/context7-client.js +2 -1
  78. package/dist/core/db-review.js +704 -0
  79. package/dist/core/db-safety.js +17 -23
  80. package/dist/core/doctor/browser-use-repair.js +1 -3
  81. package/dist/core/doctor/codex-startup-config-repair.js +1 -3
  82. package/dist/core/doctor/computer-use-repair.js +1 -3
  83. package/dist/core/doctor/context7-mcp-repair.js +1 -3
  84. package/dist/core/doctor/current-project-guidance.js +1 -3
  85. package/dist/core/doctor/doctor-codex-startup-repair.js +1 -3
  86. package/dist/core/doctor/doctor-dirty-planner.js +2 -2
  87. package/dist/core/doctor/doctor-native-capability-repair.js +1 -3
  88. package/dist/core/doctor/doctor-transaction.js +1 -3
  89. package/dist/core/doctor/imagegen-repair.js +1 -3
  90. package/dist/core/doctor/legacy-global-hook-cleanup.js +1 -3
  91. package/dist/core/doctor/mcp-transport-collision-repair.js +1 -3
  92. package/dist/core/doctor/retired-managed-residue-private.js +1 -3
  93. package/dist/core/doctor/supabase-mcp-repair.js +1 -3
  94. package/dist/core/engineering-sanity-review.js +186 -0
  95. package/dist/core/errors/message.js +3 -0
  96. package/dist/core/evidence/evidence-schema.js +1 -3
  97. package/dist/core/feature-fixtures.js +1 -0
  98. package/dist/core/feature-registry.js +1 -3
  99. package/dist/core/fsx.js +13 -0
  100. package/dist/core/git-hygiene/shared-memory-publish.js +1 -3
  101. package/dist/core/git-hygiene/validators.js +1 -3
  102. package/dist/core/harness-guard.js +21 -3
  103. package/dist/core/hooks-runtime/hook-context.js +2 -2
  104. package/dist/core/image-ux-review/imagegen-adapter.js +52 -56
  105. package/dist/core/image-ux-review/real-callout-extractor.js +6 -1
  106. package/dist/core/image-ux-review.js +3 -5
  107. package/dist/core/imagegen/codex-lb-imagegen-target.js +70 -0
  108. package/dist/core/imagegen/imagegen-capability.js +11 -11
  109. package/dist/core/imagegen/imagegen-evidence.js +32 -0
  110. package/dist/core/init/skills.js +9 -11
  111. package/dist/core/init.js +4 -6
  112. package/dist/core/json/records.js +9 -0
  113. package/dist/core/json-schema-validator.js +1 -3
  114. package/dist/core/lean-engineering-policy.js +54 -0
  115. package/dist/core/loops/loop-continuation-enforcer.js +1 -3
  116. package/dist/core/mad-sks/sql-plane/mcp-executor.js +2 -1
  117. package/dist/core/mad-sks/sql-plane/policy.js +2 -1
  118. package/dist/core/managed-assets/managed-assets-manifest.js +4 -3
  119. package/dist/core/mcp-config/codex-cli-adapter.js +1 -3
  120. package/dist/core/mcp-config/config-reader.js +2 -3
  121. package/dist/core/mcp-config/guarded-patch.js +1 -1
  122. package/dist/core/mcp-config/health-check.js +2 -1
  123. package/dist/core/mcp-config/mutation.js +1 -1
  124. package/dist/core/mcp-config/restore.js +1 -1
  125. package/dist/core/mcp-config/secret-policy.js +1 -3
  126. package/dist/core/migration/migration-transaction-journal.js +3 -3
  127. package/dist/core/naruto/naruto-concurrency-governor.js +2 -2
  128. package/dist/core/perf/import-graph-budget.js +91 -1
  129. package/dist/core/pipeline/pipeline-plan-writer.js +1 -1
  130. package/dist/core/pipeline-internals/runtime-core.js +121 -23
  131. package/dist/core/pipeline-internals/runtime-gates.js +193 -4
  132. package/dist/core/pipeline.js +1 -1
  133. package/dist/core/ppt-review/slide-imagegen-review.js +7 -7
  134. package/dist/core/ppt.js +3 -3
  135. package/dist/core/product-design-app-server.js +2 -1
  136. package/dist/core/proof/fake-real-proof-policy.js +1 -3
  137. package/dist/core/proof/root-cause-policy.js +1 -3
  138. package/dist/core/proof/validation.js +1 -3
  139. package/dist/core/provider/model-router.js +4 -0
  140. package/dist/core/provider/provider-context.js +1 -3
  141. package/dist/core/providers/openrouter/openrouter-account.js +1 -3
  142. package/dist/core/quality/helper-dedup.js +0 -0
  143. package/dist/core/recallpulse.js +1 -1
  144. package/dist/core/release/file-ownership.js +26 -17
  145. package/dist/core/release/macos-menubar-proof.js +2 -1
  146. package/dist/core/release/main-push-guard.js +5 -18
  147. package/dist/core/release/main-push-receipt.js +2 -44
  148. package/dist/core/release/release-gate-contract.js +2 -0
  149. package/dist/core/release/release-pack-receipt.js +1 -1
  150. package/dist/core/release/release-proof-io.js +33 -0
  151. package/dist/core/release/release-upgrade-baseline.js +9 -0
  152. package/dist/core/release/runtime-script-pack-closure.js +87 -2
  153. package/dist/core/release/stage-publish.js +194 -0
  154. package/dist/core/remote/machine-registry.js +1 -3
  155. package/dist/core/remote/owner-proof.js +1 -3
  156. package/dist/core/remote/protocol.js +1 -3
  157. package/dist/core/remote/readiness.js +1 -3
  158. package/dist/core/remote/session-index.js +1 -3
  159. package/dist/core/remote/worker.js +1 -3
  160. package/dist/core/responses-stream.js +151 -0
  161. package/dist/core/routes/dollar-manifest-lite.js +1 -1
  162. package/dist/core/routes.js +7 -7
  163. package/dist/core/rust-accelerator.js +12 -2
  164. package/dist/core/safety/ssot-guard.js +1 -3
  165. package/dist/core/search/benchmark.js +358 -0
  166. package/dist/core/search/cache.js +65 -0
  167. package/dist/core/search/context.js +144 -0
  168. package/dist/core/search/doctor.js +74 -0
  169. package/dist/core/search/files.js +192 -0
  170. package/dist/core/search/index.js +5 -0
  171. package/dist/core/search/ipc.js +64 -0
  172. package/dist/core/search/provider.js +142 -0
  173. package/dist/core/search/rust-bridge.js +24 -0
  174. package/dist/core/search/structure.js +230 -0
  175. package/dist/core/search/symbol.js +272 -0
  176. package/dist/core/search/text.js +146 -0
  177. package/dist/core/search/types.js +22 -0
  178. package/dist/core/search/typescript-ls.js +215 -0
  179. package/dist/core/search-visibility/discovery.js +1 -3
  180. package/dist/core/skill-forge.js +1 -1
  181. package/dist/core/stop-gate/gate-evaluator.js +3 -3
  182. package/dist/core/stop-gate/stop-gate-check.js +1 -3
  183. package/dist/core/structured-output-adapter.js +62 -2
  184. package/dist/core/subagents/agent-catalog.js +56 -43
  185. package/dist/core/subagents/model-policy.js +17 -7
  186. package/dist/core/subagents/naruto-proof-projection.js +2 -6
  187. package/dist/core/subagents/official-subagent-config.js +1 -3
  188. package/dist/core/subagents/official-subagent-preparation.js +39 -12
  189. package/dist/core/subagents/official-subagent-prompt.js +83 -18
  190. package/dist/core/subagents/official-subagent-runner.js +5 -5
  191. package/dist/core/subagents/role-model-preferences.js +33 -11
  192. package/dist/core/subagents/subagent-evidence.js +1 -3
  193. package/dist/core/subagents/thread-budget.js +1 -1
  194. package/dist/core/subagents/triwiki-attention.js +1 -5
  195. package/dist/core/telegram/config.js +1 -3
  196. package/dist/core/telegram/runtime-projection.js +2 -3
  197. package/dist/core/text/regex.js +3 -0
  198. package/dist/core/text/strings.js +6 -0
  199. package/dist/core/triwiki-wrongness/image-wrongness.js +1 -3
  200. package/dist/core/triwiki-wrongness/wrongness-ledger.js +1 -3
  201. package/dist/core/triwiki-wrongness/wrongness-proof-linker.js +1 -3
  202. package/dist/core/triwiki-wrongness/wrongness-retrieval.js +1 -3
  203. package/dist/core/triwiki-wrongness/wrongness-schema.js +1 -3
  204. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +1 -3
  205. package/dist/core/trust-kernel/completion-contract.js +1 -3
  206. package/dist/core/trust-kernel/route-contract.js +1 -3
  207. package/dist/core/update/update-migration-state.js +1 -3
  208. package/dist/core/update-check.js +7 -1
  209. package/dist/core/verification/diff-quality.js +3 -4
  210. package/dist/core/verification/impact-scan.js +36 -89
  211. package/dist/core/verification/mistake-rule-compiler.js +17 -4
  212. package/dist/core/version-manager.js +3 -20
  213. package/dist/core/version.js +1 -1
  214. package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +22 -2
  215. package/dist/native/sks-menubar/Sources/ControlKit.swift +102 -0
  216. package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +23 -11
  217. package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +7 -3
  218. package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +17 -1
  219. package/dist/native/sks-menubar/Sources/OverviewViewController.swift +22 -15
  220. package/dist/native/sks-menubar/Sources/ProcessClient.swift +14 -4
  221. package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +65 -12
  222. package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +154 -225
  223. package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +252 -0
  224. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +73 -70
  225. package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +16 -7
  226. package/dist/native/sks-menubar/Sources/SettingsViewController.swift +14 -5
  227. package/dist/native/sks-menubar/Sources/SidebarItem.swift +15 -1
  228. package/dist/native/sks-menubar/Sources/StatusItemController.swift +2 -2
  229. package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +12 -11
  230. package/dist/scripts/agent-guidance-dedup-check.js +23 -0
  231. package/dist/scripts/agent-message-bus-reader-check.js +1 -1
  232. package/dist/scripts/all-feature-deep-completion-check.js +1 -1
  233. package/dist/scripts/appshots-thread-attachment-discovery-check.js +1 -1
  234. package/dist/scripts/architecture-guard-check.js +1 -2
  235. package/dist/scripts/certificate-sla-check.js +1 -1
  236. package/dist/scripts/cli-output-consistency-check.js +1 -1
  237. package/dist/scripts/codex-0-134-runner-truth-check.js +1 -1
  238. package/dist/scripts/codex-0138-capability-artifact-check.js +1 -1
  239. package/dist/scripts/codex-0138-capability-check.js +1 -1
  240. package/dist/scripts/codex-0138-doctor-check.js +1 -1
  241. package/dist/scripts/codex-0138-feature-probes-check.js +1 -1
  242. package/dist/scripts/codex-0144-app-server-v2-check.js +1 -1
  243. package/dist/scripts/codex-0144-binary-identity-check.js +1 -1
  244. package/dist/scripts/codex-0144-capability-check.js +1 -1
  245. package/dist/scripts/codex-0144-core-real-probes-check.js +1 -1
  246. package/dist/scripts/codex-0144-manifest-check.js +1 -1
  247. package/dist/scripts/codex-0144-policy-check.js +1 -1
  248. package/dist/scripts/codex-0144-thread-store-check.js +1 -1
  249. package/dist/scripts/codex-agent-role-rich-content-check.js +2 -2
  250. package/dist/scripts/codex-agent-role-sync-check.js +2 -2
  251. package/dist/scripts/codex-agent-type-routing-check.js +2 -2
  252. package/dist/scripts/codex-app-execution-profile-check.js +2 -2
  253. package/dist/scripts/codex-app-handoff-check.js +1 -1
  254. package/dist/scripts/codex-app-handoff-launch-check.js +1 -1
  255. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +1 -1
  256. package/dist/scripts/codex-lb-fast-ui-preservation-check.js +1 -3
  257. package/dist/scripts/codex-native-feature-broker-blackbox.js +2 -2
  258. package/dist/scripts/codex-native-feature-broker-check.js +2 -2
  259. package/dist/scripts/{sks-3-1-6-directive-check-lib.js → codex-native-gate-lib.js} +5 -5
  260. package/dist/scripts/codex-native-harness-compat-check.js +2 -2
  261. package/dist/scripts/codex-native-hook-lifecycle-proof-check.js +2 -2
  262. package/dist/scripts/codex-plugin-app-template-policy-check.js +1 -1
  263. package/dist/scripts/codex-sdk-backend-router-check.js +1 -1
  264. package/dist/scripts/codex-sdk-capability-check.js +1 -1
  265. package/dist/scripts/context7-evidence-dedupe-check.js +1 -1
  266. package/dist/scripts/core-skill-card-schema-check.js +1 -1
  267. package/dist/scripts/core-skill-deployment-snapshot-check.js +1 -1
  268. package/dist/scripts/core-skill-heldout-validation-check.js +1 -1
  269. package/dist/scripts/core-skill-no-inference-optimizer-check.js +1 -1
  270. package/dist/scripts/core-skill-patch-check.js +1 -1
  271. package/dist/scripts/core-skill-route-runtime-integration-check.js +1 -1
  272. package/dist/scripts/current-command-surface-check.js +1 -1
  273. package/dist/scripts/current-surface-update-e2e-check.js +4 -1
  274. package/dist/scripts/current-upgrade-matrix-check.js +1 -1
  275. package/dist/scripts/dfix-fixture-check.js +1 -1
  276. package/dist/scripts/dfix-patch-handoff-check.js +1 -1
  277. package/dist/scripts/dfix-verification-check.js +1 -1
  278. package/dist/scripts/dfix-verification-recommendation-check.js +1 -1
  279. package/dist/scripts/docs-truthfulness-check.js +16 -3
  280. package/dist/scripts/doctor-codex-app-harness-check.js +2 -2
  281. package/dist/scripts/evidence-flagship-coverage-check.js +1 -1
  282. package/dist/scripts/{sks-1-18-gate-lib.js → gate-lib.js} +1 -1
  283. package/dist/scripts/gate-policy-audit-check.js +4 -1
  284. package/dist/scripts/git-worktree-checkpoint-check.js +1 -1
  285. package/dist/scripts/git-worktree-cross-rebase-check.js +1 -1
  286. package/dist/scripts/git-worktree-diff-envelope-check.js +1 -1
  287. package/dist/scripts/git-worktree-dirty-lock-check.js +1 -1
  288. package/dist/scripts/git-worktree-dirty-main-detection-check.js +1 -1
  289. package/dist/scripts/git-worktree-integration-primary-check.js +1 -1
  290. package/dist/scripts/git-worktree-manifest-append-check.js +1 -1
  291. package/dist/scripts/git-worktree-untracked-diff-check.js +1 -1
  292. package/dist/scripts/harness-benchmark-check.js +1 -1
  293. package/dist/scripts/helper-dedup-check.js +62 -0
  294. package/dist/scripts/hook-latency-budget-check.js +1 -1
  295. package/dist/scripts/image-artifact-path-contract-check.js +1 -1
  296. package/dist/scripts/imagegen-real-smoke-check.js +2 -5
  297. package/dist/scripts/installed-package-smoke-check.js +1 -1
  298. package/dist/scripts/legacy-gate-inventory-check.js +1 -1
  299. package/dist/scripts/legacy-gate-purge-check.js +1 -1
  300. package/dist/scripts/legacy-strong-inventory-check.js +1 -1
  301. package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -1
  302. package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +1 -1
  303. package/dist/scripts/mad-sks-sql-plane-capability-check.js +1 -1
  304. package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +1 -1
  305. package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +1 -1
  306. package/dist/scripts/managed-config-merge-check.js +1 -1
  307. package/dist/scripts/mcp-plugin-inventory-check.js +1 -1
  308. package/dist/scripts/model-call-concurrency-check.js +1 -1
  309. package/dist/scripts/mutation-callsite-coverage-check.js +1 -1
  310. package/dist/scripts/naruto-ssot-gate-aliases-check.js +1 -1
  311. package/dist/scripts/naruto-ssot-pipeline-default-check.js +1 -1
  312. package/dist/scripts/naruto-ssot-route-normalization-check.js +1 -1
  313. package/dist/scripts/naruto-ssot-routing-check.js +1 -1
  314. package/dist/scripts/naruto-worktree-coding-blackbox.js +1 -1
  315. package/dist/scripts/native-capability-repair-matrix-check.js +1 -1
  316. package/dist/scripts/native-image-generation-repair-check.js +1 -1
  317. package/dist/scripts/official-subagent-workflow-check.js +3 -3
  318. package/dist/scripts/package-published-contract-check.js +37 -4
  319. package/dist/scripts/packlist-performance-check.js +17 -1
  320. package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +1 -3
  321. package/dist/scripts/ppt-real-export-adapter-check.js +1 -1
  322. package/dist/scripts/ppt-real-imagegen-wiring-check.js +1 -1
  323. package/dist/scripts/ppt-reexport-rereview-check.js +1 -1
  324. package/dist/scripts/prepublish-fast-check.js +1 -1
  325. package/dist/scripts/probe-memoization-check.js +2 -2
  326. package/dist/scripts/prompt-placeholder-guard-check.js +1 -1
  327. package/dist/scripts/qa-loop-app-handoff-capability-check.js +1 -1
  328. package/dist/scripts/qa-loop-app-handoff-check.js +1 -1
  329. package/dist/scripts/qa-loop-app-handoff-cli-check.js +1 -1
  330. package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +1 -1
  331. package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +1 -1
  332. package/dist/scripts/qa-loop-app-handoff-launch-check.js +1 -1
  333. package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +1 -1
  334. package/dist/scripts/qa-loop-budget-policy-check.js +1 -1
  335. package/dist/scripts/qa-loop-effort-escalation-check.js +1 -1
  336. package/dist/scripts/qa-loop-execution-profile-routing-check.js +2 -2
  337. package/dist/scripts/qa-loop-image-path-exposure-check.js +1 -1
  338. package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +1 -1
  339. package/dist/scripts/{sks-1-12-real-execution-check-lib.js → real-execution-check-lib.js} +1 -1
  340. package/dist/scripts/release-affected-selector-check.js +1 -1
  341. package/dist/scripts/release-aggressive-resource-governor-check.js +1 -1
  342. package/dist/scripts/release-cache-glob-hashing-check.js +1 -1
  343. package/dist/scripts/release-cache-input-classifier-check.js +1 -1
  344. package/dist/scripts/release-cache-neutralization-report-check.js +1 -1
  345. package/dist/scripts/release-cache-version-neutral-fixture-check.js +1 -1
  346. package/dist/scripts/release-dynamic-presets-check.js +2 -2
  347. package/dist/scripts/release-full-parallelism-blackbox.js +1 -1
  348. package/dist/scripts/release-gate-batch-runner-check.js +1 -1
  349. package/dist/scripts/release-gate-budget-check.js +1 -1
  350. package/dist/scripts/release-gate-dag-runner-check.js +1 -1
  351. package/dist/scripts/release-latency-slo-check.js +1 -1
  352. package/dist/scripts/release-metadata-check.js +256 -2
  353. package/dist/scripts/release-parallel-speed-budget-check.js +1 -1
  354. package/dist/scripts/release-proof-truth-check.js +1 -1
  355. package/dist/scripts/release-provenance-check.js +1 -1
  356. package/dist/scripts/release-runtime-truth-matrix-check.js +1 -1
  357. package/dist/scripts/research-blueprint-densifier-check.js +1 -1
  358. package/dist/scripts/research-claim-builder-check.js +1 -1
  359. package/dist/scripts/research-complete-package-fixture-check.js +1 -1
  360. package/dist/scripts/research-execution-profile-routing-check.js +2 -2
  361. package/dist/scripts/research-final-reviewer-blackbox.js +1 -1
  362. package/dist/scripts/{sks-3-1-4-directive-check-lib.js → runtime-domain-gate-lib.js} +2 -2
  363. package/dist/scripts/runtime-proof-summary-check.js +1 -1
  364. package/dist/scripts/runtime-script-pack-closure-check.js +7 -1
  365. package/dist/scripts/scheduler-batch-dispatch-check.js +1 -1
  366. package/dist/scripts/scheduler-parallel-proof-consistency-check.js +1 -1
  367. package/dist/scripts/scheduler-utilization-integral-check.js +1 -1
  368. package/dist/scripts/search-visibility-gate-lib.js +1 -1
  369. package/dist/scripts/secret-preservation-check.js +1 -1
  370. package/dist/scripts/seo-geo-geo-disambiguation-check.js +1 -1
  371. package/dist/scripts/seo-geo-skill-rich-content-check.js +1 -1
  372. package/dist/scripts/side-effect-runtime-report-check.js +1 -1
  373. package/dist/scripts/{sks-3-1-8-check-lib.js → skill-fixture-check-lib.js} +1 -1
  374. package/dist/scripts/skill-name-canonicalizer-check.js +1 -1
  375. package/dist/scripts/skills-manifest-continuity-check.js +1 -1
  376. package/dist/scripts/sks-uninstall-regression-check.js +1 -1
  377. package/dist/scripts/sksd-daemon-check.js +1 -1
  378. package/dist/scripts/super-search-provider-interface-check.js +1 -1
  379. package/dist/scripts/triwiki-cache-key-check.js +1 -1
  380. package/dist/scripts/triwiki-proof-bank-blackbox.js +2 -2
  381. package/dist/scripts/triwiki-proof-bank-check.js +1 -1
  382. package/dist/scripts/triwiki-proof-card-check.js +1 -1
  383. package/dist/scripts/type-surface-codex-app-check.js +2 -2
  384. package/dist/scripts/{sks-3-1-5-directive-check-lib.js → typed-routing-gate-lib.js} +2 -2
  385. package/dist/scripts/ultra-router-auto-router-check.js +1 -1
  386. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +1 -1
  387. package/dist/scripts/ux-review-patch-diff-recheck-check.js +1 -1
  388. package/dist/scripts/ux-review-run-wires-imagegen-check.js +9 -2
  389. package/package.json +4 -8
  390. package/release-gates.v2.json +66 -11
  391. package/runtime-required-scripts.json +137 -22
  392. package/config/bench-baseline.json +0 -7
  393. package/dist/core/codex-app/sks-menubar.js +0 -1
  394. package/dist/core/release/release-closure-contract.js +0 -30
  395. package/dist/core/release/release-closure-helpers.js +0 -293
  396. package/dist/core/release/release-closure-validation.js +0 -284
  397. package/dist/core/release/release-closure.js +0 -163
  398. package/dist/scripts/build-dist.js +0 -124
  399. package/dist/scripts/build-once-runner-check.js +0 -6
  400. package/dist/scripts/canonical-test-runner.js +0 -234
  401. package/dist/scripts/changelog-check.js +0 -45
  402. package/dist/scripts/check-architecture.js +0 -295
  403. package/dist/scripts/check-cli-entrypoint.js +0 -41
  404. package/dist/scripts/check-command-module-budget.js +0 -77
  405. package/dist/scripts/check-feature-quality.js +0 -51
  406. package/dist/scripts/check-legacy-free.js +0 -64
  407. package/dist/scripts/check-pipeline-budget.js +0 -49
  408. package/dist/scripts/check-pipeline-runtime.js +0 -16
  409. package/dist/scripts/check-publish-tag.js +0 -56
  410. package/dist/scripts/check-route-modularity.js +0 -72
  411. package/dist/scripts/codex-0140-capability-check.js +0 -14
  412. package/dist/scripts/codex-0140-feature-probes-check.js +0 -23
  413. package/dist/scripts/codex-permission-profiles-check.js +0 -34
  414. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -49
  415. package/dist/scripts/competitor-scorecard-check.js +0 -24
  416. package/dist/scripts/core-skill-no-drift-check.js +0 -23
  417. package/dist/scripts/db-route-materialization-check.js +0 -32
  418. package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -15
  419. package/dist/scripts/doctor-fastpath-check.js +0 -25
  420. package/dist/scripts/doctor-fix-production-blackbox.js +0 -35
  421. package/dist/scripts/doctor-idempotence-check.js +0 -6
  422. package/dist/scripts/doctor-ops-semantics-check.js +0 -83
  423. package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -18
  424. package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -13
  425. package/dist/scripts/ensure-bin-executable.js +0 -16
  426. package/dist/scripts/fsx-hotpath-check.js +0 -9
  427. package/dist/scripts/high-risk-contracts-check.js +0 -183
  428. package/dist/scripts/hook-latency-quantum-check.js +0 -120
  429. package/dist/scripts/import-graph-budget-check.js +0 -9
  430. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -14
  431. package/dist/scripts/naruto-codex-e2e-check.js +0 -105
  432. package/dist/scripts/naruto-write-e2e-check.js +0 -31
  433. package/dist/scripts/native-capability-postcheck-check.js +0 -16
  434. package/dist/scripts/ops-diagnostics-bundle-check.js +0 -11
  435. package/dist/scripts/parallel-production-smoke-check.js +0 -20
  436. package/dist/scripts/perf-budget-check.js +0 -12
  437. package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -10
  438. package/dist/scripts/project-skill-dedupe-blackbox.js +0 -62
  439. package/dist/scripts/release-dag-full-coverage-check.js +0 -98
  440. package/dist/scripts/release-dist-freshness-check.js +0 -6
  441. package/dist/scripts/release-file-ownership-check.js +0 -35
  442. package/dist/scripts/release-gate-script-parity-check.js +0 -148
  443. package/dist/scripts/release-macos-menubar-proof.js +0 -202
  444. package/dist/scripts/release-main-push-guard.js +0 -37
  445. package/dist/scripts/release-main-push-receipt.js +0 -43
  446. package/dist/scripts/release-metadata-1-19-check.js +0 -257
  447. package/dist/scripts/release-version-truth-check.js +0 -138
  448. package/dist/scripts/retention-apply-smoke-check.js +0 -19
  449. package/dist/scripts/retention-budget-check.js +0 -6
  450. package/dist/scripts/retention-dry-run-check.js +0 -8
  451. package/dist/scripts/rollback-recovery-smoke-check.js +0 -70
  452. package/dist/scripts/route-intent-regression-check.js +0 -42
  453. package/dist/scripts/runtime-current-terminal-check.js +0 -108
  454. package/dist/scripts/runtime-dist-parity-check.js +0 -76
  455. package/dist/scripts/runtime-no-src-mjs-check.js +0 -30
  456. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -58
  457. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -53
  458. package/dist/scripts/secret-preservation-guard-check.js +0 -36
  459. package/dist/scripts/seo-marketing-truthfulness-check.js +0 -98
  460. package/dist/scripts/seo-metadata-sync-check.js +0 -60
  461. package/dist/scripts/sizecheck.js +0 -148
  462. package/dist/scripts/sks-menubar-install-check.js +0 -333
  463. package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -28
  464. package/dist/scripts/super-search-live-smoke-check.js +0 -115
  465. package/dist/scripts/super-search-local-http-smoke-check.js +0 -16
  466. package/dist/scripts/super-search-offline-contract-check.js +0 -43
  467. package/dist/scripts/update-fastpath-check.js +0 -28
  468. package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -26
  469. package/dist/scripts/upgrade-migration-matrix-check.js +0 -351
  470. package/dist/scripts/write-build-manifest.js +0 -70
  471. package/dist/scripts/zellij-capability-check.js +0 -13
  472. package/dist/scripts/zellij-developer-controls-check.js +0 -16
  473. package/dist/scripts/zellij-doctor-readiness-check.js +0 -49
  474. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -19
  475. package/dist/scripts/zellij-fake-adapter-check.js +0 -31
  476. package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
  477. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -348
  478. package/dist/scripts/zellij-homebrew-policy-check.js +0 -3
  479. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -21
  480. package/dist/scripts/zellij-lane-renderer-check.js +0 -78
  481. package/dist/scripts/zellij-launch-command-truth-check.js +0 -62
  482. package/dist/scripts/zellij-layout-valid-check.js +0 -120
  483. package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -10
  484. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -78
  485. package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -12
  486. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -134
  487. package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -7
  488. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -158
  489. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -20
  490. package/dist/scripts/zellij-right-column-manager-check.js +0 -24
  491. package/dist/scripts/zellij-self-heal-check.js +0 -3
  492. package/dist/scripts/zellij-self-heal-dry-run-check.js +0 -3
  493. package/dist/scripts/zellij-self-heal-status-contract-check.js +0 -3
  494. package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -3
  495. package/dist/scripts/zellij-slot-column-anchor-check.js +0 -65
  496. package/dist/scripts/zellij-slot-column-anchor-telemetry-check.js +0 -8
  497. package/dist/scripts/zellij-slot-only-ui-check.js +0 -29
  498. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -149
  499. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -65
  500. package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +0 -11
  501. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -58
  502. package/dist/scripts/zellij-slot-telemetry-check.js +0 -38
  503. package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -46
  504. package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -55
  505. package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -32
  506. package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -19
  507. package/dist/scripts/zellij-slot-telemetry-renderer-check.js +0 -11
  508. package/dist/scripts/zellij-slot-telemetry-runtime-check.js +0 -23
  509. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -45
  510. package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -9
  511. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -78
  512. package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -29
  513. package/dist/scripts/zellij-stacked-version-parser-check.js +0 -19
  514. package/dist/scripts/zellij-ui-design-check.js +0 -92
  515. package/dist/scripts/zellij-update-missing-self-heal-check.js +0 -3
  516. package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -16
  517. package/dist/scripts/zellij-update-prompt-mode-check.js +0 -18
  518. package/dist/scripts/zellij-update-prompt-safety-check.js +0 -8
  519. package/dist/scripts/zellij-worker-pane-manager-check.js +0 -108
  520. package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
  521. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -199
  522. /package/dist/scripts/{sks-1-11-gate-lib.js → sks-cli-gate-lib.js} +0 -0
@@ -0,0 +1,274 @@
1
+ mod files;
2
+ mod text;
3
+
4
+ use serde::{Deserialize, Serialize};
5
+ use serde_json::Value;
6
+ use std::io::{self, Read};
7
+ use std::time::Instant;
8
+
9
+ #[derive(Debug, Deserialize)]
10
+ #[serde(rename_all = "camelCase")]
11
+ pub struct SearchRequest {
12
+ #[allow(dead_code)]
13
+ pub schema_version: u32,
14
+ pub mode: String,
15
+ pub root: String,
16
+ pub query: Option<String>,
17
+ pub pattern: Option<String>,
18
+ pub include: Option<Vec<String>>,
19
+ pub exclude: Option<Vec<String>>,
20
+ pub case_sensitive: Option<bool>,
21
+ pub limits: Option<SearchLimits>,
22
+ }
23
+
24
+ #[derive(Debug, Deserialize, Clone)]
25
+ #[serde(rename_all = "camelCase")]
26
+ pub struct SearchLimits {
27
+ pub max_matches: Option<usize>,
28
+ pub max_files: Option<usize>,
29
+ pub max_bytes: Option<u64>,
30
+ pub timeout_ms: Option<u64>,
31
+ }
32
+
33
+ #[derive(Debug, Serialize)]
34
+ #[serde(rename_all = "camelCase")]
35
+ pub struct SearchMatch {
36
+ pub path: String,
37
+ #[serde(skip_serializing_if = "Option::is_none")]
38
+ pub line: Option<u32>,
39
+ #[serde(skip_serializing_if = "Option::is_none")]
40
+ pub column: Option<u32>,
41
+ #[serde(skip_serializing_if = "Option::is_none")]
42
+ pub text: Option<String>,
43
+ pub confidence: String,
44
+ }
45
+
46
+ #[derive(Debug, Serialize)]
47
+ #[serde(rename_all = "camelCase")]
48
+ pub struct SearchResponse {
49
+ pub schema_version: u32,
50
+ pub schema: String,
51
+ pub ok: bool,
52
+ pub mode: String,
53
+ pub provider: String,
54
+ pub engine: String,
55
+ pub matches: Vec<SearchMatch>,
56
+ pub confidence: String,
57
+ pub truncated: bool,
58
+ pub timeout: bool,
59
+ pub limits: LimitsOut,
60
+ pub scanned: ScannedOut,
61
+ pub skipped: SkippedOut,
62
+ pub cache_hit: bool,
63
+ pub warnings: Vec<String>,
64
+ pub errors: Vec<String>,
65
+ pub duration_ms: u64,
66
+ pub process_spawns: u32,
67
+ pub deterministic_order: String,
68
+ }
69
+
70
+ #[derive(Debug, Clone, Serialize)]
71
+ #[serde(rename_all = "camelCase")]
72
+ pub struct LimitsOut {
73
+ pub max_matches: usize,
74
+ pub max_files: usize,
75
+ pub max_bytes: u64,
76
+ pub timeout_ms: u64,
77
+ }
78
+
79
+ #[derive(Debug, Serialize)]
80
+ #[serde(rename_all = "camelCase")]
81
+ pub struct ScannedOut {
82
+ pub files: usize,
83
+ pub bytes: u64,
84
+ }
85
+
86
+ #[derive(Debug, Serialize)]
87
+ #[serde(rename_all = "camelCase")]
88
+ pub struct SkippedOut {
89
+ pub files: usize,
90
+ pub reasons: serde_json::Map<String, Value>,
91
+ }
92
+
93
+ #[derive(Debug, Deserialize)]
94
+ #[serde(rename_all = "camelCase")]
95
+ struct BatchRequest {
96
+ #[allow(dead_code)]
97
+ pub schema_version: u32,
98
+ pub root: String,
99
+ pub requests: Vec<SearchRequest>,
100
+ }
101
+
102
+ #[derive(Debug, Serialize)]
103
+ #[serde(rename_all = "camelCase")]
104
+ struct BatchResponse {
105
+ pub schema_version: u32,
106
+ pub schema: String,
107
+ pub ok: bool,
108
+ pub provider: String,
109
+ pub responses: Vec<SearchResponse>,
110
+ pub process_spawns: u32,
111
+ pub duration_ms: u64,
112
+ }
113
+
114
+ pub fn run(args: &[String]) -> i32 {
115
+ let mut rest = args.to_vec();
116
+ let mut json_mode = false;
117
+ rest.retain(|a| {
118
+ if a == "--json" {
119
+ json_mode = true;
120
+ false
121
+ } else {
122
+ true
123
+ }
124
+ });
125
+ if rest.is_empty() || rest[0] == "--help" || rest[0] == "help" {
126
+ eprintln!("sks-rs search files|text|batch --json (JSON request on stdin)");
127
+ return if rest.is_empty() { 2 } else { 0 };
128
+ }
129
+ let mode = rest[0].as_str();
130
+ let started = Instant::now();
131
+ match mode {
132
+ "files" | "text" => {
133
+ let req = read_request();
134
+ let mut req = match req {
135
+ Ok(r) => r,
136
+ Err(e) => {
137
+ eprintln!("{}", e);
138
+ return 1;
139
+ }
140
+ };
141
+ req.mode = mode.to_string();
142
+ let resp = dispatch(req);
143
+ print_json(&resp);
144
+ if !json_mode {
145
+ // still JSON for machine responses only
146
+ }
147
+ if resp.ok {
148
+ 0
149
+ } else if resp.errors.iter().any(|e| e.starts_with("invalid_")) {
150
+ 2
151
+ } else {
152
+ 1
153
+ }
154
+ }
155
+ "batch" => {
156
+ let batch: BatchRequest = match read_stdin_json() {
157
+ Ok(v) => v,
158
+ Err(e) => {
159
+ eprintln!("{}", e);
160
+ return 1;
161
+ }
162
+ };
163
+ let mut responses = Vec::new();
164
+ for mut req in batch.requests {
165
+ if req.root.is_empty() {
166
+ req.root = batch.root.clone();
167
+ }
168
+ responses.push(dispatch(req));
169
+ }
170
+ let out = BatchResponse {
171
+ schema_version: 1,
172
+ schema: "sks.search-batch.v1".to_string(),
173
+ ok: responses.iter().all(|r| r.ok),
174
+ provider: "sks-rs".to_string(),
175
+ process_spawns: 1,
176
+ duration_ms: started.elapsed().as_millis() as u64,
177
+ responses,
178
+ };
179
+ print_json(&out);
180
+ if out.ok { 0 } else { 1 }
181
+ }
182
+ _ => {
183
+ eprintln!("unknown search mode: {} (files|text|batch)", mode);
184
+ 2
185
+ }
186
+ }
187
+ }
188
+
189
+ fn dispatch(req: SearchRequest) -> SearchResponse {
190
+ let started = Instant::now();
191
+ let limits = normalize_limits(req.limits.as_ref());
192
+ match req.mode.as_str() {
193
+ "files" => files::search_files(req, limits, started),
194
+ "text" => text::search_text(req, limits, started),
195
+ other => error_response(other, limits, started, vec![format!("unsupported_mode:{}", other)]),
196
+ }
197
+ }
198
+
199
+ pub(crate) fn normalize_limits(limits: Option<&SearchLimits>) -> LimitsOut {
200
+ LimitsOut {
201
+ max_matches: limits.and_then(|l| l.max_matches).unwrap_or(500),
202
+ max_files: limits.and_then(|l| l.max_files).unwrap_or(50_000),
203
+ max_bytes: limits.and_then(|l| l.max_bytes).unwrap_or(32 * 1024 * 1024),
204
+ timeout_ms: limits.and_then(|l| l.timeout_ms).unwrap_or(30_000),
205
+ }
206
+ }
207
+
208
+ pub(crate) fn empty_skipped() -> SkippedOut {
209
+ SkippedOut {
210
+ files: 0,
211
+ reasons: serde_json::Map::new(),
212
+ }
213
+ }
214
+
215
+ pub(crate) fn bump_skip(skipped: &mut SkippedOut, reason: &str) {
216
+ skipped.files += 1;
217
+ let entry = skipped.reasons.entry(reason.to_string()).or_insert(Value::from(0));
218
+ if let Some(n) = entry.as_u64() {
219
+ *entry = Value::from(n + 1);
220
+ }
221
+ }
222
+
223
+ pub(crate) fn base_ok(mode: &str, engine: &str, limits: LimitsOut, started: Instant) -> SearchResponse {
224
+ SearchResponse {
225
+ schema_version: 1,
226
+ schema: "sks.search-provider.v1".to_string(),
227
+ ok: true,
228
+ mode: mode.to_string(),
229
+ provider: "sks-rs".to_string(),
230
+ engine: engine.to_string(),
231
+ matches: vec![],
232
+ confidence: if mode == "files" { "file_path".into() } else { "text_candidate".into() },
233
+ truncated: false,
234
+ timeout: false,
235
+ limits,
236
+ scanned: ScannedOut { files: 0, bytes: 0 },
237
+ skipped: empty_skipped(),
238
+ cache_hit: false,
239
+ warnings: vec![],
240
+ errors: vec![],
241
+ duration_ms: started.elapsed().as_millis() as u64,
242
+ process_spawns: 0,
243
+ deterministic_order: "path_line_column".to_string(),
244
+ }
245
+ }
246
+
247
+ fn error_response(mode: &str, limits: LimitsOut, started: Instant, errors: Vec<String>) -> SearchResponse {
248
+ let mut resp = base_ok(mode, "sks-rs", limits, started);
249
+ resp.ok = false;
250
+ resp.errors = errors;
251
+ resp
252
+ }
253
+
254
+ fn read_request() -> Result<SearchRequest, String> {
255
+ read_stdin_json()
256
+ }
257
+
258
+ fn read_stdin_json<T: for<'de> Deserialize<'de>>() -> Result<T, String> {
259
+ let mut input = String::new();
260
+ io::stdin().read_to_string(&mut input).map_err(|e| e.to_string())?;
261
+ if input.trim().is_empty() {
262
+ return Err("empty_stdin_json".to_string());
263
+ }
264
+ serde_json::from_str(&input).map_err(|e| format!("invalid_json:{}", e))
265
+ }
266
+
267
+ fn print_json<T: Serialize>(value: &T) {
268
+ match serde_json::to_string(value) {
269
+ Ok(s) => println!("{}", s),
270
+ Err(e) => {
271
+ eprintln!("{}", e);
272
+ }
273
+ }
274
+ }
@@ -0,0 +1,175 @@
1
+ use super::{bump_skip, base_ok, LimitsOut, SearchMatch, SearchRequest, SearchResponse};
2
+ use globset::{Glob, GlobSet, GlobSetBuilder};
3
+ use grep_matcher::Matcher;
4
+ use grep_regex::RegexMatcherBuilder;
5
+ use grep_searcher::{SearcherBuilder, sinks};
6
+ use ignore::WalkBuilder;
7
+ use std::path::Path;
8
+ use std::time::Instant;
9
+
10
+ pub fn search_text(req: SearchRequest, limits: LimitsOut, started: Instant) -> SearchResponse {
11
+ let mut resp = base_ok("text", "grep-searcher", limits.clone(), started);
12
+ let pattern = req
13
+ .pattern
14
+ .as_deref()
15
+ .or(req.query.as_deref())
16
+ .unwrap_or("")
17
+ .to_string();
18
+ if pattern.is_empty() {
19
+ resp.ok = false;
20
+ resp.errors.push("missing_pattern".to_string());
21
+ resp.duration_ms = started.elapsed().as_millis() as u64;
22
+ return resp;
23
+ }
24
+
25
+ let case_sensitive = req.case_sensitive.unwrap_or(true);
26
+ let matcher = match RegexMatcherBuilder::new()
27
+ .case_insensitive(!case_sensitive)
28
+ .multi_line(false)
29
+ .build(&pattern)
30
+ {
31
+ Ok(m) => m,
32
+ Err(e) => {
33
+ resp.ok = false;
34
+ resp.errors.push(format!("invalid_regex:{}", e));
35
+ resp.duration_ms = started.elapsed().as_millis() as u64;
36
+ return resp;
37
+ }
38
+ };
39
+
40
+ let root = Path::new(&req.root);
41
+ let include = build_globset(req.include.as_deref().unwrap_or(&[]));
42
+ let exclude = build_globset(req.exclude.as_deref().unwrap_or(&[]));
43
+ let max_matches = resp.limits.max_matches;
44
+ let max_bytes = resp.limits.max_bytes;
45
+ let timeout_ms = resp.limits.timeout_ms;
46
+
47
+ let mut walker = WalkBuilder::new(root);
48
+ walker
49
+ .hidden(true)
50
+ .git_ignore(true)
51
+ .git_global(true)
52
+ .git_exclude(true)
53
+ .follow_links(false)
54
+ .max_depth(Some(40))
55
+ .filter_entry(|entry| {
56
+ let name = entry.file_name().to_string_lossy();
57
+ name != ".git" && name != "node_modules" && name != "dist" && name != "target"
58
+ });
59
+
60
+ let mut searcher = SearcherBuilder::new()
61
+ .binary_detection(grep_searcher::BinaryDetection::quit(b'\x00'))
62
+ .build();
63
+ let mut matches: Vec<SearchMatch> = Vec::new();
64
+ let mut truncated = false;
65
+
66
+ for entry in walker.build() {
67
+ if matches.len() >= max_matches {
68
+ truncated = true;
69
+ break;
70
+ }
71
+ if started.elapsed().as_millis() as u64 > timeout_ms {
72
+ resp.timeout = true;
73
+ truncated = true;
74
+ break;
75
+ }
76
+ let entry = match entry {
77
+ Ok(e) => e,
78
+ Err(_) => {
79
+ bump_skip(&mut resp.skipped, "walk_error");
80
+ continue;
81
+ }
82
+ };
83
+ if !entry.file_type().map(|t| t.is_file()).unwrap_or(false) {
84
+ continue;
85
+ }
86
+ let abs = entry.path();
87
+ let rel = match abs.strip_prefix(root) {
88
+ Ok(p) => p.to_string_lossy().replace('\\', "/"),
89
+ Err(_) => continue,
90
+ };
91
+ if let Some(set) = &exclude {
92
+ if set.is_match(&rel) {
93
+ bump_skip(&mut resp.skipped, "exclude");
94
+ continue;
95
+ }
96
+ }
97
+ if let Some(set) = &include {
98
+ if !set.is_match(&rel) {
99
+ bump_skip(&mut resp.skipped, "include");
100
+ continue;
101
+ }
102
+ }
103
+ let meta = match abs.metadata() {
104
+ Ok(m) => m,
105
+ Err(_) => {
106
+ bump_skip(&mut resp.skipped, "stat");
107
+ continue;
108
+ }
109
+ };
110
+ if meta.len() > max_bytes {
111
+ bump_skip(&mut resp.skipped, "too_large");
112
+ continue;
113
+ }
114
+ resp.scanned.files += 1;
115
+ resp.scanned.bytes += meta.len();
116
+
117
+ let mut per_file = 0usize;
118
+ let rel_for_sink = rel.clone();
119
+ let sink_truncated = std::cell::Cell::new(false);
120
+ let result = searcher.search_path(
121
+ &matcher,
122
+ abs,
123
+ sinks::UTF8(|line_num, line| {
124
+ if matches.len() >= max_matches || per_file >= 50 {
125
+ sink_truncated.set(true);
126
+ return Ok(false);
127
+ }
128
+ let mut col = 1u32;
129
+ if let Ok(Some(m)) = matcher.find(line.as_bytes()) {
130
+ col = (m.start() as u32) + 1;
131
+ }
132
+ matches.push(SearchMatch {
133
+ path: rel_for_sink.clone(),
134
+ line: Some(line_num as u32),
135
+ column: Some(col),
136
+ text: Some(line.chars().take(240).collect()),
137
+ confidence: "text_candidate".to_string(),
138
+ });
139
+ per_file += 1;
140
+ Ok(true)
141
+ }),
142
+ );
143
+ if sink_truncated.get() {
144
+ truncated = true;
145
+ }
146
+ if result.is_err() {
147
+ bump_skip(&mut resp.skipped, "search_error");
148
+ }
149
+ }
150
+
151
+ matches.sort_by(|a, b| {
152
+ a.path
153
+ .cmp(&b.path)
154
+ .then(a.line.unwrap_or(0).cmp(&b.line.unwrap_or(0)))
155
+ .then(a.column.unwrap_or(0).cmp(&b.column.unwrap_or(0)))
156
+ });
157
+ resp.matches = matches;
158
+ resp.truncated = truncated;
159
+ resp.confidence = "text_candidate".to_string();
160
+ resp.duration_ms = started.elapsed().as_millis() as u64;
161
+ resp
162
+ }
163
+
164
+ fn build_globset(patterns: &[String]) -> Option<GlobSet> {
165
+ if patterns.is_empty() {
166
+ return None;
167
+ }
168
+ let mut builder = GlobSetBuilder::new();
169
+ for p in patterns {
170
+ if let Ok(g) = Glob::new(p) {
171
+ builder.add(g);
172
+ }
173
+ }
174
+ builder.build().ok()
175
+ }
@@ -13,7 +13,7 @@ async function runSks(args) {
13
13
  const { rootJsonFastInline } = await import('./fast-inline.js');
14
14
  rootJsonFastInline(fs);
15
15
  }
16
- else if (args[0] === 'doctor' && args.includes('--json') && !args.includes('--report-file') && !args.includes('--fix') && !args.includes('--full') && !args.includes('--capabilities')) {
16
+ else if (args[0] === 'doctor' && args.includes('--json') && !args.includes('--report-file') && !args.includes('--fix') && !args.includes('--full') && !args.includes('--capabilities') && !args.includes('--search')) {
17
17
  const { doctorJsonFastInline } = await import('./fast-inline.js');
18
18
  doctorJsonFastInline();
19
19
  }
@@ -36,9 +36,10 @@ async function runSks(args) {
36
36
  await narutoHelpJsonFastInline();
37
37
  }
38
38
  else if (args[0] === 'help' || args[0] === '--help' || args[0] === '-h') {
39
- if (args.length > 1) {
39
+ const topics = args.slice(1).filter((arg) => arg !== '--help' && arg !== '-h');
40
+ if (topics.length > 0) {
40
41
  const { helpCommand } = await import('../core/commands/basic-cli.js');
41
- await helpCommand(args.slice(1));
42
+ await helpCommand(topics);
42
43
  }
43
44
  else {
44
45
  const { helpFast } = await import('../cli/help-fast.js');
@@ -1,4 +1,5 @@
1
- export const COMMAND_MANIFEST_LITE = [
1
+ import { NARUTO_ACTIONS } from '../core/safety/command-contract/types.js';
2
+ const COMMAND_MANIFEST_LITE_BASE = [
2
3
  { name: 'help', summary: 'Show SKS help', maturity: 'stable', readonly: true, skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
3
4
  { name: 'version', summary: 'Show SKS version', maturity: 'stable', readonly: true, skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
4
5
  { name: 'commands', summary: 'List SKS commands', maturity: 'stable', readonly: true, skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
@@ -31,9 +32,9 @@ export const COMMAND_MANIFEST_LITE = [
31
32
  { name: 'rollback', summary: 'List or apply managed-path rollback actions', maturity: 'beta', skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
32
33
  { name: 'postinstall', summary: 'Run postinstall bootstrap', maturity: 'stable', skipMigrationGate: true },
33
34
  { name: 'codex', summary: 'Check Codex CLI compatibility and vendored hook schemas', maturity: 'beta', skipMigrationGate: true },
34
- { name: 'codex-app', summary: 'Check Codex App readiness', maturity: 'beta' },
35
+ { name: 'codex-app', summary: 'Check Codex App readiness', maturity: 'beta', skipMigrationGate: true },
35
36
  { name: 'codex-native', summary: 'Inspect Codex Native broker and routing readiness', maturity: 'beta' },
36
- { name: 'codex-lb', summary: 'Inspect codex-lb status and circuit health', maturity: 'beta' },
37
+ { name: 'codex-lb', summary: 'Inspect codex-lb status and circuit health', maturity: 'beta', skipMigrationGate: true },
37
38
  { name: 'menubar', summary: 'Inspect/install/restart/uninstall SKS menu bar', maturity: 'beta', skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
38
39
  { name: 'remote', summary: 'Inspect official Remote readiness and run the proof-aware SSH stdio worker', maturity: 'beta' },
39
40
  { name: 'telegram', summary: 'Pair and run the private local Codex Telegram Hub', maturity: 'beta' },
@@ -64,6 +65,7 @@ export const COMMAND_MANIFEST_LITE = [
64
65
  { name: 'computer-use', summary: 'Record native Mac/non-web Computer Use visual evidence', maturity: 'beta', mutatesRouteState: true },
65
66
  { name: 'context7', summary: 'Context7 checks and docs', maturity: 'beta' },
66
67
  { name: 'super-search', summary: 'Run Super-Search provider-independent source intelligence', maturity: 'beta' },
68
+ { name: 'search', summary: 'Local files/text/structure/symbol/context search engines', maturity: 'beta', readonly: true, skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
67
69
  { name: 'recallpulse', summary: 'RecallPulse evidence route', maturity: 'labs' },
68
70
  { name: 'pipeline', summary: 'Inspect pipeline missions', maturity: 'beta', readonly: true, skipMigrationGate: true, allowedDuringActiveRoute: true, diagnostic: true },
69
71
  { name: 'guard', summary: 'Check harness guard', maturity: 'beta' },
@@ -73,7 +75,7 @@ export const COMMAND_MANIFEST_LITE = [
73
75
  { name: 'aliases', summary: 'Show command aliases', maturity: 'stable' },
74
76
  { name: 'selftest', summary: 'Run local mock selftest', maturity: 'stable' },
75
77
  { name: 'goal', summary: 'Print stateless Codex native Goal controls', maturity: 'beta' },
76
- { name: 'seo-geo-optimizer', summary: 'Run unified SEO/GEO optimizer audit/research/strategy/plan/apply/verify with optional --include-marketing on the search-visibility kernel', maturity: 'beta' },
78
+ { name: 'seo-geo-optimizer', summary: 'Run unified SEO/GEO optimizer audit/plan/apply/verify plus research/strategy (--include-marketing) on the search-visibility kernel', maturity: 'beta' },
77
79
  { name: 'hook', summary: 'Codex hook entrypoint', maturity: 'beta', skipMigrationGate: true },
78
80
  { name: 'profile', summary: 'Inspect/set profile', maturity: 'labs' },
79
81
  { name: 'hproof', summary: 'Evaluate H-Proof gate', maturity: 'beta' },
@@ -96,9 +98,178 @@ export const COMMAND_MANIFEST_LITE = [
96
98
  { name: 'all-features', summary: 'Run all-features selftest', maturity: 'beta' },
97
99
  { name: 'perf', summary: 'Run performance checks', maturity: 'beta' },
98
100
  { name: 'bench', summary: 'Run core trust-kernel benchmark budgets', maturity: 'beta' },
99
- { name: 'mcp-server', summary: 'Run a stdio MCP server exposing SKS commands as tools for any MCP-capable agent host', maturity: 'beta', skipMigrationGate: true, allowedDuringActiveRoute: true },
101
+ { name: 'mcp-server', summary: 'Run a stdio MCP server exposing SKS commands as tools for MCP-capable agent hosts', maturity: 'beta', skipMigrationGate: true, allowedDuringActiveRoute: true },
100
102
  { name: 'agent-bridge', summary: 'Publish the agent-bridge manifest and print host registration snippets for external agent systems', maturity: 'beta', readonly: true, diagnostic: true }
101
103
  ];
104
+ const SAFE_COMMAND_CONTRACT_LITE = {
105
+ risk: 'R2',
106
+ latency: 'normal',
107
+ supportsJson: false,
108
+ remoteAllowed: false,
109
+ telegramAllowed: false,
110
+ inputProfile: 'none',
111
+ requiredCapabilities: []
112
+ };
113
+ const COMMAND_CONTRACT_OVERRIDES_LITE = {
114
+ autoresearch: { latency: 'long' },
115
+ bench: { latency: 'long' },
116
+ check: { risk: 'R1', latency: 'long' },
117
+ 'commit-and-push': { risk: 'R3' },
118
+ 'computer-use': { latency: 'long' },
119
+ dfix: { latency: 'long' },
120
+ 'dollar-commands': { risk: 'R2', latency: 'normal' },
121
+ eval: { latency: 'long' },
122
+ gates: {
123
+ risk: 'R1', latency: 'long', supportsJson: true, remoteAllowed: true, telegramAllowed: true,
124
+ inputProfile: 'gates', requiredCapabilities: ['project.git', 'proof.gates']
125
+ },
126
+ harness: { latency: 'long' },
127
+ 'image-ux-review': { latency: 'long' },
128
+ loop: { latency: 'long' },
129
+ 'mad-sks': { risk: 'R3', latency: 'long' },
130
+ mcp: { risk: 'R2', latency: 'long', supportsJson: true, inputProfile: 'json-only' },
131
+ naruto: {
132
+ risk: 'R2', latency: 'long', supportsJson: true, remoteAllowed: false, telegramAllowed: false,
133
+ inputProfile: 'naruto'
134
+ },
135
+ paths: {
136
+ supportsJson: true, remoteAllowed: true, inputProfile: 'paths',
137
+ requiredCapabilities: ['project.fs.read']
138
+ },
139
+ perf: { latency: 'long' },
140
+ pipeline: {
141
+ risk: 'R2', latency: 'normal', supportsJson: true, remoteAllowed: true, inputProfile: 'pipeline-status',
142
+ requiredCapabilities: ['proof.pipeline']
143
+ },
144
+ postinstall: { latency: 'long' },
145
+ ppt: { latency: 'long' },
146
+ proof: {
147
+ risk: 'R0', latency: 'fast', supportsJson: true, remoteAllowed: true, telegramAllowed: true,
148
+ inputProfile: 'proof', requiredCapabilities: ['proof.read']
149
+ },
150
+ 'qa-loop': { latency: 'long' },
151
+ recallpulse: { latency: 'long' },
152
+ release: { risk: 'R1', latency: 'long' },
153
+ remote: { risk: 'R2', latency: 'long', supportsJson: true, remoteAllowed: false, telegramAllowed: false, inputProfile: 'json-only' },
154
+ research: { latency: 'long' },
155
+ review: { risk: 'R1' },
156
+ run: { latency: 'long' },
157
+ search: { risk: 'R0', latency: 'normal', supportsJson: true, remoteAllowed: true, inputProfile: 'json-only' },
158
+ stats: {
159
+ supportsJson: true, remoteAllowed: true, inputProfile: 'stats',
160
+ requiredCapabilities: ['project.fs.read']
161
+ },
162
+ status: {
163
+ supportsJson: true, remoteAllowed: true, telegramAllowed: true, inputProfile: 'json-only',
164
+ requiredCapabilities: ['proof.read']
165
+ },
166
+ 'stop-gate': {
167
+ supportsJson: true, remoteAllowed: true, telegramAllowed: true, inputProfile: 'stop-gate',
168
+ requiredCapabilities: ['proof.stop-gate']
169
+ },
170
+ task: { risk: 'R1', latency: 'long' },
171
+ telegram: { risk: 'R2', latency: 'long', supportsJson: true, remoteAllowed: false, telegramAllowed: false, inputProfile: 'json-only' },
172
+ trust: {
173
+ risk: 'R0', latency: 'fast', supportsJson: true, remoteAllowed: true, telegramAllowed: true,
174
+ inputProfile: 'trust', requiredCapabilities: ['proof.trust']
175
+ },
176
+ uninstall: { risk: 'R3', latency: 'long' },
177
+ update: { latency: 'long' },
178
+ 'update-check': {
179
+ supportsJson: true, remoteAllowed: true, inputProfile: 'json-only',
180
+ requiredCapabilities: ['network.npm.read']
181
+ },
182
+ 'validate-artifacts': {
183
+ risk: 'R1', supportsJson: true, remoteAllowed: true, inputProfile: 'validate-artifacts',
184
+ requiredCapabilities: ['proof.artifacts']
185
+ }
186
+ };
187
+ export const COMMAND_MANIFEST_LITE = COMMAND_MANIFEST_LITE_BASE.map((entry) => ({
188
+ ...SAFE_COMMAND_CONTRACT_LITE,
189
+ ...('readonly' in entry && entry.readonly === true ? { risk: 'R0', latency: 'fast' } : {}),
190
+ ...entry,
191
+ ...(COMMAND_CONTRACT_OVERRIDES_LITE[entry.name] || {})
192
+ }));
193
+ export function commandInputSchema(profile) {
194
+ if (profile === 'json-only')
195
+ return objectSchema({ json: { type: 'boolean' } });
196
+ if (profile === 'naruto') {
197
+ return objectSchema({
198
+ action: { type: 'string', enum: [...NARUTO_ACTIONS] },
199
+ task: boundedString(1, 32_768),
200
+ prompt: boundedString(1, 32_768),
201
+ mission: boundedString(1, 160),
202
+ agents: { type: 'integer', minimum: 1 },
203
+ max_threads: { type: 'integer', minimum: 1 },
204
+ readonly: { type: 'boolean' },
205
+ trusted_project: { type: 'boolean' },
206
+ json: { type: 'boolean' }
207
+ });
208
+ }
209
+ if (profile === 'paths') {
210
+ return objectSchema({
211
+ action: { type: 'string', enum: ['managed', 'git-policy'] },
212
+ json: { type: 'boolean' }
213
+ });
214
+ }
215
+ if (profile === 'pipeline-status') {
216
+ return objectSchema({
217
+ action: { type: 'string', enum: ['status'] },
218
+ json: { type: 'boolean' }
219
+ });
220
+ }
221
+ if (profile === 'stats')
222
+ return objectSchema({ full: { type: 'boolean' }, json: { type: 'boolean' } });
223
+ if (profile === 'stop-gate') {
224
+ return objectSchema({
225
+ route: boundedString(1, 80),
226
+ mission: boundedString(1, 160),
227
+ gate: boundedString(1, 1024),
228
+ json: { type: 'boolean' }
229
+ });
230
+ }
231
+ if (profile === 'proof') {
232
+ return objectSchema({
233
+ action: { type: 'string', enum: ['show', 'latest', 'validate', 'route'] },
234
+ mission: boundedString(1, 160),
235
+ completion: { type: 'boolean' },
236
+ json: { type: 'boolean' }
237
+ });
238
+ }
239
+ if (profile === 'trust') {
240
+ return objectSchema({
241
+ action: { type: 'string', enum: ['report', 'status', 'explain'] },
242
+ mission: boundedString(1, 160),
243
+ json: { type: 'boolean' }
244
+ });
245
+ }
246
+ if (profile === 'gates') {
247
+ return objectSchema({
248
+ target: boundedString(1, 120),
249
+ mode: { type: 'string', enum: ['preset', 'gate'] },
250
+ full: { type: 'boolean' },
251
+ json: { type: 'boolean' }
252
+ });
253
+ }
254
+ if (profile === 'validate-artifacts') {
255
+ return objectSchema({
256
+ mission: boundedString(1, 160),
257
+ required: {
258
+ type: 'array',
259
+ items: boundedString(1, 80),
260
+ maxItems: 32
261
+ },
262
+ json: { type: 'boolean' }
263
+ });
264
+ }
265
+ return objectSchema({});
266
+ }
267
+ function objectSchema(properties) {
268
+ return { type: 'object', properties, additionalProperties: false };
269
+ }
270
+ function boundedString(minLength, maxLength) {
271
+ return { type: 'string', minLength, maxLength };
272
+ }
102
273
  export const LEGACY_COMMAND_ALIASES_LITE = {};
103
274
  export const COMMAND_ALIASES_LITE = {
104
275
  ...LEGACY_COMMAND_ALIASES_LITE,