@jbr589/magcc 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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@jbr589/magcc` are documented here. The project follows
4
+ Semantic Versioning; while the version is `0.x`, a breaking change to the
5
+ IR format or to the CLI bumps the minor version and a fix bumps the patch version.
6
+
7
+ ## [0.1.0] - 2026-12-06
8
+
9
+ First release of the compiler as a single npm package.
10
+
11
+ ### Added
12
+
13
+ - `magcc build`: compiles a neutral `setup/` (agents, commands, hooks, guardrails, MCP servers,
14
+ model policy) to Claude Code, opencode and pi, with `--prune` to remove orphaned outputs.
15
+ - `magcc check`: read-only parity check; exits 0 when every generated file is bit-for-bit what
16
+ `build` would write, 1 on drift or orphaned outputs.
17
+ - `magcc deps`: dependency graph between entities, as text or `--json`.
18
+ - `magcc pipeline-run`: step-by-step execution of a compiled orchestration pipeline.
19
+ - Neutral IR: closed vocabularies for tiers (`fast`, `standard`, `deep`, `apex`, `inherit`),
20
+ capabilities and hook events; a value outside a vocabulary is discarded with a `WARN`.
21
+ - Composition of a shared base setup with a per-project overlay through `setup.toml`.
22
+ - Explicit loss reporting: each emitter declares what it renders in `capabilities()`, compared at
23
+ build time with the features the setup demands; a missing token is a `WARN`.
24
+ - Emission option `packages` for the pi target, read from an `emit-options.toml` outside the IR;
25
+ without it, pi gets no `.pi/settings.json`.
26
+ - Hook bodies written once in Node (`.mjs`) and wrapped per target.
27
+ - A generated-file header on every emitted file whose format has comments, in English
28
+ (`Generated from <source> — do not edit by hand.`).
29
+ - Warnings and errors printed by the compiler are in English.
30
+ - `examples/minimal`: a complete neutral setup with its generated output for the three targets.
31
+ - Published as one bundle (`magcc.mjs`) that runs on Node >= 24 with no runtime dependency.
32
+
33
+ ### Known limits
34
+
35
+ - Three targets only; the provider used to resolve tiers is fixed per target (opencode:
36
+ `github-copilot`, pi: `deepseek`); Claude Code receives its native model aliases.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ magcc — Copyright 2026 Joffray Braga
2
+
3
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
4
+
5
+ This product includes software developed by third parties. Their notices follow.
6
+
7
+ Bundled components. The published package `@jbr589/magcc` inlines two libraries into its single
8
+ file `magcc.mjs`: `yaml` (ISC licence) and `smol-toml` (BSD-3-Clause licence). Their licence texts
9
+ are reproduced as is in `THIRD_PARTY_NOTICES.md`, which ships with the package.
10
+
11
+ Development tools. The TypeScript compiler and the Bun type definitions are used to build and
12
+ check this repository; they are not part of the published package.
package/README.md CHANGED
@@ -1,3 +1,239 @@
1
- # Temporary Holding Version
1
+ # magcc
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Define your agentic setup once, compile it to Claude Code, opencode and pi.**
4
+
5
+ Coding agents (subagents, slash commands, hooks, always-on rules) are configured in a different
6
+ file format by every harness, so a setup written for one is rewritten by hand for the next and
7
+ the copies drift apart. Tools that only synchronise a rules file do not cover agents with model
8
+ tiers, commands or hooks. `magcc` keeps one neutral source (`setup/`), compiles it to each
9
+ target, and tells you, target by target, what that target cannot express.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm i -g @jbr589/magcc # Node >= 24, no other runtime dependency
15
+ magcc --version
16
+ ```
17
+
18
+ ## Try it in two minutes (no clone needed)
19
+
20
+ ```sh
21
+ mkdir demo && cd demo && git init -q && mkdir -p setup/agents
22
+
23
+ cat > setup/model-policy.toml <<'EOT'
24
+ default_provider = "anthropic"
25
+
26
+ [tiers.anthropic]
27
+ standard = "model-standard-1"
28
+
29
+ [tiers.github-copilot]
30
+ standard = "github-copilot/model-standard-1"
31
+
32
+ [tiers.deepseek]
33
+ standard = "deepseek-standard-1"
34
+ EOT
35
+
36
+ cat > setup/agents/reader.md <<'EOT'
37
+ ---
38
+ id: reader
39
+ description: "Read-only explorer: reads code and returns a short summary."
40
+ tier: standard
41
+ capabilities: [read, search]
42
+ access:
43
+ read: ["**"]
44
+ ---
45
+ You read the requested code and report a concise summary. You modify no file.
46
+ EOT
47
+
48
+ magcc build # writes .claude/agents/reader.md, .opencode/agent/reader.md, .pi/agents/reader.md, ...
49
+ magcc check # exit 0 while the outputs match the source, 1 as soon as one drifts
50
+ ```
51
+
52
+ (`git init` matters: `magcc` uses git to detect orphan outputs; outside a git repository it prints a `WARN` and skips that detection.)
53
+
54
+ Edit a generated file by hand and `magcc check` reports the drift and exits 1; run `magcc build`
55
+ to regenerate. Every generated file starts with a header such as
56
+ `Generated from setup/agents/reader.md — do not edit by hand.` (JSON outputs carry none, since
57
+ JSON has no comment syntax).
58
+
59
+ A larger, committed example lives in the repository under `examples/minimal`: three agents on
60
+ three tiers, one command, one Node hook, one guardrail, and the generated output for the three
61
+ targets.
62
+
63
+ ```sh
64
+ magcc build examples/minimal
65
+ magcc check examples/minimal
66
+ ```
67
+
68
+ ## Commands
69
+
70
+ | Command | What it does |
71
+ | --- | --- |
72
+ | `magcc build [--prune [--dry-run]] [dir]` | Emits the files of every target. `--prune` removes outputs that no source produces any more. |
73
+ | `magcc check [dir]` | Read-only parity check: exit 0 when every output is bit-for-bit what `build` would write. |
74
+ | `magcc deps [--json] [dir]` | Dependency graph between entities (agents, hooks, commands, guardrails). |
75
+ | `magcc pipeline-run ...` | Runs a compiled orchestration pipeline step by step. |
76
+ | `magcc help`, `magcc --version` | Usage and version. Any other command exits 2. |
77
+
78
+ `dir` is the project directory (default: the current directory). A project is a `setup/`
79
+ directory next to the outputs; an optional `setup.toml` composes a shared base with a per-project
80
+ overlay, picks the output directory and restricts the targets.
81
+
82
+ ## Source layout
83
+
84
+ ```text
85
+ setup/
86
+ model-policy.toml # tier -> concrete model, per provider
87
+ agents/<id>.md # subagents (frontmatter + prompt body)
88
+ commands/<id>.md # slash commands / prompt templates
89
+ hooks/<id>.toml # hook declaration (event, match, contract)
90
+ hooks/impl/<id>.mjs # the hook body, written once in Node
91
+ memory/guardrails/<id>.md # always-loaded rules, one per file
92
+ mcp/<id>.toml # MCP servers
93
+ ```
94
+
95
+ Apart from `model-policy.toml`, the source never names a harness or a concrete model id: that file
96
+ alone associates tiers with providers and model ids (its comments and provider names may refer to
97
+ a target). Everywhere else, tiers are a closed vocabulary
98
+ (`fast`, `standard`, `deep`, `apex`, `inherit`); capabilities are neutral tokens (`read`, `write`,
99
+ `search`, `shell`, `mcp:<id>`, ...); hook events are neutral too (`pre-tool`, `session-end`, ...).
100
+ A value outside a closed vocabulary is discarded with a `WARN`, never cast silently.
101
+
102
+ ## What gets generated
103
+
104
+ | Target | Agents | Commands | Hooks | Always-loaded rules |
105
+ | --- | --- | --- | --- | --- |
106
+ | Claude Code | `.claude/agents/` | `.claude/commands/` | `.claude/hooks/*.mjs` + `.claude/settings.json` | `CLAUDE.md` |
107
+ | opencode | `.opencode/agent/` | `.opencode/command/` | `.opencode/hooks/*.mjs` + `.opencode/plugins/*.js` | `AGENTS.md` |
108
+ | pi | `.pi/agents/` | `.pi/prompts/` | `.pi/magcc-hooks/*.mjs` + `.pi/extensions/` | `.pi/APPEND_SYSTEM.md` |
109
+
110
+ Hooks are written once as a Node module (`.mjs`, never bash, so the guard also runs on native
111
+ Windows) and wrapped by a thin per-target shim. Tiers become the target's own model naming:
112
+ Claude Code receives its native model alias for the tier, opencode and pi resolve the tier through
113
+ `model-policy.toml`.
114
+
115
+ ## Architecture
116
+
117
+ ```text
118
+ setup/ --parse--> neutral IR --resolve--> Setup --emit--> .claude/ .opencode/ .pi/
119
+ (core, pure) (tiers, inheritance, (one emitter per target)
120
+ composition)
121
+ ```
122
+
123
+ | Package | Role |
124
+ | --- | --- |
125
+ | `packages/core` | Neutral IR types, parsing, resolution (tiers, inheritance, base + overlay composition), pipeline and dependency graph, emitter contract. **Pure**: no disk I/O. |
126
+ | `packages/emitter-claude-code`, `packages/emitter-opencode`, `packages/emitter-pi` | One emitter per target. Each declares what it renders through `capabilities()`. |
127
+ | `packages/cli` | Reads `setup/`, writes the outputs, runs `build`, `check`, `deps`, `pipeline-run`. Bundled into the single `magcc.mjs` file that npm ships. |
128
+
129
+ Three rules hold the design together:
130
+
131
+ - **Lossy, but explicit.** An emitter may be unable to render a feature, but it must say so:
132
+ every feature it renders is a token in its `capabilities()`, compared at build time with the
133
+ features the setup actually demands (`setupFeatureDemands`). A missing token is a `WARN`, never
134
+ a silent loss.
135
+ - **Zero drift.** Outputs are generated, never edited. `magcc check` regenerates them in memory
136
+ and compares them bit for bit with what is on disk, so it can run in CI.
137
+ - **A pure core.** Reading `setup/` and writing outputs are the CLI's job; the core can be tested
138
+ in memory and reused elsewhere.
139
+
140
+ ## Loss matrix
141
+
142
+ What each target renders natively. Every "no" is reported as a `WARN` at build time when your
143
+ setup uses the feature; nothing is dropped silently. The table is generated from the three
144
+ `capabilities()` sets and the tokens `setupFeatureDemands` can project, and a test fails if it
145
+ drifts: `bun test packages/cli/test/readme-loss-matrix.test.ts` (print the expected table with
146
+ `bun packages/cli/test/helpers/loss-matrix.ts`).
147
+
148
+ <!-- loss-matrix:start -->
149
+ | Token | Feature | Claude Code | opencode | pi |
150
+ | --- | --- | --- | --- | --- |
151
+ | `agent` | Agents | yes | yes | yes |
152
+ | `command` | Commands | yes | yes | yes |
153
+ | `tier` | Model tier resolved from the policy | yes | yes | yes |
154
+ | `effort` | Reasoning effort (policy default per tier) | yes | **no** | yes |
155
+ | `capabilities` | Tool allowlist | yes | **no** | yes |
156
+ | `access:readonly` | Read-only access mode | yes | yes | yes |
157
+ | `access:path-scope` | Per-agent path scope | **no** | yes | **no** |
158
+ | `agent:mcp-binding` | Per-agent MCP binding | **no** | **no** | **no** |
159
+ | `mcp` | MCP servers | yes | yes | **no** |
160
+ | `hooks` | Hooks (Node body, thin per-target wrapper) | yes | yes | yes |
161
+ | `event:session-start` | Hook event `session-start` | yes | yes | yes |
162
+ | `event:prompt-submit` | Hook event `prompt-submit` | yes | yes | yes |
163
+ | `event:pre-tool` | Hook event `pre-tool` | yes | yes | yes |
164
+ | `event:post-tool` | Hook event `post-tool` | yes | yes | yes |
165
+ | `event:stop` | Hook event `stop` | yes | **no** | yes |
166
+ | `event:session-end` | Hook event `session-end` | yes | **no** | yes |
167
+ | `memory:guardrails` | Always-loaded guardrails | yes | yes | yes |
168
+ | `option:packages` | Emission option `packages` (extension packages) | **no** | **no** | yes |
169
+ <!-- loss-matrix:end -->
170
+
171
+ Finer points that a token cannot carry:
172
+
173
+ - On pi, `tier`, `effort` and a tool allowlist are rendered for agents only. A command is a plain
174
+ prompt template there, so those fields on a command are lost and reported
175
+ (`magcc build examples/minimal` shows this warning for the `summarize` command).
176
+ - On opencode, a read-only agent keeps its read-only mode and its path scope, but an explicit tool
177
+ allowlist and the reasoning effort are not translated.
178
+ - On Claude Code, a fine-grained per-agent path scope cannot be expressed; only the read-only mode
179
+ is. A path-guard hook is the documented mitigation.
180
+ - The emission option `packages` (extension packages for pi) is not part of the IR. It comes from
181
+ an `emit-options.toml` next to `setup/`; without it, pi gets no `.pi/settings.json`.
182
+
183
+ ## Limits
184
+
185
+ - **Three targets.** Claude Code, opencode and pi. Adding a target means writing an emitter.
186
+ - **Provider per target is fixed.** opencode resolves tiers against the `github-copilot` section of
187
+ the model policy and pi against `deepseek`; Claude Code uses its native aliases. The policy's
188
+ `default_provider` only drives the default reasoning effort.
189
+ - **Early version (0.x).** A breaking change to the IR format or to the CLI bumps the minor
190
+ version. Placeholder model ids in the examples must be replaced with real ones.
191
+ - **No Agent SDK emission and no runtime.** `magcc` compiles configuration; it does not run agents.
192
+ - **Node >= 24** is required for the published bundle. Building the bundle itself needs Bun.
193
+
194
+ ## Where it sits
195
+
196
+ Rule-synchronisation tools (rulesync, ai-rulez, ruler and similar) copy a rules or instructions
197
+ file, and some of their configuration, to the layout of many harnesses. They cover more targets
198
+ than `magcc` and are more mature; if rule files across many editors are all you need, use them.
199
+ `magcc` makes a narrower bet: a typed, harness-neutral source for the parts that are not plain
200
+ rules (agents with model tiers, commands, hooks written once, guardrails), a model policy that
201
+ resolves tiers only at emission time, a declared loss per target, and a parity check that makes
202
+ generated files safe to commit.
203
+
204
+ ## Documentation
205
+
206
+ The reference documents are in the `docs/` directory:
207
+
208
+ - `docs/IR-SPEC.md`: the specification of the intermediate representation;
209
+ - `docs/PIPELINE-IR.md`: the compiler pipeline;
210
+ - `docs/00-doctrine.md`: the vision and its axes;
211
+ - `docs/01-concepts.md`: the concepts;
212
+ - `docs/ADR-001-compiler-stack.md`, `docs/ADR-002-build-approach.md` and
213
+ `docs/ADR-003-hooks-node-canonical.md`: the architecture decisions;
214
+ - `docs/BACKEND-CONTRACT.md`: the contract every emitter follows;
215
+ - `docs/MEMORY-TIERS.md`: the tiered memory concept.
216
+
217
+ ## Development
218
+
219
+ ```sh
220
+ bun install --frozen-lockfile
221
+ bun run check # typecheck, tests, example parity, bundle built and run under Node
222
+ bun run build # builds packages/cli/dist/magcc.mjs (the published bundle)
223
+ ```
224
+
225
+ ## Language and contributions
226
+
227
+ Everything in this repository is in English: this README, the package metadata, the changelog,
228
+ the specification, the code comments and the messages `magcc` prints and writes are all in English.
229
+ The one exception is a handful of French sample strings in the tests, used as input data.
230
+
231
+ This is a mirror repository: contributions are reviewed and ported by hand. Issues are welcome;
232
+ pull requests are read but not merged as such, and a change that is accepted lands in a later
233
+ release. Security reports: see [SECURITY.md](SECURITY.md).
234
+
235
+ ## License
236
+
237
+ Apache License 2.0, see [LICENSE](LICENSE) and [NOTICE](NOTICE). The published package also ships
238
+ `THIRD_PARTY_NOTICES.md`, the licences of the two components bundled into `magcc.mjs` (`yaml` and
239
+ `smol-toml`).
@@ -0,0 +1,51 @@
1
+ # Third-party notices
2
+
3
+ `@jbr589/magcc` bundles, in `magcc.mjs`, the code of the components below. Their licences
4
+ are reproduced as is.
5
+
6
+ ## yaml 2.9.0 — ISC
7
+
8
+ ```text
9
+ Copyright Eemeli Aro <eemeli@gmail.com>
10
+
11
+ Permission to use, copy, modify, and/or distribute this software for any purpose
12
+ with or without fee is hereby granted, provided that the above copyright notice
13
+ and this permission notice appear in all copies.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
21
+ THIS SOFTWARE.
22
+ ```
23
+
24
+ ## smol-toml 1.7.0 — BSD-3-Clause
25
+
26
+ ```text
27
+ Copyright (c) Squirrel Chat et al., All rights reserved.
28
+
29
+ Redistribution and use in source and binary forms, with or without
30
+ modification, are permitted provided that the following conditions are met:
31
+
32
+ 1. Redistributions of source code must retain the above copyright notice, this
33
+ list of conditions and the following disclaimer.
34
+ 2. Redistributions in binary form must reproduce the above copyright notice,
35
+ this list of conditions and the following disclaimer in the
36
+ documentation and/or other materials provided with the distribution.
37
+ 3. Neither the name of the copyright holder nor the names of its contributors
38
+ may be used to endorse or promote products derived from this software without
39
+ specific prior written permission.
40
+
41
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
42
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
43
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
45
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
47
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51
+ ```