jinzd-ai-cli 0.2.3 → 0.2.4

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.
@@ -8,7 +8,7 @@ import { platform } from "os";
8
8
  import chalk from "chalk";
9
9
 
10
10
  // src/core/constants.ts
11
- var VERSION = "0.2.3";
11
+ var VERSION = "0.2.4";
12
12
  var APP_NAME = "ai-cli";
13
13
  var CONFIG_DIR_NAME = ".aicli";
14
14
  var CONFIG_FILE_NAME = "config.json";
@@ -16,7 +16,7 @@ import {
16
16
  SUBAGENT_MAX_ROUNDS_LIMIT,
17
17
  VERSION,
18
18
  runTestsTool
19
- } from "./chunk-ZV5BU6FL.js";
19
+ } from "./chunk-2WCLXWAH.js";
20
20
 
21
21
  // src/config/config-manager.ts
22
22
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -2704,11 +2704,14 @@ Important rules:
2704
2704
  1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir; ls" or "mkdir mydir; cd mydir; New-Item file.txt".
2705
2705
  2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
2706
2706
  3. Multiple commands can be combined with semicolons in a single call to reduce rounds.
2707
- 4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method).` : `Execute commands in ${SHELL}.
2707
+ 4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method).
2708
+ 5. IMPORTANT: On Windows, "curl" is an alias for Invoke-WebRequest and does NOT support curl flags like -s, -X, -H. Use Invoke-RestMethod instead for HTTP requests. Example: Invoke-RestMethod -Uri "http://localhost:3000/api/health" -Method Get
2709
+ 6. For long-running server commands (node server.js, npm run dev, etc.), use Start-Process -NoNewWindow to run in background, otherwise the tool will block until timeout.` : `Execute commands in ${SHELL}.
2708
2710
  Important rules:
2709
2711
  1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir && ls" or "mkdir -p mydir && touch mydir/file.txt".
2710
2712
  2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
