@fapost/jig-ui 0.3.0 → 0.3.1-next.48
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/board/columns.js +9 -1
- package/dist/http/app.js +45 -2
- package/dist/jig/client.js +108 -12
- package/dist/source/local.js +127 -20
- package/dist/web/assets/CanvasView-D0k-DqqN.js +1 -0
- package/dist/web/assets/index-ByAkzj4v.css +2 -0
- package/dist/web/assets/{index-DNFgC6Vp.js → index-DhOCL5uI.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/CanvasView-C5ctZB7z.js +0 -1
- package/dist/web/assets/index-BAP4tdVQ.css +0 -2
package/dist/board/columns.js
CHANGED
|
@@ -32,10 +32,18 @@ function byQueue(a, b) {
|
|
|
32
32
|
return x === null ? -1 : y === null ? 1 : x < y ? -1 : 1;
|
|
33
33
|
return a.queue.position - b.queue.position;
|
|
34
34
|
}
|
|
35
|
+
/** After a resume only `paused` changes, so the rules say where the task lands. */
|
|
36
|
+
const card = (task) => ({ ...task, resumesTo: task.resumable ? columnOf({ ...task, paused: false }) : null });
|
|
35
37
|
/**
|
|
36
38
|
* The board: every column, in a fixed order, its cards in Jig's queue order and the tasks not queued after them in the
|
|
37
39
|
* order Jig listed them (the sort is stable). Computed on every read, never stored.
|
|
38
40
|
*/
|
|
39
41
|
export function columns(tasks) {
|
|
40
|
-
return COLUMNS.map((c) => ({
|
|
42
|
+
return COLUMNS.map((c) => ({
|
|
43
|
+
...c,
|
|
44
|
+
cards: tasks
|
|
45
|
+
.filter((t) => columnOf(t) === c.id)
|
|
46
|
+
.sort(byQueue)
|
|
47
|
+
.map(card),
|
|
48
|
+
}));
|
|
41
49
|
}
|
package/dist/http/app.js
CHANGED
|
@@ -67,6 +67,14 @@ function written(c, w) {
|
|
|
67
67
|
return refuse(c, 404, w.code, 'This project has no live task with this id.');
|
|
68
68
|
return refuse(c, 422, w.code, 'Jig refused the change.');
|
|
69
69
|
}
|
|
70
|
+
/** An upgrade refused before it ran, in the API's form: under way already, none to make, or Jig's code. */
|
|
71
|
+
function upgradeRefused(c, code) {
|
|
72
|
+
if (code === 'running')
|
|
73
|
+
return refuse(c, 409, code, 'An upgrade of this project is under way.');
|
|
74
|
+
if (code === 'not-found')
|
|
75
|
+
return refuse(c, 404, code, 'This project shows no upgrade of Jig to make.');
|
|
76
|
+
return refuse(c, 422, code, 'Jig refused the upgrade.');
|
|
77
|
+
}
|
|
70
78
|
/**
|
|
71
79
|
* The API, chained so that its type carries every route's answers: the page derives its types
|
|
72
80
|
* from `AppType` and never declares them a second time.
|
|
@@ -143,6 +151,12 @@ function apiRoutes(source, version) {
|
|
|
143
151
|
if (task === undefined || revision === undefined)
|
|
144
152
|
return refuse(c, 422, 'usage', 'Give a task and the revision it was read at.');
|
|
145
153
|
return written(c, await source.cancelPause(c.req.param('id'), task, revision));
|
|
154
|
+
})
|
|
155
|
+
.post('/api/projects/:id/tasks/resume', validator('json', taskAt), async (c) => {
|
|
156
|
+
const { task, revision } = c.req.valid('json');
|
|
157
|
+
if (task === undefined || revision === undefined)
|
|
158
|
+
return refuse(c, 422, 'usage', 'Give a task and the revision it was read at.');
|
|
159
|
+
return written(c, await source.resume(c.req.param('id'), task, revision));
|
|
146
160
|
})
|
|
147
161
|
// A new task carries no revision: it writes nothing that exists (adr-20261022-filing-a-task-carries-no-revision).
|
|
148
162
|
.post('/api/projects/:id/tasks', validator('json', (body) => {
|
|
@@ -158,6 +172,33 @@ function apiRoutes(source, version) {
|
|
|
158
172
|
return refuse(c, 409, w.code, 'The project has a task with this id, maybe a finished one.');
|
|
159
173
|
}
|
|
160
174
|
return written(c, w);
|
|
175
|
+
})
|
|
176
|
+
// A dry run: what upgrading the project's Jig would do, changing nothing.
|
|
177
|
+
.post('/api/projects/:id/upgrade/plan', async (c) => {
|
|
178
|
+
const planned = await source.planUpgrade(c.req.param('id'));
|
|
179
|
+
if (planned === undefined)
|
|
180
|
+
return refuse(c, 404, 'not-connected', 'No connected project has this id.');
|
|
181
|
+
if (planned.state === 'planned')
|
|
182
|
+
return c.json({ plan: planned.plan }, 200);
|
|
183
|
+
if (planned.state !== 'refused')
|
|
184
|
+
return c.json({ project: planned }, 200);
|
|
185
|
+
return upgradeRefused(c, planned.code);
|
|
186
|
+
})
|
|
187
|
+
// Answered at once: the upgrade runs on in the server, and the workspace shows it and then what it came to.
|
|
188
|
+
.post('/api/projects/:id/upgrade', async (c) => {
|
|
189
|
+
const started = await source.upgrade(c.req.param('id'));
|
|
190
|
+
if (started === undefined)
|
|
191
|
+
return refuse(c, 404, 'not-connected', 'No connected project has this id.');
|
|
192
|
+
if (started.state === 'started')
|
|
193
|
+
return c.json({ started: true }, 202);
|
|
194
|
+
if (started.state !== 'refused')
|
|
195
|
+
return c.json({ project: started }, 200);
|
|
196
|
+
return upgradeRefused(c, started.code);
|
|
197
|
+
})
|
|
198
|
+
.delete('/api/projects/:id/upgrade', async (c) => {
|
|
199
|
+
if (!(await source.dismissUpgrade(c.req.param('id'))))
|
|
200
|
+
return refuse(c, 404, 'not-connected', 'No connected project has this id.');
|
|
201
|
+
return c.body(null, 204);
|
|
161
202
|
})
|
|
162
203
|
.post('/api/projects', validator('json', (body) => ({
|
|
163
204
|
path: absolute(body?.path),
|
|
@@ -171,9 +212,11 @@ function apiRoutes(source, version) {
|
|
|
171
212
|
return result.created ? c.json({ project: result.project }, 201) : c.json({ project: result.project }, 200);
|
|
172
213
|
})
|
|
173
214
|
.delete('/api/projects/:id', async (c) => {
|
|
174
|
-
|
|
215
|
+
const disconnected = await source.disconnect(c.req.param('id'));
|
|
216
|
+
if (disconnected === 'upgrading')
|
|
217
|
+
return refuse(c, 409, 'upgrading', 'The project is being upgraded; disconnect it once that ends.');
|
|
218
|
+
if (!disconnected)
|
|
175
219
|
return refuse(c, 404, 'not-connected', 'No connected project has this id.');
|
|
176
|
-
}
|
|
177
220
|
return c.body(null, 204);
|
|
178
221
|
})
|
|
179
222
|
// A signal, not data: the page re-fetches what it shows (adr-20261014-project-source-port-keeps-hosting-open).
|
package/dist/jig/client.js
CHANGED
|
@@ -6,8 +6,13 @@ import { z } from 'zod';
|
|
|
6
6
|
const run = promisify(execFile);
|
|
7
7
|
/** The oldest Jig Jig UI reads and writes: 0.29.0 is the first that prints JSON, 0.31.0 the first with a queue. */
|
|
8
8
|
export const MIN_JIG_VERSION = '0.31.0';
|
|
9
|
+
/** The first Jig whose `task resume` takes `--revision` and `--json` (fapost-lab/jig#295). */
|
|
10
|
+
export const RESUME_JIG_VERSION = '0.35.0';
|
|
9
11
|
const SCRIPT = '.ai/scripts/jig';
|
|
10
12
|
const TIMEOUT_MS = 10_000;
|
|
13
|
+
/** A dry run compares every framework file; a real upgrade at `agent.git: merge` also waits for CI. */
|
|
14
|
+
const PLAN_TIMEOUT_MS = 60_000;
|
|
15
|
+
const UPGRADE_TIMEOUT_MS = 30 * 60_000;
|
|
11
16
|
/** The directory whose changes may change what Jig reports: the main checkout's `.ai/`. */
|
|
12
17
|
export const watchDir = (root) => join(root, '.ai');
|
|
13
18
|
/**
|
|
@@ -41,15 +46,15 @@ async function bash(platform) {
|
|
|
41
46
|
* by `BASH_SOURCE`) rather than `exec` it: Git bash's `exec` starts a second bash and waits for it, and every run took
|
|
42
47
|
* half as long again (CI, task `conflict-display`).
|
|
43
48
|
*/
|
|
44
|
-
async function jig(root, args, platform) {
|
|
49
|
+
async function jig(root, args, platform, timeout = TIMEOUT_MS) {
|
|
45
50
|
const argv = [SCRIPT, ...args];
|
|
46
51
|
const { stdout } = platform === 'win32'
|
|
47
52
|
? await run(await bash(platform), ['-c', `. ${argv.map((_, i) => `"$JIG_UI_ARG_${i}"`).join(' ')}`], {
|
|
48
53
|
cwd: root,
|
|
49
|
-
timeout
|
|
54
|
+
timeout,
|
|
50
55
|
env: { ...process.env, ...Object.fromEntries(argv.map((arg, i) => [`JIG_UI_ARG_${i}`, arg])) },
|
|
51
56
|
})
|
|
52
|
-
: await run(await bash(platform), argv, { cwd: root, timeout
|
|
57
|
+
: await run(await bash(platform), argv, { cwd: root, timeout });
|
|
53
58
|
return stdout;
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
@@ -64,15 +69,37 @@ export async function jigVersion(root, platform = process.platform) {
|
|
|
64
69
|
throw new Error('jig --version did not print a version');
|
|
65
70
|
return match[1];
|
|
66
71
|
}
|
|
67
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Why a JSON read was refused: Jig's failure code (`failed` for one this Jig UI does not know, or a shape it cannot
|
|
74
|
+
* read), and for `upgrade-blocked` every reason Jig gave, without a path.
|
|
75
|
+
*/
|
|
68
76
|
export class JigRefusal extends Error {
|
|
69
77
|
code;
|
|
70
|
-
|
|
78
|
+
reasons;
|
|
79
|
+
constructor(code, reasons = []) {
|
|
71
80
|
super(`jig refused: ${code}`);
|
|
72
81
|
this.code = code;
|
|
82
|
+
this.reasons = reasons;
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Jig's text for a person with every absolute path in it cut out: no path reaches the page. Jig 0.35.0 names only
|
|
87
|
+
* paths under the project, relative to it, since it runs in the project's root; this keeps a later one from leaking.
|
|
88
|
+
*/
|
|
89
|
+
export const withoutPaths = (text) => text.replace(/(?<=^|[\s(`'"])(?:[A-Za-z]:)?[\\/][^\s)`'"]*/g, '…');
|
|
90
|
+
const CODES = new Set([
|
|
91
|
+
'usage',
|
|
92
|
+
'not-a-repository',
|
|
93
|
+
'not-initialised',
|
|
94
|
+
'stale-revision',
|
|
95
|
+
'not-found',
|
|
96
|
+
'already-exists',
|
|
97
|
+
'not-paused',
|
|
98
|
+
'wrong-checkout',
|
|
99
|
+
'stash-conflict',
|
|
100
|
+
'upgrade-blocked',
|
|
101
|
+
'failed',
|
|
102
|
+
]);
|
|
76
103
|
/** Jig answered in a shape this Jig UI does not read: a Jig newer than the contract its tests pin. */
|
|
77
104
|
export class JigShapeError extends Error {
|
|
78
105
|
constructor() {
|
|
@@ -85,10 +112,10 @@ const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
|
85
112
|
* JigRefusal, as does output that is no JSON at all (a crash); an envelope of another shape throws
|
|
86
113
|
* JigShapeError.
|
|
87
114
|
*/
|
|
88
|
-
async function readJson(root, args, platform) {
|
|
115
|
+
async function readJson(root, args, platform, timeout) {
|
|
89
116
|
let stdout;
|
|
90
117
|
try {
|
|
91
|
-
stdout = await jig(root, [...args, '--json'], platform);
|
|
118
|
+
stdout = await jig(root, [...args, '--json'], platform, timeout);
|
|
92
119
|
}
|
|
93
120
|
catch (error) {
|
|
94
121
|
// A refusal is an envelope too, printed before the non-zero exit.
|
|
@@ -104,7 +131,12 @@ async function readJson(root, args, platform) {
|
|
|
104
131
|
if (!isObject(envelope) || envelope.schema !== 1 || typeof envelope.revision !== 'number')
|
|
105
132
|
throw new JigShapeError();
|
|
106
133
|
if (isObject(envelope.error)) {
|
|
107
|
-
const code = envelope.error
|
|
134
|
+
const { code, message } = envelope.error;
|
|
135
|
+
if (code === 'upgrade-blocked' && typeof message === 'string') {
|
|
136
|
+
// `upgrade: nothing was changed:` and then a reason a line, as ` - <reason>`.
|
|
137
|
+
const reasons = message.split('\n').flatMap((line) => (line.startsWith(' - ') ? [withoutPaths(line.slice(4))] : []));
|
|
138
|
+
throw new JigRefusal(code, reasons);
|
|
139
|
+
}
|
|
108
140
|
throw new JigRefusal(typeof code === 'string' && CODES.has(code) ? code : 'failed');
|
|
109
141
|
}
|
|
110
142
|
if (!isObject(envelope.data))
|
|
@@ -125,7 +157,8 @@ const text = z.string();
|
|
|
125
157
|
const maybe = z.string().nullable();
|
|
126
158
|
const count = z.int().nonnegative();
|
|
127
159
|
/** Something that needs the person, as `jig status --json` reports it; a kind this Jig UI does not know is shown by its texts. */
|
|
128
|
-
const Attention = z
|
|
160
|
+
const Attention = z
|
|
161
|
+
.object({
|
|
129
162
|
kind: text,
|
|
130
163
|
subject: z.object({ type: text, id: maybe }),
|
|
131
164
|
tasks: z.array(text),
|
|
@@ -133,7 +166,14 @@ const Attention = z.object({
|
|
|
133
166
|
detail: maybe,
|
|
134
167
|
todo: text,
|
|
135
168
|
url: maybe,
|
|
136
|
-
|
|
169
|
+
// The project's Jig and the machine's. The one field left out: only `upgrade-available` carries it
|
|
170
|
+
// (Jig 0.34.0), and that item never without it.
|
|
171
|
+
versions: z
|
|
172
|
+
.object({ from: text, to: text })
|
|
173
|
+
.nullish()
|
|
174
|
+
.transform((v) => v ?? null),
|
|
175
|
+
})
|
|
176
|
+
.refine((a) => a.kind !== 'upgrade-available' || a.versions !== null);
|
|
137
177
|
const Status = z.object({
|
|
138
178
|
attention: z.array(Attention),
|
|
139
179
|
housekeeping: z.object({ stale: z.boolean() }).nullable(),
|
|
@@ -173,7 +213,7 @@ const TaskRow = z
|
|
|
173
213
|
.object({
|
|
174
214
|
id: text,
|
|
175
215
|
class: maybe,
|
|
176
|
-
status: z.enum(['active', 'ready', 'consolidated', 'abandoned']),
|
|
216
|
+
status: z.enum(['active', 'ready', 'consolidated', 'abandoned', 'archived']),
|
|
177
217
|
issue: maybe,
|
|
178
218
|
goal: maybe,
|
|
179
219
|
knowledge_consolidated: z.boolean(),
|
|
@@ -326,6 +366,14 @@ export async function requestPause(root, task, revision, platform = process.plat
|
|
|
326
366
|
export async function cancelPause(root, task, revision, platform = process.platform) {
|
|
327
367
|
await readJson(root, ['queue', 'cancel', `task:${task}`, 'pause', '--revision', String(revision)], platform);
|
|
328
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Resumes a paused task (`jig task resume <id>`), in the main checkout. Refused as `not-paused`; `wrong-checkout` when
|
|
371
|
+
* the pause kept a stash and the checkout is not on the task's branch; `stash-conflict` when that stash does not apply,
|
|
372
|
+
* the task still paused; and as `moveInQueue` is. Applied, a stash is back in the checkout, as the terminal's resume.
|
|
373
|
+
*/
|
|
374
|
+
export async function resumeTask(root, task, revision, platform = process.platform) {
|
|
375
|
+
await readJson(root, ['task', 'resume', task, '--revision', String(revision)], platform);
|
|
376
|
+
}
|
|
329
377
|
/**
|
|
330
378
|
* Files a task with only its goal (`jig task new <id> --goal <text>`); refused as `already-exists` when the id is
|
|
331
379
|
* taken — by a finished task too — and `usage` for an id or goal Jig does not take. No revision: it writes nothing
|
|
@@ -334,3 +382,51 @@ export async function cancelPause(root, task, revision, platform = process.platf
|
|
|
334
382
|
export async function fileTask(root, id, goal, platform = process.platform) {
|
|
335
383
|
await readJson(root, ['task', 'new', id, '--goal', goal], platform);
|
|
336
384
|
}
|
|
385
|
+
/** What `jig upgrade --json` did, or for `--dry-run` would do (Jig 0.34.0): Jig's texts without a path. */
|
|
386
|
+
const Upgrade = z
|
|
387
|
+
.object({
|
|
388
|
+
mode: text,
|
|
389
|
+
from: maybe,
|
|
390
|
+
to: maybe,
|
|
391
|
+
outcome: text,
|
|
392
|
+
git: z
|
|
393
|
+
.object({
|
|
394
|
+
level: text,
|
|
395
|
+
branch: maybe,
|
|
396
|
+
commit: maybe,
|
|
397
|
+
pushed: z.boolean(),
|
|
398
|
+
pull_request: maybe,
|
|
399
|
+
merged: z.boolean(),
|
|
400
|
+
})
|
|
401
|
+
.nullable(),
|
|
402
|
+
manual_steps: z.array(text),
|
|
403
|
+
would_stop: z.array(text),
|
|
404
|
+
})
|
|
405
|
+
.transform(({ git, manual_steps, would_stop, ...rest }) => ({
|
|
406
|
+
...rest,
|
|
407
|
+
git: git && {
|
|
408
|
+
level: git.level,
|
|
409
|
+
branch: git.branch,
|
|
410
|
+
commit: git.commit,
|
|
411
|
+
pushed: git.pushed,
|
|
412
|
+
pullRequest: git.pull_request,
|
|
413
|
+
merged: git.merged,
|
|
414
|
+
},
|
|
415
|
+
manualSteps: manual_steps.map(withoutPaths),
|
|
416
|
+
wouldStop: would_stop.map(withoutPaths),
|
|
417
|
+
}));
|
|
418
|
+
/**
|
|
419
|
+
* What upgrading the project's Jig would do (`jig upgrade --dry-run`), changing nothing: the versions, the steps the
|
|
420
|
+
* release asks for by hand and every reason a real run would not start.
|
|
421
|
+
*/
|
|
422
|
+
export async function planUpgrade(root, platform = process.platform) {
|
|
423
|
+
return parsed(Upgrade, (await readJson(root, ['upgrade', '--dry-run'], platform, PLAN_TIMEOUT_MS)).data);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Upgrades the project's Jig (`jig upgrade`) in its main checkout, on a branch, as far as its `agent.git` lets Jig take
|
|
427
|
+
* it — at `merge` Jig waits for CI first. Refused as `upgrade-blocked`, with its reasons, before anything is touched;
|
|
428
|
+
* any other refusal, a failed push or pull request after the commit included, is `failed`.
|
|
429
|
+
*/
|
|
430
|
+
export async function runUpgrade(root, platform = process.platform) {
|
|
431
|
+
return parsed(Upgrade, (await readJson(root, ['upgrade'], platform, UPGRADE_TIMEOUT_MS)).data);
|
|
432
|
+
}
|
package/dist/source/local.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
-
import { cancelPause, fileTask, JigRefusal, JigShapeError, jigVersion, MIN_JIG_VERSION, moveInQueue, readQueue, readSpecs, readStatus, readTasks, requestPause, setPriority, supports, watchDir, writtenByReads, } from '../jig/client.js';
|
|
2
|
+
import { cancelPause, fileTask, JigRefusal, JigShapeError, jigVersion, MIN_JIG_VERSION, moveInQueue, planUpgrade, readQueue, readSpecs, readStatus, readTasks, requestPause, RESUME_JIG_VERSION, resumeTask, runUpgrade, setPriority, supports, watchDir, writtenByReads, } from '../jig/client.js';
|
|
3
3
|
import { addProject, readProjects, removeProject } from '../registry/projects.js';
|
|
4
4
|
import { watchTree } from '../watch/watch.js';
|
|
5
5
|
import { mainCheckout } from './checkout.js';
|
|
@@ -41,8 +41,11 @@ const gone = (t) => ({
|
|
|
41
41
|
updatedAt: t.updatedAt,
|
|
42
42
|
pullRequest: t.pullRequest && { url: t.pullRequest.url, state: t.pullRequest.state },
|
|
43
43
|
});
|
|
44
|
-
/**
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* A live task as a board's card shows it, with its place in the queue if it has one; `resumes` when the project's Jig
|
|
46
|
+
* takes `task resume --revision`.
|
|
47
|
+
*/
|
|
48
|
+
const card = (t, q, resumes) => ({
|
|
46
49
|
id: t.id,
|
|
47
50
|
class: t.class,
|
|
48
51
|
status: t.status,
|
|
@@ -50,6 +53,7 @@ const card = (t, q) => ({
|
|
|
50
53
|
paused: t.paused,
|
|
51
54
|
pauseRequest: t.pauseRequest,
|
|
52
55
|
pauseRequestable: t.actions.some((a) => a.id === 'request-pause' && a.offered),
|
|
56
|
+
resumable: resumes && t.actions.some((a) => a.id === 'resume' && a.offered),
|
|
53
57
|
started: t.branch !== null,
|
|
54
58
|
gate: t.gate?.state ?? null,
|
|
55
59
|
autopilot: t.autopilot?.state ?? null,
|
|
@@ -58,8 +62,8 @@ const card = (t, q) => ({
|
|
|
58
62
|
queue: q ? { level: q.level, position: q.position } : null,
|
|
59
63
|
});
|
|
60
64
|
/** A live task in full; where its worktree is was never read, and an action Jig refuses is left out. */
|
|
61
|
-
const details = (t, q, attention) => ({
|
|
62
|
-
...card(t, q),
|
|
65
|
+
const details = (t, q, attention, resumes) => ({
|
|
66
|
+
...card(t, q, resumes),
|
|
63
67
|
issue: t.issue,
|
|
64
68
|
branch: t.branch,
|
|
65
69
|
baseBranch: t.baseBranch,
|
|
@@ -110,12 +114,13 @@ async function readProject(project) {
|
|
|
110
114
|
if (!('list' in read))
|
|
111
115
|
return { view: read, tasks: read, details: [], specs: read, revision: null };
|
|
112
116
|
const { status, list, queue, specs, jigVersion } = read;
|
|
113
|
-
// Live: active and ready;
|
|
117
|
+
// Live: active and ready; finished: closed and abandoned. An archived one (Jig 0.37.0) is neither: Jig keeps it out of its lists.
|
|
114
118
|
const live = list.tasks.filter((t) => t.status === 'active' || t.status === 'ready');
|
|
115
119
|
const finished = list.tasks.filter((t) => t.status === 'consolidated' || t.status === 'abandoned');
|
|
116
120
|
const queued = new Map(queue.items.map((q) => [q.id, q]));
|
|
117
121
|
// The oldest of the reads the board is made of: a write against it is refused if anything was written after any of them.
|
|
118
122
|
const revision = Math.min(status.revision, list.revision, queue.revision);
|
|
123
|
+
const resumes = supports(jigVersion, RESUME_JIG_VERSION);
|
|
119
124
|
return {
|
|
120
125
|
view: {
|
|
121
126
|
id: project.id,
|
|
@@ -125,12 +130,14 @@ async function readProject(project) {
|
|
|
125
130
|
attention: status.attention,
|
|
126
131
|
housekeepingStale: status.housekeepingStale,
|
|
127
132
|
},
|
|
128
|
-
tasks: { state: 'ready', tasks: live.map((t) => card(t, queued.get(t.id))), finished: finished.map(gone), revision },
|
|
129
|
-
details: live.map((t) => details(t, queued.get(t.id), status.attention)),
|
|
133
|
+
tasks: { state: 'ready', tasks: live.map((t) => card(t, queued.get(t.id), resumes)), finished: finished.map(gone), revision },
|
|
134
|
+
details: live.map((t) => details(t, queued.get(t.id), status.attention, resumes)),
|
|
130
135
|
specs: { state: 'ready', specs },
|
|
131
136
|
revision,
|
|
132
137
|
};
|
|
133
138
|
}
|
|
139
|
+
/** The version Jig's `upgrade-available` item in a read names for this machine; none without the item. */
|
|
140
|
+
const upgradeTo = (read) => read.view.state === 'ready' ? (read.view.attention.find((a) => a.kind === 'upgrade-available')?.versions?.to ?? undefined) : undefined;
|
|
134
141
|
/** A read that may have caught Jig mid-write: worth one more try before it is believed. */
|
|
135
142
|
const torn = (read) => read.view.state === 'unreadable' || read.view.state === 'incompatible';
|
|
136
143
|
/**
|
|
@@ -140,6 +147,13 @@ const torn = (read) => read.view.state === 'unreadable' || read.view.state === '
|
|
|
140
147
|
*/
|
|
141
148
|
export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs } = {}) {
|
|
142
149
|
const entries = new Map();
|
|
150
|
+
/** The last upgrade start or disconnect: they run one at a time, each checking what the one before changed. */
|
|
151
|
+
let changing = Promise.resolve();
|
|
152
|
+
function oneAtATime(change) {
|
|
153
|
+
const done = changing.then(change);
|
|
154
|
+
changing = done.catch(() => undefined);
|
|
155
|
+
return done;
|
|
156
|
+
}
|
|
143
157
|
const listeners = new Set();
|
|
144
158
|
let rescan;
|
|
145
159
|
/** Counts the times following started; a read that finishes after a stop belongs to none. */
|
|
@@ -150,7 +164,7 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
150
164
|
const entryOf = (project) => {
|
|
151
165
|
let entry = entries.get(project.id);
|
|
152
166
|
if (!entry)
|
|
153
|
-
entries.set(project.id, (entry = { project, held: false, dirty: false, news: false }));
|
|
167
|
+
entries.set(project.id, (entry = { project, held: false, dirty: false, news: false, writes: new Set() }));
|
|
154
168
|
return entry;
|
|
155
169
|
};
|
|
156
170
|
/** Keeps what was shown over one torn read; otherwise the read is what the project shows. */
|
|
@@ -171,6 +185,9 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
171
185
|
*/
|
|
172
186
|
function refresh(entry, news = false) {
|
|
173
187
|
entry.news ||= news;
|
|
188
|
+
// Jig replaces its own scripts while it upgrades: a read could run one half placed. The run reads once it ends.
|
|
189
|
+
if (entry.upgrade?.state === 'running' && entry.shown)
|
|
190
|
+
return Promise.resolve();
|
|
174
191
|
if (entry.reading) {
|
|
175
192
|
entry.dirty = true;
|
|
176
193
|
return entry.reading;
|
|
@@ -198,6 +215,43 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
198
215
|
for (const listener of listeners)
|
|
199
216
|
listener(change);
|
|
200
217
|
}
|
|
218
|
+
/** Tells the listeners that what the project shows beyond Jig's read — its upgrade — changed. */
|
|
219
|
+
function signalUpgrade(entry) {
|
|
220
|
+
if (following() && entries.get(entry.project.id) === entry)
|
|
221
|
+
signal({ id: entry.project.id, revision: entry.shown?.revision ?? null });
|
|
222
|
+
}
|
|
223
|
+
/** The project's last read when an upgrade may start from it: ready and naming a version to upgrade to. */
|
|
224
|
+
async function upgradable(id) {
|
|
225
|
+
const project = (await readProjects(configDir)).find((p) => p.id === id);
|
|
226
|
+
if (!project)
|
|
227
|
+
return undefined;
|
|
228
|
+
const read = await shown(project);
|
|
229
|
+
if (read.view.state !== 'ready')
|
|
230
|
+
return read.view;
|
|
231
|
+
const entry = entryOf(project);
|
|
232
|
+
if (entry.upgrade?.state === 'running')
|
|
233
|
+
return { state: 'refused', code: 'running' };
|
|
234
|
+
const to = upgradeTo(read);
|
|
235
|
+
return to === undefined ? { state: 'refused', code: 'not-found' } : { entry, to };
|
|
236
|
+
}
|
|
237
|
+
/** Runs the upgrade to its end, then keeps what it came to and reads the project again. */
|
|
238
|
+
async function upgrading(entry) {
|
|
239
|
+
// A read or a write under way runs Jig in the same checkout.
|
|
240
|
+
await Promise.allSettled([entry.reading, ...entry.writes]);
|
|
241
|
+
let run;
|
|
242
|
+
try {
|
|
243
|
+
run = { state: 'done', at: '', upgrade: await runUpgrade(entry.project.path) };
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
run =
|
|
247
|
+
error instanceof JigRefusal
|
|
248
|
+
? { state: 'refused', at: '', code: error.code, reasons: error.reasons }
|
|
249
|
+
: { state: 'refused', at: '', code: 'failed', reasons: [] };
|
|
250
|
+
}
|
|
251
|
+
entry.upgrade = { ...run, at: new Date().toISOString() };
|
|
252
|
+
await refresh(entry);
|
|
253
|
+
signalUpgrade(entry);
|
|
254
|
+
}
|
|
201
255
|
/** What the project shows: from the watch while following, read through Jig otherwise. */
|
|
202
256
|
async function shown(project) {
|
|
203
257
|
const entry = entryOf(project);
|
|
@@ -253,7 +307,9 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
253
307
|
for (const entry of entries.values()) {
|
|
254
308
|
entry.watch?.close();
|
|
255
309
|
entry.watch = undefined;
|
|
256
|
-
|
|
310
|
+
// A project being upgraded keeps its read: it is read again only once the upgrade ends.
|
|
311
|
+
if (entry.upgrade?.state !== 'running')
|
|
312
|
+
entry.shown = undefined;
|
|
257
313
|
entry.held = false;
|
|
258
314
|
}
|
|
259
315
|
}
|
|
@@ -271,20 +327,29 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
271
327
|
return tasks;
|
|
272
328
|
if (!taskIds.every((t) => tasks.tasks.some((live) => live.id === t)))
|
|
273
329
|
return { state: 'refused', code: 'not-found' };
|
|
330
|
+
const entry = entryOf(project);
|
|
331
|
+
// Jig replaces its own scripts while it upgrades: the write waits for the person to try again.
|
|
332
|
+
if (entry.upgrade?.state === 'running')
|
|
333
|
+
return { state: 'refused', code: 'upgrading' };
|
|
274
334
|
let written = { state: 'written' };
|
|
335
|
+
const run = write(project.path);
|
|
336
|
+
entry.writes.add(run);
|
|
275
337
|
try {
|
|
276
|
-
await
|
|
338
|
+
await run;
|
|
277
339
|
}
|
|
278
340
|
catch (error) {
|
|
279
341
|
// Only the code goes on: Jig's message may name a path.
|
|
280
342
|
written = { state: 'refused', code: error instanceof JigRefusal ? error.code : 'failed' };
|
|
281
343
|
}
|
|
282
|
-
|
|
344
|
+
finally {
|
|
345
|
+
entry.writes.delete(run);
|
|
346
|
+
}
|
|
347
|
+
await refresh(entry);
|
|
283
348
|
return written;
|
|
284
349
|
}
|
|
285
350
|
return {
|
|
286
351
|
async workspace() {
|
|
287
|
-
return Promise.all((await readProjects(configDir)).map(async (p) => (await shown(p)).view));
|
|
352
|
+
return Promise.all((await readProjects(configDir)).map(async (p) => ({ ...(await shown(p)).view, upgrade: entryOf(p).upgrade ?? null })));
|
|
288
353
|
},
|
|
289
354
|
async connect(path) {
|
|
290
355
|
const found = await connectable(path);
|
|
@@ -330,20 +395,62 @@ export function localSource(configDir, { rescanMs = 60_000, quietMs, maxWaitMs }
|
|
|
330
395
|
cancelPause(id, taskId, revision) {
|
|
331
396
|
return writing(id, [taskId], (root) => cancelPause(root, taskId, revision));
|
|
332
397
|
},
|
|
398
|
+
resume(id, taskId, revision) {
|
|
399
|
+
return writing(id, [taskId], (root) => resumeTask(root, taskId, revision));
|
|
400
|
+
},
|
|
333
401
|
fileTask(id, taskId, goal) {
|
|
334
402
|
// A new id names no live task: Jig itself refuses a taken one.
|
|
335
403
|
return writing(id, [], (root) => fileTask(root, taskId, goal));
|
|
336
404
|
},
|
|
337
|
-
async
|
|
338
|
-
|
|
405
|
+
async planUpgrade(id) {
|
|
406
|
+
const found = await upgradable(id);
|
|
407
|
+
if (!found || !('entry' in found))
|
|
408
|
+
return found;
|
|
409
|
+
try {
|
|
410
|
+
return { state: 'planned', plan: await planUpgrade(found.entry.project.path) };
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
return { state: 'refused', code: error instanceof JigRefusal ? error.code : 'failed' };
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
upgrade(id) {
|
|
417
|
+
// Two starts at once make one run; a disconnect sent with a start finds the run, or the start no project.
|
|
418
|
+
return oneAtATime(async () => {
|
|
419
|
+
const found = await upgradable(id);
|
|
420
|
+
if (!found || !('entry' in found))
|
|
421
|
+
return found;
|
|
422
|
+
found.entry.upgrade = { state: 'running', since: new Date().toISOString(), to: found.to };
|
|
423
|
+
signalUpgrade(found.entry);
|
|
424
|
+
void upgrading(found.entry);
|
|
425
|
+
return { state: 'started' };
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
async dismissUpgrade(id) {
|
|
429
|
+
const project = (await readProjects(configDir)).find((p) => p.id === id);
|
|
430
|
+
if (!project)
|
|
339
431
|
return false;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
432
|
+
const entry = entryOf(project);
|
|
433
|
+
if (entry.upgrade && entry.upgrade.state !== 'running') {
|
|
434
|
+
entry.upgrade = undefined;
|
|
435
|
+
signalUpgrade(entry);
|
|
436
|
+
}
|
|
345
437
|
return true;
|
|
346
438
|
},
|
|
439
|
+
disconnect(id) {
|
|
440
|
+
return oneAtATime(async () => {
|
|
441
|
+
// The run is the entry's: without it a project connected again would be read, and upgraded, meanwhile.
|
|
442
|
+
if (entries.get(id)?.upgrade?.state === 'running')
|
|
443
|
+
return 'upgrading';
|
|
444
|
+
if (!(await removeProject(configDir, id)))
|
|
445
|
+
return false;
|
|
446
|
+
entries.get(id)?.watch?.close();
|
|
447
|
+
entries.delete(id);
|
|
448
|
+
known?.delete(id); // connected again before the next sweep, it is news again
|
|
449
|
+
if (following())
|
|
450
|
+
signal({ id, revision: null });
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
},
|
|
347
454
|
subscribe(listener) {
|
|
348
455
|
listeners.add(listener);
|
|
349
456
|
if (!following())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as ee,K as u,L as te,M as d,N as f,O as ne,P as p,Q as m,R as re,S as ie,T as h,U as g,V as _,W as v,X as y,Y as b,Z as x,_ as ae,a as S,b as C,c as oe,d as w,et as T,f as se,g as E,h as D,i as ce,j as le,k as ue,l as de,m as fe,n as O,nt as pe,o as me,p as k,q as A,r as j,rt as M,s as he,t as ge,tt as N,u as _e,v as ve,w as P,x as F,y as ye,z as I}from"./index-DhOCL5uI.js";var be=A({__name:`BaseSeparator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){let r=t,i=[`horizontal`,`vertical`];function a(e){return i.includes(e)}let o=n(()=>a(r.orientation)?r.orientation:`horizontal`),s=n(()=>o.value===`vertical`?r.orientation:void 0),l=n(()=>r.decorative?{role:`none`}:{"aria-orientation":s.value,role:`separator`});return(n,r)=>(y(),c(T(f),b({as:t.as,"as-child":t.asChild,"data-orientation":o.value},l.value),{default:e(()=>[m(n.$slots,`default`)]),_:3},16,[`as`,`as-child`,`data-orientation`]))}}),xe=A({__name:`Separator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){let n=t;return(t,r)=>(y(),c(be,pe(ee(n)),{default:e(()=>[m(t.$slots,`default`)]),_:3},16))}}),Se=A({__name:`CardContent`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(y(),v(`div`,{"data-slot":`card-content`,class:N(T(p)(`px-4 group-data-[size=sm]/card:px-3`,t.class))},[m(e.$slots,`default`)],2))}}),Ce=A({__name:`CardDescription`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(y(),v(`div`,{"data-slot":`card-description`,class:N(T(p)(`text-xs/relaxed text-muted-foreground`,t.class))},[m(e.$slots,`default`)],2))}}),we=A({__name:`CardHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(y(),v(`div`,{"data-slot":`card-header`,class:N(T(p)(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-none px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,t.class))},[m(e.$slots,`default`)],2))}}),Te=A({__name:`CardTitle`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(y(),v(`div`,{"data-slot":`card-title`,class:N(T(p)(`cn-font-heading text-sm font-medium group-data-[size=sm]/card:text-sm`,t.class))},[m(e.$slots,`default`)],2))}}),L=A({__name:`Separator`,props:{orientation:{default:`horizontal`},decorative:{type:Boolean,default:!0},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=ue(t,`class`);return(e,r)=>(y(),c(T(xe),b({"data-slot":`separator`},T(n),{class:T(p)(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch`,t.class)}),null,16,[`class`]))}}),Ee=[`aria-label`],De={class:`flex items-baseline gap-3 border-b bg-muted/50 px-4 py-2`},Oe={class:`font-semibold tracking-wider uppercase`},ke={key:0,class:`text-muted-foreground`},Ae={class:`grid grid-cols-1 divide-y lg:grid-cols-2 lg:divide-x lg:divide-y-0`},R=A({__name:`CanvasSection`,props:{title:{},note:{}},setup(e){return(t,n)=>(y(),v(`section`,{"aria-label":e.title,class:`border-b`},[_(`h2`,De,[_(`span`,Oe,M(e.title),1),e.note?(y(),v(`span`,ke,M(e.note),1)):g(``,!0)]),_(`div`,Ae,[(y(),v(I,null,x([`light`,`dark`],e=>_(`div`,{key:e,class:N([e,`flex flex-col gap-4 bg-background p-4 text-foreground`])},[m(t.$slots,`default`)],2)),64))])],8,Ee))}}),z=(e,t)=>({id:e,class:`T2`,status:`active`,goal:null,paused:!1,pauseRequest:null,pauseRequestable:!0,resumable:!1,resumesTo:null,started:!0,gate:null,autopilot:null,pullRequest:null,priority:null,queue:null,...t}),B=(e,t)=>({url:`https://github.com/fapost-lab/jig-ui/pull/18`,state:e,ci:t,fetchedAt:`2026-10-18T09:40:00Z`}),V=[z(`design-system`,{class:`T3`,gate:`waiting`,priority:0,queue:{level:null,position:100},goal:`shadcn-vue on Tailwind v4 with light and dark themes; #/canvas with every component in every variant; the three screens rebuilt on it.`}),z(`registry-schema`,{gate:`changed`,priority:3,queue:{level:null,position:200},goal:`Version the registry file so a newer Jig UI can read an older one.`}),z(`pause-request`,{class:`T3`,autopilot:`stopped`,goal:`A drop on the paused column writes a sticky request through Jig; the card shows it with its age and a cancel.`}),z(`specs-and-epics`,{autopilot:`on`,queue:{level:null,position:300},goal:`Show each spec with its phases, progress and epic branch beside the board, from Jig's spec list.`}),z(`task-details`,{status:`ready`,pullRequest:B(`open`,`green`),goal:`Open a task's details from its card.`}),z(`refusal-fixture`,{class:`T0`,status:`ready`,pullRequest:B(`open`,`red`),goal:`Replace the refusal text in task-list-states.json with one Jig prints.`}),z(`docs-board`,{class:`T1`,status:`ready`,pullRequest:B(`open`,`pending`),goal:`Describe the five columns on the projects page of the docs.`}),z(`live-updates`,{status:`ready`,pullRequest:B(`merged`,`none`),goal:`Follow connected projects without a reload.`}),z(`no-pr-yet`,{class:`T1`,status:`ready`,goal:`Ready, nothing pushed.`}),z(`jig-init-hook`,{class:`T3`,paused:!0,pauseRequestable:!1,goal:`Register a project in an installed Jig UI from jig init.`}),z(`file-backlog-task`,{class:null,started:!1,goal:`File a minimal backlog task from the page through jig task new.`}),z(`a-task-with-a-rather-long-identifier-that-wraps`,{goal:null}),z(`conflict-display`,{pauseRequest:{requestedAt:`2026-10-22T09:00:00Z`},pauseRequestable:!1,goal:`Show what changed when a write was based on a stale read.`}),z(`resume-from-page`,{class:`T3`,paused:!0,pauseRequestable:!1,resumable:!0,resumesTo:`in-progress`,goal:`A drop out of Paused, or the card menu, resumes the task through jig task resume.`})],H=[{id:`needs-you`,title:`Needs you`,cards:V.slice(0,3)},{id:`in-progress`,title:`In progress`,cards:[V[3],V[12],V[11]]},{id:`ready`,title:`Ready`,cards:V.slice(4,9)},{id:`backlog`,title:`Backlog`,cards:[V[10]]},{id:`paused`,title:`Paused`,cards:[V[9],V[13]]}],U=H.map(e=>({...e,cards:[]})),je=[{id:`file-backlog-task`,status:`consolidated`,goal:`File a minimal backlog task from the page.`,updatedAt:`2026-10-25`,pullRequest:{url:`https://github.com/fapost-lab/jig-ui/pull/40`,state:`merged`}},{id:`pr-template`,status:`abandoned`,goal:`A pull request template.`,updatedAt:`2026-10-17`,pullRequest:null},{id:`old-spike`,status:`abandoned`,goal:null,updatedAt:`2026-10-12`,pullRequest:null}],Me=[{id:`needs-you`,title:`Needs you`,count:3},{id:`in-progress`,title:`In progress`,count:1},{id:`ready`,title:`Ready`,count:5},{id:`backlog`,title:`Backlog`,count:1},{id:`paused`,title:`Paused`,count:1},{id:`unknown`,title:`A column this page does not know`,count:0}],W=[{kind:`gate`,subject:{type:`task`,id:`design-system`},tasks:[`design-system`],title:`Design waits at its gate`,detail:null,todo:`Review the design and approve it: jig task gate design-system approved`,url:null,versions:null},{kind:`pull-request-ci-failed`,subject:{type:`task`,id:`refusal-fixture`},tasks:[`refusal-fixture`],title:`CI failed`,detail:`pull request #19`,todo:`Look at the failing check.`,url:`https://github.com/fapost-lab/jig-ui/pull/19`,versions:null},{kind:`housekeeping`,subject:{type:`project`,id:null},tasks:[],title:`Housekeeping never ran`,detail:null,todo:`Run jig housekeeping.`,url:`https://example.com/docs`,versions:null}],G=[{id:`approve-gate`,command:`jig task gate design-system approved`},{id:`answer-stop`,command:`jig task autopilot pause-request resume --answer <text>`},{id:`pause`,command:`jig task pause design-system`},{id:`request-pause`,command:`jig queue request task:design-system pause`},{id:`something-new`,command:`jig task something-new design-system`}],K={state:`ready`,issue:null,baseBranch:`main`,createdAt:`2026-10-17`,updatedAt:`2026-10-18`,knowledgeConsolidated:!1,worktree:null,gateBy:null,run:null,housekeepingFlags:[],attention:[]},q=[{...K,...V[2],gate:`approved`,gateBy:`human`,branch:`task/pause-request`,worktree:{uncommitted:4},issue:`#42`,pullRequest:B(`open`,`red`),run:{mode:`attended`,stage:`implement`,stageAt:`2026-10-18T09:00:00Z`,stopReason:`Which column takes a paused task that already has an open pull request?`,stopAt:`2026-10-18T09:12:00Z`,phase:null},housekeepingFlags:[`needs-consolidation`],attention:[W[0]],actions:G,column:{id:`needs-you`,title:`Needs you`}},{...K,...V[10],branch:null,actions:[{id:`start`,command:`jig task start file-backlog-task`}],column:{id:`backlog`,title:`Backlog`}}],J=(e,t={})=>({id:e,state:`ready`,jigVersion:`0.29.0`,counts:{active:11,paused:1,ready:3},attention:[],housekeepingStale:!1,upgrade:null,...t}),Y=[J(`jig-ui`,{attention:W,housekeepingStale:!0}),J(`nextjs-store`,{counts:{active:0,paused:0,ready:0}}),J(`legacy-shop`,{jigVersion:`0.34.0`,counts:{active:2,paused:0,ready:0},attention:[{kind:`upgrade-available`,subject:{type:`project`,id:null},tasks:[],title:`Jig in this project is older than on this machine`,detail:`this project runs 0.34.0; this machine has 0.35.0`,todo:`jig upgrade`,url:null,versions:{from:`0.34.0`,to:`0.35.0`}}]}),{id:`old-jig`,state:`unsupported`,jigVersion:`0.26.0`,minimum:`0.29.0`,upgrade:null},{id:`new-jig`,state:`incompatible`,jigVersion:`1.0.0`,upgrade:null},{id:`busy`,state:`unreadable`,code:`locked`,upgrade:null},{id:`moved`,state:`unavailable`,reason:`missing`,upgrade:null}],X={mode:`copy`,from:`0.34.0`,to:`0.35.0`,outcome:`planned`,git:null,manualSteps:[],wouldStop:[]},Ne=[{state:`reading`},{state:`planned`,plan:X},{state:`planned`,plan:{...X,manualSteps:[`Restart your agent sessions: the skills changed.`]}},{state:`planned`,plan:{...X,wouldStop:["the working tree has uncommitted changes; commit them, stash them (`git stash`), or finish the task they belong to, then run `jig upgrade` again"]}},{state:`refused`,message:`Jig refused the upgrade.`}],Z={level:`pr`,branch:`jig/upgrade-0.35.0`,commit:`279390b`,pushed:!0,pullRequest:`https://github.com/fapost-lab/jig-ui/pull/49`,merged:!1},Q=e=>({state:`done`,at:`2026-10-27T08:00:00Z`,upgrade:{...X,outcome:`upgraded`,git:Z,...e}}),Pe=[{state:`running`,since:new Date(Date.now()-12e4).toISOString(),to:`0.35.0`},Q({git:{...Z,merged:!0}}),Q({manualSteps:[`Restart your agent sessions: the skills changed.`]}),Q({outcome:`staged`,git:{...Z,level:`none`,commit:null,pushed:!1,pullRequest:null}}),Q({outcome:`nothing-to-do`,git:null}),{state:`refused`,at:`2026-10-27T08:00:00Z`,code:`upgrade-blocked`,reasons:[`task up-x is started and its branch task/up-x is checked out here (record .ai/runtime/working/up-x); the upgrade would take this checkout off it`]},{state:`refused`,at:`2026-10-27T08:00:00Z`,code:`failed`,reasons:[]}],$=[{text:"`design-system` — design system and canvas",checked:!0,task:`design-system`,fog:!1},{text:"`specs-and-epics` — specs and epics (after: project board — `jig spec list`)",checked:!1,task:`specs-and-epics`,fog:!1},{text:"`old-task` — a task no longer live",checked:!1,task:`old-task`,fog:!1},{text:`invoices from orders, no task filed yet`,checked:!1,task:null,fog:!1},{text:"fog: registration by `jig init`",checked:!1,task:null,fog:!0}],Fe=[{id:`jig-ui`,title:`Jig UI — a local control center for Jig projects`,missingFiles:[],release:null,epic:null,progress:{done:2,total:6,filed:2,fog:1},phases:[{phase:0,title:`Package and release`,done:1,total:1,filed:0,fog:0,items:[{...$[0],text:`package and release`,task:null}]},{phase:1,title:`Read-only UI`,done:1,total:5,filed:2,fog:1,items:$}]},{id:`billing`,title:`Billing in one place`,missingFiles:[],release:`minor`,epic:{branch:`epic/billing`,state:`open`,checkedOut:!1,missing:!1,fetched:!0},progress:{done:0,total:1,filed:0,fog:0},phases:[{phase:null,title:null,done:0,total:1,filed:0,fog:0,items:[$[3]]}]},{id:`lost-epic`,title:`An epic whose branch is gone`,missingFiles:[],release:`major`,epic:{branch:`epic/lost`,state:`open`,checkedOut:!0,missing:!0,fetched:!1},progress:null,phases:[]},{id:`half-written`,title:null,missingFiles:[`spec.md`,`roadmap.md`],release:null,epic:null,progress:null,phases:[]}],Ie={class:`flex gap-4`},Le={class:`w-24 text-muted-foreground`},Re={class:`flex items-center gap-2`},ze={class:`flex flex-wrap gap-2`},Be={class:`flex max-w-sm flex-col gap-2`},Ve={class:`flex h-5 items-center gap-2`},He={class:`flex gap-2`},Ue={class:`flex flex-wrap items-center gap-6`},We={class:`flex items-center gap-1`},Ge={class:`grid grid-cols-2 gap-2 xl:grid-cols-3`},Ke={class:`flex h-[28rem] flex-col`},qe={class:`flex h-40 flex-col`},Je={class:`flex h-[28rem] flex-col`},Ye={class:`flex h-64 flex-col`},Xe={class:`flex h-64 flex-col`},Ze=A({__name:`CanvasView`,setup(n){let ee=[`default`,`secondary`,`outline`,`ghost`,`destructive`,`link`],f=[`xs`,`sm`,`default`,`lg`],p=[`icon-xs`,`icon-sm`,`icon`,`icon-lg`],m=[`default`,`secondary`,`outline`,`ghost`,`destructive`,`link`],g=[`attention`,`good`,`bad`,`quiet`];return(n,b)=>(y(),v(`div`,null,[b[14]||=_(`div`,{class:`border-b px-4 py-3`},[_(`h1`,{class:`font-semibold tracking-wider uppercase`},`Canvas`),_(`p`,{class:`text-muted-foreground`},`Every component of the page in every variant and state; the left panel light, the right dark.`)],-1),u(R,{title:`Tones`,note:`lib/tones.ts — the only colours with a meaning`},{default:e(()=>[(y(),v(I,null,x(g,e=>_(`p`,{key:e,class:N(T(te)[e])},M(e)+` as a rule`,3)),64)),_(`p`,Ie,[(y(),v(I,null,x(g,e=>_(`span`,{key:e,class:N(T(re)[e])},M(e),3)),64))])]),_:1}),b[15]||=_(`h2`,{class:`border-b px-4 py-2 font-bold tracking-widest uppercase`},`components/ui`,-1),u(R,{title:`Button`,note:`variant × size; icon sizes; disabled`},{default:e(()=>[(y(),v(I,null,x(ee,t=>_(`div`,{key:t,class:`flex flex-wrap items-center gap-2`},[_(`span`,Le,M(t),1),(y(),v(I,null,x(f,n=>u(T(d),{key:n,variant:t,size:n},{default:e(()=>[s(M(n),1)]),_:2},1032,[`variant`,`size`])),64)),u(T(d),{variant:t,disabled:``},{default:e(()=>[...b[0]||=[s(`disabled`,-1)]]),_:1},8,[`variant`])])),64)),_(`div`,Re,[b[2]||=_(`span`,{class:`w-24 text-muted-foreground`},`icon`,-1),(y(),v(I,null,x(p,t=>u(T(d),{key:t,variant:`outline`,size:t,"aria-label":t},{default:e(()=>[u(T(o))]),_:1},8,[`size`,`aria-label`])),64)),u(T(d),{variant:`outline`,size:`sm`},{default:e(()=>[u(T(o),{"data-icon":`inline-start`}),b[1]||=s(`with icon`,-1)]),_:1})])]),_:1}),u(R,{title:`Badge`},{default:e(()=>[_(`div`,ze,[(y(),v(I,null,x(m,t=>u(T(ne),{key:t,variant:t},{default:e(()=>[s(M(t),1)]),_:2},1032,[`variant`])),64))])]),_:1}),u(R,{title:`Card`},{default:e(()=>[u(T(i),{class:`max-w-sm`},{default:e(()=>[u(T(we),null,{default:e(()=>[u(T(Te),null,{default:e(()=>[...b[3]||=[s(`Card title`,-1)]]),_:1}),u(T(Ce),null,{default:e(()=>[...b[4]||=[s(`Card description, muted.`,-1)]]),_:1})]),_:1}),u(T(Se),null,{default:e(()=>[...b[5]||=[s(`Card content.`,-1)]]),_:1})]),_:1})]),_:1}),u(R,{title:`Input and Label`,note:`empty, filled, invalid, disabled`},{default:e(()=>[_(`div`,Be,[u(T(se),null,{default:e(()=>[...b[6]||=[s(`Project path`,-1)]]),_:1}),u(T(k),{placeholder:`/path/to/project`}),u(T(k),{"model-value":`/Users/me/project`}),u(T(k),{"model-value":`/not/a/project`,"aria-invalid":`true`}),u(T(k),{"model-value":`disabled`,disabled:``})])]),_:1}),u(R,{title:`Separator`},{default:e(()=>[u(T(L)),_(`div`,Ve,[b[7]||=s(`left`,-1),u(T(L),{orientation:`vertical`}),b[8]||=s(`right`,-1)])]),_:1}),u(R,{title:`ToggleGroup`,note:`the Board / List switch`},{default:e(()=>[u(T(me),{type:`single`,variant:`outline`,size:`sm`,"model-value":`board`,"aria-label":`View`},{default:e(()=>[u(T(S),{value:`board`},{default:e(()=>[...b[9]||=[s(`Board`,-1)]]),_:1}),u(T(S),{value:`list`},{default:e(()=>[...b[10]||=[s(`List`,-1)]]),_:1})]),_:1})]),_:1}),u(R,{title:`Toggle`,note:`the board's finished tasks: off, on`},{default:e(()=>[_(`div`,He,[u(T(he),{variant:`outline`,size:`sm`,"model-value":!1},{default:e(()=>[...b[11]||=[s(`3 finished tasks`,-1)]]),_:1}),u(T(he),{variant:`outline`,size:`sm`,"model-value":!0},{default:e(()=>[...b[12]||=[s(`3 finished tasks`,-1)]]),_:1})])]),_:1}),u(R,{title:`Collapsible`,note:`open and folded`},{default:e(()=>[(y(),v(I,null,x([!0,!1],t=>u(T(ye),{key:String(t),"default-open":t},{default:e(()=>[u(T(ae),{class:`w-full border-b bg-muted/50 px-3 py-1.5 text-left`},{default:e(()=>[s(`Trigger (`+M(t?`open`:`folded`)+`)`,1)]),_:2},1024),u(T(ve),{class:`px-3 py-2`},{default:e(()=>[...b[13]||=[s(`Content`,-1)]]),_:1})]),_:2},1032,[`default-open`])),64))]),_:1}),b[16]||=_(`h2`,{class:`border-b px-4 py-2 font-bold tracking-widest uppercase`},`components`,-1),u(R,{title:`ProjectTabs`,note:`on the workspace; on a project; empty`},{default:e(()=>[u(l,{projects:T(Y),version:`0.1.0`},{default:e(()=>[u(le)]),_:1},8,[`projects`]),u(l,{projects:T(Y),current:`jig-ui`,version:`0.1.0`},null,8,[`projects`]),u(l,{projects:[]})]),_:1}),u(R,{title:`ThemeToggle`,note:`switches the whole page; the icon is the theme it switches to`},{default:e(()=>[_(`div`,null,[u(le)])]),_:1}),u(R,{title:`ProjectCard`,note:`ready with attention and stale housekeeping; nothing needs you; its Jig older than the machine's, Upgrade… offered; each state it cannot be read in`},{default:e(()=>[(y(!0),v(I,null,x(T(Y),e=>(y(),c(ge,{key:e.id,project:e},null,8,[`project`]))),128))]),_:1}),u(R,{title:`UpgradePanel`,note:`on a card: reading the dry run; the plan, with steps by hand; a stop; a refusal; under way; merged, with steps by hand, staged, nothing to do; not started; failed`},{default:e(()=>[(y(!0),v(I,null,x(T(Ne),(e,t)=>(y(),c(O,{key:`plan-${t}`,project:`legacy-shop`,run:null,plan:e},null,8,[`plan`]))),128)),(y(!0),v(I,null,x(T(Pe),(e,t)=>(y(),c(O,{key:`run-${t}`,project:`legacy-shop`,run:e,plan:void 0},null,8,[`run`]))),128))]),_:1}),u(R,{title:`NewTaskForm`,note:`empty, on its way, the id taken`},{default:e(()=>[u(w,{busy:!1}),u(w,{busy:!0,task:`fix-login`,goal:`Log in with the token after a restart.`}),u(w,{busy:!1,task:`queue-reorder`,goal:`Order the work.`,refusal:`The project has a task called queue-reorder already, maybe a finished one. Choose another id.`,taken:``})]),_:1}),u(R,{title:`ConnectForm`,note:`idle, busy, refused`},{default:e(()=>[u(j,{busy:!1}),u(j,{busy:!0,"model-value":`/Users/me/project`}),u(j,{busy:!1,"model-value":`/Users/me/project/.claude/worktrees/x`,refusal:`That is a worktree. Connect the main checkout instead.`})]),_:1}),u(R,{title:`AttentionItem`,note:`no link; a pull request; another link`},{default:e(()=>[(y(!0),v(I,null,x(T(W),(e,t)=>(y(),c(ce,{key:t,item:e},null,8,[`item`]))),128))]),_:1}),u(R,{title:`ColumnHeader`,note:`each column, and one this page does not know`},{default:e(()=>[(y(!0),v(I,null,x(T(Me),e=>(y(),c(t,{id:e.id,key:e.id,title:e.title,count:e.count},null,8,[`id`,`title`,`count`]))),128))]),_:1}),u(R,{title:`QueueMenu`,note:`press to open: To top, Up, Down, To bottom, Priority, the pause — first queued, in the middle, not queued, last, paused under a Jig that cannot resume it (no pause to ask, Resume off), paused and resumable, a pause asked, while its change is on its way`},{default:e(()=>[_(`div`,Ue,[(y(!0),v(I,null,x([T(V)[0],T(V)[1],T(V)[3],T(V)[11],T(V)[9],T(V)[13],T(V)[12]],e=>(y(),v(`span`,{key:e.id,class:`flex items-center gap-1`},[s(M(e.id),1),u(a,{task:e,cards:T(V)},null,8,[`task`,`cards`])]))),128)),_(`span`,We,[s(M(T(V)[1].id),1),u(a,{task:T(V)[1],cards:T(V),disabled:``},null,8,[`task`,`cards`])])])]),_:1}),u(R,{title:`TaskCard`,note:`every note a card carries, a priority among them; with its queue menu; while its change is on its way; changed since a refused change; open with details, while reading, unreadable`},{default:e(()=>[_(`div`,Ge,[(y(!0),v(I,null,x(T(V),e=>(y(),c(F,{key:e.id,project:`jig-ui`,task:e,open:!1},null,8,[`task`]))),128)),u(F,{project:`jig-ui`,task:T(V)[1],open:!1,cards:T(V)},null,8,[`task`,`cards`]),u(F,{project:`jig-ui`,task:T(V)[0],open:!1,cards:T(V),busy:``},null,8,[`task`,`cards`]),u(F,{project:`jig-ui`,task:T(V)[3],open:!1,cards:T(V),changed:``},null,8,[`task`,`cards`]),u(F,{project:`jig-ui`,task:T(V)[2],open:!0,details:T(q)[0]},null,8,[`task`,`details`]),u(F,{project:`jig-ui`,task:T(V)[0],open:!0},null,8,[`task`]),u(F,{project:`jig-ui`,task:T(V)[1],open:!0,details:`unavailable`},null,8,[`task`])])]),_:1}),u(R,{title:`TaskRow`,note:`each note and priority; selected; with its queue menu; while its change is on its way; changed since a refused change`},{default:e(()=>[_(`div`,null,[(y(!0),v(I,null,x(T(V),(e,t)=>(y(),c(E,{key:e.id,task:e,selected:t===2},null,8,[`task`,`selected`]))),128)),u(E,{task:T(V)[1],selected:!1,cards:T(V)},null,8,[`task`,`cards`]),u(E,{task:T(V)[0],selected:!1,cards:T(V),busy:``},null,8,[`task`,`cards`]),u(E,{task:T(V)[3],selected:!1,cards:T(V),changed:``},null,8,[`task`,`cards`])])]),_:1}),u(R,{title:`BoardColumns`,note:`cards in every column, one open with its details, two changed since a refused change; no live task`},{default:e(()=>[_(`div`,Ke,[u(C,{project:`jig-ui`,columns:T(H),selected:T(V)[2].id,details:T(q)[0],pending:T(V)[0].id,changed:[T(V)[1].id,T(V)[3].id]},null,8,[`columns`,`selected`,`details`,`pending`,`changed`])]),_(`div`,qe,[u(C,{project:`jig-ui`,columns:T(U)},null,8,[`columns`])])]),_:1}),u(R,{title:`BoardList`,note:`a row picked with its details; nothing picked; no live task`},{default:e(()=>[_(`div`,Je,[u(D,{project:`jig-ui`,columns:T(H),selected:T(V)[2].id,details:T(q)[0]},null,8,[`columns`,`selected`,`details`])]),_(`div`,Ye,[u(D,{project:`jig-ui`,columns:T(H)},null,8,[`columns`])]),_(`div`,Xe,[u(D,{project:`jig-ui`,columns:T(U)},null,8,[`columns`])])]),_:1}),u(R,{title:`FinishedList`,note:`closed with its pull request merged; abandoned; one without a goal`},{default:e(()=>[u(fe,{tasks:T(je),class:`border`},null,8,[`tasks`])]),_:1}),u(R,{title:`TaskFacts`,note:`everything a task can carry; a task not started`},{default:e(()=>[(y(!0),v(I,null,x(T(q),e=>(y(),c(r,{key:e.id,details:e,class:`border-b pb-3`},null,8,[`details`]))),128))]),_:1}),u(R,{title:`TaskBrief`,note:`facts, actions and the link to the full page`},{default:e(()=>[u(ie,{project:`jig-ui`,task:T(q)[1].id,details:T(q)[1]},null,8,[`task`,`details`])]),_:1}),u(R,{title:`ActionList`,note:`Jig's offers, one unknown id; none`},{default:e(()=>[u(P,{actions:T(G)},null,8,[`actions`]),u(P,{actions:[]})]),_:1}),u(R,{title:`CopyCommand`,note:`short; long enough to be cut`},{default:e(()=>[u(h,{command:`jig task pause design-system`}),u(h,{command:`jig task autopilot a-task-with-a-rather-long-identifier-that-wraps resume --answer 'a long answer to the question'`,class:`max-w-xs`})]),_:1}),u(R,{title:`ProgressBar`,note:`none, part, all, an empty roadmap`},{default:e(()=>[(y(),v(I,null,x([[0,4],[3,9],[5,5],[0,0]],([e,t])=>u(_e,{key:`${e}/${t}`,done:e,total:t},null,8,[`done`,`total`])),64))]),_:1}),u(R,{title:`SpecItemRow`,note:`done with a live task; open with dependencies; a task no longer live; no task; fog`},{default:e(()=>[_(`ul`,null,[(y(!0),v(I,null,x(T($),(e,t)=>(y(),c(de,{key:t,item:e,project:`jig-ui`,live:t<2},null,8,[`item`,`live`]))),128))])]),_:1}),u(R,{title:`SpecCard`,note:`no epic, a finished phase folded; an open epic as of the last fetch; a lost epic branch; missing files`},{default:e(()=>[(y(!0),v(I,null,x(T(Fe),e=>(y(),c(oe,{key:e.id,spec:e,project:`jig-ui`,live:[`design-system`,`specs-and-epics`]},null,8,[`spec`]))),128))]),_:1})]))}});export{Ze as default};
|