@skill-map/cli 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cli/tutorial/sm-master/references/tour-authoring.md +0 -4
  2. package/dist/cli/tutorial/sm-tutorial/SKILL.md +279 -26
  3. package/dist/cli.js +732 -549
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +28 -13
  7. package/dist/index.js.map +1 -1
  8. package/dist/kernel/index.d.ts +44 -34
  9. package/dist/kernel/index.js +28 -13
  10. package/dist/kernel/index.js.map +1 -1
  11. package/dist/ui/chunk-4HTOYDCM.js +809 -0
  12. package/dist/ui/chunk-4X4GYACU.js +123 -0
  13. package/dist/ui/chunk-7Q3IO77R.js +317 -0
  14. package/dist/ui/chunk-FL6RV2IG.js +2 -0
  15. package/dist/ui/chunk-HGNE4UVQ.js +1 -0
  16. package/dist/ui/chunk-IS5ULQSF.js +1 -0
  17. package/dist/ui/chunk-KVWYVO6I.js +1 -0
  18. package/dist/ui/chunk-N4XX4WPE.js +2190 -0
  19. package/dist/ui/chunk-P7TXZKUX.js +2 -0
  20. package/dist/ui/chunk-UVVXMEZT.js +1025 -0
  21. package/dist/ui/chunk-W2JMLJCF.js +135 -0
  22. package/dist/ui/{chunk-NHI5UPNK.js → chunk-YWWD62BR.js} +1 -1
  23. package/dist/ui/chunk-Z3C2OSRL.js +107 -0
  24. package/dist/ui/chunk-ZAEGBMF7.js +90 -0
  25. package/dist/ui/index.html +2 -2
  26. package/dist/ui/main-F7N5RV4Y.js +3 -0
  27. package/dist/ui/{styles-2WO3KNOY.css → styles-6H4GSOHY.css} +1 -1
  28. package/package.json +2 -2
  29. package/dist/ui/chunk-AALYQ3RG.js +0 -965
  30. package/dist/ui/chunk-JECPBFFX.js +0 -135
  31. package/dist/ui/chunk-LGLLRAJ6.js +0 -61
  32. package/dist/ui/chunk-PVVKVGJ6.js +0 -500
  33. package/dist/ui/chunk-SKA7ZFUX.js +0 -1
  34. package/dist/ui/chunk-VDMXHCXR.js +0 -1
  35. package/dist/ui/chunk-VZIYRREA.js +0 -2588
  36. package/dist/ui/chunk-XRDZZC5F.js +0 -123
  37. package/dist/ui/chunk-YPO2DTMO.js +0 -317
  38. package/dist/ui/chunk-ZYIKNMFV.js +0 -107
  39. package/dist/ui/main-TYWMNAII.js +0 -2
