claude-scope 0.8.2 → 0.8.4
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/claude-scope.cjs +232 -108
- package/package.json +1 -1
package/dist/claude-scope.cjs
CHANGED
|
@@ -1185,13 +1185,13 @@ var init_constants = __esm({
|
|
|
1185
1185
|
/** Demo total output tokens */
|
|
1186
1186
|
TOTAL_OUTPUT_TOKENS: 5e4,
|
|
1187
1187
|
/** Demo current input tokens */
|
|
1188
|
-
CURRENT_INPUT_TOKENS:
|
|
1188
|
+
CURRENT_INPUT_TOKENS: 8e4,
|
|
1189
1189
|
/** Demo current output tokens */
|
|
1190
|
-
CURRENT_OUTPUT_TOKENS:
|
|
1190
|
+
CURRENT_OUTPUT_TOKENS: 3e4,
|
|
1191
1191
|
/** Demo cache creation tokens */
|
|
1192
|
-
CACHE_CREATION_TOKENS:
|
|
1192
|
+
CACHE_CREATION_TOKENS: 1e3,
|
|
1193
1193
|
/** Demo cache read tokens */
|
|
1194
|
-
CACHE_READ_TOKENS:
|
|
1194
|
+
CACHE_READ_TOKENS: 15e3
|
|
1195
1195
|
};
|
|
1196
1196
|
DEFAULT_PROGRESS_BAR_WIDTH = DEFAULTS.PROGRESS_BAR_WIDTH;
|
|
1197
1197
|
}
|
|
@@ -1355,107 +1355,104 @@ var init_widget_registry = __esm({
|
|
|
1355
1355
|
}
|
|
1356
1356
|
});
|
|
1357
1357
|
|
|
1358
|
-
// src/providers/
|
|
1359
|
-
var
|
|
1360
|
-
var
|
|
1361
|
-
"src/providers/
|
|
1358
|
+
// src/providers/mock-git.ts
|
|
1359
|
+
var MockGit;
|
|
1360
|
+
var init_mock_git = __esm({
|
|
1361
|
+
"src/providers/mock-git.ts"() {
|
|
1362
1362
|
"use strict";
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
* Parse tools from a JSONL transcript file
|
|
1369
|
-
* @param transcriptPath Path to the transcript file
|
|
1370
|
-
* @returns Array of tool entries, limited to last 20
|
|
1371
|
-
*/
|
|
1372
|
-
async parseTools(transcriptPath) {
|
|
1373
|
-
if (!(0, import_node_fs.existsSync)(transcriptPath)) {
|
|
1374
|
-
return [];
|
|
1375
|
-
}
|
|
1376
|
-
const toolMap = /* @__PURE__ */ new Map();
|
|
1377
|
-
try {
|
|
1378
|
-
const fileStream = (0, import_node_fs.createReadStream)(transcriptPath, { encoding: "utf-8" });
|
|
1379
|
-
const rl = (0, import_node_readline.createInterface)({
|
|
1380
|
-
input: fileStream,
|
|
1381
|
-
crlfDelay: Infinity
|
|
1382
|
-
});
|
|
1383
|
-
for await (const line of rl) {
|
|
1384
|
-
if (!line.trim()) continue;
|
|
1385
|
-
try {
|
|
1386
|
-
const entry = JSON.parse(line);
|
|
1387
|
-
this.processLine(entry, toolMap);
|
|
1388
|
-
} catch {
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
const tools = Array.from(toolMap.values());
|
|
1392
|
-
return tools.slice(-this.MAX_TOOLS);
|
|
1393
|
-
} catch {
|
|
1394
|
-
return [];
|
|
1395
|
-
}
|
|
1363
|
+
MockGit = class {
|
|
1364
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: kept for API consistency with NativeGit
|
|
1365
|
+
cwd;
|
|
1366
|
+
constructor(cwd) {
|
|
1367
|
+
this.cwd = cwd;
|
|
1396
1368
|
}
|
|
1397
1369
|
/**
|
|
1398
|
-
*
|
|
1370
|
+
* Return demo git status
|
|
1371
|
+
* @returns Status with "main" branch
|
|
1399
1372
|
*/
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
const timestamp = /* @__PURE__ */ new Date();
|
|
1403
|
-
for (const block of blocks) {
|
|
1404
|
-
if (block.type === "tool_use" && block.id && block.name) {
|
|
1405
|
-
const tool = {
|
|
1406
|
-
id: block.id,
|
|
1407
|
-
name: block.name,
|
|
1408
|
-
target: this.extractTarget(block.name, block.input),
|
|
1409
|
-
status: "running",
|
|
1410
|
-
startTime: timestamp
|
|
1411
|
-
};
|
|
1412
|
-
toolMap.set(block.id, tool);
|
|
1413
|
-
}
|
|
1414
|
-
if (block.type === "tool_result" && block.tool_use_id) {
|
|
1415
|
-
const existing = toolMap.get(block.tool_use_id);
|
|
1416
|
-
if (existing) {
|
|
1417
|
-
existing.status = block.is_error ? "error" : "completed";
|
|
1418
|
-
existing.endTime = timestamp;
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1373
|
+
async status() {
|
|
1374
|
+
return { current: "main" };
|
|
1422
1375
|
}
|
|
1423
1376
|
/**
|
|
1424
|
-
*
|
|
1377
|
+
* Return demo diff summary
|
|
1378
|
+
* @returns Diff with 3 files, 142 insertions, 27 deletions
|
|
1425
1379
|
*/
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
case "Grep":
|
|
1436
|
-
return this.asString(input.pattern);
|
|
1437
|
-
case "Bash": {
|
|
1438
|
-
const cmd = this.asString(input.command);
|
|
1439
|
-
return cmd ? this.truncateCommand(cmd) : void 0;
|
|
1440
|
-
}
|
|
1441
|
-
default:
|
|
1442
|
-
return void 0;
|
|
1443
|
-
}
|
|
1380
|
+
async diffSummary(_options) {
|
|
1381
|
+
return {
|
|
1382
|
+
fileCount: 3,
|
|
1383
|
+
files: [
|
|
1384
|
+
{ file: "src/widget.ts", insertions: 85, deletions: 12 },
|
|
1385
|
+
{ file: "src/config.ts", insertions: 42, deletions: 8 },
|
|
1386
|
+
{ file: "tests/widget.test.ts", insertions: 15, deletions: 7 }
|
|
1387
|
+
]
|
|
1388
|
+
};
|
|
1444
1389
|
}
|
|
1445
1390
|
/**
|
|
1446
|
-
*
|
|
1391
|
+
* Return demo latest tag
|
|
1392
|
+
* @returns Current version tag
|
|
1447
1393
|
*/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
if (typeof value === "number") return String(value);
|
|
1451
|
-
return void 0;
|
|
1394
|
+
async latestTag() {
|
|
1395
|
+
return "v0.8.3";
|
|
1452
1396
|
}
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
// src/providers/mock-transcript-provider.ts
|
|
1402
|
+
var MockTranscriptProvider;
|
|
1403
|
+
var init_mock_transcript_provider = __esm({
|
|
1404
|
+
"src/providers/mock-transcript-provider.ts"() {
|
|
1405
|
+
"use strict";
|
|
1406
|
+
MockTranscriptProvider = class {
|
|
1453
1407
|
/**
|
|
1454
|
-
*
|
|
1408
|
+
* Return demo tool entries
|
|
1409
|
+
* @param path - Transcript path (ignored in mock)
|
|
1410
|
+
* @returns Array of demo tool entries
|
|
1455
1411
|
*/
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1412
|
+
async parseTools(_path) {
|
|
1413
|
+
const now = /* @__PURE__ */ new Date();
|
|
1414
|
+
const minuteAgo = new Date(now.getTime() - 60 * 1e3);
|
|
1415
|
+
return [
|
|
1416
|
+
{
|
|
1417
|
+
id: "tool_1",
|
|
1418
|
+
name: "Read",
|
|
1419
|
+
target: "src/config.ts",
|
|
1420
|
+
status: "completed",
|
|
1421
|
+
startTime: minuteAgo,
|
|
1422
|
+
endTime: minuteAgo
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
id: "tool_2",
|
|
1426
|
+
name: "Edit",
|
|
1427
|
+
target: "src/config.ts",
|
|
1428
|
+
status: "completed",
|
|
1429
|
+
startTime: minuteAgo,
|
|
1430
|
+
endTime: minuteAgo
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
id: "tool_3",
|
|
1434
|
+
name: "Read",
|
|
1435
|
+
target: "src/widget.ts",
|
|
1436
|
+
status: "completed",
|
|
1437
|
+
startTime: minuteAgo,
|
|
1438
|
+
endTime: minuteAgo
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
id: "tool_4",
|
|
1442
|
+
name: "Bash",
|
|
1443
|
+
target: "npm test",
|
|
1444
|
+
status: "running",
|
|
1445
|
+
startTime: now
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
id: "tool_5",
|
|
1449
|
+
name: "Edit",
|
|
1450
|
+
target: "src/styles.ts",
|
|
1451
|
+
status: "completed",
|
|
1452
|
+
startTime: minuteAgo,
|
|
1453
|
+
endTime: minuteAgo
|
|
1454
|
+
}
|
|
1455
|
+
];
|
|
1459
1456
|
}
|
|
1460
1457
|
};
|
|
1461
1458
|
}
|
|
@@ -1917,11 +1914,11 @@ var init_widget_types = __esm({
|
|
|
1917
1914
|
});
|
|
1918
1915
|
|
|
1919
1916
|
// src/storage/cache-manager.ts
|
|
1920
|
-
var
|
|
1917
|
+
var import_node_fs, import_node_os2, import_node_path2, DEFAULT_CACHE_PATH, DEFAULT_EXPIRY_MS, CacheManager;
|
|
1921
1918
|
var init_cache_manager = __esm({
|
|
1922
1919
|
"src/storage/cache-manager.ts"() {
|
|
1923
1920
|
"use strict";
|
|
1924
|
-
|
|
1921
|
+
import_node_fs = require("node:fs");
|
|
1925
1922
|
import_node_os2 = require("node:os");
|
|
1926
1923
|
import_node_path2 = require("node:path");
|
|
1927
1924
|
DEFAULT_CACHE_PATH = `${(0, import_node_os2.homedir)()}/.config/claude-scope/cache.json`;
|
|
@@ -1994,11 +1991,11 @@ var init_cache_manager = __esm({
|
|
|
1994
1991
|
* Load cache from file
|
|
1995
1992
|
*/
|
|
1996
1993
|
loadCache() {
|
|
1997
|
-
if (!(0,
|
|
1994
|
+
if (!(0, import_node_fs.existsSync)(this.cachePath)) {
|
|
1998
1995
|
return { sessions: {}, version: 1 };
|
|
1999
1996
|
}
|
|
2000
1997
|
try {
|
|
2001
|
-
const content = (0,
|
|
1998
|
+
const content = (0, import_node_fs.readFileSync)(this.cachePath, "utf-8");
|
|
2002
1999
|
return JSON.parse(content);
|
|
2003
2000
|
} catch {
|
|
2004
2001
|
return { sessions: {}, version: 1 };
|
|
@@ -2009,7 +2006,7 @@ var init_cache_manager = __esm({
|
|
|
2009
2006
|
*/
|
|
2010
2007
|
saveCache(cache) {
|
|
2011
2008
|
try {
|
|
2012
|
-
(0,
|
|
2009
|
+
(0, import_node_fs.writeFileSync)(this.cachePath, JSON.stringify(cache, null, 2), "utf-8");
|
|
2013
2010
|
} catch {
|
|
2014
2011
|
}
|
|
2015
2012
|
}
|
|
@@ -2019,8 +2016,8 @@ var init_cache_manager = __esm({
|
|
|
2019
2016
|
ensureCacheDir() {
|
|
2020
2017
|
try {
|
|
2021
2018
|
const dir = (0, import_node_path2.dirname)(this.cachePath);
|
|
2022
|
-
if (!(0,
|
|
2023
|
-
(0,
|
|
2019
|
+
if (!(0, import_node_fs.existsSync)(dir)) {
|
|
2020
|
+
(0, import_node_fs.mkdirSync)(dir, { recursive: true });
|
|
2024
2021
|
}
|
|
2025
2022
|
} catch {
|
|
2026
2023
|
}
|
|
@@ -3596,7 +3593,7 @@ var init_demo_data = __esm({
|
|
|
3596
3593
|
// src/cli/commands/quick-config/layout-preview.ts
|
|
3597
3594
|
async function registerWidgetsFromConfig(registry, config, style, themeName) {
|
|
3598
3595
|
const themeColors = getThemeByName(themeName).colors;
|
|
3599
|
-
const transcriptProvider = new
|
|
3596
|
+
const transcriptProvider = new MockTranscriptProvider();
|
|
3600
3597
|
const widgetFactory = {
|
|
3601
3598
|
model: (s) => {
|
|
3602
3599
|
const w = new ModelWidget(themeColors);
|
|
@@ -3624,12 +3621,12 @@ async function registerWidgetsFromConfig(registry, config, style, themeName) {
|
|
|
3624
3621
|
return w;
|
|
3625
3622
|
},
|
|
3626
3623
|
git: (s) => {
|
|
3627
|
-
const w = new GitWidget(
|
|
3624
|
+
const w = new GitWidget((cwd) => new MockGit(cwd), themeColors);
|
|
3628
3625
|
w.setStyle(s);
|
|
3629
3626
|
return w;
|
|
3630
3627
|
},
|
|
3631
3628
|
"git-tag": (s) => {
|
|
3632
|
-
const w = new GitTagWidget(
|
|
3629
|
+
const w = new GitTagWidget((cwd) => new MockGit(cwd), themeColors);
|
|
3633
3630
|
w.setStyle(s);
|
|
3634
3631
|
return w;
|
|
3635
3632
|
},
|
|
@@ -3685,7 +3682,8 @@ var init_layout_preview = __esm({
|
|
|
3685
3682
|
"use strict";
|
|
3686
3683
|
init_renderer();
|
|
3687
3684
|
init_widget_registry();
|
|
3688
|
-
|
|
3685
|
+
init_mock_git();
|
|
3686
|
+
init_mock_transcript_provider();
|
|
3689
3687
|
init_theme();
|
|
3690
3688
|
init_active_tools();
|
|
3691
3689
|
init_cache_metrics();
|
|
@@ -6486,12 +6484,32 @@ __export(select_with_preview_exports, {
|
|
|
6486
6484
|
});
|
|
6487
6485
|
async function generatePreviews(choices, style, themeName) {
|
|
6488
6486
|
const previews = [];
|
|
6487
|
+
const isStyleSelection = choices.length >= 3 && choices.every((c) => isQuickConfigStyle(c.value));
|
|
6488
|
+
const availableThemes = [
|
|
6489
|
+
"monokai",
|
|
6490
|
+
"nord",
|
|
6491
|
+
"dracula",
|
|
6492
|
+
"catppuccin-mocha",
|
|
6493
|
+
"tokyo-night",
|
|
6494
|
+
"vscode-dark-plus",
|
|
6495
|
+
"github-dark-dimmed",
|
|
6496
|
+
"dusty-sage"
|
|
6497
|
+
];
|
|
6498
|
+
const isThemeSelection = choices.some((c) => isThemeName(c.value, availableThemes));
|
|
6489
6499
|
for (const choice of choices) {
|
|
6490
6500
|
try {
|
|
6501
|
+
let previewStyle = style;
|
|
6502
|
+
if (isStyleSelection) {
|
|
6503
|
+
previewStyle = choice.value;
|
|
6504
|
+
}
|
|
6505
|
+
let previewTheme = themeName;
|
|
6506
|
+
if (isThemeSelection && isThemeName(choice.value, availableThemes)) {
|
|
6507
|
+
previewTheme = choice.value;
|
|
6508
|
+
}
|
|
6491
6509
|
const preview = await renderPreviewFromConfig(
|
|
6492
|
-
choice.getConfig(
|
|
6493
|
-
|
|
6494
|
-
|
|
6510
|
+
choice.getConfig(previewStyle, previewTheme),
|
|
6511
|
+
previewStyle,
|
|
6512
|
+
previewTheme
|
|
6495
6513
|
);
|
|
6496
6514
|
previews.push(preview);
|
|
6497
6515
|
} catch (error) {
|
|
@@ -6501,6 +6519,12 @@ async function generatePreviews(choices, style, themeName) {
|
|
|
6501
6519
|
}
|
|
6502
6520
|
return previews;
|
|
6503
6521
|
}
|
|
6522
|
+
function isQuickConfigStyle(value) {
|
|
6523
|
+
return typeof value === "string" && ["balanced", "playful", "compact"].includes(value);
|
|
6524
|
+
}
|
|
6525
|
+
function isThemeName(value, availableThemes) {
|
|
6526
|
+
return typeof value === "string" && availableThemes.includes(value);
|
|
6527
|
+
}
|
|
6504
6528
|
function selectWithPreviewImpl(config, done) {
|
|
6505
6529
|
const [active, setActive] = useState(0);
|
|
6506
6530
|
const [status, setStatus] = useState("idle");
|
|
@@ -6966,7 +6990,108 @@ async function runQuickConfigMenu() {
|
|
|
6966
6990
|
// src/cli/commands/quick-config/preview.ts
|
|
6967
6991
|
init_renderer();
|
|
6968
6992
|
init_widget_registry();
|
|
6969
|
-
|
|
6993
|
+
|
|
6994
|
+
// src/providers/transcript-provider.ts
|
|
6995
|
+
var import_node_fs2 = require("node:fs");
|
|
6996
|
+
var import_node_readline = require("node:readline");
|
|
6997
|
+
var TranscriptProvider = class {
|
|
6998
|
+
MAX_TOOLS = 20;
|
|
6999
|
+
/**
|
|
7000
|
+
* Parse tools from a JSONL transcript file
|
|
7001
|
+
* @param transcriptPath Path to the transcript file
|
|
7002
|
+
* @returns Array of tool entries, limited to last 20
|
|
7003
|
+
*/
|
|
7004
|
+
async parseTools(transcriptPath) {
|
|
7005
|
+
if (!(0, import_node_fs2.existsSync)(transcriptPath)) {
|
|
7006
|
+
return [];
|
|
7007
|
+
}
|
|
7008
|
+
const toolMap = /* @__PURE__ */ new Map();
|
|
7009
|
+
try {
|
|
7010
|
+
const fileStream = (0, import_node_fs2.createReadStream)(transcriptPath, { encoding: "utf-8" });
|
|
7011
|
+
const rl = (0, import_node_readline.createInterface)({
|
|
7012
|
+
input: fileStream,
|
|
7013
|
+
crlfDelay: Infinity
|
|
7014
|
+
});
|
|
7015
|
+
for await (const line of rl) {
|
|
7016
|
+
if (!line.trim()) continue;
|
|
7017
|
+
try {
|
|
7018
|
+
const entry = JSON.parse(line);
|
|
7019
|
+
this.processLine(entry, toolMap);
|
|
7020
|
+
} catch {
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
const tools = Array.from(toolMap.values());
|
|
7024
|
+
return tools.slice(-this.MAX_TOOLS);
|
|
7025
|
+
} catch {
|
|
7026
|
+
return [];
|
|
7027
|
+
}
|
|
7028
|
+
}
|
|
7029
|
+
/**
|
|
7030
|
+
* Process a single transcript line and update tool map
|
|
7031
|
+
*/
|
|
7032
|
+
processLine(line, toolMap) {
|
|
7033
|
+
const blocks = line.message?.content ?? [];
|
|
7034
|
+
const timestamp = /* @__PURE__ */ new Date();
|
|
7035
|
+
for (const block of blocks) {
|
|
7036
|
+
if (block.type === "tool_use" && block.id && block.name) {
|
|
7037
|
+
const tool = {
|
|
7038
|
+
id: block.id,
|
|
7039
|
+
name: block.name,
|
|
7040
|
+
target: this.extractTarget(block.name, block.input),
|
|
7041
|
+
status: "running",
|
|
7042
|
+
startTime: timestamp
|
|
7043
|
+
};
|
|
7044
|
+
toolMap.set(block.id, tool);
|
|
7045
|
+
}
|
|
7046
|
+
if (block.type === "tool_result" && block.tool_use_id) {
|
|
7047
|
+
const existing = toolMap.get(block.tool_use_id);
|
|
7048
|
+
if (existing) {
|
|
7049
|
+
existing.status = block.is_error ? "error" : "completed";
|
|
7050
|
+
existing.endTime = timestamp;
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
}
|
|
7054
|
+
}
|
|
7055
|
+
/**
|
|
7056
|
+
* Extract target from tool input based on tool type
|
|
7057
|
+
*/
|
|
7058
|
+
extractTarget(toolName, input) {
|
|
7059
|
+
if (!input) return void 0;
|
|
7060
|
+
switch (toolName) {
|
|
7061
|
+
case "Read":
|
|
7062
|
+
case "Write":
|
|
7063
|
+
case "Edit":
|
|
7064
|
+
return this.asString(input.file_path ?? input.path);
|
|
7065
|
+
case "Glob":
|
|
7066
|
+
return this.asString(input.pattern);
|
|
7067
|
+
case "Grep":
|
|
7068
|
+
return this.asString(input.pattern);
|
|
7069
|
+
case "Bash": {
|
|
7070
|
+
const cmd = this.asString(input.command);
|
|
7071
|
+
return cmd ? this.truncateCommand(cmd) : void 0;
|
|
7072
|
+
}
|
|
7073
|
+
default:
|
|
7074
|
+
return void 0;
|
|
7075
|
+
}
|
|
7076
|
+
}
|
|
7077
|
+
/**
|
|
7078
|
+
* Safely convert value to string
|
|
7079
|
+
*/
|
|
7080
|
+
asString(value) {
|
|
7081
|
+
if (typeof value === "string") return value;
|
|
7082
|
+
if (typeof value === "number") return String(value);
|
|
7083
|
+
return void 0;
|
|
7084
|
+
}
|
|
7085
|
+
/**
|
|
7086
|
+
* Truncate long commands to 30 chars
|
|
7087
|
+
*/
|
|
7088
|
+
truncateCommand(cmd) {
|
|
7089
|
+
if (cmd.length <= 30) return cmd;
|
|
7090
|
+
return `${cmd.slice(0, 30)}...`;
|
|
7091
|
+
}
|
|
7092
|
+
};
|
|
7093
|
+
|
|
7094
|
+
// src/cli/commands/quick-config/preview.ts
|
|
6970
7095
|
init_theme();
|
|
6971
7096
|
init_active_tools();
|
|
6972
7097
|
init_cache_metrics();
|
|
@@ -7227,7 +7352,6 @@ var StdinProvider = class {
|
|
|
7227
7352
|
};
|
|
7228
7353
|
|
|
7229
7354
|
// src/index.ts
|
|
7230
|
-
init_transcript_provider();
|
|
7231
7355
|
init_theme();
|
|
7232
7356
|
init_active_tools();
|
|
7233
7357
|
init_cache_metrics();
|