@ankhorage/doctor 0.2.0 → 0.3.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.
package/dist/commands.js CHANGED
@@ -1,6 +1,6 @@
1
- import { analyzeDoctorTarget } from "./analysis.js";
2
- import { countErrorDiagnostics, countWarningDiagnostics, } from "./diagnostics.js";
3
- import { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY } from "./packageMetadata.js";
1
+ import { analyzeDoctorTarget } from './analysis.js';
2
+ import { countErrorDiagnostics, countWarningDiagnostics, } from './diagnostics.js';
3
+ import { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY } from './packageMetadata.js';
4
4
  const COMMAND_CAPABILITIES = {
5
5
  validate: DOCTOR_CAPABILITIES[0],
6
6
  fix: DOCTOR_CAPABILITIES[1],
@@ -9,35 +9,35 @@ const COMMAND_CAPABILITIES = {
9
9
  };
10
10
  export const DOCTOR_COMMANDS = [
11
11
  {
12
- standaloneName: "validate",
13
- path: ["validate"],
12
+ standaloneName: 'validate',
13
+ path: ['validate'],
14
14
  capability: COMMAND_CAPABILITIES.validate,
15
- mode: "validate",
16
- summary: "Auto-detect lightweight repo and package diagnostics for a local path.",
15
+ mode: 'validate',
16
+ summary: 'Auto-detect the applicable doctor policy profile and validate a local path.',
17
17
  run: runValidateCommand,
18
18
  },
19
19
  {
20
- standaloneName: "fix",
21
- path: ["fix"],
20
+ standaloneName: 'fix',
21
+ path: ['fix'],
22
22
  capability: COMMAND_CAPABILITIES.fix,
23
- mode: "fix",
24
- summary: "Run the same lightweight checks and report that no automatic fixes exist yet.",
23
+ mode: 'fix',
24
+ summary: 'Build a non-mutating fix plan for deterministic doctor policy violations.',
25
25
  run: runFixCommand,
26
26
  },
27
27
  {
28
- standaloneName: "repo",
29
- path: ["repo"],
28
+ standaloneName: 'repo',
29
+ path: ['repo'],
30
30
  capability: COMMAND_CAPABILITIES.repo,
31
- mode: "repo",
32
- summary: "Force repo-light diagnostics for a repo/workspace-root candidate path.",
31
+ mode: 'repo',
32
+ summary: 'Force repo-light diagnostics for a repo/workspace-root candidate path.',
33
33
  run: runRepoCommand,
34
34
  },
35
35
  {
36
- standaloneName: "package",
37
- path: ["package"],
36
+ standaloneName: 'package',
37
+ path: ['package'],
38
38
  capability: COMMAND_CAPABILITIES.package,
39
- mode: "package",
40
- summary: "Force package-light diagnostics for a directory containing package.json.",
39
+ mode: 'package',
40
+ summary: 'Force package-light diagnostics for a directory containing package.json.',
41
41
  run: runPackageCommand,
42
42
  },
43
43
  ];
@@ -45,7 +45,7 @@ export async function runDoctorCommand(request, options = {}) {
45
45
  const services = createDoctorCommandServices(options.services);
46
46
  try {
47
47
  const parsedArgs = parseCommandArguments(request.command, request.argv);
48
- if (parsedArgs.kind === "help") {
48
+ if (parsedArgs.kind === 'help') {
49
49
  request.context.writeStdout(renderCommandHelp(request.command));
50
50
  return { exitCode: 0 };
51
51
  }
@@ -70,42 +70,37 @@ export function findDoctorCommandByStandaloneName(value) {
70
70
  return DOCTOR_COMMANDS.find((command) => command.standaloneName === value) ?? null;
71
71
  }
72
72
  export function renderRootHelp(version) {
73
- const commandLines = DOCTOR_COMMANDS.map((command) => ` ${command.standaloneName.padEnd(8, " ")} ${command.summary}`).join("\n");
73
+ const commandLines = DOCTOR_COMMANDS.map((command) => ` ${command.standaloneName.padEnd(8, ' ')} ${command.summary}`).join('\n');
74
74
  return [
75
75
  `@ankhorage/doctor v${version}`,
76
- "",
77
- "Usage:",
78
- " ankhorage-doctor <command> [path]",
76
+ '',
77
+ 'Usage:',
78
+ ' ankhorage-doctor <command> [path]',
79
79
  ` ankh ${DOCTOR_COMMAND_CATEGORY} <command> [path]`,
80
- "",
81
- "Commands:",
80
+ '',
81
+ 'Commands:',
82
82
  commandLines,
83
- "",
84
- "Path resolution:",
85
- " Pass [path], or omit it to validate the current working directory.",
86
- "",
87
- ].join("\n");
83
+ '',
84
+ 'Path resolution:',
85
+ ' Pass [path], or omit it to validate the current working directory.',
86
+ '',
87
+ ].join('\n');
88
88
  }
89
89
  export function renderUnknownCommand(value) {
90
- return [
91
- `Unknown doctor command: ${value}`,
92
- "",
93
- "Run ankhorage-doctor --help",
94
- "",
95
- ].join("\n");
90
+ return [`Unknown doctor command: ${value}`, '', 'Run ankhorage-doctor --help', ''].join('\n');
96
91
  }
97
92
  function renderCommandHelp(command) {
98
93
  return [
99
94
  command.summary,
100
- "",
101
- "Usage:",
95
+ '',
96
+ 'Usage:',
102
97
  ` ankhorage-doctor ${command.standaloneName} [path]`,
103
- ` ankh ${DOCTOR_COMMAND_CATEGORY} ${command.path.join(" ")} [path]`,
104
- "",
105
- "Path resolution:",
106
- " Pass [path], or omit it to validate the current working directory.",
107
- "",
108
- ].join("\n");
98
+ ` ankh ${DOCTOR_COMMAND_CATEGORY} ${command.path.join(' ')} [path]`,
99
+ '',
100
+ 'Path resolution:',
101
+ ' Pass [path], or omit it to validate the current working directory.',
102
+ '',
103
+ ].join('\n');
109
104
  }
110
105
  function createDoctorCommandServices(overrides = {}) {
111
106
  return {
@@ -113,15 +108,15 @@ function createDoctorCommandServices(overrides = {}) {
113
108
  };
114
109
  }
115
110
  function parseCommandArguments(command, argv) {
116
- const firstArg = argv[0];
111
+ const [firstArg] = argv;
117
112
  if (argv.length === 1 && firstArg !== undefined && isHelpToken(firstArg)) {
118
- return { kind: "help" };
113
+ return { kind: 'help' };
119
114
  }
120
115
  if (argv.length > 1) {
121
116
  throw new Error(`Doctor ${command.standaloneName} accepts at most one path argument.`);
122
117
  }
123
118
  return {
124
- kind: "run",
119
+ kind: 'run',
125
120
  inputPath: firstArg,
126
121
  };
127
122
  }
@@ -129,9 +124,9 @@ async function runValidateCommand(request, services) {
129
124
  const result = await services.analyzeTarget({
130
125
  cwd: request.context.cwd,
131
126
  inputPath: request.inputPath,
132
- mode: "validate",
127
+ mode: 'validate',
133
128
  });
134
- request.context.writeStdout(renderAnalysisReport("validate", result));
129
+ request.context.writeStdout(renderAnalysisReport('validate', result));
135
130
  return {
136
131
  exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,
137
132
  };
@@ -140,10 +135,9 @@ async function runFixCommand(request, services) {
140
135
  const result = await services.analyzeTarget({
141
136
  cwd: request.context.cwd,
142
137
  inputPath: request.inputPath,
143
- mode: "fix",
138
+ mode: 'fix',
144
139
  });
145
- request.context.writeStdout(renderAnalysisReport("fix", result));
146
- request.context.writeStdout("No automatic fixes available.\n");
140
+ request.context.writeStdout(renderAnalysisReport('fix', result));
147
141
  return {
148
142
  exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,
149
143
  };
@@ -152,9 +146,9 @@ async function runRepoCommand(request, services) {
152
146
  const result = await services.analyzeTarget({
153
147
  cwd: request.context.cwd,
154
148
  inputPath: request.inputPath,
155
- mode: "repo",
149
+ mode: 'repo',
156
150
  });
157
- request.context.writeStdout(renderAnalysisReport("repo", result));
151
+ request.context.writeStdout(renderAnalysisReport('repo', result));
158
152
  return {
159
153
  exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,
160
154
  };
@@ -163,9 +157,9 @@ async function runPackageCommand(request, services) {
163
157
  const result = await services.analyzeTarget({
164
158
  cwd: request.context.cwd,
165
159
  inputPath: request.inputPath,
166
- mode: "package",
160
+ mode: 'package',
167
161
  });
168
- request.context.writeStdout(renderAnalysisReport("package", result));
162
+ request.context.writeStdout(renderAnalysisReport('package', result));
169
163
  return {
170
164
  exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,
171
165
  };
@@ -174,34 +168,50 @@ function renderAnalysisReport(commandName, result) {
174
168
  const lines = [
175
169
  `doctor ${commandName}`,
176
170
  `target: ${result.targetPath}`,
177
- `checks: ${result.appliedChecks.length > 0 ? result.appliedChecks.join(", ") : "none"}`,
178
- `repoMarkers: ${result.repoMarkers.length > 0 ? result.repoMarkers.join(", ") : "none"}`,
179
- "",
180
- "Diagnostics:",
171
+ `profile: ${result.profile}`,
172
+ `checks: ${result.appliedChecks.length > 0 ? result.appliedChecks.join(', ') : 'none'}`,
173
+ `repoMarkers: ${result.repoMarkers.length > 0 ? result.repoMarkers.join(', ') : 'none'}`,
174
+ '',
175
+ 'Diagnostics:',
181
176
  ];
182
177
  if (result.diagnostics.length === 0) {
183
- lines.push(" none");
178
+ lines.push(' none');
184
179
  }
185
180
  else {
186
181
  for (const diagnostic of result.diagnostics) {
187
182
  lines.push(renderDiagnosticLine(diagnostic));
188
183
  }
189
184
  }
185
+ if (commandName === 'fix') {
186
+ lines.push('');
187
+ lines.push('Planned changes:');
188
+ if (result.plannedChanges.length === 0) {
189
+ lines.push(' none');
190
+ }
191
+ else {
192
+ for (const change of result.plannedChanges) {
193
+ lines.push(renderPlannedChangeLine(change));
194
+ }
195
+ }
196
+ }
190
197
  const errorCount = countErrorDiagnostics(result.diagnostics);
191
198
  const warningCount = countWarningDiagnostics(result.diagnostics);
192
- lines.push("");
199
+ lines.push('');
193
200
  lines.push(`Summary: ${errorCount} error(s), ${warningCount} warning(s)`);
194
- lines.push("");
195
- return lines.join("\n");
201
+ lines.push('');
202
+ return lines.join('\n');
196
203
  }
197
204
  function renderDiagnosticLine(diagnostic) {
198
- return ` - ${diagnostic.severity.toUpperCase()} ${diagnostic.code}: ${diagnostic.message}`;
205
+ return ` - ${diagnostic.severity.toUpperCase()} ${diagnostic.ruleId} (${diagnostic.code}): ${diagnostic.message}`;
206
+ }
207
+ function renderPlannedChangeLine(change) {
208
+ return ` - ${change.ruleId} [${change.kind}]: ${change.description}`;
199
209
  }
200
210
  function renderCommandFailure(commandName, error) {
201
211
  const message = error instanceof Error ? error.message : String(error);
202
- return [`Failed to run doctor ${commandName}: ${message}`, ""].join("\n");
212
+ return [`Failed to run doctor ${commandName}: ${message}`, ''].join('\n');
203
213
  }
204
214
  function isHelpToken(value) {
205
- return value === "--help" || value === "-h" || value === "help";
215
+ return value === '--help' || value === '-h' || value === 'help';
206
216
  }
207
217
  //# sourceMappingURL=commands.js.map
@@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O,EAAE,CAAC;AAC9F,CAAC;AAED,SAAS,oBAAoB,CAAC,WAA8B,EAAE,KAAc;IAC1E,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,wBAAwB,WAAW,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC;AAClE,CAAC","sourcesContent":["import type {\n AnkhCapabilityId,\n AnkhCommandDescriptor,\n} from \"@ankhorage/contracts/cli\";\n\nimport type { DoctorAnalysisResult, DoctorTargetMode } from \"./analysis.js\";\nimport { analyzeDoctorTarget } from \"./analysis.js\";\nimport {\n countErrorDiagnostics,\n countWarningDiagnostics,\n type DoctorDiagnostic,\n} from \"./diagnostics.js\";\nimport { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY } from \"./packageMetadata.js\";\nimport type { DoctorCommandContext, DoctorCommandRunResult } from \"./commandContext.js\";\n\ntype DoctorCommandName = \"fix\" | \"package\" | \"repo\" | \"validate\";\n\ninterface DoctorCommandRunRequest {\n readonly context: DoctorCommandContext;\n readonly inputPath?: string;\n}\n\ntype DoctorCommandImplementation = (\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n) => Promise<DoctorCommandRunResult>;\n\nexport interface DoctorCommandDefinition {\n readonly capability: AnkhCapabilityId;\n readonly mode: DoctorTargetMode;\n readonly path: readonly [DoctorCommandName];\n readonly standaloneName: DoctorCommandName;\n readonly summary: string;\n readonly run: DoctorCommandImplementation;\n}\n\nexport interface DoctorCommandInvocation {\n readonly argv: readonly string[];\n readonly command: DoctorCommandDefinition;\n readonly context: DoctorCommandContext;\n}\n\nexport interface DoctorCommandServices {\n readonly analyzeTarget: typeof analyzeDoctorTarget;\n}\n\nexport interface RunDoctorCommandOptions {\n readonly runCommandImpl?: RunDoctorCommandImpl;\n readonly services?: Partial<DoctorCommandServices>;\n}\n\nexport type RunDoctorCommandImpl = (\n request: DoctorCommandInvocation,\n options?: RunDoctorCommandOptions,\n) => Promise<DoctorCommandRunResult>;\n\nconst COMMAND_CAPABILITIES = {\n validate: DOCTOR_CAPABILITIES[0],\n fix: DOCTOR_CAPABILITIES[1],\n repo: DOCTOR_CAPABILITIES[2],\n package: DOCTOR_CAPABILITIES[3],\n} as const satisfies Record<DoctorCommandName, AnkhCapabilityId>;\n\nexport const DOCTOR_COMMANDS = [\n {\n standaloneName: \"validate\",\n path: [\"validate\"],\n capability: COMMAND_CAPABILITIES.validate,\n mode: \"validate\",\n summary: \"Auto-detect lightweight repo and package diagnostics for a local path.\",\n run: runValidateCommand,\n },\n {\n standaloneName: \"fix\",\n path: [\"fix\"],\n capability: COMMAND_CAPABILITIES.fix,\n mode: \"fix\",\n summary: \"Run the same lightweight checks and report that no automatic fixes exist yet.\",\n run: runFixCommand,\n },\n {\n standaloneName: \"repo\",\n path: [\"repo\"],\n capability: COMMAND_CAPABILITIES.repo,\n mode: \"repo\",\n summary: \"Force repo-light diagnostics for a repo/workspace-root candidate path.\",\n run: runRepoCommand,\n },\n {\n standaloneName: \"package\",\n path: [\"package\"],\n capability: COMMAND_CAPABILITIES.package,\n mode: \"package\",\n summary: \"Force package-light diagnostics for a directory containing package.json.\",\n run: runPackageCommand,\n },\n] as const satisfies readonly DoctorCommandDefinition[];\n\nexport async function runDoctorCommand(\n request: DoctorCommandInvocation,\n options: RunDoctorCommandOptions = {},\n): Promise<DoctorCommandRunResult> {\n const services = createDoctorCommandServices(options.services);\n\n try {\n const parsedArgs = parseCommandArguments(request.command, request.argv);\n if (parsedArgs.kind === \"help\") {\n request.context.writeStdout(renderCommandHelp(request.command));\n return { exitCode: 0 };\n }\n\n return await request.command.run(\n {\n context: request.context,\n inputPath: parsedArgs.inputPath,\n },\n services,\n );\n } catch (error) {\n request.context.writeStderr(\n renderCommandFailure(request.command.standaloneName, error),\n );\n return { exitCode: 1 };\n }\n}\n\nexport function createProviderCommandDescriptors(): readonly AnkhCommandDescriptor[] {\n return DOCTOR_COMMANDS.map((command) => ({\n capability: command.capability,\n path: command.path,\n summary: command.summary,\n }));\n}\n\nexport function findDoctorCommandByStandaloneName(\n value: string,\n): DoctorCommandDefinition | null {\n return DOCTOR_COMMANDS.find((command) => command.standaloneName === value) ?? null;\n}\n\nexport function renderRootHelp(version: string): string {\n const commandLines = DOCTOR_COMMANDS.map(\n (command) => ` ${command.standaloneName.padEnd(8, \" \")} ${command.summary}`,\n ).join(\"\\n\");\n\n return [\n `@ankhorage/doctor v${version}`,\n \"\",\n \"Usage:\",\n \" ankhorage-doctor <command> [path]\",\n ` ankh ${DOCTOR_COMMAND_CATEGORY} <command> [path]`,\n \"\",\n \"Commands:\",\n commandLines,\n \"\",\n \"Path resolution:\",\n \" Pass [path], or omit it to validate the current working directory.\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport function renderUnknownCommand(value: string): string {\n return [\n `Unknown doctor command: ${value}`,\n \"\",\n \"Run ankhorage-doctor --help\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderCommandHelp(command: DoctorCommandDefinition): string {\n return [\n command.summary,\n \"\",\n \"Usage:\",\n ` ankhorage-doctor ${command.standaloneName} [path]`,\n ` ankh ${DOCTOR_COMMAND_CATEGORY} ${command.path.join(\" \")} [path]`,\n \"\",\n \"Path resolution:\",\n \" Pass [path], or omit it to validate the current working directory.\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction createDoctorCommandServices(\n overrides: Partial<DoctorCommandServices> = {},\n): DoctorCommandServices {\n return {\n analyzeTarget: overrides.analyzeTarget ?? analyzeDoctorTarget,\n };\n}\n\nfunction parseCommandArguments(\n command: DoctorCommandDefinition,\n argv: readonly string[],\n): { readonly kind: \"help\" } | { readonly kind: \"run\"; readonly inputPath?: string } {\n const firstArg = argv[0];\n\n if (argv.length === 1 && firstArg !== undefined && isHelpToken(firstArg)) {\n return { kind: \"help\" };\n }\n\n if (argv.length > 1) {\n throw new Error(`Doctor ${command.standaloneName} accepts at most one path argument.`);\n }\n\n return {\n kind: \"run\",\n inputPath: firstArg,\n };\n}\n\nasync function runValidateCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: \"validate\",\n });\n\n request.context.writeStdout(renderAnalysisReport(\"validate\", result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runFixCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: \"fix\",\n });\n\n request.context.writeStdout(renderAnalysisReport(\"fix\", result));\n request.context.writeStdout(\"No automatic fixes available.\\n\");\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runRepoCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: \"repo\",\n });\n\n request.context.writeStdout(renderAnalysisReport(\"repo\", result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runPackageCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: \"package\",\n });\n\n request.context.writeStdout(renderAnalysisReport(\"package\", result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nfunction renderAnalysisReport(\n commandName: DoctorCommandName,\n result: DoctorAnalysisResult,\n): string {\n const lines = [\n `doctor ${commandName}`,\n `target: ${result.targetPath}`,\n `checks: ${result.appliedChecks.length > 0 ? result.appliedChecks.join(\", \") : \"none\"}`,\n `repoMarkers: ${result.repoMarkers.length > 0 ? result.repoMarkers.join(\", \") : \"none\"}`,\n \"\",\n \"Diagnostics:\",\n ];\n\n if (result.diagnostics.length === 0) {\n lines.push(\" none\");\n } else {\n for (const diagnostic of result.diagnostics) {\n lines.push(renderDiagnosticLine(diagnostic));\n }\n }\n\n const errorCount = countErrorDiagnostics(result.diagnostics);\n const warningCount = countWarningDiagnostics(result.diagnostics);\n\n lines.push(\"\");\n lines.push(`Summary: ${errorCount} error(s), ${warningCount} warning(s)`);\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n\nfunction renderDiagnosticLine(diagnostic: DoctorDiagnostic): string {\n return ` - ${diagnostic.severity.toUpperCase()} ${diagnostic.code}: ${diagnostic.message}`;\n}\n\nfunction renderCommandFailure(commandName: DoctorCommandName, error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return [`Failed to run doctor ${commandName}: ${message}`, \"\"].join(\"\\n\");\n}\n\nfunction isHelpToken(value: string): boolean {\n return value === \"--help\" || value === \"-h\" || value === \"help\";\n}\n"]}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AA2CpF,MAAM,oBAAoB,GAAG;IAC3B,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAChC,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAE,mB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AAU,CAAC,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;AACrH,CAAC;AAED,SAAS,uBAAuB,CAAC,MAA2B;IAC1D,OAAO,OAAO,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;AACxE,CAAC;AAED,SAAS,oBAAoB,CAAC,WAA8B,EAAE,KAAc;IAC1E,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,wBAAwB,WAAW,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC;AAClE,CAAC","sourcesContent":["import type { AnkhCapabilityId, AnkhCommandDescriptor } from '@ankhorage/contracts/cli';\n\nimport type { DoctorAnalysisResult, DoctorPlannedChange, DoctorTargetMode } from './analysis.js';\nimport { analyzeDoctorTarget } from './analysis.js';\nimport type { DoctorCommandContext, DoctorCommandRunResult } from './commandContext.js';\nimport {\n countErrorDiagnostics,\n countWarningDiagnostics,\n type DoctorDiagnostic,\n} from './diagnostics.js';\nimport { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY } from './packageMetadata.js';\n\ntype DoctorCommandName = 'fix' | 'package' | 'repo' | 'validate';\n\ninterface DoctorCommandRunRequest {\n readonly context: DoctorCommandContext;\n readonly inputPath?: string;\n}\n\ntype DoctorCommandImplementation = (\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n) => Promise<DoctorCommandRunResult>;\n\nexport interface DoctorCommandDefinition {\n readonly capability: AnkhCapabilityId;\n readonly mode: DoctorTargetMode;\n readonly path: readonly [DoctorCommandName];\n readonly standaloneName: DoctorCommandName;\n readonly summary: string;\n readonly run: DoctorCommandImplementation;\n}\n\nexport interface DoctorCommandInvocation {\n readonly argv: readonly string[];\n readonly command: DoctorCommandDefinition;\n readonly context: DoctorCommandContext;\n}\n\nexport interface DoctorCommandServices {\n readonly analyzeTarget: typeof analyzeDoctorTarget;\n}\n\nexport interface RunDoctorCommandOptions {\n readonly runCommandImpl?: RunDoctorCommandImpl;\n readonly services?: Partial<DoctorCommandServices>;\n}\n\nexport type RunDoctorCommandImpl = (\n request: DoctorCommandInvocation,\n options?: RunDoctorCommandOptions,\n) => Promise<DoctorCommandRunResult>;\n\nconst COMMAND_CAPABILITIES = {\n validate: DOCTOR_CAPABILITIES[0],\n fix: DOCTOR_CAPABILITIES[1],\n repo: DOCTOR_CAPABILITIES[2],\n package: DOCTOR_CAPABILITIES[3],\n} as const satisfies Record<DoctorCommandName, AnkhCapabilityId>;\n\nexport const DOCTOR_COMMANDS = [\n {\n standaloneName: 'validate',\n path: ['validate'],\n capability: COMMAND_CAPABILITIES.validate,\n mode: 'validate',\n summary: 'Auto-detect the applicable doctor policy profile and validate a local path.',\n run: runValidateCommand,\n },\n {\n standaloneName: 'fix',\n path: ['fix'],\n capability: COMMAND_CAPABILITIES.fix,\n mode: 'fix',\n summary: 'Build a non-mutating fix plan for deterministic doctor policy violations.',\n run: runFixCommand,\n },\n {\n standaloneName: 'repo',\n path: ['repo'],\n capability: COMMAND_CAPABILITIES.repo,\n mode: 'repo',\n summary: 'Force repo-light diagnostics for a repo/workspace-root candidate path.',\n run: runRepoCommand,\n },\n {\n standaloneName: 'package',\n path: ['package'],\n capability: COMMAND_CAPABILITIES.package,\n mode: 'package',\n summary: 'Force package-light diagnostics for a directory containing package.json.',\n run: runPackageCommand,\n },\n] as const satisfies readonly DoctorCommandDefinition[];\n\nexport async function runDoctorCommand(\n request: DoctorCommandInvocation,\n options: RunDoctorCommandOptions = {},\n): Promise<DoctorCommandRunResult> {\n const services = createDoctorCommandServices(options.services);\n\n try {\n const parsedArgs = parseCommandArguments(request.command, request.argv);\n if (parsedArgs.kind === 'help') {\n request.context.writeStdout(renderCommandHelp(request.command));\n return { exitCode: 0 };\n }\n\n return await request.command.run(\n {\n context: request.context,\n inputPath: parsedArgs.inputPath,\n },\n services,\n );\n } catch (error) {\n request.context.writeStderr(renderCommandFailure(request.command.standaloneName, error));\n return { exitCode: 1 };\n }\n}\n\nexport function createProviderCommandDescriptors(): readonly AnkhCommandDescriptor[] {\n return DOCTOR_COMMANDS.map((command) => ({\n capability: command.capability,\n path: command.path,\n summary: command.summary,\n }));\n}\n\nexport function findDoctorCommandByStandaloneName(value: string): DoctorCommandDefinition | null {\n return DOCTOR_COMMANDS.find((command) => command.standaloneName === value) ?? null;\n}\n\nexport function renderRootHelp(version: string): string {\n const commandLines = DOCTOR_COMMANDS.map(\n (command) => ` ${command.standaloneName.padEnd(8, ' ')} ${command.summary}`,\n ).join('\\n');\n\n return [\n `@ankhorage/doctor v${version}`,\n '',\n 'Usage:',\n ' ankhorage-doctor <command> [path]',\n ` ankh ${DOCTOR_COMMAND_CATEGORY} <command> [path]`,\n '',\n 'Commands:',\n commandLines,\n '',\n 'Path resolution:',\n ' Pass [path], or omit it to validate the current working directory.',\n '',\n ].join('\\n');\n}\n\nexport function renderUnknownCommand(value: string): string {\n return [`Unknown doctor command: ${value}`, '', 'Run ankhorage-doctor --help', ''].join('\\n');\n}\n\nfunction renderCommandHelp(command: DoctorCommandDefinition): string {\n return [\n command.summary,\n '',\n 'Usage:',\n ` ankhorage-doctor ${command.standaloneName} [path]`,\n ` ankh ${DOCTOR_COMMAND_CATEGORY} ${command.path.join(' ')} [path]`,\n '',\n 'Path resolution:',\n ' Pass [path], or omit it to validate the current working directory.',\n '',\n ].join('\\n');\n}\n\nfunction createDoctorCommandServices(\n overrides: Partial<DoctorCommandServices> = {},\n): DoctorCommandServices {\n return {\n analyzeTarget: overrides.analyzeTarget ?? analyzeDoctorTarget,\n };\n}\n\nfunction parseCommandArguments(\n command: DoctorCommandDefinition,\n argv: readonly string[],\n): { readonly kind: 'help' } | { readonly kind: 'run'; readonly inputPath?: string } {\n const [firstArg] = argv;\n\n if (argv.length === 1 && firstArg !== undefined && isHelpToken(firstArg)) {\n return { kind: 'help' };\n }\n\n if (argv.length > 1) {\n throw new Error(`Doctor ${command.standaloneName} accepts at most one path argument.`);\n }\n\n return {\n kind: 'run',\n inputPath: firstArg,\n };\n}\n\nasync function runValidateCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: 'validate',\n });\n\n request.context.writeStdout(renderAnalysisReport('validate', result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runFixCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: 'fix',\n });\n\n request.context.writeStdout(renderAnalysisReport('fix', result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runRepoCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: 'repo',\n });\n\n request.context.writeStdout(renderAnalysisReport('repo', result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nasync function runPackageCommand(\n request: DoctorCommandRunRequest,\n services: DoctorCommandServices,\n): Promise<DoctorCommandRunResult> {\n const result = await services.analyzeTarget({\n cwd: request.context.cwd,\n inputPath: request.inputPath,\n mode: 'package',\n });\n\n request.context.writeStdout(renderAnalysisReport('package', result));\n\n return {\n exitCode: countErrorDiagnostics(result.diagnostics) > 0 ? 1 : 0,\n };\n}\n\nfunction renderAnalysisReport(\n commandName: DoctorCommandName,\n result: DoctorAnalysisResult,\n): string {\n const lines = [\n `doctor ${commandName}`,\n `target: ${result.targetPath}`,\n `profile: ${result.profile}`,\n `checks: ${result.appliedChecks.length > 0 ? result.appliedChecks.join(', ') : 'none'}`,\n `repoMarkers: ${result.repoMarkers.length > 0 ? result.repoMarkers.join(', ') : 'none'}`,\n '',\n 'Diagnostics:',\n ];\n\n if (result.diagnostics.length === 0) {\n lines.push(' none');\n } else {\n for (const diagnostic of result.diagnostics) {\n lines.push(renderDiagnosticLine(diagnostic));\n }\n }\n\n if (commandName === 'fix') {\n lines.push('');\n lines.push('Planned changes:');\n\n if (result.plannedChanges.length === 0) {\n lines.push(' none');\n } else {\n for (const change of result.plannedChanges) {\n lines.push(renderPlannedChangeLine(change));\n }\n }\n }\n\n const errorCount = countErrorDiagnostics(result.diagnostics);\n const warningCount = countWarningDiagnostics(result.diagnostics);\n\n lines.push('');\n lines.push(`Summary: ${errorCount} error(s), ${warningCount} warning(s)`);\n lines.push('');\n\n return lines.join('\\n');\n}\n\nfunction renderDiagnosticLine(diagnostic: DoctorDiagnostic): string {\n return ` - ${diagnostic.severity.toUpperCase()} ${diagnostic.ruleId} (${diagnostic.code}): ${diagnostic.message}`;\n}\n\nfunction renderPlannedChangeLine(change: DoctorPlannedChange): string {\n return ` - ${change.ruleId} [${change.kind}]: ${change.description}`;\n}\n\nfunction renderCommandFailure(commandName: DoctorCommandName, error: unknown): string {\n const message = error instanceof Error ? error.message : String(error);\n return [`Failed to run doctor ${commandName}: ${message}`, ''].join('\\n');\n}\n\nfunction isHelpToken(value: string): boolean {\n return value === '--help' || value === '-h' || value === 'help';\n}\n"]}
@@ -1,9 +1,13 @@
1
- export type DoctorDiagnosticCode = "invalid-ankh-metadata" | "invalid-package-json" | "missing-changelog" | "missing-changeset-directory" | "missing-license" | "missing-readme" | "missing-workflows-directory" | "package-json-missing" | "package-name-missing" | "package-type-missing" | "package-version-missing" | "repo-markers-missing" | "target-not-directory" | "target-not-found" | "unsupported-target";
2
- export type DoctorDiagnosticSeverity = "error" | "warning";
1
+ export type DoctorDiagnosticCode = 'field-invalid' | 'field-missing' | 'invalid-ankh-metadata' | 'invalid-package-json' | 'missing-dependency' | 'missing-path' | 'missing-script' | 'provider-source-import-failed' | 'provider-source-missing' | 'target-not-directory' | 'target-not-found' | 'unsupported-target';
2
+ export type DoctorDiagnosticSeverity = 'error' | 'warning';
3
+ export type DoctorPolicyProfile = 'integration-monorepo' | 'public-package' | 'unknown';
4
+ export type DoctorRuleId = 'integration.package.ankh.disallowed' | 'integration.package.private.required' | 'integration.package.workspaces.required' | 'package.ankh.capabilities.match-provider' | 'package.ankh.present.valid-shape' | 'package.ankh.provider-path.required' | 'package.ankh.required-for-provider' | 'package.dependencies.changesets.required' | 'package.dependencies.devtools.required' | 'package.dependencies.paradox.required' | 'package.dependencies.types-bun.required' | 'package.dependencies.types-node.required' | 'package.dependencies.typescript.required' | 'package.json.bugs.required' | 'package.json.description.required' | 'package.json.exports.required' | 'package.json.files.required' | 'package.json.homepage.required' | 'package.json.keywords.required' | 'package.json.license.required' | 'package.json.name.required' | 'package.json.package-manager.bun' | 'package.json.package-manager.required' | 'package.json.private.public-package-disallowed' | 'package.json.publish-config.public' | 'package.json.publish-config.required' | 'package.json.repository.required' | 'package.json.type.module' | 'package.json.type.required' | 'package.json.version.required' | 'package.scripts.build.required' | 'package.scripts.changeset-status.required' | 'package.scripts.changeset.required' | 'package.scripts.docs.required' | 'package.scripts.format-check.required' | 'package.scripts.format.required' | 'package.scripts.knip.required' | 'package.scripts.lint-fix.required' | 'package.scripts.lint.required' | 'package.scripts.test.required' | 'package.scripts.typecheck.required' | 'package.scripts.version-packages.required' | 'provider.commands.match-capabilities' | 'provider.commands.match-handlers' | 'provider.source.importable' | 'provider.source.required' | 'repo.changelog.required' | 'repo.changeset.required' | 'repo.license.required' | 'repo.readme.required' | 'repo.workflows.required' | 'target.package-json.required' | 'target.path.directory' | 'target.path.exists' | 'target.profile.supported' | 'target.repo-markers.required';
3
5
  export interface DoctorDiagnostic {
4
6
  readonly code: DoctorDiagnosticCode;
5
7
  readonly message: string;
6
8
  readonly path: string;
9
+ readonly profile: DoctorPolicyProfile;
10
+ readonly ruleId: DoctorRuleId;
7
11
  readonly severity: DoctorDiagnosticSeverity;
8
12
  }
9
13
  export declare function countErrorDiagnostics(diagnostics: readonly DoctorDiagnostic[]): number;
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,uBAAuB,GACvB,sBAAsB,GACtB,mBAAmB,GACnB,6BAA6B,GAC7B,iBAAiB,GACjB,gBAAgB,GAChB,6BAA6B,GAC7B,sBAAsB,GACtB,sBAAsB,GACtB,sBAAsB,GACtB,yBAAyB,GACzB,sBAAsB,GACtB,sBAAsB,GACtB,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,MAAM,CAGR;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,MAAM,CAGR"}
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,eAAe,GACf,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,GACp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AC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAEtF;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAExF"}
@@ -1,9 +1,7 @@
1
1
  export function countErrorDiagnostics(diagnostics) {
2
- return diagnostics.filter((diagnostic) => diagnostic.severity === "error")
3
- .length;
2
+ return diagnostics.filter((diagnostic) => diagnostic.severity === 'error').length;
4
3
  }
5
4
  export function countWarningDiagnostics(diagnostics) {
6
- return diagnostics.filter((diagnostic) => diagnostic.severity === "warning")
7
- .length;
5
+ return diagnostics.filter((diagnostic) => diagnostic.severity === 'warning').length;
8
6
  }
9
7
  //# sourceMappingURL=diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,qBAAqB,CACnC,WAAwC;IAExC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC;SACvE,MAAM,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,WAAwC;IAExC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,CAAC;SACzE,MAAM,CAAC;AACZ,CAAC","sourcesContent":["export type DoctorDiagnosticCode =\n | \"invalid-ankh-metadata\"\n | \"invalid-package-json\"\n | \"missing-changelog\"\n | \"missing-changeset-directory\"\n | \"missing-license\"\n | \"missing-readme\"\n | \"missing-workflows-directory\"\n | \"package-json-missing\"\n | \"package-name-missing\"\n | \"package-type-missing\"\n | \"package-version-missing\"\n | \"repo-markers-missing\"\n | \"target-not-directory\"\n | \"target-not-found\"\n | \"unsupported-target\";\n\nexport type DoctorDiagnosticSeverity = \"error\" | \"warning\";\n\nexport interface DoctorDiagnostic {\n readonly code: DoctorDiagnosticCode;\n readonly message: string;\n readonly path: string;\n readonly severity: DoctorDiagnosticSeverity;\n}\n\nexport function countErrorDiagnostics(\n diagnostics: readonly DoctorDiagnostic[],\n): number {\n return diagnostics.filter((diagnostic) => diagnostic.severity === \"error\")\n .length;\n}\n\nexport function countWarningDiagnostics(\n diagnostics: readonly DoctorDiagnostic[],\n): number {\n return diagnostics.filter((diagnostic) => diagnostic.severity === \"warning\")\n .length;\n}\n"]}
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAmFA,MAAM,UAAU,qBAAqB,CAAC,WAAwC;IAC5E,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,WAAwC;IAC9E,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;AACtF,CAAC","sourcesContent":["export type DoctorDiagnosticCode =\n | 'field-invalid'\n | 'field-missing'\n | 'invalid-ankh-metadata'\n | 'invalid-package-json'\n | 'missing-dependency'\n | 'missing-path'\n | 'missing-script'\n | 'provider-source-import-failed'\n | 'provider-source-missing'\n | 'target-not-directory'\n | 'target-not-found'\n | 'unsupported-target';\n\nexport type DoctorDiagnosticSeverity = 'error' | 'warning';\nexport type DoctorPolicyProfile = 'integration-monorepo' | 'public-package' | 'unknown';\nexport type DoctorRuleId =\n | 'integration.package.ankh.disallowed'\n | 'integration.package.private.required'\n | 'integration.package.workspaces.required'\n | 'package.ankh.capabilities.match-provider'\n | 'package.ankh.present.valid-shape'\n | 'package.ankh.provider-path.required'\n | 'package.ankh.required-for-provider'\n | 'package.dependencies.changesets.required'\n | 'package.dependencies.devtools.required'\n | 'package.dependencies.paradox.required'\n | 'package.dependencies.types-bun.required'\n | 'package.dependencies.types-node.required'\n | 'package.dependencies.typescript.required'\n | 'package.json.bugs.required'\n | 'package.json.description.required'\n | 'package.json.exports.required'\n | 'package.json.files.required'\n | 'package.json.homepage.required'\n | 'package.json.keywords.required'\n | 'package.json.license.required'\n | 'package.json.name.required'\n | 'package.json.package-manager.bun'\n | 'package.json.package-manager.required'\n | 'package.json.private.public-package-disallowed'\n | 'package.json.publish-config.public'\n | 'package.json.publish-config.required'\n | 'package.json.repository.required'\n | 'package.json.type.module'\n | 'package.json.type.required'\n | 'package.json.version.required'\n | 'package.scripts.build.required'\n | 'package.scripts.changeset-status.required'\n | 'package.scripts.changeset.required'\n | 'package.scripts.docs.required'\n | 'package.scripts.format-check.required'\n | 'package.scripts.format.required'\n | 'package.scripts.knip.required'\n | 'package.scripts.lint-fix.required'\n | 'package.scripts.lint.required'\n | 'package.scripts.test.required'\n | 'package.scripts.typecheck.required'\n | 'package.scripts.version-packages.required'\n | 'provider.commands.match-capabilities'\n | 'provider.commands.match-handlers'\n | 'provider.source.importable'\n | 'provider.source.required'\n | 'repo.changelog.required'\n | 'repo.changeset.required'\n | 'repo.license.required'\n | 'repo.readme.required'\n | 'repo.workflows.required'\n | 'target.package-json.required'\n | 'target.path.directory'\n | 'target.path.exists'\n | 'target.profile.supported'\n | 'target.repo-markers.required';\n\nexport interface DoctorDiagnostic {\n readonly code: DoctorDiagnosticCode;\n readonly message: string;\n readonly path: string;\n readonly profile: DoctorPolicyProfile;\n readonly ruleId: DoctorRuleId;\n readonly severity: DoctorDiagnosticSeverity;\n}\n\nexport function countErrorDiagnostics(diagnostics: readonly DoctorDiagnostic[]): number {\n return diagnostics.filter((diagnostic) => diagnostic.severity === 'error').length;\n}\n\nexport function countWarningDiagnostics(diagnostics: readonly DoctorDiagnostic[]): number {\n return diagnostics.filter((diagnostic) => diagnostic.severity === 'warning').length;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { runCli } from "./cli.js";
2
- export type { DoctorCommandContext, DoctorCommandRunResult } from "./commandContext.js";
3
- export { createDefaultCommandContext } from "./commandContext.js";
4
- export type { DoctorAnalysisRequest, DoctorAnalysisResult, DoctorTargetCheck, DoctorTargetMode, } from "./analysis.js";
5
- export { analyzeDoctorTarget } from "./analysis.js";
6
- export { createDoctorRuntimeProvider, type CreateDoctorRuntimeProviderOptions, } from "./ankh.provider.js";
7
- export type { DoctorDiagnostic, DoctorDiagnosticCode, DoctorDiagnosticSeverity, } from "./diagnostics.js";
8
- export { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY, DOCTOR_PACKAGE_METADATA, DOCTOR_PACKAGE_NAME, DOCTOR_PACKAGE_VERSION, } from "./packageMetadata.js";
1
+ export type { DoctorAnalysisRequest, DoctorAnalysisResult, DoctorFixPlan, DoctorPlannedChange, DoctorPlannedChangeKind, DoctorTargetCheck, DoctorTargetMode, } from './analysis.js';
2
+ export { analyzeDoctorTarget } from './analysis.js';
3
+ export { createDoctorRuntimeProvider, type CreateDoctorRuntimeProviderOptions, } from './ankh.provider.js';
4
+ export { runCli } from './cli.js';
5
+ export type { DoctorCommandContext, DoctorCommandRunResult } from './commandContext.js';
6
+ export { createDefaultCommandContext } from './commandContext.js';
7
+ export type { DoctorDiagnostic, DoctorDiagnosticCode, DoctorDiagnosticSeverity, DoctorPolicyProfile, DoctorRuleId, } from './diagnostics.js';
8
+ export { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY, DOCTOR_PACKAGE_METADATA, DOCTOR_PACKAGE_NAME, DOCTOR_PACKAGE_VERSION, } from './packageMetadata.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { runCli } from "./cli.js";
2
- export { createDefaultCommandContext } from "./commandContext.js";
3
- export { analyzeDoctorTarget } from "./analysis.js";
4
- export { createDoctorRuntimeProvider, } from "./ankh.provider.js";
5
- export { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY, DOCTOR_PACKAGE_METADATA, DOCTOR_PACKAGE_NAME, DOCTOR_PACKAGE_VERSION, } from "./packageMetadata.js";
1
+ export { analyzeDoctorTarget } from './analysis.js';
2
+ export { createDoctorRuntimeProvider, } from './ankh.provider.js';
3
+ export { runCli } from './cli.js';
4
+ export { createDefaultCommandContext } from './commandContext.js';
5
+ export { DOCTOR_CAPABILITIES, DOCTOR_COMMAND_CATEGORY, DOCTOR_PACKAGE_METADATA, DOCTOR_PACKAGE_NAME, DOCTOR_PACKAGE_VERSION, } from './packageMetadata.js';
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAOlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC","sourcesContent":["export { runCli } from \"./cli.js\";\nexport type { DoctorCommandContext, DoctorCommandRunResult } from \"./commandContext.js\";\nexport { createDefaultCommandContext } from \"./commandContext.js\";\nexport type {\n DoctorAnalysisRequest,\n DoctorAnalysisResult,\n DoctorTargetCheck,\n DoctorTargetMode,\n} from \"./analysis.js\";\nexport { analyzeDoctorTarget } from \"./analysis.js\";\nexport {\n createDoctorRuntimeProvider,\n type CreateDoctorRuntimeProviderOptions,\n} from \"./ankh.provider.js\";\nexport type {\n DoctorDiagnostic,\n DoctorDiagnosticCode,\n DoctorDiagnosticSeverity,\n} from \"./diagnostics.js\";\nexport {\n DOCTOR_CAPABILITIES,\n DOCTOR_COMMAND_CATEGORY,\n DOCTOR_PACKAGE_METADATA,\n DOCTOR_PACKAGE_NAME,\n DOCTOR_PACKAGE_VERSION,\n} from \"./packageMetadata.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAQlE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC","sourcesContent":["export type {\n DoctorAnalysisRequest,\n DoctorAnalysisResult,\n DoctorFixPlan,\n DoctorPlannedChange,\n DoctorPlannedChangeKind,\n DoctorTargetCheck,\n DoctorTargetMode,\n} from './analysis.js';\nexport { analyzeDoctorTarget } from './analysis.js';\nexport {\n createDoctorRuntimeProvider,\n type CreateDoctorRuntimeProviderOptions,\n} from './ankh.provider.js';\nexport { runCli } from './cli.js';\nexport type { DoctorCommandContext, DoctorCommandRunResult } from './commandContext.js';\nexport { createDefaultCommandContext } from './commandContext.js';\nexport type {\n DoctorDiagnostic,\n DoctorDiagnosticCode,\n DoctorDiagnosticSeverity,\n DoctorPolicyProfile,\n DoctorRuleId,\n} from './diagnostics.js';\nexport {\n DOCTOR_CAPABILITIES,\n DOCTOR_COMMAND_CATEGORY,\n DOCTOR_PACKAGE_METADATA,\n DOCTOR_PACKAGE_NAME,\n DOCTOR_PACKAGE_VERSION,\n} from './packageMetadata.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"packageMetadata.d.ts","sourceRoot":"","sources":["../src/packageMetadata.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,UACa,CAAC;AAClD,eAAO,MAAM,mBAAmB,6EAKgB,CAAC;AAEjD,eAAO,MAAM,uBAAuB;;;;CAII,CAAC"}
1
+ {"version":3,"file":"packageMetadata.d.ts","sourceRoot":"","sources":["../src/packageMetadata.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,UAAkD,CAAC;AACvF,eAAO,MAAM,mBAAmB,6EAKgB,CAAC;AAEjD,eAAO,MAAM,uBAAuB;;;;CAII,CAAC"}
@@ -1,16 +1,16 @@
1
- import packageJson from "../package.json";
1
+ import packageJson from '../package.json';
2
2
  export const DOCTOR_PACKAGE_NAME = packageJson.name;
3
3
  export const DOCTOR_PACKAGE_VERSION = packageJson.version;
4
- export const DOCTOR_COMMAND_CATEGORY = "doctor";
4
+ export const DOCTOR_COMMAND_CATEGORY = 'doctor';
5
5
  export const DOCTOR_CAPABILITIES = [
6
- "doctor.validate",
7
- "doctor.fix",
8
- "doctor.repo",
9
- "doctor.package",
6
+ 'doctor.validate',
7
+ 'doctor.fix',
8
+ 'doctor.repo',
9
+ 'doctor.package',
10
10
  ];
11
11
  export const DOCTOR_PACKAGE_METADATA = {
12
12
  category: DOCTOR_COMMAND_CATEGORY,
13
- provider: "./dist/ankh.provider.js",
13
+ provider: './dist/ankh.provider.js',
14
14
  capabilities: DOCTOR_CAPABILITIES,
15
15
  };
16
16
  //# sourceMappingURL=packageMetadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageMetadata.js","sourceRoot":"","sources":["../src/packageMetadata.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAClC,QAA+C,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,gBAAgB;CAC8B,CAAC;AAEjD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,uBAAuB;IACjC,QAAQ,EAAE,yBAAyB;IACnC,YAAY,EAAE,mBAAmB;CACK,CAAC","sourcesContent":["import type {\n AnkhCapabilityId,\n AnkhCommandCategory,\n AnkhPackageMetadata,\n} from \"@ankhorage/contracts/cli\";\n\nimport packageJson from \"../package.json\";\n\nexport const DOCTOR_PACKAGE_NAME = packageJson.name;\nexport const DOCTOR_PACKAGE_VERSION = packageJson.version;\nexport const DOCTOR_COMMAND_CATEGORY =\n \"doctor\" as const satisfies AnkhCommandCategory;\nexport const DOCTOR_CAPABILITIES = [\n \"doctor.validate\",\n \"doctor.fix\",\n \"doctor.repo\",\n \"doctor.package\",\n] as const satisfies readonly AnkhCapabilityId[];\n\nexport const DOCTOR_PACKAGE_METADATA = {\n category: DOCTOR_COMMAND_CATEGORY,\n provider: \"./dist/ankh.provider.js\",\n capabilities: DOCTOR_CAPABILITIES,\n} as const satisfies AnkhPackageMetadata;\n"]}
1
+ {"version":3,"file":"packageMetadata.js","sourceRoot":"","sources":["../src/packageMetadata.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAA+C,CAAC;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,gBAAgB;CAC8B,CAAC;AAEjD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,uBAAuB;IACjC,QAAQ,EAAE,yBAAyB;IACnC,YAAY,EAAE,mBAAmB;CACK,CAAC","sourcesContent":["import type {\n AnkhCapabilityId,\n AnkhCommandCategory,\n AnkhPackageMetadata,\n} from '@ankhorage/contracts/cli';\n\nimport packageJson from '../package.json';\n\nexport const DOCTOR_PACKAGE_NAME = packageJson.name;\nexport const DOCTOR_PACKAGE_VERSION = packageJson.version;\nexport const DOCTOR_COMMAND_CATEGORY = 'doctor' as const satisfies AnkhCommandCategory;\nexport const DOCTOR_CAPABILITIES = [\n 'doctor.validate',\n 'doctor.fix',\n 'doctor.repo',\n 'doctor.package',\n] as const satisfies readonly AnkhCapabilityId[];\n\nexport const DOCTOR_PACKAGE_METADATA = {\n category: DOCTOR_COMMAND_CATEGORY,\n provider: './dist/ankh.provider.js',\n capabilities: DOCTOR_CAPABILITIES,\n} as const satisfies AnkhPackageMetadata;\n"]}
@@ -1,4 +1,4 @@
1
- import { runCli } from "./cli.js";
1
+ import { runCli } from './cli.js';
2
2
  /***
3
3
  * Provider and CLI surface
4
4
  *
@@ -16,10 +16,18 @@ import { runCli } from "./cli.js";
16
16
  * - `repo`
17
17
  * - `package`
18
18
  *
19
- * `doctor#1` intentionally stays lightweight:
19
+ * `doctor#2` adds a profile-based policy engine:
20
20
  *
21
- * - path-aware local repo/package diagnostics are implemented now
22
- * - GitHub checks, CI checks, full policy enforcement, and autofix rules are deferred
21
+ * - strict `public-package` validation for extracted public package repos
22
+ * - light recognized `integration-monorepo` validation for `ankhorage4`
23
+ * - non-mutating `fix` plans for deterministic mechanical changes only
24
+ *
25
+ * Still deferred:
26
+ *
27
+ * - GitHub checks
28
+ * - CI checks
29
+ * - on-disk `fix --apply`
30
+ * - deeper cross-repo policy enforcement
23
31
  *
24
32
  * Path handling:
25
33
  *
@@ -28,5 +36,5 @@ import { runCli } from "./cli.js";
28
36
  *
29
37
  * @usage
30
38
  */
31
- await runCli(["--help"]);
39
+ await runCli(['--help']);
32
40
  //# sourceMappingURL=readme-usage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readme-usage.js","sourceRoot":"","sources":["../src/readme-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import { runCli } from \"./cli.js\";\n\n/***\n * Provider and CLI surface\n *\n * `@ankhorage/doctor` is the repo/package compliance provider for Ankhorage.\n *\n * The same shared command implementation backs both:\n *\n * - `ankh doctor ...`\n * - `bunx @ankhorage/doctor ...`\n *\n * Current command surface:\n *\n * - `validate`\n * - `fix`\n * - `repo`\n * - `package`\n *\n * `doctor#1` intentionally stays lightweight:\n *\n * - path-aware local repo/package diagnostics are implemented now\n * - GitHub checks, CI checks, full policy enforcement, and autofix rules are deferred\n *\n * Path handling:\n *\n * - pass `[path]`, or\n * - omit it to inspect the current working directory\n *\n * @usage\n */\nawait runCli([\"--help\"]);\n"]}
1
+ {"version":3,"file":"readme-usage.js","sourceRoot":"","sources":["../src/readme-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import { runCli } from './cli.js';\n\n/***\n * Provider and CLI surface\n *\n * `@ankhorage/doctor` is the repo/package compliance provider for Ankhorage.\n *\n * The same shared command implementation backs both:\n *\n * - `ankh doctor ...`\n * - `bunx @ankhorage/doctor ...`\n *\n * Current command surface:\n *\n * - `validate`\n * - `fix`\n * - `repo`\n * - `package`\n *\n * `doctor#2` adds a profile-based policy engine:\n *\n * - strict `public-package` validation for extracted public package repos\n * - light recognized `integration-monorepo` validation for `ankhorage4`\n * - non-mutating `fix` plans for deterministic mechanical changes only\n *\n * Still deferred:\n *\n * - GitHub checks\n * - CI checks\n * - on-disk `fix --apply`\n * - deeper cross-repo policy enforcement\n *\n * Path handling:\n *\n * - pass `[path]`, or\n * - omit it to inspect the current working directory\n *\n * @usage\n */\nawait runCli(['--help']);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/doctor",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Executable Ankh provider and standalone CLI for lightweight repo and package compliance diagnostics.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {