@npxstack/npxforge 0.0.0-stage → 0.2.31
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 +177 -0
- package/README.md +274 -2
- package/SECURITY.md +38 -0
- package/bundled-skills/caveman/SKILL.md +35 -0
- package/bundled-skills/session-continuity/SKILL.md +73 -0
- package/bundled-skills/token-economy/SKILL.md +29 -0
- package/dist/index.js +7065 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control systems,
|
|
56
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
57
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
58
|
+
excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
69
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
70
|
+
Work and such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
(except as stated in this section) patent license to make, have made,
|
|
76
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
77
|
+
where such license applies only to those patent claims licensable
|
|
78
|
+
by such Contributor that are necessarily infringed by their
|
|
79
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
80
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
81
|
+
institute patent litigation against any entity (including a
|
|
82
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
83
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
84
|
+
or contributory patent infringement, then any patent licenses
|
|
85
|
+
granted to You under this License for that Work shall terminate
|
|
86
|
+
as of the date such litigation is filed.
|
|
87
|
+
|
|
88
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
89
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
90
|
+
modifications, and in Source or Object form, provided that You
|
|
91
|
+
meet the following conditions:
|
|
92
|
+
|
|
93
|
+
(a) You must give any other recipients of the Work or
|
|
94
|
+
Derivative Works a copy of this License; and
|
|
95
|
+
|
|
96
|
+
(b) You must cause any modified files to carry prominent notices
|
|
97
|
+
stating that You changed the files; and
|
|
98
|
+
|
|
99
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
100
|
+
that You distribute, all copyright, patent, trademark, and
|
|
101
|
+
attribution notices from the Source form of the Work,
|
|
102
|
+
excluding those notices that do not pertain to any part of
|
|
103
|
+
the Derivative Works; and
|
|
104
|
+
|
|
105
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
106
|
+
distribution, then any Derivative Works that You distribute must
|
|
107
|
+
include a readable copy of the attribution notices contained
|
|
108
|
+
within such NOTICE file, excluding those notices that do not
|
|
109
|
+
pertain to any part of the Derivative Works, in at least one
|
|
110
|
+
of the following places: within a NOTICE text file distributed
|
|
111
|
+
as part of the Derivative Works; within the Source form or
|
|
112
|
+
documentation, if provided along with the Derivative Works; or,
|
|
113
|
+
within a display generated by the Derivative Works, if and
|
|
114
|
+
wherever such third-party notices normally appear. The contents
|
|
115
|
+
of the NOTICE file are for informational purposes only and
|
|
116
|
+
do not modify the License. You may add Your own attribution
|
|
117
|
+
notices within Derivative Works that You distribute, alongside
|
|
118
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
119
|
+
that such additional attribution notices cannot be construed
|
|
120
|
+
as modifying the License.
|
|
121
|
+
|
|
122
|
+
You may add Your own copyright statement to Your modifications and
|
|
123
|
+
may provide additional or different license terms and conditions
|
|
124
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
125
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
126
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
127
|
+
the conditions stated in this License.
|
|
128
|
+
|
|
129
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
130
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
131
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
132
|
+
this License, without any additional terms or conditions.
|
|
133
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
134
|
+
the terms of any separate license agreement you may have executed
|
|
135
|
+
with Licensor regarding such Contributions.
|
|
136
|
+
|
|
137
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
138
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
139
|
+
except as required for reasonable and customary use in describing the
|
|
140
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
141
|
+
|
|
142
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
143
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
144
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
145
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
146
|
+
implied, including, without limitation, any warranties or conditions
|
|
147
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
148
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
149
|
+
appropriateness of using or redistributing the Work and assume any
|
|
150
|
+
risks associated with Your exercise of permissions under this License.
|
|
151
|
+
|
|
152
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
153
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
154
|
+
unless required by applicable law (such as deliberate and grossly
|
|
155
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
156
|
+
liable to You for damages, including any direct, indirect, special,
|
|
157
|
+
incidental, or exemplary damages of any character arising as a
|
|
158
|
+
result of this License or out of the use or inability to use the
|
|
159
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
160
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
161
|
+
other commercial damages or losses), even if such Contributor
|
|
162
|
+
has been advised of the possibility of such damages.
|
|
163
|
+
|
|
164
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
165
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
166
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
167
|
+
or other liability obligations and/or rights consistent with this
|
|
168
|
+
License. However, in accepting such obligations, You may act only
|
|
169
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
170
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
171
|
+
defend, and hold each Contributor harmless for any liability
|
|
172
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
173
|
+
of your accepting any such warranty or additional liability.
|
|
174
|
+
|
|
175
|
+
END OF TERMS AND CONDITIONS
|
|
176
|
+
|
|
177
|
+
Copyright 2026 Npxstack Forge Authors
|
package/README.md
CHANGED
|
@@ -1,3 +1,275 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Npxstack Forge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Local-first, hybrid AI coding CLI agent**
|
|
4
|
+
> Autonomous coding, testing, reviewing, and checkpointing with zero host sprawl.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@npxstack/npxforge)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
**Npxstack Forge** (`npxforge`) is a local-first personal coding agent CLI that orchestrates the entire development lifecycle on your machine:
|
|
14
|
+
- **Preflight & Inspection**: Detects project stack, package managers, and test scripts.
|
|
15
|
+
- **Structured Planning**: Analyzes repository architecture and drafts a verified plan.
|
|
16
|
+
- **Safe Implementation**: Executes file modifications and patches via strict security guards (`PathGuard`, `CommandPolicy`).
|
|
17
|
+
- **Autonomous Testing**: Runs project tests, capturing output within bounded buffers.
|
|
18
|
+
- **Review & Repair**: Evaluates Git diffs and repairs regressions iteratively up to bounded safety limits.
|
|
19
|
+
- **Persistent Ledger**: Records runs, events, model calls, and snapshots in a local SQLite ledger (`~/.npxforge/npxforge.sqlite`).
|
|
20
|
+
- **Project folder**: Per-repo session, handoff, and skills live under `.npxforge/` (legacy `.forge/` still read).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Canonical Naming & Conventions
|
|
25
|
+
|
|
26
|
+
| Property | Canonical Value | Notes / Fallbacks |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| **Product / Display Name** | `Npxstack Forge` | Formal product name |
|
|
29
|
+
| **npm Package** | `@npxstack/npxforge` | Published CLI package |
|
|
30
|
+
| **CLI Executable** | `npxforge` | Product display name remains Forge |
|
|
31
|
+
| **Project Directory** | `.npxforge/` | Legacy `.forge/` still read if present |
|
|
32
|
+
| **Config Directory** | `~/.npxforge/` | Auto-detects & migrates legacy `~/.config/forge-agent/` / `%APPDATA%\forge-agent\` |
|
|
33
|
+
| **Database File** | `npxforge.sqlite` | Auto-migrates existing `forge.sqlite` history |
|
|
34
|
+
| **Environment Variable Prefix** | `NPXSTACK_FORGE_` | Legacy `FORGE_` prefix supported as fallback |
|
|
35
|
+
| **Repository Slug** | `forge` | Workspace root identifier |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Installation & Quick Start
|
|
40
|
+
|
|
41
|
+
### 1. One-line Shell Installer (Recommended)
|
|
42
|
+
|
|
43
|
+
* **Windows (PowerShell):**
|
|
44
|
+
```powershell
|
|
45
|
+
irm https://cli.npxstack.com/forge | iex
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
* **macOS / Linux:**
|
|
49
|
+
```bash
|
|
50
|
+
curl -fsSL https://cli.npxstack.com/forge/install.sh | bash
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
* **Or via npm globally:**
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g @npxstack/npxforge
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Platform URLs
|
|
59
|
+
|
|
60
|
+
| Role | URL |
|
|
61
|
+
|---|---|
|
|
62
|
+
| Company | https://npxstack.com |
|
|
63
|
+
| Forge product / dashboard / CLI auth | https://forge.npxstack.com |
|
|
64
|
+
| Cloud API (canonical) | https://api.npxstack.com |
|
|
65
|
+
| CLI installers | https://cli.npxstack.com |
|
|
66
|
+
|
|
67
|
+
Sign in (recommended):
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npxforge auth login
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Opens `forge.npxstack.com/cli/auth` → Google sign-in → **Authorize CLI**.
|
|
74
|
+
Legacy configs that still point at `gateway.npxstack.com`, `gateway.npxstack.dev`, or `forge.npxstack.dev` are auto-rewritten to `api.npxstack.com`.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### 2. Launch Interactive Terminal Agent (Like Claude Code)
|
|
79
|
+
|
|
80
|
+
Once installed, just type `npxforge` in any project directory:
|
|
81
|
+
|
|
82
|
+
On first launch in a folder, Forge asks **Do you trust the files in this folder?** (saved under `~/.npxforge/trusted-folders.json`). Home-directory trust is session-only. CI/non-TTY: pass `--trust` or set `NPXSTACK_FORGE_TRUST_ALL=1`.
|
|
83
|
+
|
|
84
|
+
See [SECURITY.md](./SECURITY.md) for workspace trust and Socket.dev dependency notes (`better-sqlite3` install scripts are expected for the local SQLite ledger).
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npxforge
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This launches the full **Interactive Terminal Session**:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
╭────────────────────────────────────────────────────────────────────────╮
|
|
94
|
+
│ 🔨 Npxstack Forge v0.2.12 — Autonomous AI Terminal Agent │
|
|
95
|
+
│ Model: coder | Privacy: cloud-ok | Dir: /path/to/project │
|
|
96
|
+
│ Type / or Tab for command list · /help · /exit │
|
|
97
|
+
╰────────────────────────────────────────────────────────────────────────╯
|
|
98
|
+
|
|
99
|
+
npxnpxforge (coder) › /mo
|
|
100
|
+
┌─ suggestions ─────────────────────────────────────────────
|
|
101
|
+
│ › /model Switch AI model (picker or alias)
|
|
102
|
+
│ /models Alias for /model
|
|
103
|
+
└─ ↑↓ select · Tab accept · Enter run/accept · Esc hide ─
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Cursor-style command list:** type `/` (or press **Tab**) to open a filtered suggestion panel with descriptions. Use ↑/↓ to highlight, **Tab**/**Enter** to accept, **Esc** to hide.
|
|
107
|
+
|
|
108
|
+
#### Slash Commands in Interactive Mode
|
|
109
|
+
* `/help` : Show help menu
|
|
110
|
+
* `/model` : List all available models & short aliases
|
|
111
|
+
* `/model <name>` : Switch active model (e.g. `/model coder`, `/model deepseek`, `/model scout`, `/model local`)
|
|
112
|
+
* `/privacy <mode>` : Switch privacy mode (`cloud-ok` หรือ `local-only`)
|
|
113
|
+
* `/diff` : Inspect git changes in current repository
|
|
114
|
+
* `/doctor` : Check environment & provider connectivity
|
|
115
|
+
* `/history` : View past runs in this repo
|
|
116
|
+
* `/clear` : Clear terminal screen
|
|
117
|
+
* `/exit` : Exit session
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### 3. Single-shot Command Mode (CLI Execution)
|
|
122
|
+
|
|
123
|
+
You can also run autonomous tasks directly:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npxforge run "Fix bug in calculateTax" --model coder --yes-safe
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Local Monorepo Development
|
|
130
|
+
```bash
|
|
131
|
+
git clone https://github.com/npxstack/forge.git
|
|
132
|
+
cd forge
|
|
133
|
+
pnpm install
|
|
134
|
+
pnpm build
|
|
135
|
+
pnpm test
|
|
136
|
+
|
|
137
|
+
# Run CLI locally
|
|
138
|
+
pnpm npxforge doctor
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## CLI Commands
|
|
144
|
+
|
|
145
|
+
### 1. Diagnostics (`doctor`)
|
|
146
|
+
Verifies Node.js, Git, local SQLite, Ollama local instance, and Cloud API connectivity:
|
|
147
|
+
```bash
|
|
148
|
+
npxforge doctor
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 2. Autonomous Run (`run`)
|
|
152
|
+
Executes an end-to-end coding task:
|
|
153
|
+
```bash
|
|
154
|
+
npxforge run "Add unit tests for auth middleware" --cwd ./my-project
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Options:**
|
|
158
|
+
- `--cwd <path>`: Target workspace directory (defaults to current directory).
|
|
159
|
+
- `--privacy <mode>`: Privacy mode: `local-only` (Ollama only) or `cloud-ok` (Cloud API / cloud models). Defaults to `cloud-ok`.
|
|
160
|
+
- `--max-cost <usd>`: Per-run USD spending limit.
|
|
161
|
+
- `--max-cycles <n>`: Maximum agent decision cycles (defaults to 60).
|
|
162
|
+
- `--yes-safe`: Auto-approve non-destructive operations.
|
|
163
|
+
|
|
164
|
+
### 3. Inspect Repository (`inspect`)
|
|
165
|
+
Inspects project stack, package manager, and test scripts:
|
|
166
|
+
```bash
|
|
167
|
+
npxforge inspect --cwd ./my-project
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 4. Run History & Details (`runs`, `show`, `diff`)
|
|
171
|
+
```bash
|
|
172
|
+
# List past runs
|
|
173
|
+
npxforge runs
|
|
174
|
+
|
|
175
|
+
# Inspect a specific run
|
|
176
|
+
npxforge show <run-id>
|
|
177
|
+
|
|
178
|
+
# View current workspace Git diff
|
|
179
|
+
npxforge diff
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 5. Cancel & Resume (`cancel`, `resume`)
|
|
183
|
+
```bash
|
|
184
|
+
# Mark an abandoned / in-progress run as CANCELLED in the local ledger
|
|
185
|
+
npxforge cancel <run-id>
|
|
186
|
+
|
|
187
|
+
# Start a new run with the same goal, linked to a prior cancelled/failed/blocked run
|
|
188
|
+
npxforge resume <run-id>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
During an active `run`, press **Ctrl+C** once to request a graceful cancel (finishes the current step, marks the run `CANCELLED`). Press Ctrl+C again to force-exit.
|
|
192
|
+
|
|
193
|
+
### 6. Models & Authentication (`models`, `auth`)
|
|
194
|
+
```bash
|
|
195
|
+
# List supported models and token costs
|
|
196
|
+
npxforge models list
|
|
197
|
+
|
|
198
|
+
# Test model connectivity
|
|
199
|
+
npxforge models test cloudflare/@cf/meta/llama-3.3-70b-instruct-fp8-fast
|
|
200
|
+
|
|
201
|
+
# Sign in via browser (recommended — Claude-style)
|
|
202
|
+
npxforge auth login
|
|
203
|
+
npxforge auth status
|
|
204
|
+
npxforge auth logout
|
|
205
|
+
|
|
206
|
+
# Legacy / CI: paste a token manually
|
|
207
|
+
npxforge auth set-token <token>
|
|
208
|
+
npxforge auth list
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Configuration & Environment Variables
|
|
214
|
+
|
|
215
|
+
### Configuration File (`~/.npxforge/config.json`)
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"defaultPrivacy": "cloud_ok",
|
|
219
|
+
"workspace": {
|
|
220
|
+
"allowAbsoluteCwd": true,
|
|
221
|
+
"protectedPaths": [".git", ".env", ".env.*", "*.pem", "*.key"]
|
|
222
|
+
},
|
|
223
|
+
"models": {
|
|
224
|
+
"planner": "cloudflare/@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
|
225
|
+
"coder": "cloudflare/@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
|
226
|
+
"reviewer": "cloudflare/@cf/meta/llama-3.3-70b-instruct-fp8-fast"
|
|
227
|
+
},
|
|
228
|
+
"gateway": {
|
|
229
|
+
"url": "https://api.npxstack.com",
|
|
230
|
+
"token": ""
|
|
231
|
+
},
|
|
232
|
+
"budget": {
|
|
233
|
+
"maxRunUsd": 1.00,
|
|
234
|
+
"maxDailyUsd": 5.00,
|
|
235
|
+
"maxMonthlyUsd": 30.00,
|
|
236
|
+
"maxCycles": 60,
|
|
237
|
+
"maxRepairCycles": 3,
|
|
238
|
+
"maxWallClockMinutes": 30
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Environment Variables
|
|
244
|
+
All configuration options can be overridden using environment variables prefixed with `NPXSTACK_FORGE_`:
|
|
245
|
+
|
|
246
|
+
| Variable | Description | Legacy Fallback |
|
|
247
|
+
|---|---|---|
|
|
248
|
+
| `NPXSTACK_FORGE_CONFIG_DIR` | Custom config directory path | `FORGE_CONFIG_DIR` |
|
|
249
|
+
| `NPXSTACK_FORGE_API_URL` | Cloud API endpoint (canonical) | `NPXSTACK_FORGE_GATEWAY_URL`, `FORGE_GATEWAY_URL`, `NPXSTACK_FORGE_BROKER_URL` |
|
|
250
|
+
| `NPXSTACK_TOKEN` | Cloud API token (preferred) | `NPXSTACK_FORGE_GATEWAY_TOKEN`, `FORGE_GATEWAY_TOKEN`, `NPXSTACK_FORGE_BROKER_TOKEN` |
|
|
251
|
+
| `NPXSTACK_FORGE_PRIVACY` | Default privacy class (`local_only` or `cloud_ok`) | `FORGE_PRIVACY` |
|
|
252
|
+
| `NPXSTACK_FORGE_MAX_CYCLES` | Maximum decision cycles per run | `FORGE_MAX_CYCLES` |
|
|
253
|
+
| `NPXSTACK_FORGE_MAX_COST` | Maximum USD budget per run | `FORGE_MAX_COST` |
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Backward Compatibility & Migration
|
|
258
|
+
|
|
259
|
+
Npxstack Forge is designed with seamless backward compatibility:
|
|
260
|
+
- **Configuration & Ledger Migration**: If `~/.npxforge/` does not exist but legacy directory `~/.config/forge-agent/` (or `%APPDATA%\forge-agent\`) is found, files (`config.json`, `forge.sqlite`, `secrets.json`) are automatically migrated into `.npxforge/` without deleting or discarding the legacy data.
|
|
261
|
+
- **Database History**: If `forge.sqlite` exists from previous runs, it is copied to `npxforge.sqlite`, retaining all run records, events, checkpoints, and model call metrics.
|
|
262
|
+
- **API host migration**: Config URLs containing `workers.dev`, `forge.npxstack.dev`, `gateway.npxstack.dev`, or `gateway.npxstack.com` are rewritten to `https://api.npxstack.com`.
|
|
263
|
+
- **CLI command**: The published binary is `npxforge` (npm package `@npxstack/npxforge`).
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Documentation & Architecture
|
|
268
|
+
|
|
269
|
+
For product docs and the member dashboard, visit [https://forge.npxstack.com](https://forge.npxstack.com). Company site: [https://npxstack.com](https://npxstack.com).
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT © Npxstack
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Security notes — `@npxstack/npxforge`
|
|
2
|
+
|
|
3
|
+
## Workspace trust
|
|
4
|
+
|
|
5
|
+
Forge asks **Do you trust the files in this folder?** before an interactive session or a headless `run` can read, edit, or execute commands in a directory (Claude Code–style).
|
|
6
|
+
|
|
7
|
+
- Acceptance is saved under `~/.npxforge/trusted-folders.json`
|
|
8
|
+
- Trusting `$HOME` is **session-only** and is not persisted
|
|
9
|
+
- CI: pass `--trust` or set `NPXSTACK_FORGE_TRUST_ALL=1`
|
|
10
|
+
- Manage with `/trust`, `/trust list`, `/trust revoke`
|
|
11
|
+
|
|
12
|
+
## Socket.dev / dependency alerts
|
|
13
|
+
|
|
14
|
+
Published CLI dependencies (runtime):
|
|
15
|
+
|
|
16
|
+
| Package | Why it is there | Typical Socket signal |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `better-sqlite3` | Local audit ledger (`.npxforge/npxforge.sqlite`) | **Install scripts** — runs `prebuild-install \|\| node-gyp rebuild` to ship a native SQLite binding. Expected and required. |
|
|
19
|
+
| `execa` | Bounded shell tool calls under CommandPolicy | May flag process spawn; Forge gates commands via policy + confirmation |
|
|
20
|
+
| `@inquirer/prompts` | Interactive prompts (trust, model picker, auth) | None material |
|
|
21
|
+
| `commander`, `zod`, `diff`, `fast-glob`, `picocolors` | CLI / parsing / UX | None material |
|
|
22
|
+
|
|
23
|
+
### Why we keep `better-sqlite3`
|
|
24
|
+
|
|
25
|
+
The ledger records runs, costs, events, and checkpoints on disk. A native SQLite driver is intentional. Socket’s “install scripts” alert for this package is **expected**, not a supply-chain compromise of `@npxstack/npxforge` itself (our package has **no** `install` / `postinstall` script).
|
|
26
|
+
|
|
27
|
+
Review the published tarball anytime:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm pack @npxstack/npxforge
|
|
31
|
+
tar -tzf npxstack-forge-*.tgz
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Only `dist/`, `package.json`, `README.md`, `LICENSE` ship — no install hooks.
|
|
35
|
+
|
|
36
|
+
### Reporting
|
|
37
|
+
|
|
38
|
+
Security issues: open a private report via the Npxstack org or email the maintainers listed on npm.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: caveman
|
|
3
|
+
description: Terse caveman voice — answer first, fluff gone, technical facts kept verbatim. Use for /caveman, brief mode, less tokens in replies. Off with "stop caveman" or /caveman off.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# caveman
|
|
7
|
+
|
|
8
|
+
Respond terse like smart caveman. All technical substance stay. Only fluff die.
|
|
9
|
+
|
|
10
|
+
Caveman is a **voice**, not broken grammar. Reader pays per token and reads in a terminal. Every word earns its place. Every fact survives.
|
|
11
|
+
|
|
12
|
+
Inspired by the open [caveman](https://github.com/JuliusBrussee/caveman) pattern; adapted for Npxstack Forge.
|
|
13
|
+
|
|
14
|
+
## Persistence
|
|
15
|
+
|
|
16
|
+
Stays on for the Forge session until user says `stop caveman`, `normal mode`, or `/caveman off`.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
|
|
20
|
+
1. **Answer first** — `[thing] [action] [reason]. [next].` No "Sure, I'd be happy to help…"
|
|
21
|
+
2. **Kill ceremony** — no greeting, hedging, recap, closer.
|
|
22
|
+
3. **Short word** — "fix" not "implement a solution for". Standard acronyms OK.
|
|
23
|
+
4. **Articles optional, meaning never** — never drop not/never/no/only/except.
|
|
24
|
+
5. **One idea per sentence** — ~20 words max when possible. Clarity beats compression.
|
|
25
|
+
6. **Payload verbatim** — code, commands, paths, API names, errors exact.
|
|
26
|
+
7. **Tool status bounded** — one line per phase, not a essay between calls.
|
|
27
|
+
8. **User's language** — compress style, not language (Thai stays Thai).
|
|
28
|
+
|
|
29
|
+
## When to break
|
|
30
|
+
|
|
31
|
+
Use full sentences for: security warnings, irreversible confirms, confused user, questions to the user, and anything written to disk (code, handoff, commits). Then resume caveman.
|
|
32
|
+
|
|
33
|
+
## With session-continuity
|
|
34
|
+
|
|
35
|
+
Handoff files **must** use caveman compression for bullets, but **never** shorten paths/errors. `/handoff` writes durable memory; caveman is how that memory stays small.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-continuity
|
|
3
|
+
description: Survive session changes and auto-compact. Write caveman handoff to .npxforge/handoff.md before context dies; resume by reading it first. Use for /handoff, /compact, session change, forget, resume.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Session continuity (compact-proof memory)
|
|
7
|
+
|
|
8
|
+
Chat history is disposable. **`.npxforge/handoff.md` is not.**
|
|
9
|
+
|
|
10
|
+
When context will shrink (auto-compact, `/clear`, new terminal, `/mode` swap mid-task, long REPL), persist goal-state in caveman form, then resume from that file — not from foggy memory.
|
|
11
|
+
|
|
12
|
+
## Triggers
|
|
13
|
+
|
|
14
|
+
- User: handoff, compact, recap, remember this, before clear, new session, don't forget
|
|
15
|
+
- You sense context pressure or economy trim will drop older turns
|
|
16
|
+
- Switching ask ↔ agent while work is unfinished
|
|
17
|
+
|
|
18
|
+
## Save protocol (`/handoff` or `/compact`)
|
|
19
|
+
|
|
20
|
+
1. Read current goal, done / wip / next, locked decisions, blockers, touched files.
|
|
21
|
+
2. Write **caveman** lines to `.npxforge/handoff.md`:
|
|
22
|
+
- Drop articles/filler. Keep paths, cmds, errors, numbers, API names **verbatim**.
|
|
23
|
+
- Never invent facts. Prefer "unknown" over a guess.
|
|
24
|
+
3. Sections (fixed schema):
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
# Forge handoff (caveman)
|
|
28
|
+
updated: <ISO>
|
|
29
|
+
goal: <one line>
|
|
30
|
+
|
|
31
|
+
## done
|
|
32
|
+
- …
|
|
33
|
+
|
|
34
|
+
## wip
|
|
35
|
+
- …
|
|
36
|
+
|
|
37
|
+
## next
|
|
38
|
+
- … ← first actionable step
|
|
39
|
+
|
|
40
|
+
## locked
|
|
41
|
+
- decision = why
|
|
42
|
+
|
|
43
|
+
## blockers
|
|
44
|
+
- …
|
|
45
|
+
|
|
46
|
+
## files
|
|
47
|
+
- path/to/file
|
|
48
|
+
|
|
49
|
+
## notes
|
|
50
|
+
- hard constraints only
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. Tell user: `Handoff saved → .npxforge/handoff.md`. Stop fluff.
|
|
54
|
+
|
|
55
|
+
## Resume protocol (new session / after compact)
|
|
56
|
+
|
|
57
|
+
1. **First tool action:** `read_file` `.npxforge/handoff.md` (if missing, say so — do not invent prior work).
|
|
58
|
+
2. Announce in one line: `Resumed. Goal: … Next: …`
|
|
59
|
+
3. Priority: **blockers → wip → next**. Do not re-explore the whole repo.
|
|
60
|
+
4. Locked decisions stay locked unless user overrides.
|
|
61
|
+
|
|
62
|
+
## Caveman rules for the handoff file
|
|
63
|
+
|
|
64
|
+
- Answer-shaped facts only. No "Sure!", no recap essays.
|
|
65
|
+
- One idea per bullet. ≤20 words when possible.
|
|
66
|
+
- Negations kept (`not` / `never` / `only`).
|
|
67
|
+
- Code/paths/errors byte-accurate.
|
|
68
|
+
|
|
69
|
+
## Anti-amnesia
|
|
70
|
+
|
|
71
|
+
- Do not claim "starting fresh" if handoff exists.
|
|
72
|
+
- Do not re-ask questions already answered in `locked` / `notes`.
|
|
73
|
+
- After each major milestone, refresh handoff (merge, don't wipe `locked`).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: token-economy
|
|
3
|
+
description: Deep playbook for minimizing Cloud API tokens. Always-on defaults already apply; use /skill token-economy when a large coding task needs stricter discipline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Token economy (explicit skill)
|
|
7
|
+
|
|
8
|
+
Forge already enables a compact token-economy profile by default (short replies, truncated tool output, limited history). Use this skill when you want the agent to follow a stricter checklist on a heavy task.
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
|
|
12
|
+
1. **Restate the goal in one line** — then act; do not re-quote the user.
|
|
13
|
+
2. **Map before reading** — `search_code` or `list_dir` on the narrowest path first.
|
|
14
|
+
3. **Read slices** — open only files you will change or cite; skip generated/vendor dirs.
|
|
15
|
+
4. **Plan ≤ 6 bullets** — files, steps, tests; no essay.
|
|
16
|
+
5. **Smallest patch** — prefer `apply_patch` / surgical `write_file`; no drive-by refactors.
|
|
17
|
+
6. **One verification** — run the most relevant test once; do not spam commands.
|
|
18
|
+
7. **Exit early** — when the goal is met, final summary ≤ 5 bullets and stop.
|
|
19
|
+
|
|
20
|
+
## Anti-patterns
|
|
21
|
+
|
|
22
|
+
- Pasting entire files into the reply
|
|
23
|
+
- Re-reading the same file every cycle without new need
|
|
24
|
+
- Exploring unrelated directories "just in case"
|
|
25
|
+
- Long apologies / capability lists / marketing fluff
|
|
26
|
+
|
|
27
|
+
## When to skip this skill
|
|
28
|
+
|
|
29
|
+
Casual `/ask` chat already uses the default economy rules. Do not stack this skill on greetings.
|