@agenticprimitives/devkit 0.0.0-alpha.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.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/bin/ap.mjs +119 -0
  4. package/dist/config.d.ts +130 -0
  5. package/dist/config.d.ts.map +1 -0
  6. package/dist/config.js +128 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/dispatch.d.ts +44 -0
  9. package/dist/dispatch.d.ts.map +1 -0
  10. package/dist/dispatch.js +43 -0
  11. package/dist/dispatch.js.map +1 -0
  12. package/dist/doctor.d.ts +21 -0
  13. package/dist/doctor.d.ts.map +1 -0
  14. package/dist/doctor.js +71 -0
  15. package/dist/doctor.js.map +1 -0
  16. package/dist/errors.d.ts +37 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +35 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/fs.d.ts +20 -0
  21. package/dist/fs.d.ts.map +1 -0
  22. package/dist/fs.js +54 -0
  23. package/dist/fs.js.map +1 -0
  24. package/dist/index.d.ts +24 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +19 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/lock.d.ts +18 -0
  29. package/dist/lock.d.ts.map +1 -0
  30. package/dist/lock.js +15 -0
  31. package/dist/lock.js.map +1 -0
  32. package/dist/redact.d.ts +2 -0
  33. package/dist/redact.d.ts.map +1 -0
  34. package/dist/redact.js +14 -0
  35. package/dist/redact.js.map +1 -0
  36. package/dist/rules/archetype-catalog.d.ts +4 -0
  37. package/dist/rules/archetype-catalog.d.ts.map +1 -0
  38. package/dist/rules/archetype-catalog.js +48 -0
  39. package/dist/rules/archetype-catalog.js.map +1 -0
  40. package/dist/rules/capability-vocabulary.d.ts +4 -0
  41. package/dist/rules/capability-vocabulary.d.ts.map +1 -0
  42. package/dist/rules/capability-vocabulary.js +56 -0
  43. package/dist/rules/capability-vocabulary.js.map +1 -0
  44. package/dist/rules/custodian-coverage.d.ts +4 -0
  45. package/dist/rules/custodian-coverage.d.ts.map +1 -0
  46. package/dist/rules/custodian-coverage.js +47 -0
  47. package/dist/rules/custodian-coverage.js.map +1 -0
  48. package/dist/rules/demo-person-org-distinct.d.ts +4 -0
  49. package/dist/rules/demo-person-org-distinct.d.ts.map +1 -0
  50. package/dist/rules/demo-person-org-distinct.js +26 -0
  51. package/dist/rules/demo-person-org-distinct.js.map +1 -0
  52. package/dist/rules/fail-open-knobs.d.ts +4 -0
  53. package/dist/rules/fail-open-knobs.d.ts.map +1 -0
  54. package/dist/rules/fail-open-knobs.js +64 -0
  55. package/dist/rules/fail-open-knobs.js.map +1 -0
  56. package/dist/rules/index.d.ts +10 -0
  57. package/dist/rules/index.d.ts.map +1 -0
  58. package/dist/rules/index.js +29 -0
  59. package/dist/rules/index.js.map +1 -0
  60. package/dist/rules/internal-marker-split.d.ts +4 -0
  61. package/dist/rules/internal-marker-split.d.ts.map +1 -0
  62. package/dist/rules/internal-marker-split.js +31 -0
  63. package/dist/rules/internal-marker-split.js.map +1 -0
  64. package/dist/rules/lock-coherent.d.ts +4 -0
  65. package/dist/rules/lock-coherent.d.ts.map +1 -0
  66. package/dist/rules/lock-coherent.js +39 -0
  67. package/dist/rules/lock-coherent.js.map +1 -0
  68. package/dist/rules/no-cross-subject-vault-reads.d.ts +4 -0
  69. package/dist/rules/no-cross-subject-vault-reads.d.ts.map +1 -0
  70. package/dist/rules/no-cross-subject-vault-reads.js +35 -0
  71. package/dist/rules/no-cross-subject-vault-reads.js.map +1 -0
  72. package/dist/rules/no-hmac-home-bridge.d.ts +4 -0
  73. package/dist/rules/no-hmac-home-bridge.d.ts.map +1 -0
  74. package/dist/rules/no-hmac-home-bridge.js +40 -0
  75. package/dist/rules/no-hmac-home-bridge.js.map +1 -0
  76. package/dist/rules/no-private-keys.d.ts +4 -0
  77. package/dist/rules/no-private-keys.d.ts.map +1 -0
  78. package/dist/rules/no-private-keys.js +45 -0
  79. package/dist/rules/no-private-keys.js.map +1 -0
  80. package/dist/rules/rules-drift.d.ts +4 -0
  81. package/dist/rules/rules-drift.d.ts.map +1 -0
  82. package/dist/rules/rules-drift.js +46 -0
  83. package/dist/rules/rules-drift.js.map +1 -0
  84. package/dist/rules/types.d.ts +50 -0
  85. package/dist/rules/types.d.ts.map +1 -0
  86. package/dist/rules/types.js +2 -0
  87. package/dist/rules/types.js.map +1 -0
  88. package/dist/rules/web-no-direct-mcp.d.ts +4 -0
  89. package/dist/rules/web-no-direct-mcp.d.ts.map +1 -0
  90. package/dist/rules/web-no-direct-mcp.js +37 -0
  91. package/dist/rules/web-no-direct-mcp.js.map +1 -0
  92. package/dist/rules-projection.d.ts +58 -0
  93. package/dist/rules-projection.d.ts.map +1 -0
  94. package/dist/rules-projection.js +135 -0
  95. package/dist/rules-projection.js.map +1 -0
  96. package/dist/upgrade.d.ts +37 -0
  97. package/dist/upgrade.d.ts.map +1 -0
  98. package/dist/upgrade.js +116 -0
  99. package/dist/upgrade.js.map +1 -0
  100. package/dist/workspace.d.ts +18 -0
  101. package/dist/workspace.d.ts.map +1 -0
  102. package/dist/workspace.js +56 -0
  103. package/dist/workspace.js.map +1 -0
  104. package/package.json +73 -0
  105. package/rules/coordination-vs-orchestration.md +31 -0
  106. package/rules/demo-person-org-distinct.md +40 -0
  107. package/rules/external-registry-integrations.md +15 -0
  108. package/rules/hard-rules.md +50 -0
  109. package/rules/one-capability-model-generates-both.md +82 -0
  110. package/rules/ontology-drives-behavior.md +58 -0
  111. package/rules/service-agent-signing.md +84 -0
  112. package/rules/sidecar.json +13 -0
  113. package/rules/skill-terminology.md +76 -0
  114. package/rules/vault-and-ontology.md +8 -0
  115. package/rules/vault-records-are-ontology-shaped.md +85 -0
  116. package/spec.md +11 -0
