@really-knows-ai/foundry 3.3.6 → 3.3.8

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.
@@ -169,3 +169,37 @@ export function writeFoundryGuideAgent(worktree, packageRoot) {
169
169
  }
170
170
  }
171
171
 
172
+ function resolveSkillsSource(packageRoot) {
173
+ const distSkillsDir = path.join(packageRoot, 'dist', 'skills');
174
+ if (existsSync(distSkillsDir)) return distSkillsDir;
175
+ const srcSkillsDir = path.join(packageRoot, 'src', 'skills');
176
+ if (existsSync(srcSkillsDir)) return srcSkillsDir;
177
+ return null;
178
+ }
179
+
180
+ function copySkillFile(worktree, name, sourcePath) {
181
+ const targetDir = path.join(worktree, '.opencode', 'skills', name);
182
+ mkdirSync(targetDir, { recursive: true });
183
+ writeFileSync(path.join(targetDir, 'SKILL.md'), readFileSync(sourcePath, 'utf8'));
184
+ }
185
+
186
+ export function writeFoundrySkills(worktree, packageRoot) {
187
+ const sourceDir = resolveSkillsSource(packageRoot);
188
+ if (!sourceDir) {
189
+ return { ok: false, error: 'Skills directory not found in dist/skills or src/skills' };
190
+ }
191
+
192
+ const skillDirs = readdirSync(sourceDir, { withFileTypes: true })
193
+ .filter(e => e.isDirectory());
194
+
195
+ let count = 0;
196
+ for (const dir of skillDirs) {
197
+ const sourceSkill = path.join(sourceDir, dir.name, 'SKILL.md');
198
+ if (!existsSync(sourceSkill)) continue;
199
+ copySkillFile(worktree, dir.name, sourceSkill);
200
+ count++;
201
+ }
202
+
203
+ return { ok: true, count };
204
+ }
205
+
@@ -113,7 +113,7 @@ export function createOrchestrateTool({ tool, pending }) {
113
113
  },
114
114
 
115
115
  async execute(args, context) {
116
- const { runOrchestrate } = await import('../../scripts/orchestrate.js');
116
+ const { runOrchestrate } = await import('../../../scripts/orchestrate.js');
117
117
  const io = makeIO(context.worktree);
118
118
  const cwd = context.worktree;
119
119
  const secret = readOrCreateSecret(context.worktree);
@@ -17,7 +17,7 @@ import { execFileSync } from 'child_process';
17
17
  import { tool } from '@opencode-ai/plugin';
18
18
  import { createPendingStore } from '../../scripts/lib/pending.js';
19
19
  import { getBootstrapContent } from './foundry-tools/helpers.js';
20
- import { refreshAgents, detectChanges, writeFoundryGuideAgent } from './foundry-tools/agent-refresh.js';
20
+ import { refreshAgents, detectChanges, writeFoundryGuideAgent, writeFoundrySkills } from './foundry-tools/agent-refresh.js';
21
21
  import { createHistoryTools } from './foundry-tools/history-tools.js';
22
22
  import { createStageTools } from './foundry-tools/stage-tools.js';
23
23
  import { createWorkfileTools } from './foundry-tools/workfile-tools.js';
@@ -108,6 +108,7 @@ function runBootstrapSequence(worktree, pkgRoot) {
108
108
  bootstrapGitignore(worktree);
109
109
  refreshAgents(worktree);
110
110
  writeFoundryGuideAgent(worktree, pkgRoot);
111
+ writeFoundrySkills(worktree, pkgRoot);
111
112
  const pkg = JSON.parse(readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'));
112
113
  writeFileSync(path.join(worktree, 'foundry', 'VERSION'), pkg.version, 'utf8');
113
114
  initGitRepo(worktree);
@@ -218,8 +219,9 @@ export const FoundryPlugin = async ({ directory }) => {
218
219
  config.skills.paths.push(allSkillsDir);
219
220
  }
220
221
 
221
- // Always ensure guide agent is up to date
222
+ // Always ensure guide agent and skills are up to date
222
223
  ensureGuideAgent(directory, packageRoot);
224
+ writeFoundrySkills(directory, packageRoot);
223
225
 
224
226
  restartNeeded = runPluginBootstrap(directory, packageRoot);
225
227
  },
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.3.8] - 2026-05-19
4
+
5
+ ### Fixed
6
+
7
+ - **Build script now rewrites dynamic `import()` paths.** The `rewriteImports`
8
+ function only handled static `from '...'` imports, missing `await import()`
9
+ calls in `orchestrate-tool.js`. Added a second regex pass for dynamic imports.
10
+ - **New packaging test** verifies every relative import in `dist/` resolves.
11
+ - **add-flow now offers next steps after building.** After creating a flow on a
12
+ `config/*` branch, the skill presents dry-run / merge / leave options instead
13
+ of telling the LLM to auto-merge.
14
+
15
+ ## [3.3.7] - 2026-05-18
16
+
17
+ ### Fixed
18
+
19
+ - **Skills table in agent + file copying.** The Foundry agent lists all 27
20
+ skills in an "Available Skills" table. The plugin also copies them to
21
+ `.opencode/skills/` on every startup, making them loadable via the
22
+ `skill` tool. Both pieces together ensure the LLM knows about the skills
23
+ AND can load them.
24
+
3
25
  ## [3.3.6] - 2026-05-18
4
26
 
5
27
  ### Fixed
@@ -145,7 +145,17 @@ After all dependencies are built, create the flow itself:
145
145
 
146
146
  If the tool returns `{ ok: false, errors }` because the target file already exists, read the existing flow file, incorporate the user's requested changes into the current body, propose the merged result for review, then write and commit the updated file.
147
147
 
148
- 3. **Report**: Show the user the flow file and the commit hash. Also summarise each dependency that was created, with its commit hash. Tell the user they can now ask the Foundry agent to run the flow.
148
+ 3. **Report and offer next steps**: Show the user the flow file and the commit hash. Summarise each dependency that was created, with its commit hash. Then present these options:
149
+
150
+ > The flow is built on the `config/*` branch. Before merging to main, you can:
151
+ >
152
+ > 1. **Dry-run the flow** — test it safely from the config branch without touching main. I'll run a dry-run: `dry-run/haiku-flow/01`.
153
+ > 2. **Merge to main** — commit the configuration and make the flow available for normal runs.
154
+ > 3. **Leave it on this branch** — you can review the configuration or come back later.
155
+ >
156
+ > Which would you like?
157
+
158
+ Do NOT automatically merge or call `foundry_git_finish` unless the user explicitly asks for it.
149
159
 
150
160
  ## Safety Rules
151
161
 
@@ -153,3 +163,4 @@ After all dependencies are built, create the flow itself:
153
163
  - Do not skip dependency validation.
154
164
  - Do not expose internal tool-call syntax to the user.
155
165
  - Do not continue when a branch or worktree state could overwrite user changes.
166
+ - Do not merge or call `foundry_git_finish` unless the user explicitly asks — always offer to dry-run first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "3.3.6",
3
+ "version": "3.3.8",
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",