archondev 2.19.24 → 2.19.25

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.
@@ -4796,6 +4796,13 @@ function createPrompt() {
4796
4796
  };
4797
4797
  }
4798
4798
  async function execute(atomId, options) {
4799
+ const fail = () => {
4800
+ if (options.nonTerminating) {
4801
+ process.exitCode = 1;
4802
+ return;
4803
+ }
4804
+ process.exit(1);
4805
+ };
4799
4806
  if (options.parallel && options.parallel.length > 0) {
4800
4807
  const { parallelExecute } = await import("./parallel-RCMUYXE2.js");
4801
4808
  const allAtomIds = [atomId, ...options.parallel];
@@ -4826,12 +4833,12 @@ async function execute(atomId, options) {
4826
4833
  if (!repoUrl) {
4827
4834
  console.error(chalk2.red("No git remote found. Cloud execution requires a GitHub repository."));
4828
4835
  console.log(chalk2.dim("Add a remote with: git remote add origin <url>"));
4829
- process.exit(1);
4836
+ return fail();
4830
4837
  }
4831
4838
  const atom2 = await loadAtom(atomId);
4832
4839
  if (!atom2) {
4833
4840
  console.error(chalk2.red(`Atom ${atomId} not found.`));
4834
- process.exit(1);
4841
+ return fail();
4835
4842
  }
4836
4843
  try {
4837
4844
  const executionId = await queueCloudExecution(atomId, projectName, {
@@ -4854,23 +4861,23 @@ Repository: ${repoUrl}`));
4854
4861
  }
4855
4862
  } catch (error) {
4856
4863
  console.error(chalk2.red(error instanceof Error ? error.message : "Failed to queue execution"));
4857
- process.exit(1);
4864
+ return fail();
4858
4865
  }
4859
4866
  return;
4860
4867
  }
4861
4868
  console.log(chalk2.dim(`Loading atom ${atomId}...`));
4862
- const atom = await loadAtom(atomId);
4869
+ let atom = await loadAtom(atomId);
4863
4870
  if (!atom) {
4864
4871
  console.error(chalk2.red(`Atom ${atomId} not found.`));
4865
4872
  console.log(chalk2.dim(`Use "archon list" to see available atoms.`));
4866
- process.exit(1);
4873
+ return fail();
4867
4874
  }
4868
4875
  const envLoader = new EnvironmentConfigLoader(cwd);
4869
4876
  const targetEnvName = options.env ?? "development";
4870
4877
  if (!envLoader.isValidEnvironment(targetEnvName)) {
4871
4878
  console.error(chalk2.red(`Invalid environment: ${targetEnvName}`));
4872
4879
  console.log(chalk2.dim("Valid environments: development, staging, production"));
4873
- process.exit(1);
4880
+ return fail();
4874
4881
  }
4875
4882
  const envConfigs = await envLoader.loadConfig();
4876
4883
  const envConfig = envLoader.getEnvironmentConfig(envConfigs, targetEnvName);
@@ -4880,7 +4887,7 @@ Repository: ${repoUrl}`));
4880
4887
  const executionCheck = validator.canExecuteInEnvironment(atom, targetEnvName, envState?.lastExecutedEnv);
4881
4888
  if (!executionCheck.allowed) {
4882
4889
  console.error(chalk2.red(executionCheck.reason ?? "Execution not allowed"));
4883
- process.exit(1);
4890
+ return fail();
4884
4891
  }
4885
4892
  if (atom.status === "DONE" && targetEnvName === envState?.lastExecutedEnv) {
4886
4893
  console.log(chalk2.yellow(`Atom ${atomId} has already been executed in ${targetEnvName}.`));
@@ -4896,12 +4903,12 @@ Repository: ${repoUrl}`));
4896
4903
  if (atom.status !== "READY" && atom.status !== "IN_PROGRESS" && atom.status !== "DONE") {
4897
4904
  console.error(chalk2.red(`Atom ${atomId} is not ready for execution.`));
4898
4905
  console.log(chalk2.dim(`Status: ${atom.status}. Only READY or DONE atoms can be executed.`));
4899
- process.exit(1);
4906
+ return fail();
4900
4907
  }
4901
4908
  if (!atom.plan) {
4902
4909
  console.error(chalk2.red(`Atom ${atomId} has no plan.`));
4903
4910
  console.log(chalk2.dim(`Run "archon plan" to create a plan first.`));
4904
- process.exit(1);
4911
+ return fail();
4905
4912
  }
4906
4913
  const atomContext = atom.context;
4907
4914
  const designApproved = atomContext?.["designApproved"] === true;
@@ -4916,13 +4923,13 @@ Repository: ${repoUrl}`));
4916
4923
  const archPath = join4(cwd, "ARCHITECTURE.md");
4917
4924
  if (!existsSync9(archPath)) {
4918
4925
  console.error(chalk2.red("ARCHITECTURE.md not found."));
4919
- process.exit(1);
4926
+ return fail();
4920
4927
  }
4921
4928
  const parser = new ArchitectureParser(archPath);
4922
4929
  const parseResult = await parser.parse();
4923
4930
  if (!parseResult.success || !parseResult.schema) {
4924
4931
  console.error(chalk2.red("Failed to parse ARCHITECTURE.md."));
4925
- process.exit(1);
4932
+ return fail();
4926
4933
  }
4927
4934
  if (!options.skipConflictCheck) {
4928
4935
  console.log(chalk2.dim("\nChecking for conflicts..."));
@@ -4957,11 +4964,11 @@ ${conflictReport.blockerCount} blocking conflict(s) found.`));
4957
4964
  }
4958
4965
  }
4959
4966
  try {
4960
- transitionAtom(atom, "IN_PROGRESS");
4967
+ atom = transitionAtom(atom, "IN_PROGRESS");
4961
4968
  } catch (error) {
4962
4969
  console.error(chalk2.red("Failed to update atom status."));
4963
4970
  console.error(chalk2.dim(error instanceof Error ? error.message : "Unknown error"));
4964
- process.exit(1);
4971
+ return fail();
4965
4972
  }
4966
4973
  await saveAtom(atom);
4967
4974
  console.log(chalk2.blue("\n\u{1F680} Executing plan..."));
@@ -5016,7 +5023,7 @@ ${conflictReport.blockerCount} blocking conflict(s) found.`));
5016
5023
  if (executionResult.rollbackPerformed) {
5017
5024
  console.log(chalk2.yellow("Changes have been rolled back."));
5018
5025
  }
5019
- transitionAtom(atom, "FAILED");
5026
+ atom = transitionAtom(atom, "FAILED");
5020
5027
  atom.errorMessage = executionResult.errorMessage ?? "Execution failed";
5021
5028
  await saveAtom(atom);
5022
5029
  await captureLearnings(atom, {
@@ -5026,7 +5033,7 @@ ${conflictReport.blockerCount} blocking conflict(s) found.`));
5026
5033
  success: false,
5027
5034
  errorMessage: executionResult.errorMessage
5028
5035
  });
5029
- process.exit(1);
5036
+ return fail();
5030
5037
  }
5031
5038
  console.log(chalk2.green("\u2713 Plan executed successfully"));
5032
5039
  console.log(chalk2.dim(`Files modified: ${filesChanged.length}`));
@@ -5059,7 +5066,7 @@ Running quality gates for ${targetEnvName}...`));
5059
5066
  console.log(chalk2.red("Failed to rollback. Please manually revert changes."));
5060
5067
  console.log(chalk2.dim(error instanceof Error ? error.message : "Unknown rollback error"));
5061
5068
  }
5062
- transitionAtom(atom, "FAILED");
5069
+ atom = transitionAtom(atom, "FAILED");
5063
5070
  atom.errorMessage = `Quality gate failed: ${gateResult.failedAt}`;
5064
5071
  await saveAtom(atom);
5065
5072
  await captureLearnings(atom, {
@@ -5074,7 +5081,7 @@ Running quality gates for ${targetEnvName}...`));
5074
5081
  success: false,
5075
5082
  errorMessage: `Quality gate failed: ${gateResult.failedAt}`
5076
5083
  });
5077
- process.exit(1);
5084
+ return fail();
5078
5085
  }
5079
5086
  }
5080
5087
  console.log(chalk2.dim("\nCommitting changes..."));
@@ -5092,8 +5099,8 @@ Running quality gates for ${targetEnvName}...`));
5092
5099
  } catch (error) {
5093
5100
  console.log(chalk2.yellow("No changes to commit or git commit failed."));
5094
5101
  }
