@hotpathrun/cli 0.2.0 → 0.2.2

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 +30 -2
  2. package/package.json +10 -10
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.2",
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: {
@@ -81596,6 +81596,8 @@ function hasModelSettings(root) {
81596
81596
  }
81597
81597
  function addDemoCommand(program2) {
81598
81598
  program2.command("demo-tools", { hidden: true }).description("(internal) the demo's fake MCP tool server").action(async () => {
81599
+ process.env.DEMO_FIXTURES_DIR ??= demoFixturesDir();
81600
+ process.env.DEMO_OUT_DIR ??= path24.join(projectRoot(), "out");
81599
81601
  await init_src8().then(() => src_exports);
81600
81602
  });
81601
81603
  program2.command("demo").description(
@@ -85646,6 +85648,24 @@ async function runInit(options) {
85646
85648
  HOTPATH_CHEAP_MODEL: cheapModel,
85647
85649
  ...preset.extra ?? {}
85648
85650
  };
85651
+ const replacesKey = !!existing.LLM_API_KEY && (existing.LLM_API_KEY !== apiKey || existing.LLM_BASE_URL !== baseUrl);
85652
+ let backupFile;
85653
+ if (replacesKey && existingText !== null) {
85654
+ if (!options.force) {
85655
+ const where = existing.LLM_BASE_URL || "another endpoint";
85656
+ const refuse = () => new InitError(
85657
+ `${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.`
85658
+ );
85659
+ if (!ask) throw refuse();
85660
+ const answer = (await ask(
85661
+ `${options.envFile} already has a key for ${where}. Replace it (a copy is kept)? [y/N]: `
85662
+ )).trim().toLowerCase();
85663
+ if (answer !== "y" && answer !== "yes") throw refuse();
85664
+ }
85665
+ backupFile = `${options.envFile}.backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace("T", "-").slice(0, 15)}`;
85666
+ await writeFile16(backupFile, existingText, { mode: 384 });
85667
+ await chmod(backupFile, 384).catch(() => void 0);
85668
+ }
85649
85669
  await writeFile16(options.envFile, setEnv(existingText ?? "", values), {
85650
85670
  mode: 384
85651
85671
  });
@@ -85657,6 +85677,11 @@ async function runInit(options) {
85657
85677
  log(
85658
85678
  "The key stays in that file; Hotpath never prints or sends it anywhere else."
85659
85679
  );
85680
+ if (backupFile) {
85681
+ log(
85682
+ `The old settings, with the old key, are in ${backupFile}. Keep it out of version control.`
85683
+ );
85684
+ }
85660
85685
  if (preset.id !== "ollama") {
85661
85686
  log(
85662
85687
  "Check the model names match your provider's exact ids: hotpath doctor lists what it finds."
@@ -85850,7 +85875,10 @@ First steps:
85850
85875
  ).option("--provider <id>", "ollama, openai, groq, openrouter or custom").option("--base-url <url>", "OpenAI-compatible endpoint").option(
85851
85876
  "--api-key <key>",
85852
85877
  "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(
85878
+ ).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(
85879
+ "--force",
85880
+ "replace a key that .env already has for another endpoint (a copy is kept)"
85881
+ ).action(
85854
85882
  async (options) => {
85855
85883
  try {
85856
85884
  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.2",
4
4
  "description": "The hotpath command line: record, compile, show, run and view",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,16 +43,16 @@
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/compiler": "0.2.2",
47
+ "@hotpathrun/proxy": "0.2.2",
48
+ "@hotpathrun/runtime": "0.2.2",
49
+ "@hotpathrun/scheduler": "0.2.2",
50
+ "@hotpathrun/learn": "0.2.2",
53
51
  "demo-agent": "0.1.0",
54
- "@hotpathrun/runtime": "0.2.0",
55
- "demo-tools": "0.1.0"
52
+ "@hotpathrun/recorder": "0.2.2",
53
+ "@hotpathrun/shared": "0.2.2",
54
+ "demo-tools": "0.1.0",
55
+ "@hotpathrun/viewer": "0.2.2"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsc -p tsconfig.json --noEmit",