@really-knows-ai/foundry 3.2.3 → 3.2.5
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 +20 -23
- package/dist/.opencode/plugins/foundry.js +12 -42
- package/dist/CHANGELOG.md +27 -0
- package/dist/README.md +20 -23
- package/dist/docs/getting-started.md +18 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,9 +103,18 @@ Add the plugin to `opencode.json`:
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Restart OpenCode so the plugin registers
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
107
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
108
|
+
agent automatically.
|
|
109
|
+
|
|
110
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
111
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
112
|
+
|
|
113
|
+
Optionally, to make the package available to your project's local `node_modules`:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
pnpm add -D @really-knows-ai/foundry
|
|
117
|
+
```
|
|
109
118
|
|
|
110
119
|
---
|
|
111
120
|
|
|
@@ -121,29 +130,17 @@ The upgrade process asks clarifying questions for ambiguous routing, input contr
|
|
|
121
130
|
|
|
122
131
|
### Phase 1 — Install
|
|
123
132
|
|
|
124
|
-
Add the plugin to `opencode.json` (see Install section above)
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"$schema": "https://opencode.ai/config.json",
|
|
129
|
-
"plugin": ["@really-knows-ai/foundry"]
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Then restart OpenCode so the plugin registers its tools and skills. You will see new
|
|
134
|
-
tools and skills become available in OpenCode's command palette once the restart
|
|
135
|
-
completes. Flow-management tools are now ready to use.
|
|
133
|
+
Add the plugin to `opencode.json` (see Install section above), then restart
|
|
134
|
+
OpenCode.
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
Type **hello foundry**. The assistant will guide you through any remaining
|
|
137
|
+
setup. If Foundry was just initialised, it will ask you to restart and switch
|
|
138
|
+
to the **Foundry** agent. If Foundry is already set up, it will tell you to
|
|
139
|
+
switch to the Foundry agent directly.
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
a decision tree: if `foundry/` is missing or its VERSION does not match the
|
|
141
|
-
installed plugin version, it bootstraps the directory structure, generates
|
|
142
|
-
`foundry-<model>` stage agent files, installs the user-facing `Foundry` guide
|
|
143
|
-
agent, and tells you to restart again.
|
|
141
|
+
### Phase 2 — Switch to the Foundry agent
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
143
|
+
Switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
147
144
|
authoring and running Foundry workflows.
|
|
148
145
|
|
|
149
146
|
### Phase 3 — Ask the Foundry agent for a flow
|
|
@@ -36,8 +36,18 @@ import { createSnapshotTools } from './foundry-tools/snapshot-tools.js';
|
|
|
36
36
|
import { createAttestationTools } from './foundry-tools/attestation-tools.js';
|
|
37
37
|
import { createRefreshAgentsTool } from './foundry-tools/refresh-agents-tool.js';
|
|
38
38
|
|
|
39
|
+
function findPackageRoot(startDir) {
|
|
40
|
+
let dir = startDir;
|
|
41
|
+
const root = path.parse(dir).root;
|
|
42
|
+
while (dir !== root) {
|
|
43
|
+
if (existsSync(path.join(dir, 'package.json'))) return dir;
|
|
44
|
+
dir = path.dirname(dir);
|
|
45
|
+
}
|
|
46
|
+
return startDir;
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
40
|
-
const packageRoot =
|
|
50
|
+
const packageRoot = findPackageRoot(__dirname);
|
|
41
51
|
const allSkillsDir = path.join(packageRoot, 'skills');
|
|
42
52
|
|
|
43
53
|
// Module-level flag shared between config and message-transform hooks.
|
|
@@ -143,44 +153,6 @@ function runPluginBootstrap(worktree, pkgRoot) {
|
|
|
143
153
|
}
|
|
144
154
|
}
|
|
145
155
|
|
|
146
|
-
const defaultSleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
147
|
-
|
|
148
|
-
function resolveOpt(opts, key, fallback) {
|
|
149
|
-
return (opts && opts[key] !== undefined) ? opts[key] : fallback;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const STARTUP_MSG_MAX_MS = 3000;
|
|
153
|
-
|
|
154
|
-
async function retryUntilReady(fn, opts) {
|
|
155
|
-
const sleep = resolveOpt(opts, 'sleep', defaultSleep);
|
|
156
|
-
const now = resolveOpt(opts, 'now', Date.now);
|
|
157
|
-
const maxMs = resolveOpt(opts, 'maxMs', STARTUP_MSG_MAX_MS);
|
|
158
|
-
const deadline = now() + maxMs;
|
|
159
|
-
while (now() < deadline) {
|
|
160
|
-
try {
|
|
161
|
-
await fn();
|
|
162
|
-
return;
|
|
163
|
-
} catch {
|
|
164
|
-
await sleep(500);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async function showStartupMessage(needsRestart, directory, client, timerFns) {
|
|
170
|
-
if (!client) return;
|
|
171
|
-
if (needsRestart) {
|
|
172
|
-
await retryUntilReady(() => client.tui.appendPrompt({
|
|
173
|
-
body: { text: 'Foundry initialised. Restart OpenCode so the Foundry agent registers, then switch to it to author and run workflows.' },
|
|
174
|
-
}), timerFns);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (existsSync(path.join(directory, 'foundry'))) {
|
|
178
|
-
await retryUntilReady(() => client.tui.showToast({
|
|
179
|
-
body: { message: 'Foundry is active', variant: 'info' },
|
|
180
|
-
}), timerFns);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
156
|
export { buildCyclePromptExtras } from './foundry-tools/helpers.js';
|
|
185
157
|
|
|
186
158
|
function buildTools(createTool, pending) {
|
|
@@ -217,7 +189,7 @@ function getFirstUserWithParts(output) {
|
|
|
217
189
|
return firstUser;
|
|
218
190
|
}
|
|
219
191
|
|
|
220
|
-
export const FoundryPlugin = async ({ directory
|
|
192
|
+
export const FoundryPlugin = async ({ directory }) => {
|
|
221
193
|
// Pending store is per-plugin-instance (shared across all tool invocations).
|
|
222
194
|
const pending = createPendingStore();
|
|
223
195
|
|
|
@@ -232,8 +204,6 @@ export const FoundryPlugin = async ({ directory, client }) => {
|
|
|
232
204
|
}
|
|
233
205
|
|
|
234
206
|
restartNeeded = runPluginBootstrap(directory, packageRoot);
|
|
235
|
-
// Fire-and-forget: don't block startup. messages.transform is the fallback.
|
|
236
|
-
showStartupMessage(restartNeeded, directory, client);
|
|
237
207
|
},
|
|
238
208
|
|
|
239
209
|
'experimental.chat.messages.transform': async (_input, output) => {
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.2.5] - 2026-05-14
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Startup flow simplified to "hello foundry".** Removed the TUI client
|
|
8
|
+
retry approach for startup messages. Users now type **hello foundry**
|
|
9
|
+
after restarting; the AI reads the injected `FOUNDRY_CONTEXT` and responds
|
|
10
|
+
with restart instructions or readiness confirmation. This replaces the
|
|
11
|
+
silent double-restart dance.
|
|
12
|
+
- **E2E tests no longer depend on Python or `dd`.** The SIGTERM trap test
|
|
13
|
+
now uses shell builtins (`trap`/`echo`/`while`). The output cap tests use
|
|
14
|
+
small Node.js scripts instead of `dd` piped to `tr`. Tests are faster and
|
|
15
|
+
have no external dependencies.
|
|
16
|
+
- **Install docs updated** (`README.md`, `docs/getting-started.md`) to
|
|
17
|
+
reflect the "hello foundry" flow.
|
|
18
|
+
|
|
19
|
+
## [3.2.4] - 2026-05-14
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **Bootstrap error in cached npm installs.** The `packageRoot` was resolved
|
|
24
|
+
from `__dirname` using a hardcoded relative path (`../..`) that only worked
|
|
25
|
+
in the source tree. In the dist tree (`dist/.opencode/plugins/`), the same
|
|
26
|
+
path resolved to `dist/` instead of the package root, causing
|
|
27
|
+
`ENOENT: package.json` errors. The resolution now walks up from `__dirname`
|
|
28
|
+
until it finds `package.json`.
|
|
29
|
+
|
|
3
30
|
## [3.2.3] - 2026-05-14
|
|
4
31
|
|
|
5
32
|
### Fixed
|
package/dist/README.md
CHANGED
|
@@ -103,9 +103,18 @@ Add the plugin to `opencode.json`:
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Restart OpenCode so the plugin registers
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
107
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
108
|
+
agent automatically.
|
|
109
|
+
|
|
110
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
111
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
112
|
+
|
|
113
|
+
Optionally, to make the package available to your project's local `node_modules`:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
pnpm add -D @really-knows-ai/foundry
|
|
117
|
+
```
|
|
109
118
|
|
|
110
119
|
---
|
|
111
120
|
|
|
@@ -121,29 +130,17 @@ The upgrade process asks clarifying questions for ambiguous routing, input contr
|
|
|
121
130
|
|
|
122
131
|
### Phase 1 — Install
|
|
123
132
|
|
|
124
|
-
Add the plugin to `opencode.json` (see Install section above)
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"$schema": "https://opencode.ai/config.json",
|
|
129
|
-
"plugin": ["@really-knows-ai/foundry"]
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Then restart OpenCode so the plugin registers its tools and skills. You will see new
|
|
134
|
-
tools and skills become available in OpenCode's command palette once the restart
|
|
135
|
-
completes. Flow-management tools are now ready to use.
|
|
133
|
+
Add the plugin to `opencode.json` (see Install section above), then restart
|
|
134
|
+
OpenCode.
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
Type **hello foundry**. The assistant will guide you through any remaining
|
|
137
|
+
setup. If Foundry was just initialised, it will ask you to restart and switch
|
|
138
|
+
to the **Foundry** agent. If Foundry is already set up, it will tell you to
|
|
139
|
+
switch to the Foundry agent directly.
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
a decision tree: if `foundry/` is missing or its VERSION does not match the
|
|
141
|
-
installed plugin version, it bootstraps the directory structure, generates
|
|
142
|
-
`foundry-<model>` stage agent files, installs the user-facing `Foundry` guide
|
|
143
|
-
agent, and tells you to restart again.
|
|
141
|
+
### Phase 2 — Switch to the Foundry agent
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
143
|
+
Switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
147
144
|
authoring and running Foundry workflows.
|
|
148
145
|
|
|
149
146
|
### Phase 3 — Ask the Foundry agent for a flow
|
|
@@ -21,7 +21,12 @@ Add Foundry to `opencode.json`:
|
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
25
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
26
|
+
agent automatically.
|
|
27
|
+
|
|
28
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
29
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
25
30
|
|
|
26
31
|
Optionally, if you want the package available to your project's local node_modules (for editor tooling or scripts), run:
|
|
27
32
|
|
|
@@ -31,11 +36,20 @@ pnpm add -D @really-knows-ai/foundry
|
|
|
31
36
|
|
|
32
37
|
## Initialise
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
After restarting OpenCode with the plugin, type **hello foundry**. The
|
|
40
|
+
assistant will read the Foundry bootstrap context and respond with guidance:
|
|
41
|
+
|
|
42
|
+
- If Foundry was just initialised: it will tell you to restart again and switch
|
|
43
|
+
to the Foundry agent.
|
|
44
|
+
- If Foundry is already set up: it will tell you to switch to the Foundry agent
|
|
45
|
+
directly.
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
switch to the **Foundry** agent before authoring flows. The Foundry agent
|
|
48
|
+
understands Foundry's authoring workflow and handles dependent setup such as
|
|
49
|
+
artefact types, laws, validators, appraisers, cycles, and config branches.
|
|
37
50
|
|
|
38
|
-
The `.foundry/` runtime directory (holding `.secret` for stage tokens) is
|
|
51
|
+
The `.foundry/` runtime directory (holding `.secret` for stage tokens) is
|
|
52
|
+
created automatically on first plugin boot and added to `.gitignore`.
|
|
39
53
|
|
|
40
54
|
---
|
|
41
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@really-knows-ai/foundry",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "A skill-driven framework for governed artefact generation with AI coding tools. Define your own artefact types, laws, and flows — Foundry handles the forge → quench → appraise pipeline with deterministic routing, quality gates, and iterative refinement.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/.opencode/plugins/foundry.js",
|