farna-bootstrapper 0.0.0-stage → 0.1.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +30 -0
  3. package/NOTICE +42 -0
  4. package/README.md +1079 -2
  5. package/SECURITY.md +65 -0
  6. package/dist/cli/commands/check.d.ts +58 -0
  7. package/dist/cli/commands/check.js +198 -0
  8. package/dist/cli/commands/generate.d.ts +75 -0
  9. package/dist/cli/commands/generate.js +218 -0
  10. package/dist/cli/commands/init.d.ts +52 -0
  11. package/dist/cli/commands/init.js +271 -0
  12. package/dist/cli/main.d.ts +2 -0
  13. package/dist/cli/main.js +51 -0
  14. package/dist/cli/program.d.ts +23 -0
  15. package/dist/cli/program.js +183 -0
  16. package/dist/compose/resolve.d.ts +154 -0
  17. package/dist/compose/resolve.js +545 -0
  18. package/dist/config/load.d.ts +4 -0
  19. package/dist/config/load.js +45 -0
  20. package/dist/config/schema.d.ts +22 -0
  21. package/dist/config/schema.js +46 -0
  22. package/dist/core/constants.d.ts +268 -0
  23. package/dist/core/constants.js +336 -0
  24. package/dist/core/errors.d.ts +44 -0
  25. package/dist/core/errors.js +75 -0
  26. package/dist/core/fs.d.ts +31 -0
  27. package/dist/core/fs.js +169 -0
  28. package/dist/core/json.d.ts +22 -0
  29. package/dist/core/json.js +174 -0
  30. package/dist/core/paths.d.ts +45 -0
  31. package/dist/core/paths.js +110 -0
  32. package/dist/core/text.d.ts +10 -0
  33. package/dist/core/text.js +27 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +1 -0
  36. package/dist/lock/lockfile.d.ts +229 -0
  37. package/dist/lock/lockfile.js +333 -0
  38. package/dist/materialise/source-tree.d.ts +77 -0
  39. package/dist/materialise/source-tree.js +264 -0
  40. package/dist/permissions/permissions.d.ts +128 -0
  41. package/dist/permissions/permissions.js +452 -0
  42. package/dist/render/commit.d.ts +59 -0
  43. package/dist/render/commit.js +279 -0
  44. package/dist/render/generate-lock.d.ts +9 -0
  45. package/dist/render/generate-lock.js +203 -0
  46. package/dist/render/identity.d.ts +23 -0
  47. package/dist/render/identity.js +396 -0
  48. package/dist/render/orphans.d.ts +59 -0
  49. package/dist/render/orphans.js +234 -0
  50. package/dist/render/port.d.ts +96 -0
  51. package/dist/render/port.js +1 -0
  52. package/dist/render/prepare.d.ts +33 -0
  53. package/dist/render/prepare.js +139 -0
  54. package/dist/render/root-cleanliness.d.ts +28 -0
  55. package/dist/render/root-cleanliness.js +76 -0
  56. package/dist/render/stage.d.ts +36 -0
  57. package/dist/render/stage.js +92 -0
  58. package/dist/render/staging.d.ts +16 -0
  59. package/dist/render/staging.js +94 -0
  60. package/dist/render/structured.d.ts +35 -0
  61. package/dist/render/structured.js +258 -0
  62. package/dist/render/upstream.d.ts +41 -0
  63. package/dist/render/upstream.js +179 -0
  64. package/dist/report/format.d.ts +7 -0
  65. package/dist/report/format.js +97 -0
  66. package/dist/report/warnings.d.ts +21 -0
  67. package/dist/report/warnings.js +24 -0
  68. package/dist/source/digest.d.ts +18 -0
  69. package/dist/source/digest.js +77 -0
  70. package/dist/source/frontmatter.d.ts +12 -0
  71. package/dist/source/frontmatter.js +29 -0
  72. package/dist/source/load.d.ts +103 -0
  73. package/dist/source/load.js +676 -0
  74. package/dist/source/schema.d.ts +149 -0
  75. package/dist/source/schema.js +283 -0
  76. package/dist/source/yaml.d.ts +10 -0
  77. package/dist/source/yaml.js +49 -0
  78. package/dist/verify/containment.d.ts +22 -0
  79. package/dist/verify/containment.js +753 -0
  80. package/package.json +79 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,91 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
