gcf-board 0.18.3 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server/cli.js
CHANGED
|
@@ -71,10 +71,15 @@ export function refusalOf(err) {
|
|
|
71
71
|
catch {
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
|
-
const { code, paths } = (data ?? {});
|
|
75
|
-
if (
|
|
74
|
+
const { code, paths, left } = (data ?? {});
|
|
75
|
+
if (!Array.isArray(paths))
|
|
76
76
|
return undefined;
|
|
77
|
-
const
|
|
77
|
+
const safe = (a) => (Array.isArray(a) ? a : []).filter((x) => typeof x === 'string' && x.startsWith('gcf/') && !x.split('/').includes('..'));
|
|
78
|
+
if (code === 'clean')
|
|
79
|
+
return { code, paths: safe(paths), left: safe(left) };
|
|
80
|
+
if (code !== 'dirty')
|
|
81
|
+
return undefined;
|
|
82
|
+
const kept = safe(paths);
|
|
78
83
|
return kept.length ? { code, paths: kept } : undefined;
|
|
79
84
|
}
|
|
80
85
|
/**
|
package/dist/shared/board.js
CHANGED
|
@@ -19,6 +19,19 @@ export function runModeOf(board, id, asked) {
|
|
|
19
19
|
const own = board.items.find((i) => i.id === id)?.run_mode;
|
|
20
20
|
return own === 'main' || own === 'worktree' ? own : board.run_mode;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* What is left of a refusal's `named` paths after `gcf edits` refused them as `clean`: the ones
|
|
24
|
+
* still edited, none when another card's Commit or Discard took them all. Null: not that
|
|
25
|
+
* refusal, or not known what is left.
|
|
26
|
+
*/
|
|
27
|
+
export function leftOf(r, named) {
|
|
28
|
+
if (r.refusal?.code === 'clean')
|
|
29
|
+
return r.refusal.left;
|
|
30
|
+
// shortcut: core 0.20.0 gives words only and refuses when any one path is clean: only a single
|
|
31
|
+
// path is known to be done; drop once boards need core 0.20.1.
|
|
32
|
+
const words = /^edits (commit|discard|diff): no change under gcf\//m.test(r.err);
|
|
33
|
+
return words && named.length === 1 ? [] : null;
|
|
34
|
+
}
|
|
22
35
|
/**
|
|
23
36
|
* The tool of a proposed move: `propose_<key>`, `-` and `:` as `_` (AD-12). The session engine
|
|
24
37
|
* reads the name back with `_` as `-`, so `verdict:keep` comes back `verdict-keep`: moveOfTool
|