@skrr-ai/cli 0.1.92 → 0.1.94

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 (323) hide show
  1. package/dist/base-command.d.ts +44 -0
  2. package/dist/base-command.js +96 -0
  3. package/dist/commands/agents/badge.d.ts +41 -0
  4. package/dist/commands/agents/badge.js +158 -0
  5. package/dist/commands/agents/create.d.ts +24 -0
  6. package/dist/commands/agents/create.js +212 -0
  7. package/dist/commands/agents/embed.d.ts +20 -0
  8. package/dist/commands/agents/embed.js +61 -0
  9. package/dist/commands/agents/operating-plan.d.ts +11 -0
  10. package/dist/commands/agents/operating-plan.js +54 -0
  11. package/dist/commands/agents/roles/example.d.ts +11 -0
  12. package/dist/commands/agents/roles/example.js +30 -0
  13. package/dist/commands/{commitments/mode.d.ts → agents/roles/export.d.ts} +5 -5
  14. package/dist/commands/agents/roles/export.js +81 -0
  15. package/dist/commands/agents/roles/install.d.ts +12 -0
  16. package/dist/commands/agents/roles/install.js +48 -0
  17. package/dist/commands/agents/roles/list.d.ts +11 -0
  18. package/dist/commands/agents/roles/list.js +36 -0
  19. package/dist/commands/agents/roles/preview.d.ts +14 -0
  20. package/dist/commands/agents/roles/preview.js +49 -0
  21. package/dist/commands/agents/roles/withdraw.d.ts +13 -0
  22. package/dist/commands/agents/roles/withdraw.js +43 -0
  23. package/dist/commands/agents/share.d.ts +27 -0
  24. package/dist/commands/agents/share.js +100 -0
  25. package/dist/commands/agents/vanity.d.ts +21 -0
  26. package/dist/commands/agents/vanity.js +77 -0
  27. package/dist/commands/agents/visibility.d.ts +21 -1
  28. package/dist/commands/agents/visibility.js +112 -0
  29. package/dist/commands/commands.d.ts +1 -0
  30. package/dist/commands/commands.js +22 -9
  31. package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.d.ts +5 -7
  32. package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.js +13 -15
  33. package/dist/commands/commitments/cost.d.ts +1 -1
  34. package/dist/commands/commitments/cost.js +1 -1
  35. package/dist/commands/commitments/create.d.ts +0 -7
  36. package/dist/commands/commitments/create.js +9 -98
  37. package/dist/commands/commitments/delivery.js +3 -21
  38. package/dist/commands/commitments/doctor.js +28 -27
  39. package/dist/commands/commitments/effective-policy.js +5 -36
  40. package/dist/commands/commitments/evaluations.d.ts +15 -0
  41. package/dist/commands/commitments/evaluations.js +54 -0
  42. package/dist/commands/commitments/pack/activate.d.ts +11 -0
  43. package/dist/commands/commitments/pack/activate.js +22 -0
  44. package/dist/commands/commitments/pack/bind.js +1 -1
  45. package/dist/commands/commitments/remediate.js +2 -5
  46. package/dist/commands/commitments/show.js +1 -1
  47. package/dist/commands/commitments/update.js +9 -9
  48. package/dist/commands/commitments/wake-capabilities.d.ts +1 -3
  49. package/dist/commands/commitments/wake-capabilities.js +5 -21
  50. package/dist/commands/earnings/attributions.d.ts +17 -0
  51. package/dist/commands/earnings/attributions.js +82 -0
  52. package/dist/commands/earnings/index.js +2 -1
  53. package/dist/commands/generate-recovery-code.js +4 -3
  54. package/dist/commands/github/allow-tools.d.ts +1 -0
  55. package/dist/commands/github/app/install.d.ts +1 -0
  56. package/dist/commands/github/app/status.d.ts +1 -0
  57. package/dist/commands/github/connect.d.ts +1 -0
  58. package/dist/commands/github/connections.d.ts +1 -0
  59. package/dist/commands/github/disconnect.d.ts +1 -0
  60. package/dist/commands/github/finalize.d.ts +1 -0
  61. package/dist/commands/github/reconnect.d.ts +1 -0
  62. package/dist/commands/github/run.d.ts +1 -0
  63. package/dist/commands/github/tools.d.ts +1 -0
  64. package/dist/commands/integrations/connections/connect.d.ts +1 -0
  65. package/dist/commands/integrations/connections/disconnect.d.ts +1 -0
  66. package/dist/commands/integrations/connections/finalize.d.ts +1 -0
  67. package/dist/commands/integrations/connections/list.d.ts +1 -0
  68. package/dist/commands/integrations/connections/reconnect.d.ts +1 -0
  69. package/dist/commands/integrations/execute.d.ts +1 -0
  70. package/dist/commands/integrations/search.d.ts +1 -0
  71. package/dist/commands/integrations/toolkits.d.ts +1 -0
  72. package/dist/commands/integrations/tools/allow.d.ts +1 -0
  73. package/dist/commands/integrations/tools/list.d.ts +1 -0
  74. package/dist/commands/login.js +12 -0
  75. package/dist/commands/machines/dedicated/logs.d.ts +19 -0
  76. package/dist/commands/machines/dedicated/logs.js +103 -0
  77. package/dist/commands/machines/dedicated/power/set.js +1 -1
  78. package/dist/commands/open.d.ts +24 -0
  79. package/dist/commands/open.js +74 -0
  80. package/dist/commands/projects/archive.d.ts +1 -0
  81. package/dist/commands/projects/archive.js +23 -0
  82. package/dist/commands/projects/delete.d.ts +1 -0
  83. package/dist/commands/projects/delete.js +23 -0
  84. package/dist/commands/projects/list.d.ts +3 -0
  85. package/dist/commands/projects/list.js +12 -2
  86. package/dist/commands/spaces/actions/add.js +4 -3
  87. package/dist/commands/spaces/actions/available.js +3 -2
  88. package/dist/commands/spaces/actions/list.js +5 -4
  89. package/dist/commands/spaces/actions/replace.js +6 -5
  90. package/dist/commands/spaces/archive.js +3 -2
  91. package/dist/commands/spaces/auto-executor/preview.js +4 -3
  92. package/dist/commands/spaces/auto-executor/run.js +4 -3
  93. package/dist/commands/spaces/auto-executor/runs.js +3 -2
  94. package/dist/commands/spaces/auto-executor/update.js +4 -3
  95. package/dist/commands/spaces/bootstrap.js +3 -2
  96. package/dist/commands/spaces/briefs/delete.js +3 -2
  97. package/dist/commands/spaces/briefs/get.js +3 -2
  98. package/dist/commands/spaces/briefs/list.js +3 -2
  99. package/dist/commands/spaces/briefs/set.js +5 -4
  100. package/dist/commands/spaces/capacity.js +5 -4
  101. package/dist/commands/spaces/conversations.js +3 -2
  102. package/dist/commands/spaces/cycles/create.js +3 -2
  103. package/dist/commands/spaces/cycles/graph.js +2 -1
  104. package/dist/commands/spaces/cycles/list.js +3 -2
  105. package/dist/commands/spaces/cycles/settings.js +4 -3
  106. package/dist/commands/spaces/cycles/show.js +3 -2
  107. package/dist/commands/spaces/cycles/update.js +3 -2
  108. package/dist/commands/spaces/delete.js +4 -3
  109. package/dist/commands/spaces/expertise-suggestions.js +4 -3
  110. package/dist/commands/spaces/files/delete.js +3 -2
  111. package/dist/commands/spaces/files/folders/create.js +3 -2
  112. package/dist/commands/spaces/files/folders/delete.js +3 -2
  113. package/dist/commands/spaces/files/folders/list.js +3 -2
  114. package/dist/commands/spaces/files/folders/update.js +3 -2
  115. package/dist/commands/spaces/files/list.js +3 -2
  116. package/dist/commands/spaces/files/move.js +3 -2
  117. package/dist/commands/spaces/files/rename.js +3 -2
  118. package/dist/commands/spaces/files/upload.js +6 -5
  119. package/dist/commands/spaces/github-automations/set.js +3 -2
  120. package/dist/commands/spaces/github-automations/show.js +3 -2
  121. package/dist/commands/spaces/goals.js +2 -1
  122. package/dist/commands/spaces/heartbeats/create.js +4 -3
  123. package/dist/commands/spaces/heartbeats/delete.js +4 -3
  124. package/dist/commands/spaces/heartbeats/list.js +4 -3
  125. package/dist/commands/spaces/heartbeats/status.js +3 -2
  126. package/dist/commands/spaces/heartbeats/update.js +4 -3
  127. package/dist/commands/spaces/insights.js +5 -4
  128. package/dist/commands/spaces/labels/add.js +4 -3
  129. package/dist/commands/spaces/labels/list.js +2 -1
  130. package/dist/commands/spaces/labels/remove.js +4 -3
  131. package/dist/commands/spaces/list.d.ts +3 -0
  132. package/dist/commands/spaces/list.js +11 -2
  133. package/dist/commands/spaces/live/cards/create.js +3 -2
  134. package/dist/commands/spaces/live/cards/list.js +3 -2
  135. package/dist/commands/spaces/live/cards/reorder.js +7 -2
  136. package/dist/commands/spaces/live/scene.js +4 -3
  137. package/dist/commands/spaces/members/add.js +7 -6
  138. package/dist/commands/spaces/members/list.js +4 -3
  139. package/dist/commands/spaces/members/remove.js +7 -6
  140. package/dist/commands/spaces/move.js +3 -2
  141. package/dist/commands/spaces/pin.js +5 -4
  142. package/dist/commands/spaces/preferences/show.js +4 -3
  143. package/dist/commands/spaces/preferences/tabs.js +4 -3
  144. package/dist/commands/spaces/revisions.js +3 -2
  145. package/dist/commands/spaces/room/ensure.js +5 -4
  146. package/dist/commands/spaces/room/messages.js +3 -2
  147. package/dist/commands/spaces/room/show.js +5 -4
  148. package/dist/commands/spaces/skills/add.js +4 -3
  149. package/dist/commands/spaces/skills/list.js +3 -2
  150. package/dist/commands/spaces/skills/pin.js +4 -3
  151. package/dist/commands/spaces/skills/remove.js +4 -3
  152. package/dist/commands/spaces/snapshot.js +3 -2
  153. package/dist/commands/spaces/states/archive.js +3 -2
  154. package/dist/commands/spaces/states/create.js +3 -2
  155. package/dist/commands/spaces/states/list.js +3 -2
  156. package/dist/commands/spaces/states/reorder.js +2 -1
  157. package/dist/commands/spaces/states/update.js +3 -2
  158. package/dist/commands/spaces/summary.js +4 -3
  159. package/dist/commands/spaces/tasks.d.ts +3 -0
  160. package/dist/commands/spaces/tasks.js +14 -3
  161. package/dist/commands/spaces/triggers/delete.js +5 -4
  162. package/dist/commands/spaces/triggers/set.js +4 -3
  163. package/dist/commands/spaces/triggers/show.js +4 -3
  164. package/dist/commands/spaces/unarchive.js +3 -2
  165. package/dist/commands/spaces/update.js +5 -4
  166. package/dist/commands/spaces/views/create.js +3 -2
  167. package/dist/commands/spaces/views/list.js +3 -2
  168. package/dist/commands/spaces/views/reorder.js +6 -3
  169. package/dist/commands/spaces/views/subscribe.js +2 -1
  170. package/dist/commands/spaces/views/subscriptions.js +1 -0
  171. package/dist/commands/spaces/views/unsubscribe.js +2 -1
  172. package/dist/commands/spaces/widgets/add.js +4 -3
  173. package/dist/commands/spaces/widgets/list.js +3 -2
  174. package/dist/commands/spaces/widgets/remove.js +5 -4
  175. package/dist/commands/spaces/work-graph.js +2 -1
  176. package/dist/commands/store/install.d.ts +1 -1
  177. package/dist/commands/store/install.js +24 -8
  178. package/dist/commands/store/show.d.ts +25 -0
  179. package/dist/commands/store/show.js +203 -0
  180. package/dist/commands/store/stats.d.ts +33 -0
  181. package/dist/commands/store/stats.js +258 -0
  182. package/dist/commands/tasks/actions/attach.js +1 -1
  183. package/dist/commands/tasks/actions/detach.js +4 -3
  184. package/dist/commands/tasks/activity.js +3 -2
  185. package/dist/commands/tasks/ancestors.js +2 -1
  186. package/dist/commands/tasks/approvals/create.js +2 -1
  187. package/dist/commands/tasks/approvals/delete.js +3 -2
  188. package/dist/commands/tasks/approvals/list.js +5 -4
  189. package/dist/commands/tasks/approvals/resolve.js +2 -1
  190. package/dist/commands/tasks/archive.js +3 -2
  191. package/dist/commands/tasks/assign.js +4 -3
  192. package/dist/commands/tasks/attachments/delete.js +3 -2
  193. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  194. package/dist/commands/tasks/attachments/download.js +20 -1
  195. package/dist/commands/tasks/attachments/list.js +2 -1
  196. package/dist/commands/tasks/attachments/set-role.js +2 -1
  197. package/dist/commands/tasks/attachments/upload.js +2 -1
  198. package/dist/commands/tasks/bulk-update.d.ts +1 -0
  199. package/dist/commands/tasks/bulk-update.js +106 -15
  200. package/dist/commands/tasks/cancel-cascade.d.ts +1 -0
  201. package/dist/commands/tasks/cancel-cascade.js +13 -3
  202. package/dist/commands/tasks/cascade-status.js +2 -1
  203. package/dist/commands/tasks/checkout.js +3 -2
  204. package/dist/commands/tasks/children.js +2 -1
  205. package/dist/commands/tasks/comments/add.js +7 -6
  206. package/dist/commands/tasks/comments/anchor.js +8 -7
  207. package/dist/commands/tasks/comments/delete.js +3 -2
  208. package/dist/commands/tasks/comments/list.js +2 -1
  209. package/dist/commands/tasks/comments/reopen.js +3 -2
  210. package/dist/commands/tasks/comments/resolve.js +3 -2
  211. package/dist/commands/tasks/create-tree.d.ts +63 -0
  212. package/dist/commands/tasks/create-tree.js +197 -4
  213. package/dist/commands/tasks/delete.js +5 -4
  214. package/dist/commands/tasks/descendants.js +2 -1
  215. package/dist/commands/tasks/dri-plan.js +3 -2
  216. package/dist/commands/tasks/dri-run.js +3 -2
  217. package/dist/commands/tasks/dri-status.js +2 -1
  218. package/dist/commands/tasks/duplicate-pipeline.js +2 -1
  219. package/dist/commands/tasks/execution-summary.js +2 -1
  220. package/dist/commands/tasks/execution-timeline.js +2 -1
  221. package/dist/commands/tasks/fork.js +1 -0
  222. package/dist/commands/tasks/forward.js +4 -3
  223. package/dist/commands/tasks/handover.js +1 -0
  224. package/dist/commands/tasks/interrupt.js +3 -2
  225. package/dist/commands/tasks/labels/attach.js +4 -3
  226. package/dist/commands/tasks/labels/detach.js +4 -3
  227. package/dist/commands/tasks/labels/suggest.js +5 -4
  228. package/dist/commands/tasks/list.d.ts +27 -1
  229. package/dist/commands/tasks/list.js +101 -3
  230. package/dist/commands/tasks/move.js +4 -3
  231. package/dist/commands/tasks/output.js +6 -5
  232. package/dist/commands/tasks/pause-schedule.js +3 -2
  233. package/dist/commands/tasks/promote.js +1 -0
  234. package/dist/commands/tasks/prompt-log.js +2 -1
  235. package/dist/commands/tasks/release.js +5 -4
  236. package/dist/commands/tasks/remind.js +2 -1
  237. package/dist/commands/tasks/replay.js +3 -2
  238. package/dist/commands/tasks/report.js +1 -0
  239. package/dist/commands/tasks/resume-schedule.js +3 -2
  240. package/dist/commands/tasks/retry-schedule.js +3 -2
  241. package/dist/commands/tasks/retry.js +10 -9
  242. package/dist/commands/tasks/revisions.js +2 -1
  243. package/dist/commands/tasks/runs.js +6 -5
  244. package/dist/commands/tasks/schedule.js +3 -2
  245. package/dist/commands/tasks/self-schedule.js +6 -5
  246. package/dist/commands/tasks/skills/pin.js +3 -2
  247. package/dist/commands/tasks/skills/unpin.js +3 -2
  248. package/dist/commands/tasks/snooze.js +6 -5
  249. package/dist/commands/tasks/start-all.js +5 -4
  250. package/dist/commands/tasks/subscribe.js +1 -0
  251. package/dist/commands/tasks/tags/add.js +4 -3
  252. package/dist/commands/tasks/tags/remove.js +4 -3
  253. package/dist/commands/tasks/timeline.js +3 -2
  254. package/dist/commands/tasks/today.d.ts +4 -1
  255. package/dist/commands/tasks/today.js +12 -2
  256. package/dist/commands/tasks/transcript.js +6 -5
  257. package/dist/commands/tasks/unschedule.js +3 -2
  258. package/dist/commands/tasks/unsnooze.js +3 -2
  259. package/dist/commands/tasks/unsubscribe.js +2 -1
  260. package/dist/commands/tasks/update.js +5 -4
  261. package/dist/commands/tasks/wait.js +5 -4
  262. package/dist/lib/agent-distribution.d.ts +37 -0
  263. package/dist/lib/agent-distribution.js +63 -0
  264. package/dist/lib/agent-ref.d.ts +69 -0
  265. package/dist/lib/agent-ref.js +168 -0
  266. package/dist/lib/api-fetch.d.ts +2 -0
  267. package/dist/lib/api-fetch.js +14 -3
  268. package/dist/lib/command-hygiene.d.ts +13 -0
  269. package/dist/lib/command-hygiene.js +62 -2
  270. package/dist/lib/commitment-product.d.ts +0 -6
  271. package/dist/lib/commitment-product.js +1 -30
  272. package/dist/lib/commitments.d.ts +9 -45
  273. package/dist/lib/commitments.js +24 -95
  274. package/dist/lib/dedicated-power.d.ts +5 -0
  275. package/dist/lib/dedicated-power.js +30 -2
  276. package/dist/lib/dry-run-plans.d.ts +50 -0
  277. package/dist/lib/dry-run-plans.js +85 -0
  278. package/dist/lib/json-output.d.ts +31 -0
  279. package/dist/lib/json-output.js +78 -0
  280. package/dist/lib/list-output.d.ts +75 -0
  281. package/dist/lib/list-output.js +266 -0
  282. package/dist/lib/machine-daemon-log.d.ts +36 -0
  283. package/dist/lib/machine-daemon-log.js +78 -0
  284. package/dist/lib/node-adapter.js +10 -1
  285. package/dist/lib/northstars.js +1 -1
  286. package/dist/lib/open-target.d.ts +12 -0
  287. package/dist/lib/open-target.js +108 -0
  288. package/dist/lib/rate-limit-retry.d.ts +45 -0
  289. package/dist/lib/rate-limit-retry.js +88 -0
  290. package/dist/lib/roles.d.ts +98 -0
  291. package/dist/lib/roles.js +45 -0
  292. package/dist/lib/store-listing.d.ts +45 -0
  293. package/dist/lib/store-listing.js +186 -0
  294. package/dist/lib/task-batch.d.ts +67 -0
  295. package/dist/lib/task-batch.js +227 -0
  296. package/dist/lib/terminal-qr.d.ts +55 -0
  297. package/dist/lib/terminal-qr.js +119 -0
  298. package/dist/lib/web-url.d.ts +11 -0
  299. package/dist/lib/web-url.js +24 -0
  300. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.d.ts +45 -0
  301. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +550 -0
  302. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +68 -0
  303. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +47 -1
  304. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.d.ts +7 -44
  305. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.js +8 -47
  306. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.d.ts +45 -0
  307. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +545 -0
  308. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +68 -0
  309. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +46 -0
  310. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.d.ts +7 -44
  311. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.js +8 -47
  312. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  313. package/dist/node_modules/@skrr-ai/data-provider/index.js +7285 -6673
  314. package/dist/node_modules/@skrr-ai/data-provider/package.json +2 -2
  315. package/oclif.manifest.json +35937 -26820
  316. package/package.json +6 -2
  317. package/dist/commands/commitments/autonomy.d.ts +0 -30
  318. package/dist/commands/commitments/autonomy.js +0 -67
  319. package/dist/commands/commitments/mode.js +0 -58
  320. package/dist/commands/commitments/pack/promote.d.ts +0 -19
  321. package/dist/commands/commitments/pack/promote.js +0 -46
  322. package/dist/commands/commitments/pack/shadow.d.ts +0 -20
  323. package/dist/commands/commitments/pack/shadow.js +0 -42
