ntn-skills 2.1.0 → 2.3.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
@@ -174,7 +174,7 @@ ntn-skills init [--root <notion-page-url>] [--export ~/.agents/skills] [--export
174
174
  ntn-skills skill [--path] [--install [--dest ~/.agents/skills] [--force]] [--uninstall]
175
175
  ntn-skills doctor [--json]
176
176
  ntn-skills status [--days 30] [--json]
177
- ntn-skills sync [--full] [--coalesce] [--json]
177
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json]
178
178
  ntn-skills find [query] [--scene <scene>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--json]
179
179
  ntn-skills info <name> [--json]
180
180
  ntn-skills load <name> [--refresh] [--path-only]
@@ -183,14 +183,14 @@ ntn-skills load <name> [--refresh] [--path-only]
183
183
  ### Targeted & Declarative Exports
184
184
  ```bash
185
185
  # Reconcile all configured exports (including config.json `include_exports`)
186
- ntn-skills export [--json]
186
+ ntn-skills export [--dry-run] [--json]
187
187
 
188
188
  # Project an exact allowlist (name or slug; includes manual skills, auto-closes Requires, omits skill-catalog by default)
189
- ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--json]
189
+ ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json]
190
190
 
191
191
  # Batch-project from a standalone JSON spec (`{ bundles?, exports }`, `ExportTarget[]`, or single `ExportTarget`)
192
192
  # Relative target `dir` paths resolve against the spec file's directory; `copy` mode safely coexists with unmanaged folders
193
- ntn-skills export --spec ./exports.spec.json [--json]
193
+ ntn-skills export --spec ./exports.spec.json [--dry-run] [--json]
194
194
  ```
195
195
 
196
196
  In `~/.config/ntn-skills/config.json`, you can also declare reusable top-level `bundles` (`Record<string, string[]>`) and external manifest files via `include_exports` (`string[]`, supporting `~` and `${HOME}`). Each export target supports `skills`, `bundles`, `exclude`, and `include_requires` alongside `profiles`, `scenes`, `router`, and `mode`.
