archondev 2.19.17 → 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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listLocalAtoms
3
- } from "./chunk-VUT5XLKM.js";
3
+ } from "./chunk-PSUBO3TR.js";
4
4
 
5
5
  // src/cli/list.ts
6
6
  import chalk from "chalk";
@@ -7,7 +7,7 @@ import {
7
7
  UsageRecorder,
8
8
  handleInsufficientCreditsRecovery,
9
9
  loadAtom
10
- } from "./chunk-VUT5XLKM.js";
10
+ } from "./chunk-PSUBO3TR.js";
11
11
  import {
12
12
  transitionAtom
13
13
  } from "./chunk-PCTP3LKJ.js";
@@ -4797,7 +4797,7 @@ function createPrompt() {
4797
4797
  }
4798
4798
  async function execute(atomId, options) {
4799
4799
  if (options.parallel && options.parallel.length > 0) {
4800
- const { parallelExecute } = await import("./parallel-3JTGAHOS.js");
4800
+ const { parallelExecute } = await import("./parallel-DBPSYNE4.js");
4801
4801
  const allAtomIds = [atomId, ...options.parallel];
4802
4802
  await parallelExecute(allAtomIds, { skipGates: options.skipGates === true });
4803
4803
  return;
@@ -954,6 +954,30 @@ async function plan(description, options) {
954
954
  Atom created: ${atom.externalId}`));
955
955
  console.log(chalk2.dim(`Title: ${atom.title}`));
956
956
  console.log(chalk2.dim(`Acceptance Criteria: ${atom.acceptanceCriteria.length} items`));
957
+ if (conversational) {
958
+ atom.plan = classification.kind === "content" ? buildContentPlan({
959
+ description,
960
+ requirements,
961
+ referencedFiles: references,
962
+ deliverableTarget,
963
+ missingFiles
964
+ }) : buildConversationalFallbackPlan({
965
+ description,
966
+ requirements,
967
+ references,
968
+ deliverableTarget
969
+ });
970
+ atom.status = "READY";
971
+ await saveAtom(atom);
972
+ console.log(chalk2.green(`
973
+ \u2705 Atom saved: ${atom.externalId}`));
974
+ console.log(chalk2.dim(`Status: ${atom.status}`));
975
+ console.log(chalk2.dim(`
976
+ Next steps:`));
977
+ console.log(chalk2.dim(` - Execute: archon execute ${atom.externalId}`));
978
+ console.log(chalk2.dim(` - View: archon show ${atom.externalId}`));
979
+ return;
980
+ }
957
981
  if (isContentOnlyTask) {
958
982
  console.log(chalk2.blue("\nContent task detected. Creating a lightweight plan (no adversarial loop)."));
959
983
  atom.plan = buildContentPlan({
@@ -1007,7 +1031,11 @@ Atom saved: ${atom.externalId}`));
1007
1031
  }
1008
1032
  const planner = billingContext ? new TrackedAdversarialPlanner({ apiKey, billing: billingContext }) : new AdversarialPlanner({ apiKey });
1009
1033
  if (billingContext && planner instanceof TrackedAdversarialPlanner) {
1010
- let balanceCheck = await planner.checkBalance();
1034
+ let balanceCheck = await withTimeout(
1035
+ planner.checkBalance(),
1036
+ conversational ? 15e3 : 3e4,
1037
+ "Balance check timed out"
1038
+ );
1011
1039
  if (balanceCheck.tier === "CREDITS") {
1012
1040
  console.log(chalk2.dim(`Estimated planning cost: $${(balanceCheck.estimatedCostCents / 100).toFixed(2)} | Balance: $${(balanceCheck.balance / 100).toFixed(2)}`));
1013
1041
  }
@@ -1020,7 +1048,11 @@ Atom saved: ${atom.externalId}`));
1020
1048
  if (recovery === "abort") {
1021
1049
  return;
1022
1050
  }
1023
- balanceCheck = await planner.checkBalance();
1051
+ balanceCheck = await withTimeout(
1052
+ planner.checkBalance(),
1053
+ conversational ? 15e3 : 3e4,
1054
+ "Balance re-check timed out"
1055
+ );
1024
1056
  if (!balanceCheck.sufficient && balanceCheck.tier === "CREDITS") {
1025
1057
  console.log(chalk2.red("\nStill insufficient credits after recovery action."));
1026
1058
  console.log(chalk2.dim("Please add more credits with: archon credits add"));
@@ -1029,7 +1061,35 @@ Atom saved: ${atom.externalId}`));
1029
1061
  }
