@skrr-ai/cli 0.1.119 → 0.1.120

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 (276) hide show
  1. package/dist/base-command.d.ts +31 -0
  2. package/dist/base-command.js +106 -4
  3. package/dist/commands/commands.js +11 -0
  4. package/dist/commands/commitments/action-proposal.d.ts +13 -0
  5. package/dist/commands/commitments/action-proposal.js +39 -0
  6. package/dist/commands/commitments/action-proposals/decide.js +8 -1
  7. package/dist/commands/commitments/action-proposals/execute.js +11 -1
  8. package/dist/commands/commitments/create.js +2 -2
  9. package/dist/commands/commitments/doctor.d.ts +8 -0
  10. package/dist/commands/commitments/doctor.js +22 -0
  11. package/dist/commands/commitments/execute-remediation.js +12 -1
  12. package/dist/commands/commitments/observations.js +2 -2
  13. package/dist/commands/commitments/pack/bind.d.ts +18 -1
  14. package/dist/commands/commitments/pack/bind.js +66 -8
  15. package/dist/commands/commitments/pack/plan.d.ts +4 -1
  16. package/dist/commands/commitments/pack/plan.js +30 -2
  17. package/dist/commands/commitments/update.js +8 -2
  18. package/dist/commands/completion/index.js +1 -1
  19. package/dist/commands/completion/values.js +1 -1
  20. package/dist/commands/computer-use/audio.d.ts +1 -0
  21. package/dist/commands/computer-use/audio.js +1 -0
  22. package/dist/commands/computer-use/browser.d.ts +1 -0
  23. package/dist/commands/computer-use/browser.js +1 -0
  24. package/dist/commands/computer-use/disable.d.ts +1 -0
  25. package/dist/commands/computer-use/disable.js +1 -0
  26. package/dist/commands/computer-use/enable.d.ts +1 -0
  27. package/dist/commands/computer-use/enable.js +1 -0
  28. package/dist/commands/computer-use/index.d.ts +1 -0
  29. package/dist/commands/computer-use/index.js +1 -0
  30. package/dist/commands/computer-use/install.d.ts +1 -0
  31. package/dist/commands/computer-use/install.js +1 -0
  32. package/dist/commands/computer-use/recover.d.ts +1 -0
  33. package/dist/commands/computer-use/recover.js +1 -0
  34. package/dist/commands/computer-use/status.d.ts +1 -0
  35. package/dist/commands/computer-use/status.js +1 -0
  36. package/dist/commands/computer-use/stop.d.ts +1 -0
  37. package/dist/commands/computer-use/stop.js +1 -0
  38. package/dist/commands/context.js +16 -11
  39. package/dist/commands/convos/recovery.js +1 -1
  40. package/dist/commands/daemon/diagnostics.d.ts +9 -0
  41. package/dist/commands/daemon/diagnostics.js +53 -0
  42. package/dist/commands/daemon/index.js +2 -0
  43. package/dist/commands/daemon/maintenance/attest.d.ts +15 -0
  44. package/dist/commands/daemon/maintenance/attest.js +52 -0
  45. package/dist/commands/daemon/maintenance/hold.d.ts +17 -0
  46. package/dist/commands/daemon/maintenance/hold.js +70 -0
  47. package/dist/commands/daemon/maintenance/index.d.ts +12 -0
  48. package/dist/commands/daemon/maintenance/index.js +30 -0
  49. package/dist/commands/daemon/maintenance/resume.d.ts +13 -0
  50. package/dist/commands/daemon/maintenance/resume.js +36 -0
  51. package/dist/commands/daemon/maintenance/status.d.ts +13 -0
  52. package/dist/commands/daemon/maintenance/status.js +36 -0
  53. package/dist/commands/doctor.d.ts +4 -1
  54. package/dist/commands/doctor.js +50 -6
  55. package/dist/commands/followups/plans/cancel-batch.js +6 -3
  56. package/dist/commands/followups/plans/capacity.js +7 -3
  57. package/dist/commands/followups/plans/observability.js +11 -3
  58. package/dist/commands/followups/plans/preferences/set.js +26 -8
  59. package/dist/commands/followups/plans/preferences.js +1 -1
  60. package/dist/commands/followups/plans/show.js +1 -1
  61. package/dist/commands/goals/key-results/assess.d.ts +36 -0
  62. package/dist/commands/goals/key-results/assess.js +110 -0
  63. package/dist/commands/goals/key-results/history.d.ts +30 -0
  64. package/dist/commands/goals/key-results/history.js +104 -0
  65. package/dist/commands/goals/key-results/list.d.ts +5 -4
  66. package/dist/commands/goals/key-results/list.js +12 -6
  67. package/dist/commands/goals/key-results/show.d.ts +4 -2
  68. package/dist/commands/goals/key-results/show.js +25 -4
  69. package/dist/commands/goals/key-results/update.d.ts +4 -0
  70. package/dist/commands/goals/key-results/update.js +18 -24
  71. package/dist/commands/goals/plan-now.js +12 -1
  72. package/dist/commands/goals/planner-compare.d.ts +30 -0
  73. package/dist/commands/goals/planner-compare.js +136 -0
  74. package/dist/commands/machines/dedicated/service/exec.d.ts +3 -0
  75. package/dist/commands/machines/dedicated/service/exec.js +70 -11
  76. package/dist/commands/machines/hosted/destroy.d.ts +1 -0
  77. package/dist/commands/machines/hosted/destroy.js +11 -1
  78. package/dist/commands/machines/hosted/exec.d.ts +1 -0
  79. package/dist/commands/machines/hosted/exec.js +12 -1
  80. package/dist/commands/machines/hosted/index.js +1 -0
  81. package/dist/commands/machines/hosted/operation.d.ts +14 -0
  82. package/dist/commands/machines/hosted/operation.js +51 -0
  83. package/dist/commands/machines/hosted/pull.js +1 -1
  84. package/dist/commands/machines/hosted/start.js +6 -2
  85. package/dist/commands/spaces/auto-executor/compare.d.ts +18 -0
  86. package/dist/commands/spaces/auto-executor/compare.js +139 -0
  87. package/dist/commands/spaces/auto-executor/runs.d.ts +3 -0
  88. package/dist/commands/spaces/auto-executor/runs.js +13 -1
  89. package/dist/commands/spaces/charter/create-from-description.d.ts +21 -0
  90. package/dist/commands/spaces/charter/create-from-description.js +77 -0
  91. package/dist/commands/spaces/charter/show.d.ts +22 -0
  92. package/dist/commands/spaces/charter/show.js +61 -0
  93. package/dist/commands/spaces/heartbeats/list.d.ts +1 -16
  94. package/dist/commands/spaces/heartbeats/list.js +13 -0
  95. package/dist/commands/spaces/install-template.js +3 -0
  96. package/dist/commands/spaces/loops/migrate.d.ts +32 -0
  97. package/dist/commands/spaces/loops/migrate.js +103 -0
  98. package/dist/commands/spaces/loops/release.d.ts +14 -0
  99. package/dist/commands/spaces/loops/release.js +59 -0
  100. package/dist/commands/spaces/notebook.d.ts +25 -0
  101. package/dist/commands/spaces/notebook.js +75 -0
  102. package/dist/commands/spaces/proposals/discard.d.ts +17 -0
  103. package/dist/commands/spaces/proposals/discard.js +17 -0
  104. package/dist/commands/spaces/proposals/keep.d.ts +17 -0
  105. package/dist/commands/spaces/proposals/keep.js +17 -0
  106. package/dist/commands/spaces/proposals/list.d.ts +24 -0
  107. package/dist/commands/spaces/proposals/list.js +89 -0
  108. package/dist/commands/spaces/skills/propose.d.ts +29 -0
  109. package/dist/commands/spaces/skills/propose.js +82 -0
  110. package/dist/commands/spaces/templates/fork.js +3 -0
  111. package/dist/commands/spaces/triggers/show.js +6 -0
  112. package/dist/commands/spaces/workflows/retry.d.ts +1 -0
  113. package/dist/commands/spaces/workflows/retry.js +8 -1
  114. package/dist/commands/spaces/workflows/triggers/create.js +3 -2
  115. package/dist/commands/spaces/workflows/triggers/fire.js +4 -0
  116. package/dist/commands/spaces/workflows/triggers/update.js +2 -1
  117. package/dist/commands/spaces/write-policy/set.d.ts +22 -0
  118. package/dist/commands/spaces/write-policy/set.js +82 -0
  119. package/dist/commands/spaces/write-policy/show.d.ts +19 -0
  120. package/dist/commands/spaces/write-policy/show.js +49 -0
  121. package/dist/commands/store/artifacts/receipt.d.ts +14 -0
  122. package/dist/commands/store/artifacts/receipt.js +34 -0
  123. package/dist/commands/store/artifacts/release.d.ts +2 -0
  124. package/dist/commands/store/artifacts/release.js +11 -0
  125. package/dist/commands/store/governance/publish-release.d.ts +2 -0
  126. package/dist/commands/store/governance/publish-release.js +30 -1
  127. package/dist/commands/store/governance/release-receipt.d.ts +12 -0
  128. package/dist/commands/store/governance/release-receipt.js +32 -0
  129. package/dist/commands/tasks/approvals/list.d.ts +11 -5
  130. package/dist/commands/tasks/approvals/list.js +13 -6
  131. package/dist/commands/tasks/attachments/facts.d.ts +12 -0
  132. package/dist/commands/tasks/attachments/facts.js +29 -0
  133. package/dist/commands/tasks/attachments/upload.d.ts +1 -0
  134. package/dist/commands/tasks/attachments/upload.js +16 -0
  135. package/dist/commands/tasks/bulk-update.js +35 -1
  136. package/dist/commands/tasks/context.d.ts +15 -0
  137. package/dist/commands/tasks/context.js +69 -0
  138. package/dist/commands/tasks/copy.d.ts +18 -0
  139. package/dist/commands/tasks/copy.js +85 -0
  140. package/dist/commands/tasks/create-tree.js +97 -23
  141. package/dist/commands/tasks/create.js +9 -1
  142. package/dist/commands/tasks/deliverable/add.js +20 -10
  143. package/dist/commands/tasks/move.js +8 -1
  144. package/dist/commands/tasks/operations/show.d.ts +16 -0
  145. package/dist/commands/tasks/operations/show.js +98 -0
  146. package/dist/commands/tasks/operations/wait.d.ts +22 -0
  147. package/dist/commands/tasks/operations/wait.js +114 -0
  148. package/dist/commands/tasks/preflight.d.ts +1 -0
  149. package/dist/commands/tasks/preflight.js +11 -1
  150. package/dist/commands/tasks/rearm-recurrence.js +4 -0
  151. package/dist/commands/tasks/result/show.js +22 -0
  152. package/dist/commands/tasks/result/submit.d.ts +1 -0
  153. package/dist/commands/tasks/result/submit.js +3 -0
  154. package/dist/commands/tasks/retry-receipt.d.ts +15 -0
  155. package/dist/commands/tasks/retry-receipt.js +89 -0
  156. package/dist/commands/tasks/retry-review.d.ts +16 -0
  157. package/dist/commands/tasks/retry-review.js +66 -0
  158. package/dist/commands/tasks/retry.d.ts +4 -8
  159. package/dist/commands/tasks/retry.js +34 -68
  160. package/dist/commands/tasks/runs.d.ts +21 -0
  161. package/dist/commands/tasks/runs.js +95 -0
  162. package/dist/commands/tasks/show.d.ts +2 -0
  163. package/dist/commands/tasks/show.js +15 -1
  164. package/dist/commands/tasks/start-receipt.d.ts +15 -0
  165. package/dist/commands/tasks/start-receipt.js +95 -0
  166. package/dist/commands/tasks/start.d.ts +4 -0
  167. package/dist/commands/tasks/start.js +49 -3
  168. package/dist/commands/tasks/update.js +3 -0
  169. package/dist/commands/tasks/upsert.js +17 -3
  170. package/dist/commands/tasks/watch.d.ts +3 -0
  171. package/dist/commands/tasks/watch.js +85 -20
  172. package/dist/commands/wiki/history.d.ts +33 -0
  173. package/dist/commands/wiki/history.js +134 -0
  174. package/dist/commands/wiki/ls.d.ts +2 -0
  175. package/dist/commands/wiki/ls.js +8 -0
  176. package/dist/commands/wiki/update.d.ts +3 -1
  177. package/dist/commands/wiki/update.js +24 -2
  178. package/dist/commands/wiki/write.d.ts +22 -0
  179. package/dist/commands/wiki/write.js +144 -6
  180. package/dist/generated/agent-guides.json +81 -81
  181. package/dist/generated/managed-instruction-guides.json +1 -1
  182. package/dist/lib/agent-guides.d.ts +9 -0
  183. package/dist/lib/agent-guides.js +23 -1
  184. package/dist/lib/agentic-stream.d.ts +5 -0
  185. package/dist/lib/agentic-stream.js +122 -3
  186. package/dist/lib/auth-diagnostics.d.ts +39 -0
  187. package/dist/lib/auth-diagnostics.js +71 -0
  188. package/dist/lib/cli-client-identity.d.ts +6 -0
  189. package/dist/lib/cli-client-identity.js +16 -0
  190. package/dist/lib/cli-installation-diagnostics.d.ts +52 -0
  191. package/dist/lib/cli-installation-diagnostics.js +254 -0
  192. package/dist/lib/command-hygiene.d.ts +45 -0
  193. package/dist/lib/command-hygiene.js +413 -0
  194. package/dist/lib/commitments.d.ts +64 -3
  195. package/dist/lib/commitments.js +34 -6
  196. package/dist/lib/completion-index.d.ts +16 -4
  197. package/dist/lib/completion-index.js +50 -14
  198. package/dist/lib/config.js +7 -1
  199. package/dist/lib/daemon-maintenance-command.d.ts +22 -0
  200. package/dist/lib/daemon-maintenance-command.js +39 -0
  201. package/dist/lib/daemon-maintenance.d.ts +275 -0
  202. package/dist/lib/daemon-maintenance.js +1035 -0
  203. package/dist/lib/dedicated-service.d.ts +3 -2
  204. package/dist/lib/dedicated-service.js +11 -3
  205. package/dist/lib/governed-store.d.ts +8 -0
  206. package/dist/lib/governed-store.js +5 -0
  207. package/dist/lib/hosted-machines.d.ts +33 -2
  208. package/dist/lib/hosted-machines.js +19 -1
  209. package/dist/lib/json-output.d.ts +1 -1
  210. package/dist/lib/machines.d.ts +9 -1
  211. package/dist/lib/machines.js +15 -1
  212. package/dist/lib/node-adapter.js +13 -0
  213. package/dist/lib/record-output.d.ts +22 -0
  214. package/dist/lib/record-output.js +78 -0
  215. package/dist/lib/roles.d.ts +3 -3
  216. package/dist/lib/scoped-memory-command.d.ts +18 -0
  217. package/dist/lib/scoped-memory-command.js +53 -2
  218. package/dist/lib/space-charter.d.ts +49 -0
  219. package/dist/lib/space-charter.js +78 -0
  220. package/dist/lib/space-loop-migration.d.ts +18 -0
  221. package/dist/lib/space-loop-migration.js +128 -0
  222. package/dist/lib/space-notebook.d.ts +22 -0
  223. package/dist/lib/space-notebook.js +140 -0
  224. package/dist/lib/space-proposal-decision-command.d.ts +36 -0
  225. package/dist/lib/space-proposal-decision-command.js +108 -0
  226. package/dist/lib/space-proposals.d.ts +44 -0
  227. package/dist/lib/space-proposals.js +186 -0
  228. package/dist/lib/space-templates.d.ts +8 -0
  229. package/dist/lib/space-templates.js +17 -0
  230. package/dist/lib/space-write-policy.d.ts +24 -0
  231. package/dist/lib/space-write-policy.js +103 -0
  232. package/dist/lib/task-agent-context-capabilities.d.ts +10 -0
  233. package/dist/lib/task-agent-context-capabilities.js +22 -0
  234. package/dist/lib/task-agent-context-compatibility.d.ts +9 -0
  235. package/dist/lib/task-agent-context-compatibility.js +30 -0
  236. package/dist/lib/task-asset-upload.d.ts +22 -0
  237. package/dist/lib/task-asset-upload.js +257 -29
  238. package/dist/lib/task-batch.d.ts +15 -1
  239. package/dist/lib/task-batch.js +35 -2
  240. package/dist/lib/task-operation-watch.d.ts +66 -0
  241. package/dist/lib/task-operation-watch.js +159 -0
  242. package/dist/lib/task-resolver.d.ts +1 -1
  243. package/dist/lib/task-resolver.js +4 -3
  244. package/dist/lib/task-work.d.ts +1 -1
  245. package/dist/lib/task-work.js +35 -1
  246. package/dist/lib/task-write-attribution.d.ts +14 -0
  247. package/dist/lib/task-write-attribution.js +35 -2
  248. package/dist/lib/triggers.d.ts +11 -0
  249. package/dist/lib/triggers.js +7 -0
  250. package/dist/lib/wiki-update.d.ts +1 -0
  251. package/dist/lib/wiki-update.js +10 -1
  252. package/dist/lib/wiki.js +4 -1
  253. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +9 -1
  254. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +31 -15
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +1 -0
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +13 -7
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.d.ts +370 -0
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +315 -0
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.d.ts +178 -0
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.js +262 -0
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +51 -0
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +106 -0
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +9 -1
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +32 -5
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +1 -0
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +33 -14
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.d.ts +370 -0
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +404 -0
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.d.ts +178 -0
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.js +342 -0
  271. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +51 -0
  272. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +138 -0
  273. package/dist/node_modules/@skrr-ai/auth-core/package.json +20 -0
  274. package/dist/node_modules/@skrr-ai/data-provider/index.js +27085 -20250
  275. package/oclif.manifest.json +10566 -7247
  276. package/package.json +20 -2
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.inspectCliInstallations = inspectCliInstallations;
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
39
+ const update_check_1 = require("./update-check");
40
+ const CLI_PACKAGE_NAME = '@skrr-ai/cli';
41
+ /**
42
+ * Inspect executable paths without ever starting another CLI.
43
+ *
44
+ * `doctor` is often invoked because PATH is already suspect. Running each
45
+ * discovered `skrr --version` would make the report execute an arbitrary
46
+ * shadowing binary. This reader follows symlinks and reads package metadata
47
+ * only; a candidate that cannot prove it belongs to this CLI is reported as
48
+ * unrecognised rather than trusted.
49
+ */
50
+ function inspectCliInstallations(options = {}) {
51
+ const env = options.env ?? process.env;
52
+ const platform = options.platform ?? process.platform;
53
+ const activeRoot = options.activeRoot ? canonicalPath(options.activeRoot) : null;
54
+ const activeEntry = options.activeEntry ?? process.argv[1] ?? null;
55
+ const locations = executableLocations({
56
+ activeEntry,
57
+ pathValue: env.PATH ?? '',
58
+ platform,
59
+ wellKnownPaths: options.wellKnownPaths ?? defaultWellKnownPaths(env, platform),
60
+ });
61
+ const candidates = new Map();
62
+ const unrecognisedExecutables = [];
63
+ // A source checkout may be invoked through node, Jest, or a development
64
+ // wrapper rather than an executable named `skrr`. Its configured root is the
65
+ // reliable active fact, so inspect it independently from PATH discovery.
66
+ if (activeRoot) {
67
+ const activePackage = readCliPackage(activeRoot, true);
68
+ if (activePackage) {
69
+ addCandidate(candidates, activePackage, {
70
+ path: activeEntry ?? path.join(activeRoot, 'bin', 'run.js'),
71
+ realPath: activeEntry ? realPath(activeEntry) : null,
72
+ source: 'active',
73
+ pathPrecedence: null,
74
+ }, env);
75
+ }
76
+ }
77
+ for (const location of locations) {
78
+ const packageInfo = readCliPackage(location.path);
79
+ if (!packageInfo) {
80
+ if (location.source !== 'active' && isExecutable(location.path, platform)) {
81
+ unrecognisedExecutables.push({
82
+ path: location.path,
83
+ realPath: realPath(location.path),
84
+ source: location.source,
85
+ pathPrecedence: location.pathPrecedence,
86
+ });
87
+ }
88
+ continue;
89
+ }
90
+ addCandidate(candidates, packageInfo, location, env);
91
+ }
92
+ const rows = [...candidates.values()]
93
+ .map((candidate) => ({
94
+ paths: [...candidate.paths],
95
+ realPath: candidate.realPath,
96
+ packageRoot: candidate.packageRoot,
97
+ version: candidate.version,
98
+ owner: candidate.owner,
99
+ updateCommand: candidate.updateCommand,
100
+ sources: sourceOrder([...candidate.sources]),
101
+ pathPrecedence: candidate.pathPrecedence,
102
+ active: candidate.active,
103
+ }))
104
+ .sort(compareCandidates);
105
+ const active = rows.find((candidate) => candidate.active) ?? null;
106
+ const pathVersions = [...new Set(rows
107
+ .filter((candidate) => candidate.pathPrecedence !== null)
108
+ .sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) - (b.pathPrecedence ?? Number.MAX_SAFE_INTEGER))
109
+ .map((candidate) => candidate.version))];
110
+ const hasVersionDrift = pathVersions.length > 1;
111
+ return {
112
+ active,
113
+ candidates: rows,
114
+ unrecognisedExecutables,
115
+ pathVersions,
116
+ hasVersionDrift,
117
+ remedy: hasVersionDrift ? versionDriftRemedy(rows, active) : null,
118
+ };
119
+ }
120
+ function addCandidate(candidates, packageInfo, location, env) {
121
+ const key = packageInfo.packageRoot;
122
+ const existing = candidates.get(key);
123
+ const install = existing
124
+ ? null
125
+ : (0, update_check_1.classifyCliInstall)(env, [process.execPath, location.path], null, false);
126
+ const candidate = existing ?? {
127
+ paths: new Set(),
128
+ realPath: location.realPath,
129
+ packageRoot: packageInfo.packageRoot,
130
+ version: packageInfo.version,
131
+ // Read-only classification: doctor never creates a write-probe just to
132
+ // identify an installation.
133
+ owner: install.kind,
134
+ updateCommand: (0, update_check_1.cliUpdateCommand)(install.kind, install.npmPrefix),
135
+ sources: new Set(),
136
+ pathPrecedence: location.pathPrecedence,
137
+ active: false,
138
+ };
139
+ if (!existing)
140
+ candidates.set(key, candidate);
141
+ candidate.paths.add(location.path);
142
+ if (!candidate.realPath && location.realPath)
143
+ candidate.realPath = location.realPath;
144
+ candidate.sources.add(location.source);
145
+ candidate.active ||= location.source === 'active';
146
+ if (location.pathPrecedence !== null &&
147
+ (candidate.pathPrecedence === null || location.pathPrecedence < candidate.pathPrecedence)) {
148
+ candidate.pathPrecedence = location.pathPrecedence;
149
+ }
150
+ }
151
+ function executableLocations(options) {
152
+ const names = options.platform === 'win32' ? ['skrr.exe', 'skrr.cmd'] : ['skrr'];
153
+ const locations = [];
154
+ if (options.activeEntry) {
155
+ locations.push({ path: options.activeEntry, realPath: realPath(options.activeEntry), source: 'active', pathPrecedence: null });
156
+ }
157
+ const seenPath = new Set();
158
+ for (const [index, directory] of options.pathValue.split(path.delimiter).entries()) {
159
+ if (!directory)
160
+ continue;
161
+ for (const name of names) {
162
+ const candidate = path.resolve(directory, name);
163
+ if (!isExecutable(candidate, options.platform) || seenPath.has(candidate))
164
+ continue;
165
+ seenPath.add(candidate);
166
+ locations.push({ path: candidate, realPath: realPath(candidate), source: 'path', pathPrecedence: index });
167
+ }
168
+ }
169
+ for (const candidate of options.wellKnownPaths) {
170
+ const resolved = path.resolve(candidate);
171
+ if (!isExecutable(resolved, options.platform) || seenPath.has(resolved))
172
+ continue;
173
+ seenPath.add(resolved);
174
+ locations.push({ path: resolved, realPath: realPath(resolved), source: 'well_known', pathPrecedence: null });
175
+ }
176
+ return locations;
177
+ }
178
+ function defaultWellKnownPaths(env, platform) {
179
+ if (platform === 'win32')
180
+ return [];
181
+ const home = env.HOME?.trim();
182
+ return [
183
+ ...(home ? [path.join(home, '.local', 'bin', 'skrr')] : []),
184
+ '/opt/homebrew/bin/skrr',
185
+ '/usr/local/bin/skrr',
186
+ ];
187
+ }
188
+ function readCliPackage(entry, allowPackageRoot = false) {
189
+ let current = canonicalPath(entry);
190
+ try {
191
+ if (!allowPackageRoot || !fs.statSync(current).isDirectory())
192
+ current = path.dirname(current);
193
+ }
194
+ catch {
195
+ current = path.dirname(current);
196
+ }
197
+ while (true) {
198
+ try {
199
+ const pkg = JSON.parse(fs.readFileSync(path.join(current, 'package.json'), 'utf8'));
200
+ if (pkg.name === CLI_PACKAGE_NAME && typeof pkg.version === 'string' && pkg.version.trim()) {
201
+ return { packageRoot: canonicalPath(current), version: pkg.version };
202
+ }
203
+ }
204
+ catch {
205
+ // A wrapper that does not prove its package must not be treated as skrr.
206
+ }
207
+ const parent = path.dirname(current);
208
+ if (parent === current)
209
+ return null;
210
+ current = parent;
211
+ }
212
+ }
213
+ function realPath(value) {
214
+ try {
215
+ return fs.realpathSync(value);
216
+ }
217
+ catch {
218
+ return null;
219
+ }
220
+ }
221
+ function canonicalPath(value) {
222
+ return realPath(value) ?? path.resolve(value);
223
+ }
224
+ function isExecutable(candidate, platform) {
225
+ try {
226
+ fs.accessSync(candidate, platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK);
227
+ return true;
228
+ }
229
+ catch {
230
+ return false;
231
+ }
232
+ }
233
+ function sourceOrder(sources) {
234
+ const order = ['active', 'path', 'well_known'];
235
+ return order.filter((source) => sources.includes(source));
236
+ }
237
+ function compareCandidates(a, b) {
238
+ if (a.active !== b.active)
239
+ return a.active ? -1 : 1;
240
+ const aPrecedence = a.pathPrecedence ?? Number.MAX_SAFE_INTEGER;
241
+ const bPrecedence = b.pathPrecedence ?? Number.MAX_SAFE_INTEGER;
242
+ return aPrecedence - bPrecedence || a.packageRoot.localeCompare(b.packageRoot);
243
+ }
244
+ function versionDriftRemedy(candidates, active) {
245
+ const pathCandidates = candidates
246
+ .filter((candidate) => candidate.pathPrecedence !== null)
247
+ .sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) - (b.pathPrecedence ?? Number.MAX_SAFE_INTEGER));
248
+ const selected = pathCandidates[0] ?? active;
249
+ if (!selected)
250
+ return 'Inspect the skrr entries on PATH, update the intended installation, then re-run `skrr doctor`.';
251
+ return (`PATH selects ${selected.paths[0]} (v${selected.version}). Update the installation you intend to keep with ` +
252
+ `\`${selected.updateCommand}\`, then remove or reorder the other skrr entries using their owning package manager. ` +
253
+ 'No PATH changes were made. Verify with `skrr update --component cli --check` and `skrr doctor`.');
254
+ }
@@ -28,8 +28,52 @@ export type CommandHygieneReport = {
28
28
  };
29
29
  /** The verb rules the findings below are measured against (P8). */
30
30
  namingGrammar: readonly string[];
31
+ /** A reviewable, report-only inventory for high-side-effect CLI flows. */
32
+ execution: ExecutionContractReport;
31
33
  issues: CommandHygieneIssue[];
32
34
  };
35
+ type ExecutionRequirement = 'operationIdentifier' | 'receipt' | 'recovery' | 'machineState' | 'idempotency';
36
+ type ExecutionRequirementStatus = 'provided' | 'missing' | 'not_applicable';
37
+ type ExecutionRequirementAssessment = {
38
+ status: ExecutionRequirementStatus;
39
+ /** A source-level fact, or the bounded change needed to close a gap. */
40
+ note: string;
41
+ };
42
+ type HighSideEffectCommand = {
43
+ command: string;
44
+ effect: 'remote_execution' | 'machine_lifecycle' | 'durable_execution' | 'automation_control' | 'release_publication';
45
+ owner: string;
46
+ priority: 'P0' | 'P1' | 'P2';
47
+ requirements: Readonly<Record<ExecutionRequirement, ExecutionRequirementAssessment>>;
48
+ };
49
+ type HumanOnlyExemption = {
50
+ command: string;
51
+ effect: 'credential_issuance';
52
+ /** Why a receipt would be unsafe or misleading for this command. */
53
+ reason: string;
54
+ /** The policy/document a reviewer must re-check before changing the exemption. */
55
+ reviewedEvidence: string;
56
+ };
57
+ export type ExecutionContractReport = {
58
+ /** Commands in the current source/manifest that matched the guarded vocabulary. */
59
+ candidates: number;
60
+ classified: number;
61
+ humanOnlyExemptions: number;
62
+ missingOperationIdentifiers: number;
63
+ missingReceipts: number;
64
+ missingRecoveryGuidance: number;
65
+ missingMachineStateOutputs: number;
66
+ missingIdempotencyBehavior: number;
67
+ contracts: Array<{
68
+ command: string;
69
+ effect: HighSideEffectCommand['effect'];
70
+ owner: string;
71
+ priority: HighSideEffectCommand['priority'];
72
+ requirements: HighSideEffectCommand['requirements'];
73
+ }>;
74
+ exemptions: HumanOnlyExemption[];
75
+ unclassified: string[];
76
+ };
33
77
  export declare function auditCommands({ rootDir, manifest, }: {
34
78
  rootDir: string;
35
79
  /**
@@ -50,3 +94,4 @@ export declare const ENFORCED_HYGIENE_DOMAINS: readonly ["tasks", "spaces", "pro
50
94
  * report sees the rule and not only the findings it produced.
51
95
  */
52
96
  export declare const NAMING_GRAMMAR: readonly ["Verbs: list, show, create, update, delete, archive, unarchive, move. A reversible state flip is its own verb, never a flag on its inverse.", "Scope: a list verb takes its parent scope as an optional filter flag; a verb that cannot work without a scope says so in its description.", "Output: every command in tasks, spaces and projects takes --json and has a description (audit errors)."];
97
+ export {};