6
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Before 1.0.0, a minor
7
+ release may contain a breaking change; every change of that kind is listed under **Changed**.
8
+
9
+ ## [0.1.0] - 2026-11-22
10
+
11
+ The first public release. `farna-bootstrapper` compiles named agent personas and their resources
12
+ into the configuration a coding harness reads, records what it wrote, and proves the committed
13
+ output still matches the source.
14
+
15
+ ### Added
16
+
17
+ - **Three commands.** `init` creates the `.farna/` source root, the empty resource directories, and
18
+ the `.gitignore` and `.gitattributes` lines the generated files need. `generate` renders,
19
+ verifies and writes the managed files plus `.farna/lock.json`; `--dry-run`, `--adopt` and
20
+ `--json` are supported. `check` re-renders into a temporary directory and exits `1` on any drift.
21
+ - **Three targets.** `claudecode` writes `.claude/agents/<id>.md`; `opencode` (OpenCode V2, package
22
+ `@opencode/cli`) and `opencodev1` (OpenCode V1, package `opencode-ai`) both write
23
+ `.opencode/agents/<id>.md` in each major's own shapes. Exactly one target is configured per run.
24
+ - **OpenCode V1 support (`opencodev1`).** The V1 target writes OpenCode 1.x shapes: V1 agent
25
+ frontmatter with `name` and the per-tool `permission` map, the flat `mcp.<name>` map with
26
+ `enabled: true`, V1 command frontmatter and the `RulesyncHooksPlugin` module. Profile mode works
27
+ for both OpenCode targets, and a target switch rewrites the recorded paths in place rather than
28
+ orphaning them. Configuring both OpenCode targets in one run is `F001`. `examples/opencode-v1/`
29
+ is the V1 profile-mode example; `examples/opencode-v2/` is the V2 profile-mode example and uses
30
+ `@opencode/cli`.
31
+ - **Agent and profile modes.** Agent mode is the default and carries every persona per agent.
32
+ Profile mode, supported for both OpenCode targets, makes exactly one persona live so it can own
33
+ the workspace: `opencode.jsonc` at the repository root, plus its skills, commands and hooks under
34
+ `.opencode/`. `targets.opencode.active` selects the persona, and `--persona` overrides it for one
35
+ run. Every resolved-but-not-live persona is reported (`notLive`).
36
+ - **Persona composition.** A persona may extend one base persona. Rules and permissions are unioned
37
+ by `(kind, id)`, the stricter permission value wins, and two different concrete models in one
38
+ composed set are refused.
39
+ - **Six resource kinds plus a model class.** `rule`, `permission`, `mcp`, `skill`, `command` and
40
+ `hook` are strict sources; a persona names its model class in the persona file. MCP credentials
41
+ are environment references only.
42
+ - **Permission mapping.** Canonical categories map to each target's own byte form: Claude Code's
43
+ `Read`/`Write`/`Edit`/`Bash`/`Agent` entries and per-agent `tools`/`disallowedTools`; OpenCode's
44
+ ordered `{ action, resource, effect }` records. A category neither target can carry is refused rather
45
+ than emitted as an inert string. An opt-in Claude Code `tools` allow-list is reported when it
46
+ narrows the tool set.
47
+ - **Ownership with an explicit record.** `.farna/lock.json` records every managed path with its
48
+ size and SHA-256, each persona's composition and digests, the source warnings, and the pinned
49
+ renderer identity. It contains no timestamps, hostnames or absolute paths. `generate` removes a
50
+ recorded orphan only when it is in a managed location, is still a regular file, still has the
51
+ recorded bytes, and is recorded. `opencode.jsonc` is owned by its `mcp` key only, edited in
52
+ place so the user's own keys and comments survive.
53
+ - **Renderer pin.** `rulesync` is pinned to exactly `43.11.0` with a tarball integrity, imported by
54
+ one module behind a port. A different version is refused; a different npm-recorded integrity is
55
+ refused; when no integrity can be found the version check still applies and
56
+ `W114_RENDERER_INTEGRITY_UNVERIFIED` names the gap.
57
+ - **Fail-closed generation.** Every gate runs before the first byte is written. Managed files are
58
+ staged and renamed; a caught write failure restores what it replaced and names anything it could
59
+ not restore. One `generate` runs at a time through a local lock.
60
+ - **Release packaging.** The package publishes the ESM library types entry, the CLI `bin`, the
61
+ README, CHANGELOG, LICENSE, NOTICE and SECURITY.md. Publishing uses npm provenance.
62
+ - **No telemetry, no phone-home, no Farna Control dependency.** Generation and checking make no
63
+ network request of their own, and a hook, MCP server or command the tool writes is never executed
64
+ by it.
65
+
66
+ ### Known limitations
67
+
68
+ - **One target per run.** More than one configured target is refused; the lockfile and mode plan
69
+ are per-target.
70
+ - **No `doctor` command.** `--dry-run` prints the plan, but there is no capability-report command.
71
+ - **`claudecode` profile mode is not implemented**, and the workspace resource kinds (`mcp`,
72
+ `skill`, `command`, `hook`) are not carried by `claudecode` at all in this release.
73
+ - **Both OpenCode targets carry the workspace resource kinds in profile mode only.** Agent mode
74
+ refuses a reference with `F001` rather than emitting it workspace-wide. A hook OpenCode cannot
75
+ represent (`session-end`, or a matcher on a non-tool event) is reported (`W101`) and not emitted.
76
+ - **No cross-target single run, no `patch`/`replaceWith`, no per-target filters, no `--strict`, no
77
+ `.farna/local.jsonc` override, no region ownership (`CLAUDE.md`/`AGENTS.md`).** `opencode.jsonc`
78
+ is the only structured file, and the only key it owns is `mcp`.
79
+ - **TOCTOU and crash windows remain.** A symlink swapped in between the `lstat` preflight and the
80
+ write is not detected; a process kill between two renames can leave a mixed tree that `check`
81
+ reports and a re-run repairs.
82
+ - **The renderer pin is provenance, not a sandbox.** A renderer patched in place with the same
83
+ version and tarball integrity is not detected.
84
+ - **No coverage threshold.** CI enforces lint, type-check, tests (with a minimum count and
85
+ real-renderer suite assertions), a dependency audit at `moderate`, and the published-tarball
86
+ contents.
87
+ - **Windows test skips.** The symlink regression suites (creating a symlink needs a privilege the
88
+ runner does not grant), the POSIX mode assertions, the FIFO cases and the install-layout suite are
89
+ skipped on Windows; CI runs them on Linux.
90
+
91
+ [0.1.0]: https://github.com/farnalabs/farna-bootstrapper/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Farnalabs Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Third-party software
24
+ --------------------
25
+
26
+ This project depends on rulesync (https://github.com/dyoshikawa/rulesync),
27
+ which is licensed under the MIT License, Copyright (c) 2024 dyoshikawa.
28
+ rulesync is used unmodified as a library; the renderer is pinned exactly and is
29
+ imported by exactly one module. The third-party licence text is reproduced in
30
+ NOTICE.
package/NOTICE ADDED
@@ -0,0 +1,42 @@
1
+ farna-bootstrapper
2
+ Copyright (c) 2026 Farnalabs Ltd
3
+
4
+ This product is licensed under the MIT License. The full text is in LICENSE.
5
+
6
+ This product includes software developed by third parties:
7
+
8
+ rulesync
9
+ https://github.com/dyoshikawa/rulesync
10
+ MIT License
11
+ Copyright (c) 2024 dyoshikawa
12
+
13
+ rulesync is used unmodified as a library dependency. Its version and tarball
14
+ integrity are pinned in package.json and recorded by the generated
15
+ .farna/lock.json. The licence text below is reproduced from the rulesync
16
+ package (node_modules/rulesync/LICENSE) as distributed with this release.
17
+
18
+ -------------------------------------------------------------------------------
19
+ rulesync
20
+
21
+ MIT License
22
+
23
+ Copyright (c) 2024 dyoshikawa
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in all
33
+ copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ SOFTWARE.
42
+ -------------------------------------------------------------------------------