ntn-skills 2.2.0 → 2.4.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/README.md CHANGED
@@ -158,11 +158,31 @@ Created automatically by `ntn-skills init --root <blank-page-url>`:
158
158
  | Table | Purpose | Key Properties |
159
159
  | :--- | :--- | :--- |
160
160
  | **`Sources`** | Upstream & private Git skill repositories | `Name`, `Repo URL`, `Ref`, `Pinned Commit`, `Policy` (`track \| pinned \| manual`), `Enabled`, `Last Checked`, `Skills` |
161
- | **`Skills`** | Master catalog, 3-tier routing & `SKILL.md` body | `Name`, `Description`, `Enabled`, `Visibility` (`always \| discoverable \| manual`), `Kind` (`skill \| router \| prompt`), `Profiles`, `Scenes`, `Requires`, `Origin`, `Source Path`, `Custom Main`, `Revision`, `Preview Hash`, `Status`, `Supporting Files` |
161
+ | **`Skills`** | Master catalog, 3-tier routing, zero-fork customization & `SKILL.md` body | `Name` (lowercase `a-b-c` slug), `Description`, `Enabled`, `Visibility` (`always \| discoverable \| manual`), `Kind` (`skill \| router \| prompt`), `Profiles`, `Scenes`, `Requires`, `Origin`, `Source Path`, `Custom Main`, `Custom Description`, `Local Patch`, `Status` (`active \| draft \| retired`), `Revision`, `Preview Hash`, `Supporting Files` |
162
162
  | **`Files`** | Draft supporting files & upstream diff overlays | `Name`, `Skill`, `Path`, `Status` (`override \| delete`), `Executable`, `SHA256`, `External URL`, `Attachment` |
163
163
 
164
164
  > **Subtree-Hash Pruning & Zero Redundancy**: Unmodified upstream skills store **0 rows** in `Files` (an auto-maintained read-only `Upstream Files` child page at row 1 of each Skill page shows the upstream file tree). When a multi-skill upstream repo gets a new commit, untouched sibling skills incur **0 Notion writes** and keep a stable `effectiveRev`.
165
165
 
166
+ ### How Notion Fields & Local `config.json` Work Together
167
+
168
+ Notion owns **logical intent**, while each machine's `~/.config/ntn-skills/config.json` owns **physical host mounts**:
169
+
170
+ 1. **`Visibility` × `Profiles` × `Scenes` (Three Orthogonal Axes)**
171
+ - **`Visibility` (Context budget)**: `always` exports directly into default agent skill folders; `discoverable` pre-materializes under `by-name/` behind an $O(1)$ constant-size index (`skill-catalog` or `skill_find`); `manual` stays indexed only until explicitly loaded via `$skill` or `load`.
172
+ - **`Profiles` (Where a skill lands — machine, agent, or org boundary)**: Intersects `Skills.Profiles` (empty defaults to `["default"]`) with top-level `config.profiles` and per-target `exports[i].profiles`.
173
+ - *Machine-bound skills*: Tag desktop-only tools (e.g. `ego-browser`) with `["pro"]` and include `"pro"` only in that machine's `config.json`—headless workers never see them.
174
+ - *Agent-specific skills*: Export shared skills (`["default"]`) to `~/.agents/skills`, and target host-specific skills (`["claude"]`, `["cursor"]`) via per-directory `exports` rules (`profiles`, `skills`, or `exclude`).
175
+ - *Workspace isolation*: Isolate work/internal skills under `["company"]` to keep your personal `default` plane clean.
176
+ - **`Scenes` (What task topic it serves)**: Cross-machine topic tags (`coding`, `ops`, `design`, `research`) used strictly for on-demand discovery.
177
+ 2. **Zero-Fork Upstream Customization (3 Tiers)**
178
+ - **Tier ① Lock routing boundaries (`Custom Description`)**: Upstream skills often ship overly broad *"MUST USE"* descriptions that collide on a shared plane. Setting `Custom Description = true` (or `ntn-skills set <name> --description "..."`) keeps your tailored routing description intact across `upstream apply` updates while continuing to track upstream `SKILL.md` body changes.
179
+ - **Tier ② Declarative materialization hooks (`Local Patch`)**: Adapt upstream `SKILL.md` content during local materialization without setting `Custom Main = true` (included in `effectiveRev`):
180
+ - `@replace "Cursor" => "your coding agent"`: Replaces prose terms while **automatically skipping fenced code blocks and inline backticks** so real CLI binary names stay intact (use `@replace-all` to include code spans);
181
+ - `@prepend` / `@append`: Inject local credential/proxy rules at the top or workflow notes at the bottom (plain text without `@` directives defaults to `@prepend`).
182
+ - **Tier ③ File overlays & full body takeover (`Files` Overlay / `Custom Main`)**: Use `edit -> push` for supporting-file `override | delete` rows, reserving `Custom Main = true` only when replacing the entire `SKILL.md`.
183
+ 3. **Pausing vs. Soft Archiving (`Enabled` vs. `Status = retired`)**
184
+ - Uncheck `Enabled` to pause temporarily; run `ntn-skills rm <name>` (`Enabled = false`, `Visibility = manual`, `Status = retired`) to soft-archive obsolete skills—withdrawing local links across all machines while preserving Notion history (filter Notion views by `Status != retired`).
185
+
166
186
  ---
167
187
 
168
188
  ## CLI Reference
@@ -209,7 +229,8 @@ ntn-skills abort "$WORKDIR"
209
229
  ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual] [--profiles default] [--scenes ops] [--adopt | --no-adopt] [--dry-run] [--json]
210
230
  ntn-skills set [<name...>] [--source <source-name>] \
211
231
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
212
- [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
232
+ [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--rm-profile <p>] [--add-scene <s>] [--rm-scene <s>] [--require <dep>] \
233
+ [--description <text> | --reset-description] [--patch <rules> | --clear-patch]
213
234
 
214
235
  # Graduate draft or overlay back to Git, or revert overlays
215
236
  ntn-skills pull <name> <git-repo-skill-dir> --clean
package/README.zh-CN.md CHANGED
@@ -159,11 +159,31 @@ flowchart LR
159
159
  | 数据表 | 职责 | 核心字段 |
160
160
  | :--- | :--- | :--- |
161
161
  | **`Sources`** | 管理外部上游与自有私有 Git 仓库 | `Name`、`Repo URL`、`Ref`、`Pinned Commit`、`Policy` (`track \| pinned \| manual`)、`Enabled`、`Last Checked`、`Skills` |
162
- | **`Skills`** | 技能总目录、三档可见性路由与 `SKILL.md` 正文 | `Name`、`Description`、`Enabled`、`Visibility` (`always \| discoverable \| manual`)、`Kind` (`skill \| router \| prompt`)、`Profiles`、`Scenes`、`Requires`、`Origin`、`Source Path`、`Custom Main`、`Revision`、`Preview Hash`、`Status`、`Supporting Files` |
162
+ | **`Skills`** | 技能总目录、三档可见性路由、本地无分叉定制与 `SKILL.md` 正文 | `Name`(规范小写 `a-b-c` slug)、`Description`、`Enabled`、`Visibility` (`always \| discoverable \| manual`)、`Kind` (`skill \| router \| prompt`)、`Profiles`、`Scenes`、`Requires`、`Origin`、`Source Path`、`Custom Main`、`Custom Description`、`Local Patch`、`Status` (`active \| draft \| retired`)、`Revision`、`Preview Hash`、`Supporting Files` |
163
163
  | **`Files`** | 自有技能附属文件与上游技能差异补丁 | `Name`、`Skill`、`Path`、`Status` (`override \| delete`)、`Executable`、`SHA256`、`External URL`、`Attachment` |
164
164
 
165
165
  > **子树哈希剪枝与零冗余**:未改动的上游技能在 `Files` 表中占 **0 行**(上游文件清单自动展示在技能页第 1 行的只读子页 `Upstream Files` 中)。当多技能上游仓库有新提交时,未改动的同仓其他技能触发 **0 次 Notion 写入**,本地 `effectiveRev` 保持稳定不重物化。
166
166
 
167
+ ### 字段与本机 `config.json` 协同心智(怎么配不打架、不膨胀)
168
+
169
+ Notion 控制面只声明**「逻辑属性」**,每台机器的 `~/.config/ntn-skills/config.json` 只声明**「本机物理挂载」**,二者通过正交组合覆盖多机器、多宿主与外部上游共存场景:
170
+
171
+ 1. **`Visibility` × `Profiles` × `Scenes` 三维分工(切忌混用)**
172
+ - **`Visibility`(何时占用上下文)**:`always` 直接挂入宿主默认目录(每轮对话可见,建议精选高频底座);`discoverable` 本地预物化到 `by-name/`,日常仅占 `skill-catalog` 或 `skill_find` 的 $O(1)$ 常数索引,绝不随库规模膨胀;`manual` 仅留索引,显式 `$skill` 或 `load` 时才拉取。
173
+ - **`Profiles`(投递给哪台机器 / 哪个宿主 / 哪个组织边界)**:`Skills.Profiles` 多选标签(空值视为 `["default"]`)与本机 `config.json` 的顶层 `profiles` 及单个 `exports[i].profiles` 取交集。
174
+ - *跟机器走*:例如桌面浏览器 `ego-browser` 仅安装在主力机 `pro`,将其 `Profiles` 设为 `["pro"]`,仅在 `pro` 的 `config.json` 声明 `"profiles": ["default", "pro"]`,纯 Worker 机器则完全看不见它。
175
+ - *跟宿主走*:公共目录 `~/.agents/skills` 放 `["default"]` 公约数;特定 Coding Agent 独享技能(如 `claude`、`cursor`)通过对应私有导出目录(如 `~/.claude/skills`)的 `profiles` / `skills` / `exclude` 精准投递。
176
+ - *公私隔离*:公司内部部署/监控技能设为 `["company"]`,与个人日常 `default` 平面天然隔离。
177
+ - **`Scenes`(做什么任务时被检索)**:如 `coding`、`ops`、`design`、`research`,跨机器通用,专供 Agent 按任务主题检索 `discoverable` / `manual` 技能。
178
+ 2. **外部上游技能「无分叉定制」三阶梯(既持续跟进上游更新,又在同一平面守规矩)**
179
+ - **阶梯 ① 锁选路边界(`Custom Description`)**:第三方上游常在 `description` 中写满 `MUST USE` 抢夺调用权。勾选 `Custom Description`(或运行 `ntn-skills set <name> --description "..."`)后,`upstream apply` 在自动拉取上游最新 `SKILL.md` 正文与脚本时**绝不覆盖你的本地 `Description`**。
180
+ - **阶梯 ② 轻量物化钩子(`Local Patch`)**:无需勾选 `Custom Main` 硬分叉全文,直接在 Notion 的 `Local Patch` 文本列(或 `--patch`)填写声明式物化指令,每次本地合成 `SKILL.md` 时自动套用(纳入 `effectiveRev`):
181
+ - `@replace "Cursor" => "your coding agent"`:替换说明文本中的宿主绑定词(**默认自动跳过代码块与行内反引号命令**,防止误伤真实 CLI 命令名;需连同代码块替换时用 `@replace-all`);
182
+ - `@prepend` / `@append`:在正文顶部置入本机凭据/代理红线,或在底部追加联动说明(未写 `@` 指令的纯文本默认按 `@prepend` 置顶)。
183
+ - **阶梯 ③ 文件级覆盖与全文接管(`Files` Overlay / `Custom Main`)**:需替换/屏蔽附属脚本时走 `edit -> push` 写入 `Files` 表 `override | delete`;仅当需彻底重写整篇 `SKILL.md` 时才启用 `Custom Main = true`。
184
+ 3. **停用与软归档(`Enabled` vs `Status = retired`)**
185
+ - 临时调试停用仅取消勾选 `Enabled`;早期不再使用的历史技能运行 `ntn-skills rm <name>`(自动置 `Enabled = false`、`Visibility = manual`、`Status = retired` 并撤回全机软链),Notion 页面完整保留备查,网页主视图过滤 `Status != retired` 即可保持清爽。
186
+
167
187
  ---
168
188
 
169
189
  ## 命令速查
@@ -210,7 +230,8 @@ ntn-skills abort "$WORKDIR"
210
230
  ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual] [--profiles default] [--scenes ops] [--adopt | --no-adopt] [--dry-run] [--json]
