@antelopejs/tooling-configs 0.2.18 → 0.2.19

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/bin/sync.mjs CHANGED
@@ -7,7 +7,7 @@ import { t as runCli } from "../cli-4Tv71vYk.mjs";
7
7
  import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
8
8
  import { i as recordedRelease, t as measureBaseline } from "../ratchet-BAcLRYuM.mjs";
9
9
  import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-C0SkPO5R.mjs";
10
- import { a as MUTATION_PATH, c as MISSING_CHECKS_WORKFLOW, d as hasChecksWorkflow, l as ciNodeCallers, o as ciWorkflow, r as CI_PATH, s as mutationCaller, u as ciRenovateSyncCallers } from "../ci-workflow-ChW4He0r.mjs";
10
+ import { a as MUTATION_PATH, c as MISSING_CHECKS_WORKFLOW, d as hasChecksWorkflow, l as ciNodeCallers, o as ciWorkflow, r as CI_PATH, s as mutationCaller, u as ciRenovateSyncCallers } from "../ci-workflow-DVkpwauQ.mjs";
11
11
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmdirSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
12
12
  import { dirname, join, resolve } from "node:path";
13
13
  import { execFileSync } from "node:child_process";
@@ -696,6 +696,22 @@ function planDocs(root, manager) {
696
696
  for (const item of packages) planPackage(root, plan, locks.get(item.directory), standard, item);
697
697
  return plan;
698
698
  }
699
+ //#endregion
700
+ //#region src/guardrails/template-agent-layer.ts
701
+ /** The folders a project scaffolded from a template does not get, as `ajs project init` excludes them. */
702
+ const SCAFFOLD_EXCLUDED_PATHS = [".agents/", ".claude/skills/"];
703
+ /** Whether a scaffold lacks `path`, so a template's AGENTS.md, which every scaffold keeps, must not link it. */
704
+ function inScaffoldExcludedPath(path) {
705
+ return path !== void 0 && SCAFFOLD_EXCLUDED_PATHS.some((folder) => path.startsWith(folder));
706
+ }
707
+ /** The writing skills belong to the agent layer, which the template profile syncs only in the template source. */
708
+ function planWritingSkills(root, profile, kind) {
709
+ if (profile === "template" && kind !== "template") return {
710
+ actions: [],
711
+ errors: []
712
+ };
713
+ return planDocsSkills(root);
714
+ }
699
715
  /** The kind-specific text of each shared skill. */
700
716
  const KIND_TEXT = {
701
717
  interface: {
@@ -956,8 +972,7 @@ function ownVerificationSkill(root) {
956
972
  }
957
973
  }
958
974
  }
959
- function inferKind(manifest, profile) {
960
- if (profile === "template") return "template";
975
+ function inferKind(manifest) {
961
976
  const declared = manifest.antelopeJs;
962
977
  if (declared?.kind === "interface" || declared?.kind === "module") return declared.kind;
963
978
  if (Array.isArray(declared?.implements) && declared.implements.length > 0) return "module";
@@ -982,8 +997,12 @@ function resolveKind(root, flag, manifest, profile) {
982
997
  kind: "custom",
983
998
  errors
984
999
  };
1000
+ if (profile === "template") return {
1001
+ kind: existsSync(join(root, skillFolder("template"))) ? "template" : void 0,
1002
+ errors
1003
+ };
985
1004
  return {
986
- kind: inferKind(manifest, profile),
1005
+ kind: inferKind(manifest),
987
1006
  errors
988
1007
  };
989
1008
  }
@@ -1045,7 +1064,11 @@ function planStaleKinds(root, keep) {
1045
1064
  notes
1046
1065
  };
1047
1066
  }