1030
1062
  }
1031
1063
  }
1032
- const planResult = await planner.planAtom(atom, parseResult.schema);
1064
+ let planResult;
1065
+ try {
1066
+ planResult = await withTimeout(
1067
+ planner.planAtom(atom, parseResult.schema),
1068
+ conversational ? 45e3 : 12e4,
1069
+ "Planning timed out"
1070
+ );
1071
+ } catch (error) {
1072
+ if (!conversational) {
1073
+ throw error;
1074
+ }
1075
+ console.log(chalk2.yellow("\nPlanner is taking too long. Switching to a quick fallback plan."));
1076
+ atom.plan = buildConversationalFallbackPlan({
1077
+ description,
1078
+ requirements,
1079
+ references,
1080
+ deliverableTarget
1081
+ });
1082
+ atom.status = "READY";
1083
+ await saveAtom(atom);
1084
+ console.log(chalk2.green(`
1085
+ \u2705 Atom saved: ${atom.externalId}`));
1086
+ console.log(chalk2.dim(`Status: ${atom.status}`));
1087
+ console.log(chalk2.dim(`
1088
+ Next steps:`));
1089
+ console.log(chalk2.dim(` - Execute: archon execute ${atom.externalId}`));
1090
+ console.log(chalk2.dim(` - View: archon show ${atom.externalId}`));
1091
+ return;
1092
+ }
1033
1093
  if (!planResult.approved) {
1034
1094
  console.log(chalk2.red("\n\u274C Plan not approved after maximum iterations."));
1035
1095
  console.log(chalk2.yellow("Issues found:"));
@@ -1067,8 +1127,27 @@ Next steps:`));
1067
1127
  console.log(chalk2.dim(` - View: archon show ${atom.externalId}`));
1068
1128
  return;
1069
1129
  }
1070
- const answer2 = await prompt2.ask("\nSave as draft anyway? (y/N): ");
1071
- const normalized = answer2.toLowerCase();
1130
+ if (conversational) {
1131
+ console.log(chalk2.yellow("\nPlan was not fully approved. Saving a pragmatic fallback plan so you can continue."));
1132
+ atom.plan = buildConversationalFallbackPlan({
1133
+ description,
1134
+ requirements,
1135
+ references,
1136
+ deliverableTarget
1137
+ });
1138
+ atom.status = "READY";
1139
+ await saveAtom(atom);
1140
+ console.log(chalk2.green(`
1141
+ \u2705 Atom saved: ${atom.externalId}`));
1142
+ console.log(chalk2.dim(`Status: ${atom.status}`));
1143
+ console.log(chalk2.dim(`
1144
+ Next steps:`));
1145
+ console.log(chalk2.dim(` - Execute: archon execute ${atom.externalId}`));
1146
+ console.log(chalk2.dim(` - View: archon show ${atom.externalId}`));
1147
+ return;
1148
+ }
1149
+ const answer = await prompt2.ask("\nSave as draft anyway? (y/N): ");
1150
+ const normalized = answer.toLowerCase();
1072
1151
  if (normalized.includes("wrong") || normalized.includes("content") || normalized.includes("not a code")) {
1073
1152
  console.log(chalk2.blue("\nReclassifying as content task and creating a lightweight plan."));
1074
1153
  atom.plan = buildContentPlan({
@@ -1113,16 +1192,26 @@ Token usage: ${planResult.totalUsage.inputTokens} input, ${planResult.totalUsage
1113
1192
  }
1114
1193
  }
1115
1194
  }
1116
- const answer = await prompt2.ask("\nApprove this plan? (y/N/e for edit): ");
1117
- if (answer.toLowerCase() === "e") {
1118
- console.log(chalk2.yellow("Edit mode not yet implemented. Saving as draft."));
1119
- atom.status = "DRAFT";
1120
- } else if (answer.toLowerCase() !== "y") {
1121
- console.log(chalk2.dim("Atom discarded."));
1122
- return;
1123
- } else {
1124
- atom.plan = planResult.finalPlan;
1195
+ if (conversational) {
1196
+ atom.plan = planResult.finalPlan ?? buildConversationalFallbackPlan({
1197
+ description,
1198
+ requirements,
1199
+ references,
1200
+ deliverableTarget
1201
+ });
1125
1202
  atom.status = "READY";
1203
+ } else {
1204
+ const answer = await prompt2.ask("\nApprove this plan? (y/N/e for edit): ");
1205
+ if (answer.toLowerCase() === "e") {
1206
+ console.log(chalk2.yellow("Edit mode not yet implemented. Saving as draft."));
1207
+ atom.status = "DRAFT";
1208
+ } else if (answer.toLowerCase() !== "y") {
1209
+ console.log(chalk2.dim("Atom discarded."));
1210
+ return;
1211
+ } else {
1212
+ atom.plan = planResult.finalPlan;
1213
+ atom.status = "READY";
1214
+ }
1126
1215
  }
1127
1216
  await saveAtom(atom);
1128
1217
  console.log(chalk2.green(`
@@ -1137,6 +1226,17 @@ Next steps:`));
1137
1226
  prompt2.close();
1138
1227
  }
1139
1228
  }
1229
+ function withTimeout(promise, ms, message) {
1230
+ let timeoutHandle;
1231
+ const timeoutPromise = new Promise((_, reject) => {
1232
+ timeoutHandle = setTimeout(() => reject(new Error(message)), ms);
1233
+ });
1234
+ return Promise.race([promise, timeoutPromise]).finally(() => {
1235
+ if (timeoutHandle) {
1236
+ clearTimeout(timeoutHandle);
1237
+ }
1238
+ });
1239
+ }
1140
1240
  function printPlanNextActions(atomExternalId, success) {
1141
1241
  console.log();
1142
1242
  console.log(chalk2.bold("Next best action:"));
@@ -1363,6 +1463,34 @@ function buildContentPlan(input) {
1363
1463
  estimated_complexity: steps.length > 6 ? "MEDIUM" : "LOW"
1364
1464
  };
1365
1465
  }
1466
+ function buildConversationalFallbackPlan(input) {
1467
+ const steps = [];
1468
+ if (input.references.length > 0) {
1469
+ steps.push(`Review referenced inputs: ${input.references.join(", ")}`);
1470
+ } else {
1471
+ steps.push("Review current project files relevant to the request");
1472
+ }
1473
+ if (input.requirements.length > 0) {
1474
+ steps.push("Draft implementation outline directly from the detected requirements");
1475
+ } else {
1476
+ steps.push("Define a concrete implementation outline for the requested outcome");
1477
+ }
1478
+ steps.push("Create the first deliverable increment and validate against user intent");
1479
+ steps.push("Summarize the plan and execution-ready next action");
1480
+ if (input.deliverableTarget) {
1481
+ steps.push(`Write output to ${input.deliverableTarget}`);
1482
+ }
1483
+ return {
1484
+ steps,
1485
+ files_to_modify: input.references,
1486
+ dependencies: [],
1487
+ risks: [
1488
+ "Reference mismatch risk: confirm inferred requirements against provided source documents.",
1489
+ "Scope drift risk: keep first increment focused on the requested sample deliverable."
1490
+ ],
1491
+ estimated_complexity: "LOW"
1492
+ };
1493
+ }
1366
1494
  function extractReferencedFiles(description) {
1367
1495
  const references = /* @__PURE__ */ new Set();
1368
1496
  const barePattern = /\b[\w./-]+\.(md|txt|json|yaml|yml|png|jpg|jpeg|gif|svg|pdf)\b/gi;
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  listLocalAtoms,
8
8
  loadAtom
9
- } from "./chunk-VUT5XLKM.js";
9
+ } from "./chunk-PSUBO3TR.js";
10
10
  import {
11
11
  loadConfig
12
12
  } from "./chunk-SVU7MLG6.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  execute
3
- } from "./chunk-HVXBKZDF.js";
3
+ } from "./chunk-LWNFP7BL.js";
4
4
  import "./chunk-EBHHIUCB.js";
5
- import "./chunk-VUT5XLKM.js";
5
+ import "./chunk-PSUBO3TR.js";
6
6
  import "./chunk-PCTP3LKJ.js";
7
7
  import "./chunk-PJRQI5UN.js";
8
8
  import "./chunk-EIEU3IIY.js";
package/dist/index.js CHANGED
@@ -47,13 +47,13 @@ import {
47
47
  parallelRunWaves,
48
48
  parallelSchedule,
49
49
  parallelStatus
50
- } from "./chunk-BUFMPKXX.js";
50
+ } from "./chunk-RWNRCLN5.js";
51
51
  import {
52
52
  DependencyParser,
53
53
  EnvironmentConfigLoader,
54
54
  EnvironmentValidator,
55
55
  execute
56
- } from "./chunk-HVXBKZDF.js";
56
+ } from "./chunk-LWNFP7BL.js";
57
57
  import {
58
58
  cloudCancel,
59
59
  cloudLogs,
@@ -61,12 +61,12 @@ import {
61
61
  } from "./chunk-EBHHIUCB.js";
62
62
  import {
63
63
  list
64
- } from "./chunk-GU7OQ5EV.js";
64
+ } from "./chunk-6KE53F2W.js";
65
65
  import {
66
66
  listLocalAtoms,
67
67
  loadAtom,
68
68
  plan
69
- } from "./chunk-VUT5XLKM.js";
69
+ } from "./chunk-PSUBO3TR.js";
70
70
  import "./chunk-PCTP3LKJ.js";
71
71
  import "./chunk-PJRQI5UN.js";
72
72
  import {
@@ -124,9 +124,8 @@ function shouldEnableSafeMode() {
124
124
  }
125
125
  return process.env["TERM_PROGRAM"] === "Apple_Terminal";
126
126
  }
127
- function toAsciiSafe(value) {
128
- const withoutAnsi = value.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
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
- const methods = ["log", "info", "warn", "error"];
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
- switch (projectState.scenario) {
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 handleNewProject(cwd, _state) {
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-3UKVNQDT.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-3UKVNQDT.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-3UKVNQDT.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"));
@@ -3449,7 +3326,10 @@ async function runExploreFlow(cwd, followUpInput) {
3449
3326
  const request = actionableFollowUp ?? originalFollowUp;
3450
3327
  console.log(chalk6.dim("I finished the project scan. Continuing with your requested task...\n"));
3451
3328
  await handlePostExploreAction(cwd, request);
3452
- await showMainMenu();
3329
+ return;
3330
+ }
3331
+ if (options.agentMode) {
3332
+ console.log(chalk6.dim("Tell me the next thing you want to do.\n"));
3453
3333
  return;
3454
3334
  }
3455
3335
  console.log(chalk6.bold("What would you like to do next?\n"));
@@ -3466,7 +3346,7 @@ async function runExploreFlow(cwd, followUpInput) {
3466
3346
  case "1": {
3467
3347
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3468
3348
  if (description.trim()) {
3469
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3349
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
3470
3350
  await plan2(description, { conversational: true });
3471
3351
  }
3472
3352
  await showMainMenu();
@@ -3711,7 +3591,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3711
3591
  const hintedTask = initialTaskHint?.trim() ?? "";
3712
3592
  if (hintedTask) {
3713
3593
  console.log(chalk6.dim("Using your request above as the first task.\n"));
3714
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3594
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
3715
3595
  await plan2(hintedTask, { conversational: true });
3716
3596
  return;
3717
3597
  }
@@ -3736,7 +3616,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3736
3616
  description = continueAnswer.trim();
3737
3617
  }
3738
3618
  if (description.trim()) {
3739
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3619
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
3740
3620
  await plan2(description, { conversational: true });
3741
3621
  }
3742
3622
  }
@@ -3813,122 +3693,6 @@ function inferLanguageFromProjectFiles(cwd) {
3813
3693
  }
3814
3694
  return best?.language;
3815
3695
  }
3816
- async function quickStart(cwd) {
3817
- const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
3818
- const progressPath = join6(cwd, "progress.txt");
3819
- if (!existsSync6(progressPath)) {
3820
- const { writeFileSync: writeFileSync2 } = await import("fs");
3821
- writeFileSync2(progressPath, `# ArchonDev Progress Log
3822
-
3823
- This file tracks learnings and decisions across sessions.
3824
-
3825
- ## ${today} - Project Initialized (Quick Start)
3826
-
3827
- ### What was done
3828
- - Created ARCHITECTURE.md with default template
3829
- - Initialized .archon directory
3830
- - Created this progress.txt
3831
-
3832
- ### Next Steps
3833
- 1. Customize ARCHITECTURE.md for your project
3834
- 2. Run \`archon plan "your first task"\` to create an atom
3835
- `);
3836
- }
3837
- console.log(chalk6.green("\u2713 Ready to go!\n"));
3838
- await showMainMenu();
3839
- }
3840
- async function handleAdaptExisting(cwd, state) {
3841
- if (state.hasArchitecture) {
3842
- console.log(chalk6.bold("Project governance is set up!\n"));
3843
- console.log(chalk6.dim("Type what you want to do, or choose an option below.\n"));
3844
- } else {
3845
- console.log(chalk6.bold("Existing project detected!\n"));
3846
- console.log(chalk6.dim("I can analyze your codebase and adapt the governance files to match your structure."));
3847
- console.log(chalk6.dim("This helps me understand your architecture without changing any code.\n"));
3848
- }
3849
- const response = await promptWithCommands("What would you like to do?", { allowMultiline: true });
3850
- if (response.toLowerCase() === "q" || response.toLowerCase() === "quit") {
3851
- process.exit(0);
3852
- }
3853
- if (!response.trim()) {
3854
- await showAdaptExistingMenu(cwd, state);
3855
- return;
3856
- }
3857
- const intent = detectUserIntent(response);
3858
- if (intent.mode === "explore" && intent.confidence >= 0.7) {
3859
- console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
3860
- await runExploreFlow(cwd, response);
3861
- return;
3862
- }
3863
- if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
3864
- console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3865
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3866
- await plan2(response, { conversational: true });
3867
- return;
3868
- }
3869
- if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
3870
- console.log(chalk6.dim("\n> Let me understand your project better...\n"));
3871
- await runConversationalInterview(cwd, response);
3872
- return;
3873
- }
3874
- if (response.trim()) {
3875
- const handled = await handleFreeformJourneyInput(cwd, response);
3876
- if (handled) {
3877
- return;
3878
- }
3879
- }
3880
- await showAdaptExistingMenu(cwd, state);
3881
- }
3882
- async function showAdaptExistingMenu(cwd, state) {
3883
- console.log();
3884
- console.log(chalk6.bold("What would you like to do?\n"));
3885
- console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut number:\n"));
3886
- console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Analyze project")} \u2014 Scan and summarize the codebase`);
3887
- console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Plan a task")} \u2014 Create an implementation plan for something specific`);
3888
- console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Code review")} \u2014 Review code for issues`);
3889
- if (!state.hasArchitecture) {
3890
- console.log(` ${chalk6.cyan("4")}) ${chalk6.bold("Set up governance")} \u2014 Create ARCHITECTURE.md from your code`);
3891
- }
3892
- console.log(` ${chalk6.cyan("q")}) ${chalk6.dim("Quit")}`);
3893
- console.log(chalk6.dim(' (Type "upgrade" or "help" anytime)'));
3894
- console.log();
3895
- const choice = await promptWithCommands("Enter choice");
3896
- switch (choice.toLowerCase()) {
3897
- case "1":
3898
- await runExploreFlow(cwd);
3899
- break;
3900
- case "2": {
3901
- const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3902
- if (description.trim()) {
3903
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3904
- await plan2(description, { conversational: true });
3905
- }
3906
- break;
3907
- }
3908
- case "3":
3909
- await codeReviewFirst(cwd);
3910
- break;
3911
- case "4":
3912
- if (!state.hasArchitecture) {
3913
- await analyzeAndAdapt(cwd);
3914
- } else {
3915
- console.log(chalk6.yellow("Invalid choice. Please try again."));
3916
- await showAdaptExistingMenu(cwd, state);
3917
- }
3918
- break;
3919
- case "q":
3920
- process.exit(0);
3921
- default:
3922
- if (choice.trim()) {
3923
- const handled = await handleFreeformJourneyInput(cwd, choice);
3924
- if (handled) {
3925
- return;
3926
- }
3927
- }
3928
- console.log(chalk6.yellow("I did not catch that. Try again or describe what you want in plain language."));
3929
- await showAdaptExistingMenu(cwd, state);
3930
- }
3931
- }
3932
3696
  async function analyzeAndAdapt(cwd) {
3933
3697
  console.log(chalk6.blue("\n-- Analyzing Project --\n"));
3934
3698
  const { init: init2 } = await import("./init-FINETS3Q.js");
@@ -3970,59 +3734,64 @@ async function codeReviewFirst(cwd) {
3970
3734
  }
3971
3735
  console.log(chalk6.dim("\nAfter reviewing, you can run ") + chalk6.cyan("archon") + chalk6.dim(" again to set up governance.\n"));
3972
3736
  }