@@ -201,10 +201,12 @@ In `~/.config/ntn-skills/config.json`, you can also declare reusable top-level `
201
201
  WORKDIR=$(ntn-skills edit "<name>")
202
202
  ntn-skills diff "$WORKDIR" --remote
203
203
  ntn-skills push "$WORKDIR" [--dry-run]
204
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--json]
205
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--json] # Direct overwrite (preserves source dir)
204
206
  ntn-skills abort "$WORKDIR"
205
207
 
206
- # Create/adopt a Notion-native draft skill & single/batch update metadata
207
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual] [--profiles default] [--scenes ops] [--no-adopt]
208
+ # Create/adopt single or batch Notion-native skills (--pending requires explicit visibility; --dry-run previews conflicts & sensitive files)
209
+ 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]
208
210
  ntn-skills set [<name...>] [--source <source-name>] \
209
211
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
210
212
  [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
@@ -318,7 +320,7 @@ magpie library mcp router ntn-skills direct
318
320
  ## Security, Privacy & Data Boundaries
319
321
 
320
322
  - **Zero Consumer-Time Network Access**: Everyday skill consumption reads immutable local files (`0444/0555`) under `$XDG_DATA_HOME/ntn-skills/store/` (default `~/.local/share/ntn-skills/store/`). Network requests to `api.notion.com` and your configured Git remotes happen only during explicit CLI invocations or scheduled sync jobs.
321
- - **Local-Only Credentials & Telemetry**: `credentials.env` lives under `$XDG_CONFIG_HOME/ntn-skills/` (default `~/.config/ntn-skills/credentials.env`) with enforced `0600` permissions. Usage counters (`telemetry/usage.jsonl`) and bounded sync logs (`2 MiB` rotation) never leave your machine.
323
+ - **Local-Only Credentials, Fail-Closed Secret Scan & Telemetry**: `credentials.env` lives under `$XDG_CONFIG_HOME/ntn-skills/` (default `~/.config/ntn-skills/credentials.env`) with enforced `0600` permissions. Before uploading to Notion, `new` and `push` run a fail-closed scan blocking out-of-root symlinks and sensitive files (`.env`/`.env.*` except `.env.example`/`.sample`/`.template`/`.dist`, `*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`, `*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`, and `.npmrc` containing `_authToken`) without ever printing file contents. Usage counters (`telemetry/usage.jsonl`) and bounded sync logs (`2 MiB` rotation) never leave your machine.
322
324
  - **Foreign Directory Guard & Trash-Only Cleanup**: `export` never overwrites unmanaged files or symlinks inside host skill directories. Workdir and expired cache cleanups move files to the OS Trash rather than permanently unlinking them; retiring skills in Notion marks `Status = retired`.
323
325
  - **Formal Verification**: Core concurrency locks, overlap-window delta sync, and atomic snapshot switching are verified with TLA+ specifications under [`verification/`](https://github.com/yoyooyooo/ntn-skills/tree/main/verification).
324
326
 
@@ -327,7 +329,7 @@ magpie library mcp router ntn-skills direct
327
329
  ## Scope & Non-Goals
328
330
 
329
331
  - **Focused on Agent Skills**: `ntn-skills` governs Markdown/script-based Agent Skills (`SKILL.md` + supporting references/scripts). It is **not** an MCP server proxy, secret manager, or general machine provisioning tool.
330
- - **One-Way Sync by Design**: `ntn-skills sync` strictly pulls from Notion/Git to local snapshots and reports `Local Pending` items without silently pushing local scratch edits to Notion. Publishing always requires explicit `new` or `edit -> diff --remote -> push`.
332
+ - **One-Way Three-Channel Architecture by Design**: `ntn-skills sync` strictly pulls from Notion/Git to local snapshots (with `--dry-run` zero-write previews) and reports `Local Pending` items without silently pushing local scratch edits to Notion. Creating/adopting goes through `new` (including `--pending` & `--dry-run`), and updating existing skills goes through `edit -> diff --remote -> push` (including batch `push --pending`) or explicit single-directory `push <dir> --overwrite | --to <name>`.
331
333
 
332
334
  ---
333
335
 
package/README.zh-CN.md CHANGED
@@ -175,7 +175,7 @@ ntn-skills init [--root <notion-page-url>] [--export ~/.agents/skills] [--export
175
175
  ntn-skills skill [--path] [--install [--dest ~/.agents/skills] [--force]] [--uninstall]
176
176
  ntn-skills doctor [--json]
177
177
  ntn-skills status [--days 30] [--json]
178
- ntn-skills sync [--full] [--coalesce] [--json]
178
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json]
179
179
  ntn-skills find [关键词] [--scene <场景>] [--visibility always|discoverable|manual] [--kind skill|router|prompt] [--json]
180
180
  ntn-skills info <name> [--json]
181
181
  ntn-skills load <name> [--refresh] [--path-only]
@@ -184,14 +184,14 @@ ntn-skills load <name> [--refresh] [--path-only]
184
184
  ### 精确白名单与声明式投影导出
185
185
  ```bash
186
186
  # 对账同步配置中的全部导出目标(包含 config.json 的 `include_exports`)
187
- ntn-skills export [--json]
187
+ ntn-skills export [--dry-run] [--json]
188
188
 
189
189
  # 按精确技能白名单投影(支持正本名或 slug,可选中 manual 技能并自动按需物化,默认展开 Requires 闭包且不生成 skill-catalog)
190
- ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--json]
190
+ ntn-skills export --to <dir> --skills skill-a,skill-b [--exclude noisy-dep] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json]
191
191
 
192
192
  # 按独立 JSON 声明文件批量投影(支持 `{ bundles?, exports }`、`ExportTarget[]` 或单个 `ExportTarget`)
193
193
  # spec 文件中的相对 `dir` 相对该 spec 文件所在目录解析;`copy` 模式仅接管含 `.ntn-managed-copy.json` 的目录,与原有非受管目录安全共存
194
- ntn-skills export --spec ./exports.spec.json [--json]
194
+ ntn-skills export --spec ./exports.spec.json [--dry-run] [--json]
195
195
  ```
196
196
 
197
197
  在 `~/.config/ntn-skills/config.json` 中还可声明顶层复用的 `bundles`(`Record<string, string[]>`)以及外部清单文件 `include_exports`(`string[]`,支持 `~` 与 `${HOME}` 展开)。每个导出目标均可配置 `skills`、`bundles`、`exclude` 与 `include_requires`,与既有 `profiles`、`scenes`、`router`、`mode` 完全兼容。
@@ -202,10 +202,12 @@ ntn-skills export --spec ./exports.spec.json [--json]
202
202
  WORKDIR=$(ntn-skills edit "<name>")
203
203
  ntn-skills diff "$WORKDIR" --remote
204
204
  ntn-skills push "$WORKDIR" [--dry-run]
205
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--json]
206
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--json] # 普通本地目录直推覆盖(保留源目录)
205
207
  ntn-skills abort "$WORKDIR"
206
208
 
207
- # 新建/原地收编纯 Notion 草稿技能 & 单个/按源批量修改元数据
208
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual] [--profiles default] [--scenes ops] [--no-adopt]
209
+ # 单个或批量新建/原地收编纯 Notion 技能(--pending 须显式指定可见性;--dry-run 零写入预览冲突与敏感文件拦截)
210
+ 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]
209
211
  ntn-skills set [<name...>] [--source <source-name>] \
210
212
  [--visibility always|discoverable|manual | --always | --discoverable | --manual] \
211
213
  [--kind skill|router|prompt] [--enable|--disable] [--add-profile <p>] [--add-scene <s>] [--require <dep>]
@@ -319,7 +321,7 @@ magpie library mcp router ntn-skills direct
319
321
  ## 安全与数据边界
320
322
 
321
323
  - **日常消费零网络请求**:日常会话仅读取 `$XDG_DATA_HOME/ntn-skills/store/`(默认 `~/.local/share/ntn-skills/store/`)下的只读不可变快照(`0444/0555`);仅在显式运行同步/维护 CLI 或系统定时任务时访问 `api.notion.com` 与用户配置的 Git 远端。
322
- - **本地凭据保护与零第三方遥测**:`credentials.env` 存放在 `$XDG_CONFIG_HOME/ntn-skills/`(默认 `~/.config/ntn-skills/credentials.env`),`doctor` 强制校验 `0600` 权限;工作区自动剥离 `.env` 等敏感文件;调用统计(`telemetry/usage.jsonl`)与同步日志(`2 MiB` 上限轮转)100% 留在本机,绝不外发。
324
+ - **本地凭据保护、上传前置敏感文件拦截与零第三方遥测**:`credentials.env` 存放在 `$XDG_CONFIG_HOME/ntn-skills/`(默认 `~/.config/ntn-skills/credentials.env`),`doctor` 强制校验 `0600` 权限;`new` 与 `push` 上传前执行 Fail-Closed 安全扫描,自动阻断越界符号链接及高危敏感文件(`.env`/`.env.*`(豁免 `.env.example`/`.sample`/`.template`/`.dist`)、私钥证书、`*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc` 及含 `_authToken` 的 `.npmrc`)且绝不打印文件内容;调用统计(`telemetry/usage.jsonl`)与同步日志(`2 MiB` 上限轮转)100% 留在本机,绝不外发。
323
325
  - **非受管目录保护与零永久删除**:`export` 绝不覆盖宿主目录中已有的非受管文件或软链;工作区和过期缓存回收统一移入系统废纸篓;Notion 技能下线走软标记 `Status = retired`。
324
326
  - **形式化验证**:核心并发锁、重叠窗口增量同步与原子快照切换不变量配有 TLA+ 规约(见 [`verification/`](https://github.com/yoyooyooo/ntn-skills/tree/main/verification))。
325
327
 
@@ -328,7 +330,7 @@ magpie library mcp router ntn-skills direct
328
330
  ## 适用范围与非目标
329
331
 
330
332
  - **聚焦 Agent Skills 生命周期**:`ntn-skills` 专注管理基于 `SKILL.md` 与附属脚本/参考文档的技能资产;不承担 MCP Server 托管代理、通用密钥管理或宿主系统初始化编排。
331
- - **刻意保持单向同步边界**:`ntn-skills sync` 仅从 Notion/Git 向本机单向拉取并在 `Local Pending` 提示本地未入库增量,绝不静默将本地临时试验推上云端;所有写回均须显式经过 `new` 或 `edit -> diff --remote -> push`。
333
+ - **刻意保持单向三通道边界**:`ntn-skills sync` 仅从 Notion/Git 向本机单向拉取(支持 `--dry-run` 零磁盘写入预演)并在 `Local Pending` 提示本地未入库增量,绝不静默将本地临时试验推上云端;新建与批量收编走 `new`(含 `--pending` 与 `--dry-run`),修改已有技能走 `edit -> diff --remote -> push`(含批量 `push --pending`)或显式单目录 `push <dir> --overwrite | --to <name>`。
332
334
 
333
335
  ---
334
336
 
package/SECURITY.md CHANGED
@@ -12,7 +12,7 @@
12
12
  - **Local Secret Storage**: `ntn-skills` reads `NOTION_TOKEN` and optional `GITHUB_TOKEN` from `$XDG_CONFIG_HOME/ntn-skills/credentials.env` (default `~/.config/ntn-skills/credentials.env`) and verifies `0600` file permissions via `ntn-skills doctor`.
13
13
  - **Zero Consumer-Time Network Access**: Everyday skill consumption reads immutable local files (`0444/0555`) under `$XDG_DATA_HOME/ntn-skills/store/`. Network calls to `api.notion.com` and configured Git remotes occur only during explicit CLI commands or user-installed background sync jobs.
14
14
  - **Local-Only Telemetry**: Usage counters (`telemetry/usage.jsonl`) and API latency logs are bounded (`2 MiB` rotation) and stored strictly on the local machine. Nothing is transmitted to third-party analytics endpoints.
15
- - **Workdir Secret Scrubbing**: Isolated edit workdirs ignore `.env`, `.env.*`, and credential files during `diff` and `push`.
15
+ - **Fail-Closed Sensitive File Pre-Scan**: Before uploading to Notion, `new` and `push` scan local skill directories to block out-of-root symlinks and sensitive files (`.env`, `.env.*` except `.env.example`/`.sample`/`.template`/`.dist`, private keys/certs `*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`, `*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`, and `.npmrc` containing `_authToken`) without printing file contents.
16
16
 
17
17
  ## Reporting a Vulnerability
18
18
 
@@ -38,13 +38,14 @@ ntn-skills info <name> [--json] </dev/null
38
38
  # 按需物化单个 Skill 到只读 store(仅拿目录路径可加 --path-only)
39
39
  ntn-skills load <name> [--refresh] [--path-only] [--json] </dev/null
40
40
 
41
- # 增量同步(默认 2 分钟重叠窗口)或全量对账(--full)
42
- ntn-skills sync [--full] [--coalesce] [--json] </dev/null
41
+ # 增量同步(默认 2 分钟重叠窗口)、全量对账(--full)或零磁盘写入预演(--dry-run)
42
+ # 注:sync 严格单向只读 Notion,绝不静默向 Notion 回推本地改动;--dry-run 严格零磁盘变更并预览 pulled、plannedMaterializations、plannedExports、plannedPrunes 与 localPending
43
+ ntn-skills sync [--full] [--dry-run] [--coalesce] [--json] </dev/null
43
44
 
44
- # 幂等导出到指定宿主目录(支持属性过滤、精确 --skills 白名单、--exclude 排除、Requires 依赖闭合与 --spec 声明文件批量投影)
45
+ # 幂等导出到指定宿主目录(支持 --dry-run 零写入预览、属性过滤、精确 --skills 白名单、--exclude 排除、Requires 依赖闭合与 --spec 声明文件批量投影)
45
46
  # 注:精确白名单模式忽略全局 visibility/profiles/scenes,默认闭合 Requires(--no-requires 可关)且默认不生成 skill-catalog;对未预物化的 manual 技能会自动按需物化;copy 模式与目标目录中的非受管子目录安全共存
46
- ntn-skills export [--to <dir>] [--skills <a,b>] [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--profile <p>] [--scene <s>] [--mode symlink|copy] [--include-non-default] [--json] </dev/null
47
- ntn-skills export --spec <export-spec.json> [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--json] </dev/null
47
+ ntn-skills export [--to <dir>] [--skills <a,b>] [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--profile <p>] [--scene <s>] [--mode symlink|copy] [--include-non-default] [--dry-run] [--json] </dev/null
48
+ ntn-skills export --spec <export-spec.json> [--exclude <c>] [--with-requires | --no-requires] [--no-router] [--mode symlink|copy] [--dry-run] [--json] </dev/null
48
49
 
49
50
  # 初始化新库(空白 Notion 页自动创建纯净 3 表及双向关系;已有 3 表则直接绑定)或扩展新机器
50
51
  # 支持任意宿主目录(如 Grok Box 的 ${HOME}/agent-data/workflows:copy 实体拷贝模式 + ~/.agents/skills 软链双面同时导出)
@@ -87,8 +88,16 @@ ntn-skills push "$WORKDIR" --dry-run </dev/null
87
88
 
88
89
  # 5) 正式有序推送(先 Files -> 后 SKILL.md -> 再属性 -> 本地同步 -> 自动将 workdir 移入废纸篓)
89
90
  ntn-skills push "$WORKDIR" </dev/null
91
+
92
+ # 6) 批量推送多个工作区或全部未推送工作区(--pending 扫描 work/;单条基线漂移失败隔离,末尾合并执行 1 次本地同步)
93
+ ntn-skills push [<workdir...>] [--pending] [--exclude <name,...>] [--dry-run] [--force] [--library <uuid>] [--json] </dev/null
94
+
95
+ # 7) 普通本地目录直推覆盖已有 Notion 技能(无 .ntn-skill.json 时必须显式传 --overwrite 或 --to <name>,强烈建议先 --dry-run 预览逐文件 diff;绝不删除源本地目录)
96
+ ntn-skills push <plain-dir> --overwrite [--to <skill-name>] [--dry-run] [--library <uuid>] [--json] </dev/null
90
97
  ```
