@jslee124/forge 0.3.0 → 0.3.2

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.
Files changed (35) hide show
  1. package/dist/index.js +1189 -90
  2. package/package.json +2 -1
  3. package/resources/docs/en/ARCHITECTURE.md +519 -0
  4. package/resources/docs/en/AUTHENTICATION.md +224 -0
  5. package/resources/docs/en/CLI_UI.md +266 -0
  6. package/resources/docs/en/CONFIGURATION.md +263 -0
  7. package/resources/docs/en/CONTEXT_MANAGEMENT.md +692 -0
  8. package/resources/docs/en/GETTING_STARTED.md +241 -0
  9. package/resources/docs/en/PLUGINS.md +622 -0
  10. package/resources/docs/en/PRODUCT.md +157 -0
  11. package/resources/docs/en/PROJECT_CONTEXT.md +225 -0
  12. package/resources/docs/en/RELEASING.md +94 -0
  13. package/resources/docs/en/SECURITY.md +272 -0
  14. package/resources/docs/en/SESSIONS.md +134 -0
  15. package/resources/docs/en/TROUBLESHOOTING.md +256 -0
  16. package/resources/docs/index.json +24334 -0
  17. package/resources/docs/zh-CN/ARCHITECTURE.md +174 -0
  18. package/resources/docs/zh-CN/AUTHENTICATION.md +96 -0
  19. package/resources/docs/zh-CN/CLI_UI.md +112 -0
  20. package/resources/docs/zh-CN/CONFIGURATION.md +221 -0
  21. package/resources/docs/zh-CN/CONTEXT_MANAGEMENT.md +200 -0
  22. package/resources/docs/zh-CN/GETTING_STARTED.md +193 -0
  23. package/resources/docs/zh-CN/PLUGINS.md +286 -0
  24. package/resources/docs/zh-CN/PRODUCT.md +86 -0
  25. package/resources/docs/zh-CN/PROJECT_CONTEXT.md +130 -0
  26. package/resources/docs/zh-CN/RELEASING.md +86 -0
  27. package/resources/docs/zh-CN/SECURITY.md +92 -0
  28. package/resources/docs/zh-CN/SESSIONS.md +69 -0
  29. package/resources/docs/zh-CN/TROUBLESHOOTING.md +185 -0
  30. package/resources/skills/forge-plugin-creator/SKILL.md +70 -0
  31. package/resources/skills/forge-plugin-creator/references/plugin-api.md +36 -0
  32. package/resources/skills/forge-plugin-creator/templates/index.mjs +30 -0
  33. package/resources/skills/forge-plugin-creator/templates/plugin.json +8 -0
  34. package/resources/skills/forge-plugin-creator/templates/plugin.test-template.ts +14 -0
  35. package/resources/skills/forge-product-help/SKILL.md +16 -0
