agentforge-guard 0.0.0-stage → 1.0.0-rc.1

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/LICENSE-APACHE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dildo Baggins(假屌巴金斯,中土世界第一巨屌)
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.
package/README.md CHANGED
@@ -1,3 +1,163 @@
1
- # Temporary Holding Version
1
+ # AgentForge Guard
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
+ **AgentForge Guard (`afg`) is a policy-driven, agent-agnostic code-execution tool for AI coding agents.** A single policy file decides what an agent's commands may do:
4
+
5
+ - Deterministic development work (builds, tests, linters) runs **locally**, with your native toolchain and caches.
6
+ - Untrusted code (scripts, generated shell) runs in a **Docker sandbox** with no network and no host secrets.
7
+ - Infrastructure changes (deploys, `kubectl apply`, `git push`) need **human approval**, or are denied.
8
+ - Every decision is written to a **redacted audit log**.
9
+
10
+ > Local-first for deterministic development; sandbox-first for untrusted execution; approval-gated for infrastructure mutation.
11
+
12
+ Status: **v1.0.0-rc.1, a release candidate.** It is not yet production-ready: an independent security review is still pending (see [SECURITY.md](SECURITY.md)). See [docs/plan.md](docs/plan.md) for the roadmap.
13
+
14
+ ## Install
15
+
16
+ Each method installs the `afg` command. While only release candidates exist, ask for the version explicitly: `agentforge-guard@next` on npm, `--version 1.0.0-rc.1` for cargo, and the versioned script URL below. After the first stable release, the script is also at `releases/latest/download/install.sh`.
17
+
18
+ | You have | Command |
19
+ |---|---|
20
+ | Node.js 18+ | `npm install -g agentforge-guard@next`, or run once with `npx agentforge-guard@next doctor` |
21
+ | Rust | `cargo install agentforge-guard --version 1.0.0-rc.1` |
22
+ | Neither (Go, Python, ...) on macOS or Linux | `curl -fsSL https://github.com/dennislee928/AgentForge-Guard/releases/download/v1.0.0-rc.1/install.sh \| AFG_VERSION=1.0.0-rc.1 sh` |
23
+ | Windows without Node or Rust | the `.zip` from [GitHub Releases](https://github.com/dennislee928/AgentForge-Guard/releases) |
24
+
25
+ Prebuilt binaries cover macOS (arm64, x64), Linux glibc (x64, arm64) and Windows x64. The npm package runs the binary from a per-platform optional dependency; it downloads nothing at install time and runs no install scripts. `install.sh` checks the archive against `SHA256SUMS` and, if `cosign` is installed, its Sigstore signature (`AFG_REQUIRE_COSIGN=1` makes that mandatory). Every release file is signed with Sigstore and has SLSA build provenance; npm packages carry npm provenance. A Homebrew formula template is in [packaging/homebrew](packaging/homebrew).
26
+
27
+ ## Commands
28
+
29
+ | Command | Purpose |
30
+ |---|---|
31
+ | `afg init` | Write `agentforge.yaml` from detected stacks, and pin it as trusted |
32
+ | `afg doctor` | Detected projects, per-command decisions, backend health, trust status, risks |
33
+ | `afg run -- <argv>` | Run a command under the policy (managed mode, the only mode that enforces) |
34
+ | `afg policy explain -- <argv>` | Show a decision without running anything |
35
+ | `afg policy validate` / `schema` | Check the policy / print its JSON Schema |
36
+ | `afg policy trust` | Pin the reviewed policy; later edits deny every command until it is re-trusted |
37
+ | `afg policy migrate --write` | Upgrade `agentforge.dev/v1alpha1` to `v1` |
38
+ | `afg approve [<id>]` | A human approves a pending `require-approval` request |
39
+ | `afg audit tail` / `show` / `report --format sarif` | Read the audit log, or export it for code scanning |
40
+ | `afg agents sync claude\|codex` | Generate agent settings, hooks and instructions from the policy |
41
+ | `afg hook claude-pretool` / `claude-posttool-format` | Claude Code hooks (registered by `agents sync`) |
42
+
43
+ ## Quickstart
44
+
45
+ Requires Rust 1.89+. Docker is optional and only needed for the container backend.
46
+
47
+ ```sh
48
+ git clone <this repository> agentforge-guard && cd agentforge-guard
49
+ cargo install --path crates/afg-cli # from source; installs the `afg` binary
50
+
51
+ cd examples/polyglot-monorepo # or any repository of yours
52
+ afg init --force # writes agentforge.yaml from detected stacks
53
+ afg doctor # stacks, per-command decisions, backends, risks
54
+ afg policy trust # (init already did this) pin the reviewed policy; later edits deny everything
55
+ ```
56
+
57
+ Run commands through the policy:
58
+
59
+ ```sh
60
+ (cd services/rust-service && afg run -- cargo test) # allowed → runs locally
61
+ afg run -- terraform destroy # denied → exit 126, audited
62
+ afg run -- sh scripts/untrusted.sh # routed → Docker, no network, no secrets
63
+ afg run -- kubectl apply -f k8s/ # asks a human on the terminal
64
+ afg policy explain -- git -c core.pager=sh log # shows why, without running anything
65
+ afg audit tail
66
+ ```
67
+
68
+ ## Demos
69
+
70
+ Detected stacks: Go, Rust, Node.js, TypeScript and Next.js (all code detectors), plus Zig, Python and Mojo (data-driven profiles in [`crates/afg-detect/language-profiles/`](crates/afg-detect/language-profiles/)).
71
+
72
+ 1. **Polyglot repository.** In `examples/polyglot-monorepo`, `afg doctor` finds the Go API, the Rust service and the Next.js app, and shows the policy decision for each verification command.
73
+ 2. **Unsafe command prevention.** `afg run -- terraform destroy` is denied by the `destructive-operations` rule, and the audit log records argv, cwd, the policy hash and the rule.
74
+ 3. **Untrusted script execution.** `scripts/untrusted.sh` runs in a container. It cannot read `.env`, `~/.ssh` or the Docker socket, and cannot reach the network.
75
+
76
+ Demos 2 and 3 run in CI on every pull request ([scripts/ci-demos.sh](scripts/ci-demos.sh)).
77
+
78
+ ## How it works
79
+
80
+ ```text
81
+ argv ─► normalize ─► protected paths ─► rules ─► fallback ─► backend ─► audit
82
+ │ │ │ │
83
+ │ │ │ └ default: deny
84
+ │ │ └ deny > require-approval > route > allow
85
+ │ └ ~/.ssh, ~/.aws, .env*, *.pem, docker.sock … → deny
86
+ └ resolve the executable, unwrap env/nice/timeout, mark shells,
87
+ interpreters, xargs/make and shell syntax as *opaque*
88
+ ```
89
+
90
+ - **Fail closed.** Unknown commands are denied unless the policy's `fallback` says otherwise. Opaque commands, such as `bash -c …` or `env X=1 cmd`, never match `allow` rules. They can only be routed to a sandbox, sent for approval, or denied.
91
+ - **No implicit shell.** `afg` runs a structured argv against the executable's resolved absolute path, with a cleared environment (an allowlist) and closed stdin.
92
+ - **TOCTOU checks.** The program and any script arguments are pinned (hashed) when the decision is made and re-checked just before execution.
93
+ - **The container backend** runs `docker run` with `--network none --read-only --cap-drop ALL --security-opt no-new-privileges`, a non-root user, memory, CPU and pids limits, and a *copy* of the workspace that excludes gitignored and credential files. The Docker socket and `$HOME` are never mounted. **Changes made inside the container are discarded.**
94
+
95
+ All documentation is indexed in [docs/README.md](docs/README.md).
96
+
97
+ ## Agent integration (Claude Code, Codex)
98
+
99
+ ```sh
100
+ afg agents sync claude # .claude/settings.json: hooks + Read/Edit/Bash deny & ask rules; CLAUDE.md section
101
+ afg agents sync codex # AGENTS.md section; .codex/config.toml (only if absent)
102
+ ```
103
+
104
+ - **Claude Code PreToolUse hook** (`afg hook claude-pretool`): every Bash command string is evaluated by the same engine. `deny` becomes deny, `require-approval` becomes ask, and `route` becomes deny with a hint to use `afg run --`. An allowed command defers to Claude Code's own permissions. Strings afg can't analyze (`$(…)`, redirections, globs) are treated as opaque `sh -c`.
105
+ - **PostToolUse formatter** (`afg hook claude-posttool-format`): after Claude finishes an Edit or Write tool operation, rustfmt, gofmt or prettier runs, but only if the policy allows the formatter.
106
+ - **Out-of-band approval**: without a terminal, `afg run` prints a pending id. A human runs `afg approve <id>` in their own terminal to mint a single-use token that is bound to that exact command. `afg` refuses to run itself, so a confined agent can't approve its own request.
107
+ - **Reports**: `afg audit report --format sarif` produces SARIF for GitHub Code Scanning, and `action.yml` is a composite GitHub Action that validates the policy and uploads the report.
108
+
109
+ ## Managed mode vs. integration mode
110
+
111
+ | | Managed mode: `afg run -- …` | Integration mode: agent hooks |
112
+ |---|---|---|
113
+ | Who spawns the process | afg | the agent |
114
+ | Policy enforcement | **enforced** by afg's executor | advisory; it depends on the agent's hook API |
115
+ | Sandbox, env clearing, pinning | yes | only what the agent provides |
116
+
117
+ These are **not** equivalent levels of protection. See [docs/security-boundaries.md](docs/security-boundaries.md).
118
+
119
+ ## Limitations
120
+
121
+ Read these before relying on afg:
122
+
123
+ - **Prompt instructions are not a security boundary**, and neither is argv matching. Allowing `go test` or `cargo test` lets arbitrary test code run with your privileges.
124
+ - **Approval is read from the controlling terminal**, or comes from a single-use `afg approve <id>` token. A process that drives its own pseudo-terminal, or that runs outside afg, can approve as the user. Use `deny` for operations an agent must never trigger.
125
+ - **Redaction is pattern-based and best effort.** Environment *values* are never recorded, and output is stored only as a length and a SHA-256.
126
+ - **Docker isolation is only as strong as the Docker runtime and kernel.** Pin images by digest.
127
+ - **Agents that don't use `afg` are not affected by it.** Agent-level read rules and OS sandboxes are still needed.
128
+ - **The hook sees only what the agent sends it.** Tools other than Bash, such as file reads, are covered only by the generated Read/Edit deny rules.
129
+ - **The Cloudflare backend** (`packages/cloudflare-adapter`) is contract-tested against a mock Worker but has not run against a live account yet. See [docs/provider-compatibility.md](docs/provider-compatibility.md).
130
+ - **There is no Windows support for process-group cleanup yet.**
131
+
132
+ ## Exit codes
133
+
134
+ | Code | Meaning |
135
+ |---|---|
136
+ | command's own code | `afg run` executed the command |
137
+ | 2 | usage or configuration error (for example, no `agentforge.yaml`) |
138
+ | 124 | the command timed out |
139
+ | 125 | afg could not execute an approved command (for example, Docker is unavailable) |
140
+ | 126 | denied by policy, approval refused, or a pinned file changed |
141
+ | 127 | executable not found |
142
+
143
+ ## Development
144
+
145
+ ```sh
146
+ cargo fmt --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace
147
+ cargo test --workspace -- --ignored # Docker isolation suite
148
+ ```
149
+
150
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
151
+
152
+ ## License
153
+
154
+ Licensed under either of
155
+
156
+ - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
157
+ - MIT license ([LICENSE-MIT](LICENSE-MIT))
158
+
159
+ at your option.
160
+
161
+ Unless you explicitly state otherwise, any contribution intentionally submitted
162
+ for inclusion in this work, as defined in the Apache-2.0 license, shall be dual
163
+ licensed as above, without any additional terms or conditions.
package/bin/afg.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Runs the `afg` binary from the matching optional platform package.
5
+ // Nothing is downloaded at install or run time, and no shell is involved.
6
+ const { spawnSync } = require('node:child_process');
7
+ const { resolvePlatform } = require('../lib/platform.js');
8
+
9
+ function glibc() {
10
+ if (process.platform !== 'linux') return true;
11
+ const header = process.report && process.report.getReport().header;
12
+ return Boolean(header && header.glibcVersionRuntime);
13
+ }
14
+
15
+ const found = resolvePlatform(process.platform, process.arch, glibc());
16
+ if (found instanceof Error) {
17
+ console.error(found.message);
18
+ process.exit(1);
19
+ }
20
+
21
+ let binary;
22
+ try {
23
+ binary = require.resolve(`${found.pkg}/${found.bin}`);
24
+ } catch {
25
+ console.error(
26
+ `agentforge-guard: the platform package ${found.pkg} is not installed. ` +
27
+ 'Reinstall without --no-optional / --omit=optional, or install from source with: cargo install agentforge-guard',
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
33
+ if (result.error) {
34
+ console.error(`agentforge-guard: failed to run ${binary}: ${result.error.message}`);
35
+ process.exit(1);
36
+ }
37
+ if (result.signal) {
38
+ process.kill(process.pid, result.signal);
39
+ }
40
+ process.exit(result.status ?? 1);
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ // Release targets, keyed by Node's `${process.platform}-${process.arch}`.
4
+ // Each maps to the optional npm package that ships that target's `afg` binary.
5
+ const TARGETS = {
6
+ 'darwin-arm64': 'aarch64-apple-darwin',
7
+ 'darwin-x64': 'x86_64-apple-darwin',
8
+ 'linux-arm64': 'aarch64-unknown-linux-gnu',
9
+ 'linux-x64': 'x86_64-unknown-linux-gnu',
10
+ 'win32-x64': 'x86_64-pc-windows-msvc',
11
+ };
12
+
13
+ /**
14
+ * The platform package and binary path for this machine, or an Error explaining
15
+ * why there is none. `glibc` is false on musl Linux (Alpine), where the
16
+ * glibc-linked release binaries cannot run.
17
+ */
18
+ function resolvePlatform(platform, arch, glibc = true) {
19
+ const key = `${platform}-${arch}`;
20
+ if (!TARGETS[key]) {
21
+ return new Error(
22
+ `agentforge-guard has no prebuilt binary for ${key}. ` +
23
+ `Supported: ${Object.keys(TARGETS).join(', ')}. Install from source with: cargo install agentforge-guard`,
24
+ );
25
+ }
26
+ if (platform === 'linux' && !glibc) {
27
+ return new Error(
28
+ 'agentforge-guard ships glibc Linux binaries; this system uses musl. Install from source with: cargo install agentforge-guard',
29
+ );
30
+ }
31
+ return {
32
+ pkg: `agentforge-guard-${key}`,
33
+ target: TARGETS[key],
34
+ bin: platform === 'win32' ? 'bin/afg.exe' : 'bin/afg',
35
+ };
36
+ }
37
+
38
+ module.exports = { TARGETS, resolvePlatform };
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "agentforge-guard",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0-rc.1",
4
+ "description": "AgentForge Guard (afg): a policy-driven execution guard for AI coding agents",
5
+ "license": "MIT OR Apache-2.0",
6
+ "homepage": "https://github.com/dennislee928/AgentForge-Guard",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/dennislee928/AgentForge-Guard.git"
10
+ },
11
+ "bin": {
12
+ "afg": "bin/afg.js",
13
+ "agentforge-guard": "bin/afg.js"
14
+ },
15
+ "files": [
16
+ "bin/afg.js",
17
+ "lib/platform.js",
18
+ "README.md",
19
+ "LICENSE-MIT",
20
+ "LICENSE-APACHE"
21
+ ],
22
+ "engines": {
23
+ "node": ">=18"
24
+ },
25
+ "optionalDependencies": {
26
+ "agentforge-guard-darwin-arm64": "1.0.0-rc.1",
27
+ "agentforge-guard-darwin-x64": "1.0.0-rc.1",
28
+ "agentforge-guard-linux-arm64": "1.0.0-rc.1",
29
+ "agentforge-guard-linux-x64": "1.0.0-rc.1",
30
+ "agentforge-guard-win32-x64": "1.0.0-rc.1"
31
+ }
32
+ }