@usechain/chain-hub 0.0.0-stage → 1.1.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -2
  3. package/dist/index.d.ts +9 -0
  4. package/dist/index.js +32318 -0
  5. package/dist/web/apple-touch-icon.png +0 -0
  6. package/dist/web/assets/CatalogPage-DH4aZzR2.js +1 -0
  7. package/dist/web/assets/CatalogPage-M8VZyfIe.js +1 -0
  8. package/dist/web/assets/HealthPage-C2uKV9FU.js +1 -0
  9. package/dist/web/assets/HealthPage-DUbZiwpY.js +1 -0
  10. package/dist/web/assets/IntegrationsPage-BziKwfEq.js +1 -0
  11. package/dist/web/assets/IntegrationsPage-rJcPXOty.js +1 -0
  12. package/dist/web/assets/LearningsPage-DBJ9M7V5.js +2 -0
  13. package/dist/web/assets/LearningsPage-Da6i4TeB.js +2 -0
  14. package/dist/web/assets/LibraryPage-BP6IKKuN.js +4 -0
  15. package/dist/web/assets/LibraryPage-C9uf78JX.js +4 -0
  16. package/dist/web/assets/MarkdownSourceEditor-CV1ZTZzI.js +39 -0
  17. package/dist/web/assets/MarkdownSourceEditor-Xh-yr_Pu.js +39 -0
  18. package/dist/web/assets/OverviewPage-DeApcxoJ.js +1 -0
  19. package/dist/web/assets/OverviewPage-DhNIr7N8.js +1 -0
  20. package/dist/web/assets/SettingsPage-BCoxInUI.js +1 -0
  21. package/dist/web/assets/SettingsPage-BmRmIO3z.js +1 -0
  22. package/dist/web/assets/SetupPage-BUmmsWEo.js +1 -0
  23. package/dist/web/assets/SetupPage-CmXMvqM5.js +1 -0
  24. package/dist/web/assets/SkillRelinkDialog-C5PU7vKu.js +1 -0
  25. package/dist/web/assets/SkillRelinkDialog-DEY3IqVA.js +1 -0
  26. package/dist/web/assets/alert-Mr-ofzoN.js +1 -0
  27. package/dist/web/assets/alert-YumgHBdn.js +1 -0
  28. package/dist/web/assets/badge-C2BSIZMN.js +1 -0
  29. package/dist/web/assets/badge-CcASMiB4.js +1 -0
  30. package/dist/web/assets/format-time-D8VGlAcs.js +1 -0
  31. package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  32. package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  33. package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  34. package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  35. package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  36. package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  37. package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  38. package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  39. package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  40. package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  41. package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  42. package/dist/web/assets/index-D3L-4LuU.css +1 -0
  43. package/dist/web/assets/index-ltESF1KS.js +172 -0
  44. package/dist/web/assets/index-mFc_WQtU.css +1 -0
  45. package/dist/web/assets/index-ommOzjM4.js +172 -0
  46. package/dist/web/assets/libesm-CHGPMFhL.js +6 -0
  47. package/dist/web/assets/select-DJSrFTH0.js +1 -0
  48. package/dist/web/assets/tabs-B9fkoXIl.js +1 -0
  49. package/dist/web/assets/utils-BEATUXr4.js +1 -0
  50. package/dist/web/assets/vendor-react-BgntYnUn.js +12 -0
  51. package/dist/web/assets/vendor-ui-qVCZmmA-.js +41 -0
  52. package/dist/web/favicon-32.png +0 -0
  53. package/dist/web/favicon.svg +2 -0
  54. package/dist/web/icon-192.png +0 -0
  55. package/dist/web/icon-512.png +0 -0
  56. package/dist/web/icon-maskable-512.png +0 -0
  57. package/dist/web/index.html +37 -0
  58. package/dist/web/logo.svg +2 -0
  59. package/dist/web/site.webmanifest +25 -0
  60. package/package.json +42 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Martijn Bokma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,210 @@
1
- # Temporary Holding Version
1
+ # Chain Hub
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A local-first AI workspace control plane — one hub folder, one CLI, one dashboard, every editor.
4
+
5
+ ## Philosophy
6
+
7
+ - **Local first** — everything lives on disk at `~/.chain-hub`. No cloud, no sync service required.
8
+ - **Editor-agnostic** — sync the hub into Cursor, Claude Code, Windsurf, Zed and Google Antigravity.
9
+ - **Single source of truth** — one folder, no database, no duplicated config files.
10
+ - **Calm by default** — a minimal surface that grows with deliberate steps.
11
+
12
+ ## Workspace layout
13
+
14
+ ```text
15
+ web/ React 19 dashboard (Tailwind v4, shadcn/ui, TanStack Query)
16
+ packages/
17
+ cli/ chain binary (Commander, Node 22)
18
+ server/ Hono localhost API
19
+ domain/ use-cases and business logic
20
+ storage/ hub folder I/O + editor adapters
21
+ contracts/ shared Zod schemas and TypeScript types
22
+ ```
23
+
24
+ ## Hub folder structure
25
+
26
+ ```text
27
+ ~/.chain-hub/
28
+ skills/ SKILL.md files
29
+ agents/ agent persona files
30
+ workflows/ workflow .md files
31
+ rules/ rule files
32
+ memory/ markdown notes + learnings log
33
+ learnings/
34
+ events.jsonl append-only capture log
35
+ reflections/ written reflection snapshots (chain reflect --write)
36
+ system/
37
+ meta.json initialization metadata
38
+ skills-lock.json where installed skills came from
39
+ backups/ hand-written editor files replaced by sync or import
40
+ logs/
41
+ ```
42
+
43
+ ## Quickstart
44
+
45
+ Fastest path — one command builds everything and starts the dashboard:
46
+
47
+ ```bash
48
+ bun install
49
+ bun run hub
50
+ # → http://127.0.0.1:2342
51
+ ```
52
+
53
+ `bun run hub` builds all packages, initializes `~/.chain-hub` on first run, starts the API server, and opens the browser. Pass flags after `--`, e.g. `bun run hub -- --no-open --port 3456`.
54
+
55
+ Step by step, if you want more control:
56
+
57
+ ```bash
58
+ # 1. Install
59
+ bun install
60
+
61
+ # 2. Build all packages
62
+ bun run build
63
+
64
+ # 3. Start the dashboard (also initializes ~/.chain-hub on first run)
65
+ node packages/cli/dist/index.js hub
66
+ # → http://127.0.0.1:2342
67
+ ```
68
+
69
+ Override the hub location with `--chain-home <path>` or the `CHAIN_HOME` environment variable:
70
+
71
+ ```bash
72
+ CHAIN_HOME=~/my-hub node packages/cli/dist/index.js hub
73
+ node packages/cli/dist/index.js --chain-home ./.sandbox-hub hub --port 3456
74
+ ```
75
+
76
+ ## CLI reference
77
+
78
+ ### Hub management
79
+
80
+ | Command | Description |
81
+ |---|---|
82
+ | `chain init` | Initialize hub structure and seed a welcome skill |
83
+ | `chain status` | Print a JSON overview of the hub |
84
+ | `chain validate` | Check structural integrity; exits 1 if issues found |
85
+ | `chain setup` | Sync the hub into every installed editor and import new `~/.agents` skills |
86
+ | `chain guide` | Show the guided setup checklist |
87
+ | `chain hub [--port N] [--no-open]` | Start the local dashboard (default port 2342, auto-opens browser) |
88
+
89
+ ### Asset management
90
+
91
+ ```bash
92
+ chain asset list [--kind <kind>]
93
+ chain asset create --kind <kind> --name <name> --content <text>
94
+ chain asset show --kind <kind> --name <name>
95
+ chain asset update --kind <kind> --name <name> --content <text>
96
+ chain asset remove --kind <kind> --name <name>
97
+ ```
98
+
99
+ Asset kinds: `skills` · `agents` · `workflows` · `rules`
100
+
101
+ ### Learnings
102
+
103
+ ```bash
104
+ # Append an event to the timeline
105
+ chain capture --event <type> --skill <slug> --summary "<text>"
106
+ # type: success | failure | correction | note
107
+
108
+ # Print a per-skill reflection report
109
+ chain reflect
110
+
111
+ # Write the report to memory/reflections/YYYY-MM-DD.md
112
+ chain reflect --write
113
+
114
+ # Output raw JSON
115
+ chain reflect --json
116
+ ```
117
+
118
+ ## Dashboard surfaces
119
+
120
+ | Page | What it does |
121
+ |---|---|
122
+ | **Setup** | Guided checklist: init → assets → connect → validate |
123
+ | **Overview** | Health, asset counts, storage stats |
124
+ | **Library** | Browse, create, edit, and delete skills/agents/workflows/rules/prompts |
125
+ | **Learnings** | Captured events and per-skill reflection |
126
+ | **Integrations** | Sync status for Cursor, Claude Code, Windsurf, Zed, Google Antigravity |
127
+ | **Settings** | Theme + local-first AI providers (BYOK / Ollama) |
128
+
129
+ Command palette: **Cmd/Ctrl + K** — navigate, create assets, connect editors, theme/AI shortcuts.
130
+
131
+ Learnings are also available via the CLI (`chain capture` / `chain reflect`).
132
+
133
+ ## API routes
134
+
135
+ The dashboard API runs on the same port as the hub server. It only listens on `127.0.0.1` and rejects requests from other websites (foreign `Origin`, cross-site fetches, non-JSON bodies) and from non-loopback `Host` headers.
136
+
137
+ | Method | Path | Description |
138
+ |---|---|---|
139
+ | GET | `/api/overview` | Hub health, counts, storage |
140
+ | GET | `/api/library` | List assets |
141
+ | POST | `/api/library` | Create asset |
142
+ | GET | `/api/library/:kind/:name` | Get asset detail |
143
+ | PUT | `/api/library/:kind/:name` | Update asset |
144
+ | DELETE | `/api/library/:kind/:name` | Delete asset |
145
+ | GET | `/api/learnings` | Timeline (supports `?limit=` `?offset=`) |
146
+ | POST | `/api/learnings/capture` | Append an event |
147
+ | GET | `/api/learnings/reflect` | Per-skill reflection report |
148
+ | GET | `/api/setup` | Guided setup checklist |
149
+ | GET | `/api/integrations` | Integration status |
150
+ | POST | `/api/integrations/setup` | Run editor setup |
151
+ | GET | `/api/validate` | Validation result |
152
+ | GET | `/api/settings/ai` | AI provider/model settings (no secrets) |
153
+ | PUT | `/api/settings/ai` | Update AI settings / API keys |
154
+ | POST | `/api/ai/draft-prompt` | Draft asset content with configured provider |
155
+
156
+ ## Global install (development)
157
+
158
+ Use `bun link` to make the `chain` binary available globally from the monorepo:
159
+
160
+ ```bash
161
+ # 1. Build all packages first
162
+ bun run build
163
+
164
+ # 2. Link the CLI package globally
165
+ cd packages/cli && bun link
166
+
167
+ # 3. Now use chain directly
168
+ chain init
169
+ chain hub
170
+ chain capture --event success --skill my-skill --summary "It works"
171
+ chain reflect
172
+ ```
173
+
174
+ To unlink:
175
+
176
+ ```bash
177
+ bun unlink @chain-hub/cli
178
+ ```
179
+
180
+ > The `chain` binary calls `dist/index.js` inside `packages/cli/`. Always run `bun run build` after code changes when using the linked binary.
181
+
182
+ ## Development
183
+
184
+ ```bash
185
+ # Build all packages in dependency order
186
+ bun run build
187
+
188
+ # Typecheck all packages and apps
189
+ bun run typecheck
190
+
191
+ # Run all tests (storage + domain + server)
192
+ bun run test
193
+
194
+ # Run with a local sandbox hub
195
+ node packages/cli/dist/index.js --chain-home ./.sandbox-hub init
196
+ node packages/cli/dist/index.js --chain-home ./.sandbox-hub hub --port 3456 --no-open
197
+ ```
198
+
199
+ ## Stack
200
+
201
+ | Layer | Technology |
202
+ |---|---|
203
+ | Runtime | Node 22.13.0+ (ESM) |
204
+ | CLI | Commander |
205
+ | API server | Hono + `@hono/node-server` |
206
+ | Frontend | React 19, React Router 7, TanStack Query v5 |
207
+ | Styling | Tailwind CSS v4, shadcn/ui primitives |
208
+ | Validation | Zod |
209
+ | Build | tsup (packages), Vite (hub-web) |
210
+ | Monorepo | Bun workspaces + Turborepo |
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+
4
+ declare function createProgram(): Command;
5
+ declare function runCli(argv?: string[]): Promise<Command>;
6
+ /** Turns thrown errors into one readable line instead of a stack trace. */
7
+ declare function formatCliError(error: unknown): string;
8
+
9
+ export { createProgram, formatCliError, runCli };