211
231
  ntn-skills set [<name...>] [--source <source-name>] \
212
232
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
213
- [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
233
+ [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--rm-profile <p>] [--add-scene <s>] [--rm-scene <s>] [--require <dep>] \
234
+ [--description <text> | --reset-description] [--patch <rules> | --clear-patch]
214
235
 
215
236
  # 导出干净源码入仓、草稿毕业挂源、解绑、回退补丁与软退役
216
237
  ntn-skills pull <name> <git-repo-skill-dir> --clean
@@ -123,7 +123,9 @@ ntn-skills set [<name...>] [--source <source-name-or-id>] \
123
123
  [--enable | --disable] \
124
124
  [--add-profile <p>] [--rm-profile <p>] \
125
125
  [--add-scene <s>] [--rm-scene <s>] \
126
- [--require <dep1,dep2>] </dev/null
126
+ [--require <dep1,dep2>] \
127
+ [--description <text> | --reset-description] \
128
+ [--patch <rules> | --clear-patch] </dev/null
127
129
 
128
130
  # 将当前合成后的干净技能源码树(不含 .ntn-skill.json 元数据,自动清理已被删除/改名的旧文件)导出到指定 Git 仓库目录
129
131
  ntn-skills pull <name> <git-repo-skill-dir> --clean </dev/null
@@ -146,7 +148,9 @@ ntn-skills rm <name> </dev/null
146
148
 
147
149
  ### 4.2 三层演进工作流(草稿孵化 -> Overlay 在线调优 -> 沉淀入自有 Git 仓)
148
150
  - **阶段 ① 孵化草稿**:临时想法无需建 Git 分支,直接 `ntn-skills new <dir>` 放入 Notion 缓冲池,通过 `edit -> push` 跨机器快速迭代试跑。
149
- - **阶段 ② 在线打补丁调优(Overlay)**:对任意上游/自有 Git 正式技能跑 `edit -> 修改/新增/删除/重命名附属文件 -> push`(重命名自动表达为旧路径 `delete` + 新路径 `override`;在 Notion 修改 `Skills.Name` / `Description` 可无损定制别名与触发描述)。新开会话即可让 Agent 实测合成态;不理想用 `reset-overlay` 秒退。
151
+ - **阶段 ② 在线打补丁调优(无分叉定制 + Overlay)**:
152
+ - **无分叉上游矫正(首选,保持 `Custom Main = false` 持续自动跟进上游正文更新)**:用 `ntn-skills set <name> --description "..."` 开启 `Custom Description` 锁死本地选路触发边界(不被 `upstream apply` 覆盖);用 `--patch`(或 Notion `Local Patch` 列)声明物化规则:`@replace "from" => "to"`(默认自动跳过代码块与行内反引号命令,全局替换用 `@replace-all`)、`@prepend`(置顶本机红线)、`@append`(追加联动说明)。
153
+ - **文件级覆盖 / 全文接管**:对附属脚本跑 `edit -> 修改/新增/删除 -> push`(写入 `Files` 表 `override | delete`);仅当需整篇接管 `SKILL.md` 时修改主文置 `Custom Main = true`,不理想用 `reset-overlay` 秒退。
150
154
  - **阶段 ③ 定稿沉淀入 Git 仓**:
151
155
  1. 执行 `ntn-skills pull <name> <repo/skills/name> --clean </dev/null` 导出干净源码树到私有 Git 仓库,审查 `git diff` 后 `commit & push`;
152
156
  2. 若原为纯 Notion 草稿:执行 `ntn-skills attach <name> --source <my-repo> </dev/null` 完成无损挂源并清空冗余 `Files` 行;
package/dist/bin.js CHANGED
@@ -59,6 +59,8 @@ var SkillRecordSchema = Schema.Struct({
59
59
  originSourceId: Schema.NullOr(Schema.String),
60
60
  sourcePath: Schema.String,
61
61
  customMain: Schema.Boolean,
62
+ customDescription: Schema.optional(Schema.Boolean),
63
+ localPatch: Schema.optional(Schema.String),
62
64
  revision: Schema.String,
63
65
  previewHash: Schema.String,
64
66
  kind: Schema.Literals(["skill", "router", "prompt"]),
@@ -159,6 +161,8 @@ var CatalogEntrySchema = Schema.Struct({
159
161
  originPinnedCommit: Schema.NullOr(Schema.String),
160
162
  sourcePath: Schema.String,
161
163
  customMain: Schema.Boolean,
164
+ customDescription: Schema.optional(Schema.Boolean),
165
+ localPatch: Schema.optional(Schema.String),
162
166
  revision: Schema.String,
163
167
  previewHash: Schema.String,
164
168
  effectiveRev: Schema.String,
@@ -234,8 +238,27 @@ function normalizeUuid(raw) {
234
238
  function libShortHash(libraryId) {
235
239
  return normalizeUuid(libraryId).replace(/-/g, "").slice(0, 8);
236
240
  }
241
+ var SKILL_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
242
+ function isValidSkillSlug(raw) {
243
+ return SKILL_SLUG_RE.test(raw);
244
+ }
237
245
  function normalizeSkillSlug(raw) {
238
- return raw.trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
246
+ return raw.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
247
+ }
248
+ function resolveCanonicalSkillName(preferred, fallback) {
249
+ const pref = (preferred ?? "").trim();
250
+ if (pref && isValidSkillSlug(pref))
251
+ return pref;
252
+ const isAsciiOnly = pref.length > 0 && /^[\x20-\x7E]+$/.test(pref);
253
+ if (isAsciiOnly) {
254
+ const prefSlug = normalizeSkillSlug(pref);
255
+ if (prefSlug)
256
+ return prefSlug;
257
+ }
258
+ const fbSlug = normalizeSkillSlug(fallback ?? "");
259
+ if (fbSlug)
260
+ return fbSlug;
261
+ return normalizeSkillSlug(pref);
239
262
  }
240
263
  function computeOverlapWindowIso(watermarkIso, overlapMs = 120000) {
241
264
  const ms = Date.parse(watermarkIso);
@@ -346,27 +369,133 @@ function parseSkillFrontmatter(markdown) {
346
369
  hasFrontmatter: true
347
370
  };
348
371
  }
349
- function applyAuthoritativeFrontmatter(rawMarkdown, authoritativeName, authoritativeDescription) {
372
+ function parseReplaceSpec(spec) {
373
+ const quotedMatch = spec.match(/^(?:"((?:\\.|[^"\\])*)"|'((?:''|[^'])*)')\s*=>\s*(?:"((?:\\.|[^"\\])*)"|'((?:''|[^'])*)')$/);
374
+ if (quotedMatch) {
375
+ const from = quotedMatch[1] !== undefined ? unquoteYamlScalar(`"${quotedMatch[1]}"`) : unquoteYamlScalar(`'${quotedMatch[2] ?? ""}'`);
376
+ const to = quotedMatch[3] !== undefined ? unquoteYamlScalar(`"${quotedMatch[3]}"`) : unquoteYamlScalar(`'${quotedMatch[4] ?? ""}'`);
377
+ return from.length > 0 ? { from, to } : null;
378
+ }
379
+ const arrowIdx = spec.indexOf("=>");
380
+ if (arrowIdx <= 0)
381
+ return null;
382
+ const from = unquoteYamlScalar(spec.slice(0, arrowIdx).trim());
383
+ const to = unquoteYamlScalar(spec.slice(arrowIdx + 2).trim());
384
+ return from.length > 0 ? { from, to } : null;
385
+ }
386
+ function parseLocalPatch(rawPatch) {
387
+ const normalized = (rawPatch ?? "").replace(/\r\n/g, `
388
+ `).trim();
389
+ if (!normalized)
390
+ return { replaces: [], prepends: [], appends: [] };
391
+ const replaces = [];
392
+ const prepends = [];
393
+ const appends = [];
394
+ let section = "prepend";
395
+ let buffer = [];
396
+ const flushBuffer = () => {
397
+ const text = buffer.join(`
398
+ `).trim();
399
+ if (text.length > 0) {
400
+ if (section === "prepend")
401
+ prepends.push(text);
402
+ else
403
+ appends.push(text);
404
+ }
405
+ buffer = [];
406
+ };
407
+ for (const line of normalized.split(`
408
+ `)) {
409
+ const trimmed = line.trim();
410
+ if (buffer.length === 0 && trimmed.startsWith("//"))
411
+ continue;
412
+ if (/^@prepend\s*$/i.test(trimmed)) {
413
+ flushBuffer();
414
+ section = "prepend";
415
+ continue;
416
+ }
417
+ if (/^@append\s*$/i.test(trimmed)) {
418
+ flushBuffer();
419
+ section = "append";
420
+ continue;
421
+ }
422
+ const repAll = trimmed.match(/^@replace-all\s+(.+)$/i);
423
+ if (repAll) {
424
+ flushBuffer();
425
+ const parsed = parseReplaceSpec(repAll[1].trim());
426
+ if (parsed)
427
+ replaces.push({ ...parsed, codeSafe: false });
428
+ continue;
429
+ }
430
+ const repSafe = trimmed.match(/^@replace\s+(.+)$/i);
431
+ if (repSafe) {
432
+ flushBuffer();
433
+ const parsed = parseReplaceSpec(repSafe[1].trim());
434
+ if (parsed)
435
+ replaces.push({ ...parsed, codeSafe: true });
436
+ continue;
437
+ }
438
+ buffer.push(line);
439
+ }
440
+ flushBuffer();
441
+ return { replaces, prepends, appends };
442
+ }
443
+ function replaceOutsideCodeSpans(text, from, to) {
444
+ const parts = text.split(/(```[\s\S]*?```|`[^`\n]+`)/g);
445
+ return parts.map((part, idx) => idx % 2 === 0 ? part.split(from).join(to) : part).join("");
446
+ }
447
+ function applyLocalPatch(markdownBody, rawPatch) {
448
+ const parsed = parseLocalPatch(rawPatch);
449
+ if (parsed.replaces.length === 0 && parsed.prepends.length === 0 && parsed.appends.length === 0) {
450
+ return markdownBody;
451
+ }
452
+ let out = markdownBody;
453
+ for (const r of parsed.replaces) {
454
+ out = r.codeSafe ? replaceOutsideCodeSpans(out, r.from, r.to) : out.split(r.from).join(r.to);
455
+ }
456
+ const blocks = [];
457
+ if (parsed.prepends.length > 0)
458
+ blocks.push(parsed.prepends.join(`
459
+
460
+ `));
461
+ const cleanCore = out.replace(/^\n+/, "").replace(/\s+$/, "");
462
+ if (cleanCore.length > 0)
463
+ blocks.push(cleanCore);
464
+ if (parsed.appends.length > 0)
465
+ blocks.push(parsed.appends.join(`
466
+
467
+ `));
468
+ return blocks.join(`
469
+
470
+ `);
471
+ }
472
+ function applyAuthoritativeFrontmatter(rawMarkdown, authoritativeName, authoritativeDescription, requiresPaths, localPatch) {
350
473
  const parsed = parseSkillFrontmatter(rawMarkdown);
474
+ const canonicalName = normalizeSkillSlug(authoritativeName) || authoritativeName.trim();
351
475
  const headerLines = [
352
476
  "---",
353
- `name: ${JSON.stringify(authoritativeName)}`,
477
+ `name: ${JSON.stringify(canonicalName)}`,
354
478
  `description: ${JSON.stringify(authoritativeDescription)}`,
355
479
  ...parsed.extraLines,
356
480
  "---"
357
481
  ];
358
- const cleanBody = parsed.body.replace(/^\n+/, "").replace(/\s+$/, "");
482
+ const reqPairs = Object.entries(requiresPaths ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}=${v}`);
483
+ const reqLine = reqPairs.length > 0 ? `
484
+ Requires: ${reqPairs.join(", ")}
485
+ ` : "";
486
+ const patchedBody = applyLocalPatch(parsed.body, localPatch);
487
+ const cleanBody = patchedBody.replace(/^\n+/, "").replace(/\s+$/, "");
359
488
  return cleanBody.length > 0 ? `${headerLines.join(`
360
- `)}
361
-
489
+ `)}${reqLine}
362
490
  ${cleanBody}
363
491
  ` : `${headerLines.join(`
364
- `)}
492
+ `)}${reqLine}
365
493
  `;
366
494
  }
367
495
  function computeEffectiveRev(input) {
368
496
  const sortedOverlays = [...input.overlays].sort((a, b) => a.path.localeCompare(b.path));
369
497
  const sortedRequires = [...input.requiresRevs].sort((a, b) => a.skillId.localeCompare(b.skillId));
498
+ const trimmedPatch = (input.localPatch ?? "").trim();
370
499
  const canonical = JSON.stringify({
371
500
  v: 2,
372
501
  commit: input.originPinnedCommit ?? null,
@@ -374,6 +503,7 @@ function computeEffectiveRev(input) {
374
503
  customMain: input.customMain,
375
504
  name: input.name,
376
505
  description: input.description,
506
+ ...trimmedPatch ? { localPatch: trimmedPatch } : {},
377
507
  main: input.mainContentIdentity,
378
508
  overlays: sortedOverlays,
379
509
  requires: sortedRequires
@@ -677,9 +807,25 @@ function sanitizeSceneSlug(raw) {
677
807
  const slug = raw.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
678
808
  return slug || "general";
679
809
  }
810
+ function summarizeCatalogDescription(raw, maxChars = 140) {
811
+ const flat = raw.replace(/\s+/g, " ").trim();
812
+ if (!flat)
813
+ return "(no description)";
814
+ if (flat.length <= maxChars)
815
+ return flat;
816
+ const window = flat.slice(0, maxChars);
817
+ const sentenceEnd = window.search(/(?:\.\s+|。\s*|;\s*)/);
818
+ if (sentenceEnd >= 24 && sentenceEnd <= maxChars - 1) {
819
+ const endChar = window[sentenceEnd];
820
+ const cut = endChar === "." ? sentenceEnd + 1 : sentenceEnd + 1;
821
+ return window.slice(0, cut).trim();
822
+ }
823
+ return `${flat.slice(0, maxChars - 3).trimEnd()}...`;
824
+ }
680
825
  function synthesizeSkillCatalogPackage(args) {
681
826
  const enc = new TextEncoder;
682
827
  const normalizedByNameRoot = args.byNameRoot?.trim().replace(/\/+$/, "");
828
+ const cliCmd = args.cliCommand?.trim() || "ntn-skills";
683
829
  const sorted = [...args.discoverableEntries].sort((a, b) => {
684
830
  if (a.kind === "router" && b.kind !== "router")
685
831
  return -1;
@@ -688,12 +834,16 @@ function synthesizeSkillCatalogPackage(args) {
688
834
  return a.name.localeCompare(b.name);
689
835
  });
690
836
  const formatEntryBullet = (e) => {
691
- const reqNames = e.requiresIds.map((id) => args.allEntriesById.get(id)?.name).filter((n) => Boolean(n));
837
+ const slug = normalizeSkillSlug(e.name) || e.name;
838
+ const reqNames = e.requiresIds.map((id) => {
839
+ const n = args.allEntriesById.get(id)?.name;
840
+ return n ? normalizeSkillSlug(n) || n : undefined;
841
+ }).filter((n) => Boolean(n));
692
842
  const kindBadge = e.kind === "router" ? " `[strategy-router]`" : "";
693
- const desc = e.description.replace(/\s+/g, " ").trim() || "(no description)";
843
+ const desc = summarizeCatalogDescription(e.description, 140);
694
844
  const reqSuffix = reqNames.length > 0 ? ` *(requires: ${reqNames.join(", ")})*` : "";
695
- const unmaterializedSuffix = !e.materializedPath ? ` *(load via \`ntn-skills load "${e.name}" --path-only </dev/null\`)*` : "";
696
- return `- **${e.name}**${kindBadge}: ${desc}${reqSuffix}${unmaterializedSuffix}`;
845
+ const unmaterializedSuffix = !e.materializedPath ? ` *(load via \`${cliCmd} load "${slug}" --path-only </dev/null\`)*` : "";
846
+ return `- **${slug}**${kindBadge}: ${desc}${reqSuffix}${unmaterializedSuffix}`;
697
847
  };
698
848
  const groups = new Map;
699
849
  for (const e of sorted) {
@@ -713,12 +863,12 @@ function synthesizeSkillCatalogPackage(args) {
713
863
  });
714
864
  const files = [];
715
865
  const groupSummaryLines = [];
716
- const sceneLoadLine = normalizedByNameRoot ? `Load a skill by reading \`${normalizedByNameRoot}/<name>/SKILL.md\`.` : 'Load a skill via `ntn-skills load "<name>" --path-only </dev/null` then read `<dir>/SKILL.md`.';
866
+ const sceneLoadLine = normalizedByNameRoot ? `Load a skill by reading \`${normalizedByNameRoot}/<name>/SKILL.md\`.` : `Load a skill via \`${cliCmd} load "<name>" --path-only </dev/null\` then read \`<dir>/SKILL.md\`.`;
717
867
  for (const gk of orderedGroupKeys) {
718
868
  const items = groups.get(gk);
719
869
  const relPath = `references/${gk}.md`;
720
870
  const previewCandidates = items.filter((i) => i.kind !== "router");
721
- const sampleNames = previewCandidates.slice(0, 4).map((i) => i.name);
871
+ const sampleNames = previewCandidates.slice(0, 4).map((i) => normalizeSkillSlug(i.name) || i.name);
722
872
  const sampleSuffix = sampleNames.length > 0 ? `: ${sampleNames.join(", ")}${previewCandidates.length > 4 ? "..." : ""}` : "";
723
873
  groupSummaryLines.push(`- \`${relPath}\` (${items.length})${sampleSuffix}`);
724
874
  const refMd = [
@@ -739,15 +889,17 @@ function synthesizeSkillCatalogPackage(args) {
739
889
  const routerSection = strategyRouters.length > 0 ? [
740
890
  "## Strategy Routers",
741
891
  ...strategyRouters.map((e) => {
742
- const desc = e.description.replace(/\s+/g, " ").trim() || "(no description)";
743
- const unmat = !e.materializedPath ? ` (run: ntn-skills load "${e.name}" --path-only </dev/null)` : "";
744
- return `- **${e.name}**: ${desc}${unmat}`;
892
+ const slug = normalizeSkillSlug(e.name) || e.name;
893
+ const desc = summarizeCatalogDescription(e.description, 140);
894
+ const unmat = !e.materializedPath ? ` (run: ${cliCmd} load "${slug}" --path-only </dev/null)` : "";
895
+ return `- **${slug}**: ${desc}${unmat}`;
745
896
  }),
746
897
  ""
747
898
  ] : [];
748
- const topLoadInstruction = normalizedByNameRoot ? `Open the matching scene file below, then read \`${normalizedByNameRoot}/<name>/SKILL.md\`.` : 'Open the matching scene file below, then run `ntn-skills load "<name>" --path-only </dev/null` and read `<dir>/SKILL.md`.';
899
+ const topLoadInstruction = normalizedByNameRoot ? `Open the matching scene file below, then read \`${normalizedByNameRoot}/<name>/SKILL.md\`.` : `Open the matching scene file below, then run \`${cliCmd} load "<name>" --path-only </dev/null\` and read \`<dir>/SKILL.md\`.`;
900
+ const cliSearchInstruction = `To search all skills (including manual skills) or materialize on demand, run \`${cliCmd} find "<query>" </dev/null\` and \`${cliCmd} load "<name>" --path-only </dev/null\`.`;
749
901
  const byNameDescClause = normalizedByNameRoot ? `; skill files live at ${normalizedByNameRoot}/<name>/SKILL.md` : "";
750
- const topDescription = `On-demand index of ${sorted.length} specialized skills by scene (${orderedGroupKeys.join(", ")})${byNameDescClause}. Read ONLY when top-level skills do not cover a specialized workflow/tool in these scenes; skip for routine coding/Q&A, or use skill_find directly if available.`;
902
+ const topDescription = `On-demand index of ${sorted.length} specialized skills by scene${byNameDescClause}. Read ONLY when top-level skills do not cover a specialized workflow or tool; skip for routine coding/Q&A, or use skill_find directly if available.`;
751
903
  const mainMd = [
752
904
  "---",
753
905
  `name: ${JSON.stringify(args.routerName)}`,
@@ -756,6 +908,7 @@ function synthesizeSkillCatalogPackage(args) {
756
908
  "",
757
909
  `# ${args.routerName} (${sorted.length})`,
758
910
  topLoadInstruction,
911
+ cliSearchInstruction,
759
912
  "",
760
913
  ...routerSection,
761
914
  "## Scenes",
@@ -835,13 +988,29 @@ function formatSkillFindResults(args) {
835
988
  };
836
989
  }
837
990
  function formatLoadedSkillBlock(args) {
991
+ const parsed = parseSkillFrontmatter(args.markdown);
992
+ let bodyText = parsed.hasFrontmatter ? parsed.body.replace(/^\n+/, "") : args.markdown;
993
+ let inlineReqLine = "";
994
+ const leadingReqMatch = bodyText.match(/^Requires:\s*([^\n]+)\n+/);
995
+ if (leadingReqMatch) {
996
+ inlineReqLine = leadingReqMatch[1].trim();
997
+ bodyText = bodyText.slice(leadingReqMatch[0].length);
998
+ }
838
999
  const pairs = Object.entries(args.requiresPaths ?? {}).map(([k, v]) => `${k}=${v}`);
839
- const reqLine = pairs.length > 0 ? `
840
- Requires: ${pairs.join(", ")}` : "";
841
- return `<skill name="${args.name}" location="${args.dir}" path="${args.dir}">
1000
+ const mergedReq = pairs.length > 0 ? pairs.join(", ") : inlineReqLine;
1001
+ const reqLine = mergedReq ? `
1002
+ Requires: ${mergedReq}` : "";
1003
+ const extraFrontmatter = parsed.hasFrontmatter && parsed.extraLines.length > 0 ? `---
1004
+ ${parsed.extraLines.join(`
1005
+ `)}
1006
+ ---
1007
+
1008
+ ` : "";
1009
+ const cleanPayload = `${extraFrontmatter}${bodyText.trim()}`.trim();
1010
+ return `<skill name="${args.name}" path="${args.dir}">
842
1011
  References are relative to ${args.dir}.${reqLine}
843
1012
 
844
- ${args.markdown.trim()}
1013
+ ${cleanPayload}
845
1014
  </skill>`;
846
1015
  }
847
1016
  // packages/core/src/notion/markdown-blocks.ts
@@ -2686,6 +2855,8 @@ function decodeSkillPage(page) {
2686
2855
  originSourceId: origins[0] ?? null,
2687
2856
  sourcePath,
2688
2857
  customMain: propCheckbox(p["Custom Main"]),
2858
+ customDescription: propCheckbox(p["Custom Description"]),
2859
+ localPatch: propPlain(p["Local Patch"]).trim(),
2689
2860
  revision: propPlain(p.Revision).trim(),
2690
2861
  previewHash: propPlain(p["Preview Hash"]).trim(),
2691
2862
  kind,
@@ -2874,6 +3045,8 @@ function makeNotionServiceFromTransport(transport) {
2874
3045
  },
2875
3046
  "Source Path": { rich_text: {} },
2876
3047
  "Custom Main": { checkbox: {} },
3048
+ "Custom Description": { checkbox: {} },
3049
+ "Local Patch": { rich_text: {} },
2877
3050
  Revision: { rich_text: {} },
2878
3051
  "Preview Hash": { rich_text: {} },
2879
3052
  Kind: {
@@ -2915,6 +3088,22 @@ function makeNotionServiceFromTransport(transport) {
2915
3088
  }
2916
3089
  }
2917
3090
  });
3091
+ } else {
3092
+ const existingSkillsDs = await transport.requestJson("GET", `/v1/data_sources/${found.skills}`).catch(() => null);
3093
+ if (existingSkillsDs?.properties) {
3094
+ const missingProps = {};
3095
+ if (!existingSkillsDs.properties["Custom Description"]) {
3096
+ missingProps["Custom Description"] = { checkbox: {} };
3097
+ }
3098
+ if (!existingSkillsDs.properties["Local Patch"]) {
3099
+ missingProps["Local Patch"] = { rich_text: {} };
3100
+ }
3101
+ if (Object.keys(missingProps).length > 0) {
3102
+ await transport.requestJson("PATCH", `/v1/data_sources/${found.skills}`, {
3103
+ properties: missingProps
3104
+ });
3105
+ }
3106
+ }
2918
3107
  }
2919
3108
  if (!found.files) {
2920
3109
  const created = await createChildDb("Files", {
@@ -3186,6 +3375,14 @@ function makeNotionServiceFromTransport(transport) {
3186
3375
  }
3187
3376
  if (input.customMain !== undefined)
3188
3377
  props["Custom Main"] = { checkbox: input.customMain };
3378
+ if (input.customDescription !== undefined) {
3379
+ props["Custom Description"] = { checkbox: input.customDescription };
3380
+ }
3381
+ if (input.localPatch !== undefined) {
3382
+ props["Local Patch"] = {
3383
+ rich_text: input.localPatch ? [{ type: "text", text: { content: input.localPatch.slice(0, 1950) } }] : []
3384
+ };
3385
+ }
3189
3386
  if (input.revision !== undefined) {
3190
3387
  props.Revision = {
3191
3388
  rich_text: input.revision ? [{ type: "text", text: { content: input.revision } }] : []
@@ -3225,6 +3422,14 @@ function makeNotionServiceFromTransport(transport) {
3225
3422
  },
3226
3423
  "Source Path": { rich_text: rtPath },
3227
3424
  "Custom Main": { checkbox: input.customMain },
3425
+ ...input.customDescription !== undefined ? { "Custom Description": { checkbox: input.customDescription } } : {},
3426
+ ...input.localPatch ? {
3427
+ "Local Patch": {
3428
+ rich_text: [
3429
+ { type: "text", text: { content: input.localPatch.slice(0, 1950) } }
3430
+ ]
3431
+ }
3432
+ } : {},
3228
3433
  Revision: {
3229
3434
  rich_text: input.revision ? [{ type: "text", text: { content: input.revision } }] : []
3230
3435
  },
@@ -3950,7 +4155,7 @@ var UpstreamLiveLayer = Layer3.effect(UpstreamPort, Effect3.gen(function* () {
3950
4155
  const rawText = mdTexts.get(smd.path) ?? "";
3951
4156
  const parsed = parseSkillFrontmatter(rawText);
3952
4157
  const fallbackName = dir === "." ? repoUrl.replace(/\.git$/i, "").split("/").pop() : dir.split("/").pop();
3953
- const finalName = (parsed.name || fallbackName).trim();
4158
+ const finalName = resolveCanonicalSkillName(parsed.name, fallbackName);
3954
4159
  if (!finalName || seenGh.has(finalName.toLowerCase()))
3955
4160
  continue;
3956
4161
  seenGh.add(finalName.toLowerCase());
@@ -3994,7 +4199,7 @@ var UpstreamLiveLayer = Layer3.effect(UpstreamPort, Effect3.gen(function* () {
3994
4199
  const rawText = new TextDecoder().decode(smd.bytes);
3995
4200
  const parsed = parseSkillFrontmatter(rawText);
3996
4201
  const fallbackName = dir === "." ? repoUrl.replace(/\.git$/i, "").split("/").pop() : dir.split("/").pop();
3997
- const finalName = (parsed.name || fallbackName).trim();
4202
+ const finalName = resolveCanonicalSkillName(parsed.name, fallbackName);
3998
4203
  if (!finalName || seenNames.has(finalName.toLowerCase()))
3999
4204
  continue;
4000
4205
  seenNames.add(finalName.toLowerCase());
@@ -4129,6 +4334,7 @@ var UpstreamLiveLayer = Layer3.effect(UpstreamPort, Effect3.gen(function* () {
4129
4334
  // packages/core/src/sync/sync-engine.ts
4130
4335
  import { randomUUID as randomUUID4 } from "node:crypto";
4131
4336
  import * as fsp5 from "node:fs/promises";
4337
+ import * as os2 from "node:os";
4132
4338
  import * as nodePath5 from "node:path";
4133
4339
  import { Effect as Effect4, Schema as Schema3 } from "effect";
4134
4340
  function isHomeOrEnvPrefixed(raw) {
@@ -4419,6 +4625,26 @@ function initLibraryCommand(args) {
4419
4625
  };
4420
4626
  });
4421
4627
  }
4628
+ async function resolveLocalCliCommandHint(homeDir) {
4629
+ const isExec = async (p) => fsp5.access(p, fsp5.constants.X_OK).then(() => true).catch(() => false);
4630
+ for (const seg of (process.env.PATH ?? "").split(nodePath5.delimiter)) {
4631
+ const dir = seg.trim();
4632
+ if (!dir)
4633
+ continue;
4634
+ if (await isExec(nodePath5.join(dir, "ntn-skills"))) {
4635
+ return "ntn-skills";
4636
+ }
4637
+ }
4638
+ const candidates = [
4639
+ nodePath5.join(process.env.HOME?.trim() || os2.homedir(), ".local", "bin", "ntn-skills"),
4640
+ nodePath5.join(homeDir, "bin", "ntn-skills")
4641
+ ];
4642
+ for (const c of candidates) {
4643
+ if (await isExec(c))
4644
+ return c;
4645
+ }
4646
+ return "ntn-skills";
4647
+ }
4422
4648
  function doctorCommand(args) {
4423
4649
  return Effect4.gen(function* () {
4424
4650
  const notion = yield* NotionPort;
@@ -4530,6 +4756,23 @@ function doctorCommand(args) {
4530
4756
  status: "pass",
4531
4757
  detail: `Synced catalog: ${activeSources} source(s), ${activeSkills} active skill(s), ${activeFiles} file row(s) (lastSync=${libState.lastSyncedAt ?? libState.watermark ?? "unknown"}).`
4532
4758
  });
4759
+ const nonSlugSkills = Object.values(libState.skills).filter((s) => s.enabled && !isValidSkillSlug(s.name)).map((s) => s.name).sort();
4760
+ if (nonSlugSkills.length > 0) {
4761
+ const sample = nonSlugSkills.slice(0, 6).join(", ");
4762
+ const more = nonSlugSkills.length > 6 ? `, +${nonSlugSkills.length - 6} more` : "";
4763
+ checks.push({
4764
+ name: "skill_names",
4765
+ status: "warn",
4766
+ detail: `${nonSlugSkills.length} active skill(s) use non-slug names (${sample}${more}); local exports fall back to normalized lowercase slugs.`,
4767
+ hint: "Rename Skills.Name in Notion to lowercase hyphenated slugs (a-z, 0-9, -) for clean cross-agent compatibility."
4768
+ });
4769
+ } else {
4770
+ checks.push({
4771
+ name: "skill_names",
4772
+ status: "pass",
4773
+ detail: `All ${activeSkills} active skill name(s) conform to lowercase hyphenated slug format.`
4774
+ });
4775
+ }
4533
4776
  }
4534
4777
  const realStoreRoot = yield* Effect4.tryPromise(() => fsp5.realpath(store.paths.storeRoot)).pipe(Effect4.catch(() => Effect4.succeed(store.paths.storeRoot)));
4535
4778
  const storePrefixes = Array.from(new Set([`${store.paths.storeRoot}${nodePath5.sep}`, `${realStoreRoot}${nodePath5.sep}`]));
@@ -4650,7 +4893,7 @@ function materializeOneSkill(args) {
4650
4893
  };
4651
4894
  }
4652
4895
  }
4653
- const authoritativeSkillMd = applyAuthoritativeFrontmatter(rawMainMarkdown, args.skill.name, args.skill.description);
4896
+ const authoritativeSkillMd = applyAuthoritativeFrontmatter(rawMainMarkdown, args.skill.name, args.skill.description, args.requiresPaths, args.skill.localPatch);
4654
4897
  fileMap.set("SKILL.md", {
4655
4898
  path: "SKILL.md",
4656
4899
  bytes: new TextEncoder().encode(authoritativeSkillMd),
@@ -4710,21 +4953,22 @@ function planExportTarget(args) {
4710
4953
  const seenNames = new Map;
4711
4954
  const duplicateNames = new Map;
4712
4955
  for (const entry of args.selectedEntries) {
4713
- const prev = seenNames.get(entry.name);
4956
+ const exportName = normalizeSkillSlug(entry.name) || entry.name.trim();
4957
+ const prev = seenNames.get(exportName);
4714
4958
  if (prev && prev.skillId !== entry.skillId) {
4715
4959
  if (onConflict === "error") {
4716
4960
  return yield* Effect4.fail(new ConflictError({
4717
4961
  kind: "duplicate_name",
4718
- message: `Duplicate active skill name '${entry.name}' in Notion (${prev.skillId} vs ${entry.skillId}); refusing export.`,
4962
+ message: `Duplicate active skill name '${exportName}' in Notion (${prev.skillId} vs ${entry.skillId}); refusing export.`,
4719
4963
  details: [prev.skillId, entry.skillId]
4720
4964
  }));
4721
4965
  }
4722
- const ids = duplicateNames.get(entry.name) ?? new Set([prev.skillId]);
4966
+ const ids = duplicateNames.get(exportName) ?? new Set([prev.skillId]);
4723
4967
  ids.add(entry.skillId);
4724
- duplicateNames.set(entry.name, ids);
4968
+ duplicateNames.set(exportName, ids);
4725
4969
  continue;
4726
4970
  }
4727
- seenNames.set(entry.name, entry);
4971
+ seenNames.set(exportName, entry);
4728
4972
  }
4729
4973
  for (const [dupName, ids] of duplicateNames) {
4730
4974
  seenNames.delete(dupName);
@@ -4895,21 +5139,22 @@ function publishExportTarget(args) {
4895
5139
  const seenNames = new Map;
4896
5140
  const duplicateNames = new Map;
4897
5141
  for (const entry of args.selectedEntries) {
4898
- const prev = seenNames.get(entry.name);
5142
+ const exportName = normalizeSkillSlug(entry.name) || entry.name.trim();
5143
+ const prev = seenNames.get(exportName);
4899
5144
  if (prev && prev.skillId !== entry.skillId) {
4900
5145
  if (onConflict === "error") {
4901
5146
  return yield* Effect4.fail(new ConflictError({
4902
5147
  kind: "duplicate_name",
4903
- message: `Duplicate active skill name '${entry.name}' in Notion (${prev.skillId} vs ${entry.skillId}); refusing export.`,
5148
+ message: `Duplicate active skill name '${exportName}' in Notion (${prev.skillId} vs ${entry.skillId}); refusing export.`,
4904
5149
  details: [prev.skillId, entry.skillId]
4905
5150
  }));
4906
5151
  }
4907
- const ids = duplicateNames.get(entry.name) ?? new Set([prev.skillId]);
5152
+ const ids = duplicateNames.get(exportName) ?? new Set([prev.skillId]);
4908
5153
  ids.add(entry.skillId);
4909
- duplicateNames.set(entry.name, ids);
5154
+ duplicateNames.set(exportName, ids);
4910
5155
  continue;
4911
5156
  }
4912
- seenNames.set(entry.name, entry);
5157
+ seenNames.set(exportName, entry);
4913
5158
  }
4914
5159
  for (const [dupName, ids] of duplicateNames) {
4915
5160
  seenNames.delete(dupName);
@@ -5009,9 +5254,23 @@ function publishExportTarget(args) {
5009
5254
  }
5010
5255
  publishableEntries.set(skillName, entry);
5011
5256
  }
5257
+ const existingCaseMap = new Map;
5258
+ for (const ex of await fsp5.readdir(destRoot).catch(() => [])) {
5259
+ existingCaseMap.set(ex.toLowerCase(), ex);
5260
+ }
5012
5261
  for (const [skillName, entry] of publishableEntries) {
5013
5262
  const storePath = entry.materializedPath;
5014
5263
  const destPath = nodePath5.join(destRoot, skillName);
5264
+ const prevCased = existingCaseMap.get(skillName.toLowerCase());
5265
+ if (prevCased && prevCased !== skillName) {
5266
+ const prevFull = nodePath5.join(destRoot, prevCased);
5267
+ const prevLst = await fsp5.lstat(prevFull).catch(() => null);
5268
+ if (prevLst?.isSymbolicLink()) {
5269
+ await fsp5.unlink(prevFull).catch(() => {
5270
+ return;
5271
+ });
5272
+ }
5273
+ }
5015
5274
  if (args.target.mode === "symlink") {
5016
5275
  const lst = await fsp5.lstat(destPath).catch(() => null);
5017
5276
  if (lst?.isSymbolicLink()) {
@@ -5102,7 +5361,7 @@ async function copyDirectoryContentsWritable(srcDir, dstDir) {
5102
5361
  }
5103
5362
  }
5104
5363
  async function upsertByNameSymlink(byNameRoot, skillName, targetDir) {
5105
- const trimmed = skillName.trim();
5364
+ const trimmed = normalizeSkillSlug(skillName) || skillName.trim();
5106
5365
  if (!trimmed || trimmed === "." || trimmed === ".." || trimmed.startsWith(".") || nodePath5.basename(trimmed) !== trimmed) {
5107
5366
  return;
5108
5367
  }
@@ -5149,7 +5408,7 @@ async function reconcileByNameDirectory(args) {
5149
5408
  for (const e of ordered) {
5150
5409
  if (!e.enabled || !e.materializedPath)
5151
5410
  continue;
5152
- const trimmed = e.name.trim();
5411
+ const trimmed = normalizeSkillSlug(e.name) || e.name.trim();
5153
5412
  if (!trimmed || trimmed === "." || trimmed === ".." || trimmed.startsWith(".") || nodePath5.basename(trimmed) !== trimmed || desired.has(trimmed)) {
5154
5413
  continue;
5155
5414
  }
@@ -5583,6 +5842,7 @@ function syncCommand(options = {}) {
5583
5842
  customMain: sk.customMain,
5584
5843
  name: sk.name,
5585
5844
  description: sk.description,
5845
+ ...sk.localPatch ? { localPatch: sk.localPatch } : {},
5586
5846
  mainContentIdentity: mainIdentity,
5587
5847
  overlays,
5588
5848
  requiresRevs: reqRevs
@@ -5631,6 +5891,14 @@ function syncCommand(options = {}) {
5631
5891
  revMemo.delete(sid);
5632
5892
  }
5633
5893
  const rev = getEffectiveRevFor(sid);
5894
+ const reqPathsForMat = {};
5895
+ for (const reqId of sk.requiresIds) {
5896
+ const reqSkill = effectiveById.get(reqId);
5897
+ if (!reqSkill)
5898
+ continue;
5899
+ const reqSlug = normalizeSkillSlug(reqSkill.name) || reqSkill.name.trim();
5900
+ reqPathsForMat[reqSlug] = store.getStoreSkillDir(libraryId, reqId, getEffectiveRevFor(reqId));
5901
+ }
5634
5902
  if (isDryRun) {
5635
5903
  const alreadyReady = yield* store.hasVerifiedStorePackage(libraryId, sid, rev);
5636
5904
  const expectedDir = store.getStoreSkillDir(libraryId, sid, rev);
@@ -5652,7 +5920,8 @@ function syncCommand(options = {}) {
5652
5920
  pinnedCommit: src.pinnedCommit || (resolvedCommits.get(src.id) ?? "")
5653
5921
  } : null,
5654
5922
  overlayFiles: filesBySkillId.get(sid) ?? [],
5655
- effectiveRev: rev
5923
+ effectiveRev: rev,
5924
+ requiresPaths: reqPathsForMat
5656
5925
  }).pipe(Effect4.map((ok) => ({ ok: true, value: ok })), Effect4.catchTag("UpstreamError", (err) => Effect4.succeed({ ok: false, err })));
5657
5926
  if (!matRes.ok) {
5658
5927
  const warnMsg = `Skill '${sk.name}' skipped materialization due to upstream fetch error: ${matRes.err.message}`;
@@ -5721,6 +5990,8 @@ function syncCommand(options = {}) {
5721
5990
  originPinnedCommit: src ? src.pinnedCommit || (resolvedCommits.get(src.id) ?? null) : null,
5722
5991
  sourcePath: sk.sourcePath,
5723
5992
  customMain: sk.customMain,
5993
+ customDescription: Boolean(sk.customDescription),
5994
+ localPatch: sk.localPatch ?? "",
5724
5995
  revision: sk.revision,
5725
5996
  previewHash: sk.previewHash,
5726
5997
  effectiveRev: rev,
@@ -5759,6 +6030,7 @@ function syncCommand(options = {}) {
5759
6030
  }
5760
6031
  const manifestExports = [];
5761
6032
  const preparedExports = [];
6033
+ const cliCommand = yield* Effect4.promise(() => resolveLocalCliCommandHint(store.paths.homeDir));
5762
6034
  for (const { resolved, selection } of exportSelections) {
5763
6035
  const exp = resolved.target;
5764
6036
  const selectedEntries = selection.selected.map((s) => exportEntryMapById.get(s.id)).filter((e) => Boolean(e?.materializedPath));
@@ -5771,7 +6043,8 @@ function syncCommand(options = {}) {
5771
6043
  routerName,
5772
6044
  discoverableEntries,
5773
6045
  allEntriesById: exportEntryMapById,
5774
- byNameRoot: store.paths.byNameRoot
6046
+ byNameRoot: store.paths.byNameRoot,
6047
+ cliCommand
5775
6048
  });
5776
6049
  const routerSkillId = `_router-${routerName}`;
5777
6050
  const routerStoreDir = isDryRun ? store.getStoreSkillDir(libraryId, routerSkillId, synth.effectiveRev) : yield* store.publishImmutablePackage({
@@ -6284,11 +6557,23 @@ function loadSkillCommand(args) {
6284
6557
  customMain: sk.customMain,
6285
6558
  name: sk.name,
6286
6559
  description: sk.description,
6560
+ ...sk.localPatch ? { localPatch: sk.localPatch } : {},
6287
6561
  mainContentIdentity: mainId,
6288
6562
  overlays,
6289
6563
  requiresRevs: []
6290
6564
  });
6291
6565
  }
6566
+ const reqPathsForLoad = {};
6567
+ for (const reqId of sk.requiresIds) {
6568
+ const reqSkill = effectiveById.get(reqId);
6569
+ if (!reqSkill)
6570
+ continue;
6571
+ const reqSlug = normalizeSkillSlug(reqSkill.name) || reqSkill.name.trim();
6572
+ const knownDir = matDirs.get(reqId);
6573
+ if (knownDir) {
6574
+ reqPathsForLoad[reqSlug] = knownDir;
6575
+ }
6576
+ }
6292
6577
  const mat = yield* materializeOneSkill({
6293
6578
  libraryId,
6294
6579
  libState: workingLib,
@@ -6296,7 +6581,8 @@ function loadSkillCommand(args) {
6296
6581
  source: src,
6297
6582
  overlayFiles: filesBySkill.get(cid) ?? [],
6298
6583
  effectiveRev: targetRev,
6299
- forceRefreshBodies: Boolean(args.refresh)
6584
+ forceRefreshBodies: Boolean(args.refresh),
6585
+ requiresPaths: reqPathsForLoad
6300
6586
  });
6301
6587
  workingLib = mat.updatedLibState;
6302
6588
  matDirs.set(cid, mat.storeDir);
@@ -6401,6 +6687,7 @@ function materializeSkillOutsideCatalog(args) {
6401
6687
  customMain: sk.customMain,
6402
6688
  name: sk.name,
6403
6689
  description: sk.description,
6690
+ ...sk.localPatch ? { localPatch: sk.localPatch } : {},
6404
6691
  mainContentIdentity: mainIdentity,
6405
6692
  overlays: overlayFiles.map((ov) => ({
6406
6693
  path: ov.path,
@@ -6756,11 +7043,13 @@ function exportCommand(args) {
6756
7043
  let routerEntry = null;
6757
7044
  const routerName = (target.router?.name ?? "skill-catalog").trim() || "skill-catalog";
6758
7045
  if (selection.resolvedRouterEnabled && discoverableEntries.length > 0 && !directNameSet.has(routerName.toLowerCase())) {
7046
+ const cliCommand = yield* Effect4.promise(() => resolveLocalCliCommandHint(store.paths.homeDir));
6759
7047
  const synth = synthesizeSkillCatalogPackage({
6760
7048
  routerName,
6761
7049
  discoverableEntries,
6762
7050
  allEntriesById: entryCacheById,
6763
- byNameRoot: store.paths.byNameRoot
7051
+ byNameRoot: store.paths.byNameRoot,
7052
+ cliCommand
6764
7053
  });
6765
7054
  const routerSkillId = `_router-${routerName}`;
6766
7055
  const routerStoreDir = isDryRun ? store.getStoreSkillDir(libraryId, routerSkillId, synth.effectiveRev) : yield* store.publishImmutablePackage({
@@ -6862,9 +7151,11 @@ function statusCommand(args) {
6862
7151
  const entryByName = new Map(entries.map((e) => [e.name.toLowerCase(), e]));
6863
7152
  const activeSources = libState ? Object.values(libState.sources).filter((s) => s.enabled).length : 0;
6864
7153
  const draftEntries = entries.filter((e) => !e.originSourceId).sort((a, b) => b.lastEditedTime.localeCompare(a.lastEditedTime));
6865
- const activeOverlays = entries.filter((e) => Boolean(e.originSourceId) && (e.customMain || e.overlays.length > 0)).map((e) => ({
7154
+ const activeOverlays = entries.filter((e) => Boolean(e.originSourceId) && (e.customMain || Boolean(e.customDescription) || Boolean(e.localPatch?.trim()) || e.overlays.length > 0)).map((e) => ({
6866
7155
  name: e.name,
6867
7156
  customMain: e.customMain,
7157
+ customDescription: Boolean(e.customDescription),
7158
+ hasLocalPatch: Boolean(e.localPatch?.trim()),
6868
7159
  overrides: e.overlays.filter((o) => o.status === "override").length,
6869
7160
  deletes: e.overlays.filter((o) => o.status === "delete").length,
6870
7161
  warnings: e.warnings
@@ -7135,7 +7426,8 @@ function loadTableMetadataLibrary(explicitLibraryId) {
7135
7426
  }
7136
7427
  function findSkillOrFail(libState, name) {
7137
7428
  const needle = name.trim().toLowerCase();
7138
- const candidates = Object.values(libState.skills).filter((s) => s.name.toLowerCase() === needle).sort((a, b) => Number(b.enabled) - Number(a.enabled) || b.lastEditedTime.localeCompare(a.lastEditedTime));
7429
+ const needleSlug = normalizeSkillSlug(name);
7430
+ const candidates = Object.values(libState.skills).filter((s) => s.name.toLowerCase() === needle || needleSlug.length > 0 && normalizeSkillSlug(s.name) === needleSlug).sort((a, b) => Number(b.enabled) - Number(a.enabled) || b.lastEditedTime.localeCompare(a.lastEditedTime));
7139
7431
  const found = candidates[0];
7140
7432
  return found ? Effect6.succeed(found) : Effect6.fail(new NotFoundError({ entity: "skill", target: name, message: `Skill '${name}' not found.` }));
7141
7433
  }
@@ -7159,7 +7451,9 @@ function editOrPullSkillCommand(args) {
7159
7451
  const store = yield* StorePort;
7160
7452
  const upstream = yield* UpstreamPort;
7161
7453
  const { libraryId, binding, catalog, libState } = yield* loadSyncedLibrary(args.libraryId);
7162
- const entry = catalog.entries.find((e) => e.libraryId === libraryId && e.name.toLowerCase() === args.name.trim().toLowerCase());
7454
+ const targetLower = args.name.trim().toLowerCase();
7455
+ const targetSlug = normalizeSkillSlug(args.name);
7456
+ const entry = catalog.entries.find((e) => e.libraryId === libraryId && (e.name.toLowerCase() === targetLower || targetSlug.length > 0 && normalizeSkillSlug(e.name) === targetSlug));
7163
7457
  if (!entry) {
7164
7458
  return yield* Effect6.fail(new NotFoundError({
7165
7459
  entity: "skill",
@@ -7706,7 +8000,12 @@ function createNewSkillCommand(args) {
7706
8000
  return yield* Effect6.fail(new StoreError({ path: absDir, message: `Missing SKILL.md in ${absDir}.` }));
7707
8001
  const rawMain = new TextDecoder().decode(mainFile.bytes);
7708
8002
  const parsed = parseSkillFrontmatter(rawMain);
7709
- const skillName = (args.name ?? parsed.name ?? nodePath7.basename(absDir)).trim();
8003
+ const skillName = args.name?.trim() ? normalizeSkillSlug(args.name) : resolveCanonicalSkillName(parsed.name, nodePath7.basename(absDir));
8004
+ if (!skillName || !isValidSkillSlug(skillName)) {
8005
+ return yield* Effect6.fail(new ConfigError({
8006
+ message: `Invalid skill name for ${absDir}: must form a lowercase hyphenated English slug (a-z, 0-9, -). Pass --name <slug>.`
8007
+ }));
8008
+ }
7710
8009
  const duplicate = catalog.entries.find((e) => e.libraryId === libraryId && (e.name.toLowerCase() === skillName.toLowerCase() || normalizeSkillSlug(e.name) === normalizeSkillSlug(skillName)));
7711
8010
  if (duplicate) {
7712
8011
  return yield* Effect6.fail(new ConflictError({
@@ -7809,7 +8108,18 @@ function createNewSkillCommand(args) {
7809
8108
  function setSkillMetaCommand(args) {
7810
8109
  return Effect6.gen(function* () {
7811
8110
  const notion = yield* NotionPort;
8111
+ const upstream = yield* UpstreamPort;
7812
8112
  const { libraryId, libState } = yield* loadSyncedLibrary(args.libraryId);
8113
+ if (args.description !== undefined && args.resetDescription) {
8114
+ return yield* Effect6.fail(new ConfigError({
8115
+ message: "Cannot combine --description with --reset-description."
8116
+ }));
8117
+ }
8118
+ if (args.localPatch !== undefined && args.clearPatch) {
8119
+ return yield* Effect6.fail(new ConfigError({
8120
+ message: "Cannot combine --patch with --clear-patch."
8121
+ }));
8122
+ }
7813
8123
  const requestedNames = [...args.name ? [args.name] : [], ...args.names ?? []].map((n) => n.trim()).filter(Boolean);
7814
8124
  if (requestedNames.length === 0 && !args.sourceQuery?.trim()) {
7815
8125
  return yield* Effect6.fail(new ConfigError({
@@ -7859,6 +8169,33 @@ function setSkillMetaCommand(args) {
7859
8169
  nextScenes.add(s);
7860
8170
  for (const s of args.rmScenes ?? [])
7861
8171
  nextScenes.delete(s);
8172
+ let nextDescPatch = {};
8173
+ if (args.description !== undefined) {
8174
+ nextDescPatch = { description: args.description, customDescription: true };
8175
+ } else if (args.resetDescription) {
8176
+ let restoredDesc;
8177
+ const src = targetSkill.originSourceId ? libState.sources[targetSkill.originSourceId] : undefined;
8178
+ if (src && !targetSkill.customMain) {
8179
+ const commitSha = src.pinnedCommit || (yield* upstream.resolveHeadCommit(src.repoUrl, src.ref));
8180
+ const subtree = yield* upstream.fetchSubtree({
8181
+ repoUrl: src.repoUrl,
8182
+ commitSha,
8183
+ sourcePath: targetSkill.sourcePath || "."
8184
+ }).pipe(Effect6.catch(() => Effect6.succeed(null)));
8185
+ const upMain = subtree?.find((f) => f.path === "SKILL.md");
8186
+ if (upMain) {
8187
+ const parsedUp = parseSkillFrontmatter(new TextDecoder().decode(upMain.bytes));
8188
+ if (parsedUp.description !== undefined) {
8189
+ restoredDesc = parsedUp.description;
8190
+ }
8191
+ }
8192
+ }
8193
+ nextDescPatch = {
8194
+ customDescription: false,
8195
+ ...restoredDesc !== undefined ? { description: restoredDesc } : {}
8196
+ };
8197
+ }
8198
+ const nextLocalPatch = args.localPatch !== undefined ? args.localPatch : args.clearPatch ? "" : undefined;
7862
8199
  yield* notion.updateSkillProps({
7863
8200
  libraryId,
7864
8201
  skillId: targetSkill.id,
@@ -7868,6 +8205,8 @@ function setSkillMetaCommand(args) {
7868
8205
  ...args.addProfiles?.length || args.rmProfiles?.length ? { profiles: [...nextProfiles] } : {},
7869
8206
  ...args.addScenes?.length || args.rmScenes?.length ? { scenes: [...nextScenes] } : {},
7870
8207
  ...nextRequires !== undefined ? { requiresIds: nextRequires } : {},
8208
+ ...nextDescPatch,
8209
+ ...nextLocalPatch !== undefined ? { localPatch: nextLocalPatch } : {},
7871
8210
  revision: makeRevisionStamp(extractSubtreeDigestFromRevision(targetSkill.revision))
7872
8211
  });
7873
8212
  }), { concurrency: UPSTREAM_SKILL_CONCURRENCY });
@@ -8734,7 +9073,7 @@ function upstreamCheckOrApplyCommand(args) {
8734
9073
  }
8735
9074
  if (matchesTargetUpstream && rawMainText !== null) {
8736
9075
  const parsedMain = parseSkillFrontmatter(rawMainText);
8737
- if (parsedMain.description !== undefined && parsedMain.description !== sk.description) {
9076
+ if (!sk.customDescription && parsedMain.description !== undefined && parsedMain.description !== sk.description) {
8738
9077
  nextDesc = parsedMain.description;
8739
9078
  }
8740
9079
  nextPreviewHash = sha256Hex(currentBody.rawMarkdown);
@@ -8743,7 +9082,7 @@ function upstreamCheckOrApplyCommand(args) {
8743
9082
  }
8744
9083
  } else if (rawMainText !== null) {
8745
9084
  const parsedMain = parseSkillFrontmatter(rawMainText);
8746
- if (parsedMain.description !== undefined && parsedMain.description !== sk.description) {
9085
+ if (!sk.customDescription && parsedMain.description !== undefined && parsedMain.description !== sk.description) {
8747
9086
  nextDesc = parsedMain.description;
8748
9087
  }
8749
9088
  yield* notion.writeSkillBody({
@@ -9276,7 +9615,8 @@ function createNewSkillsBatchCommand(args) {
9276
9615
  const mainFile = scan.files.get("SKILL.md");
9277
9616
  const rawMain = mainFile ? new TextDecoder().decode(mainFile.bytes) : "";
9278
9617
  const parsed = mainFile ? parseSkillFrontmatter(rawMain) : null;
9279
- const skillName = ((explicitDirs.length === 1 && !isPending ? args.name : undefined) ?? parsed?.name ?? fallbackName).trim();
9618
+ const explicitName = explicitDirs.length === 1 && !isPending ? args.name?.trim() : undefined;
9619
+ const skillName = explicitName ? normalizeSkillSlug(explicitName) : resolveCanonicalSkillName(parsed?.name, fallbackName);
9280
9620
  const resolvedVisibility = explicitVisibility ?? (parsed?.disableModelInvocation ? "manual" : "discoverable");
9281
9621
  if (scan.blockedFiles.length > 0) {
9282
9622
  failed.push({
@@ -9308,10 +9648,10 @@ function createNewSkillsBatchCommand(args) {
9308
9648
  });
9309
9649
  continue;
9310
9650
  }
9311
- if (!skillName) {
9651
+ if (!skillName || !isValidSkillSlug(skillName)) {
9312
9652
  failed.push({
9313
9653
  dir: absDir,
9314
- name: null,
9654
+ name: skillName || null,
9315
9655
  visibility: resolvedVisibility,
9316
9656
  fileCount: scan.fileCount,
9317
9657
  totalBytes: scan.totalBytes,
@@ -9319,7 +9659,7 @@ function createNewSkillsBatchCommand(args) {
9319
9659
  blockedFiles: [],
9320
9660
  conflict: false,
9321
9661
  code: "invalid_skill_name",
9322
- error: `Could not resolve skill name for ${absDir}.`
9662
+ error: `Skill name for ${absDir} must form a lowercase hyphenated English slug (a-z, 0-9, -).`
9323
9663
  });
9324
9664
  continue;
9325
9665
  }
@@ -10044,7 +10384,7 @@ function makeCoreLiveLayer(options) {
10044
10384
  // packages/core/src/schedule/scheduler.ts
10045
10385
  import { spawn as spawn4 } from "node:child_process";
10046
10386
  import * as fsp9 from "node:fs/promises";
10047
- import * as os2 from "node:os";
10387
+ import * as os3 from "node:os";
10048
10388
  import * as nodePath9 from "node:path";
10049
10389
  import { fileURLToPath } from "node:url";
10050
10390
  import { Effect as Effect8 } from "effect";
@@ -10270,7 +10610,7 @@ function isMacOsTccProtectedPath(absPath, safeHomeDir) {
10270
10610
  if (norm === normSafe || norm.startsWith(`${normSafe}${nodePath9.sep}`)) {
10271
10611
  return false;
10272
10612
  }
10273
- const home = process.env.HOME?.trim() || os2.homedir();
10613
+ const home = process.env.HOME?.trim() || os3.homedir();
10274
10614
  const protectedRoots = ["Documents", "Desktop", "Downloads"].map((d) => nodePath9.join(home, d));
10275
10615
  return protectedRoots.some((r) => norm === r || norm.startsWith(`${r}${nodePath9.sep}`));
10276
10616
  }
@@ -10565,8 +10905,8 @@ function installScheduleCommand(args) {
10565
10905
  try: () => {
10566
10906
  const cleanEnvArgs = [
10567
10907
  "-i",
10568
- `HOME=${process.env.HOME?.trim() || os2.homedir()}`,
10569
- `USER=${os2.userInfo().username}`,
10908
+ `HOME=${process.env.HOME?.trim() || os3.homedir()}`,
10909
+ `USER=${os3.userInfo().username}`,
10570
10910
  "PATH=/usr/bin:/bin",
10571
10911
  ...process.env.XDG_DATA_HOME?.trim() ? [`XDG_DATA_HOME=${process.env.XDG_DATA_HOME.trim()}`] : [],
10572
10912
  ...process.env.XDG_CONFIG_HOME?.trim() ? [`XDG_CONFIG_HOME=${process.env.XDG_CONFIG_HOME.trim()}`] : [],
@@ -11961,6 +12301,9 @@ var infoCmd = Command.make("info", {
11961
12301
  `Scenes: ${exact.scenes.join(", ") || "-"}`,
11962
12302
  `Origin: ${exact.originRepoUrl ? `${exact.originRepoUrl} @ ${exact.originPinnedCommit ?? exact.originRef} (${exact.sourcePath || "."})` : "native"}`,
11963
12303
  `Custom Main: ${exact.customMain}`,
12304
+ `Custom Desc: ${Boolean(exact.customDescription)}`,
12305
+ `Local Patch: ${exact.localPatch?.trim() ? `active (${exact.localPatch.trim().split(`
12306
+ `).length} line(s))` : "none"}`,
11964
12307
  `Overlays: ${exact.overlays.length === 0 ? "none" : exact.overlays.map((o) => `${o.path}[${o.status}]`).join(", ")}`,
11965
12308
  `Store Path: ${exact.materializedPath ?? "(not materialized yet)"}`,
11966
12309
  ...exact.warnings.length > 0 ? [`Warnings: ${exact.warnings.join("; ")}`] : []
@@ -12333,6 +12676,10 @@ var setCmd = Command.make("set", {
12333
12676
  addScene: Flag.String("add-scene").pipe(Flag.atLeast(0)),
12334
12677
  rmScene: Flag.String("rm-scene").pipe(Flag.atLeast(0)),
12335
12678
  require: Flag.String("require").pipe(Flag.atLeast(0)),
12679
+ description: Flag.String("description").pipe(Flag.withDescription("Set authoritative Description and lock Custom Description=true"), Flag.optional),
12680
+ resetDescription: Flag.Boolean("reset-description").pipe(Flag.withDescription("Unlock Custom Description=false and restore upstream description"), Flag.withDefault(false)),
12681
+ patch: Flag.String("patch").pipe(Flag.withDescription("Set Local Patch materialization rules (@replace, @replace-all, @prepend, @append)"), Flag.optional),
12682
+ clearPatch: Flag.Boolean("clear-patch").pipe(Flag.withDescription("Clear Local Patch rules"), Flag.withDefault(false)),
12336
12683
  library: libraryFlag,
12337
12684
  json: jsonFlag
12338
12685
  }, (cfg) => Effect9.gen(function* () {
@@ -12342,6 +12689,8 @@ var setCmd = Command.make("set", {
12342
12689
  const enable = cfg.enable ? true : cfg.disable ? false : undefined;
12343
12690
  const visibility = visOpt ?? (cfg.always || cfg.default ? "always" : cfg.discoverable || cfg.noDefault ? "discoverable" : cfg.manual ? "manual" : undefined);
12344
12691
  const srcOpt = Option2.getOrUndefined(cfg.source);
12692
+ const descOpt = Option2.getOrUndefined(cfg.description);
12693
+ const patchOpt = Option2.getOrUndefined(cfg.patch);
12345
12694
  const nameList = splitMulti(cfg.names);
12346
12695
  const reqs = splitMulti(cfg.require);
12347
12696
  const res = yield* setSkillMetaCommand({
@@ -12355,10 +12704,14 @@ var setCmd = Command.make("set", {
12355
12704
  addScenes: splitMulti(cfg.addScene),
12356
12705
  rmScenes: splitMulti(cfg.rmScene),
12357
12706
  ...reqs.length > 0 ? { requireNames: reqs } : {},
12707
+ ...descOpt !== undefined ? { description: descOpt } : {},
12708
+ ...cfg.resetDescription ? { resetDescription: true } : {},
12709
+ ...patchOpt !== undefined ? { localPatch: patchOpt } : {},
12710
+ ...cfg.clearPatch ? { clearPatch: true } : {},
12358
12711
  ...lib ? { libraryId: lib } : {}
12359
12712
  });
12360
12713
  yield* printOut(cfg.json, res, `Updated metadata for ${res.updatedSkills.length} skill(s): ${res.updatedSkills.join(", ")}`);
12361
- })).pipe(Command.withDescription("Declaratively update Visibility (always|discoverable|manual), Kind, Enabled, Profiles, Scenes, or Requires"));
12714
+ })).pipe(Command.withDescription("Declaratively update Visibility, Kind, Enabled, Profiles, Scenes, Requires, Custom Description, or Local Patch"));
12362
12715
  var attachCmd = Command.make("attach", {
12363
12716
  name: Argument.String("name"),
12364
12717
  source: Flag.String("source").pipe(Flag.withDescription("Target upstream Git Source name or Notion page UUID")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ntn-skills",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ntn-skills": "./dist/bin.js"
@@ -37,6 +37,6 @@
37
37
  "bun": ">=1.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@ntn-skills/core": "2.2.0"
40
+ "@ntn-skills/core": "2.4.0"
41
41
  }
42
42
  }