91
98
 
99
+ - **单向三通道边界**:`sync` 永远只读单向拉取 Notion;新建与批量收编走 `new`;修改已有技能走 `edit -> diff --remote -> push`(或显式单目录 `push <dir> --overwrite | --to <name>`)。
100
+ - **敏感文件 Fail-Closed 拦截**:`new` 与 `push` 在上传前自动扫描目录,阻断越界符号链接及高危敏感文件(`.env` / `.env.*`(豁免 `.env.example`/`.env.sample`/`.env.template`/`.env.dist`)、`*.pem`/`*.key`/`*.p12`/`*.pfx`/`id_rsa`/`id_ed25519`/`id_ecdsa`、`*credentials*.json`/`*secret*.json`/`token.json`/`secrets.yaml`/`.netrc`、含 `_authToken` 的 `.npmrc`),仅报相对路径且绝不打印文件内容。
92
101
  - **冲突处置**:若 `diff --remote` 显示 `Remote drift detected` 或 `push` 报 `baseline_drift` 冲突,**严禁未经用户明确授权盲目加 `--force`**!应先核对远端变更,或用 `ntn-skills abort "$WORKDIR" </dev/null` 安全放弃旧工作区后重新 `edit`。
93
102
  - **清理陈旧工作区**:`ntn-skills work clean --days 7 </dev/null`。
