@chatcut/cli 0.0.0-stage → 0.1.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
@@ -1,3 +1,97 @@
1
- # Temporary Holding Version
1
+ # ChatCut CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The small command-line entry point for the official ChatCut Desktop app. It
4
+ contains no video editor, second MCP server, downloaded skills catalog, or
5
+ third-party runtime dependencies. Desktop owns editing, agent connections and
6
+ the skills shipped with that app version.
7
+
8
+ The `connect` entry point requires `@chatcut/cli` 0.1.1 or later. Merging source
9
+ changes alone does not publish a new npm version.
10
+
11
+ ```sh
12
+ npx --yes @chatcut/cli app
13
+
14
+ # Optional permanent command:
15
+ npm install --global @chatcut/cli
16
+ chatcut
17
+ chatcut app
18
+ ```
19
+
20
+ Node.js 22+ is required. Desktop supports macOS 13+ on Apple Silicon or Intel and
21
+ Windows x64. This launcher does not install a GUI on Linux or a headless server.
22
+
23
+ `chatcut` and `chatcut app` reuse an installed, signed production app. When it is
24
+ missing, they download the official artifact, validate its publisher, install it
25
+ for the current user when necessary, and request launch. Repeated calls preserve
26
+ the existing app, account and projects. Failed launch never triggers replacement.
27
+ macOS copies use a new staging bundle and rollback rather than merging bundles.
28
+ Windows uses the signed per-user NSIS installer. OS policy, missing privileges,
29
+ and signature assessment failures retain their original evidence.
30
+
31
+ ```sh
32
+ chatcut connect --json
33
+ chatcut connect --client codex --json
34
+ chatcut connect --client claude-code --json
35
+ chatcut doctor --json
36
+ chatcut doctor --client codex --json
37
+ chatcut doctor --fix --json
38
+ chatcut update --json
39
+ ```
40
+
41
+ `connect` is the agent setup entry point. It opens/installs Desktop, asks Desktop
42
+ to register or repair the supported agent integrations and sync its managed
43
+ skills, then verifies the local MCP connection with a real tool call. Tools are
44
+ provided over Desktop's MCP server. Use `--client` to select Codex or Claude Code;
45
+ without it, both supported integrations are considered. The command reuses
46
+ `doctor --fix`, including its standing opt-outs and preservation of custom skills.
47
+ Read the returned findings for skipped hosts or remaining actions; passing checks
48
+ does not mean an opted-out or unavailable host was connected. Start a new agent
49
+ conversation after connection or skill changes to load the current tools and skills.
50
+ JSON results identify this entry point with `command: "connect"`.
51
+
52
+ Doctor without `--fix` does not install or open Desktop or change agent settings.
53
+ It inspects a running Desktop through its authenticated user-scoped IPC, then
54
+ starts a fresh local MCP client, negotiates the protocol, lists tools and calls
55
+ `get_active_project`. An empty active project is valid. A cached list followed by
56
+ a failed tool call is a failed check. Desktop may serve MCP reads while its GUI
57
+ is closed; a working MCP probe does not establish that the GUI is running or that
58
+ the current host conversation has loaded its tools and skills.
59
+
60
+ `--fix` explicitly opens/installs Desktop, asks Desktop to repair the selected
61
+ supported integration(s), and checks the result. Desktop continues to own host
62
+ configuration and skill synchronization, including its standing opt-outs.
63
+ Unchanged manifest-owned obsolete skills can be removed. User-edited, foreign,
64
+ symlinked and ambiguous overlapping skills are preserved and reported. Different
65
+ client variants are intentional and must not be deduplicated by name alone.
66
+
67
+ Doctor reports original errors and remaining actions. Sign in within Desktop
68
+ when needed; start a new agent conversation after its connection or skill set
69
+ changes. A fresh diagnostic client cannot prove the current host's discovery
70
+ state. Older Desktop releases without the doctor IPC report an update requirement.
71
+
72
+ When a host CLI fails, Desktop reports its source error code and operation stage
73
+ and marks omitted command output explicitly. Inspect that host locally for the
74
+ remaining error text; an omitted message is an evidence gap, not a diagnosis.
75
+
76
+ `update` is explicit and separate from diagnosis. Close Desktop first; it never
77
+ forces a running editor to quit. It uses the official signed release, preserves
78
+ user data and refuses downgrades. Shared Windows installations use their existing
79
+ app updater or an interactive official installer.
80
+
81
+ `--json` writes one JSON result to stdout; progress goes to stderr. Exit 0 means
82
+ the requested operation completed or all required diagnostic checks passed.
83
+ Exit 1 retains the failing stage, original cause and remaining action. Informative
84
+ opt-outs, unavailable optional hosts and preserved custom skills are not failures.
85
+
86
+ The historical `@chatcut/skill` package also exports a `chatcut` executable for its
87
+ cloud job workflow. Use `npx --yes @chatcut/cli ...` without changing that install,
88
+ or explicitly remove the old global package before installing this one globally.
89
+ Do not use `--force` to overwrite another package's executable. Its saved cloud
90
+ credentials and jobs are not migrated or deleted by this CLI.
91
+
92
+ For contributors: run `npm test` and `npm pack --dry-run` from this directory.
93
+ Native install/trust boundaries have deterministic fixtures on macOS, Windows
94
+ and Linux CI; actual publisher validation and a real installation remain separate
95
+ release acceptance evidence. Publish with the organization's npm release identity
96
+ after review, inspect the tarball, and verify the published `npx` entry point on a
97
+ clean supported machine before advertising availability.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "../src/cli.mjs";
3
+
4
+ process.exitCode = await runCli(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,27 @@
1
1
  {
2
2
  "name": "@chatcut/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Install, open, diagnose and repair ChatCut Desktop",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "chatcut": "bin/chatcut.mjs"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "README.md"
13
+ ],
14
+ "type": "module",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "test": "node --test",
20
+ "check-types": "node --check bin/chatcut.mjs && node --check src/cli.mjs && node --check src/doctor.mjs && node --check src/rpc.mjs && node --check src/desktop.mjs",
21
+ "lint": "oxlint src bin tests",
22
+ "pack:check": "npm pack --dry-run"
23
+ },
24
+ "engines": {
25
+ "node": ">=22"
26
+ }
27
+ }
package/src/cli.mjs ADDED
@@ -0,0 +1,116 @@
1
+ import { parseArgs } from "node:util";
2
+
3
+ import packageInfo from "../package.json" with { type: "json" };
4
+ import { ensureDesktop, updateDesktop } from "./desktop.mjs";
5
+ import { errorEvidence, runDoctor } from "./doctor.mjs";
6
+
7
+ const HELP = `ChatCut — your desktop video editor
8
+
9
+ Usage:
10
+ chatcut Open Desktop; install it if needed
11
+ chatcut app Same as chatcut
12
+ chatcut connect [--json] Open Desktop, connect agents and sync skills
13
+ chatcut doctor [--json] Check Desktop, MCP and managed skills
14
+ chatcut doctor --fix [--json] Repair supported connection and skill issues
15
+ chatcut update [--json] Update Desktop after closing it
16
+
17
+ Options:
18
+ --client codex|claude-code Limit connect or doctor to one integration
19
+ --json Write one structured result to stdout
20
+ --help Show help without opening Desktop
21
+ --version Show CLI version
22
+
23
+ First use: npx --yes @chatcut/cli app
24
+ Desktop supports macOS 13+ and Windows x64. Node.js 22+ is required for this CLI.
25
+ `;
26
+
27
+ export async function runCli(args, dependencies = {}) {
28
+ const stdout = dependencies.stdout ?? process.stdout;
29
+ const stderr = dependencies.stderr ?? process.stderr;
30
+ let json = args.includes("--json");
31
+ try {
32
+ const { positionals, values } = parseArgs({
33
+ allowPositionals: true,
34
+ args,
35
+ options: {
36
+ client: { type: "string" },
37
+ fix: { type: "boolean" },
38
+ help: { short: "h", type: "boolean" },
39
+ json: { type: "boolean" },
40
+ version: { short: "v", type: "boolean" },
41
+ },
42
+ });
43
+ json = !!values.json;
44
+ if (values.help || positionals[0] === "help") {
45
+ stdout.write(HELP);
46
+ return 0;
47
+ }
48
+ if (values.version) {
49
+ stdout.write(`${packageInfo.version}\n`);
50
+ return 0;
51
+ }
52
+ const command = positionals[0] ?? "app";
53
+ if (
54
+ positionals.length > 1 ||
55
+ !["app", "connect", "doctor", "update"].includes(command)
56
+ )
57
+ throw new Error("Unknown command. Run chatcut --help.");
58
+ if (values.fix && command !== "doctor")
59
+ throw new Error("--fix applies only to chatcut doctor.");
60
+ if (values.client && !["connect", "doctor"].includes(command))
61
+ throw new Error("--client applies only to chatcut connect or doctor.");
62
+ if (values.client && !["claude-code", "codex"].includes(values.client))
63
+ throw new Error("--client must be codex or claude-code.");
64
+ const options = {
65
+ onProgress: (entry) =>
66
+ stderr.write(`${typeof entry === "string" ? entry : entry.message}\n`),
67
+ };
68
+ let result;
69
+ if (command === "doctor" || command === "connect") {
70
+ result = await (dependencies.doctor ?? runDoctor)({
71
+ ...options,
72
+ client: values.client,
73
+ fix: command === "connect" || !!values.fix,
74
+ });
75
+ result = { ...result, command };
76
+ } else {
77
+ const desktop = await (
78
+ command === "app"
79
+ ? (dependencies.ensure ?? ensureDesktop)
80
+ : (dependencies.update ?? updateDesktop)
81
+ )(options);
82
+ result = { command, desktop, ok: true, schemaVersion: 1 };
83
+ }
84
+ if (json) stdout.write(`${JSON.stringify(result)}\n`);
85
+ else if (command === "doctor" || command === "connect") {
86
+ stdout.write(
87
+ command === "connect"
88
+ ? `ChatCut Connect: ${result.ok ? "checks passed" : "issues found"}\n`
89
+ : `ChatCut Doctor: ${result.ok ? "healthy" : "issues found"}\n`,
90
+ );
91
+ for (const check of result.checks)
92
+ stdout.write(
93
+ `${check.status === "pass" ? "OK" : "FAIL"} ${check.message}${check.error ? ` ${check.error.message ?? check.error}` : ""}\n`,
94
+ );
95
+ for (const finding of result.findings)
96
+ stdout.write(`INFO ${finding.message}\n`);
97
+ for (const change of result.repair?.changes ?? [])
98
+ stdout.write(`FIXED ${change}\n`);
99
+ if (!result.ok)
100
+ stdout.write(
101
+ "Run chatcut doctor --fix for supported repairs. Sign-in and agent-session reloads may still be needed.\n",
102
+ );
103
+ } else
104
+ stdout.write(
105
+ command === "app"
106
+ ? "ChatCut launch requested. Run chatcut doctor to check the agent connection.\n"
107
+ : `ChatCut Desktop: ${result.desktop.action}.\n`,
108
+ );
109
+ return result.ok ? 0 : 1;
110
+ } catch (error) {
111
+ const result = { error: errorEvidence(error), ok: false, schemaVersion: 1 };
112
+ if (json) stdout.write(`${JSON.stringify(result)}\n`);
113
+ else stderr.write(`ChatCut: ${result.error.message}\n`);
114
+ return 1;
115
+ }
116
+ }