archondev 2.19.18 → 2.19.20
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/index.js +67 -334
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,9 +124,8 @@ function shouldEnableSafeMode() {
|
|
|
124
124
|
}
|
|
125
125
|
return process.env["TERM_PROGRAM"] === "Apple_Terminal";
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
return withoutAnsi.replace(/[^\x09\x0A\x0D\x20-\x7E]/g, "");
|
|
127
|
+
function isTerminalSafeMode() {
|
|
128
|
+
return shouldEnableSafeMode();
|
|
130
129
|
}
|
|
131
130
|
function enableTerminalCompatibilityMode() {
|
|
132
131
|
if (!shouldEnableSafeMode()) {
|
|
@@ -139,19 +138,7 @@ function enableTerminalCompatibilityMode() {
|
|
|
139
138
|
globalObj[SAFE_MODE_FLAG] = true;
|
|
140
139
|
process.env["NO_COLOR"] = "1";
|
|
141
140
|
process.env["FORCE_COLOR"] = "0";
|
|
142
|
-
|
|
143
|
-
for (const method of methods) {
|
|
144
|
-
const original = console[method].bind(console);
|
|
145
|
-
console[method] = (...args) => {
|
|
146
|
-
const patched = args.map((arg) => {
|
|
147
|
-
if (typeof arg === "string") {
|
|
148
|
-
return toAsciiSafe(arg);
|
|
149
|
-
}
|
|
150
|
-
return arg;
|
|
151
|
-
});
|
|
152
|
-
original(...patched);
|
|
153
|
-
};
|
|
154
|
-
}
|
|
141
|
+
process.env["ARCHON_TERMINAL_SAFE_MODE"] = "1";
|
|
155
142
|
}
|
|
156
143
|
|
|
157
144
|
// src/cli/promote.ts
|
|
@@ -1051,6 +1038,14 @@ var ARCHON_LOGO_MINI = `
|
|
|
1051
1038
|
\u2588\u2588\u2588\u2588\u2588\u2588
|
|
1052
1039
|
`;
|
|
1053
1040
|
function displayBrandedHeader() {
|
|
1041
|
+
if (process.env["ARCHON_TERMINAL_SAFE_MODE"] === "1") {
|
|
1042
|
+
console.log();
|
|
1043
|
+
console.log("ArchonDev");
|
|
1044
|
+
console.log("AI-Powered Development Governance");
|
|
1045
|
+
console.log("----------------------------------------");
|
|
1046
|
+
console.log();
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1054
1049
|
console.log();
|
|
1055
1050
|
console.log(chalk5.hex("#374F4E")(ARCHON_LOGO_MINI));
|
|
1056
1051
|
console.log(chalk5.bold.hex("#374F4E")(" ArchonDev"));
|
|
@@ -1226,9 +1221,6 @@ function detectUserIntent(message) {
|
|
|
1226
1221
|
suggestedAction: "clarify"
|
|
1227
1222
|
};
|
|
1228
1223
|
}
|
|
1229
|
-
function needsClarification(result) {
|
|
1230
|
-
return result.confidence < 0.65 || result.suggestedAction === "clarify";
|
|
1231
|
-
}
|
|
1232
1224
|
function wantsToSkip(message) {
|
|
1233
1225
|
return ESCAPE_PHRASES.some((pattern) => pattern.test(message.trim()));
|
|
1234
1226
|
}
|
|
@@ -3023,17 +3015,7 @@ async function start(options = {}) {
|
|
|
3023
3015
|
if (await shouldRunAutoCleanup(cwd)) {
|
|
3024
3016
|
await runAutoCleanupCheck(cwd);
|
|
3025
3017
|
}
|
|
3026
|
-
|
|
3027
|
-
case "NEW_PROJECT":
|
|
3028
|
-
await handleNewProject(cwd, projectState);
|
|
3029
|
-
break;
|
|
3030
|
-
case "ADAPT_EXISTING":
|
|
3031
|
-
await handleAdaptExisting(cwd, projectState);
|
|
3032
|
-
break;
|
|
3033
|
-
case "CONTINUE_SESSION":
|
|
3034
|
-
await handleContinueSession(cwd, projectState);
|
|
3035
|
-
break;
|
|
3036
|
-
}
|
|
3018
|
+
await runAgentMode(cwd, projectState);
|
|
3037
3019
|
}
|
|
3038
3020
|
function formatTierName(tier) {
|
|
3039
3021
|
switch (tier) {
|
|
@@ -3297,112 +3279,7 @@ async function gatherGovernanceStatus(cwd) {
|
|
|
3297
3279
|
}
|
|
3298
3280
|
return status2;
|
|
3299
3281
|
}
|
|
3300
|
-
async function
|
|
3301
|
-
console.log(chalk6.bold("\u{1F389} Starting a new project? Great!\n"));
|
|
3302
|
-
console.log(chalk6.dim("Answer as much or as little as you want \u2014 you can always refine later."));
|
|
3303
|
-
console.log(chalk6.dim('Type "just start" or "skip" to use defaults.\n'));
|
|
3304
|
-
const initialResponse = await promptWithCommands("What do you want to do?", { allowMultiline: true });
|
|
3305
|
-
if (!initialResponse.trim()) {
|
|
3306
|
-
console.log(chalk6.yellow("\nNo response provided. Showing options...\n"));
|
|
3307
|
-
await showNewProjectMenu(cwd);
|
|
3308
|
-
return;
|
|
3309
|
-
}
|
|
3310
|
-
const intent = detectUserIntent(initialResponse);
|
|
3311
|
-
if (wantsToSkip(initialResponse)) {
|
|
3312
|
-
console.log(chalk6.dim("\n> Using defaults \u2014 let's go!\n"));
|
|
3313
|
-
await quickStart(cwd);
|
|
3314
|
-
return;
|
|
3315
|
-
}
|
|
3316
|
-
if (intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3317
|
-
console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
|
|
3318
|
-
await runExploreFlow(cwd, initialResponse);
|
|
3319
|
-
return;
|
|
3320
|
-
}
|
|
3321
|
-
if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
|
|
3322
|
-
console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
|
|
3323
|
-
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3324
|
-
await plan2(initialResponse, { conversational: true });
|
|
3325
|
-
return;
|
|
3326
|
-
}
|
|
3327
|
-
if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
|
|
3328
|
-
console.log(chalk6.dim("\n> Sounds like a bigger project. Let me ask a few quick questions...\n"));
|
|
3329
|
-
await runConversationalInterview(cwd, initialResponse);
|
|
3330
|
-
return;
|
|
3331
|
-
}
|
|
3332
|
-
if (needsClarification(intent)) {
|
|
3333
|
-
console.log();
|
|
3334
|
-
console.log(chalk6.dim("I'm not sure yet. You can tell me in plain language, or use shortcuts:"));
|
|
3335
|
-
console.log();
|
|
3336
|
-
console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Build something new")}`);
|
|
3337
|
-
console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Do a specific task")}`);
|
|
3338
|
-
console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Explore project/status")}`);
|
|
3339
|
-
console.log();
|
|
3340
|
-
const clarification = await promptWithCommands("What are you trying to do?", { allowMultiline: true });
|
|
3341
|
-
const trimmed = clarification.trim();
|
|
3342
|
-
if (trimmed === "1") {
|
|
3343
|
-
await runConversationalInterview(cwd, initialResponse);
|
|
3344
|
-
return;
|
|
3345
|
-
}
|
|
3346
|
-
if (trimmed === "2") {
|
|
3347
|
-
console.log(chalk6.dim("\n> Creating a task for this...\n"));
|
|
3348
|
-
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3349
|
-
await plan2(initialResponse, { conversational: true });
|
|
3350
|
-
return;
|
|
3351
|
-
}
|
|
3352
|
-
if (trimmed === "3") {
|
|
3353
|
-
await showNewProjectMenu(cwd);
|
|
3354
|
-
return;
|
|
3355
|
-
}
|
|
3356
|
-
if (trimmed) {
|
|
3357
|
-
const handled = await handleFreeformJourneyInput(cwd, trimmed);
|
|
3358
|
-
if (handled) {
|
|
3359
|
-
return;
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
|
-
await showNewProjectMenu(cwd);
|
|
3363
|
-
return;
|
|
3364
|
-
}
|
|
3365
|
-
await runConversationalInterview(cwd, initialResponse);
|
|
3366
|
-
}
|
|
3367
|
-
async function showNewProjectMenu(cwd) {
|
|
3368
|
-
console.log(chalk6.bold("What would you like to do?\n"));
|
|
3369
|
-
console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut number:\n"));
|
|
3370
|
-
console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Start interview")} \u2014 I'll ask questions to understand your project`);
|
|
3371
|
-
console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Quick start")} \u2014 Just create basic governance files`);
|
|
3372
|
-
console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Plan a task")} \u2014 Create an atom for a specific task`);
|
|
3373
|
-
console.log(` ${chalk6.cyan("q")}) ${chalk6.dim("Quit")}`);
|
|
3374
|
-
console.log(chalk6.dim(' (Type "upgrade" or "help" anytime)'));
|
|
3375
|
-
console.log();
|
|
3376
|
-
const choice = await promptWithCommands("Enter choice");
|
|
3377
|
-
switch (choice.toLowerCase()) {
|
|
3378
|
-
case "1":
|
|
3379
|
-
await runConversationalInterview(cwd, "");
|
|
3380
|
-
break;
|
|
3381
|
-
case "2":
|
|
3382
|
-
await quickStart(cwd);
|
|
3383
|
-
break;
|
|
3384
|
-
case "3": {
|
|
3385
|
-
const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
|
|
3386
|
-
if (description.trim()) {
|
|
3387
|
-
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3388
|
-
await plan2(description, { conversational: true });
|
|
3389
|
-
}
|
|
3390
|
-
break;
|
|
3391
|
-
}
|
|
3392
|
-
case "q":
|
|
3393
|
-
process.exit(0);
|
|
3394
|
-
default:
|
|
3395
|
-
if (choice.trim()) {
|
|
3396
|
-
const handled = await handleFreeformJourneyInput(cwd, choice);
|
|
3397
|
-
if (handled) {
|
|
3398
|
-
return;
|
|
3399
|
-
}
|
|
3400
|
-
}
|
|
3401
|
-
console.log(chalk6.yellow("I did not catch that. Try again or describe what you want in plain language."));
|
|
3402
|
-
await showNewProjectMenu(cwd);
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
async function runExploreFlow(cwd, followUpInput) {
|
|
3282
|
+
async function runExploreFlow(cwd, followUpInput, options = {}) {
|
|
3406
3283
|
console.log(chalk6.blue("-- Analyzing Project --\n"));
|
|
3407
3284
|
const projectInfo = await gatherProjectInfo(cwd);
|
|
3408
3285
|
console.log(chalk6.bold("\u{1F4C1} Project Overview\n"));
|
|
@@ -3451,6 +3328,10 @@ async function runExploreFlow(cwd, followUpInput) {
|
|
|
3451
3328
|
await handlePostExploreAction(cwd, request);
|
|
3452
3329
|
return;
|
|
3453
3330
|
}
|
|
3331
|
+
if (options.agentMode) {
|
|
3332
|
+
console.log(chalk6.dim("Tell me the next thing you want to do.\n"));
|
|
3333
|
+
return;
|
|
3334
|
+
}
|
|
3454
3335
|
console.log(chalk6.bold("What would you like to do next?\n"));
|
|
3455
3336
|
console.log(chalk6.dim("You can describe it naturally, or use shortcuts:\n"));
|
|
3456
3337
|
console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Plan a task")} \u2014 Tell me what to implement, fix, or change`);
|
|
@@ -3812,122 +3693,6 @@ function inferLanguageFromProjectFiles(cwd) {
|
|
|
3812
3693
|
}
|
|
3813
3694
|
return best?.language;
|
|
3814
3695
|
}
|
|
3815
|
-
async function quickStart(cwd) {
|
|
3816
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
3817
|
-
const progressPath = join6(cwd, "progress.txt");
|
|
3818
|
-
if (!existsSync6(progressPath)) {
|
|
3819
|
-
const { writeFileSync: writeFileSync2 } = await import("fs");
|
|
3820
|
-
writeFileSync2(progressPath, `# ArchonDev Progress Log
|
|
3821
|
-
|
|
3822
|
-
This file tracks learnings and decisions across sessions.
|
|
3823
|
-
|
|
3824
|
-
## ${today} - Project Initialized (Quick Start)
|
|
3825
|
-
|
|
3826
|
-
### What was done
|
|
3827
|
-
- Created ARCHITECTURE.md with default template
|
|
3828
|
-
- Initialized .archon directory
|
|
3829
|
-
- Created this progress.txt
|
|
3830
|
-
|
|
3831
|
-
### Next Steps
|
|
3832
|
-
1. Customize ARCHITECTURE.md for your project
|
|
3833
|
-
2. Run \`archon plan "your first task"\` to create an atom
|
|
3834
|
-
`);
|
|
3835
|
-
}
|
|
3836
|
-
console.log(chalk6.green("\u2713 Ready to go!\n"));
|
|
3837
|
-
await showMainMenu();
|
|
3838
|
-
}
|
|
3839
|
-
async function handleAdaptExisting(cwd, state) {
|
|
3840
|
-
if (state.hasArchitecture) {
|
|
3841
|
-
console.log(chalk6.bold("Project governance is set up!\n"));
|
|
3842
|
-
console.log(chalk6.dim("Type what you want to do, or choose an option below.\n"));
|
|
3843
|
-
} else {
|
|
3844
|
-
console.log(chalk6.bold("Existing project detected!\n"));
|
|
3845
|
-
console.log(chalk6.dim("I can analyze your codebase and adapt the governance files to match your structure."));
|
|
3846
|
-
console.log(chalk6.dim("This helps me understand your architecture without changing any code.\n"));
|
|
3847
|
-
}
|
|
3848
|
-
const response = await promptWithCommands("What would you like to do?", { allowMultiline: true });
|
|
3849
|
-
if (response.toLowerCase() === "q" || response.toLowerCase() === "quit") {
|
|
3850
|
-
process.exit(0);
|
|
3851
|
-
}
|
|
3852
|
-
if (!response.trim()) {
|
|
3853
|
-
await showAdaptExistingMenu(cwd, state);
|
|
3854
|
-
return;
|
|
3855
|
-
}
|
|
3856
|
-
const intent = detectUserIntent(response);
|
|
3857
|
-
if (intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3858
|
-
console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
|
|
3859
|
-
await runExploreFlow(cwd, response);
|
|
3860
|
-
return;
|
|
3861
|
-
}
|
|
3862
|
-
if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
|
|
3863
|
-
console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
|
|
3864
|
-
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3865
|
-
await plan2(response, { conversational: true });
|
|
3866
|
-
return;
|
|
3867
|
-
}
|
|
3868
|
-
if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
|
|
3869
|
-
console.log(chalk6.dim("\n> Let me understand your project better...\n"));
|
|
3870
|
-
await runConversationalInterview(cwd, response);
|
|
3871
|
-
return;
|
|
3872
|
-
}
|
|
3873
|
-
if (response.trim()) {
|
|
3874
|
-
const handled = await handleFreeformJourneyInput(cwd, response);
|
|
3875
|
-
if (handled) {
|
|
3876
|
-
return;
|
|
3877
|
-
}
|
|
3878
|
-
}
|
|
3879
|
-
await showAdaptExistingMenu(cwd, state);
|
|
3880
|
-
}
|
|
3881
|
-
async function showAdaptExistingMenu(cwd, state) {
|
|
3882
|
-
console.log();
|
|
3883
|
-
console.log(chalk6.bold("What would you like to do?\n"));
|
|
3884
|
-
console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut number:\n"));
|
|
3885
|
-
console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Analyze project")} \u2014 Scan and summarize the codebase`);
|
|
3886
|
-
console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Plan a task")} \u2014 Create an implementation plan for something specific`);
|
|
3887
|
-
console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Code review")} \u2014 Review code for issues`);
|
|
3888
|
-
if (!state.hasArchitecture) {
|
|
3889
|
-
console.log(` ${chalk6.cyan("4")}) ${chalk6.bold("Set up governance")} \u2014 Create ARCHITECTURE.md from your code`);
|
|
3890
|
-
}
|
|
3891
|
-
console.log(` ${chalk6.cyan("q")}) ${chalk6.dim("Quit")}`);
|
|
3892
|
-
console.log(chalk6.dim(' (Type "upgrade" or "help" anytime)'));
|
|
3893
|
-
console.log();
|
|
3894
|
-
const choice = await promptWithCommands("Enter choice");
|
|
3895
|
-
switch (choice.toLowerCase()) {
|
|
3896
|
-
case "1":
|
|
3897
|
-
await runExploreFlow(cwd);
|
|
3898
|
-
break;
|
|
3899
|
-
case "2": {
|
|
3900
|
-
const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
|
|
3901
|
-
if (description.trim()) {
|
|
3902
|
-
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3903
|
-
await plan2(description, { conversational: true });
|
|
3904
|
-
}
|
|
3905
|
-
break;
|
|
3906
|
-
}
|
|
3907
|
-
case "3":
|
|
3908
|
-
await codeReviewFirst(cwd);
|
|
3909
|
-
break;
|
|
3910
|
-
case "4":
|
|
3911
|
-
if (!state.hasArchitecture) {
|
|
3912
|
-
await analyzeAndAdapt(cwd);
|
|
3913
|
-
} else {
|
|
3914
|
-
console.log(chalk6.yellow("Invalid choice. Please try again."));
|
|
3915
|
-
await showAdaptExistingMenu(cwd, state);
|
|
3916
|
-
}
|
|
3917
|
-
break;
|
|
3918
|
-
case "q":
|
|
3919
|
-
process.exit(0);
|
|
3920
|
-
default:
|
|
3921
|
-
if (choice.trim()) {
|
|
3922
|
-
const handled = await handleFreeformJourneyInput(cwd, choice);
|
|
3923
|
-
if (handled) {
|
|
3924
|
-
return;
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
console.log(chalk6.yellow("I did not catch that. Try again or describe what you want in plain language."));
|
|
3928
|
-
await showAdaptExistingMenu(cwd, state);
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
3696
|
async function analyzeAndAdapt(cwd) {
|
|
3932
3697
|
console.log(chalk6.blue("\n-- Analyzing Project --\n"));
|
|
3933
3698
|
const { init: init2 } = await import("./init-FINETS3Q.js");
|
|
@@ -3969,53 +3734,58 @@ async function codeReviewFirst(cwd) {
|
|
|
3969
3734
|
}
|
|
3970
3735
|
console.log(chalk6.dim("\nAfter reviewing, you can run ") + chalk6.cyan("archon") + chalk6.dim(" again to set up governance.\n"));
|
|
3971
3736
|
}
|
|
3972
|
-
async function
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
const handoff = checkForHandoff(cwd);
|
|
3980
|
-
if (handoff) {
|
|
3981
|
-
console.log(chalk6.yellow("[HANDOFF] Found from last session:\n"));
|
|
3982
|
-
console.log(chalk6.dim(handoff.nextSteps));
|
|
3983
|
-
console.log();
|
|
3984
|
-
const continueHandoff = await promptYesNo("Continue from handoff?", true);
|
|
3985
|
-
if (continueHandoff) {
|
|
3986
|
-
console.log(chalk6.dim("\nPicking up where you left off...\n"));
|
|
3987
|
-
}
|
|
3988
|
-
}
|
|
3989
|
-
if (state.hasReviewDb) {
|
|
3990
|
-
await showReviewProgress(cwd);
|
|
3991
|
-
}
|
|
3992
|
-
const response = await promptWithCommands("What would you like to do next? (press Enter for options)", { allowMultiline: true });
|
|
3993
|
-
if (response.trim()) {
|
|
3994
|
-
const handled = await handleFreeformJourneyInput(cwd, response);
|
|
3995
|
-
if (handled) {
|
|
3996
|
-
await continueConversationLoop(cwd);
|
|
3997
|
-
return;
|
|
3737
|
+
async function runAgentMode(cwd, state) {
|
|
3738
|
+
if (state.scenario === "CONTINUE_SESSION") {
|
|
3739
|
+
console.log(chalk6.bold("Welcome back!\n"));
|
|
3740
|
+
if (state.lastProgressEntry) {
|
|
3741
|
+
console.log(chalk6.dim("Last activity:"));
|
|
3742
|
+
console.log(chalk6.dim(" " + state.lastProgressEntry.split("\n")[0]));
|
|
3743
|
+
console.log();
|
|
3998
3744
|
}
|
|
3745
|
+
} else if (state.scenario === "NEW_PROJECT") {
|
|
3746
|
+
console.log(chalk6.bold("Starting in chat mode.\n"));
|
|
3747
|
+
console.log(chalk6.dim("Tell me what you want to build. I will apply governance checks in the background.\n"));
|
|
3748
|
+
} else {
|
|
3749
|
+
console.log(chalk6.bold("Ready in chat mode.\n"));
|
|
3750
|
+
console.log(chalk6.dim("Tell me what you want to do. Use /workflow for the classic menu.\n"));
|
|
3999
3751
|
}
|
|
4000
|
-
await showMainMenu();
|
|
4001
|
-
}
|
|
4002
|
-
async function continueConversationLoop(cwd) {
|
|
4003
3752
|
while (true) {
|
|
4004
|
-
const response = await promptWithCommands(
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
3753
|
+
const response = await promptWithCommands(
|
|
3754
|
+
"What should we work on next? (use /workflow for menu)",
|
|
3755
|
+
{ allowMultiline: true }
|
|
3756
|
+
);
|
|
3757
|
+
const trimmed = response.trim();
|
|
3758
|
+
if (!trimmed) {
|
|
3759
|
+
continue;
|
|
4008
3760
|
}
|
|
4009
|
-
if (
|
|
4010
|
-
await
|
|
3761
|
+
if (trimmed.toLowerCase() === "/workflow") {
|
|
3762
|
+
await showMainMenu();
|
|
4011
3763
|
continue;
|
|
4012
3764
|
}
|
|
4013
|
-
const handled = await
|
|
3765
|
+
const handled = await handleAgentConversationInput(cwd, trimmed);
|
|
4014
3766
|
if (!handled) {
|
|
4015
|
-
console.log(chalk6.yellow("I did not catch that.
|
|
3767
|
+
console.log(chalk6.yellow("I did not catch that. Describe your goal in one sentence."));
|
|
4016
3768
|
}
|
|
4017
3769
|
}
|
|
4018
3770
|
}
|
|
3771
|
+
async function handleAgentConversationInput(cwd, input) {
|
|
3772
|
+
const normalized = input.trim().toLowerCase();
|
|
3773
|
+
if (!normalized) return false;
|
|
3774
|
+
if (isContinuationDirective(normalized)) {
|
|
3775
|
+
await continueWithCurrentTask(cwd);
|
|
3776
|
+
return true;
|
|
3777
|
+
}
|
|
3778
|
+
const intent = detectUserIntent(input);
|
|
3779
|
+
if (intent.mode === "explore" && intent.confidence >= 0.7) {
|
|
3780
|
+
console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
|
|
3781
|
+
await runExploreFlow(cwd, input, { agentMode: true });
|
|
3782
|
+
return true;
|
|
3783
|
+
}
|
|
3784
|
+
console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
|
|
3785
|
+
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
3786
|
+
await plan2(input, { conversational: true });
|
|
3787
|
+
return true;
|
|
3788
|
+
}
|
|
4019
3789
|
function isContinuationDirective(input) {
|
|
4020
3790
|
const normalized = input.trim().toLowerCase();
|
|
4021
3791
|
return normalized === "continue" || normalized === "continue." || normalized === "go on" || normalized === "go ahead" || normalized === "next" || normalized === "proceed" || normalized === "do it";
|
|
@@ -4039,31 +3809,6 @@ Continuing with ${nextAtom.externalId}...
|
|
|
4039
3809
|
const { execute: execute2 } = await import("./execute-3IUO33KY.js");
|
|
4040
3810
|
await execute2(nextAtom.externalId, {});
|
|
4041
3811
|
}
|
|
4042
|
-
function checkForHandoff(cwd) {
|
|
4043
|
-
try {
|
|
4044
|
-
const currentContextPath = join6(cwd, ".archon", "current_context.md");
|
|
4045
|
-
if (existsSync6(currentContextPath)) {
|
|
4046
|
-
const content2 = readFileSync3(currentContextPath, "utf-8");
|
|
4047
|
-
const nextStepsMatch = content2.match(/## Next Actions[^\n]*\n([\s\S]*?)(?=\n## |\n*$)/);
|
|
4048
|
-
if (nextStepsMatch && nextStepsMatch[1]) {
|
|
4049
|
-
return { nextSteps: nextStepsMatch[1].trim() };
|
|
4050
|
-
}
|
|
4051
|
-
}
|
|
4052
|
-
const progressPath = join6(cwd, "progress.txt");
|
|
4053
|
-
if (!existsSync6(progressPath)) return null;
|
|
4054
|
-
const content = readFileSync3(progressPath, "utf-8");
|
|
4055
|
-
const handoffMatch = content.match(/## Context Handoff[^\n]*\n([\s\S]*?)(?=\n## |\n*$)/);
|
|
4056
|
-
if (handoffMatch && handoffMatch[1]) {
|
|
4057
|
-
const handoffContent = handoffMatch[1];
|
|
4058
|
-
const nextStepsMatch = handoffContent.match(/### Next Steps[^\n]*\n([\s\S]*?)(?=\n### |$)/);
|
|
4059
|
-
if (nextStepsMatch && nextStepsMatch[1]) {
|
|
4060
|
-
return { nextSteps: nextStepsMatch[1].trim() };
|
|
4061
|
-
}
|
|
4062
|
-
}
|
|
4063
|
-
} catch {
|
|
4064
|
-
}
|
|
4065
|
-
return null;
|
|
4066
|
-
}
|
|
4067
3812
|
async function showMainMenu() {
|
|
4068
3813
|
const cwd = process.cwd();
|
|
4069
3814
|
while (true) {
|
|
@@ -4191,24 +3936,6 @@ async function handlePostExploreAction(cwd, request) {
|
|
|
4191
3936
|
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
4192
3937
|
await plan2(request, { conversational: true });
|
|
4193
3938
|
}
|
|
4194
|
-
async function showReviewProgress(cwd) {
|
|
4195
|
-
try {
|
|
4196
|
-
const { ReviewDatabase } = await import("./code-review-GJVBZPZA.js");
|
|
4197
|
-
const db = new ReviewDatabase(cwd);
|
|
4198
|
-
db.open();
|
|
4199
|
-
const stats = db.getStats();
|
|
4200
|
-
db.close();
|
|
4201
|
-
const total = stats.total;
|
|
4202
|
-
const completed = stats.completed;
|
|
4203
|
-
const pending = stats.pending + stats.inReview;
|
|
4204
|
-
const needsFix = stats.needsFix;
|
|
4205
|
-
console.log(
|
|
4206
|
-
chalk6.blue("Review Progress:") + chalk6.dim(` ${completed}/${total} completed`) + (needsFix > 0 ? chalk6.red(` (${needsFix} need fixes)`) : "") + (pending > 0 ? chalk6.yellow(` (${pending} pending)`) : "")
|
|
4207
|
-
);
|
|
4208
|
-
console.log();
|
|
4209
|
-
} catch {
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
3939
|
async function planTask() {
|
|
4213
3940
|
const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
|
|
4214
3941
|
const description = await promptWithCommands("Describe what you want to build", { allowMultiline: true });
|
|
@@ -4412,6 +4139,7 @@ async function handleInSessionCommand(input) {
|
|
|
4412
4139
|
console.log(chalk6.dim(" upgrade \u2014 Switch to BYOK or Managed plan"));
|
|
4413
4140
|
console.log(chalk6.dim(" status \u2014 Show login and tier status"));
|
|
4414
4141
|
console.log(chalk6.dim(" keys \u2014 Manage API keys (BYOK tier)"));
|
|
4142
|
+
console.log(chalk6.dim(" /workflow \u2014 Open classic workflow menu"));
|
|
4415
4143
|
console.log(chalk6.dim(" quit / q \u2014 Exit ArchonDev"));
|
|
4416
4144
|
console.log(chalk6.dim(" skip \u2014 Skip current question"));
|
|
4417
4145
|
console.log();
|
|
@@ -4438,6 +4166,7 @@ function showSlashCommandMenu() {
|
|
|
4438
4166
|
console.log(chalk6.dim(" /status Show account/status"));
|
|
4439
4167
|
console.log(chalk6.dim(" /settings Open settings & preferences"));
|
|
4440
4168
|
console.log(chalk6.dim(" /upgrade Open tier upgrade menu"));
|
|
4169
|
+
console.log(chalk6.dim(" /workflow Open classic workflow menu"));
|
|
4441
4170
|
console.log(chalk6.dim(" /quit Exit ArchonDev"));
|
|
4442
4171
|
console.log();
|
|
4443
4172
|
}
|
|
@@ -4482,6 +4211,9 @@ async function handleSlashCommand(input) {
|
|
|
4482
4211
|
await showUpgradeMenu();
|
|
4483
4212
|
return true;
|
|
4484
4213
|
}
|
|
4214
|
+
case "/workflow":
|
|
4215
|
+
await showMainMenu();
|
|
4216
|
+
return true;
|
|
4485
4217
|
case "/quit":
|
|
4486
4218
|
case "/exit":
|
|
4487
4219
|
console.log(chalk6.dim("Goodbye!"));
|
|
@@ -4527,9 +4259,10 @@ function promptMultiline(question) {
|
|
|
4527
4259
|
});
|
|
4528
4260
|
}
|
|
4529
4261
|
async function promptWithCommands(question, options = {}) {
|
|
4262
|
+
const useMultiline = Boolean(options.allowMultiline && !isTerminalSafeMode());
|
|
4530
4263
|
while (true) {
|
|
4531
|
-
const answer =
|
|
4532
|
-
if (
|
|
4264
|
+
const answer = useMultiline ? await promptMultiline(question) : await prompt(question);
|
|
4265
|
+
if (useMultiline && answer.includes("\n")) {
|
|
4533
4266
|
return answer;
|
|
4534
4267
|
}
|
|
4535
4268
|
const handled = await handleInSessionCommand(answer);
|