ntn-skills 0.1.2 → 0.2.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/CHANGELOG.md +28 -0
- package/CONTRIBUTING.md +6 -0
- package/README.md +38 -9
- package/README.zh-CN.md +38 -9
- package/SECURITY.md +9 -5
- package/dist/ntn-skills.js +3192 -318
- package/docs/README.md +4 -2
- package/docs/host-integration.md +21 -9
- package/docs/protocol.md +81 -13
- package/docs/releasing.md +2 -0
- package/docs/usage.md +91 -11
- package/package.json +7 -3
- package/skills/ntn-skills/SKILL.md +19 -11
- package/skills/ntn-skills/references/commands.md +37 -4
- package/skills/ntn-skills/references/integration.md +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 — 2026-10-14
|
|
4
|
+
|
|
5
|
+
Current-target reads now reuse complete observations for up to five minutes, and catalogs for up to 60 seconds. Callers that require immediate remote validation must use `--refresh`; pinned snapshot reads remain immutable and offline. Preserve existing configuration/state when upgrading; disposable observations now use the separate cache root.
|
|
6
|
+
|
|
7
|
+
- Read skills from databases with rich-text Description and References, without requiring native Skills exports.
|
|
8
|
+
- Materialize reference pages as relative Markdown files, preserve links through create/import/write/export, and include referenced-page edits in version conflicts.
|
|
9
|
+
- Create editable reference child pages during imports and retain omitted pages in Notion while excluding them from new snapshots and exports.
|
|
10
|
+
- Support page-only libraries without Files, with normalized Markdown and repeat imports that reuse existing pages; optional Files retains exact source bytes and other assets.
|
|
11
|
+
- Report the selected storage mode in doctor and update CLI help, both READMEs, protocol and Agent integration references.
|
|
12
|
+
- Resume interrupted reference imports using existing child-page IDs, reject duplicate paths, and normalize equivalent relative links when comparing page-only content.
|
|
13
|
+
- Report safe transport failure reasons without exposing raw stderr, credentials or signed URLs; preserve unknown write outcomes.
|
|
14
|
+
- Retry transient read/query transport and service failures up to three times with bounded backoff; mutation requests are never retried automatically.
|
|
15
|
+
- Recover transient References attachment downloads with scoped timeouts and bounded retry; reject denied access without retry or signed URL disclosure.
|
|
16
|
+
- Add repository-local verification recipes and command-to-case coverage with isolated config/state/cache and XDG bases, preserved evidence and system-Trash cleanup.
|
|
17
|
+
- Limit npm documentation files to the explicit public guide set; keep implementation designs and verification maps repository-only without broken package-relative links.
|
|
18
|
+
- Add `sync bind/status/plan/apply/reconcile/unbind`, immutable checked plans, per-binding common baselines, grouped multi-target distribution and durable partial/unknown-operation recovery without replaying mutations.
|
|
19
|
+
- Resolve local directory, parent and per-file symlink chains; preserve links on writes, reject saved-target drift at commit guards, retain removed/replaced bytes and fence cooperating processes. Native Node filesystem calls retain a documented check-to-syscall race.
|
|
20
|
+
- Change current reads to complete bounded observations: 5m Skill and 60s catalog defaults, mutually exclusive `--refresh`/`--offline`/`--max-age`, explicit source/freshness metadata and unchanged immutable pinned reads. Writes, sync and doctor still validate online.
|
|
21
|
+
- Add XDG/application cache roots, cache-only status/retirement and configurable cache policy; preserve configuration, bindings, baselines, plans, receipts, immutable snapshots and content objects through cache cleanup/upgrade.
|
|
22
|
+
- Add `import --target` for verified whole-Skill replacement on one existing page, preserving page identity across rename and rejecting stale, missing or non-main targets without creation fallback.
|
|
23
|
+
- Run CI on Ubuntu/macOS 15 and Node.js 22/24 through the package verification controller, retain consumer evidence/tarballs as artifacts, and exercise explicit Linux retention failure without losing cached bytes.
|
|
24
|
+
- Fence the entire content/catalog retirement batch before system Trash operations, so unavailable retention preserves bytes without exposing later observations or accepting delayed publishers.
|
|
25
|
+
|
|
26
|
+
## 0.1.3 — 2026-10-14
|
|
27
|
+
|
|
28
|
+
- Wait for the npm attestation document to become available after registry metadata appears.
|
|
29
|
+
- Give each CLI boundary scenario its own test timeout.
|
|
30
|
+
|
|
3
31
|
## 0.1.2 — 2026-10-14
|
|
4
32
|
|
|
5
33
|
- Publish from GitHub Actions with npm OIDC; verify provenance for public repositories and registry evidence for private repositories.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -12,6 +12,10 @@ bun run dev --help
|
|
|
12
12
|
bun run check && bun run package:check
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Use `bun run dev <command>` to exercise the TypeScript CLI entrypoint directly during development; it uses the default official `ntn` transport without requiring a distribution build.
|
|
16
|
+
|
|
17
|
+
For repeatable live verification, read `.cursor/skills/verify-ntn-skills/SKILL.md` and its feature map in the source checkout. Its executable `control.ts` isolates config/state/cache and XDG bases, records real CLI actions and readback, and preserves evidence while moving owned scratch to system Trash. The map routes the [implemented sync/cache design](https://github.com/yoyooyooo/notion-skills-cli/blob/main/docs/sync-cache-cli-design.md) to acceptance cases; case definitions are not passing results. Live mutations require current task authorization; the npm package excludes these repository-local maintenance files, so unpublished changes must be read from the checkout.
|
|
18
|
+
|
|
15
19
|
Build and pack a consumer artifact from the checkout root:
|
|
16
20
|
|
|
17
21
|
```bash
|
|
@@ -25,6 +29,8 @@ The archive filename follows the package version. Consumers install that tarball
|
|
|
25
29
|
|
|
26
30
|
`check` runs type checking, formatting checks, tests and the Node.js distribution build. `package:check` validates documentation links, packs the CLI and installs it with npm in a fresh consuming project, then executes the installed binary with Node.js. CI covers Node.js 22 and 24 on Linux and macOS. Run both checks before proposing a pull request or release. Tests must not depend on personal credentials or mutate a live Notion workspace. Keep live verification separate and disclose the environment and authorization used.
|
|
27
31
|
|
|
32
|
+
CI uses Ubuntu and macOS 15 with Node.js 22.19.0 and 24. Every job runs the complete deterministic suite, then drives package verification through `control.ts init/package`; successful runs retain the installed-consumer outputs and exact tarball. Per-matrix evidence is uploaded for seven days, including available failure records. macOS jobs require `/usr/bin/trash`, exercise real cache retirement and recycle owned scratch. Linux consumers verify `RETENTION_UNAVAILABLE` and unchanged cached bytes; Linux scratch remains on the disposable runner because no recycle capability is implemented. These checks require no live Notion credentials. Before integration, inspect all four checks for the PR's current head, not an earlier main run.
|
|
33
|
+
|
|
28
34
|
Keep Effect and platform versions aligned at 4.0.4. New commands use `effect/cli`; external execution uses scoped Effect platform capabilities. Pure path and identity transformations remain ordinary TypeScript. Preserve the [JSON and ref contract](docs/protocol.md), explicit discovery coverage and immutable snapshot semantics.
|
|
29
35
|
|
|
30
36
|
Preserve the Skill naming contract: Notion Name uses ASCII English letters and single spaces (1-64 characters); its lowercase form with spaces replaced by hyphens is the invocation name and must equal the export frontmatter name. Do not introduce independent alias configuration or silently normalize invalid titles. Descriptions and file contents may use any language.
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Available on [npm](https://www.npmjs.com/package/ntn-skills). For source builds,
|
|
|
29
29
|
|
|
30
30
|
You maintain reusable instructions in Notion, but an Agent only needs a few of them for its current task. `ntn-skills list` exposes names and descriptions so the Agent can choose a relevant workflow before loading its instructions. `read` loads the selected file and saves the complete Skill export locally.
|
|
31
31
|
|
|
32
|
-
A task can outlive an edit in Notion.
|
|
32
|
+
A task can outlive an edit in Notion. The first successful read returns a **snapshot**: a local, fixed version of the workflow and its files. Keep the returned refs for the task. Ordinary current-target reads may reuse content validated within five minutes; use `--refresh` to adopt a freshly validated remote version for a new task.
|
|
33
33
|
|
|
34
34
|
| When you want to… | Use |
|
|
35
35
|
| --- | --- |
|
|
@@ -37,6 +37,7 @@ A task can outlive an edit in Notion. Reading instructions before that edit and
|
|
|
37
37
|
| Read instructions and supporting files from one version | `read`, then `files` |
|
|
38
38
|
| Move a complete Skill between local files and Notion | `import`, `export` |
|
|
39
39
|
| Add a new Skill or replace one file deliberately | `create`, `write` |
|
|
40
|
+
| Keep an existing page and local Skill directory in sync | `sync bind`, `sync plan`, `sync apply` |
|
|
40
41
|
|
|
41
42
|
## Installation
|
|
42
43
|
|
|
@@ -58,7 +59,7 @@ To produce a package yourself, follow [the contributor setup and build instructi
|
|
|
58
59
|
|
|
59
60
|
### 1. Connect Notion
|
|
60
61
|
|
|
61
|
-
Configure `ntn` through [its authentication guide](https://developers.notion.com/cli/get-started/authentication). Your connection needs Read content access
|
|
62
|
+
Configure `ntn` through [its authentication guide](https://developers.notion.com/cli/get-started/authentication). Your connection needs Read content access to a database with rich-text `Description` and `References` properties. `References` lists Notion page mentions or page links; each linked page becomes a Markdown file under `references/`. The native Skills database/export mode is also supported for existing libraries.
|
|
62
63
|
|
|
63
64
|
That database needs at least one valid Skill. For example, the Notion Name `Release Review` maps to `name: release-review` in its exported `SKILL.md`. Names use English letters separated by single spaces, up to 64 characters; descriptions and instructions can use any language. [Naming and database requirements](docs/protocol.md#identity-and-references).
|
|
64
65
|
|
|
@@ -71,7 +72,7 @@ ntn-skills doctor
|
|
|
71
72
|
ntn-skills list
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
With a valid Skill available, `doctor` should report `ok: true`, `authentication: "available"`, a positive `skill_count`, and `
|
|
75
|
+
With a valid Skill available, `doctor` should report `ok: true`, `authentication: "available"`, a positive `skill_count`, and `skill_read.available: true`. It reads and caches one Skill to verify the selected storage mode. `list` returns metadata and coverage without loading workflow bodies.
|
|
75
76
|
|
|
76
77
|
Notion Search may miss databases. Read `coverage`; if you know the database, use `ntn-skills list --database 'DATABASE_ID_OR_URL'`, replacing that value with your database ID or URL.
|
|
77
78
|
|
|
@@ -83,7 +84,7 @@ Copy an entry's `ref` from `skills` into this command, replacing the placeholder
|
|
|
83
84
|
ntn-skills read 'REF_FROM_LIST'
|
|
84
85
|
```
|
|
85
86
|
|
|
86
|
-
A successful response contains `ok: true`,
|
|
87
|
+
A successful response contains `ok: true`, instructions in `content`, a `snapshot_id` starting with `s_`, and a pinned `ref` containing `?snapshot=...`. `source: "notion"` means online validation; `source: "local_cache"` means a bounded cached observation. Retain `freshness`, the ref and snapshot ID with your task. Add `--refresh` to the current ref when current remote access/content must be checked. [Response fields](docs/protocol.md#success).
|
|
87
88
|
|
|
88
89
|
### 4. Read supporting files from the same version
|
|
89
90
|
|
|
@@ -125,18 +126,46 @@ ntn-skills write 'PINNED_REF_FROM_READ' --input ./SKILL.md --dry-run
|
|
|
125
126
|
|
|
126
127
|
`create` requires a new name. `import` creates an absent name, reuses identical content, or replaces the existing same-name Skill's body, metadata and complete file set. `write` replaces one file while retaining the others; run it without `--dry-run` to apply the reviewed change. Pinned writes check the current online version and fail if it changed. [Inputs, conflicts and partial outcomes](docs/usage.md#creating-importing-exporting-and-updating-skills).
|
|
127
128
|
|
|
129
|
+
Use `import ./my-skill --target 'CURRENT_PAGE_ID_OR_PINNED_MAIN_REF' --database ops --dry-run` to replace a selected existing page deliberately. `--target` preserves that page identity even when imported name/description changes; a missing, inaccessible or stale target fails without creating a page or falling back to its imported name.
|
|
130
|
+
|
|
131
|
+
### Synchronize a local distribution directory
|
|
132
|
+
|
|
133
|
+
Replace `PAGE_ID` and `PLAN_ID` with actual returned identities. The binding label is local configuration, separate from a Skill's invocation alias.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
ntn-skills sync bind PAGE_ID --path ~/.agents/skills/release-review --as release-review-global
|
|
137
|
+
ntn-skills sync plan release-review-global --from notion
|
|
138
|
+
ntn-skills sync apply --plan PLAN_ID
|
|
139
|
+
ntn-skills sync status release-review-global
|
|
140
|
+
ntn-skills sync plan --all --output ./skills-plan.json
|
|
141
|
+
ntn-skills sync apply --plan ./skills-plan.json
|
|
142
|
+
ntn-skills sync reconcile release-review-global
|
|
143
|
+
ntn-skills sync unbind release-review-global --dry-run
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Equal initial contents can initialize a common baseline at bind; differing or absent local contents require an explicit `--from local|notion` initialization plan. Later plans use each binding's confirmed baseline to select direction or report a conflict. Apply rechecks the saved binding, versions, content and logical/resolved path before effects; a copied plan cannot authorize a different machine or binding. Status is local/provisional unless `--refresh` is used. Reconcile inspects unfinished receipts without replaying writes. Unbind deactivates configuration and retains content, baselines, plans and receipts. Symlink paths retain their logical links; removed/replaced bytes go through system Trash retention. See [sync usage](docs/usage.md#synchronizing-local-skills).
|
|
147
|
+
|
|
148
|
+
### Maintain reference pages in Notion
|
|
149
|
+
|
|
150
|
+
Add page mentions or links to the rich-text `References` property. A link labeled `references/guide.md` fixes the local path; otherwise the page title determines its filename. Write normal Notion page links in the instructions: reads and exports turn links to included pages into relative paths such as `./references/guide.md`. Links between reference files resolve from the containing file, and CLI writes restore the Notion URLs. Other websites and code examples remain unchanged.
|
|
151
|
+
|
|
152
|
+
`create` and `import` turn `references/**/*.md` into editable child pages. `write` updates the page behind a reference path. Removing a reference from an imported file set excludes it from new snapshots but retains the Notion page. `Files` is optional for page-only libraries; keep it when preserving original source bytes, extra frontmatter or non-Markdown assets. See [the References contract](docs/protocol.md#references-pages).
|
|
153
|
+
|
|
154
|
+
|
|
128
155
|
## Agent integration
|
|
129
156
|
|
|
130
157
|
Copy the [bootstrap Skill](skills/ntn-skills/SKILL.md) directory into your Agent host's supported local skill directory. It teaches the Agent to discover metadata, read a selected workflow, and follow pinned attachment refs through shell commands.
|
|
131
158
|
|
|
132
159
|
For startup awareness of every available workflow, the host needs a startup hook that runs `ntn-skills list` and injects the returned metadata. A bootstrap Skill by itself does not expose the remote catalog at startup. Direct use of `Read skill://...` requires a host adapter; shell integration works wherever shell tools are available. [Host integration contract](docs/host-integration.md).
|
|
133
160
|
|
|
161
|
+
Inspecting or maintaining a Skill does not activate its instructions. Hosts activate only a workflow selected for the current task and retain its freshness metadata; no downloaded content or script executes automatically.
|
|
162
|
+
|
|
134
163
|
## Boundaries and local data
|
|
135
164
|
|
|
136
|
-
- Local verification covers npm installation
|
|
137
|
-
- Explicit `create`, `import`, and `
|
|
138
|
-
- Configuration defaults to `~/.config/ntn-skills/config.json`; snapshots and
|
|
139
|
-
- Online operations use `ntn` and Notion's signed download URLs. The CLI sends no telemetry requests of its own; `ntn` has its own policies. Imported scripts are never executed automatically.
|
|
165
|
+
- Local verification covers npm installation and seeded offline behavior on macOS arm64 with Node.js 24.20.0 and Linux arm64 with the minimum Node.js 22.19.0. Real Notion reads were verified on macOS with `ntn` 0.22.12. CI is configured for Node.js 22.19.0 and 24 on Ubuntu and macOS 15; configured jobs do not establish successful runs for a new change. Windows is unverified.
|
|
166
|
+
- Explicit `create`, `import`, `write` and `sync apply` commands change content. Version checks are client preflight checks; body, properties, and files are separate requests. On partial/unknown outcomes, inspect the target; use `sync reconcile` for an unfinished sync receipt before another apply.
|
|
167
|
+
- Configuration defaults to `~/.config/ntn-skills/config.json`; retained snapshots, uploads and sync recovery state to `~/.local/state/ntn-skills`; disposable observations to `~/.cache/ntn-skills`. Freshness defaults are five minutes for content and 60 seconds for catalogs. [Cache policy and cleanup](docs/usage.md#cache-policy-and-cleanup) explain overrides and system Trash retention.
|
|
168
|
+
- Online operations use `ntn` and Notion's signed download URLs. Safe local identity is required for unpinned offline lookup; official-login identity may still require online checks. A cached observation does not prove present access. The CLI sends no telemetry requests of its own; `ntn` has its own policies. Imported scripts are never executed automatically.
|
|
140
169
|
|
|
141
170
|
See [configuration and storage](docs/protocol.md#environment-and-local-storage), [error recovery](docs/protocol.md#errors), and [security and privacy](SECURITY.md).
|
|
142
171
|
|
|
@@ -144,7 +173,7 @@ See [configuration and storage](docs/protocol.md#environment-and-local-storage),
|
|
|
144
173
|
|
|
145
174
|
For a tarball installation, obtain the newer built package and repeat the npm installation command. Read [the changelog](CHANGELOG.md) before a 0.x minor upgrade. Source builds follow [the contributor instructions](CONTRIBUTING.md#development-setup).
|
|
146
175
|
|
|
147
|
-
Remove a global installation with `npm uninstall --global ntn-skills`. Configuration and
|
|
176
|
+
Remove a global installation with `npm uninstall --global ntn-skills`. Configuration, cache and retained state remain afterward, including pinned versions, sync baselines/plans and unfinished receipts. To remove a saved token, run `ntn-skills config clear-token` before uninstalling. Upgrade retains state/config and rebuilds disposable observations in the cache root; use `--refresh` in callers that previously assumed every unpinned read was fresh. [Removal and optional retention](docs/usage.md#upgrade-and-uninstall) explain what to preserve.
|
|
148
177
|
|
|
149
178
|
## Documentation and contributing
|
|
150
179
|
|
package/README.zh-CN.md
CHANGED
|
@@ -29,7 +29,7 @@ ntn-skills read 'Release Review'
|
|
|
29
29
|
|
|
30
30
|
你在 Notion 中维护了一组可复用的操作指令,但 Agent 在当前任务里只需要其中几项。`ntn-skills list` 先提供名称和描述,让 Agent 选出适用的工作流,再用 `read` 读取需要的文件,同时把该 Skill 的完整导出保存到本地。
|
|
31
31
|
|
|
32
|
-
任务执行期间,Notion
|
|
32
|
+
任务执行期间,Notion 内容可能被修改。第一次成功读取会返回一个**快照**,把工作流和附件固定为一个本地版本。任务中持续使用返回的引用。普通未固定版本的读取可复用五分钟内验证过的内容;新任务需要确认远端最新内容时,在当前目标上加 `--refresh`。
|
|
33
33
|
|
|
34
34
|
| 你想做什么 | 使用的命令 |
|
|
35
35
|
| --- | --- |
|
|
@@ -37,6 +37,7 @@ ntn-skills read 'Release Review'
|
|
|
37
37
|
| 从同一版本读取指令和附件 | `read`,再用 `files` |
|
|
38
38
|
| 在本地文件和 Notion 之间迁移完整 Skill | `import`、`export` |
|
|
39
39
|
| 明确新增一个 Skill 或替换一个文件 | `create`、`write` |
|
|
40
|
+
| 同步已有 Notion 页面与本地 Skill 目录 | `sync bind`、`sync plan`、`sync apply` |
|
|
40
41
|
|
|
41
42
|
## 安装
|
|
42
43
|
|
|
@@ -58,7 +59,7 @@ ntn-skills --help
|
|
|
58
59
|
|
|
59
60
|
### 1. 连接 Notion
|
|
60
61
|
|
|
61
|
-
按[官方认证指南](https://developers.notion.com/cli/get-started/authentication) 配置 `ntn`。连接需要 Read content
|
|
62
|
+
按[官方认证指南](https://developers.notion.com/cli/get-started/authentication) 配置 `ntn`。连接需要 Read content 权限,并能访问具备 `Description` 和 `References` 两个富文本属性的数据库。`References` 保存 Notion 页面提及或页面链接,CLI 将这些页面转成 `references/` 下的 Markdown。已有原生 Skills 数据库及其导出模式也可继续使用。
|
|
62
63
|
|
|
63
64
|
数据库中至少需要一个有效 Skill。比如,Notion 中的 Name 为 `Release Review`,其导出的 `SKILL.md` 必须包含 `name: release-review`。名称只能用英文字母,单词之间用一个空格,最多 64 个字符;描述和正文可以使用任何语言。[命名与数据库要求](docs/protocol.md#identity-and-references)。
|
|
64
65
|
|
|
@@ -71,7 +72,7 @@ ntn-skills doctor
|
|
|
71
72
|
ntn-skills list
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
有效 Skill 可访问时,`doctor` 应返回 `ok: true`、`authentication: "available"`、大于零的 `skill_count`,以及 `
|
|
75
|
+
有效 Skill 可访问时,`doctor` 应返回 `ok: true`、`authentication: "available"`、大于零的 `skill_count`,以及 `skill_read.available: true`。它实际读取并缓存一个 Skill,验证当前存储模式。`list` 返回元数据和覆盖范围,不加载工作流正文。
|
|
75
76
|
|
|
76
77
|
Notion Search 可能漏掉数据库。请查看 `coverage`;如果已知数据库,可使用 `ntn-skills list --database 'DATABASE_ID_OR_URL'`,将其中的值替换成实际数据库 ID 或 URL。
|
|
77
78
|
|
|
@@ -83,7 +84,7 @@ Notion Search 可能漏掉数据库。请查看 `coverage`;如果已知数据
|
|
|
83
84
|
ntn-skills read 'REF_FROM_LIST'
|
|
84
85
|
```
|
|
85
86
|
|
|
86
|
-
成功响应包含 `ok: true`、`content`
|
|
87
|
+
成功响应包含 `ok: true`、`content` 中的指令、以 `s_` 开头的 `snapshot_id`,以及包含 `?snapshot=...` 的固定版本 `ref`。`source: "notion"` 表示本次在线验证,`source: "local_cache"` 表示有时间边界的缓存观察。将 `freshness`、引用和快照 ID 保留在任务上下文中;需要确认当前访问权限与远端内容时,对当前引用加 `--refresh`。[响应字段说明](docs/protocol.md#success)。
|
|
87
88
|
|
|
88
89
|
### 4. 从同一版本读取附件
|
|
89
90
|
|
|
@@ -125,18 +126,46 @@ ntn-skills write 'PINNED_REF_FROM_READ' --input ./SKILL.md --dry-run
|
|
|
125
126
|
|
|
126
127
|
`create` 要求名称尚不存在。`import` 会创建缺失的名称、复用相同内容,或替换已有同名 Skill 的正文、元数据和完整文件集。`write` 只替换一个文件,保留其他文件;确认预览后,去掉 `--dry-run` 执行。固定版本写入会在线核对当前版本,版本已变化就失败。[输入格式、冲突与部分成功的处理](docs/usage.md#creating-importing-exporting-and-updating-skills)。
|
|
127
128
|
|
|
129
|
+
用 `import ./my-skill --target 'CURRENT_PAGE_ID_OR_PINNED_MAIN_REF' --database ops --dry-run` 明确替换已有页面。即使导入的名称、描述变化,`--target` 仍保留选定页面身份;目标缺失、不可访问或版本过期时失败,不按导入名称回退或创建新页。
|
|
130
|
+
|
|
131
|
+
### 同步本地分发目录
|
|
132
|
+
|
|
133
|
+
将 `PAGE_ID`、`PLAN_ID` 替换为实际返回值。绑定标签是本地配置,与 Skill 调用别名分开。
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
ntn-skills sync bind PAGE_ID --path ~/.agents/skills/release-review --as release-review-global
|
|
137
|
+
ntn-skills sync plan release-review-global --from notion
|
|
138
|
+
ntn-skills sync apply --plan PLAN_ID
|
|
139
|
+
ntn-skills sync status release-review-global
|
|
140
|
+
ntn-skills sync plan --all --output ./skills-plan.json
|
|
141
|
+
ntn-skills sync apply --plan ./skills-plan.json
|
|
142
|
+
ntn-skills sync reconcile release-review-global
|
|
143
|
+
ntn-skills sync unbind release-review-global --dry-run
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
首次绑定两侧相同时可初始化共同基线;不同或本地普通目录末级尚不存在时,必须用 `--from local|notion` 明确选择初始化来源。后续计划按各绑定已确认的基线判断方向或报告冲突。执行前重新检查绑定、版本、内容、逻辑路径与真实目标;复制计划不能授权在另一台机器或另一绑定执行。`status` 默认只报告本地与已有远端观察,`--refresh` 才在线验证。`reconcile` 检查未完成回执,不重放写入。`unbind` 停用绑定并保留内容、基线、计划和回执。符号链接保留逻辑路径与链接;移除、替换的旧字节通过系统废纸篓保留。详见[同步使用说明](docs/usage.md#synchronizing-local-skills)。
|
|
147
|
+
|
|
148
|
+
### 在 Notion 中维护参考页面
|
|
149
|
+
|
|
150
|
+
在富文本 `References` 属性中添加页面提及或链接。链接文字写成 `references/guide.md` 时固定本地路径,否则按页面标题生成文件名。正文照常使用 Notion 页面链接;CLI 读取和导出时转换为 `./references/guide.md` 等相对路径。参考文档互相引用时按所在文件目录解析,CLI 写回时恢复 Notion URL。其他网站链接和代码示例保持原样。
|
|
151
|
+
|
|
152
|
+
`create`、`import` 将 `references/**/*.md` 创建为可编辑的子页面;`write` 更新对应参考页。导入时移除某个参考文件,会让它退出新快照,原 Notion 页面保留。纯页面库可以不设 `Files`;需要保留原始字节、额外 frontmatter 或非 Markdown 资源时继续保留它。详见 [References 契约](docs/protocol.md#references-pages)。
|
|
153
|
+
|
|
154
|
+
|
|
128
155
|
## 接入 Agent
|
|
129
156
|
|
|
130
157
|
把[引导 Skill](skills/ntn-skills/SKILL.md) 所在目录复制到 Agent 宿主支持的本地 Skill 目录。它让 Agent 通过终端命令发现元数据、读取选中的工作流,并沿固定版本引用读取附件。
|
|
131
158
|
|
|
132
159
|
如果希望宿主启动时就知道所有可用工作流,需要启动钩子执行 `ntn-skills list` 并注入返回的元数据。仅安装引导 Skill,并不会在启动时自动暴露远端目录。直接使用 `Read skill://...` 需要宿主适配器;宿主提供终端工具时,即可通过 CLI 接入。[宿主接入契约](docs/host-integration.md)。
|
|
133
160
|
|
|
161
|
+
检查或维护 Skill 不会激活其中的指令。宿主仅激活当前任务选择的工作流并保留其新鲜度信息;下载的内容、脚本不会自动执行。
|
|
162
|
+
|
|
134
163
|
## 使用边界与本地数据
|
|
135
164
|
|
|
136
|
-
-
|
|
137
|
-
- 明确执行 `create`、`import` 或 `
|
|
138
|
-
- 配置默认位于 `~/.config/ntn-skills/config.json
|
|
139
|
-
- 在线操作通过 `ntn` 和 Notion 的签名下载 URL
|
|
165
|
+
- 本地已在 macOS arm64 的 Node.js 24.20.0 和 Linux arm64 的最低 Node.js 22.19.0 验证 npm 安装与预置快照的离线行为;真实 Notion 读取用 macOS 和 `ntn` 0.22.12 验证。CI 已配置 Ubuntu、macOS 15 上的 Node.js 22.19.0 和 24;工作流配置不代表新变更的运行已成功。Windows 未验证。
|
|
166
|
+
- 明确执行 `create`、`import`、`write` 或 `sync apply` 会修改内容。版本检查属于客户端预检查;正文、属性和文件由不同请求更新。遇到部分成功或结果未知,先检查目标;未完成同步应先执行 `sync reconcile`,再生成新的执行计划。
|
|
167
|
+
- 配置默认位于 `~/.config/ntn-skills/config.json`;快照、上传暂存和同步恢复状态位于 `~/.local/state/ntn-skills`;可丢弃观察缓存位于 `~/.cache/ntn-skills`。正文默认五分钟、目录元数据默认 60 秒;[缓存策略与清理](docs/usage.md#cache-policy-and-cleanup)说明配置及系统废纸篓保留。
|
|
168
|
+
- 在线操作通过 `ntn` 和 Notion 的签名下载 URL 完成。未固定版本的离线查找必须能安全确定本地身份范围;官方登录身份可能仍需在线检查。缓存观察不能证明当前权限。CLI 自身不发送遥测请求;`ntn` 有自己的政策。导入的脚本不会自动执行。
|
|
140
169
|
|
|
141
170
|
详见[配置与存储](docs/protocol.md#environment-and-local-storage)、[错误恢复](docs/protocol.md#errors) 和[安全与隐私](SECURITY.md)。
|
|
142
171
|
|
|
@@ -144,7 +173,7 @@ ntn-skills write 'PINNED_REF_FROM_READ' --input ./SKILL.md --dry-run
|
|
|
144
173
|
|
|
145
174
|
tarball 安装可获取新版已构建安装包,再执行 npm 安装命令。跨 0.x 次版本升级前,请阅读[变更记录](CHANGELOG.md)。源码构建按[贡献指南](CONTRIBUTING.md#development-setup) 操作。
|
|
146
175
|
|
|
147
|
-
全局安装用 `npm uninstall --global ntn-skills`
|
|
176
|
+
全局安装用 `npm uninstall --global ntn-skills` 卸载。配置、缓存和保留状态仍在,包括固定版本、同步基线、计划与未完成回执。需要移除已保存的 token 时,在卸载前执行 `ntn-skills config clear-token`。升级保留状态与配置,在独立缓存根重建可丢弃观察;原先假定每次未固定读取都在线的调用者应加 `--refresh`。[卸载与可选保留说明](docs/usage.md#upgrade-and-uninstall)说明应保留哪些数据。
|
|
148
177
|
|
|
149
178
|
## 文档与贡献
|
|
150
179
|
|
package/SECURITY.md
CHANGED
|
@@ -14,21 +14,25 @@ The maintainer aims to acknowledge reports within seven days. This is a response
|
|
|
14
14
|
|
|
15
15
|
Authentication priority is config.token, non-empty NOTION_API_TOKEN, then official ntn's existing login state. An explicitly saved token is plaintext in the private config.json; it is supplied to the ntn child process through its environment and never appears in command arguments, command output or snapshot state. config set-token requires piped stdin and saves offline without validating the credential; config show reports only token_configured. config clear-token removes the configuration token and restores environment/login fallback. The CLI never reads ntn's private credential files or persists signed download URLs. Explicit create/import/write commands mutate Notion using the selected connection; --dry-run only reads and validates. Read operations do not execute scripts or grant write authority. Exported skill contents are untrusted documents; reading does not authorize instructions unrelated to the user's task.
|
|
16
16
|
|
|
17
|
-
Cached content is private local data and can remain available after remote permission changes. Explicit snapshot reads are offline.
|
|
17
|
+
Cached content is private local data and can remain available after remote permission changes. Explicit snapshot reads are offline. Current-target reads may reuse a complete observation within the configured age; use `--refresh` to verify present remote access. Isolate `NTN_SKILLS_HOME`, `NTN_SKILLS_CONFIG_HOME` and `NTN_SKILLS_CACHE_HOME` for separate host identities; a shared config token overrides a host's environment credential. Protect all three roots and config.json backups according to your retention policy. Defaults are `~/.local/state/ntn-skills`, `~/.config/ntn-skills` and `~/.cache/ntn-skills`. Configuration files use mode 0600; new application directories use mode 0700. Legacy configuration migration preserves a `.migrated` backup in the old state directory.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Content/catalog defaults of five minutes/60 seconds control freshness only. Immutable snapshot manifests, content-addressed objects, uploads and sync baselines/plans/receipts are retained without automatic garbage collection; upload staging can contain original input bytes. Uninstalling retains configuration, state and cache. `cache clear` retires only disposable observations through the implemented system Trash capability and preserves recovery state. Where retention is unavailable it fails explicitly and leaves bytes in place. Remove a saved token with `config clear-token`; deliberately reclaim other identified directories only through an approved recycle/retention process after stopping hosts. State cleanup loses pinned versions and sync recovery history. See [storage and uninstall guidance](docs/usage.md#upgrade-and-uninstall).
|
|
20
|
+
|
|
21
|
+
Cache retirement invalidates the selected content/catalog observation batch before moving bytes. A retention error leaves unmoved files in place but does not reactivate those observations or delayed publishers. Pinned content and recovery state remain usable; see the [retention contract](docs/protocol.md#environment-and-local-storage).
|
|
20
22
|
|
|
21
23
|
## Network and local access
|
|
22
24
|
|
|
23
25
|
The CLI sends no analytics or telemetry requests of its own. Online commands invoke the executable selected by `NTN_SKILLS_NTN_BIN` (default `ntn`) for Notion authentication/API requests and uploads, then download export archives from signed URLs returned by Notion. This does not attest to the official CLI's telemetry, credential storage or network policies. Treat an executable override as executable code you trust.
|
|
24
26
|
|
|
25
|
-
Local access covers configuration
|
|
27
|
+
Local access covers configuration, retained state, disposable cache, explicitly selected ZIP/folder/Markdown or write inputs, requested outputs and registered logical sync directories with their resolved destinations. Explicit create/import/write and sync push operations may upload those inputs. `NOTION_WORKSPACE_ID` and `NOTION_API_BASE_URL` enter the cache scope and are inherited by `ntn`. Workspace selection follows its authentication rules; the API base URL override can direct authenticated requests to another endpoint, so use only an endpoint you trust. Signed archive downloads follow the URLs returned by the service independently. See [the environment contract](docs/protocol.md#environment-and-local-storage).
|
|
26
28
|
|
|
27
29
|
## Content and mutation boundaries
|
|
28
30
|
|
|
29
|
-
Archives reject root escapes, duplicate entries, links and special files, with compressed/expanded limits. ZIPs expand in memory and verify checksums.
|
|
31
|
+
Archives reject root escapes, duplicate entries, links and special files, with compressed/expanded limits. ZIPs expand in memory and verify checksums. Files preserves extra metadata, nested paths and binary bytes in a source ZIP without executing them. References mode reads the inclusion list of page mentions/links and rewrites only links to included pages; code examples and external URLs remain unchanged. Without Files, main/reference Markdown is normalized. Create rejects existing names; import replaces differing same-name content on the existing page and excludes omitted reference pages without deleting them. Write preserves unrelated logical files. Local read/export output verifies bytes, reuses identical output and rejects differing output without overwrite. Portable manifests add no generated remote identity or timestamps; original source fields may remain verbatim. Hashes detect corruption, not malicious authorized local modification.
|
|
32
|
+
|
|
33
|
+
Pinned write refs are checked against the current authentication scope, page identity and complete version, including all referenced-page content. This is a client preflight check, not a server-side atomic commit. Body/properties/files can partially succeed; mutation requests are not automatically retried. Read back WRITE_PARTIAL/WRITE_OUTCOME_UNKNOWN before retrying. A new write returns a new snapshot and never edits historical objects. The configured default database affects creation only; explicit --database has priority.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
Sync plans/applies always validate online; read TTL cannot authorize a write. Saved plans retain binding, version, baseline, content and link preconditions. Unknown/partial outcomes retain receipts and fence overlapping resources until `sync reconcile` observes them without replay. Local links are preserved through real-destination writes, but Node commit guards are not atomic protection against a noncooperating process's link retargeting. Removed/replaced bytes require system Trash; unsupported hosts retain bytes and report the missing capability. [Synchronization contract](docs/protocol.md#synchronization).
|
|
32
36
|
|
|
33
37
|
Database selection accepts one ID/URL or exact registered alias; IDs/URLs take priority and titles do not select targets. Unknown, conflicting or inaccessible aliases fail without redirecting to a default. Repeated --database flags fail before any command handler. Different databases may hold the same Skill name; name resolution fails on ambiguity, while page-ID refs remain exact. A pinned alias constraint checks local registration and snapshot database ownership without network access. Configuration registration aliases are local preferences, not remote identity or proof of permission.
|
|
34
38
|
|