@shrkcrft/cli 0.1.0-alpha.8 → 0.1.0-alpha.9
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/README.md +1 -1
- package/dist/commands/boundaries.command.d.ts.map +1 -1
- package/dist/commands/boundaries.command.js +12 -0
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +30 -20
- package/dist/commands/command-catalog.d.ts +3 -7
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +47 -113
- package/dist/commands/commands.command.d.ts.map +1 -1
- package/dist/commands/commands.command.js +4 -4
- package/dist/commands/constructs.command.d.ts.map +1 -1
- package/dist/commands/constructs.command.js +22 -5
- package/dist/commands/doctor.command.d.ts.map +1 -1
- package/dist/commands/doctor.command.js +9 -42
- package/dist/commands/export.command.d.ts.map +1 -1
- package/dist/commands/export.command.js +3 -76
- package/dist/commands/help.command.d.ts +3 -4
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +21 -77
- package/dist/commands/helper.command.js +1 -1
- package/dist/commands/import.command.d.ts.map +1 -1
- package/dist/commands/import.command.js +5 -121
- package/dist/commands/init.command.d.ts.map +1 -1
- package/dist/commands/init.command.js +16 -184
- package/dist/commands/mcp.command.d.ts.map +1 -1
- package/dist/commands/mcp.command.js +131 -2
- package/dist/commands/onboard.command.d.ts.map +1 -1
- package/dist/commands/onboard.command.js +15 -3
- package/dist/commands/packs-new.d.ts +1 -1
- package/dist/commands/packs-new.d.ts.map +1 -1
- package/dist/commands/packs-new.js +36 -5
- package/dist/commands/packs.command.d.ts.map +1 -1
- package/dist/commands/packs.command.js +17 -3
- package/dist/commands/plugin.command.d.ts +11 -0
- package/dist/commands/plugin.command.d.ts.map +1 -0
- package/dist/commands/plugin.command.js +394 -0
- package/dist/commands/profiles.command.js +4 -4
- package/dist/commands/release.command.js +13 -13
- package/dist/commands/review.command.d.ts.map +1 -1
- package/dist/commands/review.command.js +28 -2
- package/dist/commands/search.command.js +1 -1
- package/dist/commands/task-context.command.js +16 -0
- package/dist/export/export-formats.d.ts +1 -1
- package/dist/export/export-formats.d.ts.map +1 -1
- package/dist/export/export-formats.js +12 -139
- package/dist/init/init-templates.d.ts.map +1 -1
- package/dist/init/init-templates.js +113 -133
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +46 -117
- package/dist/output/failure-hints.d.ts +9 -1
- package/dist/output/failure-hints.d.ts.map +1 -1
- package/dist/output/failure-hints.js +8 -2
- package/dist/output/watch-loop.d.ts +1 -9
- package/dist/output/watch-loop.d.ts.map +1 -1
- package/dist/output/watch-loop.js +3 -13
- package/dist/schemas/json-schemas.d.ts +36 -36
- package/dist/schemas/json-schemas.js +36 -36
- package/dist/surface/about.d.ts.map +1 -1
- package/dist/surface/about.js +15 -37
- package/dist/surface/no-args-landing.d.ts.map +1 -1
- package/dist/surface/no-args-landing.js +13 -9
- package/dist/surface/surface-config-writer.d.ts.map +1 -1
- package/dist/surface/surface-config-writer.js +11 -23
- package/package.json +25 -26
- package/dist/commands/diff-check.command.d.ts +0 -30
- package/dist/commands/diff-check.command.d.ts.map +0 -1
- package/dist/commands/diff-check.command.js +0 -210
- package/dist/export/claude-commands-export.d.ts +0 -60
- package/dist/export/claude-commands-export.d.ts.map +0 -1
- package/dist/export/claude-commands-export.js +0 -276
- package/dist/init/paths-advisory.d.ts +0 -20
- package/dist/init/paths-advisory.d.ts.map +0 -1
- package/dist/init/paths-advisory.js +0 -88
|
@@ -6,7 +6,6 @@ import { listBuiltInSurfaceProfiles, suggestSurfaceProfile } from '@shrkcrft/ins
|
|
|
6
6
|
import { INIT_FILES } from "../init/init-templates.js";
|
|
7
7
|
import { buildDetectedBlock, renderDetectedBlockText } from "../init/detected-block.js";
|
|
8
8
|
import { ensureSharkcraftGitignore, renderGitignorePatch } from "../init/gitignore.js";
|
|
9
|
-
import { annotatePathsAgainstDisk } from "../init/paths-advisory.js";
|
|
10
9
|
import { applySurfaceTextEdit } from "../surface/surface-config-writer.js";
|
|
11
10
|
import { flagBool, flagString, resolveCwd } from "../command-registry.js";
|
|
12
11
|
import { bullet, header } from "../output/format-output.js";
|
|
@@ -109,13 +108,8 @@ async function applyPresetInit(cwd, mode) {
|
|
|
109
108
|
process.stdout.write(bullet(`(warning) ${warn}`) + '\n');
|
|
110
109
|
}
|
|
111
110
|
process.stdout.write('\nNext:\n');
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
'shrk doctor',
|
|
115
|
-
'shrk context --task "<task>"',
|
|
116
|
-
]) {
|
|
117
|
-
process.stdout.write(bullet(`$ ${cmd}`) + '\n');
|
|
118
|
-
}
|
|
111
|
+
process.stdout.write(bullet('$ shrk init --zero-config --write') + '\n');
|
|
112
|
+
process.stdout.write(bullet('Then prove it: $ shrk check boundaries --changed-only --since main') + '\n');
|
|
119
113
|
if (!mode.skipGitignore) {
|
|
120
114
|
const patch = ensureSharkcraftGitignore({ cwd, dryRun: true });
|
|
121
115
|
process.stdout.write('\n' + renderGitignorePatch(patch, true));
|
|
@@ -134,11 +128,6 @@ async function applyPresetInit(cwd, mode) {
|
|
|
134
128
|
source: 'override',
|
|
135
129
|
});
|
|
136
130
|
}
|
|
137
|
-
// Workspace-shape advisory: when the preset emits path conventions
|
|
138
|
-
// that don't exist in this repo (common with generic presets in
|
|
139
|
-
// framework-specific repos), annotate paths.ts so the user knows
|
|
140
|
-
// which defaults to fix.
|
|
141
|
-
const pathsAdvisory = annotatePathsAgainstDisk(cwd, plan.sharkcraftDir);
|
|
142
131
|
process.stdout.write(header('SharkCraft initialized'));
|
|
143
132
|
process.stdout.write(`Preset: ${preset.id} — ${preset.title}\n`);
|
|
144
133
|
process.stdout.write(`Folder: ${plan.sharkcraftDir}\n`);
|
|
@@ -175,29 +164,20 @@ async function applyPresetInit(cwd, mode) {
|
|
|
175
164
|
process.stdout.write('\n' + renderGitignorePatch(patch, false));
|
|
176
165
|
}
|
|
177
166
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
process.stdout.write('\
|
|
182
|
-
process.stdout.write(bullet('$ shrk doctor
|
|
183
|
-
process.stdout.write(bullet('$ shrk
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
167
|
+
process.stdout.write('\nProve it works (60 seconds):\n');
|
|
168
|
+
process.stdout.write(bullet('$ shrk check boundaries --changed-only --since main') + '\n');
|
|
169
|
+
process.stdout.write(bullet('$ shrk review packet --v3 --since main') + '\n');
|
|
170
|
+
process.stdout.write('\nOptional:\n');
|
|
171
|
+
process.stdout.write(bullet('$ shrk doctor') + '\n');
|
|
172
|
+
process.stdout.write(bullet('$ shrk mcp serve # plug into Claude Code / Cursor / Cline') + '\n');
|
|
173
|
+
if (preset.recommendedNextCommands && preset.recommendedNextCommands.length > 0) {
|
|
174
|
+
process.stdout.write('\nPreset-specific next steps:\n');
|
|
175
|
+
for (const cmd of preset.recommendedNextCommands) {
|
|
176
|
+
process.stdout.write(bullet(`$ ${cmd}`) + '\n');
|
|
177
|
+
}
|
|
187
178
|
}
|
|
188
|
-
process.stdout.write(bullet('Start the MCP server: `shrk mcp serve` (or run it via Claude Code)') + '\n');
|
|
189
179
|
return 0;
|
|
190
180
|
}
|
|
191
|
-
function renderPathsAdvisory(advisory) {
|
|
192
|
-
process.stdout.write('\n');
|
|
193
|
-
process.stdout.write(header('Paths advisory'));
|
|
194
|
-
process.stdout.write('These preset-default paths do not exist in this repo:\n');
|
|
195
|
-
for (const p of advisory.missingPaths) {
|
|
196
|
-
process.stdout.write(bullet(p) + '\n');
|
|
197
|
-
}
|
|
198
|
-
process.stdout.write('\nEdit sharkcraft/paths.ts to match your real layout. ' +
|
|
199
|
-
'Run `shrk onboard --dry-run` to see what the engine infers.\n');
|
|
200
|
-
}
|
|
201
181
|
function applyLegacyInit(cwd, force) {
|
|
202
182
|
const { root } = detectProjectRoot(cwd);
|
|
203
183
|
const sharkcraftDir = nodePath.join(root, 'sharkcraft');
|
|
@@ -231,10 +211,6 @@ function applyLegacyInit(cwd, force) {
|
|
|
231
211
|
for (const s of skipped)
|
|
232
212
|
process.stdout.write(bullet(s) + '\n');
|
|
233
213
|
}
|
|
234
|
-
const legacyAdvisory = annotatePathsAgainstDisk(cwd, sharkcraftDir);
|
|
235
|
-
if (legacyAdvisory.annotated) {
|
|
236
|
-
renderPathsAdvisory(legacyAdvisory);
|
|
237
|
-
}
|
|
238
214
|
process.stdout.write('\nNext:\n');
|
|
239
215
|
process.stdout.write(bullet('Run `shrk inspect` to see your project summary.') + '\n');
|
|
240
216
|
process.stdout.write(bullet('Run `shrk knowledge list` to see what was seeded.') + '\n');
|
|
@@ -243,23 +219,13 @@ function applyLegacyInit(cwd, force) {
|
|
|
243
219
|
}
|
|
244
220
|
export const initCommand = {
|
|
245
221
|
name: 'init',
|
|
246
|
-
description: 'Initialize a sharkcraft/ folder in the current repository. Pass --preset <id> to apply a built-in preset (default: generic). Use --zero-config or --preset auto to detect the workspace and pick a preset automatically. Use --legacy for the full pre-preset seed.
|
|
247
|
-
usage: 'shrk init [--preset <id|auto>] [--zero-config] [--
|
|
222
|
+
description: 'Initialize a sharkcraft/ folder in the current repository. Pass --preset <id> to apply a built-in preset (default: generic). Use --zero-config or --preset auto to detect the workspace and pick a preset automatically. Use --legacy for the full pre-preset seed.',
|
|
223
|
+
usage: 'shrk init [--preset <id|auto>] [--zero-config] [--dry-run] [--write] [--legacy] [--force] [--merge] [--suggest-only] [--no-gitignore] [--surface-profile <id>]',
|
|
248
224
|
async run(args) {
|
|
249
225
|
const force = flagBool(args, 'force');
|
|
250
226
|
const merge = flagBool(args, 'merge');
|
|
251
227
|
const cwd = resolveCwd(args);
|
|
252
|
-
const wantInfer = flagBool(args, 'infer');
|
|
253
228
|
const skipGitignore = flagBool(args, 'no-gitignore');
|
|
254
|
-
// `--infer` mode short-circuits the preset path entirely. The
|
|
255
|
-
// inferred output IS the populated sharkcraft/*, no preset
|
|
256
|
-
// baseline to merge against. This is the cleaner contract: the
|
|
257
|
-
// user opted into "scan my repo and tell me what's there", and
|
|
258
|
-
// adding a preset's static defaults on top would muddy the
|
|
259
|
-
// confidence reporting in .inferred-report.md.
|
|
260
|
-
if (wantInfer) {
|
|
261
|
-
return runInferInit(cwd, args, force);
|
|
262
|
-
}
|
|
263
229
|
if (flagBool(args, 'legacy')) {
|
|
264
230
|
const code = applyLegacyInit(cwd, force);
|
|
265
231
|
if (code === 0 && !skipGitignore) {
|
|
@@ -320,7 +286,7 @@ export const initCommand = {
|
|
|
320
286
|
if (dryRun) {
|
|
321
287
|
process.stdout.write(`Surface profile: ${surfaceDecision.profile} (${surfaceDecision.source}) — ${surfaceDecision.reason}\n`);
|
|
322
288
|
}
|
|
323
|
-
|
|
289
|
+
return applyPresetInit(cwd, {
|
|
324
290
|
presetId,
|
|
325
291
|
dryRun,
|
|
326
292
|
force,
|
|
@@ -330,139 +296,5 @@ export const initCommand = {
|
|
|
330
296
|
surfaceProfile: surfaceDecision.profile,
|
|
331
297
|
surfaceProfileReason: surfaceDecision.reason,
|
|
332
298
|
});
|
|
333
|
-
// `--with-claude-skill` chains the claude-skill export onto the init
|
|
334
|
-
// so a fresh user goes from `npx shrk init --with-claude-skill --write`
|
|
335
|
-
// to a working .claude/skills/<name>/SKILL.md in one step. Skipped in
|
|
336
|
-
// dry-run + when init itself didn't succeed.
|
|
337
|
-
if (presetCode === 0 &&
|
|
338
|
-
!dryRun &&
|
|
339
|
-
(flagBool(args, 'with-claude-skill') || flagBool(args, 'with-skill'))) {
|
|
340
|
-
const skillCode = await runClaudeSkillExportAfterInit(cwd, force);
|
|
341
|
-
// Init success is what we report; skill failure is logged but
|
|
342
|
-
// doesn't fail the init exit code (otherwise users would see a
|
|
343
|
-
// half-applied repo with a non-zero exit and panic).
|
|
344
|
-
if (skillCode !== 0) {
|
|
345
|
-
process.stderr.write('\n(claude-skill export failed — re-run `shrk export claude-skill --write` to retry.)\n');
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return presetCode;
|
|
349
299
|
},
|
|
350
300
|
};
|
|
351
|
-
/**
|
|
352
|
-
* Chain the claude-skill export onto a successful init. Loads the
|
|
353
|
-
* exporter lazily (it depends on inspectSharkcraft which has its own
|
|
354
|
-
* caching) and writes the skill file using the same `--force` semantics
|
|
355
|
-
* as init itself.
|
|
356
|
-
*/
|
|
357
|
-
/**
|
|
358
|
-
* `shrk init --infer` — scan the repo and populate `sharkcraft/*`
|
|
359
|
-
* with the real signals it finds, instead of writing preset defaults.
|
|
360
|
-
*
|
|
361
|
-
* Pipeline:
|
|
362
|
-
* 1. `inspectSharkcraft({ cwd })` builds the full inspection.
|
|
363
|
-
* 2. `buildOnboardingPlan(inspection)` extracts inferred paths,
|
|
364
|
-
* rules, boundaries, pipelines, verification commands.
|
|
365
|
-
* 3. `synthesizeFromOnboarding(plan)` triages each entry by
|
|
366
|
-
* confidence and emits populated `sharkcraft/*.ts` files plus
|
|
367
|
-
* a companion `.inferred-report.md` + `.inferred-report.json`.
|
|
368
|
-
* 4. Writer respects `--dry-run` / `--write` / `--force` /
|
|
369
|
-
* `--with-claude-skill` semantics consistently with the
|
|
370
|
-
* preset-init path.
|
|
371
|
-
*
|
|
372
|
-
* Honest-by-default: every adopted entry is tagged with its source
|
|
373
|
-
* signal; medium-confidence rows get a `// TODO: review` marker; low-
|
|
374
|
-
* confidence rows are dropped from the populated files and listed in
|
|
375
|
-
* the report so the user knows exactly what was inferred vs needs
|
|
376
|
-
* authoring.
|
|
377
|
-
*/
|
|
378
|
-
async function runInferInit(cwd, args, force) {
|
|
379
|
-
const { inspectSharkcraft, buildOnboardingPlan, synthesizeFromOnboarding } = await import('@shrkcrft/inspector');
|
|
380
|
-
const dryRun = !flagBool(args, 'write');
|
|
381
|
-
const sharkcraftDir = nodePath.join(cwd, 'sharkcraft');
|
|
382
|
-
process.stdout.write(header('SharkCraft init — infer'));
|
|
383
|
-
process.stdout.write(`Folder: ${sharkcraftDir}\n`);
|
|
384
|
-
const inspection = await inspectSharkcraft({ cwd });
|
|
385
|
-
const plan = buildOnboardingPlan(inspection);
|
|
386
|
-
const result = synthesizeFromOnboarding(plan);
|
|
387
|
-
// Summary block — print BEFORE writing so the user can ctrl-C if the
|
|
388
|
-
// confidence triage doesn't look right.
|
|
389
|
-
process.stdout.write(`\nDetected profiles: ${plan.projectSummary.profiles.join(', ') || '(none)'}\n`);
|
|
390
|
-
process.stdout.write(`Inference triage: ${result.report.adoptedHigh.length} adopted directly · ` +
|
|
391
|
-
`${result.report.adoptedMedium.length} marked for review · ` +
|
|
392
|
-
`${result.report.dropped.length} dropped (in report).\n\n`);
|
|
393
|
-
const written = [];
|
|
394
|
-
const skipped = [];
|
|
395
|
-
const wouldWrite = [];
|
|
396
|
-
for (const file of result.files) {
|
|
397
|
-
const fullPath = nodePath.join(sharkcraftDir, file.path);
|
|
398
|
-
if (dryRun) {
|
|
399
|
-
wouldWrite.push(file.path);
|
|
400
|
-
continue;
|
|
401
|
-
}
|
|
402
|
-
mkdirSync(nodePath.dirname(fullPath), { recursive: true });
|
|
403
|
-
if (existsSync(fullPath) && !force) {
|
|
404
|
-
skipped.push(file.path);
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
writeFileSync(fullPath, file.content, 'utf8');
|
|
408
|
-
written.push(file.path);
|
|
409
|
-
}
|
|
410
|
-
if (dryRun) {
|
|
411
|
-
process.stdout.write('Would write:\n');
|
|
412
|
-
for (const p of wouldWrite)
|
|
413
|
-
process.stdout.write(bullet(p) + '\n');
|
|
414
|
-
process.stdout.write('\nRe-run with --write to persist.\n');
|
|
415
|
-
return 0;
|
|
416
|
-
}
|
|
417
|
-
if (written.length) {
|
|
418
|
-
process.stdout.write('Wrote:\n');
|
|
419
|
-
for (const p of written)
|
|
420
|
-
process.stdout.write(bullet(p) + '\n');
|
|
421
|
-
}
|
|
422
|
-
if (skipped.length) {
|
|
423
|
-
process.stdout.write('\nSkipped (already exist; use --force to overwrite):\n');
|
|
424
|
-
for (const p of skipped)
|
|
425
|
-
process.stdout.write(bullet(p) + '\n');
|
|
426
|
-
}
|
|
427
|
-
process.stdout.write(`\nRead the confidence report: \`${nodePath.join('sharkcraft', '.inferred-report.md')}\`\n` +
|
|
428
|
-
`It lists what was adopted high-confidence, what's marked for your review, ` +
|
|
429
|
-
`and what shrk can't infer (project-specific decisions you should author by hand).\n`);
|
|
430
|
-
process.stdout.write('\nNext:\n');
|
|
431
|
-
process.stdout.write(bullet('$ shrk doctor — verify the setup (shape-aware verdict)') + '\n');
|
|
432
|
-
process.stdout.write(bullet('$ shrk brief — single-page brief Claude reads first') + '\n');
|
|
433
|
-
process.stdout.write(bullet('$ shrk export claude-skill --write — inline the rules into Claude\'s prompt') + '\n');
|
|
434
|
-
// Chain claude-skill if requested.
|
|
435
|
-
if (flagBool(args, 'with-claude-skill') || flagBool(args, 'with-skill')) {
|
|
436
|
-
const skillCode = await runClaudeSkillExportAfterInit(cwd, force);
|
|
437
|
-
if (skillCode !== 0) {
|
|
438
|
-
process.stderr.write('\n(claude-skill export failed — re-run `shrk export claude-skill --write` to retry.)\n');
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
// Gitignore + paths advisory same as preset path.
|
|
442
|
-
const skipGitignore = flagBool(args, 'no-gitignore');
|
|
443
|
-
if (!skipGitignore) {
|
|
444
|
-
const patch = ensureSharkcraftGitignore({ cwd, dryRun: false });
|
|
445
|
-
if (patch.added.length > 0) {
|
|
446
|
-
process.stdout.write('\n' + renderGitignorePatch(patch, false));
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return 0;
|
|
450
|
-
}
|
|
451
|
-
async function runClaudeSkillExportAfterInit(cwd, force) {
|
|
452
|
-
const { inspectSharkcraft } = await import('@shrkcrft/inspector');
|
|
453
|
-
const { renderExport } = await import("../export/export-formats.js");
|
|
454
|
-
const inspection = await inspectSharkcraft({ cwd });
|
|
455
|
-
const result = renderExport(inspection, { format: 'claude-skill' });
|
|
456
|
-
const outputPath = nodePath.join(cwd, result.suggestedPath);
|
|
457
|
-
mkdirSync(nodePath.dirname(outputPath), { recursive: true });
|
|
458
|
-
if (existsSync(outputPath) && !force) {
|
|
459
|
-
process.stdout.write(`\nSkipped claude-skill export — ${result.suggestedPath} already exists. Pass --force to overwrite, or run \`shrk export claude-skill --write --force\`.\n`);
|
|
460
|
-
return 0;
|
|
461
|
-
}
|
|
462
|
-
writeFileSync(outputPath, result.content, 'utf8');
|
|
463
|
-
process.stdout.write('\n');
|
|
464
|
-
process.stdout.write(header('Claude-skill exported'));
|
|
465
|
-
process.stdout.write(`Wrote ${result.suggestedPath}\n` +
|
|
466
|
-
` → Claude Code will auto-load this skill in any session opened against this repo.\n`);
|
|
467
|
-
return 0;
|
|
468
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.command.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp.command.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,UAAU,EAAE,eAiDxB,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { buildSurfaceSummary, findCommandInSummary } from "../surface/surface-su
|
|
|
6
6
|
export const mcpCommand = {
|
|
7
7
|
name: 'mcp',
|
|
8
8
|
description: 'MCP server operations (subcommand required).',
|
|
9
|
-
usage: 'shrk [--cwd <dir>] mcp serve [--verbose] [--watch] [--http] [--port <n>] [--host <h>]',
|
|
9
|
+
usage: 'shrk [--cwd <dir>] mcp serve [--verbose] [--watch] [--http] [--port <n>] [--host <h>] | shrk mcp install [<harness>]',
|
|
10
10
|
async run(args) {
|
|
11
11
|
const sub = args.positional[0];
|
|
12
12
|
if (sub === 'serve') {
|
|
@@ -35,10 +35,139 @@ export const mcpCommand = {
|
|
|
35
35
|
return 1;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
if (sub === 'install') {
|
|
39
|
+
const harness = args.positional[1];
|
|
40
|
+
const showAll = flagBool(args, 'all-paths');
|
|
41
|
+
if (harness !== undefined && !HARNESSES.some((h) => h.id === harness)) {
|
|
42
|
+
process.stderr.write(`Unknown harness: ${harness}\nKnown: ${HARNESSES.map((h) => h.id).join(', ')}\n`);
|
|
43
|
+
return 2;
|
|
44
|
+
}
|
|
45
|
+
process.stdout.write(renderMcpInstallInstructions(harness, showAll));
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
process.stderr.write('Usage:\n' +
|
|
49
|
+
' shrk mcp serve [--http] [--port N] [--watch]\n' +
|
|
50
|
+
' shrk mcp install [claude-code|claude-desktop|cursor|cline]\n');
|
|
39
51
|
return 2;
|
|
40
52
|
},
|
|
41
53
|
};
|
|
54
|
+
const HARNESSES = [
|
|
55
|
+
{
|
|
56
|
+
id: 'claude-code',
|
|
57
|
+
label: 'Claude Code (Anthropic CLI)',
|
|
58
|
+
configPaths: [
|
|
59
|
+
{ os: '*', path: '<repo>/.mcp.json # project-scoped (preferred)' },
|
|
60
|
+
{ os: '*', path: '~/.claude.json # user-scoped (fallback)' },
|
|
61
|
+
],
|
|
62
|
+
note: 'Claude Code reads both; project-scoped wins when present.',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'claude-desktop',
|
|
66
|
+
label: 'Claude Desktop',
|
|
67
|
+
configPaths: [
|
|
68
|
+
{ os: 'darwin', path: '~/Library/Application Support/Claude/claude_desktop_config.json' },
|
|
69
|
+
{ os: 'win32', path: '%APPDATA%\\Claude\\claude_desktop_config.json' },
|
|
70
|
+
{ os: 'linux', path: '~/.config/Claude/claude_desktop_config.json' },
|
|
71
|
+
],
|
|
72
|
+
note: 'Restart Claude Desktop after editing.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'cursor',
|
|
76
|
+
label: 'Cursor IDE',
|
|
77
|
+
configPaths: [
|
|
78
|
+
{ os: '*', path: '~/.cursor/mcp.json # user-scoped' },
|
|
79
|
+
{ os: '*', path: '<repo>/.cursor/mcp.json # project-scoped' },
|
|
80
|
+
],
|
|
81
|
+
note: 'Cursor merges both. Reload the IDE after editing.',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'cline',
|
|
85
|
+
label: 'Cline (VS Code extension)',
|
|
86
|
+
configPaths: [
|
|
87
|
+
{
|
|
88
|
+
os: 'darwin',
|
|
89
|
+
path: '~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
os: 'win32',
|
|
93
|
+
path: '%APPDATA%\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
os: 'linux',
|
|
97
|
+
path: '~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
note: 'Reload the Cline panel after editing.',
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
function currentOs() {
|
|
104
|
+
const p = process.platform;
|
|
105
|
+
if (p === 'darwin' || p === 'win32' || p === 'linux')
|
|
106
|
+
return p;
|
|
107
|
+
return 'other';
|
|
108
|
+
}
|
|
109
|
+
function pathsForPlatform(target, showAll) {
|
|
110
|
+
if (showAll)
|
|
111
|
+
return target.configPaths.map((p) => p.path);
|
|
112
|
+
const os = currentOs();
|
|
113
|
+
const matched = target.configPaths.filter((p) => p.os === '*' || p.os === os);
|
|
114
|
+
// If the current OS has no specific entry, fall back to all to avoid an
|
|
115
|
+
// empty list. (`other` platforms like FreeBSD land here.)
|
|
116
|
+
if (matched.length === 0)
|
|
117
|
+
return target.configPaths.map((p) => p.path);
|
|
118
|
+
return matched.map((p) => p.path);
|
|
119
|
+
}
|
|
120
|
+
const SHARKCRAFT_MCP_SNIPPET = `{
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"sharkcraft": {
|
|
123
|
+
"command": "shrk",
|
|
124
|
+
"args": ["mcp", "serve"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}`;
|
|
128
|
+
function renderMcpInstallInstructions(harness, showAll) {
|
|
129
|
+
const lines = [];
|
|
130
|
+
if (!harness) {
|
|
131
|
+
lines.push('SharkCraft MCP server entry (universal, stdio transport):');
|
|
132
|
+
lines.push('');
|
|
133
|
+
lines.push(SHARKCRAFT_MCP_SNIPPET);
|
|
134
|
+
lines.push('');
|
|
135
|
+
lines.push('Paste it into one of these harnesses (`shrk mcp install <id>` for exact paths):');
|
|
136
|
+
lines.push('');
|
|
137
|
+
for (const h of HARNESSES) {
|
|
138
|
+
lines.push(` ${h.id.padEnd(16)} ${h.label}`);
|
|
139
|
+
}
|
|
140
|
+
lines.push('');
|
|
141
|
+
lines.push('After pasting, restart/reload the harness. The server is read-only — agents cannot write.');
|
|
142
|
+
return lines.join('\n') + '\n';
|
|
143
|
+
}
|
|
144
|
+
const target = HARNESSES.find((h) => h.id === harness);
|
|
145
|
+
if (!target) {
|
|
146
|
+
return (`Unknown harness: ${harness}\n` +
|
|
147
|
+
`Known: ${HARNESSES.map((h) => h.id).join(', ')}\n`);
|
|
148
|
+
}
|
|
149
|
+
const paths = pathsForPlatform(target, showAll);
|
|
150
|
+
const os = currentOs();
|
|
151
|
+
lines.push(`${target.label}`);
|
|
152
|
+
lines.push('');
|
|
153
|
+
lines.push(showAll || os === 'other'
|
|
154
|
+
? 'Config file (all platforms):'
|
|
155
|
+
: `Config file (${os}; pass --all-paths to see every platform):`);
|
|
156
|
+
for (const p of paths)
|
|
157
|
+
lines.push(` ${p}`);
|
|
158
|
+
lines.push('');
|
|
159
|
+
lines.push('Add this entry (merge with any existing `mcpServers` block):');
|
|
160
|
+
lines.push('');
|
|
161
|
+
lines.push(SHARKCRAFT_MCP_SNIPPET);
|
|
162
|
+
if (target.note) {
|
|
163
|
+
lines.push('');
|
|
164
|
+
lines.push(target.note);
|
|
165
|
+
}
|
|
166
|
+
lines.push('');
|
|
167
|
+
lines.push('Verify by asking the agent: "List MCP tools available." You should see ~250 sharkcraft tools.');
|
|
168
|
+
lines.push('The server is read-only — agents cannot write. Use `shrk apply --verify-signature` for writes.');
|
|
169
|
+
return lines.join('\n') + '\n';
|
|
170
|
+
}
|
|
42
171
|
/**
|
|
43
172
|
* Build the MCP tier-gate resolver from the surface summary.
|
|
44
173
|
* Returns a function that, given a tool, decides whether to refuse the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboard.command.d.ts","sourceRoot":"","sources":["../../src/commands/onboard.command.ts"],"names":[],"mappings":"AA6CA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"onboard.command.d.ts","sourceRoot":"","sources":["../../src/commands/onboard.command.ts"],"names":[],"mappings":"AA6CA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,cAAc,EAAE,eA2O5B,CAAC"}
|
|
@@ -5,8 +5,8 @@ import { flagBool, flagNumber, flagString, flagList, resolveCwd, } from "../comm
|
|
|
5
5
|
import { asJson, header, kv } from "../output/format-output.js";
|
|
6
6
|
export const onboardCommand = {
|
|
7
7
|
name: 'onboard',
|
|
8
|
-
description: 'Analyze an existing repository and produce a SharkCraft onboarding plan (rules / paths / templates / boundaries / pipelines + readiness estimate). Default is dry-run; `--write-drafts` writes advisory drafts under sharkcraft/onboarding/ (never overwrites rules.ts / paths.ts / templates.ts). `--scaffold-templates` drafts runnable template bodies. `--import-agents` parses AGENTS.md / CLAUDE.md / .cursor/rules into a draft. `--diff` compares the plan against the live config.',
|
|
9
|
-
usage: 'shrk [--cwd <dir>] onboard [--dry-run] [--write-drafts] [--scaffold-templates] [--import-agents] [--diff] [--preset <id>] [--json]',
|
|
8
|
+
description: 'Analyze an existing repository and produce a SharkCraft onboarding plan (rules / paths / templates / boundaries / pipelines + readiness estimate). Default is dry-run; `--write-drafts` writes advisory drafts under sharkcraft/onboarding/ (never overwrites rules.ts / paths.ts / templates.ts). Re-running `--write-drafts` against hand-edited drafts performs a three-way merge against the previous snapshot; conflicts emit conflict markers inside the draft (use `--abort-on-conflict` for CI to leave the file untouched and exit non-zero). `--scaffold-templates` drafts runnable template bodies. `--import-agents` parses AGENTS.md / CLAUDE.md / .cursor/rules into a draft. `--diff` compares the plan against the live config.',
|
|
9
|
+
usage: 'shrk [--cwd <dir>] onboard [--dry-run] [--write-drafts] [--abort-on-conflict] [--scaffold-templates] [--import-agents] [--diff] [--preset <id>] [--json]',
|
|
10
10
|
async run(args) {
|
|
11
11
|
// Dispatch sub-verb: `shrk onboard adopt [...]`.
|
|
12
12
|
if (args.positional[0] === 'adopt') {
|
|
@@ -15,6 +15,7 @@ export const onboardCommand = {
|
|
|
15
15
|
}
|
|
16
16
|
const cwd = resolveCwd(args);
|
|
17
17
|
const writeDrafts = flagBool(args, 'write-drafts');
|
|
18
|
+
const abortOnConflict = flagBool(args, 'abort-on-conflict');
|
|
18
19
|
const scaffoldTemplates = flagBool(args, 'scaffold-templates');
|
|
19
20
|
const importAgents = flagBool(args, 'import-agents');
|
|
20
21
|
const diffMode = flagBool(args, 'diff');
|
|
@@ -35,6 +36,7 @@ export const onboardCommand = {
|
|
|
35
36
|
written = writeOnboardingDrafts(plan, {
|
|
36
37
|
projectRoot: cwd,
|
|
37
38
|
...(importedAgentRules ? { importedAgentRules } : {}),
|
|
39
|
+
abortOnConflict,
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
const diff = diffMode ? buildOnboardingDiff(inspection, plan) : undefined;
|
|
@@ -166,8 +168,18 @@ export const onboardCommand = {
|
|
|
166
168
|
if (writeDrafts && written) {
|
|
167
169
|
process.stdout.write(`Wrote ${written.files.length} draft file(s) to:\n ${written.outDir}\n`);
|
|
168
170
|
for (const f of written.files) {
|
|
169
|
-
process.stdout.write(` + ${f.path} (${f.bytes} bytes)\n`);
|
|
171
|
+
process.stdout.write(` + ${f.path} (${f.bytes} bytes) [${f.mergeStatus}]\n`);
|
|
170
172
|
}
|
|
173
|
+
if (written.conflicts > 0) {
|
|
174
|
+
process.stderr.write(`\nConflict regions emitted in ${written.conflicts} draft file(s). ` +
|
|
175
|
+
'Resolve <<<<<<< / ======= / >>>>>>> markers before adopting.\n');
|
|
176
|
+
}
|
|
177
|
+
if (written.aborted > 0) {
|
|
178
|
+
process.stderr.write(`\n--abort-on-conflict: ${written.aborted} draft file(s) left unchanged due to conflicts.\n`);
|
|
179
|
+
return 1;
|
|
180
|
+
}
|
|
181
|
+
if (written.conflicts > 0)
|
|
182
|
+
return 2;
|
|
171
183
|
}
|
|
172
184
|
else if (dryRun) {
|
|
173
185
|
process.stdout.write('Dry-run only. Re-run with `--write-drafts` to write advisory drafts.\n');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
-
export type PackKind = 'generic' | 'framework' | 'architecture' | 'enterprise';
|
|
2
|
+
export type PackKind = 'generic' | 'framework' | 'architecture' | 'enterprise' | 'platform-adopter';
|
|
3
3
|
interface IScaffoldFile {
|
|
4
4
|
/** Path relative to the new pack root. */
|
|
5
5
|
relativePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packs-new.d.ts","sourceRoot":"","sources":["../../src/commands/packs-new.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"packs-new.d.ts","sourceRoot":"","sources":["../../src/commands/packs-new.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,kBAAkB,CAAC;AAUpG,UAAU,aAAa;IACrB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CA+G/E;AA4TD,eAAO,MAAM,eAAe,EAAE,eAoG7B,CAAC;AAUF,eAAO,MAAM,gBAAgB,EAAE,eAqI9B,CAAC"}
|
|
@@ -1,13 +1,21 @@
|
|
|
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
|
+
};
|
|
1
9
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
3
11
|
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
4
12
|
import { asJson, header, kv } from "../output/format-output.js";
|
|
5
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
6
13
|
const VALID_KINDS = new Set([
|
|
7
14
|
'generic',
|
|
8
15
|
'framework',
|
|
9
16
|
'architecture',
|
|
10
17
|
'enterprise',
|
|
18
|
+
'platform-adopter',
|
|
11
19
|
]);
|
|
12
20
|
/** Pure: compute the file set to write. No IO. */
|
|
13
21
|
export function planPackScaffold(input) {
|
|
@@ -100,6 +108,12 @@ export function planPackScaffold(input) {
|
|
|
100
108
|
body: renderBoundariesAsset(),
|
|
101
109
|
});
|
|
102
110
|
}
|
|
111
|
+
if (input.kind === 'platform-adopter' || input.withExamples) {
|
|
112
|
+
files.push({
|
|
113
|
+
relativePath: 'src/assets/contracts/plugin-contract.example.ts',
|
|
114
|
+
body: renderPluginContractExample(),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
103
117
|
if (input.kind === 'enterprise') {
|
|
104
118
|
files.push({
|
|
105
119
|
relativePath: 'docs/review-workflow.md',
|
|
@@ -225,6 +239,12 @@ function renderKnowledgeAsset(input) {
|
|
|
225
239
|
['framework.overview', 'Framework overview', 'High', 'What this framework is for.'],
|
|
226
240
|
]);
|
|
227
241
|
}
|
|
242
|
+
if (input.kind === 'platform-adopter') {
|
|
243
|
+
return knowledgeBody([
|
|
244
|
+
['platform.policy', 'Policy capability', 'Medium', 'Describe the policy/capability model your platform exposes.'],
|
|
245
|
+
['platform.adapter', 'Adapter contract', 'Medium', 'Describe the adapter contract your platform expects.'],
|
|
246
|
+
]);
|
|
247
|
+
}
|
|
228
248
|
return knowledgeBody([
|
|
229
249
|
['pack.overview', 'Pack overview', 'Medium', 'Short overview of what this pack contributes.'],
|
|
230
250
|
]);
|
|
@@ -337,6 +357,17 @@ function renderBoundariesAsset() {
|
|
|
337
357
|
``,
|
|
338
358
|
].join('\n');
|
|
339
359
|
}
|
|
360
|
+
function renderPluginContractExample() {
|
|
361
|
+
return [
|
|
362
|
+
`// Example: an adapter-style plugin contract.`,
|
|
363
|
+
`// Replace with the actual interface your platform expects.`,
|
|
364
|
+
`export interface IPluginCapability {`,
|
|
365
|
+
` id: string;`,
|
|
366
|
+
` invoke(input: unknown): Promise<unknown>;`,
|
|
367
|
+
`}`,
|
|
368
|
+
``,
|
|
369
|
+
].join('\n');
|
|
370
|
+
}
|
|
340
371
|
function renderEnterpriseReviewDocs() {
|
|
341
372
|
return [
|
|
342
373
|
`# Review workflow`,
|
|
@@ -383,11 +414,11 @@ function renderDocsOverview(input, fullName) {
|
|
|
383
414
|
export const packsNewCommand = {
|
|
384
415
|
name: 'new',
|
|
385
416
|
description: 'Scaffold a new SharkCraft pack package (rules / paths / templates / pipelines / presets / boundaries). Dry-run by default — pass --write to materialize. No install, no publish, no overwrite without --force.',
|
|
386
|
-
usage: 'shrk [--cwd <dir>] packs new <name> [--scope @org] [--preset <id>] [--kind generic|framework|architecture|enterprise] [--with-examples] [--write] [--force] [--json]',
|
|
417
|
+
usage: 'shrk [--cwd <dir>] packs new <name> [--scope @org] [--preset <id>] [--kind generic|framework|architecture|enterprise|platform-adopter] [--with-examples] [--write] [--force] [--json]',
|
|
387
418
|
async run(args) {
|
|
388
419
|
const name = args.positional[0];
|
|
389
420
|
if (!name) {
|
|
390
|
-
process.stderr.write('Usage: shrk packs new <name> [--scope @org] [--preset <id>] [--kind generic|framework|architecture|enterprise] [--with-examples] [--write]\n');
|
|
421
|
+
process.stderr.write('Usage: shrk packs new <name> [--scope @org] [--preset <id>] [--kind generic|framework|architecture|enterprise|platform-adopter] [--with-examples] [--write]\n');
|
|
391
422
|
return 2;
|
|
392
423
|
}
|
|
393
424
|
const cwd = resolveCwd(args);
|
|
@@ -614,7 +645,7 @@ async function runRuntimePackTest(input) {
|
|
|
614
645
|
if (existsSync(entry)) {
|
|
615
646
|
try {
|
|
616
647
|
const { pathToFileURL } = await import('node:url');
|
|
617
|
-
const mod = (await
|
|
648
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(entry).href + `?bust=${Date.now()}`)));
|
|
618
649
|
const value = mod.default ?? mod;
|
|
619
650
|
const shape = describeShape(value);
|
|
620
651
|
modules.push({
|
|
@@ -661,7 +692,7 @@ async function runRuntimePackTest(input) {
|
|
|
661
692
|
continue;
|
|
662
693
|
try {
|
|
663
694
|
const { pathToFileURL } = await import('node:url');
|
|
664
|
-
const mod = (await
|
|
695
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(full).href + `?bust=${Date.now()}`)));
|
|
665
696
|
const value = mod.default;
|
|
666
697
|
const arr = Array.isArray(value) ? value : null;
|
|
667
698
|
modules.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packs.command.d.ts","sourceRoot":"","sources":["../../src/commands/packs.command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packs.command.d.ts","sourceRoot":"","sources":["../../src/commands/packs.command.ts"],"names":[],"mappings":"AAqBA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAOhC,eAAO,MAAM,yBAAyB,EAAE,eAoCvC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,eAsGzC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eA+CnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAuD9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAsE7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAqDjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAyFhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAqEhC,CAAC;AA4DF,eAAO,MAAM,gBAAgB,EAAE,eA+K9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAmCtC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAyFhC,CAAC;AAMF,eAAO,MAAM,qBAAqB,EAAE,eA4BnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eA+E/B,CAAC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
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
|
+
};
|
|
1
9
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
3
12
|
import { buildPackDoctorReport, buildPackSignatureStatusReport, checkPackSymbolCompat, explainPackSignatureStatus, inspectSharkcraft, mergePackReleaseChecks, runPackReleaseCheck, runPackReleaseChecksForReport, } from '@shrkcrft/inspector';
|
|
4
13
|
import { PACK_SECRET_ENV, signPackManifest, validatePackManifest, verifyPackManifest, } from '@shrkcrft/plugin-api';
|
|
5
14
|
import { flagBool, flagString, resolveCwd, } from "../command-registry.js";
|
|
6
15
|
import { asJson, header, kv } from "../output/format-output.js";
|
|
7
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
8
16
|
function statusLabel(valid) {
|
|
9
17
|
return valid ? 'OK ' : 'INVALID';
|
|
10
18
|
}
|
|
@@ -545,7 +553,7 @@ async function loadManifestFromPath(manifestPath) {
|
|
|
545
553
|
if (manifestPath.endsWith('.json')) {
|
|
546
554
|
return JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
547
555
|
}
|
|
548
|
-
const mod = (await
|
|
556
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(manifestPath).href)));
|
|
549
557
|
return (mod.default ?? mod);
|
|
550
558
|
}
|
|
551
559
|
export const packsSignCommand = {
|
|
@@ -765,11 +773,17 @@ export const packsCompatCommand = {
|
|
|
765
773
|
: nodePath.resolve(cwd, consumerRootRaw)
|
|
766
774
|
: null;
|
|
767
775
|
const distAware = flagBool(args, 'dist-aware');
|
|
776
|
+
const fastMode = flagBool(args, 'fast');
|
|
768
777
|
// Run a release-check first; surfaces helper-missing diagnostics.
|
|
769
778
|
const release = await runPackReleaseCheck(abs);
|
|
770
779
|
const helperMissing = release.findings.filter((f) => f.code === 'contribution-helper-missing');
|
|
771
780
|
// Symbol-level diff against the consumer's installed plugin-api.
|
|
772
|
-
const symbol = checkPackSymbolCompat({
|
|
781
|
+
const symbol = checkPackSymbolCompat({
|
|
782
|
+
packPath: abs,
|
|
783
|
+
consumerRoot,
|
|
784
|
+
distAware,
|
|
785
|
+
mode: fastMode ? 'fast' : 'ts',
|
|
786
|
+
});
|
|
773
787
|
const passed = helperMissing.length === 0 && symbol.compatible;
|
|
774
788
|
if (flagBool(args, 'json')) {
|
|
775
789
|
process.stdout.write(asJson({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
+
export declare const pluginRenameCommand: ICommandHandler;
|
|
3
|
+
export declare const pluginRemoveCommand: ICommandHandler;
|
|
4
|
+
export declare const pluginLifecycleListCommand: ICommandHandler;
|
|
5
|
+
export declare const pluginLifecycleInspectCommand: ICommandHandler;
|
|
6
|
+
export declare const pluginLifecycleProfilesCommand: ICommandHandler;
|
|
7
|
+
export declare const pluginLifecycleProfileCommand: ICommandHandler;
|
|
8
|
+
export declare const pluginLifecycleDoctorCommand: ICommandHandler;
|
|
9
|
+
export declare const pluginLifecycleCommand: ICommandHandler;
|
|
10
|
+
export declare const pluginCommand: ICommandHandler;
|
|
11
|
+
//# sourceMappingURL=plugin.command.d.ts.map
|