@shrkcrft/inspector 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (112) hide show
  1. package/dist/agent-brief.d.ts.map +1 -1
  2. package/dist/agent-brief.js +59 -10
  3. package/dist/agent-task-prep.d.ts.map +1 -1
  4. package/dist/agent-task-prep.js +1 -3
  5. package/dist/ai-readiness.d.ts +84 -9
  6. package/dist/ai-readiness.d.ts.map +1 -1
  7. package/dist/ai-readiness.js +161 -30
  8. package/dist/apply-dispatch-trace.d.ts +1 -2
  9. package/dist/apply-dispatch-trace.d.ts.map +1 -1
  10. package/dist/apply-dispatch-trace.js +0 -9
  11. package/dist/area-explore.d.ts.map +1 -1
  12. package/dist/area-explore.js +1 -5
  13. package/dist/area-map.d.ts +0 -5
  14. package/dist/area-map.d.ts.map +1 -1
  15. package/dist/area-map.js +0 -10
  16. package/dist/compliance-profiles.js +1 -1
  17. package/dist/construct-adoption.d.ts.map +1 -1
  18. package/dist/construct-adoption.js +10 -11
  19. package/dist/construct-registry.d.ts.map +1 -1
  20. package/dist/construct-registry.js +2 -10
  21. package/dist/contract-template-registry.d.ts.map +1 -1
  22. package/dist/contract-template-registry.js +2 -10
  23. package/dist/convention-registry.d.ts.map +1 -1
  24. package/dist/convention-registry.js +2 -10
  25. package/dist/decision-records.d.ts.map +1 -1
  26. package/dist/decision-records.js +2 -9
  27. package/dist/demo-script.d.ts +0 -1
  28. package/dist/demo-script.d.ts.map +1 -1
  29. package/dist/demo-script.js +0 -43
  30. package/dist/docs-check.js +1 -1
  31. package/dist/drift-baseline.d.ts.map +1 -1
  32. package/dist/drift-baseline.js +5 -2
  33. package/dist/feedback-ingestion.d.ts.map +1 -1
  34. package/dist/feedback-ingestion.js +2 -16
  35. package/dist/helper-registry.d.ts +27 -54
  36. package/dist/helper-registry.d.ts.map +1 -1
  37. package/dist/helper-registry.js +16 -517
  38. package/dist/impact-analysis.d.ts.map +1 -1
  39. package/dist/impact-analysis.js +4 -5
  40. package/dist/index.d.ts +1 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +1 -2
  43. package/dist/migration-profile-registry.d.ts.map +1 -1
  44. package/dist/migration-profile-registry.js +2 -10
  45. package/dist/monorepo-onboarding.js +2 -2
  46. package/dist/onboarding-report.d.ts.map +1 -1
  47. package/dist/onboarding-report.js +5 -1
  48. package/dist/onboarding.d.ts +1 -1
  49. package/dist/onboarding.d.ts.map +1 -1
  50. package/dist/onboarding.js +5 -64
  51. package/dist/ownership.js +2 -10
  52. package/dist/pack-contributions-inventory.d.ts +0 -1
  53. package/dist/pack-contributions-inventory.d.ts.map +1 -1
  54. package/dist/pack-contributions-inventory.js +0 -24
  55. package/dist/pack-helper-registry.d.ts.map +1 -1
  56. package/dist/pack-helper-registry.js +2 -10
  57. package/dist/pack-release-check.d.ts.map +1 -1
  58. package/dist/pack-release-check.js +4 -11
  59. package/dist/pack-signature-status.d.ts.map +1 -1
  60. package/dist/pack-signature-status.js +0 -1
  61. package/dist/pack-test-runner.js +2 -10
  62. package/dist/plan-simulation.d.ts.map +1 -1
  63. package/dist/plan-simulation.js +3 -20
  64. package/dist/playbook-registry.d.ts.map +1 -1
  65. package/dist/playbook-registry.js +2 -10
  66. package/dist/policy-engine.d.ts.map +1 -1
  67. package/dist/policy-engine.js +3 -11
  68. package/dist/policy-test.js +3 -11
  69. package/dist/profile-registry.d.ts +0 -1
  70. package/dist/profile-registry.d.ts.map +1 -1
  71. package/dist/profile-registry.js +4 -32
  72. package/dist/quality-baseline.d.ts.map +1 -1
  73. package/dist/quality-baseline.js +3 -1
  74. package/dist/ranker-explainability.d.ts.map +1 -1
  75. package/dist/ranker-explainability.js +3 -9
  76. package/dist/registration-hint-registry.d.ts.map +1 -1
  77. package/dist/registration-hint-registry.js +2 -10
  78. package/dist/release-readiness.js +3 -3
  79. package/dist/reposet.js +1 -1
  80. package/dist/repository-knowledge-model.d.ts +1 -1
  81. package/dist/repository-knowledge-model.d.ts.map +1 -1
  82. package/dist/scaffold-patterns.js +2 -10
  83. package/dist/search-tuning-registry.d.ts.map +1 -1
  84. package/dist/search-tuning-registry.js +2 -10
  85. package/dist/self-config-doctor-v2.d.ts +1 -1
  86. package/dist/self-config-doctor-v2.d.ts.map +1 -1
  87. package/dist/self-config-doctor-v2.js +6 -10
  88. package/dist/self-config-doctor.d.ts.map +1 -1
  89. package/dist/self-config-doctor.js +7 -13
  90. package/dist/sharkcraft-inspector.d.ts.map +1 -1
  91. package/dist/sharkcraft-inspector.js +1 -0
  92. package/dist/start-here.d.ts +1 -1
  93. package/dist/start-here.js +1 -1
  94. package/dist/synthesize-from-onboarding.d.ts +68 -0
  95. package/dist/synthesize-from-onboarding.d.ts.map +1 -0
  96. package/dist/synthesize-from-onboarding.js +508 -0
  97. package/dist/task-ranker.d.ts.map +1 -1
  98. package/dist/task-ranker.js +1 -31
  99. package/dist/task-routing-hint-registry.d.ts.map +1 -1
  100. package/dist/task-routing-hint-registry.js +2 -10
  101. package/dist/test-runner.d.ts.map +1 -1
  102. package/dist/test-runner.js +8 -16
  103. package/dist/universal-search.d.ts +0 -1
  104. package/dist/universal-search.d.ts.map +1 -1
  105. package/dist/universal-search.js +0 -12
  106. package/package.json +17 -17
  107. package/dist/plugin-lifecycle-profile-registry.d.ts +0 -52
  108. package/dist/plugin-lifecycle-profile-registry.d.ts.map +0 -1
  109. package/dist/plugin-lifecycle-profile-registry.js +0 -202
  110. package/dist/plugin-lifecycle.d.ts +0 -132
  111. package/dist/plugin-lifecycle.d.ts.map +0 -1
  112. package/dist/plugin-lifecycle.js +0 -477
