ntn-skills 0.3.0 → 2.0.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 CHANGED
@@ -1,213 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
4
-
5
- - Add one pinned `apply` for sparse file additions/changes, explicit removals and metadata, reusing the original publication and recovery operation. Reject stale baselines and main-file deletion before effects.
6
- - Add `sync upstream connect SOURCE` and `sync local connect TARGET --path DIR` for initial registration plus synchronization. Repeated matching connections reuse their existing subscription or binding; recurring work uses `run`.
7
- - Make upstream `run` continue confirmable original work and restore confirmed owned tracked pages from Notion Trash. Keep missing/inaccessible pages and unresolved outcomes explicit; local runs settle retained receipts only when observations confirm convergence.
8
- - Read stable manual edits to committed Notion content through ordinary current reads and `--refresh`, preserving immutable pinned snapshots and original publication/write guards.
9
- - Keep daily help/schema on the public command tree, wrap array results as `{ok:true,items:[...]}`, and expose legal next commands in errors. Move historical upstream adoption/repair/rebuild and operation edit-acceptance tools to the separately distributed `ntn-skills-operator`.
10
- - Align bundled Skill and host guidance with ordinary `$ntn-skills@builtin`, `$ntn-skills-maintain@builtin` and `$ntn-skills-sync@builtin` selection. Explicit central installation remains optional for independently managed local copies.
11
- - Add metadata revalidation of locally verified native Skill source bundles for ordinary read/files/export. Bind the checkpoint to authenticated scope, generator/source snapshot, complete page and References observations, and immutable attachment identity; reuse all local files without repeated Markdown/block reads or ZIP downloads when unchanged. Expose `freshness.validation="metadata"` and preserve it through TTL hits/cache status. First alignment, missing/changed evidence, `--refresh`, explicit `--max-age 0`, writes and sync retain complete validation. Keep same-timestamp limitations explicit and exclude mutable external attachments, Router/Prompt and editable-file storage.
12
- - Preserve exact member Tags when rebuilding or restoring an upstream Skill, with frozen-property checks, conflicting-edit protection and unknown-write readback; invalidate affected View observations.
13
- - Add ordered Notion `views`, native `list --view` and `list --default-view`, with independent scoped observation caches and complete-query validation. Keep full explicit discovery separate from a host-selected View.
14
- - Isolate exact tracked-member reads from unrelated sibling failures; actual cross-member reads still validate their target and pinned source-map identity.
15
- - Retain historical `ntn-skills-operator upstream restore-deleted SUBSCRIPTION_ID MEMBER_KEY --operation p_...` for one mapped member whose original page is already in Notion Trash. Prove page ownership and Trash state before publishing a distinct current-source page and switching only that mapping. Refuse a live page before any publication; preserve missing or inaccessible reads instead of treating them as deletion. Repeat the same operation after interruption. Ordinary `sync upstream run` now owns this confirmed-deletion recovery as part of recurring synchronization.
16
- - Retain explicit historical `ntn-skills-operator upstream rebuild SUBSCRIPTION_ID MEMBER_KEY --operation p_...` for one current source member. Move its owned old page to Notion Trash, publish a distinct native rendered main page and References child pages, and switch only that member mapping. Resume the same operation's frozen source after interruption without replaying an unknown outcome; use a different operation to fetch again. This is separate from `apply --member` and does not require the old page ID or byte-identical round-trip.
17
- - Allow an explicit one-member upstream rebuild to create a new native page that shares an invocation name. Ordinary create and upstream apply still return `CREATE_CONFLICT`, and the existing page is never overwritten; selection remains by exact page ID. Preserve the member page `Default Context` separately from the subscription Router checkbox: omission keeps the old member page value, an explicit value writes only that page, and a missing checkbox fails before the write with `PROPERTY_UNAVAILABLE`. Freeze the current revision and complete source manifest for cross-member resource resolution.
18
- - Compare subscription member maps structurally after schema decoding rather than by JSON key order. Preserve current unselected members and source metadata when a committed one-member rebuild resumes mapping; reconcile an unknown map write without replaying its PATCH. Keep upstream portable identity separate from publication integrity hashes.
19
-
20
- - Add a native `Source URL` column to upstream subscription tables and derive its clickable destination on add/update. Keep `Source` authoritative, support Git/marketplace/registry display URLs and leave local sources empty; existing-table initialization adds the column without rewriting source configuration.
21
-
22
- - Add Source Type (`builtin`/`upstream`/`manual`) and exact Builtin ID through explicit additive database initialization, including repeated published attaches, without legacy backfill. Preserve ordinary write provenance and legacy create compatibility; require source schema preflight for builtin/upstream publication. Support journaled metadata-only updates, mutation-free complete reuse and frozen source/property recovery without new public record fields or CLI flags.
23
- - Recover an acknowledged publication metadata assignment after its readback fails without repeating the PATCH or changing the retained response. Preserve guarded owned-business retries and use the same source-aware ownership representation throughout content-adoption proof. Keep metadata-only editable-file recovery independent of file ordering without appending content.
24
- - Add explicit `ctl cache gc`, including `--dry-run` and `--online --database`. Offline GC moves only unreachable snapshot manifests and content objects to system Trash; online GC requires one complete refreshed catalog before releasing a missing record's history. Keep `cache clear` limited to SQL observations and generation fences, with no filesystem deletion.
25
- - Offer automatic subscription Routers only for at least two verified published active Skills. Keep zero/single-member subscriptions out of Router discovery, enforce the same minimum on current exact reads and status/check, and preserve independent member Skills and upstream display namespaces. Invalidate prior catalogs and subscription Router observations while retaining pinned historical snapshots and manually authored Router behavior.
26
- - Keep successful development builds silent so global shims return clean CLI output; retain failed-build diagnostics on stderr and Node.js execution. Document the public-command consumer boundary and Broker-provided pinned resource identities, using `read SNAPSHOT --path RELATIVE` when local paths are hidden or shell tools interpret URI arguments.
27
- - Document the OMP/Pi Context Broker's default lightweight CLI XML guidance, including resolved command/scope, effective-context deduplication and restoration after compaction; align the entrypoint reference and host integration contract.
28
- - Align broker consumption guidance with database-scoped CLI argument examples, top-level read result fields, pinned resource refs, direct relative resource reads and reuse of complete bodies for inspection without running workflow setup.
29
- - Apply a configurable 30-second timeout to each network attempt via `NTN_SKILLS_REQUEST_TIMEOUT_MS`, including Notion API and file downloads. Keep pagination, admission and retry waits outside individual attempt budgets so complete reads may exceed one minute; preserve unknown write outcomes and cancellation.
30
- - Publish optional upstream display metadata on validated active-member catalog records, using the Notion subscription Name's callable alias instead of repository URL basenames or registry slugs. Display `pstack/correct` and `matt/retro` from the existing Pstack/Matt subscriptions while retaining exact member selectors and snapshot identities, without additional discovery requests.
31
- - Invalidate catalogs produced before subscription names controlled upstream display namespaces, so an upgraded CLI does not keep serving cached `plugins/correct` or `skills/retro` labels.
32
- - Add offline `ctl cache identity [--database SELECTOR]` for shared consumer metadata indexes, binding an opaque digest to selected credentials and the resolved remote catalog scope. Exclude project paths, command spelling, local preferences, cache policy and sync bindings; return the effective TTL separately. Preserve credential isolation, ordinary read authorization and the bounded local official-login lookup.
33
-
34
- - Record recurring upstream workflow status, last attempt, last successful sync and a summary directly in the subscription table. Refresh successful times on unchanged runs, preserve them on partial/failure, accept native Notion date precision, continue remaining targets and return a nonzero structured batch result when incomplete. Serialize each subscription's full run within one state root; existing-table initialization adds the four workflow fields.
35
-
36
- - Reuse complete content and subscription query inventories when listing subscription Routers instead of refetching every database, Router and member page. Preserve committed-marker, ownership, key, hash, target and coverage checks; explicit Router activation still revalidates fresh member metadata.
37
- - Batch online subscription activation through fresh, fully paginated publisher-relation queries rather than individual member-page GETs. Reuse validated rows to materialize Router snapshots, retaining exact parent, ownership, key, hash and committed-state checks; reject missing members and invalid pagination without falling back to cached metadata.
38
-
39
- - Add explicit `operation resume --retry-metadata` for guarded idempotent ownership/commit assignments in editable-file publications. Preserve original unknown requests with linked separate PATCH outcomes; reject append/create/upload/arbitrary-page replay, scope/guard/source drift and incompatible artifact recovery. Avoid repeating already applied ownership during editable-file commit.
40
-
41
- - Clarify the storage policy: daily/upstream publication uses rendered main Markdown and References child pages for every supporting Markdown document, preserving original root/nested paths (commonly `references/**`), with scripts/non-Markdown assets in Files/the source bundle. Retain the legacy References page-title fallback when no explicit Markdown path label exists. Permit only whitespace/equivalent local formatting differences; reject content loss and whole-document code-block substitution. Reserve explicit `markdown_files` for a particular source-file maintenance choice, never a failure fallback/default bulk migration; document exact-target `replace --storage notion_blocks` for returning literal pages to rendered storage. This policy entry does not claim a completed live library conversion.
42
- - Retain complete paginated child inventories after acknowledged native reference creation, including the boundary where ordinary blocks push child pages past 100 raw rows. Recover older synthetic single-page guards through complete public reconciliation without duplicate creates or dropping conflict history. Bind root/nested reference creation discovery to the frozen source path and hash. Keep normalized native read files stable for committed Publication manifests; source ZIP/export bytes remain separately verified. Invalidate the incorrect in-session source-restored read snapshots through a new materialization version.
43
- - Compare omitted heading-to-paragraph gaps and plain punctuation escapes only with complete ordered physical block evidence, preserving the exact retained target, source text and link/annotation identities. Keep changed prose or marker payloads rejected. Extract private Markdown comparison helpers without changing public exports.
44
- - Preserve complete quote/paragraph intervals, a terminal list-owned table, literal single-tilde ranges and split bold inline-code links through source-bound physical readback proofs. Escape inline placeholder tags in future native request bodies without changing source files, code, destinations or parser-warning failures. Permit guarded continuation of an original native preserve-replace's initial marker or exact References registration, retaining the original unknown history and checking frozen source hashes before property retries.
45
- - Reassess an already retained terminal unknown source-upload orphan only after exact artifact identity/bytes and all current publication effects converge. Preserve the unknown request, absent response and conflict history; public reconciliation does not allocate, and a separate upload still requires explicit `--new-artifact`.
46
- - Preserve editable-file operation/metadata boundaries and guard current targets before replacement. Reconcile upstream literal-file publications against committed live files instead of demoting completed receipts through rendered-Markdown journals. Batch bounded file allocations and resume only missing file suffixes.
47
- - Batch large editable files as multiple code blocks under bounded 350000-byte JSON budgets and at most 99 code blocks per request, including initial nested allocation. Preserve ordered UTF-8 source bytes and resume only the missing suffix; unknown append outcomes still require exact readback or explicit distinct-page supersession.
48
- - Keep absent or partial unknown file appends unresolved without replay. Explicit historical `ntn-skills-operator upstream publish-files --supersede` uses a distinct page/operation after checking the original owner, frozen source and writing authority; retain the original unknown receipt and page.
49
- - Reject CR/CRLF editable-file inputs before mutation because live Notion code blocks normalize carriage returns. Retain concrete old block ancestry so an acknowledged whole-page clear removes obsolete nested inventory guards rather than requesting deleted blocks. Split reconciliation and recovery fixtures into bounded modules without compatibility re-exports.
50
- - Reconcile a terminal editable-file property response only from exact observed requested fields, unchanged other metadata and complete source files; keep absent results unknown without replay. Public operation reconciliation uses the same literal-file path as upstream recovery.
51
-
52
- - Recover typed-link readback split at rich-text annotation boundaries after proving exact adjacent destinations, complete visible text and ordered block links. Preserve already matching reads, authored write guards and ambiguous-link failures.
53
- - Reuse graph-mapped, physically proved quote/list readback for reversible source exports so a verified page cannot fail only because the export used a different comparison target. Preserve exact source bytes and reject changed instructions.
54
- - Use the native 2000-character rich-text span capacity for subscription JSON, retaining complete large source manifests and member maps that fit the 100-span limit instead of rejecting them at the former 180000-character chunking boundary.
55
-
56
- - Document the complete portable v2 Prompt/Router producer contract in create help/schema and usage: explicit kind, manifest/body files, metadata precedence, source versus canonical entrypoints, exact same-library Members and online dry-run preflight.
57
-
58
- - Keep committed source members independently readable while subscription Router publication is pending. Preserve own resource bytes, expose unavailable cross-member targets as typed projection metadata, and recover generated refs when the exact active map appears; retain Router and publication integrity gates.
59
- - Support explicit `source.member_patches` keyed by exact selected source member, preserving raw upstream hashes while recording adapted portable and patch identities. Reject unknown members, overlapping global/member patch files and replacements that do not match exactly once; retain strict YAML admission.
60
-
61
- - Admit nonblank descriptions up to 2000 Unicode code points through one Effect Schema across Markdown imports, portable/native archives and property updates. Preserve complete upstream metadata and source bytes; reject invalid updates before remote access and isolate invalid catalog descriptions with explicit coverage failures.
62
- - Publication mutations recheck their target and ownership graph before writes, with complete fresh graph fences at allocation checkpoints and commit; conflicts and unknown outcomes retain the original operation for recovery.
63
- - Bind content-root and reference-page creation to an atomic scope, parent, source and intent correlation proof. Retain reference transport markers through writes while excluding them from authored exports; reconcile complete inventories without replay when identity is absent, ambiguous or incomplete.
64
- - Retain reviewed `ntn-skills-operator operation supersede-plan` and one-attempt `ntn-skills-operator operation supersede-apply` for a new explicit creation intent after complete zero-candidate discovery. Preserve original unknown receipts, recheck frozen source and ownership guards, and move upstream pointers only after committed publication and guarded compare-and-swap.
65
- - Classify exact official `ntn` rejection envelopes using safe HTTP status and allowlisted Notion codes even when stdout is empty. Keep uncertain writes unknown without automatic mutation retries and exclude raw stderr or service messages from public diagnostics.
66
- - Recognize the exact official generic public-API failure envelope as `unknown_transport`, without inventing a network or TLS diagnosis. Reuse existing bounded read/query retries; keep writes uncertain with one attempt and no automatic replay.
67
- - Version References materialization and current observations together so generator upgrades create new snapshot identities even for unchanged remote content. Require online refresh for older current observations, preserve exact pinned snapshots and retain strict publication proof verification.
68
- - Preserve exact human-readable Unicode titles and authored frontmatter names, including digits, spaces and hyphens. Derive safe callable aliases separately without changing page identities, stable member keys or builtin IDs; require exact selectors for collisions and document `--name` as a human-title override.
69
- - Persist exact subscription mutation intents after read preflight, atomically claim each create, and include the stable operation marker in its initial POST. Reconcile complete marker evidence without replay; expose source/target/origin evidence through operation inspection. Add explicit evidence-reviewed local adoption and proven GET-only preparation recovery, and resume known-target updates/removals only under their original version guards.
70
- - Preflight all explicit existing initialization tables before remote mutations, retaining unknown-create reconciliation. Include upstream catalog sources and successful subscription query coverage with explicit roles; keep content configuration separate and validate exact locator provenance through Broker discovery and activation.
71
- - Respect a caller-supplied process capability for local lock retirement while retaining the default Node host behavior. Isolate builtin crash-rollback fixtures from host Trash startup and preserve original tree, resource and receipt bytes through recovery and explicit retry. Protect the exact compact Router manifest golden input from formatting.
72
- - Prove create-name uniqueness from the complete selected content database only; unrelated partial upstream Routers retain discovery failures without blocking target writes. Target content failures and existing names still refuse mutation.
73
- - Reject portable v1 in every normal create/read/export source path with `PORTABLE_UPGRADE_REQUIRED`. Ship historical conversion only as a separate operator artifact with immutable input inventories, explicit kind audit, remote read-only planning and guarded exact-target formal replacement; no production conversion is automatic.
74
- - Add explicit read-only portable `remote-replan --preserve-output` for reviewed plans with no attempt or retained publication. Bind original plan bytes/hash and attempt path to a current-baseline successor while preserving exact reviewed output; keep existing operations on their original recovery contract.
75
- - Retain standalone portable-converter operation IDs before publication and add original-plan/ledger remote reconcile and resume. Known-root zero-intent preparation failures revalidate reviewed source bounds; uncertain mutation and allocation intents remain `NO_REPLAY`.
76
- - Add explicit `remote-recovery-plan` and hash-reviewed resume for an original zero-intent, unbound-integrity replacement after a materialization-only baseline change. Bind original plan and ledger bytes, operation, unchanged remote authority and exact output; retain the normal strict current-version guard and reject any mutation-intent replay.
77
- - Recover mode-only writes using every retained ownership observation and classified owned intent without requiring child inventories the original mode operation never owned. Keep complete reference-inventory gates for document create/replace recovery.
78
- - Continue the same publication without repeating acknowledged business PATCHes only when exact retained payloads and current guards prove convergence. Reuse the existing normalization for current body comparisons to avoid repeated whole-graph scans per body; retain fresh checkpoints and final verification, and never reuse uncertain writes, allocations, uploads or publication markers.
79
- - Compare every explicitly requested select field against Notion's richer readback object during acknowledged recovery. Preserve strict null, ID and unknown-field matching, full current guards and rejection of changed selections.
80
- - Permit explicit public publication reconcile to release a retained conflict fence only after complete fresh guards and completed intended effects prove convergence; preserve the original failure, stages and typed conflict history before same-operation resume.
81
- - Reconcile an unbound initial creation only through its unique completed root POST, full original creation proof and matching current marker; retain exact bound replacement marker checks and never rewrite integrity authority.
82
- - Reuse an acknowledged source-bundle attachment only when its exact completed upload intent, current file guard and downloaded bytes/hash prove the same attachment with no later unresolved write; preserve normal unattached upload handling.
83
- - Restore Notion quote-to-paragraph boundaries only from complete ordered typed block evidence with unique text anchors and a stable page revision; include compact structural evidence in snapshot versions while preserving source bytes and original recovery guards.
84
- - Reuse one fresh, fully paginated publisher identity inventory within each upstream plan, preserving member ambiguity, ownership and complete plan hashes/actions while leaving apply-time drift guards unchanged.
85
- - Extract CLI command families, upstream planning/application/operation responsibilities and Node sync scenario suites without command aliases or legacy reexports.
86
- - Separate fenced publication continuation and typed-block recovery from new-publication sessions; recovery callers import the owning recovery module directly without legacy module aliases.
87
- - Preserve Node-native loading of split upstream modules with erased type imports, resolve the real Node executable before CLI consumer tests isolate HOME, and include the linked portable-converter guide in the public package.
88
- - Require Node.js `^22.22.3 || >=24.20.0` for the CLI and migration artifact; exercise CI on 22.22.3/24.20.0 and publish on 24.20.0. Reject unsupported Node/Bun or SQLite runtimes with `STATE_RUNTIME_UNSUPPORTED` before opening state. Keep the official driver and scope the in-memory SQLite version probe; see the [runtime policy](docs/protocol.md#local-sqlite-authority-and-explicit-upgrade) for fixed WAL branches.
89
- - Add durable `ctl database init` for native content/subscription tables with exact database, data-source and property receipts, guarded relation repair and independent global upstream configuration.
90
- - Register source subscription commands only under `sync upstream`, alongside `sync local`; remove the former root `upstream` path while retaining target/all selection constraints.
91
- - Validate subscription names with the content alias contract before add/update writes; isolate malformed historical subscription metadata in catalog `failed_sources`. Read exact subscription refs directly under the existing observation policy and retire affected scoped catalogs after subscription add/update or upstream apply. Accept literal Git paths containing brackets, Unicode, spaces and pathspec characters while preserving traversal, symlink and submodule rejection.
92
- - Separate upstream aggregate progress from explicit Router availability and member publication evidence. Make status offline and scope-local; make check observe only current metadata/markers with freshness, exact Router refs, active counts/IDs and failed-source coverage. Preserve unknown states without reading member bodies or treating partial subscriptions as total failure; teach the bundled sync Skill to use those fields.
93
- - Use one ContentRecord contract for Skill, Router and Prompt across catalogs, snapshots, reads, files and portable exports. Portable v2 carries kind and entrypoint; historical state converts explicitly rather than through runtime aliases.
94
- - Render authored Router instructions with a deterministic Skill member index in the same snapshot. Members remain metadata and stable refs, with explicit missing-member failures and independent Default Context flags.
95
- - Author manual Router Members through exact Skill IDs or refs on create, replace and update. Resolve current same-library permission and kind, deduplicate/sort relations, and retain member intents for guarded recovery. Include Members and Default Context in committed managed integrity alongside authored resources and provenance.
96
- - Version managed remote publication proofs as v2 for provenance, Members and Default Context. Reject old v1 proofs with an explicit conversion requirement instead of reinterpreting their digest. Provide a separate reviewed remote-proof conversion artifact with complete content checks, guarded readback and no automatic replay after an uncertain write; normal CLI and offline state migration do not interpret v1 remote proofs.
97
- - Keep Router authored source bytes separate from its generated member index. Default source exports preserve reversible authored files; explicit snapshot exports carry the exact read entrypoint and all resources with SHA-256, byte lengths and roles. Compare authored publication content without copying generated indexes back into instructions or masking resource damage.
98
- - Persist typed page destinations through official owned-block rich-text URL updates after Notion Markdown strips fragments. Journal the original body, concrete block paths, expected URLs and guarded recovery; restore distinct resource paths from real paginated block metadata in fresh reads and exports. Reject ambiguous correspondence, preserve code examples and verify live instructions/resources independently of source-bundle byte restoration. Members remain read-only dependencies.
99
- - Freeze complete source member/resource manifests and resolve cross-member Markdown destinations to exact published page resource refs on explicit reads. Preserve original source files/ZIPs with hashed derived projection provenance; reject stale maps, removed targets and unsafe paths. Broker reads materialize only the requested member and validate source scope and filesystem containment.
100
- - Treat every explicit Prompt submission as new user-task requirements using one prepared snapshot per turn. Keep Prompt out of default/native/automatic loading, preserve mixed text/images and prevent cancelled session generations from dispatching.
101
- - Move mutable local state to one SQLite database using official Effect SQL/SQLite 4.0.5: scoped connection, migrations, short transactions, generation fences, atomic binding/baseline and baseline/receipt commits. Persist publication intent before remote writes and retain unresolved outcomes across crashes and lock release.
102
- - Add the independent `ntn-skills-migrate` offline importer with validated private backup, source hashes, resumable phases and explicit old-writer stop precondition. Normal commands use SQLite exclusively; corrupt state never falls back to old JSON or an empty database. Preserve immutable content, snapshot files, original IDs and reviewed plan digests.
103
- - Preserve unresolved migrated operations as public evidence-review records with their original identity, source hash and audit reference. `operation list/show/reconcile` returns their safe review envelope without authentication when no scoped ledger is selected; resume returns `UNRESOLVED_NO_REPLAY`. Only the independent converter maps proved old import destinations to current operations and retains original wire evidence.
104
- - Durably publish file bytes before snapshot pointers, retire only SQL observations during cache clear, and support standalone SQLite plus referenced-file backup. Return `sqlite:` plan/receipt locators instead of paths to nonexistent JSON files.
105
- - Execute development and real SQLite/configuration consumers on Node with the official SQLite 4.0.5 driver and Effect Vitest integration; keep pure tests on Bun. Distinguish corrupt bytes, inaccessible state, busy/resource exhaustion, schema/runtime mismatch and state conflicts instead of reporting every initialization failure as corruption.
106
- - Run the full synchronization consumer contract on Node with its HTTP fixture and official Effect test host, retaining all saved-plan, baseline and recovery assertions. Preserve implementation defects through the CLI runtime instead of flattening Scope or Layer failures into a generic domain error.
107
- - Cut over the public command tree to content, `sync local`, `operation` and `ctl` commands with official Effect CLI help/schema. Current builtin management accepts receipt v2 only; v1 conversion remains an explicit independent artifact. These implementation notes do not establish installed, service or host acceptance.
108
- - Retire name-upsert import APIs and commands: create refuses existing names; replace uses exact identity across CLI, builtins and local sync. File writes preserve page properties; update changes explicitly selected Name, Description, Default Context and Router Members. Share domain constraints between handler validation and machine schema, use controlled config set/unset and database register/unregister, and reconcile publication intents through read-only guarded observations including property-only recovery.
109
- - Unify publication, local/upstream sync, subscription, fork/track, database initialization and review operations under one typed domain envelope with scoped listing, safe result summaries and executable next reasons. Reconcile never commits remote writes or local sync baselines; publication marker completion requires explicit guarded resume and reports `needs_safe_commit` until then.
110
- - Recover original upstream fork/track parents through their frozen child ownership intents, expose pending safe resume through read-only inspection, and avoid duplicate mode writes after proven convergence.
111
- - Check retained sync receipt fences before remote saved-plan observations, preserving `SYNC_PENDING` and corrupt-participant guards while a publication is incomplete. Keep originating publication recovery on its original operation. Stable direct Notion edits remain readable; tracked source ownership and local common-baseline conflicts still constrain synchronization.
112
- - Recover upload interruptions using the exact upload-object endpoint and original upload IDs. Add explicit `operation resume ID --new-artifact` for proven unreferenced unknown allocations or uncertain pending sends; preserve the original unknown audit and remote orphan, verify attachment bytes after lost responses, and retain page/source/conflict guards before publication integrity commit.
113
- - Add safe verification-helper help and offline default doctor with explicit live probing; retain actual child PID/exit/signal evidence and isolate all CLI/XDG roots for repeatable installed-consumer acceptance.
114
- - Add optional Notion `Default Context` checkbox metadata as `default_context`; missing values and legacy cached metadata default to false, with unchanged content/snapshot identities and complete catalog listing.
115
- - Add optional project-maintained Skills with separate discovery/consumption, Notion content-maintenance and ongoing synchronization responsibilities.
116
- - Add offline exact-ID `builtin list/read/export` with package origin/version/content metadata; keep remote catalog and same-name pages separate.
117
- - Centralize offline `builtin install/update/status` and installation-aware `builtin list` under the XDG data directory, default to `~/.agents/skills` symlinks, and support repeated `--agent-dir` distribution targets. Retain complete file receipts, content-based equality, local-edit/unmanaged-target protection, system Trash retention and interrupted-write recovery. Migrate explicitly selected clean profile installations without keeping per-host copies; keep installation separate from package upgrades and remote publication.
118
- - Add explicit `builtin publish`, a separately configurable `builtin_database`, create-only first publication, and exact-page/pinned updates with existing conflict and readback protections. No automatic installation, publication or upgrade.
119
- - Manage three independent builtins: `notion/ntn-skills` for discovery/consumption/routing, `notion/ntn-skills-maintain` for Notion content maintenance, and new `notion/ntn-skills-sync` for ongoing local synchronization, distribution and recovery. Keep entrypoint metadata discoverable without preloading bodies, retain unmanaged copied bootstraps, and package complete portable references for each Skill.
120
- - Add opt-in publication stage/timing JSONL on stderr, retained publication receipts with frozen input, and `resume OPERATION_ID` with authentication/source/readback guards and explicit unresolved outcomes. Keep validation observations provisional across process exits, reject external changes at checkpoints and continuation, and replay complete target-file write results.
121
- - Reuse authenticated publication refresh context and checkpoint Markdown while preserving complete content-version checks; pace actual request starts, including concurrent callers and retries, instead of sleeping before every call.
122
- - Exclude per-request Notion References response trace IDs from publication guards while retaining property content and pagination checks, so unchanged live pages can validate and resume.
123
- - Accept automatic `last_edited_time` property updates after a proven body write while continuing to compare editable metadata and ordinary revision guards.
124
- - Verify live main/reference Markdown against submitted content independently of preserved source ZIPs, including reuse, so altered page instructions cannot pass through intact original bytes. Make a non-dry exit 0 with `ok: true` and `verified: true` the ordinary import completion criterion; reserve repeated read/files/export audits for diagnostics and development regression.
125
- - Write CommonMark/GFM through Notion's v2 Markdown parser, restore changed table-cell literals and code-block languages with the block API, reject parser warnings, and materialize v1 readback with explicit table/code/list boundaries and joined emphasis around inline code. Verify instructions, code languages and link destinations without discarding fenced-code blank lines or treating changed table text as equivalent.
126
- - Accept Notion's inline `<br>` readback of paragraph line breaks during saved-content verification, while retaining literal code, link targets, reference inclusion and real instruction-change rejection. Preserve snapshot and source-bundle byte contracts.
127
-
128
- ## 0.2.0 — 2026-10-14
129
-
130
- 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.
131
-
132
- - Read skills from databases with rich-text Description and References, without requiring native Skills exports.
133
- - Materialize reference pages as relative Markdown files, preserve links through create/import/write/export, and include referenced-page edits in version conflicts.
134
- - Create editable reference child pages during imports and retain omitted pages in Notion while excluding them from new snapshots and exports.
135
- - 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.
136
- - Report the selected storage mode in doctor and update CLI help, both READMEs, protocol and Agent integration references.
137
- - Resume interrupted reference imports using existing child-page IDs, reject duplicate paths, and normalize equivalent relative links when comparing page-only content.
138
- - Report safe transport failure reasons without exposing raw stderr, credentials or signed URLs; preserve unknown write outcomes.
139
- - Retry transient read/query transport and service failures up to three times with bounded backoff; mutation requests are never retried automatically.
140
- - Recover transient References attachment downloads with scoped timeouts and bounded retry; reject denied access without retry or signed URL disclosure.
141
- - Add repository-local verification recipes and command-to-case coverage with isolated config/state/cache and XDG bases, preserved evidence and system-Trash cleanup.
142
- - Limit npm documentation files to the explicit public guide set; keep implementation designs and verification maps repository-only without broken package-relative links.
143
- - 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.
144
- - 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.
145
- - 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.
146
- - 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.
147
- - 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.
148
- - 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.
149
- - Fence the entire content/catalog retirement batch before system Trash operations, so unavailable retention preserves bytes without exposing later observations or accepting delayed publishers.
150
- - Expose the originating authentication `scope` with snapshot read/open/files/export responses, allowing consumers to reject stale discovery records after credential changes while retaining explicitly pinned offline versions.
151
- - Document one-way broker source consumption through metadata-only list, selected-page read and pinned directory export; the adapter is provided in the separate pi-context-broker repository and is not installed by this package.
152
- - Add read-only source/installed consumption recipes and helper mode, plus installed-consumer cases for portable entrypoints, directory output protection and credential isolation. These additions require execution evidence before claiming acceptance.
153
-
154
- ## 0.1.3 — 2026-10-14
155
-
156
- - Wait for the npm attestation document to become available after registry metadata appears.
157
- - Give each CLI boundary scenario its own test timeout.
158
-
159
- ## 0.1.2 — 2026-10-14
160
-
161
- - Publish from GitHub Actions with npm OIDC; verify provenance for public repositories and registry evidence for private repositories.
162
- - Simplify installation and release documentation.
163
-
164
- ## 0.1.0 — 2026-10-14
165
-
166
- Initial npm release, published with maintainer web authentication.
167
-
168
- ### Public repository baseline
169
-
170
- - Set the public npm package name to `ntn-skills`, matching the executable and bootstrap Skill; retain the `notion-skills-cli` source repository.
171
- - Add equivalent English and Simplified Chinese READMEs with a centered header, language switch and section navigation; package both language files.
172
- - Move detailed operations into the [usage guide](docs/usage.md), and document source-access and release status.
173
- - Separate consumer installation and use from contributor source/build steps in both READMEs; consumers install a built tarball with npm and run on Node.js 22.19.0 or newer.
174
- - Replace the Bun runtime platform, executable shebang and distribution target with Node.js; keep Bun 1.4.3 for development/build/tests, and exercise npm consumers on Node.js 22 and 24 in CI.
175
- - Add an English installation and first-read walkthrough, tarball consumption, upgrade and uninstall instructions, and explicit runtime/platform evidence boundaries in [README](README.md).
176
- - Document metadata freshness separately from retained snapshots and upload staging, inherited workspace/API endpoint settings, network behavior and optional local data cleanup across the [protocol](docs/protocol.md), [host integration](docs/host-integration.md) and [Skill reference](skills/ntn-skills/references/integration.md).
177
- - Use the returned snapshot ID to list every attachment; a pinned file ref filters only its own path.
178
- - Set the public issue and private vulnerability-reporting channels, security support for the latest patch of the current 0.x series, and a seven-day acknowledgement target without a promised fix deadline in [SECURITY](SECURITY.md).
179
- - Define 0.x compatibility, deprecation migration guidance and fast-forward integration in [CONTRIBUTING](CONTRIBUTING.md), and prepare the package/release metadata and CI release lane.
180
- - Update production archive dependency `fflate` to 0.8.3.
181
-
182
- ### Initial 0.1.0 functionality
183
-
184
- - Add Bun development monorepo with a Node.js CLI using Effect 4.0.4, platform services, schemas, and scoped ntn transport.
185
- - Discover accessible typed Skills Databases with explicit search coverage and registered-source supplementation.
186
- - Resolve exact skill names, metadata-derived aliases, page IDs, and page URLs; return structured missing/ambiguous/incomplete errors.
187
- - Read immutable export snapshots one file at a time, including line ranges, UTF-8 BOM text, and explicit binary output.
188
- - Support skill:// refs, pinned snapshots, and relative reference resolution.
189
- - Ship ntn-skills bootstrap Skill, host integration contract, contributor/security policies, and reproducible CI checks.
190
- - Keep parser failures machine-readable, with optional Boolean switches and no interactive wizard.
191
- - Bound rate-limit retries and validate Notion error responses with Schema.
192
- - Package docs and bundled dependency licenses, and check formatting with pinned Biome.
193
- - Store global source configuration under ~/.config/ntn-skills with XDG_CONFIG_HOME and NTN_SKILLS_CONFIG_HOME overrides; migrate legacy registrations once and retain a backup without moving snapshots.
194
- - Require English-letter Notion titles with single spaces and derive the invocation name by lowercasing and replacing spaces with hyphens; validate matching export frontmatter and preserve historical snapshot reads.
195
- - Make root and command help self-contained for agents with argument/flag descriptions, online/offline modes, usage examples, output conventions, storage and error-recovery guidance.
196
- - Add create/write with dry runs, shared targets, pinned-version conflict detection, verified snapshots and explicit partial/unknown outcomes; preserve nested paths and extra metadata in the source ZIP.
197
- - Add config.default_database and config show/set-default/clear-default; create selects an explicit database, the configured default, or the sole discovered Skills Database. Preserve the default when adding sources and reject ambiguous/incomplete discovery.
198
- - Add import for a local ZIP, folder or any .md/.markdown filename, with one-Skill entrypoint selection, name/description overrides, bounded ZIP decoding, preserved attachment bytes, dry runs and verified new snapshots.
199
- - Preserve initial H1 headings on create/import by writing Markdown after page creation and compare normalized write responses with page readback and exported content.
200
- - Add complete ZIP/directory export with offline pinned refs, a versioned portable manifest, deterministic archive bytes, content digests and reuse/conflict handling for existing output.
201
- - Preserve imported source bytes, arbitrary Markdown filenames, extra frontmatter and nested supporting files in a retained source ZIP; reconstruct current edits without changing historical snapshots.
202
- - Make create pure creation with CREATE_CONFLICT on an existing invocation name; import creates absent names, reuses identical content or replaces different content on the same page with version checks.
203
- - Compare page and Skills Markdown across equivalent plain-text code labels and paragraph spacing without discarding blank lines inside fenced code.
204
- - Rename the discovery command from catalog to list; make ntn-skills list the agent-facing entrypoint in help, the bootstrap Skill and host integration, with automatic pagination and metadata-only output.
205
- - Unify read/files/open/write/export targets across names, invocation aliases, page IDs/URLs, refs and snapshot IDs; use --path instead of second positional paths and remove read --snapshot/refresh modes.
206
- - Replace ls with files and databases with database list; database discovery no longer queries Skill rows. List queries match invocation aliases and return compact metadata/count/coverage.
207
- - Reuse identical local read/export output with reused=true; reject differing output with OUTPUT_CONFLICT. Identical writes return unchanged=true without remote mutation.
208
- - Add optional global config.token with priority over NOTION_API_TOKEN and existing ntn login; set via config set-token --stdin, clear offline, preserve other settings and expose only token_configured in configuration output.
209
- - Scope online caches by the selected credential digest; existing pinned snapshots remain readable offline, while pinned writes from an older scope format require a fresh online read.
210
- - Accept Database IDs, URLs and exact registered aliases consistently across --database flags and config set-default; persist defaults as canonical IDs and enforce alias constraints on offline pinned targets.
211
- - Return the queried databases map in list, retain cross-database same-name Skills, and include database maps in ambiguity errors plus owning database labels in failed-source coverage.
212
- - Reject repeated --database values before execution, including identical values and --database=value; explicit help remains offline and takes precedence.
213
- - Accept notion.so URLs alongside notion.com/notion.site when resolving database and page identities.
3
+ All notable changes to `ntn-skills` are documented in this file.
4
+
5
+ ## [2.0.0] - 2026-12-03
6
+
7
+ ### Added
8
+ - **Minimal 3-Table Notion Control Plane**: One-command `ntn-skills init` auto-bootstraps `Sources`, `Skills`, and `Files` tables with bidirectional relations on any blank Notion page.
9
+ - **3-Tier `Visibility` Routing (`always | discoverable | manual`)**:
10
+ - `always`: Top-level host symlinks or managed directory copies;
11
+ - `discoverable`: Auto-synthesized immutable local `skill-catalog` skill sharded by `Scenes`, pinning `Kind = router` strategy routers at the top with pre-materialized `store/` paths for 2-hop zero-plugin `Read` access across any agent host;
12
+ - `manual`: Silent long-tail reserve woken on demand via `$skill`, `skill_find`/`skill_load`, `Requires`, or `ntn-skills load`.
13
+ - **Static `manifest.json` & `ntn-skills status`**: Machine-readable lockfile and governance summary covering Visibility distribution, Notion draft buffer, active upstream overlays, and 30-day local `Hot Loads`.
14
+ - **Three-Stage Skill Evolution**: Local incubation (`new` with automatic in-place adoption), isolated live overlay patching (`edit -> diff --remote -> push` & `reset-overlay`), and lossless Git graduation (`pull --clean`, `attach`, and subtree-pruned `upstream apply` auto-reconciliation).
15
+ - **Built-in Agent Guide & Diagnostics**: `ntn-skills skill` (`--path`, `--install`, `--uninstall`), `ntn-skills doctor`, precise `sync` pulled-diff & local-pending reporting, XDG Base Directory support (`XDG_DATA_HOME` / `XDG_CONFIG_HOME`), and native `launchd` / `systemd` / `dagu` / `github-actions` / `crontab` scheduling.
package/CONTRIBUTING.md CHANGED
@@ -1,66 +1,30 @@
1
- # Contributing
1
+ # Contributing to ntn-skills
2
2
 
3
- ## Development setup
3
+ Thank you for your interest in contributing to `ntn-skills`.
4
4
 
5
- Use Bun 1.4.3 for dependency installation, building and the pure test suites, with the committed lockfile. Development and the published CLI run on Node.js 22.22.3+ within 22.x, or Node.js 24.20.0+; install Node.js and npm as well for the real SQLite and fresh-consumer checks. Clone the repository, then work from the checkout root:
5
+ ## Prerequisites
6
6
 
7
- ```bash
8
- git clone https://github.com/yoyooyooo/notion-skills-cli.git
9
- cd notion-skills-cli
10
- bun install --frozen-lockfile
11
- bun run dev --help
12
- bun run check && bun run package:check
13
- ```
14
-
15
- Use `bun run dev <command>` to build the current sources and execute the freshly built CLI with Node.js. Successful builds stay silent; failed builds report diagnostics on stderr and stop the command. Argv and exit status pass through to the same production entrypoint used by the package. It uses the default official `ntn` transport. The official SQLite driver uses `node:sqlite`; running the product through Bun is unsupported.
7
+ - macOS or Linux
8
+ - `git`
9
+ - [Bun](https://bun.sh) `>= 1.2.0`
16
10
 
17
- A developer-owned global `ntn-skills` shim can use `exec bun run --silent "/absolute/checkout/scripts/dev.ts" "$@"`. Configure consumer hosts with `command: [ntn-skills]` and launch them in a neutral workspace outside the source checkout. The shim owns the implementation path; consumer prompts need only the public command and selected refs. See the [host integration contract](docs/host-integration.md).
18
-
19
- 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 credential config/state/cache and XDG bases, records real CLI actions/readback, and preserves evidence while moving owned scratch to system Trash. Builtin verification must also isolate HOME and `NTN_SKILLS_DATA_HOME`/`XDG_DATA_HOME` because installation defaults to shared Agent links. 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; definitions are not passing results. Live mutations need current authorization; npm excludes these repository-local files.
20
-
21
- Build and pack a consumer artifact from the checkout root:
11
+ ## Development Setup & Verification
22
12
 
23
13
  ```bash
24
- bun run build
25
- node packages/cli/dist/ntn-skills.js --help
26
- mkdir -p release
27
- bun pm pack --cwd packages/cli --destination ../../release
28
- ```
29
-
30
- The archive filename follows the package version. Consumers install that tarball with npm as described in [the README](README.md#installation). Update source with `git pull --ff-only`, reinstall dependencies and rebuild before producing a new tarball.
31
-
32
- `check` runs type checking, formatting checks, both test hosts and the Node.js distribution build. `bun run test` runs the Bun suites and the real SQLite/configuration and sync-consumer suites on Node through official `@effect/vitest` 4.0.5 and its Vitest 5 runner; `test:unit` and `test:node` select those lanes individually. Existing database assertions, competing processes, crash rollback, backups and fences execute against the same official SQLite driver as production. The sync suite uses a Node HTTP fixture with the production Node platform and resource finalizers. CLI tests launch Node children. `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. Modeled domain and argument failures produce JSON; implementation defects retain their Effect cause and Node runtime diagnostics.
33
-
34
- CI uses Ubuntu and macOS 15 with Node.js 22.22.3 and 24.20.0. 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.
35
-
36
- The compact `packages/core/test/fixtures/router-original/.ntn-skills.json` manifest is a byte-preservation golden input for independent Router round trips. Its original bytes, including whitespace and final newline, are part of the fixture contract. Biome disables formatting for that exact file only; the containing fixture directory, tests and production sources remain in the normal root check.
37
-
38
- Builtin transaction tests retain both replaced trees and released lock receipts in their own temporary fixture using the public `ChildProcessSpawner` service boundary. Executable access is checked with the host filesystem, and released fences are renamed only after verifying their fixture ownership; they do not launch macOS Trash for each assertion. The default spawner still exercises system Trash in the real process and installed-consumer suites. Keep process teardown attached to the command Scope and keep the 5-second transaction-test deadline unchanged.
14
+ git clone https://github.com/yoyooyooo/ntn-skills.git
15
+ cd ntn-skills
16
+ bun install
39
17
 
40
- Keep Effect, platform, SQLite and Effect test integration versions aligned at 4.0.5. 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.
41
-
42
- Preserve the [naming contract](docs/protocol.md#identity-and-references): Notion Name and authored frontmatter `name` are exact human-readable values, nonempty and free of control characters. Unicode, digits, spaces and hyphens are allowed. Derive callable aliases separately with NFC normalization, lowercase, surrounding-whitespace trimming, whitespace runs replaced by `-`, and percent-encoding outside Unicode letters, marks, numbers, `_` and `-`. Never rewrite an authored name to its alias or use aliases as stable identity. Alias collisions require exact selectors; title changes preserve page IDs and stable member keys. `--name` is an explicit human-title override. Keep package builtin IDs and slugs unchanged.
43
-
44
- Official optional Skill sources live under `skills/notion/<frontmatter-name>/` and are registered explicitly in `packages/cli/src/builtins.ts` with a `notion/<name>` ID. Embed each selected UTF-8 file and ship the same source tree; keep the Skill self-contained with relative internal references. Update the package file inventory and installed consumer smoke when adding files. `builtin` metadata identifies package input, never remote ownership; preserve create-on-first-publish and exact-target update semantics. Keep the existing general bootstrap at `skills/ntn-skills`.
45
-
46
- Edit Skill and documentation sources at the repository root. `packages/cli/build.ts` generates `packages/cli/skills`, `docs`, both READMEs, CONTRIBUTING, SECURITY, CHANGELOG, LICENSE and THIRD_PARTY_NOTICES; rebuild these copies rather than editing them directly.
47
-
48
- Builtin installation has one writer under the XDG data root, with default shared links and optional additional Agent destinations. Keep version-2 tree receipts and distribution ownership outside transient host profiles; profile receipt-v1 support is a guarded migration input, not another installation path. Exercise default installation, multiple targets, update through links, foreign-target/local-edit protection, status without writes and interrupted migration. Use isolated data/HOME and preserve all replaced bytes through the existing retention capability.
49
-
50
- Add behavior tests for plausible consumer-visible failures: ambiguity, pagination, partial discovery, file boundaries, version consistency and permission failure. Avoid asserting implementation text or internal call wiring. A pull request should explain the user-visible problem, resulting behavior and checks actually run. Keep unrelated changes separate.
51
-
52
- ## Compatibility and deprecation
53
-
54
- The 0.x series is experimental. A minor release may change public commands or protocol behavior incompatibly; a patch release preserves existing semantics and provides compatible fixes. Consumers should tolerate additional JSON fields and handle unfamiliar error codes as structured failures. Additional fields or codes must not silently change the meaning of existing fields or successful operations.
55
-
56
- Document a deprecation and its replacement in the relevant reference and [CHANGELOG](CHANGELOG.md), including migration steps and the version that removes it. Breaking changes must be called out before consumers upgrade. Update both READMEs ([English](README.md) and [简体中文](README.zh-CN.md)), the [usage guide](docs/usage.md), [protocol documentation](docs/protocol.md), [host integration](docs/host-integration.md) and affected Skill references when public behavior changes. Keep language navigation, commands, release status, capabilities and limits equivalent; detailed guides are maintained in English. Verify README rendering, anchors and packaged language files when the entry structure changes.
57
-
58
- ## Git and release workflow
18
+ # Run all quality gates before opening a PR:
19
+ bun run check # Runs lint + typecheck + test
20
+ ```
59
21
 
60
- Update your checkout with `git pull --ff-only`. Integration is fast-forward only; rebase contributions onto the current target branch rather than creating merge commits. Keep reviewable commits focused on the change.
22
+ If you modify `skills/ntn-skills/SKILL.md`, copy the updated file to `packages/cli/assets/ntn-skills/SKILL.md` (`packages/cli/test/bundled-skill.test.ts` enforces byte-for-byte equality).
61
23
 
62
- The private core is bundled into the CLI distribution. Before release, verify the tarball from outside the workspace and follow [the release procedure](docs/releasing.md). Releases use immutable annotated `v<version>` tags; publishing a registry package or creating a hosted repository requires explicit release authorization. A prepared version or local tarball does not establish that a package is published.
24
+ If you change user-facing behavior, flags, or workflows, update both `README.md` and `README.zh-CN.md` (plus `INSTALL.md` if setup steps change) so English and Simplified Chinese documentation stay aligned.
63
25
 
64
- ## Reporting bugs and vulnerabilities
26
+ ## Engineering Rules
65
27
 
66
- Use [GitHub issues](https://github.com/yoyooyooo/notion-skills-cli/issues) for bugs and usage questions. Include the command, sanitized response, runtime and `ntn` versions, expected behavior and a minimal reproduction. Never include credentials, signed URLs, private Skill contents or personal database identifiers in public reports. Report vulnerabilities through [the private channel in SECURITY.md](SECURITY.md#reporting-a-vulnerability).
28
+ - **Linear History**: Use clean, focused commits suitable for rebase-merging onto `main`.
29
+ - **Never Mutate Production Notion Libraries in Tests**: Unit tests must use the deterministic fake backends in `packages/core/test/fakes.ts`. Live smoke tests must enable `NTN_SKILLS_TEST_ONLY=1` against a dedicated test page.
30
+ - **Trash-Only File Removal**: Use `moveToSystemTrash` rather than raw `fs.rm` / `unlink` when retiring user-visible directories or workdirs.
package/INSTALL.md ADDED
@@ -0,0 +1,132 @@
1
+ # ntn-skills — Agent Setup Protocol
2
+
3
+ > **Audience**: Coding Agents (Claude Code, Cursor, Pi, Codex, Antigravity, OpenBot, etc.) executing setup on behalf of a user.
4
+ >
5
+ > **Goal**: Install `ntn-skills`, bootstrap (or bind) a 3-table Notion Skills Library, configure local zero-latency exports, enable background sync, and verify everything passes `ntn-skills doctor --json`.
6
+
7
+ ---
8
+
9
+ ## Non-Negotiable Safety Rules
10
+
11
+ 1. **Never ask the user to paste secrets into chat.** Guide the user to write `NOTION_TOKEN` (and optional `GITHUB_TOKEN`) directly into `~/.config/ntn-skills/credentials.env` with `chmod 600`. Never print secret values in terminal output or replies.
12
+ 2. **Never overwrite or delete existing non-managed skill directories.** Before choosing export directories, inspect `~/.agents/skills` and `~/.claude/skills`. If either already contains non-managed skills, ask the user whether to export to a separate directory first (via `--export <dir>`) or migrate existing skills later.
13
+ 3. **Close stdin on all non-interactive CLI calls** (`</dev/null`). Use `--json` when parsing command output.
14
+ 4. **Verify with `ntn-skills doctor --json`.** Do not declare setup complete until `"ok": true` is confirmed.
15
+
16
+ ---
17
+
18
+ ## Step 1 — Inspect Local Environment (Automatic, Read-Only)
19
+
20
+ Run a quick read-only probe to detect OS, `git`, `bun`, existing `ntn-skills`, existing skill folders, and whether Pi (`~/.pi/agent`) is present:
21
+
22
+ ```bash
23
+ uname -s
24
+ command -v git bun ntn-skills || true
25
+ ls -la ~/.agents/skills ~/.claude/skills ~/.pi/agent 2>/dev/null || true
26
+ ls -la ~/.config/ntn-skills/credentials.env ~/.config/ntn-skills/config.json 2>/dev/null || true
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Step 2 — Install or Upgrade `ntn-skills` CLI
32
+
33
+ Run the idempotent installer (add `--with-pi` if the user uses Pi; add `--install-bun` if Bun is missing and the user agrees):
34
+
35
+ ```bash
36
+ curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- </dev/null
37
+ # For Pi users (enables $skill inline loading + skill_find / skill_load tools):
38
+ # curl -fsSL https://raw.githubusercontent.com/yoyooyooo/ntn-skills/main/scripts/install.sh | bash -s -- --with-pi </dev/null
39
+ ```
40
+
41
+ Ensure `~/.local/bin` is on `PATH` (or invoke `~/.local/bin/ntn-skills` explicitly) and confirm:
42
+
43
+ ```bash
44
+ ntn-skills --version </dev/null
45
+ ntn-skills skill --path </dev/null # Built-in management guide shipped with the binary
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Step 3 — Collect Minimal User Authorization (2 Prerequisites)
51
+
52
+ If `~/.config/ntn-skills/credentials.env` does not yet exist (and `NOTION_TOKEN` is not set in the environment), ask the user to complete these two quick steps in Notion and report back **only the Notion page URL** (plus their preferred export directory if Step 1 detected existing non-managed skills):
53
+
54
+ 1. **Create a Notion Integration & save token locally** (do **not** paste token into chat):
55
+ - Open `https://www.notion.so/profile/integrations` -> create an **Internal Integration** -> copy the token (`ntn_...`).
56
+ - Run locally in their terminal:
57
+ ```bash
58
+ mkdir -p ~/.config/ntn-skills
59
+ cat > ~/.config/ntn-skills/credentials.env <<'EOF'
60
+ NOTION_TOKEN=ntn_your_token_here
61
+ # Optional: avoids GitHub API rate limits & enables private GitHub skill repos
62
+ # GITHUB_TOKEN=ghp_your_token_here
63
+ EOF
64
+ chmod 600 ~/.config/ntn-skills/credentials.env
65
+ ```
66
+ 2. **Choose & share a Notion Root Page**:
67
+ - **First-time user**: Create a blank Notion page (e.g., `Agent Skills`), click `...` -> **Connections** -> add your Integration, and share the page URL with the Agent.
68
+ - **Adding a 2nd machine**: Open your existing `ntn-skills` Library root page and share its URL with the Agent.
69
+
70
+ ---
71
+
72
+ ## Step 4 — Bootstrap Notion 3-Table Library & Global Config (Single Idempotent Command)
73
+
74
+ Once `credentials.env` is in place and the user provides `<NOTION_PAGE_URL>`, run `ntn-skills init`:
75
+
76
+ - **Default setup** (exports to `~/.agents/skills` with `prefetch: discoverable`):
77
+ ```bash
78
+ ntn-skills init --root "<NOTION_PAGE_URL>" --json </dev/null
79
+ ```
80
+ - **Custom or multi-surface export directories** (e.g., Grok Box `${HOME}/agent-data/workflows` using `copy` mode alongside `~/.agents/skills` using `symlink`, or `~/.claude/skills`):
81
+ ```bash
82
+ # Single custom directory (e.g. Grok Bot workflows in copy mode):
83
+ ntn-skills init --root "<NOTION_PAGE_URL>" --export '${HOME}/agent-data/workflows' --mode copy --json </dev/null
84
+ # Dual surfaces on a Grok Box (Grok Bot workflows as copy + Raft/Pi ~/.agents/skills as symlink):
85
+ ntn-skills init --root "<NOTION_PAGE_URL>" --export ~/.agents/skills --export '${HOME}/agent-data/workflows:copy' --json </dev/null
86
+ ```
87
+ - **Machine profile filtering** (optional, e.g., `--profile default,work`):
88
+ ```bash
89
+ ntn-skills init --root "<NOTION_PAGE_URL>" --profile default,work --json </dev/null
90
+ ```
91
+
92
+ What `ntn-skills init` handles automatically and idempotently:
93
+ 1. **Blank page**: Creates the clean v2 3-table schema (`Sources`, `Skills`, `Files`) with all bidirectional relations (`Origin <-> Skills`, `Skill <-> Supporting Files`, `Requires`). **Existing library**: Binds the 3 tables without modifying them.
94
+ 2. Writes `~/.config/ntn-skills/config.json`.
95
+ 3. Links the built-in `ntn-skills` management guide shipped with the CLI binary into the configured export directory (unless already managed by the library), keeping a brand-new Notion library 100% clean with 0 external seed rows.
96
+ 4. Runs the first `sync --full` and exports `always` skills as top-level symlinks plus an auto-generated `skill-catalog` index for `discoverable` skills.
97
+
98
+ ---
99
+
100
+ ## Step 5 — Enable Background Sync & Verify with `doctor`
101
+
102
+ Install the native OS background sync timer (`launchd` on macOS, `systemd` on Linux; runs fast overlap-window incremental sync every 12 minutes + daily full reconciliation):
103
+
104
+ ```bash
105
+ ntn-skills schedule install --json </dev/null
106
+ ```
107
+
108
+ Run the end-to-end health check:
109
+
110
+ ```bash
111
+ ntn-skills doctor --json </dev/null
112
+ ```
113
+
114
+ Confirm `"ok": true` and that `credentials`, `config`, `notion_connection`, `catalog_cache`, `export:*`, and `background_sync` are healthy.
115
+
116
+ ---
117
+
118
+ ## Step 6 — Optional Onboarding Offer (After `"ok": true`)
119
+
120
+ Report the setup summary clearly to the user (Library ID, 3 table status, export directory, exported skill count, background sync active). Then offer two optional next steps:
121
+
122
+ 1. **Import an existing upstream or private Git skill repo**:
123
+ ```bash
124
+ # Community/reference repo (defaults to Visibility=manual; zero context cost):
125
+ ntn-skills source add <git-repo-url> --name <source-name> [--root skills] --policy track </dev/null
126
+ # User's own primary skill repo (auto-indexed into skill-catalog via --discoverable):
127
+ ntn-skills source add <git-repo-url> --name <source-name> [--root skills] --policy track --discoverable </dev/null
128
+ ```
129
+ 2. **Import local standalone skills into the Notion Draft Buffer**:
130
+ ```bash
131
+ ntn-skills new <local-skill-dir> --visibility discoverable </dev/null
132
+ ```
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 notion-skills-cli contributors
3
+ Copyright (c) 2026 yoyooyooo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal