@ashulab/agent-forge 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AshuLab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # Agent Forge
2
+
3
+ A small CLI for launching coding agents (`claude`, `codex`, `antigravity`) with a
4
+ **GitHub App identity** and a provider CLI chosen at runtime.
5
+
6
+ On each run the launcher:
7
+
8
+ - reads agent metadata from `agents.json`
9
+ - generates a GitHub App installation token
10
+ - detects installed provider CLIs on your PATH
11
+ - asks which provider to use (or takes it from a flag)
12
+ - starts the provider with the GitHub token and a per-agent git identity injected
13
+ into the environment
14
+ - writes the agent's `systemPrompt` into the provider's startup memory file
15
+ (`CLAUDE.md` / `AGENTS.md`) so subagents inherit the identity
16
+
17
+ Provider auth stays in the provider CLI — the launcher never handles provider API keys.
18
+
19
+ ## Requirements
20
+
21
+ - Node.js 24+
22
+ - a GitHub App with an installation on the target account/org —
23
+ [how to create one](docs/github-app.md)
24
+ - the App private key stored locally (e.g. in `~/.ssh`)
25
+ - one of these provider CLIs on your PATH: `claude`, `codex`, `agy` (antigravity)
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ pnpm add -g @ashulab/agent-forge
31
+ ```
32
+
33
+ Or run without installing:
34
+
35
+ ```bash
36
+ pnpm dlx @ashulab/agent-forge --help
37
+ ```
38
+
39
+ ## Configuration
40
+
41
+ Your agents live in a single machine-global registry — you launch the tool from
42
+ inside each target repo, but the identities are not per-repo. The launcher reads
43
+ `agents.json` from the first of these that exists:
44
+
45
+ 1. `$AGENT_FORGE_CONFIG`
46
+ 2. `~/.config/agent-forge/agents.json` — the global registry (`agent-forge add` writes here)
47
+ 3. `./agents.json` — only if it already exists
48
+
49
+ The easiest path is `agent-forge add` (see below), which creates the global
50
+ file for you. Do **not** drop `agents.json` into a project you run the agent in:
51
+ it holds real App / installation IDs and private-key paths and must stay out of
52
+ version control.
53
+
54
+ The shape, for reference — the `"$schema"` line points at the published schema so
55
+ any editor that understands JSON Schema gives you field descriptions,
56
+ required-field checks and typo detection:
57
+
58
+ ```json
59
+ {
60
+ "$schema": "https://raw.githubusercontent.com/AshuLab/agent-forge/main/schema/agents.schema.json",
61
+ "agents": [
62
+ {
63
+ "name": "ops-agent",
64
+ "label": "Ops Agent",
65
+ "appId": "123456",
66
+ "installationId": "987654",
67
+ "botName": "ops-agent",
68
+ "privateKeyPath": "~/.ssh/ops-agent.private-key.pem",
69
+ "systemPrompt": "You are Ops Agent, a senior DevOps engineer. Prefer safe, minimal changes and explain operational risks clearly."
70
+ }
71
+ ]
72
+ }
73
+ ```
74
+
75
+ - `botId` is optional. When omitted it is resolved from the GitHub API using
76
+ `botName` so the git author email links commits to the bot. Set it explicitly
77
+ only to skip that lookup (e.g. offline).
78
+ - Do not put provider-specific config here — providers are auto-detected from PATH.
79
+
80
+ ### Least-privilege tokens (optional)
81
+
82
+ By default the installation token carries the full installation scope. Narrow it
83
+ per agent with either or both of:
84
+
85
+ ```json
86
+ {
87
+ "repositories": ["some-repo", "another-repo"],
88
+ "permissions": { "contents": "write", "pull_requests": "write" }
89
+ }
90
+ ```
91
+
92
+ ## Add an agent
93
+
94
+ You need a GitHub App first — its **App ID**, a **private key**, and an
95
+ **installation**. If you don't have one yet, follow
96
+ [docs/github-app.md](docs/github-app.md).
97
+
98
+ ### Guided (recommended)
99
+
100
+ ```bash
101
+ agent-forge add
102
+ ```
103
+
104
+ You provide the **GitHub App ID** and the **path to its private key**. The wizard
105
+ derives the rest from the GitHub API — slug (`botName`), bot user id, and the
106
+ installation (auto-selected when there is only one) — asks for a label and an
107
+ optional system prompt, mints a test token to confirm it works, and writes the
108
+ entry. It writes to the resolved config path — the global registry
109
+ (`~/.config/agent-forge/agents.json`) unless `$AGENT_FORGE_CONFIG` or an
110
+ existing `./agents.json` redirects it.
111
+
112
+ ### Manual
113
+
114
+ Copy one agent object inside the `agents` array and set unique values for `name`,
115
+ `label`, `appId`, `installationId`, `botName`, `privateKeyPath`. Make sure the
116
+ private key file exists and is readable.
117
+
118
+ ## Launch
119
+
120
+ Interactive:
121
+
122
+ ```bash
123
+ agent-forge
124
+ ```
125
+
126
+ Direct flags (passing both skips all prompts; passing one pre-fills it):
127
+
128
+ ```bash
129
+ agent-forge --agent ops-agent --provider claude
130
+ agent-forge --agent review-agent --provider codex
131
+ ```
132
+
133
+ Other commands:
134
+
135
+ ```bash
136
+ agent-forge --list
137
+ agent-forge --help
138
+ ```
139
+
140
+ ### Provider-specific prompt behavior
141
+
142
+ - `claude`: passed via `--append-system-prompt` (lands in the real system prompt)
143
+ - `codex` / `antigravity` (`agy`): no CLI flag — identity comes from `AGENTS.md`
144
+ only (`agy --prompt` is headless `--print`; a codex positional arg is a fake
145
+ first user turn)
146
+
147
+ The launcher also writes `systemPrompt` into the provider's startup memory file
148
+ in the working directory (`CLAUDE.md` for claude, `AGENTS.md` for codex and
149
+ antigravity), inside a managed `agent-forge:identity` block. This keeps the
150
+ identity in place for subagents the provider spawns, not just its main thread.
151
+ The block is rewritten on each run and safe to keep in version control.
152
+
153
+ ## Token refresh
154
+
155
+ Installation tokens last ~1 hour. For longer sessions, print a fresh one on demand:
156
+
157
+ ```bash
158
+ export GH_TOKEN=$(agent-forge token --agent ops-agent)
159
+ ```
160
+
161
+ Or wire it into git as a credential helper so pushes never see a stale token:
162
+
163
+ ```bash
164
+ git config credential.https://github.com.helper \
165
+ '!f() { test "$1" = get && echo username=x-access-token && echo "password=$(agent-forge token --agent ops-agent)"; }; f'
166
+ ```
167
+
168
+ ## Contributing
169
+
170
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) and [AGENTS.md](./AGENTS.md).
171
+
172
+ ## License
173
+
174
+ [MIT](./LICENSE)