substrate-ai 0.2.28 → 0.2.29
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.
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
2
|
+
import { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-IeDyGCak.js";
|
|
3
3
|
import { createLogger, deepMask } from "../logger-D2fS2ccL.js";
|
|
4
4
|
import { AdapterRegistry, ConfigError, ConfigIncompatibleFormatError } from "../errors-CswS7Mzg.js";
|
|
5
5
|
import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema, SUPPORTED_CONFIG_FORMAT_VERSIONS, SubstrateConfigSchema, defaultConfigMigrator } from "../version-manager-impl-CtzNu7YZ.js";
|
|
@@ -2888,7 +2888,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2888
2888
|
const expDb = expDbWrapper.db;
|
|
2889
2889
|
const { runRunAction: runPipeline } = await import(
|
|
2890
2890
|
/* @vite-ignore */
|
|
2891
|
-
"../run-
|
|
2891
|
+
"../run-DFFZVzZK.js"
|
|
2892
2892
|
);
|
|
2893
2893
|
const runStoryFn = async (opts) => {
|
|
2894
2894
|
const exitCode = await runPipeline({
|
|
@@ -7123,6 +7123,27 @@ function createPauseGate() {
|
|
|
7123
7123
|
};
|
|
7124
7124
|
}
|
|
7125
7125
|
/**
|
|
7126
|
+
* Build the targeted_files content string from a code-review issue list.
|
|
7127
|
+
* Deduplicates file paths and includes line numbers where available.
|
|
7128
|
+
* Returns empty string when no issues have file references.
|
|
7129
|
+
*/
|
|
7130
|
+
function buildTargetedFilesContent(issueList) {
|
|
7131
|
+
const seen = new Map();
|
|
7132
|
+
for (const issue of issueList) {
|
|
7133
|
+
const iss = issue;
|
|
7134
|
+
if (!iss.file) continue;
|
|
7135
|
+
if (!seen.has(iss.file)) seen.set(iss.file, new Set());
|
|
7136
|
+
if (iss.line !== void 0) seen.get(iss.file).add(iss.line);
|
|
7137
|
+
}
|
|
7138
|
+
if (seen.size === 0) return "";
|
|
7139
|
+
const lines = [];
|
|
7140
|
+
for (const [file, lineNums] of seen) if (lineNums.size > 0) {
|
|
7141
|
+
const sorted = [...lineNums].sort((a, b) => a - b);
|
|
7142
|
+
lines.push(`- ${file} (lines: ${sorted.join(", ")})`);
|
|
7143
|
+
} else lines.push(`- ${file}`);
|
|
7144
|
+
return lines.join("\n");
|
|
7145
|
+
}
|
|
7146
|
+
/**
|
|
7126
7147
|
* Factory function that creates an ImplementationOrchestrator instance.
|
|
7127
7148
|
*
|
|
7128
7149
|
* @param deps - Injected dependencies (db, pack, contextCompiler, dispatcher,
|
|
@@ -8158,9 +8179,13 @@ function createImplementationOrchestrator(deps) {
|
|
|
8158
8179
|
updateStory(storyKey, { phase: "NEEDS_FIXES" });
|
|
8159
8180
|
try {
|
|
8160
8181
|
let fixPrompt;
|
|
8182
|
+
let autoApproveMaxTurns;
|
|
8161
8183
|
try {
|
|
8162
8184
|
const fixTemplate = await pack.getPrompt("fix-story");
|
|
8163
8185
|
const storyContent = await readFile$1(storyFilePath ?? "", "utf-8");
|
|
8186
|
+
const complexity = computeStoryComplexity(storyContent);
|
|
8187
|
+
autoApproveMaxTurns = resolveFixStoryMaxTurns(complexity.complexityScore);
|
|
8188
|
+
logComplexityResult(storyKey, complexity, autoApproveMaxTurns);
|
|
8164
8189
|
let reviewFeedback;
|
|
8165
8190
|
if (issueList.length === 0) reviewFeedback = `Verdict: ${verdict}\nIssues: Minor issues flagged but no specifics provided. Review the story ACs and fix any remaining gaps.`;
|
|
8166
8191
|
else reviewFeedback = [
|
|
@@ -8177,6 +8202,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
8177
8202
|
const constraints = decisions.filter((d) => d.category === "architecture");
|
|
8178
8203
|
archConstraints = constraints.map((d) => `${d.key}: ${d.value}`).join("\n");
|
|
8179
8204
|
} catch {}
|
|
8205
|
+
const targetedFilesContent = buildTargetedFilesContent(issueList);
|
|
8180
8206
|
const sections = [
|
|
8181
8207
|
{
|
|
8182
8208
|
name: "story_content",
|
|
@@ -8192,7 +8218,12 @@ function createImplementationOrchestrator(deps) {
|
|
|
8192
8218
|
name: "arch_constraints",
|
|
8193
8219
|
content: archConstraints,
|
|
8194
8220
|
priority: "optional"
|
|
8195
|
-
}
|
|
8221
|
+
},
|
|
8222
|
+
...targetedFilesContent ? [{
|
|
8223
|
+
name: "targeted_files",
|
|
8224
|
+
content: targetedFilesContent,
|
|
8225
|
+
priority: "important"
|
|
8226
|
+
}] : []
|
|
8196
8227
|
];
|
|
8197
8228
|
const assembled = assemblePrompt(fixTemplate, sections, 24e3);
|
|
8198
8229
|
fixPrompt = assembled.prompt;
|
|
@@ -8204,7 +8235,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
8204
8235
|
prompt: fixPrompt,
|
|
8205
8236
|
agent: "claude-code",
|
|
8206
8237
|
taskType: "minor-fixes",
|
|
8207
|
-
workingDirectory: projectRoot
|
|
8238
|
+
workingDirectory: projectRoot,
|
|
8239
|
+
...autoApproveMaxTurns !== void 0 ? { maxTurns: autoApproveMaxTurns } : {}
|
|
8208
8240
|
});
|
|
8209
8241
|
const fixResult = await handle.result;
|
|
8210
8242
|
eventBus.emit("orchestrator:story-phase-complete", {
|
|
@@ -8251,7 +8283,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
8251
8283
|
try {
|
|
8252
8284
|
const fixTemplate = await pack.getPrompt(templateName);
|
|
8253
8285
|
const storyContent = await readFile$1(storyFilePath ?? "", "utf-8");
|
|
8254
|
-
|
|
8286
|
+
{
|
|
8255
8287
|
const complexity = computeStoryComplexity(storyContent);
|
|
8256
8288
|
fixMaxTurns = resolveFixStoryMaxTurns(complexity.complexityScore);
|
|
8257
8289
|
logComplexityResult(storyKey, complexity, fixMaxTurns);
|
|
@@ -8305,23 +8337,31 @@ function createImplementationOrchestrator(deps) {
|
|
|
8305
8337
|
content: "",
|
|
8306
8338
|
priority: "optional"
|
|
8307
8339
|
}
|
|
8308
|
-
] :
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8340
|
+
] : (() => {
|
|
8341
|
+
const targetedFilesContent = buildTargetedFilesContent(issueList);
|
|
8342
|
+
return [
|
|
8343
|
+
{
|
|
8344
|
+
name: "story_content",
|
|
8345
|
+
content: storyContent,
|
|
8346
|
+
priority: "required"
|
|
8347
|
+
},
|
|
8348
|
+
{
|
|
8349
|
+
name: "review_feedback",
|
|
8350
|
+
content: reviewFeedback,
|
|
8351
|
+
priority: "required"
|
|
8352
|
+
},
|
|
8353
|
+
{
|
|
8354
|
+
name: "arch_constraints",
|
|
8355
|
+
content: archConstraints,
|
|
8356
|
+
priority: "optional"
|
|
8357
|
+
},
|
|
8358
|
+
...targetedFilesContent ? [{
|
|
8359
|
+
name: "targeted_files",
|
|
8360
|
+
content: targetedFilesContent,
|
|
8361
|
+
priority: "important"
|
|
8362
|
+
}] : []
|
|
8363
|
+
];
|
|
8364
|
+
})();
|
|
8325
8365
|
const assembled = assemblePrompt(fixTemplate, sections, 24e3);
|
|
8326
8366
|
fixPrompt = assembled.prompt;
|
|
8327
8367
|
} catch {
|
|
@@ -8345,6 +8385,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
8345
8385
|
agent: "claude-code",
|
|
8346
8386
|
taskType,
|
|
8347
8387
|
...fixModel !== void 0 ? { model: fixModel } : {},
|
|
8388
|
+
...fixMaxTurns !== void 0 ? { maxTurns: fixMaxTurns } : {},
|
|
8348
8389
|
...projectRoot !== void 0 ? { workingDirectory: projectRoot } : {}
|
|
8349
8390
|
});
|
|
8350
8391
|
const fixResult = await handle.result;
|
|
@@ -13501,4 +13542,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
13501
13542
|
|
|
13502
13543
|
//#endregion
|
|
13503
13544
|
export { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
|
|
13504
|
-
//# sourceMappingURL=run-
|
|
13545
|
+
//# sourceMappingURL=run-IeDyGCak.js.map
|
package/package.json
CHANGED
|
@@ -11,10 +11,15 @@
|
|
|
11
11
|
### Architecture Constraints
|
|
12
12
|
{{arch_constraints}}
|
|
13
13
|
|
|
14
|
+
### Targeted Files
|
|
15
|
+
{{targeted_files}}
|
|
16
|
+
|
|
14
17
|
---
|
|
15
18
|
|
|
16
19
|
## Mission
|
|
17
20
|
|
|
21
|
+
**Start by reading ONLY the files listed in the Targeted Files section above.** Do not scan the codebase or re-read story context until you have read and understood those specific files. If no targeted files are listed, proceed with the review feedback to locate the files yourself.
|
|
22
|
+
|
|
18
23
|
Fix the issues identified in the code review above. Address every issue listed in the review feedback.
|
|
19
24
|
|
|
20
25
|
## Instructions
|