@@ -0,0 +1,508 @@
1
+ /**
2
+ * Convert an {@link IOnboardingPlan} into populated `sharkcraft/*.ts`
3
+ * file contents — the engine behind `shrk init --infer --write`.
4
+ *
5
+ * Design goals:
6
+ *
7
+ * - **Populated, not advisory.** The existing `writeOnboardingDrafts`
8
+ * emits files into `sharkcraft/onboarding/` and asks the user to
9
+ * adopt by hand. This module emits directly to `sharkcraft/`-root
10
+ * files so a `shrk init --infer --write` user gets a working
11
+ * project on day 1.
12
+ *
13
+ * - **Honest about confidence.** Inferred entries are tagged with
14
+ * their source signal and confidence; medium-confidence rows get a
15
+ * `// TODO: review` marker on the emitted line. The user can see
16
+ * exactly what was inferred vs hand-curated. Low-confidence rows
17
+ * are dropped from the populated file and reported in the
18
+ * companion `.inferred-report.md` so the user can find them.
19
+ *
20
+ * - **Self-contained output.** Generated files declare their own
21
+ * `defineKnowledgeEntry` / `definePathConvention` stubs — no
22
+ * `@shrkcrft/*` imports, matching the local-mirror pattern from
23
+ * `packages/presets/src/emit/synthesize-files.ts`.
24
+ *
25
+ * - **Deterministic.** Same input → same output, byte-for-byte.
26
+ * Sort lists by id where they're rendered together.
27
+ *
28
+ * - **Idempotent at the file level.** The caller decides write vs
29
+ * dry-run + force; this module only produces strings.
30
+ */
31
+ // ─── Local-mirror preambles (match presets' synthesize-files.ts) ─────────────
32
+ const KNOWLEDGE_HELPERS = `// Local helpers — keep this file self-contained (no @shrkcrft/* imports).
33
+ // Generated by \`shrk init --infer\`. Edit freely.
34
+
35
+ const KnowledgePriority = {
36
+ Critical: 'critical',
37
+ High: 'high',
38
+ Medium: 'medium',
39
+ Low: 'low',
40
+ } as const;
41
+
42
+ const KnowledgeType = {
43
+ Rule: 'rule',
44
+ Path: 'path',
45
+ Template: 'template',
46
+ Architecture: 'architecture',
47
+ Technical: 'technical',
48
+ Convention: 'convention',
49
+ Workflow: 'workflow',
50
+ Warning: 'warning',
51
+ } as const;
52
+
53
+ function defineKnowledgeEntry<T>(entry: T): T {
54
+ return entry;
55
+ }
56
+ `;
57
+ const PIPELINE_HELPERS = `// Local helpers — keep this file self-contained (no @shrkcrft/* imports).
58
+ // Generated by \`shrk init --infer\`. Edit freely.
59
+
60
+ function definePipeline<T>(pipeline: T): T {
61
+ return pipeline;
62
+ }
63
+ `;
64
+ // ─── Confidence triage ───────────────────────────────────────────────────────
65
+ const HIGH_CONFIDENCE_RULE_IDS = new Set([
66
+ 'typescript.strict-mode',
67
+ 'project.package-manager',
68
+ ]);
69
+ /** Map an inferred-rule priority to a {high|medium|low} adoption tier. */
70
+ function ruleTier(rule) {
71
+ // Promote known-canonical rules.
72
+ if (HIGH_CONFIDENCE_RULE_IDS.has(rule.id))
73
+ return 'high';
74
+ const p = rule.priority.toLowerCase();
75
+ if (p === 'critical' || p === 'high')
76
+ return 'high';
77
+ if (p === 'medium')
78
+ return 'medium';
79
+ return 'low';
80
+ }
81
+ function pathTier(path) {
82
+ // Path conventions are inferred from disk presence — if we found the
83
+ // directory, the convention is real. The only "low" case is when the
84
+ // patterns list is empty (couldn't pin a concrete location).
85
+ if (path.patterns.length === 0)
86
+ return 'low';
87
+ return 'high';
88
+ }
89
+ function boundaryTier(rule) {
90
+ // Boundary rules require BOTH a from-pattern AND a forbidden list to
91
+ // be enforceable. Without forbidden imports, the rule is a label,
92
+ // not a gate.
93
+ if (rule.from.length === 0)
94
+ return 'low';
95
+ if (!rule.forbiddenImports || rule.forbiddenImports.length === 0)
96
+ return 'medium';
97
+ return 'high';
98
+ }
99
+ function pipelineTier(pipeline) {
100
+ // Pipelines with concrete steps that map to verification commands
101
+ // are higher-confidence than generic feature-dev outlines.
102
+ if (pipeline.steps.length === 0)
103
+ return 'low';
104
+ if (pipeline.steps.length <= 2)
105
+ return 'medium';
106
+ return 'high';
107
+ }
108
+ // ─── Renderers ──────────────────────────────────────────────────────────────
109
+ function renderPath(p, tier) {
110
+ const todo = tier === 'medium' ? '// TODO: review — confidence: medium\n ' : '';
111
+ const primaryPath = p.patterns[0]?.replace(/\/\*\*.*$/, '').replace(/\/\*$/, '') ?? '';
112
+ return ` ${todo}defineKnowledgeEntry({
113
+ id: ${JSON.stringify(p.id)},
114
+ title: ${JSON.stringify(p.title)},
115
+ type: KnowledgeType.Path,
116
+ priority: KnowledgePriority.High,
117
+ tags: ['paths', 'inferred'],
118
+ scope: ['inferred'],
119
+ appliesWhen: ['generate-code'],
120
+ content: ${JSON.stringify(p.content)},
121
+ metadata: {
122
+ path: ${JSON.stringify(primaryPath)},
123
+ patterns: ${JSON.stringify(p.patterns)},
124
+ inferredFrom: ${JSON.stringify(p.reason)},
125
+ },
126
+ })`;
127
+ }
128
+ function renderRule(r, tier) {
129
+ const todo = tier === 'medium' ? '// TODO: review — confidence: medium\n ' : '';
130
+ const priority = r.priority === 'critical' ? 'KnowledgePriority.Critical'
131
+ : r.priority === 'high' ? 'KnowledgePriority.High'
132
+ : r.priority === 'medium' ? 'KnowledgePriority.Medium'
133
+ : 'KnowledgePriority.Low';
134
+ return ` ${todo}defineKnowledgeEntry({
135
+ id: ${JSON.stringify(r.id)},
136
+ title: ${JSON.stringify(r.title)},
137
+ type: KnowledgeType.Rule,
138
+ priority: ${priority},
139
+ tags: ['inferred', ${JSON.stringify(r.source)}],
140
+ scope: ['inferred'],
141
+ appliesWhen: ['generate-code', 'review'],
142
+ content: ${JSON.stringify(r.content)},
143
+ metadata: {
144
+ inferredFrom: ${JSON.stringify(r.reason)},
145
+ source: ${JSON.stringify(r.source)},
146
+ },
147
+ })`;
148
+ }
149
+ function renderBoundary(b, tier) {
150
+ const todo = tier === 'medium' ? '// TODO: review — confidence: medium\n ' : '';
151
+ const forbidden = b.forbiddenImports && b.forbiddenImports.length > 0
152
+ ? `\n forbiddenImports: ${JSON.stringify(b.forbiddenImports)},`
153
+ : '';
154
+ const allowed = b.allowedImports && b.allowedImports.length > 0
155
+ ? `\n allowedImports: ${JSON.stringify(b.allowedImports)},`
156
+ : '';
157
+ return ` ${todo}{
158
+ id: ${JSON.stringify(b.id)},
159
+ title: ${JSON.stringify(b.title)},
160
+ severity: ${JSON.stringify(b.severity)},
161
+ from: ${JSON.stringify(b.from)},${forbidden}${allowed}
162
+ suggestedFix: ${JSON.stringify(b.suggestedFix)},
163
+ inferredFrom: ${JSON.stringify(b.reason)},
164
+ }`;
165
+ }
166
+ function renderPipeline(p, tier) {
167
+ const todo = tier === 'medium' ? '// TODO: review — confidence: medium\n ' : '';
168
+ const stepLines = p.steps
169
+ .map((s) => ` { id: ${JSON.stringify(s)}, type: 'command', description: ${JSON.stringify(s)} }`)
170
+ .join(',\n');
171
+ return ` ${todo}definePipeline({
172
+ id: ${JSON.stringify(p.id)},
173
+ title: ${JSON.stringify(p.title)},
174
+ description: ${JSON.stringify(p.description)},
175
+ tags: ['inferred'],
176
+ steps: [
177
+ ${stepLines}
178
+ ],
179
+ metadata: {
180
+ inferredFrom: ${JSON.stringify(p.reason)},
181
+ },
182
+ })`;
183
+ }
184
+ // ─── File builders ──────────────────────────────────────────────────────────
185
+ function buildConfigFile(opts) {
186
+ return (`// Generated by \`shrk init --infer\`. Edit freely; SharkCraft will not\n` +
187
+ `// regenerate this file. Re-run \`shrk init --infer --force\` to overwrite.\n\n` +
188
+ `const config = {\n` +
189
+ ` projectName: ${JSON.stringify(opts.projectName)},\n` +
190
+ ` description: ${JSON.stringify(opts.description)},\n` +
191
+ ` pathFiles: ${JSON.stringify(opts.includePaths ? ['paths.ts'] : [])},\n` +
192
+ ` ruleFiles: ${JSON.stringify(opts.includeRules ? ['rules.ts'] : [])},\n` +
193
+ ` boundaryFiles: ${JSON.stringify(opts.includeBoundaries ? ['boundaries.ts'] : [])},\n` +
194
+ ` pipelineFiles: ${JSON.stringify(opts.includePipelines ? ['pipelines.ts'] : [])},\n` +
195
+ ` knowledgeFiles: ${JSON.stringify(['knowledge.ts'])},\n` +
196
+ ` templateFiles: ${JSON.stringify([])},\n` +
197
+ ` docsFiles: ${JSON.stringify([])},\n` +
198
+ ` defaultMaxTokens: 3500,\n` +
199
+ `};\n\nexport default config;\n`);
200
+ }
201
+ function buildPathsFile(rendered) {
202
+ return (KNOWLEDGE_HELPERS +
203
+ '\nconst paths = [\n' +
204
+ rendered.join(',\n') +
205
+ (rendered.length > 0 ? ',\n' : '') +
206
+ '];\n\nexport default paths;\n');
207
+ }
208
+ function buildRulesFile(rendered) {
209
+ return (KNOWLEDGE_HELPERS +
210
+ '\nconst rules = [\n' +
211
+ rendered.join(',\n') +
212
+ (rendered.length > 0 ? ',\n' : '') +
213
+ '];\n\nexport default rules;\n');
214
+ }
215
+ function buildBoundariesFile(rendered) {
216
+ return ('// Generated by `shrk init --infer`. Plain default-export array — the\n' +
217
+ '// boundaries loader accepts any object with id/title/severity/from.\n\n' +
218
+ 'export default [\n' +
219
+ rendered.join(',\n') +
220
+ (rendered.length > 0 ? ',\n' : '') +
221
+ '];\n');
222
+ }
223
+ function buildPipelinesFile(rendered) {
224
+ return (PIPELINE_HELPERS +
225
+ '\nconst pipelines = [\n' +
226
+ rendered.join(',\n') +
227
+ (rendered.length > 0 ? ',\n' : '') +
228
+ '];\n\nexport default pipelines;\n');
229
+ }
230
+ function buildKnowledgeSeed(projectName, description) {
231
+ // Minimal but useful knowledge seed — these aren't really inferable,
232
+ // but every repo benefits from the agent-briefing + safety baseline.
233
+ return (KNOWLEDGE_HELPERS +
234
+ '\n' +
235
+ `export const projectOverview = defineKnowledgeEntry({
236
+ id: 'project.overview',
237
+ title: ${JSON.stringify(projectName + ' — project overview')},
238
+ type: KnowledgeType.Architecture,
239
+ priority: KnowledgePriority.High,
240
+ tags: ['overview', 'inferred'],
241
+ scope: ['inferred'],
242
+ appliesWhen: ['onboard', 'plan-work'],
243
+ summary: ${JSON.stringify(description || 'High-level overview of this project.')},
244
+ content: ${JSON.stringify(description || 'High-level overview of this project. Generated by shrk init --infer; replace with project-specific context.')},
245
+ });
246
+
247
+ export const agentBriefing = defineKnowledgeEntry({
248
+ id: 'agent.briefing',
249
+ title: 'AI agent briefing',
250
+ type: KnowledgeType.Convention,
251
+ priority: KnowledgePriority.Critical,
252
+ tags: ['agent', 'safety'],
253
+ scope: ['agent'],
254
+ appliesWhen: ['agent-start', 'agent-plan'],
255
+ content: \`When working in this repo as an AI agent:
256
+ 1. Read \\\`shrk brief\\\` for the focused project context (rules + paths + verification).
257
+ 2. Use \\\`shrk task "<task>"\\\` to get a per-task packet (relevant rules + templates + commands).
258
+ 3. Generate code via \\\`shrk gen <template> <name> --dry-run --save-plan plan.json\\\`, then apply with \\\`shrk apply plan.json --verify-signature --validate\\\`.
259
+ 4. Never bypass \\\`shrk check boundaries\\\` — it gates architecture violations.\`,
260
+ });
261
+
262
+ export const generationSafety = defineKnowledgeEntry({
263
+ id: 'safety.generation',
264
+ title: 'Generation safety',
265
+ type: KnowledgeType.Warning,
266
+ priority: KnowledgePriority.Critical,
267
+ tags: ['safety', 'generation'],
268
+ scope: ['generation'],
269
+ appliesWhen: ['generate-code', 'overwrite-file'],
270
+ content: \`shrk gen defaults to dry-run. A real write requires --write AND a clean plan (no conflicts). AI agents must call create_generation_plan via MCP first — never write files directly through MCP.\`,
271
+ });
272
+
273
+ export default [projectOverview, agentBriefing, generationSafety];
274
+ `);
275
+ }
276
+ // ─── Confidence report renderers ─────────────────────────────────────────────
277
+ function buildReportMarkdown(report, projectName) {
278
+ const lines = [];
279
+ lines.push(`# Inferred from your codebase`);
280
+ lines.push('');
281
+ lines.push(`\`shrk init --infer\` scanned ${projectName} and produced the populated ` +
282
+ `\`sharkcraft/*.ts\` files alongside this report. Re-run with \`--force\` to regenerate.`);
283
+ lines.push('');
284
+ lines.push(`## ✅ Adopted directly (${report.adoptedHigh.length} entries — high confidence)`);
285
+ lines.push('');
286
+ if (report.adoptedHigh.length === 0) {
287
+ lines.push('_None._');
288
+ }
289
+ else {
290
+ for (const line of report.adoptedHigh) {
291
+ lines.push(`- **[${line.kind}] \`${line.id}\`** — ${line.title} _(${line.reason})_`);
292
+ }
293
+ }
294
+ lines.push('');
295
+ lines.push(`## 🟡 Adopted with review marker (${report.adoptedMedium.length} entries — medium confidence)`);
296
+ lines.push('');
297
+ lines.push('These entries were included in the populated files with a `// TODO: review` ' +
298
+ 'comment. Read them, confirm they match your team\'s actual practice, then remove the marker.');
299
+ lines.push('');
300
+ if (report.adoptedMedium.length === 0) {
301
+ lines.push('_None._');
302
+ }
303
+ else {
304
+ for (const line of report.adoptedMedium) {
305
+ lines.push(`- **[${line.kind}] \`${line.id}\`** — ${line.title} _(${line.reason})_`);
306
+ }
307
+ }
308
+ lines.push('');
309
+ lines.push(`## ⚠️ Not adopted (${report.dropped.length} entries — low confidence)`);
310
+ lines.push('');
311
+ lines.push('These entries had weak signals — either incomplete data or generic patterns that ' +
312
+ 'might not reflect your real conventions. Review the draft versions under ' +
313
+ '`sharkcraft/onboarding/` (after running `shrk onboard --write-drafts`) and adopt any that apply.');
314
+ lines.push('');
315
+ if (report.dropped.length === 0) {
316
+ lines.push('_None — all signals were strong enough to adopt._');
317
+ }
318
+ else {
319
+ for (const line of report.dropped) {
320
+ lines.push(`- **[${line.kind}] \`${line.id}\`** — ${line.title} _(${line.reason})_`);
321
+ }
322
+ }
323
+ lines.push('');
324
+ lines.push(`## ✍️ What shrk can't infer (author these by hand)`);
325
+ lines.push('');
326
+ lines.push('These categories rely on team knowledge that\'s not visible in code or config. ' +
327
+ 'Add them to `sharkcraft/knowledge.ts` to make Claude aware:');
328
+ lines.push('');
329
+ for (const item of report.notInferable)
330
+ lines.push(`- ${item}`);
331
+ lines.push('');
332
+ lines.push('---');
333
+ lines.push('');
334
+ lines.push(`_Generated by \`shrk init --infer\`. This report is regenerated each ` +
335
+ `time you re-run with \`--force\`._`);
336
+ return lines.join('\n') + '\n';
337
+ }
338
+ const NOT_INFERABLE_DEFAULTS = [
339
+ 'Project-specific architectural decisions ("we chose X over Y because…").',
340
+ 'Deprecated paths / legacy code to avoid ("don\'t add new code to legacy/").',
341
+ 'Non-obvious conventions ("our pagination uses cursor, not offset").',
342
+ 'Cross-cutting concerns ("all writes go through the audit-log middleware").',
343
+ 'Recently-changed patterns ("DTOs migrated to class-validator last month — old code uses Zod").',
344
+ 'Team workflow conventions ("review with two approvals before merge to main").',
345
+ ];
346
+ // ─── Public entry point ─────────────────────────────────────────────────────
347
+ /**
348
+ * Convert an {@link IOnboardingPlan} into a populated set of
349
+ * `sharkcraft/*.ts` files plus a companion confidence report.
350
+ *
351
+ * The caller is responsible for actually writing the files; this
352
+ * function is pure (input plan → output strings).
353
+ */
354
+ export function synthesizeFromOnboarding(plan) {
355
+ const report = { adoptedHigh: [], adoptedMedium: [], dropped: [] };
356
+ // ── Triage paths ────────────────────────────────────────────────────
357
+ const renderedPaths = [];
358
+ for (const p of [...plan.inferredPathConventions].sort((a, b) => a.id.localeCompare(b.id))) {
359
+ const tier = pathTier(p);
360
+ if (tier === 'low') {
361
+ report.dropped.push({ kind: 'path', id: p.id, title: p.title, reason: p.reason });
362
+ continue;
363
+ }
364
+ renderedPaths.push(renderPath(p, tier));
365
+ (tier === 'high' ? report.adoptedHigh : report.adoptedMedium).push({
366
+ kind: 'path',
367
+ id: p.id,
368
+ title: p.title,
369
+ reason: p.reason,
370
+ });
371
+ }
372
+ // ── Triage rules ────────────────────────────────────────────────────
373
+ const renderedRules = [];
374
+ for (const r of [...plan.inferredRules].sort((a, b) => a.id.localeCompare(b.id))) {
375
+ const tier = ruleTier(r);
376
+ if (tier === 'low') {
377
+ report.dropped.push({ kind: 'rule', id: r.id, title: r.title, reason: r.reason });
378
+ continue;
379
+ }
380
+ renderedRules.push(renderRule(r, tier));
381
+ (tier === 'high' ? report.adoptedHigh : report.adoptedMedium).push({
382
+ kind: 'rule',
383
+ id: r.id,
384
+ title: r.title,
385
+ reason: r.reason,
386
+ });
387
+ }
388
+ // ── Triage boundaries ──────────────────────────────────────────────
389
+ const renderedBoundaries = [];
390
+ for (const b of [...plan.inferredBoundaryRules].sort((a, b2) => a.id.localeCompare(b2.id))) {
391
+ const tier = boundaryTier(b);
392
+ if (tier === 'low') {
393
+ report.dropped.push({ kind: 'boundary', id: b.id, title: b.title, reason: b.reason });
394
+ continue;
395
+ }
396
+ renderedBoundaries.push(renderBoundary(b, tier));
397
+ (tier === 'high' ? report.adoptedHigh : report.adoptedMedium).push({
398
+ kind: 'boundary',
399
+ id: b.id,
400
+ title: b.title,
401
+ reason: b.reason,
402
+ });
403
+ }
404
+ // ── Triage pipelines ───────────────────────────────────────────────
405
+ const renderedPipelines = [];
406
+ for (const p of [...plan.inferredPipelines].sort((a, b) => a.id.localeCompare(b.id))) {
407
+ const tier = pipelineTier(p);
408
+ if (tier === 'low') {
409
+ report.dropped.push({ kind: 'pipeline', id: p.id, title: p.title, reason: p.reason });
410
+ continue;
411
+ }
412
+ renderedPipelines.push(renderPipeline(p, tier));
413
+ (tier === 'high' ? report.adoptedHigh : report.adoptedMedium).push({
414
+ kind: 'pipeline',
415
+ id: p.id,
416
+ title: p.title,
417
+ reason: p.reason,
418
+ });
419
+ }
420
+ // ── Templates are dropped wholesale into the report — emitting a
421
+ // runnable template from inference is too speculative to populate
422
+ // automatically. The user gets them as drafts via `shrk onboard
423
+ // --write-drafts`.
424
+ for (const t of plan.inferredTemplateCandidates) {
425
+ report.dropped.push({
426
+ kind: 'template',
427
+ id: t.id,
428
+ title: t.name,
429
+ reason: `${t.reason} (templates require manual review; see sharkcraft/onboarding/inferred-templates.draft.ts after \`shrk onboard --write-drafts\`)`,
430
+ });
431
+ }
432
+ // ── Verification commands surface in the report only (consumed via
433
+ // sharkcraft.config.ts verificationCommands[]; not emitted as
434
+ // `sharkcraft/*.ts` here to avoid duplicating config shape).
435
+ for (const v of plan.inferredVerificationCommands) {
436
+ report.adoptedHigh.push({
437
+ kind: 'verification',
438
+ id: v.id,
439
+ title: `${v.label}: \`${v.command}\``,
440
+ reason: v.reason,
441
+ });
442
+ }
443
+ const projectName = plan.projectSummary.projectName ?? 'project';
444
+ const description = plan.projectSummary.description ?? '';
445
+ const files = [];
446
+ files.push({
447
+ path: 'sharkcraft.config.ts',
448
+ kind: 'config',
449
+ content: buildConfigFile({
450
+ projectName,
451
+ description,
452
+ includePaths: renderedPaths.length > 0,
453
+ includeRules: renderedRules.length > 0,
454
+ includeBoundaries: renderedBoundaries.length > 0,
455
+ includePipelines: renderedPipelines.length > 0,
456
+ }),
457
+ });
458
+ files.push({
459
+ path: 'knowledge.ts',
460
+ kind: 'knowledge',
461
+ content: buildKnowledgeSeed(projectName, description),
462
+ });
463
+ if (renderedPaths.length > 0) {
464
+ files.push({ path: 'paths.ts', kind: 'paths', content: buildPathsFile(renderedPaths) });
465
+ }
466
+ if (renderedRules.length > 0) {
467
+ files.push({ path: 'rules.ts', kind: 'rules', content: buildRulesFile(renderedRules) });
468
+ }
469
+ if (renderedBoundaries.length > 0) {
470
+ files.push({
471
+ path: 'boundaries.ts',
472
+ kind: 'boundaries',
473
+ content: buildBoundariesFile(renderedBoundaries),
474
+ });
475
+ }
476
+ if (renderedPipelines.length > 0) {
477
+ files.push({
478
+ path: 'pipelines.ts',
479
+ kind: 'pipelines',
480
+ content: buildPipelinesFile(renderedPipelines),
481
+ });
482
+ }
483
+ const fullReport = {
484
+ adoptedHigh: report.adoptedHigh,
485
+ adoptedMedium: report.adoptedMedium,
486
+ dropped: report.dropped,
487
+ notInferable: NOT_INFERABLE_DEFAULTS,
488
+ };
489
+ files.push({
490
+ path: '.inferred-report.md',
491
+ kind: 'report-md',
492
+ content: buildReportMarkdown(fullReport, projectName),
493
+ });
494
+ files.push({
495
+ path: '.inferred-report.json',
496
+ kind: 'report-json',
497
+ content: JSON.stringify({
498
+ schema: 'sharkcraft.inferred-report/v1',
499
+ generatedAt: new Date().toISOString().slice(0, 10),
500
+ projectName,
501
+ adoptedHigh: fullReport.adoptedHigh,
502
+ adoptedMedium: fullReport.adoptedMedium,
503
+ dropped: fullReport.dropped,
504
+ notInferable: fullReport.notInferable,
505
+ }, null, 2) + '\n',
506
+ });
507
+ return { files, report: fullReport };
508
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"task-ranker.d.ts","sourceRoot":"","sources":["../src/task-ranker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qB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AAM,SAAS,OAAO,EAAE,CAAA;KAAE,CAAC;IACnD,SAAS,EAAE;QAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IAC3C,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,SAAS,eAAe,EAAE,CAAA;KAAE,CAAC;IACxD,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,SAAS,eAAe,EAAE,CAAA;KAAE,CAAC;CACzD,EACD,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAW,GACjB,cAAc,CAiEhB;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC7B,KAAK,GAAE,MAAU,GAChB,MAAM,CAKR;AAED,uFAAuF;AACvF,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -29,33 +29,8 @@ const VERB_HINTS = [
29
29
  // ── Domain hints (what *kind of thing* is being worked on) ──────────────
30
30
  // These boost rules/templates/pipelines whose own `appliesWhen` or `tags`
31
31
  // declare the same domain — much higher signal than verb hints alone for
32
- // "create a user profile *plugin*" vs "add pagination *capability*".
32
+ // "create a *service*" vs "add a *utility*".
33
33
  const DOMAIN_HINTS = [
34
- {
35
- token: 'plugin',
36
- appliesWhen: ['create-plugin', 'generate-plugin', 'plugin-dev', 'register-plugin'],
37
- tags: ['plugin'],
38
- },
39
- {
40
- token: 'defaults',
41
- appliesWhen: ['register-defaults', 'create-defaults', 'plugin-defaults'],
42
- tags: ['defaults'],
43
- },
44
- {
45
- token: 'capability',
46
- appliesWhen: ['create-capability', 'generate-capability'],
47
- tags: ['capability'],
48
- },
49
- {
50
- token: 'policy',
51
- appliesWhen: ['create-policy', 'generate-policy'],
52
- tags: ['policy'],
53
- },
54
- {
55
- token: 'adapter',
56
- appliesWhen: ['create-adapter', 'generate-adapter'],
57
- tags: ['adapter'],
58
- },
59
34
  {
60
35
  token: 'service',
61
36
  appliesWhen: ['generate-service'],
@@ -81,11 +56,6 @@ const DOMAIN_HINTS = [
81
56
  appliesWhen: ['generate-route'],
82
57
  tags: ['http', 'routes', 'api'],
83
58
  },
84
- {
85
- token: 'kernel',
86
- appliesWhen: ['create-kernel-service'],
87
- tags: ['kernel'],
88
- },
89
59
  ];
90
60
  function tokenize(s) {
91
61
  return s
@@ -1 +1 @@
1
- {"version":3,"file":"task-routing-hint-registry.d.ts","sourceRoot":"","sources":["../src/task-routing-hint-registry.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAE5F,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA4BD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAAC,MAAM,EAA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,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA4BD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAAC,MAAM,EAAE,SAAS,2BAA2B,EAAE,CAAA;CAAE,CAAC,CAoFxG;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CAG3C;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,2BAA2B,EAAE,CAAC,CAGjD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,qBAAqB,EACjC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CA0C7C"}
@@ -1,11 +1,3 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
1
  /**
10
2
  * Task routing hint registry. Pack- and local-contributed task
11
3
  * routing hints bias the recommender output toward project-specific
@@ -15,8 +7,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
15
7
  */
16
8
  import { existsSync } from 'node:fs';
17
9
  import * as nodePath from 'node:path';
18
- import { pathToFileURL } from 'node:url';
19
10
  import { validateTaskRoutingHint, } from '@shrkcrft/plugin-api';
11
+ import { importModuleViaLoader } from '@shrkcrft/core';
20
12
  export const TASK_ROUTING_HINT_REGISTRY_SCHEMA = 'sharkcraft.task-routing-hint-registry/v1';
21
13
  export var TaskRoutingHintSource;
22
14
  (function (TaskRoutingHintSource) {
@@ -25,7 +17,7 @@ export var TaskRoutingHintSource;
25
17
  TaskRoutingHintSource["Fixture"] = "fixture";
26
18
  })(TaskRoutingHintSource || (TaskRoutingHintSource = {}));
27
19
  async function importDefault(file) {
28
- const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
20
+ const mod = (await importModuleViaLoader(file));
29
21
  if (Array.isArray(mod.default))
30
22
  return mod.default;
31
23
  if (mod.default && typeof mod.default === 'object')
@@ -1 +1 @@
1
- {"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../src/test-runner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAI/B;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,UA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