cc-viewer 1.0.0 → 1.0.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/cli.js +14 -12
- package/interceptor.js +4 -2
- package/lib/assets/{index-DHxuhfJE.js → index-Cc1O-iKV.js} +87 -87
- package/lib/index.html +1 -1
- package/locales/ar.json +10 -14
- package/locales/da.json +10 -14
- package/locales/de.json +10 -14
- package/locales/en.json +10 -14
- package/locales/es.json +10 -14
- package/locales/fr.json +10 -14
- package/locales/it.json +10 -14
- package/locales/ja.json +10 -14
- package/locales/ko.json +10 -14
- package/locales/no.json +10 -14
- package/locales/pl.json +10 -14
- package/locales/pt-BR.json +10 -14
- package/locales/ru.json +10 -14
- package/locales/th.json +10 -14
- package/locales/tr.json +10 -14
- package/locales/uk.json +10 -14
- package/locales/zh-TW.json +9 -13
- package/locales/zh.json +9 -8
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -137,23 +137,25 @@ if (showAll) {
|
|
|
137
137
|
|
|
138
138
|
try {
|
|
139
139
|
const cliResult = injectCliJs();
|
|
140
|
-
if (cliResult === 'exists') {
|
|
141
|
-
console.log(t('cli.inject.exists'));
|
|
142
|
-
} else {
|
|
143
|
-
console.log(t('cli.inject.success'));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
140
|
const shellResult = installShellHook();
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
console.log(t('cli.hook.exists', { path: shellResult.path }));
|
|
141
|
+
|
|
142
|
+
if (cliResult === 'exists' && shellResult.status === 'exists') {
|
|
143
|
+
console.log(t('cli.alreadyWorking'));
|
|
151
144
|
} else {
|
|
152
|
-
|
|
145
|
+
if (cliResult === 'exists') {
|
|
146
|
+
console.log(t('cli.inject.exists'));
|
|
147
|
+
} else {
|
|
148
|
+
console.log(t('cli.inject.success'));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (shellResult.status === 'installed') {
|
|
152
|
+
console.log(t('cli.hook.installed', { path: shellResult.path }));
|
|
153
|
+
} else if (shellResult.status !== 'exists') {
|
|
154
|
+
console.log(t('cli.hook.fail', { error: shellResult.error }));
|
|
155
|
+
}
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
console.log(t('cli.usage.hint'));
|
|
156
|
-
console.log(t('cli.usage.uninstallHint'));
|
|
157
159
|
} catch (err) {
|
|
158
160
|
if (err.code === 'ENOENT') {
|
|
159
161
|
console.error(t('cli.inject.notFound', { path: cliPath }));
|
package/interceptor.js
CHANGED
|
@@ -18,7 +18,9 @@ function generateLogFilePath() {
|
|
|
18
18
|
+ String(now.getHours()).padStart(2, '0')
|
|
19
19
|
+ String(now.getMinutes()).padStart(2, '0')
|
|
20
20
|
+ String(now.getSeconds()).padStart(2, '0');
|
|
21
|
-
|
|
21
|
+
let cwd;
|
|
22
|
+
try { cwd = process.cwd(); } catch { cwd = homedir(); }
|
|
23
|
+
const projectName = basename(cwd).replace(/[^a-zA-Z0-9_\-\.]/g, '_');
|
|
22
24
|
const dir = join(homedir(), '.claude', 'cc-viewer');
|
|
23
25
|
try { mkdirSync(dir, { recursive: true }); } catch {}
|
|
24
26
|
return join(dir, `${projectName}_${ts}.jsonl`);
|
|
@@ -208,7 +210,7 @@ export function setupInterceptor() {
|
|
|
208
210
|
|
|
209
211
|
requestEntry = {
|
|
210
212
|
timestamp,
|
|
211
|
-
project: basename(process.cwd()),
|
|
213
|
+
project: (() => { try { return basename(process.cwd()); } catch { return 'unknown'; } })(),
|
|
212
214
|
url: urlStr,
|
|
213
215
|
method: options?.method || 'GET',
|
|
214
216
|
headers,
|