@ccode-si/cli 1.11.1 → 1.12.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.
package/README.md CHANGED
@@ -35,10 +35,12 @@ ccode update # install the newest version
35
35
  - Reads images and PDFs, searches the web and fetches pages.
36
36
  - Plans multi-step work as a task list you can follow as it goes.
37
37
  - `@` attaches files to a message, `ctrl+v` pastes an image from the clipboard; messages typed while it works are queued.
38
+ - `/background` sends a session to the background and gives you the terminal back: it keeps working, and `ccode --resume <id>` or `/session` picks it up again (macOS and Linux).
38
39
 
39
40
  **You stay in control**
40
41
  - Four permission modes, cycled with `shift+tab`: **Auto**, **Accept edits**, **Manual** and **Plan** (read-only: it explores and proposes a plan for you to approve).
41
42
  - Allow or deny rules for commands, paths, tools and websites, kept in your own settings.
43
+ - A permission ask shows what it would change — the diff, or the new file — before you say yes.
42
44
  - A repository you open can't grant itself permissions, change your model or start servers without your approval.
43
45
 
44
46
  **Nothing is lost**
package/bin/ccode.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // Runs the CCode binary from the platform package npm installed for this machine.
3
3
  "use strict";
4
- const { spawnSync } = require("node:child_process");
4
+ const { spawn, spawnSync } = require("node:child_process");
5
5
  const { join, dirname } = require("node:path");
6
6
 
7
7
  const target = `${process.platform}-${process.arch}`;
@@ -19,13 +19,37 @@ try {
19
19
  if (process.platform === "win32") removeLeftovers();
20
20
  // Here to take over "ccode update" on Windows (see updateFromHere).
21
21
  const env = { ...process.env, CCODE_UPDATE_HANDOFF: "1" };
22
- const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit", env });
23
- if (result.error) {
24
- console.error(result.error.message);
22
+ // /background: CCode says "detach" on fd 3 when it goes on in the
23
+ // background — this launcher exits then, and the shell has its terminal back.
24
+ const posix = process.platform !== "win32";
25
+ if (posix) env.CCODE_DETACH_FD = "3";
26
+ const child = spawn(binary, process.argv.slice(2), { stdio: posix ? ["inherit", "inherit", "inherit", "pipe"] : "inherit", env });
27
+ child.on("error", (err) => {
28
+ console.error(err.message);
25
29
  process.exit(1);
30
+ });
31
+ if (posix) {
32
+ let said = "";
33
+ child.stdio[3].on("data", (chunk) => {
34
+ said += String(chunk);
35
+ if (said.includes("detach")) process.exit(0);
36
+ });
37
+ child.stdio[3].on("error", () => {});
26
38
  }
27
- if (process.platform === "win32" && process.argv[2] === "update" && result.status === 75) process.exit(updateFromHere());
28
- process.exit(result.status ?? (result.signal ? 1 : 0));
39
+ // Keys like ctrl+c reach CCode itself (it's in the same process group): the
40
+ // launcher waits for it. A stop meant for the launcher is passed on — and so
41
+ // is a hang-up (the terminal closed): it may reach only the launcher, and
42
+ // CCode must hear it (background sessions go back to the background then).
43
+ process.on("SIGINT", () => {});
44
+ if (posix) {
45
+ process.on("SIGQUIT", () => {});
46
+ process.on("SIGHUP", () => child.kill("SIGHUP"));
47
+ process.on("SIGTERM", () => child.kill("SIGTERM"));
48
+ }
49
+ child.on("exit", (status, signal) => {
50
+ if (process.platform === "win32" && process.argv[2] === "update" && status === 75) process.exit(updateFromHere());
51
+ process.exit(status ?? (signal ? 1 : 0));
52
+ });
29
53
 
30
54
  /**
31
55
  * Windows keeps a running program's files locked, so an update npm ran
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccode-si/cli",
3
- "version": "1.11.1",
3
+ "version": "1.12.1",
4
4
  "description": "CCode — a coding agent for your terminal.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {
@@ -15,11 +15,11 @@
15
15
  "node": ">=18"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@ccode-si/cli-darwin-arm64": "1.11.1",
19
- "@ccode-si/cli-darwin-x64": "1.11.1",
20
- "@ccode-si/cli-win32-x64": "1.11.1",
21
- "@ccode-si/cli-win32-arm64": "1.11.1",
22
- "@ccode-si/cli-linux-x64": "1.11.1",
23
- "@ccode-si/cli-linux-arm64": "1.11.1"
18
+ "@ccode-si/cli-darwin-arm64": "1.12.1",
19
+ "@ccode-si/cli-darwin-x64": "1.12.1",
20
+ "@ccode-si/cli-win32-x64": "1.12.1",
21
+ "@ccode-si/cli-win32-arm64": "1.12.1",
22
+ "@ccode-si/cli-linux-x64": "1.12.1",
23
+ "@ccode-si/cli-linux-arm64": "1.12.1"
24
24
  }
25
25
  }