archondev 2.19.3 → 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/README.md CHANGED
@@ -118,6 +118,7 @@ pnpm exec tsx scripts/init-governance-db.ts
118
118
 
119
119
  **Notes:**
120
120
  - Credits tier shows your balance and per‑model usage on startup; use `archon credits` for full details and history.
121
+ - Content-only requests (stories, outlines, lessons, visuals) use lightweight planning to avoid blocking.
121
122
  - BYOK shows per‑model usage and cost by today/week/month/year in `archon preferences` → “View usage details.”
122
123
  - You can paste multi‑line requests into interactive prompts; Archon captures them as a single response.
123
124
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  bugReport
3
- } from "./chunk-DCIIYVJW.js";
3
+ } from "./chunk-XKYRHJA5.js";
4
4
  import "./chunk-PCTP3LKJ.js";
5
5
  import "./chunk-PJRQI5UN.js";
6
6
  import "./chunk-EIEU3IIY.js";
@@ -4,7 +4,7 @@ import {
4
4
  analyzeProject,
5
5
  featuresToTasks,
6
6
  readArchitectureContext
7
- } from "./chunk-KG35EHZY.js";
7
+ } from "./chunk-YGDLWQBK.js";
8
8
 
9
9
  // src/cli/review.ts
10
10
  import chalk from "chalk";
@@ -593,6 +593,7 @@ async function reviewRun(options) {
593
593
  spinner.stop();
594
594
  console.log(chalk.green(`Starting AI Review`));
595
595
  console.log(chalk.dim(`Pending tasks: ${stats.pending}`));
596
+ console.log(chalk.dim("Workflow: Stage 1 spec compliance \u2192 Stage 2 code quality"));
596
597
  if (limit) {
597
598
  console.log(chalk.dim(`Limit: ${limit}`));
598
599
  }
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  listLocalAtoms,
8
8
  loadAtom
9
- } from "./chunk-4VIBRFVY.js";
9
+ } from "./chunk-OTODLPY4.js";
10
10
  import {
11
11
  loadConfig
12
12
  } from "./chunk-SVU7MLG6.js";
@@ -763,6 +763,7 @@ async function interactiveSettings() {
763
763
  }
764
764
  await displayCurrentSettings(profile, usage, providers);
765
765
  console.log(chalk.bold("\nOptions:\n"));
766
+ console.log(chalk.dim("Type naturally (recommended) or use a shortcut:\n"));
766
767
  console.log(` ${chalk.cyan("1")}) Change billing mode (BYOK / Credits)`);
767
768
  console.log(` ${chalk.cyan("2")}) Set default models`);
768
769
  console.log(` ${chalk.cyan("x")}) Smart Routing (cost optimization)`);
