substrate-ai 0.18.0 → 0.19.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.
package/dist/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createLogger } from "../logger-KeHncl-f.js";
|
|
|
4
4
|
import { createEventBus } from "../helpers-CElYrONe.js";
|
|
5
5
|
import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, EXPERIMENT_RESULT, GlobalSettingsSchema, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-Bm0qSZer.js";
|
|
6
6
|
import "../adapter-registry-DXLMTmfD.js";
|
|
7
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
7
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-C3MnOuBe.js";
|
|
8
8
|
import "../errors-BSpu7pIv.js";
|
|
9
9
|
import "../routing-CcBOCuC9.js";
|
|
10
10
|
import "../decisions-C0pz9Clx.js";
|
|
@@ -1827,6 +1827,21 @@ function parseCSVLine(line) {
|
|
|
1827
1827
|
return fields;
|
|
1828
1828
|
}
|
|
1829
1829
|
/**
|
|
1830
|
+
* Prepare the `.claude/skills/` directory by cleaning stale bmad-prefixed entries.
|
|
1831
|
+
* Returns the skills directory path.
|
|
1832
|
+
*/
|
|
1833
|
+
function prepareSkillsDir(projectRoot) {
|
|
1834
|
+
const skillsDir = join(projectRoot, ".claude", "skills");
|
|
1835
|
+
mkdirSync$1(skillsDir, { recursive: true });
|
|
1836
|
+
try {
|
|
1837
|
+
for (const entry of readdirSync$1(skillsDir, { withFileTypes: true })) if (entry.isDirectory() && entry.name.startsWith("bmad")) rmSync$1(join(skillsDir, entry.name), {
|
|
1838
|
+
recursive: true,
|
|
1839
|
+
force: true
|
|
1840
|
+
});
|
|
1841
|
+
} catch {}
|
|
1842
|
+
return skillsDir;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1830
1845
|
* Install skills from `_bmad/_config/skill-manifest.csv` into `.claude/skills/`.
|
|
1831
1846
|
*
|
|
1832
1847
|
* Each row in the CSV specifies a canonicalId and a path to the SKILL.md file.
|
|
@@ -1847,14 +1862,7 @@ function installSkillsFromManifest(projectRoot, bmadDir) {
|
|
|
1847
1862
|
if (canonicalIdIdx < 0 || pathIdx < 0) return 0;
|
|
1848
1863
|
const bmadFolderName = "_bmad";
|
|
1849
1864
|
const bmadPrefix = bmadFolderName + "/";
|
|
1850
|
-
const skillsDir =
|
|
1851
|
-
mkdirSync$1(skillsDir, { recursive: true });
|
|
1852
|
-
if (existsSync$1(skillsDir)) try {
|
|
1853
|
-
for (const entry of readdirSync$1(skillsDir, { withFileTypes: true })) if (entry.isDirectory() && entry.name.startsWith("bmad")) rmSync$1(join(skillsDir, entry.name), {
|
|
1854
|
-
recursive: true,
|
|
1855
|
-
force: true
|
|
1856
|
-
});
|
|
1857
|
-
} catch {}
|
|
1865
|
+
const skillsDir = prepareSkillsDir(projectRoot);
|
|
1858
1866
|
let count = 0;
|
|
1859
1867
|
for (let i = 1; i < lines.length; i++) {
|
|
1860
1868
|
const fields = parseCSVLine(lines[i]);
|
|
@@ -1872,6 +1880,54 @@ function installSkillsFromManifest(projectRoot, bmadDir) {
|
|
|
1872
1880
|
}
|
|
1873
1881
|
return count;
|
|
1874
1882
|
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Install skills directly from bmad-method source directories.
|
|
1885
|
+
*
|
|
1886
|
+
* Scans `src/core-skills/` and `src/bmm-skills/` (recursively) in the
|
|
1887
|
+
* bmad-method package for directories containing SKILL.md. Each directory
|
|
1888
|
+
* name is used as the canonicalId.
|
|
1889
|
+
*
|
|
1890
|
+
* This is the primary installation path for bmad-method v6.2.0+ where
|
|
1891
|
+
* skill-manifest.csv may be empty (it's populated by the full IDE installer,
|
|
1892
|
+
* which substrate doesn't call).
|
|
1893
|
+
*
|
|
1894
|
+
* @param installerLibPath - Path to bmad-method's tools/cli/installers/lib/
|
|
1895
|
+
* @returns Number of skills installed.
|
|
1896
|
+
*/
|
|
1897
|
+
function installSkillsFromSource(projectRoot, installerLibPath) {
|
|
1898
|
+
const bmadMethodRoot = resolve(installerLibPath, "..", "..", "..", "..");
|
|
1899
|
+
const skillRoots = [join(bmadMethodRoot, "src", "core-skills"), join(bmadMethodRoot, "src", "bmm-skills")];
|
|
1900
|
+
const skillsDir = prepareSkillsDir(projectRoot);
|
|
1901
|
+
let count = 0;
|
|
1902
|
+
for (const root of skillRoots) {
|
|
1903
|
+
if (!existsSync$1(root)) continue;
|
|
1904
|
+
count += copySkillDirsRecursive(root, skillsDir);
|
|
1905
|
+
}
|
|
1906
|
+
return count;
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Recursively find directories containing SKILL.md and copy them to destRoot.
|
|
1910
|
+
* The directory name becomes the canonicalId (skill target directory name).
|
|
1911
|
+
*/
|
|
1912
|
+
function copySkillDirsRecursive(dir, destRoot) {
|
|
1913
|
+
if (!existsSync$1(dir)) return 0;
|
|
1914
|
+
let count = 0;
|
|
1915
|
+
try {
|
|
1916
|
+
const entries = readdirSync$1(dir, { withFileTypes: true });
|
|
1917
|
+
for (const entry of entries) {
|
|
1918
|
+
if (!entry.isDirectory()) continue;
|
|
1919
|
+
const childPath = join(dir, entry.name);
|
|
1920
|
+
const skillFile = join(childPath, "SKILL.md");
|
|
1921
|
+
if (existsSync$1(skillFile)) {
|
|
1922
|
+
const destDir = join(destRoot, entry.name);
|
|
1923
|
+
mkdirSync$1(destDir, { recursive: true });
|
|
1924
|
+
cpSync(childPath, destDir, { recursive: true });
|
|
1925
|
+
count++;
|
|
1926
|
+
} else count += copySkillDirsRecursive(childPath, destRoot);
|
|
1927
|
+
}
|
|
1928
|
+
} catch {}
|
|
1929
|
+
return count;
|
|
1930
|
+
}
|
|
1875
1931
|
async function scaffoldClaudeCommands(projectRoot, outputFormat) {
|
|
1876
1932
|
const bmadDir = join(projectRoot, "_bmad");
|
|
1877
1933
|
if (!existsSync$1(bmadDir)) return;
|
|
@@ -1967,7 +2023,10 @@ async function scaffoldClaudeCommands(projectRoot, outputFormat) {
|
|
|
1967
2023
|
taskToolCount = typeof taskToolGen.writeDashArtifacts === "function" ? await taskToolGen.writeDashArtifacts(commandsDir, taskToolArtifacts) : await writeDashFallback(commandsDir, taskToolArtifacts, ["task", "tool"]);
|
|
1968
2024
|
}
|
|
1969
2025
|
let skillCount = 0;
|
|
1970
|
-
if (!WorkflowCommandGenerator && !TaskToolCommandGenerator)
|
|
2026
|
+
if (!WorkflowCommandGenerator && !TaskToolCommandGenerator) {
|
|
2027
|
+
skillCount = installSkillsFromSource(projectRoot, installerLibPath);
|
|
2028
|
+
if (skillCount === 0) skillCount = installSkillsFromManifest(projectRoot, bmadDir);
|
|
2029
|
+
}
|
|
1971
2030
|
const total = agentCount + workflowCount + taskToolCount + skillCount;
|
|
1972
2031
|
if (outputFormat !== "json") if (skillCount > 0) process.stdout.write(`Generated ${String(total)} Claude Code commands (${String(agentCount)} agents, ${String(skillCount)} skills)\n`);
|
|
1973
2032
|
else process.stdout.write(`Generated ${String(total)} Claude Code commands (${String(agentCount)} agents, ${String(workflowCount)} workflows, ${String(taskToolCount)} tasks/tools)\n`);
|
|
@@ -4470,7 +4529,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
4470
4529
|
await initSchema(expAdapter);
|
|
4471
4530
|
const { runRunAction: runPipeline } = await import(
|
|
4472
4531
|
/* @vite-ignore */
|
|
4473
|
-
"../run-
|
|
4532
|
+
"../run-C8jeEtC6.js"
|
|
4474
4533
|
);
|
|
4475
4534
|
const runStoryFn = async (opts) => {
|
|
4476
4535
|
const exitCode = await runPipeline({
|