ccsidekick 1.1.0 → 1.3.0
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/ccsidekick-render.js +129 -205
- package/dist/ccsidekick.js +172 -271
- package/package.json +12 -1
package/dist/ccsidekick.js
CHANGED
|
@@ -479,7 +479,7 @@ var init_themes = __esm(() => {
|
|
|
479
479
|
},
|
|
480
480
|
solarizedDark: {
|
|
481
481
|
displayName: "Solarized Dark",
|
|
482
|
-
hues: [32, 36,
|
|
482
|
+
hues: [32, 36, 178, 136, 168],
|
|
483
483
|
comment: [32, 36],
|
|
484
484
|
signals: { nominal: 46, caution: 136, critical: 167 },
|
|
485
485
|
separator: 100
|
|
@@ -507,14 +507,14 @@ var init_themes = __esm(() => {
|
|
|
507
507
|
},
|
|
508
508
|
materialPalenight: {
|
|
509
509
|
displayName: "Material Palenight",
|
|
510
|
-
hues: [111,
|
|
510
|
+
hues: [111, 141, 45, 220, 203],
|
|
511
511
|
comment: [60, 111, 176],
|
|
512
512
|
signals: { nominal: 150, caution: 214, critical: 217 },
|
|
513
513
|
separator: 150
|
|
514
514
|
},
|
|
515
515
|
nightOwl: {
|
|
516
516
|
displayName: "Night Owl",
|
|
517
|
-
hues: [111,
|
|
517
|
+
hues: [111, 122, 222, 149, 203],
|
|
518
518
|
comment: [111, 116],
|
|
519
519
|
signals: { nominal: 149, caution: 214, critical: 209 },
|
|
520
520
|
separator: 66
|
|
@@ -535,9 +535,9 @@ var init_themes = __esm(() => {
|
|
|
535
535
|
},
|
|
536
536
|
darcula: {
|
|
537
537
|
displayName: "Darcula",
|
|
538
|
-
hues: [173, 67, 103,
|
|
538
|
+
hues: [173, 67, 103, 77, 221],
|
|
539
539
|
comment: [173, 103],
|
|
540
|
-
signals: { nominal:
|
|
540
|
+
signals: { nominal: 77, caution: 221, critical: 203 },
|
|
541
541
|
separator: 173
|
|
542
542
|
},
|
|
543
543
|
xcodeDark: {
|
|
@@ -584,35 +584,35 @@ var init_themes = __esm(() => {
|
|
|
584
584
|
},
|
|
585
585
|
everforest: {
|
|
586
586
|
displayName: "Everforest",
|
|
587
|
-
hues: [
|
|
587
|
+
hues: [149, 222, 115, 173, 174],
|
|
588
588
|
comment: [144, 174],
|
|
589
589
|
signals: { nominal: 108, caution: 180, critical: 167 },
|
|
590
590
|
separator: 144
|
|
591
591
|
},
|
|
592
592
|
rosePine: {
|
|
593
593
|
displayName: "Rosé Pine",
|
|
594
|
-
hues: [181,
|
|
594
|
+
hues: [181, 74, 152, 182, 216],
|
|
595
595
|
comment: [60, 181, 182],
|
|
596
596
|
signals: { nominal: 46, caution: 214, critical: 181 },
|
|
597
597
|
separator: 66
|
|
598
598
|
},
|
|
599
599
|
rosePineMoon: {
|
|
600
600
|
displayName: "Rosé Pine Moon",
|
|
601
|
-
hues: [
|
|
601
|
+
hues: [217, 75, 122, 183, 223],
|
|
602
602
|
comment: [60, 174, 182],
|
|
603
603
|
signals: { nominal: 46, caution: 214, critical: 174 },
|
|
604
604
|
separator: 174
|
|
605
605
|
},
|
|
606
606
|
kanagawa: {
|
|
607
607
|
displayName: "Kanagawa",
|
|
608
|
-
hues: [110, 103,
|
|
608
|
+
hues: [110, 103, 79, 107, 180],
|
|
609
609
|
comment: [110, 103],
|
|
610
610
|
signals: { nominal: 107, caution: 180, critical: 203 },
|
|
611
611
|
separator: 107
|
|
612
612
|
},
|
|
613
613
|
tomorrowNight: {
|
|
614
614
|
displayName: "Tomorrow Night",
|
|
615
|
-
hues: [
|
|
615
|
+
hues: [110, 182, 149, 222, 167],
|
|
616
616
|
comment: [109, 139],
|
|
617
617
|
signals: { nominal: 46, caution: 214, critical: 203 },
|
|
618
618
|
separator: 143
|
|
@@ -626,7 +626,7 @@ var init_themes = __esm(() => {
|
|
|
626
626
|
},
|
|
627
627
|
iceberg: {
|
|
628
628
|
displayName: "Iceberg",
|
|
629
|
-
hues: [110, 140,
|
|
629
|
+
hues: [110, 140, 149, 180, 174],
|
|
630
630
|
comment: [60, 110, 140],
|
|
631
631
|
signals: { nominal: 46, caution: 214, critical: 203 },
|
|
632
632
|
separator: 144
|
|
@@ -668,7 +668,7 @@ var init_themes = __esm(() => {
|
|
|
668
668
|
},
|
|
669
669
|
moonlight: {
|
|
670
670
|
displayName: "Moonlight",
|
|
671
|
-
hues: [111,
|
|
671
|
+
hues: [111, 177, 123, 211, 155],
|
|
672
672
|
comment: [104, 111, 141],
|
|
673
673
|
signals: { nominal: 150, caution: 222, critical: 203 },
|
|
674
674
|
separator: 150
|
|
@@ -689,14 +689,14 @@ var init_themes = __esm(() => {
|
|
|
689
689
|
},
|
|
690
690
|
spacegray: {
|
|
691
691
|
displayName: "Spacegray",
|
|
692
|
-
hues: [
|
|
692
|
+
hues: [111, 182, 114, 180, 174],
|
|
693
693
|
comment: [109, 139],
|
|
694
694
|
signals: { nominal: 46, caution: 214, critical: 203 },
|
|
695
695
|
separator: 144
|
|
696
696
|
},
|
|
697
697
|
palenight: {
|
|
698
698
|
displayName: "Palenight",
|
|
699
|
-
hues: [
|
|
699
|
+
hues: [177, 117, 215, 150, 204],
|
|
700
700
|
comment: [60, 176, 111],
|
|
701
701
|
signals: { nominal: 150, caution: 214, critical: 209 },
|
|
702
702
|
separator: 209
|
|
@@ -717,7 +717,7 @@ var init_themes = __esm(() => {
|
|
|
717
717
|
},
|
|
718
718
|
githubDarkDimmed: {
|
|
719
719
|
displayName: "GitHub Dark Dimmed",
|
|
720
|
-
hues: [75,
|
|
720
|
+
hues: [75, 176, 78, 179, 174],
|
|
721
721
|
comment: [75, 183],
|
|
722
722
|
signals: { nominal: 114, caution: 215, critical: 203 },
|
|
723
723
|
separator: 215
|
|
@@ -757,107 +757,16 @@ var init_themes = __esm(() => {
|
|
|
757
757
|
signals: { nominal: 107, caution: 179, critical: 167 },
|
|
758
758
|
separator: 179
|
|
759
759
|
},
|
|
760
|
-
githubLight: {
|
|
761
|
-
displayName: "GitHub Light",
|
|
762
|
-
hues: [26, 98, 29, 130, 160],
|
|
763
|
-
comment: [26, 98],
|
|
764
|
-
signals: { nominal: 29, caution: 130, critical: 160 },
|
|
765
|
-
separator: 130
|
|
766
|
-
},
|
|
767
|
-
solarizedLight: {
|
|
768
|
-
displayName: "Solarized Light",
|
|
769
|
-
hues: [32, 36, 100, 136, 168],
|
|
770
|
-
comment: [32, 168],
|
|
771
|
-
signals: { nominal: 46, caution: 136, critical: 167 },
|
|
772
|
-
separator: 100
|
|
773
|
-
},
|
|
774
|
-
catppuccinLatte: {
|
|
775
|
-
displayName: "Catppuccin Latte",
|
|
776
|
-
hues: [99, 176, 27, 70, 202],
|
|
777
|
-
comment: [99, 176],
|
|
778
|
-
signals: { nominal: 70, caution: 214, critical: 203 },
|
|
779
|
-
separator: 70
|
|
780
|
-
},
|
|
781
|
-
gruvboxLight: {
|
|
782
|
-
displayName: "Gruvbox Light",
|
|
783
|
-
hues: [136, 130, 100, 24, 95],
|
|
784
|
-
comment: [136, 130],
|
|
785
|
-
signals: { nominal: 46, caution: 136, critical: 95 },
|
|
786
|
-
separator: 187
|
|
787
|
-
},
|
|
788
|
-
ayuLight: {
|
|
789
|
-
displayName: "Ayu Light",
|
|
790
|
-
hues: [209, 74, 106, 140, 204],
|
|
791
|
-
comment: [209, 74],
|
|
792
|
-
signals: { nominal: 46, caution: 214, critical: 209 },
|
|
793
|
-
separator: 106
|
|
794
|
-
},
|
|
795
|
-
oneLight: {
|
|
796
|
-
displayName: "One Light",
|
|
797
|
-
hues: [69, 71, 127, 31, 136],
|
|
798
|
-
comment: [69, 127],
|
|
799
|
-
signals: { nominal: 71, caution: 136, critical: 203 },
|
|
800
|
-
separator: 136
|
|
801
|
-
},
|
|
802
|
-
vscodeLightPlus: {
|
|
803
|
-
displayName: "VS Code Light+",
|
|
804
|
-
hues: [21, 128, 30, 29, 124],
|
|
805
|
-
comment: [28, 21, 30],
|
|
806
|
-
signals: { nominal: 29, caution: 214, critical: 124 },
|
|
807
|
-
separator: 124
|
|
808
|
-
},
|
|
809
|
-
xcodeLight: {
|
|
810
|
-
displayName: "Xcode Light",
|
|
811
|
-
hues: [133, 24, 20, 160],
|
|
812
|
-
comment: [66, 133, 20],
|
|
813
|
-
signals: { nominal: 46, caution: 214, critical: 160 },
|
|
814
|
-
separator: 160
|
|
815
|
-
},
|
|
816
|
-
quietLight: {
|
|
817
|
-
displayName: "Quiet Light",
|
|
818
|
-
hues: [62, 131, 64, 97, 136],
|
|
819
|
-
comment: [62, 64],
|
|
820
|
-
signals: { nominal: 64, caution: 136, critical: 131 },
|
|
821
|
-
separator: 64
|
|
822
|
-
},
|
|
823
|
-
tomorrowLight: {
|
|
824
|
-
displayName: "Tomorrow Light",
|
|
825
|
-
hues: [61, 97, 67, 64, 208],
|
|
826
|
-
comment: [61, 97],
|
|
827
|
-
signals: { nominal: 64, caution: 208, critical: 203 },
|
|
828
|
-
separator: 64
|
|
829
|
-
},
|
|
830
|
-
blulocoLight: {
|
|
831
|
-
displayName: "Bluloco Light",
|
|
832
|
-
hues: [26, 99, 32, 29, 166],
|
|
833
|
-
comment: [26, 32],
|
|
834
|
-
signals: { nominal: 29, caution: 166, critical: 203 },
|
|
835
|
-
separator: 166
|
|
836
|
-
},
|
|
837
|
-
rosePineDawn: {
|
|
838
|
-
displayName: "Rosé Pine Dawn",
|
|
839
|
-
hues: [174, 24, 67, 103, 179],
|
|
840
|
-
comment: [174, 103],
|
|
841
|
-
signals: { nominal: 46, caution: 179, critical: 174 },
|
|
842
|
-
separator: 179
|
|
843
|
-
},
|
|
844
760
|
githubHCDark: {
|
|
845
761
|
displayName: "GitHub HC Dark",
|
|
846
|
-
hues: [
|
|
762
|
+
hues: [45, 135, 47, 220, 196],
|
|
847
763
|
comment: [75, 183],
|
|
848
764
|
signals: { nominal: 77, caution: 215, critical: 210 },
|
|
849
765
|
separator: 77
|
|
850
766
|
},
|
|
851
|
-
githubHCLight: {
|
|
852
|
-
displayName: "GitHub HC Light",
|
|
853
|
-
hues: [25, 55, 22, 52, 124],
|
|
854
|
-
comment: [25, 55],
|
|
855
|
-
signals: { nominal: 22, caution: 214, critical: 52 },
|
|
856
|
-
separator: 22
|
|
857
|
-
},
|
|
858
767
|
vscodeHighContrast: {
|
|
859
768
|
displayName: "VS Code HC",
|
|
860
|
-
hues: [
|
|
769
|
+
hues: [45, 129, 118, 226, 203],
|
|
861
770
|
comment: [107, 74],
|
|
862
771
|
signals: { nominal: 79, caution: 214, critical: 203 },
|
|
863
772
|
separator: 74
|
|
@@ -1023,7 +932,13 @@ var SEP_GLYPH = "│", sanitizePackText = (s) => s.replace(/\x1b\[[0-9;?]*[ -/]*
|
|
|
1023
932
|
if (f.id === "model" && f.segments.length >= 2 && tail !== undefined) {
|
|
1024
933
|
const tailText = sanitizePackText(tail.text);
|
|
1025
934
|
const headText = f.segments.slice(0, -1).map((s) => sanitizePackText(s.text)).filter((t) => t !== "").join(" ");
|
|
1026
|
-
const headBudget =
|
|
935
|
+
const headBudget = budget - displayWidth(tailText) - 1;
|
|
936
|
+
if (headBudget < 1) {
|
|
937
|
+
return {
|
|
938
|
+
id: f.id,
|
|
939
|
+
segments: [{ role: "value", text: truncToWidth(fieldPlain(f), budget) }]
|
|
940
|
+
};
|
|
941
|
+
}
|
|
1027
942
|
return {
|
|
1028
943
|
id: f.id,
|
|
1029
944
|
segments: [
|
|
@@ -1033,6 +948,20 @@ var SEP_GLYPH = "│", sanitizePackText = (s) => s.replace(/\x1b\[[0-9;?]*[ -/]*
|
|
|
1033
948
|
};
|
|
1034
949
|
}
|
|
1035
950
|
return { id: f.id, segments: [{ role: "value", text: truncToWidth(fieldPlain(f), budget) }] };
|
|
951
|
+
}, fitCells = (cells, avail, sepGlyph) => {
|
|
952
|
+
if (cells.length === 0 || rowPlainWidth(cells, sepGlyph) <= avail)
|
|
953
|
+
return [...cells];
|
|
954
|
+
const last = cells[cells.length - 1];
|
|
955
|
+
if (last === undefined)
|
|
956
|
+
return [...cells];
|
|
957
|
+
const head = cells.slice(0, -1);
|
|
958
|
+
const sepWidth = displayWidth(` ${sepGlyph} `);
|
|
959
|
+
const headWidth = head.length > 0 ? displayWidth(head.map(fieldPlain).join(` ${sepGlyph} `)) : 0;
|
|
960
|
+
const budget = avail - headWidth - (head.length > 0 ? sepWidth : 0);
|
|
961
|
+
if (budget >= 1)
|
|
962
|
+
return [...head, truncateField(last, budget)];
|
|
963
|
+
const headFitted = fitCells(head, Math.max(1, avail - sepWidth - 1), sepGlyph);
|
|
964
|
+
return [...headFitted, truncateField(last, 1)];
|
|
1036
965
|
}, fitRow = (row, cells, avail, sepGlyph) => {
|
|
1037
966
|
const present = [...cells];
|
|
1038
967
|
for (const id of dropOrder(row)) {
|
|
@@ -1044,15 +973,7 @@ var SEP_GLYPH = "│", sanitizePackText = (s) => s.replace(/\x1b\[[0-9;?]*[ -/]*
|
|
|
1044
973
|
if (idx >= 0)
|
|
1045
974
|
present.splice(idx, 1);
|
|
1046
975
|
}
|
|
1047
|
-
|
|
1048
|
-
return present;
|
|
1049
|
-
const last = present[present.length - 1];
|
|
1050
|
-
if (last === undefined)
|
|
1051
|
-
return present;
|
|
1052
|
-
const head = present.slice(0, -1);
|
|
1053
|
-
const headWidth = head.length > 0 ? displayWidth(head.map(fieldPlain).join(` ${sepGlyph} `)) + displayWidth(` ${sepGlyph} `) : 0;
|
|
1054
|
-
const budget = Math.max(1, avail - headWidth);
|
|
1055
|
-
return [...head, truncateField(last, budget)];
|
|
976
|
+
return fitCells(present, avail, sepGlyph);
|
|
1056
977
|
}, colorCell = (field, lineIdx, cellIdx, input, term) => {
|
|
1057
978
|
const { theme, moodShift, mood } = input;
|
|
1058
979
|
const s = theme.statusline;
|
|
@@ -3563,15 +3484,34 @@ function candidateSet(config, installed) {
|
|
|
3563
3484
|
return [...installed].sort();
|
|
3564
3485
|
return ["batman"];
|
|
3565
3486
|
}
|
|
3566
|
-
function
|
|
3567
|
-
|
|
3568
|
-
|
|
3487
|
+
function lastUsedByCharacter(attribution, currentSession) {
|
|
3488
|
+
const out = {};
|
|
3489
|
+
for (const [sessionId, entry] of Object.entries(attribution)) {
|
|
3490
|
+
if (sessionId === currentSession)
|
|
3491
|
+
continue;
|
|
3492
|
+
const ts = entry.updatedMs ?? 0;
|
|
3493
|
+
if (ts > (out[entry.character] ?? 0))
|
|
3494
|
+
out[entry.character] = ts;
|
|
3495
|
+
}
|
|
3496
|
+
return out;
|
|
3497
|
+
}
|
|
3498
|
+
function derivePersona(config, state, session, installed, attribution) {
|
|
3499
|
+
const candidates = candidateSet(config, installed);
|
|
3500
|
+
const sticky = state.character;
|
|
3501
|
+
if (sticky !== undefined && sticky !== "" && stickyValid(config, candidates, sticky))
|
|
3502
|
+
return sticky;
|
|
3569
3503
|
if (config.character.mode === "fixed")
|
|
3570
3504
|
return config.character.name;
|
|
3571
|
-
const
|
|
3505
|
+
const lastUsed = lastUsedByCharacter(attribution, String(session));
|
|
3506
|
+
const recency = (name) => lastUsed[name] ?? 0;
|
|
3507
|
+
const oldest = Math.min(...candidates.map(recency));
|
|
3508
|
+
const tied = candidates.filter((name) => recency(name) === oldest);
|
|
3572
3509
|
const hash = createHash2("sha1").update(session).digest("hex");
|
|
3573
|
-
const idx = parseInt(hash.slice(0, 8), 16) %
|
|
3574
|
-
return
|
|
3510
|
+
const idx = parseInt(hash.slice(0, 8), 16) % tied.length;
|
|
3511
|
+
return tied[idx] ?? "batman";
|
|
3512
|
+
}
|
|
3513
|
+
function stickyValid(config, candidates, sticky) {
|
|
3514
|
+
return config.character.mode === "fixed" ? sticky === config.character.name : candidates.includes(sticky);
|
|
3575
3515
|
}
|
|
3576
3516
|
var init_persona = () => {};
|
|
3577
3517
|
|
|
@@ -4012,11 +3952,22 @@ var init_registry = __esm(() => {
|
|
|
4012
3952
|
PACKS = [
|
|
4013
3953
|
"barbie",
|
|
4014
3954
|
"batman",
|
|
3955
|
+
"ben10",
|
|
3956
|
+
"darth-vader",
|
|
3957
|
+
"deadpool",
|
|
3958
|
+
"gandalf",
|
|
4015
3959
|
"harry-potter",
|
|
4016
3960
|
"hello-kitty",
|
|
4017
|
-
"
|
|
3961
|
+
"iron-man",
|
|
4018
3962
|
"james-bond",
|
|
4019
|
-
"
|
|
3963
|
+
"joker",
|
|
3964
|
+
"naruto",
|
|
3965
|
+
"pikachu",
|
|
3966
|
+
"sherlock-holmes",
|
|
3967
|
+
"shinchan",
|
|
3968
|
+
"spiderman",
|
|
3969
|
+
"superman",
|
|
3970
|
+
"yoda"
|
|
4020
3971
|
];
|
|
4021
3972
|
});
|
|
4022
3973
|
|
|
@@ -4032,13 +3983,6 @@ import { join } from "node:path";
|
|
|
4032
3983
|
var ccsidekickRoot = (env = process.env) => join(env["CLAUDE_CONFIG_DIR"] ?? join(homedir(), ".claude"), "ccsidekick"), sessionDir = (root, id) => join(root, "sessions", id), cacheDir = (root) => join(root, "cache"), analyticsDir = (root) => join(root, "analytics");
|
|
4033
3984
|
var init_configDir = () => {};
|
|
4034
3985
|
|
|
4035
|
-
// src/sources/storage/engineRoot.ts
|
|
4036
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4037
|
-
function engineRoot(moduleUrl) {
|
|
4038
|
-
return fileURLToPath2(new URL("../", moduleUrl));
|
|
4039
|
-
}
|
|
4040
|
-
var init_engineRoot = () => {};
|
|
4041
|
-
|
|
4042
3986
|
// src/sources/storage/atomicWrite.ts
|
|
4043
3987
|
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
4044
3988
|
import { dirname } from "node:path";
|
|
@@ -4125,7 +4069,6 @@ var init_singleFlight = () => {};
|
|
|
4125
4069
|
// src/sources/storage/index.ts
|
|
4126
4070
|
var init_storage = __esm(() => {
|
|
4127
4071
|
init_configDir();
|
|
4128
|
-
init_engineRoot();
|
|
4129
4072
|
init_atomicWrite();
|
|
4130
4073
|
init_readJson();
|
|
4131
4074
|
init_withLock();
|
|
@@ -4146,7 +4089,8 @@ function coerceStore(raw) {
|
|
|
4146
4089
|
const project = entry["project"];
|
|
4147
4090
|
const character = entry["character"];
|
|
4148
4091
|
if (typeof project === "string" && typeof character === "string") {
|
|
4149
|
-
|
|
4092
|
+
const updatedMs = entry["updatedMs"];
|
|
4093
|
+
out[key] = typeof updatedMs === "number" ? { project, character, updatedMs } : { project, character };
|
|
4150
4094
|
}
|
|
4151
4095
|
}
|
|
4152
4096
|
return out;
|
|
@@ -4165,7 +4109,7 @@ function upsertAttribution(root, sessionId, rec) {
|
|
|
4165
4109
|
const path = storePath(root);
|
|
4166
4110
|
withLock(`${path}.lock`, () => {
|
|
4167
4111
|
const store = coerceStore(readJson(path, undefined));
|
|
4168
|
-
store[sessionId] = { project: rec.project, character: rec.character };
|
|
4112
|
+
store[sessionId] = rec.updatedMs !== undefined ? { project: rec.project, character: rec.character, updatedMs: rec.updatedMs } : { project: rec.project, character: rec.character };
|
|
4169
4113
|
atomicWrite(path, JSON.stringify(store));
|
|
4170
4114
|
}, () => {});
|
|
4171
4115
|
}
|
|
@@ -6564,49 +6508,14 @@ function readHelpfulEnv(cwd) {
|
|
|
6564
6508
|
var opt3 = (key, value) => value !== undefined ? { [key]: value } : {};
|
|
6565
6509
|
var init_helpfulEnv = () => {};
|
|
6566
6510
|
|
|
6567
|
-
// src/sources/installed.ts
|
|
6568
|
-
import { readdirSync, statSync as statSync3 } from "node:fs";
|
|
6569
|
-
import { join as join10 } from "node:path";
|
|
6570
|
-
function listInstalledPacks(engineDir) {
|
|
6571
|
-
const scope = join10(engineDir, "node_modules", "@ccsidekick");
|
|
6572
|
-
let entries;
|
|
6573
|
-
try {
|
|
6574
|
-
entries = readdirSync(scope, { withFileTypes: true });
|
|
6575
|
-
} catch {
|
|
6576
|
-
return [];
|
|
6577
|
-
}
|
|
6578
|
-
const ids = [];
|
|
6579
|
-
for (const entry of entries) {
|
|
6580
|
-
if (!entry.name.startsWith(PREFIX2) || entry.name.length <= PREFIX2.length)
|
|
6581
|
-
continue;
|
|
6582
|
-
if (!isDir(entry, join10(scope, entry.name)))
|
|
6583
|
-
continue;
|
|
6584
|
-
ids.push(entry.name.slice(PREFIX2.length));
|
|
6585
|
-
}
|
|
6586
|
-
return ids.sort();
|
|
6587
|
-
}
|
|
6588
|
-
function isDir(entry, path) {
|
|
6589
|
-
if (entry.isDirectory())
|
|
6590
|
-
return true;
|
|
6591
|
-
if (!entry.isSymbolicLink())
|
|
6592
|
-
return false;
|
|
6593
|
-
try {
|
|
6594
|
-
return statSync3(path).isDirectory();
|
|
6595
|
-
} catch {
|
|
6596
|
-
return false;
|
|
6597
|
-
}
|
|
6598
|
-
}
|
|
6599
|
-
var PREFIX2 = "pack-";
|
|
6600
|
-
var init_installed = () => {};
|
|
6601
|
-
|
|
6602
6511
|
// src/sources/markers.ts
|
|
6603
|
-
import { readdirSync
|
|
6512
|
+
import { readdirSync } from "node:fs";
|
|
6604
6513
|
import { dirname as dirname4, resolve as resolve2 } from "node:path";
|
|
6605
6514
|
function scanDir(dir, stacks) {
|
|
6606
6515
|
let entries;
|
|
6607
6516
|
let isRepoRoot = false;
|
|
6608
6517
|
try {
|
|
6609
|
-
entries =
|
|
6518
|
+
entries = readdirSync(dir);
|
|
6610
6519
|
} catch {
|
|
6611
6520
|
return false;
|
|
6612
6521
|
}
|
|
@@ -6699,7 +6608,7 @@ var init_markers = __esm(() => {
|
|
|
6699
6608
|
});
|
|
6700
6609
|
|
|
6701
6610
|
// src/sources/modelNames.ts
|
|
6702
|
-
import { join as
|
|
6611
|
+
import { join as join10 } from "node:path";
|
|
6703
6612
|
function readModelNames(root) {
|
|
6704
6613
|
return readJson(cachePath(root), {});
|
|
6705
6614
|
}
|
|
@@ -6708,7 +6617,7 @@ function learnModelName(root, current, id, name) {
|
|
|
6708
6617
|
return;
|
|
6709
6618
|
atomicWrite(cachePath(root), JSON.stringify({ ...current, [id]: name }));
|
|
6710
6619
|
}
|
|
6711
|
-
var cachePath = (root) =>
|
|
6620
|
+
var cachePath = (root) => join10(cacheDir(root), "model-names.json");
|
|
6712
6621
|
var init_modelNames = __esm(() => {
|
|
6713
6622
|
init_storage();
|
|
6714
6623
|
});
|
|
@@ -6818,7 +6727,7 @@ function parsePayload(raw) {
|
|
|
6818
6727
|
var str2 = (v) => typeof v === "string" ? v : undefined, num = (v) => typeof v === "number" ? v : undefined, bool2 = (v) => typeof v === "boolean" ? v : undefined, obj2 = (v) => v !== null && typeof v === "object" ? v : {}, opt4 = (key, value) => value !== undefined ? { [key]: value } : {};
|
|
6819
6728
|
|
|
6820
6729
|
// src/sources/state.ts
|
|
6821
|
-
import { join as
|
|
6730
|
+
import { join as join11 } from "node:path";
|
|
6822
6731
|
function isObject5(v) {
|
|
6823
6732
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
6824
6733
|
}
|
|
@@ -6841,7 +6750,7 @@ function asHelpful(v) {
|
|
|
6841
6750
|
return out;
|
|
6842
6751
|
}
|
|
6843
6752
|
function readState(sessionDir2) {
|
|
6844
|
-
const raw = readJson(
|
|
6753
|
+
const raw = readJson(join11(sessionDir2, STATE_FILE), undefined);
|
|
6845
6754
|
if (!isObject5(raw))
|
|
6846
6755
|
return EMPTY2;
|
|
6847
6756
|
const character = raw["character"];
|
|
@@ -6871,7 +6780,7 @@ function mergeState(disk, next) {
|
|
|
6871
6780
|
};
|
|
6872
6781
|
}
|
|
6873
6782
|
function writeState(sessionDir2, s) {
|
|
6874
|
-
const path =
|
|
6783
|
+
const path = join11(sessionDir2, STATE_FILE);
|
|
6875
6784
|
withLock(`${path}.lock`, () => {
|
|
6876
6785
|
atomicWrite(path, JSON.stringify(mergeState(readState(sessionDir2), s)));
|
|
6877
6786
|
}, () => {});
|
|
@@ -6883,8 +6792,8 @@ var init_state = __esm(() => {
|
|
|
6883
6792
|
});
|
|
6884
6793
|
|
|
6885
6794
|
// src/sources/transcript.ts
|
|
6886
|
-
import { readFileSync as readFileSync8, readdirSync as
|
|
6887
|
-
import { basename as basename2, dirname as dirname5, join as
|
|
6795
|
+
import { readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
6796
|
+
import { basename as basename2, dirname as dirname5, join as join12 } from "node:path";
|
|
6888
6797
|
function parseTs(s) {
|
|
6889
6798
|
if (s === undefined)
|
|
6890
6799
|
return;
|
|
@@ -7105,7 +7014,7 @@ function reconstructTodos(lines) {
|
|
|
7105
7014
|
}
|
|
7106
7015
|
function statSafe(p) {
|
|
7107
7016
|
try {
|
|
7108
|
-
const s =
|
|
7017
|
+
const s = statSync3(p);
|
|
7109
7018
|
return { mtimeMs: s.mtimeMs, size: s.size };
|
|
7110
7019
|
} catch {
|
|
7111
7020
|
return null;
|
|
@@ -7192,7 +7101,7 @@ function repoRootForCwd(cwd) {
|
|
|
7192
7101
|
let result = cwd;
|
|
7193
7102
|
while (dir !== "" && dir !== dirname5(dir)) {
|
|
7194
7103
|
try {
|
|
7195
|
-
if (
|
|
7104
|
+
if (statSync3(join12(dir, ".git")).isDirectory()) {
|
|
7196
7105
|
result = dir;
|
|
7197
7106
|
break;
|
|
7198
7107
|
}
|
|
@@ -7205,15 +7114,15 @@ function repoRootForCwd(cwd) {
|
|
|
7205
7114
|
function* walkTree(dir, encodedDir) {
|
|
7206
7115
|
let entries;
|
|
7207
7116
|
try {
|
|
7208
|
-
entries =
|
|
7117
|
+
entries = readdirSync2(dir);
|
|
7209
7118
|
} catch {
|
|
7210
7119
|
return;
|
|
7211
7120
|
}
|
|
7212
7121
|
for (const name of entries) {
|
|
7213
|
-
const full =
|
|
7122
|
+
const full = join12(dir, name);
|
|
7214
7123
|
let st;
|
|
7215
7124
|
try {
|
|
7216
|
-
st =
|
|
7125
|
+
st = statSync3(full);
|
|
7217
7126
|
} catch {
|
|
7218
7127
|
continue;
|
|
7219
7128
|
}
|
|
@@ -7227,12 +7136,12 @@ function* walkTree(dir, encodedDir) {
|
|
|
7227
7136
|
function* walkJsonl(root) {
|
|
7228
7137
|
let dirs;
|
|
7229
7138
|
try {
|
|
7230
|
-
dirs =
|
|
7139
|
+
dirs = readdirSync2(root);
|
|
7231
7140
|
} catch {
|
|
7232
7141
|
return;
|
|
7233
7142
|
}
|
|
7234
7143
|
for (const encodedDir of dirs) {
|
|
7235
|
-
yield* walkTree(
|
|
7144
|
+
yield* walkTree(join12(root, encodedDir), encodedDir);
|
|
7236
7145
|
}
|
|
7237
7146
|
}
|
|
7238
7147
|
function scanBounds(lines) {
|
|
@@ -7387,7 +7296,6 @@ var init_sources = __esm(() => {
|
|
|
7387
7296
|
init_fx();
|
|
7388
7297
|
init_git();
|
|
7389
7298
|
init_helpfulEnv();
|
|
7390
|
-
init_installed();
|
|
7391
7299
|
init_markers();
|
|
7392
7300
|
init_modelNames();
|
|
7393
7301
|
init_oauthUsage();
|
|
@@ -7397,15 +7305,15 @@ var init_sources = __esm(() => {
|
|
|
7397
7305
|
});
|
|
7398
7306
|
|
|
7399
7307
|
// src/cli/gc.ts
|
|
7400
|
-
import { existsSync as existsSync2, readdirSync as
|
|
7401
|
-
import { join as
|
|
7308
|
+
import { existsSync as existsSync2, readdirSync as readdirSync3, rmSync, statSync as statSync4 } from "node:fs";
|
|
7309
|
+
import { join as join13 } from "node:path";
|
|
7402
7310
|
function newestMtime(dir) {
|
|
7403
7311
|
let newest = 0;
|
|
7404
7312
|
try {
|
|
7405
|
-
newest =
|
|
7406
|
-
for (const name of
|
|
7313
|
+
newest = statSync4(dir).mtimeMs;
|
|
7314
|
+
for (const name of readdirSync3(dir)) {
|
|
7407
7315
|
try {
|
|
7408
|
-
const m =
|
|
7316
|
+
const m = statSync4(join13(dir, name)).mtimeMs;
|
|
7409
7317
|
if (m > newest)
|
|
7410
7318
|
newest = m;
|
|
7411
7319
|
} catch {}
|
|
@@ -7414,18 +7322,18 @@ function newestMtime(dir) {
|
|
|
7414
7322
|
return newest;
|
|
7415
7323
|
}
|
|
7416
7324
|
function pruneSessions(root, now) {
|
|
7417
|
-
const sessions =
|
|
7325
|
+
const sessions = join13(root, "sessions");
|
|
7418
7326
|
let names;
|
|
7419
7327
|
try {
|
|
7420
|
-
names =
|
|
7328
|
+
names = readdirSync3(sessions);
|
|
7421
7329
|
} catch {
|
|
7422
7330
|
return;
|
|
7423
7331
|
}
|
|
7424
7332
|
const cutoff = now - SESSION_TTL_DAYS * DAY_MS;
|
|
7425
7333
|
for (const name of names) {
|
|
7426
|
-
const dir =
|
|
7334
|
+
const dir = join13(sessions, name);
|
|
7427
7335
|
try {
|
|
7428
|
-
if (!
|
|
7336
|
+
if (!statSync4(dir).isDirectory())
|
|
7429
7337
|
continue;
|
|
7430
7338
|
} catch {
|
|
7431
7339
|
continue;
|
|
@@ -7464,7 +7372,7 @@ var init_gc = __esm(() => {
|
|
|
7464
7372
|
|
|
7465
7373
|
// src/cli/render.ts
|
|
7466
7374
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
7467
|
-
import { dirname as dirname6, join as
|
|
7375
|
+
import { dirname as dirname6, join as join14 } from "node:path";
|
|
7468
7376
|
function readTextSafe(path) {
|
|
7469
7377
|
try {
|
|
7470
7378
|
return readFileSync9(path, "utf8");
|
|
@@ -7501,13 +7409,12 @@ function applyThemeIcons(fields, theme, config) {
|
|
|
7501
7409
|
};
|
|
7502
7410
|
});
|
|
7503
7411
|
}
|
|
7504
|
-
function readGated(overrides, envInputs, config, root, dir, markers,
|
|
7412
|
+
function readGated(overrides, envInputs, config, root, dir, markers, clock) {
|
|
7505
7413
|
const creds = overrides?.creds !== undefined ? overrides.creds : envInputs.hasApiKey || config.network.usage_fetch ? readCreds() : null;
|
|
7506
7414
|
const usage = overrides?.usage !== undefined ? overrides.usage : config.network.usage_fetch ? readUsageCached(root) : null;
|
|
7507
7415
|
const balance = overrides?.balance !== undefined ? overrides.balance : config.network.balance_path !== "" ? readBalance(config.network.balance_path, clock) : null;
|
|
7508
7416
|
const helpfulEnv = needsHelpfulEnv(markers) ? readHelpfulEnv(dir) : EMPTY_HELPFUL_ENV;
|
|
7509
|
-
|
|
7510
|
-
return { creds, usage, balance, helpfulEnv, installed };
|
|
7417
|
+
return { creds, usage, balance, helpfulEnv };
|
|
7511
7418
|
}
|
|
7512
7419
|
function lookupPackTheme(name) {
|
|
7513
7420
|
const loaded = loadPack(name);
|
|
@@ -7534,10 +7441,10 @@ function build(stdin, env, term, clock, overrides) {
|
|
|
7534
7441
|
return { line: "", persist: NOOP };
|
|
7535
7442
|
const root = ccsidekickRoot(env);
|
|
7536
7443
|
const base = dirname6(root);
|
|
7537
|
-
const projectsRoot =
|
|
7444
|
+
const projectsRoot = join14(base, "projects");
|
|
7538
7445
|
const dir = payload.workspace.current_dir ?? payload.cwd ?? process.cwd();
|
|
7539
|
-
const globalToml = readTextSafe(
|
|
7540
|
-
const projectToml = readTextSafe(
|
|
7446
|
+
const globalToml = readTextSafe(join14(root, "config.toml"));
|
|
7447
|
+
const projectToml = readTextSafe(join14(dir, ".ccsidekick", "config.toml"));
|
|
7541
7448
|
const config = loadConfig(globalToml, projectToml);
|
|
7542
7449
|
const envInputs = readEnv(env);
|
|
7543
7450
|
const aliases = readModelAliases(env);
|
|
@@ -7552,8 +7459,8 @@ function build(stdin, env, term, clock, overrides) {
|
|
|
7552
7459
|
const attribution = readAttribution(root);
|
|
7553
7460
|
const costCache = readCostCache(root);
|
|
7554
7461
|
const fxTable = readFxCached(root);
|
|
7555
|
-
const { creds, usage, balance, helpfulEnv
|
|
7556
|
-
const persona = derivePersona(config, sessionState, session,
|
|
7462
|
+
const { creds, usage, balance, helpfulEnv } = readGated(overrides, envInputs, config, root, dir, markers, clock);
|
|
7463
|
+
const persona = derivePersona(config, sessionState, session, PACKS, attribution);
|
|
7557
7464
|
const loaded = loadPack(persona);
|
|
7558
7465
|
const pack = loaded.ok ? loaded.pack : null;
|
|
7559
7466
|
const project = deriveProject(git, payload);
|
|
@@ -7662,7 +7569,8 @@ function build(stdin, env, term, clock, overrides) {
|
|
|
7662
7569
|
swallow(() => {
|
|
7663
7570
|
upsertAttribution(root, String(session), {
|
|
7664
7571
|
project: String(project),
|
|
7665
|
-
character: persona
|
|
7572
|
+
character: persona,
|
|
7573
|
+
updatedMs: clock.now()
|
|
7666
7574
|
});
|
|
7667
7575
|
});
|
|
7668
7576
|
if (!isDefault) {
|
|
@@ -7726,8 +7634,8 @@ var init_render2 = __esm(() => {
|
|
|
7726
7634
|
});
|
|
7727
7635
|
|
|
7728
7636
|
// src/cli/settings.ts
|
|
7729
|
-
import { existsSync as existsSync3, readFileSync as readFileSync10, readdirSync as
|
|
7730
|
-
import { basename as basename3, dirname as dirname7, join as
|
|
7637
|
+
import { existsSync as existsSync3, readFileSync as readFileSync10, readdirSync as readdirSync4, renameSync as renameSync2, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7638
|
+
import { basename as basename3, dirname as dirname7, join as join15 } from "node:path";
|
|
7731
7639
|
function asRecord(v) {
|
|
7732
7640
|
return typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
|
|
7733
7641
|
}
|
|
@@ -7751,9 +7659,9 @@ function isOurClassifyEntry(entry, classifyCmd) {
|
|
|
7751
7659
|
function pruneBackups(settingsPath) {
|
|
7752
7660
|
const dir = dirname7(settingsPath);
|
|
7753
7661
|
const prefix = backupPrefix(settingsPath);
|
|
7754
|
-
const baks =
|
|
7662
|
+
const baks = readdirSync4(dir).filter((f) => f.startsWith(prefix)).map((f) => ({ name: f, epoch: Number(f.slice(prefix.length)) })).filter((b) => Number.isFinite(b.epoch)).sort((a, b) => a.epoch - b.epoch);
|
|
7755
7663
|
for (const b of baks.slice(1, -1))
|
|
7756
|
-
rmSync2(
|
|
7664
|
+
rmSync2(join15(dir, b.name), { force: true });
|
|
7757
7665
|
}
|
|
7758
7666
|
function safeWriteJson(path, text, restoreText) {
|
|
7759
7667
|
const tmp = `${path}.tmp.${String(process.pid)}.${Math.random().toString(36).slice(2)}`;
|
|
@@ -7808,7 +7716,7 @@ function installSettings(opts) {
|
|
|
7808
7716
|
`, originalText);
|
|
7809
7717
|
}
|
|
7810
7718
|
function writeConfigToml(root, config) {
|
|
7811
|
-
atomicWrite(
|
|
7719
|
+
atomicWrite(join15(root, "config.toml"), stringify(config));
|
|
7812
7720
|
}
|
|
7813
7721
|
var MATCHER = "Bash|Edit|Write|NotebookEdit|Read|Grep|Glob|WebFetch|WebSearch|Agent|TaskCreate|TaskUpdate|Task|Skill|TodoWrite", HOOK_EVENTS, backupPrefix = (settingsPath) => `${basename3(settingsPath)}.ccsidekick-bak.`;
|
|
7814
7722
|
var init_settings = __esm(() => {
|
|
@@ -7820,7 +7728,7 @@ var init_settings = __esm(() => {
|
|
|
7820
7728
|
|
|
7821
7729
|
// src/cli/setup.ts
|
|
7822
7730
|
import { readFileSync as readFileSync11 } from "node:fs";
|
|
7823
|
-
import { join as
|
|
7731
|
+
import { join as join16 } from "node:path";
|
|
7824
7732
|
function themeNames() {
|
|
7825
7733
|
return [CHARACTER_THEME, ...Object.keys(THEMES), ...PACKS];
|
|
7826
7734
|
}
|
|
@@ -7890,7 +7798,7 @@ function parseSetup(argv, homeDir, env) {
|
|
|
7890
7798
|
if (bools.has("global") && bools.has("local"))
|
|
7891
7799
|
errors.push("ccsidekick: pass only one of --global / --local");
|
|
7892
7800
|
const scope = bools.has("local") ? "local" : "global";
|
|
7893
|
-
const dir = pairs.get("config-dir") ?? env["CLAUDE_CONFIG_DIR"] ??
|
|
7801
|
+
const dir = pairs.get("config-dir") ?? env["CLAUDE_CONFIG_DIR"] ?? join16(homeDir, ".claude");
|
|
7894
7802
|
return { flags, target: { scope, dir }, errors };
|
|
7895
7803
|
}
|
|
7896
7804
|
function applySetup(base, flags) {
|
|
@@ -7923,7 +7831,7 @@ function applySetup(base, flags) {
|
|
|
7923
7831
|
};
|
|
7924
7832
|
}
|
|
7925
7833
|
function existingConfigPath(target, cwd) {
|
|
7926
|
-
return target.scope === "global" ?
|
|
7834
|
+
return target.scope === "global" ? join16(target.dir, "ccsidekick", "config.toml") : join16(cwd, ".ccsidekick", "config.toml");
|
|
7927
7835
|
}
|
|
7928
7836
|
function runSetup(argv, deps) {
|
|
7929
7837
|
const parsed = parseSetup(argv, deps.homeDir, deps.env);
|
|
@@ -8071,8 +7979,8 @@ var init_setup = __esm(() => {
|
|
|
8071
7979
|
});
|
|
8072
7980
|
|
|
8073
7981
|
// src/cli/uninstall.ts
|
|
8074
|
-
import { existsSync as existsSync4, readFileSync as readFileSync12, readdirSync as
|
|
8075
|
-
import { basename as basename4, dirname as dirname8, join as
|
|
7982
|
+
import { existsSync as existsSync4, readFileSync as readFileSync12, readdirSync as readdirSync5 } from "node:fs";
|
|
7983
|
+
import { basename as basename4, dirname as dirname8, join as join17 } from "node:path";
|
|
8076
7984
|
function asRecord2(v) {
|
|
8077
7985
|
return typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
|
|
8078
7986
|
}
|
|
@@ -8107,7 +8015,7 @@ function restoreNewestBackup(settingsPath) {
|
|
|
8107
8015
|
const dir = dirname8(settingsPath);
|
|
8108
8016
|
const prefix = `${basename4(settingsPath)}.ccsidekick-bak.`;
|
|
8109
8017
|
let newest;
|
|
8110
|
-
for (const f of
|
|
8018
|
+
for (const f of readdirSync5(dir)) {
|
|
8111
8019
|
if (!f.startsWith(prefix))
|
|
8112
8020
|
continue;
|
|
8113
8021
|
const epoch = Number(f.slice(prefix.length));
|
|
@@ -8118,7 +8026,7 @@ function restoreNewestBackup(settingsPath) {
|
|
|
8118
8026
|
}
|
|
8119
8027
|
if (newest === undefined)
|
|
8120
8028
|
return null;
|
|
8121
|
-
atomicWrite(settingsPath, readFileSync12(
|
|
8029
|
+
atomicWrite(settingsPath, readFileSync12(join17(dir, newest.name), "utf8"));
|
|
8122
8030
|
return newest.name;
|
|
8123
8031
|
}
|
|
8124
8032
|
function runRestore(settingsPath, emit) {
|
|
@@ -8200,21 +8108,21 @@ var init_cli = __esm(() => {
|
|
|
8200
8108
|
});
|
|
8201
8109
|
|
|
8202
8110
|
// src/tui/configDirs.ts
|
|
8203
|
-
import { existsSync as existsSync5, readdirSync as
|
|
8204
|
-
import { join as
|
|
8111
|
+
import { existsSync as existsSync5, readdirSync as readdirSync6 } from "node:fs";
|
|
8112
|
+
import { join as join18 } from "node:path";
|
|
8205
8113
|
function discoverConfigDirs(homeDir, suggested) {
|
|
8206
|
-
const home =
|
|
8114
|
+
const home = join18(homeDir, ".claude");
|
|
8207
8115
|
const set = new Set([home]);
|
|
8208
8116
|
try {
|
|
8209
|
-
for (const entry of
|
|
8117
|
+
for (const entry of readdirSync6(homeDir, { withFileTypes: true })) {
|
|
8210
8118
|
if (entry.isDirectory() && entry.name.startsWith(".claude")) {
|
|
8211
|
-
set.add(
|
|
8119
|
+
set.add(join18(homeDir, entry.name));
|
|
8212
8120
|
}
|
|
8213
8121
|
}
|
|
8214
8122
|
} catch {}
|
|
8215
8123
|
if (suggested !== undefined && suggested !== "")
|
|
8216
8124
|
set.add(suggested);
|
|
8217
|
-
const dirs = [...set].filter((d) => existsSync5(
|
|
8125
|
+
const dirs = [...set].filter((d) => existsSync5(join18(d, "settings.json"))).sort();
|
|
8218
8126
|
let suggestedIndex = 0;
|
|
8219
8127
|
if (suggested !== undefined && suggested !== "" && dirs.includes(suggested)) {
|
|
8220
8128
|
suggestedIndex = dirs.indexOf(suggested);
|
|
@@ -8255,18 +8163,11 @@ var ACCENT = "#ffd700", FRAME = "gray", DANGER = "red";
|
|
|
8255
8163
|
|
|
8256
8164
|
// src/tui/save.ts
|
|
8257
8165
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
8258
|
-
import { join as
|
|
8166
|
+
import { join as join19 } from "node:path";
|
|
8259
8167
|
function defaultResolveVerbs(name) {
|
|
8260
8168
|
const loaded = loadPack(name);
|
|
8261
8169
|
return loaded.ok ? loaded.pack.spinnerVerbs : [];
|
|
8262
8170
|
}
|
|
8263
|
-
function defaultInstalled() {
|
|
8264
|
-
try {
|
|
8265
|
-
return listInstalledPacks(engineRoot(import.meta.url));
|
|
8266
|
-
} catch {
|
|
8267
|
-
return [];
|
|
8268
|
-
}
|
|
8269
|
-
}
|
|
8270
8171
|
function spinnerVerbUnion(config, resolveVerbs, installed) {
|
|
8271
8172
|
const candidates = config.character.mode === "fixed" ? [config.character.name] : config.character.roster.length > 0 ? [...config.character.roster] : [...installed];
|
|
8272
8173
|
const seen = new Set;
|
|
@@ -8286,21 +8187,21 @@ function normalize(config) {
|
|
|
8286
8187
|
}
|
|
8287
8188
|
function save(config, scope, dir, renderBin, opts = {}) {
|
|
8288
8189
|
const resolveVerbs = opts.resolveVerbs ?? defaultResolveVerbs;
|
|
8289
|
-
const installed = opts.installed ??
|
|
8190
|
+
const installed = opts.installed ?? PACKS;
|
|
8290
8191
|
const cwd = opts.cwd ?? process.cwd();
|
|
8291
8192
|
const normalized = normalize(config);
|
|
8292
8193
|
const spinnerVerbs = spinnerVerbUnion(normalized, resolveVerbs, installed);
|
|
8293
8194
|
if (scope === "global") {
|
|
8294
|
-
writeConfigToml(
|
|
8295
|
-
installSettings({ settingsPath:
|
|
8195
|
+
writeConfigToml(join19(dir, "ccsidekick"), normalized);
|
|
8196
|
+
installSettings({ settingsPath: join19(dir, "settings.json"), renderBin, spinnerVerbs });
|
|
8296
8197
|
return;
|
|
8297
8198
|
}
|
|
8298
|
-
writeConfigToml(
|
|
8199
|
+
writeConfigToml(join19(cwd, ".ccsidekick"), normalized);
|
|
8299
8200
|
if (opts.wireLocalSettings === true) {
|
|
8300
|
-
const claudeDir =
|
|
8201
|
+
const claudeDir = join19(cwd, ".claude");
|
|
8301
8202
|
mkdirSync4(claudeDir, { recursive: true });
|
|
8302
8203
|
installSettings({
|
|
8303
|
-
settingsPath:
|
|
8204
|
+
settingsPath: join19(claudeDir, "settings.json"),
|
|
8304
8205
|
renderBin,
|
|
8305
8206
|
spinnerVerbs
|
|
8306
8207
|
});
|
|
@@ -10998,9 +10899,9 @@ var init_PreviewPanel = __esm(() => {
|
|
|
10998
10899
|
import { execFileSync } from "node:child_process";
|
|
10999
10900
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, mkdtempSync, realpathSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
11000
10901
|
import { tmpdir } from "node:os";
|
|
11001
|
-
import { join as
|
|
10902
|
+
import { join as join20 } from "node:path";
|
|
11002
10903
|
function seedTranscriptFixture(workdir) {
|
|
11003
|
-
const path =
|
|
10904
|
+
const path = join20(workdir, "preview-transcript.jsonl");
|
|
11004
10905
|
try {
|
|
11005
10906
|
mkdirSync5(workdir, { recursive: true });
|
|
11006
10907
|
if (!existsSync6(path)) {
|
|
@@ -11071,7 +10972,7 @@ function gitEnv() {
|
|
|
11071
10972
|
function setupGitFixture(workdir) {
|
|
11072
10973
|
try {
|
|
11073
10974
|
mkdirSync5(workdir, { recursive: true });
|
|
11074
|
-
if (existsSync6(
|
|
10975
|
+
if (existsSync6(join20(workdir, ".git")))
|
|
11075
10976
|
return;
|
|
11076
10977
|
const env2 = gitEnv();
|
|
11077
10978
|
const git = (...args) => {
|
|
@@ -11081,20 +10982,20 @@ function setupGitFixture(workdir) {
|
|
|
11081
10982
|
git("config", "user.email", "wayne@example.com");
|
|
11082
10983
|
git("config", "user.name", "Bruce Wayne");
|
|
11083
10984
|
git("remote", "add", "origin", "https://github.com/wayne/ccsidekick.git");
|
|
11084
|
-
writeFileSync4(
|
|
10985
|
+
writeFileSync4(join20(workdir, "README.md"), `# ccsidekick
|
|
11085
10986
|
|
|
11086
10987
|
original line
|
|
11087
10988
|
keep me
|
|
11088
10989
|
`);
|
|
11089
10990
|
git("add", "README.md");
|
|
11090
10991
|
git("commit", "-q", "-m", "initial commit");
|
|
11091
|
-
writeFileSync4(
|
|
10992
|
+
writeFileSync4(join20(workdir, "README.md"), `# ccsidekick
|
|
11092
10993
|
|
|
11093
10994
|
edited line
|
|
11094
10995
|
keep me
|
|
11095
10996
|
new line
|
|
11096
10997
|
`);
|
|
11097
|
-
writeFileSync4(
|
|
10998
|
+
writeFileSync4(join20(workdir, "src.ts"), `export const answer = 42;
|
|
11098
10999
|
`);
|
|
11099
11000
|
git("add", "src.ts");
|
|
11100
11001
|
} catch {}
|
|
@@ -11116,24 +11017,24 @@ function transcriptLine(id, model, inputTokens, outputTokens) {
|
|
|
11116
11017
|
});
|
|
11117
11018
|
}
|
|
11118
11019
|
function seedCostFixture(root, workdir) {
|
|
11119
|
-
const projectsRoot =
|
|
11120
|
-
const currentProjectDir =
|
|
11121
|
-
const otherProjectDir =
|
|
11020
|
+
const projectsRoot = join20(root, "projects");
|
|
11021
|
+
const currentProjectDir = join20(projectsRoot, workdir.replace(/[/.]/g, "-"));
|
|
11022
|
+
const otherProjectDir = join20(projectsRoot, "-other-project");
|
|
11122
11023
|
mkdirSync5(currentProjectDir, { recursive: true });
|
|
11123
11024
|
mkdirSync5(otherProjectDir, { recursive: true });
|
|
11124
|
-
writeFileSync4(
|
|
11025
|
+
writeFileSync4(join20(currentProjectDir, "sess-a.jsonl"), `${transcriptLine("sess-a-1", "claude-opus-4-8", 1e5, 20000)}
|
|
11125
11026
|
`);
|
|
11126
|
-
writeFileSync4(
|
|
11027
|
+
writeFileSync4(join20(otherProjectDir, "sess-b.jsonl"), `${transcriptLine("sess-b-1", "claude-opus-4-8", 200000, 50000)}
|
|
11127
11028
|
`);
|
|
11128
11029
|
}
|
|
11129
11030
|
function scratchRoot(scratchDir) {
|
|
11130
11031
|
if (scratchDir !== undefined)
|
|
11131
11032
|
return scratchDir;
|
|
11132
|
-
sharedScratch ??= mkdtempSync(
|
|
11033
|
+
sharedScratch ??= mkdtempSync(join20(tmpdir(), "ccsidekick-preview-"));
|
|
11133
11034
|
return sharedScratch;
|
|
11134
11035
|
}
|
|
11135
11036
|
function previewEnv(root, extra) {
|
|
11136
|
-
const homeBase =
|
|
11037
|
+
const homeBase = join20(root, "home");
|
|
11137
11038
|
mkdirSync5(homeBase, { recursive: true });
|
|
11138
11039
|
let home = homeBase;
|
|
11139
11040
|
try {
|
|
@@ -11210,15 +11111,15 @@ var init_scenarios = __esm(() => {
|
|
|
11210
11111
|
});
|
|
11211
11112
|
|
|
11212
11113
|
// src/tui/preview/render.ts
|
|
11213
|
-
import { join as
|
|
11114
|
+
import { join as join21 } from "node:path";
|
|
11214
11115
|
function renderScenario(scenario, draft, opts) {
|
|
11215
11116
|
try {
|
|
11216
11117
|
const clock = opts.clock ?? DEFAULT_CLOCK;
|
|
11217
11118
|
const root = scratchRoot(opts.scratchDir);
|
|
11218
|
-
writeConfigToml(
|
|
11119
|
+
writeConfigToml(join21(root, "ccsidekick"), draft);
|
|
11219
11120
|
const env2 = previewEnv(root, scenario.env ?? {});
|
|
11220
11121
|
const home = env2["HOME"] ?? root;
|
|
11221
|
-
const workdir =
|
|
11122
|
+
const workdir = join21(home, "ccsidekick");
|
|
11222
11123
|
setupGitFixture(workdir);
|
|
11223
11124
|
seedCostFixture(root, workdir);
|
|
11224
11125
|
const term = { columns: opts.columns, noColor: opts.noColor, isTTY: true };
|
|
@@ -12917,7 +12818,7 @@ var init_inputRoute = __esm(() => {
|
|
|
12917
12818
|
|
|
12918
12819
|
// src/tui/shell/saveTarget.ts
|
|
12919
12820
|
import { existsSync as existsSync8, readFileSync as readFileSync13 } from "node:fs";
|
|
12920
|
-
import { join as
|
|
12821
|
+
import { join as join22 } from "node:path";
|
|
12921
12822
|
function chipFor(targets) {
|
|
12922
12823
|
if (targets.every((t) => t.scope === "global"))
|
|
12923
12824
|
return "global";
|
|
@@ -12936,12 +12837,12 @@ function alreadyWired(settingsPath) {
|
|
|
12936
12837
|
}
|
|
12937
12838
|
}
|
|
12938
12839
|
function projectTarget(cwd, _homeDir) {
|
|
12939
|
-
const dir =
|
|
12840
|
+
const dir = join22(cwd, ".claude");
|
|
12940
12841
|
return {
|
|
12941
12842
|
dir,
|
|
12942
12843
|
scope: "local",
|
|
12943
12844
|
cwd,
|
|
12944
|
-
wireLocalSettings: !alreadyWired(
|
|
12845
|
+
wireLocalSettings: !alreadyWired(join22(dir, "settings.json"))
|
|
12945
12846
|
};
|
|
12946
12847
|
}
|
|
12947
12848
|
var init_saveTarget = __esm(() => {
|
|
@@ -13184,7 +13085,7 @@ var init_useMouseWheel = __esm(() => {
|
|
|
13184
13085
|
|
|
13185
13086
|
// src/tui/shell/Dashboard.tsx
|
|
13186
13087
|
import { readFileSync as readFileSync14 } from "node:fs";
|
|
13187
|
-
import { join as
|
|
13088
|
+
import { join as join23 } from "node:path";
|
|
13188
13089
|
import { Box as Box30, Text as Text35, useApp as useApp2, useInput as useInput8 } from "ink";
|
|
13189
13090
|
import { useCallback as useCallback6, useMemo as useMemo9, useState as useState8 } from "react";
|
|
13190
13091
|
import { jsxDEV as jsxDEV22 } from "react/jsx-dev-runtime";
|
|
@@ -13202,7 +13103,7 @@ function Dashboard(props) {
|
|
|
13202
13103
|
const [nav, setNav] = useState8(INITIAL_NAV);
|
|
13203
13104
|
const [targets, setTargets] = useState8(props.targets);
|
|
13204
13105
|
const configDir2 = targets[0]?.dir ?? "";
|
|
13205
|
-
const root =
|
|
13106
|
+
const root = join23(configDir2, "ccsidekick");
|
|
13206
13107
|
const [draft, setDraft] = useState8(() => seed(configDir2, initialConfig));
|
|
13207
13108
|
const [dirty2, setDirty] = useState8(props.initialDirty ?? false);
|
|
13208
13109
|
const [cursor4, setCursor] = useState8(0);
|
|
@@ -13982,7 +13883,7 @@ var seed = (configDir2, initial) => {
|
|
|
13982
13883
|
if (initial)
|
|
13983
13884
|
return initial;
|
|
13984
13885
|
try {
|
|
13985
|
-
return loadConfig(readFileSync14(
|
|
13886
|
+
return loadConfig(readFileSync14(join23(configDir2, "ccsidekick", "config.toml"), "utf8"));
|
|
13986
13887
|
} catch {
|
|
13987
13888
|
return loadConfig("");
|
|
13988
13889
|
}
|
|
@@ -14627,7 +14528,7 @@ var init_Wizard = __esm(() => {
|
|
|
14627
14528
|
// src/tui/shell/App.tsx
|
|
14628
14529
|
import { existsSync as existsSync9, readFileSync as readFileSync15 } from "node:fs";
|
|
14629
14530
|
import { homedir as homedir6 } from "node:os";
|
|
14630
|
-
import { join as
|
|
14531
|
+
import { join as join24 } from "node:path";
|
|
14631
14532
|
import { useInput as useInput10 } from "ink";
|
|
14632
14533
|
import { useMemo as useMemo10, useState as useState10 } from "react";
|
|
14633
14534
|
import { jsxDEV as jsxDEV26 } from "react/jsx-dev-runtime";
|
|
@@ -14640,7 +14541,7 @@ function welcomeTheme(suggestedDir) {
|
|
|
14640
14541
|
if (suggestedDir === undefined || suggestedDir === "")
|
|
14641
14542
|
return THEMES.houston;
|
|
14642
14543
|
try {
|
|
14643
|
-
const text = readFileSync15(
|
|
14544
|
+
const text = readFileSync15(join24(suggestedDir, "ccsidekick", "config.toml"), "utf8");
|
|
14644
14545
|
return pickTheme(loadConfig(text).theme.name);
|
|
14645
14546
|
} catch {
|
|
14646
14547
|
return THEMES.houston;
|
|
@@ -14650,7 +14551,7 @@ function initialChosenDirs(configDir2) {
|
|
|
14650
14551
|
return configDir2 === undefined ? null : [{ dir: configDir2, scope: "global" }];
|
|
14651
14552
|
}
|
|
14652
14553
|
function configPathFor(t) {
|
|
14653
|
-
return t.scope === "global" ?
|
|
14554
|
+
return t.scope === "global" ? join24(t.dir, "ccsidekick", "config.toml") : join24(t.cwd ?? "", ".ccsidekick", "config.toml");
|
|
14654
14555
|
}
|
|
14655
14556
|
function isFirstRun(targets) {
|
|
14656
14557
|
return !targets.some((t) => existsSync9(configPathFor(t)));
|
|
@@ -14801,11 +14702,11 @@ init_cli();
|
|
|
14801
14702
|
init_domain();
|
|
14802
14703
|
init_tui();
|
|
14803
14704
|
import { homedir as homedir7 } from "node:os";
|
|
14804
|
-
import { join as
|
|
14805
|
-
import { fileURLToPath as
|
|
14705
|
+
import { join as join25 } from "node:path";
|
|
14706
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
14806
14707
|
var sub = process.argv[2];
|
|
14807
14708
|
function claudeDir() {
|
|
14808
|
-
return process.env["CLAUDE_CONFIG_DIR"] ??
|
|
14709
|
+
return process.env["CLAUDE_CONFIG_DIR"] ?? join25(homedir7(), ".claude");
|
|
14809
14710
|
}
|
|
14810
14711
|
function printHelp() {
|
|
14811
14712
|
process.stdout.write([
|
|
@@ -14835,7 +14736,7 @@ function printManualSetup() {
|
|
|
14835
14736
|
"Run `ccsidekick` directly in your terminal to configure and wire it.",
|
|
14836
14737
|
"",
|
|
14837
14738
|
"To wire it by hand, add to your Claude Code settings.json:",
|
|
14838
|
-
` • settings.json: ${
|
|
14739
|
+
` • settings.json: ${join25(dir, "settings.json")}`,
|
|
14839
14740
|
` • "statusLine": { "type": "command", "command": "ccsidekick-render render", "refreshInterval": ${String(REFRESH_INTERVAL_SEC)} }`,
|
|
14840
14741
|
' • three hooks, each running "ccsidekick-render classify" with the same matcher:',
|
|
14841
14742
|
' "PostToolUse", "PostToolUseFailure", and "PostToolBatch"',
|
|
@@ -14847,7 +14748,7 @@ async function launchTui() {
|
|
|
14847
14748
|
const { render } = await import("ink");
|
|
14848
14749
|
const { createElement } = await import("react");
|
|
14849
14750
|
const { App: App2 } = await Promise.resolve().then(() => (init_shell(), exports_shell));
|
|
14850
|
-
const renderBin =
|
|
14751
|
+
const renderBin = fileURLToPath2(new URL("ccsidekick-render.js", import.meta.url));
|
|
14851
14752
|
const suggested = process.env["CLAUDE_CONFIG_DIR"];
|
|
14852
14753
|
const instance = render(createElement(App2, {
|
|
14853
14754
|
homeDir: homedir7(),
|
|
@@ -14863,7 +14764,7 @@ async function main() {
|
|
|
14863
14764
|
}
|
|
14864
14765
|
if (sub === "uninstall") {
|
|
14865
14766
|
runUninstall({
|
|
14866
|
-
settingsPath:
|
|
14767
|
+
settingsPath: join25(claudeDir(), "settings.json"),
|
|
14867
14768
|
restoreBackup: process.argv.includes("--restore-backup")
|
|
14868
14769
|
});
|
|
14869
14770
|
process.exit(0);
|
|
@@ -14877,7 +14778,7 @@ async function main() {
|
|
|
14877
14778
|
process.stdout.write(setupHelp());
|
|
14878
14779
|
process.exit(0);
|
|
14879
14780
|
}
|
|
14880
|
-
const renderBin =
|
|
14781
|
+
const renderBin = fileURLToPath2(new URL("ccsidekick-render.js", import.meta.url));
|
|
14881
14782
|
const code = runSetup(process.argv.slice(3), {
|
|
14882
14783
|
save,
|
|
14883
14784
|
renderBin,
|