1048
- /** Resolves the repository's verification kind and plans the synced layer; the repo-owned files are never touched. */
1067
+ /**
1068
+ * Resolves the repository's verification kind and plans the synced layer; the repo-owned files are never touched.
1069
+ * The template profile infers no kind: a shared skill lives under `.agents`, which a project scaffolded from the template does not get,
1070
+ * so it is synced only where it already exists, as `verify-template` does in the template source, or where `--verify` asks for it.
1071
+ */
1049
1072
  function planVerify(root, options) {
1050
1073
  const { kind, errors } = resolveKind(root, options.flag, options.manifest, options.profile);
1051
1074
  const shared = kind !== void 0 && kind !== "custom" ? kind : void 0;
@@ -1292,7 +1315,7 @@ function repositoryContext(root, current, profile, verificationSkill) {
1292
1315
  suppressionBudget: profile === "full" ? adoptedBudget(root, current.get(SUPPRESSIONS_FILE)) : "",
1293
1316
  packageName: manifest.name ?? "",
1294
1317
  managesCi: current.has(".github/workflows/ci.yml") || !hasChecksWorkflow(root),
1295
- verificationSkill,
1318
+ verificationSkill: profile === "template" && inScaffoldExcludedPath(verificationSkill) ? void 0 : verificationSkill,
1296
1319
  glossary: ["GLOSSARY.md", "docs/GLOSSARY.md"].find((file) => existsSync(join(root, file))),
1297
1320
  docs: profile === "full" && current.has("package.json") ? planDocs(root, manager) : void 0
1298
1321
  };
@@ -1312,7 +1335,12 @@ function repositoryNotices(root, context) {
1312
1335
  if (context.ratchet && isRetired(readCeilings(root))) notices.push(RETIRED_RATCHET);
1313
1336
  return notices;
1314
1337
  }
1315
- /** Measures debt only on first adoption, before sync has written the sync:check script; retired repositories stay retired. */
1338
+ /**
1339
+ * Measures debt only on first adoption, before sync has written the sync:check script; retired repositories stay retired.
1340
+ * Under the template profile the agent layer, `verify-template` and the writing skills, is synced only in the template source,
1341
+ * marked by its `.agents/skills/verify-template` folder or chosen with `--verify template`, because a scaffold ships without it,
1342
+ * and the AGENTS.md block, which a scaffold keeps, links no skill under it.
1343
+ */
1316
1344
  function syncRepository(root, options = {}) {
1317
1345
  const profile = options.profile ?? "full";
1318
1346
  const { current, modes } = repositorySnapshot(root);
@@ -1322,7 +1350,7 @@ function syncRepository(root, options = {}) {
1322
1350
  manifest,
1323
1351
  profile
1324
1352
  });
1325
- const writing = planDocsSkills(root);
1353
+ const writing = planWritingSkills(root, profile, verify.kind);
1326
1354
  const actions = [...verify.actions, ...writing.actions];
1327
1355
  const context = repositoryContext(root, current, profile, verify.verificationSkill);
1328
1356
  const boundaries = backendBoundaryArtifacts(root);
@@ -127,6 +127,7 @@ jobs:
127
127
  uses: ${CI_NODE_REF}
128
128
  with:
129
129
  renovate-sync: false
130
+ test-job: true
130
131
  ${RENOVATE_SYNC_JOB_ID}:
131
132
  if: >-
132
133
  github.event_name == 'pull_request'
@@ -251,6 +252,14 @@ function skipRenovateSync(document, job) {
251
252
  else job.set("with", document.createNode({ "renovate-sync": false }));
252
253
  return true;
253
254
  }
255
+ function addTestJob(document, job) {
256
+ const inputs = job.get("with", true);
257
+ if (isMap(inputs)) {
258
+ if (inputs.has("test-job")) return false;
259
+ inputs.set("test-job", true);
260
+ } else job.set("with", document.createNode({ "test-job": true }));
261
+ return true;
262
+ }
254
263
  function lines(text) {
255
264
  return text.split("\n").map((line) => line.trim()).filter(Boolean);
256
265
  }
@@ -312,6 +321,8 @@ function assertNoClash(jobs, callerId, hasSyncCaller) {
312
321
  * Keeps the shared CI caller on the job id `ci` with no `name`, so the shared workflow reports `ci / checks`,
313
322
  * dispatchable and read-only, with the Renovate sync it would otherwise run turned off. The write permissions the sync
314
323
  * needs to push and dispatch the caller live on a separate job calling ci-renovate-sync.yml, which is added when missing.
324
+ * A caller without a `test-job` input gets `test-job: true`, which runs the tests in their own job; an explicit value
325
+ * is left as the repository set it.
315
326
  * No `uses:` ref is ever rewritten. A workflow with no caller job is repository-specific CI and is left as it is.
316
327
  * When `docsFiles` computes paths, every caller's `docs-files` input lists them first, then keeps its hand-listed paths
317
328
  * that still exist, so sync never drops coverage.
@@ -340,6 +351,7 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
340
351
  }
341
352
  changed = grant(document, pair.value, { contents: "read" }) || changed;
342
353
  changed = skipRenovateSync(document, pair.value) || changed;
354
+ changed = addTestJob(document, pair.value) || changed;
343
355
  changed = ensureSyncJob(document, jobs, syncCallers) || changed;
344
356
  if (!hasDispatch(document)) {
345
357
  addDispatch(document);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
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",
@@ -29,6 +29,7 @@
29
29
  "antelopejs-checks": "./dist/bin/checks.mjs",
30
30
  "antelopejs-comment-proof": "./dist/bin/comment-proof.mjs",
31
31
  "antelopejs-garden": "./dist/bin/garden.mjs",
32
+ "antelopejs-lease": "./dist/bin/lease.mjs",
32
33
  "antelopejs-ratchet": "./dist/bin/ratchet.mjs",
33
34
  "antelopejs-suppressions": "./dist/bin/suppressions.mjs",
34
35
  "antelopejs-sync": "./dist/bin/sync.mjs",