@zero2webmaster/starter-kit 0.31.0 → 0.36.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.
@@ -235,13 +235,64 @@ export function extractIntegrationsSection(md) {
235
235
  // A slug as agents actually write it: bare, or wrapped in backticks/bold, optionally
236
236
  // with a `:qualifier` naming a concrete backend (`email-service-router:SES`).
237
237
  function cleanSlug(raw) {
238
- const s = String(raw).trim().replace(/^[`*_]+|[`*_]+$/g, "").trim();
238
+ // Strip decoration and SENTENCE PUNCTUATION, alternately and to fixed point. A single
239
+ // pass anchored on `[`*_]+$` cannot reach the backtick in ``org-hq` .`` — the sentence
240
+ // period is outside it — so the LAST edge of any inline list written as a sentence was
241
+ // silently dropped. Found 2026-09-20 while testing the retraction fix, on
242
+ // `volunteer-engine`'s real line; pre-existing, and it predates this file's table work.
243
+ // A trailing dot is never part of a slug, and a slug that legitimately contains dots
244
+ // (`crawl-engine:crawlapi.z2w.us`) does not END on one.
245
+ let s = String(raw).trim();
246
+ for (let prev = null; prev !== s; ) { prev = s; s = s.replace(/^[`*_\s]+|[`*_.,;\s]+$/g, ""); }
239
247
  if (!s || /^\(none/i.test(s)) return null;
240
248
  // Reject prose that isn't a slug (spaces, sentence punctuation).
241
249
  if (!/^[a-z0-9][a-z0-9._-]*(:[A-Za-z0-9._-]+)?$/i.test(s)) return null;
242
250
  return s;
243
251
  }
244
252
 
253
+ /**
254
+ * Collect RETRACTED edges from the `~~struck~~` spans in one line (or one table cell).
255
+ *
256
+ * 🔴 WHY THIS EXISTS, and why the precedent it was filed against did not already do it
257
+ * (2026-09-20, filed by `audit-engine`, and their diagnosis was half right).
258
+ *
259
+ * The filing said the table branch "already skips a struck row" and only the prose branch
260
+ * lacked the equivalent. It skipped, but `nextConsumes` is a UNION with what the registry
261
+ * already holds, so **skipping a struck row is byte-identical to never parsing it** — the
262
+ * retired edge simply stays. Measured on the live bulletin the day it was filed: three
263
+ * struck edges were still on the registry, and TWO of the three were TABLE rows the
264
+ * "already handled" branch had duly skipped for weeks —
265
+ * · `volunteer-engine` ~~grantor~~ struck 2026-08-16, still on row 100 (35 d) — prose
266
+ * · `marketing-engine` ~~z2w-google-ads-suite~~ struck 2026-09-09, still on row 96 (11 d) — table
267
+ * · `support-desk` ~~file-server~~ struck 2026-09-08, still on row 89 (12 d) — table
268
+ * A no-op that looks like a feature is worse than an absent one, because it closes the
269
+ * question. [[zero-is-not-a-pass]]
270
+ *
271
+ * So a strike is now a THIRD state, not a skip: silence ⇒ keep (a parse miss must never
272
+ * delete), an explicit strike ⇒ drop (a decision the agent wrote down). The additive
273
+ * default is untouched.
274
+ *
275
+ * SPANS, not whole cells. `marketing-engine` writes
276
+ * `| ~~\`z2w-google-ads-suite\`~~ → **\`org-hq\` Social Publisher** |` — the retraction and
277
+ * its REPLACEMENT share a cell, and `org-hq` is a live edge. Reading the cell would
278
+ * retract both; reading only what is inside the `~~ ~~` retracts exactly what was struck.
279
+ *
280
+ * STRICTER THAN AN ADDITION, deliberately. An addition accepts any `foo:qualifier` so a
281
+ * non-registry backend can be declared. A retraction DELETES a recorded edge, so it
282
+ * requires the base to be a REAL registry slug — prose struck for emphasis
283
+ * (`~~0 real submissions~~`, `~~attachments~~`, `~~The RESOLVE leg is still unobserved~~`,
284
+ * all live on the bulletin today) must never authorise a delete.
285
+ */
286
+ function collectRetractions(text, knownSlugs, out) {
287
+ for (const m of String(text).matchAll(/~~(.+?)~~/g)) {
288
+ // Same pre-cleaning the sibling branches do: cut the `— why` note and drop
289
+ // parentheticals, so `~~`file-server` (`files.z2w.us`)~~` resolves to `file-server`.
290
+ const head = m[1].split(/\s+[—–-]\s+/)[0].replace(/\([^)]*\)/g, "");
291
+ const slug = cleanSlug(head);
292
+ if (slug && knownSlugs.has(slug.split(":")[0])) out.push(slug);
293
+ }
294
+ }
295
+
245
296
  /**
246
297
  * Parse the `## Integrations` section.
247
298
  *
@@ -278,6 +329,10 @@ export function parseSection(section, knownSlugs = new Set()) {
278
329
  const result = {
279
330
  liveStatus: null, statusDeclared: false, statusQualifier: null, asOf: null,
280
331
  consumes: [],
332
+ // Edges the agent STRUCK OUT in place. Subtracted from the union in main(), which is
333
+ // the only thing that turns a retraction into a registry change — see
334
+ // collectRetractions() for why skipping the line was never enough.
335
+ retracts: [],
281
336
  // TRUE only when a LABELLED consumes line resolved to the §8.10 empty marker
282
337
  // (`- consumes: (none — no Z2W edges)`). This is the "genuinely empty" signal that
283
338
  // lets the caller stop reporting a deliberate zero as a parse failure — `main()`
@@ -375,6 +430,15 @@ export function parseSection(section, knownSlugs = new Set()) {
375
430
  inConsumes = true; directionCol = -1; tableConsumes = null;
376
431
  }
377
432
 
433
+ // (r) RETRACTION in prose. `volunteer-engine` writes its retirement as a bold
434
+ // paragraph — `**NOT consumed — ruled 2026-08-16:** ~~\`grantor\`~~.` — which is neither
435
+ // a bullet nor a table row, so every branch below is blind to it. Deliberately does NOT
436
+ // `continue`: a line may retract one edge while declaring others, and a `~~slug~~` token
437
+ // is rejected by cleanSlug anyway (`~` is not in its charset), so nothing re-adds it.
438
+ if (inConsumes && !/^\s*\|/.test(line) && /~~.+?~~/.test(line)) {
439
+ collectRetractions(line, knownSlugs, result.retracts);
440
+ }
441
+
378
442
  // (a) canonical: `- consumes: slug — why` / (b) inline list: `- **consumes:** a, b, c`
379
443
  const labelled = line.match(/^\s*[-*]\s*\*{0,2}consumes:?\*{0,2}:?\s*(.+)$/i);
380
444
  if (labelled) {
@@ -430,9 +494,6 @@ export function parseSection(section, knownSlugs = new Set()) {
430
494
  const cells = line.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((c) => c.trim());
431
495
  // The `|---|:--:|` delimiter row carries no data and must not reset anything.
432
496
  if (cells.every((c) => /^:?-{2,}:?$/.test(c) || c === "")) continue;
433
- // A struck-through row is an edge the agent RETIRED in place rather than deleting.
434
- if (cells.some((c) => /^~~.*~~$/.test(c))) continue;
435
-
436
497
  const headerDir = cells.findIndex((c) => /^\**\s*directions?\s*\**$/i.test(c));
437
498
  if (headerDir !== -1) { directionCol = headerDir; tableConsumes = null; continue; }
438
499
  // A header row naming its own direction, for tables that follow no heading.
@@ -448,6 +509,17 @@ export function parseSection(section, knownSlugs = new Set()) {
448
509
  : (tableConsumes ?? inConsumes);
449
510
  if (!consumesHere) continue;
450
511
 
512
+ // A struck-through row is an edge the agent RETIRED in place rather than deleting.
513
+ // It is COLLECTED, not skipped — skipping left it on the registry (collectRetractions).
514
+ // Tested AFTER direction, so a retraction under **Consumed by** stays out of `consumes`,
515
+ // and on cells[0] unanchored as well as on any fully-struck cell: `los-osititos` strikes
516
+ // the whole row while `marketing-engine` strikes only the target and names its successor
517
+ // beside it in the same cell.
518
+ if (/~~.+?~~/.test(cells[0]) || cells.some((c) => /^~~.*~~$/.test(c))) {
519
+ collectRetractions(cells[0], knownSlugs, result.retracts);
520
+ continue;
521
+ }
522
+
451
523
  const head = cells[0].split(/\s+[—–-]\s+/)[0].replace(/\([^)]*\)/g, "");
452
524
  const slug = cleanSlug(head);
453
525
  if (slug && (knownSlugs.has(slug.split(":")[0]) || slug.includes(":"))) {
@@ -473,7 +545,11 @@ export function parseSection(section, knownSlugs = new Set()) {
473
545
  }
474
546
  }
475
547
  // de-dupe, preserve order
476
- result.consumes = [...new Set(result.consumes)];
548
+ result.retracts = [...new Set(result.retracts)];
549
+ // A retraction BEATS a declaration in the same section. If a section both lists an edge
550
+ // and strikes it, the strike is the later, more explicit statement — and leaving it in
551
+ // `consumes` would have main() re-add what it is about to subtract.
552
+ result.consumes = [...new Set(result.consumes)].filter((c) => !result.retracts.includes(c));
477
553
  return result;
478
554
  }
479
555
 
@@ -682,7 +758,7 @@ async function main() {
682
758
  parsed++;
683
759
  if (!known.has(slug)) { skippedUnknown++; console.warn(` ⚠ ${slug}: has ## Integrations but no registry row — skipped (never auto-inserted).`); continue; }
684
760
 
685
- const { liveStatus, statusDeclared, statusQualifier, asOf, consumes, declaredNoConsumes } = parseSection(section, known);
761
+ const { liveStatus, statusDeclared, statusQualifier, asOf, consumes, retracts, declaredNoConsumes } = parseSection(section, known);
686
762
 
687
763
  // NO SILENT ZERO, STATUS HALF (2026-08-02). The `zeroEdges` counter below has caught
688
764
  // an inert EDGE pipeline since 2026-07-25; the STATUS field had no equivalent, so a
@@ -741,8 +817,16 @@ async function main() {
741
817
  // ADDITIVE BY DEFAULT. Prose parsing is best-effort, so a miss must never DELETE a
742
818
  // known-good edge — it may only fail to add a new one. `--prune` opts into letting
743
819
  // the bulletin be authoritative (i.e. removing edges it no longer declares).
744
- const nextConsumes = args.prune ? consumes : [...new Set([...curConsumes, ...consumes])];
745
- const dropped = curConsumes.filter((c) => !nextConsumes.includes(c));
820
+ // RETRACTIONS are subtracted AFTER the union, and they are the one thing that may
821
+ // remove an edge without `--prune`. The two are different claims: `--prune` says "the
822
+ // bulletin is authoritative, delete anything it no longer mentions", which is unsafe
823
+ // by default because a parse miss mentions nothing. A `~~strike~~` says "this specific
824
+ // edge was retired", which is a written decision about one named slug. Silence still
825
+ // never deletes.
826
+ const nextConsumes = (args.prune ? consumes : [...new Set([...curConsumes, ...consumes])])
827
+ .filter((c) => !retracts.includes(c));
828
+ const retracted = curConsumes.filter((c) => retracts.includes(c));
829
+ const dropped = curConsumes.filter((c) => !nextConsumes.includes(c) && !retracted.includes(c));
746
830
 
747
831
  const statusChanged = liveStatus && liveStatus !== current?.production_status;
748
832
 
@@ -759,8 +843,11 @@ async function main() {
759
843
  // edge is best-effort prose parsing that still produces artifacts (the inline-list
760
844
  // splitter reads `live-status` out of audit-engine's trailing sentence as an edge).
761
845
  // Being able to apply the trustworthy half alone beats holding it hostage to the other.
846
+ // `nextConsumes.length > 0` guards against a TOTAL parse failure wiping a good row.
847
+ // An explicit retraction is not that, and a project retracting its only edge must be
848
+ // able to reach zero — otherwise the guard silently pins the last stale edge forever.
762
849
  const consumesChanged = !args.statusOnly
763
- && nextConsumes.length > 0
850
+ && (nextConsumes.length > 0 || retracted.length > 0)
764
851
  && JSON.stringify([...nextConsumes].sort()) !== JSON.stringify([...curConsumes].sort());
765
852
  if (!statusChanged && !qualifierChanged && !consumesChanged) continue;
766
853
 
@@ -774,6 +861,7 @@ async function main() {
774
861
  (statusChanged ? `status ${current?.production_status ?? "∅"} → ${liveStatus} ` : "") +
775
862
  (qualifierChanged ? `qualifier ${current?.status_qualifier ? `"${current.status_qualifier}"` : "∅"} → ${statusQualifier ? `"${statusQualifier}"` : "∅"} ` : "") +
776
863
  (consumesChanged ? `consumes [${curConsumes.join(", ") || "∅"}] → [${nextConsumes.join(", ")}]` : ""));
864
+ if (retracted.length) console.log(` ↩ RETRACTED (struck out in the bulletin): ${retracted.join(", ")}`);
777
865
  if (dropped.length) console.warn(` ⚠ --prune REMOVES: ${dropped.join(", ")}`);
778
866
  if (consumesChanged && unknownTargets.length) console.warn(` ⓘ not registry slugs (external, or prose noise — check): ${unknownTargets.join(", ")}`);
779
867