@really-knows-ai/foundry 1.3.0 → 1.3.2

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.
@@ -132,7 +132,7 @@ export const FoundryPlugin = async ({ directory }) => {
132
132
  stages: tool.schema.array(tool.schema.string()).describe('Ordered stage names'),
133
133
  maxIterations: tool.schema.number().describe('Maximum iterations'),
134
134
  goal: tool.schema.string().describe('Goal text'),
135
- models: tool.schema.record(tool.schema.string()).optional().describe('Per-stage model overrides'),
135
+ models: tool.schema.string().optional().describe('Per-stage model overrides as JSON object, e.g. \'{"forge":"openai/gpt-4o"}\''),
136
136
  },
137
137
  async execute(args, context) {
138
138
  const workPath = path.join(context.worktree, 'WORK.md');
@@ -140,7 +140,9 @@ export const FoundryPlugin = async ({ directory }) => {
140
140
  return JSON.stringify({ error: 'WORK.md already exists' });
141
141
  }
142
142
  const fm = { flow: args.flow, cycle: args.cycle, stages: args.stages, maxIterations: args.maxIterations };
143
- if (args.models) fm.models = args.models;
143
+ if (args.models) {
144
+ try { fm.models = JSON.parse(args.models); } catch { fm.models = {}; }
145
+ }
144
146
  const content = createWorkfile(fm, args.goal);
145
147
  writeFileSync(workPath, content, 'utf-8');
146
148
  return JSON.stringify({ ok: true });
@@ -167,7 +169,7 @@ export const FoundryPlugin = async ({ directory }) => {
167
169
  description: 'Update a single frontmatter field in WORK.md',
168
170
  args: {
169
171
  key: tool.schema.string().describe('Frontmatter key'),
170
- value: tool.schema.any().describe('Value to set'),
172
+ value: tool.schema.string().describe('Value to set (use JSON for arrays/objects, e.g. \'["forge:a","quench:b"]\' or \'{"forge":"openai/gpt-4o"}\')'),
171
173
  },
172
174
  async execute(args, context) {
173
175
  const workPath = path.join(context.worktree, 'WORK.md');
@@ -175,7 +177,17 @@ export const FoundryPlugin = async ({ directory }) => {
175
177
  return JSON.stringify({ error: 'WORK.md not found' });
176
178
  }
177
179
  const text = readFileSync(workPath, 'utf-8');
178
- const updated = setFrontmatterField(text, args.key, args.value);
180
+ // Parse JSON values for arrays/objects, keep strings as-is
181
+ let value = args.value;
182
+ try {
183
+ const parsed = JSON.parse(args.value);
184
+ if (typeof parsed === 'object' || Array.isArray(parsed) || typeof parsed === 'number') {
185
+ value = parsed;
186
+ }
187
+ } catch {
188
+ // Not JSON, use as plain string
189
+ }
190
+ const updated = setFrontmatterField(text, args.key, value);
179
191
  writeFileSync(workPath, updated, 'utf-8');
180
192
  return JSON.stringify({ ok: true });
181
193
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "A structured framework for AI-driven artefact creation with deterministic routing, quality gates, and iterative refinement cycles.",
5
5
  "type": "module",
6
6
  "main": ".opencode/plugins/foundry.js",
@@ -28,6 +28,7 @@
28
28
  "test": "node --test tests/**/*.test.js"
29
29
  },
30
30
  "dependencies": {
31
+ "@opencode-ai/plugin": "^1.4.0",
31
32
  "js-yaml": "^4.1.0",
32
33
  "minimatch": "^10.2.5"
33
34
  },