mustflow 2.18.2 → 2.18.7

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 (34) hide show
  1. package/README.md +2 -0
  2. package/dist/cli/commands/run/builtin-dispatch.js +92 -0
  3. package/dist/cli/commands/run/executor.js +149 -0
  4. package/dist/cli/commands/run/output.js +59 -0
  5. package/dist/cli/commands/run/process-tree.js +91 -0
  6. package/dist/cli/commands/run/receipt.js +42 -0
  7. package/dist/cli/commands/run.js +17 -382
  8. package/dist/cli/commands/verify/args.js +262 -0
  9. package/dist/cli/commands/verify.js +1 -262
  10. package/dist/cli/i18n/en.js +1 -0
  11. package/dist/cli/i18n/es.js +1 -0
  12. package/dist/cli/i18n/fr.js +1 -0
  13. package/dist/cli/i18n/hi.js +1 -0
  14. package/dist/cli/i18n/ko.js +1 -0
  15. package/dist/cli/i18n/zh.js +1 -0
  16. package/dist/cli/index.js +6 -72
  17. package/dist/cli/lib/command-registry.js +27 -0
  18. package/dist/cli/lib/dashboard-export.js +2 -1
  19. package/dist/cli/lib/dashboard-html/locale-bootstrap.js +3 -2
  20. package/dist/cli/lib/dashboard-html/template.js +5 -4
  21. package/dist/cli/lib/html-json.js +11 -0
  22. package/dist/cli/lib/local-index/index.js +166 -14
  23. package/dist/cli/lib/run-plan.js +6 -0
  24. package/dist/core/check-issues.js +1 -0
  25. package/dist/core/command-contract-rules.js +0 -3
  26. package/dist/core/command-contract-validation.js +42 -4
  27. package/dist/core/command-intent-eligibility.js +4 -4
  28. package/dist/core/contract-lint.js +3 -3
  29. package/package.json +1 -1
  30. package/templates/default/i18n.toml +7 -1
  31. package/templates/default/locales/en/.mustflow/skills/INDEX.md +2 -1
  32. package/templates/default/locales/en/.mustflow/skills/routes.toml +6 -0
  33. package/templates/default/locales/en/.mustflow/skills/source-anchor-authoring/SKILL.md +147 -0
  34. package/templates/default/manifest.toml +8 -1
