archondev 2.19.4 → 2.19.5

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 CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  showExecutionPreferences,
29
29
  showPreferences,
30
30
  showUsageDetails
31
- } from "./chunk-K3XN7PN6.js";
31
+ } from "./chunk-KETUHDUE.js";
32
32
  import {
33
33
  a11yBadge,
34
34
  a11yCheck,
@@ -47,13 +47,13 @@ import {
47
47
  parallelRunWaves,
48
48
  parallelSchedule,
49
49
  parallelStatus
50
- } from "./chunk-3UOMLERV.js";
50
+ } from "./chunk-KDWIKBM2.js";
51
51
  import {
52
52
  DependencyParser,
53
53
  EnvironmentConfigLoader,
54
54
  EnvironmentValidator,
55
55
  execute
56
- } from "./chunk-HQBF3VTN.js";
56
+ } from "./chunk-X5ZZCJBQ.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-C4HVI2NJ.js";
64
+ } from "./chunk-W6TYXCZA.js";
65
65
  import {
66
66
  listLocalAtoms,
67
67
  loadAtom,
68
68
  plan
69
- } from "./chunk-IKMCIWK3.js";
69
+ } from "./chunk-OTODLPY4.js";
70
70
  import "./chunk-PCTP3LKJ.js";
71
71
  import "./chunk-PJRQI5UN.js";
72
72
  import {
@@ -2777,6 +2777,7 @@ async function start(options = {}) {
2777
2777
  console.log(chalk6.dim(" \u2022 ") + chalk6.bold("BYOK (FREE)") + chalk6.dim(" - Unlimited usage with your own API keys"));
2778
2778
  console.log(chalk6.dim(" \u2022 ") + chalk6.bold("Managed Plan") + chalk6.dim(" - Just 10% fee on AI costs, zero setup"));
2779
2779
  console.log(chalk6.cyan("\u2192 Run ") + chalk6.bold("'archon upgrade'") + chalk6.cyan(" to unlock unlimited access"));
2780
+ console.log(chalk6.dim("\u2192 Model preferences: archon preferences"));
2780
2781
  }
2781
2782
  if (currentTier === "CREDITS" && config.accessToken) {
2782
2783
  try {
@@ -2832,7 +2833,13 @@ async function start(options = {}) {
2832
2833
  } else {
2833
2834
  console.log(chalk6.dim(`Add credits: archon credits add`));
2834
2835
  }
2835
- console.log(chalk6.dim(`View details: archon credits | Switch tier: archon upgrade`));
2836
+ console.log(chalk6.dim(`View details: archon credits | Switch tier: archon upgrade | Models: archon preferences`));
2837
+ if (usageStats.balance <= 0) {
2838
+ const topUpNow = await promptYesNo("Balance is $0. Add credits now?", true);
2839
+ if (topUpNow) {
2840
+ await handleTierSetup("CREDITS");
2841
+ }
2842
+ }
2836
2843
  }
2837
2844
  } catch {
2838
2845
  }
@@ -3185,7 +3192,7 @@ async function handleNewProject(cwd, _state) {
3185
3192
  }
3186
3193
  if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
3187
3194
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3188
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3195
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3189
3196
  await plan2(initialResponse, {});
3190
3197
  return;
3191
3198
  }
@@ -3196,32 +3203,42 @@ async function handleNewProject(cwd, _state) {
3196
3203
  }
3197
3204
  if (needsClarification(intent)) {
3198
3205
  console.log();
3199
- console.log(chalk6.dim("I'm not sure what you're looking for. Are you..."));
3206
+ console.log(chalk6.dim("I'm not sure yet. You can tell me in plain language, or use shortcuts:"));
3200
3207
  console.log();
3201
- console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Building something new")} \u2014 a complete app, system, or project`);
3202
- console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Doing a specific task")} \u2014 fix, add, refactor, analyze`);
3203
- console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Just exploring")} \u2014 show me what ArchonDev can do`);
3208
+ console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Build something new")}`);
3209
+ console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Do a specific task")}`);
3210
+ console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Explore project/status")}`);
3204
3211
  console.log();
3205
- const clarification = await promptWithCommands("Enter choice (1-3)");
3206
- switch (clarification.trim()) {
3207
- case "1":
3208
- await runConversationalInterview(cwd, initialResponse);
3209
- break;
3210
- case "2":
3211
- console.log(chalk6.dim("\n> Creating a task for this...\n"));
3212
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3213
- await plan2(initialResponse, {});
3214
- break;
3215
- case "3":
3216
- default:
3217
- await showNewProjectMenu(cwd);
3212
+ const clarification = await promptWithCommands("What are you trying to do?", { allowMultiline: true });
3213
+ const trimmed = clarification.trim();
3214
+ if (trimmed === "1") {
3215
+ await runConversationalInterview(cwd, initialResponse);
3216
+ return;
3217
+ }
3218
+ if (trimmed === "2") {
3219
+ console.log(chalk6.dim("\n> Creating a task for this...\n"));
3220
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3221
+ await plan2(initialResponse, {});
3222
+ return;
3223
+ }
3224
+ if (trimmed === "3") {
3225
+ await showNewProjectMenu(cwd);
3226
+ return;
3227
+ }
3228
+ if (trimmed) {
3229
+ const handled = await handleFreeformJourneyInput(cwd, trimmed);
3230
+ if (handled) {
3231
+ return;
3232
+ }
3218
3233
  }
3234
+ await showNewProjectMenu(cwd);
3219
3235
  return;
3220
3236
  }
3221
3237
  await runConversationalInterview(cwd, initialResponse);
3222
3238
  }