94
103
 
@@ -103,7 +112,9 @@ ntn-skills push "$WORKDIR" </dev/null
103
112
  # 注:new / set / push / attach / detach / reset-overlay / rm / source add / upstream apply 成功后均会自动同步本地 catalog.json 并刷新已配置的 exports 软链,无需额外手动跑 sync 或 export!
104
113
  # 注:未显式指定单技能可见性时默认 discoverable,含 disable-model-invocation: true 的技能会自动归入 manual
105
114
  # 若 <dir> 直接位于导出目录内(如先在 ~/.agents/skills/<name> 本地孵化试跑),上传成功后会自动将该本地目录移入废纸篓并原地接管为受管软链或编入 skill-catalog;其他临时目录可加 --adopt 自动回收
106
- ntn-skills new <dir> [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual] [--kind skill|router|prompt] [--profiles default,mini] [--scenes ops,ci] [--adopt | --no-adopt] </dev/null
115
+ # 支持多目录 <dir...>、--pending(扫描配置 exports 中所有非受管本地目录,强制要求显式指定可见性;默认跳过外部软链,--include-symlinks 可纳入)、--exclude 与 --dry-run 零写入预演
116
+ # 批量模式下单条失败(重名/敏感文件/解析异常)隔离记入 failed[] 不连坐健康项,成功项先移入废纸篓,末尾合并执行 1 次本地 sync 重建受管软链
117
+ ntn-skills new [<dir...>] [--pending] [--exclude <name,...>] [--include-symlinks] [--name <name>] [--visibility always|discoverable|manual | --always | --discoverable | --manual | --default] [--kind skill|router|prompt] [--profiles default,mini] [--scenes ops,ci] [--adopt | --no-adopt] [--dry-run] [--library <uuid>] [--json] </dev/null
107
118
 
108
119
  # 声明式修改单个或批量技能元数据(支持多个 <name...> 或 --source <源名> 批量修改,无需 edit/push)
109
120
  ntn-skills set [<name...>] [--source <source-name-or-id>] \