scream-code 0.7.1 → 0.7.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.
@@ -121617,13 +121617,14 @@ function createProgram(version, onMain, onMigrate, onPluginNodeRunner = () => {}
121617
121617
  program.addOption(new Option("-S, --session [id]", "恢复会话。带 ID:恢复该会话。不带 ID:交互式选择。").argParser((val) => val === true ? "" : val)).addOption(new Option("-r, --resume [id]").hideHelp().argParser((val) => val === true ? "" : val)).option("-C, --continue", "继续当前工作目录的上一个会话。", false).option("-y, --yolo", "自动批准所有操作。", false).option("--auto", "以自动权限模式启动。", false).addOption(new Option("-m, --model <model>", "本次调用使用的 LLM 模型别名。默认使用 config.toml 中的 default_model。")).addOption(new Option("-p, --prompt <prompt>", "非交互式运行一条提示并打印响应。")).addOption(new Option("--output-format <format>", "提示模式的输出格式。默认为 text。").choices(["text", "stream-json"])).addOption(new Option("--skills-dir <dir>", "从该目录加载技能,而不是自动发现的用户和项目目录。可多次指定。").argParser((value, previous) => [...previous ?? [], value]).default([])).addOption(new Option("--yes").hideHelp().default(false)).addOption(new Option("--auto-approve").hideHelp().default(false)).option("--plan", "以计划模式启动。", false);
121618
121618
  registerExportCommand(program);
121619
121619
  registerMigrateCommand(program, onMigrate);
121620
- program.command("stream-json", { hidden: true }).option("--input-format <fmt>", "stream-json").option("--output-format <fmt>", "stream-json").option("--resume <id>", "resume a previous session").option("--model <model>", "model to use").option("--permission-mode <mode>", "permission mode").option("--permission-prompt-tool <mode>", "(ignored, cc-connect compat)").option("--replay-user-messages", "(ignored, cc-connect compat)").option("--verbose", "(ignored, cc-connect compat)").option("--system-prompt <text>", "(ignored, cc-connect compat)").option("--append-system-prompt <text>", "(passed through to agent)").option("--allowedTools <list>", "(ignored, cc-connect compat)").option("--disallowedTools <list>", "(ignored, cc-connect compat)").option("--effort <value>", "(ignored, cc-connect compat)").option("--max-context-tokens <N>", "(ignored, cc-connect compat)").option("--skills-dir <dir>", "additional skills directory (repeatable)", (value, previous) => [...previous ?? [], value], []).action((subOpts) => {
121620
+ program.command("stream-json", { hidden: true }).option("--input-format <fmt>", "stream-json").option("--output-format <fmt>", "stream-json").option("--resume <id>", "resume a previous session").option("--model <model>", "model to use").option("--permission-mode <mode>", "permission mode").option("--permission-prompt-tool <mode>", "(ignored, cc-connect compat)").option("--replay-user-messages", "(ignored, cc-connect compat)").option("--verbose", "(ignored, cc-connect compat)").option("--system-prompt <text>", "(ignored, cc-connect compat)").option("--append-system-prompt <text>", "(passed through to agent)").option("--append-system-prompt-file <path>", "(passed through to agent; file contents are read and merged)").option("--allowedTools <list>", "(ignored, cc-connect compat)").option("--disallowedTools <list>", "(ignored, cc-connect compat)").option("--effort <value>", "(ignored, cc-connect compat)").option("--max-context-tokens <N>", "(ignored, cc-connect compat)").option("--skills-dir <dir>", "additional skills directory (repeatable)", (value, previous) => [...previous ?? [], value], []).option("--plugin-dir <dir>", "(ignored, cc-connect compat; repeatable)", (value, previous) => [...previous ?? [], value], []).action((subOpts) => {
121621
121621
  onStreamJson({
121622
121622
  resume: subOpts["resume"],
121623
121623
  model: subOpts["model"],
121624
121624
  permissionMode: subOpts["permissionMode"],
121625
121625
  skillsDirs: subOpts["skillsDir"] ?? [],
121626
- appendSystemPrompt: subOpts["appendSystemPrompt"]
121626
+ appendSystemPrompt: subOpts["appendSystemPrompt"],
121627
+ appendSystemPromptFile: subOpts["appendSystemPromptFile"]
121627
121628
  });
121628
121629
  });
121629
121630
  program.command("channel").description("管理 cc-connect 消息平台通道").command("setup").description("配置 cc-connect 并选择要连接的平台").action(() => {
@@ -129504,6 +129505,20 @@ async function writeUpdateCache(value, filePath = getUpdateStateFile()) {
129504
129505
  //#region src/cli/update/cdn.ts
129505
129506
  const NPM_TIMEOUT_MS = 15e3;
129506
129507
  /**
129508
+ * Resolve the npm executable name for the current platform.
129509
+ *
129510
+ * On Windows, `npm` is actually `npm.cmd` — a batch file. Node's child_process
129511
+ * can execute `.cmd` files directly without `shell: true`, but only when the
129512
+ * filename includes the `.cmd` extension. Using `'npm'` without `.cmd` would
129513
+ * fail with ENOENT on Windows.
129514
+ *
129515
+ * We deliberately avoid `shell: true` because passing args alongside
129516
+ * `shell: true` triggers Node's DEP0190 deprecation warning on every spawn.
129517
+ */
129518
+ function npmExecutable$1() {
129519
+ return process.platform === "win32" ? "npm.cmd" : "npm";
129520
+ }
129521
+ /**
129507
129522
  * Query the latest published Scream Code version from the npm registry
129508
129523
  * via `npm view scream-code version`.
129509
129524
  *
@@ -129515,14 +129530,13 @@ const NPM_TIMEOUT_MS = 15e3;
129515
129530
  * `execFileImpl` is injectable for tests; defaults to a promisified spawn.
129516
129531
  */
129517
129532
  async function fetchLatestVersionFromNpm(execFileImpl = execFile) {
129518
- const { stdout } = await promisify(execFileImpl)("npm", [
129533
+ const { stdout } = await promisify(execFileImpl)(npmExecutable$1(), [
129519
129534
  "view",
129520
129535
  "scream-code",
129521
129536
  "version"
129522
129537
  ], {
129523
129538
  timeout: NPM_TIMEOUT_MS,
129524
- maxBuffer: 1024,
129525
- shell: process.platform === "win32"
129539
+ maxBuffer: 1024
129526
129540
  });
129527
129541
  const raw = stdout.trim();
129528
129542
  if (valid(raw) === null) throw new Error(`npm view 返回的版本号不是合法 semver: ${JSON.stringify(raw)}`);
@@ -129562,6 +129576,15 @@ function selectUpdateTarget(currentVersion, latest) {
129562
129576
  * Network-error detection with user-friendly Chinese prompts.
129563
129577
  */
129564
129578
  const INSTALL_TIMEOUT_MS = 3e5;
129579
+ /**
129580
+ * Resolve the npm executable name for the current platform.
129581
+ *
129582
+ * On Windows, `npm` is `npm.cmd` — a batch file Node can spawn directly
129583
+ * without `shell: true` (which would trigger DEP0190 when args are passed).
129584
+ */
129585
+ function npmExecutable() {
129586
+ return process.platform === "win32" ? "npm.cmd" : "npm";
129587
+ }
129565
129588
  const NETWORK_ERROR_PATTERNS = [
129566
129589
  /ETIMEDOUT/i,
129567
129590
  /ENOTFOUND/i,
@@ -129586,8 +129609,7 @@ async function runInstallStep(cmd, args, cwd, label, timeoutMs = INSTALL_TIMEOUT
129586
129609
  return new Promise((resolve) => {
129587
129610
  const child = spawn(cmd, args, {
129588
129611
  cwd,
129589
- stdio: "pipe",
129590
- shell: process.platform === "win32"
129612
+ stdio: "pipe"
129591
129613
  });
129592
129614
  let stderr = "";
129593
129615
  let settled = false;
@@ -129657,7 +129679,7 @@ async function handleUpdateCommand(host) {
129657
129679
  }
129658
129680
  host.showStatus(`正在更新到 ${target.version}...`);
129659
129681
  host.showStatus("正在通过 npm 安装最新版本...");
129660
- const result = await runInstallStep("npm", [
129682
+ const result = await runInstallStep(npmExecutable(), [
129661
129683
  "install",
129662
129684
  "-g",
129663
129685
  "scream-code@latest"
@@ -143325,7 +143347,21 @@ async function runStreamJson(opts) {
143325
143347
  const agentsMdPath = join(workDir, ".scream-code", "AGENTS.md");
143326
143348
  let originalAgentsMd;
143327
143349
  let injectedAgentsMd = false;
143328
- if (opts.appendSystemPrompt) {
143350
+ let appendPrompt = opts.appendSystemPrompt ?? "";
143351
+ if (opts.appendSystemPromptFile) try {
143352
+ const fileContent = await readFile(opts.appendSystemPromptFile, "utf-8");
143353
+ appendPrompt = appendPrompt ? `${appendPrompt}\n\n${fileContent}` : fileContent;
143354
+ log.info("stream-json: loaded append-system-prompt-file", {
143355
+ path: opts.appendSystemPromptFile,
143356
+ bytes: fileContent.length
143357
+ });
143358
+ } catch (error) {
143359
+ log.warn("stream-json: failed to read append-system-prompt-file", {
143360
+ path: opts.appendSystemPromptFile,
143361
+ error: String(error)
143362
+ });
143363
+ }
143364
+ if (appendPrompt) {
143329
143365
  try {
143330
143366
  originalAgentsMd = await readFile(agentsMdPath, "utf-8");
143331
143367
  } catch {}
@@ -143334,7 +143370,7 @@ async function runStreamJson(opts) {
143334
143370
  cc-connect send --image /absolute/path/to/image.png
143335
143371
  cc-connect send --file /absolute/path/to/file.pdf
143336
143372
  当用户要求你发送文件、截图、生成的图片时,使用 Bash 工具执行上述命令即可。
143337
- \n${opts.appendSystemPrompt}`;
143373
+ \n${appendPrompt}`;
143338
143374
  await writeFile(agentsMdPath, originalAgentsMd ? `${ccPrompt}\n\n${originalAgentsMd}` : ccPrompt, "utf-8");
143339
143375
  injectedAgentsMd = true;
143340
143376
  log.info("stream-json: injected cc-connect system prompt into AGENTS.md");
package/dist/main.mjs CHANGED
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
6
6
  import "./suppress-sqlite-warning-C2VB0doZ.mjs";
7
7
  //#region src/main.ts
8
8
  try {
9
- (await import("./app-DupTD-8y.mjs")).main();
9
+ (await import("./app-B-LM3p5x.mjs")).main();
10
10
  } catch (error) {
11
11
  process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
12
12
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scream-code",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "A terminal-native AI agent for builders",
5
5
  "license": "MIT",
6
6
  "author": "ScreamCli",