@@ -0,0 +1,262 @@
1
+ export const DEFAULT_VERIFY_PARALLELISM = 1;
2
+ export function parseVerifyArgs(args) {
3
+ let reason;
4
+ let fromClassification;
5
+ let fromPlan;
6
+ let writePlan;
7
+ let reproEvidence;
8
+ let externalEvidence;
9
+ let json = false;
10
+ let planOnly = false;
11
+ let changed = false;
12
+ let parallelism = DEFAULT_VERIFY_PARALLELISM;
13
+ for (let index = 0; index < args.length; index += 1) {
14
+ const arg = args[index];
15
+ if (arg === '--json') {
16
+ json = true;
17
+ continue;
18
+ }
19
+ if (arg === '--plan-only') {
20
+ planOnly = true;
21
+ continue;
22
+ }
23
+ if (arg === '--changed') {
24
+ changed = true;
25
+ continue;
26
+ }
27
+ if (arg === '--parallel') {
28
+ const value = args[index + 1];
29
+ if (!value || value.startsWith('-')) {
30
+ return { json, planOnly, changed, reason, parallelism, error: 'missing_parallel_value' };
31
+ }
32
+ const parsedParallelism = parseVerifyParallelism(value);
33
+ if (parsedParallelism === null) {
34
+ return { json, planOnly, changed, reason, parallelism, error: 'invalid_parallel_value' };
35
+ }
36
+ parallelism = parsedParallelism;
37
+ index += 1;
38
+ continue;
39
+ }
40
+ if (arg === '--reason') {
41
+ const value = args[index + 1];
42
+ if (!value || value.startsWith('-')) {
43
+ return { json, planOnly, changed, reason, error: 'missing_reason_value' };
44
+ }
45
+ reason = value;
46
+ index += 1;
47
+ continue;
48
+ }
49
+ if (arg === '--from-plan') {
50
+ const value = args[index + 1];
51
+ if (!value || value.startsWith('-')) {
52
+ return { json, planOnly, changed, reason, fromClassification, fromPlan, error: 'missing_from_plan_value' };
53
+ }
54
+ fromPlan = value;
55
+ index += 1;
56
+ continue;
57
+ }
58
+ if (arg === '--from-classification') {
59
+ const value = args[index + 1];
60
+ if (!value || value.startsWith('-')) {
61
+ return {
62
+ json,
63
+ planOnly,
64
+ changed,
65
+ reason,
66
+ fromClassification,
67
+ fromPlan,
68
+ error: 'missing_from_classification_value',
69
+ };
70
+ }
71
+ fromClassification = value;
72
+ index += 1;
73
+ continue;
74
+ }
75
+ if (arg === '--write-plan') {
76
+ const value = args[index + 1];
77
+ if (!value || value.startsWith('-')) {
78
+ return {
79
+ json,
80
+ planOnly,
81
+ changed,
82
+ reason,
83
+ fromClassification,
84
+ fromPlan,
85
+ writePlan,
86
+ error: 'missing_write_plan_value',
87
+ };
88
+ }
89
+ writePlan = value;
90
+ index += 1;
91
+ continue;
92
+ }
93
+ if (arg === '--external-evidence') {
94
+ const value = args[index + 1];
95
+ if (!value || value.startsWith('-')) {
96
+ return {
97
+ json,
98
+ planOnly,
99
+ changed,
100
+ reason,
101
+ fromClassification,
102
+ fromPlan,
103
+ writePlan,
104
+ externalEvidence,
105
+ error: 'missing_external_evidence_value',
106
+ };
107
+ }
108
+ externalEvidence = value;
109
+ index += 1;
110
+ continue;
111
+ }
112
+ if (arg === '--repro-evidence') {
113
+ const value = args[index + 1];
114
+ if (!value || value.startsWith('-')) {
115
+ return {
116
+ json,
117
+ planOnly,
118
+ changed,
119
+ reason,
120
+ fromClassification,
121
+ fromPlan,
122
+ writePlan,
123
+ reproEvidence,
124
+ externalEvidence,
125
+ error: 'missing_repro_evidence_value',
126
+ };
127
+ }
128
+ reproEvidence = value;
129
+ index += 1;
130
+ continue;
131
+ }
132
+ if (arg.startsWith('--reason=')) {
133
+ const value = arg.slice('--reason='.length);
134
+ if (value.length === 0) {
135
+ return { json, planOnly, changed, reason, error: 'missing_reason_value' };
136
+ }
137
+ reason = value;
138
+ continue;
139
+ }
140
+ if (arg.startsWith('--parallel=')) {
141
+ const value = arg.slice('--parallel='.length);
142
+ const parsedParallelism = parseVerifyParallelism(value);
143
+ if (parsedParallelism === null) {
144
+ return { json, planOnly, changed, reason, parallelism, error: 'invalid_parallel_value' };
145
+ }
146
+ parallelism = parsedParallelism;
147
+ continue;
148
+ }
149
+ if (arg.startsWith('--from-plan=')) {
150
+ const value = arg.slice('--from-plan='.length);
151
+ if (value.length === 0) {
152
+ return { json, planOnly, changed, reason, fromClassification, fromPlan, error: 'missing_from_plan_value' };
153
+ }
154
+ fromPlan = value;
155
+ continue;
156
+ }
157
+ if (arg.startsWith('--from-classification=')) {
158
+ const value = arg.slice('--from-classification='.length);
159
+ if (value.length === 0) {
160
+ return {
161
+ json,
162
+ planOnly,
163
+ changed,
164
+ reason,
165
+ fromClassification,
166
+ fromPlan,
167
+ error: 'missing_from_classification_value',
168
+ };
169
+ }
170
+ fromClassification = value;
171
+ continue;
172
+ }
173
+ if (arg.startsWith('--write-plan=')) {
174
+ const value = arg.slice('--write-plan='.length);
175
+ if (value.length === 0) {
176
+ return {
177
+ json,
178
+ planOnly,
179
+ changed,
180
+ reason,
181
+ fromClassification,
182
+ fromPlan,
183
+ writePlan,
184
+ error: 'missing_write_plan_value',
185
+ };
186
+ }
187
+ writePlan = value;
188
+ continue;
189
+ }
190
+ if (arg.startsWith('--external-evidence=')) {
191
+ const value = arg.slice('--external-evidence='.length);
192
+ if (value.length === 0) {
193
+ return {
194
+ json,
195
+ planOnly,
196
+ changed,
197
+ reason,
198
+ fromClassification,
199
+ fromPlan,
200
+ writePlan,
201
+ externalEvidence,
202
+ error: 'missing_external_evidence_value',
203
+ };
204
+ }
205
+ externalEvidence = value;
206
+ continue;
207
+ }
208
+ if (arg.startsWith('--repro-evidence=')) {
209
+ const value = arg.slice('--repro-evidence='.length);
210
+ if (value.length === 0) {
211
+ return {
212
+ json,
213
+ planOnly,
214
+ changed,
215
+ reason,
216
+ fromClassification,
217
+ fromPlan,
218
+ writePlan,
219
+ reproEvidence,
220
+ externalEvidence,
221
+ error: 'missing_repro_evidence_value',
222
+ };
223
+ }
224
+ reproEvidence = value;
225
+ continue;
226
+ }
227
+ if (arg.startsWith('-')) {
228
+ return { json, planOnly, changed, reason, fromClassification, fromPlan, writePlan, reproEvidence, externalEvidence, error: arg };
229
+ }
230
+ return {
231
+ json,
232
+ planOnly,
233
+ changed,
234
+ reason,
235
+ fromClassification,
236
+ fromPlan,
237
+ writePlan,
238
+ reproEvidence,
239
+ externalEvidence,
240
+ error: `unexpected:${arg}`,
241
+ };
242
+ }
243
+ return {
244
+ json,
245
+ planOnly,
246
+ changed,
247
+ reason,
248
+ fromClassification,
249
+ fromPlan,
250
+ writePlan,
251
+ reproEvidence,
252
+ externalEvidence,
253
+ parallelism,
254
+ };
255
+ }
256
+ function parseVerifyParallelism(value) {
257
+ if (!/^[1-9][0-9]*$/u.test(value)) {
258
+ return null;
259
+ }
260
+ const parsed = Number(value);
261
+ return Number.isSafeInteger(parsed) ? parsed : null;
262
+ }
@@ -13,6 +13,7 @@ import { createVerifyEvidenceModel } from '../../core/verification-evidence.js';
13
13
  import { createScopeDiffRisks } from '../../core/scope-risk.js';
