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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ntn-skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Discover, read and maintain Notion skills with immutable task snapshots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,11 @@
|
|
|
33
33
|
"files": [
|
|
34
34
|
"dist",
|
|
35
35
|
"skills",
|
|
36
|
-
"docs",
|
|
36
|
+
"docs/README.md",
|
|
37
|
+
"docs/usage.md",
|
|
38
|
+
"docs/protocol.md",
|
|
39
|
+
"docs/host-integration.md",
|
|
40
|
+
"docs/releasing.md",
|
|
37
41
|
"README.md",
|
|
38
42
|
"README.zh-CN.md",
|
|
39
43
|
"LICENSE",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"@effect/platform-node": "4.0.4"
|
|
51
55
|
},
|
|
52
56
|
"devDependencies": {
|
|
53
|
-
"@notion-skills-cli/core": "0.
|
|
57
|
+
"@notion-skills-cli/core": "0.2.0"
|
|
54
58
|
},
|
|
55
59
|
"license": "MIT"
|
|
56
60
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ntn-skills
|
|
3
|
-
description: Discover, read, create, import, export and
|
|
4
|
-
compatibility: Requires Node.js >= 22.19.0, official ntn CLI, ntn-skills, and
|
|
3
|
+
description: Discover, read, create, import, export and synchronize reusable workflows in Notion through ntn-skills. Use when a task may benefit from the Notion skill library, names a remote skill, follows skill:// references, or requests Skill maintenance/sync. Read metadata first, then needed files; retain freshness and pinned refs, and review saved sync plans before authorized apply.
|
|
4
|
+
compatibility: Requires Node.js >= 22.19.0, official ntn CLI, ntn-skills, and a Notion Read content connection to a database with rich-text Description/References or native Skills support. Creating/importing/updating requires Insert/Update content capabilities. Shell tool access is sufficient; host protocol adapters are optional.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Remote Notion skills
|
|
@@ -12,10 +12,12 @@ Authentication priority is non-empty config.token > NOTION_API_TOKEN > existing
|
|
|
12
12
|
|
|
13
13
|
Notion Name uses ASCII English letters and single spaces, with no surrounding spaces and at most 64 characters. Its lowercase, hyphenated form is the skill's invocation name: `Resource Tag Governance` → `resource-tag-governance`. Each listed `name` is the display title and `alias` is that invocation name. The export's `SKILL.md` name must match it. Descriptions and contents may use any language.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
References is a rich-text inclusion list of Notion page mentions or links. These pages become references/*.md; a link label such as references/subdirectory/guide.md fixes its path, otherwise its page title determines the filename. Included page links become relative paths, including links back to SKILL.md. External URLs and code examples stay unchanged. Follow those paths within the pinned snapshot. Referenced-page edits participate in write conflicts. Native Skills exports remain supported when References is absent. See [the storage contract](../../docs/protocol.md#references-pages).
|
|
16
|
+
|
|
17
|
+
1. If remote metadata is already supplied, choose from it; otherwise run `ntn-skills list`. It returns databases/skills/count/coverage without bodies. Join database_id to the database map for title/domain alias. `--query` filters Name/alias/Description; broaden it when needed. Catalogs default to 60 seconds; `--refresh` requests fresh metadata. Preserve coverage and freshness; cached discovery does not prove workspace completeness.
|
|
16
18
|
2. Select a workflow by its name and Description. List entries are discovery data. Inspecting, editing, summarizing, or configuring a skill does not activate its instructions.
|
|
17
|
-
3. Run `ntn-skills read "<exact display name>"` or
|
|
18
|
-
4. Record
|
|
19
|
+
3. Run `ntn-skills read "<exact display name>"` or use its current listed ref. It obtains a complete snapshot without an open step. Ordinary current reads accept content validated within five minutes; use `--refresh` when a fresh remote observation is required, or deliberate `--offline` only when local scope can be selected safely. Official-login identity may still need online validation; do not promise zero-network warm reads in that mode.
|
|
20
|
+
4. Record `source`, `freshness`, `snapshot_id` and the pinned `ref`. `notion` means online validated, `local_cache` means an unpinned cached observation, and `local_snapshot` means an immutable pinned version. Read supporting files only as needed from that snapshot:
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
23
|
ntn-skills read <snapshot-id> --path references/guide.md
|
|
@@ -24,22 +26,28 @@ Notion Name uses ASCII English letters and single spaces, with no surrounding sp
|
|
|
24
26
|
|
|
25
27
|
5. Relative links resolve from the containing file. Use `read relative-path --from '<pinned ref>'`; resolve is an optional helper. `read`, `files`, `open`, `write` and `export` share targets: Name, invocation alias, page ID/URL, skill:// ref or snapshot ID. --path supplies a path only when the target has none; --from rejects --path. `files <snapshot-id>` returns pinned file refs.
|
|
26
28
|
6. For binary bytes, use --output and a host viewer; identical local output is reused, differing output returns OUTPUT_CONFLICT. Reading scripts does not authorize execution.
|
|
27
|
-
7. Keep one snapshot throughout a workflow. Pinned refs/snapshot IDs read
|
|
29
|
+
7. Keep one snapshot throughout a workflow. Pinned refs/snapshot IDs read or export offline and do not prove latest remote freshness. Refresh a current unpinned target to adopt a newer version. `--refresh`, `--offline` and `--max-age DURATION` are mutually exclusive; pinned targets and pinned relative `--from` reject refresh/max-age. There is no automatic stale fallback after online failure. Raw text omits freshness metadata.
|
|
28
30
|
|
|
29
31
|
`skill://<name-or-page-id>/<path>?snapshot=<id>` is handled by this CLI. A built-in Read tool accepts it only if the host registered an adapter. Do not assume a Skill can register that adapter.
|
|
30
32
|
|
|
31
33
|
Output is JSON with ok, identity, snapshot, path and content. Errors are JSON with nonzero exit status. Do not treat a failed command as Skill content. Cross-database same-name Skills are allowed: retain both page identities. On SKILL_AMBIGUOUS, use details.databases with candidate database_id to select a domain, or use a returned page-ID ref. Every --database accepts one ID, URL or exact case-sensitive registered alias; repeated flags fail before execution and titles are display labels only. Register with source add frontend --database DATABASE_ID, then read NAME --database frontend. Unknown or conflicting aliases fail without fallback. Pinned alias constraints resolve locally and enforce cached database ownership. On incomplete discovery, report failed_sources database_id/alias/title/data_source_id instead of claiming uniqueness. Search cannot prove full workspace enumeration.
|
|
32
34
|
|
|
33
|
-
For maintenance, edit one local file and run `ntn-skills write '<pinned ref>' --input ./SKILL.md --dry-run`, then execute within the current authorization. --path selects a file only when the target has no path. A pinned target is an online version baseline. Stale refs return WRITE_CONFLICT; identical input returns unchanged=true without upload or mutation.
|
|
35
|
+
For maintenance, edit one local file and run `ntn-skills write '<pinned ref>' --input ./SKILL.md --dry-run`, then execute within the current authorization. --path selects a file only when the target has no path. A pinned target is an online version baseline. Stale refs return WRITE_CONFLICT; identical input returns unchanged=true without upload or mutation. Reference paths update their Notion pages and restore page URLs. Writes preserve unrelated logical files; optional Files retains extra frontmatter and nested/binary assets in the source ZIP. notion_page_id in SKILL.md must match the target. A changed write returns a new pinned snapshot.
|
|
34
36
|
|
|
35
|
-
Create/import target
|
|
37
|
+
Create/import without an explicit target choose --database > config.default_database > sole freshly discovered Skills Database. `config set-default` validates online and stores the canonical ID; show/clear-default manage it. Failed defaults never fall back. This preference does not restrict reads and cannot redirect an existing import target.
|
|
36
38
|
|
|
37
|
-
`create <input>` and `import <input>` share ZIP/folder/Markdown inputs
|
|
39
|
+
`create <input>` and `import <input>` share ZIP/folder/Markdown inputs and --name/--description overrides. Portable manifests select metadata/entrypoints; other ZIPs/folders choose SKILL.md or one top-level Markdown after wrapper removal. A single Markdown filename is the body. Missing names derive from English filenames; missing descriptions require --description. References Markdown becomes editable child pages, allocated before writing cyclic links. Files retains extra Skill frontmatter, arbitrary filenames and nested assets in ntn-skills-source.zip; without Files only main/reference Markdown is accepted and formatting/frontmatter is normalized. Imported page IDs never select a target. Input ZIP max 32 MiB compressed; expanded/folder max 128 MiB/10,000 entries; source ZIP max 20 MiB including its manifest. Unsafe/duplicate paths, links and special files fail before mutation.
|
|
38
40
|
|
|
39
|
-
Create
|
|
41
|
+
Create requires a new invocation name or returns CREATE_CONFLICT. Import without target creates absent names, reuses identical content or replaces differing content on the same-name page. `import INPUT --target TARGET` selects one existing current page or pinned main-file/snapshot baseline instead: preserve page ID when metadata renames it, constrain with --database, reject reference-file targets, and fail missing/inaccessible/stale targets without create/name fallback. Overwrite replaces the whole file set; omitted references remain in Notion. Preview with --dry-run. Version checks are strong online client checks, not an atomic server guarantee.
|
|
40
42
|
|
|
41
43
|
`export <target> --output <path> [--format zip|directory]` writes a complete reversible Skill. .zip selects ZIP; other paths select directory. Pinned targets work offline. Preserve .ntn-skills.json for metadata/entrypoint and title casing. Original source bytes stay exact while their recorded projection matches current body/metadata; live edits regenerate the main file and retain other content. ZIP order/timestamps are deterministic. Identical destinations return reused=true; different output returns OUTPUT_CONFLICT. Reimport reuses identical content or overwrites differing same-name content.
|
|
42
44
|
|
|
43
|
-
New pages write body after properties to preserve an initial H1
|
|
45
|
+
New pages write body after properties to preserve an initial H1. Optional source ZIPs record normalized body/name/description and reference projections. Successful changes verify complete saved content; page-only mode compares normalized Markdown. Create/import return input_type/main_path/content_id/action/reused; write adds previous_version_id/path/unchanged. Body/properties/files are separate requests. Insert/Update and Read content are required. WRITE_PARTIAL/WRITE_OUTCOME_UNKNOWN includes stage/page identity; read back before retrying. Dry runs cannot prove service acceptance.
|
|
46
|
+
|
|
47
|
+
For an authorized local distribution workflow, bind an existing current page with `sync bind PAGE_ID --path LOGICAL_DIR --as LABEL` (optional --database/--dry-run). Equal content may initialize a common baseline; otherwise review `sync plan LABEL --from notion` or `--from local`, then `sync apply --plan PLAN_ID`. Later `sync plan LABEL` or `sync plan --all` selects direction from each confirmed baseline and rejects competing/two-sided contents. `--output ./plan.json` saves a reviewable copy; apply accepts that path but rechecks digest, registered binding/scope, baseline generation, remote version, local hashes and link proof. Neither reads nor plans advance baselines.
|
|
48
|
+
|
|
49
|
+
`sync status [LABEL]` is local/provisional; --refresh validates only the remote observation. Apply advances each baseline only after verified convergence. Keep partial/unknown receipts and run `sync reconcile LABEL` before another apply; reconciliation reads actual effects without replaying mutation. `sync unbind LABEL [--dry-run]` deactivates configuration and retains contents/bases/plans/receipts. Logical directory/parent/per-file links are preserved, drift rejects plans, and commit-boundary checks are not an atomic guarantee against external filesystem retargeting. Removed/replaced bytes require system Trash retention. See [sync usage](../../docs/usage.md#synchronizing-local-skills) and [protocol](../../docs/protocol.md) rather than inventing plan fields.
|
|
50
|
+
|
|
51
|
+
`cache status [TARGET] [--database SELECTOR]` is offline. `cache clear TARGET [--database SELECTOR] [--dry-run]` or `cache clear --all [--dry-run]` retires disposable observations through system Trash; never erase immutable snapshots/objects or sync recovery state. Config/state/cache roots use NTN_SKILLS_CONFIG_HOME/NTN_SKILLS_HOME/NTN_SKILLS_CACHE_HOME and their XDG fallbacks; isolate all three. `config set-cache-policy --read-max-age 5m --catalog-max-age 60s` saves defaults; clear-cache-policy restores built-ins. Durations use nonnegative integers `0`, `Ns`, `Nm`, `Nh`, `Nd`. Upgrades rebuild disposable cache and retain pinned/state data; uninstall retains all roots. [Cache/storage guidance](../../docs/usage.md#cache-policy-and-cleanup).
|
|
44
52
|
|
|
45
53
|
See [commands and errors](references/commands.md) for exact flags and responses. See [discovery and host integration](references/integration.md) when setting up metadata injection or handling missing sources.
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# Commands and recovery
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
ntn-skills list [--query text] [--database id-or-url-or-alias] [--refresh]
|
|
4
|
+
ntn-skills list [--query text] [--database id-or-url-or-alias] [--refresh | --offline | --max-age duration]
|
|
5
5
|
ntn-skills read "Exact Display Name"
|
|
6
6
|
ntn-skills read skill://exact-display-name/SKILL.md
|
|
7
7
|
ntn-skills open <target>
|
|
8
8
|
ntn-skills files <target> [--path directory-or-file]
|
|
9
|
+
ntn-skills read <current-target> --refresh
|
|
10
|
+
ntn-skills open <current-target> --max-age 30s
|
|
11
|
+
ntn-skills files <current-target> --offline
|
|
9
12
|
ntn-skills read <snapshot-id> --path references/guide.md
|
|
10
13
|
ntn-skills read references/guide.md --from '<pinned-main-ref>'
|
|
11
14
|
ntn-skills resolve ../assets/template.md --from '<pinned-reference-ref>'
|
|
@@ -16,10 +19,16 @@ ntn-skills config set-default <id-or-url-or-alias>
|
|
|
16
19
|
ntn-skills config clear-default
|
|
17
20
|
ntn-skills config set-token --stdin
|
|
18
21
|
ntn-skills config clear-token
|
|
22
|
+
ntn-skills config set-cache-policy --read-max-age 5m --catalog-max-age 60s
|
|
23
|
+
ntn-skills config clear-cache-policy
|
|
24
|
+
ntn-skills cache status [target] [--database id-or-url-or-alias]
|
|
25
|
+
ntn-skills cache clear <current-target> [--database id-or-url-or-alias] [--dry-run]
|
|
26
|
+
ntn-skills cache clear --all [--dry-run]
|
|
19
27
|
ntn-skills create <zip-or-folder-or-markdown> [--database id-or-url-or-alias] [--name title] [--description text] [--dry-run]
|
|
20
28
|
ntn-skills import ./my-skill.zip [--database id-or-url-or-alias] [--name 'My Skill'] [--description text] [--dry-run]
|
|
21
29
|
ntn-skills import ./my-skill [--dry-run]
|
|
22
30
|
ntn-skills import ./workflow.md --name 'My Workflow' --description 'When to use this workflow'
|
|
31
|
+
ntn-skills import ./renamed-skill --target '<current-page-id-or-pinned-main-ref>' [--database id-or-url-or-alias] [--dry-run]
|
|
23
32
|
ntn-skills export 'My Workflow' --output ./my-workflow.zip
|
|
24
33
|
ntn-skills export '<pinned-main-ref>' --output ./my-workflow [--format directory]
|
|
25
34
|
ntn-skills export <snapshot-id> --output ./my-workflow.zip
|
|
@@ -28,6 +37,13 @@ ntn-skills write 'skill://exact-display-name/vocabulary.md' --input ./vocabulary
|
|
|
28
37
|
ntn-skills write <snapshot-id> --path references/guide.md --input ./guide.md
|
|
29
38
|
ntn-skills database list [--database id-or-url-or-alias]
|
|
30
39
|
ntn-skills doctor
|
|
40
|
+
ntn-skills sync bind <current-target> --path <logical-directory> [--as label] [--database id-or-url-or-alias] [--dry-run]
|
|
41
|
+
ntn-skills sync status [binding] [--refresh]
|
|
42
|
+
ntn-skills sync plan <binding> [--from local|notion] [--output ./reviewed-plan.json]
|
|
43
|
+
ntn-skills sync plan --all [--output ./reviewed-plan.json]
|
|
44
|
+
ntn-skills sync apply --plan <plan-id-or-json-file>
|
|
45
|
+
ntn-skills sync reconcile <binding>
|
|
46
|
+
ntn-skills sync unbind <binding> [--dry-run]
|
|
31
47
|
```
|
|
32
48
|
|
|
33
49
|
list returns databases/skills/count/coverage and paginates automatically without bodies. Join each Skill database_id to the map (database_id/title/alias/data_source_ids); the Skill alias remains its invocation name. --query filters Skill Name/alias/Description and retains the full queried database map. --database selects one ID/URL/exact case-sensitive registered alias; database titles never select targets and repeated flags fail with INVALID_ARGUMENT/exit 2. Register a domain with source add frontend --database DATABASE_ID, then list --database frontend. Unknown/conflicting aliases return DATABASE_NOT_FOUND/DATABASE_AMBIGUOUS. --refresh bypasses metadata cache. Failed queries retain database_id/alias/title and data_source_id in coverage.failed_sources. database list discovers databases without Skill row queries. Shared read/files/open/write/export targets accept Name, invocation alias, page ID/URL, ref or snapshot ID. Pinned read/files/open/export targets are offline, including local alias constraints; pinned writes are online baselines. --path cannot combine with a target already containing a path; read --from rejects --path.
|
|
@@ -38,6 +54,8 @@ Authentication: config.token > non-empty NOTION_API_TOKEN > existing ntn login.
|
|
|
38
54
|
|
|
39
55
|
The default successful read is JSON with `ok=true`, content, page identity, snapshot ID, version, pinned ref, and range metadata. `--raw` returns successful text only and should be used only when the caller already keeps version state. Help/version are text; every failure is JSON.
|
|
40
56
|
|
|
57
|
+
Current-target `read`, `open`, `files`, `export` and `list` accept at most one of `--refresh`, `--offline`, `--max-age DURATION`. Default content/catalog limits are 5m/60s. Refresh validates online, offline intentionally uses eligible local observations even if expired, and max-age overrides the invocation (`0` requires validation). Durations use finite nonnegative integers `0`, `Ns`, `Nm`, `Nh`, `Nd`. Pinned targets and pinned relative --from reject refresh/max-age; redundant offline is allowed. JSON source is notion/local_cache/local_snapshot with freshness metadata; a hit does not update validation time and failed validation does not fall back to stale. Existing official-login identity may require online checking; unpinned offline lookup must fail if scope cannot be selected safely. Writes, sync plans/applies/reconcile and doctor always validate online. [Protocol](../../../docs/protocol.md#success).
|
|
58
|
+
|
|
41
59
|
Errors have `ok=false`, `error.code`, `error.message`, and optional `error.details`. Exit 1 is an operation failure; exit 2 is invalid CLI input.
|
|
42
60
|
|
|
43
61
|
- SKILL_AMBIGUOUS: candidates and their owning databases map are under details; scope by database alias or choose a page-ID ref. Do not select the first row or collapse cross-database same-name entries.
|
|
@@ -52,16 +70,31 @@ Errors have `ok=false`, `error.code`, `error.message`, and optional `error.detai
|
|
|
52
70
|
- `CREATE_CONFLICT`: create requires a new name; use import to replace the existing Skill or supply another --name.
|
|
53
71
|
- `OUTPUT_CONFLICT`: choose a new destination; the existing output differs and is never overwritten.
|
|
54
72
|
- `INVALID_ARCHIVE`, `ARCHIVE_TOO_LARGE`: fix the ZIP or import size/count limits (32 MiB compressed ZIP, 128 MiB expanded/folder, 10,000 entries); unsafe/duplicate paths, links, special files and checksum failures are rejected.
|
|
55
|
-
- `WRITE_CONFLICT`: remote version differs from the pinned baseline;
|
|
56
|
-
- `WRITE_PARTIAL`, `WRITE_OUTCOME_UNKNOWN`: inspect details.stage/completed/page_id and
|
|
73
|
+
- `WRITE_CONFLICT`: remote version differs from the pinned baseline; refresh the current target and rebuild the edit.
|
|
74
|
+
- `WRITE_PARTIAL`, `WRITE_OUTCOME_UNKNOWN`: inspect details.stage/completed/page_id and refresh the current page before an explicit retry; do not refresh the old pinned ref. For unfinished sync, retain its receipt and reconcile before another apply.
|
|
57
75
|
- `MARKDOWN_INCOMPLETE`: truncated or unsupported page Markdown prevents safe writes.
|
|
76
|
+
- `INVALID_REFERENCES`, `REFERENCE_PATH_CONFLICT`, `REFERENCE_NOT_FOUND`: fix page links, safe distinct Markdown paths and page access in References.
|
|
77
|
+
- `UNSUPPORTED_FILE`: add Files to retain non-reference assets, or submit only main/reference Markdown.
|
|
58
78
|
- `INPUT_FAILED`, `INVALID_INPUT`, `FILE_TOO_LARGE`: correct the local input or size (20 MiB per upload).
|
|
59
79
|
- `FILE_NOT_FOUND`: inspect files and preserve the actual layout.
|
|
60
80
|
- `BINARY_FILE`: use output; do not decode binary content as instructions.
|
|
61
81
|
- `AUTH_REQUIRED`, `ACCESS_DENIED`, `NTN_UNAVAILABLE`: diagnose the selected credential and runtime; config.token overrides environment/login credentials. Use config clear-token to restore fallback. Never ask the user to paste credentials into command output or start a login implicitly.
|
|
82
|
+
- Transport failures: inspect `details.reason` or nested `cause_details.reason` (`timeout`, `process`, `dns`, `tls`, `network`, `invalid_response`); never request raw stderr that may contain credentials or signed URLs.
|
|
83
|
+
- Read/query calls retry transient network and service failures up to three times with 1/2/4-second backoff; mutation calls never retry automatically.
|
|
84
|
+
- After readback of an interrupted reference import, repeat the same input/database to reuse matching child-page IDs; duplicate paths fail with `REFERENCE_PATH_CONFLICT`.
|
|
62
85
|
|
|
63
86
|
Line numbers are inclusive and 1-based. Relative paths resolve from the containing file. Traversal outside the skill root is rejected. Scripts are files; reading them does not authorize execution.
|
|
64
87
|
|
|
65
|
-
Create/import priority: --database > config.default_database > sole discovered
|
|
88
|
+
Create/import priority: --database > config.default_database > sole discovered skill database; failed defaults never fall back. Both accept ZIP/folder/Markdown, choose manifest or SKILL.md/unique Markdown and accept --name/--description overrides. References Markdown becomes editable child pages; writes restore Notion page links. Files preserves source bytes, extra frontmatter and other assets in a source ZIP (20 MiB including manifest). Without Files only main/reference Markdown is accepted and export is normalized. Create rejects existing invocation names. Import creates absent names, reuses identical content, or replaces different body/metadata/whole file sets on the existing page. Omitted reference pages remain in Notion but are excluded from new snapshots. Imported page IDs never select the target. Overwrite uses fresh version checks; --dry-run validates the storage mode and reports create/reuse/update without mutation. Write replaces one logical file and keeps others; unchanged bytes return unchanged=true. Pinned refs are online write baselines; child-only edits cause conflicts. Body/properties/files are separate requests; partial/unknown outcomes require readback.
|
|
66
89
|
|
|
67
90
|
Export accepts names/page IDs/URLs, pinned refs and snapshot IDs. Pinned exports are offline. --output is required; .zip selects ZIP, otherwise a directory, with --format zip|directory available. Output includes .ntn-skills.json, original source names/bytes/paths for unchanged imports, and current remote edits otherwise. Preserve the manifest for reimport. Deterministic ZIPs contain no generated page/version identity or timestamps. ZIP output fits 20 MiB; portable content fits 128 MiB and 10,000 entries including the manifest. Identical existing output returns reused=true; different output fails with OUTPUT_CONFLICT. Success includes content_id, main_path, format, output and files. Reimporting an unchanged export reuses its page.
|
|
91
|
+
|
|
92
|
+
With `import --target`, select an existing current page or pinned main-version baseline once. Imported name/description changes preserve page ID; --database constrains that target, reference-file targets are rejected, and missing/inaccessible/stale targets fail with no create/name fallback. Imported identity metadata itself never selects the target. [Mutation contract](../../../docs/protocol.md#mutation-contract).
|
|
93
|
+
|
|
94
|
+
Sync binds canonical page IDs to logical local paths. Equal registration may initialize a baseline; differing or absent ordinary local leaves need explicit source-selection initialization. Plan is a preview with retained digest-protected state; --all checks shared-page candidates and independent baselines. A review copy remains executable only against its registered resources after scope/version/base/hash/link rechecks. Apply advances baselines only after confirmed convergence and persists per-binding/group receipts; reconcile reads outcomes without replay. Unresolved receipts fence affected resources. Logical links are preserved, target drift is rejected, and commit guards cannot promise atomicity against external retargeting. Unbind retains content/bases/plans/receipts; removed/replaced bytes use system Trash. [Workflow](../../../docs/usage.md#synchronizing-local-skills).
|
|
95
|
+
|
|
96
|
+
Reconcile pending operations before reactivating/relabeling a binding. Recovery permits an unchanged binding or one unbind that leaves it inactive; a later revision returns `SYNC_PLAN_STALE` while retaining the fence. [Recovery contract](../../../docs/protocol.md#synchronization).
|
|
97
|
+
|
|
98
|
+
Cache status is offline. Clear requires one current target or --all and retires only disposable scoped observations via system Trash, preserving immutable snapshots/objects and all sync state. Missing retention support fails rather than deleting permanently. Config/state/cache roots are separate; isolate all three. Upgrades rebuild disposable cache while retaining pinned/state/config data; uninstall retains all roots. [Policy, cleanup and migration](../../../docs/usage.md#cache-policy-and-cleanup).
|
|
99
|
+
|
|
100
|
+
Before moving bytes, clear invalidates the entire selected content/catalog batch and rejects its delayed publishers. A retention error preserves unmoved files without making those observations usable again; refresh for a new current observation. Pinned versions and sync recovery remain available. [Retention contract](../../../docs/protocol.md#environment-and-local-storage).
|
|
@@ -4,10 +4,12 @@ Use [the README](../../../README.md#quick-start) for prerequisites, installation
|
|
|
4
4
|
|
|
5
5
|
Install the built CLI package with npm and run it on Node.js 22.19.0 or newer. The host must put Node.js and `ntn-skills` on PATH; online operations also need the official `ntn` executable. Repository development/build/test tooling uses Bun separately.
|
|
6
6
|
|
|
7
|
-
Discover metadata before loading bodies
|
|
7
|
+
Discover metadata before loading bodies. Read an actual current ref returned by `list`, require `ok: true`, and retain `content`, `ref`, `snapshot_id`, `version_id`, `source` and `freshness`. Ordinary content reads accept observations validated within five minutes (`source=local_cache`); `--refresh` validates current remote access/content (`source=notion`). Use `files <snapshot_id>` for every file in the fixed version and follow its pinned refs (`source=local_snapshot`). Pinned versions do not claim latest freshness. Inspecting, summarizing, editing or configuring a retained Skill does not activate its instructions; activate only the workflow selected for the task. No content or script executes automatically.
|
|
8
8
|
|
|
9
9
|
ntn-skills list follows all Search/row-query pages and returns databases/skills/count/coverage without bodies. Join Skill database_id to database title/alias/data_source_ids; Skill alias remains its invocation name. --query filters Skill Name/alias/Description and retains the full queried database map, including empty/no-match databases. --refresh bypasses the list cache. Discovery is limited to credential visibility and cannot prove workspace-wide completeness; preserve failed_sources database_id/alias/title/data_source_id. database list discovers database maps without querying Skill rows.
|
|
10
10
|
|
|
11
|
+
Discovery accepts native Skills databases and data sources with rich-text Description and References. References mode uses page Markdown; included page links become relative files under references/, with a path fixed by a `.md` link label or derived from the page title. Reference-only edits change the version. Optional Files preserves source bytes and other assets; without it main/reference Markdown exports are normalized. Host adapters retain the same command/ref interface for both modes. See [References pages](../../../docs/protocol.md#references-pages).
|
|
12
|
+
|
|
11
13
|
To query a known database directly:
|
|
12
14
|
|
|
13
15
|
```bash
|
|
@@ -19,22 +21,24 @@ All --database flags and config set-default accept one ID, URL or exact case-sen
|
|
|
19
21
|
|
|
20
22
|
Source registrations are local, supplement discovery, and do not modify Notion. No custom Status filter is applied by default. Notion Name must use ASCII English letters separated by single spaces and be at most 64 characters. Lowercase it and replace spaces with hyphens to obtain the invocation name shown as the listed `alias`; the export's frontmatter `name` must match. Exact display titles and invocation names resolve only when one distinct page ID matches; case-only title differences can collide. Invalid titles return `INVALID_SKILL_NAME`, and mismatched export names return `INVALID_SKILL`. Descriptions and contents may use any language.
|
|
21
23
|
|
|
22
|
-
Source registrations live in `~/.config/ntn-skills/config.json
|
|
24
|
+
Source registrations and sync bindings live in config (`~/.config/ntn-skills/config.json`); immutable snapshots/objects, uploads, baselines/plans/receipts in state (`~/.local/state/ntn-skills`); disposable latest/catalog/selector observations in cache (`~/.cache/ntn-skills`). Override the complete roots with NTN_SKILLS_CONFIG_HOME, NTN_SKILLS_HOME and NTN_SKILLS_CACHE_HOME; XDG config/state/cache bases are also supported. Isolate all three for separate hosts. Legacy valid state config migrates only when new config is absent, retaining a `.migrated` backup. Upgrades preserve state/config and rebuild disposable indexes; old catalogs cannot manufacture freshness or initialize baselines.
|
|
23
25
|
|
|
24
26
|
The config may contain default_database. config set-default accepts the same ID/URL/alias selector, validates online and stores its canonical ID. Manage it through config show/clear-default. It applies to create/import only: --database wins, then the default, then the sole freshly discovered database. Name conflict/reuse/update is scoped to that database. Failed defaults and failed/ambiguous discovery never silently redirect writes.
|
|
25
27
|
|
|
26
|
-
Authentication selects non-empty config.token > NOTION_API_TOKEN > existing ntn login.
|
|
28
|
+
Authentication selects non-empty config.token > NOTION_API_TOKEN > existing ntn login. Set a token through trusted piped stdin, never arguments/logs; clear-token restores fallback. Config operations preserve sources/defaults/policy/bindings and report token presence only. Tokens are plaintext with private permissions. Separate roots do not isolate official login; safe local credential/workspace/endpoint identity is required for eligible cached lookup. Official-login identity may need online validation; unpinned offline selection fails when scope cannot be determined safely. Pinned snapshots remain explicitly offline and older scopes remain readable; obtain a fresh current ref before writing from an older scope. [Scope contract](../../../docs/protocol.md#environment-and-local-storage).
|
|
27
29
|
|
|
28
30
|
`NTN_SKILLS_NTN_BIN` selects the trusted official CLI executable, default `ntn`. `NOTION_WORKSPACE_ID` and `NOTION_API_BASE_URL` enter the authentication scope and are inherited by `ntn`; workspace selection follows its authentication rules, while `ntn api` honors the API base URL override. Select a trusted endpoint because authenticated requests may reach it. Signed archive downloads follow the returned URLs independently. See [the environment contract](../../../docs/protocol.md#environment-and-local-storage).
|
|
29
31
|
|
|
30
|
-
The CLI sends no analytics requests of its own. Online operations
|
|
32
|
+
The CLI sends no analytics requests of its own. Online operations use official `ntn` and signed download URLs; `ntn` has its own policies. Local access includes config/state/cache, explicit inputs and outputs. State's private immutable bytes, uploads and sync recovery have no automatic garbage collection. Content/catalog defaults are 5m/60s, configurable through set-cache-policy; TTL controls freshness, not retention. Cache status is offline and clear retires disposable observations through system Trash only. Uninstall retains all roots and pinned versions/recovery evidence. [Retention guidance](../../../docs/usage.md#upgrade-and-uninstall) and [security policy](../../../SECURITY.md).
|
|
31
33
|
|
|
32
34
|
For startup awareness, the host must inject list metadata or carry an instruction to use this bootstrap Skill for relevant tasks. A Skill description alone does not guarantee that the host already knows every remote workflow.
|
|
33
35
|
|
|
34
36
|
For direct Read tool support, the host must register a skill:// protocol adapter that invokes ntn-skills read with an argument array, parses JSON, preserves the snapshot, and propagates errors. If the host already owns skill:// for local skills, route explicitly instead of replacing its handler. Without an adapter, invoke the CLI through the shell tool.
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Current read/open/files/export/list accept mutually exclusive `--refresh`, `--offline` or `--max-age DURATION`; expired ordinary reads validate or fail without stale fallback. Pinned snapshots and relative pinned --from reject refresh/max-age and permit redundant offline. Preserve JSON freshness; raw text omits it. Cached local content can remain after remote access revocation and is not proof of current permission. Never modify immutable cache/state objects directly.
|
|
37
39
|
|
|
38
40
|
For host Write integration, call `["write", uri, "--input", localFile]` as an argument array under current task authorization. Reuse the pinned read ref as the remote version baseline, propagate conflicts and partial/unknown outcomes, and adopt the new returned snapshot only after success. Never mutate cache objects or automatically retry an uncertain remote write. CLI support for skill:// writes does not register a host Write adapter.
|
|
39
41
|
|
|
42
|
+
For complete replacement, `import INPUT --target TARGET` selects an existing current page or pinned main-version baseline, preserves page ID on metadata rename, rejects reference-file targets and never falls back to create/name selection. Database constrains that target. Host synchronization registers a logical local path with sync bind, initializes differing/absent local content through an explicit sync plan --from notion|local, and applies only its saved plan ID/review copy after version/scope/base/hash/link checks. Plan --all checks shared-page candidates; status is provisional unless refreshed. Baselines advance only after verified convergence. Retain unresolved receipts and use sync reconcile without replay before another apply; unbind retains content/recovery. Logical links survive, retargeting invalidates plans, and filesystem checks are not atomic against external retargeting. Removed/replaced bytes require system Trash. [Sync workflow](../../../docs/usage.md#synchronizing-local-skills) and [authoritative protocol](../../../docs/protocol.md).
|
|
43
|
+
|
|
40
44
|
Adapters must tolerate additional JSON fields and propagate unfamiliar error codes as failures. Patch releases preserve current semantics; 0.x minor releases may break compatibility with documented migration steps. See [CONTRIBUTING](../../../CONTRIBUTING.md#compatibility-and-deprecation) and [the release procedure](../../../docs/releasing.md).
|