@really-knows-ai/foundry 3.5.6 → 3.5.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.
@@ -36,7 +36,7 @@ import { createMemoryAdminTools } from './foundry-tools/memory-admin-tools.js';
36
36
  import { createSnapshotTools } from './foundry-tools/snapshot-tools.js';
37
37
  import { createAttestationTools } from './foundry-tools/attestation-tools.js';
38
38
  import { createRefreshAgentsTool } from './foundry-tools/refresh-agents-tool.js';
39
- import { resolveGit } from '../../scripts/lib/tool-paths.js';
39
+ import { resolveGit, resolvePnpm } from '../../scripts/lib/tool-paths.js';
40
40
 
41
41
  function findPackageRoot(startDir) {
42
42
  let dir = startDir;
@@ -103,7 +103,17 @@ function initGitRepo(worktree) {
103
103
  }
104
104
  }
105
105
 
106
+ function ensurePackageJson(worktree) {
107
+ if (existsSync(path.join(worktree, 'package.json'))) return;
108
+ try {
109
+ execFileSync(resolvePnpm(), ['init'], { cwd: worktree, stdio: 'pipe' });
110
+ } catch (err) {
111
+ console.error('Foundry pnpm init error:', err.message);
112
+ }
113
+ }
114
+
106
115
  function runBootstrapSequence(worktree, pkgRoot) {
116
+ ensurePackageJson(worktree);
107
117
  bootstrapDirectories(worktree);
108
118
  bootstrapGitignore(worktree);
109
119
  refreshAgents(worktree);
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.5.8] - 2026-05-23
4
+
5
+ ### Added
6
+
7
+ - Foundry bootstrap runs `pnpm init` on the project workspace when no `package.json` exists, so validators can install dependencies immediately.
8
+
9
+ ### Changed
10
+
11
+ - Validator guidance in the add-law skill hardened from "prefer libraries" to "hand-rolled heuristics are a last resort."
12
+
13
+ ## [3.5.7] - 2026-05-23
14
+
15
+ ### Added
16
+
17
+ - Artefact types can include an `example.md` alongside `definition.md`. When present, the forge skill treats its structure as normative — the forge agent follows the same format, preventing common formatting mistakes like unwanted title headings on haikus.
18
+
3
19
  ## [3.5.6] - 2026-05-23
4
20
 
5
21
  ### Fixed
@@ -22,12 +22,20 @@ export async function getCycleDefinition(foundryDir, cycleId, io) {
22
22
  }
23
23
 
24
24
  export async function getArtefactType(foundryDir, typeId, io) {
25
- const path = join(foundryDir, 'artefacts', typeId, 'definition.md');
26
- if (!(await io.exists(path))) {
25
+ const dir = join(foundryDir, 'artefacts', typeId);
26
+ const defPath = join(dir, 'definition.md');
27
+ if (!(await io.exists(defPath))) {
27
28
  throw new Error(`Artefact type not found: ${typeId}`);
28
29
  }
29
- const text = await io.readFile(path);
30
- return parseDoc(text);
30
+ const text = await io.readFile(defPath);
31
+ const result = parseDoc(text);
32
+
33
+ const examplePath = join(dir, 'example.md');
34
+ if (await io.exists(examplePath)) {
35
+ result.example = (await io.readFile(examplePath)).trim();
36
+ }
37
+
38
+ return result;
31
39
  }
32
40
 
33
41
  /**
@@ -18,4 +18,8 @@ function resolveOpenCode() {
18
18
  return process.env.FOUNDRY_OPENCODE_PATH || resolveFromPath('opencode');
19
19
  }
20
20
 
21
- export { resolveGit, resolveOpenCode };
21
+ function resolvePnpm() {
22
+ return process.env.FOUNDRY_PNPM_PATH || resolveFromPath('pnpm');
23
+ }
24
+
25
+ export { resolveGit, resolveOpenCode, resolvePnpm };
@@ -66,7 +66,7 @@ Walk the user through which elements of the law can be validated deterministical
66
66
  >
67
67
  > Shall I add validators for the script-checkable elements?
68
68
 
69
- For each script-checkable element, write a standalone `.mjs` script next to the artefacts it validates (e.g. `foundry/artefacts/<type>/check-line-count.mjs`) and reference it in the command (e.g. `node foundry/artefacts/<type>/check-line-count.mjs {files}`). Place validators alongside the artefacts so they colocate with what they validate. Prefer Node.js built-ins and libraries already in the project; hand-rolled heuristics are fragileuse available packages instead of writing custom validation logic from scratch.
69
+ For each script-checkable element, write a standalone `.mjs` script next to the artefacts it validates (e.g. `foundry/artefacts/<type>/check-line-count.mjs`) and reference it in the command (e.g. `node foundry/artefacts/<type>/check-line-count.mjs {files}`). Place validators alongside the artefacts so they colocate with what they validate. Use existing project dependencies and Node.js builtins. Hand‑rolled heuristics (custom syllable counters, regex parsers, manual character walks) are a last resort they produce false positives, waste tokens on debugging, and break on edge cases. Install a library instead. Only write validation logic from scratch when no npm package exists for the task and the heuristic is trivially correct.
70
70
 
71
71
  **Validators**: Ask about `validators` (optional) — offer to create one or skip.
72
72
 
@@ -40,7 +40,7 @@ Forge runs inside an enforced stage. Your **first** and **last** tool calls are
40
40
 
41
41
  Then return control to the user and stop.
42
42
  3. `foundry_config_cycle` — understand what to produce and what inputs are available.
43
- 4. `foundry_config_artefact_type` with the output type ID — get the artefact type definition, especially its `file-patterns`.
43
+ 4. `foundry_config_artefact_type` with the output type ID — get the artefact type definition, `file-patterns`, and any example. When the response includes an `example` field, its structure is normative — your output must follow the same format (no extra headings, metadata blocks, or free-form prose that the example does not include).
44
44
  5. `foundry_config_laws` — get all applicable laws (global + type-specific).
45
45
  6. If the cycle declares `inputs`, discover input files by filesystem scan:
46
46
  - For each type listed in `inputs`, call `foundry_config_artefact_type` to get its `file-patterns`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "3.5.6",
3
+ "version": "3.5.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",