14
14
  import { countValidationRatchetVerdictEffects, createValidationRatchetRisks, } from '../../core/validation-ratchet.js';
15
15
  import { readCommandContract } from '../../core/config-loading.js';
16
+ import { DEFAULT_VERIFY_PARALLELISM, parseVerifyArgs } from './verify/args.js';
16
17
  import { printUsageError, renderHelp } from '../lib/cli-output.js';
17
18
  import { t } from '../lib/i18n.js';
18
19
  import { readLocalCommandEffectGraph, readLocalPathSurfaces, readLocalSourceAnchorVerdictRisks, } from '../lib/local-index.js';
@@ -20,7 +21,6 @@ import { resolveMustflowRoot } from '../lib/project-root.js';
20
21
  const VERIFY_SCHEMA_VERSION = '1';
21
22
  const RUN_STATE_DIR = path.join('.mustflow', 'state', 'runs');
22
23
  const LATEST_RUN_RECEIPT_PATH = path.join(RUN_STATE_DIR, 'latest.json');
23
- const DEFAULT_VERIFY_PARALLELISM = 1;
24
24
  function createBufferedOutput() {
25
25
  const stdout = [];
26
26
  const stderr = [];
@@ -73,267 +73,6 @@ export function getVerifyHelp(lang = 'en') {
73
73
  ],
74
74
  }, lang);
75
75
  }