@@ -771,7 +772,8 @@ async function interactiveSettings() {
771
772
  console.log(` ${chalk.cyan("5")}) Reset to defaults`);
772
773
  console.log(` ${chalk.cyan("b")}) Back to project`);
773
774
  console.log();
774
- const choice = await prompt("Enter choice");
775
+ const rawChoice = await prompt("What would you like to do?");
776
+ const choice = resolveSettingsChoice(rawChoice);
775
777
  switch (choice.toLowerCase()) {
776
778
  case "1":
777
779
  await changeBillingMode(profile.tier);
@@ -801,7 +803,7 @@ async function interactiveSettings() {
801
803
  console.log(chalk.dim("\nReturning to project...\n"));
802
804
  return;
803
805
  default:
804
- console.log(chalk.yellow("Invalid choice."));
806
+ console.log(chalk.yellow("I did not catch that. Try again or describe what you need."));
805
807
  await interactiveSettings();
806
808
  }
807
809
  }
@@ -843,7 +845,8 @@ async function changeBillingMode(currentTier) {
843
845
  console.log(chalk.dim(" 10% service fee applied.\n"));
844
846
  console.log(` ${chalk.cyan("b")}) Back`);
845
847
  console.log();
846
- const choice = await prompt("Enter choice");
848
+ const rawChoice = await prompt("How do you want to pay?");
849
+ const choice = resolveBillingChoice(rawChoice);
847
850
  if (choice === "1" && !byokSelected) {
848
851
  const spinner = ora("Switching to BYOK...").start();
849
852
  const result = await updateUserTier("BYOK");
@@ -861,9 +864,11 @@ async function changeBillingMode(currentTier) {
861
864
  } else {
862
865
  spinner.fail(chalk.red(result.error ?? "Failed to update"));
863
866
  }
864
- } else if (choice.toLowerCase() !== "b") {
867
+ } else if (choice !== "b") {
865
868
  if (choice === "1" && byokSelected || choice === "2" && creditsSelected) {
866
869
  console.log(chalk.dim("Already using this billing mode."));
870
+ } else {
871
+ console.log(chalk.yellow("I did not catch that."));
867
872
  }
868
873
  }
869
874
  }
@@ -877,7 +882,8 @@ async function setDefaultModelsMenu(profile, providers) {
877
882
  console.log();
878
883
  console.log(` ${chalk.cyan("b")}) Back`);
879
884
  console.log();
880
- const choice = await prompt("Which model to change?");
885
+ const rawChoice = await prompt("Which default model should change?");
886
+ const choice = resolveDefaultModelSlotChoice(rawChoice);
881
887
  const keyMap = {
882
888
  "1": "fast-model",
883
889
  "2": "thinking-model",
@@ -889,7 +895,7 @@ async function setDefaultModelsMenu(profile, providers) {
889
895
  }
890
896
  const prefKey = keyMap[choice];
891
897
  if (!prefKey) {
892
- console.log(chalk.yellow("Invalid choice."));
898
+ console.log(chalk.yellow("I did not catch that."));
893
899
  return;
894
900
  }
895
901
  const models = getAllActiveModels();
@@ -906,8 +912,8 @@ async function setDefaultModelsMenu(profile, providers) {
906
912
  console.log(` ${chalk.cyan(String(i + 1))}) ${m.modelName} ${categoryLabel}`);
907
913
  });
908
914
  console.log();
909
- const modelChoice = await prompt("Select model number");
910
- const modelIndex = parseInt(modelChoice, 10) - 1;
915
+ const modelChoice = await prompt("Which model do you want? (number or model name)");
916
+ const modelIndex = resolveModelChoice(modelChoice, availableModels);
911
917
  if (modelIndex >= 0 && modelIndex < availableModels.length) {
912
918
  const selectedModel = availableModels[modelIndex];
913
919
  if (selectedModel) {
@@ -940,7 +946,8 @@ async function setSmartRoutingMenu(profile, providers) {
940
946
  console.log(` ${chalk.cyan("5")}) View operations by tier`);
941
947
  console.log(` ${chalk.cyan("b")}) Back`);
942
948
  console.log();
943
- const choice = await prompt("Select option");
949
+ const rawChoice = await prompt("What would you like to change?");
950
+ const choice = resolveSmartRoutingChoice(rawChoice);
944
951
  if (choice.toLowerCase() === "b") {
945
952
  return;
946
953
  }
@@ -963,7 +970,8 @@ async function setSmartRoutingMenu(profile, providers) {
963
970
  console.log(` ${chalk.cyan("3")}) google`);
964
971
  console.log(` ${chalk.cyan("0")}) Clear preference (auto)`);
965
972
  console.log();
966
- const provChoice = await prompt("Select");
973
+ const provChoiceRaw = await prompt("Which provider should be preferred?");
974
+ const provChoice = resolveProviderChoice(provChoiceRaw);
967
975
  const providerMap = {
968
976
  "0": null,
969
977
  "1": "anthropic",
@@ -997,12 +1005,12 @@ Select model for ${selectedTier.tier} tier:
997
1005
  console.log(` ${chalk.cyan(String(i + 1))}) ${m.modelName} ${categoryLabel}`);
998
1006
  });
999
1007
  console.log();
1000
- const modelChoice = await prompt("Select model number");
1008
+ const modelChoice = await prompt("Which model do you want for this tier? (number or model name)");
1001
1009
  if (modelChoice === "0") {
1002
1010
  await setTierPreference(selectedTier.key, null);
1003
1011
  return;
1004
1012
  }
1005
- const modelIndex = parseInt(modelChoice, 10) - 1;
1013
+ const modelIndex = resolveModelChoice(modelChoice, availableModels);
1006
1014
  if (modelIndex >= 0 && modelIndex < availableModels.length) {
1007
1015
  const selectedModel = availableModels[modelIndex];
1008
1016
  if (selectedModel) {
@@ -1057,7 +1065,8 @@ async function manageApiKeys() {
1057
1065
  console.log(` ${chalk.cyan("4")}) Remove a key`);
1058
1066
  console.log(` ${chalk.cyan("b")}) Back`);
1059
1067
  console.log();
1060
- const choice = await prompt("Enter choice");
1068
+ const rawChoice = await prompt("What do you want to do with API keys?");
1069
+ const choice = resolveApiKeysChoice(rawChoice);
1061
1070
  const providerMap = {
1062
1071
  "1": "anthropic",
1063
1072
  "2": "openai",
@@ -1073,8 +1082,8 @@ async function manageApiKeys() {
1073
1082
  }
1074
1083
  console.log("\nWhich provider to remove?");
1075
1084
  providers.forEach((p, i) => console.log(` ${chalk.cyan(String(i + 1))}) ${p}`));
1076
- const removeChoice = await prompt("Select");
1077
- const removeIndex = parseInt(removeChoice, 10) - 1;
1085
+ const removeChoice = await prompt("Which provider key should be removed?");
1086
+ const removeIndex = resolveProviderIndexChoice(removeChoice, providers);
1078
1087
  if (removeIndex >= 0 && removeIndex < providers.length) {
1079
1088
  const providerToRemove = providers[removeIndex];
1080
1089
  if (providerToRemove) {
@@ -1088,8 +1097,97 @@ async function manageApiKeys() {
1088
1097
  if (provider) {
1089
1098
  const { addKey } = await import("./keys-T2VPHE7Z.js");
1090
1099
  await addKey(provider);
1100
+ } else if (choice !== "b") {
1101
+ console.log(chalk.yellow("I did not catch that."));
1091
1102
  }
1092
1103
  }
1104
+ function resolveSettingsChoice(input) {
1105
+ const normalized = input.trim().toLowerCase();
1106
+ if (!normalized) return "";
1107
+ if (normalized === "1" || normalized.includes("billing") || normalized.includes("tier") || normalized.includes("pay")) return "1";
1108
+ if (normalized === "2" || normalized.includes("default model") || normalized.includes("model")) return "2";
1109
+ if (normalized === "x" || normalized === "smart" || normalized.includes("routing") || normalized.includes("cost optimization")) return "x";
1110
+ if (normalized === "3" || normalized.includes("key")) return "3";
1111
+ if (normalized === "4" || normalized.includes("usage") || normalized.includes("spend") || normalized.includes("cost details")) return "4";
1112
+ if (normalized === "5" || normalized.includes("reset") || normalized.includes("defaults")) return "5";
1113
+ if (normalized === "b" || normalized.includes("back") || normalized.includes("return")) return "b";
1114
+ return normalized;
1115
+ }
1116
+ function resolveBillingChoice(input) {
1117
+ const normalized = input.trim().toLowerCase();
1118
+ if (!normalized) return "";
1119
+ if (normalized === "1" || normalized.includes("byok") || normalized.includes("own key")) return "1";
1120
+ if (normalized === "2" || normalized.includes("credit") || normalized.includes("managed")) return "2";
1121
+ if (normalized === "b" || normalized.includes("back")) return "b";
1122
+ return normalized;
1123
+ }
1124
+ function resolveDefaultModelSlotChoice(input) {
1125
+ const normalized = input.trim().toLowerCase();
1126
+ if (!normalized) return "";
1127
+ if (normalized === "1" || normalized.includes("fast")) return "1";
1128
+ if (normalized === "2" || normalized.includes("thinking")) return "2";
1129
+ if (normalized === "3" || normalized.includes("primary")) return "3";
1130
+ if (normalized === "4" || normalized.includes("secondary")) return "4";
1131
+ if (normalized === "b" || normalized.includes("back")) return "b";
1132
+ return normalized;
1133
+ }
1134
+ function resolveModelChoice(choice, models) {
1135
+ const normalized = choice.trim().toLowerCase();
1136
+ const numeric = parseInt(normalized, 10);
1137
+ if (!Number.isNaN(numeric)) {
1138
+ return numeric - 1;
1139
+ }
1140
+ const idx = models.findIndex(
1141
+ (m) => m.modelId.toLowerCase() === normalized || m.modelName.toLowerCase() === normalized || m.modelName.toLowerCase().includes(normalized) || normalized.includes(m.modelName.toLowerCase())
1142
+ );
1143
+ return idx;
1144
+ }
1145
+ function resolveSmartRoutingChoice(input) {
1146
+ const normalized = input.trim().toLowerCase();
1147
+ if (!normalized) return "";
1148
+ if (normalized === "1" || normalized.includes("planning")) return "1";
1149
+ if (normalized === "2" || normalized.includes("reasoning")) return "2";
1150
+ if (normalized === "3" || normalized.includes("execution")) return "3";
1151
+ if (normalized === "4" || normalized.includes("provider")) return "4";
1152
+ if (normalized === "5" || normalized.includes("operation")) return "5";
1153
+ if (normalized === "b" || normalized.includes("back")) return "b";
1154
+ return normalized;
1155
+ }
1156
+ function resolveProviderChoice(input) {
1157
+ const normalized = input.trim().toLowerCase();
1158
+ if (!normalized) return "";
1159
+ if (normalized === "0" || normalized.includes("auto") || normalized.includes("clear")) return "0";
1160
+ if (normalized === "1" || normalized.includes("anthropic")) return "1";
1161
+ if (normalized === "2" || normalized.includes("openai")) return "2";
1162
+ if (normalized === "3" || normalized.includes("google") || normalized.includes("gemini")) return "3";
1163
+ return normalized;
1164
+ }
1165
+ function resolveApiKeysChoice(input) {
1166
+ const normalized = input.trim().toLowerCase();
1167
+ if (!normalized) return "";
1168
+ if (normalized === "1" || normalized.includes("add") && normalized.includes("anthropic")) return "1";
1169
+ if (normalized === "2" || normalized.includes("add") && normalized.includes("openai")) return "2";
1170
+ if (normalized === "3" || normalized.includes("add") && (normalized.includes("google") || normalized.includes("gemini"))) return "3";
1171
+ if (normalized === "4" || normalized.includes("remove") || normalized.includes("delete")) return "4";
1172
+ if (normalized === "b" || normalized.includes("back")) return "b";
1173
+ return normalized;
1174
+ }
1175
+ function resolveProviderIndexChoice(choice, providers) {
1176
+ const normalized = choice.trim().toLowerCase();
1177
+ const numeric = parseInt(normalized, 10);
1178
+ if (!Number.isNaN(numeric)) return numeric - 1;
1179
+ return providers.findIndex((p) => normalized.includes(p));
1180
+ }
1181
+ var __preferencesChoiceHelpers = {
1182
+ resolveSettingsChoice,
1183
+ resolveBillingChoice,
1184
+ resolveDefaultModelSlotChoice,
1185
+ resolveSmartRoutingChoice,
1186
+ resolveProviderChoice,
1187
+ resolveApiKeysChoice,
1188
+ resolveProviderIndexChoice,
1189
+ resolveModelChoice
1190
+ };
1093
1191
  async function showUsageDetails() {
1094
1192
  console.log(chalk.bold("\n-- Usage Details --\n"));
1095
1193
  const spinner = ora("Loading usage data...").start();
@@ -1236,5 +1334,6 @@ export {
1236
1334
  resetPreferences,
1237
1335
  listModels,
1238
1336
  interactiveSettings,
1337
+ __preferencesChoiceHelpers,
1239
1338
  showUsageDetails
1240
1339
  };