@hotpathrun/cli 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/hotpath.mjs +28 -2
  2. package/package.json +9 -9
package/dist/hotpath.mjs CHANGED
@@ -78487,7 +78487,7 @@ var init_package = __esm({
78487
78487
  "../../package.json"() {
78488
78488
  package_default = {
78489
78489
  name: "hotpath",
78490
- version: "0.2.0",
78490
+ version: "0.2.1",
78491
78491
  description: "Record your AI agent once. Replay it faster and cheaper, with AI only where judgment is needed.",
78492
78492
  license: "Apache-2.0",
78493
78493
  repository: {
@@ -85646,6 +85646,24 @@ async function runInit(options) {
85646
85646
  HOTPATH_CHEAP_MODEL: cheapModel,
85647
85647
  ...preset.extra ?? {}
85648
85648
  };
85649
+ const replacesKey = !!existing.LLM_API_KEY && (existing.LLM_API_KEY !== apiKey || existing.LLM_BASE_URL !== baseUrl);
85650
+ let backupFile;
85651
+ if (replacesKey && existingText !== null) {
85652
+ if (!options.force) {
85653
+ const where = existing.LLM_BASE_URL || "another endpoint";
85654
+ const refuse = () => new InitError(
85655
+ `${options.envFile} already has a key for ${where}; nothing was changed. To set up a new project in this folder instead, run: hotpath --home . init. To replace it anyway (a copy of the old file is kept), add --force.`
85656
+ );
85657
+ if (!ask) throw refuse();
85658
+ const answer = (await ask(
85659
+ `${options.envFile} already has a key for ${where}. Replace it (a copy is kept)? [y/N]: `
85660
+ )).trim().toLowerCase();
85661
+ if (answer !== "y" && answer !== "yes") throw refuse();
85662
+ }
85663
+ backupFile = `${options.envFile}.backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace("T", "-").slice(0, 15)}`;
85664
+ await writeFile16(backupFile, existingText, { mode: 384 });
85665
+ await chmod(backupFile, 384).catch(() => void 0);
85666
+ }
85649
85667
  await writeFile16(options.envFile, setEnv(existingText ?? "", values), {
85650
85668
  mode: 384
85651
85669
  });
@@ -85657,6 +85675,11 @@ async function runInit(options) {
85657
85675
  log(
85658
85676
  "The key stays in that file; Hotpath never prints or sends it anywhere else."
85659
85677
  );
85678
+ if (backupFile) {
85679
+ log(
85680
+ `The old settings, with the old key, are in ${backupFile}. Keep it out of version control.`
85681
+ );
85682
+ }
85660
85683
  if (preset.id !== "ollama") {
85661
85684
  log(
85662
85685
  "Check the model names match your provider's exact ids: hotpath doctor lists what it finds."
@@ -85850,7 +85873,10 @@ First steps:
85850
85873
  ).option("--provider <id>", "ollama, openai, groq, openrouter or custom").option("--base-url <url>", "OpenAI-compatible endpoint").option(
85851
85874
  "--api-key <key>",
85852
85875
  "API key (prefer typing it when asked: flags land in shell history)"
85853
- ).option("--agent-model <id>", "model that records tasks").option("--cheap-model <id>", "model for the short AI steps in a replay").option("-y, --yes", "accept the defaults, ask nothing").action(
85876
+ ).option("--agent-model <id>", "model that records tasks").option("--cheap-model <id>", "model for the short AI steps in a replay").option("-y, --yes", "accept the defaults, ask nothing").option(
85877
+ "--force",
85878
+ "replace a key that .env already has for another endpoint (a copy is kept)"
85879
+ ).action(
85854
85880
  async (options) => {
85855
85881
  try {
85856
85882
  await runInit({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotpathrun/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The hotpath command line: record, compile, show, run and view",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,15 +43,15 @@
43
43
  "cross-spawn": "^7.0.6",
44
44
  "json5": "^2.2.3",
45
45
  "@types/cross-spawn": "^6.0.6",
46
- "@hotpathrun/compiler": "0.2.0",
47
- "@hotpathrun/learn": "0.2.0",
48
- "@hotpathrun/recorder": "0.2.0",
49
- "@hotpathrun/proxy": "0.2.0",
50
- "@hotpathrun/shared": "0.2.0",
51
- "@hotpathrun/viewer": "0.2.0",
52
- "@hotpathrun/scheduler": "0.2.0",
46
+ "@hotpathrun/learn": "0.2.1",
47
+ "@hotpathrun/runtime": "0.2.1",
48
+ "@hotpathrun/proxy": "0.2.1",
49
+ "@hotpathrun/compiler": "0.2.1",
50
+ "@hotpathrun/recorder": "0.2.1",
51
+ "@hotpathrun/scheduler": "0.2.1",
52
+ "@hotpathrun/viewer": "0.2.1",
53
+ "@hotpathrun/shared": "0.2.1",
53
54
  "demo-agent": "0.1.0",
54
- "@hotpathrun/runtime": "0.2.0",
55
55
  "demo-tools": "0.1.0"
56
56
  },
57
57
  "scripts": {