claude-code-kr 0.3.13 โ 0.3.15
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/bin/cc-kr.js +38 -0
- package/lib/cckr-command.md +1 -7
- package/lib/patcher.js +12 -11
- package/package.json +1 -1
package/bin/cc-kr.js
CHANGED
|
@@ -59,6 +59,44 @@ switch (cmd) {
|
|
|
59
59
|
console.log(`๐ฐ๐ท ํจ์น: ${s.patched ? '์ ์ฉ๋จ โ
' : '๋ฏธ์ ์ฉ โ'}`);
|
|
60
60
|
console.log(`๐ฆ cckr ๋ฒ์ : ${pkg.version}`);
|
|
61
61
|
console.log(`๐ท CC ๋ฒ์ : ${s.ccVersion || '์ ์ ์์'}`);
|
|
62
|
+
|
|
63
|
+
// ํ์ฌ ์ธ์
์ in-memory ๋ฒ์
|
|
64
|
+
// !cckr status: claude (C) โ bash (PPID=C) โ node (PPID=bash)
|
|
65
|
+
// ์ธ์
ํ์ผ์ claude PID๋ก ์ ์ฅ๋๋ฏ๋ก grandparent๋ฅผ ์ฐพ์์ผ ํจ
|
|
66
|
+
function getGrandparentPid(pid) {
|
|
67
|
+
try {
|
|
68
|
+
if (process.platform === 'linux') {
|
|
69
|
+
const stat = fs.readFileSync(`/proc/${pid}/status`, 'utf8');
|
|
70
|
+
const m = stat.match(/^PPid:\s*(\d+)/m);
|
|
71
|
+
return m ? m[1] : null;
|
|
72
|
+
} else if (process.platform === 'darwin') {
|
|
73
|
+
return execSync(`ps -o ppid= -p ${pid}`, { encoding: 'utf8' }).trim();
|
|
74
|
+
}
|
|
75
|
+
} catch {}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
// process.ppid (bash) ์ grandparent (claude) ๋ ๋ค ์๋
|
|
80
|
+
const candidates = [process.ppid.toString()];
|
|
81
|
+
const grand = getGrandparentPid(process.ppid);
|
|
82
|
+
if (grand) candidates.push(grand);
|
|
83
|
+
|
|
84
|
+
for (const pid of candidates) {
|
|
85
|
+
const sessionFile = `/tmp/cckr-session-${pid}.json`;
|
|
86
|
+
if (fs.existsSync(sessionFile)) {
|
|
87
|
+
const session = JSON.parse(fs.readFileSync(sessionFile, 'utf8'));
|
|
88
|
+
const inSession = session.sessionCckrVersion;
|
|
89
|
+
const installed = pkg.version;
|
|
90
|
+
if (inSession === installed) {
|
|
91
|
+
console.log(`๐ฏ ์ด ์ธ์
: cckr ${inSession} (๋์คํฌ์ ๋์ผ)`);
|
|
92
|
+
} else {
|
|
93
|
+
console.log(`๐ฏ ์ด ์ธ์
: cckr ${inSession} โ ๏ธ (๋์คํฌ: ${installed} โ ์ ์ธ์
์์ ์ ๋ณ๊ฒฝ ์ ์ฉ)`);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} catch {}
|
|
99
|
+
|
|
62
100
|
if (!s.patched) {
|
|
63
101
|
const sudo = needsSudo() ? 'sudo ' : '';
|
|
64
102
|
console.log('\n๐ ํจ์น ์ ์ฉ:');
|
package/lib/cckr-command.md
CHANGED
|
@@ -3,10 +3,4 @@ description: cckr ํ๊ธ ํจ์น ๋ฒ์ ํ์ธ
|
|
|
3
3
|
---
|
|
4
4
|
<!-- managed-by: claude-code-kr -->
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
echo "=== ์ด ์ธ์
==="; cat /tmp/cckr-session-$PPID.json 2>/dev/null || echo "(์ธ์
์ ๋ณด ์์ โ ์ ์ธ์
์ ์์ํ์ธ์)"; echo ""; echo "=== ๋์คํฌ (ํ์ฌ cli.js) ==="; cckr status
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
์ถ๊ฐ ํด์/์์ฝ ์์ด ์ถ๋ ฅ๋ง ๊ทธ๋๋ก.
|
|
6
|
+
`cckr status` ๋ช
๋ น์ ์คํํด์ ๊ฒฐ๊ณผ๋ฅผ ๊ทธ๋๋ก ๋ณด์ฌ์ค. ์ถ๊ฐ ํด์์ด๋ ์์ฝ ์์ด ์ถ๋ ฅ๋ง.
|
package/lib/patcher.js
CHANGED
|
@@ -120,17 +120,8 @@ function apply(cliJs, { force = false } = {}) {
|
|
|
120
120
|
const markerPath = cliJs + '.cckr';
|
|
121
121
|
const ccVersion = getCliVersion(cliJs);
|
|
122
122
|
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
const marker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
127
|
-
if (marker.ccVersion === ccVersion && marker.cckrVersion === pkg.version) {
|
|
128
|
-
return { ok: true, skipped: true, ccVersion, testedCcVersion: TESTED_CC_VERSION };
|
|
129
|
-
}
|
|
130
|
-
} catch {}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ์ธ์
์์ ์์ ์บก์ฒ โ SessionStart hook์ด CCKR_SESSION_PPID env๋ก ํธ์ถ
|
|
123
|
+
// ์ธ์
์์ ์์ ์บก์ฒ โ ๋ง์ปค ์คํต๋ณด๋ค ๋จผ์ (์คํต๋ผ๋ ์ธ์
์ ๋ณด๋ ํญ์ ๊ธฐ๋ก)
|
|
124
|
+
// SessionStart hook์ด CCKR_SESSION_PPID env๋ก ํธ์ถ
|
|
134
125
|
// ํจ์น ์ง์ ์ marker = ์ด ์ธ์
์ด ๋ฉ๋ชจ๋ฆฌ์ ๋ก๋ํ cli.js ๋ฒ์
|
|
135
126
|
const sessionPpid = process.env.CCKR_SESSION_PPID;
|
|
136
127
|
if (sessionPpid && /^\d+$/.test(sessionPpid)) {
|
|
@@ -161,6 +152,16 @@ function apply(cliJs, { force = false } = {}) {
|
|
|
161
152
|
} catch {}
|
|
162
153
|
}
|
|
163
154
|
|
|
155
|
+
// ๋ง์ปค ์ฒดํฌ โ CC ๋ฒ์ + cckr ๋ฒ์ ์ด ๊ฐ์ผ๋ฉด ์คํต
|
|
156
|
+
if (!force && fs.existsSync(markerPath)) {
|
|
157
|
+
try {
|
|
158
|
+
const marker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
159
|
+
if (marker.ccVersion === ccVersion && marker.cckrVersion === pkg.version) {
|
|
160
|
+
return { ok: true, skipped: true, ccVersion, testedCcVersion: TESTED_CC_VERSION };
|
|
161
|
+
}
|
|
162
|
+
} catch {}
|
|
163
|
+
}
|
|
164
|
+
|
|
164
165
|
const bakPath = cliJs + '.bak';
|
|
165
166
|
|
|
166
167
|
// ๋ฐฑ์
์์ฑ ๋๋ ๋ฐฑ์
์์ ๋ณต์ (์ค๋ณต ํจ์น ๋ฐฉ์ง)
|