@@ -5,12 +5,15 @@ const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../base-command");
6
6
  const web_url_1 = require("../../lib/web-url");
7
7
  const prompt_1 = require("../../lib/prompt");
8
+ const dry_run_plans_1 = require("../../lib/dry-run-plans");
9
+ const task_batch_1 = require("../../lib/task-batch");
8
10
  const tasks_1 = require("../../lib/tasks");
9
11
  class TasksBulkUpdate extends base_command_1.BaseCommand {
10
12
  static description = 'Apply partial updates to many tasks from JSON';
11
13
  static examples = [
12
14
  '<%= config.bin %> tasks bulk-update --from-json updates.json --json',
13
15
  '<%= config.bin %> tasks bulk-update --from-json updates.json --continue-on-error',
16
+ '<%= config.bin %> tasks bulk-update --from-json updates.json --dry-run --json',
14
17
  ];
15
18
  static flags = {
16
19
  json: core_1.Flags.boolean({ description: 'Output bulk result as JSON' }),
@@ -18,6 +21,9 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
18
21
  description: 'Path to a JSON file (or "-" for stdin) containing updates',
19
22
  required: true,
20
23
  }),
24
+ 'dry-run': core_1.Flags.boolean({
25
+ description: 'Read each task, validate every patch client-side and print the field-by-field diff without writing anything',
26
+ }),
21
27
  'continue-on-error': core_1.Flags.boolean({
22
28
  description: 'Continue applying later updates after one task fails',
23
29
  }),