2711
- 3. Multiple commands can be combined with && in a single call to reduce rounds.`,
2713
+ 3. Multiple commands can be combined with && in a single call to reduce rounds.
2714
+ 4. For long-running server commands (node server.js, npm start, npm run dev, etc.), run in background with & or nohup, otherwise the tool will block until timeout.`,
2712
2715
  parameters: {
2713
2716
  command: {
2714
2717
  type: "string",
@@ -3228,10 +3231,11 @@ var editFileTool = {
3228
3231
  definition: {
3229
3232
  name: "edit_file",
3230
3233
  description: `Precisely edit file contents. Supports three modes:
3231
- 1. String replace (most common): Provide old_str and new_str to replace an exact match. old_str must appear exactly once in the file.
3234
+ 1. String replace (most common): Provide old_str and new_str to replace an exact match. old_str must appear exactly once in the file (unless replace_all is true).
3232
3235
  2. Line insert: Provide insert_after_line (1-based line number) and insert_content to insert after that line.
3233
3236
  3. Line delete: Provide delete_from_line and delete_to_line (inclusive) to delete that range.
3234
3237
  Optional ignore_whitespace: true to match ignoring indentation differences.
3238
+ Optional replace_all: true to replace ALL occurrences of old_str in the file at once (saves tool rounds when renaming variables/functions).
3235
3239
  Note: Path can be absolute or relative to the current working directory.`,
3236
3240
  parameters: {
3237
3241
  path: {
@@ -3254,6 +3258,11 @@ Note: Path can be absolute or relative to the current working directory.`,
3254
3258
  description: "[Replace mode] Whether to ignore leading/trailing whitespace per line when matching, defaults to false",
3255
3259
  required: false
3256
3260
  },
3261
+ replace_all: {
3262
+ type: "boolean",
3263
+ description: "[Replace mode] Replace ALL occurrences of old_str instead of requiring unique match. Useful for renaming variables/functions across the file in one call.",
3264
+ required: false
3265
+ },
3257
3266
  insert_after_line: {
3258
3267
  type: "number",
3259
3268
  description: "[Insert mode] Insert after this line number (1-based), 0 means insert at the beginning",
@@ -3293,6 +3302,7 @@ Note: Path can be absolute or relative to the current working directory.`,
3293
3302
  const oldStr = String(args["old_str"]);
3294
3303
  const newStr = String(args["new_str"] ?? "");
3295
3304
  const ignoreWs = Boolean(args["ignore_whitespace"]);
3305
+ const replaceAll = Boolean(args["replace_all"]);
3296
3306
  if (oldStr === "") throw new Error("old_str cannot be empty");
3297
3307
  if (ignoreWs) {
3298
3308
  const fileLines = original.split("\n");
@@ -3320,6 +3330,23 @@ Please read the file first and use exact text.`;
3320
3330
  Replaced: ${searchLines.length} line(s) \u2192 ${newStr.split("\n").length} line(s)
3321
3331
  Old: ${truncatePreview(oldStr)}
3322
3332
  New: ${truncatePreview(newStr)}`;
3333
+ }
3334
+ if (replaceAll) {
3335
+ const occurrences = original.split(oldStr).length - 1;
3336
+ if (occurrences === 0) {
3337
+ const similar = findSimilarLines(original, oldStr);
3338
+ const hint = similar.length > 0 ? `
3339
+ Similar lines found (did you mean?):
3340
+ ${similar.join("\n")}` : "";
3341
+ return `ERROR: old_str not found in file.${hint}
3342
+ Please read the file first and use exact text.`;
3343
+ }
3344
+ undoStack.push(filePath, `edit_file (replace_all): ${filePath}`);
3345
+ const updated2 = original.split(oldStr).join(newStr);
3346
+ writeFileSync5(filePath, updated2, encoding);
3347
+ return `Successfully edited ${filePath} (replace_all)
3348
+ Replaced: ${occurrences} occurrence(s) of ${truncatePreview(oldStr)}
3349
+ With: ${truncatePreview(newStr)}`;
3323
3350
  }
3324
3351
  const firstIndex = original.indexOf(oldStr);
3325
3352
  if (firstIndex === -1) {
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  theme,
36
36
  truncateOutput,
37
37
  undoStack
38
- } from "./chunk-MVARMOOJ.js";
38
+ } from "./chunk-HTXJ23TX.js";
39
39
  import {
40
40
  AGENTIC_BEHAVIOR_GUIDELINE,
41
41
  AUTHOR,
@@ -55,7 +55,7 @@ import {
55
55
  REPO_URL,
56
56
  SKILLS_DIR_NAME,
57
57
  VERSION
58
- } from "./chunk-ZV5BU6FL.js";
58
+ } from "./chunk-2WCLXWAH.js";
59
59
 
60
60
  // src/index.ts
61
61
  import { program } from "commander";
@@ -1904,7 +1904,7 @@ ${hint}` : "")
1904
1904
  description: "Run project tests and show structured report",
1905
1905
  usage: "/test [command|filter]",
1906
1906
  async execute(args, _ctx) {
1907
- const { executeTests } = await import("./run-tests-ONH2KZTI.js");
1907
+ const { executeTests } = await import("./run-tests-L5G4W7EB.js");
1908
1908
  const argStr = args.join(" ").trim();
1909
1909
  let testArgs = {};
1910
1910
  if (argStr) {
@@ -5292,7 +5292,7 @@ program.command("web").description("Start Web UI server with browser-based chat
5292
5292
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
5293
5293
  process.exit(1);
5294
5294
  }
5295
- const { startWebServer } = await import("./server-6JLWLVZ5.js");
5295
+ const { startWebServer } = await import("./server-N2LG3A4M.js");
5296
5296
  await startWebServer({ port, host: options.host });
5297
5297
  });
5298
5298
  program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-ZV5BU6FL.js";
5
+ } from "./chunk-2WCLXWAH.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -23,7 +23,7 @@ import {
23
23
  setupProxy,
24
24
  spawnAgentContext,
25
25
  truncateOutput
26
- } from "./chunk-MVARMOOJ.js";
26
+ } from "./chunk-HTXJ23TX.js";
27
27
  import {
28
28
  AGENTIC_BEHAVIOR_GUIDELINE,
29
29
  CONTEXT_FILE_CANDIDATES,
@@ -35,7 +35,7 @@ import {
35
35
  PLAN_MODE_SYSTEM_ADDON,
36
36
  SKILLS_DIR_NAME,
37
37
  VERSION
38
- } from "./chunk-ZV5BU6FL.js";
38
+ } from "./chunk-2WCLXWAH.js";
39
39
  import {
40
40
  AuthManager
41
41
  } from "./chunk-CPLT6CD3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",