@@ -0,0 +1,263 @@
1
+ # Configuration Reference
2
+
3
+ 简体中文 · Documentation index
4
+
5
+ This page documents Forge configuration schema version 1 as implemented by
6
+ `@forge/config`. Use it for current settings and precedence; use Project
7
+ context for `AGENTS.md`, Skills, and the broader resource
8
+ layout.
9
+
10
+ ## Inspect before editing
11
+
12
+ Two read-only commands explain the active configuration:
13
+
14
+ ```bash
15
+ pnpm forge config validate
16
+ pnpm forge config show
17
+ ```
18
+
19
+ `validate` prints the user and project paths Forge checked. `show` prints each
20
+ effective value together with its source, plus the resolved Forge home and
21
+ canonical workspace root. Neither command contacts a model provider.
22
+
23
+ ## Files and precedence
24
+
25
+ Forge loads settings in this order:
26
+
27
+ ```text
28
+ built-in defaults
29
+ < $FORGE_HOME/config.json user configuration
30
+ < <workspace-root>/.forge/config.json
31
+ < supported environment variables
32
+ < explicit CLI flags
33
+ ```
34
+
35
+ `FORGE_HOME` defaults to `~/.forge`. A Git repository's canonical root is the
36
+ workspace root; outside Git, the current directory is used.
37
+
38
+ This is not unrestricted last-writer-wins behavior:
39
+
40
+ - User configuration may set every schema field.
41
+ - Project configuration may set only `limits` and `context`.
42
+ - A project limit is applied only when it is stricter than the active user
43
+ value.
44
+ - Project context mode may move only from `off` to `warn` or `compact`, or from
45
+ `warn` to `compact`.
46
+ - Model selection, permission profile, trace persistence, enabled user plugins,
47
+ and provider routes are user-only and are rejected in project configuration.
48
+ - Unknown fields and unsupported schema versions are errors.
49
+
50
+ These rules prevent repository-controlled configuration from choosing where a
51
+ credential is sent, enabling executable code, or widening a safety limit.
52
+
53
+ ## A practical user configuration
54
+
55
+ Create `$FORGE_HOME/config.json` only for values you want to override. Omitted
56
+ values keep their defaults.
57
+
58
+ ```json
59
+ {
60
+ "schemaVersion": 1,
61
+ "model": {
62
+ "engine": "forge",
63
+ "provider": "deepseek",
64
+ "id": "deepseek-v4-flash",
65
+ "reasoningEffort": "medium",
66
+ "thinking": "enabled"
67
+ },
68
+ "permissionProfile": "safe",
69
+ "limits": {
70
+ "maxSteps": 12,
71
+ "maxToolCalls": 40,
72
+ "commandTimeoutMs": 60000,
73
+ "maxToolOutputBytes": 65536
74
+ },
75
+ "trace": { "enabled": true },
76
+ "plugins": { "enabled": [] },
77
+ "context": {
78
+ "mode": "warn",
79
+ "reservedOutputTokens": 4096,
80
+ "bufferTokens": 8192,
81
+ "recentTailTokens": 12000,
82
+ "summaryTargetTokens": 1200
83
+ }
84
+ }
85
+ ```
86
+
87
+ The interactive `/model`, `/effort`, `/login`, and provider-management flows
88
+ write only the relevant user-owned fields. Updates are validated and replaced
89
+ atomically.
90
+
91
+ ## Field reference
92
+
93
+ ### Model and runtime
94
+
95
+ | Field | Default | Accepted values | Notes |
96
+ | --- | --- | --- | --- |
97
+ | `model.engine` | `forge` | `forge`, `codex` | Chooses the native Forge Engine or separate Codex Engine for interactive model selection. |
98
+ | `model.provider` | `deepseek` | `deepseek`, `openai`, or a configured route name | Native Forge Engine provider. A route must exist under `providers`. |
99
+ | `model.id` | `deepseek-v4-flash` | Non-empty model ID | Defaults to `gpt-5.4-mini` when `openai` is selected without an explicit model; configured routes use their first model. |
100
+ | `model.reasoningEffort` | `medium` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `ultra` | The selected provider/model may support only a subset. `ultra` is reserved for a Codex model that advertises it. |
101
+ | `model.thinking` | `enabled` | `enabled`, `disabled` | Native provider thinking mode; provider capability still applies. |
102
+
103
+ Changing provider without setting a model selects that provider's default.
104
+ Use `/model` for the safest interactive path because it displays discovered or
105
+ configured capabilities; use `/effort` independently to change reasoning
106
+ effort.
107
+
108
+ ### Permission and runtime limits
109
+
110
+ | Field | Default | Valid range | Meaning |
111
+ | --- | ---: | --- | --- |
112
+ | `permissionProfile` | `safe` | `safe`, `workspace-write` | `safe` confirms the first write and every command. `workspace-write` auto-allows workspace file writes but still confirms commands, network tools, and delegated model runs. |
113
+ | `limits.maxSteps` | `12` | Positive integer | Maximum model turns in one run. |
114
+ | `limits.maxToolCalls` | `40` | Positive integer | Maximum proposed tool calls in one run. |
115
+ | `limits.commandTimeoutMs` | `60000` | Positive integer | Upper bound applied to process-command duration. |
116
+ | `limits.maxToolOutputBytes` | `65536` | Positive integer | Maximum retained output from one tool execution. |
117
+
118
+ Forge does not implement a `full-access` profile. An approved child process is
119
+ still not OS-sandboxed; see Security.
120
+
121
+ ### Traces and plugins
122
+
123
+ | Field | Default | Notes |
124
+ | --- | --- | --- |
125
+ | `trace.enabled` | `true` | Native Forge Engine events are written under `$FORGE_HOME/runs`. Codex Engine has a separate runtime and is not wrapped by this trace pipeline. |
126
+ | `plugins.enabled` | `[]` | Names of user plugins under `$FORGE_HOME/plugins`. Project plugins use workspace trust instead of this list. |
127
+
128
+ User plugins and trusted project plugins are executable in-process JavaScript.
129
+ Enabling or trusting one is a code-trust decision, not an ordinary feature
130
+ toggle. See Plugin authoring and trust.
131
+
132
+ ### Context budget
133
+
134
+ | Field | Default | Valid range | Project merge rule |
135
+ | --- | ---: | --- | --- |
136
+ | `context.mode` | `warn` | `off`, `warn`, `compact` | A project may select only a stricter mode. |
137
+ | `context.reservedOutputTokens` | `4096` | 1–2,000,000 | A project may increase the reserve. |
138
+ | `context.bufferTokens` | `8192` | 1–2,000,000 | A project may increase the safety buffer. |
139
+ | `context.recentTailTokens` | `12000` | 0–2,000,000 | A project may reduce the verbatim recent-history budget. |
140
+ | `context.summaryTargetTokens` | `1200` | 64–2,000,000 | A project may reduce the checkpoint target. |
141
+
142
+ `warn` measures pressure and reports it without automatically generating a
143
+ checkpoint. `compact` enables automatic checkpoint behavior when required by
144
+ the implemented budget rules. `/compact` remains available as an explicit
145
+ interactive action. The canonical session transcript is retained separately in
146
+ all modes. See Context management.
147
+
148
+ ## Safe project configuration
149
+
150
+ A repository may check in a smaller, stricter configuration such as:
151
+
152
+ ```json
153
+ {
154
+ "schemaVersion": 1,
155
+ "limits": {
156
+ "maxSteps": 8,
157
+ "maxToolCalls": 20,
158
+ "commandTimeoutMs": 30000
159
+ },
160
+ "context": {
161
+ "mode": "compact",
162
+ "bufferTokens": 12000,
163
+ "recentTailTokens": 8000
164
+ }
165
+ }
166
+ ```
167
+
168
+ The following project configuration is rejected because the repository may not
169
+ select a model or widen its own privileges:
170
+
171
+ ```json
172
+ {
173
+ "schemaVersion": 1,
174
+ "model": { "provider": "some-endpoint" },
175
+ "permissionProfile": "workspace-write"
176
+ }
177
+ ```
178
+
179
+ ## Environment variables
180
+
181
+ ### Configuration selection
182
+
183
+ | Variable | Purpose |
184
+ | --- | --- |
185
+ | `FORGE_HOME` | Override the user-level configuration, credential, plugin, session, and trace root. |
186
+ | `FORGE_PROVIDER` | Select `deepseek`, `openai`, or a configured provider route. |
187
+ | `FORGE_MODEL` | Select the model ID. |
188
+ | `FORGE_REASONING_EFFORT` | Select one of the schema reasoning levels. |
189
+ | `FORGE_THINKING` | Select `enabled` or `disabled`. |
190
+
191
+ There is intentionally no environment variable that widens the permission
192
+ profile.
193
+
194
+ ### Credentials
195
+
196
+ | Variable | Purpose |
197
+ | --- | --- |
198
+ | `DEEPSEEK_API_KEY` | DeepSeek API authentication. |
199
+ | `OPENAI_API_KEY` | Usage-based OpenAI API authentication; unrelated to a ChatGPT subscription. |
200
+ | Declared route variable | A route may name `auth.apiKeyEnv`, for example `GATEWAY_API_KEY`. |
201
+ | `FORGE_<ROUTE>_API_KEY` | Derived fallback for a bearer route without an explicit `apiKeyEnv`; hyphens become underscores. |
202
+
203
+ Credential variables take precedence over `$FORGE_HOME/auth.json`. Secret
204
+ values never belong in `config.json`.
205
+
206
+ ### Optional plugin networking
207
+
208
+ The checked-in `web-tools` example honors `HTTP_PROXY`, `HTTPS_PROXY`, and
209
+ `NO_PROXY`, including lowercase aliases, through Forge's shared HTTP
210
+ dispatcher. These variables affect optional network plugins, not the built-in
211
+ workspace tools. `BRAVE_SEARCH_API_KEY` is used only by that example's search
212
+ provider.
213
+
214
+ ## OpenAI-compatible routes
215
+
216
+ Provider routes are user-only because they decide the protocol, endpoint, and
217
+ credential binding. A minimal local route looks like this:
218
+
219
+ ```json
220
+ {
221
+ "schemaVersion": 1,
222
+ "providers": {
223
+ "local": {
224
+ "api": "openai-completions",
225
+ "baseUrl": "http://127.0.0.1:11434/v1",
226
+ "auth": { "type": "none" },
227
+ "models": [
228
+ {
229
+ "id": "local-model",
230
+ "contextWindow": 32768,
231
+ "maxOutputTokens": 4096,
232
+ "reasoningGears": false,
233
+ "supportsImages": false
234
+ }
235
+ ]
236
+ }
237
+ }
238
+ }
239
+ ```
240
+
241
+ Supported `api` values, remote HTTPS requirements, bearer-key binding, model
242
+ discovery limits, and reasoning metadata are documented in
243
+ Authentication.
244
+
245
+ ## Common mistakes
246
+
247
+ - **Editing the wrong file:** run `forge config validate` to see both resolved
248
+ paths and `forge config show` to see provenance.
249
+ - **Placing user-only fields in `.forge/config.json`:** move model, permission,
250
+ trace, plugin, and provider fields to `$FORGE_HOME/config.json`.
251
+ - **Adding an unknown field:** schema version 1 is strict; spelling mistakes are
252
+ errors, not ignored settings.
253
+ - **Treating `reasoningEffort: "none"` as provider default:** omission means
254
+ provider default; explicit `none` is sent only when the provider mapping
255
+ supports it.
256
+ - **Putting an API key in configuration:** remove it, rotate it if committed,
257
+ then use `/login` or an environment variable.
258
+ - **Expecting Forge to unset the parent shell:** `/logout` removes stored
259
+ credentials but cannot remove an exported environment variable.
260
+
261
+ ## Skill invocation preferences
262
+
263
+ User configuration may set `resources.disabledModelInvocation` to a list of Skill names. `forge resources disable <name>` and `forge resources enable <name>` update this user-only setting. Disabling automatic invocation does not modify the Skill or repository and does not disable an explicit `$name` request. Project configuration cannot set `resources`.