gcf-board 0.24.1 → 0.25.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 CHANGED
@@ -6,6 +6,7 @@ A local web board for game projects on [GCF](../gcf-aif-ext): the items by statu
6
6
 
7
7
  - Node.js ≥ 22.18
8
8
  - [`ai-factory`](https://www.npmjs.com/package/ai-factory) installed globally, and in each project [`gcf-aif-ext`](../gcf-aif-ext) ≥ 0.18 (`gcf board --json` with `schema: 4`: the columns, the moves, the item's fields, the blocks and the Help terms come from it as data)
9
+ - for 0.25: `gcf-aif-ext` ≥ 0.27 for **Push** and **Pull** on Changes and the header's `↑N` (an older core shows no strip)
9
10
  - for 0.23: `gcf-aif-ext` ≥ 0.25 and `gcf-harness-aif-ext` ≥ 0.24 for **Play** (an older core shows no bar)
10
11
  - for 0.22: `gcf-aif-ext` ≥ 0.24 and `gcf-harness-aif-ext` ≥ 0.23 for the **shelved** chip (an older pair stops a main batch at a card's loose code, as before)
11
12
  - for 0.21: `gcf-aif-ext` ≥ 0.23 for **amend** (an older core offers no such move)
@@ -49,7 +50,7 @@ The board knows no domain by name: the project's board read gives its columns, m
49
50
  - **Play** (board 0.24.0, core 0.26.0): a card waiting for play shows its build (one per code, `Same build as` when shared), **Play** per target of `play:` that builds first when there is none, **Stop** and **Change** (find again with agent, edit, build again), on its run's end card, in its window and on Playtest; **Set up** opens a chat thread whose agent finds the commands, **by hand** opens the form; **Play main** and **Build main** play the checkout as it is; a verdict stops the card's player and removes a build no other card holds.
50
51
  - **Amend** (board 0.21.0, core 0.23.0): under "more" on a card: the form opens on its text, shows old and new lines before the move, and refuses an edit made meanwhile with the text you typed kept beside it. A chat agent's proposal shows the same lines. During that card's run it is refused, and the proposal offers **Send to the run**, to a live session only.
51
52
  - **Run again** (board 0.20.1): an item a main batch has ended, blocked for one, can be run again while the batch goes on: it queues behind the batch. An item the batch works or has yet to reach is still refused with `already running from this board`, and so is every item of a worktree batch until that batch ends.
52
- - **Changes** (board 0.20.0, core 0.22.0): what is not committed and how it differs, view only: the agent commits. The header's `● 7 changed` counts the main checkout, and says `run writing in main` while a run works there; the screen switches between the main checkout and each run's worktree. A text file opens its diff, a picture its before and after; a binary file, the project's `no_diff:` globs (one glob a line in Settings), links, submodules, nested repositories and Git LFS files are listed and open nothing. It follows a move, a commit or an add at once, a save in an editor within 30 s.
53
+ - **Changes** (board 0.20.0, core 0.22.0): what is not committed and how it differs, view only: the agent commits. The header's `● 7 changed` counts the main checkout, and says `run writing in main` while a run works there; the screen switches between the main checkout and each run's worktree. Board 0.25 with core 0.27 adds **Push** on the main tab: how far the branch is ahead and behind its remote, the commits that go out and who made each, Push after a confirm, Pull when the remote moved on, both fast-forward only and never a force; `↑N` in the header counts what is not pushed. A text file opens its diff, a picture its before and after; a binary file, the project's `no_diff:` globs (one glob a line in Settings), links, submodules, nested repositories and Git LFS files are listed and open nothing. It follows a move, a commit or an add at once, a save in an editor within 30 s.
53
54
  - **Drag**:
54
55
  - a ready card into **running** starts its run;
55
56
  - a blocked or parked card into **ready** unblocks it;
@@ -105,6 +105,7 @@ const questionText = (b, move, id) => {
105
105
  /** The core lists 2000 rows at most, so a Commit ticks no more. */
106
106
  const CHANGE_PATHS_MAX = 2000;
107
107
  const COMMIT_TIMEOUT_MS = 600_000;
108
+ export const PUSH_TIMEOUT_MS = 150_000;
108
109
  /** The most paths one edits diff takes: a refusal past this many is read in the console. */
109
110
  const EDIT_PATHS_MAX = 2000;
110
111
  /** The same for an older core, each path an argument (core 0.20.1). */
@@ -1093,6 +1094,22 @@ export function createApp(o) {
1093
1094
  : { ok: false, err: briefError(r.err || r.out) });
1094
1095
  },
1095
1096
  ],
1097
+ [
1098
+ // Push and Pull on Changes (`gcf changes push|pull`, core 0.27): no body, fast-forward only.
1099
+ // The core stops git at 90 s; the route waits past that for its words.
1100
+ 'POST',
1101
+ /^\/api\/p\/([^/]+)\/changes\/(push|pull)$/,
1102
+ async (_req, res, m) => {
1103
+ const p = await projectOf(m[1]);
1104
+ const r = await cli(p, ['gcf', 'changes', m[2], '--json'], PUSH_TIMEOUT_MS);
1105
+ broadcast({ type: 'board', project: p.name });
1106
+ const err = r.err || r.out;
1107
+ const refusal = r.ok ? undefined : refusalOf(err);
1108
+ send(res, 200, r.ok
1109
+ ? { ok: true, ...jsonOf(r, `gcf changes ${m[2]}`) }
1110
+ : { ok: false, err: briefError(err), ...(refusal && { refusal }) });
1111
+ },
1112
+ ],
1096
1113
  [
1097
1114
  'GET',
1098
1115
  /^\/api\/p\/([^/]+)\/changes\/diff$/,
@@ -60,6 +60,8 @@ export function briefError(err) {
60
60
  return (m?.[1] ?? words).replaceAll('\r', '').trim();
61
61
  }
62
62
  const REFUSAL_LINE = /^gcf-refusal: .*(\r?\n)?/gm;
63
+ // Push and Pull's refusals with no data (core 0.27).
64
+ const PUSH_CODES = ['no-remote', 'behind', 'diverged', 'rejected', 'auth', 'timeout'];
63
65
  /**
64
66
  * The core's machine refusal in a command's error (core 0.20): its last `gcf-refusal: {…}`
65
67
  * line, read as data, never its words. Only the codes of `Refusal` are known; a path not under
@@ -77,11 +79,18 @@ export function refusalOf(err) {
77
79
  catch {
78
80
  return undefined;
79
81
  }
80
- const { code, paths, left, reason } = (data ?? {});
82
+ const { code, paths, left, reason, remotes } = (data ?? {});
81
83
  if (code === 'running' || code === 'stale')
82
84
  return { code };
83
85
  if (code === 'shelve')
84
86
  return { code, reason: typeof reason === 'string' ? reason : '' };
87
+ if (PUSH_CODES.includes(code))
88
+ return { code: code };
89
+ if (code === 'no-upstream')
90
+ return {
91
+ code,
92
+ remotes: Array.isArray(remotes) ? remotes.filter((r) => typeof r === 'string') : [],
93
+ };
85
94
  if (!Array.isArray(paths))
86
95
  return undefined;
87
96
  const safe = (a) => (Array.isArray(a) ? a : []).filter(gatePath);
@@ -77,9 +77,10 @@ async function readChanges(project, w) {
77
77
  export function markerEvent(busy, read) {
78
78
  if (busy)
79
79
  return { type: 'changes', count: null };
80
- return read && read.base !== null
81
- ? { type: 'changes', count: read.count }
82
- : { type: 'changes', count: null, unknown: true };
80
+ if (!read || read.base === null)
81
+ return { type: 'changes', count: null, unknown: true };
82
+ const ahead = read.branch?.ahead;
83
+ return { type: 'changes', count: read.count, ...(ahead && { ahead }) };
83
84
  }
84
85
  /** A project's files moved, or a run began or ended: read its marker if a page shows it. */
85
86
  export function signalChanges(project) {