setup-cc-room 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.
- package/dist/chunk-6SYATEI6.js +108 -0
- package/dist/chunk-AVDOC76K.js +116 -0
- package/dist/chunk-ETJNYBPF.js +116 -0
- package/dist/chunk-KEFBOTQD.js +22 -0
- package/dist/chunk-LMBNCW4L.js +142 -0
- package/dist/chunk-MSQUTURC.js +119 -0
- package/dist/chunk-MVD6RIS2.js +120 -0
- package/dist/chunk-OYW7MM4W.js +278 -0
- package/dist/chunk-RYVZHEHF.js +169 -0
- package/dist/chunk-SMSDMP5O.js +125 -0
- package/dist/chunk-ZDOKJ4KX.js +132 -0
- package/dist/daemon-resolver.d.ts +1 -1
- package/dist/daemon-resolver.js +1 -1
- package/dist/i18n.d.ts +7 -0
- package/dist/i18n.js +12 -0
- package/dist/index.js +73 -38
- package/dist/installer.d.ts +5 -2
- package/dist/installer.js +9 -6
- package/dist/register-service.js +2 -1
- package/dist/settings-merger.d.ts +4 -1
- package/dist/settings-merger.js +8 -3
- package/dist/uninstaller.d.ts +10 -0
- package/dist/uninstaller.js +23 -0
- package/dist/validators.js +2 -1
- package/package.json +2 -2
- package/vendor/commands/room/en/private.md +75 -0
- package/vendor/commands/room/en/room.md +475 -0
- package/vendor/commands/room/en/show.md +149 -0
- /package/vendor/commands/room/{private.md → ja/private.md} +0 -0
- /package/vendor/commands/room/{room.md → ja/room.md} +0 -0
- /package/vendor/commands/room/{show.md → ja/show.md} +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveDaemonSource
|
|
3
|
+
} from "./chunk-KEFBOTQD.js";
|
|
4
|
+
import {
|
|
5
|
+
registerService
|
|
6
|
+
} from "./chunk-ZDOKJ4KX.js";
|
|
7
|
+
import {
|
|
8
|
+
resolveCcRoomDir
|
|
9
|
+
} from "./chunk-WCEABGOA.js";
|
|
10
|
+
import {
|
|
11
|
+
mergeSettings
|
|
12
|
+
} from "./chunk-MVD6RIS2.js";
|
|
13
|
+
import {
|
|
14
|
+
t
|
|
15
|
+
} from "./chunk-OYW7MM4W.js";
|
|
16
|
+
|
|
17
|
+
// src/installer.ts
|
|
18
|
+
import {
|
|
19
|
+
mkdirSync,
|
|
20
|
+
writeFileSync,
|
|
21
|
+
existsSync,
|
|
22
|
+
copyFileSync,
|
|
23
|
+
chmodSync,
|
|
24
|
+
unlinkSync
|
|
25
|
+
} from "fs";
|
|
26
|
+
import { join, dirname } from "path";
|
|
27
|
+
import { homedir } from "os";
|
|
28
|
+
import { execFileSync, spawnSync } from "child_process";
|
|
29
|
+
import { fileURLToPath } from "url";
|
|
30
|
+
import { stringify } from "yaml";
|
|
31
|
+
var CC_ROOM_DIR = resolveCcRoomDir();
|
|
32
|
+
var BIN_DIR = join(CC_ROOM_DIR, "bin");
|
|
33
|
+
var CONFIG_PATH = join(CC_ROOM_DIR, "config.yaml");
|
|
34
|
+
var COMMANDS_DIR = join(homedir(), ".claude", "commands");
|
|
35
|
+
var THIS_DIR = dirname(fileURLToPath(import.meta.url));
|
|
36
|
+
var SETUP_PACKAGE_ROOT = join(THIS_DIR, "..");
|
|
37
|
+
function getGitUserName() {
|
|
38
|
+
try {
|
|
39
|
+
return execFileSync("git", ["config", "user.name"], { encoding: "utf-8", stdio: "pipe" }).trim();
|
|
40
|
+
} catch {
|
|
41
|
+
return "unknown";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function resolveCommandSources(setupPackageRoot, locale) {
|
|
45
|
+
const candidates = [
|
|
46
|
+
join(setupPackageRoot, "vendor", "commands", "room", locale),
|
|
47
|
+
join(setupPackageRoot, "..", "commands", "room", locale),
|
|
48
|
+
// legacy flat layout (pre-i18n)
|
|
49
|
+
join(setupPackageRoot, "vendor", "commands", "room"),
|
|
50
|
+
join(setupPackageRoot, "..", "commands", "room")
|
|
51
|
+
];
|
|
52
|
+
for (const dir of candidates) {
|
|
53
|
+
if (existsSync(join(dir, "room.md"))) return dir;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
async function install(locale = "en") {
|
|
58
|
+
console.log(t("install.step1", { dir: CC_ROOM_DIR }));
|
|
59
|
+
mkdirSync(BIN_DIR, { recursive: true });
|
|
60
|
+
const daemonSrc = resolveDaemonSource(SETUP_PACKAGE_ROOT);
|
|
61
|
+
const daemonDest = join(BIN_DIR, "cc-room-daemon");
|
|
62
|
+
if (daemonSrc) {
|
|
63
|
+
copyFileSync(daemonSrc, daemonDest);
|
|
64
|
+
chmodSync(daemonDest, 493);
|
|
65
|
+
console.log(t("install.copied", { path: daemonDest }));
|
|
66
|
+
} else {
|
|
67
|
+
const globalBin = spawnSync("which", ["cc-room-daemon"], { encoding: "utf-8" });
|
|
68
|
+
if (globalBin.status === 0) {
|
|
69
|
+
console.log(t("install.global_ok", { path: globalBin.stdout.trim() }));
|
|
70
|
+
} else {
|
|
71
|
+
console.log(` \x1B[33m\u26A0 ${t("daemon.missing")}\x1B[0m`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
console.log(t("install.step2", { path: CONFIG_PATH }));
|
|
75
|
+
if (!existsSync(CONFIG_PATH)) {
|
|
76
|
+
const identity = getGitUserName();
|
|
77
|
+
const config = {
|
|
78
|
+
identity: { name: identity },
|
|
79
|
+
ui: { locale },
|
|
80
|
+
network: { port: 7331, http_port: 7332 },
|
|
81
|
+
trust: [],
|
|
82
|
+
sessions: { default_mode: "approve", share_files: true, share_context: true },
|
|
83
|
+
privacy: {
|
|
84
|
+
public_tools: ["room_context", "room_messages", "room_files", "room_status", "room_invite", "room_share"],
|
|
85
|
+
private_patterns: [],
|
|
86
|
+
redact_after_private_tool: true
|
|
87
|
+
},
|
|
88
|
+
summarizer: { model: "claude-haiku-4-5-20251001", interval_turns: 5, interval_seconds: 30 },
|
|
89
|
+
storage: { max_bytes: 524288e3, artifact_ttl_days: 30, context_ttl_days: 7, message_ttl_days: 14 }
|
|
90
|
+
};
|
|
91
|
+
writeFileSync(CONFIG_PATH, stringify(config), { mode: 384 });
|
|
92
|
+
console.log(t("install.config_created", { path: CONFIG_PATH, identity }));
|
|
93
|
+
} else {
|
|
94
|
+
console.log(t("install.config_skip", { path: CONFIG_PATH }));
|
|
95
|
+
}
|
|
96
|
+
console.log(t("install.step3", { locale }));
|
|
97
|
+
mkdirSync(COMMANDS_DIR, { recursive: true });
|
|
98
|
+
const commandFiles = ["room.md", "private.md", "show.md"];
|
|
99
|
+
const legacyFiles = ["invite.md", "join.md", "leave.md", "files.md", "remember.md", "share.md"];
|
|
100
|
+
const commandsSrcDir = resolveCommandSources(SETUP_PACKAGE_ROOT, locale);
|
|
101
|
+
if (!commandsSrcDir) {
|
|
102
|
+
throw new Error(`Command source directory not found for locale=${locale}`);
|
|
103
|
+
}
|
|
104
|
+
for (const cmd of commandFiles) {
|
|
105
|
+
const src = join(commandsSrcDir, cmd);
|
|
106
|
+
if (!existsSync(src)) throw new Error(`Command source file not found: ${src}`);
|
|
107
|
+
copyFileSync(src, join(COMMANDS_DIR, cmd));
|
|
108
|
+
}
|
|
109
|
+
for (const legacy of legacyFiles) {
|
|
110
|
+
const dest = join(COMMANDS_DIR, legacy);
|
|
111
|
+
if (existsSync(dest)) {
|
|
112
|
+
unlinkSync(dest);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
console.log(t("install.commands_ok", { count: commandFiles.length, dir: COMMANDS_DIR }));
|
|
116
|
+
console.log(t("install.step4"));
|
|
117
|
+
mergeSettings();
|
|
118
|
+
console.log(t("install.step5"));
|
|
119
|
+
await registerService();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
resolveCommandSources,
|
|
124
|
+
install
|
|
125
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveCcRoomDir
|
|
3
|
+
} from "./chunk-WCEABGOA.js";
|
|
4
|
+
import {
|
|
5
|
+
t
|
|
6
|
+
} from "./chunk-OYW7MM4W.js";
|
|
7
|
+
|
|
8
|
+
// src/register-service.ts
|
|
9
|
+
import { writeFileSync, mkdirSync, existsSync } from "fs";
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import { homedir, platform } from "os";
|
|
12
|
+
import { execFileSync } from "child_process";
|
|
13
|
+
var CC_ROOM_DIR = resolveCcRoomDir();
|
|
14
|
+
function getDaemonBinPath() {
|
|
15
|
+
try {
|
|
16
|
+
const which = execFileSync("which", ["cc-room-daemon"], { encoding: "utf-8", stdio: "pipe" }).trim();
|
|
17
|
+
if (which) return which;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
return join(CC_ROOM_DIR, "bin", "cc-room-daemon");
|
|
21
|
+
}
|
|
22
|
+
function ccRoomHomeEnvXml() {
|
|
23
|
+
if (!process.env.CC_ROOM_HOME) return "";
|
|
24
|
+
return `
|
|
25
|
+
<key>CC_ROOM_HOME</key>
|
|
26
|
+
<string>${process.env.CC_ROOM_HOME}</string>`;
|
|
27
|
+
}
|
|
28
|
+
function registerLaunchd() {
|
|
29
|
+
const plistDir = join(homedir(), "Library", "LaunchAgents");
|
|
30
|
+
const plistPath = join(plistDir, "dev.ccroom.daemon.plist");
|
|
31
|
+
const daemonBin = getDaemonBinPath();
|
|
32
|
+
const logPath = join(CC_ROOM_DIR, "logs", "daemon.log");
|
|
33
|
+
mkdirSync(join(CC_ROOM_DIR, "logs"), { recursive: true });
|
|
34
|
+
mkdirSync(plistDir, { recursive: true });
|
|
35
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
36
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
37
|
+
<plist version="1.0">
|
|
38
|
+
<dict>
|
|
39
|
+
<key>Label</key>
|
|
40
|
+
<string>dev.ccroom.daemon</string>
|
|
41
|
+
<key>ProgramArguments</key>
|
|
42
|
+
<array>
|
|
43
|
+
<string>${daemonBin}</string>
|
|
44
|
+
</array>
|
|
45
|
+
<key>KeepAlive</key>
|
|
46
|
+
<true/>
|
|
47
|
+
<key>RunAtLoad</key>
|
|
48
|
+
<true/>
|
|
49
|
+
<key>StandardOutPath</key>
|
|
50
|
+
<string>${logPath}</string>
|
|
51
|
+
<key>StandardErrorPath</key>
|
|
52
|
+
<string>${logPath}</string>
|
|
53
|
+
<key>EnvironmentVariables</key>
|
|
54
|
+
<dict>
|
|
55
|
+
<key>PATH</key>
|
|
56
|
+
<string>/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>${ccRoomHomeEnvXml()}
|
|
57
|
+
</dict>
|
|
58
|
+
</dict>
|
|
59
|
+
</plist>
|
|
60
|
+
`;
|
|
61
|
+
writeFileSync(plistPath, plist, { mode: 420 });
|
|
62
|
+
try {
|
|
63
|
+
execFileSync("launchctl", ["unload", plistPath], { stdio: "pipe" });
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
execFileSync("launchctl", ["load", plistPath], { stdio: "pipe" });
|
|
68
|
+
console.log(t("svc.launchd_ok", { path: plistPath }));
|
|
69
|
+
} catch (err) {
|
|
70
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
71
|
+
console.log(t("svc.launchd_fail", { msg }));
|
|
72
|
+
console.log(t("svc.launchd_manual", { path: plistPath }));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function registerSystemd() {
|
|
76
|
+
const serviceDir = join(homedir(), ".config", "systemd", "user");
|
|
77
|
+
const servicePath = join(serviceDir, "cc-room-daemon.service");
|
|
78
|
+
const daemonBin = getDaemonBinPath();
|
|
79
|
+
const logPath = join(CC_ROOM_DIR, "logs", "daemon.log");
|
|
80
|
+
mkdirSync(join(CC_ROOM_DIR, "logs"), { recursive: true });
|
|
81
|
+
mkdirSync(serviceDir, { recursive: true });
|
|
82
|
+
const envLine = process.env.CC_ROOM_HOME ? `Environment=CC_ROOM_HOME=${process.env.CC_ROOM_HOME}
|
|
83
|
+
` : "";
|
|
84
|
+
const unit = `[Unit]
|
|
85
|
+
Description=cc-room daemon
|
|
86
|
+
After=network.target
|
|
87
|
+
|
|
88
|
+
[Service]
|
|
89
|
+
ExecStart=${daemonBin}
|
|
90
|
+
Restart=on-failure
|
|
91
|
+
RestartSec=5
|
|
92
|
+
${envLine}StandardOutput=append:${logPath}
|
|
93
|
+
StandardError=append:${logPath}
|
|
94
|
+
|
|
95
|
+
[Install]
|
|
96
|
+
WantedBy=default.target
|
|
97
|
+
`;
|
|
98
|
+
writeFileSync(servicePath, unit, { mode: 420 });
|
|
99
|
+
try {
|
|
100
|
+
execFileSync("systemctl", ["--user", "daemon-reload"], { stdio: "pipe" });
|
|
101
|
+
execFileSync("systemctl", ["--user", "enable", "--now", "cc-room-daemon"], { stdio: "pipe" });
|
|
102
|
+
console.log(t("svc.systemd_ok", { path: servicePath }));
|
|
103
|
+
} catch (err) {
|
|
104
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
105
|
+
console.log(t("svc.systemd_fail", { msg }));
|
|
106
|
+
console.log(t("svc.systemd_manual"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function registerService() {
|
|
110
|
+
const os = platform();
|
|
111
|
+
if (os === "darwin") {
|
|
112
|
+
registerLaunchd();
|
|
113
|
+
} else if (os === "linux") {
|
|
114
|
+
registerSystemd();
|
|
115
|
+
} else {
|
|
116
|
+
console.log(t("svc.unsupported", { os }));
|
|
117
|
+
}
|
|
118
|
+
const pidPath = join(CC_ROOM_DIR, "daemon.pid");
|
|
119
|
+
if (!existsSync(pidPath)) {
|
|
120
|
+
console.log(t("svc.waiting"));
|
|
121
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
122
|
+
}
|
|
123
|
+
if (existsSync(pidPath)) {
|
|
124
|
+
console.log(t("svc.started"));
|
|
125
|
+
} else {
|
|
126
|
+
console.log(t("svc.start_unconfirmed"));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
registerService
|
|
132
|
+
};
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* 優先: vendor 同梱(npm / pack:vendor)→ ローカル dist-bundle
|
|
4
4
|
*/
|
|
5
5
|
declare function resolveDaemonSource(setupPackageRoot: string): string | null;
|
|
6
|
-
declare const DAEMON_MISSING_HINT = "cc-room-daemon
|
|
6
|
+
declare const DAEMON_MISSING_HINT = "cc-room-daemon not found. In the repo run `pnpm --filter setup-cc-room run pack:vendor`, or use the npm setup-cc-room package.";
|
|
7
7
|
|
|
8
8
|
export { DAEMON_MISSING_HINT, resolveDaemonSource };
|
package/dist/daemon-resolver.js
CHANGED
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type Locale = "en" | "ja";
|
|
2
|
+
declare function resolveLocale(argv?: string[], env?: NodeJS.ProcessEnv): Locale;
|
|
3
|
+
declare function setLocale(locale: Locale): void;
|
|
4
|
+
declare function getLocale(): Locale;
|
|
5
|
+
declare function t(key: string, vars?: Record<string, string | number>): string;
|
|
6
|
+
|
|
7
|
+
export { type Locale, getLocale, resolveLocale, setLocale, t };
|
package/dist/i18n.js
ADDED
package/dist/index.js
CHANGED
|
@@ -1,57 +1,92 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
printResults,
|
|
4
|
+
validateAll
|
|
5
|
+
} from "./chunk-RYVZHEHF.js";
|
|
2
6
|
import {
|
|
3
7
|
install
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-SMSDMP5O.js";
|
|
9
|
+
import "./chunk-KEFBOTQD.js";
|
|
10
|
+
import "./chunk-ZDOKJ4KX.js";
|
|
11
|
+
import {
|
|
12
|
+
uninstall
|
|
13
|
+
} from "./chunk-MSQUTURC.js";
|
|
7
14
|
import "./chunk-WCEABGOA.js";
|
|
8
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-MVD6RIS2.js";
|
|
9
16
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
getLocale,
|
|
18
|
+
resolveLocale,
|
|
19
|
+
setLocale,
|
|
20
|
+
t
|
|
21
|
+
} from "./chunk-OYW7MM4W.js";
|
|
13
22
|
|
|
14
23
|
// src/index.ts
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
var VERSION = "0.2.2";
|
|
25
|
+
function stripLangArgs(argv) {
|
|
26
|
+
const out = [];
|
|
27
|
+
for (let i = 0; i < argv.length; i++) {
|
|
28
|
+
const a = argv[i];
|
|
29
|
+
if (a === "--lang" || a === "--locale") {
|
|
30
|
+
i++;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (a.startsWith("--lang=") || a.startsWith("--locale=")) continue;
|
|
34
|
+
out.push(a);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function printHelp() {
|
|
39
|
+
console.log(t("cli.help", { version: VERSION }));
|
|
40
|
+
}
|
|
41
|
+
async function runInstall() {
|
|
42
|
+
console.log(`
|
|
43
|
+
\u{1F3E0} setup-cc-room v${VERSION}
|
|
44
|
+
`);
|
|
45
|
+
console.log(t("cli.running_preflight"));
|
|
18
46
|
const { passed, results } = validateAll();
|
|
19
47
|
printResults(results);
|
|
20
48
|
if (!passed) {
|
|
21
|
-
console.log("
|
|
49
|
+
console.log(t("cli.preflight_failed"));
|
|
22
50
|
process.exit(1);
|
|
23
51
|
}
|
|
24
|
-
console.log("
|
|
25
|
-
await install();
|
|
52
|
+
console.log(t("cli.preflight_ok"));
|
|
53
|
+
await install(getLocale());
|
|
26
54
|
console.log(`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
1. Claude Code \u3092\u518D\u8D77\u52D5
|
|
39
|
-
2. /room join <name> <PIN> \u2190 \u76F8\u624B\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u5024\u3092\u5165\u529B
|
|
40
|
-
|
|
41
|
-
\u3010\u65E5\u5E38\u64CD\u4F5C\u3011
|
|
42
|
-
/room \u2026 \u30DB\u30EF\u30A4\u30C8\u30DC\u30FC\u30C9\u3092\u898B\u308B
|
|
43
|
-
/private \u2026 \u72B6\u614B\u8868\u793A\u3001\u624B\u5143/\u516C\u958B\u306E\u5207\u66FF\uFF08on|off|share|drop\uFF09
|
|
44
|
-
|
|
45
|
-
\u26A0\uFE0F cc-room \u306F\u81EA\u52D5\u3067\u76F8\u624B\u306B\u901A\u77E5\u3057\u307E\u305B\u3093\u3002
|
|
46
|
-
\u90E8\u5C4B\u540D\u3068 PIN \u306F\u81EA\u5206\u3067\u76F8\u624B\u306B\u4F1D\u3048\u3066\u304F\u3060\u3055\u3044\u3002
|
|
47
|
-
|
|
48
|
-
\u63A5\u7D9A\u5F8C\u306F\u540C\u3058 WiFi\uFF08LAN\uFF09\u5185\u306B\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
|
|
49
|
-
\uFF08VPN \u3067\u540C\u4E00 LAN \u76F8\u5F53\u306B\u306A\u308C\u3070\u30EA\u30E2\u30FC\u30C8\u3067\u3082\u4F7F\u3048\u307E\u3059\uFF09
|
|
55
|
+
${t("cli.install_done")}
|
|
56
|
+
${t("cli.install_guide")}
|
|
57
|
+
`);
|
|
58
|
+
}
|
|
59
|
+
async function runUninstall() {
|
|
60
|
+
console.log(`
|
|
61
|
+
\u{1F3E0} setup-cc-room v${VERSION} \u2014 uninstall
|
|
62
|
+
`);
|
|
63
|
+
await uninstall();
|
|
64
|
+
console.log(`
|
|
65
|
+
${t("cli.uninstall_done")}
|
|
50
66
|
|
|
51
|
-
|
|
67
|
+
${t("cli.restart_claude")}
|
|
52
68
|
`);
|
|
53
69
|
}
|
|
70
|
+
async function main() {
|
|
71
|
+
setLocale(resolveLocale(process.argv, process.env));
|
|
72
|
+
const args = stripLangArgs(process.argv.slice(2));
|
|
73
|
+
const arg = args[0];
|
|
74
|
+
if (arg === "--help" || arg === "-h" || arg === "help") {
|
|
75
|
+
printHelp();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (arg === "uninstall" || arg === "--uninstall") {
|
|
79
|
+
await runUninstall();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (arg && arg !== "install") {
|
|
83
|
+
console.error(t("cli.unknown_arg", { arg }));
|
|
84
|
+
printHelp();
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
await runInstall();
|
|
88
|
+
}
|
|
54
89
|
main().catch((err) => {
|
|
55
|
-
console.error("
|
|
90
|
+
console.error(t("cli.error"), err instanceof Error ? err.message : err);
|
|
56
91
|
process.exit(1);
|
|
57
92
|
});
|
package/dist/installer.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Locale } from './i18n.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
declare function resolveCommandSources(setupPackageRoot: string, locale: Locale): string | null;
|
|
4
|
+
declare function install(locale?: Locale): Promise<void>;
|
|
5
|
+
|
|
6
|
+
export { install, resolveCommandSources };
|
package/dist/installer.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
install
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "./chunk-
|
|
2
|
+
install,
|
|
3
|
+
resolveCommandSources
|
|
4
|
+
} from "./chunk-SMSDMP5O.js";
|
|
5
|
+
import "./chunk-KEFBOTQD.js";
|
|
6
|
+
import "./chunk-ZDOKJ4KX.js";
|
|
6
7
|
import "./chunk-WCEABGOA.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-MVD6RIS2.js";
|
|
9
|
+
import "./chunk-OYW7MM4W.js";
|
|
8
10
|
export {
|
|
9
|
-
install
|
|
11
|
+
install,
|
|
12
|
+
resolveCommandSources
|
|
10
13
|
};
|
package/dist/register-service.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
declare function mergeSettings(): void;
|
|
2
|
+
/** settings.json から cc-room の hooks / mcpServers を除去(他設定は保持) */
|
|
3
|
+
declare function stripCcRoomFromSettings(settings: Record<string, unknown>): Record<string, unknown>;
|
|
4
|
+
declare function unmergeSettings(): void;
|
|
2
5
|
|
|
3
|
-
export { mergeSettings };
|
|
6
|
+
export { mergeSettings, stripCcRoomFromSettings, unmergeSettings };
|
package/dist/settings-merger.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
mergeSettings
|
|
3
|
-
|
|
2
|
+
mergeSettings,
|
|
3
|
+
stripCcRoomFromSettings,
|
|
4
|
+
unmergeSettings
|
|
5
|
+
} from "./chunk-MVD6RIS2.js";
|
|
6
|
+
import "./chunk-OYW7MM4W.js";
|
|
4
7
|
export {
|
|
5
|
-
mergeSettings
|
|
8
|
+
mergeSettings,
|
|
9
|
+
stripCcRoomFromSettings,
|
|
10
|
+
unmergeSettings
|
|
6
11
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function getLaunchdPlistPath(home?: string): string;
|
|
2
|
+
declare function getSystemdUnitPath(home?: string): string;
|
|
3
|
+
declare function stopLaunchd(plistPath: string): void;
|
|
4
|
+
declare function stopSystemd(unitPath: string): void;
|
|
5
|
+
declare function removeCommandFiles(commandsDir: string): void;
|
|
6
|
+
declare function removeCcRoomData(ccRoomDir: string): void;
|
|
7
|
+
declare function stopOrphanDaemon(): void;
|
|
8
|
+
declare function uninstall(): Promise<void>;
|
|
9
|
+
|
|
10
|
+
export { getLaunchdPlistPath, getSystemdUnitPath, removeCcRoomData, removeCommandFiles, stopLaunchd, stopOrphanDaemon, stopSystemd, uninstall };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLaunchdPlistPath,
|
|
3
|
+
getSystemdUnitPath,
|
|
4
|
+
removeCcRoomData,
|
|
5
|
+
removeCommandFiles,
|
|
6
|
+
stopLaunchd,
|
|
7
|
+
stopOrphanDaemon,
|
|
8
|
+
stopSystemd,
|
|
9
|
+
uninstall
|
|
10
|
+
} from "./chunk-MSQUTURC.js";
|
|
11
|
+
import "./chunk-WCEABGOA.js";
|
|
12
|
+
import "./chunk-MVD6RIS2.js";
|
|
13
|
+
import "./chunk-OYW7MM4W.js";
|
|
14
|
+
export {
|
|
15
|
+
getLaunchdPlistPath,
|
|
16
|
+
getSystemdUnitPath,
|
|
17
|
+
removeCcRoomData,
|
|
18
|
+
removeCommandFiles,
|
|
19
|
+
stopLaunchd,
|
|
20
|
+
stopOrphanDaemon,
|
|
21
|
+
stopSystemd,
|
|
22
|
+
uninstall
|
|
23
|
+
};
|
package/dist/validators.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "setup-cc-room",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Install cc-room — bring your Claude Code into a shared LAN meeting room",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Takanori Suzuki",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"vendor"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "tsup src/index.ts src/installer.ts src/settings-merger.ts src/register-service.ts src/validators.ts src/daemon-resolver.ts src/paths.ts --format esm --dts",
|
|
21
|
+
"build": "tsup src/index.ts src/installer.ts src/settings-merger.ts src/register-service.ts src/validators.ts src/daemon-resolver.ts src/paths.ts src/uninstaller.ts src/i18n.ts --format esm --dts",
|
|
22
22
|
"dev": "tsup src/index.ts --format esm --watch",
|
|
23
23
|
"pack:vendor": "node scripts/pack-vendor.mjs",
|
|
24
24
|
"prepack": "pnpm run build && pnpm run pack:vendor",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: private
|
|
3
|
+
description: Toggle local (Private) mode. When turning off, always choose share or drop for pending work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Toggle between local (Private) and public. While public (Private OFF), summaries and artifacts flow to the Primary room automatically. Work done during Private ON accumulates as pending and stays invisible to others.
|
|
7
|
+
|
|
8
|
+
## Resolve the port
|
|
9
|
+
|
|
10
|
+
Before every HTTP request, resolve the port:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
CC_ROOM_HOME="${CC_ROOM_HOME:-$HOME/.cc-room}"
|
|
14
|
+
HTTP_PORT=$(grep 'http_port:' "$CC_ROOM_HOME/config.yaml" 2>/dev/null | awk '{print $2}' | tr -d '[:space:]')
|
|
15
|
+
HTTP_PORT="${HTTP_PORT:-7332}"
|
|
16
|
+
BASE_URL="http://127.0.0.1:$HTTP_PORT"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Subcommands
|
|
20
|
+
|
|
21
|
+
### `/private` (no args) — status
|
|
22
|
+
|
|
23
|
+
1. `GET $BASE_URL/status`.
|
|
24
|
+
2. Display:
|
|
25
|
+
```
|
|
26
|
+
🔒 Private ON (local mode) / 📡 Live (Private OFF)
|
|
27
|
+
Primary: <primary_room_name>
|
|
28
|
+
Pending local work: <pending_turns + pending_files> items
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### `/private on` — enter local mode
|
|
32
|
+
|
|
33
|
+
1. `POST $BASE_URL/private` with `{ "mode": "on" }`.
|
|
34
|
+
2. On success:
|
|
35
|
+
```
|
|
36
|
+
🔒 Switched to local mode. Your work is hidden (use /private off to go public)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `/private off` — return to public
|
|
40
|
+
|
|
41
|
+
1. `POST $BASE_URL/private` with `{ "mode": "off" }`.
|
|
42
|
+
2. Branch on the response:
|
|
43
|
+
- If `needs_choice: true`, **always ask the user** (never auto-share):
|
|
44
|
+
```
|
|
45
|
+
You have <pending> pending items. Send them to Primary (<primary_room_name>)?
|
|
46
|
+
→ share (send, then go public) / drop (discard, then go public)
|
|
47
|
+
```
|
|
48
|
+
Then run `/private share` or `/private drop` based on their choice.
|
|
49
|
+
- If no `needs_choice` (0 pending):
|
|
50
|
+
```
|
|
51
|
+
📡 Back to public. Work summaries will flow to Primary (<primary_room_name>)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `/private share` — share pending, then go public
|
|
55
|
+
|
|
56
|
+
1. `POST $BASE_URL/private` with `{ "mode": "share" }`.
|
|
57
|
+
2. On success:
|
|
58
|
+
```
|
|
59
|
+
📡 Shared <shared> pending items to Primary (<primary_room_name>) and returned to public
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `/private drop` — discard pending, then go public
|
|
63
|
+
|
|
64
|
+
1. `POST $BASE_URL/private` with `{ "mode": "drop" }`.
|
|
65
|
+
2. On success:
|
|
66
|
+
```
|
|
67
|
+
🗑 Discarded <dropped> pending items and returned to public
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Errors
|
|
71
|
+
|
|
72
|
+
- If the daemon is not running:
|
|
73
|
+
"cc-room daemon is not running."
|
|
74
|
+
- If not in a room:
|
|
75
|
+
"You are not in a room. Use `/room open` or `/room join` first."
|