package/dist/doctor.js ADDED
@@ -0,0 +1,71 @@
1
+ // `ap doctor` — spec 399 §3.3 / spec 398 §10.3. Runs the registered rules over a tree under one config and returns
2
+ // a report: per rule, pass / fail / skip / error with findings. A rule that throws is an ERROR, never a pass
3
+ // (green-by-absence is the failure this kit exists to remove).
4
+ import { join } from 'node:path';
5
+ import { performance } from 'node:perf_hooks';
6
+ import { loadDoctorConfig } from './config.js';
7
+ import { DevkitError, ERROR_CODES } from './errors.js';
8
+ import { exists, gitTracked, readText, rel, walk } from './fs.js';
9
+ import { redact } from './redact.js';
10
+ import { DOCTOR_RULES, RULE_IDS } from './rules/index.js';
11
+ export function makeRuleContext(root) {
12
+ return {
13
+ root,
14
+ abs: (p) => join(root, p),
15
+ rel: (p) => rel(root, p),
16
+ exists: (p) => exists(join(root, p)),
17
+ read: (p) => readText(join(root, p)),
18
+ walk: (dir, opts) => walk(join(root, dir), opts),
19
+ tracked: (dir) => gitTracked(root, dir),
20
+ };
21
+ }
22
+ export async function runDoctor(opts) {
23
+ const loaded = opts.loaded ?? (opts.config ? { config: opts.config, source: 'built-in ring-0 layout', overrides: [] } : loadDoctorConfig(opts.root));
24
+ if (opts.only)
25
+ for (const id of opts.only)
26
+ if (!RULE_IDS.includes(id))
27
+ throw new DevkitError(ERROR_CODES.E_RULE_UNKNOWN, `unknown rule "${id}" (known: ${RULE_IDS.join(', ')})`);
28
+ const ctx = makeRuleContext(opts.root);
29
+ const results = [];
30
+ for (const { rule, section } of DOCTOR_RULES) {
31
+ if (opts.only && !opts.only.includes(rule.id))
32
+ continue;
33
+ const t0 = performance.now();
34
+ const cfg = loaded.config[section];
35
+ if (cfg.skip) {
36
+ results.push({ id: rule.id, status: 'skip', summary: `skipped by config — ${cfg.skip}`, findings: [], notes: [], ms: 0 });
37
+ continue;
38
+ }
39
+ try {
40
+ const out = await rule.run(ctx, cfg);
41
+ const findings = (out.findings ?? []).map((f) => ({ ...f, message: redact(f.message) }));
42
+ const status = out.status ?? (findings.length ? 'fail' : 'pass');
43
+ results.push({ id: rule.id, status, summary: redact(out.summary), findings, notes: (out.notes ?? []).map(redact), ms: Math.round(performance.now() - t0) });
44
+ }
45
+ catch (e) {
46
+ results.push({ id: rule.id, status: 'error', summary: redact(`${ERROR_CODES.E_RULE_ERROR}: ${e.message}`), findings: [], notes: [], ms: Math.round(performance.now() - t0) });
47
+ }
48
+ }
49
+ return { root: opts.root, configSource: loaded.source, configOverrides: loaded.overrides, rules: results, ok: results.every((r) => r.status === 'pass' || r.status === 'skip'), errored: results.some((r) => r.status === 'error') };
50
+ }
51
+ export function formatDoctorReport(report, opts = {}) {
52
+ const mark = { pass: '✓', fail: '✗', skip: '⊘', error: '‼' };
53
+ const lines = [`ap doctor · ${report.root} · config: ${report.configSource}${report.configOverrides.length ? ` (${report.configOverrides.join(', ')})` : ''}`, ''];
54
+ for (const r of report.rules) {
55
+ lines.push(`${mark[r.status]} ${r.id.padEnd(30)} ${r.summary}`);
56
+ const show = r.status === 'fail' || r.status === 'error' || opts.verbose;
57
+ if (show)
58
+ for (const f of r.findings.slice(0, opts.verbose ? undefined : 40))
59
+ lines.push(` ${f.file ?? ''}${f.line ? `:${f.line}` : ''}${f.file ? ' ' : ''}${f.message}`);
60
+ if (show && !opts.verbose && r.findings.length > 40)
61
+ lines.push(` … ${r.findings.length - 40} more (use --verbose)`);
62
+ if (opts.verbose)
63
+ for (const n of r.notes)
64
+ lines.push(` · ${n}`);
65
+ }
66
+ const fails = report.rules.filter((r) => r.status === 'fail').length;
67
+ const errors = report.rules.filter((r) => r.status === 'error').length;
68
+ lines.push('', report.ok ? `✓ ${report.rules.length} rule(s) clean` : `✗ ${fails} failing, ${errors} errored of ${report.rules.length}`);
69
+ return lines.join('\n');
70
+ }
71
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,6GAA6G;AAC7G,+DAA+D;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;A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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9K,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,EAAE,uBAAuB,CAAC,CAAC;QACxH,IAAI,IAAI,CAAC,OAAO;YAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IACvE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM,gBAAgB,CAAC,CAAC,CAAC,KAAK,KAAK,aAAa,MAAM,eAAe,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzI,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,37 @@
1
+ export declare const ERROR_CODES: {
2
+ /** The config file could not be read or is not the shape `ap.config.json` / `agentic.lock.json#doctor` declares. */
3
+ readonly E_CONFIG: "E_CONFIG";
4
+ /** `--rule <id>` names no registered rule. */
5
+ readonly E_RULE_UNKNOWN: "E_RULE_UNKNOWN";
6
+ /** A rule threw instead of judging — its own defect, reported as `status: error`, never as a pass. */
7
+ readonly E_RULE_ERROR: "E_RULE_ERROR";
8
+ /** A rule needed a file the config names and it is not there. */
9
+ readonly E_INPUT_MISSING: "E_INPUT_MISSING";
10
+ /** An `ap` command dispatches to a package that is not installed (a2a / mcp-protocol / evaluation / create-app). */
11
+ readonly E_MODULE_ABSENT: "E_MODULE_ABSENT";
12
+ /** The dispatched module is installed but does not export the function this CLI version expects. */
13
+ readonly E_MODULE_SHAPE: "E_MODULE_SHAPE";
14
+ /** Command-line usage error. */
15
+ readonly E_USAGE: "E_USAGE";
16
+ /** `ap upgrade` could not resolve a version for a package. */
17
+ readonly E_RESOLVE: "E_RESOLVE";
18
+ /** `ap upgrade` stops for review: a contract's authority or effects changed (398 §10.3). */
19
+ readonly E_REVIEW_REQUIRED: "E_REVIEW_REQUIRED";
20
+ /** `ap doctor --rules`: a projection target exists but carries no managed block. */
21
+ readonly E_UNMANAGED_TARGET: "E_UNMANAGED_TARGET";
22
+ };
23
+ export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
24
+ export declare class DevkitError extends Error {
25
+ readonly code: ErrorCode;
26
+ constructor(code: ErrorCode, message: string, options?: {
27
+ cause?: unknown;
28
+ });
29
+ }
30
+ /** Process exit codes, fixed: 0 clean · 1 findings · 2 usage/config · 3 a rule or dispatch errored. */
31
+ export declare const EXIT: {
32
+ readonly OK: 0;
33
+ readonly FINDINGS: 1;
34
+ readonly USAGE: 2;
35
+ readonly ERROR: 3;
36
+ };
37
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;IACtB,oHAAoH;;IAEpH,8CAA8C;;IAE9C,sGAAsG;;IAEtG,iEAAiE;;IAEjE,oHAAoH;;IAEpH,oGAAoG;;IAEpG,gCAAgC;;IAEhC,8DAA8D;;IAE9D,4FAA4F;;IAE5F,oFAAoF;;CAE5E,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;gBACb,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAK5E;AAED,uGAAuG;AACvG,eAAO,MAAM,IAAI;;;;;CAAsD,CAAC"}
package/dist/errors.js ADDED
@@ -0,0 +1,35 @@
1
+ // Stable error codes — a coding agent (398 §10.3: every command has `--json`) branches on the CODE, never on
2
+ // the sentence. Add a code; never repurpose one.
3
+ export const ERROR_CODES = {
4
+ /** The config file could not be read or is not the shape `ap.config.json` / `agentic.lock.json#doctor` declares. */
5
+ E_CONFIG: 'E_CONFIG',
6
+ /** `--rule <id>` names no registered rule. */
7
+ E_RULE_UNKNOWN: 'E_RULE_UNKNOWN',
8
+ /** A rule threw instead of judging — its own defect, reported as `status: error`, never as a pass. */
9
+ E_RULE_ERROR: 'E_RULE_ERROR',
10
+ /** A rule needed a file the config names and it is not there. */
11
+ E_INPUT_MISSING: 'E_INPUT_MISSING',
12
+ /** An `ap` command dispatches to a package that is not installed (a2a / mcp-protocol / evaluation / create-app). */
13
+ E_MODULE_ABSENT: 'E_MODULE_ABSENT',
14
+ /** The dispatched module is installed but does not export the function this CLI version expects. */
15
+ E_MODULE_SHAPE: 'E_MODULE_SHAPE',
16
+ /** Command-line usage error. */
17
+ E_USAGE: 'E_USAGE',
18
+ /** `ap upgrade` could not resolve a version for a package. */
19
+ E_RESOLVE: 'E_RESOLVE',
20
+ /** `ap upgrade` stops for review: a contract's authority or effects changed (398 §10.3). */
21
+ E_REVIEW_REQUIRED: 'E_REVIEW_REQUIRED',
22
+ /** `ap doctor --rules`: a projection target exists but carries no managed block. */
23
+ E_UNMANAGED_TARGET: 'E_UNMANAGED_TARGET',
24
+ };
25
+ export class DevkitError extends Error {
26
+ code;
27
+ constructor(code, message, options) {
28
+ super(message, options);
29
+ this.name = 'DevkitError';
30
+ this.code = code;
31
+ }
32
+ }
33
+ /** Process exit codes, fixed: 0 clean · 1 findings · 2 usage/config · 3 a rule or dispatch errored. */
34
+ export const EXIT = { OK: 0, FINDINGS: 1, USAGE: 2, ERROR: 3 };
35
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,iDAAiD;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,oHAAoH;IACpH,QAAQ,EAAE,UAAU;IACpB,8CAA8C;IAC9C,cAAc,EAAE,gBAAgB;IAChC,sGAAsG;IACtG,YAAY,EAAE,cAAc;IAC5B,iEAAiE;IACjE,eAAe,EAAE,iBAAiB;IAClC,oHAAoH;IACpH,eAAe,EAAE,iBAAiB;IAClC,oGAAoG;IACpG,cAAc,EAAE,gBAAgB;IAChC,gCAAgC;IAChC,OAAO,EAAE,SAAS;IAClB,8DAA8D;IAC9D,SAAS,EAAE,WAAW;IACtB,4FAA4F;IAC5F,iBAAiB,EAAE,mBAAmB;IACtC,oFAAoF;IACpF,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAGX,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAY;IACzB,YAAY,IAAe,EAAE,OAAe,EAAE,OAA6B;QACzE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC"}
package/dist/fs.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { existsSync } from 'node:fs';
2
+ export interface WalkOptions {
3
+ /** Directory names skipped at any depth. */
4
+ skipDirs?: ReadonlySet<string>;
5
+ /** File filter over the base name. */
6
+ file?: (name: string) => boolean;
7
+ }
8
+ /** Every file under `dir` (absolute paths), depth-first, deterministic order. Missing dir → []. */
9
+ export declare function walk(dir: string, opts?: WalkOptions): string[];
10
+ /** Repo-relative path with forward slashes — the form every finding prints. */
11
+ export declare function rel(root: string, abs: string): string;
12
+ /** Files git tracks under `subdir` (repo-relative), or `null` when `root` is not a git checkout. */
13
+ export declare function gitTracked(root: string, subdir: string): string[] | null;
14
+ export declare function readText(path: string): string;
15
+ export { existsSync as exists };
16
+ /** Strip block and line comments — code, not prose, is what a rule judges. */
17
+ export declare function stripComments(src: string): string;
18
+ /** True when a line is a comment line (//, *, /*) — doctrine references in prose are fine. */
19
+ export declare function isCommentLine(line: string): boolean;
20
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAuC,MAAM,SAAS,CAAC;AAI1E,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,sCAAsC;IACtC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAClC;AAID,mGAAmG;AACnG,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,MAAM,EAAE,CAYlE;AAED,+EAA+E;AAC/E,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,oGAAoG;AACpG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAQxE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC;AAEhC,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGnD"}
package/dist/fs.js ADDED
@@ -0,0 +1,54 @@
1
+ // Filesystem helpers shared by every rule. Rules never touch `node:fs` directly: they receive a `RuleContext`
2
+ // built from these, which is what makes a rule testable against a temp tree.
3
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
4
+ import { execFileSync } from 'node:child_process';
5
+ import { join, relative, sep } from 'node:path';
6
+ const DEFAULT_SKIP = new Set(['node_modules', 'dist', '.git', 'coverage', '.next', '.wrangler', '.turbo']);
7
+ /** Every file under `dir` (absolute paths), depth-first, deterministic order. Missing dir → []. */
8
+ export function walk(dir, opts = {}) {
9
+ const skip = opts.skipDirs ?? DEFAULT_SKIP;
10
+ const out = [];
11
+ if (!existsSync(dir))
12
+ return out;
13
+ for (const entry of readdirSync(dir).sort()) {
14
+ if (skip.has(entry))
15
+ continue;
16
+ const p = join(dir, entry);
17
+ const s = statSync(p);
18
+ if (s.isDirectory())
19
+ out.push(...walk(p, opts));
20
+ else if (!opts.file || opts.file(entry))
21
+ out.push(p);
22
+ }
23
+ return out;
24
+ }
25
+ /** Repo-relative path with forward slashes — the form every finding prints. */
26
+ export function rel(root, abs) {
27
+ return relative(root, abs).split(sep).join('/');
28
+ }
29
+ /** Files git tracks under `subdir` (repo-relative), or `null` when `root` is not a git checkout. */
30
+ export function gitTracked(root, subdir) {
31
+ if (!existsSync(join(root, '.git')))
32
+ return null;
33
+ try {
34
+ const out = execFileSync('git', ['ls-files', subdir], { cwd: root, encoding: 'utf8' });
35
+ return out.split('\n').map((l) => l.trim()).filter(Boolean);
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ export function readText(path) {
42
+ return readFileSync(path, 'utf8');
43
+ }
44
+ export { existsSync as exists };
45
+ /** Strip block and line comments — code, not prose, is what a rule judges. */
46
+ export function stripComments(src) {
47
+ return src.replace(/\/\*[\s\S]*?\*\//g, '').replace(/^\s*\/\/.*$/gm, '');
48
+ }
49
+ /** True when a line is a comment line (//, *, /*) — doctrine references in prose are fine. */
50
+ export function isCommentLine(line) {
51
+ const t = line.trim();
52
+ return t.startsWith('//') || t.startsWith('*') || t.startsWith('/*');
53
+ }
54
+ //# sourceMappingURL=fs.js.map
package/dist/fs.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,6EAA6E;AAC7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAShD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3G,mGAAmG;AACnG,MAAM,UAAU,IAAI,CAAC,GAAW,EAAE,OAAoB,EAAE;IACtD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,YAAY,CAAC;IAC3C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB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CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC;AAED,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const PACKAGE_NAME: "@agenticprimitives/devkit";
2
+ export declare const PACKAGE_STATUS: "w0-doctor-rules-upgrade";
3
+ export declare const SPEC_REF: "specs/399-repository-split-program.md";
4
+ export { ERROR_CODES, DevkitError, EXIT } from './errors.js';
5
+ export type { ErrorCode } from './errors.js';
6
+ export { redact } from './redact.js';
7
+ export { RING0_DOCTOR_CONFIG, mergeDoctorConfig, loadDoctorConfig } from './config.js';
8
+ export type { DoctorConfig, DoctorConfigOverrides, ConfigSource, LoadedConfig, Skippable, WhyEntry, KnobAllow } from './config.js';
9
+ export type { DoctorRule, RuleContext, RuleFinding, RuleOutcome, RuleResult, RuleStatus } from './rules/types.js';
10
+ export { DOCTOR_RULES, RULE_IDS } from './rules/index.js';
11
+ export type { RegisteredRule } from './rules/index.js';
12
+ export { runDoctor, makeRuleContext, formatDoctorReport } from './doctor.js';
13
+ export type { DoctorReport } from './doctor.js';
14
+ export { BUNDLED_RULES_DIR, RULES_BLOCK_START, RULES_BLOCK_END, ruleDigest, extractHardRules, loadRulesCorpus, rulesLockEntries, renderMdc, renderRulesBlock, replaceRulesBlock, projectRules, } from './rules-projection.js';
15
+ export type { RuleSidecarEntry, RulesSidecar, RuleSource, RulesCorpus, ProjectionResult, ProjectOptions } from './rules-projection.js';
16
+ export { readLock, writeLock } from './lock.js';
17
+ export type { AgenticLockV1 } from './lock.js';
18
+ export { workspaceGlobs, workspaceManifests } from './workspace.js';
19
+ export type { PackageManifest, WorkspaceManifest } from './workspace.js';
20
+ export { planUpgrade, applyUpgradePlan, formatUpgradePlan, npmDistTags } from './upgrade.js';
21
+ export type { UpgradeMode, UpgradeChange, UpgradePlan, DistTagResolver } from './upgrade.js';
22
+ export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, formatConformanceReport } from './dispatch.js';
23
+ export type { ConformanceCheck, ConformanceReport, ConformFn, LiveGatesRunner } from './dispatch.js';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAG,2BAAoC,CAAC;AACjE,eAAO,MAAM,cAAc,EAAG,yBAAkC,CAAC;AACjE,eAAO,MAAM,QAAQ,EAAG,uCAAgD,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;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AAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAChK,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ // @agenticprimitives/devkit — the Developer Kit core (spec 398 §10, spec 399 §3.3–3.6, ADR-0063 §1). The packages'
2
+ // own front door: `ap doctor` (the doctrine gates as data + pure rules), `ap doctor --rules` (one rules source
3
+ // projected by digest), `ap upgrade` (one coherent exact set), and thin dispatch to the packages that own
4
+ // conformance (`ap conform`) and live gates (`ap test`). Generic by construction (ADR-0021): the layout a rule
5
+ // judges is CONFIG; the reference layout ships so Ring 0's root checks have their twins.
6
+ export const PACKAGE_NAME = '@agenticprimitives/devkit';
7
+ export const PACKAGE_STATUS = 'w0-doctor-rules-upgrade';
8
+ export const SPEC_REF = 'specs/399-repository-split-program.md';
9
+ export { ERROR_CODES, DevkitError, EXIT } from './errors.js';
10
+ export { redact } from './redact.js';
11
+ export { RING0_DOCTOR_CONFIG, mergeDoctorConfig, loadDoctorConfig } from './config.js';
12
+ export { DOCTOR_RULES, RULE_IDS } from './rules/index.js';
13
+ export { runDoctor, makeRuleContext, formatDoctorReport } from './doctor.js';
14
+ export { BUNDLED_RULES_DIR, RULES_BLOCK_START, RULES_BLOCK_END, ruleDigest, extractHardRules, loadRulesCorpus, rulesLockEntries, renderMdc, renderRulesBlock, replaceRulesBlock, projectRules, } from './rules-projection.js';
15
+ export { readLock, writeLock } from './lock.js';
16
+ export { workspaceGlobs, workspaceManifests } from './workspace.js';
17
+ export { planUpgrade, applyUpgradePlan, formatUpgradePlan, npmDistTags } from './upgrade.js';
18
+ export { CONFORM_MODULES, LIVE_GATES_MODULE, CREATE_APP_MODULE, loadConform, loadLiveGatesRunner, loadCreateApp, formatConformanceReport } from './dispatch.js';
19
+ //# sourceMappingURL=index.js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1
+ import type { DoctorConfigOverrides } from './config.js';
2
+ export interface AgenticLockV1 {
3
+ lockVersion: 1;
4
+ /** Exact @agenticprimitives/* versions the product pins — one coherent set. */
5
+ packages: Record<string, string>;
6
+ /** sha256 digest per rule in the pinned rules source (399 §3.4). */
7
+ rules: Record<string, string>;
8
+ /** The devkit version that generated / last upgraded this lock. */
9
+ devkit?: string;
10
+ template?: {
11
+ name: string;
12
+ revision: string;
13
+ };
14
+ doctor?: DoctorConfigOverrides;
15
+ }
16
+ export declare function readLock(root: string): AgenticLockV1 | null;
17
+ export declare function writeLock(root: string, lock: AgenticLockV1): void;
18
+ //# sourceMappingURL=lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,CAAC,CAAC;IACf,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAI3D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAEjE"}
package/dist/lock.js ADDED
@@ -0,0 +1,15 @@
1
+ // `agentic.lock.json` — what a package-manager lock cannot pin (398 §10.4): the @agenticprimitives/* version set,
2
+ // the rules-source digests, the template revision, and the doctor config the product carries. W0 binds the first
3
+ // three; contract deployments, ontology closures and definition digests are later fields on the same document.
4
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ export function readLock(root) {
7
+ const p = join(root, 'agentic.lock.json');
8
+ if (!existsSync(p))
9
+ return null;
10
+ return JSON.parse(readFileSync(p, 'utf8'));
11
+ }
12
+ export function writeLock(root, lock) {
13
+ writeFileSync(join(root, 'agentic.lock.json'), `${JSON.stringify(lock, null, 2)}\n`);
14
+ }
15
+ //# sourceMappingURL=lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,iHAAiH;AACjH,+GAA+G;AAC/G,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAejC,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAkB,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAmB;IACzD,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function redact(text: string): string;
2
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3C"}
package/dist/redact.js ADDED
@@ -0,0 +1,14 @@
1
+ // Redacted output (398 §10.3 T22): a finding names WHERE a secret-shaped thing is, never WHAT it is. Every
2
+ // message that leaves `ap` passes through here, so a rule author cannot leak by accident.
3
+ // A digest is public and a person needs it (`record 0x…`); key material never reaches a message, this is depth.
4
+ const HEX_32 = /(?<!\b(?:digest|recorded|record)\s)0x[0-9a-fA-F]{64}/g;
5
+ // Long opaque tokens (a pasted bearer, a base64 blob); a `sha256:` / `0x` digest is spared — see HEX_32.
6
+ const LONG_TOKEN = /(?<![\w/.:-])(?!0x[0-9a-fA-F]{64}\b)[A-Za-z0-9_-]{48,}(?![\w/.-])/g;
7
+ const BEARER = /(bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi;
8
+ export function redact(text) {
9
+ return text
10
+ .replace(HEX_32, '0x…[redacted 32 bytes]')
11
+ .replace(BEARER, '$1[redacted]')
12
+ .replace(LONG_TOKEN, '[redacted]');
13
+ }
14
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,0FAA0F;AAC1F,gHAAgH;AAChH,MAAM,MAAM,GAAG,uDAAuD,CAAC;AACvE,yGAAyG;AACzG,MAAM,UAAU,GAAG,oEAAoE,CAAC;AACxF,MAAM,MAAM,GAAG,qCAAqC,CAAC;AAErD,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,IAAI;SACR,OAAO,CAAC,MAAM,EAAE,wBAAwB,CAAC;SACzC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC;SAC/B,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DoctorConfig } from '../config.js';
2
+ import type { DoctorRule } from './types.js';
3
+ export declare const archetypeCatalog: DoctorRule<DoctorConfig['archetypeCatalog']>;
4
+ //# sourceMappingURL=archetype-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetype-catalog.d.ts","sourceRoot":"","sources":["../../src/rules/archetype-catalog.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,YAAY,CAAC,kBAAkB,CAAC,CA4BzE,CAAC"}
@@ -0,0 +1,48 @@
1
+ // archetype-catalog — spec 354 §3 (twin of root check:archetype-catalog). The app-config catalog carries compiled
2
+ // AgentHarnessDefinitionV1 objects committed verbatim; each is re-validated against the Ring-0 schema and its
3
+ // digest re-derived against the recorded value. The catalog module is loaded by dynamic import; run under a
4
+ // TypeScript-capable runtime (node ≥ 22.18 strips types; `tsx` otherwise).
5
+ import { pathToFileURL } from 'node:url';
6
+ import { validateAgentHarnessDefinition, definitionDigest } from '@agenticprimitives/capability-claims';
7
+ export const archetypeCatalog = {
8
+ id: 'archetype-catalog',
9
+ spec: 'spec 354 §3',
10
+ twin: 'check:archetype-catalog',
11
+ describe: 'the compiled archetype catalog validates and carries its recorded digests',
12
+ async run(ctx, cfg) {
13
+ if (!ctx.exists(cfg.module))
14
+ return { status: 'error', summary: `catalog module ${cfg.module} is missing`, findings: [{ file: cfg.module, message: 'catalog module not found', tag: 'missing' }] };
15
+ let mod;
16
+ try {
17
+ mod = (await import(pathToFileURL(ctx.abs(cfg.module)).href));
18
+ }
19
+ catch (e) {
20
+ return { status: 'error', summary: `could not load ${cfg.module}: ${e.message}`, findings: [{ file: cfg.module, message: `module load failed (${e.message}) — run under a TypeScript-capable runtime`, tag: 'load' }] };
21
+ }
22
+ const catalog = mod[cfg.exportName];
23
+ if (!Array.isArray(catalog))
24
+ return { status: 'error', summary: `${cfg.module} does not export an array named ${cfg.exportName}`, findings: [{ file: cfg.module, message: `no array export ${cfg.exportName}`, tag: 'shape' }] };
25
+ const findings = [];
26
+ const notes = [];
27
+ for (const entry of catalog) {
28
+ const v = validateAgentHarnessDefinition(entry.definition);
29
+ if (!v.ok) {
30
+ findings.push({ file: cfg.module, message: `${entry.key}: definition invalid — ${v.errors.join('; ')}`, tag: 'invalid' });
31
+ continue;
32
+ }
33
+ const digest = definitionDigest(entry.definition);
34
+ const want = cfg.expected[entry.key];
35
+ if (want === undefined) {
36
+ findings.push({ file: cfg.module, message: `${entry.key}: no recorded expected digest — record ${digest} after reviewing the change`, tag: 'unrecorded' });
37
+ continue;
38
+ }
39
+ if (digest !== want) {
40
+ findings.push({ file: cfg.module, message: `${entry.key}: digest ${digest} ≠ recorded ${want} — the definition changed; update the record if intended`, tag: 'drift' });
41
+ continue;
42
+ }
43
+ notes.push(`${entry.key} (${entry.definition.archetypeId} v${entry.definition.archetypeVersion}) ${digest}`);
44
+ }
45
+ return { summary: findings.length ? `${findings.length} catalog problem(s)` : `${catalog.length} archetype(s) validated at their recorded digests`, findings, notes };
46
+ },
47
+ };
48
+ //# sourceMappingURL=archetype-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetype-catalog.js","sourceRoot":"","sources":["../../src/rules/archetype-catalog.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,8GAA8G;AAC9G,4GAA4G;AAC5G,2EAA2E;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,gBAAgB,EAAiC,MAAM,sCAAsC,CAAC;AAMvI,MAAM,CAAC,MAAM,gBAAgB,GAAiD;IAC5E,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,yBAAyB;IAC/B,QAAQ,EAAE,2EAA2E;IACrF,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG;QAChB,IAAI,CAAC,GAAG,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C;QACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,qBAAqB,CAAC,CAAC,CAAC,GAAI,OAAqB,CAAC,MAAM,mDAAmD,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACvL,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DoctorConfig } from '../config.js';
2
+ import type { DoctorRule } from './types.js';
3
+ export declare const capabilityVocabulary: DoctorRule<DoctorConfig['capabilityVocabulary']>;
4
+ //# sourceMappingURL=capability-vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-vocabulary.d.ts","sourceRoot":"","sources":["../../src/rules/capability-vocabulary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,oBAAoB,EAAE,UAAU,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAoCjF,CAAC"}
@@ -0,0 +1,56 @@
1
+ // capability-vocabulary — ADR-0051 (twin of root check:capability-vocabulary, the product-source half). Three
2
+ // names, one meaning each: capability (what an agent can do) · protocol features (A2A's streaming/push flags) ·
3
+ // skill (a SKILL.md playbook). `skills[]` is the A2A wire word and is legitimate only where config says the wire
4
+ // is written or shown raw.
5
+ import { globSync } from 'node:fs';
6
+ export const capabilityVocabulary = {
7
+ id: 'capability-vocabulary',
8
+ spec: 'ADR-0051',
9
+ twin: 'check:capability-vocabulary',
10
+ describe: 'capability · protocol features · playbook stay distinct in product source',
11
+ run(ctx, cfg) {
12
+ const findings = [];
13
+ const allowed = (file) => cfg.wireAllowed.some((p) => file.startsWith(p));
14
+ const scan = (patterns, check, tag) => {
15
+ for (const file of globSync(patterns, { cwd: ctx.root })) {
16
+ if (file.includes('node_modules') || file.includes('/dist/'))
17
+ continue;
18
+ if (allowed(file))
19
+ continue;
20
+ let src;
21
+ try {
22
+ src = ctx.read(file);
23
+ }
24
+ catch {
25
+ continue;
26
+ }
27
+ src.split('\n').forEach((line, i) => {
28
+ const why = check(line);
29
+ if (why)
30
+ findings.push({ file, line: i + 1, message: why, tag });
31
+ });
32
+ }
33
+ };
34
+ scan(cfg.homeGlobs, (line) => {
35
+ if (/\/\/|\/\*|\*/.test(line.trimStart().slice(0, 2)))
36
+ return null;
37
+ const m = /(?:label|title|placeholder|aria-label|heading|name):\s*['"`]([^'"`]*\bSkills?\b[^'"`]*)['"`]/i.exec(line)
38
+ ?? />\s*(Skills)\s*</.exec(line)
39
+ ?? /,\s*['"`](Skills?)['"`]\s*,/.exec(line);
40
+ if (!m)
41
+ return null;
42
+ if (/playbook/i.test(line))
43
+ return null;
44
+ return 'user-visible "Skills" — say Capabilities (or Playbook, if that is what it is)';
45
+ }, 'user-visible');
46
+ scan([cfg.packagesGlob], (line) => {
47
+ if (/^\s*(\/\/|\*|\/\*)/.test(line))
48
+ return null;
49
+ if (!/^\s*(?:readonly\s+)?skills\??\s*:/.test(line))
50
+ return null;
51
+ return 'a `skills` field outside the A2A wire — the field is `capabilities`';
52
+ }, 'field');
53
+ return { summary: findings.length ? `${findings.length} vocabulary drift(s)` : 'capability / protocol features / playbook stay distinct', findings };
54
+ },
55
+ };
56
+ //# sourceMappingURL=capability-vocabulary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-vocabulary.js","sourceRoot":"","sources":["../../src/rules/capability-vocabulary.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,gHAAgH;AAChH,iHAAiH;AACjH,2BAA2B;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,MAAM,CAAC,MAAM,oBAAoB,GAAqD;IACpF,EAAE,EAAE,uBAAuB;IAC3B,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,6BAA6B;IACnC,QAAQ,EAAE,2EAA2E;IACrF,GAAG,CAAC,GA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AK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;YACnE,MAAM,CAAC,GAAG,+FAA+F,CAAC,IAAI,CAAC,IAAI,CAAC;mBAC/G,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;mBAC7B,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,IAAI,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;YACpB,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACxC,OAAO,+EAA+E,CAAC;QACzF,CAAC,EAAE,cAAc,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;YAChC,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACjD,IAAI,CAAC,mCAAmC,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACjE,OAAO,qEAAqE,CAAC;QAC/E,CAAC,EAAE,OAAO,CAAC,CAAC;QACZ,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,sBAAsB,CAAC,CAAC,CAAC,yDAAyD,EAAE,QAAQ,EAAE,CAAC;IACvJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DoctorConfig } from '../config.js';
2
+ import type { DoctorRule } from './types.js';
3
+ export declare const custodianCoverage: DoctorRule<DoctorConfig['custodianCoverage']>;
4
+ //# sourceMappingURL=custodian-coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custodian-coverage.d.ts","sourceRoot":"","sources":["../../src/rules/custodian-coverage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAkC3E,CAAC"}
@@ -0,0 +1,47 @@
1
+ export const custodianCoverage = {
2
+ id: 'custodian-coverage',
3
+ spec: 'specs 294 / 295',
4
+ twin: 'check:custodian-coverage',
5
+ describe: 'provider-neutral custodian; the Home offers every custody class; relying apps delegate',
6
+ run(ctx, cfg) {
7
+ const findings = [];
8
+ if (!ctx.exists(cfg.matrix))
9
+ findings.push({ file: cfg.matrix, message: 'the custodian coverage matrix is missing', tag: 'matrix' });
10
+ else {
11
+ const m = ctx.read(cfg.matrix).toLowerCase();
12
+ for (const kind of cfg.matrixKinds)
13
+ if (!m.includes(kind))
14
+ findings.push({ file: cfg.matrix, message: `the matrix does not mention the '${kind}' custody kind`, tag: 'matrix' });
15
+ }
16
+ if (ctx.exists(cfg.homeVia)) {
17
+ const decl = ctx.read(cfg.homeVia).match(/type Via\s*=\s*([^;]+);/)?.[1] ?? '';
18
+ for (const req of cfg.viaRequired)
19
+ if (!new RegExp(`'${req}'`).test(decl))
20
+ findings.push({ file: cfg.homeVia, message: `the Home \`Via\` type is missing '${req}'`, tag: 'via' });
21
+ if (!cfg.viaSocialAny.some((s) => new RegExp(`'${s}'`).test(decl)))
22
+ findings.push({ file: cfg.homeVia, message: `the Home \`Via\` type offers no SOCIAL custody kind (${cfg.viaSocialAny.join('/')})`, tag: 'via' });
23
+ }
24
+ else
25
+ findings.push({ file: cfg.homeVia, message: 'not found — cannot verify the Home custody surface', tag: 'via' });
26
+ const usesClient = ctx.exists(cfg.relyingApp.dir) && cfg.relyingApp.entryFiles.some((f) => {
27
+ const p = `${cfg.relyingApp.dir}/${f}`;
28
+ return ctx.exists(p) && ctx.read(p).includes(cfg.relyingApp.mustImport);
29
+ });
30
+ if (!usesClient)
31
+ findings.push({ file: cfg.relyingApp.dir, message: `the relying app must hand custody off through ${cfg.relyingApp.mustImport}`, tag: 'relying' });
32
+ const providerRe = new RegExp(`['"\`]\\/(?:a2a\\/)?custody\\/(${cfg.providerNamedCustody.join('|')})\\/`);
33
+ const skip = new Set(['node_modules', 'dist', '.wrangler', 'server', 'functions']);
34
+ for (const app of cfg.browserApps) {
35
+ const src = `${app}/src`;
36
+ if (!ctx.exists(src))
37
+ continue;
38
+ for (const abs of ctx.walk(src, { skipDirs: skip, file: (n) => /\.(ts|tsx)$/.test(n) })) {
39
+ const hit = ctx.read(ctx.rel(abs)).match(providerRe);
40
+ if (hit)
41
+ findings.push({ file: ctx.rel(abs), message: `references a PROVIDER-NAMED custody path (${hit[1]}); use the generic /custody/oidc/*`, tag: 'provider-named' });
42
+ }
43
+ }
44
+ return { summary: findings.length ? `${findings.length} custodian-coverage problem(s)` : 'custodian provider-neutral; Home offers every custody class; relying apps delegate', findings };
45
+ },
46
+ };
47
+ //# sourceMappingURL=custodian-coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custodian-coverage.js","sourceRoot":"","sources":["../../src/rules/custodian-coverage.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,iBAAiB,GAAkD;IAC9E,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,0BAA0B;IAChC,QAAQ,EAAE,wFAAwF;IAClG,GAAG,CAAC,GAAG,EAAE,GAAG;QACV,MAAM,QAAQ,GAAkB,EAAE,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,0CAA0C,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;aAChI,CAAC;YACJ,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;YAC7C,KAAK,MAAM,IAAI,IAA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C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;gBACxF,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACrD,IAAI,GAAG;oBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,6CAA6C,GAAG,CAAC,CAAC,CAAC,oCAAoC,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,CAAC;YAC1K,CAAC;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,gCAAgC,CAAC,CAAC,CAAC,oFAAoF,EAAE,QAAQ,EAAE,CAAC;IAC5L,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DoctorConfig } from '../config.js';
2
+ import type { DoctorRule } from './types.js';
3
+ export declare const demoPersonOrgDistinct: DoctorRule<DoctorConfig['demoPersonOrgDistinct']>;
4
+ //# sourceMappingURL=demo-person-org-distinct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-person-org-distinct.d.ts","sourceRoot":"","sources":["../../src/rules/demo-person-org-distinct.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAI1D,eAAO,MAAM,qBAAqB,EAAE,UAAU,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAmBnF,CAAC"}