@dhzh/foundry 3.1.3 → 4.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/README.md +87 -23
- package/dist/index.mjs +1 -1
- package/dist/skills/foundry/SKILL.md +118 -0
- package/dist/skills/foundry/references/captures.md +241 -0
- package/dist/skills/foundry/references/cli-conventions.md +145 -0
- package/dist/skills/foundry/references/data-transfer.md +150 -0
- package/dist/skills/foundry/references/providers.md +140 -0
- package/dist/skills/foundry/references/settings.md +134 -0
- package/dist/web/assets/{BottomSheet-CLUxnQLq.js → BottomSheet-CDtaYemW.js} +1 -1
- package/dist/web/assets/{ItemSwipeLayer-Chuv-rsv.js → ItemSwipeLayer-Cp1gCfRQ.js} +1 -1
- package/dist/web/assets/{MenuBottomSheet-CvQo99mU.js → MenuBottomSheet-CMLetz-H.js} +1 -1
- package/dist/web/assets/index-D8GEg9kQ.js +179 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-DyyvDGwQ.js +0 -179
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Captures
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
foundry captures list [--filter all|no-successful]
|
|
7
|
+
foundry captures counts
|
|
8
|
+
foundry captures get <capture-id>
|
|
9
|
+
foundry captures create <url> [--note <text>]
|
|
10
|
+
foundry captures recapture <capture-id>
|
|
11
|
+
foundry captures note <capture-id> <text>
|
|
12
|
+
foundry captures delete <capture-id>
|
|
13
|
+
foundry captures jobs list <capture-id>
|
|
14
|
+
foundry captures jobs get <capture-id> <job-id>
|
|
15
|
+
foundry captures jobs recapture <capture-id>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Aliases: `foundry capture ...`; `list` supports `ls`; `create` supports `add`;
|
|
19
|
+
`delete` supports `remove` and `rm`; nested job `list` supports `ls` and
|
|
20
|
+
nested job `get` supports `show`.
|
|
21
|
+
|
|
22
|
+
## Capture Summary
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"id": "<capture-id>",
|
|
27
|
+
"url": "https://example.com/article",
|
|
28
|
+
"title": "Article title",
|
|
29
|
+
"userNote": "Read later",
|
|
30
|
+
"latestSuccessfulJobId": "<job-id>",
|
|
31
|
+
"createdAt": "<iso>",
|
|
32
|
+
"updatedAt": "<iso>"
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Capture Detail
|
|
37
|
+
|
|
38
|
+
`captures get` returns:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"capture": {
|
|
43
|
+
"id": "<capture-id>",
|
|
44
|
+
"url": "https://example.com/article",
|
|
45
|
+
"title": "Article title",
|
|
46
|
+
"userNote": "Read later",
|
|
47
|
+
"latestSuccessfulJobId": "<job-id>",
|
|
48
|
+
"createdAt": "<iso>",
|
|
49
|
+
"updatedAt": "<iso>"
|
|
50
|
+
},
|
|
51
|
+
"content": {
|
|
52
|
+
"jobId": "<job-id>",
|
|
53
|
+
"markdown": "# Article"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`content` is the latest successful scrape content. It is `null` when no job has
|
|
59
|
+
succeeded yet or the stored response has no usable Markdown/content string.
|
|
60
|
+
|
|
61
|
+
## Child Jobs
|
|
62
|
+
|
|
63
|
+
Jobs are capture-owned children. They are not a global top-level CLI resource.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
foundry captures jobs list <capture-id>
|
|
67
|
+
foundry captures jobs get <capture-id> <job-id>
|
|
68
|
+
foundry captures jobs recapture <capture-id>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`jobs get` requires both IDs because Foundry verifies that the job belongs to
|
|
72
|
+
the specified capture:
|
|
73
|
+
|
|
74
|
+
- unknown capture -> `CAPTURE_NOT_FOUND`
|
|
75
|
+
- unknown job or job owned by another capture -> `JOB_NOT_FOUND`
|
|
76
|
+
|
|
77
|
+
Job shape:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"id": "<job-id>",
|
|
82
|
+
"captureId": "<capture-id>",
|
|
83
|
+
"status": "succeeded",
|
|
84
|
+
"fetcher": "firecrawl",
|
|
85
|
+
"errorCode": null,
|
|
86
|
+
"errorMessage": null,
|
|
87
|
+
"createdAt": "<iso>",
|
|
88
|
+
"updatedAt": "<iso>"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Statuses:
|
|
93
|
+
|
|
94
|
+
- `pending`: queued, not started.
|
|
95
|
+
- `running`: scrape request in progress.
|
|
96
|
+
- `succeeded`: scrape completed and latest successful job pointer may be set.
|
|
97
|
+
- `failed`: scrape exhausted its attempt or failed non-retryably.
|
|
98
|
+
|
|
99
|
+
The job response does not include captured Markdown. Use
|
|
100
|
+
`foundry captures get <capture-id>` for the latest successful content.
|
|
101
|
+
|
|
102
|
+
`jobs list` returns the capture's non-deleted jobs, newest first. This matches
|
|
103
|
+
the Web UI Jobs page. An existing capture with no jobs returns `[]`.
|
|
104
|
+
|
|
105
|
+
`jobs recapture` creates a new job with the current fetcher configuration, waits
|
|
106
|
+
for it to reach `succeeded` or `failed`, and returns the final job summary.
|
|
107
|
+
Preconditions are the same as capture recapture: the capture exists, no active
|
|
108
|
+
job already exists, and the current fetcher/API key are configured.
|
|
109
|
+
|
|
110
|
+
The Web UI Jobs page supports listing status, fetcher, created/updated time,
|
|
111
|
+
and error details; refresh by rerunning `jobs list`; and recapture. It does not
|
|
112
|
+
expose cancel, delete, retry-in-place, or a global job list. The CLI deliberately
|
|
113
|
+
matches those capabilities.
|
|
114
|
+
|
|
115
|
+
## List And Counts
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
foundry captures list
|
|
119
|
+
foundry captures list --filter no-successful
|
|
120
|
+
foundry captures counts
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Filters:
|
|
124
|
+
|
|
125
|
+
- `all`: every non-deleted capture.
|
|
126
|
+
- `no-successful`: captures with no latest successful job.
|
|
127
|
+
|
|
128
|
+
Counts shape:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"all": 6,
|
|
133
|
+
"noSuccessful": 1
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Create
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
foundry captures create https://example.com/article --note "Read later"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Preconditions:
|
|
144
|
+
|
|
145
|
+
- `settings.features.library.captures.fetcher` must be `firecrawl` or `deepseek`.
|
|
146
|
+
- The selected fetcher's API key must be non-empty.
|
|
147
|
+
- URL must be HTTP or HTTPS after trimming whitespace.
|
|
148
|
+
- The same normalized URL cannot already have an active capture.
|
|
149
|
+
|
|
150
|
+
The command creates the capture, queues its first scrape job, waits until that
|
|
151
|
+
job reaches `succeeded` or `failed`, and returns:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"capture": {
|
|
156
|
+
"id": "<capture-id>",
|
|
157
|
+
"url": "https://example.com/article",
|
|
158
|
+
"title": "Article title",
|
|
159
|
+
"userNote": "Read later",
|
|
160
|
+
"latestSuccessfulJobId": "<job-id>",
|
|
161
|
+
"createdAt": "<iso>",
|
|
162
|
+
"updatedAt": "<iso>"
|
|
163
|
+
},
|
|
164
|
+
"content": {
|
|
165
|
+
"jobId": "<job-id>",
|
|
166
|
+
"markdown": "# Article"
|
|
167
|
+
},
|
|
168
|
+
"job": {
|
|
169
|
+
"id": "<job-id>",
|
|
170
|
+
"captureId": "<capture-id>",
|
|
171
|
+
"status": "succeeded",
|
|
172
|
+
"fetcher": "firecrawl",
|
|
173
|
+
"errorCode": null,
|
|
174
|
+
"errorMessage": null,
|
|
175
|
+
"createdAt": "<iso>",
|
|
176
|
+
"updatedAt": "<iso>"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Important: a completed create command can return `job.status: "failed"` and
|
|
182
|
+
`content: null`. That is a scrape failure, not a capture-create failure. Read
|
|
183
|
+
`errorCode` and `errorMessage`.
|
|
184
|
+
|
|
185
|
+
## Recapture
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
foundry captures recapture <capture-id>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This creates a new child job, waits for completion, and returns the same
|
|
192
|
+
`capture`, `content`, and `job` structure as `captures create`.
|
|
193
|
+
|
|
194
|
+
Preconditions:
|
|
195
|
+
|
|
196
|
+
- The capture must exist.
|
|
197
|
+
- No pending or running job may already exist for it.
|
|
198
|
+
- The current capture fetcher and key must be configured.
|
|
199
|
+
|
|
200
|
+
This is the capture-level equivalent of `captures jobs recapture`; it returns
|
|
201
|
+
the capture detail along with the final job, while the nested jobs command
|
|
202
|
+
returns only the final job.
|
|
203
|
+
|
|
204
|
+
## Update Note
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
foundry captures note <capture-id> "New note"
|
|
208
|
+
foundry captures note <capture-id> ""
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Notes are trimmed. An empty string stores `null` and clears the note.
|
|
212
|
+
|
|
213
|
+
## Delete
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
foundry captures delete <capture-id>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Deletion is soft deletion of the capture and its jobs. It is blocked while a
|
|
220
|
+
pending or running job exists. Response:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"deleted": true,
|
|
225
|
+
"id": "<capture-id>"
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Deleting the capture also removes its job history from normal queries.
|
|
230
|
+
|
|
231
|
+
## Errors
|
|
232
|
+
|
|
233
|
+
- `INVALID_URL`: URL is not HTTP or HTTPS.
|
|
234
|
+
- `CAPTURE_ALREADY_EXISTS`: active capture with the same URL exists.
|
|
235
|
+
- `FETCHER_NOT_CONFIGURED`: no capture fetcher/key configured.
|
|
236
|
+
- `ACTIVE_JOB_EXISTS`: capture already has pending/running work.
|
|
237
|
+
- `CAPTURE_NOT_FOUND`: unknown or deleted capture.
|
|
238
|
+
- `JOB_NOT_FOUND`: unknown job or a job owned by another capture.
|
|
239
|
+
|
|
240
|
+
Job failures are returned as a valid final job with `status: "failed"`; do not
|
|
241
|
+
assume a successful command means a successful scrape.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# CLI Conventions
|
|
2
|
+
|
|
3
|
+
## Prerequisite
|
|
4
|
+
|
|
5
|
+
Use the installed `foundry` executable on `PATH`. Check availability with
|
|
6
|
+
`foundry --version` or the user's normal command-discovery mechanism.
|
|
7
|
+
|
|
8
|
+
If the command is unavailable, stop and report that the Foundry CLI is not
|
|
9
|
+
installed or not on `PATH`. Do not initialize storage manually.
|
|
10
|
+
|
|
11
|
+
## Command Discovery
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
foundry --help
|
|
15
|
+
foundry <command> --help
|
|
16
|
+
foundry <command> <subcommand> --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Running bare `foundry` prints help. It does not initialize storage or start the
|
|
20
|
+
Web UI.
|
|
21
|
+
|
|
22
|
+
Command aliases:
|
|
23
|
+
|
|
24
|
+
- `provider` -> `providers`
|
|
25
|
+
- `capture` -> `captures`
|
|
26
|
+
- `data` -> `data-transfer`
|
|
27
|
+
- `ls` -> `list` where listed by command help
|
|
28
|
+
- `show` -> `get` where listed by command help
|
|
29
|
+
- `add` -> `create` where listed by command help
|
|
30
|
+
- `remove` / `rm` -> `delete` for captures
|
|
31
|
+
- `restore` -> `import` for data transfer
|
|
32
|
+
|
|
33
|
+
## JSON Contract
|
|
34
|
+
|
|
35
|
+
Successful feature commands write one JSON value to stdout. Do not scrape or
|
|
36
|
+
parse localized human prose. Help output is plain text and is only for command
|
|
37
|
+
discovery.
|
|
38
|
+
|
|
39
|
+
Expected domain failures write a JSON envelope to stderr:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"error": {
|
|
44
|
+
"code": "CAPTURE_NOT_FOUND",
|
|
45
|
+
"message": "Capture not found"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The process exit code is `1` for handled command errors. A failed scrape is
|
|
51
|
+
different: capture commands can return successful JSON with `job.status` set to
|
|
52
|
+
`"failed"`, so always inspect the job payload.
|
|
53
|
+
|
|
54
|
+
Citty argument/usage errors may print command help instead of the JSON error
|
|
55
|
+
envelope. Correct the command shape and retry.
|
|
56
|
+
|
|
57
|
+
## JSON Input
|
|
58
|
+
|
|
59
|
+
Commands that accept structured input support:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
foundry providers create --input '{"name":"Local"}'
|
|
63
|
+
foundry providers create --input-file ./provider.json
|
|
64
|
+
printf '%s' '{"name":"Local"}' | foundry providers create --input -
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Use a file or stdin for large payloads and secrets. Provide either `--input` or
|
|
68
|
+
`--input-file`, not both.
|
|
69
|
+
|
|
70
|
+
Error codes for input handling include:
|
|
71
|
+
|
|
72
|
+
- `INPUT_REQUIRED`
|
|
73
|
+
- `CONFLICTING_INPUT`
|
|
74
|
+
- `INPUT_READ_FAILED`
|
|
75
|
+
- `INVALID_JSON`
|
|
76
|
+
|
|
77
|
+
## IDs
|
|
78
|
+
|
|
79
|
+
Use IDs exactly as returned. Do not infer them from names, URLs, or timestamps.
|
|
80
|
+
|
|
81
|
+
- Provider create returns a top-level `id`.
|
|
82
|
+
- Capture create returns `capture.id` and `job.id`.
|
|
83
|
+
- Capture list/get returns `capture.id`.
|
|
84
|
+
- Job list/get returns `job.id` and `captureId`.
|
|
85
|
+
|
|
86
|
+
Jobs are capture-owned. Query a job with both IDs:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
foundry captures jobs get <capture-id> <job-id>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Timestamps
|
|
93
|
+
|
|
94
|
+
CLI timestamps are ISO-8601 strings such as
|
|
95
|
+
`2026-10-29T08:58:12.061Z`. Convert them for presentation only when the user
|
|
96
|
+
asks; preserve the original value when passing data between commands.
|
|
97
|
+
|
|
98
|
+
## Secrets
|
|
99
|
+
|
|
100
|
+
Provider responses and settings responses include stored API keys. This is
|
|
101
|
+
intentional for a local-only product. Do not print, quote, summarize, or write
|
|
102
|
+
those values to logs unless the user explicitly requests them.
|
|
103
|
+
|
|
104
|
+
For backup passphrases:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
export FOUNDRY_PASSPHRASE='...'
|
|
108
|
+
foundry data-transfer export --output ./foundry.foundry-backup
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Prefer the environment variable over `--passphrase`.
|
|
112
|
+
|
|
113
|
+
## Web UI
|
|
114
|
+
|
|
115
|
+
Start the Web UI only when the user asks for the browser interface:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
foundry web
|
|
119
|
+
foundry web --no-open
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This is a long-running process on `http://127.0.0.1:11111`. For data operations,
|
|
123
|
+
use the feature CLI commands instead of keeping the Web server running.
|
|
124
|
+
|
|
125
|
+
## Downloading The Skill
|
|
126
|
+
|
|
127
|
+
The installed Foundry package contains this skill. Download the complete skill
|
|
128
|
+
directory by copying it into one or both supported workspace targets:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
foundry settings download-skill --target .agents
|
|
132
|
+
foundry settings download-skill --target .agents,.claude
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Target destinations are relative to the user home directory. Here `<home>` is
|
|
136
|
+
`~` on POSIX and `%USERPROFILE%` on Windows:
|
|
137
|
+
|
|
138
|
+
- `.agents` -> `<home>/.agents/skills/foundry`
|
|
139
|
+
- `.claude` -> `<home>/.claude/skills/foundry`
|
|
140
|
+
|
|
141
|
+
Selecting both copies the same skill into both locations. An existing selected
|
|
142
|
+
destination is replaced with the bundled version; unselected destinations are
|
|
143
|
+
left untouched.
|
|
144
|
+
|
|
145
|
+
The Web UI exposes the same multi-select operation from Advanced settings.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Data Transfer
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
foundry data-transfer status
|
|
7
|
+
foundry data-transfer export --output <path> [--force]
|
|
8
|
+
foundry data-transfer inspect <path>
|
|
9
|
+
foundry data-transfer import <path>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Alias: `foundry data ...`. `import` also supports `restore`.
|
|
13
|
+
|
|
14
|
+
Pass the passphrase through `FOUNDRY_PASSPHRASE`; `--passphrase` is also
|
|
15
|
+
accepted but may expose the secret in shell history or process inspection.
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"activeJobCount": 0,
|
|
22
|
+
"isBusy": false
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`activeJobCount` counts pending/running scrape jobs. Export, inspect, and import
|
|
27
|
+
are blocked when the current Foundry database has active jobs. Concurrent
|
|
28
|
+
transfers return `BUSY`.
|
|
29
|
+
|
|
30
|
+
## Export
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
export FOUNDRY_PASSPHRASE='...'
|
|
34
|
+
foundry data-transfer export --output ./foundry.foundry-backup
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Behavior:
|
|
38
|
+
|
|
39
|
+
- Produces an encrypted `.foundry-backup` archive.
|
|
40
|
+
- If `--output` is omitted, writes `foundry-<iso-timestamp>.foundry-backup` in
|
|
41
|
+
the current directory.
|
|
42
|
+
- Appends `.foundry-backup` when the destination lacks that extension.
|
|
43
|
+
- Creates missing destination directories.
|
|
44
|
+
- Refuses to overwrite by default; use `--force` only with explicit intent.
|
|
45
|
+
- Uses restrictive file permissions on POSIX systems.
|
|
46
|
+
|
|
47
|
+
Response:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"filePath": "/absolute/path/foundry.foundry-backup",
|
|
52
|
+
"providerCount": 2,
|
|
53
|
+
"captureCount": 10,
|
|
54
|
+
"jobCount": 14
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Counts describe records present in the exported snapshot.
|
|
59
|
+
|
|
60
|
+
## Inspect
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
foundry data-transfer inspect ./foundry.foundry-backup
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Inspection:
|
|
67
|
+
|
|
68
|
+
- requires a non-empty passphrase
|
|
69
|
+
- blocks if current Foundry has active jobs
|
|
70
|
+
- decrypts and validates the archive
|
|
71
|
+
- verifies manifest, checksums, database integrity, foreign keys, schema
|
|
72
|
+
compatibility, provider/capture/job rows, and capture success pointers
|
|
73
|
+
- returns a preview without replacing current data
|
|
74
|
+
|
|
75
|
+
Response:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"importId": "<temporary-id>",
|
|
80
|
+
"fileName": "foundry.foundry-backup",
|
|
81
|
+
"exportedAt": "<iso>",
|
|
82
|
+
"appVersion": "3.1.3",
|
|
83
|
+
"databaseSchemaVersion": 1,
|
|
84
|
+
"settingsVersion": 1,
|
|
85
|
+
"providerCount": 2,
|
|
86
|
+
"captureCount": 10,
|
|
87
|
+
"jobCount": 14
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The `importId` is for the temporary API-style inspection flow. The CLI cleans
|
|
92
|
+
the staged import before exiting, so do not attempt to reuse that ID in a later
|
|
93
|
+
command.
|
|
94
|
+
|
|
95
|
+
## Import
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
export FOUNDRY_PASSPHRASE='...'
|
|
99
|
+
foundry data-transfer import ./foundry.foundry-backup
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Import performs inspection and commit in one process:
|
|
103
|
+
|
|
104
|
+
1. Validate current state has no active jobs.
|
|
105
|
+
2. Decrypt and validate the archive.
|
|
106
|
+
3. Stage the imported database and settings.
|
|
107
|
+
4. Replace current providers, captures, scrape jobs, and settings in a
|
|
108
|
+
transaction where applicable.
|
|
109
|
+
|
|
110
|
+
This operation is destructive: the current Foundry database and settings are
|
|
111
|
+
replaced by the archive. Run `inspect` first and summarize the preview unless
|
|
112
|
+
the user explicitly asked for immediate restoration of a known-good file.
|
|
113
|
+
|
|
114
|
+
Response:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"status": "imported",
|
|
119
|
+
"preview": {
|
|
120
|
+
"importId": "<temporary-id>",
|
|
121
|
+
"fileName": "foundry.foundry-backup",
|
|
122
|
+
"exportedAt": "<iso>",
|
|
123
|
+
"appVersion": "3.1.3",
|
|
124
|
+
"databaseSchemaVersion": 1,
|
|
125
|
+
"settingsVersion": 1,
|
|
126
|
+
"providerCount": 2,
|
|
127
|
+
"captureCount": 10,
|
|
128
|
+
"jobCount": 14
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
After import, query the affected feature commands to verify the new state.
|
|
134
|
+
|
|
135
|
+
## Errors
|
|
136
|
+
|
|
137
|
+
- `PASSPHRASE_REQUIRED`: no passphrase supplied.
|
|
138
|
+
- `INVALID_PASSPHRASE`: decryption failed.
|
|
139
|
+
- `INVALID_ARCHIVE`: malformed, incomplete, corrupt, or semantically invalid
|
|
140
|
+
backup.
|
|
141
|
+
- `UNSUPPORTED_ARCHIVE`: unsupported archive or settings version.
|
|
142
|
+
- `NEWER_SCHEMA`: archive database is newer than the installed Foundry.
|
|
143
|
+
- `ACTIVE_JOBS`: pending/running jobs block transfer.
|
|
144
|
+
- `BUSY`: another transfer is already running.
|
|
145
|
+
- `IMPORT_NOT_FOUND`: staged import is unavailable.
|
|
146
|
+
- `IO_ERROR`: filesystem or other transfer I/O failure.
|
|
147
|
+
- `OUTPUT_EXISTS`: export destination exists and `--force` was not supplied.
|
|
148
|
+
|
|
149
|
+
Do not extract, patch, or repack a `.foundry-backup` manually. Treat the archive
|
|
150
|
+
format and manifest validation as compatibility contracts.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Providers
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
foundry providers list
|
|
7
|
+
foundry providers get <provider-id>
|
|
8
|
+
foundry providers create --input '<json>'
|
|
9
|
+
foundry providers update <provider-id> --input '<json>'
|
|
10
|
+
foundry providers set-status <provider-id> --status active|disabled|deleted
|
|
11
|
+
foundry providers models <provider-id>
|
|
12
|
+
foundry providers models-for-connection --input '<connection-json>'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Aliases: `foundry provider ...`; `list` also supports `ls`; `create` also
|
|
16
|
+
supports `add`.
|
|
17
|
+
|
|
18
|
+
## Provider Input
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"name": "Local OpenAI",
|
|
23
|
+
"protocol": "openai-compatible-chat-completions",
|
|
24
|
+
"baseURL": "http://127.0.0.1:11434/v1",
|
|
25
|
+
"apiKey": "",
|
|
26
|
+
"customModels": [
|
|
27
|
+
{
|
|
28
|
+
"id": "local-model",
|
|
29
|
+
"displayName": "Local model"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Rules:
|
|
36
|
+
|
|
37
|
+
- `name`: required, trimmed, non-empty.
|
|
38
|
+
- `protocol`: required; one of `openai-responses`,
|
|
39
|
+
`anthropic-messages`, `openai-compatible-chat-completions`.
|
|
40
|
+
- `baseURL`: required HTTP or HTTPS URL.
|
|
41
|
+
- `apiKey`: optional string; missing input is treated as an empty string.
|
|
42
|
+
- `customModels`: optional array on create; each entry requires non-empty `id`.
|
|
43
|
+
`displayName` can be a non-empty string or `null`.
|
|
44
|
+
|
|
45
|
+
## Provider Object
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"id": "<provider-id>",
|
|
50
|
+
"name": "Local OpenAI",
|
|
51
|
+
"protocol": "openai-compatible-chat-completions",
|
|
52
|
+
"baseURL": "http://127.0.0.1:11434/v1",
|
|
53
|
+
"apiKey": "<stored-key>",
|
|
54
|
+
"customModels": [],
|
|
55
|
+
"status": "active",
|
|
56
|
+
"createdAt": "<iso>",
|
|
57
|
+
"updatedAt": "<iso>",
|
|
58
|
+
"deletedAt": null
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`providers list` additionally returns `isInUse`, indicating that a feature
|
|
63
|
+
settings record currently references the provider.
|
|
64
|
+
|
|
65
|
+
## Create
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
foundry providers create --input '{
|
|
69
|
+
"name": "Local OpenAI",
|
|
70
|
+
"protocol": "openai-compatible-chat-completions",
|
|
71
|
+
"baseURL": "http://127.0.0.1:11434/v1",
|
|
72
|
+
"apiKey": "",
|
|
73
|
+
"customModels": []
|
|
74
|
+
}'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The response is the complete provider object. Reuse its top-level `id`.
|
|
78
|
+
|
|
79
|
+
## Update
|
|
80
|
+
|
|
81
|
+
Provider update is a **full replacement**.
|
|
82
|
+
|
|
83
|
+
1. Read the current provider with `providers get`.
|
|
84
|
+
2. Modify only the requested fields.
|
|
85
|
+
3. Preserve the existing `apiKey`, `customModels`, `protocol`, and `baseURL`
|
|
86
|
+
unless the user intends to replace them.
|
|
87
|
+
4. Submit the complete provider input.
|
|
88
|
+
|
|
89
|
+
Omitting `apiKey` writes an empty key. Omitting `customModels` replaces the
|
|
90
|
+
custom list with `[]`. Never construct an update from only the user's changed
|
|
91
|
+
fields.
|
|
92
|
+
|
|
93
|
+
## Status
|
|
94
|
+
|
|
95
|
+
- `active`: selectable and usable.
|
|
96
|
+
- `disabled`: retained but not active.
|
|
97
|
+
- `deleted`: soft-deleted and excluded from `providers list`.
|
|
98
|
+
|
|
99
|
+
Disabling or deleting a provider referenced by feature settings returns
|
|
100
|
+
`PROVIDER_IN_USE`. Clear the referencing feature/provider selection first.
|
|
101
|
+
|
|
102
|
+
## Model Discovery
|
|
103
|
+
|
|
104
|
+
Saved provider:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
foundry providers models <provider-id>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Unsaved connection:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
foundry providers models-for-connection --input '{
|
|
114
|
+
"protocol": "openai-compatible-chat-completions",
|
|
115
|
+
"baseURL": "http://127.0.0.1:11434/v1",
|
|
116
|
+
"apiKey": ""
|
|
117
|
+
}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Discovery resolves `models/` relative to `baseURL` with a 15-second timeout.
|
|
121
|
+
When `baseURL` includes a path such as `/v1`, include a trailing slash
|
|
122
|
+
(`http://host/v1/`) so the path prefix is preserved during URL resolution.
|
|
123
|
+
|
|
124
|
+
- Anthropic uses `x-api-key` and `anthropic-version: 2023-06-01`.
|
|
125
|
+
- Other protocols use bearer authorization. An empty key uses the local
|
|
126
|
+
placeholder `local-provider`.
|
|
127
|
+
- The response must contain an array under `data`, and every entry must have a
|
|
128
|
+
non-empty string `id`.
|
|
129
|
+
- Returned models include optional `displayName` derived from `display_name`
|
|
130
|
+
or `name`.
|
|
131
|
+
|
|
132
|
+
## Errors
|
|
133
|
+
|
|
134
|
+
- `INVALID_PROVIDER_INPUT`: invalid input shape, enum, URL, or custom model.
|
|
135
|
+
- `PROVIDER_NOT_FOUND`: unknown saved provider.
|
|
136
|
+
- `PROVIDER_IN_USE`: attempted disable/delete while referenced.
|
|
137
|
+
- `PROVIDER_MODELS_FAILED`: network failure, non-2xx response, invalid JSON, or
|
|
138
|
+
invalid model payload.
|
|
139
|
+
|
|
140
|
+
Provider responses include stored credentials. Do not expose them unnecessarily.
|