@lamemind/loom-deck 0.74.0 → 0.76.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/README.md +1 -1
- package/dist/actions.js +76 -8
- package/dist/archivable.js +1 -1
- package/dist/claude-cmd.js +101 -0
- package/dist/cli.js +21 -8
- package/dist/commit-times.js +5 -2
- package/dist/config.js +51 -6
- package/dist/deck-model.js +14 -9
- package/dist/doc-tree.js +1 -1
- package/dist/focus-session.js +139 -0
- package/dist/frame.js +7 -0
- package/dist/git-bash.js +78 -0
- package/dist/gitlink.js +1 -0
- package/dist/hooks.js +21 -7
- package/dist/inbox.js +1 -1
- package/dist/input.js +11 -1
- package/dist/live-sessions.js +4 -1
- package/dist/overlays/gitlink.js +12 -2
- package/dist/overlays/wrap.js +10 -1
- package/dist/pane-views.js +12 -2
- package/dist/platform.js +94 -0
- package/dist/project-path.js +71 -0
- package/dist/purge.js +1 -0
- package/dist/sessions.js +63 -29
- package/dist/spawn.js +27 -5
- package/dist/tasks.js +8 -21
- package/dist/ui/doc-pane.js +6 -2
- package/dist/ui/inbox-pane.js +7 -2
- package/dist/wrap-scan.js +1 -1
- package/package.json +2 -2
- package/dist/overlays/inbox.js +0 -90
- package/dist/ui/inbox-screen.js +0 -21
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { spawnOut } from './spawn.js';
|
|
2
|
+
// Il binario del canale. L'override esiste per il collaudo del ramo «canale
|
|
3
|
+
// assente», stesso schema di `LOOM_DECK_NOTIFY_CMD` (`spawn.ts`): su una
|
|
4
|
+
// macchina dove `gdbus` c'è e compass è sul bus, quel ramo non è altrimenti
|
|
5
|
+
// raggiungibile.
|
|
6
|
+
export const FOCUS_CMD = process.env.LOOM_DECK_FOCUS_CMD ?? 'gdbus';
|
|
7
|
+
/**
|
|
8
|
+
* Il timeout che `gdbus` applica alla risposta, in secondi.
|
|
9
|
+
*
|
|
10
|
+
* compass risponde DOPO il salto: l'helper AT-SPI e la ricerca della finestra
|
|
11
|
+
* costano qualche decimo di secondo ciascuno, quindi la soglia sta un ordine di
|
|
12
|
+
* grandezza sopra il caso normale e scatta solo su un compass appeso. Un compass
|
|
13
|
+
* assente non la aspetta: il bus risponde subito `ServiceUnknown`.
|
|
14
|
+
*/
|
|
15
|
+
export const FOCUS_TIMEOUT_S = 5;
|
|
16
|
+
/**
|
|
17
|
+
* La rete sotto il timeout di `gdbus`: Node uccide il figlio se nemmeno quello
|
|
18
|
+
* esce, per esempio con un bus di sessione che non risponde alla connessione.
|
|
19
|
+
* Senza, un `⏎` resterebbe senza nota per sempre.
|
|
20
|
+
*/
|
|
21
|
+
const FOCUS_KILL_MS = (FOCUS_TIMEOUT_S + 1) * 1000;
|
|
22
|
+
/** Gli esiti che portano alla conversazione: la tab era già davanti
|
|
23
|
+
* (`esatta`) o il salto l'ha portata davanti (`tab`). Ogni altra parola del
|
|
24
|
+
* vocabolario di compass dice perché non ci si è arrivati. */
|
|
25
|
+
const REACHED = new Set(['esatta', 'tab']);
|
|
26
|
+
/** L'argv di `gdbus` per chiedere a compass il focus di `sessionId`. Il
|
|
27
|
+
* `sessionId` va nudo: `gdbus` legge il tipo `s` dall'introspezione del metodo
|
|
28
|
+
* e un UUID non è testo GVariant valido, quindi lo prende come stringa. */
|
|
29
|
+
export function focusSessionArgs(sessionId) {
|
|
30
|
+
return [
|
|
31
|
+
'call',
|
|
32
|
+
'--session',
|
|
33
|
+
'--dest',
|
|
34
|
+
'org.lamemind.Compass',
|
|
35
|
+
'--object-path',
|
|
36
|
+
'/org/lamemind/Compass',
|
|
37
|
+
'--method',
|
|
38
|
+
'org.lamemind.Compass.FocusSession',
|
|
39
|
+
'--timeout',
|
|
40
|
+
String(FOCUS_TIMEOUT_S),
|
|
41
|
+
sessionId,
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* L'esito dentro la risposta testuale di `gdbus`, o `null` se la risposta non
|
|
46
|
+
* ha la forma attesa.
|
|
47
|
+
*
|
|
48
|
+
* Un metodo con firma `(s)` esce come tupla GVariant di un elemento:
|
|
49
|
+
* `('tab',)`. La parola non si confronta col vocabolario di compass: un esito
|
|
50
|
+
* che una versione futura aggiungesse deve arrivare nella nota così com'è,
|
|
51
|
+
* invece di confondersi con un canale rotto.
|
|
52
|
+
*/
|
|
53
|
+
export function parseFocusReply(stdout) {
|
|
54
|
+
const m = /^\('([^']*)',\)$/.exec(stdout.trim());
|
|
55
|
+
return m ? m[1] : null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Chiede a compass il focus di `sessionId` e consegna l'esito a `onResult`,
|
|
59
|
+
* una volta sola.
|
|
60
|
+
*
|
|
61
|
+
* Il listener su `error` è OBBLIGATORIO e non difensivo: senza `gdbus` (su
|
|
62
|
+
* Windows, o su un Linux senza glib) lo spawn fallisce con un `error`
|
|
63
|
+
* asincrono, e un `error` non agganciato su un `ChildProcess` abbatte il deck.
|
|
64
|
+
* Agganciato, è il ramo «canale assente», ed è anche il solo gate di
|
|
65
|
+
* piattaforma che serve: nessun `process.platform` qui.
|
|
66
|
+
*
|
|
67
|
+
* Il codice d'uscita decide, lo stderr no: `gdbus` lo scrive nella lingua del
|
|
68
|
+
* sistema (`Errore: GDBus.Error:…ServiceUnknown`), e ne resta solo l'ultima
|
|
69
|
+
* riga come motivo, per chi legge il risultato in un test.
|
|
70
|
+
*/
|
|
71
|
+
export function focusSession(sessionId, onResult) {
|
|
72
|
+
const child = spawnOut(FOCUS_CMD, focusSessionArgs(sessionId), {
|
|
73
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
74
|
+
timeout: FOCUS_KILL_MS,
|
|
75
|
+
});
|
|
76
|
+
let out = '';
|
|
77
|
+
let err = '';
|
|
78
|
+
child.stdout?.on('data', (c) => {
|
|
79
|
+
out += c.toString();
|
|
80
|
+
});
|
|
81
|
+
child.stderr?.on('data', (c) => {
|
|
82
|
+
err += c.toString();
|
|
83
|
+
});
|
|
84
|
+
// `error` e `close` possono arrivare entrambi per lo stesso spawn fallito:
|
|
85
|
+
// la nota è una sola.
|
|
86
|
+
let done = false;
|
|
87
|
+
const finish = (r) => {
|
|
88
|
+
if (done)
|
|
89
|
+
return;
|
|
90
|
+
done = true;
|
|
91
|
+
onResult(r);
|
|
92
|
+
};
|
|
93
|
+
child.on('error', (e) => finish({ unreachable: e.code ?? e.message }));
|
|
94
|
+
child.on('close', (code, signal) => {
|
|
95
|
+
if (code !== 0) {
|
|
96
|
+
const last = err.trim().split('\n').pop() ?? '';
|
|
97
|
+
finish({ unreachable: signal ? `timeout (${signal})` : last || `exit ${code}` });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const outcome = parseFocusReply(out);
|
|
101
|
+
finish(outcome === null
|
|
102
|
+
? { unreachable: `risposta inattesa: ${out.trim()}` }
|
|
103
|
+
: { reached: REACHED.has(outcome), outcome });
|
|
104
|
+
});
|
|
105
|
+
return child;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* La nota di un `⏎` su una viva, a ogni esito, successo compreso.
|
|
109
|
+
*
|
|
110
|
+
* Sul successo la tab del deck va dietro, quindi la nota non la legge nessuno
|
|
111
|
+
* subito: si legge al ritorno, ed è l'unica traccia di cosa ha fatto il tasto —
|
|
112
|
+
* ogni spawn del deck lascia già la sua riga di stato, e un `⏎` muto sarebbe
|
|
113
|
+
* l'unica azione senza.
|
|
114
|
+
*
|
|
115
|
+
* `sconosciuta` (compass non trova il `sessionId` fra i vivi) cade nella forma
|
|
116
|
+
* di ogni esito fuori dalla tab, senza un resume: vuol dire che la
|
|
117
|
+
* conversazione è finita dopo l'ultimo tick del deck, e il `⏎` successivo, a
|
|
118
|
+
* tick avvenuto, la vede non viva e la riprende.
|
|
119
|
+
*/
|
|
120
|
+
export function focusNote(r, name) {
|
|
121
|
+
if ('unreachable' in r)
|
|
122
|
+
return `⚠ compass non raggiungibile — ${name}`;
|
|
123
|
+
return r.reached ? `→ ${name}` : `⚠ focus ${r.outcome} — ${name}`;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* La scelta del `⏎`. Una viva non si riprende MAI, qualunque esito torni:
|
|
127
|
+
* né su `assente` (viva, ma senza una tab col suo nome — lanciata fuori da
|
|
128
|
+
* Ptyxis) né con compass irraggiungibile. In entrambi i casi il processo
|
|
129
|
+
* `claude` c'è, e un resume sarebbe il secondo scrittore.
|
|
130
|
+
*/
|
|
131
|
+
export function enterSession(sessionId, deps) {
|
|
132
|
+
if (!deps.isLive(sessionId)) {
|
|
133
|
+
deps.resume(sessionId);
|
|
134
|
+
return 'resume';
|
|
135
|
+
}
|
|
136
|
+
const name = deps.nameOf(sessionId);
|
|
137
|
+
deps.focus(sessionId, (r) => deps.note(focusNote(r, name)));
|
|
138
|
+
return 'focus';
|
|
139
|
+
}
|
package/dist/frame.js
CHANGED
|
@@ -26,6 +26,7 @@ import { META_ROWS } from './model.js';
|
|
|
26
26
|
import { TASK_MODE_LEGEND } from './input-modes.js';
|
|
27
27
|
import { rowIndexOf } from './session-list.js';
|
|
28
28
|
import { VERSION } from './version.js';
|
|
29
|
+
import { OFF_MARK } from './platform.js';
|
|
29
30
|
// La surface built-in del cappello, in testa alla riga launch. Non sta fra i
|
|
30
31
|
// tasti perché ha la stessa natura delle voci `launch` — fire-once, cwd =
|
|
31
32
|
// project root, nessuno stato. Per il terminale compass usa 🖥️, che nel frame
|
|
@@ -230,6 +231,8 @@ export const INDICATOR_SEP = ' ';
|
|
|
230
231
|
* dell'ultimo riuscito, che resta vero e ancora apribile.
|
|
231
232
|
*/
|
|
232
233
|
export function inboxButton(state) {
|
|
234
|
+
if (state.available === false)
|
|
235
|
+
return sanitize(`[ Doc 📄 ${OFF_MARK} ]`);
|
|
233
236
|
const numbers = state.scanned
|
|
234
237
|
? `${state.counts.nozioni}/${state.counts.derivazione}/${state.counts.sweep}`
|
|
235
238
|
: STATUS_MISSING;
|
|
@@ -261,6 +264,8 @@ export function inboxButton(state) {
|
|
|
261
264
|
* l'esito dell'ultimo riuscito resta vero e ancora apribile.
|
|
262
265
|
*/
|
|
263
266
|
export function wrapIndicator(state) {
|
|
267
|
+
if (state.available === false)
|
|
268
|
+
return `wrap ${OFF_MARK}`;
|
|
264
269
|
const body = state.scanning
|
|
265
270
|
? 'scan…'
|
|
266
271
|
: state.mtime === null
|
|
@@ -289,6 +294,8 @@ export function wrapIndicator(state) {
|
|
|
289
294
|
* nomina i membri.
|
|
290
295
|
*/
|
|
291
296
|
export function gitlinkIndicator(state) {
|
|
297
|
+
if (state.available === false)
|
|
298
|
+
return `gitlink ${OFF_MARK}`;
|
|
292
299
|
const body = !state.scanned
|
|
293
300
|
? STATUS_MISSING
|
|
294
301
|
: !state.ok
|
package/dist/git-bash.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// T175 — il bash di Git for Windows: dove sta, e come lo riceve un `claude`
|
|
2
|
+
// lanciato dal deck.
|
|
3
|
+
//
|
|
4
|
+
// Serve già qui e non solo a T178 (gli script `.sh` del plugin), per il verdetto
|
|
5
|
+
// 9 di T174: un `claude` che eredita il `PATH` di Git Bash esegue gli hook del
|
|
6
|
+
// plugin in PowerShell — `cat` diventa `Get-Content`, lo script `.sh` una
|
|
7
|
+
// stringa stampata — e la task non arriva in contesto. Con
|
|
8
|
+
// `CLAUDE_CODE_GIT_BASH_PATH` nell'env, la variabile con cui Claude Code sceglie
|
|
9
|
+
// il proprio bash, gli hook tornano in bash. Un deck avviato da Git Bash non la
|
|
10
|
+
// porta: la risolve lui.
|
|
11
|
+
//
|
|
12
|
+
// Modulo PURO nel cuore (`resolveGitBash` riceve il filesystem come funzione),
|
|
13
|
+
// con un involucro che legge quello vero. Su Linux non fa niente.
|
|
14
|
+
import { existsSync } from 'node:fs';
|
|
15
|
+
import { win32 } from 'node:path';
|
|
16
|
+
export const GIT_BASH_ENV = 'CLAUDE_CODE_GIT_BASH_PATH';
|
|
17
|
+
/**
|
|
18
|
+
* Quanti livelli sopra la cartella di `git.exe` si cerca `bin\bash.exe`. Tre
|
|
19
|
+
* coprono le tre posizioni di `git.exe` in Git for Windows: `Git\cmd\` (quella
|
|
20
|
+
* del `PATH` di Windows), `Git\bin\` e `Git\mingw64\bin\` (la prima del `PATH`
|
|
21
|
+
* di Git Bash, dove accanto non c'è nessun bash).
|
|
22
|
+
*/
|
|
23
|
+
const MAX_UP = 3;
|
|
24
|
+
/**
|
|
25
|
+
* Il bash di Git, o `null`.
|
|
26
|
+
*
|
|
27
|
+
* Cascata (P6 preflight): la variabile, se impostata — è la scelta esplicita di
|
|
28
|
+
* chi ha configurato Claude Code; poi ogni `git.exe` del `PATH`, nell'ordine,
|
|
29
|
+
* risalendo da lì fino a trovare `bin\bash.exe`. Mai `bash` dal `PATH`: Git
|
|
30
|
+
* aggiunge solo `Git\cmd`, e `C:\Windows\System32\bash.exe` è il lanciatore di
|
|
31
|
+
* WSL. Mai un path cablato: Git può stare fuori da `C:\Program Files\Git`
|
|
32
|
+
* (sulla macchina di T174 sta in `C:\Dev\Tools\Git`).
|
|
33
|
+
*/
|
|
34
|
+
export function resolveGitBash(env, exists) {
|
|
35
|
+
const explicit = env[GIT_BASH_ENV];
|
|
36
|
+
if (explicit)
|
|
37
|
+
return explicit;
|
|
38
|
+
const path = env.PATH ?? env.Path ?? '';
|
|
39
|
+
for (const dir of path.split(win32.delimiter)) {
|
|
40
|
+
if (!dir)
|
|
41
|
+
continue;
|
|
42
|
+
const git = win32.join(dir, 'git.exe');
|
|
43
|
+
if (!exists(git))
|
|
44
|
+
continue;
|
|
45
|
+
let at = win32.dirname(git);
|
|
46
|
+
for (let i = 0; i < MAX_UP; i++) {
|
|
47
|
+
const bash = win32.join(at, 'bin', 'bash.exe');
|
|
48
|
+
if (exists(bash))
|
|
49
|
+
return bash;
|
|
50
|
+
const up = win32.dirname(at);
|
|
51
|
+
if (up === at)
|
|
52
|
+
break;
|
|
53
|
+
at = up;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
let cached;
|
|
59
|
+
/** Il bash di Git di questa macchina, risolto una volta per vita del deck:
|
|
60
|
+
* un'installazione di Git non si sposta mentre il deck è aperto. */
|
|
61
|
+
export function gitBash() {
|
|
62
|
+
if (cached === undefined)
|
|
63
|
+
cached = resolveGitBash(process.env, existsSync);
|
|
64
|
+
return cached;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* L'env di un `claude` lanciato dal deck.
|
|
68
|
+
*
|
|
69
|
+
* Su win32, quello del deck più `CLAUDE_CODE_GIT_BASH_PATH` quando non c'è già e
|
|
70
|
+
* il bash si trova; senza bash il figlio parte con l'env del deck, come prima.
|
|
71
|
+
* Altrove `undefined`, cioè l'env ereditato di `spawn`: nessun cambio su Linux.
|
|
72
|
+
*/
|
|
73
|
+
export function claudeEnv(platform = process.platform, env = process.env, bash = gitBash) {
|
|
74
|
+
if (platform !== 'win32' || env[GIT_BASH_ENV])
|
|
75
|
+
return undefined;
|
|
76
|
+
const found = bash();
|
|
77
|
+
return found ? { ...env, [GIT_BASH_ENV]: found } : undefined;
|
|
78
|
+
}
|
package/dist/gitlink.js
CHANGED
package/dist/hooks.js
CHANGED
|
@@ -20,6 +20,7 @@ import { mixedCount, readWrapCache, runWrapScan, wrapCacheFile, wrapCount, } fro
|
|
|
20
20
|
import { purgeTargets } from './purge.js';
|
|
21
21
|
import { loadSpawnOverrides, saveSpawnOverrides, } from './spawn-config.js';
|
|
22
22
|
import { POLL_MS } from './model.js';
|
|
23
|
+
import { isAvailable } from './platform.js';
|
|
23
24
|
// Dimensioni del terminale, live sul resize.
|
|
24
25
|
//
|
|
25
26
|
// Non è una comodità di layout: senza `rows` il frame non ha tetto, e un frame
|
|
@@ -203,9 +204,12 @@ export function useSessions(projectRoot, core) {
|
|
|
203
204
|
// un refresh più lento mostrerebbe `idle` su una sessione che lavora.
|
|
204
205
|
// Il try è separato perché il registry è una fonte indipendente: se manca
|
|
205
206
|
// (versione del CLI che non lo scrive) la lista deve restare, senza vive.
|
|
207
|
+
// T175 — dove la liveness manca non si interroga nemmeno il registry: la
|
|
208
|
+
// mappa vuota è il dato onesto, e chi ne dipende per una guardia (`CANC`)
|
|
209
|
+
// legge la mappa delle funzioni, non questa.
|
|
206
210
|
let live;
|
|
207
211
|
try {
|
|
208
|
-
live = discoverLiveSessions(projectRoot);
|
|
212
|
+
live = isAvailable('liveSessions') ? discoverLiveSessions(projectRoot) : new Map();
|
|
209
213
|
}
|
|
210
214
|
catch {
|
|
211
215
|
live = new Map();
|
|
@@ -400,7 +404,9 @@ export function useDirtyFolders(idsSig, tasksDir, projectRoot) {
|
|
|
400
404
|
}, [idsSig, tasksDir, projectRoot]);
|
|
401
405
|
return dirty;
|
|
402
406
|
}
|
|
403
|
-
|
|
407
|
+
/** T175 — `enabled` falso = la funzione è spenta su questa piattaforma: nessuno
|
|
408
|
+
* spawn, né all'avvio né a richiesta, e lo stato resta quello di partenza. */
|
|
409
|
+
export function useInboxScan(projectRoot, docsRoot, enabled = true) {
|
|
404
410
|
const [state, setState] = useState({
|
|
405
411
|
files: [],
|
|
406
412
|
ok: true,
|
|
@@ -437,10 +443,12 @@ export function useInboxScan(projectRoot, docsRoot) {
|
|
|
437
443
|
});
|
|
438
444
|
}, [projectRoot, docsRoot]);
|
|
439
445
|
useEffect(() => {
|
|
446
|
+
if (!enabled)
|
|
447
|
+
return;
|
|
440
448
|
run();
|
|
441
449
|
const id = setInterval(run, INBOX_SCAN_INTERVAL_MS);
|
|
442
450
|
return () => clearInterval(id);
|
|
443
|
-
}, [run, epoch]);
|
|
451
|
+
}, [run, epoch, enabled]);
|
|
444
452
|
// Lo scan a richiesta RESETTA il timer, come quello del wrap: senza,
|
|
445
453
|
// l'intervallo continuerebbe a scorrere dall'ultimo tick automatico e potrebbe
|
|
446
454
|
// rimisurare pochi istanti dopo un dato appena misurato.
|
|
@@ -493,7 +501,11 @@ export function useDocScan(projectRoot, docsRoot, enabled) {
|
|
|
493
501
|
}, []);
|
|
494
502
|
return { ...state, scan };
|
|
495
503
|
}
|
|
496
|
-
|
|
504
|
+
/** T175 — `enabled` falso = scan spento su questa piattaforma: niente periodico
|
|
505
|
+
* e niente scan a richiesta. Il periodico sarebbe il peggiore dei due — uno
|
|
506
|
+
* spawn di `python3` ogni sei ore che nessuno ha chiesto, e su Windows quel
|
|
507
|
+
* nome risolve nell'alias dello Store. */
|
|
508
|
+
export function useWrapScan(projectRoot, enabled = true) {
|
|
497
509
|
const path = useMemo(() => wrapCacheFile(projectRoot), [projectRoot]);
|
|
498
510
|
const [cache, setCache] = useState(() => readWrapCache(path));
|
|
499
511
|
const [ok, setOk] = useState(true);
|
|
@@ -505,7 +517,7 @@ export function useWrapScan(projectRoot) {
|
|
|
505
517
|
// secondo lancio.
|
|
506
518
|
const busy = useRef(false);
|
|
507
519
|
const run = useCallback(() => {
|
|
508
|
-
if (busy.current)
|
|
520
|
+
if (busy.current || !enabled)
|
|
509
521
|
return;
|
|
510
522
|
busy.current = true;
|
|
511
523
|
setScanning(true);
|
|
@@ -518,11 +530,13 @@ export function useWrapScan(projectRoot) {
|
|
|
518
530
|
if (good)
|
|
519
531
|
setCache(readWrapCache(path));
|
|
520
532
|
});
|
|
521
|
-
}, [projectRoot, path]);
|
|
533
|
+
}, [projectRoot, path, enabled]);
|
|
522
534
|
useEffect(() => {
|
|
535
|
+
if (!enabled)
|
|
536
|
+
return;
|
|
523
537
|
const id = setInterval(run, SCAN_INTERVAL_MS);
|
|
524
538
|
return () => clearInterval(id);
|
|
525
|
-
}, [run, epoch]);
|
|
539
|
+
}, [run, epoch, enabled]);
|
|
526
540
|
const scan = useCallback(() => {
|
|
527
541
|
setEpoch((e) => e + 1);
|
|
528
542
|
run();
|
package/dist/inbox.js
CHANGED
|
@@ -248,7 +248,7 @@ export async function scanInbox(projectRoot, docsRoot) {
|
|
|
248
248
|
if (!script)
|
|
249
249
|
return { files: [], ok: false };
|
|
250
250
|
try {
|
|
251
|
-
const { stdout } = await execFileAsync(script, ['--docs-root', docsRoot, '--inbox', '--format', 'tsv'], { cwd: projectRoot, maxBuffer: 4 * 1024 * 1024 });
|
|
251
|
+
const { stdout } = await execFileAsync(script, ['--docs-root', docsRoot, '--inbox', '--format', 'tsv'], { cwd: projectRoot, maxBuffer: 4 * 1024 * 1024, windowsHide: true });
|
|
252
252
|
return { files: parseInboxTsv(stdout), ok: true };
|
|
253
253
|
}
|
|
254
254
|
catch {
|
package/dist/input.js
CHANGED
|
@@ -28,6 +28,7 @@ import { TASK_VIEWS, taskView } from './pane-views.js';
|
|
|
28
28
|
import { loadTaskFileText } from './tasks.js';
|
|
29
29
|
import { inboxPrompt, loadInboxText } from './inbox.js';
|
|
30
30
|
import { dirListing, loadDocText } from './doc-tree.js';
|
|
31
|
+
import { refuse } from './platform.js';
|
|
31
32
|
// T116 — l'avviso della prima pressione di `^C`. La durata è INTERPOLATA dalla
|
|
32
33
|
// finestra, non ricopiata: un numero scritto a mano in un testo che promette un
|
|
33
34
|
// comportamento diventa falso il giorno che la costante cambia, e nessuno
|
|
@@ -461,6 +462,12 @@ export function useDeckInput({ cwd, tasksDir, mode, setMode, setNote, model, act
|
|
|
461
462
|
model.setSelSessionId((id) => moveSelection(model.sessionRows, id, 1));
|
|
462
463
|
}
|
|
463
464
|
else if (key.return) {
|
|
465
|
+
// T175 — i due pane del modo doc li riempie uno script del plugin: dove non
|
|
466
|
+
// gira, `⏎` lo dice invece di rispondere «nessuna riga selezionata».
|
|
467
|
+
if ((model.focus === 'doctree' || model.focus === 'inbox') &&
|
|
468
|
+
refuse('pluginScripts', '⏎', setNote, model.focus === 'inbox' ? 'coda inbox' : 'albero doc')) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
464
471
|
if (model.focus === 'doctree') {
|
|
465
472
|
// T160 — `⏎` apre il DETAIL del bersaglio, non la sessione: la sessione
|
|
466
473
|
// la apre il `⏎` di dentro, come sul pane inbox. Il gesto è lo stesso su
|
|
@@ -523,6 +530,9 @@ export function useDeckInput({ cwd, tasksDir, mode, setMode, setNote, model, act
|
|
|
523
530
|
else {
|
|
524
531
|
// T49 — ⏎ su una sessione = resume in nuova tab. Il binding si rilegge
|
|
525
532
|
// dal sidecar (non dal padre selezionato): vale anche per le spot.
|
|
533
|
+
// T184 — solo se NON è viva: su una viva compass porta davanti la sua
|
|
534
|
+
// tab, e nessun `deck-run` parte (`openSession`, la stessa azione del
|
|
535
|
+
// `⏎` nella ricerca).
|
|
526
536
|
const s = model.selSessionObj;
|
|
527
537
|
if (!s) {
|
|
528
538
|
setNote(model.selSessionId
|
|
@@ -530,7 +540,7 @@ export function useDeckInput({ cwd, tasksDir, mode, setMode, setNote, model, act
|
|
|
530
540
|
: 'nessuna sessione da riprendere');
|
|
531
541
|
}
|
|
532
542
|
else {
|
|
533
|
-
actions.
|
|
543
|
+
actions.openSession(s.sessionId, model.resumeModel);
|
|
534
544
|
}
|
|
535
545
|
}
|
|
536
546
|
}
|
package/dist/live-sessions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { basename, join } from 'node:path';
|
|
4
|
+
import { isWithin } from './project-path.js';
|
|
4
5
|
function liveSessionsRoot() {
|
|
5
6
|
return join(homedir(), '.claude', 'sessions');
|
|
6
7
|
}
|
|
@@ -132,7 +133,9 @@ export function discoverLiveSessions(projectRoot) {
|
|
|
132
133
|
if (!parsed)
|
|
133
134
|
continue;
|
|
134
135
|
const { entry, procStart } = parsed;
|
|
135
|
-
|
|
136
|
+
// T175 — `isWithin` regge le grafie di Windows: il registry scrive `C:\…`,
|
|
137
|
+
// e la root del deck può arrivare con la lettera del drive in un altro case.
|
|
138
|
+
if (!isWithin(entry.cwd, projectRoot))
|
|
136
139
|
continue;
|
|
137
140
|
if (!isAlive(pid, procStart))
|
|
138
141
|
continue;
|
package/dist/overlays/gitlink.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// preflight, D1/P12 — nessuno split dentro questa task).
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
import { attentionCount, bumpableCount, bumpGitlink, disalignedCount, gitlinkNote, GITLINK_SCAN_INTERVAL_MS, hasGitmodules, scanGitlink, } from '../gitlink.js';
|
|
10
|
+
import { isAvailable, refuse } from '../platform.js';
|
|
10
11
|
export function useGitlink(deps) {
|
|
11
12
|
const { cwd, setNote } = deps;
|
|
12
13
|
/**
|
|
@@ -21,6 +22,12 @@ export function useGitlink(deps) {
|
|
|
21
22
|
* qui invece che scoperto dopo.
|
|
22
23
|
*/
|
|
23
24
|
const enabled = useMemo(() => hasGitmodules(cwd), [cwd]);
|
|
25
|
+
/** T175 — il segmento esiste (c'è `.gitmodules`) ma lo script che lo misura
|
|
26
|
+
* non gira su questa piattaforma: l'indicatore dice `n/d` al posto del
|
|
27
|
+
* valore, nessun timer parte, `^U` lo spiega. Due gate e non uno, perché sono
|
|
28
|
+
* due fatti diversi: un repo senza submodule e una piattaforma senza bash. */
|
|
29
|
+
const available = isAvailable('pluginScripts');
|
|
30
|
+
const active = enabled && available;
|
|
24
31
|
const [members, setMembers] = useState([]);
|
|
25
32
|
const [ok, setOk] = useState(true);
|
|
26
33
|
/** Almeno un tentativo è stato fatto: distingue «non ho ancora misurato» da
|
|
@@ -65,12 +72,12 @@ export function useGitlink(deps) {
|
|
|
65
72
|
});
|
|
66
73
|
}, [cwd]);
|
|
67
74
|
useEffect(() => {
|
|
68
|
-
if (!
|
|
75
|
+
if (!active)
|
|
69
76
|
return;
|
|
70
77
|
run();
|
|
71
78
|
const id = setInterval(run, GITLINK_SCAN_INTERVAL_MS);
|
|
72
79
|
return () => clearInterval(id);
|
|
73
|
-
}, [
|
|
80
|
+
}, [active, run, epoch]);
|
|
74
81
|
/**
|
|
75
82
|
* Rimisura adesso e riparte col timer da zero.
|
|
76
83
|
*
|
|
@@ -100,6 +107,8 @@ export function useGitlink(deps) {
|
|
|
100
107
|
setNote('^U → questo progetto non ha submodule: nessun gitlink da bumpare');
|
|
101
108
|
return;
|
|
102
109
|
}
|
|
110
|
+
if (refuse('pluginScripts', '^U', setNote, 'bump del gitlink'))
|
|
111
|
+
return;
|
|
103
112
|
if (busy.current || bumping) {
|
|
104
113
|
setNote('^U → bump del gitlink già in corso');
|
|
105
114
|
return;
|
|
@@ -140,6 +149,7 @@ export function useGitlink(deps) {
|
|
|
140
149
|
}
|
|
141
150
|
return {
|
|
142
151
|
enabled,
|
|
152
|
+
available,
|
|
143
153
|
members,
|
|
144
154
|
ok,
|
|
145
155
|
scanned,
|
package/dist/overlays/wrap.js
CHANGED
|
@@ -15,6 +15,7 @@ import { pageStep, wrapListCapacity } from '../viewport.js';
|
|
|
15
15
|
import { cpLen, insertAt, removeAt } from '../layout.js';
|
|
16
16
|
import { sanitizeTyped } from '../glyphs.js';
|
|
17
17
|
import { WRAP_DEFAULT_PATH } from '../wrap-scan.js';
|
|
18
|
+
import { isAvailable, refuse } from '../platform.js';
|
|
18
19
|
export function useWrapOverlay(deps) {
|
|
19
20
|
const { cwd, rows, setMode, setNote, onApply } = deps;
|
|
20
21
|
// Lo stato dello scan vive QUI e non nel modello, sul precedente di
|
|
@@ -22,7 +23,10 @@ export function useWrapOverlay(deps) {
|
|
|
22
23
|
// numeri si leggono in testata a schermata chiusa, e la lista è una delle sue
|
|
23
24
|
// superfici invece che il suo contenuto. Tenerli in due posti significherebbe
|
|
24
25
|
// che l'indicatore e la lista possono dire cose diverse dello stesso scan.
|
|
25
|
-
|
|
26
|
+
// T175 — su una piattaforma senza lo scan, nessun periodico e nessuno spawn:
|
|
27
|
+
// l'indicatore dice `n/d` e i due tasti lo spiegano.
|
|
28
|
+
const available = isAvailable('hardWrap');
|
|
29
|
+
const measure = useWrapScan(cwd, available);
|
|
26
30
|
/** Le righe FOTOGRAFATE all'apertura: uno scan che finisse mentre la lista è
|
|
27
31
|
* a schermo la riscriverebbe sotto gli occhi, e la posizione di scroll non
|
|
28
32
|
* avrebbe più un riferimento. Stessa regola del viewer del project status. */
|
|
@@ -41,6 +45,8 @@ export function useWrapOverlay(deps) {
|
|
|
41
45
|
* uno solo. È la stessa forma di `^O` senza cache.
|
|
42
46
|
*/
|
|
43
47
|
function open() {
|
|
48
|
+
if (refuse('hardWrap', '^W', setNote, 'lista hard-wrap'))
|
|
49
|
+
return;
|
|
44
50
|
if (measure.files.length === 0) {
|
|
45
51
|
setNote(measure.mtime === null
|
|
46
52
|
? '^W → hard-wrap non ancora misurato · ^E per lo scan'
|
|
@@ -117,6 +123,8 @@ export function useWrapOverlay(deps) {
|
|
|
117
123
|
* l'albero del progetto intero, quindi dura, e un tasto che non desse segno
|
|
118
124
|
* si leggerebbe come inerte. */
|
|
119
125
|
function scan() {
|
|
126
|
+
if (refuse('hardWrap', '^E', setNote))
|
|
127
|
+
return;
|
|
120
128
|
if (measure.scanning) {
|
|
121
129
|
setNote('^E → scan hard-wrap già in corso');
|
|
122
130
|
return;
|
|
@@ -136,6 +144,7 @@ export function useWrapOverlay(deps) {
|
|
|
136
144
|
mtime: measure.mtime,
|
|
137
145
|
ok: measure.ok,
|
|
138
146
|
scanning: measure.scanning,
|
|
147
|
+
available,
|
|
139
148
|
open,
|
|
140
149
|
scan,
|
|
141
150
|
onKey,
|
package/dist/pane-views.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// - `↑N`/`↓N` non stanno qui: contano elementi fuori finestra per altezza del
|
|
22
22
|
// terminale, cioè una POSIZIONE, non un insieme.
|
|
23
23
|
import { isVisible, groupHierarchy } from './view.js';
|
|
24
|
+
import { isAvailable, offText, OFF_MARK } from './platform.js';
|
|
24
25
|
export const TASK_VIEWS = [
|
|
25
26
|
{
|
|
26
27
|
id: 'tasks',
|
|
@@ -78,12 +79,21 @@ export const SESSION_VIEWS = [
|
|
|
78
79
|
empty: null,
|
|
79
80
|
},
|
|
80
81
|
{
|
|
82
|
+
// T175 — dove la liveness manca, la voce resta nel catalogo (D1 create: le
|
|
83
|
+
// voci non spariscono) ma il numero no: `●0 vive` direbbe «ho guardato e
|
|
84
|
+
// nessuna è aperta», cioè uno stato misurato che non esiste. Etichetta e
|
|
85
|
+
// nota vuota si leggono alla chiamata, non all'import, così la piattaforma
|
|
86
|
+
// dei test si cambia fra un caso e l'altro.
|
|
81
87
|
id: 'live',
|
|
82
|
-
label: (c) => `${LIVE_GLYPH}${c.live} vive`,
|
|
88
|
+
label: (c) => isAvailable('liveSessions') ? `${LIVE_GLYPH}${c.live} vive` : `${LIVE_GLYPH} vive ${OFF_MARK}`,
|
|
83
89
|
count: (c) => c.live,
|
|
84
90
|
rows: (ctx) => ctx.assembled.rows.filter((r) => ctx.isLive(r.sessionId)),
|
|
85
91
|
color: 'green',
|
|
86
|
-
empty
|
|
92
|
+
get empty() {
|
|
93
|
+
return isAvailable('liveSessions')
|
|
94
|
+
? 'nessuna conversazione viva in questa lista'
|
|
95
|
+
: offText('liveSessions');
|
|
96
|
+
},
|
|
87
97
|
},
|
|
88
98
|
{
|
|
89
99
|
// T133 D7 — sola vista che NON filtra la lista: il suo insieme è più largo
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// T175 — COSA il deck sa fare sulla piattaforma su cui gira.
|
|
2
|
+
//
|
|
3
|
+
// Un modulo solo e non un `process.platform` sparso nei file: la domanda «questa
|
|
4
|
+
// funzione c'è qui?» ha una risposta sola, e la mappa di cosa è spento e perché
|
|
5
|
+
// si legge in un posto invece che cercando dieci `if`. Le figlie di porting
|
|
6
|
+
// dell'epica T173 riaccendono una funzione TOGLIENDO UNA VOCE da `UNAVAILABLE`:
|
|
7
|
+
// i tasti, i pane e gli scan leggono la mappa, non la piattaforma.
|
|
8
|
+
//
|
|
9
|
+
// Modulo PURO: nessun React, nessun I/O. L'unico ingresso esterno è la
|
|
10
|
+
// piattaforma stessa, letta a ogni chiamata (`platform()`), così un test può
|
|
11
|
+
// cambiarla fra un caso e l'altro senza re-importare il modulo.
|
|
12
|
+
/**
|
|
13
|
+
* LA MAPPA: per piattaforma, le funzioni spente. Una piattaforma assente le ha
|
|
14
|
+
* tutte — è il comportamento di prima di T175 su Linux e su macOS.
|
|
15
|
+
*
|
|
16
|
+
* Il commento accanto a ogni voce nomina la figlia di T173 che la riaccende.
|
|
17
|
+
*/
|
|
18
|
+
export const UNAVAILABLE = {
|
|
19
|
+
win32: [
|
|
20
|
+
'spawn', // T176 — tab di Windows Terminal al posto di ptyxis
|
|
21
|
+
'liveSessions', // T177 — liveness senza /proc
|
|
22
|
+
'pluginScripts', // T178 — .sh del plugin via Git Bash
|
|
23
|
+
'hardWrap', // T178 — python del wrap-scan
|
|
24
|
+
'launch', // T179 — comando per piattaforma nelle voci launch[]
|
|
25
|
+
'notify', // T180 — toast al posto di notify-send
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
/** Come una funzione si nomina in un avviso, quando il chiamante non ne dà un
|
|
29
|
+
* nome più preciso (il tasto che l'ha chiesta, per esempio). */
|
|
30
|
+
const FEATURE_LABEL = {
|
|
31
|
+
spawn: 'apertura di tab e conversazioni',
|
|
32
|
+
liveSessions: 'sessioni vive',
|
|
33
|
+
pluginScripts: 'script del plugin',
|
|
34
|
+
hardWrap: 'scan hard-wrap',
|
|
35
|
+
launch: 'voci launch',
|
|
36
|
+
notify: 'notifiche',
|
|
37
|
+
};
|
|
38
|
+
const PLATFORM_NAME = {
|
|
39
|
+
win32: 'Windows',
|
|
40
|
+
linux: 'Linux',
|
|
41
|
+
darwin: 'macOS',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Il marcatore di una funzione spenta, al posto del valore: in un indicatore
|
|
45
|
+
* della testata (`gitlink n/d`), in un'etichetta di vista (`● vive n/d`).
|
|
46
|
+
*
|
|
47
|
+
* Il marcatore SOSTITUISCE il valore e non lo nasconde: un indicatore assente è
|
|
48
|
+
* già uno stato (il gitlink non disegnato vuol dire «repo senza `.gitmodules`»),
|
|
49
|
+
* e un `0` direbbe «ho misurato e non c'è niente».
|
|
50
|
+
*/
|
|
51
|
+
export const OFF_MARK = 'n/d';
|
|
52
|
+
/**
|
|
53
|
+
* La piattaforma delle FUNZIONI. `LOOM_DECK_PLATFORM` la sostituisce, ed esiste
|
|
54
|
+
* per i test: rende verificabile su Linux il deck di Windows, avvisi compresi.
|
|
55
|
+
*
|
|
56
|
+
* Vale solo per la mappa delle funzioni. La semantica dei path (`project-path.ts`)
|
|
57
|
+
* legge la piattaforma vera, perché descrive il filesystem e non una scelta.
|
|
58
|
+
*/
|
|
59
|
+
export function platform() {
|
|
60
|
+
return process.env.LOOM_DECK_PLATFORM || process.platform;
|
|
61
|
+
}
|
|
62
|
+
export function platformName(p = platform()) {
|
|
63
|
+
return PLATFORM_NAME[p] ?? p;
|
|
64
|
+
}
|
|
65
|
+
/** La funzione c'è su questa piattaforma. */
|
|
66
|
+
export function isAvailable(feature, p = platform()) {
|
|
67
|
+
return !(UNAVAILABLE[p] ?? []).includes(feature);
|
|
68
|
+
}
|
|
69
|
+
/** Il testo di una funzione spenta, per un pane o una vista: nomina la funzione
|
|
70
|
+
* e la piattaforma. `n/d` e non «non disponibile»: resta invariato davanti a un
|
|
71
|
+
* nome singolare o plurale. */
|
|
72
|
+
export function offText(feature, what, p = platform()) {
|
|
73
|
+
return `${what ?? FEATURE_LABEL[feature]} ${OFF_MARK} su ${platformName(p)}`;
|
|
74
|
+
}
|
|
75
|
+
/** La riga di stato di un tasto spento: il tasto, la funzione, la piattaforma. */
|
|
76
|
+
export function offNote(key, feature, what, p = platform()) {
|
|
77
|
+
return `⚠ ${key} → ${offText(feature, what, p)}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* La GUARDIA di un tasto: `true` se la funzione è spenta, e in quel caso
|
|
81
|
+
* l'avviso è già nella riga di stato. Il chiamante esce e basta:
|
|
82
|
+
*
|
|
83
|
+
* if (refuse('spawn', '^K', setNote)) return;
|
|
84
|
+
*
|
|
85
|
+
* Un tasto spento che non facesse niente in silenzio sarebbe indistinguibile da
|
|
86
|
+
* un binding mancante, e uno che arrivasse fino al processo esterno fallirebbe
|
|
87
|
+
* con un messaggio che non nomina la piattaforma («ptyxis non lanciabile»).
|
|
88
|
+
*/
|
|
89
|
+
export function refuse(feature, key, setNote, what) {
|
|
90
|
+
if (isAvailable(feature))
|
|
91
|
+
return false;
|
|
92
|
+
setNote(offNote(key, feature, what));
|
|
93
|
+
return true;
|
|
94
|
+
}
|