rosettify 2.4.4 → 3.1.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 (165) hide show
  1. package/dist/commands/plan/core.d.ts +2 -1
  2. package/dist/commands/plan/core.d.ts.map +1 -1
  3. package/dist/commands/plan/core.js +6 -26
  4. package/dist/commands/plan/core.js.map +1 -1
  5. package/dist/commands/plan/errors.d.ts +6 -2
  6. package/dist/commands/plan/errors.d.ts.map +1 -1
  7. package/dist/commands/plan/errors.js +6 -2
  8. package/dist/commands/plan/errors.js.map +1 -1
  9. package/dist/commands/plan/next.js +3 -3
  10. package/dist/commands/plan/next.js.map +1 -1
  11. package/dist/commands/plan/query.js +3 -3
  12. package/dist/commands/plan/query.js.map +1 -1
  13. package/dist/commands/plan/show-status.js +3 -3
  14. package/dist/commands/plan/show-status.js.map +1 -1
  15. package/dist/commands/plan/update-status.js +1 -1
  16. package/dist/commands/plan/update-status.js.map +1 -1
  17. package/dist/commands/plan/upsert.js +2 -2
  18. package/dist/commands/plan/upsert.js.map +1 -1
  19. package/dist/commands/specs/add.d.ts +12 -0
  20. package/dist/commands/specs/add.d.ts.map +1 -0
  21. package/dist/commands/specs/add.js +127 -0
  22. package/dist/commands/specs/add.js.map +1 -0
  23. package/dist/commands/specs/aggregate.d.ts +12 -0
  24. package/dist/commands/specs/aggregate.d.ts.map +1 -0
  25. package/dist/commands/specs/aggregate.js +14 -0
  26. package/dist/commands/specs/aggregate.js.map +1 -0
  27. package/dist/commands/specs/approve.d.ts +4 -0
  28. package/dist/commands/specs/approve.d.ts.map +1 -0
  29. package/dist/commands/specs/approve.js +69 -0
  30. package/dist/commands/specs/approve.js.map +1 -0
  31. package/dist/commands/specs/core.d.ts +123 -0
  32. package/dist/commands/specs/core.d.ts.map +1 -0
  33. package/dist/commands/specs/core.js +284 -0
  34. package/dist/commands/specs/core.js.map +1 -0
  35. package/dist/commands/specs/delete.d.ts +4 -0
  36. package/dist/commands/specs/delete.d.ts.map +1 -0
  37. package/dist/commands/specs/delete.js +36 -0
  38. package/dist/commands/specs/delete.js.map +1 -0
  39. package/dist/commands/specs/deprecate.d.ts +4 -0
  40. package/dist/commands/specs/deprecate.d.ts.map +1 -0
  41. package/dist/commands/specs/deprecate.js +51 -0
  42. package/dist/commands/specs/deprecate.js.map +1 -0
  43. package/dist/commands/specs/errors.d.ts +69 -0
  44. package/dist/commands/specs/errors.d.ts.map +1 -0
  45. package/dist/commands/specs/errors.js +114 -0
  46. package/dist/commands/specs/errors.js.map +1 -0
  47. package/dist/commands/specs/get.d.ts +4 -0
  48. package/dist/commands/specs/get.d.ts.map +1 -0
  49. package/dist/commands/specs/get.js +37 -0
  50. package/dist/commands/specs/get.js.map +1 -0
  51. package/dist/commands/specs/graph.d.ts +33 -0
  52. package/dist/commands/specs/graph.d.ts.map +1 -0
  53. package/dist/commands/specs/graph.js +179 -0
  54. package/dist/commands/specs/graph.js.map +1 -0
  55. package/dist/commands/specs/help-content.d.ts +226 -0
  56. package/dist/commands/specs/help-content.d.ts.map +1 -0
  57. package/dist/commands/specs/help-content.js +328 -0
  58. package/dist/commands/specs/help-content.js.map +1 -0
  59. package/dist/commands/specs/implemented.d.ts +4 -0
  60. package/dist/commands/specs/implemented.d.ts.map +1 -0
  61. package/dist/commands/specs/implemented.js +69 -0
  62. package/dist/commands/specs/implemented.js.map +1 -0
  63. package/dist/commands/specs/index.d.ts +4 -0
  64. package/dist/commands/specs/index.d.ts.map +1 -0
  65. package/dist/commands/specs/index.js +282 -0
  66. package/dist/commands/specs/index.js.map +1 -0
  67. package/dist/commands/specs/info.d.ts +4 -0
  68. package/dist/commands/specs/info.d.ts.map +1 -0
  69. package/dist/commands/specs/info.js +78 -0
  70. package/dist/commands/specs/info.js.map +1 -0
  71. package/dist/commands/specs/migrate.d.ts +4 -0
  72. package/dist/commands/specs/migrate.d.ts.map +1 -0
  73. package/dist/commands/specs/migrate.js +124 -0
  74. package/dist/commands/specs/migrate.js.map +1 -0
  75. package/dist/commands/specs/output.d.ts +152 -0
  76. package/dist/commands/specs/output.d.ts.map +1 -0
  77. package/dist/commands/specs/output.js +45 -0
  78. package/dist/commands/specs/output.js.map +1 -0
  79. package/dist/commands/specs/purge.d.ts +4 -0
  80. package/dist/commands/specs/purge.d.ts.map +1 -0
  81. package/dist/commands/specs/purge.js +58 -0
  82. package/dist/commands/specs/purge.js.map +1 -0
  83. package/dist/commands/specs/query-filter.d.ts +26 -0
  84. package/dist/commands/specs/query-filter.d.ts.map +1 -0
  85. package/dist/commands/specs/query-filter.js +275 -0
  86. package/dist/commands/specs/query-filter.js.map +1 -0
  87. package/dist/commands/specs/query.d.ts +4 -0
  88. package/dist/commands/specs/query.d.ts.map +1 -0
  89. package/dist/commands/specs/query.js +35 -0
  90. package/dist/commands/specs/query.js.map +1 -0
  91. package/dist/commands/specs/render.d.ts +9 -0
  92. package/dist/commands/specs/render.d.ts.map +1 -0
  93. package/dist/commands/specs/render.js +129 -0
  94. package/dist/commands/specs/render.js.map +1 -0
  95. package/dist/commands/specs/reopen.d.ts +4 -0
  96. package/dist/commands/specs/reopen.d.ts.map +1 -0
  97. package/dist/commands/specs/reopen.js +47 -0
  98. package/dist/commands/specs/reopen.js.map +1 -0
  99. package/dist/commands/specs/req-parser.d.ts +55 -0
  100. package/dist/commands/specs/req-parser.d.ts.map +1 -0
  101. package/dist/commands/specs/req-parser.js +325 -0
  102. package/dist/commands/specs/req-parser.js.map +1 -0
  103. package/dist/commands/specs/restore.d.ts +4 -0
  104. package/dist/commands/specs/restore.d.ts.map +1 -0
  105. package/dist/commands/specs/restore.js +46 -0
  106. package/dist/commands/specs/restore.js.map +1 -0
  107. package/dist/commands/specs/rubric.d.ts +18 -0
  108. package/dist/commands/specs/rubric.d.ts.map +1 -0
  109. package/dist/commands/specs/rubric.js +86 -0
  110. package/dist/commands/specs/rubric.js.map +1 -0
  111. package/dist/commands/specs/schemas.d.ts +687 -0
  112. package/dist/commands/specs/schemas.d.ts.map +1 -0
  113. package/dist/commands/specs/schemas.js +454 -0
  114. package/dist/commands/specs/schemas.js.map +1 -0
  115. package/dist/commands/specs/update.d.ts +4 -0
  116. package/dist/commands/specs/update.d.ts.map +1 -0
  117. package/dist/commands/specs/update.js +139 -0
  118. package/dist/commands/specs/update.js.map +1 -0
  119. package/dist/commands/specs/validate.d.ts +13 -0
  120. package/dist/commands/specs/validate.d.ts.map +1 -0
  121. package/dist/commands/specs/validate.js +165 -0
  122. package/dist/commands/specs/validate.js.map +1 -0
  123. package/dist/commands/specs/write.d.ts +38 -0
  124. package/dist/commands/specs/write.d.ts.map +1 -0
  125. package/dist/commands/specs/write.js +65 -0
  126. package/dist/commands/specs/write.js.map +1 -0
  127. package/dist/frontends/cli.d.ts.map +1 -1
  128. package/dist/frontends/cli.js +186 -0
  129. package/dist/frontends/cli.js.map +1 -1
  130. package/dist/registry/index.d.ts.map +1 -1
  131. package/dist/registry/index.js +2 -0
  132. package/dist/registry/index.js.map +1 -1
  133. package/dist/registry/types.d.ts +22 -0
  134. package/dist/registry/types.d.ts.map +1 -1
  135. package/dist/shared/actor.d.ts +8 -0
  136. package/dist/shared/actor.d.ts.map +1 -0
  137. package/dist/shared/actor.js +65 -0
  138. package/dist/shared/actor.js.map +1 -0
  139. package/dist/shared/constants.d.ts +6 -0
  140. package/dist/shared/constants.d.ts.map +1 -1
  141. package/dist/shared/constants.js +8 -1
  142. package/dist/shared/constants.js.map +1 -1
  143. package/dist/shared/dispatch.d.ts.map +1 -1
  144. package/dist/shared/dispatch.js +2 -0
  145. package/dist/shared/dispatch.js.map +1 -1
  146. package/dist/shared/doc-io.d.ts +46 -0
  147. package/dist/shared/doc-io.d.ts.map +1 -0
  148. package/dist/shared/{plan-io.js → doc-io.js} +23 -18
  149. package/dist/shared/doc-io.js.map +1 -0
  150. package/dist/shared/errors.d.ts +3 -0
  151. package/dist/shared/errors.d.ts.map +1 -0
  152. package/dist/shared/errors.js +6 -0
  153. package/dist/shared/errors.js.map +1 -0
  154. package/dist/shared/graph.d.ts +6 -0
  155. package/dist/shared/graph.d.ts.map +1 -0
  156. package/dist/shared/graph.js +34 -0
  157. package/dist/shared/graph.js.map +1 -0
  158. package/dist/shared/time.d.ts +9 -0
  159. package/dist/shared/time.d.ts.map +1 -0
  160. package/dist/shared/time.js +20 -0
  161. package/dist/shared/time.js.map +1 -0
  162. package/package.json +11 -3
  163. package/dist/shared/plan-io.d.ts +0 -41
  164. package/dist/shared/plan-io.d.ts.map +0 -1
  165. package/dist/shared/plan-io.js.map +0 -1
