@nram-ai/setup-agents 0.0.1-pre.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/LICENSE +19 -0
- package/README.md +109 -0
- package/dist/helpers/configure/amp.d.ts +9 -0
- package/dist/helpers/configure/amp.js +49 -0
- package/dist/helpers/configure/amp.js.map +1 -0
- package/dist/helpers/configure/antigravity.d.ts +12 -0
- package/dist/helpers/configure/antigravity.js +74 -0
- package/dist/helpers/configure/antigravity.js.map +1 -0
- package/dist/helpers/configure/claude_code.d.ts +9 -0
- package/dist/helpers/configure/claude_code.js +119 -0
- package/dist/helpers/configure/claude_code.js.map +1 -0
- package/dist/helpers/configure/codex.d.ts +19 -0
- package/dist/helpers/configure/codex.js +76 -0
- package/dist/helpers/configure/codex.js.map +1 -0
- package/dist/helpers/configure/copilot.d.ts +11 -0
- package/dist/helpers/configure/copilot.js +64 -0
- package/dist/helpers/configure/copilot.js.map +1 -0
- package/dist/helpers/configure/cursor.d.ts +26 -0
- package/dist/helpers/configure/cursor.js +90 -0
- package/dist/helpers/configure/cursor.js.map +1 -0
- package/dist/helpers/configure/droid.d.ts +18 -0
- package/dist/helpers/configure/droid.js +70 -0
- package/dist/helpers/configure/droid.js.map +1 -0
- package/dist/helpers/configure/grok.d.ts +25 -0
- package/dist/helpers/configure/grok.js +93 -0
- package/dist/helpers/configure/grok.js.map +1 -0
- package/dist/helpers/configure/hermes.d.ts +22 -0
- package/dist/helpers/configure/hermes.js +107 -0
- package/dist/helpers/configure/hermes.js.map +1 -0
- package/dist/helpers/configure/junie.d.ts +10 -0
- package/dist/helpers/configure/junie.js +52 -0
- package/dist/helpers/configure/junie.js.map +1 -0
- package/dist/helpers/configure/kilo.d.ts +19 -0
- package/dist/helpers/configure/kilo.js +110 -0
- package/dist/helpers/configure/kilo.js.map +1 -0
- package/dist/helpers/configure/kimi.d.ts +10 -0
- package/dist/helpers/configure/kimi.js +75 -0
- package/dist/helpers/configure/kimi.js.map +1 -0
- package/dist/helpers/configure/kiro.d.ts +25 -0
- package/dist/helpers/configure/kiro.js +77 -0
- package/dist/helpers/configure/kiro.js.map +1 -0
- package/dist/helpers/configure/openclaw.d.ts +10 -0
- package/dist/helpers/configure/openclaw.js +72 -0
- package/dist/helpers/configure/openclaw.js.map +1 -0
- package/dist/helpers/configure/opencode.d.ts +18 -0
- package/dist/helpers/configure/opencode.js +72 -0
- package/dist/helpers/configure/opencode.js.map +1 -0
- package/dist/helpers/configure/pi.d.ts +10 -0
- package/dist/helpers/configure/pi.js +60 -0
- package/dist/helpers/configure/pi.js.map +1 -0
- package/dist/helpers/configure/trae.d.ts +11 -0
- package/dist/helpers/configure/trae.js +63 -0
- package/dist/helpers/configure/trae.js.map +1 -0
- package/dist/helpers/configure/vibe.d.ts +24 -0
- package/dist/helpers/configure/vibe.js +106 -0
- package/dist/helpers/configure/vibe.js.map +1 -0
- package/dist/helpers/configure/vscode.d.ts +18 -0
- package/dist/helpers/configure/vscode.js +81 -0
- package/dist/helpers/configure/vscode.js.map +1 -0
- package/dist/helpers/harnesses.d.ts +8 -0
- package/dist/helpers/harnesses.js +161 -0
- package/dist/helpers/harnesses.js.map +1 -0
- package/dist/helpers/instructions.d.ts +63 -0
- package/dist/helpers/instructions.js +175 -0
- package/dist/helpers/instructions.js.map +1 -0
- package/dist/helpers/paths.d.ts +130 -0
- package/dist/helpers/paths.js +211 -0
- package/dist/helpers/paths.js.map +1 -0
- package/dist/helpers/upsert.d.ts +197 -0
- package/dist/helpers/upsert.js +428 -0
- package/dist/helpers/upsert.js.map +1 -0
- package/dist/helpers/url.d.ts +15 -0
- package/dist/helpers/url.js +51 -0
- package/dist/helpers/url.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/setup.d.ts +17 -0
- package/dist/setup.js +296 -0
- package/dist/setup.js.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 Brandon Lehmann
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://nram.ai/brand.png" alt="Neural Ram" width="150" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@nram-ai/setup-agents</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><sub>the setup wizard for <a href="https://github.com/nram-ai/nram">Neural Ram</a> (<code>nram</code> for short)</sub></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>One command to connect your AI coding tools to Neural Ram.</strong><br />
|
|
11
|
+
Registers the MCP connection and installs the standing memory instructions for 19 tools, in one interactive run.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-7FCFFA?style=flat-square" alt="License: MIT" /></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@nram-ai/setup-agents"><img src="https://img.shields.io/npm/v/@nram-ai/setup-agents?style=flat-square&color=7FCFFA" alt="npm version" /></a>
|
|
17
|
+
<img src="https://img.shields.io/badge/Node.js-22%2B-5FA04E?style=flat-square&logo=node.js&logoColor=white" alt="Node.js 22+" />
|
|
18
|
+
<img src="https://img.shields.io/badge/supports-19_tools-7FCFFA?style=flat-square" alt="Supports 19 tools" />
|
|
19
|
+
<a href="https://github.com/nram-ai/setup-agents/stargazers"><img src="https://img.shields.io/github/stars/nram-ai/setup-agents?style=flat-square&color=7FCFFA" alt="GitHub stars" /></a>
|
|
20
|
+
<img src="https://img.shields.io/github/last-commit/nram-ai/setup-agents?style=flat-square&color=7FCFFA" alt="Last commit" />
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
25
|
+
<a href="#supported-tools">Supported tools</a> ·
|
|
26
|
+
<a href="https://nram.ai">nram.ai</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
> Work in progress: under active development. Expect rough edges, and feedback is welcome.
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @nram-ai/setup-agents
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Neural Ram is the continuity layer for everything you do with AI: one self-hosted server that keeps what mattered across every tool, every conversation, and every machine. This wizard wires your coding tools into it.
|
|
38
|
+
|
|
39
|
+
Your agents get two things out of it: a connection to your nram server (over MCP), and standing instructions that teach them to actually use it, recalling context at the start of every task and storing what they learn. Without the second half, an agent has memory tools it never thinks to touch; without the first, it has instructions about tools that do not exist. This wizard sets up both.
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
- Node.js 22 or newer
|
|
44
|
+
- A running [Neural Ram](https://github.com/nram-ai/nram) server (defaults to `http://localhost:8674`)
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
The wizard walks you through five questions and then does the work:
|
|
49
|
+
|
|
50
|
+
1. **Scope.** User level (your machine-wide tool configs) or project level (files inside the current repository, shareable with your team).
|
|
51
|
+
2. **Tools.** Every supported tool is listed; the ones detected on your machine are preselected. At project level you can configure tools you do not have installed, because teammates might.
|
|
52
|
+
3. **Components.** The MCP connection, the agent instructions, or both (the default).
|
|
53
|
+
4. **Server.** Your nram base URL, asked once and used for both components: the MCP endpoint derives from it, and the canonical agent instructions are pulled from its public `/instructions` endpoint. Pass it up front with `--url` and the wizard notes the value and skips this question. Every run health-checks the server against `/v1/health` before a single file is touched.
|
|
54
|
+
5. **Authentication.** OAuth (recommended: capable tools discover your server and negotiate on their own, this wizard never sees a credential) or an nram API key.
|
|
55
|
+
|
|
56
|
+
Then it configures each selected tool and prints exactly what it did: every file written, everything skipped because it was already in place, and any step a tool requires you to finish by hand.
|
|
57
|
+
|
|
58
|
+
## Supported tools
|
|
59
|
+
|
|
60
|
+
| Tool | MCP connection | Agent instructions |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| Amp | `settings.json` | `AGENTS.md` |
|
|
63
|
+
| Antigravity | `mcp_config.json` (no MCP OAuth; use an API key) | `AGENTS.md` |
|
|
64
|
+
| Claude Code | `claude mcp add` | SessionStart hook |
|
|
65
|
+
| Codex | `config.toml` | SessionStart hook |
|
|
66
|
+
| Cursor | `mcp.json` | `.cursor/rules/` (project scope) |
|
|
67
|
+
| Droid (Factory) | `mcp.json` | `AGENTS.md` |
|
|
68
|
+
| GitHub Copilot CLI | `mcp-config.json` | `copilot-instructions.md` / `AGENTS.md` |
|
|
69
|
+
| Grok Build (xAI) | `config.toml` | SessionStart hook (project scope needs `/hooks-trust`) |
|
|
70
|
+
| Hermes | `config.yaml` | `AGENTS.md` (project scope) |
|
|
71
|
+
| Junie (JetBrains) | `mcp/mcp.json` | `AGENTS.md` |
|
|
72
|
+
| Kilo Code | `kilo.jsonc` | rules file |
|
|
73
|
+
| Kimi Code | `mcp.json` | not supported by Kimi yet |
|
|
74
|
+
| Kiro | `settings/mcp.json` | steering doc |
|
|
75
|
+
| OpenClaw | `openclaw.json` | workspace `AGENTS.md` |
|
|
76
|
+
| OpenCode | `opencode.json` | `AGENTS.md` |
|
|
77
|
+
| Pi | `mcp.json` | `AGENTS.md` |
|
|
78
|
+
| Trae | through Trae's own MCP UI | rules file (project scope) |
|
|
79
|
+
| Vibe (Mistral) | `config.toml` (a project file is updated, never created) | `AGENTS.md` |
|
|
80
|
+
| VS Code | `.vscode/mcp.json` | instructions file |
|
|
81
|
+
|
|
82
|
+
Where a tool genuinely cannot do something (a scope it does not support, OAuth it has not implemented, an instructions file it will not read), the wizard says so plainly and prints what to do instead. It never writes a file the tool would ignore.
|
|
83
|
+
|
|
84
|
+
## How it treats your files
|
|
85
|
+
|
|
86
|
+
**It merges; it does not overwrite.** Existing config files are edited surgically: a JSON config gains one keyed entry, a TOML or YAML config gains one clearly marked block, and everything else in the file, comments included, survives byte for byte.
|
|
87
|
+
|
|
88
|
+
**It is idempotent.** Run it twice and the second run changes nothing; every action reports `skipped: already present`. Marker-fenced blocks are updated in place on reruns, never duplicated.
|
|
89
|
+
|
|
90
|
+
**It refuses rather than guesses.** A config file it cannot parse is left untouched, and you get a copy-paste snippet instead. Same for anything it cannot verify the tool actually supports.
|
|
91
|
+
|
|
92
|
+
**It keeps secrets off disk.** In API-key mode, configs reference the `NRAM_API_KEY` environment variable wherever the tool supports substitution; where it does not, you are told which header to add yourself. The key itself is never written to a config file.
|
|
93
|
+
|
|
94
|
+
## Flags
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
npx @nram-ai/setup-agents [options]
|
|
98
|
+
|
|
99
|
+
-u, --url <url> the base URL of your nram server (skips the prompt)
|
|
100
|
+
--skip-mcp do not register the nram MCP server
|
|
101
|
+
--skip-instructions do not inject the agent instructions
|
|
102
|
+
-s, --session-start fetch and print the agent instructions and exit
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`--session-start` is the command the installed SessionStart hooks run (they carry `--url`, so each hook knows your server): its output lands in the agent's context at the start of every session, which keeps the memory protocol out of your CLAUDE.md and AGENTS.md files where hooks are supported, and always current because the text comes from your server, the single source of truth. Every successful fetch is cached at `~/.nram/cache/`; when the server is unreachable the hook serves that cached copy, then the copy in the nram source on GitHub, and as a last resort a short notice telling the agent to let you know the instructions could not be loaded. The hook never fails or blocks a session beyond a few bounded seconds.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Configures Amp (Sourcegraph): merges the nram MCP server into settings.json
|
|
4
|
+
* under the `amp.mcpServers` key and upserts the agent instructions into the
|
|
5
|
+
* AGENTS.md Amp reads at the requested scope
|
|
6
|
+
*
|
|
7
|
+
* @param options the collected setup options
|
|
8
|
+
*/
|
|
9
|
+
export declare const configure_amp: (options: SetupOptions) => Promise<ActionResult[]>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.configure_amp = void 0;
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const paths_1 = require("../paths");
|
|
25
|
+
const upsert_1 = require("../upsert");
|
|
26
|
+
/**
|
|
27
|
+
* Configures Amp (Sourcegraph): merges the nram MCP server into settings.json
|
|
28
|
+
* under the `amp.mcpServers` key and upserts the agent instructions into the
|
|
29
|
+
* AGENTS.md Amp reads at the requested scope
|
|
30
|
+
*
|
|
31
|
+
* @param options the collected setup options
|
|
32
|
+
*/
|
|
33
|
+
const configure_amp = async (options) => {
|
|
34
|
+
const results = [];
|
|
35
|
+
if (options.mcp_url !== undefined) {
|
|
36
|
+
const config_path = (0, path_1.resolve)((0, paths_1.amp_dir)(options.scope), 'settings.json');
|
|
37
|
+
const mcp = (0, upsert_1.mcp_json_result)(config_path, ['amp.mcpServers', 'nram'], { url: options.mcp_url });
|
|
38
|
+
results.push(mcp);
|
|
39
|
+
if (mcp.kind !== 'manual' && options.api_key !== undefined) {
|
|
40
|
+
results.push((0, upsert_1.api_key_header_manual_result)(config_path));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (options.instructions) {
|
|
44
|
+
results.push((0, upsert_1.agents_md_result)((0, paths_1.agents_md_path)(options.scope, (0, path_1.resolve)((0, paths_1.amp_dir)(options.scope), 'AGENTS.md')), options.instructions.full));
|
|
45
|
+
}
|
|
46
|
+
return results;
|
|
47
|
+
};
|
|
48
|
+
exports.configure_amp = configure_amp;
|
|
49
|
+
//# sourceMappingURL=amp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amp.js","sourceRoot":"","sources":["../../../src/helpers/configure/amp.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AAEZ,+BAA+B;AAE/B,oCAAmD;AACnD,sCAA4F;AAE5F;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,KAAK,EAAE,OAAqB,EAA2B,EAAE;IAClF,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,IAAA,eAAO,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,CAAC;QAErE,MAAM,GAAG,GAAG,IAAA,wBAAe,EAAC,WAAW,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/F,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACzD,OAAO,CAAC,IAAI,CAAC,IAAA,qCAA4B,EAAC,WAAW,CAAC,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAA,yBAAgB,EACzB,IAAA,sBAAc,EAAC,OAAO,CAAC,KAAK,EAAE,IAAA,cAAO,EAAC,IAAA,eAAO,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,EAC3E,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAtBW,QAAA,aAAa,iBAsBxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Configures Google Antigravity: merges the nram MCP server into the
|
|
4
|
+
* user-level mcp_config.json (Antigravity documents project-local MCP config
|
|
5
|
+
* as read-but-ignored, and uses `serverUrl` rather than `url`) and upserts
|
|
6
|
+
* the agent instructions into the AGENTS.md Antigravity reads. AGENTS.md is
|
|
7
|
+
* used instead of GEMINI.md deliberately: Antigravity and Gemini CLI both
|
|
8
|
+
* write GEMINI.md, a documented conflict
|
|
9
|
+
*
|
|
10
|
+
* @param options the collected setup options
|
|
11
|
+
*/
|
|
12
|
+
export declare const configure_antigravity: (options: SetupOptions) => Promise<ActionResult[]>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.configure_antigravity = void 0;
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const types_1 = require("../../types");
|
|
25
|
+
const paths_1 = require("../paths");
|
|
26
|
+
const upsert_1 = require("../upsert");
|
|
27
|
+
/**
|
|
28
|
+
* Configures Google Antigravity: merges the nram MCP server into the
|
|
29
|
+
* user-level mcp_config.json (Antigravity documents project-local MCP config
|
|
30
|
+
* as read-but-ignored, and uses `serverUrl` rather than `url`) and upserts
|
|
31
|
+
* the agent instructions into the AGENTS.md Antigravity reads. AGENTS.md is
|
|
32
|
+
* used instead of GEMINI.md deliberately: Antigravity and Gemini CLI both
|
|
33
|
+
* write GEMINI.md, a documented conflict
|
|
34
|
+
*
|
|
35
|
+
* @param options the collected setup options
|
|
36
|
+
*/
|
|
37
|
+
const configure_antigravity = async (options) => {
|
|
38
|
+
const results = [];
|
|
39
|
+
if (options.mcp_url !== undefined) {
|
|
40
|
+
if (options.scope !== types_1.Scope.USER) {
|
|
41
|
+
results.push({
|
|
42
|
+
action: 'MCP registration',
|
|
43
|
+
kind: 'skipped',
|
|
44
|
+
detail: 'Antigravity documents project-local MCP config as read-but-ignored; ' +
|
|
45
|
+
'rerun at user scope to register the server'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const config_path = (0, path_1.resolve)((0, paths_1.antigravity_dir)(), 'mcp_config.json');
|
|
50
|
+
const mcp = (0, upsert_1.mcp_json_result)(config_path, ['mcpServers', 'nram'], { serverUrl: options.mcp_url });
|
|
51
|
+
results.push(mcp);
|
|
52
|
+
if (mcp.kind !== 'manual') {
|
|
53
|
+
if (options.api_key !== undefined) {
|
|
54
|
+
results.push((0, upsert_1.api_key_header_manual_result)(config_path));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
results.push({
|
|
58
|
+
action: 'Authentication',
|
|
59
|
+
kind: 'manual',
|
|
60
|
+
detail: 'Antigravity does not support MCP OAuth (as of June 2026), and nram requires ' +
|
|
61
|
+
'authentication; create an nram API key and add it as an Authorization header in ' +
|
|
62
|
+
`${config_path}, or rerun this tool choosing API-key authentication`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (options.instructions) {
|
|
69
|
+
results.push((0, upsert_1.agents_md_result)((0, paths_1.agents_md_path)(options.scope, (0, path_1.resolve)((0, paths_1.gemini_dir)(), 'AGENTS.md')), options.instructions.full));
|
|
70
|
+
}
|
|
71
|
+
return results;
|
|
72
|
+
};
|
|
73
|
+
exports.configure_antigravity = configure_antigravity;
|
|
74
|
+
//# sourceMappingURL=antigravity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antigravity.js","sourceRoot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WAAW,CAAC,CAAC,CAAC;gBAC5D,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,IAAI,CAAC;wBACT,MAAM,EAAE,gBAAgB;wBACxB,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE,8EAA8E;4BAClF,kFAAkF;4BAClF,GAAG,WAAW,sDAAsD;qBAC3E,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAA,yBAAgB,EACzB,IAAA,sBAAc,EAAC,OAAO,CAAC,KAAK,EAAE,IAAA,cAAO,EAAC,IAAA,kBAAU,GAAE,EAAE,WAAW,CAAC,CAAC,EACjE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAzCW,QAAA,qBAAqB,yBAyChC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Configures Claude Code: registers the nram MCP server via the documented
|
|
4
|
+
* `claude mcp add` CLI and injects the agent-instructions SessionStart hook
|
|
5
|
+
* into settings.json at the requested scope
|
|
6
|
+
*
|
|
7
|
+
* @param options the collected setup options
|
|
8
|
+
*/
|
|
9
|
+
export declare const configure_claude_code: (options: SetupOptions) => Promise<ActionResult[]>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.configure_claude_code = void 0;
|
|
23
|
+
const child_process_1 = require("child_process");
|
|
24
|
+
const path_1 = require("path");
|
|
25
|
+
const types_1 = require("../../types");
|
|
26
|
+
const paths_1 = require("../paths");
|
|
27
|
+
const upsert_1 = require("../upsert");
|
|
28
|
+
/**
|
|
29
|
+
* Runs the `claude` CLI with the supplied arguments
|
|
30
|
+
*
|
|
31
|
+
* On Windows the CLI is commonly an `.exe` or an npm `.cmd` shim; the latter
|
|
32
|
+
* is only executable through a shell, so we shell out there and quote each
|
|
33
|
+
* argument ourselves (callers must never pass arguments containing `"`)
|
|
34
|
+
*
|
|
35
|
+
* @param args the CLI arguments
|
|
36
|
+
*/
|
|
37
|
+
const run_claude = (args) => {
|
|
38
|
+
const use_shell = process.platform === 'win32';
|
|
39
|
+
const final_args = use_shell ? args.map(arg => `"${arg}"`) : args;
|
|
40
|
+
const result = (0, child_process_1.spawnSync)('claude', final_args, {
|
|
41
|
+
shell: use_shell,
|
|
42
|
+
encoding: 'utf8',
|
|
43
|
+
windowsHide: true,
|
|
44
|
+
timeout: 30_000
|
|
45
|
+
});
|
|
46
|
+
const missing = result.error !== undefined || result.status === null;
|
|
47
|
+
return {
|
|
48
|
+
ok: result.status === 0,
|
|
49
|
+
missing,
|
|
50
|
+
output: `${result.stdout ?? ''}${result.stderr ?? ''}`.trim()
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Registers the nram MCP server via the documented `claude mcp add` CLI,
|
|
55
|
+
* guarded by `claude mcp get nram` so re-runs never double-add
|
|
56
|
+
*
|
|
57
|
+
* @param scope the CLI scope flag value
|
|
58
|
+
* @param mcp_url the MCP endpoint URL
|
|
59
|
+
* @param api_key the API key, when API-key authentication was chosen
|
|
60
|
+
*/
|
|
61
|
+
const claude_mcp_result = (scope, mcp_url, api_key) => {
|
|
62
|
+
const add_args = ['mcp', 'add', '--scope', scope, '--transport', 'http', 'nram', mcp_url];
|
|
63
|
+
if (api_key !== undefined) {
|
|
64
|
+
add_args.push('--header', `Authorization: Bearer ${api_key}`);
|
|
65
|
+
}
|
|
66
|
+
const manual_command = `claude ${add_args.join(' ')}`;
|
|
67
|
+
if (add_args.some(arg => arg.includes('"'))) {
|
|
68
|
+
return {
|
|
69
|
+
action: 'MCP registration',
|
|
70
|
+
kind: 'failed',
|
|
71
|
+
detail: 'refusing to run: argument contains a double quote'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const existing = run_claude(['mcp', 'get', 'nram']);
|
|
75
|
+
if (existing.missing) {
|
|
76
|
+
return {
|
|
77
|
+
action: 'MCP registration',
|
|
78
|
+
kind: 'manual',
|
|
79
|
+
detail: `the claude CLI was not found on PATH; run this yourself: ${manual_command}`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (existing.ok) {
|
|
83
|
+
return {
|
|
84
|
+
action: 'MCP registration',
|
|
85
|
+
kind: 'skipped',
|
|
86
|
+
detail: 'an MCP server named "nram" is already registered (claude mcp get nram)'
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const added = run_claude(add_args);
|
|
90
|
+
if (added.ok) {
|
|
91
|
+
return { action: 'MCP registration', kind: 'written', detail: manual_command };
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
action: 'MCP registration',
|
|
95
|
+
kind: 'failed',
|
|
96
|
+
detail: `claude mcp add failed: ${added.output || 'unknown error'}; ` +
|
|
97
|
+
`run this yourself: ${manual_command}`
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Configures Claude Code: registers the nram MCP server via the documented
|
|
102
|
+
* `claude mcp add` CLI and injects the agent-instructions SessionStart hook
|
|
103
|
+
* into settings.json at the requested scope
|
|
104
|
+
*
|
|
105
|
+
* @param options the collected setup options
|
|
106
|
+
*/
|
|
107
|
+
const configure_claude_code = async (options) => {
|
|
108
|
+
const results = [];
|
|
109
|
+
if (options.mcp_url !== undefined) {
|
|
110
|
+
const scope = options.scope === types_1.Scope.USER ? 'user' : 'project';
|
|
111
|
+
results.push(claude_mcp_result(scope, options.mcp_url, options.api_key));
|
|
112
|
+
}
|
|
113
|
+
if (options.instructions) {
|
|
114
|
+
results.push((0, upsert_1.upsert_hooks_json)((0, path_1.resolve)((0, paths_1.claude_dir)(options.scope), 'settings.json'), options.base_url));
|
|
115
|
+
}
|
|
116
|
+
return results;
|
|
117
|
+
};
|
|
118
|
+
exports.configure_claude_code = configure_claude_code;
|
|
119
|
+
//# sourceMappingURL=claude_code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude_code.js","sourceRoot":"","sources":["../../../src/helpers/configure/claude_code.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAA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;;GAMG;AACI,MAAM,qBAAqB,GAAG,KAAK,EAAE,OAAqB,EAA2B,EAAE;IAC1F,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,aAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAEhE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAA,0BAAiB,EAAC,IAAA,cAAO,EAAC,IAAA,kBAAU,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3G,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the marker-fenced `[mcp_servers.nram]` TOML block. In API-key mode
|
|
4
|
+
* the key itself is never written to disk; the file references the
|
|
5
|
+
* NRAM_API_KEY environment variable instead
|
|
6
|
+
*
|
|
7
|
+
* @param mcp_url the MCP endpoint URL
|
|
8
|
+
* @param api_key the API key, when API-key authentication was chosen
|
|
9
|
+
*/
|
|
10
|
+
export declare const codex_mcp_block: (mcp_url: string, api_key?: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Configures Codex: upserts a marker-fenced `[mcp_servers.nram]` block in
|
|
13
|
+
* config.toml (the `codex mcp add` CLI covers stdio servers only, so remote
|
|
14
|
+
* HTTP servers are written to the file, per the Codex docs) and injects the
|
|
15
|
+
* agent-instructions SessionStart hook into hooks.json
|
|
16
|
+
*
|
|
17
|
+
* @param options the collected setup options
|
|
18
|
+
*/
|
|
19
|
+
export declare const configure_codex: (options: SetupOptions) => Promise<ActionResult[]>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.configure_codex = exports.codex_mcp_block = void 0;
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const smol_toml_1 = require("smol-toml");
|
|
25
|
+
const paths_1 = require("../paths");
|
|
26
|
+
const upsert_1 = require("../upsert");
|
|
27
|
+
/**
|
|
28
|
+
* Builds the marker-fenced `[mcp_servers.nram]` TOML block. In API-key mode
|
|
29
|
+
* the key itself is never written to disk; the file references the
|
|
30
|
+
* NRAM_API_KEY environment variable instead
|
|
31
|
+
*
|
|
32
|
+
* @param mcp_url the MCP endpoint URL
|
|
33
|
+
* @param api_key the API key, when API-key authentication was chosen
|
|
34
|
+
*/
|
|
35
|
+
const codex_mcp_block = (mcp_url, api_key) => {
|
|
36
|
+
const lines = [
|
|
37
|
+
'[mcp_servers.nram]',
|
|
38
|
+
`url = "${mcp_url}"`
|
|
39
|
+
];
|
|
40
|
+
if (api_key !== undefined) {
|
|
41
|
+
lines.push('bearer_token_env_var = "NRAM_API_KEY"');
|
|
42
|
+
}
|
|
43
|
+
return lines.join('\n');
|
|
44
|
+
};
|
|
45
|
+
exports.codex_mcp_block = codex_mcp_block;
|
|
46
|
+
/**
|
|
47
|
+
* Configures Codex: upserts a marker-fenced `[mcp_servers.nram]` block in
|
|
48
|
+
* config.toml (the `codex mcp add` CLI covers stdio servers only, so remote
|
|
49
|
+
* HTTP servers are written to the file, per the Codex docs) and injects the
|
|
50
|
+
* agent-instructions SessionStart hook into hooks.json
|
|
51
|
+
*
|
|
52
|
+
* @param options the collected setup options
|
|
53
|
+
*/
|
|
54
|
+
const configure_codex = async (options) => {
|
|
55
|
+
const results = [];
|
|
56
|
+
if (options.mcp_url !== undefined) {
|
|
57
|
+
const config_path = (0, path_1.resolve)((0, paths_1.codex_dir)(options.scope), 'config.toml');
|
|
58
|
+
const mcp = (0, upsert_1.upsert_block_with_validation)(config_path, (0, exports.codex_mcp_block)(options.mcp_url, options.api_key), smol_toml_1.parse, 'TOML', (parsed, text) => parsed?.mcp_servers?.nram !== undefined && !(0, upsert_1.has_marker_block)(text, 'hash')
|
|
59
|
+
? {
|
|
60
|
+
action: 'MCP registration',
|
|
61
|
+
kind: 'skipped',
|
|
62
|
+
detail: `[mcp_servers.nram] already exists in ${config_path} (outside the nram setup markers)`
|
|
63
|
+
}
|
|
64
|
+
: undefined, parsed => parsed?.mcp_servers?.nram !== undefined);
|
|
65
|
+
results.push(mcp);
|
|
66
|
+
if ((mcp.kind === 'written' || mcp.kind === 'updated') && options.api_key !== undefined) {
|
|
67
|
+
results.push((0, upsert_1.api_key_manual_result)());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (options.instructions) {
|
|
71
|
+
results.push((0, upsert_1.upsert_hooks_json)((0, path_1.resolve)((0, paths_1.codex_dir)(options.scope), 'hooks.json'), options.base_url));
|
|
72
|
+
}
|
|
73
|
+
return results;
|
|
74
|
+
};
|
|
75
|
+
exports.configure_codex = configure_codex;
|
|
76
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/helpers/configure/codex.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AAEZ,+BAA+B;AAC/B,yCAAkC;AAElC,oCAAqC;AACrC,sCAKmB;AAEnB;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,OAAgB,EAAU,EAAE;IACzE,MAAM,KAAK,GAAG;QACV,oBAAoB;QACpB,UAAU,OAAO,GAAG;KACvB,CAAC;IAEF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,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,iBAAS,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAjCW,QAAA,eAAe,mBAiC1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Configures GitHub Copilot CLI: merges the nram MCP server into the
|
|
4
|
+
* user-level mcp-config.json (Copilot CLI has no repo-level MCP config) and
|
|
5
|
+
* upserts the agent instructions into the files Copilot CLI documents:
|
|
6
|
+
* `$HOME/.copilot/copilot-instructions.md` at user scope and the repository
|
|
7
|
+
* root AGENTS.md at project scope
|
|
8
|
+
*
|
|
9
|
+
* @param options the collected setup options
|
|
10
|
+
*/
|
|
11
|
+
export declare const configure_copilot: (options: SetupOptions) => Promise<ActionResult[]>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026, Brandon Lehmann <brandonlehmann@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.configure_copilot = void 0;
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const types_1 = require("../../types");
|
|
25
|
+
const paths_1 = require("../paths");
|
|
26
|
+
const upsert_1 = require("../upsert");
|
|
27
|
+
/**
|
|
28
|
+
* Configures GitHub Copilot CLI: merges the nram MCP server into the
|
|
29
|
+
* user-level mcp-config.json (Copilot CLI has no repo-level MCP config) and
|
|
30
|
+
* upserts the agent instructions into the files Copilot CLI documents:
|
|
31
|
+
* `$HOME/.copilot/copilot-instructions.md` at user scope and the repository
|
|
32
|
+
* root AGENTS.md at project scope
|
|
33
|
+
*
|
|
34
|
+
* @param options the collected setup options
|
|
35
|
+
*/
|
|
36
|
+
const configure_copilot = async (options) => {
|
|
37
|
+
const results = [];
|
|
38
|
+
if (options.mcp_url !== undefined) {
|
|
39
|
+
if (options.scope !== types_1.Scope.USER) {
|
|
40
|
+
results.push({
|
|
41
|
+
action: 'MCP registration',
|
|
42
|
+
kind: 'skipped',
|
|
43
|
+
detail: 'Copilot CLI stores MCP servers in the user-level mcp-config.json only; rerun at user scope'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const config_path = (0, path_1.resolve)((0, paths_1.copilot_dir)(), 'mcp-config.json');
|
|
48
|
+
const mcp = (0, upsert_1.mcp_json_result)(config_path, ['servers', 'nram'], {
|
|
49
|
+
type: 'http',
|
|
50
|
+
url: options.mcp_url
|
|
51
|
+
});
|
|
52
|
+
results.push(mcp);
|
|
53
|
+
if (mcp.kind !== 'manual' && options.api_key !== undefined) {
|
|
54
|
+
results.push((0, upsert_1.api_key_header_manual_result)(config_path));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (options.instructions) {
|
|
59
|
+
results.push((0, upsert_1.agents_md_result)((0, paths_1.agents_md_path)(options.scope, (0, path_1.resolve)((0, paths_1.copilot_dir)(), 'copilot-instructions.md')), options.instructions.full));
|
|
60
|
+
}
|
|
61
|
+
return results;
|
|
62
|
+
};
|
|
63
|
+
exports.configure_copilot = configure_copilot;
|
|
64
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/helpers/configure/copilot.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;;;AAEZ,+BAA+B;AAC/B,uCAAgE;AAChE,oCAAuD;AACvD,sCAA4F;AAE5F;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,OAAqB,EAA2B,EAAE;IACtF,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,KAAK,KAAK,aAAK,CAAC,IAAI,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC;gBACT,MAAM,EAAE,kBAAkB;gBAC1B,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,4FAA4F;aACvG,CAAC,CAAC;QACP,CAAC;aAAM,CAAC;YACJ,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,IAAA,mBAAW,GAAE,EAAE,iBAAiB,CAAC,CAAC;YAE9D,MAAM,GAAG,GAAG,IAAA,wBAAe,EAAC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE;gBAC1D,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,OAAO,CAAC,OAAO;aACvB,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAElB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACzD,OAAO,CAAC,IAAI,CAAC,IAAA,qCAA4B,EAAC,WAAW,CAAC,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAA,yBAAgB,EACzB,IAAA,sBAAc,EAAC,OAAO,CAAC,KAAK,EAAE,IAAA,cAAO,EAAC,IAAA,mBAAW,GAAE,EAAE,yBAAyB,CAAC,CAAC,EAChF,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAjCW,QAAA,iBAAiB,qBAiC5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ActionResult, SetupOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `mcpServers.nram` entry for Cursor's mcp.json. In API-key mode
|
|
4
|
+
* the key is referenced through Cursor's `${env:...}` interpolation, never
|
|
5
|
+
* written to disk
|
|
6
|
+
*
|
|
7
|
+
* @param mcp_url the MCP endpoint URL
|
|
8
|
+
* @param api_key the API key, when API-key authentication was chosen
|
|
9
|
+
*/
|
|
10
|
+
export declare const cursor_mcp_entry: (mcp_url: string, api_key?: string) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Builds the project rule file (`.cursor/rules/nram.mdc`) carrying the agent
|
|
13
|
+
* instructions; `alwaysApply: true` injects it into every Agent conversation
|
|
14
|
+
*
|
|
15
|
+
* @param instructions the agent instructions text
|
|
16
|
+
*/
|
|
17
|
+
export declare const cursor_rule_file: (instructions: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Configures Cursor: merges the nram MCP server into mcp.json and, at project
|
|
20
|
+
* scope, writes the agent instructions as `.cursor/rules/nram.mdc`
|
|
21
|
+
* (`.cursorrules` is deprecated; user-level rules live only in the Cursor
|
|
22
|
+
* settings GUI, so the instruction half is reported and skipped at user scope)
|
|
23
|
+
*
|
|
24
|
+
* @param options the collected setup options
|
|
25
|
+
*/
|
|
26
|
+
export declare const configure_cursor: (options: SetupOptions) => Promise<ActionResult[]>;
|