@hasna/skills 0.1.63 → 0.1.66

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.
Files changed (42) hide show
  1. package/README.md +61 -22
  2. package/bin/index.js +2120 -670
  3. package/bin/mcp.js +555 -249
  4. package/bin/migrate.js +229 -33
  5. package/bin/server.js +1542 -327
  6. package/bin/worker.js +716 -207
  7. package/dist/cli/commands/registry-reconcile.d.ts +2 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +682 -276
  10. package/dist/lib/agent-sync.d.ts +26 -6
  11. package/dist/lib/auth-store.d.ts +37 -0
  12. package/dist/lib/config.d.ts +51 -0
  13. package/dist/lib/home-census.d.ts +4 -0
  14. package/dist/lib/home-migration.d.ts +8 -9
  15. package/dist/lib/native-storage.d.ts +29 -1
  16. package/dist/lib/portable-skills.d.ts +49 -6
  17. package/dist/lib/pull.d.ts +31 -0
  18. package/dist/lib/registry-reconcile.d.ts +114 -0
  19. package/dist/lib/registry-types.d.ts +9 -0
  20. package/dist/lib/registry.d.ts +7 -4
  21. package/dist/lib/remote-client.d.ts +118 -1
  22. package/dist/lib/remote-registry.d.ts +26 -0
  23. package/dist/lib/revision.d.ts +29 -0
  24. package/dist/lib/run-routing.d.ts +60 -0
  25. package/dist/sdk/index.js +14412 -13338
  26. package/dist/server/app.d.ts +4 -1
  27. package/dist/server/config.d.ts +12 -2
  28. package/dist/server/rows.d.ts +2 -1
  29. package/dist/server/skills-api.d.ts +108 -6
  30. package/dist/server/sqlite-store.d.ts +20 -3
  31. package/dist/server/store-fixtures.d.ts +6 -0
  32. package/dist/server/store.d.ts +31 -5
  33. package/dist/server/types.d.ts +98 -3
  34. package/dist/storage.d.ts +1 -1
  35. package/dist/storage.js +57 -2
  36. package/migrations/postgres/0004_hosted_pins.sql +28 -0
  37. package/migrations/postgres/0005_revision_tombstone_registry.sql +37 -0
  38. package/migrations/postgres/0005_tag_projection.sql +36 -0
  39. package/migrations/sqlite/0004_hosted_pins.sql +21 -0
  40. package/migrations/sqlite/0005_revision_tombstone_registry.sql +18 -0
  41. package/migrations/sqlite/0005_tag_projection.sql +25 -0
  42. package/package.json +3 -2
package/README.md CHANGED
@@ -19,7 +19,7 @@ Requires [Bun](https://bun.sh/) 1.0+.
19
19
  # Browse skills interactively
20
20
  skills
21
21
 
22
- # Point the CLI at a Skills API server when you want remote runs
22
+ # Point the CLI at a Skills API server for server-owned (premium) skill runs
23
23
  skills setup --api-url https://skills.example.com
24
24
  skills auth login --api-key "$SKILLS_API_KEY"
25
25
 
@@ -35,28 +35,41 @@ skills setup agents
35
35
  # See what a skill needs
36
36
  skills info logo-design
37
37
 
38
- # Premium skills run through the configured Skills API
39
- skills run logo-design --brief "minimal geometric owl mark"
38
+ # Server-owned (premium) skills run through the configured Skills API
39
+ skills run <server-owned-skill> --brief "minimal geometric owl mark"
40
40
 
41
- # Free/local skills can still use your own provider keys when documented
41
+ # Every other skill runs on this machine by default, even when an API is
42
+ # configured; local skills may use your own provider keys when documented
42
43
  skills requires brand-style-guide
43
44
  OPENAI_API_KEY=... skills run brand-style-guide ./brand-notes.md
44
45
  ```
45
46
 
46
47
  ## Server-Side Runtime Skills
47
48
 
48
- Premium skills run on the server. The CLI and MCP server submit them to the
49
- configured Skills API, create local run metadata, and then expose status and
50
- artifact commands. They do not fall back to bundled local execution when auth is
51
- missing or the server runtime is unavailable.
52
-
53
- Use `SKILLS_API_KEY` or `skills auth login --api-key` for premium server-side
49
+ Premium skills run on the server. A skill is premium server-owned when its
50
+ published contract carries the server-owned marker (`skills.runtime: "hosted"`
51
+ or `skills.source: "remote" | "private-hosted"` in the skill's `package.json`).
52
+ The CLI and MCP server submit server-owned skills to the configured Skills API,
53
+ create local run metadata, and then expose status and artifact commands. They
54
+ do not fall back to bundled local execution when auth is missing or the server
55
+ runtime is unavailable.
56
+
57
+ Routing is config-driven and local is the default: a run is sent to the API
58
+ only when an origin is configured (`apiUrl` or `$SKILLS_API_URL`), a credential
59
+ is present (`SKILLS_API_KEY` or the auth store), and the skill carries the
60
+ server-owned marker. Every other skill runs on this machine, whether or not an
61
+ API is configured. No skill in the OSS catalog is server-owned today; the
62
+ marker arrives with skills synced from a Skills API deployment. A server-owned
63
+ skill run without the origin or the credential fails closed with an error
64
+ naming the missing setup — it never silently runs locally.
65
+
66
+ Use `SKILLS_API_KEY` or `skills auth login --api-key` for server-side
54
67
  execution:
55
68
 
56
69
  ```bash
57
70
  skills setup --api-url https://skills.example.com
58
71
  skills auth login --api-key "$SKILLS_API_KEY"
59
- skills run logo-design --brief "minimal geometric owl mark"
72
+ skills run <server-owned-skill> --brief "minimal geometric owl mark"
60
73
  skills runs status <run-id>
61
74
  skills exports download <run-id>
62
75
  ```
@@ -175,10 +188,11 @@ Stable command shapes:
175
188
  `{ "dryRun": true, "actions": [...] }` where applicable.
176
189
  - Runtime: `run --json <skill> ...` returns
177
190
  `{ "skill", "args", "exitCode", "stdout", "stderr", "error", "run" }`.
178
- Premium server-side runs include `{ "contractVersion": 1, "remote": true,
179
- "remoteRun", "pricing", "run", "nextActions" }` and return immediately with
191
+ Server-owned (premium) runs include `{ "contractVersion": 1, "remote": true,
192
+ "remoteRun", "run", "nextActions" }` and return immediately with
180
193
  status commands such as `skills runs status <run-id>` and
181
- `skills exports download <run-id>`.
194
+ `skills exports download <run-id>`. Premium-catalog and pricing metadata is
195
+ served by the API and never ships in this package.
182
196
  - Config and schedules: `config * --json` and `schedule * --json` return
183
197
  machine-readable status objects.
184
198
  - Storage: `storage status --json` returns local `.skills` paths and optional
@@ -215,6 +229,12 @@ If the URL is an origin such as `https://your-server.example`, the CLI requests
215
229
  Authenticated registry listing and premium server-side execution use
216
230
  `SKILLS_API_KEY` or the credential saved by `skills auth login --api-key`.
217
231
 
232
+ The typed `RemoteSkillsClient` also exposes pin, tag, and cursor-based
233
+ incremental-sync methods (`listPins`/`pin`/`unpin`, `listTags`/`skillsByTag`,
234
+ `listUpdatedSince`). A server that predates those routes fails closed with an
235
+ explicit unsupported-route error — never a silent empty listing. Route table
236
+ and version-skew contract: `docs/architecture/remote-client-pins-tags-sync.md`.
237
+
218
238
  For the reusable upstream contract, see
219
239
  `docs/architecture/reusable-skills-engine.md`.
220
240
 
@@ -303,8 +323,8 @@ identical either way.
303
323
 
304
324
  ```bash
305
325
  skills-server # SQLite at ~/.hasna/skills/server.db
306
- HASNA_SKILLS_DATABASE_URL=/srv/skills/server.db skills-server
307
- HASNA_SKILLS_DATABASE_URL=postgres://user:pw@host/skills skills-server
326
+ HASNA_SKILLS_DATABASE_URL=<path>/server.db skills-server
327
+ HASNA_SKILLS_DATABASE_URL=postgres://user:CHANGEME@host/skills skills-server
308
328
  ```
309
329
 
310
330
  | `HASNA_SKILLS_DATABASE_URL` | Backend | Survives restart |
@@ -338,12 +358,19 @@ explicitly, because several replicas racing to migrate one shared database is no
338
358
  something to do implicitly:
339
359
 
340
360
  ```bash
341
- HASNA_SKILLS_DATABASE_URL=postgres://… skills-migrate
361
+ HASNA_SKILLS_DATABASE_URL=postgres://user:CHANGEME@host/skills skills-migrate
342
362
  ```
343
363
 
344
364
  `skills-migrate` fails if no database is configured rather than migrating a default
345
365
  SQLite file, so it stays usable as a deploy gate.
346
366
 
367
+ `HASNA_SKILLS_DATABASE_URL` and `DATABASE_URL` are server-only. CLI, MCP, and SDK
368
+ clients never read them and never open a database connection: a client reaches
369
+ the cloud only through `SKILLS_API_URL` plus an API key (the `apiKey` stored by
370
+ `skills auth`, or `SKILLS_API_KEY`). The one exception is the repo-native storage
371
+ sync under [Storage Boundary](#storage-boundary), an operator tool that
372
+ intentionally reads the same variables.
373
+
347
374
  Three things the server will not do:
348
375
 
349
376
  - Fall back to another backend when a configured Postgres URL cannot be reached.
@@ -421,7 +448,7 @@ skills/ # Public skill contracts and local OSS skills
421
448
 
422
449
  | Count | Value | Derived from |
423
450
  |---|---|---|
424
- | Catalog skills | 85 | `SKILLS.length` (`src/lib/registry-data/`) |
451
+ | Catalog skills | 86 | `SKILLS.length` (`src/lib/registry-data/`) |
425
452
  | Categories | 17 | `CATEGORIES` (`src/lib/registry-types.ts`) |
426
453
  | MCP tools | 37 | `tools/list` against a live `buildServer()` |
427
454
 
@@ -450,7 +477,8 @@ folders are never used as skill libraries.
450
477
  └── tmp/
451
478
  ```
452
479
 
453
- Auth stays global in `~/.hasna/skills/auth.json`. Registry and doc caches
480
+ Auth stays global in `<app folder>/auth.json` (default
481
+ `~/.hasna/skills/auth.json`). Registry and doc caches
454
482
  belong in `~/.cache/skills` or the Skills API, not inside project
455
483
  `.skills`.
456
484
 
@@ -473,8 +501,11 @@ bun run typecheck # TypeScript type checking
473
501
  manifests, bin entries, docs, and SKILL.md frontmatter
474
502
  4. Run `bun test` to verify registry-wide validation passes
475
503
 
476
- Premium server-executed skills should add public contracts, pricing, docs, and tests
477
- without adding provider secrets to the OSS package.
504
+ Server-owned (premium) skills declare the server-owned marker in their
505
+ published contract (`skills.runtime: "hosted"` or `skills.source: "remote" |
506
+ "private-hosted"`), ship public contracts, docs, and tests, and add no provider
507
+ secrets and no pricing metadata to the OSS package — pricing is served by the
508
+ API.
478
509
 
479
510
  Portable skill directories are auto-discovered from
480
511
  `~/.hasna/skills/installed/<name>/`. Skills found in either older location -
@@ -513,7 +544,15 @@ overridden folder. `skills config path` reports the config file actually in use.
513
544
  | Installed skills | `<app folder>/installed/<name>/` | yes |
514
545
  | Global config | `<app folder>/config.json` | yes |
515
546
  | Feedback database | `<app folder>/skills.db` | yes |
516
- | Auth | `~/.hasna/skills/auth.json` | no (resolved at startup) |
547
+ | Auth | `<app folder>/auth.json` | yes |
548
+
549
+ There is no separate local-skills-folder override, and none is needed: one
550
+ variable relocates the whole app folder, so the corpus is always
551
+ `<app folder>/installed`. With the default app folder that is exactly the
552
+ migrated corpus location — the former `~/.skills` and `custom/` trees are folded
553
+ into `<app folder>/installed` on first resolution (see "Migrating from the older
554
+ layout"). Extension corpora are a separate concern and keep their own
555
+ `extensionsDir` config key.
517
556
 
518
557
  ### Migrating from the older layout
519
558