@rexezuge/cli 0.0.0-stage → 1.14.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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +142 -2
  3. package/dist/args.d.ts +22 -0
  4. package/dist/args.d.ts.map +1 -0
  5. package/dist/args.js +1 -0
  6. package/dist/args.js.map +7 -0
  7. package/dist/bin.d.ts +3 -0
  8. package/dist/bin.d.ts.map +1 -0
  9. package/dist/bin.js +2 -0
  10. package/dist/bin.js.map +7 -0
  11. package/dist/cli.d.ts +13 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +18 -0
  14. package/dist/cli.js.map +7 -0
  15. package/dist/commands/doctor.d.ts +8 -0
  16. package/dist/commands/doctor.d.ts.map +1 -0
  17. package/dist/commands/doctor.js +1 -0
  18. package/dist/commands/doctor.js.map +7 -0
  19. package/dist/commands/godFiles.d.ts +7 -0
  20. package/dist/commands/godFiles.d.ts.map +1 -0
  21. package/dist/commands/godFiles.js +1 -0
  22. package/dist/commands/godFiles.js.map +7 -0
  23. package/dist/commands/identity.d.ts +26 -0
  24. package/dist/commands/identity.d.ts.map +1 -0
  25. package/dist/commands/identity.js +4 -0
  26. package/dist/commands/identity.js.map +7 -0
  27. package/dist/commands/locales.d.ts +7 -0
  28. package/dist/commands/locales.d.ts.map +1 -0
  29. package/dist/commands/locales.js +1 -0
  30. package/dist/commands/locales.js.map +7 -0
  31. package/dist/commands/migrations.d.ts +7 -0
  32. package/dist/commands/migrations.d.ts.map +1 -0
  33. package/dist/commands/migrations.js +1 -0
  34. package/dist/commands/migrations.js.map +7 -0
  35. package/dist/commands/scripts.d.ts +25 -0
  36. package/dist/commands/scripts.d.ts.map +1 -0
  37. package/dist/commands/scripts.js +1 -0
  38. package/dist/commands/scripts.js.map +7 -0
  39. package/dist/commands/spaShell.d.ts +7 -0
  40. package/dist/commands/spaShell.d.ts.map +1 -0
  41. package/dist/commands/spaShell.js +1 -0
  42. package/dist/commands/spaShell.js.map +7 -0
  43. package/dist/commands/sync.d.ts +7 -0
  44. package/dist/commands/sync.d.ts.map +1 -0
  45. package/dist/commands/sync.js +1 -0
  46. package/dist/commands/sync.js.map +7 -0
  47. package/dist/doctor/checks/catalog.d.ts +16 -0
  48. package/dist/doctor/checks/catalog.d.ts.map +1 -0
  49. package/dist/doctor/checks/catalog.js +1 -0
  50. package/dist/doctor/checks/catalog.js.map +7 -0
  51. package/dist/doctor/checks/files.d.ts +8 -0
  52. package/dist/doctor/checks/files.d.ts.map +1 -0
  53. package/dist/doctor/checks/files.js +1 -0
  54. package/dist/doctor/checks/files.js.map +7 -0
  55. package/dist/doctor/checks/manifest.d.ts +3 -0
  56. package/dist/doctor/checks/manifest.d.ts.map +1 -0
  57. package/dist/doctor/checks/manifest.js +1 -0
  58. package/dist/doctor/checks/manifest.js.map +7 -0
  59. package/dist/doctor/checks/presets.d.ts +7 -0
  60. package/dist/doctor/checks/presets.d.ts.map +1 -0
  61. package/dist/doctor/checks/presets.js +1 -0
  62. package/dist/doctor/checks/presets.js.map +7 -0
  63. package/dist/doctor/checks/vendored.d.ts +25 -0
  64. package/dist/doctor/checks/vendored.d.ts.map +1 -0
  65. package/dist/doctor/checks/vendored.js +1 -0
  66. package/dist/doctor/checks/vendored.js.map +7 -0
  67. package/dist/doctor/extensions.d.ts +26 -0
  68. package/dist/doctor/extensions.d.ts.map +1 -0
  69. package/dist/doctor/extensions.js +1 -0
  70. package/dist/doctor/extensions.js.map +7 -0
  71. package/dist/doctor/registry.d.ts +7 -0
  72. package/dist/doctor/registry.d.ts.map +1 -0
  73. package/dist/doctor/registry.js +1 -0
  74. package/dist/doctor/registry.js.map +7 -0
  75. package/dist/doctor/run.d.ts +13 -0
  76. package/dist/doctor/run.d.ts.map +1 -0
  77. package/dist/doctor/run.js +1 -0
  78. package/dist/doctor/run.js.map +7 -0
  79. package/dist/doctor/types.d.ts +75 -0
  80. package/dist/doctor/types.d.ts.map +1 -0
  81. package/dist/doctor/types.js +0 -0
  82. package/dist/doctor/types.js.map +7 -0
  83. package/dist/index.d.ts +18 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +1 -0
  86. package/dist/index.js.map +7 -0
  87. package/dist/io.d.ts +22 -0
  88. package/dist/io.d.ts.map +1 -0
  89. package/dist/io.js +3 -0
  90. package/dist/io.js.map +7 -0
  91. package/dist/repo-json.d.ts +6 -0
  92. package/dist/repo-json.d.ts.map +1 -0
  93. package/dist/repo-json.js +1 -0
  94. package/dist/repo-json.js.map +7 -0
  95. package/dist/repo.d.ts +37 -0
  96. package/dist/repo.d.ts.map +1 -0
  97. package/dist/repo.js +1 -0
  98. package/dist/repo.js.map +7 -0
  99. package/dist/sync/fixes.d.ts +12 -0
  100. package/dist/sync/fixes.d.ts.map +1 -0
  101. package/dist/sync/fixes.js +6 -0
  102. package/dist/sync/fixes.js.map +7 -0
  103. package/dist/sync/plan.d.ts +46 -0
  104. package/dist/sync/plan.d.ts.map +1 -0
  105. package/dist/sync/plan.js +3 -0
  106. package/dist/sync/plan.js.map +7 -0
  107. package/dist/sync/run.d.ts +24 -0
  108. package/dist/sync/run.d.ts.map +1 -0
  109. package/dist/sync/run.js +1 -0
  110. package/dist/sync/run.js.map +7 -0
  111. package/dist/sync/workflows.d.ts +8 -0
  112. package/dist/sync/workflows.d.ts.map +1 -0
  113. package/dist/sync/workflows.js +1 -0
  114. package/dist/sync/workflows.js.map +7 -0
  115. package/dist/version.d.ts +14 -0
  116. package/dist/version.d.ts.map +1 -0
  117. package/dist/version.js +1 -0
  118. package/dist/version.js.map +7 -0
  119. package/dist/workflow-callers.d.ts +26 -0
  120. package/dist/workflow-callers.d.ts.map +1 -0
  121. package/dist/workflow-callers.js +34 -0
  122. package/dist/workflow-callers.js.map +7 -0
  123. package/dist/workspace-yaml.d.ts +28 -0
  124. package/dist/workspace-yaml.d.ts.map +1 -0
  125. package/dist/workspace-yaml.js +12 -0
  126. package/dist/workspace-yaml.js.map +7 -0
  127. package/package.json +47 -3
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/spaShell.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { ensureSpaShellStub, verifySpaShell } from '@rexezuge/tooling/scripts/spa-shell';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge spa-shell ensure|verify`: write the empty stub when absent, or fail on a missing, stubbed\n * or half-refreshed shell. `verify` needs the build to have run first.\n */\nexport function spaShellCommand(args: readonly string[], io: Io): number {\n const { cwd, json, positionals } = parseCommand(args, {} as const);\n const [mode, ...extra] = positionals;\n if ((mode !== 'ensure' && mode !== 'verify') || extra.length > 0) throw new UsageError('usage: rexezuge spa-shell <ensure|verify>');\n if (mode === 'ensure') {\n const result = ensureSpaShellStub({ root: cwd });\n const file = path.relative(cwd, result.path);\n if (json) io.out(JSON.stringify({ ok: true, created: result.created, path: file }, null, 2));\n else io.out(result.created ? `created stub at ${file}` : `${file} already present, left untouched`);\n return 0;\n }\n const { problems } = verifySpaShell({ root: cwd });\n if (json) io.out(JSON.stringify({ ok: problems.length === 0, problems }, null, 2));\n else if (problems.length === 0) io.out('SPA shell check passed.');\n else {\n io.err('SPA shell check failed:');\n for (const problem of problems) io.err(` - ${problem}`);\n }\n return problems.length === 0 ? 0 : 1;\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,sBAAAC,EAAoB,kBAAAC,MAAsB,sCACnD,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAOrB,SAAUC,EAAgBC,EAAyBC,EAAM,CAC7D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,YAAAC,CAAW,EAAKP,EAAaG,EAAM,CAAA,CAAW,EAC3D,CAACK,EAAM,GAAGC,CAAK,EAAIF,EACzB,GAAKC,IAAS,UAAYA,IAAS,UAAaC,EAAM,OAAS,EAAG,MAAM,IAAIR,EAAW,2CAA2C,EAClI,GAAIO,IAAS,SAAU,CACrB,MAAME,EAASZ,EAAmB,CAAE,KAAMO,CAAG,CAAE,EACzCM,EAAOd,EAAK,SAASQ,EAAKK,EAAO,IAAI,EAC3C,OAAIJ,EAAMF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAI,GAAM,QAASM,EAAO,QAAS,KAAMC,CAAI,EAAI,KAAM,CAAC,CAAC,EACtFP,EAAG,IAAIM,EAAO,QAAU,mBAAmBC,CAAI,GAAK,GAAGA,CAAI,kCAAkC,EAC3F,CACT,CACA,KAAM,CAAE,SAAAC,CAAQ,EAAKb,EAAe,CAAE,KAAMM,CAAG,CAAE,EACjD,GAAIC,EAAMF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAIQ,EAAS,SAAW,EAAG,SAAAA,CAAQ,EAAI,KAAM,CAAC,CAAC,UACxEA,EAAS,SAAW,EAAGR,EAAG,IAAI,yBAAyB,MAC3D,CACHA,EAAG,IAAI,yBAAyB,EAChC,UAAWS,KAAWD,EAAUR,EAAG,IAAI,OAAOS,CAAO,EAAE,CACzD,CACA,OAAOD,EAAS,SAAW,EAAI,EAAI,CACrC,CAnBgBE,EAAAZ,EAAA",
6
+ "names": ["path", "ensureSpaShellStub", "verifySpaShell", "parseCommand", "UsageError", "spaShellCommand", "args", "io", "cwd", "json", "positionals", "mode", "extra", "result", "file", "problems", "problem", "__name"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * `rexezuge sync [--write] [--json]`: the repairs for what doctor found. A dry run unless `--write`.
4
+ * Exit 0 when nothing failed to apply; 1 when an auto-fixable check was left failing (see `unfixed`).
5
+ */
6
+ export declare function syncCommand(args: readonly string[], io: Io): Promise<number>;
7
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlF"}
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var n=(r,t)=>i(r,"name",{value:t,configurable:!0});import{parseCommand as l}from"../args.js";import{runSync as d}from"../sync/run.js";async function h(r,t){const{cwd:s,json:a,values:c}=l(r,{write:{type:"boolean"}}),e=await d(s,c.write===!0);if(a)t.out(JSON.stringify({...e,before:e.before.score,after:e.after?.score??null},null,2));else{t.out(`rexezuge sync ${e.write?"--write":"(dry run; pass --write to apply)"}: ${e.root}`);for(const o of e.changes){const f=o.op==="write"?` (+${o.added??0} -${o.removed??0})`:"",u={write:"M",symlink:"L",delete:"D"}[o.op];t.out(` ${u} ${o.path}${f}: ${o.note}`)}e.changes.length===0&&t.out(" nothing to change");for(const o of e.unfixed)t.out(` ! ${o}: needs a human (the file is repo code, not a safe replacement)`);t.out(`Score: ${e.before.score}${e.after===null?"":` -> ${e.after.score}`}/100`)}return e.unfixed.length>0?1:0}n(h,"syncCommand");export{h as syncCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/sync.ts"],
4
+ "sourcesContent": ["import { parseCommand } from '../args.ts';\nimport { runSync } from '../sync/run.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge sync [--write] [--json]`: the repairs for what doctor found. A dry run unless `--write`.\n * Exit 0 when nothing failed to apply; 1 when an auto-fixable check was left failing (see `unfixed`).\n */\nexport async function syncCommand(args: readonly string[], io: Io): Promise<number> {\n const { cwd, json, values } = parseCommand(args, { write: { type: 'boolean' } } as const);\n const result = await runSync(cwd, values.write === true);\n if (json) {\n io.out(JSON.stringify({ ...result, before: result.before.score, after: result.after?.score ?? null }, null, 2));\n } else {\n io.out(`rexezuge sync ${result.write ? '--write' : '(dry run; pass --write to apply)'}: ${result.root}`);\n for (const change of result.changes) {\n const stat = change.op === 'write' ? ` (+${change.added ?? 0} -${change.removed ?? 0})` : '';\n const mark = { write: 'M', symlink: 'L', delete: 'D' }[change.op];\n io.out(` ${mark} ${change.path}${stat}: ${change.note}`);\n }\n if (result.changes.length === 0) io.out(' nothing to change');\n for (const id of result.unfixed) io.out(` ! ${id}: needs a human (the file is repo code, not a safe replacement)`);\n io.out(`Score: ${result.before.score}${result.after === null ? '' : ` -> ${result.after.score}`}/100`);\n }\n return result.unfixed.length > 0 ? 1 : 0;\n}\n"],
5
+ "mappings": "+EAAA,OAAS,gBAAAA,MAAoB,aAC7B,OAAS,WAAAC,MAAe,iBAOxB,eAAsBC,EAAYC,EAAyBC,EAAM,CAC/D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,OAAAC,CAAM,EAAKP,EAAaG,EAAM,CAAE,MAAO,CAAE,KAAM,SAAS,CAAE,CAAW,EAClFK,EAAS,MAAMP,EAAQI,EAAKE,EAAO,QAAU,EAAI,EACvD,GAAID,EACFF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAGI,EAAQ,OAAQA,EAAO,OAAO,MAAO,MAAOA,EAAO,OAAO,OAAS,IAAI,EAAI,KAAM,CAAC,CAAC,MACzG,CACLJ,EAAG,IAAI,iBAAiBI,EAAO,MAAQ,UAAY,kCAAkC,KAAKA,EAAO,IAAI,EAAE,EACvG,UAAWC,KAAUD,EAAO,QAAS,CACnC,MAAME,EAAOD,EAAO,KAAO,QAAU,MAAMA,EAAO,OAAS,CAAC,KAAKA,EAAO,SAAW,CAAC,IAAM,GACpFE,EAAO,CAAE,MAAO,IAAK,QAAS,IAAK,OAAQ,GAAG,EAAGF,EAAO,EAAE,EAChEL,EAAG,IAAI,KAAKO,CAAI,IAAIF,EAAO,IAAI,GAAGC,CAAI,KAAKD,EAAO,IAAI,EAAE,CAC1D,CACID,EAAO,QAAQ,SAAW,GAAGJ,EAAG,IAAI,qBAAqB,EAC7D,UAAWQ,KAAMJ,EAAO,QAASJ,EAAG,IAAI,OAAOQ,CAAE,iEAAiE,EAClHR,EAAG,IAAI,UAAUI,EAAO,OAAO,KAAK,GAAGA,EAAO,QAAU,KAAO,GAAK,OAAOA,EAAO,MAAM,KAAK,EAAE,MAAM,CACvG,CACA,OAAOA,EAAO,QAAQ,OAAS,EAAI,EAAI,CACzC,CAjBsBK,EAAAX,EAAA",
6
+ "names": ["parseCommand", "runSync", "syncCommand", "args", "io", "cwd", "json", "values", "result", "change", "stat", "mark", "id", "__name"]
7
+ }
@@ -0,0 +1,16 @@
1
+ import type { Repo } from '../../repo.ts';
2
+ import type { Check } from '../types.ts';
3
+ /**
4
+ * Every `@rexezuge/*` dependency edge in the repo: package.json path, dependency name, spec.
5
+ */
6
+ export declare function kitEdges(repo: Repo): Array<{
7
+ file: string;
8
+ name: string;
9
+ spec: string;
10
+ }>;
11
+ /**
12
+ * The single version the lockfile resolves each kit package to, from the `packages:` section keys.
13
+ */
14
+ export declare function lockfileVersions(lockfile: string): Map<string, Set<string>>;
15
+ export declare const catalogChecks: readonly Check[];
16
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAExF;AAsBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAO3E;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,KAAK,EAoFzC,CAAC"}
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var n=(o,e)=>d(o,"name",{value:e,configurable:!0});import{kitDependencies as k}from"../../repo.js";import{atLeastMinor as m,CLI_VERSION as l,parseVersion as p}from"../../version.js";function u(o){return o.packages.flatMap(e=>[...k(e.json)].map(([t,r])=>({file:e.path,name:t,spec:r})))}n(u,"kitEdges");function h(o){const e=new Set(o.workspace?.catalog.keys());for(const t of o.workspace?.namedCatalogs.values()??[])for(const r of t.keys())e.add(r);return e}n(h,"catalogNames");const c=n(o=>o.startsWith("@rexezuge/"),"isKit");function v(o){const e=[...o.workspace?.overrides.keys()??[]].filter(c).map(t=>`pnpm-workspace.yaml: overrides ${t}`);for(const t of o.packages){const r=t.json?.pnpm?.overrides,s=t.json?.overrides;for(const a of[r,s])for(const i of Object.keys(a??{}))c(i)&&e.push(`${t.path}: overrides ${i}`)}return e}n(v,"overridePins");function x(o){const e=new Map;for(const t of o.matchAll(/^ {2}'?(@rexezuge\/[a-z0-9-]+)@(\d[^':(\s]*)'?:/gm)){const[,r="",s=""]=t;e.set(r,(e.get(r)??new Set).add(s))}return e}n(x,"lockfileVersions");const $=[{id:"catalog.present",severity:"error",title:"pnpm-workspace.yaml has a catalog entry for every @rexezuge/* package",message:"The pnpm catalog does not name every @rexezuge/* dependency, so versions are not held in one place.",fix:"Add the packages under `catalog:` in pnpm-workspace.yaml (rexezuge sync --write).",autoFixable:!0,run:n(o=>{const e=new Set(u(o).filter(s=>!s.spec.startsWith("workspace:")).map(s=>s.name));if(e.size===0)return{skipped:"no @rexezuge/* dependencies"};if(o.workspace===null)return{ok:!1,details:["pnpm-workspace.yaml not found"]};const t=h(o),r=[...e].filter(s=>!t.has(s)).sort((s,a)=>s.localeCompare(a));return r.length===0?{ok:!0}:{ok:!1,details:r.map(s=>`${s} is not in the catalog`)}},"run")},{id:"catalog.no-overrides",severity:"error",title:"Nothing pins @rexezuge/* through overrides",message:"An overrides pin hides the real dependency graph and drifts from the catalog.",fix:"Delete the @rexezuge/* entries from `overrides` (pnpm-workspace.yaml, package.json pnpm.overrides).",autoFixable:!0,run:n(o=>{const e=v(o);return e.length===0?{ok:!0}:{ok:!1,details:e}},"run")},{id:"catalog.protocol",severity:"error",title:"Every package.json uses `catalog:` for @rexezuge/*",message:"Some @rexezuge/* dependencies carry their own version range.",fix:"Replace the range with `catalog:` (rexezuge sync --write).",autoFixable:!0,run:n(o=>{const e=u(o).filter(t=>!t.spec.startsWith("catalog:")&&!t.spec.startsWith("workspace:"));return e.length===0?{ok:!0}:{ok:!1,details:e.map(t=>`${t.file}: ${t.name} is "${t.spec}"`)}},"run")},{id:"lockfile.single-version",severity:"error",title:"The lockfile resolves each @rexezuge/* package to a single version",message:"The lockfile holds more than one version of a kit package, or the packages are not in lockstep.",fix:"Align the catalog, then reinstall (pnpm install) so the lockfile collapses to one version.",autoFixable:!1,run:n(o=>{const e=o.read("pnpm-lock.yaml");if(e===null)return{skipped:"no pnpm-lock.yaml"};const t=x(e);if(t.size===0)return{skipped:"no @rexezuge/* in the lockfile"};const r=[...t].filter(([,a])=>a.size>1).map(([a,i])=>`${a}: ${[...i].sort((g,f)=>g.localeCompare(f)).join(", ")}`),s=new Set([...t.values()].flatMap(a=>[...a]));return r.length===0&&s.size>1&&r.push(`packages are not in lockstep: ${[...s].sort((a,i)=>a.localeCompare(i)).join(", ")}`),r.length===0?{ok:!0}:{ok:!1,details:r}},"run")},{id:"sdk.current",severity:"warn",title:"The SDK version is at least the minor this CLI knows",message:`The catalog pins an SDK older than ${l}.`,fix:"Bump the @rexezuge/* catalog entries and run the codemods (pnpm exec rexezuge sync --write).",autoFixable:!1,run:n(o=>{const e=[...o.workspace?.catalog??[]].filter(([s])=>c(s)).map(([s,a])=>({name:s,spec:a})),t=p(l);if(e.length===0||t===null)return{skipped:"no catalog versions"};const r=e.filter(({spec:s})=>{const a=p(s);return a!==null&&!m(a,t)});return r.length===0?{ok:!0}:{ok:!1,details:r.map(({name:s,spec:a})=>`${s} ${a} < ${l}`)}},"run")}];export{$ as catalogChecks,u as kitEdges,x as lockfileVersions};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/doctor/checks/catalog.ts"],
4
+ "sourcesContent": ["import { kitDependencies } from '../../repo.ts';\nimport type { Repo } from '../../repo.ts';\nimport { atLeastMinor, CLI_VERSION, parseVersion } from '../../version.ts';\nimport type { Check } from '../types.ts';\n\n/**\n * Every `@rexezuge/*` dependency edge in the repo: package.json path, dependency name, spec.\n */\nexport function kitEdges(repo: Repo): Array<{ file: string; name: string; spec: string }> {\n return repo.packages.flatMap((pkg) => [...kitDependencies(pkg.json)].map(([name, spec]) => ({ file: pkg.path, name, spec })));\n}\n\nfunction catalogNames(repo: Repo): Set<string> {\n const names = new Set(repo.workspace?.catalog.keys());\n for (const named of repo.workspace?.namedCatalogs.values() ?? []) for (const name of named.keys()) names.add(name);\n return names;\n}\n\nconst isKit = (name: string): boolean => name.startsWith('@rexezuge/');\n\nfunction overridePins(repo: Repo): string[] {\n const pins = [...(repo.workspace?.overrides.keys() ?? [])].filter(isKit).map((key) => `pnpm-workspace.yaml: overrides ${key}`);\n for (const pkg of repo.packages) {\n const nested = (pkg.json?.['pnpm'] as { overrides?: Record<string, unknown> } | undefined)?.overrides;\n const flat = pkg.json?.['overrides'] as Record<string, unknown> | undefined;\n for (const block of [nested, flat]) {\n for (const key of Object.keys(block ?? {})) if (isKit(key)) pins.push(`${pkg.path}: overrides ${key}`);\n }\n }\n return pins;\n}\n\n/**\n * The single version the lockfile resolves each kit package to, from the `packages:` section keys.\n */\nexport function lockfileVersions(lockfile: string): Map<string, Set<string>> {\n const found = new Map<string, Set<string>>();\n for (const match of lockfile.matchAll(/^ {2}'?(@rexezuge\\/[a-z0-9-]+)@(\\d[^':(\\s]*)'?:/gm)) {\n const [, name = '', version = ''] = match;\n found.set(name, (found.get(name) ?? new Set()).add(version));\n }\n return found;\n}\n\nexport const catalogChecks: readonly Check[] = [\n {\n id: 'catalog.present',\n severity: 'error',\n title: 'pnpm-workspace.yaml has a catalog entry for every @rexezuge/* package',\n message: 'The pnpm catalog does not name every @rexezuge/* dependency, so versions are not held in one place.',\n fix: 'Add the packages under `catalog:` in pnpm-workspace.yaml (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const used = new Set(\n kitEdges(repo)\n .filter((edge) => !edge.spec.startsWith('workspace:'))\n .map((edge) => edge.name),\n );\n if (used.size === 0) return { skipped: 'no @rexezuge/* dependencies' };\n if (repo.workspace === null) return { ok: false, details: ['pnpm-workspace.yaml not found'] };\n const have = catalogNames(repo);\n const missing = [...used].filter((name) => !have.has(name)).sort((a, b) => a.localeCompare(b));\n return missing.length === 0 ? { ok: true } : { ok: false, details: missing.map((name) => `${name} is not in the catalog`) };\n },\n },\n {\n id: 'catalog.no-overrides',\n severity: 'error',\n title: 'Nothing pins @rexezuge/* through overrides',\n message: 'An overrides pin hides the real dependency graph and drifts from the catalog.',\n fix: 'Delete the @rexezuge/* entries from `overrides` (pnpm-workspace.yaml, package.json pnpm.overrides).',\n autoFixable: true,\n run: (repo) => {\n const pins = overridePins(repo);\n return pins.length === 0 ? { ok: true } : { ok: false, details: pins };\n },\n },\n {\n id: 'catalog.protocol',\n severity: 'error',\n title: 'Every package.json uses `catalog:` for @rexezuge/*',\n message: 'Some @rexezuge/* dependencies carry their own version range.',\n fix: 'Replace the range with `catalog:` (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const bad = kitEdges(repo).filter((edge) => !edge.spec.startsWith('catalog:') && !edge.spec.startsWith('workspace:'));\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((edge) => `${edge.file}: ${edge.name} is \"${edge.spec}\"`) };\n },\n },\n {\n id: 'lockfile.single-version',\n severity: 'error',\n title: 'The lockfile resolves each @rexezuge/* package to a single version',\n message: 'The lockfile holds more than one version of a kit package, or the packages are not in lockstep.',\n fix: 'Align the catalog, then reinstall (pnpm install) so the lockfile collapses to one version.',\n autoFixable: false,\n run: (repo) => {\n const lockfile = repo.read('pnpm-lock.yaml');\n if (lockfile === null) return { skipped: 'no pnpm-lock.yaml' };\n const versions = lockfileVersions(lockfile);\n if (versions.size === 0) return { skipped: 'no @rexezuge/* in the lockfile' };\n const details = [...versions]\n .filter(([, set]) => set.size > 1)\n .map(([name, set]) => `${name}: ${[...set].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n const all = new Set([...versions.values()].flatMap((set) => [...set]));\n if (details.length === 0 && all.size > 1)\n details.push(`packages are not in lockstep: ${[...all].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n return details.length === 0 ? { ok: true } : { ok: false, details };\n },\n },\n {\n id: 'sdk.current',\n severity: 'warn',\n title: 'The SDK version is at least the minor this CLI knows',\n message: `The catalog pins an SDK older than ${CLI_VERSION}.`,\n fix: 'Bump the @rexezuge/* catalog entries and run the codemods (pnpm exec rexezuge sync --write).',\n autoFixable: false,\n run: (repo) => {\n const specs = [...(repo.workspace?.catalog ?? [])].filter(([name]) => isKit(name)).map(([name, spec]) => ({ name, spec }));\n const known = parseVersion(CLI_VERSION);\n if (specs.length === 0 || known === null) return { skipped: 'no catalog versions' };\n const old = specs.filter(({ spec }) => {\n const version = parseVersion(spec);\n return version !== null && !atLeastMinor(version, known);\n });\n return old.length === 0 ? { ok: true } : { ok: false, details: old.map(({ name, spec }) => `${name} ${spec} < ${CLI_VERSION}`) };\n },\n },\n];\n"],
5
+ "mappings": "+EAAA,OAAS,mBAAAA,MAAuB,gBAEhC,OAAS,gBAAAC,EAAc,eAAAC,EAAa,gBAAAC,MAAoB,mBAMlD,SAAUC,EAASC,EAAU,CACjC,OAAOA,EAAK,SAAS,QAASC,GAAQ,CAAC,GAAGN,EAAgBM,EAAI,IAAI,CAAC,EAAE,IAAI,CAAC,CAACC,EAAMC,CAAI,KAAO,CAAE,KAAMF,EAAI,KAAM,KAA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IAAMM,EAAMN,CAAI,CAAC,EAAE,IAAI,CAAC,CAACA,EAAMC,CAAI,KAAO,CAAE,KAAAD,EAAM,KAAAC,CAAI,EAAG,EACnH8B,EAAQnC,EAAaD,CAAW,EACtC,GAAImC,EAAM,SAAW,GAAKC,IAAU,KAAM,MAAO,CAAE,QAAS,qBAAqB,EACjF,MAAMC,EAAMF,EAAM,OAAO,CAAC,CAAE,KAAA7B,CAAI,IAAM,CACpC,MAAMgB,EAAUrB,EAAaK,CAAI,EACjC,OAAOgB,IAAY,MAAQ,CAACvB,EAAauB,EAASc,CAAK,CACzD,CAAC,EACD,OAAOC,EAAI,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAASA,EAAI,IAAI,CAAC,CAAE,KAAAhC,EAAM,KAAAC,CAAI,IAAO,GAAGD,CAAI,IAAIC,CAAI,MAAMN,CAAW,EAAE,CAAC,CAChI,EATK",
6
+ "names": ["kitDependencies", "atLeastMinor", "CLI_VERSION", "parseVersion", "kitEdges", "repo", "pkg", "name", "spec", "__name", "catalogNames", "names", "named", "isKit", "overridePins", "pins", "key", "nested", "flat", "block", "lockfileVersions", "lockfile", "found", "match", "version", "catalogChecks", "used", "edge", "have", "missing", "a", "b", "bad", "versions", "details", "set", "all", "specs", "known", "old"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import type { Check } from '../types.ts';
2
+ /**
3
+ * The script names every family repo defines, so `pnpm run checks` means the same thing everywhere.
4
+ */
5
+ export declare const CANONICAL_SCRIPTS: readonly ["checks", "typecheck", "lint", "lint:check", "format", "format:check", "test", "test:coverage", "typegen"];
6
+ export declare const WORKFLOW_PREFIX = "Rexezuge-CloudflareWorkers/SDK/.github/workflows/";
7
+ export declare const fileChecks: readonly Check[];
8
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC;;GAEG;AACH,eAAO,MAAM,iBAAiB,sHAUpB,CAAC;AAEX,eAAO,MAAM,eAAe,sDAAsD,CAAC;AAEnF,eAAO,MAAM,UAAU,EAAE,SAAS,KAAK,EAsGtC,CAAC"}
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var r=(e,s)=>n(e,"name",{value:s,configurable:!0});import{rootScripts as a}from"../../repo-json.js";const l=["checks","typecheck","lint","lint:check","format","format:check","test","test:coverage","typegen"],o="Rexezuge-CloudflareWorkers/SDK/.github/workflows/",c=[{id:"workflows.callers",severity:"error",title:".github/workflows/*.yml are thin callers of the SDK reusable workflows",message:"A workflow is a full pipeline instead of a caller.",fix:`Replace it with a caller: \`uses: ${o}<name>.yml@v1\` (rexezuge sync --write).`,autoFixable:!0,run:r(e=>{const s=e.files.filter(i=>/^\.github\/workflows\/[^/]+\.ya?ml$/.test(i));if(s.length===0)return{ok:!1,details:[".github/workflows has no workflow"]};const t=s.filter(i=>!new RegExp(String.raw`uses:\s*${o.replaceAll(".",String.raw`\.`)}`).test(e.read(i)??""));return t.length===0?{ok:!0}:{ok:!1,details:t.map(i=>`${i} does not call ${o}*`)}},"run")},{id:"files.license",severity:"error",title:"LICENSE exists",message:"The repo has no LICENSE file.",fix:"Add the family LICENSE (MIT).",autoFixable:!1,run:r(e=>e.exists("LICENSE")||e.exists("LICENSE.md")?{ok:!0}:{ok:!1,details:["LICENSE"]},"run")},{id:"files.editorconfig",severity:"warn",title:".editorconfig exists",message:"The repo has no .editorconfig.",fix:"Copy the family .editorconfig.",autoFixable:!1,run:r(e=>e.exists(".editorconfig")?{ok:!0}:{ok:!1,details:[".editorconfig"]},"run")},{id:"files.agents",severity:"error",title:"AGENTS.md exists",message:"The repo has no AGENTS.md.",fix:"Add AGENTS.md linking the SDK conventions (docs/conventions.md).",autoFixable:!1,run:r(e=>e.exists("AGENTS.md")?{ok:!0}:{ok:!1,details:["AGENTS.md"]},"run")},{id:"files.claude-symlink",severity:"error",title:"CLAUDE.md is a symlink to AGENTS.md",message:"CLAUDE.md is missing or is not a symlink to AGENTS.md.",fix:"ln -sf AGENTS.md CLAUDE.md (rexezuge sync --write).",autoFixable:!0,run:r(e=>{const s=e.linkTarget("CLAUDE.md");return s==="AGENTS.md"||s==="./AGENTS.md"?{ok:!0}:{ok:!1,details:[s===null?"CLAUDE.md is absent or a regular file":`CLAUDE.md points at ${s}`]}},"run")},{id:"files.node-version",severity:"warn",title:".nvmrc is 24 or package.json engines.node is set",message:"The Node version is not pinned.",fix:"Write 24 to .nvmrc (rexezuge sync --write).",autoFixable:!0,run:r(e=>{const s=e.read(".nvmrc")?.trim();if(s!==void 0&&/^v?24(?:\.|$)/.test(s))return{ok:!0};const t=e.packages.find(i=>i.path==="package.json")?.json?.engines?.node;return typeof t=="string"&&t!==""?{ok:!0}:{ok:!1,details:[s===void 0?".nvmrc not found":`.nvmrc is ${s}, expected 24`]}},"run")},{id:"files.migrations-lock",severity:"error",title:"migrations.lock.json exists when the repo uses D1",message:"The D1 migrations have no lock.",fix:"Run `rexezuge migrations lock`.",autoFixable:!1,run:r(e=>{const s=e.manifest?.features?.d1;if(s===void 0)return{skipped:"feature d1 is off"};const t=`${s.migrationsDir??"migrations"}/migrations.lock.json`;return e.exists(t)?{ok:!0}:{ok:!1,details:[t]}},"run")},{id:"scripts.canonical",severity:"warn",title:"package.json defines the canonical scripts",message:"Some canonical scripts are missing from the root package.json.",fix:"Add the missing scripts (rexezuge sync --write).",autoFixable:!0,run:r(e=>{const s=a(e),t=l.filter(i=>s[i]===void 0);return t.length===0?{ok:!0}:{ok:!1,details:t.map(i=>`scripts.${i}`)}},"run")}];export{l as CANONICAL_SCRIPTS,o as WORKFLOW_PREFIX,c as fileChecks};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/doctor/checks/files.ts"],
4
+ "sourcesContent": ["import type { Check } from '../types.ts';\nimport { rootScripts } from '../../repo-json.ts';\n\n/**\n * The script names every family repo defines, so `pnpm run checks` means the same thing everywhere.\n */\nexport const CANONICAL_SCRIPTS = [\n 'checks',\n 'typecheck',\n 'lint',\n 'lint:check',\n 'format',\n 'format:check',\n 'test',\n 'test:coverage',\n 'typegen',\n] as const;\n\nexport const WORKFLOW_PREFIX = 'Rexezuge-CloudflareWorkers/SDK/.github/workflows/';\n\nexport const fileChecks: readonly Check[] = [\n {\n id: 'workflows.callers',\n severity: 'error',\n title: '.github/workflows/*.yml are thin callers of the SDK reusable workflows',\n message: 'A workflow is a full pipeline instead of a caller.',\n fix: `Replace it with a caller: \\`uses: ${WORKFLOW_PREFIX}<name>.yml@v1\\` (rexezuge sync --write).`,\n autoFixable: true,\n run: (repo) => {\n const files = repo.files.filter((file) => /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(file));\n if (files.length === 0) return { ok: false, details: ['.github/workflows has no workflow'] };\n const bad = files.filter(\n (file) => !new RegExp(String.raw`uses:\\s*${WORKFLOW_PREFIX.replaceAll('.', String.raw`\\.`)}`).test(repo.read(file) ?? ''),\n );\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((file) => `${file} does not call ${WORKFLOW_PREFIX}*`) };\n },\n },\n {\n id: 'files.license',\n severity: 'error',\n title: 'LICENSE exists',\n message: 'The repo has no LICENSE file.',\n fix: 'Add the family LICENSE (MIT).',\n autoFixable: false,\n run: (repo) => (repo.exists('LICENSE') || repo.exists('LICENSE.md') ? { ok: true } : { ok: false, details: ['LICENSE'] }),\n },\n {\n id: 'files.editorconfig',\n severity: 'warn',\n title: '.editorconfig exists',\n message: 'The repo has no .editorconfig.',\n fix: 'Copy the family .editorconfig.',\n autoFixable: false,\n run: (repo) => (repo.exists('.editorconfig') ? { ok: true } : { ok: false, details: ['.editorconfig'] }),\n },\n {\n id: 'files.agents',\n severity: 'error',\n title: 'AGENTS.md exists',\n message: 'The repo has no AGENTS.md.',\n fix: 'Add AGENTS.md linking the SDK conventions (docs/conventions.md).',\n autoFixable: false,\n run: (repo) => (repo.exists('AGENTS.md') ? { ok: true } : { ok: false, details: ['AGENTS.md'] }),\n },\n {\n id: 'files.claude-symlink',\n severity: 'error',\n title: 'CLAUDE.md is a symlink to AGENTS.md',\n message: 'CLAUDE.md is missing or is not a symlink to AGENTS.md.',\n fix: 'ln -sf AGENTS.md CLAUDE.md (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const target = repo.linkTarget('CLAUDE.md');\n return target === 'AGENTS.md' || target === './AGENTS.md'\n ? { ok: true }\n : { ok: false, details: [target === null ? 'CLAUDE.md is absent or a regular file' : `CLAUDE.md points at ${target}`] };\n },\n },\n {\n id: 'files.node-version',\n severity: 'warn',\n title: '.nvmrc is 24 or package.json engines.node is set',\n message: 'The Node version is not pinned.',\n fix: 'Write 24 to .nvmrc (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const nvmrc = repo.read('.nvmrc')?.trim();\n if (nvmrc !== undefined && /^v?24(?:\\.|$)/.test(nvmrc)) return { ok: true };\n const engines = (\n repo.packages.find((pkg) => pkg.path === 'package.json')?.json as { engines?: { node?: unknown } } | null | undefined\n )?.engines?.node;\n if (typeof engines === 'string' && engines !== '') return { ok: true };\n return { ok: false, details: [nvmrc === undefined ? '.nvmrc not found' : `.nvmrc is ${nvmrc}, expected 24`] };\n },\n },\n {\n id: 'files.migrations-lock',\n severity: 'error',\n title: 'migrations.lock.json exists when the repo uses D1',\n message: 'The D1 migrations have no lock.',\n fix: 'Run `rexezuge migrations lock`.',\n autoFixable: false,\n run: (repo) => {\n const d1 = repo.manifest?.features?.d1;\n if (d1 === undefined) return { skipped: 'feature d1 is off' };\n const lock = `${d1.migrationsDir ?? 'migrations'}/migrations.lock.json`;\n return repo.exists(lock) ? { ok: true } : { ok: false, details: [lock] };\n },\n },\n {\n id: 'scripts.canonical',\n severity: 'warn',\n title: 'package.json defines the canonical scripts',\n message: 'Some canonical scripts are missing from the root package.json.',\n fix: 'Add the missing scripts (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const scripts = rootScripts(repo);\n const missing = CANONICAL_SCRIPTS.filter((name) => scripts[name] === undefined);\n return missing.length === 0 ? { ok: true } : { ok: false, details: missing.map((name) => `scripts.${name}`) };\n },\n },\n];\n"],
5
+ "mappings": "+EACA,OAAS,eAAAA,MAAmB,qBAKrB,MAAMC,EAAoB,CAC/B,SACA,YACA,OACA,aACA,SACA,eACA,OACA,gBACA,WAGWC,EAAkB,oDAElBC,EAA+B,CAC1C,CACE,GAAI,oBACJ,SAAU,QACV,MAAO,yEACP,QAAS,qDACT,IAAK,qCAAqCD,CAAe,2CACzD,YAAa,GACb,IAAKE,EAACC,GAAQ,CACZ,MAAMC,EAAQD,EAAK,MAAM,OAAQE,GAAS,sCAAsC,KAAKA,CAAI,CAAC,EAC1F,GAAID,EAAM,SAAW,EAAG,MAAO,CAAE,GAAI,GAAO,QAAS,CAAC,mCAAmC,CAAC,EAC1F,MAAME,EAAMF,EAAM,OACfC,GAAS,CAAC,IAAI,OAAO,OAAO,cAAcL,EAAgB,WAAW,IAAK,OAAO,OAAO,CAAC,EAAE,EAAE,KAAKG,EAAK,KAAKE,CAAI,GAAK,EAAE,CAAC,EAE3H,OAAOC,EAAI,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAASA,EAAI,IAAKD,GAAS,GAAGA,CAAI,kBAAkBL,CAAe,GAAG,CAAC,CAC/H,EAPK,QASP,CACE,GAAI,gBACJ,SAAU,QACV,MAAO,iBACP,QAAS,gCACT,IAAK,gCACL,YAAa,GACb,IAAKE,EAACC,GAAUA,EAAK,OAAO,SAAS,GAAKA,EAAK,OAAO,YAAY,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAAS,CAAC,SAAS,CAAC,EAAjH,QAEP,CACE,GAAI,qBACJ,SAAU,OACV,MAAO,uBACP,QAAS,iCACT,IAAK,iCACL,YAAa,GACb,IAAKD,EAACC,GAAUA,EA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AAE,QAAS,mBAAmB,EAC3D,MAAMC,EAAO,GAAGD,EAAG,eAAiB,YAAY,wBAChD,OAAOR,EAAK,OAAOS,CAAI,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAAS,CAACA,CAAI,CAAC,CACxE,EALK,QAOP,CACE,GAAI,oBACJ,SAAU,OACV,MAAO,6CACP,QAAS,iEACT,IAAK,mDACL,YAAa,GACb,IAAKV,EAACC,GAAQ,CACZ,MAAMU,EAAUf,EAAYK,CAAI,EAC1BW,EAAUf,EAAkB,OAAQgB,GAASF,EAAQE,CAAI,IAAM,MAAS,EAC9E,OAAOD,EAAQ,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAASA,EAAQ,IAAKC,GAAS,WAAWA,CAAI,EAAE,CAAC,CAC7G,EAJK",
6
+ "names": ["rootScripts", "CANONICAL_SCRIPTS", "WORKFLOW_PREFIX", "fileChecks", "__name", "repo", "files", "file", "bad", "target", "nvmrc", "engines", "pkg", "d1", "lock", "scripts", "missing", "name"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { Check } from '../types.ts';
2
+ export declare const manifestChecks: readonly Check[];
3
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,cAAc,EAAE,SAAS,KAAK,EAa1C,CAAC"}
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var a=(e,s)=>i(e,"name",{value:s,configurable:!0});const n=[{id:"manifest.valid",severity:"error",title:".rexezuge.jsonc is present and valid",message:"The family manifest is missing or invalid.",fix:"Create .rexezuge.jsonc (name, scope, features, layers, quality) and validate it against the tooling schema.",autoFixable:!1,run:a(e=>e.manifestError!==null?{ok:!1,details:[e.manifestError]}:e.manifest===null?{ok:!1,details:[".rexezuge.jsonc not found"]}:{ok:!0},"run")}];export{n as manifestChecks};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/doctor/checks/manifest.ts"],
4
+ "sourcesContent": ["import type { Check } from '../types.ts';\n\nexport const manifestChecks: readonly Check[] = [\n {\n id: 'manifest.valid',\n severity: 'error',\n title: '.rexezuge.jsonc is present and valid',\n message: 'The family manifest is missing or invalid.',\n fix: 'Create .rexezuge.jsonc (name, scope, features, layers, quality) and validate it against the tooling schema.',\n autoFixable: false,\n run: (repo) => {\n if (repo.manifestError !== null) return { ok: false, details: [repo.manifestError] };\n return repo.manifest === null ? { ok: false, details: ['.rexezuge.jsonc not found'] } : { ok: true };\n },\n },\n];\n"],
5
+ "mappings": "+EAEO,MAAMA,EAAmC,CAC9C,CACE,GAAI,iBACJ,SAAU,QACV,MAAO,uCACP,QAAS,6CACT,IAAK,8GACL,YAAa,GACb,IAAKC,EAACC,GACAA,EAAK,gBAAkB,KAAa,CAAE,GAAI,GAAO,QAAS,CAACA,EAAK,aAAa,CAAC,EAC3EA,EAAK,WAAa,KAAO,CAAE,GAAI,GAAO,QAAS,CAAC,2BAA2B,CAAC,EAAK,CAAE,GAAI,EAAI,EAF/F",
6
+ "names": ["manifestChecks", "__name", "repo"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Check } from '../types.ts';
2
+ /**
3
+ * Whether a tsconfig's `extends` names a tooling preset (a string, or any element of an array).
4
+ */
5
+ export declare function extendsPreset(text: string | null): boolean;
6
+ export declare const presetChecks: readonly Check[];
7
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAgB,MAAM,aAAa,CAAC;AAKvD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAI1D;AASD,eAAO,MAAM,YAAY,EAAE,SAAS,KAAK,EAwExC,CAAC"}
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var o=(e,t)=>g(e,"name",{value:t,configurable:!0});import{parse as l}from"jsonc-parser";const d=o((e,t)=>s=>t.some(i=>s===`${e}.${i}`),"ROOT_FILE");function c(e){const t=l(e??"{}")?.extends;return(Array.isArray(t)?t:[t]).some(i=>typeof i=="string"&&i.startsWith("@rexezuge/tooling/tsconfig/"))}o(c,"extendsPreset");function a(e,t,s,i){const r=e.files.filter(t);if(r.length===0)return{ok:!1,details:[`no ${i} found`]};const n=r.filter(f=>!s.test(e.read(f)??""));return n.length===0?{ok:!0}:{ok:!1,details:n.map(f=>`${f} is hand-written, not a preset call`)}}o(a,"configChecked");const x=[{id:"presets.eslint",severity:"error",title:"eslint.config.* is defineRepoLintConfig",message:"The ESLint config is hand-written instead of the tooling preset.",fix:"export default defineRepoLintConfig({ scope }) from '@rexezuge/tooling/eslint'.",autoFixable:!1,run:o(e=>a(e,d("eslint.config",["mjs","js","mts","ts","cjs"]),/defineRepoLintConfig/,"eslint.config.*"),"run")},{id:"presets.vitest",severity:"error",title:"vitest configs use the tooling factories",message:"A Vitest config is hand-written instead of a tooling factory.",fix:"Use defineUnitVitestConfig / defineWebVitestConfig / defineRepoVitestConfig from @rexezuge/tooling.",autoFixable:!1,run:o(e=>a(e,t=>/^vitest(?:\.[a-z]+)?\.config\.(?:mts|ts|mjs|js)$/.test(t),/define(?:Unit|Web|Repo|Integration)VitestConfig/,"root vitest config"),"run")},{id:"presets.vite",severity:"warn",title:"The SPA vite config uses defineWebViteConfig",message:"A Vite config is hand-written instead of the tooling factory.",fix:"Use defineWebViteConfig from '@rexezuge/tooling/vite'.",autoFixable:!1,run:o(e=>{const t=e.files.filter(i=>/(?:^|\/)vite\.config\.(?:mts|ts|mjs|js)$/.test(i));if(t.length===0)return{skipped:"no vite config"};const s=t.filter(i=>!(e.read(i)??"").includes("defineWebViteConfig"));return s.length===0?{ok:!0}:{ok:!1,details:s}},"run")},{id:"presets.tsconfig",severity:"error",title:"Root and app tsconfig.json extend @rexezuge/tooling/tsconfig/*",message:"A tsconfig repeats compiler options instead of extending the preset.",fix:'Set "extends": "@rexezuge/tooling/tsconfig/base.json" (worker.json for apps/api and apps/background, web.json for apps/web).',autoFixable:!0,run:o(e=>{const t=e.files.filter(i=>i==="tsconfig.json"||/^apps\/[^/]+\/tsconfig\.json$/.test(i));if(!t.includes("tsconfig.json"))return{ok:!1,details:["tsconfig.json not found"]};const s=t.filter(i=>!c(e.read(i)));return s.length===0?{ok:!0}:{ok:!1,details:s.map(i=>`${i} does not extend a tooling preset`)}},"run")},{id:"presets.prettier",severity:"error",title:"Prettier is the tooling preset",message:"Prettier is configured by hand.",fix:'Set "prettier": "@rexezuge/tooling/prettier" in package.json and delete .prettierrc*.',autoFixable:!0,run:o(e=>{const t=e.files.filter(n=>/^\.prettierrc(?:\.[a-z]+)?$/.test(n)),s=e.packages.find(n=>n.path==="package.json")?.json?.prettier,i=e.files.some(n=>/^prettier\.config\.[a-z]+$/.test(n)&&(e.read(n)??"").includes("@rexezuge/tooling/prettier")),r=t.map(n=>`${n} should be deleted`);return s!=="@rexezuge/tooling/prettier"&&!i&&r.push('package.json "prettier" is not @rexezuge/tooling/prettier'),r.length===0?{ok:!0}:{ok:!1,details:r}},"run")}];export{c as extendsPreset,x as presetChecks};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/doctor/checks/presets.ts"],
4
+ "sourcesContent": ["import { parse } from 'jsonc-parser';\nimport type { Repo } from '../../repo.ts';\nimport type { Check, CheckOutcome } from '../types.ts';\n\nconst ROOT_FILE = (name: string, extensions: readonly string[]) => (file: string) =>\n extensions.some((extension) => file === `${name}.${extension}`);\n\n/**\n * Whether a tsconfig's `extends` names a tooling preset (a string, or any element of an array).\n */\nexport function extendsPreset(text: string | null): boolean {\n const extended = (parse(text ?? '{}') as { extends?: unknown } | null)?.extends;\n const list = Array.isArray(extended) ? extended : [extended];\n return list.some((entry) => typeof entry === 'string' && entry.startsWith('@rexezuge/tooling/tsconfig/'));\n}\n\nfunction configChecked(repo: Repo, match: (file: string) => boolean, accepts: RegExp, what: string): CheckOutcome {\n const files = repo.files.filter(match);\n if (files.length === 0) return { ok: false, details: [`no ${what} found`] };\n const bad = files.filter((file) => !accepts.test(repo.read(file) ?? ''));\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((file) => `${file} is hand-written, not a preset call`) };\n}\n\nexport const presetChecks: readonly Check[] = [\n {\n id: 'presets.eslint',\n severity: 'error',\n title: 'eslint.config.* is defineRepoLintConfig',\n message: 'The ESLint config is hand-written instead of the tooling preset.',\n fix: \"export default defineRepoLintConfig({ scope }) from '@rexezuge/tooling/eslint'.\",\n autoFixable: false,\n run: (repo) =>\n configChecked(repo, ROOT_FILE('eslint.config', ['mjs', 'js', 'mts', 'ts', 'cjs']), /defineRepoLintConfig/, 'eslint.config.*'),\n },\n {\n id: 'presets.vitest',\n severity: 'error',\n title: 'vitest configs use the tooling factories',\n message: 'A Vitest config is hand-written instead of a tooling factory.',\n fix: 'Use defineUnitVitestConfig / defineWebVitestConfig / defineRepoVitestConfig from @rexezuge/tooling.',\n autoFixable: false,\n run: (repo) =>\n configChecked(\n repo,\n (file) => /^vitest(?:\\.[a-z]+)?\\.config\\.(?:mts|ts|mjs|js)$/.test(file),\n /define(?:Unit|Web|Repo|Integration)VitestConfig/,\n 'root vitest config',\n ),\n },\n {\n id: 'presets.vite',\n severity: 'warn',\n title: 'The SPA vite config uses defineWebViteConfig',\n message: 'A Vite config is hand-written instead of the tooling factory.',\n fix: \"Use defineWebViteConfig from '@rexezuge/tooling/vite'.\",\n autoFixable: false,\n run: (repo) => {\n const files = repo.files.filter((file) => /(?:^|\\/)vite\\.config\\.(?:mts|ts|mjs|js)$/.test(file));\n if (files.length === 0) return { skipped: 'no vite config' };\n const bad = files.filter((file) => !(repo.read(file) ?? '').includes('defineWebViteConfig'));\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad };\n },\n },\n {\n id: 'presets.tsconfig',\n severity: 'error',\n title: 'Root and app tsconfig.json extend @rexezuge/tooling/tsconfig/*',\n message: 'A tsconfig repeats compiler options instead of extending the preset.',\n fix: 'Set \"extends\": \"@rexezuge/tooling/tsconfig/base.json\" (worker.json for apps/api and apps/background, web.json for apps/web).',\n autoFixable: true,\n run: (repo) => {\n const files = repo.files.filter((file) => file === 'tsconfig.json' || /^apps\\/[^/]+\\/tsconfig\\.json$/.test(file));\n if (!files.includes('tsconfig.json')) return { ok: false, details: ['tsconfig.json not found'] };\n const bad = files.filter((file) => !extendsPreset(repo.read(file)));\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((file) => `${file} does not extend a tooling preset`) };\n },\n },\n {\n id: 'presets.prettier',\n severity: 'error',\n title: 'Prettier is the tooling preset',\n message: 'Prettier is configured by hand.',\n fix: 'Set \"prettier\": \"@rexezuge/tooling/prettier\" in package.json and delete .prettierrc*.',\n autoFixable: true,\n run: (repo) => {\n const rcFiles = repo.files.filter((file) => /^\\.prettierrc(?:\\.[a-z]+)?$/.test(file));\n const field = (repo.packages.find((pkg) => pkg.path === 'package.json')?.json as { prettier?: unknown } | null | undefined)?.prettier;\n const scripted = repo.files.some(\n (file) => /^prettier\\.config\\.[a-z]+$/.test(file) && (repo.read(file) ?? '').includes('@rexezuge/tooling/prettier'),\n );\n const details = rcFiles.map((file) => `${file} should be deleted`);\n if (field !== '@rexezuge/tooling/prettier' && !scripted) details.push('package.json \"prettier\" is not @rexezuge/tooling/prettier');\n return details.length === 0 ? { ok: true } : { ok: false, details };\n },\n },\n];\n"],
5
+ "mappings": "+EAAA,OAAS,SAAAA,MAAa,eAItB,MAAMC,EAAYC,EAAA,CAACC,EAAcC,IAAmCC,GAClED,EAAW,KAAME,GAAcD,IAAS,GAAGF,CAAI,IAAIG,CAAS,EAAE,EAD9C,aAMZ,SAAUC,EAAc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,KAAK,2DAA2D,EAC1HA,EAAQ,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAAAA,CAAO,CACnE,EATK",
6
+ "names": ["parse", "ROOT_FILE", "__name", "name", "extensions", "file", "extension", "extendsPreset", "text", "extended", "entry", "configChecked", "repo", "match", "accepts", "what", "files", "bad", "presetChecks", "rcFiles", "field", "pkg", "scripted", "details"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import type { Repo } from '../../repo.ts';
2
+ import type { Check } from '../types.ts';
3
+ /**
4
+ * A known vendored copy: which files to look at, and when a file is the repo's own domain code instead.
5
+ * Heuristics rather than hashes (a copy drifts the moment it is vendored): a path pattern, plus a content test.
6
+ */
7
+ interface VendoredRule {
8
+ readonly key: string;
9
+ readonly title: string;
10
+ readonly hint: string;
11
+ readonly autoFixable: boolean;
12
+ readonly path: RegExp;
13
+ /**
14
+ True when the file at a matching path already delegates to the kit. Default: it mentions `@rexezuge/`.
15
+ */
16
+ readonly delegates?: (content: string) => boolean;
17
+ }
18
+ export declare const VENDORED_RULES: readonly VendoredRule[];
19
+ /**
20
+ * The repo-relative paths a rule flags: files at a matching path that do not delegate to the kit.
21
+ */
22
+ export declare function vendoredFiles(repo: Repo, rule: VendoredRule): string[];
23
+ export declare const vendoredChecks: readonly Check[];
24
+ export {};
25
+ //# sourceMappingURL=vendored.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendored.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/vendored.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,UAAU,YAAY;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;MAEE;IACF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAID,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAoHjD,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,CAKtE;AAED,eAAO,MAAM,cAAc,EAAE,SAAS,KAAK,EAWxC,CAAC"}
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var t=(e,r)=>s(e,"name",{value:r,configurable:!0});const i=t(e=>e.includes("@rexezuge/"),"mentionsKit"),o=[{key:"wrangler-config",title:"No vendored scripts/lib/wrangler-config",hint:"Delete it and call `rexezuge prepare-wrangler` / `rexezuge init-secrets`.",autoFixable:!1,path:/(^|\/)scripts\/(?:.+\/)?wrangler-config\/[^/]+\.(?:ts|mts|mjs|js)$/},{key:"backup",title:"No vendored scripts/backup helpers",hint:"Import d1-target, destination-config, naming and encrypt-backup from @rexezuge/tooling.",autoFixable:!1,path:/(^|\/)scripts\/(?:.+\/)?backup\/(?:d1-target|destination-config|naming|encrypt-backup)\.(?:ts|mts|mjs|js)$/},{key:"verify-migrations",title:"No vendored migrations verifier",hint:"Delete it and run `rexezuge migrations verify|lock`.",autoFixable:!1,path:/(^|\/)scripts\/(?:.+\/)?(?:verify-migrations|migrations-lock)\.(?:ts|mts|mjs|js)$/},{key:"god-files",title:"No vendored check-god-files",hint:"Delete it and run `rexezuge god-files`.",autoFixable:!1,path:/(^|\/)check-god-files\.[a-z]+$/},{key:"init-secrets",title:"No vendored init-secrets",hint:"Delete it and run `rexezuge init-secrets`.",autoFixable:!1,path:/(^|\/)scripts\/(?:.+\/)?init-secrets\.(?:ts|mts|mjs|js)$/},{key:"prepare-wrangler",title:"No vendored prepare-wrangler-config",hint:"Delete it and run `rexezuge prepare-wrangler`.",autoFixable:!1,path:/(^|\/)prepare-wrangler-config\.(?:ts|mts|mjs|js)$/},{key:"cloudflare-workers-mock",title:"test/mocks/cloudflare-workers.ts is not a vendored copy",hint:"Replace it with `export * from '@rexezuge/testing/cloudflare-workers';` or delete it.",autoFixable:!0,path:/(^|\/)test\/mocks\/cloudflare-workers\.ts$/},{key:"pages-function",title:"functions/[[path]].ts delegates to the tooling pages proxy",hint:"Make it `export { onRequest } from '@rexezuge/tooling/pages-proxy';`.",autoFixable:!0,path:/(^|\/)functions\/\[\[path\]\]\.ts$/,delegates:t(e=>/@rexezuge\/tooling\/(?:functions\/)?pages-proxy/.test(e),"delegates")},{key:"use-current-user",title:"No local useCurrentUser hook",hint:"Use `useCurrentUser` from '@rexezuge/web'.",autoFixable:!1,path:/(^|\/)apps\/web\/src\/hooks\/useCurrentUser\.tsx?$/},{key:"use-spa-language",title:"No local useSpaLanguage hook",hint:"Use `useSpaLanguage` from '@rexezuge/web'.",autoFixable:!1,path:/(^|\/)apps\/web\/src\/hooks\/useSpaLanguage\.tsx?$/},{key:"spa-i18n",title:"apps/web/src/i18n.ts is built on createSpaI18n",hint:"Build it with `createSpaI18n` from '@rexezuge/web/i18n'.",autoFixable:!1,path:/(^|\/)apps\/web\/src\/i18n\.tsx?$/,delegates:t(e=>e.includes("@rexezuge/web/i18n"),"delegates")},{key:"base-route",title:"No local IBaseRoute",hint:"Extend `FamilyRoute` from @rexezuge/http/hono.",autoFixable:!1,path:/(^|\/)IBaseRoute\.ts$/},{key:"cron-worker",title:"CronTasksWorker extends CronTasksDurableObject",hint:"Extend `CronTasksDurableObject` from @rexezuge/runtime and keep only createRegistry.",autoFixable:!1,path:/(^|\/)CronTasksWorker\.ts$/,delegates:t(e=>/extends\s+CronTasksDurableObject\b/.test(e),"delegates")},{key:"pruning-task",title:"No local AbstractPruningTask",hint:"Extend `AbstractPruningTask` from '@rexezuge/runtime'.",autoFixable:!1,path:/(^|\/)AbstractPruningTask\.ts$/},{key:"logger",title:"No local Logger",hint:"Use `createLogger` from '@rexezuge/runtime'.",autoFixable:!1,path:/(^|\/)Logger\.ts$/},{key:"http-hardening",title:"No local HttpHardening",hint:"Use `createApiApp({ hardening })` from '@rexezuge/http/hono'.",autoFixable:!1,path:/(^|\/)HttpHardening\.ts$/}];function n(e,r){return e.files.filter(a=>r.path.test(a)?!(r.delegates??i)(e.read(a)??""):!1)}t(n,"vendoredFiles");const u=o.map(e=>({id:`vendored.${e.key}`,severity:"error",title:e.title,message:"A copy of kit code lives in the repo instead of an import.",fix:e.hint,autoFixable:e.autoFixable,run:t(r=>{const a=n(r,e);return a.length===0?{ok:!0}:{ok:!1,details:a}},"run")}));export{o as VENDORED_RULES,u as vendoredChecks,n as vendoredFiles};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/doctor/checks/vendored.ts"],
4
+ "sourcesContent": ["import type { Repo } from '../../repo.ts';\nimport type { Check } from '../types.ts';\n\n/**\n * A known vendored copy: which files to look at, and when a file is the repo's own domain code instead.\n * Heuristics rather than hashes (a copy drifts the moment it is vendored): a path pattern, plus a content test.\n */\ninterface VendoredRule {\n readonly key: string;\n readonly title: string;\n readonly hint: string;\n readonly autoFixable: boolean;\n readonly path: RegExp;\n /**\n True when the file at a matching path already delegates to the kit. Default: it mentions `@rexezuge/`.\n */\n readonly delegates?: (content: string) => boolean;\n}\n\nconst mentionsKit = (content: string): boolean => content.includes('@rexezuge/');\n\nexport const VENDORED_RULES: readonly VendoredRule[] = [\n {\n key: 'wrangler-config',\n title: 'No vendored scripts/lib/wrangler-config',\n hint: 'Delete it and call `rexezuge prepare-wrangler` / `rexezuge init-secrets`.',\n autoFixable: false,\n path: /(^|\\/)scripts\\/(?:.+\\/)?wrangler-config\\/[^/]+\\.(?:ts|mts|mjs|js)$/,\n },\n {\n key: 'backup',\n title: 'No vendored scripts/backup helpers',\n hint: 'Import d1-target, destination-config, naming and encrypt-backup from @rexezuge/tooling.',\n autoFixable: false,\n path: /(^|\\/)scripts\\/(?:.+\\/)?backup\\/(?:d1-target|destination-config|naming|encrypt-backup)\\.(?:ts|mts|mjs|js)$/,\n },\n {\n key: 'verify-migrations',\n title: 'No vendored migrations verifier',\n hint: 'Delete it and run `rexezuge migrations verify|lock`.',\n autoFixable: false,\n path: /(^|\\/)scripts\\/(?:.+\\/)?(?:verify-migrations|migrations-lock)\\.(?:ts|mts|mjs|js)$/,\n },\n {\n key: 'god-files',\n title: 'No vendored check-god-files',\n hint: 'Delete it and run `rexezuge god-files`.',\n autoFixable: false,\n path: /(^|\\/)check-god-files\\.[a-z]+$/,\n },\n {\n key: 'init-secrets',\n title: 'No vendored init-secrets',\n hint: 'Delete it and run `rexezuge init-secrets`.',\n autoFixable: false,\n path: /(^|\\/)scripts\\/(?:.+\\/)?init-secrets\\.(?:ts|mts|mjs|js)$/,\n },\n {\n key: 'prepare-wrangler',\n title: 'No vendored prepare-wrangler-config',\n hint: 'Delete it and run `rexezuge prepare-wrangler`.',\n autoFixable: false,\n path: /(^|\\/)prepare-wrangler-config\\.(?:ts|mts|mjs|js)$/,\n },\n {\n key: 'cloudflare-workers-mock',\n title: 'test/mocks/cloudflare-workers.ts is not a vendored copy',\n hint: \"Replace it with `export * from '@rexezuge/testing/cloudflare-workers';` or delete it.\",\n autoFixable: true,\n path: /(^|\\/)test\\/mocks\\/cloudflare-workers\\.ts$/,\n },\n {\n key: 'pages-function',\n title: 'functions/[[path]].ts delegates to the tooling pages proxy',\n hint: \"Make it `export { onRequest } from '@rexezuge/tooling/pages-proxy';`.\",\n autoFixable: true,\n path: /(^|\\/)functions\\/\\[\\[path\\]\\]\\.ts$/,\n delegates: (content) => /@rexezuge\\/tooling\\/(?:functions\\/)?pages-proxy/.test(content),\n },\n {\n key: 'use-current-user',\n title: 'No local useCurrentUser hook',\n hint: \"Use `useCurrentUser` from '@rexezuge/web'.\",\n autoFixable: false,\n path: /(^|\\/)apps\\/web\\/src\\/hooks\\/useCurrentUser\\.tsx?$/,\n },\n {\n key: 'use-spa-language',\n title: 'No local useSpaLanguage hook',\n hint: \"Use `useSpaLanguage` from '@rexezuge/web'.\",\n autoFixable: false,\n path: /(^|\\/)apps\\/web\\/src\\/hooks\\/useSpaLanguage\\.tsx?$/,\n },\n {\n key: 'spa-i18n',\n title: 'apps/web/src/i18n.ts is built on createSpaI18n',\n hint: \"Build it with `createSpaI18n` from '@rexezuge/web/i18n'.\",\n autoFixable: false,\n path: /(^|\\/)apps\\/web\\/src\\/i18n\\.tsx?$/,\n delegates: (content) => content.includes('@rexezuge/web/i18n'),\n },\n {\n key: 'base-route',\n title: 'No local IBaseRoute',\n hint: 'Extend `FamilyRoute` from @rexezuge/http/hono.',\n autoFixable: false,\n path: /(^|\\/)IBaseRoute\\.ts$/,\n },\n {\n key: 'cron-worker',\n title: 'CronTasksWorker extends CronTasksDurableObject',\n hint: 'Extend `CronTasksDurableObject` from @rexezuge/runtime and keep only createRegistry.',\n autoFixable: false,\n path: /(^|\\/)CronTasksWorker\\.ts$/,\n delegates: (content) => /extends\\s+CronTasksDurableObject\\b/.test(content),\n },\n {\n key: 'pruning-task',\n title: 'No local AbstractPruningTask',\n hint: \"Extend `AbstractPruningTask` from '@rexezuge/runtime'.\",\n autoFixable: false,\n path: /(^|\\/)AbstractPruningTask\\.ts$/,\n },\n {\n key: 'logger',\n title: 'No local Logger',\n hint: \"Use `createLogger` from '@rexezuge/runtime'.\",\n autoFixable: false,\n path: /(^|\\/)Logger\\.ts$/,\n },\n {\n key: 'http-hardening',\n title: 'No local HttpHardening',\n hint: \"Use `createApiApp({ hardening })` from '@rexezuge/http/hono'.\",\n autoFixable: false,\n path: /(^|\\/)HttpHardening\\.ts$/,\n },\n];\n\n/**\n * The repo-relative paths a rule flags: files at a matching path that do not delegate to the kit.\n */\nexport function vendoredFiles(repo: Repo, rule: VendoredRule): string[] {\n return repo.files.filter((file) => {\n if (!rule.path.test(file)) return false;\n return !(rule.delegates ?? mentionsKit)(repo.read(file) ?? '');\n });\n}\n\nexport const vendoredChecks: readonly Check[] = VENDORED_RULES.map((rule) => ({\n id: `vendored.${rule.key}`,\n severity: 'error' as const,\n title: rule.title,\n message: 'A copy of kit code lives in the repo instead of an import.',\n fix: rule.hint,\n autoFixable: rule.autoFixable,\n run: (repo: Repo) => {\n const files = vendoredFiles(repo, rule);\n return files.length === 0 ? { ok: true as const } : { ok: false as const, details: files };\n },\n}));\n"],
5
+ "mappings": "+EAmBA,MAAMA,EAAcC,EAACC,GAA6BA,EAAQ,SAAS,YAAY,EAA3D,eAEPC,EAA0C,CACrD,CACE,IAAK,kBACL,MAAO,0CACP,KAAM,4EACN,YAAa,GACb,KAAM,sEAER,CACE,IAAK,SACL,MAAO,qCACP,KAAM,0FACN,YAAa,GACb,KAAM,8GAER,CACE,IAAK,oBACL,MAAO,kCACP,KAAM,uDACN,YAAa,GACb,KAAM,qFAER,CACE,IAAK,YACL,MAAO,8BACP,KAAM,0CACN,YAAa,GACb,KAAM,kCAER,CACE,IAAK,eACL,MAAO,2BACP,KAAM,6CACN,YAAa,GACb,KAAM,4DAER,CACE,IAAK,mBACL,MAAO,sCACP,KAAM,iDACN,YAAa,GACb,KAAM,qDAER,CACE,IAAK,0BACL,MAAO,0DACP,KAAM,wFACN,YAAa,GACb,KAAM,8CAER,CACE,IAAK,iBACL,MAAO,6DACP,KAAM,wEACN,YAAa,GACb,KAAM,qCACN,UAAWF,EAACC,GAAY,kDAAkD,KAAKA,CAAO,EAA3E,cAEb,CACE,IAAK,mBACL,MAAO,+BACP,KAAM,6CACN,YAAa,GACb,KAAM,sDAER,CACE,IAAK,mBACL,MAAO,+BACP,KAAM,6CACN,YAAa,GACb,KAAM,sDAER,CACE,IAAK,WACL,MAAO,iDACP,KAAM,2DACN,YAAa,GACb,KAAM,oCACN,UAAWD,EAACC,GAAYA,EAAQ,SAAS,oBAAoB,EAAlD,cAEb,CACE,IAAK,aACL,MAAO,sBACP,KAAM,iDACN,YAAa,GACb,KAAM,yBAER,CACE,IAAK,cACL,MAAO,iDACP,KAAM,uFACN,YAAa,GACb,KAAM,6BACN,UAAWD,EAACC,GAAY,qCAAqC,KAAKA,CAAO,EAA9D,cAEb,CACE,IAAK,eACL,MAAO,+BACP,KAAM,yDACN,YAAa,GACb,KAAM,kCAER,CACE,IAAK,SACL,MAAO,kBACP,KAAM,+CACN,YAAa,GACb,KAAM,qBAER,CACE,IAAK,iBACL,MAAO,yBACP,KAAM,gEACN,YAAa,GACb,KAAM,6BAOJ,SAAUE,EAAcC,EAAYC,EAAkB,CAC1D,OAAOD,EAAK,MAAM,OAAQE,GACnBD,EAAK,KAAK,KAAKC,CAAI,EACjB,EAAED,EAAK,WAAaN,GAAaK,EAAK,KAAKE,CAAI,GAAK,EAAE,EAD3B,EAEnC,CACH,CALgBN,EAAAG,EAAA,iBAOT,MAAMI,EAAmCL,EAAe,IAAKG,IAAU,CAC5E,GAAI,YAAYA,EAAK,GAAG,GACxB,SAAU,QACV,MAAOA,EAAK,MACZ,QAAS,6DACT,IAAKA,EAAK,KACV,YAAaA,EAAK,YAClB,IAAKL,EAACI,GAAc,CAClB,MAAMI,EAAQL,EAAcC,EAAMC,CAAI,EACtC,OAAOG,EAAM,SAAW,EAAI,CAAE,GAAI,EAAa,EAAK,CAAE,GAAI,GAAgB,QAASA,CAAK,CAC1F,EAHK,QAIL",
6
+ "names": ["mentionsKit", "__name", "content", "VENDORED_RULES", "vendoredFiles", "repo", "rule", "file", "vendoredChecks", "files"]
7
+ }
@@ -0,0 +1,26 @@
1
+ import type { Repo } from '../repo.ts';
2
+ import type { Check } from './types.ts';
3
+ /**
4
+ * A WARN check a repo switches off, with the reason that will appear in every report.
5
+ */
6
+ export interface Disabled {
7
+ readonly id: string;
8
+ readonly reason: string;
9
+ }
10
+ /**
11
+ * The open side of doctor, from `extensions.doctor` in `.rexezuge.jsonc`:
12
+ *
13
+ * ```jsonc
14
+ * "extensions": { "doctor": { "checks": "./scripts/doctor-checks.mjs", "disable": [{ "id": "files.editorconfig", "reason": "..." }] } }
15
+ * ```
16
+ *
17
+ * `problems` are configuration mistakes; they are reported as the failing `doctor.config` check, so a
18
+ * bad extension block cannot quietly weaken the gate.
19
+ */
20
+ export interface DoctorExtensions {
21
+ readonly checks: readonly Check[];
22
+ readonly disabled: readonly Disabled[];
23
+ readonly problems: readonly string[];
24
+ }
25
+ export declare function loadExtensions(repo: Repo, builtin: readonly Check[]): Promise<DoctorExtensions>;
26
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/doctor/extensions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AA8CD,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyBrG"}
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var d=(n,e)=>l(n,"name",{value:e,configurable:!0});var h=function(n,e){return typeof n=="string"&&/^\.\.?\//.test(n)?n.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(o,s,r,i,c){return s?e?".jsx":".js":r&&(!i||!c)?o:r+i+"."+c.toLowerCase()+"js"}):n};import p from"node:path";import{pathToFileURL as y}from"node:url";const k=/^[a-z][a-z0-9-]*(?:\.[a-z0-9-]+)+$/;function g(n){const e=n;return typeof e=="object"&&e!==null&&typeof e.id=="string"&&k.test(e.id)&&(e.severity==="error"||e.severity==="warn")&&typeof e.title=="string"&&typeof e.message=="string"&&typeof e.fix=="string"&&typeof e.run=="function"}d(g,"validCheck");async function x(n,e,o,s){let r;try{r=await import(h(y(p.resolve(n.root,e)).href))}catch(t){return s.push(`extensions.doctor.checks ${e} could not be loaded: ${t instanceof Error?t.message:String(t)}`),[]}const i=r.default??r.checks,c=typeof i=="function"?i(n):i;if(!Array.isArray(c))return s.push(`extensions.doctor.checks ${e} must export an array of checks (or a function returning one)`),[];const a=[];for(const t of c)g(t)?o.has(t.id)?s.push(`${e}: check id ${t.id} collides with a built-in check`):a.push({...t,autoFixable:!1}):s.push(`${e}: an entry is not a valid check (id, severity, title, message, fix, run)`);return a}d(x,"loadChecks");async function w(n,e){const o=n.manifest?.extensions?.doctor,s=[];if(o===void 0)return{checks:[],disabled:[],problems:s};const r=new Map(e.map(a=>[a.id,a])),i=[];o.disable!==void 0&&!Array.isArray(o.disable)&&s.push("extensions.doctor.disable must be an array");for(const a of Array.isArray(o.disable)?o.disable:[]){const{id:t,reason:f}=a??{},u=typeof t=="string"?r.get(t):void 0;typeof t!="string"||u===void 0?s.push(`extensions.doctor.disable: unknown check ${String(t)}`):typeof f!="string"||f.trim()===""?s.push(`extensions.doctor.disable: ${t} needs a non-empty reason`):u.severity==="error"?s.push(`extensions.doctor.disable: ${t} is an ERROR check and cannot be disabled`):i.push({id:t,reason:f.trim()})}const c=typeof o.checks=="string"?await x(n,o.checks,new Set(r.keys()),s):[];return o.checks!==void 0&&typeof o.checks!="string"&&s.push("extensions.doctor.checks must be a module path"),{checks:c,disabled:i,problems:s}}d(w,"loadExtensions");export{w as loadExtensions};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/doctor/extensions.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { Repo } from '../repo.ts';\nimport type { Check } from './types.ts';\n\n/**\n * A WARN check a repo switches off, with the reason that will appear in every report.\n */\nexport interface Disabled {\n readonly id: string;\n readonly reason: string;\n}\n\n/**\n * The open side of doctor, from `extensions.doctor` in `.rexezuge.jsonc`:\n *\n * ```jsonc\n * \"extensions\": { \"doctor\": { \"checks\": \"./scripts/doctor-checks.mjs\", \"disable\": [{ \"id\": \"files.editorconfig\", \"reason\": \"...\" }] } }\n * ```\n *\n * `problems` are configuration mistakes; they are reported as the failing `doctor.config` check, so a\n * bad extension block cannot quietly weaken the gate.\n */\nexport interface DoctorExtensions {\n readonly checks: readonly Check[];\n readonly disabled: readonly Disabled[];\n readonly problems: readonly string[];\n}\n\nconst ID = /^[a-z][a-z0-9-]*(?:\\.[a-z0-9-]+)+$/;\n\nfunction validCheck(value: unknown): value is Check {\n const check = value as Partial<Check> | null;\n return (\n typeof check === 'object' &&\n check !== null &&\n typeof check.id === 'string' &&\n ID.test(check.id) &&\n (check.severity === 'error' || check.severity === 'warn') &&\n typeof check.title === 'string' &&\n typeof check.message === 'string' &&\n typeof check.fix === 'string' &&\n typeof check.run === 'function'\n );\n}\n\nasync function loadChecks(repo: Repo, file: string, builtin: ReadonlySet<string>, problems: string[]): Promise<Check[]> {\n let loaded: unknown;\n try {\n loaded = await import(pathToFileURL(path.resolve(repo.root, file)).href);\n } catch (error: unknown) {\n problems.push(`extensions.doctor.checks ${file} could not be loaded: ${error instanceof Error ? error.message : String(error)}`);\n return [];\n }\n const exported = (loaded as { default?: unknown; checks?: unknown }).default ?? (loaded as { checks?: unknown }).checks;\n const list: unknown = typeof exported === 'function' ? (exported as (repo: Repo) => unknown)(repo) : exported;\n if (!Array.isArray(list)) {\n problems.push(`extensions.doctor.checks ${file} must export an array of checks (or a function returning one)`);\n return [];\n }\n const accepted: Check[] = [];\n for (const entry of list as unknown[]) {\n if (!validCheck(entry)) {\n problems.push(`${file}: an entry is not a valid check (id, severity, title, message, fix, run)`);\n } else if (builtin.has(entry.id)) {\n problems.push(`${file}: check id ${entry.id} collides with a built-in check`);\n } else {\n accepted.push({ ...entry, autoFixable: false });\n }\n }\n return accepted;\n}\n\nexport async function loadExtensions(repo: Repo, builtin: readonly Check[]): Promise<DoctorExtensions> {\n const block = repo.manifest?.extensions?.['doctor'] as { checks?: unknown; disable?: unknown } | undefined;\n const problems: string[] = [];\n if (block === undefined) return { checks: [], disabled: [], problems };\n\n const known = new Map(builtin.map((check) => [check.id, check]));\n const disabled: Disabled[] = [];\n if (block.disable !== undefined && !Array.isArray(block.disable)) problems.push('extensions.doctor.disable must be an array');\n for (const entry of Array.isArray(block.disable) ? (block.disable as unknown[]) : []) {\n const { id, reason } = (entry ?? {}) as { id?: unknown; reason?: unknown };\n const target = typeof id === 'string' ? known.get(id) : undefined;\n if (typeof id !== 'string' || target === undefined) {\n problems.push(`extensions.doctor.disable: unknown check ${String(id)}`);\n } else if (typeof reason !== 'string' || reason.trim() === '') {\n problems.push(`extensions.doctor.disable: ${id} needs a non-empty reason`);\n } else if (target.severity === 'error') {\n problems.push(`extensions.doctor.disable: ${id} is an ERROR check and cannot be disabled`);\n } else {\n disabled.push({ id, reason: reason.trim() });\n }\n }\n\n const checks = typeof block.checks === 'string' ? await loadChecks(repo, block.checks, new Set(known.keys()), problems) : [];\n if (block.checks !== undefined && typeof block.checks !== 'string') problems.push('extensions.doctor.checks must be a module path');\n return { checks, disabled, problems };\n}\n"],
5
+ "mappings": "0SAAA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WA4B9B,MAAMC,EAAK,qCAEX,SAASC,EAAWC,EAAc,CAChC,MAAMC,EAAQD,EACd,OACE,OAAOC,GAAU,UACjBA,IAAU,MACV,OAAOA,EAAM,IAAO,UACpBH,EAAG,KAAKG,EAAM,EAAE,IACfA,EAAM,WAAa,SAAWA,EAAM,WAAa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AAuB,CAAA,EACzBF,EAAM,UAAY,QAAa,CAAC,MAAM,QAAQA,EAAM,OAAO,GAAGT,EAAS,KAAK,4CAA4C,EAC5H,UAAWO,KAAS,MAAM,QAAQE,EAAM,OAAO,EAAKA,EAAM,QAAwB,CAAA,EAAI,CACpF,KAAM,CAAE,GAAAG,EAAI,OAAAC,CAAM,EAAMN,GAAS,CAAA,EAC3BO,EAAS,OAAOF,GAAO,SAAWF,EAAM,IAAIE,CAAE,EAAI,OACpD,OAAOA,GAAO,UAAYE,IAAW,OACvCd,EAAS,KAAK,4CAA4C,OAAOY,CAAE,CAAC,EAAE,EAC7D,OAAOC,GAAW,UAAYA,EAAO,KAAI,IAAO,GACzDb,EAAS,KAAK,8BAA8BY,CAAE,2BAA2B,EAChEE,EAAO,WAAa,QAC7Bd,EAAS,KAAK,8BAA8BY,CAAE,2CAA2C,EAEzFD,EAAS,KAAK,CAAE,GAAAC,EAAI,OAAQC,EAAO,KAAI,CAAE,CAAE,CAE/C,CAEA,MAAME,EAAS,OAAON,EAAM,QAAW,SAAW,MAAMb,EAAWC,EAAMY,EAAM,OAAQ,IAAI,IAAIC,EAAM,KAAI,CAAE,EAAGV,CAAQ,EAAI,CAAA,EAC1H,OAAIS,EAAM,SAAW,QAAa,OAAOA,EAAM,QAAW,UAAUT,EAAS,KAAK,gDAAgD,EAC3H,CAAE,OAAAe,EAAQ,SAAAJ,EAAU,SAAAX,CAAQ,CACrC,CAzBsBL,EAAAa,EAAA",
6
+ "names": ["path", "pathToFileURL", "ID", "validCheck", "value", "check", "__name", "loadChecks", "repo", "file", "builtin", "problems", "loaded", "__rewriteRelativeImportExtension", "error", "exported", "list", "accepted", "entry", "loadExtensions", "block", "known", "disabled", "id", "reason", "target", "checks"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Check } from './types.ts';
2
+ /**
3
+ * Every check the CLI ships, in report order. A repo adds its own through `extensions.doctor.checks`
4
+ * (see `extensions.ts`); it never edits this list.
5
+ */
6
+ export declare const BUILTIN_CHECKS: readonly Check[];
7
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,KAAK,EAA6F,CAAC"}
@@ -0,0 +1 @@
1
+ import{catalogChecks as o}from"./checks/catalog.js";import{fileChecks as r}from"./checks/files.js";import{manifestChecks as e}from"./checks/manifest.js";import{presetChecks as m}from"./checks/presets.js";import{vendoredChecks as t}from"./checks/vendored.js";const C=[...e,...o,...t,...m,...r];export{C as BUILTIN_CHECKS};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/doctor/registry.ts"],
4
+ "sourcesContent": ["import { catalogChecks } from './checks/catalog.ts';\nimport { fileChecks } from './checks/files.ts';\nimport { manifestChecks } from './checks/manifest.ts';\nimport { presetChecks } from './checks/presets.ts';\nimport { vendoredChecks } from './checks/vendored.ts';\nimport type { Check } from './types.ts';\n\n/**\n * Every check the CLI ships, in report order. A repo adds its own through `extensions.doctor.checks`\n * (see `extensions.ts`); it never edits this list.\n */\nexport const BUILTIN_CHECKS: readonly Check[] = [...manifestChecks, ...catalogChecks, ...vendoredChecks, ...presetChecks, ...fileChecks];\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,sBAC9B,OAAS,cAAAC,MAAkB,oBAC3B,OAAS,kBAAAC,MAAsB,uBAC/B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,kBAAAC,MAAsB,uBAOxB,MAAMC,EAAmC,CAAC,GAAGH,EAAgB,GAAGF,EAAe,GAAGI,EAAgB,GAAGD,EAAc,GAAGF,CAAU",
6
+ "names": ["catalogChecks", "fileChecks", "manifestChecks", "presetChecks", "vendoredChecks", "BUILTIN_CHECKS"]
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Repo } from '../repo.ts';
2
+ import type { DoctorReport, Finding } from './types.ts';
3
+ /**
4
+ * `floor(earned / total * 100)`: 100 means every applicable check passed, never a rounded-up near miss.
5
+ * Skipped and disabled checks are outside both sums.
6
+ */
7
+ export declare function scoreOf(findings: readonly Finding[]): number;
8
+ /**
9
+ * Run every check (built-in, then the repo's own) against an already-loaded repo.
10
+ */
11
+ export declare function diagnose(repo: Repo): Promise<DoctorReport>;
12
+ export declare function runDoctor(root: string): Promise<DoctorReport>;
13
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/doctor/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,KAAK,EAAS,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI/D;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAK5D;AAgBD;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAyBhE;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAEnE"}
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var o=(s,r)=>d(s,"name",{value:r,configurable:!0});import{loadRepo as u}from"../repo.js";import{CLI_VERSION as c}from"../version.js";import{loadExtensions as f}from"./extensions.js";import{BUILTIN_CHECKS as n}from"./registry.js";const l={error:3,warn:1};function p(s){const r=s.filter(e=>e.status==="pass"||e.status==="fail"),a=r.reduce((e,i)=>e+l[i.severity],0),t=r.filter(e=>e.status==="pass").reduce((e,i)=>e+l[i.severity],0);return a===0?100:Math.floor(t/a*100)}o(p,"scoreOf");async function m(s,r,a){const t={id:s.id,severity:s.severity,title:s.title,fix:s.fix,autoFixable:s.autoFixable};if(a!==void 0)return{...t,status:"disabled",message:"",details:[],reason:a};try{const e=await s.run(r);return e.skipped!==void 0?{...t,status:"skipped",message:"",details:[],reason:e.skipped}:e.ok?{...t,status:"pass",message:"",details:[]}:{...t,status:"fail",message:s.message,details:e.details??[]}}catch(e){const i=e instanceof Error?e.message:String(e);return{...t,status:"fail",message:s.message,details:[`the check itself threw: ${i}`]}}}o(m,"runCheck");async function g(s){const r=await f(s,n),a=new Map(r.disabled.map(e=>[e.id,e.reason])),t=[];for(const e of[...n,...r.checks])t.push(await m(e,s,a.get(e.id)));return r.problems.length>0&&t.push({id:"doctor.config",severity:"error",status:"fail",title:"extensions.doctor is valid",message:"The doctor extension block is invalid, so its checks and disables were not applied as written.",fix:"Fix extensions.doctor in .rexezuge.jsonc: only WARN checks can be disabled, each with a reason.",autoFixable:!1,details:r.problems}),{root:s.root,cliVersion:c,score:p(t),errors:t.filter(e=>e.status==="fail"&&e.severity==="error").length,warnings:t.filter(e=>e.status==="fail"&&e.severity==="warn").length,findings:t}}o(g,"diagnose");async function v(s){return g(u(s))}o(v,"runDoctor");export{g as diagnose,v as runDoctor,p as scoreOf};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/doctor/run.ts"],
4
+ "sourcesContent": ["import { loadRepo } from '../repo.ts';\nimport type { Repo } from '../repo.ts';\nimport { CLI_VERSION } from '../version.ts';\nimport { loadExtensions } from './extensions.ts';\nimport { BUILTIN_CHECKS } from './registry.ts';\nimport type { Check, DoctorReport, Finding } from './types.ts';\n\nconst WEIGHT = { error: 3, warn: 1 } as const;\n\n/**\n * `floor(earned / total * 100)`: 100 means every applicable check passed, never a rounded-up near miss.\n * Skipped and disabled checks are outside both sums.\n */\nexport function scoreOf(findings: readonly Finding[]): number {\n const counted = findings.filter((finding) => finding.status === 'pass' || finding.status === 'fail');\n const total = counted.reduce((sum, finding) => sum + WEIGHT[finding.severity], 0);\n const earned = counted.filter((finding) => finding.status === 'pass').reduce((sum, finding) => sum + WEIGHT[finding.severity], 0);\n return total === 0 ? 100 : Math.floor((earned / total) * 100);\n}\n\nasync function runCheck(check: Check, repo: Repo, disabledReason: string | undefined): Promise<Finding> {\n const base = { id: check.id, severity: check.severity, title: check.title, fix: check.fix, autoFixable: check.autoFixable };\n if (disabledReason !== undefined) return { ...base, status: 'disabled', message: '', details: [], reason: disabledReason };\n try {\n const outcome = await check.run(repo);\n if (outcome.skipped !== undefined) return { ...base, status: 'skipped', message: '', details: [], reason: outcome.skipped };\n if (outcome.ok) return { ...base, status: 'pass', message: '', details: [] };\n return { ...base, status: 'fail', message: check.message, details: outcome.details ?? [] };\n } catch (error: unknown) {\n const reason = error instanceof Error ? error.message : String(error);\n return { ...base, status: 'fail', message: check.message, details: [`the check itself threw: ${reason}`] };\n }\n}\n\n/**\n * Run every check (built-in, then the repo's own) against an already-loaded repo.\n */\nexport async function diagnose(repo: Repo): Promise<DoctorReport> {\n const extensions = await loadExtensions(repo, BUILTIN_CHECKS);\n const disabled = new Map(extensions.disabled.map((entry) => [entry.id, entry.reason]));\n const findings: Finding[] = [];\n for (const check of [...BUILTIN_CHECKS, ...extensions.checks]) findings.push(await runCheck(check, repo, disabled.get(check.id)));\n if (extensions.problems.length > 0) {\n findings.push({\n id: 'doctor.config',\n severity: 'error',\n status: 'fail',\n title: 'extensions.doctor is valid',\n message: 'The doctor extension block is invalid, so its checks and disables were not applied as written.',\n fix: 'Fix extensions.doctor in .rexezuge.jsonc: only WARN checks can be disabled, each with a reason.',\n autoFixable: false,\n details: extensions.problems,\n });\n }\n return {\n root: repo.root,\n cliVersion: CLI_VERSION,\n score: scoreOf(findings),\n errors: findings.filter((finding) => finding.status === 'fail' && finding.severity === 'error').length,\n warnings: findings.filter((finding) => finding.status === 'fail' && finding.severity === 'warn').length,\n findings,\n };\n}\n\nexport async function runDoctor(root: string): Promise<DoctorReport> {\n return diagnose(loadRepo(root));\n}\n"],
5
+ "mappings": "+EAAA,OAAS,YAAAA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B,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACpE,MAAO,CAAE,GAAGF,EAAM,OAAQ,OAAQ,QAASH,EAAM,QAAS,QAAS,CAAC,2BAA2BM,CAAM,EAAE,CAAC,CAC1G,CACF,CAZeR,EAAAC,EAAA,YAiBf,eAAsBQ,EAASN,EAAU,CACvC,MAAMO,EAAa,MAAMpB,EAAea,EAAMZ,CAAc,EACtDoB,EAAW,IAAI,IAAID,EAAW,SAAS,IAAKE,GAAU,CAACA,EAAM,GAAIA,EAAM,MAAM,CAAC,CAAC,EAC/ElB,EAAsB,CAAA,EAC5B,UAAWQ,IAAS,CAAC,GAAGX,EAAgB,GAAGmB,EAAW,MAAM,EAAGhB,EAAS,KAAK,MAAMO,EAASC,EAAOC,EAAMQ,EAAS,IAAIT,EAAM,EAAE,CAAC,CAAC,EAChI,OAAIQ,EAAW,SAAS,OAAS,GAC/BhB,EAAS,KAAK,CACZ,GAAI,gBACJ,SAAU,QACV,OAAQ,OACR,MAAO,6BACP,QAAS,iGACT,IAAK,kGACL,YAAa,GACb,QAASgB,EAAW,SACrB,EAEI,CACL,KAAMP,EAAK,KACX,WAAYd,EACZ,MAAOI,EAAQC,CAAQ,EACvB,OAAQA,EAAS,OAAQE,GAAYA,EAAQ,SAAW,QAAUA,EAAQ,WAAa,OAAO,EAAE,OAChG,SAAUF,EAAS,OAAQE,GAAYA,EAAQ,SAAW,QAAUA,EAAQ,WAAa,MAAM,EAAE,OACjG,SAAAF,EAEJ,CAzBsBM,EAAAS,EAAA,YA2BtB,eAAsBI,EAAUC,EAAY,CAC1C,OAAOL,EAASrB,EAAS0B,CAAI,CAAC,CAChC,CAFsBd,EAAAa,EAAA",
6
+ "names": ["loadRepo", "CLI_VERSION", "loadExtensions", "BUILTIN_CHECKS", "WEIGHT", "scoreOf", "findings", "counted", "finding", "total", "sum", "earned", "__name", "runCheck", "check", "repo", "disabledReason", "base", "outcome", "error", "reason", "diagnose", "extensions", "disabled", "entry", "runDoctor", "root"]
7
+ }
@@ -0,0 +1,75 @@
1
+ import type { Repo } from '../repo.ts';
2
+ export type Severity = 'error' | 'warn';
3
+ /**
4
+ * What a check answers about one repo. `skipped` carries the reason the check does not apply
5
+ * (a repo without D1 has no migrations lock to require); a skipped check is left out of the score.
6
+ */
7
+ export type CheckOutcome = {
8
+ readonly ok: true;
9
+ readonly skipped?: undefined;
10
+ } | {
11
+ readonly ok: false;
12
+ readonly details?: readonly string[];
13
+ readonly skipped?: undefined;
14
+ } | {
15
+ readonly skipped: string;
16
+ readonly ok?: undefined;
17
+ };
18
+ /**
19
+ * One conformance rule. The registry is the open side of doctor: the built-ins below, and the
20
+ * checks a repo adds through `extensions.doctor.checks`, are the same shape.
21
+ */
22
+ export interface Check {
23
+ /**
24
+ Stable, dotted, lower-case: `catalog.no-overrides`. A repo disables a WARN check by this id.
25
+ */
26
+ readonly id: string;
27
+ readonly severity: Severity;
28
+ /**
29
+ What the check requires, as a statement that is true when it passes.
30
+ */
31
+ readonly title: string;
32
+ /**
33
+ Why it failed, shown with the details.
34
+ */
35
+ readonly message: string;
36
+ /**
37
+ What a human does about it.
38
+ */
39
+ readonly fix: string;
40
+ /**
41
+ Whether `rexezuge sync --write` repairs it.
42
+ */
43
+ readonly autoFixable: boolean;
44
+ run(repo: Repo): CheckOutcome | Promise<CheckOutcome>;
45
+ }
46
+ export type FindingStatus = 'pass' | 'fail' | 'skipped' | 'disabled';
47
+ export interface Finding {
48
+ readonly id: string;
49
+ readonly severity: Severity;
50
+ readonly status: FindingStatus;
51
+ readonly title: string;
52
+ /**
53
+ Empty when the check passed.
54
+ */
55
+ readonly message: string;
56
+ readonly fix: string;
57
+ readonly autoFixable: boolean;
58
+ readonly details: readonly string[];
59
+ /**
60
+ Why it was skipped or disabled.
61
+ */
62
+ readonly reason?: string;
63
+ }
64
+ export interface DoctorReport {
65
+ readonly root: string;
66
+ readonly cliVersion: string;
67
+ /**
68
+ 0 to 100; 100 only when every applicable check passes.
69
+ */
70
+ readonly score: number;
71
+ readonly errors: number;
72
+ readonly warnings: number;
73
+ readonly findings: readonly Finding[];
74
+ }
75
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/doctor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAC1F;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB;;MAEE;IACF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;MAEE;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;MAEE;IACF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;MAEE;IACF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;MAEE;IACF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACvD;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;MAEE;IACF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;MAEE;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;MAEE;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CACvC"}
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `@rexezuge/cli`: the `rexezuge` command, and its pieces as functions.
3
+ */
4
+ export { run } from './cli.ts';
5
+ export type { CliDeps } from './cli.ts';
6
+ export { memoryIo, processIo, UsageError } from './io.ts';
7
+ export type { Io } from './io.ts';
8
+ export { BUILTIN_CHECKS } from './doctor/registry.ts';
9
+ export { diagnose, runDoctor, scoreOf } from './doctor/run.ts';
10
+ export type { Check, CheckOutcome, DoctorReport, Finding, FindingStatus, Severity } from './doctor/types.ts';
11
+ export { runSync } from './sync/run.ts';
12
+ export type { SyncResult } from './sync/run.ts';
13
+ export { loadRepo } from './repo.ts';
14
+ export type { Repo } from './repo.ts';
15
+ export { callersFor, renderCaller, WORKFLOW_REF, WORKFLOW_TAG } from './workflow-callers.ts';
16
+ export { planIdentity } from './commands/identity.ts';
17
+ export { CLI_VERSION } from './version.ts';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1D,YAAY,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{run as e}from"./cli.js";import{memoryIo as t,processIo as m,UsageError as f}from"./io.js";import{BUILTIN_CHECKS as n}from"./doctor/registry.js";import{diagnose as a,runDoctor as l,scoreOf as s}from"./doctor/run.js";import{runSync as c}from"./sync/run.js";import{loadRepo as d}from"./repo.js";import{callersFor as E,renderCaller as F,WORKFLOW_REF as L,WORKFLOW_TAG as W}from"./workflow-callers.js";import{planIdentity as u}from"./commands/identity.js";import{CLI_VERSION as K}from"./version.js";export{n as BUILTIN_CHECKS,K as CLI_VERSION,f as UsageError,L as WORKFLOW_REF,W as WORKFLOW_TAG,E as callersFor,a as diagnose,d as loadRepo,t as memoryIo,u as planIdentity,m as processIo,F as renderCaller,e as run,l as runDoctor,c as runSync,s as scoreOf};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["/**\n * `@rexezuge/cli`: the `rexezuge` command, and its pieces as functions.\n */\nexport { run } from './cli.ts';\nexport type { CliDeps } from './cli.ts';\nexport { memoryIo, processIo, UsageError } from './io.ts';\nexport type { Io } from './io.ts';\nexport { BUILTIN_CHECKS } from './doctor/registry.ts';\nexport { diagnose, runDoctor, scoreOf } from './doctor/run.ts';\nexport type { Check, CheckOutcome, DoctorReport, Finding, FindingStatus, Severity } from './doctor/types.ts';\nexport { runSync } from './sync/run.ts';\nexport type { SyncResult } from './sync/run.ts';\nexport { loadRepo } from './repo.ts';\nexport type { Repo } from './repo.ts';\nexport { callersFor, renderCaller, WORKFLOW_REF, WORKFLOW_TAG } from './workflow-callers.ts';\nexport { planIdentity } from './commands/identity.ts';\nexport { CLI_VERSION } from './version.ts';\n"],
5
+ "mappings": "AAGA,OAAS,OAAAA,MAAW,WAEpB,OAAS,YAAAC,EAAU,aAAAC,EAAW,cAAAC,MAAkB,UAEhD,OAAS,kBAAAC,MAAsB,uBAC/B,OAAS,YAAAC,EAAU,aAAAC,EAAW,WAAAC,MAAe,kBAE7C,OAAS,WAAAC,MAAe,gBAExB,OAAS,YAAAC,MAAgB,YAEzB,OAAS,cAAAC,EAAY,gBAAAC,EAAc,gBAAAC,EAAc,gBAAAC,MAAoB,wBACrE,OAAS,gBAAAC,MAAoB,yBAC7B,OAAS,eAAAC,MAAmB",
6
+ "names": ["run", "memoryIo", "processIo", "UsageError", "BUILTIN_CHECKS", "diagnose", "runDoctor", "scoreOf", "runSync", "loadRepo", "callersFor", "renderCaller", "WORKFLOW_REF", "WORKFLOW_TAG", "planIdentity", "CLI_VERSION"]
7
+ }