archondev 2.19.24 → 2.19.26
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4864
|
+
return fail();
|
|
4858
4865
|
}
|
|
4859
4866
|
return;
|
|
4860
4867
|
}
|
|
4861
4868
|
console.log(chalk2.dim(`Loading atom ${atomId}...`));
|
|
4862
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
EnvironmentConfigLoader,
|
|
57
57
|
EnvironmentValidator,
|
|
58
58
|
execute
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-VMQKFKX3.js";
|
|
60
60
|
import {
|
|
61
61
|
cloudCancel,
|
|
62
62
|
cloudLogs,
|
|
@@ -3226,7 +3226,10 @@ async function runExploreFlow(cwd, followUpInput, options = {}) {
|
|
|
3226
3226
|
if (actionableFollowUp || containsActionIntent(originalFollowUp)) {
|
|
3227
3227
|
const request = actionableFollowUp ?? originalFollowUp;
|
|
3228
3228
|
console.log(chalk5.dim("I finished the project scan. Continuing with your requested task...\n"));
|
|
3229
|
-
await handlePostExploreAction(cwd, request
|
|
3229
|
+
await handlePostExploreAction(cwd, request, {
|
|
3230
|
+
agentMode: options.agentMode,
|
|
3231
|
+
originalInput: originalFollowUp
|
|
3232
|
+
});
|
|
3230
3233
|
return;
|
|
3231
3234
|
}
|
|
3232
3235
|
if (options.agentMode) {
|
|
@@ -3681,7 +3684,7 @@ async function handleAgentConversationInput(cwd, input) {
|
|
|
3681
3684
|
return true;
|
|
3682
3685
|
}
|
|
3683
3686
|
const intent = detectUserIntent(input);
|
|
3684
|
-
if (intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3687
|
+
if (isReadOnlyExploreRequest(input) || intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3685
3688
|
console.log(chalk5.dim("\n> Got it! Analyzing the project...\n"));
|
|
3686
3689
|
await runExploreFlow(cwd, input, { agentMode: true });
|
|
3687
3690
|
return true;
|
|
@@ -3696,6 +3699,11 @@ async function handleAgentConversationInput(cwd, input) {
|
|
|
3696
3699
|
await continueWithCurrentTask(cwd);
|
|
3697
3700
|
return true;
|
|
3698
3701
|
}
|
|
3702
|
+
function isReadOnlyExploreRequest(input) {
|
|
3703
|
+
const normalized = input.trim().toLowerCase();
|
|
3704
|
+
if (!normalized) return false;
|
|
3705
|
+
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);
|
|
3706
|
+
}
|
|
3699
3707
|
function isReferenceToPreviousRequest(input) {
|
|
3700
3708
|
const normalized = input.toLowerCase().replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
|
|
3701
3709
|
if (!normalized) return false;
|
|
@@ -3747,8 +3755,8 @@ async function continueWithCurrentTask(cwd) {
|
|
|
3747
3755
|
console.log(chalk5.dim(`
|
|
3748
3756
|
Continuing with ${nextAtom.externalId}...
|
|
3749
3757
|
`));
|
|
3750
|
-
const { execute: execute2 } = await import("./execute-
|
|
3751
|
-
await execute2(nextAtom.externalId, {});
|
|
3758
|
+
const { execute: execute2 } = await import("./execute-WIOXRN5H.js");
|
|
3759
|
+
await execute2(nextAtom.externalId, { nonTerminating: true });
|
|
3752
3760
|
}
|
|
3753
3761
|
async function showMainMenu() {
|
|
3754
3762
|
const cwd = process.cwd();
|
|
@@ -3806,7 +3814,7 @@ async function handleFreeformJourneyInput(cwd, input) {
|
|
|
3806
3814
|
const freeform = input.trim();
|
|
3807
3815
|
if (!freeform) return false;
|
|
3808
3816
|
const intent = detectUserIntent(freeform);
|
|
3809
|
-
if (intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3817
|
+
if (isReadOnlyExploreRequest(freeform) || intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3810
3818
|
console.log(chalk5.dim("\n> Got it! Analyzing the project...\n"));
|
|
3811
3819
|
await runExploreFlow(cwd, freeform);
|
|
3812
3820
|
return true;
|
|
@@ -3862,7 +3870,7 @@ function containsActionIntent(input) {
|
|
|
3862
3870
|
if (!normalized) return false;
|
|
3863
3871
|
return /(i would like to|i want to|i need to|how (can|could|do i)|can you|could you|would you|help me|create|build|generate|make|produce|plan|implement|write|fix|convert|compile)/.test(normalized);
|
|
3864
3872
|
}
|
|
3865
|
-
async function handlePostExploreAction(cwd, request) {
|
|
3873
|
+
async function handlePostExploreAction(cwd, request, options = {}) {
|
|
3866
3874
|
const intent = detectUserIntent(request);
|
|
3867
3875
|
if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
|
|
3868
3876
|
console.log(chalk5.dim("> Let me understand your project better...\n"));
|
|
@@ -3876,6 +3884,14 @@ async function handlePostExploreAction(cwd, request) {
|
|
|
3876
3884
|
}
|
|
3877
3885
|
const { plan: plan2 } = await import("./plan-PJI6MCS3.js");
|
|
3878
3886
|
await plan2(request, { conversational: true });
|
|
3887
|
+
if (options.agentMode) {
|
|
3888
|
+
const sourceInput = options.originalInput?.trim() || request;
|
|
3889
|
+
if (shouldStopAfterPlanning(sourceInput)) {
|
|
3890
|
+
await showLatestPlannedAtom(cwd);
|
|
3891
|
+
} else {
|
|
3892
|
+
await continueWithCurrentTask(cwd);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3879
3895
|
}
|
|
3880
3896
|
async function planTask() {
|
|
3881
3897
|
const { plan: plan2 } = await import("./plan-PJI6MCS3.js");
|
|
@@ -3972,7 +3988,7 @@ async function executeNext() {
|
|
|
3972
3988
|
const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
|
|
3973
3989
|
const targetId = atomId.trim() || pendingAtoms[0]?.id;
|
|
3974
3990
|
if (targetId) {
|
|
3975
|
-
const { execute: execute2 } = await import("./execute-
|
|
3991
|
+
const { execute: execute2 } = await import("./execute-WIOXRN5H.js");
|
|
3976
3992
|
await execute2(targetId, {});
|
|
3977
3993
|
} else {
|
|
3978
3994
|
console.log(chalk5.yellow("No atom to execute."));
|