@@ -347,6 +347,14 @@ interface IAnnotationContribution {
347
347
  * Runtime extension descriptor as seen by the registry / orchestrator.
348
348
  * Authors writing a manifest on disk do NOT declare `id`, `kind`, or
349
349
  * `pluginId`; the loader injects all three from the filesystem layout.
350
+ *
351
+ * `version` is the runtime invariant: every loaded extension carries a
352
+ * string. External plugins MUST declare it in their manifest (enforced
353
+ * by AJV via `spec/schemas/extensions/base.schema.json#/required`).
354
+ * Built-in extensions inside this repo OMIT `version` from the manifest
355
+ * file (see `IBuiltInManifest` below) because the codegen at
356
+ * `scripts/generate-built-ins.js` stamps the CLI version onto every
357
+ * built-in at build time, alongside the `pluginId` stamp.
350
358
  */
351
359
  interface IExtensionBase {
352
360
  /**
@@ -442,7 +450,7 @@ interface IExtensionBase {
442
450
  * 5. **Internal type aliases**, anything declared as `type` (string-
443
451
  * literal unions, function types, mapped/derived types) that lives
444
452
  * only in TS: `TLogLevel`, `TLogMethodLevel`, `TProgressListener`,
445
- * `TLogFormatter`, `TActionWrite`, `TExecutionMode`, `TGranularity`,
453
+ * `TLogFormatter`, `TActionWrite`, `TExecutionMode`,
446
454
  * `THookFilter`, `THookTrigger`, `TNodeChangeReason`,
447
455
  * `TPluginLoadStatus`, `TPluginStorage`, `TWatchEventKind`. **`T`
448
456
  * prefix.** Use this bucket when `interface` is the wrong shape
@@ -1059,24 +1067,6 @@ type TPluginStorage = {
1059
1067
  migrations: string[];
1060
1068
  schemas?: Record<string, string>;
1061
1069
  };
1062
- /**
1063
- * Toggle granularity for a plugin / built-in bundle.
1064
- *
1065
- * - `'bundle'` , the plugin id is the only enable/disable key. The whole
1066
- * bundle of extensions follows the toggle; the user cannot
1067
- * enable some extensions of the bundle and disable others.
1068
- * Default for plugins (and for the built-in `claude`
1069
- * bundle, where the provider and its kind-aware extractors
1070
- * form a coherent provider).
1071
- * - `'extension'`, each extension is independently toggle-able under its
1072
- * qualified id `<plugin-id>/<extension-id>`. Used for
1073
- * the built-in `core` bundle (every kernel built-in
1074
- * rule / formatter is removable per spec
1075
- * "no extension is privileged"). Plugin authors opt in
1076
- * only when the plugin ships several orthogonal
1077
- * capabilities a user might reasonably want piecemeal.
1078
- */
1079
- type TGranularity = 'bundle' | 'extension';
1080
1070
  /**
1081
1071
  * Raw `plugin.json` shape after successful AJV validation.
1082
1072
  *
@@ -1099,13 +1089,6 @@ interface IPluginManifest {
1099
1089
  /** Required short description shown in `sm plugins list` and the UI. */
1100
1090
  description: string;
1101
1091
  storage?: TPluginStorage;
1102
- /**
1103
- * Toggle granularity for this plugin. Optional with default
1104
- * `'extension'` since the structure-as-truth refactor (more
1105
- * permissive default: each extension is independently toggleable
1106
- * unless the author opts into bundle-level coupling).
1107
- */
1108
- granularity?: TGranularity;
1109
1092
  author?: string;
1110
1093
  license?: string;
1111
1094
  homepage?: string;
@@ -1186,12 +1169,6 @@ interface IDiscoveredPlugin {
1186
1169
  manifest?: IPluginManifest;
1187
1170
  /** Only present when status === 'enabled'. */
1188
1171
  extensions?: ILoadedExtension[];
1189
- /**
1190
- * Resolved granularity for this plugin. Always populated from
1191
- * `manifest.granularity` (default `'bundle'`) when the manifest parsed;
1192
- * absent for `invalid-manifest` paths where the manifest never validated.
1193
- */
1194
- granularity?: TGranularity;
1195
1172
  /**
1196
1173
  * Runtime-only, never persisted, never spec-modeled.
1197
1174
  *
@@ -2472,6 +2449,19 @@ interface IAnalyzerContext {
2472
2449
  * orphan files exist. Treat as read-only.
2473
2450
  */
2474
2451
  orphanJobFiles?: readonly string[];
2452
+ /**
2453
+ * Issues emitted by analyzers that already ran in the current pass.
2454
+ * Lets a late-phase analyzer (`core/issue-counter`) compute
2455
+ * cross-analyzer aggregates (per-node severity totals) without
2456
+ * scanning the persisted DB. The orchestrator threads the live
2457
+ * accumulator on every call so any analyzer can opt-in; only the
2458
+ * aggregator reads it today, the rest treat it as inert.
2459
+ *
2460
+ * Treat as read-only, the accumulator is shared with downstream
2461
+ * analyzers and a mutation here would corrupt their view of the
2462
+ * scan. Absent (or empty) on legacy callers that never wired it.
2463
+ */
2464
+ accumulatedIssues?: readonly Issue[];
2475
2465
  /**
2476
2466
  * Set of absolute file paths the operator has opted into for
2477
2467
  * link-validation purposes via `scan.referencePaths`. The driving
@@ -2563,6 +2553,26 @@ interface IAnalyzer extends IExtensionBase {
2563
2553
  * "Resolve this issue" affordances.
2564
2554
  */
2565
2555
  precondition?: IExtensionPrecondition;
2556
+ /**
2557
+ * Execution phase. Drives the order the orchestrator schedules
2558
+ * analyzers in:
2559
+ *
2560
+ * - `'detect'` (default), the main pass. Walks nodes / links and
2561
+ * emits its own findings. Most analyzers live here.
2562
+ * - `'aggregate'`, runs strictly AFTER every `detect`-phase
2563
+ * analyzer has finished. The orchestrator passes the full
2564
+ * issue accumulator on `ctx.accumulatedIssues`, so an
2565
+ * aggregator can compute cross-analyzer summaries (per-node
2566
+ * severity totals, etc.) without re-reading the persisted DB.
2567
+ * Aggregators emit contributions; emitting issues is allowed
2568
+ * but uncommon.
2569
+ *
2570
+ * Two-phase scheduling is the clean alternative to ordering
2571
+ * analyzers by hand in the built-ins registry: filesystem-sorted
2572
+ * generators can keep their alphabetical output, the orchestrator
2573
+ * applies the phase sort at run-time.
2574
+ */
2575
+ phase?: 'detect' | 'aggregate';
2566
2576
  evaluate(ctx: IAnalyzerContext): Issue[] | Promise<Issue[]>;
2567
2577
  }
2568
2578
 
@@ -3747,7 +3757,7 @@ interface IUpdateCheckCache {
3747
3757
  * any drift a compile error).
3748
3758
  *
3749
3759
  * Domain types (`IPluginManifest`, `ILoadedExtension`, `IDiscoveredPlugin`,
3750
- * `TPluginStorage`, `TPluginLoadStatus`, `TGranularity`) live in
3760
+ * `TPluginStorage`, `TPluginLoadStatus`) live in
3751
3761
  * `kernel/types/plugin.ts` because they are spec-mirroring DTOs, not
3752
3762
  * port-shape types. The port re-exports them for callers that import
3753
3763
  * from the ports barrel.
@@ -4307,4 +4317,4 @@ interface Kernel {
4307
4317
  }
4308
4318
  declare function createKernel(): Kernel;
4309
4319
 
4310
- export { type Confidence, DuplicateExtensionError, EXTENSION_KINDS, type ExecutionFailureReason, type ExecutionKind, type ExecutionRecord, type ExecutionRunner, type ExecutionStatus, ExportQueryError, type ExtensionKind, type FilesystemPort, HOOK_TRIGGERS, type HistoryStats, type HistoryStatsErrorRates, type HistoryStatsExecutionsPerPeriod, type HistoryStatsPerActionRate, type HistoryStatsTokensPerAction, type HistoryStatsTopNode, type HistoryStatsTotals, type IAction, type IActionContext, type IActionPrecondition, type IActionResult, type IAnalyzer, type IAnalyzerContext, type IAnnotationContribution, type ICreateFsWatcherOptions, type IDedicatedStorePersist, type IDedicatedStoreWrapper, type IDiscoveredPlugin, type IEnrichmentRecord, type IExportQuery, type IExportSubset, type IExtension, type IExtensionBase, type IExternalRef, type IExtractor, type IExtractorCallbacks, type IExtractorContext, type IExtractorRunRecord, type IFormatter, type IFormatterContext, type IFsWatcher, type IHook, type IHookContext, type IHookDispatcher, type IIssueRow, type IKvStorePersist, type IKvStoreWrapper, type ILoadedExtension, type INodeBundle, type INodeChange, type INodeCounts, type INodeFilter, type IPersistOptions, type IPersistedEnrichment, type IPluginManifest, type IPluginStorageSchema, type IProvider, type IRawNode, type IRegisteredAnnotationKey, type IRegisteredViewContribution, type IRunOptions, type IRunResult, type IScanDelta, type ITransactionalStorage, type IViewContribution, type IWalkOptions, type IWatchBatch, type IWatchEvent, InMemoryProgressEmitter, type Issue, type IssueFix, KV_SCHEMA_KEY, type Kernel, LOG_LEVELS, type Link, type LinkKind, type LinkLocation, type LinkOccurrence, type LinkTrigger, type LogRecord, type LoggerPort, type Node, type NodeKind, type NodeStat, type PluginLoaderPort, type ProgressEmitterPort, type ProgressEvent, Registry, type RenameOp, type RunScanOptions, type RunnerPort, type ScanResult, type ScanScannedBy, type ScanStats, type Severity, SilentLogger, type Stability, type StoragePort, type TActionWrite, type TExecutionMode, type TGranularity, type THookFilter, type THookTrigger, type TInputTypeName, type TLogLevel, type TLogMethodLevel, type TNodeChangeReason, type TPluginLoadStatus, type TPluginStorage, type TPluginStore, type TProgressListener, type TSettingDeclaration, type TSettingValue, type TSeverity, type TSlotName, type TWatchEventKind, type TripleSplit, applyExportQuery, computeScanDelta, configureLogger, createChokidarWatcher, createKernel, detectRenamesAndOrphans, getActiveLogger, isEmptyDelta, isLogLevel, log, logLevelRank, makeDedicatedStoreWrapper, makeEvent, makeHookDispatcher, makeKvStoreWrapper, makePluginStore, mergeNodeWithEnrichments, parseExportQuery, parseLogLevel, qualifiedExtensionId, resetLogger, runExtractorsForNode, runScan, runScanWithRenames };
4320
+ export { type Confidence, DuplicateExtensionError, EXTENSION_KINDS, type ExecutionFailureReason, type ExecutionKind, type ExecutionRecord, type ExecutionRunner, type ExecutionStatus, ExportQueryError, type ExtensionKind, type FilesystemPort, HOOK_TRIGGERS, type HistoryStats, type HistoryStatsErrorRates, type HistoryStatsExecutionsPerPeriod, type HistoryStatsPerActionRate, type HistoryStatsTokensPerAction, type HistoryStatsTopNode, type HistoryStatsTotals, type IAction, type IActionContext, type IActionPrecondition, type IActionResult, type IAnalyzer, type IAnalyzerContext, type IAnnotationContribution, type ICreateFsWatcherOptions, type IDedicatedStorePersist, type IDedicatedStoreWrapper, type IDiscoveredPlugin, type IEnrichmentRecord, type IExportQuery, type IExportSubset, type IExtension, type IExtensionBase, type IExternalRef, type IExtractor, type IExtractorCallbacks, type IExtractorContext, type IExtractorRunRecord, type IFormatter, type IFormatterContext, type IFsWatcher, type IHook, type IHookContext, type IHookDispatcher, type IIssueRow, type IKvStorePersist, type IKvStoreWrapper, type ILoadedExtension, type INodeBundle, type INodeChange, type INodeCounts, type INodeFilter, type IPersistOptions, type IPersistedEnrichment, type IPluginManifest, type IPluginStorageSchema, type IProvider, type IRawNode, type IRegisteredAnnotationKey, type IRegisteredViewContribution, type IRunOptions, type IRunResult, type IScanDelta, type ITransactionalStorage, type IViewContribution, type IWalkOptions, type IWatchBatch, type IWatchEvent, InMemoryProgressEmitter, type Issue, type IssueFix, KV_SCHEMA_KEY, type Kernel, LOG_LEVELS, type Link, type LinkKind, type LinkLocation, type LinkOccurrence, type LinkTrigger, type LogRecord, type LoggerPort, type Node, type NodeKind, type NodeStat, type PluginLoaderPort, type ProgressEmitterPort, type ProgressEvent, Registry, type RenameOp, type RunScanOptions, type RunnerPort, type ScanResult, type ScanScannedBy, type ScanStats, type Severity, SilentLogger, type Stability, type StoragePort, type TActionWrite, type TExecutionMode, type THookFilter, type THookTrigger, type TInputTypeName, type TLogLevel, type TLogMethodLevel, type TNodeChangeReason, type TPluginLoadStatus, type TPluginStorage, type TPluginStore, type TProgressListener, type TSettingDeclaration, type TSettingValue, type TSeverity, type TSlotName, type TWatchEventKind, type TripleSplit, applyExportQuery, computeScanDelta, configureLogger, createChokidarWatcher, createKernel, detectRenamesAndOrphans, getActiveLogger, isEmptyDelta, isLogLevel, log, logLevelRank, makeDedicatedStoreWrapper, makeEvent, makeHookDispatcher, makeKvStoreWrapper, makePluginStore, mergeNodeWithEnrichments, parseExportQuery, parseLogLevel, qualifiedExtensionId, resetLogger, runExtractorsForNode, runScan, runScanWithRenames };
@@ -101,7 +101,7 @@ import cl100k_base from "js-tiktoken/ranks/cl100k_base";
101
101
  // package.json
102
102
  var package_default = {
103
103
  name: "@skill-map/cli",
104
- version: "0.39.0",
104
+ version: "0.40.1",
105
105
  description: "skill-map reference implementation \u2014 kernel + CLI + adapters.",
106
106
  license: "MIT",
107
107
  type: "module",
@@ -1461,8 +1461,8 @@ function isExternalUrlLink(link) {
1461
1461
  }
1462
1462
 
1463
1463
  // kernel/orchestrator/analyzers.ts
1464
- async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sidecarRoots, annotationContributions, viewContributions, orphanJobFiles, referenceablePaths, cwd, registeredActionIds, emitter, hookDispatcher, reservedNodePaths, signals) {
1465
- const issues = [];
1464
+ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sidecarRoots, annotationContributions, viewContributions, orphanJobFiles, referenceablePaths, cwd, registeredActionIds, emitter, hookDispatcher, reservedNodePaths, signals, seedIssues = []) {
1465
+ const issues = [...seedIssues];
1466
1466
  const contributions = [];
1467
1467
  const validators = loadSchemaValidators();
1468
1468
  void registeredActionIds;
@@ -1470,7 +1470,8 @@ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sid
1470
1470
  relativePath: o.relativePath,
1471
1471
  expectedMdPath: o.expectedMdPath
1472
1472
  }));
