claude-scope 0.8.47 → 0.8.49
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 +161 -2
- package/package.json +1 -1
package/dist/claude-scope.cjs
CHANGED
|
@@ -152,6 +152,10 @@ function createThemeColors(params) {
|
|
|
152
152
|
configCount: {
|
|
153
153
|
label: params.configCountLabel ?? semantic.info,
|
|
154
154
|
separator: params.configCountSeparator ?? base.muted
|
|
155
|
+
},
|
|
156
|
+
cwd: {
|
|
157
|
+
name: params.cwdName ?? params.branch,
|
|
158
|
+
separator: params.cwdSeparator ?? params.duration
|
|
155
159
|
}
|
|
156
160
|
};
|
|
157
161
|
}
|
|
@@ -2100,6 +2104,10 @@ function getDefaultColors() {
|
|
|
2100
2104
|
configCount: {
|
|
2101
2105
|
label: "\x1B[36m",
|
|
2102
2106
|
separator: "\x1B[90m"
|
|
2107
|
+
},
|
|
2108
|
+
cwd: {
|
|
2109
|
+
name: "\x1B[36m",
|
|
2110
|
+
separator: "\x1B[90m"
|
|
2103
2111
|
}
|
|
2104
2112
|
};
|
|
2105
2113
|
}
|
|
@@ -26139,8 +26147,14 @@ function generateBalancedLayout(style, themeName) {
|
|
|
26139
26147
|
return {
|
|
26140
26148
|
version: "1.0.0",
|
|
26141
26149
|
$aiDocs: "https://github.com/YuriNachos/claude-scope/blob/main/AI-CONFIG-GUIDE.md",
|
|
26150
|
+
theme: themeName,
|
|
26142
26151
|
lines: {
|
|
26143
26152
|
"0": [
|
|
26153
|
+
{
|
|
26154
|
+
id: "cwd",
|
|
26155
|
+
style,
|
|
26156
|
+
colors: { name: theme.cwd.name, separator: theme.cwd.separator }
|
|
26157
|
+
},
|
|
26144
26158
|
{
|
|
26145
26159
|
id: "model",
|
|
26146
26160
|
style,
|
|
@@ -26208,8 +26222,14 @@ function generateCompactLayout(style, themeName) {
|
|
|
26208
26222
|
return {
|
|
26209
26223
|
version: "1.0.0",
|
|
26210
26224
|
$aiDocs: "https://github.com/YuriNachos/claude-scope/blob/main/AI-CONFIG-GUIDE.md",
|
|
26225
|
+
theme: themeName,
|
|
26211
26226
|
lines: {
|
|
26212
26227
|
"0": [
|
|
26228
|
+
{
|
|
26229
|
+
id: "cwd",
|
|
26230
|
+
style,
|
|
26231
|
+
colors: { name: theme.cwd.name, separator: theme.cwd.separator }
|
|
26232
|
+
},
|
|
26213
26233
|
{
|
|
26214
26234
|
id: "model",
|
|
26215
26235
|
style,
|
|
@@ -26249,8 +26269,14 @@ function generateRichLayout(style, themeName) {
|
|
|
26249
26269
|
return {
|
|
26250
26270
|
version: "1.0.0",
|
|
26251
26271
|
$aiDocs: "https://github.com/YuriNachos/claude-scope/blob/main/AI-CONFIG-GUIDE.md",
|
|
26272
|
+
theme: themeName,
|
|
26252
26273
|
lines: {
|
|
26253
26274
|
"0": [
|
|
26275
|
+
{
|
|
26276
|
+
id: "cwd",
|
|
26277
|
+
style,
|
|
26278
|
+
colors: { name: theme.cwd.name, separator: theme.cwd.separator }
|
|
26279
|
+
},
|
|
26254
26280
|
{
|
|
26255
26281
|
id: "model",
|
|
26256
26282
|
style,
|
|
@@ -26657,6 +26683,132 @@ init_cache_metrics();
|
|
|
26657
26683
|
init_config_count_widget();
|
|
26658
26684
|
init_context_widget();
|
|
26659
26685
|
init_cost_widget();
|
|
26686
|
+
|
|
26687
|
+
// src/widgets/cwd/cwd-widget.ts
|
|
26688
|
+
init_widget_types();
|
|
26689
|
+
init_theme();
|
|
26690
|
+
init_stdin_data_widget();
|
|
26691
|
+
|
|
26692
|
+
// src/widgets/cwd/styles.ts
|
|
26693
|
+
init_colors();
|
|
26694
|
+
init_style_utils();
|
|
26695
|
+
function shortenPath(path2) {
|
|
26696
|
+
const home = process.env.HOME || "";
|
|
26697
|
+
const result2 = home && path2.startsWith(home) ? "~" + path2.slice(home.length) : path2;
|
|
26698
|
+
const parts = result2.split("/").filter(Boolean);
|
|
26699
|
+
if (parts.length <= 2) return result2;
|
|
26700
|
+
const shortened = parts.map((p, i) => i === parts.length - 1 ? p : p[0] || p);
|
|
26701
|
+
const prefix = result2.startsWith("~") ? "~/" : result2.startsWith("/") ? "/" : "";
|
|
26702
|
+
const startIndex = result2.startsWith("~") ? 1 : 0;
|
|
26703
|
+
return prefix + shortened.slice(startIndex).join("/");
|
|
26704
|
+
}
|
|
26705
|
+
var cwdStyles = {
|
|
26706
|
+
/**
|
|
26707
|
+
* Minimal style (default): shortened path with ~
|
|
26708
|
+
* /Users/demo/projects/claude-scope -> ~/p/claude-scope
|
|
26709
|
+
*/
|
|
26710
|
+
minimal: (data, colors2) => {
|
|
26711
|
+
const short = shortenPath(data.fullPath);
|
|
26712
|
+
return colors2 ? colorize(short, colors2.name) : short;
|
|
26713
|
+
},
|
|
26714
|
+
/**
|
|
26715
|
+
* Balanced style: directory name only
|
|
26716
|
+
* /Users/demo/projects/claude-scope -> claude-scope
|
|
26717
|
+
*/
|
|
26718
|
+
balanced: (data, colors2) => {
|
|
26719
|
+
return colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26720
|
+
},
|
|
26721
|
+
/**
|
|
26722
|
+
* Compact style: same as balanced (directory name only)
|
|
26723
|
+
* /Users/demo/projects/claude-scope -> claude-scope
|
|
26724
|
+
*/
|
|
26725
|
+
compact: (data, colors2) => {
|
|
26726
|
+
return colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26727
|
+
},
|
|
26728
|
+
/**
|
|
26729
|
+
* Playful style: with folder emoji
|
|
26730
|
+
* /Users/demo/projects/claude-scope -> 📁 claude-scope
|
|
26731
|
+
*/
|
|
26732
|
+
playful: (data, colors2) => {
|
|
26733
|
+
const colored = colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26734
|
+
return `\u{1F4C1} ${colored}`;
|
|
26735
|
+
},
|
|
26736
|
+
/**
|
|
26737
|
+
* Technical style: full path with colored separators
|
|
26738
|
+
* /Users/demo/projects/claude-scope -> /Users/demo/projects/claude-scope
|
|
26739
|
+
*/
|
|
26740
|
+
technical: (data, colors2) => {
|
|
26741
|
+
if (!colors2) return data.fullPath;
|
|
26742
|
+
const parts = data.fullPath.split("/");
|
|
26743
|
+
return parts.map((p, i) => {
|
|
26744
|
+
if (p === "") return "";
|
|
26745
|
+
const color = i === parts.length - 1 ? colors2.name : colors2.separator;
|
|
26746
|
+
return colorize(p, color);
|
|
26747
|
+
}).join(colorize("/", colors2.separator));
|
|
26748
|
+
},
|
|
26749
|
+
/**
|
|
26750
|
+
* Symbolic style: with diamond symbol
|
|
26751
|
+
* /Users/demo/projects/claude-scope -> ◆ claude-scope
|
|
26752
|
+
*/
|
|
26753
|
+
symbolic: (data, colors2) => {
|
|
26754
|
+
const colored = colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26755
|
+
return `\u25C6 ${colored}`;
|
|
26756
|
+
},
|
|
26757
|
+
/**
|
|
26758
|
+
* Labeled style: with Dir: prefix
|
|
26759
|
+
* /Users/demo/projects/claude-scope -> Dir: claude-scope
|
|
26760
|
+
*/
|
|
26761
|
+
labeled: (data, colors2) => {
|
|
26762
|
+
const colored = colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26763
|
+
return withLabel("Dir", colored);
|
|
26764
|
+
},
|
|
26765
|
+
/**
|
|
26766
|
+
* Indicator style: with bullet indicator
|
|
26767
|
+
* /Users/demo/projects/claude-scope -> ● claude-scope
|
|
26768
|
+
*/
|
|
26769
|
+
indicator: (data, colors2) => {
|
|
26770
|
+
const colored = colors2 ? colorize(data.dirName, colors2.name) : data.dirName;
|
|
26771
|
+
return withIndicator(colored);
|
|
26772
|
+
}
|
|
26773
|
+
};
|
|
26774
|
+
|
|
26775
|
+
// src/widgets/cwd/cwd-widget.ts
|
|
26776
|
+
var CwdWidget = class extends StdinDataWidget {
|
|
26777
|
+
id = "cwd";
|
|
26778
|
+
metadata = createWidgetMetadata(
|
|
26779
|
+
"CWD",
|
|
26780
|
+
"Displays current working directory",
|
|
26781
|
+
"1.0.0",
|
|
26782
|
+
"claude-scope",
|
|
26783
|
+
0
|
|
26784
|
+
);
|
|
26785
|
+
colors;
|
|
26786
|
+
styleFn = cwdStyles.minimal;
|
|
26787
|
+
constructor(colors2) {
|
|
26788
|
+
super();
|
|
26789
|
+
this.colors = colors2 ?? DEFAULT_THEME;
|
|
26790
|
+
}
|
|
26791
|
+
setStyle(style = "minimal") {
|
|
26792
|
+
const fn = cwdStyles[style];
|
|
26793
|
+
if (fn) {
|
|
26794
|
+
this.styleFn = fn;
|
|
26795
|
+
}
|
|
26796
|
+
}
|
|
26797
|
+
renderWithData(data, _context) {
|
|
26798
|
+
if (!data.cwd) {
|
|
26799
|
+
return null;
|
|
26800
|
+
}
|
|
26801
|
+
const parts = data.cwd.split("/");
|
|
26802
|
+
const dirName = parts[parts.length - 1] || data.cwd;
|
|
26803
|
+
const renderData = {
|
|
26804
|
+
fullPath: data.cwd,
|
|
26805
|
+
dirName
|
|
26806
|
+
};
|
|
26807
|
+
return this.styleFn(renderData, this.colors.cwd);
|
|
26808
|
+
}
|
|
26809
|
+
};
|
|
26810
|
+
|
|
26811
|
+
// src/cli/commands/quick-config/preview.ts
|
|
26660
26812
|
init_duration_widget();
|
|
26661
26813
|
init_git_tag_widget();
|
|
26662
26814
|
init_git_widget();
|
|
@@ -26739,7 +26891,8 @@ async function loadWidgetConfig() {
|
|
|
26739
26891
|
return null;
|
|
26740
26892
|
}
|
|
26741
26893
|
return {
|
|
26742
|
-
lines: config.lines
|
|
26894
|
+
lines: config.lines,
|
|
26895
|
+
theme: config.theme
|
|
26743
26896
|
};
|
|
26744
26897
|
} catch (error) {
|
|
26745
26898
|
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -27630,6 +27783,8 @@ var WidgetFactory = class {
|
|
|
27630
27783
|
*/
|
|
27631
27784
|
createWidget(widgetId) {
|
|
27632
27785
|
switch (widgetId) {
|
|
27786
|
+
case "cwd":
|
|
27787
|
+
return new CwdWidget(this.theme);
|
|
27633
27788
|
case "model":
|
|
27634
27789
|
return new ModelWidget(this.theme);
|
|
27635
27790
|
case "context":
|
|
@@ -27669,6 +27824,7 @@ var WidgetFactory = class {
|
|
|
27669
27824
|
*/
|
|
27670
27825
|
getSupportedWidgetIds() {
|
|
27671
27826
|
return [
|
|
27827
|
+
"cwd",
|
|
27672
27828
|
"model",
|
|
27673
27829
|
"context",
|
|
27674
27830
|
"cost",
|
|
@@ -27870,6 +28026,7 @@ var StdinProvider = class {
|
|
|
27870
28026
|
};
|
|
27871
28027
|
|
|
27872
28028
|
// src/index.ts
|
|
28029
|
+
init_theme();
|
|
27873
28030
|
async function readStdin() {
|
|
27874
28031
|
const chunks = [];
|
|
27875
28032
|
for await (const chunk of process.stdin) {
|
|
@@ -27901,7 +28058,9 @@ async function main() {
|
|
|
27901
28058
|
const stdinData = await provider.parse(stdin);
|
|
27902
28059
|
const registry = new WidgetRegistry();
|
|
27903
28060
|
const widgetConfig = await loadWidgetConfig();
|
|
27904
|
-
const
|
|
28061
|
+
const themeName = widgetConfig?.theme ?? "monokai";
|
|
28062
|
+
const themeColors = getThemeByName(themeName).colors;
|
|
28063
|
+
const factory = new WidgetFactory(themeColors);
|
|
27905
28064
|
if (widgetConfig) {
|
|
27906
28065
|
for (const [lineNum, widgets] of Object.entries(widgetConfig.lines)) {
|
|
27907
28066
|
for (const widgetConfigItem of widgets) {
|