@sushant-kum/ccstatus 0.3.2 → 0.3.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.
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
saveConfigFile,
|
|
15
15
|
snapshotPath,
|
|
16
16
|
writeLinkedLines
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YBBGXKRW.js";
|
|
18
18
|
|
|
19
19
|
// src/app.tsx
|
|
20
20
|
import { Box as Box12, Text as Text12, useApp, useInput as useInput10 } from "ink";
|
|
@@ -332,19 +332,64 @@ function Chip({ item, selected }) {
|
|
|
332
332
|
}
|
|
333
333
|
function Items({ config, setConfig, goHome }) {
|
|
334
334
|
const [surface, setSurface] = useState3("band");
|
|
335
|
+
const [line, setLine] = useState3(0);
|
|
335
336
|
const [sel, setSel] = useState3(0);
|
|
336
337
|
const [mode, setMode] = useState3("strip");
|
|
337
338
|
const [linkPick, setLinkPick] = useState3(0);
|
|
338
339
|
const [confirm, setConfirm] = useState3(null);
|
|
339
340
|
const [field, setField] = useState3(0);
|
|
340
341
|
const [pick, setPick] = useState3(0);
|
|
341
|
-
const
|
|
342
|
+
const allLines = config.surfaces[surface].lines;
|
|
343
|
+
const displayLines = allLines.length ? allLines : [[]];
|
|
344
|
+
const lineCount = displayLines.length;
|
|
345
|
+
const curLine = Math.min(line, lineCount - 1);
|
|
346
|
+
const items = displayLines[curLine] ?? [];
|
|
342
347
|
const cur = items[Math.min(sel, items.length - 1)];
|
|
343
348
|
const idx = cur ? items.indexOf(cur) : -1;
|
|
344
|
-
const
|
|
345
|
-
const lines = [next, ...config.surfaces[surface].lines.slice(1)];
|
|
349
|
+
const commitLines = (lines) => {
|
|
346
350
|
setConfig({ ...config, surfaces: writeLinkedLines(config.surfaces, surface, lines) });
|
|
347
351
|
};
|
|
352
|
+
const commit = (next) => {
|
|
353
|
+
const lines = [...displayLines];
|
|
354
|
+
lines[curLine] = next;
|
|
355
|
+
commitLines(lines);
|
|
356
|
+
};
|
|
357
|
+
const addLine = () => {
|
|
358
|
+
const lines = [...displayLines];
|
|
359
|
+
lines.splice(curLine + 1, 0, []);
|
|
360
|
+
commitLines(lines);
|
|
361
|
+
setLine(curLine + 1);
|
|
362
|
+
setSel(0);
|
|
363
|
+
};
|
|
364
|
+
const removeLine = () => {
|
|
365
|
+
if (lineCount <= 1 && items.length === 0) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const lines = lineCount <= 1 ? [[]] : displayLines.filter((_, i) => i !== curLine);
|
|
369
|
+
commitLines(lines);
|
|
370
|
+
setLine(Math.min(curLine, lines.length - 1));
|
|
371
|
+
setSel(0);
|
|
372
|
+
};
|
|
373
|
+
const moveItemToLine = (dir) => {
|
|
374
|
+
const target = curLine + dir;
|
|
375
|
+
if (idx < 0 || target < 0 || target >= lineCount) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const lines = displayLines.map((l) => [...l]);
|
|
379
|
+
const src = lines[curLine];
|
|
380
|
+
const tgt = lines[target];
|
|
381
|
+
if (!src || !tgt) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const [moved] = src.splice(idx, 1);
|
|
385
|
+
if (!moved) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
tgt.push(moved);
|
|
389
|
+
commitLines(lines);
|
|
390
|
+
setLine(target);
|
|
391
|
+
setSel(tgt.length - 1);
|
|
392
|
+
};
|
|
348
393
|
const patch = (p) => {
|
|
349
394
|
const base = items[idx];
|
|
350
395
|
if (idx < 0 || !base || !isStylable(base)) {
|
|
@@ -413,7 +458,7 @@ function Items({ config, setConfig, goHome }) {
|
|
|
413
458
|
...layout,
|
|
414
459
|
linked: false,
|
|
415
460
|
lines: layout.lines.map(
|
|
416
|
-
(
|
|
461
|
+
(line2) => line2.map((it) => ({ ...it, id: makeId(it.type) }))
|
|
417
462
|
)
|
|
418
463
|
}
|
|
419
464
|
};
|
|
@@ -491,7 +536,16 @@ function Items({ config, setConfig, goHome }) {
|
|
|
491
536
|
goHome();
|
|
492
537
|
} else if (key.tab) {
|
|
493
538
|
setSurface((s) => SURFACES[wrap(SURFACES.indexOf(s) + 1, SURFACES.length)] ?? s);
|
|
539
|
+
setLine(0);
|
|
494
540
|
setSel(0);
|
|
541
|
+
} else if (key.upArrow) {
|
|
542
|
+
const t = Math.max(0, curLine - 1);
|
|
543
|
+
setLine(t);
|
|
544
|
+
setSel((s) => Math.min(s, Math.max(0, (displayLines[t]?.length ?? 0) - 1)));
|
|
545
|
+
} else if (key.downArrow) {
|
|
546
|
+
const t = Math.min(lineCount - 1, curLine + 1);
|
|
547
|
+
setLine(t);
|
|
548
|
+
setSel((s) => Math.min(s, Math.max(0, (displayLines[t]?.length ?? 0) - 1)));
|
|
495
549
|
} else if (key.leftArrow) {
|
|
496
550
|
setSel(Math.max(0, idx - 1));
|
|
497
551
|
} else if (key.rightArrow) {
|
|
@@ -500,6 +554,14 @@ function Items({ config, setConfig, goHome }) {
|
|
|
500
554
|
move(-1);
|
|
501
555
|
} else if (input === "]") {
|
|
502
556
|
move(1);
|
|
557
|
+
} else if (input === "{") {
|
|
558
|
+
moveItemToLine(-1);
|
|
559
|
+
} else if (input === "}") {
|
|
560
|
+
moveItemToLine(1);
|
|
561
|
+
} else if (input === "A") {
|
|
562
|
+
addLine();
|
|
563
|
+
} else if (input === "X") {
|
|
564
|
+
removeLine();
|
|
503
565
|
} else if (input === "a") {
|
|
504
566
|
setPick(0);
|
|
505
567
|
setMode("picker");
|
|
@@ -538,13 +600,15 @@ function Items({ config, setConfig, goHome }) {
|
|
|
538
600
|
SURFACES.filter((s) => config.surfaces[s].linked).join(", "),
|
|
539
601
|
" \u2014 edits apply to all"
|
|
540
602
|
] }),
|
|
541
|
-
/* @__PURE__ */ jsx4(Box5, { children:
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
603
|
+
/* @__PURE__ */ jsx4(Box5, { flexDirection: "column", children: displayLines.map((lineItems, li) => /* @__PURE__ */ jsxs4(Box5, { children: [
|
|
604
|
+
/* @__PURE__ */ jsxs4(Text5, { color: li === curLine ? "cyan" : void 0, children: [
|
|
605
|
+
li === curLine ? "\u25B8" : " ",
|
|
606
|
+
" ",
|
|
607
|
+
li + 1,
|
|
608
|
+
" "
|
|
609
|
+
] }),
|
|
610
|
+
lineItems.length === 0 ? /* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "(empty \u2014 press a)" }) : lineItems.map((it, i) => /* @__PURE__ */ jsx4(Chip, { item: it, selected: li === curLine && i === idx }, `${li}-${it.id}`))
|
|
611
|
+
] }, li)) }),
|
|
548
612
|
mode === "link" ? /* @__PURE__ */ jsx4(Box5, { flexDirection: "column", marginTop: 1, children: confirm ? /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
549
613
|
"Replace ",
|
|
550
614
|
confirm.join(", "),
|
|
@@ -584,7 +648,7 @@ function Items({ config, setConfig, goHome }) {
|
|
|
584
648
|
] }),
|
|
585
649
|
/* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "(flex separator \u2014 no style options)" })
|
|
586
650
|
] })),
|
|
587
|
-
/* @__PURE__ */ jsx4(Text5, { dimColor: true, children: mode === "strip" ? "\u2190/\u2192
|
|
651
|
+
/* @__PURE__ */ jsx4(Text5, { dimColor: true, children: mode === "strip" ? "\u2191/\u2193 line \xB7 \u2190/\u2192 item \xB7 [/] move \xB7 {/} to line \xB7 a add \xB7 x del \xB7 A +line \xB7 X \u2212line \xB7 e edit \xB7 l/u link \xB7 tab \xB7 esc" : mode === "editor" ? "\u2191/\u2193 field \xB7 \u2190/\u2192 change \xB7 esc done" : mode === "link" ? confirm ? "y confirm \xB7 n cancel" : "\u2191/\u2193 choose \xB7 enter link \xB7 esc cancel" : "\u2191/\u2193 choose \xB7 enter add \xB7 esc cancel" })
|
|
588
652
|
] });
|
|
589
653
|
}
|
|
590
654
|
|
|
@@ -297,7 +297,10 @@ register({
|
|
|
297
297
|
register({
|
|
298
298
|
type: "thinking-effort",
|
|
299
299
|
label: "Effort",
|
|
300
|
-
|
|
300
|
+
// The engine only reports an explicit effort level; when none is set it exposes
|
|
301
|
+
// nothing, so we can't derive a level here. Match ccstatusline and label that
|
|
302
|
+
// case "default" rather than inventing a level or hiding the widget. See DEC-0026.
|
|
303
|
+
format: ({ snapshot, item }) => labeled(rawOf(item), "Effort", snapshot.effort || "default")
|
|
301
304
|
});
|
|
302
305
|
register({
|
|
303
306
|
type: "session-id",
|
|
@@ -339,7 +342,9 @@ register({
|
|
|
339
342
|
register({
|
|
340
343
|
type: "git-worktree",
|
|
341
344
|
label: "Worktree",
|
|
342
|
-
|
|
345
|
+
// Inside a repo the widget stays visible: the worktree name, or a placeholder
|
|
346
|
+
// when the checkout is the main working tree rather than a linked worktree.
|
|
347
|
+
format: ({ snapshot }) => snapshot.repo ? `\u2387 ${snapshot.gitWorktree || "\u2014"}` : null
|
|
343
348
|
});
|
|
344
349
|
register({
|
|
345
350
|
type: "git-insertions",
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
var sub = process.argv[2];
|
|
6
6
|
if (sub === "statusline") {
|
|
7
|
-
const { runStatusline } = await import("./statusline-cmd-
|
|
7
|
+
const { runStatusline } = await import("./statusline-cmd-OX52DYX2.js");
|
|
8
8
|
await runStatusline();
|
|
9
9
|
} else {
|
|
10
10
|
const { render } = await import("ink");
|
|
11
|
-
const { App } = await import("./app-
|
|
11
|
+
const { App } = await import("./app-TAM7W557.js");
|
|
12
12
|
render(/* @__PURE__ */ jsx(App, {}));
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sushant-kum/ccstatus",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Interactive configurator (npx @sushant-kum/ccstatus) for the ccstatus Claude Code status bar — band, status line, pane, and threshold toasts from one config.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sushant Kumar",
|