1473
- for (const analyzer of analyzers) {
1473
+ const scheduled = orderAnalyzersByPhase(analyzers);
1474
+ for (const analyzer of scheduled) {
1474
1475
  const qualifiedId = qualifiedExtensionId(analyzer.pluginId, analyzer.id);
1475
1476
  const declaredContributions = readDeclaredContributions(analyzer);
1476
1477
  const emitContribution = (nodePath, contributionId, payload) => {
@@ -1523,6 +1524,11 @@ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sid
1523
1524
  annotationContributions,
1524
1525
  viewContributions,
1525
1526
  orphanJobFiles,
1527
+ // `issues` is the live accumulator, mutated by `issues.push(...)`
1528
+ // below as each analyzer's emission lands. Late-phase analyzers
1529
+ // (`core/issue-counter`) read it to compute cross-analyzer
1530
+ // aggregates. Treat as read-only on the analyzer side.
1531
+ accumulatedIssues: issues,
1526
1532
  ...referenceablePaths ? { referenceablePaths } : {},
1527
1533
  ...cwd ? { cwd } : {},
1528
1534
  ...reservedNodePaths ? { reservedNodePaths } : {},
@@ -1539,6 +1545,12 @@ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sid
1539
1545
  }
1540
1546
  return { issues, contributions };
1541
1547
  }
1548
+ function orderAnalyzersByPhase(analyzers) {
1549
+ return analyzers.slice().sort((a, b) => phaseRank(a) - phaseRank(b));
1550
+ }
1551
+ function phaseRank(a) {
1552
+ return a.phase === "aggregate" ? 1 : 0;
1553
+ }
1542
1554
  function validateIssue(analyzer, issue, emitter) {
1543
1555
  const severity = issue.severity;
1544
1556
  if (severity !== "error" && severity !== "warn" && severity !== "info") {
@@ -1835,10 +1847,9 @@ function resolveByName(link, indexes, ctx) {
1835
1847
  const winner = candidates.find((c) => allowedKinds.includes(c.kind));
1836
1848
  return winner ? winner.path : "none";
1837
1849
  }
1838
- function lookupAllowedKinds(link, indexes, ctx) {
1839
- const sourceNode = indexes.nodeByPath.get(link.source);
1840
- if (!sourceNode) return void 0;
1841
- return ctx.providerResolution.get(sourceNode.provider)?.[link.kind];
1850
+ function lookupAllowedKinds(link, _indexes, ctx) {
1851
+ if (ctx.activeProvider === null) return void 0;
1852
+ return ctx.providerResolution.get(ctx.activeProvider)?.[link.kind];
1842
1853
  }
1843
1854
  function stripTriggerSigil(normalized) {
1844
1855
  if (!normalized) return null;
@@ -3156,7 +3167,7 @@ async function runScanInternal(_kernel, options) {
3156
3167
  else walked.internalLinks.push(link);
3157
3168
  }
3158
3169
  walked.signals = resolved.resolvedSignals;
3159
- const postWalkCtx = buildPostWalkTransformCtx(exts.providers, walked.nodes);
3170
+ const postWalkCtx = buildPostWalkTransformCtx(exts.providers, walked.nodes, activeProviderId);
3160
3171
  walked.internalLinks = applyPostWalkTransforms(walked.internalLinks, walked.nodes, postWalkCtx);
3161
3172
  recomputeLinkCounts(walked.nodes, walked.internalLinks);
3162
3173
  recomputeExternalRefsCount(walked.nodes, walked.externalLinks, walked.cachedPaths);
@@ -3179,11 +3190,15 @@ async function runScanInternal(_kernel, options) {
3179
3190
  emitter,
3180
3191
  hookDispatcher,
3181
3192
  postWalkCtx.reservedNodePaths,
3182
- walked.signals
3193
+ walked.signals,
3194
+ // Seed the accumulator with orchestrator-emitted frontmatter
3195
+ // issues so the aggregate phase (`core/issue-counter`) counts
3196
+ // them on the per-node chip. The seeds are echoed back on
3197
+ // `analyzerResult.issues`, no explicit push is needed below.
3198
+ walked.frontmatterIssues
3183
3199
  );
3184
3200
  mergeAnalyzerEmissions(walked, analyzerResult, exts.analyzers);
3185
3201
  const issues = analyzerResult.issues;
3186
- for (const issue of walked.frontmatterIssues) issues.push(issue);
3187
3202
  const silenced = options.ignoreFilter ? (path) => options.ignoreFilter.ignores(path) : void 0;
3188
3203
  const renameOps = prior ? detectRenamesAndOrphans(prior, walked.nodes, issues, silenced) : [];
3189
3204
  const stats = buildScanStats(walked, issues, start);
@@ -3192,14 +3207,14 @@ async function runScanInternal(_kernel, options) {
3192
3207
  await hookDispatcher.dispatch("scan.completed", scanCompletedEvent);
3193
3208
  return buildScanReturn(walked, issues, renameOps, stats, options, setup);
3194
3209
  }
3195
- function buildPostWalkTransformCtx(providers, nodes) {
3210
+ function buildPostWalkTransformCtx(providers, nodes, activeProvider) {
3196
3211
  const { kindRegistry, providerResolution, reservedNamesByProviderKind } = buildProviderIndexes(providers);
3197
3212
  const reservedNodePaths = buildReservedNodePaths(
3198
3213
  nodes,
3199
3214
  kindRegistry,
3200
3215
  reservedNamesByProviderKind
3201
3216
  );
3202
- return { kindRegistry, providerResolution, reservedNodePaths };
3217
+ return { kindRegistry, providerResolution, activeProvider, reservedNodePaths };
3203
3218
  }
3204
3219
  function buildProviderIndexes(providers) {
3205
3220
  const kindRegistry = /* @__PURE__ */ new Map();