@@ -39,42 +45,127 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
39
45
  catch (err) {
40
46
  this.error(err.message, { exit: 1 });
41
47
  }
48
+ if (flags['dry-run']) {
49
+ const currentById = {};
50
+ const failedReads = {};
51
+ for (const update of updates) {
52
+ try {
53
+ currentById[update.id] = (await data_provider_1.dataService.getTask(update.id, {
54
+ enrich: false,
55
+ }));
56
+ }
57
+ catch (err) {
58
+ const status = err.status;
59
+ if (status === 404)
60
+ currentById[update.id] = null;
61
+ else
62
+ failedReads[update.id] = err instanceof Error ? err.message : String(err);
63
+ }
64
+ }
65
+ const preview = (0, dry_run_plans_1.planBulkUpdate)(updates, currentById, failedReads);
66
+ if (flags.json)
67
+ this.log(JSON.stringify(preview, null, 2));
68
+ else {
69
+ this.log(`Dry run: ${preview.wouldChange} of ${preview.requested} task(s) would change, ${preview.invalid} invalid. Nothing was written.`);
70
+ for (const row of preview.results) {
71
+ if (!row.ok)
72
+ this.log(`- ${row.id}: ${row.errors.join('; ')}`);
73
+ else if (row.noop)
74
+ this.log(`- ${row.id}: no change`);
75
+ else
76
+ this.log(`- ${row.id}: ${Object.keys(row.changes).join(', ')}`);
77
+ }
78
+ }
79
+ if (!preview.ok)
80
+ this.exit(1);
81
+ return;
82
+ }
42
83
  const results = [];
43
84
  const errors = [];
44
- for (const update of updates) {
85
+ const rows = updates.map((update) => {
86
+ const { status, ...restPatch } = update.patch;
87
+ return { id: update.id, status, patch: (0, tasks_1.removeUndefinedFields)(restPatch) };
88
+ });
89
+ // The field patches go to PATCH /api/tasks/batch in chunks; `status` is a
90
+ // workflow move with its own route and stays one call per row. A server
91
+ // without the batch route (404/405) gets the serial path below.
92
+ const patchable = rows
93
+ .map((row, index) => ({ row, index }))
94
+ .filter(({ row }) => Object.keys(row.patch).length > 0);
95
+ const batchByRow = new Map();
96
+ if (patchable.length > 0) {
97
+ const outcome = await (0, task_batch_1.patchTasksViaBatch)(patchable.map(({ row }) => ({
98
+ id: row.id,
99
+ patch: row.patch,
100
+ })));
101
+ if (outcome.supported) {
102
+ for (const [i, result] of outcome.results.entries()) {
103
+ batchByRow.set(patchable[i].index, result);
104
+ }
105
+ }
106
+ }
107
+ const usedBatch = batchByRow.size > 0;
108
+ let stopped = false;
109
+ for (const [index, row] of rows.entries()) {
45
110
  try {
46
- const { status, ...restPatch } = update.patch;
47
- const patch = (0, tasks_1.removeUndefinedFields)(restPatch);
48
111
  let task = null;
49
- if (Object.keys(patch).length > 0) {
50
- task = await data_provider_1.dataService.updateTask({
51
- taskId: update.id,
52
- data: patch,
53
- });
112
+ if (Object.keys(row.patch).length > 0) {
113
+ const batched = batchByRow.get(index);
114
+ if (usedBatch && batched) {
115
+ if (!batched.ok) {
116
+ throw Object.assign(new Error(batched.error?.message ?? 'Update failed'), {
117
+ code: batched.error?.code,
118
+ status: batched.error?.status,
119
+ });
120
+ }
121
+ // The batch route reports id/identifier/version, not the document:
122
+ // the fields this row set are echoed so the row is self-describing.
123
+ task = {
124
+ ...row.patch,
125
+ id: batched.id ?? row.id,
126
+ ...(batched.identifier ? { identifier: batched.identifier } : {}),
127
+ ...(batched.version !== undefined ? { version: batched.version } : {}),
128
+ };
129
+ }
130
+ else {
131
+ task = await data_provider_1.dataService.updateTask({
132
+ taskId: row.id,
133
+ data: row.patch,
134
+ });
135
+ }
54
136
  }
55
- if (status !== undefined) {
56
- if (!data_provider_1.TASK_STATUSES.includes(status)) {
137
+ if (row.status !== undefined) {
138
+ if (stopped) {
139
+ throw new Error('status move not applied: stopped after an earlier failure');
140
+ }
141
+ if (!data_provider_1.TASK_STATUSES.includes(row.status)) {
57
142
  throw new Error(`status must be one of: ${data_provider_1.TASK_STATUSES.join(', ')}`);
58
143
  }
59
144
  task = await data_provider_1.dataService.moveTask({
60
- taskId: update.id,
61
- status: status,
145
+ taskId: row.id,
146
+ status: row.status,
62
147
  });
63
148
  }
64
149
  if (!task) {
65
- task = await data_provider_1.dataService.getTask(update.id, { enrich: false });
150
+ task = await data_provider_1.dataService.getTask(row.id, { enrich: false });
66
151
  }
67
- results.push({ id: update.id, ok: true, task });
152
+ results.push({ id: row.id, ok: true, task });
68
153
  }
69
154
  catch (err) {
155
+ const code = err.code;
70
156
  const error = {
71
- id: update.id,
157
+ id: row.id,
72
158
  ok: false,
73
159
  error: err instanceof Error ? err.message : String(err),
160
+ ...(code ? { code } : {}),
74
161
  };
75
162
  errors.push(error);
76
163
  results.push(error);
77
164
  if (!flags['continue-on-error'])
165
+ stopped = true;
166
+ // Serial path: later rows are never touched. Batch path: they were
167
+ // already applied by the chunk, so they are reported rather than dropped.
168
+ if (!flags['continue-on-error'] && !usedBatch)
78
169
  break;
79
170
  }
80
171
  }
@@ -7,6 +7,7 @@ export default class TasksCancelCascade extends BaseCommand {
7
7
  };
8
8
  static flags: {
9
9
  yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
11
  };
11
12
  run(): Promise<void>;
12
13
  }
@@ -15,29 +15,39 @@ class TasksCancelCascade extends base_command_1.BaseCommand {
15
15
  };
16
16
  static flags = {
17
17
  yes: core_1.Flags.boolean({ char: 'y', description: 'Skip confirmation prompt' }),
18
+ json: core_1.Flags.boolean({ description: 'Output the result as JSON' }),
18
19
  };
19
20
  async run() {
20
21
  this.requireAuth();
21
22
  const { args, flags } = await this.parse(TasksCancelCascade);
23
+ const taskRef = await this.resolveEntityRef('task', args.id);
22
24
  let confirmed;
23
25
  try {
24
- confirmed = await (0, prompt_1.confirmDestructive)(`Cancel cascade for task ${args.id}? This cannot be undone.`, flags.yes);
26
+ confirmed = await (0, prompt_1.confirmDestructive)(`Cancel cascade for task ${taskRef}? This cannot be undone.`, flags.yes);
25
27
  }
26
28
  catch (err) {
27
29
  const e = err;
28
30
  this.error(e.message, { exit: e.exit ?? 1 });
29
31
  }
30
32
  if (!confirmed) {
33
+ if (flags.json) {
34
+ this.log(JSON.stringify({ object: 'task_cascade_cancel', cancelled: false, id: taskRef }));
35
+ return;
36
+ }
31
37
  this.log('Cancelled.');
32
38
  return;
33
39
  }
34
40
  try {
35
- await data_provider_1.dataService.cancelCascade(args.id);
41
+ await data_provider_1.dataService.cancelCascade(taskRef);
36
42
  }
37
43
  catch (err) {
38
44
  this.handleApiError(err);
39
45
  }
40
- this.log(`Cancelled cascade for task ${args.id}`);
46
+ if (flags.json) {
47
+ this.log(JSON.stringify({ object: 'task_cascade_cancel', cancelled: true, id: taskRef }));
48
+ return;
49
+ }
50
+ this.log(`Cancelled cascade for task ${taskRef}`);
41
51
  }
42
52
  }
43
53
  exports.default = TasksCancelCascade;
@@ -18,9 +18,10 @@ class TasksCascadeStatus extends base_command_1.BaseCommand {
18
18
  async run() {
19
19
  this.requireAuth();
20
20
  const { args, flags } = await this.parse(TasksCascadeStatus);
21
+ const taskRef = await this.resolveEntityRef('task', args.id);
21
22
  let result;
22
23
  try {
23
- result = await data_provider_1.dataService.getCascadeStatus(args.id);
24
+ result = await data_provider_1.dataService.getCascadeStatus(taskRef);
24
25
  }
25
26
  catch (err) {
26
27
  this.handleApiError(err);
@@ -54,10 +54,11 @@ class TasksCheckout extends base_command_1.BaseCommand {
54
54
  async run() {
55
55
  this.requireAuth();
56
56
  const { args, flags } = await this.parse(TasksCheckout);
57
+ const taskRef = await this.resolveEntityRef('task', args.id);
57
58
  const runId = flags.run ?? crypto.randomUUID();
58
59
  let result;
59
60
  try {
60
- result = await data_provider_1.dataService.checkoutTask({ taskId: args.id, runId });
61
+ result = await data_provider_1.dataService.checkoutTask({ taskId: taskRef, runId });
61
62
  }
62
63
  catch (err) {
63
64
  const e = err;
@@ -73,7 +74,7 @@ class TasksCheckout extends base_command_1.BaseCommand {
73
74
  this.log(JSON.stringify(result, null, 2));
74
75
  return;
75
76
  }
76
- this.log(`Checked out task ${args.id} with run ${runId}`);
77
+ this.log(`Checked out task ${taskRef} with run ${runId}`);
77
78
  }
78
79
  }
79
80
  exports.default = TasksCheckout;
@@ -20,9 +20,10 @@ class TasksChildren extends base_command_1.BaseCommand {
20
20
  async run() {
21
21
  this.requireAuth();
22
22
  const { args, flags } = await this.parse(TasksChildren);
23
+ const taskRef = await this.resolveEntityRef('task', args.id);
23
24
  let response;
24
25
  try {
25
- response = await data_provider_1.dataService.listTaskChildren(args.id);
26
+ response = await data_provider_1.dataService.listTaskChildren(taskRef);
26
27
  }
27
28
  catch (err) {
28
29
  this.handleApiError(err);
@@ -128,6 +128,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
128
128
  details: { suggestion: failure.suggestion, context: failure.details },
129
129
  });
130
130
  }
131
+ const taskRef = await this.resolveEntityRef('task', task.id);
131
132
  const commentBody = (0, task_resolver_1.stripTaskIdentityFields)(jsonBody);
132
133
  if ('authorAgentId' in commentBody || 'author-agent' in commentBody) {
133
134
  this.failWithCliError({
@@ -154,7 +155,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
154
155
  for (const filePath of flags.attach) {
155
156
  try {
156
157
  const asset = await uploadTaskAssetFile({
157
- taskId: task.id,
158
+ taskId: taskRef,
158
159
  filePath,
159
160
  role: 'evidence',
160
161
  });
@@ -200,7 +201,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
200
201
  // ONE key for the original attempt and any later replay — see the comment
201
202
  // in `spaces create`. A key sent only on the replay would post a second
202
203
  // comment whenever the original landed and its response was lost.
203
- const idempotencyKey = (0, outbox_1.idempotencyKeyFor)('task-comment', task.id, JSON.stringify(data));
204
+ const idempotencyKey = (0, outbox_1.idempotencyKeyFor)('task-comment', taskRef, JSON.stringify(data));
204
205
  let result;
205
206
  try {
206
207
  // apiFetch rather than `dataService.addTaskComment`: the shared transport
@@ -233,7 +234,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
233
234
  },
234
235
  headers: { 'X-Idempotency-Key': idempotencyKey },
235
236
  })
236
- : await (0, api_fetch_1.apiFetch)(`/api/tasks/${encodeURIComponent(task.id)}/comments`, {
237
+ : await (0, api_fetch_1.apiFetch)(`/api/tasks/${encodeURIComponent(taskRef)}/comments`, {
237
238
  method: 'POST',
238
239
  body: data,
239
240
  headers: { 'X-Idempotency-Key': idempotencyKey },
@@ -247,9 +248,9 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
247
248
  // different comment on the same task hashes differently and still posts.
248
249
  this.queueWriteOrFail(err, {
249
250
  command: 'tasks comments add',
250
- summary: `comment on task ${task.id}`,
251
+ summary: `comment on task ${taskRef}`,
251
252
  method: 'post',
252
- url: `/api/tasks/${encodeURIComponent(task.id)}/comments`,
253
+ url: `/api/tasks/${encodeURIComponent(taskRef)}/comments`,
253
254
  body: data,
254
255
  idempotencyKey,
255
256
  });
@@ -264,7 +265,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
264
265
  : c.anchor?.commentMarkId
265
266
  ? 'inline comment'
266
267
  : 'comment';
267
- this.log(`Added ${kind} ${c.id ?? c._id ?? '?'} on task ${task.id}`);
268
+ this.log(`Added ${kind} ${c.id ?? c._id ?? '?'} on task ${taskRef}`);
268
269
  if (c.anchor?.commentMarkId) {
269
270
  this.log(` anchor markId: ${c.anchor.commentMarkId}`);
270
271
  if (c.anchor.quote) {
@@ -228,6 +228,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
228
228
  async run() {
229
229
  this.requireAuth();
230
230
  const { args, flags } = await this.parse(TasksCommentsAnchor);
231
+ const taskRef = await this.resolveEntityRef('task', args.id);
231
232
  if (flags.occurrence < 1) {
232
233
  this.error('--occurrence must be ≥ 1', { exit: 1 });
233
234
  }
@@ -244,7 +245,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
244
245
  // 1. Fetch current task.
245
246
  let task;
246
247
  try {
247
- task = await data_provider_1.dataService.getTask(args.id, { enrich: false });
248
+ task = await data_provider_1.dataService.getTask(taskRef, { enrich: false });
248
249
  }
249
250
  catch (err) {
250
251
  this.handleApiError(err);
@@ -275,9 +276,9 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
275
276
  '',
276
277
  'Workarounds:',
277
278
  ` • Edit the description first so the target text lives in one span:`,
278
- ` skrr tasks update ${args.id} --description "…"`,
279
+ ` skrr tasks update ${taskRef} --description "…"`,
279
280
  ` • Or post the anchor without modifying the description:`,
280
- ` skrr tasks comments add ${args.id} --body "…" --anchor-quote "…"`,
281
+ ` skrr tasks comments add ${taskRef} --body "…" --anchor-quote "…"`,
281
282
  ' (the editor will treat the comment as a sticky thread even without',
282
283
  ' a visible span.)',
283
284
  ].join('\n'), { exit: 1 });
@@ -304,7 +305,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
304
305
  : { description: wrap.html };
305
306
  let patched;
306
307
  try {
307
- patched = await data_provider_1.dataService.updateTask({ taskId: args.id, data: patchData });
308
+ patched = await data_provider_1.dataService.updateTask({ taskId: taskRef, data: patchData });
308
309
  }
309
310
  catch (err) {
310
311
  const e = err;
@@ -331,7 +332,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
331
332
  let comment;
332
333
  try {
333
334
  comment = await data_provider_1.dataService.addTaskComment({
334
- taskId: args.id,
335
+ taskId: taskRef,
335
336
  data: commentData,
336
337
  });
337
338
  }
@@ -343,7 +344,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
343
344
  // our PATCH and rollback, we accept that they win and warn the user.
344
345
  try {
345
346
  await data_provider_1.dataService.updateTask({
346
- taskId: args.id,
347
+ taskId: taskRef,
347
348
  data: { description: originalDescription },
348
349
  });
349
350
  this.warn('Comment POST failed — rolled back description to its pre-anchor state.');
@@ -361,7 +362,7 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
361
362
  return;
362
363
  }
363
364
  const c = comment;
364
- this.log(`Anchored comment ${c.id ?? c._id ?? '?'} on task ${args.id}`);
365
+ this.log(`Anchored comment ${c.id ?? c._id ?? '?'} on task ${taskRef}`);
365
366
  this.log(` mark id: ${markId}`);
366
367
  this.log(` match: occurrence ${wrap.occurrence} of ${wrap.totalMatches}`);
367
368
  this.log(` quote: "${quote.length > 80 ? quote.slice(0, 77) + '…' : quote}"`);
@@ -20,9 +20,10 @@ class TasksCommentsDelete extends base_command_1.BaseCommand {
20
20
  async run() {
21
21
  this.requireAuth();
22
22
  const { args, flags } = await this.parse(TasksCommentsDelete);
23
+ const taskRef = await this.resolveEntityRef('task', args.id);
23
24
  let confirmed;
24
25
  try {
25
- confirmed = await (0, prompt_1.confirmDestructive)(`Delete comment ${args.commentId} from task ${args.id}? This cannot be undone.`, flags.yes);
26
+ confirmed = await (0, prompt_1.confirmDestructive)(`Delete comment ${args.commentId} from task ${taskRef}? This cannot be undone.`, flags.yes);
26
27
  }
27
28
  catch (err) {
28
29
  const e = err;
@@ -33,7 +34,7 @@ class TasksCommentsDelete extends base_command_1.BaseCommand {
33
34
  return;
34
35
  }
35
36
  try {
36
- await data_provider_1.dataService.deleteTaskComment({ taskId: args.id, commentId: args.commentId });
37
+ await data_provider_1.dataService.deleteTaskComment({ taskId: taskRef, commentId: args.commentId });
37
38
  }
38
39
  catch (err) {
39
40
  this.handleApiError(err);
@@ -83,9 +83,10 @@ class TasksCommentsList extends base_command_1.BaseCommand {
83
83
  details: { suggestion: failure.suggestion, context: failure.details },
84
84
  });
85
85
  }
86
+ const taskRef = await this.resolveEntityRef('task', task.id);
86
87
  let response;
87
88
  try {
88
- response = await data_provider_1.dataService.listTaskComments(task.id, {
89
+ response = await data_provider_1.dataService.listTaskComments(taskRef, {
89
90
  limit: flags.limit,
90
91
  cursor: flags.cursor,
91
92
  });
@@ -19,10 +19,11 @@ class TasksCommentsReopen extends base_command_1.BaseCommand {
19
19
  async run() {
20
20
  this.requireAuth();
21
21
  const { args, flags } = await this.parse(TasksCommentsReopen);
22
+ const taskRef = await this.resolveEntityRef('task', args.id);
22
23
  let result;
23
24
  try {
24
25
  result = await data_provider_1.dataService.reopenTaskComment({
25
- taskId: args.id,
26
+ taskId: taskRef,
26
27
  commentId: args.commentId,
27
28
  });
28
29
  }
@@ -34,7 +35,7 @@ class TasksCommentsReopen extends base_command_1.BaseCommand {
34
35
  return;
35
36
  }
36
37
  const c = result;
37
- this.log(`Reopened comment ${c.id ?? c._id ?? args.commentId} on task ${args.id}`);
38
+ this.log(`Reopened comment ${c.id ?? c._id ?? args.commentId} on task ${taskRef}`);
38
39
  }
39
40
  }
40
41
  exports.default = TasksCommentsReopen;
@@ -19,10 +19,11 @@ class TasksCommentsResolve extends base_command_1.BaseCommand {
19
19
  async run() {
20
20
  this.requireAuth();
21
21
  const { args, flags } = await this.parse(TasksCommentsResolve);
22
+ const taskRef = await this.resolveEntityRef('task', args.id);
22
23
  let result;
23
24
  try {
24
25
  result = await data_provider_1.dataService.resolveTaskComment({
25
- taskId: args.id,
26
+ taskId: taskRef,
26
27
  commentId: args.commentId,
27
28
  });
28
29
  }
@@ -34,7 +35,7 @@ class TasksCommentsResolve extends base_command_1.BaseCommand {
34
35
  return;
35
36
  }
36
37
  const c = result;
37
- this.log(`Resolved comment ${c.id ?? c._id ?? args.commentId} on task ${args.id}`);
38
+ this.log(`Resolved comment ${c.id ?? c._id ?? args.commentId} on task ${taskRef}`);
38
39
  }
39
40
  }
40
41
  exports.default = TasksCommentsResolve;
@@ -9,6 +9,68 @@ export type PlannedNode = {
9
9
  node: TreeNode;
10
10
  payload: TaskRecord;
11
11
  };
12
+ /**
13
+ * Nodes a re-run could not recognize: no externalKey of their own and no
14
+ * `--external-key-prefix` to derive one. Re-running a partly applied tree
15
+ * creates these twice.
16
+ */
17
+ export declare function unkeyedNodes(planned: PlannedNode[]): string[];
18
+ export declare function rerunWarning(planned: PlannedNode[], prefix: string | undefined): {
19
+ code: string;
20
+ value: string[];
21
+ hint: string;
22
+ } | undefined;
23
+ /**
24
+ * A key prefix derived from the tree itself (its JSON plus the default scope),
25
+ * stable across runs: the same file into the same space always names the same
26
+ * keys. Different content or a different default space is a different prefix.
27
+ */
28
+ export declare function derivedTreePrefix(input: TaskRecord, defaults: TaskRecord): string;
29
+ export declare function derivedPrefixWarning(prefix: string): {
30
+ code: string;
31
+ value: string;
32
+ hint: string;
33
+ };
34
+ export type TreeFailure = {
35
+ tempId: string;
36
+ parentTempId?: string;
37
+ title?: unknown;
38
+ error: {
39
+ message: string;
40
+ status?: number;
41
+ code?: string;
42
+ retryable: boolean;
43
+ };
44
+ };
45
+ /**
46
+ * What a half-applied tree reports (E4). The ids already created are the only
47
+ * way to continue or clean up, and the failing call used to print none of them.
48
+ */
49
+ export declare function partialFailureResult(args: {
50
+ results: Array<Record<string, unknown>>;
51
+ mapping: Record<string, string>;
52
+ failedAt: TreeFailure;
53
+ total: number;
54
+ prefix?: string;
55
+ warnings: Array<Record<string, unknown>>;
56
+ }): {
57
+ warnings?: Record<string, unknown>[] | undefined;
58
+ object: string;
59
+ ok: boolean;
60
+ count: number;
61
+ total: number;
62
+ created: {
63
+ tempId: unknown;
64
+ parentTempId: unknown;
65
+ id: unknown;
66
+ action: unknown;
67
+ externalKey: unknown;
68
+ title: unknown;
69
+ }[];
70
+ mapping: Record<string, string>;
71
+ failedAt: TreeFailure;
72
+ rerun: string;
73
+ };
12
74
  export default class TasksCreateTree extends BaseCommand {
13
75
  static description: string;
14
76
  static examples: string[];
@@ -17,6 +79,7 @@ export default class TasksCreateTree extends BaseCommand {
17
79
  'from-json': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
80
  'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
81
  'external-key-prefix': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
82
+ fresh: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
83
  'default-agent': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
84
  space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
85
  goal: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;