@davesheffer/hunch 0.30.0 β†’ 0.31.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 CHANGED
@@ -18,7 +18,7 @@ cd your-repo && hunch init && hunch backfill --since 90d
18
18
  hunch why src/some/file.ts # …or just ask Claude Code: "why is X built this way?"
19
19
  ```
20
20
 
21
- <sub>Works with **Claude Code, Cursor, Copilot & Windsurf** from one shared graph.</sub>
21
+ <sub>Works with **Claude Code, Cursor, Copilot, Windsurf & Google Antigravity** from one shared graph.</sub>
22
22
 
23
23
  ### πŸ“š **[Read the full documentation β†’ hunch-pi.vercel.app/docs](https://hunch-pi.vercel.app/docs)**
24
24
 
@@ -96,7 +96,7 @@ hunch why src/auth/session.ts # …then ask your assistant: "why is X buil
96
96
 
97
97
  `hunch init` scaffolds `.hunch/`, indexes the repo, installs the git hooks + merge driver,
98
98
  writes `.mcp.json` + slash commands + an auto-maintained `CLAUDE.md`, and wires up **every
99
- detected assistant** (Claude Code, Cursor, VS Code/Copilot, Windsurf, Codex) to the same
99
+ detected assistant** (Claude Code, Cursor, VS Code/Copilot, Windsurf, Codex, Google Antigravity) to the same
100
100
  graph β€” merging idempotently into existing files. **Reload your assistant in the repo**
101
101
  afterward to pick up the `hunch_*` tools. Each teammate runs `hunch init` once; the
102
102
  `.hunch/` content is shared via git.
@@ -18,6 +18,7 @@
18
18
  * and is idempotent, so re-running `hunch init` is safe.
19
19
  */
20
20
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
21
+ import { homedir } from "node:os";
21
22
  import { join, dirname } from "node:path";
22
23
  import { renderHunchSection, upsertSection, updateClaudeMd } from "./claudemd.js";
23
24
  /** Strip // line and block comments + trailing commas (JSONC β†’ JSON). String-aware
@@ -153,6 +154,37 @@ export function writeVscodeMcp(root, inv) {
153
154
  json.servers.hunch = { type: "stdio", command: inv.command, args: [...inv.args, "mcp"] };
154
155
  return writeJson(file, json);
155
156
  }
157
+ /** Google Antigravity's MCP config is GLOBAL (user home), not project-local β€” and the
158
+ * dir moved between versions (`antigravity/` vs `config/`). Resolve adaptively: an
159
+ * existing config wins, else an existing parent dir, else null (Antigravity not
160
+ * installed β€” we never create a global config for an absent tool). `home` is injectable
161
+ * for tests so we never touch the real ~/.gemini. */
162
+ export function antigravityMcpFile(home = homedir()) {
163
+ const candidates = [
164
+ join(home, ".gemini", "antigravity", "mcp_config.json"),
165
+ join(home, ".gemini", "config", "mcp_config.json"),
166
+ ];
167
+ for (const c of candidates)
168
+ if (existsSync(c))
169
+ return c;
170
+ for (const c of candidates)
171
+ if (existsSync(dirname(c)))
172
+ return c;
173
+ return null;
174
+ }
175
+ /** Antigravity: merge the hunch stdio server into the global mcp_config.json β€” same
176
+ * `mcpServers` { command, args } shape as Cursor/Claude (stdio; `serverUrl` is only for
177
+ * HTTP servers). Returns null when Antigravity isn't detected. Grounding needs nothing
178
+ * extra: Antigravity reads the project-root AGENTS.md Hunch already writes. */
179
+ export function writeAntigravityMcp(inv, home = homedir()) {
180
+ const file = antigravityMcpFile(home);
181
+ if (!file)
182
+ return null;
183
+ const json = readJsonObj(file);
184
+ json.mcpServers = json.mcpServers ?? {};
185
+ json.mcpServers.hunch = { command: inv.command, args: [...inv.args, "mcp"] };
186
+ return writeJson(file, json);
187
+ }
156
188
  const TOML_START = "# >>> hunch mcp (managed) >>>";
157
189
  const TOML_END = "# <<< hunch mcp <<<";
158
190
  /** Codex CLI: .codex/config.toml β€” `[mcp_servers.hunch]` stdio entry. We own only
@@ -278,6 +310,9 @@ export function scaffoldProviders(root, inv, store) {
278
310
  ["VS Code (Copilot)", () => [writeVscodeMcp(root, inv), writeCopilotInstructions(root, store)]],
279
311
  ["Codex CLI", () => [writeCodexConfig(root, inv)]],
280
312
  ["Windsurf", () => [writeWindsurfMcp(root, inv), writeWindsurfRule(root, store)]],
313
+ // Antigravity reads project-root AGENTS.md for grounding (written below); its MCP
314
+ // config is global + detection-gated, so it only writes when Antigravity is installed.
315
+ ["Google Antigravity", () => { const f = writeAntigravityMcp(inv); return f ? [f] : []; }],
281
316
  ["Any (AGENTS.md)", () => [writeAgentsMd(root, store)]],
282
317
  ];
283
318
  return tasks.map(([assistant, run]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
6
6
  "description": "Hunch β€” an Engineering Memory OS: a persistent, git-native reasoning graph over a codebase, exposed to Claude Code via MCP.",