@decocms/parity 0.26.20 → 0.28.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/CHANGELOG.md +73 -0
- package/dist/cli.js +366 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,79 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [0.28.0] — 2026-08-24
|
|
9
|
+
|
|
10
|
+
The Studio board stops being a one-way report: the client can now see the fixes
|
|
11
|
+
that landed and talk back on a card, and what they say enters the flow.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
* **`parity plan notes` — the client's input channel.** Reads the comments the
|
|
16
|
+
client leaves on a page's card (`TASK_BOARD_COMMENT_LIST`), so *"this product
|
|
17
|
+
card should match the Brazil site, not Ecuador"* becomes a proposed
|
|
18
|
+
`set-reference` + `set-status upgrade` — exactly what those exist for. `--post`
|
|
19
|
+
writes a confirmation back on the card so the client sees their note became a
|
|
20
|
+
decision; our comments are prefixed and skipped on the next read, so a
|
|
21
|
+
confirmation never returns as fresh input. Notes are **proposals**: `as-is` and
|
|
22
|
+
`upgrade` still need the user, since only they get to say "stop working on this".
|
|
23
|
+
* **Fix cards (`parity plan board --fixes <file>`).** Mirrors the fixes a client
|
|
24
|
+
would recognise as their own cards, with the PR URL in the description and
|
|
25
|
+
`closed` rendering as `done` — "we fixed X" without them reading GitHub. Scoped
|
|
26
|
+
on purpose: lint, bundle and infra findings bury the board that is supposed to
|
|
27
|
+
show progress.
|
|
28
|
+
* **`--repo <owner/name>`** stored on each card, so the board knows where the work
|
|
29
|
+
lives.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
* **Cards are anchored by id, not title.** The card id is stored on the page
|
|
34
|
+
(`PlanPage.boardItemId`) and carried across a re-capture by `mergePlanDecisions`.
|
|
35
|
+
Without it, renaming a card orphaned the client's comments and the next sync
|
|
36
|
+
built a second board. Titles are now the plain page path — the previous
|
|
37
|
+
`[host] /path` prefix existed only because the item was thought to have no repo
|
|
38
|
+
field; it does.
|
|
39
|
+
* **Orchestrator: a `client-notes` step** at the start of each page cycle when the
|
|
40
|
+
board goes to the Studio — read notes, propose the plan change, ask, apply,
|
|
41
|
+
confirm on the card. A note that cannot be acted on is answered, never left
|
|
42
|
+
silently unread: the client is watching that card to know they were heard.
|
|
43
|
+
(`migration-orchestrator`)
|
|
44
|
+
|
|
45
|
+
## [0.27.0] — 2026-08-21
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
* **`parity plan board` — the migration as a per-page kanban.** Every sampled page
|
|
50
|
+
sits in a lane (`triage` | `backlog` | `building` | `review` | `done` | `skipped`)
|
|
51
|
+
with the components blocking it. Lanes are **derived** from `pagePlan`, never
|
|
52
|
+
stored, so a page cannot read as done while a component it needs is missing —
|
|
53
|
+
the failure mode of the hand-typed page status. Two lists sit outside the lanes:
|
|
54
|
+
`shell` (global components, reported once because they block every page instead
|
|
55
|
+
of repeated per card) and `no page` (components the code defines that no sampled
|
|
56
|
+
page uses — common on `deco-fresh`, whose source inventory walks `sections/*.tsx`
|
|
57
|
+
with no page association; listed rather than hidden). `--json` for the
|
|
58
|
+
orchestrator. Plans predating page/component edges degrade to `triage` rather
|
|
59
|
+
than claiming false readiness.
|
|
60
|
+
* **`--board studio` — mirror the board into the deco Studio task board.** One card
|
|
61
|
+
per page in the client's org, so progress is visible without a terminal. Lanes map
|
|
62
|
+
onto the board's five fixed columns; `skipped` gets no card. Talks to the Studio's
|
|
63
|
+
`/mcp/self` endpoint with plain JSON-RPC over `fetch` (the MCP SDK would be a
|
|
64
|
+
dependency for one POST). The token decides the org — the task board tools take no
|
|
65
|
+
org parameter. Re-running does not duplicate: the sync lists first and matches on
|
|
66
|
+
title, then updates. **It never fails a run** — unset or unreachable Studio prints
|
|
67
|
+
the terminal board and exits 0.
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
* **Orchestrator + plugin integration.** `reconcile` now shows the board next to the
|
|
72
|
+
inventory and uses it to pick what to work on (the page furthest along that is not
|
|
73
|
+
done — finishing a page beats starting three); the per-page cycle refreshes the
|
|
74
|
+
board when a page closes and holds to one page at a time. `discovery` asks where
|
|
75
|
+
the board goes (`terminal`/`studio`) and **always** asks which stage the run is in
|
|
76
|
+
rather than silently defaulting, which is how a team building components ended up
|
|
77
|
+
with a queue of bundle-size and analytics issues. It also asks for `target.dir`
|
|
78
|
+
when it cannot resolve one. New `--stage` and `--board` arguments on
|
|
79
|
+
`/parity:migrate`. (`migration-orchestrator`, `commands/migrate`)
|
|
80
|
+
|
|
8
81
|
## [0.26.0] — 2026-08-21
|
|
9
82
|
|
|
10
83
|
Fixes the failure mode found running the plugin on a mature FastStore target
|
package/dist/cli.js
CHANGED
|
@@ -63724,6 +63724,8 @@ function mergePlanDecisions(fresh, previous) {
|
|
|
63724
63724
|
const prev2 = prevPages.get(page.path);
|
|
63725
63725
|
if (prev2?.status && prev2.status !== "pending")
|
|
63726
63726
|
page.status = prev2.status;
|
|
63727
|
+
if (prev2?.boardItemId)
|
|
63728
|
+
page.boardItemId = prev2.boardItemId;
|
|
63727
63729
|
}
|
|
63728
63730
|
return { plan: fresh, carried, droppedWithDecisions };
|
|
63729
63731
|
}
|
|
@@ -63759,6 +63761,13 @@ function findPage(plan, path) {
|
|
|
63759
63761
|
const target = norm(path);
|
|
63760
63762
|
return plan.pages.find((p) => p.path === path) ?? plan.pages.find((p) => norm(p.path) === target) ?? null;
|
|
63761
63763
|
}
|
|
63764
|
+
function setPageBoardItemId(plan, path, boardItemId) {
|
|
63765
|
+
const page = findPage(plan, path);
|
|
63766
|
+
if (!page)
|
|
63767
|
+
return null;
|
|
63768
|
+
page.boardItemId = boardItemId;
|
|
63769
|
+
return page;
|
|
63770
|
+
}
|
|
63762
63771
|
function planProgress(plan) {
|
|
63763
63772
|
const compByStatus = {
|
|
63764
63773
|
pending: 0,
|
|
@@ -63880,6 +63889,55 @@ function pagePlan(plan, path, candUrl) {
|
|
|
63880
63889
|
ready: counts.build === 0 && counts.validate === 0
|
|
63881
63890
|
};
|
|
63882
63891
|
}
|
|
63892
|
+
function pageColumn(page) {
|
|
63893
|
+
if (page.status === "skipped")
|
|
63894
|
+
return "skipped";
|
|
63895
|
+
if (page.status === "done")
|
|
63896
|
+
return "done";
|
|
63897
|
+
if (page.tasks === null || page.tasks.length === 0)
|
|
63898
|
+
return "triage";
|
|
63899
|
+
if (page.ready)
|
|
63900
|
+
return "review";
|
|
63901
|
+
const started = page.counts.settled + page.counts.validate + page.counts["as-is"] + page.counts.upgrade;
|
|
63902
|
+
return started > 0 ? "building" : "backlog";
|
|
63903
|
+
}
|
|
63904
|
+
function planBoard(plan, candUrl) {
|
|
63905
|
+
const columns = {
|
|
63906
|
+
triage: [],
|
|
63907
|
+
backlog: [],
|
|
63908
|
+
building: [],
|
|
63909
|
+
review: [],
|
|
63910
|
+
done: [],
|
|
63911
|
+
skipped: []
|
|
63912
|
+
};
|
|
63913
|
+
for (const p of plan.pages) {
|
|
63914
|
+
const page = pagePlan(plan, p.path, candUrl);
|
|
63915
|
+
if (!page)
|
|
63916
|
+
continue;
|
|
63917
|
+
const column = pageColumn(page);
|
|
63918
|
+
columns[column].push({
|
|
63919
|
+
path: page.path,
|
|
63920
|
+
kind: page.kind,
|
|
63921
|
+
column,
|
|
63922
|
+
blockers: (page.tasks ?? []).filter((t) => t.disposition === "build" && t.scope !== "global").map((t) => t.name),
|
|
63923
|
+
counts: page.counts,
|
|
63924
|
+
ready: page.ready,
|
|
63925
|
+
boardItemId: p.boardItemId
|
|
63926
|
+
});
|
|
63927
|
+
}
|
|
63928
|
+
const onAnyPage = new Set(plan.pages.flatMap((p) => (p.components ?? []).map(key)));
|
|
63929
|
+
const shell = [];
|
|
63930
|
+
const unassigned = [];
|
|
63931
|
+
for (const c of plan.components) {
|
|
63932
|
+
if (c.scope === "global") {
|
|
63933
|
+
if (disposition(c) === "build")
|
|
63934
|
+
shell.push(c.name);
|
|
63935
|
+
} else if (!onAnyPage.has(key(c.name))) {
|
|
63936
|
+
unassigned.push(c.name);
|
|
63937
|
+
}
|
|
63938
|
+
}
|
|
63939
|
+
return { url: plan.url, columns, shell, unassigned, sampled: plan.pages.length };
|
|
63940
|
+
}
|
|
63883
63941
|
function setComponentVerified(plan, name, verdict2, at, note) {
|
|
63884
63942
|
const k = key(name);
|
|
63885
63943
|
const component = plan.components.find((c) => key(c.name) === k);
|
|
@@ -65173,7 +65231,161 @@ function sleep2(ms) {
|
|
|
65173
65231
|
}
|
|
65174
65232
|
|
|
65175
65233
|
// src/commands/plan.ts
|
|
65234
|
+
import { readFileSync as readFileSync21 } from "node:fs";
|
|
65176
65235
|
import chalk18 from "chalk";
|
|
65236
|
+
|
|
65237
|
+
// src/board/studio.ts
|
|
65238
|
+
var LANE_TO_STUDIO = {
|
|
65239
|
+
triage: "triage",
|
|
65240
|
+
backlog: "todo",
|
|
65241
|
+
building: "in_progress",
|
|
65242
|
+
review: "in_review",
|
|
65243
|
+
done: "done",
|
|
65244
|
+
skipped: null
|
|
65245
|
+
};
|
|
65246
|
+
function studioConfigFromEnv(env = process.env) {
|
|
65247
|
+
const url = env.PARITY_STUDIO_URL;
|
|
65248
|
+
const token = env.PARITY_STUDIO_TOKEN;
|
|
65249
|
+
if (!url || !token)
|
|
65250
|
+
return null;
|
|
65251
|
+
return { url: url.replace(/\/+$/, ""), token };
|
|
65252
|
+
}
|
|
65253
|
+
function cardTitle(path) {
|
|
65254
|
+
return path;
|
|
65255
|
+
}
|
|
65256
|
+
var PARITY_COMMENT_PREFIX = "[parity]";
|
|
65257
|
+
function cardDescription(card) {
|
|
65258
|
+
const lines = [`kind: ${card.kind}`, `lane: ${card.column}`];
|
|
65259
|
+
if (card.blockers.length)
|
|
65260
|
+
lines.push(`blocked by: ${card.blockers.join(", ")}`);
|
|
65261
|
+
else if (card.column === "triage") {
|
|
65262
|
+
lines.push("scope not confirmed — no page/component edges yet");
|
|
65263
|
+
}
|
|
65264
|
+
return lines.join(`
|
|
65265
|
+
`);
|
|
65266
|
+
}
|
|
65267
|
+
function parseRpcBody(body) {
|
|
65268
|
+
const trimmed = body.trim();
|
|
65269
|
+
if (!trimmed.startsWith("event:") && !trimmed.startsWith("data:")) {
|
|
65270
|
+
return JSON.parse(trimmed);
|
|
65271
|
+
}
|
|
65272
|
+
const data2 = trimmed.split(`
|
|
65273
|
+
`).filter((l) => l.startsWith("data:")).map((l) => l.slice(5).trim()).filter(Boolean);
|
|
65274
|
+
const last2 = data2[data2.length - 1];
|
|
65275
|
+
if (!last2)
|
|
65276
|
+
throw new Error("empty SSE response");
|
|
65277
|
+
return JSON.parse(last2);
|
|
65278
|
+
}
|
|
65279
|
+
var callTool2 = async (cfg, name, args) => {
|
|
65280
|
+
const res = await fetch(`${cfg.url}/mcp/self`, {
|
|
65281
|
+
method: "POST",
|
|
65282
|
+
headers: {
|
|
65283
|
+
"content-type": "application/json",
|
|
65284
|
+
accept: "application/json, text/event-stream",
|
|
65285
|
+
authorization: `Bearer ${cfg.token}`
|
|
65286
|
+
},
|
|
65287
|
+
body: JSON.stringify({
|
|
65288
|
+
jsonrpc: "2.0",
|
|
65289
|
+
id: 1,
|
|
65290
|
+
method: "tools/call",
|
|
65291
|
+
params: { name, arguments: args }
|
|
65292
|
+
})
|
|
65293
|
+
});
|
|
65294
|
+
if (!res.ok) {
|
|
65295
|
+
throw new Error(`${name}: HTTP ${res.status} ${await res.text().catch(() => "")}`);
|
|
65296
|
+
}
|
|
65297
|
+
const payload = parseRpcBody(await res.text());
|
|
65298
|
+
if (payload.error)
|
|
65299
|
+
throw new Error(`${name}: ${payload.error.message ?? "unknown error"}`);
|
|
65300
|
+
const result = payload.result;
|
|
65301
|
+
if (result?.isError) {
|
|
65302
|
+
const text3 = result.content?.map((c) => c.text).join(" ") ?? "tool reported an error";
|
|
65303
|
+
throw new Error(`${name}: ${text3}`);
|
|
65304
|
+
}
|
|
65305
|
+
return result?.structuredContent ?? {};
|
|
65306
|
+
};
|
|
65307
|
+
async function syncBoardToStudio(board, cfg, opts = {}, call = callTool2) {
|
|
65308
|
+
const existing = await call(cfg, "TASK_BOARD_ITEM_LIST", {});
|
|
65309
|
+
const byTitle = new Map((existing.items ?? []).map((i) => [i.title, i]));
|
|
65310
|
+
const byId = new Map((existing.items ?? []).map((i) => [i.id, i]));
|
|
65311
|
+
const result = { created: 0, updated: 0, skipped: 0, ids: {} };
|
|
65312
|
+
const upsert = async (title, description, status, knownId) => {
|
|
65313
|
+
const found = (knownId ? byId.get(knownId) : undefined) ?? byTitle.get(title);
|
|
65314
|
+
if (found) {
|
|
65315
|
+
await call(cfg, "TASK_BOARD_ITEM_UPDATE", { id: found.id, title, status, description });
|
|
65316
|
+
result.updated += 1;
|
|
65317
|
+
return found.id;
|
|
65318
|
+
}
|
|
65319
|
+
const created = await call(cfg, "TASK_BOARD_ITEM_CREATE", {
|
|
65320
|
+
title,
|
|
65321
|
+
description,
|
|
65322
|
+
status,
|
|
65323
|
+
...opts.repo ? { repo: opts.repo } : {}
|
|
65324
|
+
});
|
|
65325
|
+
result.created += 1;
|
|
65326
|
+
return created.item?.id;
|
|
65327
|
+
};
|
|
65328
|
+
for (const cards of Object.values(board.columns)) {
|
|
65329
|
+
for (const card of cards) {
|
|
65330
|
+
const status = LANE_TO_STUDIO[card.column];
|
|
65331
|
+
if (!status) {
|
|
65332
|
+
result.skipped += 1;
|
|
65333
|
+
continue;
|
|
65334
|
+
}
|
|
65335
|
+
const id = await upsert(cardTitle(card.path), cardDescription(card), status, card.boardItemId);
|
|
65336
|
+
if (id)
|
|
65337
|
+
result.ids[card.path] = id;
|
|
65338
|
+
}
|
|
65339
|
+
}
|
|
65340
|
+
for (const fix of opts.fixes ?? []) {
|
|
65341
|
+
await upsert(fix.title, fixDescription(fix), FIX_STATE_TO_STUDIO[fix.state]);
|
|
65342
|
+
}
|
|
65343
|
+
return result;
|
|
65344
|
+
}
|
|
65345
|
+
async function fetchClientNotes(pages, cfg, call = callTool2) {
|
|
65346
|
+
const notes = [];
|
|
65347
|
+
for (const page of pages) {
|
|
65348
|
+
const res = await call(cfg, "TASK_BOARD_COMMENT_LIST", {
|
|
65349
|
+
taskBoardItemId: page.boardItemId
|
|
65350
|
+
});
|
|
65351
|
+
for (const c of res.comments ?? []) {
|
|
65352
|
+
if (c.body.trimStart().startsWith(PARITY_COMMENT_PREFIX))
|
|
65353
|
+
continue;
|
|
65354
|
+
if (c.resolved)
|
|
65355
|
+
continue;
|
|
65356
|
+
notes.push({
|
|
65357
|
+
path: page.path,
|
|
65358
|
+
boardItemId: page.boardItemId,
|
|
65359
|
+
commentId: c.id,
|
|
65360
|
+
body: c.body,
|
|
65361
|
+
createdAt: c.createdAt
|
|
65362
|
+
});
|
|
65363
|
+
}
|
|
65364
|
+
}
|
|
65365
|
+
return notes;
|
|
65366
|
+
}
|
|
65367
|
+
async function postParityComment(boardItemId, body, cfg, call = callTool2) {
|
|
65368
|
+
await call(cfg, "TASK_BOARD_COMMENT_CREATE", {
|
|
65369
|
+
taskBoardItemId: boardItemId,
|
|
65370
|
+
body: `${PARITY_COMMENT_PREFIX} ${body}`
|
|
65371
|
+
});
|
|
65372
|
+
}
|
|
65373
|
+
var FIX_STATE_TO_STUDIO = {
|
|
65374
|
+
open: "todo",
|
|
65375
|
+
in_review: "in_review",
|
|
65376
|
+
closed: "done"
|
|
65377
|
+
};
|
|
65378
|
+
function fixDescription(fix) {
|
|
65379
|
+
const lines = [];
|
|
65380
|
+
if (fix.body)
|
|
65381
|
+
lines.push(fix.body);
|
|
65382
|
+
if (fix.prUrl)
|
|
65383
|
+
lines.push(`PR: ${fix.prUrl}`);
|
|
65384
|
+
return lines.join(`
|
|
65385
|
+
`);
|
|
65386
|
+
}
|
|
65387
|
+
|
|
65388
|
+
// src/commands/plan.ts
|
|
65177
65389
|
var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
|
|
65178
65390
|
var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
|
|
65179
65391
|
function planSetStatusCommand(dir, name, status) {
|
|
@@ -65376,14 +65588,141 @@ ${chalk18.bold("Pages")} (${pg.total}): ` + `${chalk18.green(`${pg.byStatus.done
|
|
|
65376
65588
|
console.log("");
|
|
65377
65589
|
return 0;
|
|
65378
65590
|
}
|
|
65591
|
+
var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
|
|
65592
|
+
var COLUMN_STYLE = {
|
|
65593
|
+
triage: chalk18.magenta,
|
|
65594
|
+
backlog: chalk18.red,
|
|
65595
|
+
building: chalk18.yellow,
|
|
65596
|
+
review: chalk18.cyan,
|
|
65597
|
+
done: chalk18.green,
|
|
65598
|
+
skipped: chalk18.gray
|
|
65599
|
+
};
|
|
65600
|
+
async function planBoardCommand(dir, opts) {
|
|
65601
|
+
const plan = loadPlan(dir);
|
|
65602
|
+
if (!plan) {
|
|
65603
|
+
console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
|
|
65604
|
+
console.error(chalk18.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
|
|
65605
|
+
return 1;
|
|
65606
|
+
}
|
|
65607
|
+
const board = planBoard(plan, opts.cand);
|
|
65608
|
+
if (opts.json) {
|
|
65609
|
+
console.log(JSON.stringify(board, null, 2));
|
|
65610
|
+
return 0;
|
|
65611
|
+
}
|
|
65612
|
+
console.log(chalk18.bold(`
|
|
65613
|
+
Board — ${board.url}`));
|
|
65614
|
+
console.log(chalk18.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
|
|
65615
|
+
if (board.shell.length) {
|
|
65616
|
+
console.log(`
|
|
65617
|
+
${chalk18.bold("shell")} ${chalk18.gray("(global — blocks every page)")}: ${chalk18.yellow(board.shell.join(", "))}`);
|
|
65618
|
+
}
|
|
65619
|
+
for (const column of COLUMN_ORDER) {
|
|
65620
|
+
const cards = board.columns[column];
|
|
65621
|
+
if (!cards.length)
|
|
65622
|
+
continue;
|
|
65623
|
+
console.log(`
|
|
65624
|
+
${COLUMN_STYLE[column](chalk18.bold(column))} (${cards.length})`);
|
|
65625
|
+
for (const card of cards) {
|
|
65626
|
+
console.log(` ${card.path} ${chalk18.gray(`(${card.kind})`)}`);
|
|
65627
|
+
if (card.blockers.length) {
|
|
65628
|
+
console.log(chalk18.gray(` blocked by: ${card.blockers.join(", ")}`));
|
|
65629
|
+
}
|
|
65630
|
+
}
|
|
65631
|
+
}
|
|
65632
|
+
const skipped = board.columns.skipped;
|
|
65633
|
+
if (skipped.length) {
|
|
65634
|
+
console.log(`
|
|
65635
|
+
${chalk18.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
|
|
65636
|
+
}
|
|
65637
|
+
if (board.unassigned.length) {
|
|
65638
|
+
console.log(`
|
|
65639
|
+
${chalk18.bold("no page")} ${chalk18.gray("(in the code, not seen on any sampled page)")}
|
|
65640
|
+
${chalk18.gray(board.unassigned.join(", "))}`);
|
|
65641
|
+
}
|
|
65642
|
+
console.log("");
|
|
65643
|
+
if (opts.board === "studio") {
|
|
65644
|
+
const cfg = studioConfigFromEnv();
|
|
65645
|
+
if (!cfg) {
|
|
65646
|
+
console.log(chalk18.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
|
|
65647
|
+
`));
|
|
65648
|
+
return 0;
|
|
65649
|
+
}
|
|
65650
|
+
try {
|
|
65651
|
+
const fixes = opts.fixes ? JSON.parse(readFileSync21(opts.fixes, "utf8")) : undefined;
|
|
65652
|
+
const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
|
|
65653
|
+
let stored = 0;
|
|
65654
|
+
for (const [path, id] of Object.entries(synced.ids)) {
|
|
65655
|
+
if (setPageBoardItemId(plan, path, id))
|
|
65656
|
+
stored += 1;
|
|
65657
|
+
}
|
|
65658
|
+
if (stored)
|
|
65659
|
+
savePlan(dir, plan);
|
|
65660
|
+
console.log(chalk18.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
|
|
65661
|
+
`));
|
|
65662
|
+
} catch (err) {
|
|
65663
|
+
console.log(chalk18.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
|
|
65664
|
+
`));
|
|
65665
|
+
}
|
|
65666
|
+
}
|
|
65667
|
+
return 0;
|
|
65668
|
+
}
|
|
65669
|
+
async function planNotesCommand(dir, opts) {
|
|
65670
|
+
const plan = loadPlan(dir);
|
|
65671
|
+
if (!plan) {
|
|
65672
|
+
console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
|
|
65673
|
+
return 1;
|
|
65674
|
+
}
|
|
65675
|
+
const cfg = studioConfigFromEnv();
|
|
65676
|
+
if (!cfg) {
|
|
65677
|
+
console.error(chalk18.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
|
|
65678
|
+
return 1;
|
|
65679
|
+
}
|
|
65680
|
+
if (opts.post) {
|
|
65681
|
+
const page = plan.pages.find((p) => p.path === opts.page);
|
|
65682
|
+
if (!page?.boardItemId) {
|
|
65683
|
+
console.error(chalk18.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
|
|
65684
|
+
return 1;
|
|
65685
|
+
}
|
|
65686
|
+
await postParityComment(page.boardItemId, opts.post, cfg);
|
|
65687
|
+
console.log(`${chalk18.green("✓")} comment posted on ${page.path}`);
|
|
65688
|
+
return 0;
|
|
65689
|
+
}
|
|
65690
|
+
const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
|
|
65691
|
+
if (!pages.length) {
|
|
65692
|
+
console.error(chalk18.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
|
|
65693
|
+
return 1;
|
|
65694
|
+
}
|
|
65695
|
+
const notes = await fetchClientNotes(pages, cfg);
|
|
65696
|
+
if (opts.json) {
|
|
65697
|
+
console.log(JSON.stringify({ notes }, null, 2));
|
|
65698
|
+
return 0;
|
|
65699
|
+
}
|
|
65700
|
+
if (!notes.length) {
|
|
65701
|
+
console.log(chalk18.gray(`
|
|
65702
|
+
No open client notes.
|
|
65703
|
+
`));
|
|
65704
|
+
return 0;
|
|
65705
|
+
}
|
|
65706
|
+
console.log(chalk18.bold(`
|
|
65707
|
+
Client notes (${notes.length})`));
|
|
65708
|
+
for (const n of notes) {
|
|
65709
|
+
console.log(`
|
|
65710
|
+
${chalk18.cyan(n.path)} ${chalk18.gray(n.createdAt)}`);
|
|
65711
|
+
for (const line of n.body.split(`
|
|
65712
|
+
`))
|
|
65713
|
+
console.log(` ${line}`);
|
|
65714
|
+
}
|
|
65715
|
+
console.log(chalk18.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
|
|
65716
|
+
return 0;
|
|
65717
|
+
}
|
|
65379
65718
|
|
|
65380
65719
|
// src/commands/pr.ts
|
|
65381
|
-
import { existsSync as existsSync19, readFileSync as
|
|
65720
|
+
import { existsSync as existsSync19, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
|
|
65382
65721
|
import { join as join30 } from "node:path";
|
|
65383
65722
|
import chalk21 from "chalk";
|
|
65384
65723
|
|
|
65385
65724
|
// src/commands/run.ts
|
|
65386
|
-
import { existsSync as existsSync18, readFileSync as
|
|
65725
|
+
import { existsSync as existsSync18, readFileSync as readFileSync23, unlinkSync as unlinkSync3 } from "node:fs";
|
|
65387
65726
|
import { join as join29 } from "node:path";
|
|
65388
65727
|
import chalk20 from "chalk";
|
|
65389
65728
|
import ora7 from "ora";
|
|
@@ -65926,7 +66265,7 @@ import { existsSync as existsSync17 } from "node:fs";
|
|
|
65926
66265
|
import chalk19 from "chalk";
|
|
65927
66266
|
|
|
65928
66267
|
// src/server/proxy-server.ts
|
|
65929
|
-
import { existsSync as existsSync16, readFileSync as
|
|
66268
|
+
import { existsSync as existsSync16, readFileSync as readFileSync22, statSync } from "node:fs";
|
|
65930
66269
|
import { createServer } from "node:http";
|
|
65931
66270
|
import { extname, join as join28, normalize as normalize3, resolve as resolve5, sep } from "node:path";
|
|
65932
66271
|
var MIME3 = {
|
|
@@ -66028,7 +66367,7 @@ function serveReportHtml(res, runDir) {
|
|
|
66028
66367
|
res.end("report.html not found");
|
|
66029
66368
|
return;
|
|
66030
66369
|
}
|
|
66031
|
-
const html3 =
|
|
66370
|
+
const html3 = readFileSync22(filePath, "utf8");
|
|
66032
66371
|
const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
|
|
66033
66372
|
const out = html3.includes("</head>") ? html3.replace("</head>", `${inject}</head>`) : `${inject}${html3}`;
|
|
66034
66373
|
res.statusCode = 200;
|
|
@@ -66059,7 +66398,7 @@ function serveStatic(res, runDir, path) {
|
|
|
66059
66398
|
res.statusCode = 200;
|
|
66060
66399
|
res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
|
|
66061
66400
|
res.setHeader("cache-control", "no-store");
|
|
66062
|
-
res.end(
|
|
66401
|
+
res.end(readFileSync22(filePath));
|
|
66063
66402
|
}
|
|
66064
66403
|
async function proxyRequest(req, res, targetUrl, opts = {}) {
|
|
66065
66404
|
let target;
|
|
@@ -67172,7 +67511,7 @@ function resolveExplicitPages(pagesFile, pagesList) {
|
|
|
67172
67511
|
if (!existsSync18(pagesFile)) {
|
|
67173
67512
|
throw new Error(`--pages-file não encontrado: ${pagesFile}`);
|
|
67174
67513
|
}
|
|
67175
|
-
const raw =
|
|
67514
|
+
const raw = readFileSync23(pagesFile, "utf-8");
|
|
67176
67515
|
const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
|
|
67177
67516
|
return lines.map(parsePagePair);
|
|
67178
67517
|
}
|
|
@@ -67403,7 +67742,7 @@ async function prCommand(opts) {
|
|
|
67403
67742
|
console.error(chalk21.red(`report.json not found at ${reportJsonPath}`));
|
|
67404
67743
|
return runCode || 1;
|
|
67405
67744
|
}
|
|
67406
|
-
const run = JSON.parse(
|
|
67745
|
+
const run = JSON.parse(readFileSync24(reportJsonPath, "utf8"));
|
|
67407
67746
|
const markdown = buildPrComment(run, opts);
|
|
67408
67747
|
if (opts.out) {
|
|
67409
67748
|
writeFileSync25(opts.out, markdown, "utf8");
|
|
@@ -67504,7 +67843,7 @@ function promptCommand(runId, opts) {
|
|
|
67504
67843
|
}
|
|
67505
67844
|
|
|
67506
67845
|
// src/commands/report.ts
|
|
67507
|
-
import { existsSync as existsSync21, readFileSync as
|
|
67846
|
+
import { existsSync as existsSync21, readFileSync as readFileSync25, writeFileSync as writeFileSync27 } from "node:fs";
|
|
67508
67847
|
import { join as join31 } from "node:path";
|
|
67509
67848
|
import chalk23 from "chalk";
|
|
67510
67849
|
import open2 from "open";
|
|
@@ -68136,7 +68475,7 @@ async function reportCommand(runId, opts) {
|
|
|
68136
68475
|
console.error(chalk23.red(`report.html not found at ${paths.reportHtml}`));
|
|
68137
68476
|
return 1;
|
|
68138
68477
|
}
|
|
68139
|
-
const html3 =
|
|
68478
|
+
const html3 = readFileSync25(paths.reportHtml, "utf8");
|
|
68140
68479
|
const slice2 = extractReportSection({ kind: "html", section: opts.section, html: html3 });
|
|
68141
68480
|
if (slice2 === null) {
|
|
68142
68481
|
console.error(chalk23.red(`section "${opts.section}" not present in this report`));
|
|
@@ -68153,7 +68492,7 @@ async function reportCommand(runId, opts) {
|
|
|
68153
68492
|
}
|
|
68154
68493
|
|
|
68155
68494
|
// src/commands/vitals.ts
|
|
68156
|
-
import { existsSync as existsSync22, readFileSync as
|
|
68495
|
+
import { existsSync as existsSync22, readFileSync as readFileSync26, writeFileSync as writeFileSync28 } from "node:fs";
|
|
68157
68496
|
import { availableParallelism } from "node:os";
|
|
68158
68497
|
import { join as join32 } from "node:path";
|
|
68159
68498
|
import chalk24 from "chalk";
|
|
@@ -68690,7 +69029,7 @@ function parseUrlList(input) {
|
|
|
68690
69029
|
if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
|
|
68691
69030
|
const path = input.replace(/^file:\/\//, "");
|
|
68692
69031
|
if (existsSync22(path)) {
|
|
68693
|
-
return
|
|
69032
|
+
return readFileSync26(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
|
|
68694
69033
|
}
|
|
68695
69034
|
}
|
|
68696
69035
|
return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
|
|
@@ -68720,7 +69059,7 @@ function printSummary7(vitals, cache, scores, opportunities, agentic) {
|
|
|
68720
69059
|
}
|
|
68721
69060
|
|
|
68722
69061
|
// src/util/version.ts
|
|
68723
|
-
import { readFileSync as
|
|
69062
|
+
import { readFileSync as readFileSync27 } from "node:fs";
|
|
68724
69063
|
import { dirname as dirname5, resolve as resolve6 } from "node:path";
|
|
68725
69064
|
import { fileURLToPath } from "node:url";
|
|
68726
69065
|
function getPackageVersion() {
|
|
@@ -68729,7 +69068,7 @@ function getPackageVersion() {
|
|
|
68729
69068
|
for (const up of ["..", "../..", "../../.."]) {
|
|
68730
69069
|
try {
|
|
68731
69070
|
const pkgPath = resolve6(here, up, "package.json");
|
|
68732
|
-
const raw =
|
|
69071
|
+
const raw = readFileSync27(pkgPath, "utf8");
|
|
68733
69072
|
const parsed = JSON.parse(raw);
|
|
68734
69073
|
if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
|
|
68735
69074
|
return parsed.version;
|
|
@@ -68797,6 +69136,20 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
|
|
|
68797
69136
|
process.exit(planStatusCommand(opts.dir, Boolean(opts.json)));
|
|
68798
69137
|
})).addCommand(new Command("page").description("Per-page worksheet: every component the capture saw on this page, what to do about it (build | validate | upgrade | as-is | settled), and a runnable `parity section` command for the checkable ones. The unit of work a migration closes is a page, not a global queue.").argument("<path>", "Page path, e.g. / or /refrigeracion").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--cand <url>", "Candidate base URL — required for runnable validation commands").option("--json", "Emit structured JSON instead of human-readable text", false).action((path, opts) => {
|
|
68799
69138
|
process.exit(planPageCommand(opts.dir, path, { cand: opts.cand, json: Boolean(opts.json) }));
|
|
69139
|
+
})).addCommand(new Command("board").description("Per-page kanban: every sampled page in a derived lane (triage | backlog | building | review | done) with what blocks it. Lanes come from each page's components, so a page cannot read as done while a component it needs is missing.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--cand <url>", "Candidate base URL — enriches cards with validation state").option("--board <where>", "terminal (default) | studio — push one card per page to the deco Studio task board (needs PARITY_STUDIO_URL + PARITY_STUDIO_TOKEN; falls back to terminal when unset or unreachable)", "terminal").option("--repo <owner/name>", "Repository stored on each card, so the board knows where the work lives").option("--fixes <path>", "JSON file of client-legible fixes to mirror as cards: [{title, body?, prUrl?, state: open|in_review|closed}]").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
|
|
69140
|
+
process.exit(await planBoardCommand(opts.dir, {
|
|
69141
|
+
cand: opts.cand,
|
|
69142
|
+
json: Boolean(opts.json),
|
|
69143
|
+
board: opts.board,
|
|
69144
|
+
repo: opts.repo,
|
|
69145
|
+
fixes: opts.fixes
|
|
69146
|
+
}));
|
|
69147
|
+
})).addCommand(new Command("notes").description("Read the client's comments off the Studio cards — the input channel for 'compare this component against site X instead'. They are proposals: apply with set-reference/set-status, then --post a confirmation back.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--page <path>", "Only this page").option("--post <body>", "Post a confirmation comment on --page instead of reading").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
|
|
69148
|
+
process.exit(await planNotesCommand(opts.dir, {
|
|
69149
|
+
json: Boolean(opts.json),
|
|
69150
|
+
page: opts.page,
|
|
69151
|
+
post: opts.post
|
|
69152
|
+
}));
|
|
68800
69153
|
})).addCommand(new Command("set-reference").description("Point a component's comparison at something other than prod (a site the better component came from), and record WHY it diverges. Without this, an intentional improvement is reported as a defect on every run.").argument("<name>", "Component name (case- and separator-insensitive)").requiredOption("--note <why>", "Why this component diverges — required, not decoration").option("--url <url>", "Reference site base URL (default: the plan's prod URL)").option("--selector <sel>", "Selector on the reference site, when it differs").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, opts) => {
|
|
68801
69154
|
process.exit(planSetReferenceCommand(opts.dir, name, {
|
|
68802
69155
|
url: opts.url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|