3223
3239
  async function showNewProjectMenu(cwd) {
3224
3240
  console.log(chalk6.bold("What would you like to do?\n"));
3241
+ console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut number:\n"));
3225
3242
  console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Start interview")} \u2014 I'll ask questions to understand your project`);
3226
3243
  console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Quick start")} \u2014 Just create basic governance files`);
3227
3244
  console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Plan a task")} \u2014 Create an atom for a specific task`);
@@ -3239,7 +3256,7 @@ async function showNewProjectMenu(cwd) {
3239
3256
  case "3": {
3240
3257
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3241
3258
  if (description.trim()) {
3242
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3259
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3243
3260
  await plan2(description, {});
3244
3261
  }
3245
3262
  break;
@@ -3247,7 +3264,13 @@ async function showNewProjectMenu(cwd) {
3247
3264
  case "q":
3248
3265
  process.exit(0);
3249
3266
  default:
3250
- console.log(chalk6.yellow("Invalid choice. Please try again."));
3267
+ if (choice.trim()) {
3268
+ const handled = await handleFreeformJourneyInput(cwd, choice);
3269
+ if (handled) {
3270
+ return;
3271
+ }
3272
+ }
3273
+ console.log(chalk6.yellow("I did not catch that. Try again or describe what you want in plain language."));
3251
3274
  await showNewProjectMenu(cwd);
3252
3275
  }
3253
3276
  }
@@ -3293,6 +3316,7 @@ async function runExploreFlow(cwd) {
3293
3316
  console.log();
3294
3317
  console.log(chalk6.green("\u2713 Analysis complete! I'm ready to work on this project.\n"));
3295
3318
  console.log(chalk6.bold("What would you like to do next?\n"));
3319
+ console.log(chalk6.dim("You can describe it naturally, or use shortcuts:\n"));
3296
3320
  console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Plan a task")} \u2014 Tell me what to implement, fix, or change`);
3297
3321
  console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Review code")} \u2014 Run AI-powered code review`);
3298
3322
  if (!projectInfo.hasArchitecture) {
@@ -3305,7 +3329,7 @@ async function runExploreFlow(cwd) {
3305
3329
  case "1": {
3306
3330
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3307
3331
  if (description.trim()) {
3308
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3332
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3309
3333
  await plan2(description, {});
3310
3334
  }
3311
3335
  break;
@@ -3320,6 +3344,15 @@ async function runExploreFlow(cwd) {
3320
3344
  break;
3321
3345
  case "q":
3322
3346
  process.exit(0);
3347
+ default:
3348
+ if (choice.trim()) {
3349
+ const handled = await handleFreeformJourneyInput(cwd, choice);
3350
+ if (handled) {
3351
+ return;
3352
+ }
3353
+ }
3354
+ console.log(chalk6.yellow("I did not catch that. Tell me what you want to do next."));
3355
+ await showMainMenu();
3323
3356
  }
3324
3357
  }
3325
3358
  async function gatherProjectInfo(cwd) {
@@ -3567,7 +3600,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3567
3600
  if (continueChoice) {
3568
3601
  const description = await promptWithCommands("Describe what you want to build first", { allowMultiline: true });
3569
3602
  if (description.trim()) {
3570
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3603
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3571
3604
  await plan2(description, {});
3572
3605
  }
3573
3606
  }
@@ -3621,7 +3654,7 @@ async function handleAdaptExisting(cwd, state) {
3621
3654
  }
3622
3655
  if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
3623
3656
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3624
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3657
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3625
3658
  await plan2(response, {});
3626
3659
  return;
3627
3660
  }
@@ -3630,11 +3663,18 @@ async function handleAdaptExisting(cwd, state) {
3630
3663
  await runConversationalInterview(cwd, response);
3631
3664
  return;
3632
3665
  }
3666
+ if (response.trim()) {
3667
+ const handled = await handleFreeformJourneyInput(cwd, response);
3668
+ if (handled) {
3669
+ return;
3670
+ }
3671
+ }
3633
3672
  await showAdaptExistingMenu(cwd, state);
3634
3673
  }
3635
3674
  async function showAdaptExistingMenu(cwd, state) {
3636
3675
  console.log();
3637
3676
  console.log(chalk6.bold("What would you like to do?\n"));
3677
+ console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut number:\n"));
3638
3678
  console.log(` ${chalk6.cyan("1")}) ${chalk6.bold("Analyze project")} \u2014 Scan and summarize the codebase`);
3639
3679
  console.log(` ${chalk6.cyan("2")}) ${chalk6.bold("Plan a task")} \u2014 Create an implementation plan for something specific`);
3640
3680
  console.log(` ${chalk6.cyan("3")}) ${chalk6.bold("Code review")} \u2014 Review code for issues`);
@@ -3652,7 +3692,7 @@ async function showAdaptExistingMenu(cwd, state) {
3652
3692
  case "2": {
3653
3693
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3654
3694
  if (description.trim()) {
3655
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3695
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3656
3696
  await plan2(description, {});
3657
3697
  }
3658
3698
  break;
@@ -3671,7 +3711,13 @@ async function showAdaptExistingMenu(cwd, state) {
3671
3711
  case "q":
3672
3712
  process.exit(0);
3673
3713
  default:
3674
- console.log(chalk6.yellow("Invalid choice. Please try again."));
3714
+ if (choice.trim()) {
3715
+ const handled = await handleFreeformJourneyInput(cwd, choice);
3716
+ if (handled) {
3717
+ return;
3718
+ }
3719
+ }
3720
+ console.log(chalk6.yellow("I did not catch that. Try again or describe what you want in plain language."));
3675
3721
  await showAdaptExistingMenu(cwd, state);
3676
3722
  }
3677
3723
  }
@@ -3736,6 +3782,13 @@ async function handleContinueSession(cwd, state) {
3736
3782
  if (state.hasReviewDb) {
3737
3783
  await showReviewProgress(cwd);
3738
3784
  }
3785
+ const response = await promptWithCommands("What would you like to do next? (press Enter for options)", { allowMultiline: true });
3786
+ if (response.trim()) {
3787
+ const handled = await handleFreeformJourneyInput(cwd, response);
3788
+ if (handled) {
3789
+ return;
3790
+ }
3791
+ }
3739
3792
  await showMainMenu();
3740
3793
  }
3741
3794
  function checkForHandoff(cwd) {
@@ -3800,31 +3853,40 @@ async function showMainMenu() {
3800
3853
  }
3801
3854
  console.log(chalk6.dim(' (Type "upgrade" or "help" anytime)'));
3802
3855
  console.log();
3803
- const selected = await promptWithCommands("Enter choice", { allowMultiline: true });
3856
+ const selected = await promptWithCommands("Tell me what you want to do (or enter a shortcut)", { allowMultiline: true });
3804
3857
  const choice = choices.find((c) => c.key === selected.toLowerCase());
3805
3858
  if (choice) {
3806
3859
  await choice.action();
3807
3860
  } else if (selected.trim()) {
3808
- const freeform = selected.trim();
3809
- const intent = detectUserIntent(freeform);
3810
- if (intent.mode === "explore" && intent.confidence >= 0.7) {
3811
- console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
3812
- await runExploreFlow(cwd);
3813
- return;
3814
- }
3815
- if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
3816
- console.log(chalk6.dim("\n> Let me understand your project better...\n"));
3817
- await runConversationalInterview(cwd, freeform);
3818
- return;
3861
+ const handled = await handleFreeformJourneyInput(cwd, selected.trim());
3862
+ if (!handled) {
3863
+ console.log(chalk6.yellow("I did not catch that. Try describing your goal in one sentence."));
3864
+ await showMainMenu();
3819
3865
  }
3820
- console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3821
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3822
- await plan2(freeform, {});
3823
3866
  } else {
3824
3867
  console.log(chalk6.yellow("Invalid choice. Please try again."));
3825
3868
  await showMainMenu();
3826
3869
  }
3827
3870
  }
3871
+ async function handleFreeformJourneyInput(cwd, input) {
3872
+ const freeform = input.trim();
3873
+ if (!freeform) return false;
3874
+ const intent = detectUserIntent(freeform);
3875
+ if (intent.mode === "explore" && intent.confidence >= 0.7) {
3876
+ console.log(chalk6.dim("\n> Got it! Analyzing the project...\n"));
3877
+ await runExploreFlow(cwd);
3878
+ return true;
3879
+ }
3880
+ if (intent.mode === "app_builder" && intent.confidence >= 0.7) {
3881
+ console.log(chalk6.dim("\n> Let me understand your project better...\n"));
3882
+ await runConversationalInterview(cwd, freeform);
3883
+ return true;
3884
+ }
3885
+ console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3886
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3887
+ await plan2(freeform, {});
3888
+ return true;
3889
+ }
3828
3890
  async function showReviewProgress(cwd) {
3829
3891
  try {
3830
3892
  const { ReviewDatabase } = await import("./code-review-GJVBZPZA.js");
@@ -3844,20 +3906,20 @@ async function showReviewProgress(cwd) {
3844
3906
  }
3845
3907
  }
3846
3908
  async function planTask() {
3847
- const { plan: plan2 } = await import("./plan-7M27X3OD.js");
3909
+ const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3848
3910
  const description = await promptWithCommands("Describe what you want to build", { allowMultiline: true });
3849
3911
  if (description.trim()) {
3850
3912
  await plan2(description, {});
3851
3913
  }
3852
3914
  }
3853
3915
  async function listAtoms() {
3854
- const { list: list2 } = await import("./list-Q4HLHQJI.js");
3916
+ const { list: list2 } = await import("./list-SKRHIZ5T.js");
3855
3917
  await list2({});
3856
3918
  }
3857
3919
  async function executeNext() {
3858
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-7M27X3OD.js");
3920
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-7SCZH7EA.js");
3859
3921
  const { analyzeProject, getComplexityDescription, getModeDescription } = await import("./orchestration-HIF3KP25.js");
3860
- const { loadExecutionPreferences } = await import("./preferences-SFXRVXT3.js");
3922
+ const { loadExecutionPreferences } = await import("./preferences-YOSAIHGM.js");
3861
3923
  const cwd = process.cwd();
3862
3924
  const atoms = await listLocalAtoms2();
3863
3925
  const pendingAtoms = atoms.filter((a) => a.status === "READY" || a.status === "IN_PROGRESS");
@@ -3926,11 +3988,11 @@ async function executeNext() {
3926
3988
  }
3927
3989
  }
3928
3990
  if (selectedMode === "parallel-cloud") {
3929
- const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-QLKYSZZ3.js");
3991
+ const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-KRBYFJ4O.js");
3930
3992
  await parallelExecuteCloud2(runIds);
3931
3993
  return;
3932
3994
  }
3933
- const { parallelExecute } = await import("./parallel-QLKYSZZ3.js");
3995
+ const { parallelExecute } = await import("./parallel-KRBYFJ4O.js");
3934
3996
  await parallelExecute(runIds);
3935
3997
  return;
3936
3998
  }
@@ -3938,7 +4000,7 @@ async function executeNext() {
3938
4000
  const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
3939
4001
  const targetId = atomId.trim() || pendingAtoms[0]?.id;
3940
4002
  if (targetId) {
3941
- const { execute: execute2 } = await import("./execute-JAHXFYXL.js");
4003
+ const { execute: execute2 } = await import("./execute-DBNVIJ3P.js");
3942
4004
  await execute2(targetId, {});
3943
4005
  } else {
3944
4006
  console.log(chalk6.yellow("No atom to execute."));
@@ -3956,7 +4018,7 @@ async function viewStatus() {
3956
4018
  await status2();
3957
4019
  }
3958
4020
  async function settingsMenu() {
3959
- const { interactiveSettings } = await import("./preferences-SFXRVXT3.js");
4021
+ const { interactiveSettings } = await import("./preferences-YOSAIHGM.js");
3960
4022
  await interactiveSettings();
3961
4023
  await showMainMenu();
3962
4024
  }
@@ -3970,6 +4032,7 @@ async function reviewCode() {
3970
4032
  console.log();
3971
4033
  }
3972
4034
  console.log(chalk6.bold("\nCode Review Options:\n"));
4035
+ console.log(chalk6.dim("You can type naturally (recommended) or use a shortcut:\n"));
3973
4036
  console.log(` ${chalk6.cyan("1")}) Analyze project`);
3974
4037
  console.log(` ${chalk6.cyan("2")}) Show review status`);
3975
4038
  console.log(` ${chalk6.cyan("3")}) Review next file`);
@@ -3977,8 +4040,9 @@ async function reviewCode() {
3977
4040
  console.log(` ${chalk6.cyan("5")}) Run AI review on all pending`);
3978
4041
  console.log(` ${chalk6.cyan("b")}) Back to main menu`);
3979
4042
  console.log();
3980
- const choice = await prompt("Enter choice");
3981
- switch (choice.toLowerCase()) {
4043
+ const raw = await promptWithCommands("What do you want to do?", { allowMultiline: true });
4044
+ const choice = resolveReviewChoice(raw);
4045
+ switch (choice) {
3982
4046
  case "1": {
3983
4047
  const { reviewAnalyze: reviewAnalyze2 } = await import("./review-BXESOS5R.js");
3984
4048
  await reviewAnalyze2();
@@ -4008,7 +4072,13 @@ async function reviewCode() {
4008
4072
  await showMainMenu();
4009
4073
  return;
4010
4074
  default:
4011
- console.log(chalk6.yellow("Invalid choice."));
4075
+ if (raw.trim()) {
4076
+ const handled = await handleFreeformJourneyInput(cwd, raw.trim());
4077
+ if (handled) {
4078
+ return;
4079
+ }
4080
+ }
4081
+ console.log(chalk6.yellow("I did not catch that. Tell me what review action you want."));
4012
4082
  }
4013
4083
  await reviewCode();
4014
4084
  }
@@ -4123,8 +4193,9 @@ async function showWebChecksMenu() {
4123
4193
  console.log(` ${chalk6.cyan("7")}) Set prompt mode (ask/always/never)`);
4124
4194
  console.log(` ${chalk6.cyan("b")}) Back to main menu`);
4125
4195
  console.log();
4126
- const choice = await promptWithCommands("Enter choice");
4127
- switch (choice.toLowerCase()) {
4196
+ const raw = await promptWithCommands("What do you want to do?", { allowMultiline: true });
4197
+ const choice = resolveWebChecksChoice(raw);
4198
+ switch (choice) {
4128
4199
  case "1":
4129
4200
  await runWebChecksSuite();
4130
4201
  break;
@@ -4159,14 +4230,21 @@ async function showWebChecksMenu() {
4159
4230
  console.log(` ${chalk6.cyan("2")}) Always run automatically`);
4160
4231
  console.log(` ${chalk6.cyan("3")}) Never prompt`);
4161
4232
  console.log();
4162
- const modeChoice = await promptWithCommands("Select prompt mode");
4233
+ const modeChoiceRaw = await promptWithCommands("Set mode (ask / always / never)");
4234
+ const modeChoice = resolvePromptModeChoice(modeChoiceRaw);
4163
4235
  if (modeChoice === "1") await setWebPromptMode(cwd, "ask");
4164
4236
  if (modeChoice === "2") await setWebPromptMode(cwd, "always");
4165
4237
  if (modeChoice === "3") await setWebPromptMode(cwd, "never");
4166
4238
  break;
4167
4239
  }
4168
4240
  default:
4169
- break;
4241
+ if (raw.trim()) {
4242
+ const handled = await handleFreeformJourneyInput(cwd, raw.trim());
4243
+ if (handled) {
4244
+ return;
4245
+ }
4246
+ }
4247
+ console.log(chalk6.yellow("I did not catch that. Tell me which web check you want."));
4170
4248
  }
4171
4249
  if (choice.toLowerCase() !== "b") {
4172
4250
  await showWebChecksMenu();
@@ -4228,10 +4306,24 @@ function promptChoice(question, options, defaultKey) {
4228
4306
  input: process.stdin,
4229
4307
  output: process.stdout
4230
4308
  });
4231
- rl.question(` ${chalk6.dim("Enter choice")}: `, (answer) => {
4309
+ rl.question(` ${chalk6.dim("Enter choice or describe what you want")}: `, (answer) => {
4232
4310
  rl.close();
4233
4311
  const trimmed = answer.trim();
4234
4312
  if (trimmed) {
4313
+ const direct = options.find((opt) => opt.key.toLowerCase() === trimmed.toLowerCase());
4314
+ if (direct) {
4315
+ resolve(direct.key);
4316
+ return;
4317
+ }
4318
+ const normalized = trimmed.toLowerCase();
4319
+ const keywordMatch = options.find((opt) => {
4320
+ const labelWords = opt.label.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
4321
+ return labelWords.some((w) => w.length > 3 && normalized.includes(w));
4322
+ });
4323
+ if (keywordMatch) {
4324
+ resolve(keywordMatch.key);
4325
+ return;
4326
+ }
4235
4327
  resolve(trimmed);
4236
4328
  return;
4237
4329
  }
@@ -4243,11 +4335,44 @@ function promptChoice(question, options, defaultKey) {
4243
4335
  });
4244
4336
  });
4245
4337
  }
4338
+ function resolveReviewChoice(input) {
4339
+ const normalized = input.trim().toLowerCase();
4340
+ if (!normalized) return "";
4341
+ if (normalized === "1" || normalized.includes("analy")) return "1";
4342
+ if (normalized === "2" || normalized.includes("status")) return "2";
4343
+ if (normalized === "3" || normalized.includes("next")) return "3";
4344
+ if (normalized === "4" || normalized.includes("list")) return "4";
4345
+ if (normalized === "5" || normalized.includes("run") || normalized.includes("all pending")) return "5";
4346
+ if (normalized === "b" || normalized.includes("back")) return "b";
4347
+ return normalized;
4348
+ }
4349
+ function resolveWebChecksChoice(input) {
4350
+ const normalized = input.trim().toLowerCase();
4351
+ if (!normalized) return "";
4352
+ if (normalized === "1" || normalized.includes("all") && normalized.includes("check")) return "1";
4353
+ if (normalized === "2" || normalized.includes("access") || normalized.includes("a11y")) return "2";
4354
+ if (normalized === "3" || normalized.includes("seo")) return "3";
4355
+ if (normalized === "4" || normalized.includes("geo") && normalized.includes("audit")) return "4";
4356
+ if (normalized === "5" || normalized.includes("geo") && normalized.includes("identity")) return "5";
4357
+ if (normalized === "6" || normalized.includes("geo") && normalized.includes("schema")) return "6";
4358
+ if (normalized === "7" || normalized.includes("prompt mode") || normalized.includes("mode")) return "7";
4359
+ if (normalized === "b" || normalized.includes("back")) return "b";
4360
+ return normalized;
4361
+ }
4362
+ function resolvePromptModeChoice(input) {
4363
+ const normalized = input.trim().toLowerCase();
4364
+ if (!normalized) return "";
4365
+ if (normalized === "1" || normalized.includes("ask")) return "1";
4366
+ if (normalized === "2" || normalized.includes("always")) return "2";
4367
+ if (normalized === "3" || normalized.includes("never")) return "3";
4368
+ return normalized;
4369
+ }
4246
4370
 
4247
4371
  // src/cli/credits.ts
4248
4372
  import chalk7 from "chalk";
4249
4373
  import ora from "ora";
4250
4374
  import open from "open";
4375
+ import readline2 from "readline";
4251
4376
  function getSupabaseClient(accessToken) {
4252
4377
  return createAuthedSupabaseClient(SUPABASE_URL, SUPABASE_ANON_KEY, accessToken);
4253
4378
  }
@@ -4277,12 +4402,21 @@ async function showCredits() {
4277
4402
  console.log(` Atoms: ${profile.atoms_used_this_month}/10,000 this month`);
4278
4403
  console.log();
4279
4404
  console.log(chalk7.dim(" Upgrade to Credits tier: archon credits add"));
4405
+ printCreditsNextAction("FREE");
4280
4406
  } else if (profile.tier === "CREDITS") {
4281
4407
  console.log();
4282
4408
  console.log(chalk7.dim(" Add more credits: archon credits add"));
4409
+ printCreditsNextAction("CREDITS");
4410
+ if (balance < 5) {
4411
+ const addNow = await promptYesNo2("Balance is low. Add credits now?", false);
4412
+ if (addNow) {
4413
+ await addCredits({ amount: "10" });
4414
+ }
4415
+ }
4283
4416
  } else if (profile.tier === "BYOK") {
4284
4417
  console.log();
4285
4418
  console.log(chalk7.dim(" Using your own API keys - no credit charges"));
4419
+ printCreditsNextAction("BYOK");
4286
4420
  }
4287
4421
  console.log();
4288
4422
  } catch (err2) {
@@ -4341,11 +4475,41 @@ async function addCredits(options = {}) {
4341
4475
  } catch {
4342
4476
  console.log(chalk7.yellow(" Could not open browser. Please visit the URL above."));
4343
4477
  }
4478
+ console.log(chalk7.bold("\nNext best action:"));
4479
+ console.log(chalk7.dim(` \u2022 Complete payment in browser, then run ${chalk7.cyan("archon credits")} to verify balance.`));
4480
+ console.log(chalk7.dim(` \u2022 Continue work with ${chalk7.cyan('archon plan "..."')} or ${chalk7.cyan("archon execute <ATOM-ID>")}.`));
4344
4481
  } catch (err2) {
4345
4482
  spinner.fail("Error preparing checkout");
4346
4483
  console.error(err2);
4347
4484
  }
4348
4485
  }
4486
+ function printCreditsNextAction(tier) {
4487
+ console.log(chalk7.bold(" Next best action:"));
4488
+ if (tier === "CREDITS") {
4489
+ console.log(chalk7.dim(` \u2022 Keep at least $5 balance to avoid interruptions during plan/execute.`));
4490
+ } else if (tier === "BYOK") {
4491
+ console.log(chalk7.dim(` \u2022 Manage provider keys with ${chalk7.cyan("archon keys add/list/remove")}.`));
4492
+ } else {
4493
+ console.log(chalk7.dim(` \u2022 Upgrade to BYOK or Credits with ${chalk7.cyan("archon upgrade")}.`));
4494
+ }
4495
+ }
4496
+ function promptYesNo2(question, defaultValue) {
4497
+ return new Promise((resolve) => {
4498
+ const rl = readline2.createInterface({
4499
+ input: process.stdin,
4500
+ output: process.stdout
4501
+ });
4502
+ const hint = defaultValue ? "(Y/n)" : "(y/N)";
4503
+ rl.question(`${chalk7.cyan("?")} ${question} ${hint}: `, (answer) => {
4504
+ rl.close();
4505
+ if (answer.trim() === "") {
4506
+ resolve(defaultValue);
4507
+ } else {
4508
+ resolve(answer.toLowerCase().startsWith("y"));
4509
+ }
4510
+ });
4511
+ });
4512
+ }
4349
4513
  async function showHistory(options = {}) {
4350
4514
  const spinner = ora("Fetching usage history...").start();
4351
4515
  try {
@@ -6225,7 +6389,7 @@ async function githubDisconnect() {
6225
6389
 
6226
6390
  // src/cli/interview.ts
6227
6391
  import chalk13 from "chalk";
6228
- import readline2 from "readline";
6392
+ import readline3 from "readline";
6229
6393
  import ora3 from "ora";
6230
6394
  import { existsSync as existsSync13, readFileSync as readFileSync5, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
6231
6395
  import { join as join13 } from "path";
@@ -6333,7 +6497,7 @@ async function interview(options = {}) {
6333
6497
  console.log(chalk13.red(` \u2022 ${error}`));
6334
6498
  }
6335
6499
  console.log();
6336
- const fix = await promptYesNo2("Would you like to go back and fix these?", true);
6500
+ const fix = await promptYesNo3("Would you like to go back and fix these?", true);
6337
6501
  if (fix) {
6338
6502
  await interview({ ...options, phase: 1 });
6339
6503
  return;
@@ -6371,7 +6535,7 @@ async function interview(options = {}) {
6371
6535
  console.log(` \u2022 ${feature.name}`);
6372
6536
  }
6373
6537
  console.log();
6374
- const acceptDeferrals = await promptYesNo2(
6538
+ const acceptDeferrals = await promptYesNo3(
6375
6539
  `Move ${challengeResult.featuresToDefer.length} feature(s) to post-MVP?`,
6376
6540
  true
6377
6541
  );
@@ -6392,7 +6556,7 @@ async function interview(options = {}) {
6392
6556
  if (criticalCount > 0) {
6393
6557
  console.log(chalk13.red(`
6394
6558
  \u26A0\uFE0F ${criticalCount} critical issue(s) detected.`));
6395
- const proceed = await promptYesNo2("Proceed anyway?", false);
6559
+ const proceed = await promptYesNo3("Proceed anyway?", false);
6396
6560
  if (!proceed) {
6397
6561
  saveDraft(cwd, constitution);
6398
6562
  console.log(chalk13.dim("\nDraft saved. Address the issues and run `archon interview` again.\n"));
@@ -6410,7 +6574,7 @@ async function interview(options = {}) {
6410
6574
  saveDraft(cwd, constitution);
6411
6575
  return;
6412
6576
  }
6413
- const confirmFreeze = await promptYesNo2("Freeze this Constitution and start building?", true);
6577
+ const confirmFreeze = await promptYesNo3("Freeze this Constitution and start building?", true);
6414
6578
  if (!confirmFreeze) {
6415
6579
  saveDraft(cwd, constitution);
6416
6580
  console.log(chalk13.dim("\nDraft saved. Run `archon interview` to continue.\n"));
@@ -6491,7 +6655,7 @@ async function promptQuestion(question) {
6491
6655
  }
6492
6656
  function prompt2(question) {
6493
6657
  return new Promise((resolve) => {
6494
- const rl = readline2.createInterface({
6658
+ const rl = readline3.createInterface({
6495
6659
  input: process.stdin,
6496
6660
  output: process.stdout
6497
6661
  });
@@ -6502,9 +6666,9 @@ function prompt2(question) {
6502
6666
  });
6503
6667
  });
6504
6668
  }
6505
- function promptYesNo2(question, defaultValue) {
6669
+ function promptYesNo3(question, defaultValue) {
6506
6670
  return new Promise((resolve) => {
6507
- const rl = readline2.createInterface({
6671
+ const rl = readline3.createInterface({
6508
6672
  input: process.stdin,
6509
6673
  output: process.stdout
6510
6674
  });
@@ -6615,7 +6779,7 @@ async function generateAtoms(options = {}) {
6615
6779
  const prdPath = options.output ?? join13(cwd, "prd.json");
6616
6780
  const prdContent = formatAsPrdJson(result, constitution);
6617
6781
  if (existsSync13(prdPath)) {
6618
- const overwrite = await promptYesNo2("prd.json already exists. Overwrite?", false);
6782
+ const overwrite = await promptYesNo3("prd.json already exists. Overwrite?", false);
6619
6783
  if (!overwrite) {
6620
6784
  console.log(chalk13.dim("Cancelled. Existing prd.json preserved."));
6621
6785
  return;
@@ -6637,7 +6801,7 @@ import chalk14 from "chalk";
6637
6801
  import { existsSync as existsSync14, rmSync } from "fs";
6638
6802
  import { readFile as readFile8, writeFile as writeFile6 } from "fs/promises";
6639
6803
  import { join as join14 } from "path";
6640
- import readline3 from "readline";
6804
+ import readline4 from "readline";
6641
6805
  var ARCHON_FILES = [
6642
6806
  ".archon/",
6643
6807
  "prd.json",
@@ -6679,7 +6843,7 @@ async function eject(options = {}) {
6679
6843
  }
6680
6844
  console.log();
6681
6845
  if (!options.force) {
6682
- const confirmed = await promptYesNo3("This will permanently remove ArchonDev from your project. Continue?", false);
6846
+ const confirmed = await promptYesNo4("This will permanently remove ArchonDev from your project. Continue?", false);
6683
6847
  if (!confirmed) {
6684
6848
  console.log(chalk14.dim("Eject cancelled."));
6685
6849
  return;
@@ -6844,9 +7008,9 @@ async function ejectDryRun() {
6844
7008
  console.log();
6845
7009
  console.log(chalk14.dim('Run "archon eject" to proceed.'));
6846
7010
  }
6847
- function promptYesNo3(question, defaultValue) {
7011
+ function promptYesNo4(question, defaultValue) {
6848
7012
  return new Promise((resolve) => {
6849
- const rl = readline3.createInterface({
7013
+ const rl = readline4.createInterface({
6850
7014
  input: process.stdin,
6851
7015
  output: process.stdout
6852
7016
  });
@@ -6868,7 +7032,7 @@ import { execSync as execSync4 } from "child_process";
6868
7032
  import { existsSync as existsSync15 } from "fs";
6869
7033
  import { readFile as readFile9, writeFile as writeFile7 } from "fs/promises";
6870
7034
  import { join as join15 } from "path";
6871
- import readline4 from "readline";
7035
+ import readline5 from "readline";
6872
7036
  async function findAtomCommits(limit = 50) {
6873
7037
  const cwd = process.cwd();
6874
7038
  try {
@@ -6966,7 +7130,7 @@ async function revertCommand(atomIdOrHash, options = {}) {
6966
7130
  } catch {
6967
7131
  }
6968
7132
  if (!options.force) {
6969
- const confirmed = await promptYesNo4("Revert this atom commit?", false);
7133
+ const confirmed = await promptYesNo5("Revert this atom commit?", false);
6970
7134
  if (!confirmed) {
6971
7135
  console.log(chalk15.dim("Revert cancelled."));
6972
7136
  return;
@@ -7033,9 +7197,9 @@ async function revertableAtoms() {
7033
7197
  console.log();
7034
7198
  console.log(chalk15.dim("To revert: archon revert <atom-id>"));
7035
7199
  }
7036
- function promptYesNo4(question, defaultValue) {
7200
+ function promptYesNo5(question, defaultValue) {
7037
7201
  return new Promise((resolve) => {
7038
- const rl = readline4.createInterface({
7202
+ const rl = readline5.createInterface({
7039
7203
  input: process.stdin,
7040
7204
  output: process.stdout
7041
7205
  });