mustflow 2.74.4 → 2.74.5
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.
|
@@ -2,12 +2,14 @@ import { createClassifyOutput } from './classify.js';
|
|
|
2
2
|
import { createChangeVerificationReport, } from '../../core/change-verification.js';
|
|
3
3
|
import { isRecord, readCommandContract, } from '../../core/config-loading.js';
|
|
4
4
|
import { createVerificationPlanId } from '../../core/verification-plan-id.js';
|
|
5
|
+
import { createScriptPackSuggestionReport, } from '../../core/script-pack-suggestions.js';
|
|
5
6
|
import { printUsageError, renderHelp } from '../lib/cli-output.js';
|
|
6
7
|
import { getAgentContext } from '../lib/agent-context.js';
|
|
7
8
|
import { t } from '../lib/i18n.js';
|
|
8
9
|
import { formatCliOptionParseError, hasCliOptionToken, hasParsedCliOption, parseCliOptions, } from '../lib/option-parser.js';
|
|
9
10
|
import { resolveMustflowRoot } from '../lib/project-root.js';
|
|
10
11
|
import { createRunPlan } from '../lib/run-plan.js';
|
|
12
|
+
import { listScriptPackScripts } from '../lib/script-pack-registry.js';
|
|
11
13
|
import { checkMustflowProjectReport } from '../lib/validation.js';
|
|
12
14
|
const NEXT_SCHEMA_VERSION = '1';
|
|
13
15
|
const COMMAND_AUTHORITY = '.mustflow/config/commands.toml';
|
|
@@ -65,6 +67,7 @@ function toOutput(input) {
|
|
|
65
67
|
blockers: input.blockers ?? [],
|
|
66
68
|
warnings: input.warnings ?? [],
|
|
67
69
|
gaps: input.gaps ?? [],
|
|
70
|
+
script_pack_suggestions: input.scriptPackSuggestions ?? createEmptyScriptPackSuggestions(),
|
|
68
71
|
verification_plan_id: input.verificationPlanId ?? null,
|
|
69
72
|
};
|
|
70
73
|
}
|
|
@@ -82,6 +85,39 @@ function toNextGap(gap) {
|
|
|
82
85
|
detail: gap.detail,
|
|
83
86
|
};
|
|
84
87
|
}
|
|
88
|
+
function createEmptyScriptPackSuggestions() {
|
|
89
|
+
return {
|
|
90
|
+
status: 'empty',
|
|
91
|
+
input: {
|
|
92
|
+
phases: [],
|
|
93
|
+
skills: [],
|
|
94
|
+
paths: [],
|
|
95
|
+
changed: false,
|
|
96
|
+
},
|
|
97
|
+
analyzed_paths: [],
|
|
98
|
+
suggestions: [],
|
|
99
|
+
issues: [],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function createNextScriptPackSuggestions(mustflowRoot, classification) {
|
|
103
|
+
if (classification.files.length === 0) {
|
|
104
|
+
return createEmptyScriptPackSuggestions();
|
|
105
|
+
}
|
|
106
|
+
const report = createScriptPackSuggestionReport(mustflowRoot, {
|
|
107
|
+
changed: false,
|
|
108
|
+
phases: ['after_change', 'review'],
|
|
109
|
+
skills: [],
|
|
110
|
+
paths: classification.files,
|
|
111
|
+
scripts: listScriptPackScripts(),
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
status: report.status,
|
|
115
|
+
input: report.input,
|
|
116
|
+
analyzed_paths: report.analyzed_paths,
|
|
117
|
+
suggestions: report.suggestions,
|
|
118
|
+
issues: report.issues,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
85
121
|
function runnableIntentCommand(mustflowRoot, contract, intentName) {
|
|
86
122
|
const rawIntent = contract.intents[intentName];
|
|
87
123
|
if (!isRecord(rawIntent)) {
|
|
@@ -100,6 +136,7 @@ function createChangedOutput(mustflowRoot, contract, classification, report) {
|
|
|
100
136
|
const intents = selectedIntents(report);
|
|
101
137
|
const gaps = report.gaps.map(toNextGap);
|
|
102
138
|
const verificationPlanId = createVerificationPlanId(report, contract);
|
|
139
|
+
const scriptPackSuggestions = createNextScriptPackSuggestions(mustflowRoot, classification);
|
|
103
140
|
const state = createState({
|
|
104
141
|
installed: true,
|
|
105
142
|
check_ok: true,
|
|
@@ -120,6 +157,7 @@ function createChangedOutput(mustflowRoot, contract, classification, report) {
|
|
|
120
157
|
recommendedCommands: [...fallbackCommands(mustflowRoot, contract), ...(intents.length > 0 ? ['mf verify --changed --json'] : [])],
|
|
121
158
|
blockers: gaps.map((gap) => gap.detail),
|
|
122
159
|
gaps,
|
|
160
|
+
scriptPackSuggestions,
|
|
123
161
|
verificationPlanId,
|
|
124
162
|
});
|
|
125
163
|
}
|
|
@@ -130,6 +168,7 @@ function createChangedOutput(mustflowRoot, contract, classification, report) {
|
|
|
130
168
|
state,
|
|
131
169
|
decision: action('verify', 'mf verify --changed --json', 'Run configured verification', 'Changed files have runnable configured verification intents. Use mustflow verification instead of direct commands.'),
|
|
132
170
|
recommendedCommands: ['mf api verification-plan --changed --json', 'mf verify --changed --json'],
|
|
171
|
+
scriptPackSuggestions,
|
|
133
172
|
verificationPlanId,
|
|
134
173
|
});
|
|
135
174
|
}
|
|
@@ -139,6 +178,7 @@ function createChangedOutput(mustflowRoot, contract, classification, report) {
|
|
|
139
178
|
state,
|
|
140
179
|
decision: action('inspect', 'mf api verification-plan --changed --json', 'Inspect verification plan', 'No runnable verification entries were selected.'),
|
|
141
180
|
recommendedCommands: ['mf api verification-plan --changed --json'],
|
|
181
|
+
scriptPackSuggestions,
|
|
142
182
|
verificationPlanId,
|
|
143
183
|
});
|
|
144
184
|
}
|
|
@@ -272,6 +312,16 @@ function renderNextOutput(output, lang) {
|
|
|
272
312
|
lines.push(`- ${warning}`);
|
|
273
313
|
}
|
|
274
314
|
}
|
|
315
|
+
if (output.script_pack_suggestions.suggestions.length > 0 || output.script_pack_suggestions.issues.length > 0) {
|
|
316
|
+
lines.push('', t(lang, 'scriptPack.suggest.label.recommendations'));
|
|
317
|
+
for (const suggestion of output.script_pack_suggestions.suggestions) {
|
|
318
|
+
lines.push(`- ${suggestion.script_ref}: ${suggestion.confidence}, score ${suggestion.score}`);
|
|
319
|
+
lines.push(` ${t(lang, 'scriptPack.suggest.label.runHint')}: ${suggestion.run_hint}`);
|
|
320
|
+
}
|
|
321
|
+
for (const issue of output.script_pack_suggestions.issues) {
|
|
322
|
+
lines.push(`- ${issue}`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
275
325
|
lines.push('', t(lang, 'next.section.commands'));
|
|
276
326
|
for (const command of output.recommended_commands) {
|
|
277
327
|
lines.push(`- ${command}`);
|
package/package.json
CHANGED
package/schemas/README.md
CHANGED
|
@@ -29,7 +29,8 @@ Current schemas:
|
|
|
29
29
|
- `onboard-commands-report.schema.json`: output of `mf onboard commands --json`, containing
|
|
30
30
|
review-only command-intent suggestions that do not grant command authority or write files
|
|
31
31
|
- `next-report.schema.json`: output of `mf next --json`, containing the next safe action,
|
|
32
|
-
changed-file verification gaps,
|
|
32
|
+
changed-file verification gaps, read-only command recommendations, and optional read-only
|
|
33
|
+
script-pack helper suggestions
|
|
33
34
|
- `evidence-report.schema.json`: output of `mf evidence --changed --json`, containing verification
|
|
34
35
|
requirements, risk-priced evidence assessment, latest bounded evidence, failure replay capsules,
|
|
35
36
|
conflict ledgers, receipts, remaining risks, and gaps without running commands
|
|
@@ -116,6 +116,146 @@
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
+
"script_pack_suggestions": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": false,
|
|
122
|
+
"required": ["status", "input", "analyzed_paths", "suggestions", "issues"],
|
|
123
|
+
"properties": {
|
|
124
|
+
"status": { "type": "string", "enum": ["suggested", "empty", "partial"] },
|
|
125
|
+
"input": { "$ref": "#/$defs/scriptPackSuggestionInput" },
|
|
126
|
+
"analyzed_paths": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": { "$ref": "#/$defs/scriptPackAnalyzedPath" }
|
|
129
|
+
},
|
|
130
|
+
"suggestions": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"items": { "$ref": "#/$defs/scriptPackSuggestion" }
|
|
133
|
+
},
|
|
134
|
+
"issues": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"items": { "type": "string" }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
119
140
|
"verification_plan_id": { "type": ["string", "null"] }
|
|
141
|
+
},
|
|
142
|
+
"$defs": {
|
|
143
|
+
"scriptPackPhase": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"enum": ["before_change", "during_change", "after_change", "review"]
|
|
146
|
+
},
|
|
147
|
+
"scriptPackSurface": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"enum": [
|
|
150
|
+
"config",
|
|
151
|
+
"docs",
|
|
152
|
+
"generated",
|
|
153
|
+
"package",
|
|
154
|
+
"schema",
|
|
155
|
+
"skill",
|
|
156
|
+
"source",
|
|
157
|
+
"template",
|
|
158
|
+
"test",
|
|
159
|
+
"unknown"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"scriptPackSuggestionInput": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"additionalProperties": false,
|
|
165
|
+
"required": ["phases", "skills", "paths", "changed"],
|
|
166
|
+
"properties": {
|
|
167
|
+
"phases": {
|
|
168
|
+
"type": "array",
|
|
169
|
+
"items": { "$ref": "#/$defs/scriptPackPhase" }
|
|
170
|
+
},
|
|
171
|
+
"skills": {
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
|
|
174
|
+
},
|
|
175
|
+
"paths": {
|
|
176
|
+
"type": "array",
|
|
177
|
+
"items": { "type": "string" }
|
|
178
|
+
},
|
|
179
|
+
"changed": { "type": "boolean" }
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"scriptPackAnalyzedPath": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"additionalProperties": false,
|
|
185
|
+
"required": ["path", "surfaces"],
|
|
186
|
+
"properties": {
|
|
187
|
+
"path": { "type": "string" },
|
|
188
|
+
"surfaces": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": { "$ref": "#/$defs/scriptPackSurface" },
|
|
191
|
+
"minItems": 1
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"scriptPackSuggestion": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"additionalProperties": false,
|
|
198
|
+
"required": [
|
|
199
|
+
"script_ref",
|
|
200
|
+
"score",
|
|
201
|
+
"confidence",
|
|
202
|
+
"usage",
|
|
203
|
+
"phases",
|
|
204
|
+
"matched_phases",
|
|
205
|
+
"matched_skills",
|
|
206
|
+
"matched_surfaces",
|
|
207
|
+
"reasons",
|
|
208
|
+
"read_only",
|
|
209
|
+
"mutates",
|
|
210
|
+
"network",
|
|
211
|
+
"risk_level",
|
|
212
|
+
"cost",
|
|
213
|
+
"report_schema_file",
|
|
214
|
+
"run_hint"
|
|
215
|
+
],
|
|
216
|
+
"properties": {
|
|
217
|
+
"script_ref": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*/[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
220
|
+
},
|
|
221
|
+
"score": { "type": "integer", "minimum": 0 },
|
|
222
|
+
"confidence": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
223
|
+
"usage": { "type": "string" },
|
|
224
|
+
"phases": {
|
|
225
|
+
"type": "array",
|
|
226
|
+
"items": { "$ref": "#/$defs/scriptPackPhase" },
|
|
227
|
+
"minItems": 1
|
|
228
|
+
},
|
|
229
|
+
"matched_phases": {
|
|
230
|
+
"type": "array",
|
|
231
|
+
"items": { "$ref": "#/$defs/scriptPackPhase" }
|
|
232
|
+
},
|
|
233
|
+
"matched_skills": {
|
|
234
|
+
"type": "array",
|
|
235
|
+
"items": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
|
|
236
|
+
},
|
|
237
|
+
"matched_surfaces": {
|
|
238
|
+
"type": "array",
|
|
239
|
+
"items": { "$ref": "#/$defs/scriptPackSurface" }
|
|
240
|
+
},
|
|
241
|
+
"reasons": {
|
|
242
|
+
"type": "array",
|
|
243
|
+
"items": { "type": "string" },
|
|
244
|
+
"minItems": 1
|
|
245
|
+
},
|
|
246
|
+
"read_only": { "type": "boolean" },
|
|
247
|
+
"mutates": { "type": "boolean" },
|
|
248
|
+
"network": { "type": "boolean" },
|
|
249
|
+
"risk_level": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
250
|
+
"cost": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
251
|
+
"report_schema_file": {
|
|
252
|
+
"anyOf": [
|
|
253
|
+
{ "type": "string", "pattern": "^[a-z0-9-]+\\.schema\\.json$" },
|
|
254
|
+
{ "type": "null" }
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"run_hint": { "type": "string" }
|
|
258
|
+
}
|
|
259
|
+
}
|
|
120
260
|
}
|
|
121
261
|
}
|