setup-cc-room 0.2.1 → 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-KEFBOTQD.js +22 -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 +42 -53
- package/dist/installer.d.ts +5 -2
- package/dist/installer.js +9 -6
- package/dist/register-service.js +2 -1
- package/dist/settings-merger.js +2 -1
- package/dist/uninstaller.js +3 -2
- 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,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
t
|
|
3
|
+
} from "./chunk-OYW7MM4W.js";
|
|
4
|
+
|
|
5
|
+
// src/validators.ts
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
import { existsSync, readFileSync, accessSync, constants } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
function validateAll() {
|
|
11
|
+
const checks = [
|
|
12
|
+
checkNodeVersion(),
|
|
13
|
+
checkClaudeCodeInstalled(),
|
|
14
|
+
checkClaudeDir(),
|
|
15
|
+
checkSettingsWritable(),
|
|
16
|
+
checkHooksNotDisabled(),
|
|
17
|
+
checkMcpNotBlocked(),
|
|
18
|
+
checkSessionDir(),
|
|
19
|
+
checkGitUser()
|
|
20
|
+
];
|
|
21
|
+
const passed = checks.every((r) => r.ok);
|
|
22
|
+
return { passed, results: checks };
|
|
23
|
+
}
|
|
24
|
+
function printResults(results) {
|
|
25
|
+
console.log("\n Preflight checks:\n");
|
|
26
|
+
for (const r of results) {
|
|
27
|
+
const icon = r.ok ? "\x1B[32m\u2713\x1B[0m" : "\x1B[31m\u2717\x1B[0m";
|
|
28
|
+
console.log(` ${icon} ${r.message}`);
|
|
29
|
+
if (!r.ok && r.hint) {
|
|
30
|
+
console.log(` \x1B[33m\u2192 ${r.hint}\x1B[0m`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
console.log("");
|
|
34
|
+
}
|
|
35
|
+
function checkNodeVersion() {
|
|
36
|
+
const major = parseInt(process.versions.node.split(".")[0], 10);
|
|
37
|
+
if (major >= 20) {
|
|
38
|
+
return { ok: true, message: `Node.js ${process.versions.node}` };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
ok: false,
|
|
42
|
+
message: t("val.node_bad", { version: process.versions.node }),
|
|
43
|
+
hint: t("val.node_hint")
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function checkClaudeCodeInstalled() {
|
|
47
|
+
try {
|
|
48
|
+
execFileSync("claude", ["--version"], { encoding: "utf-8", stdio: "pipe" });
|
|
49
|
+
return { ok: true, message: t("val.claude_ok") };
|
|
50
|
+
} catch {
|
|
51
|
+
return {
|
|
52
|
+
ok: false,
|
|
53
|
+
message: t("val.claude_missing"),
|
|
54
|
+
hint: t("val.claude_hint")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function checkClaudeDir() {
|
|
59
|
+
const claudeDir = join(homedir(), ".claude");
|
|
60
|
+
if (existsSync(claudeDir)) {
|
|
61
|
+
return { ok: true, message: t("val.claude_dir_ok") };
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
ok: false,
|
|
65
|
+
message: t("val.claude_dir_missing"),
|
|
66
|
+
hint: t("val.claude_dir_hint")
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function checkSettingsWritable() {
|
|
70
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
71
|
+
const settingsDir = join(homedir(), ".claude");
|
|
72
|
+
if (existsSync(settingsPath)) {
|
|
73
|
+
try {
|
|
74
|
+
accessSync(settingsPath, constants.W_OK);
|
|
75
|
+
return { ok: true, message: t("val.settings_writable") };
|
|
76
|
+
} catch {
|
|
77
|
+
return {
|
|
78
|
+
ok: false,
|
|
79
|
+
message: t("val.settings_not_writable"),
|
|
80
|
+
hint: t("val.settings_chmod", { path: settingsPath })
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
accessSync(settingsDir, constants.W_OK);
|
|
86
|
+
return { ok: true, message: t("val.settings_creatable") };
|
|
87
|
+
} catch {
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
message: t("val.claude_dir_not_writable"),
|
|
91
|
+
hint: t("val.claude_dir_chmod", { path: settingsDir })
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function checkHooksNotDisabled() {
|
|
96
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
97
|
+
if (!existsSync(settingsPath)) {
|
|
98
|
+
return { ok: true, message: t("val.hooks_unset") };
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
102
|
+
if (settings.hooks === false || settings.disableHooks === true) {
|
|
103
|
+
return {
|
|
104
|
+
ok: false,
|
|
105
|
+
message: t("val.hooks_disabled"),
|
|
106
|
+
hint: t("val.hooks_disabled_hint")
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return { ok: true, message: t("val.hooks_ok") };
|
|
110
|
+
} catch {
|
|
111
|
+
return { ok: true, message: t("val.hooks_unrestricted") };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function checkMcpNotBlocked() {
|
|
115
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
116
|
+
if (!existsSync(settingsPath)) {
|
|
117
|
+
return { ok: true, message: t("val.mcp_ok") };
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
121
|
+
if (settings.mcpServers === false || settings.disableMcp === true) {
|
|
122
|
+
return {
|
|
123
|
+
ok: false,
|
|
124
|
+
message: t("val.mcp_disabled"),
|
|
125
|
+
hint: t("val.mcp_disabled_hint")
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return { ok: true, message: t("val.mcp_ok") };
|
|
129
|
+
} catch {
|
|
130
|
+
return { ok: true, message: t("val.mcp_ok") };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function checkSessionDir() {
|
|
134
|
+
const projectsDir = join(homedir(), ".claude", "projects");
|
|
135
|
+
if (existsSync(projectsDir)) {
|
|
136
|
+
return { ok: true, message: t("val.session_ok") };
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
ok: true,
|
|
140
|
+
message: t("val.session_pending")
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function checkGitUser() {
|
|
144
|
+
try {
|
|
145
|
+
const name = execFileSync("git", ["config", "user.name"], {
|
|
146
|
+
encoding: "utf-8",
|
|
147
|
+
stdio: "pipe"
|
|
148
|
+
}).trim();
|
|
149
|
+
if (name) {
|
|
150
|
+
return { ok: true, message: t("val.git_ok", { name }) };
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
message: t("val.git_no_name"),
|
|
155
|
+
hint: t("val.git_no_name_hint")
|
|
156
|
+
};
|
|
157
|
+
} catch {
|
|
158
|
+
return {
|
|
159
|
+
ok: false,
|
|
160
|
+
message: t("val.git_missing"),
|
|
161
|
+
hint: t("val.git_hint")
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
validateAll,
|
|
168
|
+
printResults
|
|
169
|
+
};
|
|
@@ -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,72 +1,59 @@
|
|
|
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";
|
|
7
11
|
import {
|
|
8
12
|
uninstall
|
|
9
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MSQUTURC.js";
|
|
10
14
|
import "./chunk-WCEABGOA.js";
|
|
11
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-MVD6RIS2.js";
|
|
12
16
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
getLocale,
|
|
18
|
+
resolveLocale,
|
|
19
|
+
setLocale,
|
|
20
|
+
t
|
|
21
|
+
} from "./chunk-OYW7MM4W.js";
|
|
16
22
|
|
|
17
23
|
// src/index.ts
|
|
18
|
-
var VERSION = "0.2.
|
|
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
|
+
}
|
|
19
38
|
function printHelp() {
|
|
20
|
-
console.log(
|
|
21
|
-
\u{1F3E0} setup-cc-room v${VERSION}
|
|
22
|
-
|
|
23
|
-
Usage:
|
|
24
|
-
npx setup-cc-room Install cc-room
|
|
25
|
-
npx setup-cc-room uninstall Remove cc-room (daemon, hooks, data)
|
|
26
|
-
npx setup-cc-room --help Show this help
|
|
27
|
-
`);
|
|
39
|
+
console.log(t("cli.help", { version: VERSION }));
|
|
28
40
|
}
|
|
29
41
|
async function runInstall() {
|
|
30
42
|
console.log(`
|
|
31
43
|
\u{1F3E0} setup-cc-room v${VERSION}
|
|
32
44
|
`);
|
|
33
|
-
console.log("
|
|
45
|
+
console.log(t("cli.running_preflight"));
|
|
34
46
|
const { passed, results } = validateAll();
|
|
35
47
|
printResults(results);
|
|
36
48
|
if (!passed) {
|
|
37
|
-
console.log("
|
|
49
|
+
console.log(t("cli.preflight_failed"));
|
|
38
50
|
process.exit(1);
|
|
39
51
|
}
|
|
40
|
-
console.log("
|
|
41
|
-
await install();
|
|
52
|
+
console.log(t("cli.preflight_ok"));
|
|
53
|
+
await install(getLocale());
|
|
42
54
|
console.log(`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
cc-room \u306E\u4F7F\u3044\u65B9:
|
|
46
|
-
|
|
47
|
-
\u3010\u4F1A\u8B70\u5BA4\u3092\u958B\u304F\u5834\u5408\u3011
|
|
48
|
-
1. Claude Code \u3092\u518D\u8D77\u52D5\uFF08MCP \u3068 Hooks \u3092\u6709\u52B9\u5316\uFF09
|
|
49
|
-
2. /room open <name> \u2190 \u4F1A\u8B70\u5BA4\u3092\u958B\u304F\uFF08PIN \u767A\u884C\uFF09
|
|
50
|
-
3. \u8868\u793A\u3055\u308C\u308B\u90E8\u5C4B\u540D\u3068 PIN \u3092\u76F8\u624B\u306B\u53E3\u982D\u3084 DM \u3067\u4F1D\u3048\u308B
|
|
51
|
-
4. \u76F8\u624B\u304C /room join <name> <PIN> \u3092\u5B9F\u884C\u3059\u308C\u3070\u53C2\u52A0\u5B8C\u4E86
|
|
52
|
-
|
|
53
|
-
\u3010\u62DB\u5F85\u3055\u308C\u305F\u5834\u5408\u3011
|
|
54
|
-
1. Claude Code \u3092\u518D\u8D77\u52D5
|
|
55
|
-
2. /room join <name> <PIN> \u2190 \u76F8\u624B\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u5024\u3092\u5165\u529B
|
|
56
|
-
|
|
57
|
-
\u3010\u65E5\u5E38\u64CD\u4F5C\u3011
|
|
58
|
-
/room \u2026 \u30DB\u30EF\u30A4\u30C8\u30DC\u30FC\u30C9\u3092\u898B\u308B
|
|
59
|
-
/private \u2026 \u72B6\u614B\u8868\u793A\u3001\u624B\u5143/\u516C\u958B\u306E\u5207\u66FF\uFF08on|off|share|drop\uFF09
|
|
60
|
-
|
|
61
|
-
\u26A0\uFE0F cc-room \u306F\u81EA\u52D5\u3067\u76F8\u624B\u306B\u901A\u77E5\u3057\u307E\u305B\u3093\u3002
|
|
62
|
-
\u90E8\u5C4B\u540D\u3068 PIN \u306F\u81EA\u5206\u3067\u76F8\u624B\u306B\u4F1D\u3048\u3066\u304F\u3060\u3055\u3044\u3002
|
|
63
|
-
|
|
64
|
-
\u63A5\u7D9A\u5F8C\u306F\u540C\u3058 WiFi\uFF08LAN\uFF09\u5185\u306B\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
|
|
65
|
-
\uFF08VPN \u3067\u540C\u4E00 LAN \u76F8\u5F53\u306B\u306A\u308C\u3070\u30EA\u30E2\u30FC\u30C8\u3067\u3082\u4F7F\u3048\u307E\u3059\uFF09
|
|
66
|
-
|
|
67
|
-
\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB: npx setup-cc-room uninstall
|
|
68
|
-
|
|
69
|
-
\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8: https://github.com/takanorisuzuki/cc-room
|
|
55
|
+
${t("cli.install_done")}
|
|
56
|
+
${t("cli.install_guide")}
|
|
70
57
|
`);
|
|
71
58
|
}
|
|
72
59
|
async function runUninstall() {
|
|
@@ -75,13 +62,15 @@ async function runUninstall() {
|
|
|
75
62
|
`);
|
|
76
63
|
await uninstall();
|
|
77
64
|
console.log(`
|
|
78
|
-
|
|
65
|
+
${t("cli.uninstall_done")}
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
${t("cli.restart_claude")}
|
|
81
68
|
`);
|
|
82
69
|
}
|
|
83
70
|
async function main() {
|
|
84
|
-
|
|
71
|
+
setLocale(resolveLocale(process.argv, process.env));
|
|
72
|
+
const args = stripLangArgs(process.argv.slice(2));
|
|
73
|
+
const arg = args[0];
|
|
85
74
|
if (arg === "--help" || arg === "-h" || arg === "help") {
|
|
86
75
|
printHelp();
|
|
87
76
|
return;
|
|
@@ -91,13 +80,13 @@ async function main() {
|
|
|
91
80
|
return;
|
|
92
81
|
}
|
|
93
82
|
if (arg && arg !== "install") {
|
|
94
|
-
console.error(
|
|
83
|
+
console.error(t("cli.unknown_arg", { arg }));
|
|
95
84
|
printHelp();
|
|
96
85
|
process.exit(1);
|
|
97
86
|
}
|
|
98
87
|
await runInstall();
|
|
99
88
|
}
|
|
100
89
|
main().catch((err) => {
|
|
101
|
-
console.error("
|
|
90
|
+
console.error(t("cli.error"), err instanceof Error ? err.message : err);
|
|
102
91
|
process.exit(1);
|
|
103
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
package/dist/settings-merger.js
CHANGED
package/dist/uninstaller.js
CHANGED
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
stopOrphanDaemon,
|
|
8
8
|
stopSystemd,
|
|
9
9
|
uninstall
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MSQUTURC.js";
|
|
11
11
|
import "./chunk-WCEABGOA.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-MVD6RIS2.js";
|
|
13
|
+
import "./chunk-OYW7MM4W.js";
|
|
13
14
|
export {
|
|
14
15
|
getLaunchdPlistPath,
|
|
15
16
|
getSystemdUnitPath,
|