@@ -0,0 +1,454 @@
1
+ // Implements FR-SPECS-0050 (named result types) / FR-SPECS-0060 (help schemas dictionary) /
2
+ // FR-HELP-0002 (flat named-type dict, $ref-by-name, no anonymous shape at any depth). Mirrors
3
+ // commands/plan/schemas.ts. Every schema here is sourced from the real exported TS types in
4
+ // core.ts/output.ts (SPECS §3/§4) — this file only re-describes their shape as JSON Schema, it
5
+ // never introduces a field the type declarations don't have.
6
+ //
7
+ // $ref convention: { $ref: "<DictKey>" } — string key into specsSchemasDict.
8
+ // Array of named shape: { type:"array", items:{ $ref:"<DictKey>" } }.
9
+ import { SOURCES, MOSCOW, SPEC_TYPES, STATUSES, IMPLS, VERIFS } from "./core.js";
10
+ // ---------------------------------------------------------------------------
11
+ // Shared named schemas — every nested/array-items shape is its own dict entry (FR-HELP-0002).
12
+ // ---------------------------------------------------------------------------
13
+ // AcceptanceCriterion — one Given/When/Then criterion (core.ts)
14
+ const acceptanceCriterionSchema = {
15
+ type: "object",
16
+ description: "One acceptance criterion",
17
+ properties: {
18
+ given: { type: "string" },
19
+ when: { type: "string" },
20
+ then: { type: "string" },
21
+ },
22
+ };
23
+ // Spec — full spec unit (core.ts)
24
+ const specSchema = {
25
+ type: "object",
26
+ description: "A full spec unit",
27
+ properties: {
28
+ id: { type: "string", description: "<PREFIX>-<AREA>-<NNNN>, e.g. FR-CHK-0001" },
29
+ type: { type: "string", enum: SPEC_TYPES },
30
+ level: { type: "string" },
31
+ ticket_id: { type: "string" },
32
+ classification: { type: "string" },
33
+ title: { type: "string" },
34
+ statement: { type: "string" },
35
+ rationale: { type: "string" },
36
+ source: { type: "string", enum: SOURCES },
37
+ priority: { type: "string", enum: MOSCOW },
38
+ status: { type: "string", enum: STATUSES, description: "guarded — settable only via lifecycle ops" },
39
+ approved_by: { type: "string", description: "guarded" },
40
+ changed: { type: "string", description: "guarded — UTC timestamp of the last write that touched this spec" },
41
+ changed_by: { type: "string", description: "guarded — resolved actor" },
42
+ verification: { type: "string", enum: VERIFS },
43
+ acceptance: { type: "array", items: { $ref: "AcceptanceCriterion" } },
44
+ depends_on: { type: "array", items: { type: "string" }, description: "directional, must stay acyclic" },
45
+ related: { type: "array", items: { type: "string" }, description: "associative, may cycle" },
46
+ implementation: { type: "string", enum: IMPLS, description: "guarded — settable only via implemented" },
47
+ implementation_notes: { type: "string" },
48
+ notes: { type: "string" },
49
+ },
50
+ };
51
+ // AreaEntry — {code, name} raw document area entry (core.ts, SpecsDocument.areas). Not itself
52
+ // referenced by any subcommand input/output schema below (SpecInfoResult uses the richer
53
+ // SpecAreaInfo, which adds `count`) — present in the dict solely because FR-SPECS-0050 names it
54
+ // explicitly as one of "the remaining named result types" that SHALL be in the schema dictionary.
55
+ const areaEntrySchema = {
56
+ type: "object",
57
+ description: "One registered area code/name pair on the specs document",
58
+ properties: {
59
+ code: { type: "string" },
60
+ name: { type: "string" },
61
+ },
62
+ };
63
+ // SpecRef — {id, status} used in write/lifecycle results (output.ts)
64
+ const specRefSchema = {
65
+ type: "object",
66
+ description: "A spec's id and its post-write status",
67
+ properties: {
68
+ id: { type: "string" },
69
+ status: { type: "string", enum: STATUSES },
70
+ },
71
+ };
72
+ // SpecDocumentSummary — nested shape for SpecWriteResult.document (output.ts)
73
+ const specDocumentSummarySchema = {
74
+ type: "object",
75
+ description: "Compact document snapshot after a write: component, total spec count, backup path",
76
+ properties: {
77
+ component: { type: "string" },
78
+ total: { type: "integer" },
79
+ previous_version: { type: ["string", "null"], description: "backup path captured at this write, or null on first write" },
80
+ },
81
+ };
82
+ // SpecWriteResult — shared by add, update (output.ts)
83
+ const specWriteResultSchema = {
84
+ type: "object",
85
+ description: "Shared write result returned by add and update",
86
+ properties: {
87
+ document: { $ref: "SpecDocumentSummary" },
88
+ affected: { type: "array", items: { $ref: "SpecRef" } },
89
+ },
90
+ };
91
+ // SpecLifecycleResult — shared by approve, deprecate, restore, reopen (output.ts)
92
+ const specLifecycleResultSchema = {
93
+ type: "object",
94
+ description: "Shared result returned by approve, deprecate, restore, reopen",
95
+ properties: {
96
+ updated: { type: "array", items: { $ref: "SpecRef" } },
97
+ },
98
+ };
99
+ // SpecGetResult — get (output.ts)
100
+ const specGetResultSchema = {
101
+ type: "object",
102
+ description: "Result of get: found spec units (any status, including Removed) plus missing ids",
103
+ properties: {
104
+ found: { type: "array", items: { $ref: "Spec" } },
105
+ missing: { type: "array", items: { type: "string" } },
106
+ },
107
+ };
108
+ // SpecQueryResult — query (output.ts)
109
+ const specQueryResultSchema = {
110
+ type: "object",
111
+ description: "Result of query: matching spec units and their count",
112
+ properties: {
113
+ specs: { type: "array", items: { $ref: "Spec" } },
114
+ count: { type: "integer" },
115
+ },
116
+ };
117
+ // SpecDeleteResult — delete (output.ts)
118
+ const specDeleteResultSchema = {
119
+ type: "object",
120
+ description: "Result of delete: soft-removed ids and ids that did not exist",
121
+ properties: {
122
+ removed: { type: "array", items: { type: "string" } },
123
+ missing: { type: "array", items: { type: "string" } },
124
+ },
125
+ };
126
+ // SpecPurgeResult — purge (output.ts)
127
+ const specPurgeResultSchema = {
128
+ type: "object",
129
+ description: "Result of purge: permanently removed ids and ids that did not exist",
130
+ properties: {
131
+ purged: { type: "array", items: { type: "string" } },
132
+ missing: { type: "array", items: { type: "string" } },
133
+ },
134
+ };
135
+ // SpecImplementedItem — nested shape for SpecImplementedResult.updated (output.ts)
136
+ const specImplementedItemSchema = {
137
+ type: "object",
138
+ description: "A spec's id and its post-write implementation value",
139
+ properties: {
140
+ id: { type: "string" },
141
+ implementation: { type: "string", enum: IMPLS },
142
+ },
143
+ };
144
+ // SpecImplementedResult — implemented (output.ts)
145
+ const specImplementedResultSchema = {
146
+ type: "object",
147
+ description: "Result of implemented",
148
+ properties: {
149
+ updated: { type: "array", items: { $ref: "SpecImplementedItem" } },
150
+ },
151
+ };
152
+ // SpecFinding — nested shape for SpecValidateResult.findings and SpecMigrateResult.warnings (output.ts)
153
+ const specFindingSchema = {
154
+ type: "object",
155
+ description: "One structural or phrasing finding, attributed to a spec id",
156
+ properties: {
157
+ id: { type: "string" },
158
+ check: { type: "string" },
159
+ severity: { type: "string", enum: ["error", "warning", "info"] },
160
+ message: { type: "string" },
161
+ },
162
+ };
163
+ // SpecValidateResult — validate (output.ts)
164
+ const specValidateResultSchema = {
165
+ type: "object",
166
+ description: "Result of validate: whether the scope is clean, findings, and error/warning counts",
167
+ properties: {
168
+ ok: { type: "boolean", description: "true iff error_count is 0; warnings never block" },
169
+ findings: { type: "array", items: { $ref: "SpecFinding" } },
170
+ error_count: { type: "integer" },
171
+ warning_count: { type: "integer" },
172
+ },
173
+ };
174
+ // SpecEdge — nested shape for SpecGraphResult.edges/cycles (output.ts)
175
+ const specEdgeSchema = {
176
+ type: "object",
177
+ description: "One graph edge",
178
+ properties: {
179
+ from: { type: "string" },
180
+ to: { type: "string" },
181
+ kind: { type: "string", enum: ["depends_on", "related"] },
182
+ },
183
+ };
184
+ // SpecGraphResult — graph (output.ts)
185
+ const specGraphResultSchema = {
186
+ type: "object",
187
+ description: "Result of graph. Target mode populates dependencies/dependents/related (cycles always []); " +
188
+ "whole-document mode populates edges instead (dependencies/dependents/related absent). " +
189
+ "cycles/unresolved are always present.",
190
+ properties: {
191
+ dependencies: { type: "array", items: { type: "string" } },
192
+ dependents: { type: "array", items: { type: "string" } },
193
+ related: { type: "array", items: { type: "string" } },
194
+ edges: { type: "array", items: { $ref: "SpecEdge" } },
195
+ cycles: { type: "array", items: { type: "array", items: { $ref: "SpecEdge" } } },
196
+ unresolved: { type: "array", items: { type: "string" } },
197
+ },
198
+ };
199
+ // SpecRenderResult — render (output.ts)
200
+ const specRenderResultSchema = {
201
+ type: "object",
202
+ description: "Result of render: the rendered document string and the format used",
203
+ properties: {
204
+ format: { type: "string", enum: ["markdown", "text"] },
205
+ content: { type: "string" },
206
+ },
207
+ };
208
+ // SpecAreaInfo — nested shape for SpecInfoResult.areas (output.ts)
209
+ const specAreaInfoSchema = {
210
+ type: "object",
211
+ description: "One registered area code/name and its spec count",
212
+ properties: {
213
+ code: { type: "string" },
214
+ name: { type: "string" },
215
+ count: { type: "integer" },
216
+ },
217
+ };
218
+ // SpecTotals — nested shape for SpecInfoResult.totals (output.ts)
219
+ const specTotalsSchema = {
220
+ type: "object",
221
+ description: "Counts of specs grouped by type, status, and implementation, plus the overall total",
222
+ properties: {
223
+ by_type: { type: "object", description: "type value -> count" },
224
+ by_status: { type: "object", description: "status value -> count" },
225
+ by_implementation: { type: "object", description: "implementation value -> count" },
226
+ total: { type: "integer" },
227
+ },
228
+ };
229
+ // SpecNextId — nested shape for SpecInfoResult.next_ids (output.ts)
230
+ const specNextIdSchema = {
231
+ type: "object",
232
+ description: "The next free id for a prefix+area combination that already has at least one spec",
233
+ properties: {
234
+ prefix: { type: "string" },
235
+ area: { type: "string" },
236
+ highest: { type: "integer" },
237
+ suggested: { type: "string" },
238
+ },
239
+ };
240
+ // SpecInfoResult — info (output.ts)
241
+ const specInfoResultSchema = {
242
+ type: "object",
243
+ description: "Result of info: an orientation summary (no full spec bodies)",
244
+ properties: {
245
+ component: { type: "string" },
246
+ description: { type: "string" },
247
+ areas: { type: "array", items: { $ref: "SpecAreaInfo" } },
248
+ totals: { $ref: "SpecTotals" },
249
+ next_ids: { type: "array", items: { $ref: "SpecNextId" } },
250
+ created_at: { type: "string", description: "local display time" },
251
+ updated_at: { type: "string", description: "local display time" },
252
+ },
253
+ };
254
+ // SpecSkipped — nested shape for SpecMigrateResult.skipped (output.ts)
255
+ const specSkippedSchema = {
256
+ type: "object",
257
+ description: "A whole migrate source excluded (not found, or contained no parseable spec blocks)",
258
+ properties: {
259
+ source: { type: "string" },
260
+ reason: { type: "string" },
261
+ },
262
+ };
263
+ // SpecMigrateResult — migrate (output.ts)
264
+ const specMigrateResultSchema = {
265
+ type: "object",
266
+ description: "Result of migrate",
267
+ properties: {
268
+ migrated: { type: "integer" },
269
+ sources: { type: "array", items: { type: "string" } },
270
+ warnings: { type: "array", items: { $ref: "SpecFinding" } },
271
+ skipped: { type: "array", items: { $ref: "SpecSkipped" } },
272
+ },
273
+ };
274
+ // ---------------------------------------------------------------------------
275
+ // Per-subcommand input schemas (FR-SPECS §9/§14) — every field also lives on CommandInput.
276
+ // ---------------------------------------------------------------------------
277
+ const specsFileProp = { type: "string", description: "Path to the specs document JSON file" };
278
+ const idsProp = { type: "array", items: { type: "string" }, description: "One or more spec ids" };
279
+ const dataProp = {
280
+ oneOf: [
281
+ { type: "string", description: "JSON string: a single spec/patch/implemented-item object, or an array (batch)" },
282
+ { type: "object", description: "A single spec/patch/implemented-item object" },
283
+ { type: "array", description: "A batch of spec/patch/implemented-item objects" },
284
+ ],
285
+ };
286
+ export const addInputSchema = {
287
+ type: "object",
288
+ properties: { specs_file: specsFileProp, data: dataProp },
289
+ };
290
+ export const addOutputSchema = { $ref: "SpecWriteResult" };
291
+ export const getInputSchema = {
292
+ type: "object",
293
+ properties: { specs_file: specsFileProp, ids: idsProp },
294
+ };
295
+ export const getOutputSchema = { $ref: "SpecGetResult" };
296
+ export const queryInputSchema = {
297
+ type: "object",
298
+ properties: {
299
+ specs_file: specsFileProp,
300
+ query: { type: "string", description: "Filter query string (see query_notation)" },
301
+ include_removed: { type: "boolean", description: "Include Removed specs even without an explicit status:Removed term" },
302
+ },
303
+ };
304
+ export const queryOutputSchema = { $ref: "SpecQueryResult" };
305
+ export const updateInputSchema = {
306
+ type: "object",
307
+ properties: { specs_file: specsFileProp, data: dataProp },
308
+ };
309
+ export const updateOutputSchema = { $ref: "SpecWriteResult" };
310
+ export const deleteInputSchema = {
311
+ type: "object",
312
+ properties: { specs_file: specsFileProp, ids: idsProp },
313
+ };
314
+ export const deleteOutputSchema = { $ref: "SpecDeleteResult" };
315
+ export const purgeInputSchema = {
316
+ type: "object",
317
+ properties: {
318
+ specs_file: specsFileProp,
319
+ ids: idsProp,
320
+ force: { type: "boolean", description: "Required — permanent removal refuses without it" },
321
+ },
322
+ };
323
+ export const purgeOutputSchema = { $ref: "SpecPurgeResult" };
324
+ export const implementedInputSchema = {
325
+ type: "object",
326
+ properties: { specs_file: specsFileProp, data: dataProp },
327
+ };
328
+ export const implementedOutputSchema = { $ref: "SpecImplementedResult" };
329
+ export const approveInputSchema = {
330
+ type: "object",
331
+ properties: { specs_file: specsFileProp, ids: idsProp },
332
+ };
333
+ export const approveOutputSchema = { $ref: "SpecLifecycleResult" };
334
+ export const deprecateInputSchema = {
335
+ type: "object",
336
+ properties: { specs_file: specsFileProp, ids: idsProp },
337
+ };
338
+ export const deprecateOutputSchema = { $ref: "SpecLifecycleResult" };
339
+ export const restoreInputSchema = {
340
+ type: "object",
341
+ properties: { specs_file: specsFileProp, ids: idsProp },
342
+ };
343
+ export const restoreOutputSchema = { $ref: "SpecLifecycleResult" };
344
+ export const reopenInputSchema = {
345
+ type: "object",
346
+ properties: { specs_file: specsFileProp, ids: idsProp },
347
+ };
348
+ export const reopenOutputSchema = { $ref: "SpecLifecycleResult" };
349
+ export const validateInputSchema = {
350
+ type: "object",
351
+ properties: { specs_file: specsFileProp, query: { type: "string", description: "Optional scope filter" } },
352
+ };
353
+ export const validateOutputSchema = { $ref: "SpecValidateResult" };
354
+ export const graphInputSchema = {
355
+ type: "object",
356
+ properties: {
357
+ specs_file: specsFileProp,
358
+ ids: { type: "array", items: { type: "string" }, description: "Optional target spec id, carried as ids[0] (batch-of-one); omit for whole-document mode" },
359
+ additional_paths: { type: "array", items: { type: "string" }, description: "Other specs documents to resolve cross-document references against" },
360
+ },
361
+ };
362
+ export const graphOutputSchema = { $ref: "SpecGraphResult" };
363
+ export const renderInputSchema = {
364
+ type: "object",
365
+ properties: {
366
+ specs_file: specsFileProp,
367
+ query: { type: "string", description: "Optional scope filter" },
368
+ format: { type: "string", enum: ["markdown", "text"], description: "Default markdown" },
369
+ },
370
+ };
371
+ export const renderOutputSchema = { $ref: "SpecRenderResult" };
372
+ export const infoInputSchema = {
373
+ type: "object",
374
+ properties: { specs_file: specsFileProp },
375
+ };
376
+ export const infoOutputSchema = { $ref: "SpecInfoResult" };
377
+ export const migrateInputSchema = {
378
+ type: "object",
379
+ properties: {
380
+ specs_file: specsFileProp,
381
+ sources: { type: "array", items: { type: "string" }, description: "Legacy markdown source paths" },
382
+ },
383
+ };
384
+ export const migrateOutputSchema = { $ref: "SpecMigrateResult" };
385
+ // FR-HELP-0002 — per-subcommand schema dict, keyed by subcommand name
386
+ export const specsSubcommandSchemas = {
387
+ add: { input: addInputSchema, output: addOutputSchema },
388
+ get: { input: getInputSchema, output: getOutputSchema },
389
+ query: { input: queryInputSchema, output: queryOutputSchema },
390
+ update: { input: updateInputSchema, output: updateOutputSchema },
391
+ delete: { input: deleteInputSchema, output: deleteOutputSchema },
392
+ purge: { input: purgeInputSchema, output: purgeOutputSchema },
393
+ implemented: { input: implementedInputSchema, output: implementedOutputSchema },
394
+ approve: { input: approveInputSchema, output: approveOutputSchema },
395
+ deprecate: { input: deprecateInputSchema, output: deprecateOutputSchema },
396
+ restore: { input: restoreInputSchema, output: restoreOutputSchema },
397
+ reopen: { input: reopenInputSchema, output: reopenOutputSchema },
398
+ validate: { input: validateInputSchema, output: validateOutputSchema },
399
+ graph: { input: graphInputSchema, output: graphOutputSchema },
400
+ render: { input: renderInputSchema, output: renderOutputSchema },
401
+ info: { input: infoInputSchema, output: infoOutputSchema },
402
+ migrate: { input: migrateInputSchema, output: migrateOutputSchema },
403
+ };
404
+ /**
405
+ * FR-SPECS-0050/0060 — flat schemas dict: keyed by exported type name. One entry per distinct
406
+ * named type — inputs, results, and shared data shapes. Used for help display (specsSchemasDict).
407
+ * $ref convention: every array items and every nested object property uses { $ref: "<DictKey>" }.
408
+ */
409
+ export const specsSchemasDict = {
410
+ // Input schemas keyed by exported type name
411
+ SpecAddInput: addInputSchema,
412
+ SpecGetInput: getInputSchema,
413
+ SpecQueryInput: queryInputSchema,
414
+ SpecUpdateInput: updateInputSchema,
415
+ SpecDeleteInput: deleteInputSchema,
416
+ SpecPurgeInput: purgeInputSchema,
417
+ SpecImplementedInput: implementedInputSchema,
418
+ SpecApproveInput: approveInputSchema,
419
+ SpecDeprecateInput: deprecateInputSchema,
420
+ SpecRestoreInput: restoreInputSchema,
421
+ SpecReopenInput: reopenInputSchema,
422
+ SpecValidateInput: validateInputSchema,
423
+ SpecGraphInput: graphInputSchema,
424
+ SpecRenderInput: renderInputSchema,
425
+ SpecInfoInput: infoInputSchema,
426
+ SpecMigrateInput: migrateInputSchema,
427
+ // Result schemas keyed by exported type name
428
+ SpecWriteResult: specWriteResultSchema,
429
+ SpecLifecycleResult: specLifecycleResultSchema,
430
+ SpecGetResult: specGetResultSchema,
431
+ SpecQueryResult: specQueryResultSchema,
432
+ SpecDeleteResult: specDeleteResultSchema,
433
+ SpecPurgeResult: specPurgeResultSchema,
434
+ SpecImplementedResult: specImplementedResultSchema,
435
+ SpecValidateResult: specValidateResultSchema,
436
+ SpecGraphResult: specGraphResultSchema,
437
+ SpecRenderResult: specRenderResultSchema,
438
+ SpecInfoResult: specInfoResultSchema,
439
+ SpecMigrateResult: specMigrateResultSchema,
440
+ // Shared reusable data shapes (FR-SPECS-0050)
441
+ Spec: specSchema,
442
+ AcceptanceCriterion: acceptanceCriterionSchema,
443
+ AreaEntry: areaEntrySchema,
444
+ SpecRef: specRefSchema,
445
+ SpecDocumentSummary: specDocumentSummarySchema,
446
+ SpecImplementedItem: specImplementedItemSchema,
447
+ SpecFinding: specFindingSchema,
448
+ SpecEdge: specEdgeSchema,
449
+ SpecAreaInfo: specAreaInfoSchema,
450
+ SpecTotals: specTotalsSchema,
451
+ SpecNextId: specNextIdSchema,
452
+ SpecSkipped: specSkippedSchema,
453
+ };
454
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/commands/specs/schemas.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,8FAA8F;AAC9F,4FAA4F;AAC5F,+FAA+F;AAC/F,6DAA6D;AAC7D,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjF,8EAA8E;AAC9E,8FAA8F;AAC9F,8EAA8E;AAE9E,gEAAgE;AAChE,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,QAAiB;IACvB,WAAW,EAAE,0BAA0B;IACvC,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QAClC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QACjC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;KAClC;CACF,CAAC;AAEF,kCAAkC;AAClC,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,QAAiB;IACvB,WAAW,EAAE,kBAAkB;IAC/B,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,WAAW,EAAE,0CAA0C,EAAE;QACxF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,IAAI,EAAE,UAAiC,EAAE;QAC1E,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QAClC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QACtC,cAAc,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QAC3C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QAClC,SAAS,EAAE,EAAE,IAAI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;IAC9B,QAAQ,EAAE,cAAc;IACxB,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,WAAW,EAAE,iBAAiB;CAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RunEnvelope } from "../../registry/types.js";
2
+ import { type SpecWriteResult } from "./output.js";
3
+ export declare function cmdUpdate(specsFile: string, patches: unknown[], actor?: string): Promise<RunEnvelope<SpecWriteResult>>;
4
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/specs/update.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAc3D,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,aAAa,CAAC;AAwB9F,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CA2G5H"}
@@ -0,0 +1,139 @@
1
+ // Implements FR-SPECS-0013 (update subcommand). Batch RFC 7396 merge-patch; guarded fields
2
+ // silently dropped; an Approved spec's normative edit (statement/acceptance) auto-transitions to
3
+ // Modified (+ clears approved_by), and if its implementation was Implemented, to ToBeModified.
4
+ // All-or-nothing (FR-SPECS-0030). Resolution: update's authoritative error catalog (SPECS.md
5
+ // FR-SPECS-0013) is exactly {target_not_found, immutable_id, invalid_spec_field,
6
+ // unknown_dependency, dependency_cycle, duplicate_id, size_limit_exceeded, invalid_data,
7
+ // missing_data} — deliberately NOT invalid_type/missing_required_field (those are add-only,
8
+ // SPECS FR-SPECS-0010), so a patch is not re-validated against the full add-time schema. The one
9
+ // exception: source/priority/verification enum membership (FR-SPECS-0001) IS enforced on the
10
+ // merged spec — those are structural (a fixed value set, not an add-time completeness check),
11
+ // so leaving them unchecked would let a patch persist a spec no read path could rely on.
12
+ import { ok, err } from "../../shared/envelope.js";
13
+ import { logger } from "../../shared/logger.js";
14
+ import { applyBatchWrite } from "./write.js";
15
+ import { aggregate } from "./aggregate.js";
16
+ import { stripGuarded, validateImmutableId, validateKnownFields, validatePriority, validateSource, validateVerification, } from "./core.js";
17
+ import { buildSpecWriteResult, withPreviousVersion } from "./output.js";
18
+ import { ERR_INVALID_DATA, ERR_MISSING_DATA, ERR_MISSING_ID, ERR_TARGET_NOT_FOUND } from "./errors.js";
19
+ /**
20
+ * RFC 7396 JSON Merge Patch (specs-local copy of the plan pattern — NOT imported from
21
+ * commands/plan to avoid command→command coupling, per architecture-notes' detectCycle
22
+ * precedent). `null` removes a key; nested plain objects merge recursively; scalars and arrays
23
+ * replace wholesale (Spec has no nested plain-object fields, so the recursion never actually
24
+ * descends for this command's data, but the general form is kept for parity/future-proofing).
25
+ */
26
+ function mergePatch(target, patch) {
27
+ if (typeof patch !== "object" || patch === null || Array.isArray(patch))
28
+ return patch;
29
+ if (typeof target !== "object" || target === null || Array.isArray(target))
30
+ target = {};
31
+ const result = { ...target };
32
+ for (const [key, value] of Object.entries(patch)) {
33
+ if (value === null) {
34
+ delete result[key];
35
+ }
36
+ else {
37
+ result[key] = mergePatch(result[key] ?? {}, value);
38
+ }
39
+ }
40
+ return result;
41
+ }
42
+ export async function cmdUpdate(specsFile, patches, actor) {
43
+ try {
44
+ if (!patches || patches.length === 0)
45
+ return err(ERR_MISSING_DATA, true);
46
+ const build = (doc) => {
47
+ const rejects = [];
48
+ const affected = [];
49
+ patches.forEach((raw, index) => {
50
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
51
+ // FR-SPECS-0013: a non-object patch item is invalid_data (not invalid_spec_field,
52
+ // which is reserved for an object carrying an unknown field).
53
+ rejects.push({ ref: `index ${index}`, reason: ERR_INVALID_DATA });
54
+ return;
55
+ }
56
+ const patch = raw;
57
+ const targetId = typeof patch["id"] === "string" ? patch["id"] : undefined;
58
+ if (!targetId) {
59
+ rejects.push({ ref: `index ${index}`, reason: ERR_MISSING_ID });
60
+ return;
61
+ }
62
+ const idx = (doc.specs ?? []).findIndex((s) => s.id === targetId);
63
+ if (idx < 0) {
64
+ rejects.push({ ref: targetId, reason: ERR_TARGET_NOT_FOUND });
65
+ return;
66
+ }
67
+ const existing = doc.specs[idx];
68
+ // FR-SPECS-0013 — a patch body carrying a different id is rejected. This is
69
+ // STRUCTURALLY UNREACHABLE in this design: targetId (the lookup key used just above to
70
+ // find `existing`) IS patch["id"] itself, so validateImmutableId(targetId, existing.id)
71
+ // always compares targetId to itself and can never observe a mismatch. Kept anyway per
72
+ // SPECS §10 and the plan-upsert precedent it mirrors — a cheap defensive net that costs
73
+ // nothing and guards against a future refactor that changes how the target is resolved.
74
+ const immutableErr = validateImmutableId(targetId, existing.id);
75
+ if (immutableErr) {
76
+ rejects.push({ ref: targetId, reason: immutableErr });
77
+ return;
78
+ }
79
+ // FR-SPECS-0040 — guarded fields silently dropped; `id` is excluded from the merge
80
+ // itself (immutable), never passed to mergePatch at all.
81
+ const { id: _dropId, ...patchWithoutId } = stripGuarded(patch);
82
+ const knownErr = validateKnownFields(patchWithoutId);
83
+ if (knownErr) {
84
+ rejects.push({ ref: targetId, reason: knownErr });
85
+ return;
86
+ }
87
+ const merged = mergePatch(existing, patchWithoutId);
88
+ merged.id = existing.id;
89
+ // FR-SPECS-0001 — source/priority/verification enum membership is structural (same
90
+ // treatment as add's invalid_type), so a patch that leaves the resulting spec with a
91
+ // value outside the allowed enum is a hard rejection, not silently merged.
92
+ const sourceErr = validateSource(merged.source);
93
+ if (sourceErr) {
94
+ rejects.push({ ref: targetId, reason: sourceErr });
95
+ return;
96
+ }
97
+ const priorityErr = validatePriority(merged.priority);
98
+ if (priorityErr) {
99
+ rejects.push({ ref: targetId, reason: priorityErr });
100
+ return;
101
+ }
102
+ const verificationErr = validateVerification(merged.verification);
103
+ if (verificationErr) {
104
+ rejects.push({ ref: targetId, reason: verificationErr });
105
+ return;
106
+ }
107
+ // FR-SPECS-0013 — normative edit (statement|acceptance) on an Approved spec forces
108
+ // re-approval; if its implementation was Implemented, the implementation is revisited.
109
+ const normativeEdit = patchWithoutId["statement"] !== undefined || patchWithoutId["acceptance"] !== undefined;
110
+ if (normativeEdit && existing.status === "Approved") {
111
+ merged.status = "Modified"; // guarded — set only here, inside the write-path build
112
+ merged.approved_by = "";
113
+ }
114
+ if (normativeEdit && existing.implementation === "Implemented") {
115
+ merged.implementation = "ToBeModified";
116
+ }
117
+ doc.specs[idx] = merged;
118
+ affected.push(targetId);
119
+ });
120
+ if (rejects.length > 0) {
121
+ return { ok: false, error: aggregate(rejects[0].reason, rejects) };
122
+ }
123
+ const result = buildSpecWriteResult(doc, affected, null);
124
+ return { ok: true, affected, result };
125
+ };
126
+ const writeResult = await applyBatchWrite(specsFile, build, { actor }); // update never creates (FR-SPECS-0013 targets must pre-exist)
127
+ if (!writeResult.ok) {
128
+ return { ok: false, result: null, error: writeResult.error, include_help: writeResult.include_help };
129
+ }
130
+ const { result, previous_version } = writeResult.result;
131
+ logger.info({ specsFile, count: result.affected.length }, "specs update");
132
+ return ok(withPreviousVersion(result, previous_version));
133
+ }
134
+ catch (e) {
135
+ const msg = e instanceof Error ? e.message : String(e);
136
+ return err(`internal_error: ${msg}`);
137
+ }
138
+ }
139
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/specs/update.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,iGAAiG;AACjG,+FAA+F;AAC/F,6FAA6F;AAC7F,iFAAiF;AACjF,yFAAyF;AACzF,4FAA4F;AAC5F,iGAAiG;AACjG,6FAA6F;AAC7F,8FAA8F;AAC9F,yFAAyF;AAGzF,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACh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