@skill-map/cli 0.64.1 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // cli/entry.ts
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ef7d5528-7273-5d01-b514-635331ee2072")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4ec5542f-63ef-5e2c-ab32-58a6c8be5dec")}catch(e){}}();
4
4
  import { existsSync as existsSync34 } from "fs";
5
5
  import { Builtins, Cli as Cli2 } from "clipanion";
6
6
 
@@ -250,7 +250,7 @@ function bucketByKind(kind, instance, bag) {
250
250
  // package.json
251
251
  var package_default = {
252
252
  name: "@skill-map/cli",
253
- version: "0.64.1",
253
+ version: "0.66.0",
254
254
  description: "skill-map reference implementation \u2014 kernel + CLI + adapters.",
255
255
  license: "MIT",
256
256
  type: "module",
@@ -466,6 +466,19 @@ var skill_base_schema_default = {
466
466
  type: "string",
467
467
  enum: ["bash", "powershell"],
468
468
  description: "Shell flavor for any embedded shell snippets. Default: `bash`."
469
+ },
470
+ license: {
471
+ type: "string",
472
+ description: "License applied to the skill: a license name (e.g. `Apache-2.0`) or a reference to a bundled license file. Inherited from the Agent Skills open standard that Claude Code follows. Source: https://agentskills.io/specification."
473
+ },
474
+ compatibility: {
475
+ type: "string",
476
+ description: "Environment requirements (intended product, required system packages, network access, etc.). Open-standard field; Claude Code does not consume it but the format permits it. Source: https://agentskills.io/specification."
477
+ },
478
+ metadata: {
479
+ type: "object",
480
+ additionalProperties: { type: "string" },
481
+ description: "Arbitrary string-keyed, string-valued map for metadata not covered by the standard. This is the canonical home of `version` and `author` (there is NO top-level `version` field). Source: https://agentskills.io/specification."
469
482
  }
470
483
  }
471
484
  };
@@ -481,6 +494,7 @@ var agent_schema_default = {
481
494
  ],
482
495
  type: "object",
483
496
  additionalProperties: true,
497
+ required: ["name", "description"],
484
498
  properties: {
485
499
  tools: {
486
500
  type: "array",
@@ -494,7 +508,7 @@ var agent_schema_default = {
494
508
  },
495
509
  model: {
496
510
  type: "string",
497
- description: "Model alias (`sonnet`, `opus`, `haiku`), full Claude id (e.g. `claude-3-7-sonnet-latest`), or the literal `inherit` to defer to the parent session's model."
511
+ description: "Model alias (`sonnet`, `opus`, `haiku`, `fable`), a full Claude id (e.g. `claude-opus-4-8`, `claude-sonnet-4-6`), or the literal `inherit` to defer to the parent session's model."
498
512
  },
499
513
  permissionMode: {
500
514
  type: "string",
@@ -513,8 +527,8 @@ var agent_schema_default = {
513
527
  },
514
528
  mcpServers: {
515
529
  type: "array",
516
- description: "MCP servers this agent connects to at startup. Shape is platform-defined; preserved as opaque objects.",
517
- items: { type: "object" }
530
+ description: "MCP servers this agent connects to at startup. Each item is either a bare server name referencing an already-configured server (e.g. `github`) or an inline definition object keyed by server name. Shape is platform-defined; preserved opaque.",
531
+ items: { type: ["string", "object"] }
518
532
  },
519
533
  hooks: {
520
534
  type: "object",
@@ -568,7 +582,7 @@ var command_schema_default = {
568
582
  // plugins/ids.ts
569
583
  var CORE_PLUGIN_ID = "core";
570
584
  var CLAUDE_PLUGIN_ID = "claude";
571
- var OPENAI_PLUGIN_ID = "openai";
585
+ var OPENAI_PLUGIN_ID = "codex";
572
586
  var ANTIGRAVITY_PLUGIN_ID = "antigravity";
573
587
  var AGENT_SKILLS_PLUGIN_ID = "agent-skills";
574
588
 
@@ -618,7 +632,7 @@ var claudeProvider = {
618
632
  // variant lifts luminosity for dark mode. Verbatim from the previous
619
633
  // static UI catalog (`ui/src/services/provider-ui.ts`).
620
634
  presentation: {
621
- label: "Claude",
635
+ label: "Anthropic's Claude",
622
636
  color: "#cc785c",
623
637
  colorDark: "#e89270"
624
638
  },
@@ -900,7 +914,13 @@ var atDirectiveExtractor = {
900
914
  kind: "extractor",
901
915
  description: "Detects `@<token>` directives in a node's body using Claude Code rules, choosing the link kind by token shape. Example: a bare handle `@team` becomes a `mentions` link, while a file-flavoured token `@docs/api.md` becomes a `references` link.",
902
916
  scope: "body",
903
- precondition: { provider: ["claude"] },
917
+ // Authorised under the claude AND codex lenses: OpenAI Codex sub-agents
918
+ // reference each other with the same `@<name>` mention grammar, and their
919
+ // prompt (the TOML `developer_instructions` body, fed in via the codex
920
+ // provider's `read.bodyField`) carries the same `@` tokens. The gate is the active
921
+ // lens, not the node's provider, so under `codex` this parses `@` across
922
+ // the project's markdown surface just as it does under `claude`.
923
+ precondition: { provider: ["claude", "codex"] },
904
924
  // eslint-disable-next-line complexity
905
925
  extract(ctx) {
906
926
  const seenMentions = /* @__PURE__ */ new Set();
@@ -988,7 +1008,12 @@ var slashCommandExtractor = {
988
1008
  kind: "extractor",
989
1009
  description: "Turns `/command` invocations in a node's body into arrows that point at the resolved slash command or skill, using Claude Code routing rules. Example: `/deploy` in the body draws an arrow to the `deploy` command.",
990
1010
  scope: "body",
991
- precondition: { provider: ["claude"] },
1011
+ // Also authorised under the codex lens so a Codex agent's prompt body
1012
+ // (the TOML `developer_instructions` field) has its `/command` tokens parsed for
1013
+ // pipeline parity with the claude body. codex declares no `invokes`
1014
+ // resolution today, so these signals stay unresolved (no spurious edges)
1015
+ // until Codex slash commands land in Phase 6b.
1016
+ precondition: { provider: ["claude", "codex"] },
992
1017
  extract(ctx) {
993
1018
  const seen = /* @__PURE__ */ new Set();
994
1019
  const body = stripCodeAndHtml(ctx.body);
@@ -1073,13 +1098,25 @@ var skill_schema_default2 = {
1073
1098
  $schema: "https://json-schema.org/draft/2020-12/schema",
1074
1099
  $id: "https://skill-map.ai/providers/agent-skills/v1/frontmatter/skill.schema.json",
1075
1100
  title: "FrontmatterAgentSkillsSkill",
1076
- description: "Frontmatter shape for nodes classified as `skill` by the neutral `agent-skills` Provider, Agent Skills delivered as `SKILL.md` files at the open-standard path `.agents/skills/<name>/SKILL.md`. Jointly adopted by Anthropic, OpenAI (Codex), and Google (Gemini); the path is vendor-neutral so no single Provider should own it. Required fields are `name` and `description` (from spec base). The standard's optional frontmatter fields are declared below, mirrored verbatim from https://agentskills.io/specification: `license`, `compatibility`, `metadata`, and the experimental `allowed-tools`. `additionalProperties: true` so any future standard field flows through unchanged until this schema catches up.",
1101
+ description: "Frontmatter shape for nodes classified as `skill` by the neutral `agent-skills` Provider, Agent Skills delivered as `SKILL.md` files at the open-standard path `.agents/skills/<name>/SKILL.md`. Jointly adopted by Anthropic, OpenAI (Codex), and Google (Gemini); the path is vendor-neutral so no single Provider should own it. Required fields are `name` and `description` (defined on the spec base, declared `required` here, the open standard mandates both). The standard's optional frontmatter fields are declared below, mirrored verbatim from https://agentskills.io/specification: `license`, `compatibility`, `metadata`, and the experimental `allowed-tools`. `additionalProperties: true` so any future standard field flows through unchanged until this schema catches up.",
1077
1102
  allOf: [
1078
1103
  { $ref: "https://skill-map.ai/spec/v0/frontmatter/base.schema.json" }
1079
1104
  ],
1080
1105
  type: "object",
1081
1106
  additionalProperties: true,
1107
+ required: ["name", "description"],
1082
1108
  properties: {
1109
+ name: {
1110
+ type: "string",
1111
+ maxLength: 64,
1112
+ pattern: "^[a-z0-9]+(-[a-z0-9]+)*$",
1113
+ description: "Skill handle (also the parent directory name). Open-standard rules: 1-64 chars, lowercase alphanumeric and single hyphens only, no leading/trailing or consecutive hyphens. The `name == parent dirname` rule is cross-field and not expressible in a frontmatter schema. Source: https://agentskills.io/specification."
1114
+ },
1115
+ description: {
1116
+ type: "string",
1117
+ maxLength: 1024,
1118
+ description: "What the skill does and when to use it. Max 1024 chars, non-empty (minLength from the spec base). Source: https://agentskills.io/specification."
1119
+ },
1083
1120
  license: {
1084
1121
  type: "string",
1085
1122
  description: "License applied to the skill: a license name (e.g. `Apache-2.0`) or a reference to a bundled license file. Source: https://agentskills.io/specification."
@@ -1102,11 +1139,11 @@ var skill_schema_default2 = {
1102
1139
  };
1103
1140
 
1104
1141
  // plugins/agent-skills/providers/agent-skills/index.ts
1105
- var OPEN_SKILLS_READ = {
1142
+ var COMMONS_READ = {
1106
1143
  extensions: [".md"],
1107
1144
  parser: "frontmatter-yaml"
1108
1145
  };
1109
- var OPEN_SKILLS_KINDS = {
1146
+ var COMMONS_KINDS = {
1110
1147
  skill: {
1111
1148
  schema: "./schemas/skill.schema.json",
1112
1149
  schemaJson: skill_schema_default2,
@@ -1122,8 +1159,28 @@ var OPEN_SKILLS_KINDS = {
1122
1159
  identifiers: ["frontmatter.name", "dirname"]
1123
1160
  }
1124
1161
  };
1125
- var OPEN_SKILLS_RESOLUTION = { invokes: ["skill"] };
1126
- function classifyOpenSkillsPath(path) {
1162
+ var COMMONS_RESOLUTION = { invokes: ["skill"] };
1163
+ var COMMONS_RESERVED_NAMES = {
1164
+ skill: [
1165
+ "add-dir",
1166
+ "agents",
1167
+ "clear",
1168
+ "config",
1169
+ "exit",
1170
+ "feedback",
1171
+ "help",
1172
+ "hooks",
1173
+ "logout",
1174
+ "mcp",
1175
+ "model",
1176
+ "permissions",
1177
+ "quit",
1178
+ "resume",
1179
+ "statusline",
1180
+ "usage"
1181
+ ]
1182
+ };
1183
+ function classifyCommonsPath(path) {
1127
1184
  if (/^\.agents\/skills\/[^/]+\/skill\.md$/.test(path.toLowerCase())) return "skill";
1128
1185
  return null;
1129
1186
  }
@@ -1134,10 +1191,16 @@ var agentSkillsProvider = {
1134
1191
  description: "Classifies files under `.agents/skills/<name>/SKILL.md` as Agent Skills.",
1135
1192
  // Provider identity for the active-lens dropdown, the topbar lens chip,
1136
1193
  // and the per-node provider chip. Neutral slate (this is the
1137
- // vendor-agnostic open-standard Provider, not a brand). Verbatim from
1138
- // the previous static UI catalog (`ui/src/services/provider-ui.ts`).
1194
+ // vendor-agnostic open-standard Provider, not a brand). The reusable
1195
+ // open-standard pieces it owns use a `COMMONS_*` vocabulary internally;
1196
+ // the user-facing label is the descriptive "Standard: Agent skills" (the
1197
+ // `Standard:` prefix marks it as the vendor-neutral lens, distinct from
1198
+ // the possessive `<Vendor>'s <product>` form the brand lenses use). This
1199
+ // is the single open lens shown in the selector when no vendor is active; the
1200
+ // non-gated `core/markdown` base sits underneath it and is never offered
1201
+ // as a lens of its own.
1139
1202
  presentation: {
1140
- label: "Open Skills",
1203
+ label: "Standard: Agent skills",
1141
1204
  color: "#64748b",
1142
1205
  colorDark: "#94a3b8"
1143
1206
  },
@@ -1146,11 +1209,12 @@ var agentSkillsProvider = {
1146
1209
  // (including `markdown`) it falls through to `core/markdown`, the sole
1147
1210
  // universal provider. Keeps the "one active lens" model honest.
1148
1211
  gatedByActiveLens: true,
1149
- // Not yet ready for end users: ships disabled by default. The operator
1150
- // opts in via `sm plugins enable` / the Settings toggle / the tutorial's
1151
- // `--experimental` flow, so it neither classifies nor auto-detects until
1152
- // enabled.
1153
- stability: "experimental",
1212
+ // The open-standard lens is the universal default: stable and locked
1213
+ // enabled (`agent-skills/agent-skills` in the host lock-list), so it is
1214
+ // the lens a project falls back to when no vendor marker is present, and
1215
+ // it cannot be disabled out from under that role. Auto-detects `.agents/`
1216
+ // and classifies skills under its own lens.
1217
+ stability: "stable",
1154
1218
  // Auto-detect marker: a `.agents/` directory marks an open-standard
1155
1219
  // project. This is also the marker a Google/Antigravity project carries
1156
1220
  // (Antigravity adopted the open standard). The marker only produces an
@@ -1163,11 +1227,15 @@ var agentSkillsProvider = {
1163
1227
  // OpenAI Codex (skills mirror the open standard), so `aka` surfaces both
1164
1228
  // names in the destination prompt to orient testers on those agents.
1165
1229
  // `aka` is display-only, `--for` still matches the `agent-skills` id.
1166
- scaffold: { skillDir: ".agents/skills", aka: ["Antigravity", "OpenAI Codex"] },
1167
- read: OPEN_SKILLS_READ,
1168
- kinds: OPEN_SKILLS_KINDS,
1169
- resolution: OPEN_SKILLS_RESOLUTION,
1170
- classify: classifyOpenSkillsPath
1230
+ scaffold: { skillDir: ".agents/skills", aka: ["Google's Antigravity", "OpenAI's Codex"] },
1231
+ read: COMMONS_READ,
1232
+ kinds: COMMONS_KINDS,
1233
+ resolution: COMMONS_RESOLUTION,
1234
+ // Base reserved-name catalog (self-scope under the `agent-skills` lens). The
1235
+ // shared export is inherited by every Provider that adopts the open
1236
+ // standard (see `COMMONS_RESERVED_NAMES` above).
1237
+ reservedNames: COMMONS_RESERVED_NAMES,
1238
+ classify: classifyCommonsPath
1171
1239
  };
1172
1240
 
1173
1241
  // plugins/antigravity/providers/antigravity/index.ts
@@ -1180,7 +1248,7 @@ var antigravityProvider = {
1180
1248
  // and the per-node provider chip. Antigravity violet, distinct from the
1181
1249
  // other vendor palettes.
1182
1250
  presentation: {
1183
- label: "Antigravity",
1251
+ label: "Google's Antigravity",
1184
1252
  color: "#7c3aed",
1185
1253
  colorDark: "#a78bfa"
1186
1254
  },
@@ -1207,24 +1275,24 @@ var antigravityProvider = {
1207
1275
  // lens, so it never competes here (under the antigravity lens it does
1208
1276
  // not participate). This is why there is no cross-provider lens-scope
1209
1277
  // rule in the kernel any more.
1210
- read: OPEN_SKILLS_READ,
1211
- kinds: OPEN_SKILLS_KINDS,
1212
- resolution: OPEN_SKILLS_RESOLUTION,
1213
- classify: classifyOpenSkillsPath,
1278
+ read: COMMONS_READ,
1279
+ kinds: COMMONS_KINDS,
1280
+ resolution: COMMONS_RESOLUTION,
1281
+ classify: classifyCommonsPath,
1214
1282
  // Built-in slash-command catalog, captured verbatim from `agy /help`
1215
- // (Antigravity CLI v1.0.3). This REPLACES the earlier provisional list
1216
- // that mirrored Gemini CLI's verbs: `agy` ships its own surface. It
1217
- // DROPPED Gemini-only verbs (`vim`, `theme`, `terminal-setup`,
1218
- // `setup-github`, `bashes`, `shells`, `policies`, `extensions`, `about`,
1219
- // `auth`, `bug`, `chat`, `compress`, `docs`, `editor`, `ide`, `init`,
1220
- // `memory`, `restore`, `stats`, `tools`, `upgrade`, `?`, `dir`) and
1221
- // ADDED agent-first ones (`goal`, `grill-me`, `schedule`, `fast`, `btw`,
1222
- // `artifact`, `context`, `diff`, `fork`, `tasks`, `add-dir`, `credits`,
1223
- // `feedback`, `logout`, `open`, `planning`, `rename`, `statusline`,
1224
- // `title`, `usage`). Both the 35 primary verbs and the 8 documented
1225
- // aliases (`new`, `settings`, `quit`, `branch`, `switch`, `conversation`,
1226
- // `undo`, `quota`) are reserved: a user skill named after either is
1227
- // silently shadowed by the built-in once the catalog activates.
1283
+ // (Antigravity CLI v1.0.3). The universal cross-agent verbs (`help`,
1284
+ // `config`, `mcp`, `model`, `clear`, `exit`, ...) come from the
1285
+ // open-standard base catalog (`COMMONS_RESERVED_NAMES`, owned by
1286
+ // `agent-skills` and inherited here by composition); this block adds ONLY
1287
+ // Antigravity's OWN runtime-specific verbs on top, so the neutral
1288
+ // standard never carries `agy`-specific commands. The earlier provisional
1289
+ // list mirrored Gemini CLI; `agy` dropped Gemini-only verbs (`vim`,
1290
+ // `theme`, `terminal-setup`, `setup-github`, `bashes`, `shells`,
1291
+ // `policies`, `extensions`, `?`, `dir`, ...) and added agent-first ones.
1292
+ // Both the primary verbs and the 8 documented aliases (`new`, `settings`,
1293
+ // `quit`, `branch`, `switch`, `conversation`, `undo`, `quota`) are
1294
+ // reserved: a user skill named after either is silently shadowed by the
1295
+ // built-in once the catalog activates.
1228
1296
  //
1229
1297
  // Declared under the `skill` kind (NOT `command`): Antigravity has no
1230
1298
  // vendor-specific command directory, its user slash-commands are skills
@@ -1234,136 +1302,165 @@ var antigravityProvider = {
1234
1302
  // is built-in.
1235
1303
  //
1236
1304
  // **Reconciliation marker**: re-capture from `agy /help` on each major
1237
- // Antigravity CLI release and bump the cited version above.
1305
+ // Antigravity CLI release, bump the cited version above, and move any
1306
+ // verb that becomes universal across agents down into
1307
+ // `COMMONS_RESERVED_NAMES`.
1238
1308
  reservedNames: {
1239
1309
  skill: [
1240
- "add-dir",
1241
- "agents",
1310
+ // Inherited open-standard base (universal cross-agent slash commands).
1311
+ ...COMMONS_RESERVED_NAMES["skill"] ?? [],
1312
+ // Antigravity-specific verbs (not part of the open-standard base).
1242
1313
  "artifact",
1243
1314
  "branch",
1244
1315
  "btw",
1245
1316
  "changelog",
1246
- "clear",
1247
- "config",
1248
1317
  "context",
1249
1318
  "conversation",
1250
1319
  "copy",
1251
1320
  "credits",
1252
1321
  "diff",
1253
- "exit",
1254
1322
  "fast",
1255
- "feedback",
1256
1323
  "fork",
1257
1324
  "goal",
1258
1325
  "grill-me",
1259
- "help",
1260
- "hooks",
1261
1326
  "keybindings",
1262
- "logout",
1263
- "mcp",
1264
- "model",
1265
1327
  "new",
1266
1328
  "open",
1267
- "permissions",
1268
1329
  "planning",
1269
- "quit",
1270
1330
  "quota",
1271
1331
  "rename",
1272
- "resume",
1273
1332
  "rewind",
1274
1333
  "schedule",
1275
1334
  "settings",
1276
1335
  "skills",
1277
- "statusline",
1278
1336
  "switch",
1279
1337
  "tasks",
1280
1338
  "title",
1281
- "undo",
1282
- "usage"
1339
+ "undo"
1283
1340
  ]
1284
1341
  }
1285
1342
  };
1286
1343
 
1287
- // plugins/openai/providers/openai/schemas/agent.schema.json
1344
+ // plugins/codex/providers/codex/schemas/agent.schema.json
1288
1345
  var agent_schema_default2 = {
1289
1346
  $schema: "https://json-schema.org/draft/2020-12/schema",
1290
- $id: "https://skill-map.ai/providers/openai/v1/frontmatter/agent.schema.json",
1347
+ $id: "https://skill-map.ai/providers/codex/v1/frontmatter/agent.schema.json",
1291
1348
  title: "FrontmatterCodexAgent",
1292
- description: "Frontmatter shape for nodes classified as `agent` by the OpenAI Codex Provider. Codex sub-agents live as TOML files under `.codex/agents/<name>.toml`; the entire file IS the agent definition (no markdown body). The TOML parser feeds the parsed root object into `frontmatter`, so this schema validates the same shape skill-map's other providers carry on per-kind frontmatter. Mirrors Codex's documented sub-agent fields (https://github.com/openai/codex) with `additionalProperties: true` so future additions flow through unchanged.",
1349
+ description: "Frontmatter shape for nodes classified as `agent` by the OpenAI Codex Provider. Codex sub-agents live as standalone TOML files under `.codex/agents/<name>.toml`; the entire file IS the agent definition (no markdown body, the prompt is the `developer_instructions` field). The TOML parser feeds the parsed root object into `frontmatter`, so this schema validates the same shape skill-map's other providers carry on per-kind frontmatter. Field set mirrors the documented Codex custom-agent contract (https://developers.codex.com/codex/subagents); `additionalProperties: true` lets any other inherited `config.toml` key flow through unchanged.",
1293
1350
  allOf: [
1294
1351
  { $ref: "https://skill-map.ai/spec/v0/frontmatter/base.schema.json" }
1295
1352
  ],
1296
1353
  type: "object",
1297
1354
  additionalProperties: true,
1355
+ required: ["name", "description", "developer_instructions"],
1298
1356
  properties: {
1299
1357
  name: {
1300
1358
  type: "string",
1301
1359
  minLength: 1,
1302
- description: "Sub-agent identifier. Conventionally matches the filename stem."
1360
+ description: "Sub-agent identifier used when spawning the agent. Conventionally matches the filename stem."
1303
1361
  },
1304
1362
  description: {
1305
1363
  type: "string",
1306
1364
  description: "Short description of when this sub-agent applies. Codex surfaces this in the agent picker; skill-map mirrors it in the card."
1307
1365
  },
1366
+ developer_instructions: {
1367
+ type: "string",
1368
+ description: "The sub-agent's core behavioural prompt (TOML triple-quoted string), the Codex equivalent of a system prompt. Required: the Codex CLI refuses to load an agent role file that omits it, so skill-map flags the same gap as a schema violation. Fed through the body pipeline via the provider's `read.bodyField`, so the markdown links / mentions it carries become graph edges."
1369
+ },
1308
1370
  model: {
1309
1371
  type: "string",
1310
- description: "Model identifier (`gpt-4o`, `o3-mini`, etc.) the sub-agent runs against."
1372
+ description: "Model identifier (`gpt-5-codex`, `gpt-5.4`, ...) the sub-agent runs against. Inherits the parent's model when omitted."
1311
1373
  },
1312
- instructions: {
1374
+ model_reasoning_effort: {
1313
1375
  type: "string",
1314
- description: "Multi-line prompt body (TOML triple-quoted string)."
1376
+ enum: ["minimal", "low", "medium", "high", "xhigh"],
1377
+ description: "Reasoning effort the sub-agent runs at (`xhigh` is model-dependent). Inherits the parent's setting when omitted."
1315
1378
  },
1316
- tools: {
1317
- type: "array",
1318
- items: { type: "string" },
1319
- description: "Tool ids this sub-agent is allowed to call."
1379
+ sandbox_mode: {
1380
+ type: "string",
1381
+ enum: ["read-only", "workspace-write", "danger-full-access"],
1382
+ description: "Codex sandbox mode the sub-agent runs under. Inherits the parent's policy when omitted."
1320
1383
  },
1321
- mcp_servers: {
1384
+ nickname_candidates: {
1322
1385
  type: "array",
1323
1386
  items: { type: "string" },
1324
- description: "MCP server ids attached to this sub-agent (`tools: [mcp__<server>__*]` follows the same pattern as Claude)."
1387
+ description: "Pool of display names Codex draws from when spawning instances of this sub-agent."
1325
1388
  },
1326
- approval_policy: {
1327
- type: "string",
1328
- enum: ["never", "on-request", "untrusted"],
1329
- description: "Codex approval policy for this sub-agent's destructive operations."
1389
+ mcp_servers: {
1390
+ type: "object",
1391
+ additionalProperties: { type: "object" },
1392
+ description: "Agent-specific MCP server bindings: a TOML table keyed by server name (`[mcp_servers.<name>]`), each value a server config (`command` + `args`, or `url`). This is NOT the Claude `tools: [mcp__<server>__*]` array convention, which is claude-only."
1330
1393
  },
1331
- sandbox_mode: {
1332
- type: "string",
1333
- enum: ["read-only", "workspace-write", "danger-full-access"],
1334
- description: "Codex sandbox mode the sub-agent runs under."
1394
+ skills: {
1395
+ type: "object",
1396
+ additionalProperties: true,
1397
+ description: "Skill overrides for this sub-agent. The `config` array (`[[skills.config]]` in TOML) lists skills by path with an enabled flag.",
1398
+ properties: {
1399
+ config: {
1400
+ type: "array",
1401
+ items: {
1402
+ type: "object",
1403
+ additionalProperties: true,
1404
+ properties: {
1405
+ path: { type: "string", description: "Path to the skill's SKILL.md." },
1406
+ enabled: { type: "boolean", description: "Whether the skill is active for this sub-agent." }
1407
+ }
1408
+ }
1409
+ }
1410
+ }
1335
1411
  }
1336
1412
  }
1337
1413
  };
1338
1414
 
1339
- // plugins/openai/providers/openai/index.ts
1340
- var openaiProvider = {
1341
- id: "openai",
1415
+ // plugins/codex/providers/codex/index.ts
1416
+ var codexProvider = {
1417
+ id: "codex",
1342
1418
  pluginId: OPENAI_PLUGIN_ID,
1343
1419
  kind: "provider",
1344
- description: "Classifies files under `.codex/agents/*.toml` as OpenAI Codex CLI sub-agents.",
1420
+ description: "Classifies `.codex/agents/*.toml` as OpenAI Codex CLI sub-agents and `.agents/skills/*/SKILL.md` as Codex skills (open standard).",
1345
1421
  // Provider identity for the active-lens dropdown, the topbar lens chip,
1346
1422
  // and the per-node provider chip. Codex green, distinct from the Claude
1347
1423
  // palette so the chip reads at a glance.
1348
1424
  presentation: {
1349
- label: "OpenAI Codex",
1425
+ label: "OpenAI's Codex",
1350
1426
  color: "#22c55e",
1351
1427
  colorDark: "#4ade80"
1352
1428
  },
1353
- // Auto-detect markers: a `.codex/` directory or a root `AGENTS.md` marks
1354
- // a Codex CLI project. Provider-owned (replaces the old central
1355
- // detection table in `src/core/config/active-provider.ts`).
1356
- detect: { markers: [".codex", "AGENTS.md"] },
1357
- // Vendor provider: Codex CLI only reads its own `.codex/` territory.
1358
- // Gating the classifier behind the active lens keeps the walker from
1359
- // claiming Codex agents under a `claude` (or any other) lens, where
1360
- // the Codex runtime would never resolve them anyway.
1429
+ // Auto-detect marker: a `.codex/` directory marks a Codex CLI project.
1430
+ // `AGENTS.md` is intentionally NOT a marker: it is the open agents.md
1431
+ // standard (present in many non-Codex repos, and commonly alongside a
1432
+ // `.claude/` directory), so keying auto-detect off it would mis-route a
1433
+ // plain-markdown repo to the Codex lens and force an ambiguous prompt on
1434
+ // any project that carries both. `.agents/` is likewise NOT a marker: it
1435
+ // is the vendor-neutral open standard (owned by `agent-skills` for
1436
+ // auto-detect), so a project that only carries `.agents/skills/` is an
1437
+ // open-standard project, not necessarily a Codex one. A genuine Codex
1438
+ // project is identified by `.codex/`.
1439
+ detect: { markers: [".codex"] },
1440
+ // Vendor provider: Codex CLI only reads its own territory (its `.codex/`
1441
+ // agents plus the open `.agents/skills/` skills it adopted). Gating the
1442
+ // classifier behind the active lens keeps the walker from claiming Codex
1443
+ // agents under a `claude` (or any other) lens, where the Codex runtime
1444
+ // would never resolve them anyway.
1361
1445
  gatedByActiveLens: true,
1362
- // Not yet ready for end users: ships disabled by default (the operator
1363
- // opts in via `sm plugins enable` / Settings / the tutorial's
1364
- // `--experimental` flow). Replaces the retired `comingSoon` flag.
1365
- stability: "experimental",
1366
- read: { extensions: [".toml"], parser: "toml" },
1446
+ // Beta: ships enabled by default (auto-detects `.codex/`, selectable as
1447
+ // the active lens) with a maturity badge, since the Codex body extractor
1448
+ // is freshly landed. Promote to `stable` (drop the field) once it has
1449
+ // real-world mileage.
1450
+ stability: "beta",
1451
+ // Multi-rule read: `.toml` sub-agents and `.md` open-standard skills,
1452
+ // each with its own parser. `resolveProviderWalk` runs one walk pass per
1453
+ // rule; the extensions are disjoint.
1454
+ // 1. Codex sub-agents are pure TOML (`parser: 'toml'`); the markdown
1455
+ // prompt is the triple-quoted `developer_instructions` field, fed
1456
+ // to the body pipeline via `bodyField` so the universal body
1457
+ // extractors plus the lens-gated at-directive / slash run over it.
1458
+ // 2. Skills reuse the open-standard `agent-skills` read config
1459
+ // (`COMMONS_READ`: `.md` + `frontmatter-yaml`).
1460
+ read: [
1461
+ { extensions: [".toml"], parser: "toml", bodyField: "developer_instructions" },
1462
+ COMMONS_READ
1463
+ ],
1367
1464
  kinds: {
1368
1465
  agent: {
1369
1466
  schema: "./schemas/agent.schema.json",
@@ -1380,18 +1477,30 @@ var openaiProvider = {
1380
1477
  // the TOML structured frontmatter when the author declared it
1381
1478
  // explicitly.
1382
1479
  identifiers: ["frontmatter.name", "filename-basename"]
1383
- }
1480
+ },
1481
+ // Open-standard `skill` kind, inherited from `agent-skills` by manifest
1482
+ // composition (same schema + UI every standard adopter shares).
1483
+ // `.agents/skills/<name>/SKILL.md` resolves by dirname or
1484
+ // `frontmatter.name`.
1485
+ ...COMMONS_KINDS
1384
1486
  },
1385
- // Codex's invocation surface is mention-style today (`@<name>`); slash
1386
- // invocation and skill nodes land in Phase 6b. Empty `invokes` keeps
1387
- // the contract narrow until skills arrive.
1487
+ // Mentions resolve to agents (`@<name>`, the Codex sub-agent handle).
1488
+ // Slash invocations resolve to skills (`invokes: ['skill']`, inherited
1489
+ // from the open standard), so a `/skill-name` in an agent's prompt links
1490
+ // to its `.agents/skills/` skill.
1388
1491
  resolution: {
1389
- mentions: ["agent"]
1492
+ mentions: ["agent"],
1493
+ ...COMMONS_RESOLUTION
1390
1494
  },
1495
+ // Open-standard reserved-name base (the universal cross-agent slash
1496
+ // verbs an agent CLI ships built-in), inherited from `agent-skills` and
1497
+ // applied under the codex lens via SELF scope: a user skill that shadows
1498
+ // one is flagged by `core/name-reserved`.
1499
+ reservedNames: COMMONS_RESERVED_NAMES,
1391
1500
  classify(path) {
1392
1501
  const lower = path.toLowerCase();
1393
1502
  if (lower.startsWith(".codex/agents/") && lower.endsWith(".toml")) return "agent";
1394
- return null;
1503
+ return classifyCommonsPath(path);
1395
1504
  }
1396
1505
  };
1397
1506
 
@@ -1417,17 +1526,23 @@ var coreMarkdownProvider = {
1417
1526
  // Provider identity. `hideChip: true` suppresses the per-card provider
1418
1527
  // chip: this fallback carries the majority of nodes in any project, so
1419
1528
  // badging every generic `.md` would be noise and dilute the chip's
1420
- // purpose (signalling a NON-default platform). The Provider still shows
1421
- // in the active-lens dropdown and the topbar lens chip with this label.
1529
+ // purpose (signalling a NON-default platform). This Provider is the
1530
+ // non-gated universal BASE, not a lens: `gatedByActiveLens` is false, so
1531
+ // the BFF projects `isLens: false` and the UI never lists it in the
1532
+ // active-lens dropdown nor as the topbar lens chip. The label is retained
1533
+ // only for internal registry lookups (and any legacy node still tagged
1534
+ // `provider: 'markdown'`).
1422
1535
  presentation: {
1423
1536
  label: "Markdown",
1424
1537
  color: "#9ca3af",
1425
1538
  colorDark: "#6b7280",
1426
1539
  hideChip: true
1427
1540
  },
1428
- // No `detect` block: the universal fallback is never auto-suggested as a
1429
- // lens (selecting it would gate out every vendor Provider). Operators
1430
- // pick it manually if they want an open-standard-only view.
1541
+ // No `detect` block: the universal base is never auto-suggested, and
1542
+ // since it is non-gated (`gatedByActiveLens` omitted == false) it is not
1543
+ // a selectable lens at all. A no-vendor project resolves to the
1544
+ // open-standard `agent-skills` default lens; this base runs underneath
1545
+ // every lens regardless.
1431
1546
  read: { extensions: [".md"], parser: "frontmatter-yaml" },
1432
1547
  // Per spec § A.6, defaultRefreshAction values MUST be qualified
1433
1548
  // action ids. The summarize-markdown action is not yet implemented
@@ -3228,13 +3343,6 @@ function existsSyncSafe(path) {
3228
3343
  }
3229
3344
  }
3230
3345
 
3231
- // kernel/orchestrator/frontmatter-issue-ids.ts
3232
- var FRONTMATTER_ISSUE_ANALYZERS = /* @__PURE__ */ new Set([
3233
- "frontmatter-invalid",
3234
- "frontmatter-malformed",
3235
- "frontmatter-parse-error"
3236
- ]);
3237
-
3238
3346
  // plugins/core/analyzers/schema-violation/text.ts
3239
3347
  var SCHEMA_VIOLATION_TEXTS = {
3240
3348
  // Diagnosis bodies (`<what>; <why>`). The shared `formatFinding` helper
@@ -3245,8 +3353,6 @@ var SCHEMA_VIOLATION_TEXTS = {
3245
3353
  nodeFailure: "Schema validation failed; {{errors}}",
3246
3354
  /** `<target>` subject + `Link failed schema validation; <errors>` */
3247
3355
  linkFailure: "Link failed schema validation; {{errors}}",
3248
- /** `Missing required frontmatter; <missing>` */
3249
- frontmatterBaseFailure: "Missing required frontmatter; {{missing}}",
3250
3356
  /** Singular tooltip on the alert / chip when a node has exactly one validation failure. */
3251
3357
  alertTooltipSingle: "Frontmatter or schema validation failed.",
3252
3358
  /** Plural tooltip; `{{count}}` capped at 99 in the chip badge but the tooltip text shows the raw count. */
@@ -3277,11 +3383,9 @@ var schemaViolationAnalyzer = {
3277
3383
  const validators = loadSchemaValidators();
3278
3384
  const findings = [];
3279
3385
  const perNode = /* @__PURE__ */ new Map();
3280
- const kernelFlaggedNodes = collectKernelFlaggedNodes(ctx.accumulatedIssues);
3281
3386
  for (const node of ctx.nodes) {
3282
3387
  const before = findings.length;
3283
3388
  collectNodeFindings(validators, node, findings);
3284
- collectFrontmatterBaseFindings(node, findings, kernelFlaggedNodes);
3285
3389
  if (findings.length > before) {
3286
3390
  let worst = "warn";
3287
3391
  for (let i = before; i < findings.length; i++) {
@@ -3319,43 +3423,6 @@ function collectNodeFindings(v, node, out) {
3319
3423
  data: { target: "node", path: node.path }
3320
3424
  });
3321
3425
  }
3322
- function collectKernelFlaggedNodes(accumulated) {
3323
- const flagged = /* @__PURE__ */ new Set();
3324
- for (const issue of accumulated ?? []) {
3325
- if (!FRONTMATTER_ISSUE_ANALYZERS.has(issue.analyzerId)) continue;
3326
- for (const id of issue.nodeIds) flagged.add(id);
3327
- }
3328
- return flagged;
3329
- }
3330
- function collectFrontmatterBaseFindings(node, out, kernelFlagged) {
3331
- if (kernelFlagged.has(node.path)) return;
3332
- if (node.provider === "markdown") return;
3333
- if (node.bytes.frontmatter === 0) return;
3334
- const fm = node.frontmatter ?? {};
3335
- const missing = [];
3336
- if (isMissingStringField(fm, "name")) missing.push("name");
3337
- if (isMissingStringField(fm, "description")) missing.push("description");
3338
- if (missing.length === 0) return;
3339
- out.push({
3340
- analyzerId: ID22,
3341
- // `warn` (not `error`) so the default `sm scan` exit code stays
3342
- // 0 even when nodes are missing frontmatter base fields. Strict
3343
- // mode (`sm scan --strict`) still escalates to exit 1. Matches
3344
- // the `frontmatter-invalid` severity policy of the orchestrator.
3345
- severity: "warn",
3346
- nodeIds: [node.path],
3347
- message: formatFinding({
3348
- body: tx(SCHEMA_VIOLATION_TEXTS.frontmatterBaseFailure, {
3349
- missing: missing.join(", ")
3350
- })
3351
- }),
3352
- data: { target: "frontmatter", path: node.path, missing }
3353
- });
3354
- }
3355
- function isMissingStringField(fm, field) {
3356
- const v = fm[field];
3357
- return typeof v !== "string" || v.length === 0;
3358
- }
3359
3426
  function collectLinkFindings(v, link, out) {
3360
3427
  const result = v.validate("link", toLinkForSchema(link));
3361
3428
  if (result.ok) return;
@@ -4130,12 +4197,13 @@ function writeJsonAtomic(path, content) {
4130
4197
  }
4131
4198
 
4132
4199
  // core/paths/db-path.ts
4133
- import { join as join2, resolve as resolve5 } from "path";
4200
+ import { join as join2, resolve as resolve6 } from "path";
4134
4201
 
4135
4202
  // kernel/util/skill-map-paths.ts
4136
- import { join } from "path";
4203
+ import { dirname as dirname5, join, resolve as resolve5 } from "path";
4137
4204
  var SKILL_MAP_DIR = ".skill-map";
4138
4205
  var KERNEL_SKILL_MAP_DIR = SKILL_MAP_DIR;
4206
+ var BACKUPS_DIRNAME = "backups";
4139
4207
  var SETTINGS_FILENAME = "settings.json";
4140
4208
  var LOCAL_SETTINGS_FILENAME = "settings.local.json";
4141
4209
  function kernelSettingsPath(scopeRoot) {
@@ -4144,6 +4212,9 @@ function kernelSettingsPath(scopeRoot) {
4144
4212
  function kernelLocalSettingsPath(scopeRoot) {
4145
4213
  return join(scopeRoot, KERNEL_SKILL_MAP_DIR, LOCAL_SETTINGS_FILENAME);
4146
4214
  }
4215
+ function kernelBackupsDir(dbPath) {
4216
+ return join(dirname5(resolve5(dbPath)), BACKUPS_DIRNAME);
4217
+ }
4147
4218
 
4148
4219
  // core/paths/db-path.ts
4149
4220
  var DB_FILENAME = "skill-map.db";
@@ -4158,17 +4229,20 @@ var GITIGNORE_ENTRIES = [
4158
4229
  `${SKILL_MAP_DIR}/${DB_FILENAME}`
4159
4230
  ];
4160
4231
  function resolveDbPath(options) {
4161
- if (options.db) return resolve5(options.db);
4162
- return resolve5(options.cwd, DEFAULT_DB_REL);
4232
+ if (options.db) return resolve6(options.db);
4233
+ return resolve6(options.cwd, DEFAULT_DB_REL);
4163
4234
  }
4164
4235
  function defaultProjectDbPath(ctx) {
4165
- return resolve5(ctx.cwd, DEFAULT_DB_REL);
4236
+ return resolve6(ctx.cwd, DEFAULT_DB_REL);
4166
4237
  }
4167
4238
  function defaultProjectJobsDir(ctx) {
4168
- return resolve5(ctx.cwd, SKILL_MAP_DIR, JOBS_DIRNAME);
4239
+ return resolve6(ctx.cwd, SKILL_MAP_DIR, JOBS_DIRNAME);
4169
4240
  }
4170
4241
  function defaultProjectPluginsDir(ctx) {
4171
- return resolve5(ctx.cwd, SKILL_MAP_DIR, PLUGINS_DIRNAME);
4242
+ return resolve6(ctx.cwd, SKILL_MAP_DIR, PLUGINS_DIRNAME);
4243
+ }
4244
+ function backupsDirForDb(dbPath) {
4245
+ return kernelBackupsDir(dbPath);
4172
4246
  }
4173
4247
  function defaultDbPath(scopeRoot) {
4174
4248
  return join2(scopeRoot, SKILL_MAP_DIR, DB_FILENAME);
@@ -4405,7 +4479,7 @@ var atDirectiveExtractor2 = { ...atDirectiveExtractor, pluginId: "claude", versi
4405
4479
  var slashCommandExtractor2 = { ...slashCommandExtractor, pluginId: "claude", version: VERSION };
4406
4480
  var toolsCounterExtractor2 = { ...toolsCounterExtractor, pluginId: "claude", version: VERSION };
4407
4481
  var antigravityProvider2 = { ...antigravityProvider, pluginId: "antigravity", version: VERSION };
4408
- var openaiProvider2 = { ...openaiProvider, pluginId: "openai", version: VERSION };
4482
+ var codexProvider2 = { ...codexProvider, pluginId: "codex", version: VERSION };
4409
4483
  var agentSkillsProvider2 = { ...agentSkillsProvider, pluginId: "agent-skills", version: VERSION };
4410
4484
  var coreMarkdownProvider2 = { ...coreMarkdownProvider, pluginId: "core", version: VERSION };
4411
4485
  var backtickPathExtractor2 = { ...backtickPathExtractor, pluginId: "core", version: VERSION };
@@ -4452,10 +4526,10 @@ var builtInPlugins = [
4452
4526
  ]
4453
4527
  },
4454
4528
  {
4455
- id: "openai",
4529
+ id: "codex",
4456
4530
  description: "OpenAI Codex CLI platform integration. Classifies TOML sub-agent definitions under `.codex/agents/*.toml`.",
4457
4531
  extensions: [
4458
- openaiProvider2
4532
+ codexProvider2
4459
4533
  ]
4460
4534
  },
4461
4535
  {
@@ -5193,7 +5267,7 @@ async function closeSentryCli(timeoutMs = 2e3) {
5193
5267
  var BUILT_IN_PLUGIN_IDS = /* @__PURE__ */ new Set([
5194
5268
  "claude",
5195
5269
  "antigravity",
5196
- "openai",
5270
+ "codex",
5197
5271
  "agent-skills",
5198
5272
  "core"
5199
5273
  ]);
@@ -5383,7 +5457,7 @@ import { Command as Command2, Option as Option2 } from "clipanion";
5383
5457
 
5384
5458
  // core/config/helper.ts
5385
5459
  import { homedir as osHomedir } from "os";
5386
- import { isAbsolute, join as join4, resolve as resolve6, sep } from "path";
5460
+ import { isAbsolute, join as join4, resolve as resolve7, sep } from "path";
5387
5461
 
5388
5462
  // kernel/config/loader.ts
5389
5463
  import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
@@ -5803,13 +5877,13 @@ function projectPathExposure(inputs) {
5803
5877
  return { expandsSurface: true, exposedPaths: exposed };
5804
5878
  }
5805
5879
  function resolveScanPathForExposure(raw, cwd) {
5806
- if (raw.startsWith("~/")) return resolve6(join4(osHomedir(), raw.slice(2)));
5807
- if (raw === "~") return resolve6(osHomedir());
5808
- if (isAbsolute(raw)) return resolve6(raw);
5809
- return resolve6(cwd, raw);
5880
+ if (raw.startsWith("~/")) return resolve7(join4(osHomedir(), raw.slice(2)));
5881
+ if (raw === "~") return resolve7(osHomedir());
5882
+ if (isAbsolute(raw)) return resolve7(raw);
5883
+ return resolve7(cwd, raw);
5810
5884
  }
5811
5885
  function isUnderProject(absPath, cwd) {
5812
- const projectRoot = resolve6(cwd);
5886
+ const projectRoot = resolve7(cwd);
5813
5887
  return absPath === projectRoot || absPath.startsWith(`${projectRoot}${sep}`);
5814
5888
  }
5815
5889
 
@@ -5870,7 +5944,7 @@ function ensureSidecarWritesAllowed(opts) {
5870
5944
 
5871
5945
  // kernel/sidecar/store.ts
5872
5946
  import { existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
5873
- import { dirname as dirname5, resolve as resolve7 } from "path";
5947
+ import { dirname as dirname6, resolve as resolve8 } from "path";
5874
5948
  import { createRequire as createRequire4 } from "module";
5875
5949
  import { Ajv2020 as Ajv20204 } from "ajv/dist/2020.js";
5876
5950
  import yaml2 from "js-yaml";
@@ -5978,10 +6052,10 @@ function getSidecarValidator2() {
5978
6052
  applyAjvFormats(ajv);
5979
6053
  const specRoot = resolveSpecRoot3();
5980
6054
  const annotationsSchema = JSON.parse(
5981
- readFileSync7(resolve7(specRoot, "schemas/annotations.schema.json"), "utf8")
6055
+ readFileSync7(resolve8(specRoot, "schemas/annotations.schema.json"), "utf8")
5982
6056
  );
5983
6057
  const sidecarSchema = JSON.parse(
5984
- readFileSync7(resolve7(specRoot, "schemas/sidecar.schema.json"), "utf8")
6058
+ readFileSync7(resolve8(specRoot, "schemas/sidecar.schema.json"), "utf8")
5985
6059
  );
5986
6060
  ajv.addSchema(annotationsSchema);
5987
6061
  cachedValidator = ajv.compile(sidecarSchema);
@@ -5991,7 +6065,7 @@ function resolveSpecRoot3() {
5991
6065
  const require2 = createRequire4(import.meta.url);
5992
6066
  try {
5993
6067
  const indexPath = require2.resolve("@skill-map/spec/index.json");
5994
- return dirname5(indexPath);
6068
+ return dirname6(indexPath);
5995
6069
  } catch {
5996
6070
  throw new Error("@skill-map/spec not resolvable: sidecar store cannot load schemas.");
5997
6071
  }
@@ -6101,12 +6175,12 @@ async function confirm(question, streams, opts) {
6101
6175
  // cli/util/git.ts
6102
6176
  import { spawnSync } from "child_process";
6103
6177
  import { existsSync as existsSync7 } from "fs";
6104
- import { dirname as dirname6, resolve as resolve8 } from "path";
6178
+ import { dirname as dirname7, resolve as resolve9 } from "path";
6105
6179
  function isInsideGitRepo(cwd) {
6106
6180
  let current = cwd;
6107
6181
  while (true) {
6108
- if (existsSync7(resolve8(current, ".git"))) return true;
6109
- const parent = dirname6(current);
6182
+ if (existsSync7(resolve9(current, ".git"))) return true;
6183
+ const parent = dirname7(current);
6110
6184
  if (parent === current) return false;
6111
6185
  current = parent;
6112
6186
  }
@@ -6304,7 +6378,7 @@ import { existsSync as existsSync11 } from "fs";
6304
6378
 
6305
6379
  // kernel/adapters/sqlite/storage-adapter.ts
6306
6380
  import { mkdirSync as mkdirSync4 } from "fs";
6307
- import { dirname as dirname8, resolve as resolve11 } from "path";
6381
+ import { dirname as dirname9, resolve as resolve12 } from "path";
6308
6382
  import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
6309
6383
  import { CamelCasePlugin, Kysely, sql as sql4 } from "kysely";
6310
6384
 
@@ -6437,7 +6511,7 @@ var AsyncMutex = class {
6437
6511
  this.#locked = true;
6438
6512
  return;
6439
6513
  }
6440
- await new Promise((resolve44) => this.#waiters.push(resolve44));
6514
+ await new Promise((resolve45) => this.#waiters.push(resolve45));
6441
6515
  this.#locked = true;
6442
6516
  }
6443
6517
  unlock() {
@@ -6863,7 +6937,7 @@ async function migrateNodeFavorites(trx, fromPath, toPath, report) {
6863
6937
  }
6864
6938
 
6865
6939
  // kernel/adapters/sqlite/jobs.ts
6866
- import { resolve as resolve9 } from "path";
6940
+ import { resolve as resolve10 } from "path";
6867
6941
  async function pruneTerminalJobs(db, status, cutoffMs) {
6868
6942
  const rows = await db.selectFrom("state_jobs").select(["id", "filePath"]).where("status", "=", status).where("finishedAt", "is not", null).where("finishedAt", "<", cutoffMs).execute();
6869
6943
  if (rows.length === 0) {
@@ -6878,14 +6952,14 @@ async function selectReferencedJobFilePaths(db) {
6878
6952
  const rows = await db.selectFrom("state_jobs").select(["filePath"]).where("filePath", "is not", null).execute();
6879
6953
  const out = /* @__PURE__ */ new Set();
6880
6954
  for (const row of rows) {
6881
- if (row.filePath !== null) out.add(resolve9(row.filePath));
6955
+ if (row.filePath !== null) out.add(resolve10(row.filePath));
6882
6956
  }
6883
6957
  return out;
6884
6958
  }
6885
6959
 
6886
6960
  // kernel/adapters/sqlite/migrations.ts
6887
6961
  import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync8, readdirSync as readdirSync2 } from "fs";
6888
- import { dirname as dirname7, join as join5, resolve as resolve10 } from "path";
6962
+ import { dirname as dirname8, join as join5, resolve as resolve11 } from "path";
6889
6963
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
6890
6964
  import { fileURLToPath } from "url";
6891
6965
 
@@ -6899,10 +6973,10 @@ var MIGRATIONS_TEXTS = {
6899
6973
  // kernel/adapters/sqlite/migrations.ts
6900
6974
  var FILE_RE = /^(\d{3})_([a-z0-9_]+)\.sql$/;
6901
6975
  function defaultMigrationsDir() {
6902
- const here = dirname7(fileURLToPath(import.meta.url));
6903
- const flatLayout = resolve10(here, "migrations");
6976
+ const here = dirname8(fileURLToPath(import.meta.url));
6977
+ const flatLayout = resolve11(here, "migrations");
6904
6978
  if (existsSync8(flatLayout)) return flatLayout;
6905
- return resolve10(here, "..", "..", "..", "migrations");
6979
+ return resolve11(here, "..", "..", "..", "migrations");
6906
6980
  }
6907
6981
  function discoverMigrations(dir = defaultMigrationsDir()) {
6908
6982
  if (!existsSync8(dir)) return [];
@@ -6972,7 +7046,7 @@ function resolveMigrationTarget(to, files) {
6972
7046
  function writePreMigrateBackup(dbPath, target) {
6973
7047
  return writeBackup(
6974
7048
  dbPath,
6975
- join5(dirname7(resolve10(dbPath)), "backups", `skill-map-pre-migrate-v${target}.db`)
7049
+ join5(kernelBackupsDir(dbPath), `skill-map-pre-migrate-v${target}.db`)
6976
7050
  );
6977
7051
  }
6978
7052
  function applyOneMigration(db, migration) {
@@ -7007,9 +7081,9 @@ function applyOneMigration(db, migration) {
7007
7081
  }
7008
7082
  function writeBackup(dbPath, destPath) {
7009
7083
  if (dbPath === ":memory:") return null;
7010
- const absoluteSource = resolve10(dbPath);
7011
- const absoluteDest = resolve10(destPath);
7012
- mkdirSync3(dirname7(absoluteDest), { recursive: true });
7084
+ const absoluteSource = resolve11(dbPath);
7085
+ const absoluteDest = resolve11(destPath);
7086
+ mkdirSync3(dirname8(absoluteDest), { recursive: true });
7013
7087
  const db = new DatabaseSync2(absoluteSource);
7014
7088
  try {
7015
7089
  db.exec("PRAGMA wal_checkpoint(TRUNCATE)");
@@ -8646,8 +8720,8 @@ var SqliteStorageAdapter = class {
8646
8720
  if (this.#db) return;
8647
8721
  const path = this.#options.databasePath;
8648
8722
  if (path !== ":memory:") {
8649
- const absolute = resolve11(path);
8650
- mkdirSync4(dirname8(absolute), { recursive: true });
8723
+ const absolute = resolve12(path);
8724
+ mkdirSync4(dirname9(absolute), { recursive: true });
8651
8725
  }
8652
8726
  if (this.#options.autoMigrate !== false) {
8653
8727
  const files = discoverMigrations();
@@ -9255,16 +9329,16 @@ async function tryWithSqlite(options, fn) {
9255
9329
  }
9256
9330
 
9257
9331
  // cli/commands/bump-plan.ts
9258
- import { resolve as resolve13 } from "path";
9332
+ import { resolve as resolve14 } from "path";
9259
9333
 
9260
9334
  // core/paths/path-guard.ts
9261
9335
  import { lstatSync } from "fs";
9262
- import { isAbsolute as isAbsolute2, resolve as resolve12, sep as sep2 } from "path";
9336
+ import { isAbsolute as isAbsolute2, resolve as resolve13, sep as sep2 } from "path";
9263
9337
  function assertContained(cwd, rel) {
9264
9338
  if (isAbsolute2(rel)) {
9265
9339
  throw new Error(`node path is absolute, refusing to read: ${rel}`);
9266
9340
  }
9267
- const abs = resolve12(cwd, rel);
9341
+ const abs = resolve13(cwd, rel);
9268
9342
  if (abs !== cwd && !abs.startsWith(cwd + sep2)) {
9269
9343
  throw new Error(`node path escapes repo root: ${rel}`);
9270
9344
  }
@@ -9299,7 +9373,7 @@ function planOne(node, options, invoker) {
9299
9373
  let absPath;
9300
9374
  try {
9301
9375
  assertContained(options.cwd, node.path);
9302
- absPath = resolve13(options.cwd, node.path);
9376
+ absPath = resolve14(options.cwd, node.path);
9303
9377
  } catch (err) {
9304
9378
  return {
9305
9379
  nodePath: node.path,
@@ -9941,18 +10015,18 @@ var PLUGIN_LOADER_TEXTS = {
9941
10015
  // kernel/adapters/plugin-loader/index.ts
9942
10016
  import { createRequire as createRequire5 } from "module";
9943
10017
  import { existsSync as existsSync13, readFileSync as readFileSync13, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
9944
- import { join as join8, resolve as resolve16 } from "path";
10018
+ import { join as join8, resolve as resolve17 } from "path";
9945
10019
  import { pathToFileURL } from "url";
9946
10020
  import semver from "semver";
9947
10021
 
9948
10022
  // kernel/adapters/plugin-loader/id-utils.ts
9949
- import { isAbsolute as isAbsolute3, relative, resolve as resolve14 } from "path";
10023
+ import { isAbsolute as isAbsolute3, relative, resolve as resolve15 } from "path";
9950
10024
  function fail(path, id, status, reason) {
9951
10025
  return { path, id, status, reason };
9952
10026
  }
9953
10027
  function isInsidePlugin(pluginPath, relEntry) {
9954
10028
  if (isAbsolute3(relEntry)) return false;
9955
- const abs = resolve14(pluginPath, relEntry);
10029
+ const abs = resolve15(pluginPath, relEntry);
9956
10030
  const rel = relative(pluginPath, abs);
9957
10031
  if (rel === "") return true;
9958
10032
  if (rel.startsWith("..")) return false;
@@ -10044,7 +10118,7 @@ function stripFunctionsAndPluginId(input) {
10044
10118
  // kernel/adapters/plugin-loader/validation.ts
10045
10119
  import * as nodeFs from "fs";
10046
10120
  import { existsSync as existsSync12 } from "fs";
10047
- import { dirname as dirname9, join as join7 } from "path";
10121
+ import { dirname as dirname10, join as join7 } from "path";
10048
10122
  import { Ajv2020 as Ajv20205 } from "ajv/dist/2020.js";
10049
10123
 
10050
10124
  // kernel/extensions/hook.ts
@@ -10165,7 +10239,7 @@ function validateHookTriggers(pluginPath, pluginId, manifest, relEntry, exported
10165
10239
  return null;
10166
10240
  }
10167
10241
  function validateActionFileConventions(pluginPath, pluginId, manifest, relEntry, entryAbsPath, manifestView) {
10168
- const actionDir = dirname9(entryAbsPath);
10242
+ const actionDir = dirname10(entryAbsPath);
10169
10243
  const reportSchemaPath = join7(actionDir, "report.schema.json");
10170
10244
  const promptPath = join7(actionDir, "prompt.md");
10171
10245
  const mode = isRecord(manifestView) && typeof manifestView["mode"] === "string" ? manifestView["mode"] : "deterministic";
@@ -10293,7 +10367,7 @@ function isDirectorySafe(path, statSync13) {
10293
10367
 
10294
10368
  // kernel/adapters/plugin-loader/storage-schemas.ts
10295
10369
  import { readFileSync as readFileSync12 } from "fs";
10296
- import { resolve as resolve15 } from "path";
10370
+ import { resolve as resolve16 } from "path";
10297
10371
  import { Ajv2020 as Ajv20206 } from "ajv/dist/2020.js";
10298
10372
 
10299
10373
  // kernel/adapters/plugin-store.ts
@@ -10357,7 +10431,7 @@ function compilePluginSchema(pluginPath, relPath) {
10357
10431
  errDescription: tx(PLUGIN_LOADER_TEXTS.loadErrorSchemaPathEscapesPlugin, { relPath, pluginPath })
10358
10432
  };
10359
10433
  }
10360
- const abs = resolve15(pluginPath, relPath);
10434
+ const abs = resolve16(pluginPath, relPath);
10361
10435
  let raw;
10362
10436
  try {
10363
10437
  raw = JSON.parse(readFileSync12(abs, "utf8"));
@@ -10399,7 +10473,7 @@ var PluginLoader = class {
10399
10473
  if (!entry.isDirectory()) continue;
10400
10474
  const candidate = join8(root, entry.name);
10401
10475
  if (existsSync13(join8(candidate, "plugin.json"))) {
10402
- out.push(resolve16(candidate));
10476
+ out.push(resolve17(candidate));
10403
10477
  }
10404
10478
  }
10405
10479
  }
@@ -10558,7 +10632,7 @@ var PluginLoader = class {
10558
10632
  manifest
10559
10633
  } };
10560
10634
  }
10561
- const abs = resolve16(pluginPath, relEntry);
10635
+ const abs = resolve17(pluginPath, relEntry);
10562
10636
  if (!existsSync13(abs)) {
10563
10637
  return { ok: false, failure: {
10564
10638
  ...fail(
@@ -10762,7 +10836,7 @@ function discoverExtensionEntries(pluginPath) {
10762
10836
  return out;
10763
10837
  }
10764
10838
  function collectKindEntries(pluginPath, kindDir, out) {
10765
- const kindAbs = resolve16(pluginPath, kindDir);
10839
+ const kindAbs = resolve17(pluginPath, kindDir);
10766
10840
  if (!existsSync13(kindAbs)) return;
10767
10841
  let entries;
10768
10842
  try {
@@ -10773,7 +10847,7 @@ function collectKindEntries(pluginPath, kindDir, out) {
10773
10847
  entries.sort();
10774
10848
  for (const entry of entries) {
10775
10849
  if (entry.startsWith(".")) continue;
10776
- const entryAbs = resolve16(kindAbs, entry);
10850
+ const entryAbs = resolve17(kindAbs, entry);
10777
10851
  if (!isDirectorySafe2(entryAbs)) continue;
10778
10852
  const candidate = findIndexCandidate(entryAbs);
10779
10853
  if (candidate !== null) {
@@ -10790,14 +10864,14 @@ function isDirectorySafe2(path) {
10790
10864
  }
10791
10865
  function findIndexCandidate(entryAbs) {
10792
10866
  for (const candidate of INDEX_CANDIDATES) {
10793
- if (existsSync13(resolve16(entryAbs, candidate))) return candidate;
10867
+ if (existsSync13(resolve17(entryAbs, candidate))) return candidate;
10794
10868
  }
10795
10869
  return null;
10796
10870
  }
10797
10871
  function installedSpecVersion() {
10798
10872
  const require2 = createRequire5(import.meta.url);
10799
10873
  const indexPath = require2.resolve("@skill-map/spec/index.json");
10800
- const pkgPath = resolve16(indexPath, "..", "package.json");
10874
+ const pkgPath = resolve17(indexPath, "..", "package.json");
10801
10875
  const pkg = JSON.parse(readFileSync13(pkgPath, "utf8"));
10802
10876
  return pkg.version;
10803
10877
  }
@@ -10810,6 +10884,13 @@ var LOCKED_PLUGIN_IDS = /* @__PURE__ */ new Set([
10810
10884
  // silently invisible, a foot-gun the host product does not want to
10811
10885
  // expose. Lock it in the enabled state.
10812
10886
  "core/markdown",
10887
+ // `agent-skills/agent-skills` is the open-standard default lens: the lens
10888
+ // a project falls back to when no vendor marker is present (see
10889
+ // spec/architecture.md §Active Provider Lens). Locking it enabled
10890
+ // guarantees the resolver always has a valid floor lens to resolve to;
10891
+ // disabling it would leave a no-vendor project with no selectable lens.
10892
+ // Stable, so the lock is legitimate (nothing experimental is lockable).
10893
+ "agent-skills/agent-skills",
10813
10894
  // `core/schema-violation` validates every scanned Node against
10814
10895
  // `node.schema.json` and every Link against `link.schema.json` (the
10815
10896
  // authoritative @skill-map/spec). Disabling it makes the system
@@ -10882,11 +10963,11 @@ async function buildEnabledResolver(ctx) {
10882
10963
 
10883
10964
  // kernel/scan/walk-content.ts
10884
10965
  import { readFile, readdir, lstat } from "fs/promises";
10885
- import { isAbsolute as isAbsolute4, join as join9, relative as relative2, resolve as resolve18, sep as sep3 } from "path";
10966
+ import { isAbsolute as isAbsolute4, join as join9, relative as relative2, resolve as resolve19, sep as sep3 } from "path";
10886
10967
 
10887
10968
  // kernel/scan/ignore.ts
10888
10969
  import { existsSync as existsSync14, readFileSync as readFileSync14 } from "fs";
10889
- import { dirname as dirname10, resolve as resolve17 } from "path";
10970
+ import { dirname as dirname11, resolve as resolve18 } from "path";
10890
10971
  import { fileURLToPath as fileURLToPath2 } from "url";
10891
10972
  import ignoreFactory from "ignore";
10892
10973
  function buildIgnoreFilter(opts = {}) {
@@ -10915,7 +10996,7 @@ function loadBundledIgnoreText() {
10915
10996
  return loadDefaultsText();
10916
10997
  }
10917
10998
  function readIgnoreFileText(scopeRoot) {
10918
- const path = resolve17(scopeRoot, ".skillmapignore");
10999
+ const path = resolve18(scopeRoot, ".skillmapignore");
10919
11000
  if (!existsSync14(path)) return void 0;
10920
11001
  try {
10921
11002
  return readFileSync14(path, "utf8");
@@ -10942,13 +11023,13 @@ function loadDefaultsText() {
10942
11023
  return cachedDefaults;
10943
11024
  }
10944
11025
  function readDefaultsFromDisk() {
10945
- const here = dirname10(fileURLToPath2(import.meta.url));
11026
+ const here = dirname11(fileURLToPath2(import.meta.url));
10946
11027
  const candidates = [
10947
- resolve17(here, "../../config/defaults/skillmapignore"),
11028
+ resolve18(here, "../../config/defaults/skillmapignore"),
10948
11029
  // src/kernel/scan/ → src/config/defaults/
10949
- resolve17(here, "../config/defaults/skillmapignore"),
11030
+ resolve18(here, "../config/defaults/skillmapignore"),
10950
11031
  // dist/cli.js → dist/config/defaults/ (siblings)
10951
- resolve17(here, "config/defaults/skillmapignore")
11032
+ resolve18(here, "config/defaults/skillmapignore")
10952
11033
  ];
10953
11034
  for (const candidate of candidates) {
10954
11035
  if (existsSync14(candidate)) {
@@ -11062,24 +11143,31 @@ async function* walkContent(roots, options) {
11062
11143
  const filter = options.ignoreFilter ?? buildIgnoreFilter();
11063
11144
  const extensions = options.extensions;
11064
11145
  const sizeLimit = buildSizeLimit(options);
11146
+ const bodyField = options.bodyField;
11065
11147
  if (options.scopedPaths !== void 0) {
11066
- yield* walkScoped(roots, options.scopedPaths, extensions, sizeLimit, parser);
11148
+ yield* walkScoped(roots, options.scopedPaths, extensions, sizeLimit, parser, bodyField);
11067
11149
  return;
11068
11150
  }
11069
11151
  for (const root of roots) {
11070
11152
  for await (const entry of walkRoot(root, root, filter, extensions, sizeLimit)) {
11071
11153
  const relPath = relative2(root, entry.full).split(sep3).join("/");
11072
- const rec = await traversedEntryToNode(entry, relPath, options.priorMtimes, parser);
11154
+ const rec = await traversedEntryToNode(
11155
+ entry,
11156
+ relPath,
11157
+ options.priorMtimes,
11158
+ parser,
11159
+ bodyField
11160
+ );
11073
11161
  if (rec !== null) yield rec;
11074
11162
  }
11075
11163
  }
11076
11164
  }
11077
- async function traversedEntryToNode(entry, relPath, priorMtimes, parser) {
11165
+ async function traversedEntryToNode(entry, relPath, priorMtimes, parser, bodyField) {
11078
11166
  const priorMtime = priorMtimes?.get(relPath);
11079
11167
  if (priorMtime !== void 0 && priorMtime === entry.modifiedAtMs) {
11080
- return buildUnchangedRecord(entry.full, relPath, entry.modifiedAtMs, parser);
11168
+ return buildUnchangedRecord(entry.full, relPath, entry.modifiedAtMs, parser, bodyField);
11081
11169
  }
11082
- const parsed = await readAndParse(entry.full, relPath, parser);
11170
+ const parsed = await readAndParse(entry.full, relPath, parser, bodyField);
11083
11171
  if (parsed === null) return null;
11084
11172
  return {
11085
11173
  path: relPath,
@@ -11096,7 +11184,7 @@ async function traversedEntryToNode(entry, relPath, priorMtimes, parser) {
11096
11184
  ...parsed.parseIssues ? { parseIssues: parsed.parseIssues } : {}
11097
11185
  };
11098
11186
  }
11099
- function buildUnchangedRecord(full, relPath, modifiedAtMs, parser) {
11187
+ function buildUnchangedRecord(full, relPath, modifiedAtMs, parser, bodyField) {
11100
11188
  return {
11101
11189
  path: relPath,
11102
11190
  body: "",
@@ -11105,26 +11193,26 @@ function buildUnchangedRecord(full, relPath, modifiedAtMs, parser) {
11105
11193
  modifiedAtMs,
11106
11194
  unchanged: true,
11107
11195
  reread: async () => {
11108
- const re = await readAndParse(full, relPath, parser);
11196
+ const re = await readAndParse(full, relPath, parser, bodyField);
11109
11197
  return re ?? { body: "", frontmatterRaw: "", frontmatter: {} };
11110
11198
  }
11111
11199
  };
11112
11200
  }
11113
- async function* walkScoped(roots, scopedPaths, extensions, sizeLimit, parser) {
11114
- const absRoots = roots.map((r) => isAbsolute4(r) ? r : resolve18(r));
11201
+ async function* walkScoped(roots, scopedPaths, extensions, sizeLimit, parser, bodyField) {
11202
+ const absRoots = roots.map((r) => isAbsolute4(r) ? r : resolve19(r));
11115
11203
  for (const scoped of scopedPaths) {
11116
- const rec = await scopedPathToNode(scoped, absRoots, extensions, sizeLimit, parser);
11204
+ const rec = await scopedPathToNode(scoped, absRoots, extensions, sizeLimit, parser, bodyField);
11117
11205
  if (rec !== null) yield rec;
11118
11206
  }
11119
11207
  }
11120
- async function scopedPathToNode(scoped, absRoots, extensions, sizeLimit, parser) {
11121
- const full = isAbsolute4(scoped) ? scoped : resolve18(scoped);
11208
+ async function scopedPathToNode(scoped, absRoots, extensions, sizeLimit, parser, bodyField) {
11209
+ const full = isAbsolute4(scoped) ? scoped : resolve19(scoped);
11122
11210
  const relPath = relativeFromRoots(full, absRoots);
11123
11211
  if (relPath === null) return null;
11124
11212
  if (!hasMatchingExtension(full, extensions)) return null;
11125
11213
  const s = await statRegularFile(full, relPath, sizeLimit);
11126
11214
  if (s === null) return null;
11127
- const parsed = await readAndParse(full, relPath, parser);
11215
+ const parsed = await readAndParse(full, relPath, parser, bodyField);
11128
11216
  if (parsed === null) return null;
11129
11217
  return {
11130
11218
  path: relPath,
@@ -11157,7 +11245,7 @@ function relativeFromRoots(full, absRoots) {
11157
11245
  }
11158
11246
  return null;
11159
11247
  }
11160
- async function readAndParse(full, relPath, parser) {
11248
+ async function readAndParse(full, relPath, parser, bodyField) {
11161
11249
  let raw;
11162
11250
  try {
11163
11251
  raw = await readFile(full, "utf8");
@@ -11166,12 +11254,19 @@ async function readAndParse(full, relPath, parser) {
11166
11254
  }
11167
11255
  const parsed = parser.parse(raw, relPath);
11168
11256
  return {
11169
- body: parsed.body,
11257
+ body: resolveEffectiveBody(parsed.body, parsed.frontmatter, bodyField),
11170
11258
  frontmatterRaw: parsed.frontmatterRaw,
11171
11259
  frontmatter: parsed.frontmatter,
11172
11260
  ...parsed.issues && parsed.issues.length > 0 ? { parseIssues: parsed.issues } : {}
11173
11261
  };
11174
11262
  }
11263
+ function resolveEffectiveBody(parsedBody, frontmatter, bodyField) {
11264
+ if (bodyField !== void 0) {
11265
+ const candidate = frontmatter[bodyField];
11266
+ if (typeof candidate === "string") return candidate;
11267
+ }
11268
+ return parsedBody;
11269
+ }
11175
11270
  function buildSizeLimit(options) {
11176
11271
  const sizeLimit = {};
11177
11272
  if (options.maxFileSizeBytes !== void 0) {
@@ -11227,13 +11322,19 @@ function resolveProviderWalk(provider) {
11227
11322
  return walk3;
11228
11323
  }
11229
11324
  const read = provider.read ?? DEFAULT_READ_CONFIG;
11230
- return (roots, options) => walkContent(roots, buildWalkContentOptions(read, options));
11325
+ const rules = Array.isArray(read) ? read : [read];
11326
+ return async function* walkRules(roots, options) {
11327
+ for (const rule of rules) {
11328
+ yield* walkContent(roots, buildWalkContentOptions(rule, options));
11329
+ }
11330
+ };
11231
11331
  }
11232
11332
  function buildWalkContentOptions(read, options) {
11233
11333
  const walkOptions = {
11234
11334
  extensions: read.extensions,
11235
11335
  parser: read.parser
11236
11336
  };
11337
+ if (read.bodyField !== void 0) walkOptions.bodyField = read.bodyField;
11237
11338
  if (options) copyOptionalWalkOptions(walkOptions, options);
11238
11339
  return walkOptions;
11239
11340
  }
@@ -11334,7 +11435,7 @@ function isExtensionInstance(v) {
11334
11435
  }
11335
11436
 
11336
11437
  // core/runtime/plugin-runtime/warnings.ts
11337
- import { resolve as resolve19 } from "path";
11438
+ import { resolve as resolve20 } from "path";
11338
11439
 
11339
11440
  // kernel/util/text.ts
11340
11441
  function truncateHead(s, max) {
@@ -11384,7 +11485,7 @@ function resolveRuntimeContext(opts) {
11384
11485
  return opts.runtimeContext ?? defaultRuntimeContext();
11385
11486
  }
11386
11487
  function resolveSearchPaths(opts, ctx) {
11387
- if (opts.pluginDir) return [resolve19(opts.pluginDir)];
11488
+ if (opts.pluginDir) return [resolve20(opts.pluginDir)];
11388
11489
  return [defaultProjectPluginsDir(ctx)];
11389
11490
  }
11390
11491
 
@@ -11922,17 +12023,18 @@ function isDetectableUnderCwd(cwd, provider) {
11922
12023
  }
11923
12024
 
11924
12025
  // core/config/active-provider.ts
11925
- var MARKDOWN_LENS_ID = "markdown";
12026
+ var DEFAULT_LENS_ID = "agent-skills";
12027
+ var MARKDOWN_BASE_ID = "markdown";
11926
12028
  function resolveActiveProvider(cwd, providers = []) {
11927
12029
  const detected = detectProvidersFromFilesystem(cwd, providers);
11928
12030
  const fromConfig = readConfigValue("activeProvider", { cwd });
11929
- if (typeof fromConfig === "string" && fromConfig.length > 0) {
12031
+ if (typeof fromConfig === "string" && fromConfig.length > 0 && fromConfig !== MARKDOWN_BASE_ID) {
11930
12032
  return { resolved: fromConfig, source: "config", detected };
11931
12033
  }
11932
12034
  if (detected.length > 0) {
11933
12035
  return { resolved: detected[0], source: "autodetect", detected };
11934
12036
  }
11935
- return { resolved: MARKDOWN_LENS_ID, source: "default", detected };
12037
+ return { resolved: DEFAULT_LENS_ID, source: "default", detected };
11936
12038
  }
11937
12039
 
11938
12040
  // cli/util/path-display.ts
@@ -12664,7 +12766,7 @@ var CONFIG_COMMANDS = [
12664
12766
 
12665
12767
  // cli/commands/conformance.ts
12666
12768
  import { existsSync as existsSync19, readFileSync as readFileSync16 } from "fs";
12667
- import { dirname as dirname12, resolve as resolve22 } from "path";
12769
+ import { dirname as dirname13, resolve as resolve23 } from "path";
12668
12770
  import { fileURLToPath as fileURLToPath4 } from "url";
12669
12771
  import { Command as Command5, Option as Option5 } from "clipanion";
12670
12772
 
@@ -12672,7 +12774,7 @@ import { Command as Command5, Option as Option5 } from "clipanion";
12672
12774
  import { spawnSync as spawnSync2 } from "child_process";
12673
12775
  import { cpSync, existsSync as existsSync17, mkdtempSync, readdirSync as readdirSync6, readFileSync as readFileSync15, rmSync, statSync as statSync3 } from "fs";
12674
12776
  import { tmpdir } from "os";
12675
- import { isAbsolute as isAbsolute6, join as join11, relative as relative3, resolve as resolve20 } from "path";
12777
+ import { isAbsolute as isAbsolute6, join as join11, relative as relative3, resolve as resolve21 } from "path";
12676
12778
 
12677
12779
  // conformance/i18n/runner.texts.ts
12678
12780
  var CONFORMANCE_RUNNER_TEXTS = {
@@ -12839,7 +12941,7 @@ function assertContained2(root, rel, label) {
12839
12941
  tx(CONFORMANCE_RUNNER_TEXTS.pathMustBeRelative, { label, path: rel, anchor: root })
12840
12942
  );
12841
12943
  }
12842
- const abs = resolve20(root, rel);
12944
+ const abs = resolve21(root, rel);
12843
12945
  const r = relative3(root, abs);
12844
12946
  if (r.startsWith("..") || isAbsolute6(r)) {
12845
12947
  throw new Error(
@@ -12866,7 +12968,7 @@ function evaluateAssertion(a, ctx) {
12866
12968
  } catch (err) {
12867
12969
  return { ok: false, type: a.type, reason: formatErrorMessage(err) };
12868
12970
  }
12869
- const abs = resolve20(ctx.scope, a.path);
12971
+ const abs = resolve21(ctx.scope, a.path);
12870
12972
  return existsSync17(abs) ? { ok: true, type: a.type } : {
12871
12973
  ok: false,
12872
12974
  type: a.type,
@@ -12881,7 +12983,7 @@ function evaluateAssertion(a, ctx) {
12881
12983
  return { ok: false, type: a.type, reason: formatErrorMessage(err) };
12882
12984
  }
12883
12985
  const fixturePath = join11(ctx.fixturesRoot, a.fixture);
12884
- const targetPath = resolve20(ctx.scope, a.path);
12986
+ const targetPath = resolve21(ctx.scope, a.path);
12885
12987
  if (!existsSync17(targetPath)) {
12886
12988
  return {
12887
12989
  ok: false,
@@ -13064,14 +13166,14 @@ var CONFORMANCE_TEXTS = {
13064
13166
 
13065
13167
  // cli/util/conformance-scopes.ts
13066
13168
  import { existsSync as existsSync18, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
13067
- import { dirname as dirname11, resolve as resolve21 } from "path";
13169
+ import { dirname as dirname12, resolve as resolve22 } from "path";
13068
13170
  import { createRequire as createRequire6 } from "module";
13069
13171
  import { fileURLToPath as fileURLToPath3 } from "url";
13070
13172
  function resolveSpecRoot4() {
13071
13173
  const require2 = createRequire6(import.meta.url);
13072
13174
  try {
13073
13175
  const indexPath = require2.resolve("@skill-map/spec/index.json");
13074
- return dirname11(indexPath);
13176
+ return dirname12(indexPath);
13075
13177
  } catch {
13076
13178
  throw new Error(
13077
13179
  "@skill-map/spec not resolvable: ensure the workspace is linked or the package is installed."
@@ -13079,14 +13181,14 @@ function resolveSpecRoot4() {
13079
13181
  }
13080
13182
  }
13081
13183
  function resolveCliWorkspaceRoot() {
13082
- const here = dirname11(fileURLToPath3(import.meta.url));
13184
+ const here = dirname12(fileURLToPath3(import.meta.url));
13083
13185
  let cursor = here;
13084
13186
  for (let depth = 0; depth < 6; depth += 1) {
13085
- const candidate = resolve21(cursor, "plugins");
13187
+ const candidate = resolve22(cursor, "plugins");
13086
13188
  if (existsSync18(candidate) && statSync4(candidate).isDirectory()) {
13087
13189
  return cursor;
13088
13190
  }
13089
- const parent = dirname11(cursor);
13191
+ const parent = dirname12(cursor);
13090
13192
  if (parent === cursor) break;
13091
13193
  cursor = parent;
13092
13194
  }
@@ -13102,12 +13204,12 @@ function collectProviderScopes(specRoot) {
13102
13204
  } catch {
13103
13205
  return out;
13104
13206
  }
13105
- const pluginsRoot = resolve21(workspaceRoot, "plugins");
13207
+ const pluginsRoot = resolve22(workspaceRoot, "plugins");
13106
13208
  if (!existsSync18(pluginsRoot)) return out;
13107
13209
  for (const pluginEntry of readdirSync7(pluginsRoot)) {
13108
- const pluginDir = resolve21(pluginsRoot, pluginEntry);
13210
+ const pluginDir = resolve22(pluginsRoot, pluginEntry);
13109
13211
  if (!isDir(pluginDir)) continue;
13110
- const providersRoot = resolve21(pluginDir, "providers");
13212
+ const providersRoot = resolve22(pluginDir, "providers");
13111
13213
  if (!isDir(providersRoot)) continue;
13112
13214
  collectPluginProviderScopes(providersRoot, specRoot, out);
13113
13215
  }
@@ -13122,12 +13224,12 @@ function isDir(path) {
13122
13224
  }
13123
13225
  function collectPluginProviderScopes(providersRoot, specRoot, out) {
13124
13226
  for (const entry of readdirSync7(providersRoot)) {
13125
- const providerDir = resolve21(providersRoot, entry);
13227
+ const providerDir = resolve22(providersRoot, entry);
13126
13228
  if (!isDir(providerDir)) continue;
13127
- const conformanceDir = resolve21(providerDir, "conformance");
13229
+ const conformanceDir = resolve22(providerDir, "conformance");
13128
13230
  if (!existsSync18(conformanceDir)) continue;
13129
- const casesDir = resolve21(conformanceDir, "cases");
13130
- const fixturesDir = resolve21(conformanceDir, "fixtures");
13231
+ const casesDir = resolve22(conformanceDir, "cases");
13232
+ const fixturesDir = resolve22(conformanceDir, "fixtures");
13131
13233
  if (!existsSync18(casesDir) || !existsSync18(fixturesDir)) continue;
13132
13234
  out.push({
13133
13235
  id: `provider:${entry}`,
@@ -13144,8 +13246,8 @@ function specScope(specRoot) {
13144
13246
  id: "spec",
13145
13247
  kind: "spec",
13146
13248
  label: "spec",
13147
- casesDir: resolve21(specRoot, "conformance", "cases"),
13148
- fixturesDir: resolve21(specRoot, "conformance", "fixtures"),
13249
+ casesDir: resolve22(specRoot, "conformance", "cases"),
13250
+ fixturesDir: resolve22(specRoot, "conformance", "fixtures"),
13149
13251
  specRoot
13150
13252
  };
13151
13253
  }
@@ -13167,7 +13269,7 @@ function selectConformanceScopes(scope) {
13167
13269
  }
13168
13270
  function listCaseFiles(scope) {
13169
13271
  if (!existsSync18(scope.casesDir)) return [];
13170
- return readdirSync7(scope.casesDir).filter((entry) => entry.endsWith(".json")).sort().map((entry) => resolve21(scope.casesDir, entry));
13272
+ return readdirSync7(scope.casesDir).filter((entry) => entry.endsWith(".json")).sort().map((entry) => resolve22(scope.casesDir, entry));
13171
13273
  }
13172
13274
 
13173
13275
  // cli/commands/conformance.ts
@@ -13181,16 +13283,16 @@ function formatAssertionFailureDetail(type, reason) {
13181
13283
  });
13182
13284
  }
13183
13285
  function resolveBinary() {
13184
- const here = dirname12(fileURLToPath4(import.meta.url));
13286
+ const here = dirname13(fileURLToPath4(import.meta.url));
13185
13287
  let cursor = here;
13186
13288
  for (let depth = 0; depth < 6; depth += 1) {
13187
- const candidate = resolve22(cursor, "bin", "sm.js");
13289
+ const candidate = resolve23(cursor, "bin", "sm.js");
13188
13290
  if (existsSync19(candidate)) return candidate;
13189
- const parent = dirname12(cursor);
13291
+ const parent = dirname13(cursor);
13190
13292
  if (parent === cursor) break;
13191
13293
  cursor = parent;
13192
13294
  }
13193
- return resolve22(here, "..", "..", "bin", "sm.js");
13295
+ return resolve23(here, "..", "..", "bin", "sm.js");
13194
13296
  }
13195
13297
  var ConformanceRunCommand = class extends SmCommand {
13196
13298
  static paths = [["conformance", "run"]];
@@ -13443,7 +13545,7 @@ function writeStreamSnippet(stream, header, text) {
13443
13545
  var CONFORMANCE_COMMANDS = [ConformanceRunCommand];
13444
13546
 
13445
13547
  // cli/commands/db/backup.ts
13446
- import { dirname as dirname13, join as join12, resolve as resolve23 } from "path";
13548
+ import { join as join12, resolve as resolve24 } from "path";
13447
13549
  import { Command as Command6, Option as Option6 } from "clipanion";
13448
13550
 
13449
13551
  // cli/i18n/db.texts.ts
@@ -13556,7 +13658,7 @@ var DbBackupCommand = class extends SmCommand {
13556
13658
  const exit = requireDbOrExit(path, this.context.stderr);
13557
13659
  if (exit !== null) return exit;
13558
13660
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
13559
- const outPath = this.out ? resolve23(this.out) : join12(dirname13(path), "backups", `${ts}.db`);
13661
+ const outPath = this.out ? resolve24(this.out) : join12(backupsDirForDb(path), `${ts}.db`);
13560
13662
  await withSqlite({ databasePath: path, autoMigrate: false }, async (storage) => {
13561
13663
  storage.migrations.writeBackup(outPath);
13562
13664
  });
@@ -13573,7 +13675,7 @@ var DbBackupCommand = class extends SmCommand {
13573
13675
 
13574
13676
  // cli/commands/db/restore.ts
13575
13677
  import { chmod, copyFile, mkdir, rm } from "fs/promises";
13576
- import { dirname as dirname14, resolve as resolve24 } from "path";
13678
+ import { dirname as dirname14, resolve as resolve25 } from "path";
13577
13679
  import { Command as Command7, Option as Option7 } from "clipanion";
13578
13680
 
13579
13681
  // cli/util/fs.ts
@@ -13623,7 +13725,7 @@ var DbRestoreCommand = class extends SmCommand {
13623
13725
  });
13624
13726
  async run() {
13625
13727
  const target = resolveDbPath({ db: this.db, ...defaultRuntimeContext() });
13626
- const sourcePath = resolve24(this.source);
13728
+ const sourcePath = resolve25(this.source);
13627
13729
  const stderrAnsi = this.ansiFor("stderr");
13628
13730
  const sourceStat = await statOrNull(sourcePath);
13629
13731
  if (!sourceStat) {
@@ -13864,7 +13966,7 @@ var DbShellCommand = class extends SmCommand {
13864
13966
 
13865
13967
  // cli/commands/db/browser.ts
13866
13968
  import { spawn, spawnSync as spawnSync4 } from "child_process";
13867
- import { resolve as resolve25 } from "path";
13969
+ import { resolve as resolve26 } from "path";
13868
13970
  import { Command as Command10, Option as Option9 } from "clipanion";
13869
13971
  var DbBrowserCommand = class extends SmCommand {
13870
13972
  static paths = [["db", "browser"]];
@@ -13897,7 +13999,7 @@ var DbBrowserCommand = class extends SmCommand {
13897
13999
  });
13898
14000
  positional = Option9.String({ required: false });
13899
14001
  async run() {
13900
- const path = this.positional ? resolve25(this.positional) : resolveDbPath({ db: this.db, ...defaultRuntimeContext() });
14002
+ const path = this.positional ? resolve26(this.positional) : resolveDbPath({ db: this.db, ...defaultRuntimeContext() });
13901
14003
  if (!assertDbExists(path, this.context.stderr)) {
13902
14004
  this.printer.error(DB_TEXTS.browserRunScanFirstHint);
13903
14005
  return ExitCode.NotFound;
@@ -14298,7 +14400,7 @@ var DB_COMMANDS = [
14298
14400
 
14299
14401
  // cli/commands/example.ts
14300
14402
  import { cpSync as cpSync2, existsSync as existsSync21, statSync as statSync5 } from "fs";
14301
- import { dirname as dirname16, relative as relative5, resolve as resolve26 } from "path";
14403
+ import { dirname as dirname16, relative as relative5, resolve as resolve27 } from "path";
14302
14404
  import { fileURLToPath as fileURLToPath5 } from "url";
14303
14405
  import { Command as Command13, Option as Option12 } from "clipanion";
14304
14406
 
@@ -14594,11 +14696,11 @@ function resolveExampleSourceDir() {
14594
14696
  const here = dirname16(fileURLToPath5(import.meta.url));
14595
14697
  const candidates = [
14596
14698
  // dev: src/cli/commands/ → repo-root fixtures/demo-scope/
14597
- resolve26(here, "../../..", EXAMPLE_SOURCE_DIR),
14699
+ resolve27(here, "../../..", EXAMPLE_SOURCE_DIR),
14598
14700
  // bundled: dist/cli.js → dist/cli/example (sibling)
14599
- resolve26(here, "cli/example"),
14701
+ resolve27(here, "cli/example"),
14600
14702
  // bundled fallback: any-depth → cli/example
14601
- resolve26(here, "../cli/example")
14703
+ resolve27(here, "../cli/example")
14602
14704
  ];
14603
14705
  for (const candidate of candidates) {
14604
14706
  if (existsSync21(candidate) && statSync5(candidate).isDirectory()) {
@@ -15135,7 +15237,7 @@ var GraphCommand = class extends SmCommand {
15135
15237
  // cli/commands/help.ts
15136
15238
  import { readFileSync as readFileSync17 } from "fs";
15137
15239
  import { createRequire as createRequire7 } from "module";
15138
- import { resolve as resolve27 } from "path";
15240
+ import { resolve as resolve28 } from "path";
15139
15241
  import { Command as Command16, Option as Option15 } from "clipanion";
15140
15242
 
15141
15243
  // cli/i18n/help.texts.ts
@@ -15449,7 +15551,7 @@ function resolveSpecVersion() {
15449
15551
  try {
15450
15552
  const req = createRequire7(import.meta.url);
15451
15553
  const indexPath = req.resolve("@skill-map/spec/index.json");
15452
- const pkgPath = resolve27(indexPath, "..", "package.json");
15554
+ const pkgPath = resolve28(indexPath, "..", "package.json");
15453
15555
  const pkg = JSON.parse(readFileSync17(pkgPath, "utf8"));
15454
15556
  return pkg.version;
15455
15557
  } catch {
@@ -15757,7 +15859,7 @@ function registeredVerbPaths(cli2) {
15757
15859
 
15758
15860
  // cli/commands/hooks.ts
15759
15861
  import { chmod as chmod2, mkdir as mkdir3, readFile as readFile2, stat as stat2, writeFile } from "fs/promises";
15760
- import { dirname as dirname17, resolve as resolve28 } from "path";
15862
+ import { dirname as dirname17, resolve as resolve29 } from "path";
15761
15863
  import { Command as Command17, Option as Option16 } from "clipanion";
15762
15864
 
15763
15865
  // cli/i18n/hooks.texts.ts
@@ -15860,8 +15962,8 @@ var HooksInstallCommand = class extends SmCommand {
15860
15962
  );
15861
15963
  return ExitCode.NotFound;
15862
15964
  }
15863
- const hooksDir = resolve28(repoRoot, ".git", "hooks");
15864
- const hookPath = resolve28(hooksDir, "pre-commit");
15965
+ const hooksDir = resolve29(repoRoot, ".git", "hooks");
15966
+ const hookPath = resolve29(hooksDir, "pre-commit");
15865
15967
  const existing = await pathExists(hookPath) ? await readFile2(hookPath, "utf8") : null;
15866
15968
  const planned2 = computePlannedHookContent(existing);
15867
15969
  if (planned2.kind === "already-installed") {
@@ -15919,7 +16021,7 @@ var HooksInstallCommand = class extends SmCommand {
15919
16021
  async function findGitRepoRoot(cwd) {
15920
16022
  let current = cwd;
15921
16023
  while (true) {
15922
- if (await pathExists(resolve28(current, ".git"))) return current;
16024
+ if (await pathExists(resolve29(current, ".git"))) return current;
15923
16025
  const parent = dirname17(current);
15924
16026
  if (parent === current) return null;
15925
16027
  current = parent;
@@ -15946,7 +16048,7 @@ import { Command as Command18, Option as Option17 } from "clipanion";
15946
16048
 
15947
16049
  // kernel/orchestrator/index.ts
15948
16050
  import { existsSync as existsSync24, statSync as statSync7 } from "fs";
15949
- import { isAbsolute as isAbsolute10, resolve as resolve31 } from "path";
16051
+ import { isAbsolute as isAbsolute10, resolve as resolve32 } from "path";
15950
16052
  import { Tiktoken as Tiktoken2 } from "js-tiktoken/lite";
15951
16053
 
15952
16054
  // kernel/i18n/orchestrator.texts.ts
@@ -16634,6 +16736,13 @@ function validateIssue(analyzer, issue, emitter) {
16634
16736
  return { ...issue, analyzerId: issue.analyzerId || analyzer.id };
16635
16737
  }
16636
16738
 
16739
+ // kernel/orchestrator/frontmatter-issue-ids.ts
16740
+ var FRONTMATTER_ISSUE_ANALYZERS = /* @__PURE__ */ new Set([
16741
+ "frontmatter-invalid",
16742
+ "frontmatter-malformed",
16743
+ "frontmatter-parse-error"
16744
+ ]);
16745
+
16637
16746
  // kernel/orchestrator/cache.ts
16638
16747
  function indexPriorSnapshot(prior) {
16639
16748
  const priorNodesByPath = /* @__PURE__ */ new Map();
@@ -16891,7 +17000,7 @@ function collectBrokenLinks(links, nodes, ctx) {
16891
17000
  return broken;
16892
17001
  }
16893
17002
  function applyResolution(link, indexes, ctx) {
16894
- const resolution = resolve29(link, indexes, ctx);
17003
+ const resolution = resolve30(link, indexes, ctx);
16895
17004
  if (resolution === "none") return;
16896
17005
  link.resolvedTarget = resolution;
16897
17006
  }
@@ -16906,7 +17015,7 @@ function buildIndexes(nodes, ctx) {
16906
17015
  }
16907
17016
  return { byPath: byPath3, byName, nodeByPath };
16908
17017
  }
16909
- function resolve29(link, indexes, ctx) {
17018
+ function resolve30(link, indexes, ctx) {
16910
17019
  if (indexes.byPath.has(link.target)) return link.target;
16911
17020
  return resolveByName(link, indexes, ctx);
16912
17021
  }
@@ -17295,7 +17404,7 @@ function detectRenamesAndOrphans(prior, current, issues, silenced) {
17295
17404
  }
17296
17405
 
17297
17406
  // kernel/orchestrator/walk.ts
17298
- import { isAbsolute as isAbsolute9, resolve as resolve30 } from "path";
17407
+ import { isAbsolute as isAbsolute9, resolve as resolve31 } from "path";
17299
17408
 
17300
17409
  // kernel/sidecar/drift.ts
17301
17410
  function computeDriftStatus(args2) {
@@ -17741,8 +17850,8 @@ function expandSidecarPaths(paths, priorNodesByPath) {
17741
17850
  }
17742
17851
  function toAbsolute(relPath, roots) {
17743
17852
  const root = roots[0] ?? ".";
17744
- const absRoot = isAbsolute9(root) ? root : resolve30(root);
17745
- return resolve30(absRoot, relPath);
17853
+ const absRoot = isAbsolute9(root) ? root : resolve31(root);
17854
+ return resolve31(absRoot, relPath);
17746
17855
  }
17747
17856
  function resolveEffectiveCaps(opts) {
17748
17857
  return {
@@ -18340,7 +18449,7 @@ function validateRoots(roots) {
18340
18449
  function resolveActiveProviderOption(optionValue, roots, providers) {
18341
18450
  if (optionValue !== void 0) return optionValue;
18342
18451
  for (const root of roots) {
18343
- const absRoot = isAbsolute10(root) ? root : resolve31(root);
18452
+ const absRoot = isAbsolute10(root) ? root : resolve32(root);
18344
18453
  if (!existsSync24(absRoot)) continue;
18345
18454
  const detected = detectProvidersFromFilesystem(absRoot, providers)[0] ?? null;
18346
18455
  if (detected !== null) return detected;
@@ -18349,10 +18458,10 @@ function resolveActiveProviderOption(optionValue, roots, providers) {
18349
18458
  }
18350
18459
 
18351
18460
  // kernel/scan/watcher.ts
18352
- import { resolve as resolve32, relative as relative7, sep as sep5 } from "path";
18461
+ import { resolve as resolve33, relative as relative7, sep as sep5 } from "path";
18353
18462
  import chokidar from "chokidar";
18354
18463
  function createChokidarWatcher(opts) {
18355
- const absRoots = opts.roots.map((r) => resolve32(opts.cwd, r));
18464
+ const absRoots = opts.roots.map((r) => resolve33(opts.cwd, r));
18356
18465
  const ignoreFilterOpt = opts.ignoreFilter;
18357
18466
  const getFilter = ignoreFilterOpt === void 0 ? void 0 : typeof ignoreFilterOpt === "function" ? ignoreFilterOpt : () => ignoreFilterOpt;
18358
18467
  const ignored = getFilter ? (path) => {
@@ -18858,7 +18967,7 @@ function resolveScanRoots(inputs) {
18858
18967
  // core/runtime/reference-paths-walker.ts
18859
18968
  import { readdirSync as readdirSync9, statSync as statSync8 } from "fs";
18860
18969
  import { homedir as osHomedir2 } from "os";
18861
- import { isAbsolute as isAbsolute11, join as join14, resolve as resolve33 } from "path";
18970
+ import { isAbsolute as isAbsolute11, join as join14, resolve as resolve34 } from "path";
18862
18971
  var REFERENCE_WALK_MAX_FILES = 5e4;
18863
18972
  var SKIPPED_DIR_NAMES = /* @__PURE__ */ new Set([
18864
18973
  "node_modules",
@@ -18866,10 +18975,10 @@ var SKIPPED_DIR_NAMES = /* @__PURE__ */ new Set([
18866
18975
  SKILL_MAP_DIR
18867
18976
  ]);
18868
18977
  function resolveScanPath(raw, cwd) {
18869
- if (raw.startsWith("~/")) return resolve33(join14(osHomedir2(), raw.slice(2)));
18870
- if (raw === "~") return resolve33(osHomedir2());
18871
- if (isAbsolute11(raw)) return resolve33(raw);
18872
- return resolve33(cwd, raw);
18978
+ if (raw.startsWith("~/")) return resolve34(join14(osHomedir2(), raw.slice(2)));
18979
+ if (raw === "~") return resolve34(osHomedir2());
18980
+ if (isAbsolute11(raw)) return resolve34(raw);
18981
+ return resolve34(cwd, raw);
18873
18982
  }
18874
18983
  function walkReferencePaths(rawRoots, cwd) {
18875
18984
  const paths = /* @__PURE__ */ new Set();
@@ -18938,7 +19047,7 @@ async function bootstrapActiveProvider(opts) {
18938
19047
  opts.providers
18939
19048
  );
18940
19049
  if (detected.length === 0) {
18941
- return { kind: "ok", activeProvider: MARKDOWN_LENS_ID, source: "default" };
19050
+ return { kind: "ok", activeProvider: DEFAULT_LENS_ID, source: "default" };
18942
19051
  }
18943
19052
  if (detected.length === 1) {
18944
19053
  const picked2 = detected[0];
@@ -20333,7 +20442,7 @@ import { Command as Command20, Option as Option19 } from "clipanion";
20333
20442
 
20334
20443
  // kernel/jobs/orphan-files.ts
20335
20444
  import { readdirSync as readdirSync10, statSync as statSync9 } from "fs";
20336
- import { join as join17, resolve as resolve34 } from "path";
20445
+ import { join as join17, resolve as resolve35 } from "path";
20337
20446
  function findOrphanJobFiles(jobsDir, referencedPaths) {
20338
20447
  let entries;
20339
20448
  try {
@@ -20351,7 +20460,7 @@ function findOrphanJobFiles(jobsDir, referencedPaths) {
20351
20460
  if (!entry.isFile()) continue;
20352
20461
  const name = entry.name;
20353
20462
  if (!name.endsWith(".md")) continue;
20354
- const abs = resolve34(join17(jobsDir, name));
20463
+ const abs = resolve35(join17(jobsDir, name));
20355
20464
  if (!referencedPaths.has(abs)) orphans.push(abs);
20356
20465
  }
20357
20466
  orphans.sort();
@@ -21561,7 +21670,7 @@ var BUILT_IN_PLUGIN_PRESENTATION_ORDER = [
21561
21670
  "core",
21562
21671
  "claude",
21563
21672
  "antigravity",
21564
- "openai",
21673
+ "codex",
21565
21674
  "agent-skills"
21566
21675
  ];
21567
21676
  function sortPluginsForPresentation(plugins) {
@@ -21578,9 +21687,9 @@ function sortPluginsForPresentation(plugins) {
21578
21687
  }
21579
21688
 
21580
21689
  // cli/commands/plugins/shared.ts
21581
- import { resolve as resolve35 } from "path";
21690
+ import { resolve as resolve36 } from "path";
21582
21691
  function resolveSearchPaths2(opts, cwd) {
21583
- if (opts.pluginDir) return [resolve35(opts.pluginDir)];
21692
+ if (opts.pluginDir) return [resolve36(opts.pluginDir)];
21584
21693
  return [defaultProjectPluginsDir({ cwd })];
21585
21694
  }
21586
21695
  async function buildResolver() {
@@ -22824,7 +22933,7 @@ var PluginsEnableCommand = class extends TogglePluginsBase {
22824
22933
  ids (\`claude\`, which fans the toggle out across every extension
22825
22934
  inside the plugin). Multi-extension plugins need --yes (or an
22826
22935
  interactive TTY confirm) to avoid flipping 27 core extensions by
22827
- accident. Single-extension plugins (openai, agent-skills,
22936
+ accident. Single-extension plugins (codex, agent-skills,
22828
22937
  antigravity) apply without prompting.
22829
22938
 
22830
22939
  Batches are all-or-nothing: a single unknown id aborts before
@@ -22851,7 +22960,7 @@ var PluginsDisableCommand = class extends TogglePluginsBase {
22851
22960
  ids (\`core\`, which fans the toggle out across every extension
22852
22961
  inside the plugin). Multi-extension plugins need --yes (or an
22853
22962
  interactive TTY confirm) to avoid flipping 27 core extensions by
22854
- accident. Single-extension plugins (openai, agent-skills,
22963
+ accident. Single-extension plugins (codex, agent-skills,
22855
22964
  antigravity) apply without prompting.
22856
22965
 
22857
22966
  Batches are all-or-nothing: a single unknown id aborts before
@@ -22894,7 +23003,7 @@ function resolveBareToggle(id, catalogue) {
22894
23003
 
22895
23004
  // cli/commands/plugins/create.ts
22896
23005
  import { existsSync as existsSync26, mkdirSync as mkdirSync5, writeFileSync } from "fs";
22897
- import { dirname as dirname18, join as join18, resolve as resolve36 } from "path";
23006
+ import { dirname as dirname18, join as join18, resolve as resolve37 } from "path";
22898
23007
  import { Command as Command27, Option as Option26 } from "clipanion";
22899
23008
 
22900
23009
  // cli/commands/plugins/scaffold/action.ts
@@ -23344,7 +23453,7 @@ var PluginsCreateCommand = class extends SmCommand {
23344
23453
  const kind = this.kind;
23345
23454
  const ctx = defaultRuntimeContext();
23346
23455
  const baseDir = defaultProjectPluginsDir(ctx);
23347
- const targetDir = this.at ? resolve36(this.at) : join18(baseDir, this.pluginId);
23456
+ const targetDir = this.at ? resolve37(this.at) : join18(baseDir, this.pluginId);
23348
23457
  if (existsSync26(targetDir) && !this.force) {
23349
23458
  this.printer.error(
23350
23459
  tx(PLUGINS_TEXTS.createRefuseOverwrite, {
@@ -23860,7 +23969,7 @@ var PLUGIN_COMMANDS = [
23860
23969
 
23861
23970
  // cli/commands/refresh.ts
23862
23971
  import { readFile as readFile4 } from "fs/promises";
23863
- import { resolve as resolve37 } from "path";
23972
+ import { resolve as resolve38 } from "path";
23864
23973
  import { Command as Command31, Option as Option29 } from "clipanion";
23865
23974
 
23866
23975
  // cli/i18n/refresh.texts.ts
@@ -24168,7 +24277,7 @@ var RefreshCommand = class extends SmCommand {
24168
24277
  let body;
24169
24278
  try {
24170
24279
  assertContained(cwd, node.path);
24171
- const raw = await readFile4(resolve37(cwd, node.path), "utf8");
24280
+ const raw = await readFile4(resolve38(cwd, node.path), "utf8");
24172
24281
  body = stripFrontmatterFence(raw);
24173
24282
  } catch (err) {
24174
24283
  if (!this.json) {
@@ -24241,7 +24350,7 @@ var IntentionalFailCommand = class extends SmCommand {
24241
24350
  setTimeout(() => {
24242
24351
  throw new Error(INTENTIONAL_FAIL_TEXTS.errorMessage);
24243
24352
  }, 0);
24244
- await new Promise((resolve44) => setTimeout(resolve44, 5e3));
24353
+ await new Promise((resolve45) => setTimeout(resolve45, 5e3));
24245
24354
  return ExitCode.Issues;
24246
24355
  }
24247
24356
  };
@@ -24409,7 +24518,7 @@ var SCAN_TEXTS = {
24409
24518
  import { Command as Command32, Option as Option30 } from "clipanion";
24410
24519
 
24411
24520
  // core/watcher/runtime.ts
24412
- import { dirname as dirname19, isAbsolute as isAbsolute13, relative as relative9, resolve as resolve38, sep as sep6 } from "path";
24521
+ import { dirname as dirname19, isAbsolute as isAbsolute13, relative as relative9, resolve as resolve39, sep as sep6 } from "path";
24413
24522
 
24414
24523
  // core/runtime/fresh-resolver.ts
24415
24524
  async function buildFreshResolver(deps) {
@@ -24455,7 +24564,7 @@ function applyPriorStateToRunOptions(runOptions, priorState, changedPaths) {
24455
24564
  }
24456
24565
  }
24457
24566
  function toIncrementalPaths(events, roots, cwd) {
24458
- const absRoots = roots.map((r) => isAbsolute13(r) ? r : resolve38(cwd, r));
24567
+ const absRoots = roots.map((r) => isAbsolute13(r) ? r : resolve39(cwd, r));
24459
24568
  const changed = /* @__PURE__ */ new Set();
24460
24569
  const removed = /* @__PURE__ */ new Set();
24461
24570
  for (const ev of events) {
@@ -26199,7 +26308,8 @@ var SERVER_TEXTS = {
26199
26308
  activeProviderBodyMissing: "Request body must include `activeProvider` (a non-empty string).",
26200
26309
  activeProviderValueNotString: "`activeProvider` must be a string.",
26201
26310
  activeProviderValueEmpty: "`activeProvider` cannot be the empty string. Send the id of an enabled provider.",
26202
- activeProviderPersistFailed: "Could not persist activeProvider: {{message}}"
26311
+ activeProviderPersistFailed: "Could not persist activeProvider: {{message}}",
26312
+ activeProviderNotSelectable: "`{{id}}` is not a selectable lens. Pick one of: {{selectable}}."
26203
26313
  };
26204
26314
 
26205
26315
  // server/loopback-gate.ts
@@ -27899,10 +28009,10 @@ import { HTTPException as HTTPException12 } from "hono/http-exception";
27899
28009
 
27900
28010
  // server/util/skillmapignore-io.ts
27901
28011
  import { existsSync as existsSync28, readFileSync as readFileSync18, writeFileSync as writeFileSync2 } from "fs";
27902
- import { resolve as resolve39 } from "path";
28012
+ import { resolve as resolve40 } from "path";
27903
28013
  var IGNORE_FILENAME2 = ".skillmapignore";
27904
28014
  function readPatterns(cwd) {
27905
- const path = resolve39(cwd, IGNORE_FILENAME2);
28015
+ const path = resolve40(cwd, IGNORE_FILENAME2);
27906
28016
  if (!existsSync28(path)) return [];
27907
28017
  let raw;
27908
28018
  try {
@@ -27913,7 +28023,7 @@ function readPatterns(cwd) {
27913
28023
  return raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
27914
28024
  }
27915
28025
  function writePatterns(cwd, nextPatterns) {
27916
- const path = resolve39(cwd, IGNORE_FILENAME2);
28026
+ const path = resolve40(cwd, IGNORE_FILENAME2);
27917
28027
  const prior = existsSync28(path) ? safeRead(path) : "";
27918
28028
  const content = buildContent(prior, nextPatterns);
27919
28029
  writeFileSync2(path, content, "utf8");
@@ -28301,6 +28411,15 @@ function registerActiveProviderRoute(app, deps) {
28301
28411
  });
28302
28412
  app.patch("/api/active-provider", async (c) => {
28303
28413
  const body = await parsePatchBody5(c.req.raw);
28414
+ const selectable = await resolveSelectableProviders(deps);
28415
+ if (!selectable.includes(body.activeProvider)) {
28416
+ throw new HTTPException14(400, {
28417
+ message: tx(SERVER_TEXTS.activeProviderNotSelectable, {
28418
+ id: body.activeProvider,
28419
+ selectable: selectable.join(", ")
28420
+ })
28421
+ });
28422
+ }
28304
28423
  const result = applyLensSwitch(deps, body.activeProvider);
28305
28424
  deps.configService.reload();
28306
28425
  return c.json({ ...await buildEnvelope4(deps), switch: result });
@@ -28323,7 +28442,7 @@ async function resolveSelectableProviders(deps) {
28323
28442
  });
28324
28443
  const selectable = /* @__PURE__ */ new Set();
28325
28444
  for (const provider of deps.providers) {
28326
- if (isPluginExtensionEnabled(provider, resolveEnabled)) {
28445
+ if (provider.gatedByActiveLens === true && isPluginExtensionEnabled(provider, resolveEnabled)) {
28327
28446
  selectable.add(provider.id);
28328
28447
  }
28329
28448
  }
@@ -28371,7 +28490,7 @@ var parsePatchBody5 = makeBodyValidator(PATCH_BODY_SCHEMA4, {
28371
28490
 
28372
28491
  // server/routes/actions.ts
28373
28492
  import { HTTPException as HTTPException16 } from "hono/http-exception";
28374
- import { resolve as resolve40 } from "path";
28493
+ import { resolve as resolve41 } from "path";
28375
28494
 
28376
28495
  // server/routes/node-loader.ts
28377
28496
  import { HTTPException as HTTPException15 } from "hono/http-exception";
@@ -28431,7 +28550,7 @@ function registerActionsRoutes(app, deps) {
28431
28550
  let absPath;
28432
28551
  try {
28433
28552
  assertContained(deps.runtimeContext.cwd, node.path);
28434
- absPath = resolve40(deps.runtimeContext.cwd, node.path);
28553
+ absPath = resolve41(deps.runtimeContext.cwd, node.path);
28435
28554
  } catch (err) {
28436
28555
  throw new HTTPException16(400, { message: formatErrorMessage(err) });
28437
28556
  }
@@ -28539,14 +28658,14 @@ async function withScanMutex(fn) {
28539
28658
  if (inFlight !== null) {
28540
28659
  throw new ScanBusyError();
28541
28660
  }
28542
- let resolve44;
28661
+ let resolve45;
28543
28662
  inFlight = new Promise((r) => {
28544
- resolve44 = r;
28663
+ resolve45 = r;
28545
28664
  });
28546
28665
  try {
28547
28666
  return await fn();
28548
28667
  } finally {
28549
- resolve44();
28668
+ resolve45();
28550
28669
  inFlight = null;
28551
28670
  }
28552
28671
  }
@@ -29653,6 +29772,22 @@ function buildKindRegistry(providers) {
29653
29772
  }
29654
29773
 
29655
29774
  // server/provider-registry.ts
29775
+ function presentationOptionals(ui) {
29776
+ const out = {};
29777
+ if (ui.colorDark !== void 0) out.colorDark = ui.colorDark;
29778
+ if (ui.emoji !== void 0) out.emoji = ui.emoji;
29779
+ if (ui.icon !== void 0) out.icon = ui.icon;
29780
+ if (ui.hideChip !== void 0) out.hideChip = ui.hideChip;
29781
+ return out;
29782
+ }
29783
+ function resolveProviderBodyField(read) {
29784
+ if (read === void 0) return void 0;
29785
+ const rules = Array.isArray(read) ? read : [read];
29786
+ for (const rule of rules) {
29787
+ if (rule.bodyField !== void 0) return rule.bodyField;
29788
+ }
29789
+ return void 0;
29790
+ }
29656
29791
  function buildProviderRegistry(providers) {
29657
29792
  const registry = {};
29658
29793
  for (const provider of providers) {
@@ -29660,12 +29795,14 @@ function buildProviderRegistry(providers) {
29660
29795
  if (!ui) continue;
29661
29796
  const entry = {
29662
29797
  label: ui.label,
29663
- color: ui.color
29798
+ color: ui.color,
29799
+ // A Provider is a selectable lens iff it gates on the active lens;
29800
+ // the non-gated `markdown` base projects `isLens: false`.
29801
+ isLens: provider.gatedByActiveLens === true,
29802
+ ...presentationOptionals(ui)
29664
29803
  };
29665
- if (ui.colorDark !== void 0) entry.colorDark = ui.colorDark;
29666
- if (ui.emoji !== void 0) entry.emoji = ui.emoji;
29667
- if (ui.icon !== void 0) entry.icon = ui.icon;
29668
- if (ui.hideChip !== void 0) entry.hideChip = ui.hideChip;
29804
+ const bodyField = resolveProviderBodyField(provider.read);
29805
+ if (bodyField !== void 0) entry.bodyField = bodyField;
29669
29806
  registry[provider.id] = entry;
29670
29807
  }
29671
29808
  return registry;
@@ -29844,7 +29981,7 @@ function validateNoUi(noUi, uiDist) {
29844
29981
 
29845
29982
  // server/paths.ts
29846
29983
  import { existsSync as existsSync31, statSync as statSync11 } from "fs";
29847
- import { dirname as dirname20, isAbsolute as isAbsolute15, join as join20, resolve as resolve41 } from "path";
29984
+ import { dirname as dirname20, isAbsolute as isAbsolute15, join as join20, resolve as resolve42 } from "path";
29848
29985
  import { fileURLToPath as fileURLToPath7 } from "url";
29849
29986
  var DEFAULT_UI_REL = join20("ui", "dist", "ui", "browser");
29850
29987
  var PACKAGE_UI_REL = "ui";
@@ -29855,7 +29992,7 @@ function resolveDefaultUiDist(ctx) {
29855
29992
  return walkUpForUi(ctx.cwd);
29856
29993
  }
29857
29994
  function resolveExplicitUiDist(ctx, raw) {
29858
- return isAbsolute15(raw) ? raw : resolve41(ctx.cwd, raw);
29995
+ return isAbsolute15(raw) ? raw : resolve42(ctx.cwd, raw);
29859
29996
  }
29860
29997
  function isUiBundleDir(path) {
29861
29998
  if (!existsSync31(path)) return false;
@@ -29889,7 +30026,7 @@ function resolvePackageBundledUiFrom(here) {
29889
30026
  return null;
29890
30027
  }
29891
30028
  function walkUpForUi(startDir) {
29892
- let current = resolve41(startDir);
30029
+ let current = resolve42(startDir);
29893
30030
  for (let i = 0; i < 64; i++) {
29894
30031
  const candidate = join20(current, DEFAULT_UI_REL);
29895
30032
  if (isUiBundleDir(candidate)) return candidate;
@@ -30943,7 +31080,7 @@ function rankConfidenceForGrouping(c) {
30943
31080
 
30944
31081
  // cli/commands/sidecar.ts
30945
31082
  import { unlink as unlink3 } from "fs/promises";
30946
- import { resolve as resolve42 } from "path";
31083
+ import { resolve as resolve43 } from "path";
30947
31084
  import { Command as Command37, Option as Option35 } from "clipanion";
30948
31085
 
30949
31086
  // cli/i18n/sidecar.texts.ts
@@ -31101,7 +31238,7 @@ var SidecarRefreshCommand = class extends SmCommand {
31101
31238
  let absPath;
31102
31239
  try {
31103
31240
  assertContained(ctx.cwd, node.path);
31104
- absPath = resolve42(ctx.cwd, node.path);
31241
+ absPath = resolve43(ctx.cwd, node.path);
31105
31242
  } catch (err) {
31106
31243
  this.printer.error(
31107
31244
  tx(SIDECAR_TEXTS.refreshFailed, { glyph: errGlyph, message: formatErrorMessage(err) })
@@ -31385,7 +31522,7 @@ var SidecarAnnotateCommand = class extends SmCommand {
31385
31522
  let absPath;
31386
31523
  try {
31387
31524
  assertContained(ctx.cwd, node.path);
31388
- absPath = resolve42(ctx.cwd, node.path);
31525
+ absPath = resolve43(ctx.cwd, node.path);
31389
31526
  } catch (err) {
31390
31527
  this.printer.error(
31391
31528
  tx(SIDECAR_TEXTS.annotateFailed, { glyph: errGlyph, message: formatErrorMessage(err) })
@@ -31637,7 +31774,7 @@ var STUB_COMMANDS = [
31637
31774
 
31638
31775
  // cli/commands/tutorial.ts
31639
31776
  import { cpSync as cpSync3, existsSync as existsSync33, mkdirSync as mkdirSync6, rmSync as rmSync2, statSync as statSync12 } from "fs";
31640
- import { dirname as dirname21, join as join21, resolve as resolve43 } from "path";
31777
+ import { dirname as dirname21, join as join21, resolve as resolve44 } from "path";
31641
31778
  import { createInterface as createInterface6 } from "readline";
31642
31779
  import { fileURLToPath as fileURLToPath8 } from "url";
31643
31780
  import { Command as Command39, Option as Option37 } from "clipanion";
@@ -31716,10 +31853,10 @@ var TutorialCommand = class extends SmCommand {
31716
31853
  overwrite the target directory unless --force is passed. Takes no
31717
31854
  positional argument.
31718
31855
 
31719
- By default only ready providers are offered as destinations. Pass
31720
- --experimental to also offer experimental ones (e.g. agent-skills);
31721
- they ship disabled, so enable the chosen one with
31722
- \`sm plugins enable <id>\` before scanning under its lens.
31856
+ By default only stable / beta providers are offered as destinations
31857
+ (today claude and the open-standard agent-skills). Pass --experimental
31858
+ to also offer experimental ones; they ship disabled, so enable the
31859
+ chosen one with \`sm plugins enable <id>\` before scanning under its lens.
31723
31860
  `,
31724
31861
  examples: [
31725
31862
  ["Materialize the tutorial skill in the cwd", "$0 tutorial"],
@@ -31743,7 +31880,7 @@ var TutorialCommand = class extends SmCommand {
31743
31880
  description: "Overwrite an existing target directory without prompting."
31744
31881
  });
31745
31882
  experimental = Option37.Boolean("--experimental", false, {
31746
- description: "Offer experimental providers (e.g. agent-skills) as destinations. They ship disabled; enable the chosen one with `sm plugins enable <id>`."
31883
+ description: "Offer experimental providers as destinations. They ship disabled; enable the chosen one with `sm plugins enable <id>`."
31747
31884
  });
31748
31885
  async run() {
31749
31886
  const ctx = defaultRuntimeContext();
@@ -31952,11 +32089,11 @@ function resolveSkillSourceDir() {
31952
32089
  const here = dirname21(fileURLToPath8(import.meta.url));
31953
32090
  const candidates = [
31954
32091
  // dev: src/cli/commands/ → repo-root .claude/skills/sm-tutorial/
31955
- resolve43(here, "../../..", SKILL_SOURCE_DIR),
32092
+ resolve44(here, "../../..", SKILL_SOURCE_DIR),
31956
32093
  // bundled: dist/cli.js → dist/cli/tutorial/sm-tutorial (sibling)
31957
- resolve43(here, "cli/tutorial", SKILL_SLUG),
32094
+ resolve44(here, "cli/tutorial", SKILL_SLUG),
31958
32095
  // bundled fallback: any-depth → cli/tutorial/sm-tutorial
31959
- resolve43(here, "../cli/tutorial", SKILL_SLUG)
32096
+ resolve44(here, "../cli/tutorial", SKILL_SLUG)
31960
32097
  ];
31961
32098
  for (const candidate of candidates) {
31962
32099
  if (existsSync33(candidate) && statSync12(candidate).isDirectory()) {
@@ -32202,4 +32339,4 @@ function resolveBareDefault() {
32202
32339
  process.exit(ExitCode.Error);
32203
32340
  }
32204
32341
  //# sourceMappingURL=cli.js.map
32205
- //# debugId=ef7d5528-7273-5d01-b514-635331ee2072
32342
+ //# debugId=4ec5542f-63ef-5e2c-ab32-58a6c8be5dec