3973
- async function handleContinueSession(cwd, state) {
3974
- console.log(chalk6.bold("Welcome back!\n"));
3975
- if (state.lastProgressEntry) {
3976
- console.log(chalk6.dim("Last activity:"));
3977
- console.log(chalk6.dim(" " + state.lastProgressEntry.split("\n")[0]));
3978
- console.log();
3979
- }
3980
- const handoff = checkForHandoff(cwd);
3981
- if (handoff) {
3982
- console.log(chalk6.yellow("[HANDOFF] Found from last session:\n"));
3983
- console.log(chalk6.dim(handoff.nextSteps));
3984
- console.log();
3985
- const continueHandoff = await promptYesNo("Continue from handoff?", true);
3986
- if (continueHandoff) {
3987
- console.log(chalk6.dim("\nPicking up where you left off...\n"));
3988
- }
3989
- }
3990
- if (state.hasReviewDb) {
3991
- await showReviewProgress(cwd);
3992
- }
3993
- const response = await promptWithCommands("What would you like to do next? (press Enter for options)", { allowMultiline: true });
3994
- if (response.trim()) {
3995
- const handled = await handleFreeformJourneyInput(cwd, response);
3996
- if (handled) {
3997
- await continueConversationLoop(cwd);
3998
- 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();
3999
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"));
4000
3751
  }
4001
- await showMainMenu();
4002
- }
4003
- async function continueConversationLoop(cwd) {
4004
3752
  while (true) {
4005
- const response = await promptWithCommands("Anything else? (press Enter for options)", { allowMultiline: true });
4006
- if (!response.trim()) {
4007
- await showMainMenu();
4008
- return;
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;
4009
3760
  }
4010
- if (isContinuationDirective(response)) {
4011
- await continueWithCurrentTask(cwd);
3761
+ if (trimmed.toLowerCase() === "/workflow") {
3762
+ await showMainMenu();
4012
3763
  continue;
4013
3764
  }
4014
- const handled = await handleFreeformJourneyInput(cwd, response);
3765
+ const handled = await handleAgentConversationInput(cwd, trimmed);
4015
3766
  if (!handled) {
4016
- console.log(chalk6.yellow("I did not catch that. Try describing your goal in one sentence."));
3767
+ console.log(chalk6.yellow("I did not catch that. Describe your goal in one sentence."));
4017
3768
  }
4018
3769
  }
4019
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
+ }
4020
3789
  function isContinuationDirective(input) {
4021
3790
  const normalized = input.trim().toLowerCase();
4022
3791
  return normalized === "continue" || normalized === "continue." || normalized === "go on" || normalized === "go ahead" || normalized === "next" || normalized === "proceed" || normalized === "do it";
4023
3792
  }
4024
3793
  async function continueWithCurrentTask(cwd) {
4025
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-3UKVNQDT.js");
3794
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-W4WQY7BR.js");
4026
3795
  const atoms = await listLocalAtoms2();
4027
3796
  const pending = atoms.filter((a) => a.status === "READY" || a.status === "IN_PROGRESS").sort((a, b) => a.externalId.localeCompare(b.externalId));
4028
3797
  if (pending.length === 0) {
@@ -4037,34 +3806,9 @@ async function continueWithCurrentTask(cwd) {
4037
3806
  console.log(chalk6.dim(`
4038
3807
  Continuing with ${nextAtom.externalId}...
4039
3808
  `));
4040
- const { execute: execute2 } = await import("./execute-LJNJEXWD.js");
3809
+ const { execute: execute2 } = await import("./execute-3IUO33KY.js");
4041
3810
  await execute2(nextAtom.externalId, {});
4042
3811
  }
4043
- function checkForHandoff(cwd) {
4044
- try {
4045
- const currentContextPath = join6(cwd, ".archon", "current_context.md");
4046
- if (existsSync6(currentContextPath)) {
4047
- const content2 = readFileSync3(currentContextPath, "utf-8");
4048
- const nextStepsMatch = content2.match(/## Next Actions[^\n]*\n([\s\S]*?)(?=\n## |\n*$)/);
4049
- if (nextStepsMatch && nextStepsMatch[1]) {
4050
- return { nextSteps: nextStepsMatch[1].trim() };
4051
- }
4052
- }
4053
- const progressPath = join6(cwd, "progress.txt");
4054
- if (!existsSync6(progressPath)) return null;
4055
- const content = readFileSync3(progressPath, "utf-8");
4056
- const handoffMatch = content.match(/## Context Handoff[^\n]*\n([\s\S]*?)(?=\n## |\n*$)/);
4057
- if (handoffMatch && handoffMatch[1]) {
4058
- const handoffContent = handoffMatch[1];
4059
- const nextStepsMatch = handoffContent.match(/### Next Steps[^\n]*\n([\s\S]*?)(?=\n### |$)/);
4060
- if (nextStepsMatch && nextStepsMatch[1]) {
4061
- return { nextSteps: nextStepsMatch[1].trim() };
4062
- }
4063
- }
4064
- } catch {
4065
- }
4066
- return null;
4067
- }
4068
3812
  async function showMainMenu() {
4069
3813
  const cwd = process.cwd();
4070
3814
  while (true) {
@@ -4130,7 +3874,7 @@ async function handleFreeformJourneyInput(cwd, input) {
4130
3874
  const state = detectProjectState(cwd);
4131
3875
  if (state.hasArchitecture) {
4132
3876
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
4133
- const { plan: plan3 } = await import("./plan-3UKVNQDT.js");
3877
+ const { plan: plan3 } = await import("./plan-W4WQY7BR.js");
4134
3878
  await plan3(freeform, { conversational: true });
4135
3879
  return true;
4136
3880
  }
@@ -4139,7 +3883,7 @@ async function handleFreeformJourneyInput(cwd, input) {
4139
3883
  return true;
4140
3884
  }
4141
3885
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
4142
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3886
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
4143
3887
  await plan2(freeform, { conversational: true });
4144
3888
  return true;
4145
3889
  }
@@ -4189,40 +3933,22 @@ async function handlePostExploreAction(cwd, request) {
4189
3933
  } else {
4190
3934
  console.log(chalk6.dim("> Got it! Creating a task for this...\n"));
4191
3935
  }
4192
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3936
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
4193
3937
  await plan2(request, { conversational: true });
4194
3938
  }
4195
- async function showReviewProgress(cwd) {
4196
- try {
4197
- const { ReviewDatabase } = await import("./code-review-GJVBZPZA.js");
4198
- const db = new ReviewDatabase(cwd);
4199
- db.open();
4200
- const stats = db.getStats();
4201
- db.close();
4202
- const total = stats.total;
4203
- const completed = stats.completed;
4204
- const pending = stats.pending + stats.inReview;
4205
- const needsFix = stats.needsFix;
4206
- console.log(
4207
- chalk6.blue("Review Progress:") + chalk6.dim(` ${completed}/${total} completed`) + (needsFix > 0 ? chalk6.red(` (${needsFix} need fixes)`) : "") + (pending > 0 ? chalk6.yellow(` (${pending} pending)`) : "")
4208
- );
4209
- console.log();
4210
- } catch {
4211
- }
4212
- }
4213
3939
  async function planTask() {
4214
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
3940
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
4215
3941
  const description = await promptWithCommands("Describe what you want to build", { allowMultiline: true });
4216
3942
  if (description.trim()) {
4217
3943
  await plan2(description, { conversational: true });
4218
3944
  }
4219
3945
  }
4220
3946
  async function listAtoms() {
4221
- const { list: list2 } = await import("./list-53NTME4Q.js");
3947
+ const { list: list2 } = await import("./list-P5H2N6WT.js");
4222
3948
  await list2({});
4223
3949
  }
4224
3950
  async function executeNext() {
4225
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-3UKVNQDT.js");
3951
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-W4WQY7BR.js");
4226
3952
  const { analyzeProject, getComplexityDescription, getModeDescription } = await import("./orchestration-HIF3KP25.js");
4227
3953
  const { loadExecutionPreferences } = await import("./preferences-4V4C7MVD.js");
4228
3954
  const cwd = process.cwd();
@@ -4293,11 +4019,11 @@ async function executeNext() {
4293
4019
  }
4294
4020
  }
4295
4021
  if (selectedMode === "parallel-cloud") {
4296
- const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-3JTGAHOS.js");
4022
+ const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-DBPSYNE4.js");
4297
4023
  await parallelExecuteCloud2(runIds);
4298
4024
  return;
4299
4025
  }
4300
- const { parallelExecute } = await import("./parallel-3JTGAHOS.js");
4026
+ const { parallelExecute } = await import("./parallel-DBPSYNE4.js");
4301
4027
  await parallelExecute(runIds);
4302
4028
  return;
4303
4029
  }
@@ -4305,7 +4031,7 @@ async function executeNext() {
4305
4031
  const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
4306
4032
  const targetId = atomId.trim() || pendingAtoms[0]?.id;
4307
4033
  if (targetId) {
4308
- const { execute: execute2 } = await import("./execute-LJNJEXWD.js");
4034
+ const { execute: execute2 } = await import("./execute-3IUO33KY.js");
4309
4035
  await execute2(targetId, {});
4310
4036
  } else {
4311
4037
  console.log(chalk6.yellow("No atom to execute."));
@@ -4413,6 +4139,7 @@ async function handleInSessionCommand(input) {
4413
4139
  console.log(chalk6.dim(" upgrade \u2014 Switch to BYOK or Managed plan"));
4414
4140
  console.log(chalk6.dim(" status \u2014 Show login and tier status"));
4415
4141
  console.log(chalk6.dim(" keys \u2014 Manage API keys (BYOK tier)"));
4142
+ console.log(chalk6.dim(" /workflow \u2014 Open classic workflow menu"));
4416
4143
  console.log(chalk6.dim(" quit / q \u2014 Exit ArchonDev"));
4417
4144
  console.log(chalk6.dim(" skip \u2014 Skip current question"));
4418
4145
  console.log();
@@ -4439,6 +4166,7 @@ function showSlashCommandMenu() {
4439
4166
  console.log(chalk6.dim(" /status Show account/status"));
4440
4167
  console.log(chalk6.dim(" /settings Open settings & preferences"));
4441
4168
  console.log(chalk6.dim(" /upgrade Open tier upgrade menu"));
4169
+ console.log(chalk6.dim(" /workflow Open classic workflow menu"));
4442
4170
  console.log(chalk6.dim(" /quit Exit ArchonDev"));
4443
4171
  console.log();
4444
4172
  }
@@ -4452,7 +4180,7 @@ async function handleSlashCommand(input) {
4452
4180
  const arg = parts.slice(1).join(" ").trim();
4453
4181
  switch (command) {
4454
4182
  case "/plan": {
4455
- const { plan: plan2 } = await import("./plan-3UKVNQDT.js");
4183
+ const { plan: plan2 } = await import("./plan-W4WQY7BR.js");
4456
4184
  if (arg) {
4457
4185
  await plan2(arg, { conversational: true });
4458
4186
  } else {
@@ -4483,6 +4211,9 @@ async function handleSlashCommand(input) {
4483
4211
  await showUpgradeMenu();
4484
4212
  return true;
4485
4213
  }
4214
+ case "/workflow":
4215
+ await showMainMenu();
4216
+ return true;
4486
4217
  case "/quit":
4487
4218
  case "/exit":
4488
4219
  console.log(chalk6.dim("Goodbye!"));
@@ -4528,9 +4259,10 @@ function promptMultiline(question) {
4528
4259
  });
4529
4260
  }
4530
4261
  async function promptWithCommands(question, options = {}) {
4262
+ const useMultiline = Boolean(options.allowMultiline && !isTerminalSafeMode());
4531
4263
  while (true) {
4532
- const answer = options.allowMultiline ? await promptMultiline(question) : await prompt(question);
4533
- if (options.allowMultiline && answer.includes("\n")) {
4264
+ const answer = useMultiline ? await promptMultiline(question) : await prompt(question);
4265
+ if (useMultiline && answer.includes("\n")) {
4534
4266
  return answer;
4535
4267
  }
4536
4268
  const handled = await handleInSessionCommand(answer);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  list
3
- } from "./chunk-GU7OQ5EV.js";
4
- import "./chunk-VUT5XLKM.js";
3
+ } from "./chunk-6KE53F2W.js";
4
+ import "./chunk-PSUBO3TR.js";
5
5
  import "./chunk-PCTP3LKJ.js";
6
6
  import "./chunk-PJRQI5UN.js";
7
7
  import "./chunk-EIEU3IIY.js";
@@ -6,9 +6,9 @@ import {
6
6
  parallelRunWaves,
7
7
  parallelSchedule,
8
8
  parallelStatus
9
- } from "./chunk-BUFMPKXX.js";
9
+ } from "./chunk-RWNRCLN5.js";
10
10
  import "./chunk-EBHHIUCB.js";
11
- import "./chunk-VUT5XLKM.js";
11
+ import "./chunk-PSUBO3TR.js";
12
12
  import "./chunk-PCTP3LKJ.js";
13
13
  import "./chunk-PJRQI5UN.js";
14
14
  import "./chunk-EIEU3IIY.js";
@@ -3,7 +3,7 @@ import {
3
3
  loadAtom,
4
4
  parseAtomDescription,
5
5
  plan
6
- } from "./chunk-VUT5XLKM.js";
6
+ } from "./chunk-PSUBO3TR.js";
7
7
  import "./chunk-PCTP3LKJ.js";
8
8
  import "./chunk-PJRQI5UN.js";
9
9
  import "./chunk-EIEU3IIY.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archondev",
3
- "version": "2.19.17",
3
+ "version": "2.19.20",
4
4
  "description": "Local-first AI-powered development governance system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {