@antelopejs/tooling-configs 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -66,7 +66,7 @@ Both profiles of `antelopejs-sync` keep the shared CI caller on the job id `ci`,
66
66
 
67
67
  `antelopejs-sync` also installs the `technical-writing` and `unslop` skills in every full-profile repository and in a template source. Each is `.agents/skills/<name>/SKILL.md` with a `.claude/skills/<name>` link. The text is vendored unchanged from Upd4ting/agent-config `claude/skills/<name>/SKILL.md` at commit 4e0a848, and `--check` reports an edited file as drift. Write documentation with them: `technical-writing` picks the page's mode and sets the sentence rules, and `unslop` lists the patterns to cut.
68
68
 
69
- Every deterministic step of a verification is an `antelopejs-verify` command: `map`, `plan`, `new`, `doctor`, `journey`, `formal`, `doors`, `clean`, `verdict` and `publish`. The synced `SKILL.md` documents each one for the agent that verifies.
69
+ Every deterministic step of a verification is an `antelopejs-verify` command: `map`, `plan`, `new`, `doctor`, `journey`, `formal`, `doors`, `clean` and `verdict`. The synced `SKILL.md` documents each one for the agent that verifies.
70
70
 
71
71
  The verify skills drive a browser with `playwright-core`. [Browser driver for the verify skills](./docs/browser-driver.md) records why, with the measured speed, CPU and memory.
72
72
 
@@ -6,7 +6,7 @@ import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
6
6
  import { t as accepting } from "../ports-DGP6bPJy.mjs";
7
7
  import { createRequire } from "node:module";
8
8
  import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
9
- import { basename, join, posix, relative, resolve, sep } from "node:path";
9
+ import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
10
10
  import { spawn } from "node:child_process";
11
11
  import { isMap, isScalar, isSeq, parseDocument } from "yaml";
12
12
  import { createHash } from "node:crypto";
@@ -223,10 +223,16 @@ function isLayerCode(layer, file) {
223
223
  const segments = relative(layer, file).split(sep);
224
224
  return segments[0] !== LAYER_PLAYGROUND && !segments.some((segment) => NOT_LAYER_CODE.has(segment));
225
225
  }
226
- /** The repository's own `tsc` entry, run with Node so no shell parses its path. */
226
+ /**
227
+ * The repository's own `tsc` entry, run with Node so no shell parses its path. It is found through the `bin.tsc` field of
228
+ * `typescript/package.json`, a subpath every TypeScript version exports, because TypeScript 7 declares an `exports` map that
229
+ * leaves `typescript/bin/tsc` out.
230
+ */
227
231
  function compilerOf(root) {
228
232
  try {
229
- return createRequire(join(root, "package.json")).resolve("typescript/bin/tsc");
233
+ const manifestPath = createRequire(join(root, "package.json")).resolve("typescript/package.json");
234
+ const tsc = parseManifest(readFileSync(manifestPath, "utf8")).bin?.tsc;
235
+ return tsc === void 0 ? void 0 : join(dirname(manifestPath), tsc);
230
236
  } catch {
231
237
  return;
232
238
  }
package/dist/bin/sync.mjs CHANGED
@@ -1208,7 +1208,7 @@ const KIND_TEXT = {
1208
1208
  - \`saas: { env, sandbox }\`: a SaaS module runs against the provider's sandbox with keys from these environment variables. Without every key, each journey is NOT VERIFIED and so is the verdict, never PASS or PASS+NOTES.
1209
1209
  - \`journeys\`: the module's own journeys. Each writes through the module with \`context.call(...)\` and reads the result back with \`context.native(...)\` (\`redis-cli\`, \`mongosh\`, \`psql\`, the Mailpit API) inside the service container.`,
1210
1210
  smoke: "`module-dev` and one write read back through the native client",
1211
- gotchas: ["Every container is the run's own. Never point a journey at a shared instance such as a developer's local database.", "A sandbox key missing from the environment is a NOT VERIFIED verdict, which sets status `verify` to `error`."]
1211
+ gotchas: ["Every container is the run's own. Never point a journey at a shared instance such as a developer's local database.", "A sandbox key missing from the environment is a NOT VERIFIED verdict."]
1212
1212
  },
1213
1213
  template: {
1214
1214
  description: "Drive this AntelopeJS template the way a new user does: scaffold a project with `ajs project init` from an offline interfaces manifest, install it, run its own `pnpm run checks`, run `ajs project dev --watch` and hit its welcome page, endpoint or ready line. Use to prove a change to the template works before merge, to verify a PR, or to run the release canary.",
@@ -1345,14 +1345,13 @@ Write your judgement to \`<run>/evidence/judgement.json\`:
1345
1345
  }
1346
1346
  \`\`\`
1347
1347
 
1348
- A door row is \`{ "kind", "location", "irreversible", "containment" }\`, where \`containment\` says what limits the damage. Then render and publish:
1348
+ A door row is \`{ "kind", "location", "irreversible", "containment" }\`, where \`containment\` says what limits the damage. Then render the verdict:
1349
1349
 
1350
1350
  \`\`\`bash
1351
1351
  ${BIN} verdict <run> --pr <n>
1352
- ${BIN} publish <run> --pr <n>
1353
1352
  \`\`\`
1354
1353
 
1355
- \`verdict\` writes \`evidence/verdict.md\` and exits 1 unless the result is PASS or PASS+NOTES. \`publish\` commits the evidence to the orphan branch \`verify-evidence\` under \`pr-<n>/<sha>/\` from a temporary worktree, posts the verdict as a PR comment, sets commit status \`verify\` on the head SHA (\`success\` for PASS and PASS+NOTES, \`error\` for NOT VERIFIED, \`failure\` for FAIL) and reads it back. It prints the error GitHub answers when the token cannot write statuses. A new push voids the status. Post a verdict only from a thread that did not write the change.
1354
+ \`verdict\` writes \`evidence/verdict.md\` and exits 1 unless the result is PASS or PASS+NOTES. Report the verdict and what you saw in your own reply, from a thread that did not write the change.
1356
1355
 
1357
1356
  ## Trust
1358
1357
 
@@ -11,7 +11,7 @@ import { execFileSync, spawn, spawnSync } from "node:child_process";
11
11
  import { pathToFileURL } from "node:url";
12
12
  import ts from "typescript";
13
13
  import { createHash, randomBytes } from "node:crypto";
14
- import { availableParallelism, constants as constants$1, tmpdir } from "node:os";
14
+ import { availableParallelism, constants as constants$1 } from "node:os";
15
15
  import { parseArgs } from "node:util";
16
16
  import { createServer } from "node:net";
17
17
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
@@ -2817,155 +2817,6 @@ function clean(state) {
2817
2817
  return lines;
2818
2818
  }
2819
2819
  //#endregion
2820
- //#region src/verify/publish.ts
2821
- const EVIDENCE_BRANCH = "verify-evidence";
2822
- const SCRATCH_BRANCH = "verify-evidence-scratch";
2823
- const STATUS = {
2824
- PASS: "success",
2825
- "PASS+NOTES": "success",
2826
- "NOT VERIFIED": "error",
2827
- FAIL: "failure"
2828
- };
2829
- /**
2830
- * Commits the run's evidence under pr-<n>/<sha>/ of the orphan evidence
2831
- * branch and pushes it. Works in a temporary worktree so the checkout under
2832
- * review is never touched. Returns the pushed evidence commit.
2833
- */
2834
- function pushEvidence(root, state, verdict) {
2835
- const worktree = mkdtempSync(join(tmpdir(), "verify-evidence-"));
2836
- try {
2837
- if (git(root, [
2838
- "ls-remote",
2839
- "--heads",
2840
- "origin",
2841
- EVIDENCE_BRANCH
2842
- ]) !== "") {
2843
- git(root, [
2844
- "fetch",
2845
- "--quiet",
2846
- "origin",
2847
- `${EVIDENCE_BRANCH}:refs/remotes/origin/${EVIDENCE_BRANCH}`
2848
- ]);
2849
- git(root, [
2850
- "worktree",
2851
- "add",
2852
- "--quiet",
2853
- "--detach",
2854
- worktree,
2855
- `origin/${EVIDENCE_BRANCH}`
2856
- ]);
2857
- } else git(root, [
2858
- "worktree",
2859
- "add",
2860
- "--quiet",
2861
- "--orphan",
2862
- "-B",
2863
- SCRATCH_BRANCH,
2864
- worktree
2865
- ]);
2866
- const target = join(worktree, `pr-${verdict.pr}`, verdict.headSha);
2867
- rmSync(target, {
2868
- recursive: true,
2869
- force: true
2870
- });
2871
- mkdirSync(target, { recursive: true });
2872
- cpSync(state.evidence, target, { recursive: true });
2873
- git(worktree, [
2874
- "add",
2875
- "--all",
2876
- "."
2877
- ]);
2878
- git(worktree, [
2879
- "-c",
2880
- "commit.gpgsign=false",
2881
- "commit",
2882
- "--quiet",
2883
- "--allow-empty",
2884
- "-m",
2885
- `verify: evidence for #${verdict.pr} at ${verdict.headSha.slice(0, 7)} (${verdict.result})`
2886
- ]);
2887
- git(worktree, [
2888
- "push",
2889
- "--quiet",
2890
- "origin",
2891
- `HEAD:refs/heads/${EVIDENCE_BRANCH}`
2892
- ]);
2893
- return git(worktree, ["rev-parse", "HEAD"]);
2894
- } finally {
2895
- git(root, [
2896
- "worktree",
2897
- "remove",
2898
- "--force",
2899
- worktree
2900
- ]);
2901
- if (git(root, [
2902
- "branch",
2903
- "--list",
2904
- SCRATCH_BRANCH
2905
- ]) !== "") git(root, [
2906
- "branch",
2907
- "--quiet",
2908
- "-D",
2909
- SCRATCH_BRANCH
2910
- ]);
2911
- }
2912
- }
2913
- /** Posts the verdict as a PR comment and returns the comment URL printed by gh. */
2914
- function postComment(root, verdict) {
2915
- return execFileSync("gh", [
2916
- "pr",
2917
- "comment",
2918
- String(verdict.pr),
2919
- "--repo",
2920
- verdict.repository,
2921
- "--body",
2922
- verdict.markdown
2923
- ], {
2924
- cwd: root,
2925
- encoding: "utf8"
2926
- }).trim();
2927
- }
2928
- /**
2929
- * Sets the `verify` commit status on the head SHA the verdict judged and
2930
- * reads it back from GitHub. Returns what GitHub holds, or the error GitHub
2931
- * answered, so a token without `statuses: write` is reported, never hidden.
2932
- */
2933
- function setStatus(root, verdict, targetUrl) {
2934
- const write = spawnSync("gh", [
2935
- "api",
2936
- "--silent",
2937
- `repos/${verdict.repository}/statuses/${verdict.headSha}`,
2938
- "-f",
2939
- `state=${STATUS[verdict.result]}`,
2940
- "-f",
2941
- "context=verify",
2942
- "-f",
2943
- `description=verify: ${verdict.result}`,
2944
- "-f",
2945
- `target_url=${targetUrl}`
2946
- ], {
2947
- cwd: root,
2948
- encoding: "utf8"
2949
- });
2950
- if (write.status !== 0) return {
2951
- ok: false,
2952
- detail: `setting status verify failed: ${(write.stderr || write.stdout).trim()}`
2953
- };
2954
- const state = spawnSync("gh", [
2955
- "api",
2956
- `repos/${verdict.repository}/commits/${verdict.headSha}/statuses`,
2957
- "--jq",
2958
- "[.[] | select(.context == \"verify\")][0].state"
2959
- ], {
2960
- cwd: root,
2961
- encoding: "utf8"
2962
- }).stdout.trim();
2963
- return {
2964
- ok: state === STATUS[verdict.result],
2965
- detail: `status verify on ${verdict.headSha}: ${state || "absent"}`
2966
- };
2967
- }
2968
- //#endregion
2969
2820
  //#region src/verify/builtins.ts
2970
2821
  /** Loads the module from its local source next to its backing services, then stops it. */
2971
2822
  const moduleDev = {
@@ -4178,27 +4029,16 @@ function timingTable(report) {
4178
4029
  }
4179
4030
  //#endregion
4180
4031
  //#region src/verify/verdict.ts
4181
- /** The GitHub `owner/repo` of the origin remote. */
4182
- function originRepository(root) {
4183
- const url = git(root, [
4184
- "remote",
4185
- "get-url",
4186
- "origin"
4187
- ]);
4188
- const match = /github\.com[:/](.+?)(?:\.git)?$/.exec(url);
4189
- if (!match) throw new Error(`origin ${url} is not a GitHub repository`);
4190
- return match[1];
4191
- }
4192
4032
  function short(sha) {
4193
4033
  return sha.slice(0, 7);
4194
4034
  }
4195
4035
  function bullets(entries, empty) {
4196
4036
  return (entries.length > 0 ? entries : [empty]).map((entry) => `- ${entry}`);
4197
4037
  }
4198
- function journeyRow(label, result, link) {
4038
+ function journeyRow(label, result) {
4199
4039
  const outcome = result.status === "PASS" ? "pass" : result.status === "FAIL" ? "**fail**" : "**not verified**";
4200
- const reused = result.reusedFrom === void 0 ? "" : ` (not run again: reuses [${result.reusedFrom}](${link(result.reusedFrom)}))`;
4201
- return `| ${label} | \`${result.journey}\`: ${result.entryPoint} | ${outcome}: ${result.title}${reused} | [${result.folder}](${link(result.folder)}) |`;
4040
+ const reused = result.reusedFrom === void 0 ? "" : ` (not run again: reuses [${result.reusedFrom}](${result.reusedFrom}))`;
4041
+ return `| ${label} | \`${result.journey}\`: ${result.entryPoint} | ${outcome}: ${result.title}${reused} | [${result.folder}](${result.folder}) |`;
4202
4042
  }
4203
4043
  /** For a reused result, the status of its source when that is no longer PASS (`missing` when gone); otherwise null. */
4204
4044
  function staleReuse(state, result) {
@@ -4212,7 +4052,7 @@ function staleReuse(state, result) {
4212
4052
  function featuresOutsidePlan(state, plan) {
4213
4053
  return readdirSync(state.evidence, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !plan.run.includes(entry.name) && existsSync(join(state.evidence, entry.name, "feature.json"))).map((entry) => entry.name).sort();
4214
4054
  }
4215
- function journeyRows(workspace, state, plan, link) {
4055
+ function journeyRows(workspace, state, plan) {
4216
4056
  const rows = [];
4217
4057
  const reasons = [];
4218
4058
  const notVerified = [];
@@ -4232,7 +4072,7 @@ function journeyRows(workspace, state, plan, link) {
4232
4072
  if (result.status === "NOT VERIFIED") notVerified.push(`${feature}/${result.journey}: ${result.notVerified}`);
4233
4073
  const stale = staleReuse(state, result);
4234
4074
  if (stale !== null) reasons.push(`${feature}/${result.journey} reuses ${result.reusedFrom}, which is now ${stale}`);
4235
- rows.push(journeyRow(feature, result, link));
4075
+ rows.push(journeyRow(feature, result));
4236
4076
  }
4237
4077
  }
4238
4078
  for (const feature of featuresOutsidePlan(state, plan)) {
@@ -4246,7 +4086,7 @@ function journeyRows(workspace, state, plan, link) {
4246
4086
  const stale = staleReuse(state, result);
4247
4087
  if (stale !== null) reasons.push(`${feature}/${result.journey} reuses ${result.reusedFrom}, which is now ${stale}`);
4248
4088
  if (result.status === "NOT VERIFIED") outsideNotVerified.push(`${feature}/${result.journey}: ${result.notVerified}`);
4249
- rows.push(journeyRow(`${feature} (outside the diff's features)`, result, link));
4089
+ rows.push(journeyRow(`${feature} (outside the diff's features)`, result));
4250
4090
  }
4251
4091
  }
4252
4092
  return {
@@ -4276,7 +4116,7 @@ function doorsSection(judgement) {
4276
4116
  ...judgement.doors.map((door) => `| ${door.kind} | \`${door.location}\` | ${door.irreversible} | ${door.containment} |`)
4277
4117
  ];
4278
4118
  }
4279
- function formalSection(workspace, state, plan, link) {
4119
+ function formalSection(workspace, state, plan) {
4280
4120
  const reasons = [];
4281
4121
  const lines = [];
4282
4122
  const ran = [];
@@ -4293,7 +4133,7 @@ function formalSection(workspace, state, plan, link) {
4293
4133
  const weight = formalGate(result);
4294
4134
  if (gate && weight.fails) reasons.push(`formal check ${check.name}: ${weight.outcome}`);
4295
4135
  const summary = gate ? weight.outcome : result.violated.length > 0 ? `violated: ${result.violated.join(", ")}` : `exit ${result.exitCode}, no violated rule`;
4296
- lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${summary}. [evidence](${link(result.folder)})`);
4136
+ lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${summary}. [evidence](${result.folder})`);
4297
4137
  }
4298
4138
  return {
4299
4139
  reasons,
@@ -4332,7 +4172,6 @@ function unmappedSection(unmapped) {
4332
4172
  */
4333
4173
  function renderVerdict(workspace, state, pr, judgement) {
4334
4174
  const plan = planFor(workspace, state.baseRef, state.all);
4335
- const repository = originRepository(workspace.root);
4336
4175
  const skillSha = git(workspace.root, [
4337
4176
  "log",
4338
4177
  "-1",
@@ -4340,11 +4179,10 @@ function renderVerdict(workspace, state, pr, judgement) {
4340
4179
  "--",
4341
4180
  relative(workspace.root, workspace.skill)
4342
4181
  ]) || plan.headSha;
4343
- const link = (path) => `https://github.com/${repository}/tree/verify-evidence/pr-${pr}/${plan.headSha}/${path}`;
4344
4182
  const reasons = [];
4345
4183
  if (plan.headSha !== state.headSha) reasons.push(`the run was created at ${short(state.headSha)} but HEAD is ${short(plan.headSha)}`);
4346
- const journeys = journeyRows(workspace, state, plan, link);
4347
- const formal = formalSection(workspace, state, plan, link);
4184
+ const journeys = journeyRows(workspace, state, plan);
4185
+ const formal = formalSection(workspace, state, plan);
4348
4186
  reasons.push(...journeys.reasons, ...plan.unmapped.map((file) => `unmapped surface ${file}`), ...docsReasons(judgement, plan), ...doorReasons(workspace, judgement, plan), ...formal.reasons);
4349
4187
  const notVerified = [
4350
4188
  ...journeys.notVerified,
@@ -4392,8 +4230,6 @@ function renderVerdict(workspace, state, pr, judgement) {
4392
4230
  "",
4393
4231
  "### Timing",
4394
4232
  ...timingTable(timings),
4395
- "",
4396
- `Evidence: \`verify-evidence\` branch, [\`pr-${pr}/${plan.headSha}/\`](${link("")})`,
4397
4233
  ""
4398
4234
  ].join("\n");
4399
4235
  writeFileSync(join(state.evidence, "verdict.md"), markdown);
@@ -4411,7 +4247,6 @@ function renderVerdict(workspace, state, pr, judgement) {
4411
4247
  headSha: plan.headSha,
4412
4248
  skillSha,
4413
4249
  pr,
4414
- repository,
4415
4250
  markdown,
4416
4251
  reasons
4417
4252
  };
@@ -4435,7 +4270,6 @@ const USAGE = `Usage: antelopejs-verify <command>
4435
4270
  doors [patch] [--base <ref>] print the One-way-door line for a patch, or for the diff
4436
4271
  clean <run> stop what the run started, keep only the evidence
4437
4272
  verdict <run> --pr <n> render evidence/verdict.md from the results and evidence/judgement.json
4438
- publish <run> --pr <n> push the evidence to verify-evidence, comment the verdict, set status verify
4439
4273
  `;
4440
4274
  function print(text) {
4441
4275
  process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
@@ -4589,19 +4423,11 @@ function printDoors(workspace, files) {
4589
4423
  for (const door of doors) print(` ${door.kind}: ${door.files.join(", ")}`);
4590
4424
  return 0;
4591
4425
  }
4592
- function judge(workspace, command, dir, pr) {
4593
- if (!Number.isInteger(pr) || pr <= 0) throw new Error(`${command} needs --pr <number>`);
4426
+ function judge(workspace, dir, pr) {
4427
+ if (!Number.isInteger(pr) || pr <= 0) throw new Error("verdict needs --pr <number>");
4594
4428
  const state = loadRun(dir);
4595
4429
  const verdict = renderVerdict(workspace, state, pr, readJudgement(join(state.evidence, "judgement.json")));
4596
4430
  print(verdict.markdown);
4597
- if (command === "publish") {
4598
- print(`evidence commit ${pushEvidence(workspace.root, state, verdict)}`);
4599
- const comment = postComment(workspace.root, verdict);
4600
- print(`comment ${comment}`);
4601
- const status = setStatus(workspace.root, verdict, comment);
4602
- print(status.detail);
4603
- if (!status.ok) return 1;
4604
- }
4605
4431
  return verdict.result === "PASS" || verdict.result === "PASS+NOTES" ? 0 : 1;
4606
4432
  }
4607
4433
  async function main(argv) {
@@ -4665,7 +4491,7 @@ async function main(argv) {
4665
4491
  } else if (command === "formal") return runFormal(workspace, rest[0], values.all === true);
4666
4492
  else if (command === "doors") return printDoors(workspace, rest[0] ? patchFiles(rest[0]) : planFor(workspace, values.base).changed);
4667
4493
  else if (command === "clean") for (const line of clean(loadRun(rest[0]))) print(line);
4668
- else if (command === "verdict" || command === "publish") return judge(workspace, command, rest[0], Number(values.pr));
4494
+ else if (command === "verdict") return judge(workspace, rest[0], Number(values.pr));
4669
4495
  else {
4670
4496
  print(USAGE);
4671
4497
  return 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.3.8",
3
+ "version": "0.4.1",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
5
5
  "keywords": [
6
6
  "antelopejs",