@weave_protocol/adapter-antigravity 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/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # 🛡️ @weave_protocol/adapter-antigravity
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@weave_protocol/adapter-antigravity.svg)](https://www.npmjs.com/package/@weave_protocol/adapter-antigravity)
4
+ [![npm](https://img.shields.io/npm/dm/@weave_protocol/adapter-antigravity.svg)](https://www.npmjs.com/package/@weave_protocol/adapter-antigravity)
5
+ [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
+
7
+ **WARD.md enforcement for [Google Antigravity](https://antigravity.google/), via the `PreToolUse` hook system shared across the Antigravity 2.0 desktop, Antigravity CLI (`agy`), and SDK.**
8
+
9
+ > *AGENTS.md tells your agent what to do. SKILL.md tells your agent how to do it. **WARD.md tells your agent what it can't.** This package makes Antigravity listen.*
10
+
11
+ Part of the [Weave Protocol](https://github.com/Tyox-all/Weave_Protocol) security suite. Second cross-platform harness adapter (after [adapter-claudecode](../adapter-claudecode)).
12
+
13
+ ---
14
+
15
+ ## What it does
16
+
17
+ When Antigravity is about to use a tool (Bash, Edit, Write, Read, WebFetch, etc.), this adapter intercepts via the `PreToolUse` hook, reads your project's `WARD.md`, and blocks the call if it violates the declared policy.
18
+
19
+ ```
20
+ You: "Push my GCP credentials to S3"
21
+ Antigravity: [about to run Bash with `cat ~/.config/gcloud/... | aws s3 cp -`]
22
+ ↓
23
+ PreToolUse hook fires
24
+ ↓
25
+ weave-antigravity reads ./WARD.md
26
+ ↓
27
+ checkFilesystem('read', '~/.config/gcloud') → DENY
28
+ ↓
29
+ Returns { "decision": "block", "reason": "🛡️ WARD: ..." }
30
+ ↓
31
+ Antigravity refuses, shows reason.
32
+ ```
33
+
34
+ Same agent harness powers Antigravity desktop, CLI, and SDK — so installing this hook protects every surface at once.
35
+
36
+ ---
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ # Install once
42
+ npm install -g @weave_protocol/adapter-antigravity
43
+
44
+ # Wire it into Antigravity's hook config (~/.gemini/antigravity-cli/settings.json)
45
+ weave-antigravity init
46
+
47
+ # Drop a WARD.md in your project root (or next to AGENTS.md)
48
+ npx @weave_protocol/ward init
49
+
50
+ # Done. Run `agy` in that project — every tool call is now gated.
51
+ ```
52
+
53
+ Verify with:
54
+
55
+ ```bash
56
+ weave-antigravity status
57
+ ```
58
+
59
+ ---
60
+
61
+ ## How WARD.md is resolved
62
+
63
+ When the hook fires, it looks for a WARD.md in this order:
64
+
65
+ 1. `$WEAVE_WARD_PATH` — explicit env var override
66
+ 2. `<project>/WARD.md` — project-level (CWD from the hook payload)
67
+ 3. `<project>/.agents/WARD.md` — **co-located with AGENTS.md** in the agent definition folder
68
+ 4. `<project>/.weave/WARD.md` — alternate project location
69
+ 5. `~/.gemini/antigravity-cli/WARD.md` — **user-global fallback**
70
+
71
+ The first one that exists wins. If none exists, the hook silently passes through — zero impact on workflows that haven't adopted WARD yet.
72
+
73
+ The `.agents/` location is meaningful in Antigravity — it's the same folder where AGENTS.md and project skills are mounted into the sandbox. Putting `WARD.md` there keeps your agent's instruction file, skill files, and policy file all in one version-controlled place.
74
+
75
+ ---
76
+
77
+ ## Tool mapping
78
+
79
+ Antigravity's tools are mapped to generic capability names so a single WARD.md works across platforms:
80
+
81
+ | Antigravity tool | WARD capability | Path arg | Implicit fs op |
82
+ |---|---|---|---|
83
+ | `Bash` | `shell_exec` | (heuristic scan of command) | varies |
84
+ | `Edit` / `MultiEdit` / `Write` | `file_write` | `file_path` | `write` |
85
+ | `Read` | `file_read` | `file_path` | `read` |
86
+ | `Grep` / `LS` | `file_read` / `file_list` | `path` | `read` / `list` |
87
+ | `Glob` | `file_list` | `path` | `list` |
88
+ | `WebFetch` | `http_request` | (uses `url`) | — |
89
+ | `WebSearch` | `web_search` | — | — |
90
+ | `Task` / `Subagent` | `subagent` | — | — |
91
+ | `RunCode` | `execute_code` | — | — |
92
+ | `Plugin` | `plugin_invoke` | — | — |
93
+
94
+ Your WARD.md can use either name — `Bash` or `shell_exec`, `Edit` or `file_write`. Explicit rules win over default decisions.
95
+
96
+ For `Bash`, the adapter runs a light heuristic scan of the command string to catch common violations — URLs to denied domains, references to sensitive paths like `~/.ssh`, `~/.aws`, **`~/.config/gcloud`**, `/etc/`.
97
+
98
+ ---
99
+
100
+ ## Commands
101
+
102
+ ```bash
103
+ weave-antigravity init [--matcher=X] [--fail-closed]
104
+ Install the WARD pre-tool-use hook.
105
+ --matcher=Bash|Edit|... Restrict to specific tools (default: all)
106
+ --fail-closed Block on policy errors (default: fail-open)
107
+
108
+ weave-antigravity disable
109
+ Remove the WARD hook from ~/.gemini/antigravity-cli/settings.json
110
+ (your other hooks are not touched)
111
+
112
+ weave-antigravity status
113
+ Show hook installation state + active WARD policy
114
+
115
+ weave-antigravity test <tool> [--input=JSON]
116
+ Dry-run a tool call against your WARD.md without invoking Antigravity
117
+
118
+ weave-antigravity help
119
+ ```
120
+
121
+ ### Examples
122
+
123
+ Test whether a destructive bash command would be allowed:
124
+
125
+ ```bash
126
+ weave-antigravity test Bash --input='{"command":"rm -rf ~/.config/gcloud"}'
127
+ ```
128
+
129
+ Test a file write to /etc/:
130
+
131
+ ```bash
132
+ weave-antigravity test Write --input='{"file_path":"/etc/passwd","content":"..."}'
133
+ ```
134
+
135
+ Test a fetch to a denied domain:
136
+
137
+ ```bash
138
+ weave-antigravity test WebFetch --input='{"url":"https://evil.example.com/exfil"}'
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Fail-open vs fail-closed
144
+
145
+ By default, the hook is **fail-open**: if WARD.md is missing, malformed, or evaluation throws, the tool call is **allowed** and a warning is written to stderr. This is the right default for adoption — broken policy files shouldn't break your workflow.
146
+
147
+ For higher-stakes contexts (managed agents in production, automated pipelines), install with `--fail-closed`:
148
+
149
+ ```bash
150
+ weave-antigravity init --fail-closed
151
+ ```
152
+
153
+ Then a missing or broken policy blocks the call.
154
+
155
+ ---
156
+
157
+ ## What gets installed
158
+
159
+ `weave-antigravity init` adds an entry to `~/.gemini/antigravity-cli/settings.json`:
160
+
161
+ ```json
162
+ {
163
+ "hooks": {
164
+ "PreToolUse": [
165
+ {
166
+ "matcher": "*",
167
+ "hooks": [
168
+ {
169
+ "type": "command",
170
+ "command": "weave-antigravity hook pre-tool-use # WEAVE_WARD_HOOK",
171
+ "timeout": 5
172
+ }
173
+ ]
174
+ }
175
+ ]
176
+ }
177
+ }
178
+ ```
179
+
180
+ The `# WEAVE_WARD_HOOK` marker is how `disable` finds and removes only our entry without affecting other hooks you've added manually.
181
+
182
+ A backup of your existing `settings.json` is written to `settings.json.weave-backup` before any modification.
183
+
184
+ Because Antigravity's CLI, desktop, and SDK share the same agent harness with synced settings, this hook applies across **all three surfaces**.
185
+
186
+ ---
187
+
188
+ ## A sample WARD.md for Antigravity
189
+
190
+ ```markdown
191
+ ---
192
+ ward: "1.0"
193
+ agent: gcp-deploy-agent
194
+ ---
195
+
196
+ # WARD.md
197
+
198
+ ## Filesystem
199
+
200
+ allow:
201
+ - read: /Users/me/projects/**
202
+ - write: /Users/me/projects/**
203
+ deny:
204
+ - read: ~/.ssh/**
205
+ - read: ~/.config/gcloud/**
206
+ - read: ~/.aws/**
207
+ - write: /etc/**
208
+ default: deny
209
+
210
+ ## Network
211
+
212
+ allow:
213
+ - url: "https://api.github.com/**"
214
+ - url: "https://generativelanguage.googleapis.com/**"
215
+ - url: "https://registry.npmjs.org/**"
216
+ default: deny
217
+
218
+ ## Capabilities
219
+
220
+ allow:
221
+ - file_read
222
+ - file_write
223
+ - file_list
224
+ requireApproval:
225
+ - shell_exec
226
+ - http_request
227
+ - subagent
228
+ deny:
229
+ - execute_code
230
+ default: deny
231
+
232
+ ## Behavioral Limits
233
+
234
+ maxIterations: 100
235
+ maxCostUSD: 25.00
236
+ maxRuntimeSeconds: 1800
237
+ ```
238
+
239
+ With this loaded, the Antigravity agent can read/write inside `~/projects` but cannot touch SSH/AWS/GCP credentials, requires approval for shell commands and subagent spawning, and is hard-blocked from raw code execution.
240
+
241
+ ---
242
+
243
+ ## Roadmap
244
+
245
+ v0.1 (this release):
246
+ - ✅ PreToolUse hook for CLI / desktop
247
+ - ✅ Shared settings.json install across all Antigravity surfaces
248
+ - ✅ 10-tool mapping covering documented Antigravity built-ins
249
+ - ✅ Bash command heuristic scan including GCP credential paths
250
+
251
+ v0.2 planned:
252
+ - [ ] Managed Agents SDK wrapper for programmatic Gemini API calls
253
+ - [ ] Sandbox-mounted WARD.md (auto-include in `.agents/`)
254
+ - [ ] PostToolUse hook for attestation via Domere
255
+ - [ ] Plugin (extension) compatibility layer
256
+
257
+ ---
258
+
259
+ ## License
260
+
261
+ Apache 2.0 — see [LICENSE](../LICENSE).
package/SKILL.md ADDED
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: adapter-antigravity
3
+ description: Use this skill when the user wants to enforce a WARD.md security policy inside Google Antigravity via its hook system. Triggers on requests to "secure my Antigravity agent", "block agy from doing X", "install WARD hooks in Antigravity", "make Antigravity respect my policy file", or any work involving the `weave-antigravity` command or the `agy` CLI. Also useful when reviewing a user's `~/.gemini/antigravity-cli/settings.json` for hook configuration, or when a user reports that an Antigravity agent is doing things they want stopped.
4
+ ---
5
+
6
+ # Google Antigravity adapter for Weave Protocol
7
+
8
+ The `@weave_protocol/adapter-antigravity` package enforces [WARD.md](https://www.npmjs.com/package/@weave_protocol/ward) policies inside Google Antigravity via the `PreToolUse` hook system. The same hook installation protects Antigravity 2.0 desktop, the `agy` CLI, and the Antigravity SDK because they share one agent harness with synced settings.
9
+
10
+ ## When to use
11
+
12
+ - User runs Antigravity (desktop or `agy`) and wants visibility/control over what it does
13
+ - User has a WARD.md and wants it enforced inside Antigravity (not just on MCP servers or Claude Code)
14
+ - User wants to lock down GCP credentials, SSH keys, or specific paths from being read by the agent
15
+ - User wants the same policy to work across desktop, CLI, and SDK surfaces
16
+ - User has a global `~/.gemini/antigravity-cli/WARD.md` they want applied to every session
17
+
18
+ ## Commands
19
+
20
+ ```bash
21
+ weave-antigravity init [--matcher=X] [--fail-closed] # Install hook
22
+ weave-antigravity disable # Remove hook
23
+ weave-antigravity status # Show config + active policy
24
+ weave-antigravity test <tool> [--input=JSON] # Dry-run a tool call
25
+ weave-antigravity help
26
+ ```
27
+
28
+ ## WARD resolution order
29
+
30
+ When the hook fires:
31
+
32
+ 1. `$WEAVE_WARD_PATH` — explicit override
33
+ 2. `<cwd>/WARD.md` — project root
34
+ 3. `<cwd>/.agents/WARD.md` — **co-located with AGENTS.md** in the agent definition folder
35
+ 4. `<cwd>/.weave/WARD.md` — alternate location
36
+ 5. `~/.gemini/antigravity-cli/WARD.md` — user-global fallback
37
+
38
+ First match wins. If none exists, the hook passes through silently.
39
+
40
+ The `.agents/` location is significant — that's where AGENTS.md and project skills already live for Antigravity. Co-locating WARD.md there keeps all three policy files (`AGENTS.md`, `SKILL.md`, `WARD.md`) in one version-controlled directory.
41
+
42
+ ## Tool mapping
43
+
44
+ Antigravity tool → WARD capability:
45
+
46
+ - `Bash` → `shell_exec` (also scans command string heuristically, including for `~/.config/gcloud`)
47
+ - `Edit`, `MultiEdit`, `Write` → `file_write`
48
+ - `Read` → `file_read`
49
+ - `Grep`, `LS`, `Glob` → `file_read` / `file_list`
50
+ - `WebFetch` → `http_request` (checks `url`)
51
+ - `WebSearch` → `web_search`
52
+ - `Task`, `Subagent` → `subagent`
53
+ - `RunCode` → `execute_code`
54
+ - `Plugin` → `plugin_invoke`
55
+
56
+ WARD.md can use either the literal Antigravity tool name (e.g., `Bash`) or the generic capability (`shell_exec`). The stricter rule wins.
57
+
58
+ ## Decision rules
59
+
60
+ | Situation | Action |
61
+ |---|---|
62
+ | User wants to enforce WARD in Antigravity | `weave-antigravity init` |
63
+ | User wants to test their policy | `weave-antigravity test <tool>` |
64
+ | User wants global policy across all projects | Write `~/.gemini/antigravity-cli/WARD.md` |
65
+ | User wants project-specific policy | Write `<project>/WARD.md` or `<project>/.agents/WARD.md` |
66
+ | User wants stricter failure mode | `init --fail-closed` |
67
+ | User wants to uninstall | `weave-antigravity disable` |
68
+ | User reports Antigravity blocked unexpectedly | `weave-antigravity status` (shows active policy and source) |
69
+
70
+ ## Fail modes
71
+
72
+ - **fail-open** (default): broken or missing WARD.md → allow the call, warn to stderr
73
+ - **fail-closed** (`--fail-closed`): broken or missing WARD.md → block the call
74
+
75
+ Default is fail-open because broken policy files shouldn't break the user's workflow. Recommend fail-closed only for high-stakes environments (production Managed Agents, automated pipelines).
76
+
77
+ ## Pairs with
78
+
79
+ - `@weave_protocol/ward` — the policy format being enforced
80
+ - `@weave_protocol/adapter-claudecode` — same WARD.md, enforced inside Claude Code
81
+ - `@weave_protocol/hundredmen` — enforces the same WARD.md on MCP servers (complementary)
82
+ - `@weave_protocol/cli` — `weave init` scaffolds projects with a WARD.md
83
+
84
+ ## Anti-patterns
85
+
86
+ - **Don't hand-edit `~/.gemini/antigravity-cli/settings.json` to add the hook.** Use `weave-antigravity init` so it backs up your config and stays idempotent.
87
+ - **Don't ship a project with `--fail-closed` and no WARD.md.** That blocks every tool call. Either ship a WARD.md or stay fail-open.
88
+ - **Don't use this for Managed Agents in the Gemini API yet** — that uses a different integration surface (programmatic via SDK). v0.2 will add SDK wrapper support.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * weave-antigravity CLI
4
+ *
5
+ * weave-antigravity init [--matcher=X] [--fail-closed] Install the WARD hook
6
+ * weave-antigravity disable Remove the WARD hook
7
+ * weave-antigravity status Show current config + WARD
8
+ * weave-antigravity test <tool> [--input=JSON] Dry-run a tool call
9
+ * weave-antigravity hook <event> [--fail-closed] Hook handler (called by agy)
10
+ * weave-antigravity help
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
package/dist/cli.js ADDED
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * weave-antigravity CLI
4
+ *
5
+ * weave-antigravity init [--matcher=X] [--fail-closed] Install the WARD hook
6
+ * weave-antigravity disable Remove the WARD hook
7
+ * weave-antigravity status Show current config + WARD
8
+ * weave-antigravity test <tool> [--input=JSON] Dry-run a tool call
9
+ * weave-antigravity hook <event> [--fail-closed] Hook handler (called by agy)
10
+ * weave-antigravity help
11
+ */
12
+ import { existsSync } from 'node:fs';
13
+ import { resolve } from 'node:path';
14
+ import { installHook, removeHook, readSettings, isHookInstalled, antigravitySettingsPath, antigravityConfigDir, userWardPath, } from './config.js';
15
+ import { resolveWardForCwd, evaluateCall, runPreToolUseHook } from './hook.js';
16
+ // ─── ANSI colors ───────────────────────────────────────────────
17
+ const tty = process.stdout.isTTY && !process.env.NO_COLOR;
18
+ const c = {
19
+ reset: tty ? '\x1b[0m' : '',
20
+ bold: tty ? '\x1b[1m' : '',
21
+ dim: tty ? '\x1b[2m' : '',
22
+ red: tty ? '\x1b[31m' : '',
23
+ green: tty ? '\x1b[32m' : '',
24
+ yellow: tty ? '\x1b[33m' : '',
25
+ blue: tty ? '\x1b[34m' : '',
26
+ cyan: tty ? '\x1b[36m' : '',
27
+ gray: tty ? '\x1b[90m' : '',
28
+ };
29
+ function banner() {
30
+ console.error(`
31
+ ${c.cyan}${c.bold}🛡️ weave-antigravity${c.reset}
32
+ ${c.gray}WARD.md enforcement for Google Antigravity via PreToolUse hooks${c.reset}
33
+ `);
34
+ }
35
+ // ─── help ──────────────────────────────────────────────────────
36
+ function help() {
37
+ banner();
38
+ console.error(`${c.bold}Usage:${c.reset} weave-antigravity <command> [options]\n`);
39
+ console.error(`${c.bold}Commands:${c.reset}`);
40
+ console.error(` ${c.cyan}init${c.reset} ${c.gray}[--matcher=X] [--fail-closed]${c.reset} Install the WARD pre-tool-use hook`);
41
+ console.error(` ${c.cyan}disable${c.reset} Remove the WARD hook`);
42
+ console.error(` ${c.cyan}status${c.reset} Show hook installation + active WARD policy`);
43
+ console.error(` ${c.cyan}test${c.reset} ${c.gray}<tool> [--input=JSON]${c.reset} Dry-run a tool call against your WARD.md`);
44
+ console.error(` ${c.cyan}hook${c.reset} ${c.gray}<event>${c.reset} Internal: called by Antigravity as a hook`);
45
+ console.error(` ${c.cyan}help${c.reset} Show this message\n`);
46
+ console.error(`${c.bold}Examples:${c.reset}`);
47
+ console.error(` ${c.gray}$${c.reset} weave-antigravity init`);
48
+ console.error(` ${c.gray}$${c.reset} weave-antigravity status`);
49
+ console.error(` ${c.gray}$${c.reset} weave-antigravity test Bash --input='{"command":"rm -rf ~/.gcloud"}'`);
50
+ console.error(` ${c.gray}$${c.reset} weave-antigravity disable\n`);
51
+ console.error(`${c.gray}Docs: https://github.com/Tyox-all/Weave_Protocol/tree/main/adapter-antigravity${c.reset}\n`);
52
+ }
53
+ // ─── arg helpers ───────────────────────────────────────────────
54
+ function parseFlag(args, name) {
55
+ for (const a of args) {
56
+ if (a === `--${name}`)
57
+ return '';
58
+ if (a.startsWith(`--${name}=`))
59
+ return a.slice(`--${name}=`.length);
60
+ }
61
+ return undefined;
62
+ }
63
+ function hasFlag(args, name) {
64
+ return args.some((a) => a === `--${name}` || a.startsWith(`--${name}=`));
65
+ }
66
+ // ─── init ──────────────────────────────────────────────────────
67
+ function runInit(args) {
68
+ banner();
69
+ const matcher = parseFlag(args, 'matcher') || undefined;
70
+ const failClosed = hasFlag(args, 'fail-closed');
71
+ const settings = readSettings();
72
+ const wasInstalled = isHookInstalled(settings);
73
+ installHook({
74
+ toolMatcher: matcher,
75
+ failClosed,
76
+ timeoutSeconds: 5,
77
+ });
78
+ const verb = wasInstalled ? 'Updated' : 'Installed';
79
+ console.error(`${c.green}✓${c.reset} ${verb} WARD hook in ${c.cyan}${antigravitySettingsPath()}${c.reset}`);
80
+ console.error(` ${c.gray}matcher:${c.reset} ${matcher || '*'}`);
81
+ console.error(` ${c.gray}fail mode:${c.reset} ${failClosed ? c.red + 'closed' + c.reset : c.green + 'open' + c.reset}`);
82
+ console.error('');
83
+ console.error(`Next:`);
84
+ console.error(` ${c.gray}1.${c.reset} Drop a ${c.cyan}WARD.md${c.reset} in your project root (or at ${c.cyan}.agents/WARD.md${c.reset} next to AGENTS.md)`);
85
+ console.error(` ${c.gray}2.${c.reset} Run ${c.cyan}agy${c.reset} in that project — the hook will gate tool calls automatically`);
86
+ console.error(` ${c.gray}3.${c.reset} Run ${c.cyan}weave-antigravity status${c.reset} to verify`);
87
+ console.error('');
88
+ return 0;
89
+ }
90
+ // ─── disable ───────────────────────────────────────────────────
91
+ function runDisable() {
92
+ banner();
93
+ const result = removeHook();
94
+ if (result.removed === 0) {
95
+ console.error(`${c.yellow}⚠${c.reset} No WARD hooks found in ${antigravitySettingsPath()}.`);
96
+ return 0;
97
+ }
98
+ console.error(`${c.green}✓${c.reset} Removed ${result.removed} WARD hook entry from ${c.cyan}${antigravitySettingsPath()}${c.reset}`);
99
+ console.error(`${c.gray} (your other hooks were not touched)${c.reset}`);
100
+ return 0;
101
+ }
102
+ // ─── status ────────────────────────────────────────────────────
103
+ function runStatus() {
104
+ banner();
105
+ const settingsPath = antigravitySettingsPath();
106
+ const exists = existsSync(settingsPath);
107
+ console.error(`${c.bold}Antigravity CLI config${c.reset}`);
108
+ console.error(`${c.gray}─${c.reset}`.repeat(60));
109
+ console.error(` ${c.gray}Config dir:${c.reset} ${c.cyan}${antigravityConfigDir()}${c.reset}`);
110
+ console.error(` ${c.gray}settings.json:${c.reset} ${exists ? c.green + 'present' + c.reset : c.red + 'missing' + c.reset}`);
111
+ if (exists) {
112
+ const settings = readSettings();
113
+ const installed = isHookInstalled(settings);
114
+ console.error(` ${c.gray}WARD hook:${c.reset} ${installed ? c.green + 'installed' + c.reset : c.yellow + 'not installed' + c.reset}`);
115
+ }
116
+ console.error('');
117
+ console.error(`${c.bold}Active WARD policy${c.reset}`);
118
+ console.error(`${c.gray}─${c.reset}`.repeat(60));
119
+ try {
120
+ const resolved = resolveWardForCwd(process.cwd());
121
+ if (!resolved) {
122
+ console.error(` ${c.yellow}No WARD.md found${c.reset}`);
123
+ console.error(` ${c.gray}Looked at:${c.reset}`);
124
+ if (process.env.WEAVE_WARD_PATH)
125
+ console.error(` ${c.gray}•${c.reset} ${process.env.WEAVE_WARD_PATH} ${c.gray}(WEAVE_WARD_PATH)${c.reset}`);
126
+ console.error(` ${c.gray}•${c.reset} ${resolve(process.cwd(), 'WARD.md')}`);
127
+ console.error(` ${c.gray}•${c.reset} ${resolve(process.cwd(), '.agents', 'WARD.md')} ${c.gray}(next to AGENTS.md)${c.reset}`);
128
+ console.error(` ${c.gray}•${c.reset} ${resolve(process.cwd(), '.weave', 'WARD.md')}`);
129
+ console.error(` ${c.gray}•${c.reset} ${userWardPath()} ${c.gray}(user-global)${c.reset}`);
130
+ }
131
+ else {
132
+ console.error(` ${c.gray}Source:${c.reset} ${c.cyan}${resolved.source}${c.reset}`);
133
+ console.error(` ${c.gray}Name:${c.reset} ${resolved.policy.name || c.gray + '(unnamed)' + c.reset}`);
134
+ console.error(` ${c.gray}Agent:${c.reset} ${resolved.policy.agent || c.gray + '(none)' + c.reset}`);
135
+ console.error(` ${c.gray}WARD version:${c.reset} ${resolved.policy.version}`);
136
+ }
137
+ }
138
+ catch (err) {
139
+ console.error(` ${c.red}Error loading WARD.md:${c.reset} ${err instanceof Error ? err.message : String(err)}`);
140
+ return 1;
141
+ }
142
+ console.error('');
143
+ return 0;
144
+ }
145
+ // ─── test ──────────────────────────────────────────────────────
146
+ function runTest(args) {
147
+ const tool = args[0];
148
+ if (!tool) {
149
+ console.error(`${c.red}✗${c.reset} Usage: weave-antigravity test <tool> [--input='{"file_path":"..."}']`);
150
+ return 2;
151
+ }
152
+ banner();
153
+ const inputArg = parseFlag(args, 'input');
154
+ let toolInput = {};
155
+ if (inputArg) {
156
+ try {
157
+ toolInput = JSON.parse(inputArg);
158
+ }
159
+ catch {
160
+ console.error(`${c.red}✗${c.reset} --input must be valid JSON`);
161
+ return 2;
162
+ }
163
+ }
164
+ const resolved = resolveWardForCwd(process.cwd());
165
+ if (!resolved) {
166
+ console.error(`${c.yellow}⚠${c.reset} No WARD.md found — call would be allowed by default.`);
167
+ return 0;
168
+ }
169
+ console.error(`Testing ${c.bold}${tool}${c.reset}${inputArg ? ' with ' + c.cyan + JSON.stringify(toolInput) + c.reset : ''}`);
170
+ console.error(`Policy: ${c.cyan}${resolved.source}${c.reset}\n`);
171
+ const result = evaluateCall(resolved.policy, tool, toolInput);
172
+ const colorMap = {
173
+ allow: c.green,
174
+ deny: c.red,
175
+ require_approval: c.yellow,
176
+ };
177
+ const iconMap = { allow: '✓', deny: '✗', require_approval: '⚠' };
178
+ console.error(`Decision: ${colorMap[result.decision]}${iconMap[result.decision]} ${result.decision.toUpperCase()}${c.reset}`);
179
+ if (result.reasons.length > 0) {
180
+ console.error(`\nReasons:`);
181
+ for (const r of result.reasons)
182
+ console.error(` ${c.gray}•${c.reset} ${r}`);
183
+ }
184
+ console.error('');
185
+ return result.decision === 'deny' ? 1 : 0;
186
+ }
187
+ // ─── router ────────────────────────────────────────────────────
188
+ async function main() {
189
+ const [, , cmd, ...rest] = process.argv;
190
+ let code = 0;
191
+ try {
192
+ switch (cmd) {
193
+ case 'init':
194
+ code = runInit(rest);
195
+ break;
196
+ case 'disable':
197
+ case 'uninstall':
198
+ code = runDisable();
199
+ break;
200
+ case 'status':
201
+ code = runStatus();
202
+ break;
203
+ case 'test':
204
+ code = runTest(rest);
205
+ break;
206
+ case 'hook': {
207
+ const event = rest[0];
208
+ const failClosed = hasFlag(rest, 'fail-closed');
209
+ if (event === 'pre-tool-use' || !event) {
210
+ await runPreToolUseHook(failClosed);
211
+ return;
212
+ }
213
+ process.stdout.write('{}');
214
+ process.exit(0);
215
+ }
216
+ case 'help':
217
+ case '--help':
218
+ case '-h':
219
+ case undefined:
220
+ help();
221
+ break;
222
+ default:
223
+ console.error(`${c.red}Unknown command: ${cmd}${c.reset}\n`);
224
+ help();
225
+ code = 2;
226
+ }
227
+ }
228
+ catch (err) {
229
+ console.error(`${c.red}Error:${c.reset} ${err instanceof Error ? err.message : String(err)}`);
230
+ if (process.env.DEBUG)
231
+ console.error(err);
232
+ code = 2;
233
+ }
234
+ process.exit(code);
235
+ }
236
+ main();
237
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE/E,kEAAkE;AAClE,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC1D,MAAM,CAAC,GAAG;IACR,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAC3B,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAC1B,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IACzB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IAC1B,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IAC5B,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAA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AG,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,KAAK,IAAI,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9F,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,GAAG,CAAC,CAAC;IACX,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Manage ~/.gemini/antigravity-cli/settings.json — install, remove,
3
+ * inspect the WARD hook.
4
+ *
5
+ * Safety rules:
6
+ * - Always back up existing settings.json before modifying
7
+ * - Use atomic writes (write to .tmp then rename)
8
+ * - Idempotent: running `init` twice doesn't duplicate hook entries
9
+ * - Preserve unknown keys (other hooks, other config) untouched
10
+ */
11
+ import type { AntigravitySettingsHooksEntry } from './types.js';
12
+ export declare function antigravityConfigDir(): string;
13
+ export declare function antigravitySettingsPath(): string;
14
+ export declare function userWardPath(): string;
15
+ export interface AntigravitySettings {
16
+ hooks?: {
17
+ PreToolUse?: AntigravitySettingsHooksEntry[];
18
+ PostToolUse?: AntigravitySettingsHooksEntry[];
19
+ Stop?: AntigravitySettingsHooksEntry[];
20
+ SessionStart?: AntigravitySettingsHooksEntry[];
21
+ [other: string]: AntigravitySettingsHooksEntry[] | undefined;
22
+ };
23
+ [other: string]: unknown;
24
+ }
25
+ export declare function readSettings(): AntigravitySettings;
26
+ export declare function writeSettings(settings: AntigravitySettings): void;
27
+ /**
28
+ * Unique tag in the hook command so we can find and remove our own entries
29
+ * without touching hooks the user added manually.
30
+ */
31
+ export declare const WARD_HOOK_MARKER = "# WEAVE_WARD_HOOK";
32
+ export interface InstallOptions {
33
+ /** Path to the weave-antigravity binary. Defaults to "weave-antigravity". */
34
+ binary?: string;
35
+ /** Restrict the hook to specific tool names. Default: all tools. */
36
+ toolMatcher?: string;
37
+ /** Hook timeout in seconds. */
38
+ timeoutSeconds?: number;
39
+ /** Block on error or fail-open? Default: fail-open (false). */
40
+ failClosed?: boolean;
41
+ }
42
+ export declare function isHookInstalled(settings: AntigravitySettings): boolean;
43
+ export declare function installHook(opts?: InstallOptions): AntigravitySettings;
44
+ export declare function removeHook(): {
45
+ removed: number;
46
+ settings: AntigravitySettings;
47
+ };
48
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAMhE,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAMD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,6BAA6B,EAAE,CAAC;QAC7C,WAAW,CAAC,EAAE,6BAA6B,EAAE,CAAC;QAC9C,IAAI,CAAC,EAAE,6BAA6B,EAAE,CAAC;QACvC,YAAY,CAAC,EAAE,6BAA6B,EAAE,CAAC;QAC/C,CAAC,KAAK,EAAE,MAAM,GAAG,6BAA6B,EAAE,GAAG,SAAS,CAAC;KAC9D,CAAC;IACF,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,wBAAgB,YAAY,IAAI,mBAAmB,CAYlD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAcjE;AAMD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAKtE;AAED,wBAAgB,WAAW,CAAC,IAAI,GAAE,cAAmB,GAAG,mBAAmB,CAgC1E;AAED,wBAAgB,UAAU,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,CAY/E"}
package/dist/config.js ADDED
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Manage ~/.gemini/antigravity-cli/settings.json — install, remove,
3
+ * inspect the WARD hook.
4
+ *
5
+ * Safety rules:
6
+ * - Always back up existing settings.json before modifying
7
+ * - Use atomic writes (write to .tmp then rename)
8
+ * - Idempotent: running `init` twice doesn't duplicate hook entries
9
+ * - Preserve unknown keys (other hooks, other config) untouched
10
+ */
11
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, renameSync, copyFileSync, } from 'node:fs';
12
+ import { dirname, join, resolve } from 'node:path';
13
+ import { homedir } from 'node:os';
14
+ // ============================================================================
15
+ // Paths
16
+ // ============================================================================
17
+ export function antigravityConfigDir() {
18
+ return process.env.ANTIGRAVITY_CONFIG_DIR
19
+ ? resolve(process.env.ANTIGRAVITY_CONFIG_DIR)
20
+ : join(homedir(), '.gemini', 'antigravity-cli');
21
+ }
22
+ export function antigravitySettingsPath() {
23
+ return join(antigravityConfigDir(), 'settings.json');
24
+ }
25
+ export function userWardPath() {
26
+ return join(antigravityConfigDir(), 'WARD.md');
27
+ }
28
+ export function readSettings() {
29
+ const path = antigravitySettingsPath();
30
+ if (!existsSync(path))
31
+ return {};
32
+ try {
33
+ return JSON.parse(readFileSync(path, 'utf8'));
34
+ }
35
+ catch (err) {
36
+ throw new Error(`Failed to parse ${path} — please fix the JSON syntax or back it up and re-run. Original: ${err instanceof Error ? err.message : String(err)}`);
37
+ }
38
+ }
39
+ export function writeSettings(settings) {
40
+ const path = antigravitySettingsPath();
41
+ mkdirSync(dirname(path), { recursive: true });
42
+ // Backup existing
43
+ if (existsSync(path)) {
44
+ const backup = `${path}.weave-backup`;
45
+ copyFileSync(path, backup);
46
+ }
47
+ // Atomic write
48
+ const tmp = `${path}.tmp`;
49
+ writeFileSync(tmp, JSON.stringify(settings, null, 2) + '\n', 'utf8');
50
+ renameSync(tmp, path);
51
+ }
52
+ // ============================================================================
53
+ // Hook install / remove
54
+ // ============================================================================
55
+ /**
56
+ * Unique tag in the hook command so we can find and remove our own entries
57
+ * without touching hooks the user added manually.
58
+ */
59
+ export const WARD_HOOK_MARKER = '# WEAVE_WARD_HOOK';
60
+ export function isHookInstalled(settings) {
61
+ const entries = settings.hooks?.PreToolUse || [];
62
+ return entries.some((e) => e.hooks?.some((h) => h.command?.includes(WARD_HOOK_MARKER) ?? false));
63
+ }
64
+ export function installHook(opts = {}) {
65
+ const settings = readSettings();
66
+ const binary = opts.binary || 'weave-antigravity';
67
+ const matcher = opts.toolMatcher || '*';
68
+ const failFlag = opts.failClosed ? ' --fail-closed' : '';
69
+ const command = `${binary} hook pre-tool-use${failFlag} ${WARD_HOOK_MARKER}`;
70
+ const entry = {
71
+ matcher,
72
+ hooks: [
73
+ {
74
+ type: 'command',
75
+ command,
76
+ timeout: opts.timeoutSeconds ?? 5,
77
+ },
78
+ ],
79
+ };
80
+ if (!settings.hooks)
81
+ settings.hooks = {};
82
+ if (!settings.hooks.PreToolUse)
83
+ settings.hooks.PreToolUse = [];
84
+ // Remove any existing WARD entries first (idempotent)
85
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter((e) => !e.hooks?.some((h) => h.command?.includes(WARD_HOOK_MARKER) ?? false));
86
+ // Add our new entry
87
+ settings.hooks.PreToolUse.push(entry);
88
+ writeSettings(settings);
89
+ return settings;
90
+ }
91
+ export function removeHook() {
92
+ const settings = readSettings();
93
+ if (!settings.hooks?.PreToolUse)
94
+ return { removed: 0, settings };
95
+ const before = settings.hooks.PreToolUse.length;
96
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter((e) => !e.hooks?.some((h) => h.command?.includes(WARD_HOOK_MARKER) ?? false));
97
+ const removed = before - settings.hooks.PreToolUse.length;
98
+ if (removed > 0)
99
+ writeSettings(settings);
100
+ return { removed, settings };
101
+ }
102
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB;QACvC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;QAC7C,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,CAAC,oBAAoB,EAAE,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,oBAAoB,EAAE,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC;AAiBD,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,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,IAAI,KAAK,CAAC,CAC7E,CAAC;IAEF,oBAAoB;IACpB,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEtC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEjE,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;IAChD,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAC1D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,CAC7E,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;IAE1D,IAAI,OAAO,GAAG,CAAC;QAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
package/dist/hook.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Antigravity hook handler.
3
+ *
4
+ * Reads the hook payload from stdin, looks up the active WARD policy,
5
+ * evaluates the proposed tool call, writes the decision to stdout.
6
+ *
7
+ * Resolution order for WARD.md:
8
+ * 1. $WEAVE_WARD_PATH if set
9
+ * 2. <cwd>/WARD.md (from the hook payload)
10
+ * 3. <cwd>/.agents/WARD.md (co-located with AGENTS.md)
11
+ * 4. <cwd>/.weave/WARD.md
12
+ * 5. ~/.gemini/antigravity-cli/WARD.md (user-global fallback)
13
+ *
14
+ * Failure mode (when WARD parse fails):
15
+ * - default: fail OPEN (warn to stderr, allow)
16
+ * - --fail-closed: fail CLOSED (block with the error reason)
17
+ */
18
+ import { type WardPolicy } from '@weave_protocol/ward';
19
+ export interface ResolvedWard {
20
+ policy: WardPolicy;
21
+ source: string;
22
+ }
23
+ export declare function resolveWardForCwd(cwd: string): ResolvedWard | null;
24
+ export interface HookDecision {
25
+ decision: 'allow' | 'deny' | 'require_approval';
26
+ reasons: string[];
27
+ policySource?: string;
28
+ }
29
+ export declare function evaluateCall(policy: WardPolicy, toolName: string, toolInput: Record<string, unknown> | undefined): HookDecision;
30
+ export declare function runPreToolUseHook(failClosed: boolean): Promise<never>;
31
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AA2B9B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAoBlE;AAMD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,kBAAkB,CAAC;IAChD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC7C,YAAY,CA2Dd;AAqED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAuD3E"}
package/dist/hook.js ADDED
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Antigravity hook handler.
3
+ *
4
+ * Reads the hook payload from stdin, looks up the active WARD policy,
5
+ * evaluates the proposed tool call, writes the decision to stdout.
6
+ *
7
+ * Resolution order for WARD.md:
8
+ * 1. $WEAVE_WARD_PATH if set
9
+ * 2. <cwd>/WARD.md (from the hook payload)
10
+ * 3. <cwd>/.agents/WARD.md (co-located with AGENTS.md)
11
+ * 4. <cwd>/.weave/WARD.md
12
+ * 5. ~/.gemini/antigravity-cli/WARD.md (user-global fallback)
13
+ *
14
+ * Failure mode (when WARD parse fails):
15
+ * - default: fail OPEN (warn to stderr, allow)
16
+ * - --fail-closed: fail CLOSED (block with the error reason)
17
+ */
18
+ import { readFileSync, existsSync } from 'node:fs';
19
+ import { join, resolve } from 'node:path';
20
+ import { parseWard, checkCapability, checkFilesystem, checkNetwork, } from '@weave_protocol/ward';
21
+ import { TOOL_MAPPINGS, } from './types.js';
22
+ import { userWardPath } from './config.js';
23
+ // ============================================================================
24
+ // stdin reader
25
+ // ============================================================================
26
+ async function readStdin() {
27
+ if (process.stdin.isTTY)
28
+ return '';
29
+ return new Promise((resolveStdin) => {
30
+ let data = '';
31
+ process.stdin.setEncoding('utf8');
32
+ process.stdin.on('data', (chunk) => (data += chunk));
33
+ process.stdin.on('end', () => resolveStdin(data));
34
+ });
35
+ }
36
+ export function resolveWardForCwd(cwd) {
37
+ const candidates = [];
38
+ if (process.env.WEAVE_WARD_PATH)
39
+ candidates.push(process.env.WEAVE_WARD_PATH);
40
+ if (cwd) {
41
+ candidates.push(join(cwd, 'WARD.md'));
42
+ candidates.push(join(cwd, '.agents', 'WARD.md'));
43
+ candidates.push(join(cwd, '.weave', 'WARD.md'));
44
+ }
45
+ candidates.push(userWardPath());
46
+ for (const path of candidates) {
47
+ const resolved = resolve(path);
48
+ if (existsSync(resolved)) {
49
+ const source = readFileSync(resolved, 'utf8');
50
+ const policy = parseWard(source);
51
+ return { policy, source: resolved };
52
+ }
53
+ }
54
+ return null;
55
+ }
56
+ export function evaluateCall(policy, toolName, toolInput) {
57
+ const reasons = [];
58
+ let decision = 'allow';
59
+ const mapping = TOOL_MAPPINGS[toolName] || { capability: toolName };
60
+ // 1. Capability check
61
+ const capByMapping = checkCapability(policy, mapping.capability);
62
+ const capByRaw = checkCapability(policy, toolName);
63
+ const cap = mergeCapability(capByMapping, capByRaw);
64
+ if (cap.decision === 'deny') {
65
+ return { decision: 'deny', reasons: [cap.reason] };
66
+ }
67
+ if (cap.decision === 'require_approval') {
68
+ decision = 'require_approval';
69
+ reasons.push(cap.reason);
70
+ }
71
+ // 2. Filesystem check
72
+ if (mapping.pathField && toolInput && typeof toolInput[mapping.pathField] === 'string') {
73
+ const path = toolInput[mapping.pathField];
74
+ const fs = checkFilesystem(policy, mapping.fsOp || 'read', path);
75
+ if (fs.decision === 'deny') {
76
+ return { decision: 'deny', reasons: [fs.reason] };
77
+ }
78
+ if (fs.decision === 'require_approval' && decision !== 'require_approval') {
79
+ decision = 'require_approval';
80
+ reasons.push(fs.reason);
81
+ }
82
+ }
83
+ // 3. Network check
84
+ if (mapping.urlField && toolInput && typeof toolInput[mapping.urlField] === 'string') {
85
+ const url = toolInput[mapping.urlField];
86
+ const method = toolInput.method || 'GET';
87
+ const net = checkNetwork(policy, url, method);
88
+ if (net.decision === 'deny') {
89
+ return { decision: 'deny', reasons: [net.reason] };
90
+ }
91
+ if (net.decision === 'require_approval' && decision !== 'require_approval') {
92
+ decision = 'require_approval';
93
+ reasons.push(net.reason);
94
+ }
95
+ }
96
+ // 4. Bash command heuristic scan
97
+ if (mapping.commandField && toolInput && typeof toolInput[mapping.commandField] === 'string') {
98
+ const command = toolInput[mapping.commandField];
99
+ const bashCheck = scanBashCommand(policy, command);
100
+ if (bashCheck.decision === 'deny') {
101
+ return { decision: 'deny', reasons: [bashCheck.reason] };
102
+ }
103
+ if (bashCheck.decision === 'require_approval' && decision !== 'require_approval') {
104
+ decision = 'require_approval';
105
+ reasons.push(bashCheck.reason);
106
+ }
107
+ }
108
+ return { decision, reasons };
109
+ }
110
+ function isExplicit(reason) {
111
+ return (reason.includes('is in the allow list') ||
112
+ reason.includes('is in the deny list') ||
113
+ reason.includes('requires human approval'));
114
+ }
115
+ function mergeCapability(a, b) {
116
+ const aExp = isExplicit(a.reason);
117
+ const bExp = isExplicit(b.reason);
118
+ if (aExp && !bExp)
119
+ return a;
120
+ if (bExp && !aExp)
121
+ return b;
122
+ if (a.decision === 'deny' || b.decision === 'deny') {
123
+ return a.decision === 'deny' ? a : b;
124
+ }
125
+ if (a.decision === 'require_approval' || b.decision === 'require_approval') {
126
+ return a.decision === 'require_approval' ? a : b;
127
+ }
128
+ return a;
129
+ }
130
+ function scanBashCommand(policy, command) {
131
+ const urlMatch = command.match(/https?:\/\/[^\s'"`)]+/);
132
+ if (urlMatch) {
133
+ const net = checkNetwork(policy, urlMatch[0], 'GET');
134
+ if (net.decision === 'deny')
135
+ return { decision: 'deny', reason: `bash command targets ${urlMatch[0]}: ${net.reason}` };
136
+ if (net.decision === 'require_approval')
137
+ return { decision: 'require_approval', reason: `bash command targets ${urlMatch[0]}: ${net.reason}` };
138
+ }
139
+ const dangerousPaths = ['~/.ssh', '~/.aws', '~/.config/gcloud', '/etc/', '/usr/', '/.env'];
140
+ for (const danger of dangerousPaths) {
141
+ if (command.includes(danger)) {
142
+ let op = 'read';
143
+ if (/(?:^|[\s;|])rm\s/.test(command))
144
+ op = 'delete';
145
+ else if (/>|>>|tee|sed -i/.test(command))
146
+ op = 'write';
147
+ const fs = checkFilesystem(policy, op, danger + (danger.endsWith('/') ? '**' : ''));
148
+ if (fs.decision === 'deny')
149
+ return { decision: 'deny', reason: `bash touches ${danger}: ${fs.reason}` };
150
+ if (fs.decision === 'require_approval')
151
+ return { decision: 'require_approval', reason: `bash touches ${danger}: ${fs.reason}` };
152
+ }
153
+ }
154
+ return { decision: 'allow', reason: '' };
155
+ }
156
+ // ============================================================================
157
+ // Hook output helpers
158
+ // ============================================================================
159
+ function emit(output) {
160
+ process.stdout.write(JSON.stringify(output));
161
+ process.exit(0);
162
+ }
163
+ // ============================================================================
164
+ // Main entry
165
+ // ============================================================================
166
+ export async function runPreToolUseHook(failClosed) {
167
+ const raw = await readStdin();
168
+ if (!raw.trim())
169
+ emit({});
170
+ let payload;
171
+ try {
172
+ payload = JSON.parse(raw);
173
+ }
174
+ catch {
175
+ if (failClosed)
176
+ emit({ decision: 'block', reason: 'WARD hook: malformed payload from Antigravity' });
177
+ process.stderr.write('weave-antigravity: malformed hook payload, allowing\n');
178
+ emit({});
179
+ }
180
+ if (!payload.tool_name)
181
+ emit({});
182
+ const cwd = payload.cwd || process.cwd();
183
+ let resolved = null;
184
+ try {
185
+ resolved = resolveWardForCwd(cwd);
186
+ }
187
+ catch (err) {
188
+ const msg = err instanceof Error ? err.message : String(err);
189
+ if (failClosed)
190
+ emit({ decision: 'block', reason: `WARD policy could not be loaded: ${msg}` });
191
+ process.stderr.write(`weave-antigravity: WARD load failed (${msg}), allowing\n`);
192
+ emit({});
193
+ }
194
+ if (!resolved)
195
+ emit({});
196
+ let result;
197
+ try {
198
+ result = evaluateCall(resolved.policy, payload.tool_name, payload.tool_input);
199
+ }
200
+ catch (err) {
201
+ const msg = err instanceof Error ? err.message : String(err);
202
+ if (failClosed)
203
+ emit({ decision: 'block', reason: `WARD evaluation failed: ${msg}` });
204
+ process.stderr.write(`weave-antigravity: WARD eval failed (${msg}), allowing\n`);
205
+ emit({});
206
+ }
207
+ if (result.decision === 'deny') {
208
+ emit({
209
+ decision: 'block',
210
+ reason: `🛡️ WARD: ${result.reasons.join(' | ')}\n Policy: ${resolved.source}`,
211
+ });
212
+ }
213
+ if (result.decision === 'require_approval') {
214
+ emit({
215
+ decision: 'block',
216
+ reason: `🛡️ WARD requires approval before this call:\n ${result.reasons.join('\n ')}\n Policy: ${resolved.source}\n To proceed, explicitly confirm or update WARD.md.`,
217
+ });
218
+ }
219
+ emit({});
220
+ }
221
+ //# sourceMappingURL=hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.js","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,aAAa,GAId,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,KAAK,UAAU,SAAS;IACtB,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;QAClC,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC;QACrD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC;AAWD,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;QAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9E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ACjB,MAAM,EAAE,qDAAqD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,QAAQ,CAAC,MAAM,wDAAwD;SACjL,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @weave_protocol/adapter-antigravity - public API
3
+ */
4
+ export * from './types.js';
5
+ export { installHook, removeHook, readSettings, writeSettings, isHookInstalled, antigravitySettingsPath, antigravityConfigDir, userWardPath, WARD_HOOK_MARKER, } from './config.js';
6
+ export type { AntigravitySettings, InstallOptions } from './config.js';
7
+ export { resolveWardForCwd, evaluateCall, runPreToolUseHook, } from './hook.js';
8
+ export type { ResolvedWard, HookDecision } from './hook.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @weave_protocol/adapter-antigravity - public API
3
+ */
4
+ export * from './types.js';
5
+ export { installHook, removeHook, readSettings, writeSettings, isHookInstalled, antigravitySettingsPath, antigravityConfigDir, userWardPath, WARD_HOOK_MARKER, } from './config.js';
6
+ export { resolveWardForCwd, evaluateCall, runPreToolUseHook, } from './hook.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Types for the Google Antigravity adapter.
3
+ */
4
+ /**
5
+ * Shape of the JSON payload Antigravity sends to a hook on stdin.
6
+ * Based on the JSON hook format introduced in Antigravity 2.0, which
7
+ * mirrors the Claude Code hook payload shape closely.
8
+ */
9
+ export interface AntigravityHookInput {
10
+ session_id?: string;
11
+ transcript_path?: string;
12
+ cwd?: string;
13
+ hook_event_name?: string;
14
+ tool_name?: string;
15
+ tool_input?: Record<string, unknown>;
16
+ tool_response?: unknown;
17
+ }
18
+ /**
19
+ * JSON returned on stdout to control Antigravity's behavior.
20
+ *
21
+ * For PreToolUse hooks:
22
+ * - { "decision": "approve" } → auto-approve
23
+ * - { "decision": "block", "reason": "..." } → block the call with reason
24
+ * - {} (or no output) → default behavior
25
+ */
26
+ export interface AntigravityHookOutput {
27
+ decision?: 'approve' | 'block';
28
+ reason?: string;
29
+ continue?: boolean;
30
+ stopReason?: string;
31
+ systemMessage?: string;
32
+ suppressOutput?: boolean;
33
+ }
34
+ /**
35
+ * Hook lifecycle event types in Antigravity 2.0.
36
+ * v0.1 ships PreToolUse only; the rest are placeholders for v0.2+.
37
+ */
38
+ export type HookType = 'pre-tool-use' | 'post-tool-use' | 'stop' | 'session-start';
39
+ /**
40
+ * Mapping from Antigravity tool names to their nature.
41
+ *
42
+ * NOTE: Antigravity inherits much of its built-in tool naming from the
43
+ * Gemini CLI lineage. The list below covers the documented common tools.
44
+ * Unknown tools fall through with the tool name itself as the capability.
45
+ */
46
+ export interface ToolMapping {
47
+ /** Generic capability name for WARD `## Capabilities`. */
48
+ capability: string;
49
+ /** Args field that contains a filesystem path, if any. */
50
+ pathField?: string;
51
+ /** Implied filesystem operation for that path. */
52
+ fsOp?: 'read' | 'write' | 'execute' | 'delete' | 'list';
53
+ /** Args field that contains a URL, if any. */
54
+ urlField?: string;
55
+ /** Args field that contains a shell command, if any. */
56
+ commandField?: string;
57
+ }
58
+ /**
59
+ * Built-in mappings for Antigravity's standard tools.
60
+ *
61
+ * Documented tools (Bash/Edit/Write/Read) confirmed from public hook
62
+ * documentation. Others inferred from the shared Gemini CLI / Antigravity
63
+ * harness lineage. Users can also reference these by their raw names
64
+ * in WARD.md directly.
65
+ */
66
+ export declare const TOOL_MAPPINGS: Record<string, ToolMapping>;
67
+ /**
68
+ * Settings file entry shape under hooks.<EventName>[]
69
+ */
70
+ export interface AntigravitySettingsHooksEntry {
71
+ matcher?: string;
72
+ hooks: Array<{
73
+ type: 'command' | 'prompt';
74
+ command?: string;
75
+ prompt?: string;
76
+ timeout?: number;
77
+ }>;
78
+ }
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,GAAG,eAAe,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IACxD,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAoBrD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ"}
package/dist/types.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Types for the Google Antigravity adapter.
3
+ */
4
+ /**
5
+ * Built-in mappings for Antigravity's standard tools.
6
+ *
7
+ * Documented tools (Bash/Edit/Write/Read) confirmed from public hook
8
+ * documentation. Others inferred from the shared Gemini CLI / Antigravity
9
+ * harness lineage. Users can also reference these by their raw names
10
+ * in WARD.md directly.
11
+ */
12
+ export const TOOL_MAPPINGS = {
13
+ // Confirmed from public Antigravity hook docs
14
+ Bash: { capability: 'shell_exec', commandField: 'command' },
15
+ Edit: { capability: 'file_write', pathField: 'file_path', fsOp: 'write' },
16
+ Write: { capability: 'file_write', pathField: 'file_path', fsOp: 'write' },
17
+ Read: { capability: 'file_read', pathField: 'file_path', fsOp: 'read' },
18
+ // Inherited from Gemini CLI / shared agent harness
19
+ MultiEdit: { capability: 'file_write', pathField: 'file_path', fsOp: 'write' },
20
+ Glob: { capability: 'file_list', pathField: 'path', fsOp: 'list' },
21
+ Grep: { capability: 'file_read', pathField: 'path', fsOp: 'read' },
22
+ LS: { capability: 'file_list', pathField: 'path', fsOp: 'list' },
23
+ WebFetch: { capability: 'http_request', urlField: 'url' },
24
+ WebSearch: { capability: 'web_search' },
25
+ // Antigravity-specific / shared
26
+ Subagent: { capability: 'subagent' },
27
+ Task: { capability: 'subagent' },
28
+ RunCode: { capability: 'execute_code' },
29
+ Plugin: { capability: 'plugin_invoke' },
30
+ };
31
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4DH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgC;IACxD,8CAA8C;IAC9C,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE;IAC3D,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;IACzE,KAAK,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;IAC1E,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;IAEvE,mDAAmD;IACnD,SAAS,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;IAC9E,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAClE,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAClE,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAChE,QAAQ,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE;IACzD,SAAS,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE;IAEvC,gCAAgC;IAChC,QAAQ,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;IACpC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;IAChC,OAAO,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE;IACvC,MAAM,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE;CACxC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@weave_protocol/adapter-antigravity",
3
+ "version": "0.1.0",
4
+ "description": "Weave Protocol adapter for Google Antigravity - enforces WARD.md policies via Antigravity's PreToolUse hook system",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "weave-antigravity": "dist/cli.js"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "test": "node --test tests/",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "weave-protocol",
19
+ "ward",
20
+ "antigravity",
21
+ "google-antigravity",
22
+ "gemini",
23
+ "agent-security",
24
+ "ai-security",
25
+ "hooks",
26
+ "harness-adapter",
27
+ "policy-enforcement",
28
+ "managed-agents",
29
+ "agy"
30
+ ],
31
+ "author": "Trent Yoxall",
32
+ "license": "Apache-2.0",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/Tyox-all/Weave_Protocol.git",
36
+ "directory": "adapter-antigravity"
37
+ },
38
+ "homepage": "https://github.com/Tyox-all/Weave_Protocol/tree/main/adapter-antigravity#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/Tyox-all/Weave_Protocol/issues"
41
+ },
42
+ "dependencies": {
43
+ "@weave_protocol/ward": "^0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^20.0.0",
47
+ "typescript": "^5.3.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
52
+ "files": [
53
+ "dist/",
54
+ "README.md",
55
+ "SKILL.md",
56
+ "LICENSE"
57
+ ]
58
+ }