5095
- transitionAtom(atom, "TESTING");
5096
- transitionAtom(atom, "DONE");
5102
+ atom = transitionAtom(atom, "TESTING");
5103
+ atom = transitionAtom(atom, "DONE");
5097
5104
  await saveAtom(atom);
5098
5105
  await saveAtomEnvironmentState(atomId, cwd, {
5099
5106
  lastExecutedEnv: targetEnvName,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  execute
3
- } from "./chunk-JOID4CDJ.js";
3
+ } from "./chunk-VMQKFKX3.js";
4
4
  import "./chunk-EBHHIUCB.js";
5
5
  import "./chunk-I2ORQAMH.js";
6
6
  import "./chunk-DFDEEMQU.js";
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ import {
56
56
  EnvironmentConfigLoader,
57
57
  EnvironmentValidator,
58
58
  execute
59
- } from "./chunk-JOID4CDJ.js";
59
+ } from "./chunk-VMQKFKX3.js";
60
60
  import {
61
61
  cloudCancel,
62
62
  cloudLogs,
@@ -3681,7 +3681,7 @@ async function handleAgentConversationInput(cwd, input) {
3681
3681
  return true;
3682
3682
  }
3683
3683
  const intent = detectUserIntent(input);
3684
- if (intent.mode === "explore" && intent.confidence >= 0.7) {
3684
+ if (isReadOnlyExploreRequest(input) || intent.mode === "explore" && intent.confidence >= 0.7) {
3685
3685
  console.log(chalk5.dim("\n> Got it! Analyzing the project...\n"));
3686
3686
  await runExploreFlow(cwd, input, { agentMode: true });
3687
3687
  return true;
@@ -3696,6 +3696,11 @@ async function handleAgentConversationInput(cwd, input) {
3696
3696
  await continueWithCurrentTask(cwd);
3697
3697
  return true;
3698
3698
  }
3699
+ function isReadOnlyExploreRequest(input) {
3700
+ const normalized = input.trim().toLowerCase();
3701
+ if (!normalized) return false;
3702
+ return /\b(read|scan|analy[sz]e|analyse|review|inspect|explore)\b/.test(normalized) && /\b(files?|folder|project|repo|codebase)\b/.test(normalized) && !/\b(create|build|implement|fix|write|edit|change|update|refactor)\b/.test(normalized);
3703
+ }
3699
3704
  function isReferenceToPreviousRequest(input) {
3700
3705
  const normalized = input.toLowerCase().replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
3701
3706
  if (!normalized) return false;
@@ -3747,8 +3752,8 @@ async function continueWithCurrentTask(cwd) {
3747
3752
  console.log(chalk5.dim(`
3748
3753
  Continuing with ${nextAtom.externalId}...
3749
3754
  `));
3750
- const { execute: execute2 } = await import("./execute-SGRPEDGM.js");
3751
- await execute2(nextAtom.externalId, {});
3755
+ const { execute: execute2 } = await import("./execute-WIOXRN5H.js");
3756
+ await execute2(nextAtom.externalId, { nonTerminating: true });
3752
3757
  }
3753
3758
  async function showMainMenu() {
3754
3759
  const cwd = process.cwd();
@@ -3806,7 +3811,7 @@ async function handleFreeformJourneyInput(cwd, input) {
3806
3811
  const freeform = input.trim();
3807
3812
  if (!freeform) return false;
3808
3813
  const intent = detectUserIntent(freeform);
3809
- if (intent.mode === "explore" && intent.confidence >= 0.7) {
3814
+ if (isReadOnlyExploreRequest(freeform) || intent.mode === "explore" && intent.confidence >= 0.7) {
3810
3815
  console.log(chalk5.dim("\n> Got it! Analyzing the project...\n"));
3811
3816
  await runExploreFlow(cwd, freeform);
3812
3817
  return true;
@@ -3972,7 +3977,7 @@ async function executeNext() {
3972
3977
  const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
3973
3978
  const targetId = atomId.trim() || pendingAtoms[0]?.id;
3974
3979
  if (targetId) {
3975
- const { execute: execute2 } = await import("./execute-SGRPEDGM.js");
3980
+ const { execute: execute2 } = await import("./execute-WIOXRN5H.js");
3976
3981
  await execute2(targetId, {});
3977
3982
  } else {
3978
3983
  console.log(chalk5.yellow("No atom to execute."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archondev",
3
- "version": "2.19.24",
3
+ "version": "2.19.25",
4
4
  "description": "Local-first AI-powered development governance system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {