substrate-ai 0.7.0 → 0.7.1

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
@@ -2,7 +2,7 @@
2
2
  import { DoltClient, DoltNotInstalled, FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createDatabaseAdapter, createDoltClient, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-Dnx-FGva.js";
3
3
  import { createLogger } from "../logger-D2fS2ccL.js";
4
4
  import { AdapterRegistry } from "../adapter-registry-D2zdMwVu.js";
5
- import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-CfF0-tVP.js";
5
+ import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BW8_vcTi.js";
6
6
  import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-CtGelIsG.js";
7
7
  import { ConfigError, createEventBus } from "../helpers-CpMs8VZX.js";
8
8
  import { RoutingRecommender } from "../routing-BVrxrM6v.js";
@@ -3503,7 +3503,7 @@ async function runSupervisorAction(options, deps = {}) {
3503
3503
  await initSchema(expAdapter);
3504
3504
  const { runRunAction: runPipeline } = await import(
3505
3505
  /* @vite-ignore */
3506
- "../run-BdqqWU9p.js"
3506
+ "../run-CZokQlIi.js"
3507
3507
  );
3508
3508
  const runStoryFn = async (opts) => {
3509
3509
  const exitCode = await runPipeline({
@@ -4665,7 +4665,7 @@ const DEFAULT_TIMEOUTS = {
4665
4665
  "create-story": 6e5,
4666
4666
  "dev-story": 18e5,
4667
4667
  "code-review": 9e5,
4668
- "minor-fixes": 6e5,
4668
+ "minor-fixes": 12e5,
4669
4669
  "major-rework": 9e5,
4670
4670
  "readiness-check": 6e5,
4671
4671
  "elicitation": 9e5,
@@ -5669,7 +5669,22 @@ function runBuildVerification(options) {
5669
5669
  */
5670
5670
  function checkGitDiffFiles(workingDir = process.cwd()) {
5671
5671
  const results = new Set();
5672
+ let repoHasCommits = true;
5672
5673
  try {
5674
+ execSync("git rev-parse --verify HEAD", {
5675
+ cwd: workingDir,
5676
+ stdio: [
5677
+ "ignore",
5678
+ "pipe",
5679
+ "pipe"
5680
+ ],
5681
+ timeout: 3e3
5682
+ });
5683
+ } catch {
5684
+ repoHasCommits = false;
5685
+ }
5686
+ try {
5687
+ if (!repoHasCommits) throw new Error("no commits — skip HEAD diff");
5673
5688
  const unstaged = execSync("git diff --name-only HEAD", {
5674
5689
  cwd: workingDir,
5675
5690
  encoding: "utf-8",
@@ -6600,6 +6615,27 @@ async function isValidStoryFile(filePath) {
6600
6615
  //#region src/modules/compiled-workflows/git-helpers.ts
6601
6616
  const logger$19 = createLogger("compiled-workflows:git-helpers");
6602
6617
  /**
6618
+ * Check whether the repo at `cwd` has at least one commit (HEAD resolves).
6619
+ * Returns false for fresh repos with no commits, avoiding `fatal: bad revision 'HEAD'`.
6620
+ * Synchronous (execSync) to keep it simple — this is a fast local check.
6621
+ */
6622
+ function hasCommits(cwd) {
6623
+ try {
6624
+ execSync("git rev-parse --verify HEAD", {
6625
+ cwd,
6626
+ stdio: [
6627
+ "ignore",
6628
+ "pipe",
6629
+ "pipe"
6630
+ ],
6631
+ timeout: 3e3
6632
+ });
6633
+ return true;
6634
+ } catch {
6635
+ return false;
6636
+ }
6637
+ }
6638
+ /**
6603
6639
  * Capture the full git diff for HEAD (working tree vs current commit).
6604
6640
  *
6605
6641
  * Runs `git diff HEAD` in the specified working directory and returns
@@ -6613,6 +6649,10 @@ const logger$19 = createLogger("compiled-workflows:git-helpers");
6613
6649
  * @returns The diff output string, or '' on error
6614
6650
  */
6615
6651
  async function getGitDiffSummary(workingDirectory = process.cwd()) {
6652
+ if (!hasCommits(workingDirectory)) {
6653
+ logger$19.debug({ cwd: workingDirectory }, "No commits in repo — returning empty diff");
6654
+ return "";
6655
+ }
6616
6656
  return runGitCommand(["diff", "HEAD"], workingDirectory, "git-diff-summary");
6617
6657
  }
6618
6658
  /**
@@ -6626,6 +6666,10 @@ async function getGitDiffSummary(workingDirectory = process.cwd()) {
6626
6666
  * @returns The stat summary string, or '' on error
6627
6667
  */
6628
6668
  async function getGitDiffStatSummary(workingDirectory = process.cwd()) {
6669
+ if (!hasCommits(workingDirectory)) {
6670
+ logger$19.debug({ cwd: workingDirectory }, "No commits in repo — returning empty stat");
6671
+ return "";
6672
+ }
6629
6673
  return runGitCommand([
6630
6674
  "diff",
6631
6675
  "--stat",
@@ -6648,6 +6692,10 @@ async function getGitDiffStatSummary(workingDirectory = process.cwd()) {
6648
6692
  */
6649
6693
  async function getGitDiffForFiles(files, workingDirectory = process.cwd()) {
6650
6694
  if (files.length === 0) return "";
6695
+ if (!hasCommits(workingDirectory)) {
6696
+ logger$19.debug({ cwd: workingDirectory }, "No commits in repo — returning empty diff for files");
6697
+ return "";
6698
+ }
6651
6699
  await stageIntentToAdd(files, workingDirectory);
6652
6700
  return runGitCommand([
6653
6701
  "diff",
@@ -6671,6 +6719,10 @@ async function getGitDiffForFiles(files, workingDirectory = process.cwd()) {
6671
6719
  */
6672
6720
  async function getGitDiffStatForFiles(files, workingDirectory = process.cwd()) {
6673
6721
  if (files.length === 0) return "";
6722
+ if (!hasCommits(workingDirectory)) {
6723
+ logger$19.debug({ cwd: workingDirectory }, "No commits in repo — returning empty stat for files");
6724
+ return "";
6725
+ }
6674
6726
  return runGitCommand([
6675
6727
  "diff",
6676
6728
  "--stat",
@@ -10706,22 +10758,49 @@ var IngestionServer = class {
10706
10758
  /**
10707
10759
  * Start the HTTP ingestion server.
10708
10760
  * Resolves when the server is listening and ready to accept connections.
10761
+ * On EADDRINUSE, retries up to 10 consecutive ports before failing.
10709
10762
  */
10710
10763
  async start() {
10711
10764
  if (this._server !== null) {
10712
10765
  logger$8.warn("IngestionServer.start() called while already started — ignoring");
10713
10766
  return;
10714
10767
  }
10768
+ const maxRetries = 10;
10769
+ let lastErr;
10770
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
10771
+ const port = this._port + attempt;
10772
+ try {
10773
+ await this._tryListen(port);
10774
+ return;
10775
+ } catch (err) {
10776
+ const nodeErr = err;
10777
+ if (nodeErr.code === "EADDRINUSE" && attempt < maxRetries) {
10778
+ logger$8.warn({
10779
+ port,
10780
+ attempt: attempt + 1
10781
+ }, `Port ${port} in use — trying ${port + 1}`);
10782
+ lastErr = nodeErr;
10783
+ continue;
10784
+ }
10785
+ throw err;
10786
+ }
10787
+ }
10788
+ throw lastErr ?? new Error("IngestionServer: exhausted port retry attempts");
10789
+ }
10790
+ _tryListen(port) {
10715
10791
  return new Promise((resolve$2, reject) => {
10716
10792
  const server = createServer(this._handleRequest.bind(this));
10717
10793
  server.on("error", (err) => {
10718
- logger$8.error({ err }, "IngestionServer failed to start");
10794
+ server.close();
10719
10795
  reject(err);
10720
10796
  });
10721
- server.listen(this._port, "127.0.0.1", () => {
10797
+ server.listen(port, "127.0.0.1", () => {
10722
10798
  this._server = server;
10723
10799
  const addr = server.address();
10724
- logger$8.info({ port: addr.port }, "IngestionServer listening");
10800
+ logger$8.info({
10801
+ port: addr.port,
10802
+ requestedPort: this._port
10803
+ }, "IngestionServer listening");
10725
10804
  this._buffer?.start();
10726
10805
  resolve$2();
10727
10806
  });
@@ -20941,4 +21020,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
20941
21020
 
20942
21021
  //#endregion
20943
21022
  export { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createConfigSystem, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerRunCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
20944
- //# sourceMappingURL=run-CfF0-tVP.js.map
21023
+ //# sourceMappingURL=run-BW8_vcTi.js.map
@@ -1,6 +1,6 @@
1
1
  import "./health-Dnx-FGva.js";
2
2
  import "./logger-D2fS2ccL.js";
3
- import { registerRunCommand, runRunAction } from "./run-CfF0-tVP.js";
3
+ import { registerRunCommand, runRunAction } from "./run-BW8_vcTi.js";
4
4
  import "./config-migrator-CtGelIsG.js";
5
5
  import "./helpers-CpMs8VZX.js";
6
6
  import "./routing-BVrxrM6v.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,6 +38,7 @@ Implement the story above completely. Follow tasks in exact order. Do not stop u
38
38
  - Write failing tests first
39
39
  - Make tests pass with minimal code
40
40
  - Refactor while keeping tests green
41
+ - **Use exact names from the story spec.** When the story specifies a field, variable, class, or method name, use that exact name in your implementation. Only deviate if the name would cause a compilation error (e.g., conflicts with a reserved word or inherited property), and add a code comment explaining why.
41
42
  - **If you import a new package that is not already in package.json, install it immediately** (`npm install <package>` or the appropriate workspace command). The build verification gate runs after dev-story — missing dependencies will fail the build and escalate the story.
42
43
 
43
44
  3. **After each task**: