@dhzh/foundry 6.3.2 → 7.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.
Files changed (49) hide show
  1. package/README.md +115 -170
  2. package/dist/index.mjs +4 -3
  3. package/dist/skills/foundry/SKILL.md +29 -109
  4. package/dist/skills/foundry/references/backups.md +31 -0
  5. package/dist/skills/foundry/references/settings.md +44 -113
  6. package/dist/web/assets/index-CQ9xJtJX.css +1 -0
  7. package/dist/web/assets/index-zxnJ0c_Z.js +70 -0
  8. package/dist/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  9. package/dist/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  10. package/dist/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  11. package/dist/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  12. package/dist/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  13. package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  14. package/dist/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  15. package/dist/web/index.html +2 -2
  16. package/package.json +2 -1
  17. package/dist/skills/foundry/references/captures.md +0 -237
  18. package/dist/skills/foundry/references/cli-conventions.md +0 -145
  19. package/dist/skills/foundry/references/data-transfer.md +0 -154
  20. package/dist/skills/foundry/references/providers.md +0 -146
  21. package/dist/web/assets/BottomSheet-Qx_UNAqb.js +0 -1
  22. package/dist/web/assets/ItemSwipeLayer-CaJXyfL9.js +0 -1
  23. package/dist/web/assets/MenuBottomSheet-GEcLGdnQ.js +0 -1
  24. package/dist/web/assets/index-CImkEGKN.css +0 -765
  25. package/dist/web/assets/index-CjRQ2_zc.js +0 -104
  26. package/dist/web/assets/poppins-devanagari-400-normal-CJDn6rn8.woff2 +0 -0
  27. package/dist/web/assets/poppins-devanagari-400-normal-CqVvlrh5.woff +0 -0
  28. package/dist/web/assets/poppins-devanagari-500-normal-BIdkeU1p.woff2 +0 -0
  29. package/dist/web/assets/poppins-devanagari-500-normal-DMPDjHtT.woff +0 -0
  30. package/dist/web/assets/poppins-devanagari-600-normal-ClASKHrr.woff +0 -0
  31. package/dist/web/assets/poppins-devanagari-600-normal-STEjXBNN.woff2 +0 -0
  32. package/dist/web/assets/poppins-devanagari-700-normal-O-jipLrW.woff2 +0 -0
  33. package/dist/web/assets/poppins-devanagari-700-normal-fHs-vx92.woff +0 -0
  34. package/dist/web/assets/poppins-latin-400-normal-BOb3E3N0.woff +0 -0
  35. package/dist/web/assets/poppins-latin-400-normal-cpxAROuN.woff2 +0 -0
  36. package/dist/web/assets/poppins-latin-500-normal-C8OXljZJ.woff2 +0 -0
  37. package/dist/web/assets/poppins-latin-500-normal-DGXqpDMm.woff +0 -0
  38. package/dist/web/assets/poppins-latin-600-normal-BJdTmd5m.woff +0 -0
  39. package/dist/web/assets/poppins-latin-600-normal-zEkxB9Mr.woff2 +0 -0
  40. package/dist/web/assets/poppins-latin-700-normal-BVuQR_eA.woff +0 -0
  41. package/dist/web/assets/poppins-latin-700-normal-Qrb0O0WB.woff2 +0 -0
  42. package/dist/web/assets/poppins-latin-ext-400-normal-DaBSavcJ.woff +0 -0
  43. package/dist/web/assets/poppins-latin-ext-400-normal-by3JarPu.woff2 +0 -0
  44. package/dist/web/assets/poppins-latin-ext-500-normal-CK-6C4Hw.woff2 +0 -0
  45. package/dist/web/assets/poppins-latin-ext-500-normal-CgAe2rWW.woff +0 -0
  46. package/dist/web/assets/poppins-latin-ext-600-normal-CAhIAdZj.woff2 +0 -0
  47. package/dist/web/assets/poppins-latin-ext-600-normal-Df5ffKXP.woff +0 -0
  48. package/dist/web/assets/poppins-latin-ext-700-normal-DctTR6Tg.woff +0 -0
  49. package/dist/web/assets/poppins-latin-ext-700-normal-cby-RkWa.woff2 +0 -0
package/README.md CHANGED
@@ -1,35 +1,27 @@
1
1
  # Foundry
2
2
 
3
- Foundry is an AI-native local personal workbench distributed as a CLI. Its
4
- settings, providers, captures, fetch jobs, encrypted data transfer, and bundled
5
- agent skill copy are available as JSON CLI commands for both people and agents.
6
- `foundry web` prepares local storage, starts a Hono server, serves the bundled
7
- React Web UI, and opens it in the default browser.
3
+ Foundry is a local personal workbench distributed as a CLI with a bundled Web UI.
4
+ People and agents can use the CLI to manage settings, export or import encrypted
5
+ backups, and install the bundled Foundry Skill.
8
6
 
9
- The package is intentionally CLI-only. It does not expose a JavaScript library
10
- entry point.
7
+ ## Current scope
11
8
 
12
- ## Features
9
+ Settings is the implemented feature in the current Web UI and the only business
10
+ command group in the CLI. It covers appearance, language and region, and Advanced
11
+ actions. The main layout, sidebar, and placeholder routes remain available for
12
+ future work. The root route opens Dashboard; opening Settings without a category
13
+ shows Appearance.
13
14
 
14
- - Manage model providers using OpenAI Responses, Anthropic Messages, or
15
- OpenAI-compatible Chat Completions protocols.
16
- - Discover provider models and keep custom model IDs alongside remote models.
17
- - Save links as agent-facing index cards using the configured capture fetcher,
18
- run background jobs with retries, and inspect the raw fetcher response.
19
- - Configure appearance, language and region, capture behavior, and concurrency.
20
- - Export and import an encrypted `.foundry-backup` snapshot containing the
21
- JSON records and application settings.
22
- - Copy the bundled agent skill into `<home>/.agents/skills/foundry`,
23
- `<home>/.claude/skills/foundry`, or both from the CLI or Settings > Advanced.
15
+ Provider, capture, fetch-job, and session backend services and APIs are retained.
16
+ Their presence does not imply a corresponding page or CLI command in the current
17
+ product. `app/web/legacy-src` holds remaining reference code; its Settings
18
+ implementation has been removed. Keeping the current scope focused on Settings
19
+ does not mean removing the application shell or other backend capabilities.
24
20
 
25
- ## Requirements
21
+ ## Requirements and startup
26
22
 
27
- - Node.js 24.22.1 or newer
28
- - pnpm 12.15 or newer
29
-
30
- Foundry stores its own data as JSON files. No native SQLite package is required.
31
-
32
- ## Run From Source
23
+ Use Node.js and pnpm versions compatible with `package.json` (currently Node.js
24
+ 24.22.1 or newer within major 24, and pnpm 12.15 or newer within major 12).
33
25
 
34
26
  ```bash
35
27
  pnpm install
@@ -37,11 +29,8 @@ pnpm build
37
29
  pnpm start web
38
30
  ```
39
31
 
40
- `pnpm start` runs the built CLI from `dist/index.mjs`; `pnpm start web` starts
41
- the Web UI. Build first after changing the CLI, server, or Web UI.
42
-
43
- `foundry web` listens on `http://127.0.0.1:11111`, prints the URL, and opens the
44
- browser by default:
32
+ The installed command is `foundry`. The package exposes a CLI executable, not a
33
+ JavaScript library entry point.
45
34
 
46
35
  ```bash
47
36
  foundry web
@@ -50,186 +39,142 @@ foundry --help
50
39
  foundry --version
51
40
  ```
52
41
 
53
- Running bare `foundry` only prints help. It does not initialize storage or start
54
- the Web UI. The Web host and port are fixed; there are no CLI or
55
- environment-variable port overrides.
42
+ `foundry web` initializes JSON storage, starts the local Hono server at
43
+ `http://localhost:11111`, serves the bundled React UI, and opens the browser.
44
+ `--no-open` starts the same server without opening a browser. Bare `foundry`
45
+ prints help without initializing storage. `pnpm start` runs the built CLI and
46
+ does not build implicitly.
56
47
 
57
- ## CLI
58
-
59
- Feature commands write JSON to stdout and errors to stderr:
48
+ ## Settings
60
49
 
61
50
  ```bash
62
51
  foundry settings get
63
- foundry settings update --input '{"theme":"dark"}'
52
+ foundry settings get color-theme
53
+ foundry settings set color-theme dark
54
+ foundry settings set language zh-CN
55
+ foundry settings set time-zone Asia/Shanghai
56
+ foundry settings set time-format "YYYY-MM-DD HH:mm:ss"
57
+ foundry settings get config-folder
58
+ foundry settings config-folder open
59
+ ```
64
60
 
65
- foundry providers list
66
- foundry providers create --input '{"name":"Local","protocol":"openai-compatible-chat-completions","baseURL":"http://127.0.0.1:11434/v1","apiKey":"","customModels":[]}'
67
- foundry providers set-status <id> --status disabled
61
+ `get` returns a flat JSON object containing the four editable settings and the
62
+ read-only `config-folder`. `get <key>` returns a JSON string, and
63
+ `set <key> <value>` returns `{ "key": "...", "value": "..." }`. Invalid values
64
+ are rejected. Use `foundry settings set --help` or the
65
+ [Settings reference](skills/foundry/references/settings.md) for all supported
66
+ keys and values.
67
+ Settings commands return JSON on stdout and operation errors on stderr with a
68
+ nonzero exit code. Help, version, and Web startup output are human-readable.
68
69
 
69
- foundry captures list
70
- foundry captures create https://example.com/article --note "Read later"
71
- foundry captures get <capture-id>
70
+ Web clients receive settings changes from other tabs and CLI processes while
71
+ the server is running. Settings categories can be opened directly:
72
72
 
73
- foundry captures jobs list <capture-id>
74
- foundry captures jobs get <capture-id> <job-id>
75
- foundry captures jobs recapture <capture-id>
73
+ - `#/settings?panel=appearance`
74
+ - `#/settings?panel=language-region`
75
+ - `#/settings?panel=advanced`
76
76
 
77
- foundry data-transfer status
78
- foundry data-transfer export --output ./foundry.foundry-backup
79
- foundry data-transfer inspect ./foundry.foundry-backup
80
- foundry data-transfer import ./foundry.foundry-backup
77
+ Omitted or invalid `panel` values select Appearance. Timezone names are localized;
78
+ the stored values remain IANA timezone identifiers. The full-screen Settings back
79
+ button returns one step through browser history.
81
80
 
81
+ ## Backups and agent Skill
82
+
83
+ Settings > Advanced provides Export, Import, Config Folder, and Download Skill.
84
+ The equivalent CLI operations are:
85
+
86
+ ```bash
87
+ foundry settings export --output ./backup.foundry-backup
88
+ foundry settings import ./backup.foundry-backup
82
89
  foundry settings download-skill --target .agents,.claude
83
90
  ```
84
91
 
85
- Use `--input-file <path>` or `--input -` for large JSON payloads. Data-transfer
86
- passphrases can be passed with `--passphrase` or `FOUNDRY_PASSPHRASE`.
87
- `data-transfer import` validates and replaces local JSON records and settings in
88
- one command.
92
+ Backup passphrases use `FOUNDRY_PASSPHRASE` or `--passphrase`. Export rejects an
93
+ existing destination unless `--force` is supplied. Import normalizes backup data
94
+ and replaces the supported data completely. The current backup payload contains
95
+ settings, including settings retained for backend features; it is not a copy of
96
+ all runtime files. Providers, captures, and fetch jobs are outside this payload.
97
+ Web import reloads the page without the hash route and enters the normal root
98
+ route. See [backup behavior and format](docs/data-export.md).
89
99
 
90
- Skill targets are fixed relative to the user home directory. Here `<home>` is
91
- `~` on macOS/Linux and `%USERPROFILE%` on Windows:
100
+ Download Skill installs Foundry's agent usage manual, which teaches agents how
101
+ to operate the installed Foundry CLI. It copies to selected user-level targets:
92
102
 
93
- - `.agents` -> `<home>/.agents/skills/foundry`
94
- - `.claude` -> `<home>/.claude/skills/foundry`
103
+ - `.agents` → `<home>/.agents/skills/foundry`
104
+ - `.claude` → `<home>/.claude/skills/foundry`
95
105
 
96
- Selecting both copies to both locations. Replacing one selected target does not
97
- change the other.
106
+ `<home>` is the operating system's user home directory. Existing copies at
107
+ selected targets are replaced; unselected targets are left alone.
98
108
 
99
- ## Local Development
109
+ ## Development
100
110
 
101
- Run the API and Web UI as two independent processes:
111
+ Run the API and Web dev servers separately:
102
112
 
103
113
  ```bash
104
114
  pnpm dev:api
105
115
  pnpm dev:web
106
116
  ```
107
117
 
108
- - Web UI: `http://localhost:33333`
109
- - API: `http://localhost:22222`
110
-
111
- Vite proxies `/api` from the Web dev server to the API server. There is
112
- intentionally no CLI development command; use the two development servers to
113
- test page behavior, then use `pnpm build && pnpm start web` to verify the
114
- production server and static assets.
115
-
116
- ## Data and Storage
117
-
118
- Foundry keeps user data outside the repository in `<home>/.foundry`. `<home>` is
119
- `~` on macOS/Linux and `%USERPROFILE%` on Windows:
120
-
121
- - `settings.json`: application settings
122
- - `providers.json`: an array of providers, credentials, and optional base64 avatars
123
- - `captures/<record-key>.json`: captures
124
- - `fetch-jobs/<record-key>.json`: fetch jobs, configuration snapshots and responses
125
- - `.data-transfer/`: temporary export and import files
126
-
127
- Capture and fetch-job filenames use a SHA-256 key of the record ID for portable, collision-safe
128
- paths; the original ID is preserved inside each document.
129
-
130
- Feature commands initialize JSON storage before running. `foundry web` does the
131
- same before the server starts. A process lock serializes writers and protects
132
- consistent reads. Writes use temporary-file replacement and a durable redo
133
- journal; interrupted committed writes are completed on the next open. Each read
134
- loads the requested JSON files directly; no cross-request cache or manifest is
135
- required.
136
-
137
- A new installation starts directly with default JSON settings and empty
138
- collections directly under `.foundry`, without a `data/` subdirectory. Startup
139
- does not inspect or import old SQLite databases. Unrelated files are left alone.
140
- The read-only Sessions view reads Codex and Claude Code JSONL transcripts, including
141
- Zstandard-compressed files. It does not read their databases, global state, or
142
- session indexes. Threads are grouped by the working directory recorded in their
143
- transcripts; Codex project membership and later UI-only renames are not imported.
144
- Existing `providers/` records are automatically migrated into `providers.json`
145
- under the process lock using the recovery journal. Provider avatars accept PNG,
146
- JPEG, GIF, WebP, or SVG images up to 2 MB; clearing an avatar restores the default icon.
147
-
148
- Encrypted exports and imports use JSON snapshots in `data/foundry.json`.
149
- SQLite-based backup archives are not supported.
150
-
151
- On POSIX systems, Foundry creates the data directory with `0700` permissions and
152
- sensitive files with `0600` permissions.
118
+ | Process | URL | Purpose |
119
+ | --- | --- | --- |
120
+ | Vite Web | `http://localhost:33333` | UI development; proxies `/api` to the API dev server |
121
+ | Hono API | `http://localhost:22222` | Standalone API development |
122
+ | Production Web | `http://localhost:11111` | Built CLI, API, and bundled Web assets |
153
123
 
154
- Agent skill copies are user-level rather than Foundry runtime data:
155
-
156
- - `<home>/.agents/skills/foundry`
157
- - `<home>/.claude/skills/foundry`
158
-
159
- ## Build Output
124
+ Ports are fixed. There is no CLI dev command. Rebuild after source changes when
125
+ testing the packaged CLI or production Web flow.
160
126
 
161
127
  ```bash
128
+ pnpm exec eslint src app/web/src packages/shared/src app/web/vite.config.ts vitest.config.ts tsdown.config.ts package.json
129
+ pnpm exec tsc --noEmit
130
+ pnpm --filter web exec tsc --noEmit
162
131
  pnpm build
132
+ pnpm test
133
+ git diff --check
163
134
  ```
164
135
 
165
- The build produces:
136
+ Use temporary `HOME` storage for mutating CLI or import tests. For UI changes,
137
+ verify the affected behavior in a browser as well as running static checks.
166
138
 
167
- ```text
168
- dist/
169
- |-- index.mjs
170
- |-- skills/
171
- | `-- foundry/
172
- | |-- SKILL.md
173
- | `-- references/
174
- `-- web/
175
- |-- assets/
176
- |-- index.html
177
- `-- favicon.png
178
- ```
139
+ ## Storage and packaging
179
140
 
180
- `tsdown` cleans `dist`, bundles the CLI, and copies the bundled
181
- agent skill. Vite then writes the Web UI directly to `dist/web`. Do not add a
182
- manual copy step for the Web UI.
141
+ Runtime data lives in `<home>/.foundry`, outside the repository and `dist`:
183
142
 
184
- ## Commands
143
+ - `settings.json`: normalized application settings
144
+ - `providers.json`: retained provider records
145
+ - `captures/` and `fetch-jobs/`: one JSON file per retained record
185
146
 
186
- | Command | Purpose |
187
- | --- | --- |
188
- | `pnpm dev:api` | Run the API server at `22222` |
189
- | `pnpm dev:web` | Run the Vite Web UI at `33333` |
190
- | `pnpm build` | Build the CLI and Web UI |
191
- | `pnpm start web` | Run the production Web UI at `11111` |
192
- | `pnpm start` | Print the built CLI help |
193
- | `pnpm test` | Run behavioral tests |
194
- | `pnpm test:coverage` | Run tests with V8 coverage |
147
+ Foundry uses process locking, atomic replacement, and a redo journal for JSON
148
+ transactions. Reads load files directly. Startup recovers committed interrupted
149
+ writes; a new installation uses default settings and empty collections. Foundry
150
+ does not import old SQLite databases. The retained Sessions backend reads external
151
+ Codex and Claude Code JSONL transcripts, including `.jsonl.zst` files, read-only.
152
+ On POSIX, Foundry runtime directories use `0700` and data files use `0600`.
195
153
 
196
- Run the project scripts with the Node.js version declared in `package.json`.
197
- Older Node.js versions cannot run the installed pnpm or project toolchain.
198
-
199
- ## Project Structure
154
+ `pnpm build` bundles the CLI with tsdown, copies the Skill into `dist/skills`,
155
+ then builds the Web UI directly into `dist/web` with Vite:
200
156
 
201
157
  ```text
202
- app/web/ React, Vite, Astryx, and StyleX Web UI
203
- src/
204
- |-- cli/ CLI commands, JSON I/O, and browser opening
205
- |-- features/ Feature services, validation, repositories, and routes
206
- |-- lib/ Small server-side utilities
207
- |-- server/ Hono API, static serving, and server entry points
208
- `-- storage/ JSON records, process locking, and transaction recovery
209
- skills/foundry/ Agent-facing CLI usage skill and references
210
- test/ Behavioral API and feature tests
158
+ dist/
159
+ |-- index.mjs
160
+ |-- skills/foundry/
161
+ `-- web/
211
162
  ```
212
163
 
213
- `skills/foundry/SKILL.md` is the agent-facing Foundry CLI usage skill. Its
214
- feature references live in `skills/foundry/references`.
215
-
216
- The API is mounted under `/api`. The production server serves files from
217
- `dist/web` and falls back to `dist/web/index.html` for client-side routes.
218
-
219
- ## Packaging
164
+ The published payload is `dist` plus package metadata and standard root files
165
+ included by the package manager. `bin` points to `dist/index.mjs`; `exports`
166
+ exposes only `./package.json`. Verify with `pnpm pack --dry-run`.
220
167
 
221
- The published package contains only `dist`. The `bin` entry points to
222
- `dist/index.mjs`, and `exports` exposes only `./package.json`; consumers cannot
223
- import Foundry as a JavaScript library.
224
-
225
- Verify package contents with:
226
-
227
- ```bash
228
- pnpm pack --dry-run
229
- ```
168
+ ## Documentation
230
169
 
231
- The tarball must include the CLI, Web assets, and bundled
232
- agent skill.
170
+ - [Development constraints](AGENTS.md): architecture, storage, and verification
171
+ - [Web development](app/web/README.md) and [design rules](app/web/DESIGN.md)
172
+ - [Settings implementation](docs/settings.md): routing, synchronization, and API boundaries
173
+ - [Data export and import](docs/data-export.md): normalization, replacement, and format
174
+ - [Foundry Skill](skills/foundry/SKILL.md): installed CLI usage for agents
175
+ - [Sessions vocabulary](GLOSSARY.md): retained backend domain terms
176
+ - [ADRs](docs/adr/): decisions with current backend and historical UI scope identified
177
+ - [Chatbot research](docs/research/chatbot-api-and-persistence.md): historical proposal
233
178
 
234
179
  ## License
235
180