76
- function parseVerifyArgs(args) {
77
- let reason;
78
- let fromClassification;
79
- let fromPlan;
80
- let writePlan;
81
- let reproEvidence;
82
- let externalEvidence;
83
- let json = false;
84
- let planOnly = false;
85
- let changed = false;
86
- let parallelism = DEFAULT_VERIFY_PARALLELISM;
87
- for (let index = 0; index < args.length; index += 1) {
88
- const arg = args[index];
89
- if (arg === '--json') {
90
- json = true;
91
- continue;
92
- }
93
- if (arg === '--plan-only') {
94
- planOnly = true;
95
- continue;
96
- }
97
- if (arg === '--changed') {
98
- changed = true;
99
- continue;
100
- }
101
- if (arg === '--parallel') {
102
- const value = args[index + 1];
103
- if (!value || value.startsWith('-')) {
104
- return { json, planOnly, changed, reason, parallelism, error: 'missing_parallel_value' };
105
- }
106
- const parsedParallelism = parseVerifyParallelism(value);
107
- if (parsedParallelism === null) {
108
- return { json, planOnly, changed, reason, parallelism, error: 'invalid_parallel_value' };
109
- }
110
- parallelism = parsedParallelism;
111
- index += 1;
112
- continue;
113
- }
114
- if (arg === '--reason') {
115
- const value = args[index + 1];
116
- if (!value || value.startsWith('-')) {
117
- return { json, planOnly, changed, reason, error: 'missing_reason_value' };
118
- }
119
- reason = value;
120
- index += 1;
121
- continue;
122
- }
123
- if (arg === '--from-plan') {
124
- const value = args[index + 1];
125
- if (!value || value.startsWith('-')) {
126
- return { json, planOnly, changed, reason, fromClassification, fromPlan, error: 'missing_from_plan_value' };
127
- }
128
- fromPlan = value;
129
- index += 1;
130
- continue;
131
- }
132
- if (arg === '--from-classification') {
133
- const value = args[index + 1];
134
- if (!value || value.startsWith('-')) {
135
- return {
136
- json,
137
- planOnly,
138
- changed,
139
- reason,
140
- fromClassification,
141
- fromPlan,
142
- error: 'missing_from_classification_value',
143
- };
144
- }
145
- fromClassification = value;
146
- index += 1;
147
- continue;
148
- }
149
- if (arg === '--write-plan') {
150
- const value = args[index + 1];
151
- if (!value || value.startsWith('-')) {
152
- return {
153
- json,
154
- planOnly,
155
- changed,
156
- reason,
157
- fromClassification,
158
- fromPlan,
159
- writePlan,
160
- error: 'missing_write_plan_value',
161
- };
162
- }
163
- writePlan = value;
164
- index += 1;
165
- continue;
166
- }
167
- if (arg === '--external-evidence') {
168
- const value = args[index + 1];
169
- if (!value || value.startsWith('-')) {
170
- return {
171
- json,
172
- planOnly,
173
- changed,
174
- reason,
175
- fromClassification,
176
- fromPlan,
177
- writePlan,
178
- externalEvidence,
179
- error: 'missing_external_evidence_value',
180
- };
181
- }
182
- externalEvidence = value;
183
- index += 1;
184
- continue;
185
- }
186
- if (arg === '--repro-evidence') {
187
- const value = args[index + 1];
188
- if (!value || value.startsWith('-')) {
189
- return {
190
- json,
191
- planOnly,
192
- changed,
193
- reason,
194
- fromClassification,
195
- fromPlan,
196
- writePlan,
197
- reproEvidence,
198
- externalEvidence,
199
- error: 'missing_repro_evidence_value',
200
- };
201
- }
202
- reproEvidence = value;
203
- index += 1;
204
- continue;
205
- }
206
- if (arg.startsWith('--reason=')) {
207
- const value = arg.slice('--reason='.length);
208
- if (value.length === 0) {
209
- return { json, planOnly, changed, reason, error: 'missing_reason_value' };
210
- }
211
- reason = value;
212
- continue;
213
- }
214
- if (arg.startsWith('--parallel=')) {
215
- const value = arg.slice('--parallel='.length);
216
- const parsedParallelism = parseVerifyParallelism(value);
217
- if (parsedParallelism === null) {
218
- return { json, planOnly, changed, reason, parallelism, error: 'invalid_parallel_value' };
219
- }
220
- parallelism = parsedParallelism;
221
- continue;
222
- }
223
- if (arg.startsWith('--from-plan=')) {
224
- const value = arg.slice('--from-plan='.length);
225
- if (value.length === 0) {
226
- return { json, planOnly, changed, reason, fromClassification, fromPlan, error: 'missing_from_plan_value' };
227
- }
228
- fromPlan = value;
229
- continue;
230
- }
231
- if (arg.startsWith('--from-classification=')) {
232
- const value = arg.slice('--from-classification='.length);
233
- if (value.length === 0) {
234
- return {
235
- json,
236
- planOnly,
237
- changed,
238
- reason,
239
- fromClassification,
240
- fromPlan,
241
- error: 'missing_from_classification_value',
242
- };
243
- }
244
- fromClassification = value;
245
- continue;
246
- }
247
- if (arg.startsWith('--write-plan=')) {
248
- const value = arg.slice('--write-plan='.length);
249
- if (value.length === 0) {
250
- return {
251
- json,
252
- planOnly,
253
- changed,
254
- reason,
255
- fromClassification,
256
- fromPlan,
257
- writePlan,
258
- error: 'missing_write_plan_value',
259
- };
260
- }
261
- writePlan = value;
262
- continue;
263
- }
264
- if (arg.startsWith('--external-evidence=')) {
265
- const value = arg.slice('--external-evidence='.length);
266
- if (value.length === 0) {
267
- return {
268
- json,
269
- planOnly,
270
- changed,
271
- reason,
272
- fromClassification,
273
- fromPlan,
274
- writePlan,
275
- externalEvidence,
276
- error: 'missing_external_evidence_value',
277
- };
278
- }
279
- externalEvidence = value;
280
- continue;
281
- }
282
- if (arg.startsWith('--repro-evidence=')) {
283
- const value = arg.slice('--repro-evidence='.length);
284
- if (value.length === 0) {
285
- return {
286
- json,
287
- planOnly,
288
- changed,
289
- reason,
290
- fromClassification,
291
- fromPlan,
292
- writePlan,
293
- reproEvidence,
294
- externalEvidence,
295
- error: 'missing_repro_evidence_value',
296
- };
297
- }
298
- reproEvidence = value;
299
- continue;
300
- }
301
- if (arg.startsWith('-')) {
302
- return { json, planOnly, changed, reason, fromClassification, fromPlan, writePlan, reproEvidence, externalEvidence, error: arg };
303
- }
304
- return {
305
- json,
306
- planOnly,
307
- changed,
308
- reason,
309
- fromClassification,
310
- fromPlan,
311
- writePlan,
312
- reproEvidence,
313
- externalEvidence,
314
- error: `unexpected:${arg}`,
315
- };
316
- }
317
- return {
318
- json,
319
- planOnly,
320
- changed,
321
- reason,
322
- fromClassification,
323
- fromPlan,
324
- writePlan,
325
- reproEvidence,
326
- externalEvidence,
327
- parallelism,
328
- };
329
- }
330
- function parseVerifyParallelism(value) {
331
- if (!/^[1-9][0-9]*$/u.test(value)) {
332
- return null;
333
- }
334
- const parsed = Number(value);
335
- return Number.isSafeInteger(parsed) ? parsed : null;
336
- }
337
76
  function uniqueStrings(values) {
338
77
  return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))];
339
78
  }
@@ -672,6 +672,7 @@ Read these files before working:
672
672
  "run.error.maxOutputBytesDetail": "The output limit must stay within the allowed maximum.",
673
673
  "run.error.conflictingPreviewModes": "Use either --dry-run or --plan-only, not both",
674
674
  "run.error.timedOut": 'Command "{intent}" timed out after {seconds} seconds',
675
+ "run.error.outputLimitExceeded": 'Command "{intent}" exceeded max_output_bytes: {message}',
675
676
  "run.error.startFailed": 'Command "{intent}" failed to start: {message}',
676
677
  "search.help.summary": "Search the local SQLite index for the mustflow workflow.",
677
678
  "search.help.option.limit": "Set the number of results to print. Default: 10, max: 50",
@@ -672,6 +672,7 @@ Lee estos archivos antes de trabajar:
672
672
  "run.error.maxOutputBytesDetail": "El límite de salida debe permanecer dentro del máximo permitido.",
673
673
  "run.error.conflictingPreviewModes": "Usa --dry-run o --plan-only, no ambos",
674
674
  "run.error.timedOut": 'El comando "{intent}" agotó el tiempo después de {seconds} segundos',
675
+ "run.error.outputLimitExceeded": 'El comando "{intent}" superó max_output_bytes: {message}',
675
676
  "run.error.startFailed": 'No se pudo iniciar el comando "{intent}": {message}',
676
677
  "search.help.summary": "Busca en el índice SQLite local del flujo de trabajo mustflow.",
677
678
  "search.help.option.limit": "Define la cantidad de resultados que se imprimen. Predeterminado: 10, máximo: 50",
@@ -672,6 +672,7 @@ Lisez ces fichiers avant de travailler :
672
672
  "run.error.maxOutputBytesDetail": "La limite de sortie doit rester dans le maximum autorisé.",
673
673
  "run.error.conflictingPreviewModes": "Utilisez --dry-run ou --plan-only, pas les deux",
674
674
  "run.error.timedOut": 'La commande "{intent}" a expiré après {seconds} secondes',
675
+ "run.error.outputLimitExceeded": 'La commande "{intent}" a dépassé max_output_bytes : {message}',
675
676
  "run.error.startFailed": 'Impossible de démarrer la commande "{intent}" : {message}',
676
677
  "search.help.summary": "Recherche dans l'index SQLite local du flux de travail mustflow.",
677
678
  "search.help.option.limit": "Définit le nombre de résultats à imprimer. Par défaut : 10, max : 50",
@@ -672,6 +672,7 @@ export const hiMessages = {
672
672
  "run.error.maxOutputBytesDetail": "Output limit अनुमत maximum के अंदर रहनी चाहिए।",
673
673
  "run.error.conflictingPreviewModes": "--dry-run या --plan-only में से एक इस्तेमाल करें, दोनों नहीं",
674
674
  "run.error.timedOut": 'कमांड "{intent}" {seconds} सेकंड बाद time out हुई',
675
+ "run.error.outputLimitExceeded": 'कमांड "{intent}" ने max_output_bytes सीमा पार की: {message}',
675
676
  "run.error.startFailed": 'कमांड "{intent}" शुरू नहीं हो सकी: {message}',
676
677
  "search.help.summary": "mustflow वर्कफ़्लो के लिए स्थानीय SQLite इंडेक्स में खोजें।",
677
678
  "search.help.option.limit": "प्रिंट किए जाने वाले परिणामों की संख्या सेट करें। डिफ़ॉल्ट: 10, अधिकतम: 50",
@@ -672,6 +672,7 @@ export const koMessages = {
672
672
  "run.error.maxOutputBytesDetail": "출력 상한은 허용된 최댓값 안에 있어야 합니다.",
673
673
  "run.error.conflictingPreviewModes": "--dry-run과 --plan-only 중 하나만 사용하세요",
674
674
  "run.error.timedOut": '명령 "{intent}"가 {seconds}초 뒤 시간 초과되었습니다',
675
+ "run.error.outputLimitExceeded": '명령 "{intent}"가 max_output_bytes 제한을 넘었습니다: {message}',
675
676
  "run.error.startFailed": '명령 "{intent}"를 시작하지 못했습니다: {message}',
676
677
  "search.help.summary": "로컬 SQLite 색인에서 mustflow 워크플로우를 검색합니다.",
677
678
  "search.help.option.limit": "출력할 검색 결과 수를 설정합니다. 기본값: 10, 최대: 50",
@@ -672,6 +672,7 @@ export const zhMessages = {
672
672
  "run.error.maxOutputBytesDetail": "输出限制必须保持在允许的最大值内。",
673
673
  "run.error.conflictingPreviewModes": "只能使用 --dry-run 或 --plan-only,不能同时使用",
674
674
  "run.error.timedOut": '命令 "{intent}" 在 {seconds} 秒后超时',
675
+ "run.error.outputLimitExceeded": '命令 "{intent}" 超过 max_output_bytes:{message}',
675
676
  "run.error.startFailed": '命令 "{intent}" 启动失败:{message}',
676
677
  "search.help.summary": "搜索本地 SQLite 索引中的 mustflow 工作流。",
677
678
  "search.help.option.limit": "设置要输出的结果数量。默认值:10,最大:50",