@ipul-labs/forge 1.22.0 → 1.35.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 +21 -0
- package/README.md +153 -78
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/index-BmEuPeOG.js +27 -0
- package/dist/assets/index-CSH1OQYQ.css +1 -0
- package/dist/boot-check.js +98 -0
- package/dist/favicon.svg +8 -0
- package/dist/icon-192.png +0 -0
- package/dist/icon-512.png +0 -0
- package/dist/icon.svg +12 -0
- package/dist/index.html +33 -0
- package/dist/manifest.webmanifest +18 -0
- package/dist/theme-init.js +11 -0
- package/lib/bin/cli/analyze.d.ts.map +1 -1
- package/lib/bin/cli/analyze.js +3 -44
- package/lib/bin/cli/analyze.js.map +1 -1
- package/lib/bin/cli/apply.d.ts.map +1 -1
- package/lib/bin/cli/apply.js +2 -20
- package/lib/bin/cli/apply.js.map +1 -1
- package/lib/bin/cli/cifix.d.ts.map +1 -1
- package/lib/bin/cli/cifix.js +4 -28
- package/lib/bin/cli/cifix.js.map +1 -1
- package/lib/bin/cli/close.d.ts.map +1 -1
- package/lib/bin/cli/close.js +2 -33
- package/lib/bin/cli/close.js.map +1 -1
- package/lib/bin/cli/createIssue.d.ts.map +1 -1
- package/lib/bin/cli/createIssue.js +3 -12
- package/lib/bin/cli/createIssue.js.map +1 -1
- package/lib/bin/cli/doctor.d.ts.map +1 -1
- package/lib/bin/cli/doctor.js +3 -4
- package/lib/bin/cli/doctor.js.map +1 -1
- package/lib/bin/cli/init.js +1 -10
- package/lib/bin/cli/init.js.map +1 -1
- package/lib/bin/cli/issue.d.ts.map +1 -1
- package/lib/bin/cli/issue.js +3 -12
- package/lib/bin/cli/issue.js.map +1 -1
- package/lib/bin/cli/issues.d.ts.map +1 -1
- package/lib/bin/cli/issues.js +3 -12
- package/lib/bin/cli/issues.js.map +1 -1
- package/lib/bin/cli/merge.d.ts.map +1 -1
- package/lib/bin/cli/merge.js +4 -20
- package/lib/bin/cli/merge.js.map +1 -1
- package/lib/bin/cli/refine.d.ts.map +1 -1
- package/lib/bin/cli/refine.js +2 -26
- package/lib/bin/cli/refine.js.map +1 -1
- package/lib/bin/cli/repl.d.ts.map +1 -1
- package/lib/bin/cli/repl.js +4 -13
- package/lib/bin/cli/repl.js.map +1 -1
- package/lib/bin/cli/repos.d.ts.map +1 -1
- package/lib/bin/cli/repos.js +1 -11
- package/lib/bin/cli/repos.js.map +1 -1
- package/lib/bin/cli/resetPassword.d.ts +21 -0
- package/lib/bin/cli/resetPassword.d.ts.map +1 -0
- package/lib/bin/cli/resetPassword.js +69 -0
- package/lib/bin/cli/resetPassword.js.map +1 -0
- package/lib/bin/cli/resolution.d.ts.map +1 -1
- package/lib/bin/cli/resolution.js +2 -19
- package/lib/bin/cli/resolution.js.map +1 -1
- package/lib/bin/cli/serverClient.d.ts +2 -0
- package/lib/bin/cli/serverClient.d.ts.map +1 -1
- package/lib/bin/cli/serverClient.js +8 -4
- package/lib/bin/cli/serverClient.js.map +1 -1
- package/lib/bin/cli/session.d.ts.map +1 -1
- package/lib/bin/cli/session.js.map +1 -1
- package/lib/bin/cli/sessionStore.d.ts +1 -1
- package/lib/bin/cli/sessionStore.js +2 -2
- package/lib/bin/cli/sessionStore.js.map +1 -1
- package/lib/bin/cli/ship.d.ts.map +1 -1
- package/lib/bin/cli/ship.js +15 -23
- package/lib/bin/cli/ship.js.map +1 -1
- package/lib/bin/cli/update.d.ts.map +1 -1
- package/lib/bin/cli/update.js +34 -28
- package/lib/bin/cli/update.js.map +1 -1
- package/lib/bin/cli/updatePlan.d.ts +30 -0
- package/lib/bin/cli/updatePlan.d.ts.map +1 -0
- package/lib/bin/cli/updatePlan.js +50 -0
- package/lib/bin/cli/updatePlan.js.map +1 -0
- package/lib/bin/cli/utils.d.ts +3 -0
- package/lib/bin/cli/utils.d.ts.map +1 -1
- package/lib/bin/cli/utils.js +7 -23
- package/lib/bin/cli/utils.js.map +1 -1
- package/lib/bin/cli/validate.d.ts.map +1 -1
- package/lib/bin/cli/validate.js +3 -25
- package/lib/bin/cli/validate.js.map +1 -1
- package/lib/bin/cli/watch.d.ts.map +1 -1
- package/lib/bin/cli/watch.js +3 -12
- package/lib/bin/cli/watch.js.map +1 -1
- package/lib/bin/forge-agent.js +10 -22
- package/lib/bin/forge-agent.js.map +1 -1
- package/lib/server/app.d.ts +24 -0
- package/lib/server/app.d.ts.map +1 -0
- package/lib/server/app.js +58 -0
- package/lib/server/app.js.map +1 -0
- package/lib/server/forge/analyses/analysisStore.d.ts +53 -0
- package/lib/server/forge/analyses/analysisStore.d.ts.map +1 -0
- package/lib/server/forge/analyses/analysisStore.js +77 -0
- package/lib/server/forge/analyses/analysisStore.js.map +1 -0
- package/lib/server/forge/auth/apiTokens.d.ts +34 -0
- package/lib/server/forge/auth/apiTokens.d.ts.map +1 -0
- package/lib/server/forge/auth/apiTokens.js +44 -0
- package/lib/server/forge/auth/apiTokens.js.map +1 -0
- package/lib/server/forge/auth/auditLog.d.ts +36 -0
- package/lib/server/forge/auth/auditLog.d.ts.map +1 -0
- package/lib/server/forge/auth/auditLog.js +56 -0
- package/lib/server/forge/auth/auditLog.js.map +1 -0
- package/lib/server/forge/auth/authConfig.d.ts +13 -0
- package/lib/server/forge/auth/authConfig.d.ts.map +1 -0
- package/lib/server/forge/auth/authConfig.js +37 -0
- package/lib/server/forge/auth/authConfig.js.map +1 -0
- package/lib/server/forge/auth/createAuth.d.ts +130 -0
- package/lib/server/forge/auth/createAuth.d.ts.map +1 -0
- package/lib/server/forge/auth/createAuth.js +387 -0
- package/lib/server/forge/auth/createAuth.js.map +1 -0
- package/lib/server/forge/auth/middleware.d.ts +10 -0
- package/lib/server/forge/auth/middleware.d.ts.map +1 -0
- package/lib/server/forge/auth/middleware.js +22 -0
- package/lib/server/forge/auth/middleware.js.map +1 -0
- package/lib/server/forge/auth/oidc.d.ts +38 -0
- package/lib/server/forge/auth/oidc.d.ts.map +1 -0
- package/lib/server/forge/auth/oidc.js +63 -0
- package/lib/server/forge/auth/oidc.js.map +1 -0
- package/lib/server/forge/auth/passwords.d.ts +7 -0
- package/lib/server/forge/auth/passwords.d.ts.map +1 -0
- package/lib/server/forge/auth/passwords.js +28 -0
- package/lib/server/forge/auth/passwords.js.map +1 -0
- package/lib/server/forge/auth/resetPassword.d.ts +14 -0
- package/lib/server/forge/auth/resetPassword.d.ts.map +1 -0
- package/lib/server/forge/auth/resetPassword.js +29 -0
- package/lib/server/forge/auth/resetPassword.js.map +1 -0
- package/lib/server/forge/auth/roles.d.ts +7 -0
- package/lib/server/forge/auth/roles.d.ts.map +1 -0
- package/lib/server/forge/auth/roles.js +15 -0
- package/lib/server/forge/auth/roles.js.map +1 -0
- package/lib/server/forge/auth/sessions.d.ts +27 -0
- package/lib/server/forge/auth/sessions.d.ts.map +1 -0
- package/lib/server/forge/auth/sessions.js +37 -0
- package/lib/server/forge/auth/sessions.js.map +1 -0
- package/lib/server/forge/auth/testHarness.d.ts +104 -0
- package/lib/server/forge/auth/testHarness.d.ts.map +1 -0
- package/lib/server/forge/auth/testHarness.js +53 -0
- package/lib/server/forge/auth/testHarness.js.map +1 -0
- package/lib/server/forge/auth/tokenHash.d.ts +3 -0
- package/lib/server/forge/auth/tokenHash.d.ts.map +1 -0
- package/lib/server/forge/auth/tokenHash.js +4 -0
- package/lib/server/forge/auth/tokenHash.js.map +1 -0
- package/lib/server/forge/auth/users.d.ts +51 -0
- package/lib/server/forge/auth/users.d.ts.map +1 -0
- package/lib/server/forge/auth/users.js +118 -0
- package/lib/server/forge/auth/users.js.map +1 -0
- package/lib/server/forge/core/ForgeAgent.d.ts +43 -1
- package/lib/server/forge/core/ForgeAgent.d.ts.map +1 -1
- package/lib/server/forge/core/ForgeAgent.js +209 -61
- package/lib/server/forge/core/ForgeAgent.js.map +1 -1
- package/lib/server/forge/core/agentClient.d.ts +7 -23
- package/lib/server/forge/core/agentClient.d.ts.map +1 -1
- package/lib/server/forge/core/agentClient.js +10 -25
- package/lib/server/forge/core/agentClient.js.map +1 -1
- package/lib/server/forge/core/claudeClient.d.ts +24 -1
- package/lib/server/forge/core/claudeClient.d.ts.map +1 -1
- package/lib/server/forge/core/claudeClient.js +25 -7
- package/lib/server/forge/core/claudeClient.js.map +1 -1
- package/lib/server/forge/core/configStore.d.ts +11 -1
- package/lib/server/forge/core/configStore.d.ts.map +1 -1
- package/lib/server/forge/core/configStore.js +33 -2
- package/lib/server/forge/core/configStore.js.map +1 -1
- package/lib/server/forge/core/dependencyPaths.d.ts +19 -0
- package/lib/server/forge/core/dependencyPaths.d.ts.map +1 -0
- package/lib/server/forge/core/dependencyPaths.js +32 -0
- package/lib/server/forge/core/dependencyPaths.js.map +1 -0
- package/lib/server/forge/core/evidence.d.ts +43 -0
- package/lib/server/forge/core/evidence.d.ts.map +1 -0
- package/lib/server/forge/core/evidence.js +108 -0
- package/lib/server/forge/core/evidence.js.map +1 -0
- package/lib/server/forge/core/jobs.d.ts +2 -0
- package/lib/server/forge/core/jobs.d.ts.map +1 -1
- package/lib/server/forge/core/jobs.js +8 -0
- package/lib/server/forge/core/jobs.js.map +1 -1
- package/lib/server/forge/core/localRepo.d.ts +31 -10
- package/lib/server/forge/core/localRepo.d.ts.map +1 -1
- package/lib/server/forge/core/localRepo.js +48 -82
- package/lib/server/forge/core/localRepo.js.map +1 -1
- package/lib/server/forge/core/prompts.d.ts +3 -1
- package/lib/server/forge/core/prompts.d.ts.map +1 -1
- package/lib/server/forge/core/prompts.js +14 -5
- package/lib/server/forge/core/prompts.js.map +1 -1
- package/lib/server/forge/core/providers/azuredevops.d.ts +4 -2
- package/lib/server/forge/core/providers/azuredevops.d.ts.map +1 -1
- package/lib/server/forge/core/providers/azuredevops.js +12 -2
- package/lib/server/forge/core/providers/azuredevops.js.map +1 -1
- package/lib/server/forge/core/providers/base.d.ts +29 -4
- package/lib/server/forge/core/providers/base.d.ts.map +1 -1
- package/lib/server/forge/core/providers/base.js +21 -3
- package/lib/server/forge/core/providers/base.js.map +1 -1
- package/lib/server/forge/core/providers/github.d.ts +7 -7
- package/lib/server/forge/core/providers/github.d.ts.map +1 -1
- package/lib/server/forge/core/providers/github.js +13 -4
- package/lib/server/forge/core/providers/github.js.map +1 -1
- package/lib/server/forge/core/providers/gitlab.d.ts +20 -3
- package/lib/server/forge/core/providers/gitlab.d.ts.map +1 -1
- package/lib/server/forge/core/providers/gitlab.js +65 -5
- package/lib/server/forge/core/providers/gitlab.js.map +1 -1
- package/lib/server/forge/core/providers/types.d.ts +20 -0
- package/lib/server/forge/core/providers/types.d.ts.map +1 -1
- package/lib/server/forge/core/secretBox.d.ts +17 -0
- package/lib/server/forge/core/secretBox.d.ts.map +1 -0
- package/lib/server/forge/core/secretBox.js +74 -0
- package/lib/server/forge/core/secretBox.js.map +1 -0
- package/lib/server/forge/core/types.d.ts +7 -1
- package/lib/server/forge/core/types.d.ts.map +1 -1
- package/lib/server/forge/core/validator/clone.d.ts +5 -4
- package/lib/server/forge/core/validator/clone.d.ts.map +1 -1
- package/lib/server/forge/core/validator/clone.js +6 -86
- package/lib/server/forge/core/validator/clone.js.map +1 -1
- package/lib/server/forge/core/validator/cmd.d.ts.map +1 -1
- package/lib/server/forge/core/validator/cmd.js +4 -1
- package/lib/server/forge/core/validator/cmd.js.map +1 -1
- package/lib/server/forge/core/validator/projectType.d.ts.map +1 -1
- package/lib/server/forge/core/validator/projectType.js +2 -1
- package/lib/server/forge/core/validator/projectType.js.map +1 -1
- package/lib/server/forge/core/validator/runners/node.d.ts.map +1 -1
- package/lib/server/forge/core/validator/runners/node.js +6 -2
- package/lib/server/forge/core/validator/runners/node.js.map +1 -1
- package/lib/server/forge/core/validator.d.ts.map +1 -1
- package/lib/server/forge/core/validator.js +28 -22
- package/lib/server/forge/core/validator.js.map +1 -1
- package/lib/server/forge/core/workspaces.d.ts +70 -0
- package/lib/server/forge/core/workspaces.d.ts.map +1 -0
- package/lib/server/forge/core/workspaces.js +348 -0
- package/lib/server/forge/core/workspaces.js.map +1 -0
- package/lib/server/forge/db/database.d.ts +22 -0
- package/lib/server/forge/db/database.d.ts.map +1 -0
- package/lib/server/forge/db/database.js +71 -0
- package/lib/server/forge/db/database.js.map +1 -0
- package/lib/server/forge/db/migrations.d.ts +11 -0
- package/lib/server/forge/db/migrations.d.ts.map +1 -0
- package/lib/server/forge/db/migrations.js +87 -0
- package/lib/server/forge/db/migrations.js.map +1 -0
- package/lib/server/forge/routes.d.ts.map +1 -1
- package/lib/server/forge/routes.js +413 -163
- package/lib/server/forge/routes.js.map +1 -1
- package/lib/server/forge/sse.d.ts +10 -0
- package/lib/server/forge/sse.d.ts.map +1 -0
- package/lib/server/forge/sse.js +22 -0
- package/lib/server/forge/sse.js.map +1 -0
- package/lib/server/spa.d.ts +12 -0
- package/lib/server/spa.d.ts.map +1 -0
- package/lib/server/spa.js +23 -0
- package/lib/server/spa.js.map +1 -0
- package/lib/server.js +9 -24
- package/lib/server.js.map +1 -1
- package/lib/shared/events.d.ts +3 -0
- package/lib/shared/events.d.ts.map +1 -1
- package/lib/shared/events.js +3 -0
- package/lib/shared/events.js.map +1 -1
- package/lib/shared/packageRoot.d.ts +11 -0
- package/lib/shared/packageRoot.d.ts.map +1 -0
- package/lib/shared/packageRoot.js +23 -0
- package/lib/shared/packageRoot.js.map +1 -0
- package/lib/shared/project.d.ts +3 -0
- package/lib/shared/project.d.ts.map +1 -0
- package/lib/shared/project.js +3 -0
- package/lib/shared/project.js.map +1 -0
- package/package.json +24 -9
- package/lib/bin/cli/improve.d.ts +0 -2
- package/lib/bin/cli/improve.d.ts.map +0 -1
- package/lib/bin/cli/improve.js +0 -189
- package/lib/bin/cli/improve.js.map +0 -1
- package/lib/bin/cli/stats.d.ts +0 -2
- package/lib/bin/cli/stats.d.ts.map +0 -1
- package/lib/bin/cli/stats.js +0 -78
- package/lib/bin/cli/stats.js.map +0 -1
- package/lib/server/forge/core/k8s.d.ts +0 -18
- package/lib/server/forge/core/k8s.d.ts.map +0 -1
- package/lib/server/forge/core/k8s.js +0 -49
- package/lib/server/forge/core/k8s.js.map +0 -1
- package/lib/server/forge/core/openclawClient.d.ts +0 -61
- package/lib/server/forge/core/openclawClient.d.ts.map +0 -1
- package/lib/server/forge/core/openclawClient.js +0 -111
- package/lib/server/forge/core/openclawClient.js.map +0 -1
- package/lib/server/forge/core/quotaClient.d.ts +0 -48
- package/lib/server/forge/core/quotaClient.d.ts.map +0 -1
- package/lib/server/forge/core/quotaClient.js +0 -88
- package/lib/server/forge/core/quotaClient.js.map +0 -1
- package/lib/server/forge/core/selfImprove.d.ts +0 -43
- package/lib/server/forge/core/selfImprove.d.ts.map +0 -1
- package/lib/server/forge/core/selfImprove.js +0 -372
- package/lib/server/forge/core/selfImprove.js.map +0 -1
- package/lib/server/forge/core/telemetry.d.ts +0 -100
- package/lib/server/forge/core/telemetry.d.ts.map +0 -1
- package/lib/server/forge/core/telemetry.js +0 -273
- package/lib/server/forge/core/telemetry.js.map +0 -1
- package/scripts/fix-shebang.cjs +0 -11
- package/scripts/inject-readme.cjs +0 -23
- package/scripts/local-rollout.sh +0 -134
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ipul-labs/forge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "AI-powered code change & deploy control panel — connects Claude, GitLab, and Kubernetes",
|
|
5
5
|
"readmeFilename": "README.md",
|
|
6
6
|
"type": "module",
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./lib/server/forge/routes.js",
|
|
13
13
|
"./agent": "./lib/server/forge/core/ForgeAgent.js",
|
|
14
|
-
"./providers": "./lib/server/forge/core/providers/index.js"
|
|
14
|
+
"./providers": "./lib/server/forge/core/providers/index.js",
|
|
15
|
+
"./app": "./lib/server/app.js"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"README.md",
|
|
19
|
+
"LICENSE",
|
|
18
20
|
"lib",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
+
"dist",
|
|
22
|
+
"!lib/**/*.test.*"
|
|
21
23
|
],
|
|
22
24
|
"scripts": {
|
|
23
25
|
"dev": "trap 'kill 0' EXIT INT TERM; FORGE_NO_VITE=1 tsx watch server.ts & vite; wait",
|
|
@@ -26,8 +28,11 @@
|
|
|
26
28
|
"typecheck": "tsc --noEmit -p tsconfig.app.json && tsc --noEmit -p tsconfig.server.json",
|
|
27
29
|
"test": "vitest run",
|
|
28
30
|
"test:watch": "vitest",
|
|
31
|
+
"test:e2e": "playwright test",
|
|
29
32
|
"build:server": "tsc -p tsconfig.build.json && node scripts/fix-shebang.cjs",
|
|
30
|
-
"
|
|
33
|
+
"test:package": "playwright test -c playwright.package.config.ts",
|
|
34
|
+
"prepack": "npm run build && npm run build:server && node scripts/inject-readme.cjs",
|
|
35
|
+
"postpack": "node scripts/inject-readme.cjs --restore"
|
|
31
36
|
},
|
|
32
37
|
"dependencies": {
|
|
33
38
|
"@kubernetes/client-node": "^1.0.0",
|
|
@@ -41,33 +46,39 @@
|
|
|
41
46
|
"ink-select-input": "^6.2.0",
|
|
42
47
|
"ink-spinner": "^5.0.0",
|
|
43
48
|
"ink-text-input": "^6.0.0",
|
|
49
|
+
"jose": "^5.10.0",
|
|
44
50
|
"react": "^19.0.0",
|
|
45
51
|
"react-dom": "^19.0.0",
|
|
46
|
-
"react-router-dom": "^7.14.1"
|
|
52
|
+
"react-router-dom": "^7.14.1",
|
|
53
|
+
"tsx": "^4.21.0"
|
|
47
54
|
},
|
|
48
55
|
"devDependencies": {
|
|
56
|
+
"@playwright/test": "^1.60.0",
|
|
49
57
|
"@semantic-release/changelog": "^6.0.3",
|
|
50
58
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
51
59
|
"@semantic-release/git": "^10.0.1",
|
|
52
60
|
"@semantic-release/gitlab": "^13.3.2",
|
|
53
61
|
"@semantic-release/npm": "^13.1.5",
|
|
54
62
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
63
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
64
|
+
"@testing-library/react": "^16.3.3",
|
|
65
|
+
"@testing-library/user-event": "^14.6.8",
|
|
55
66
|
"@types/express": "^5.0.0",
|
|
56
67
|
"@types/node": "^25.6.2",
|
|
57
68
|
"@types/react": "^19.0.0",
|
|
58
69
|
"@types/react-dom": "^19.0.0",
|
|
59
70
|
"@vitejs/plugin-react": "^6.0.0",
|
|
60
71
|
"autoprefixer": "^10.4.20",
|
|
72
|
+
"jsdom": "^25.0.1",
|
|
61
73
|
"postcss": "^8.4.47",
|
|
62
74
|
"semantic-release": "^25.0.3",
|
|
63
75
|
"tailwindcss": "^3.4.14",
|
|
64
|
-
"tsx": "^4.21.0",
|
|
65
76
|
"typescript": "^5.6.0",
|
|
66
77
|
"vite": "^8.0.0",
|
|
67
78
|
"vitest": "^4.1.0"
|
|
68
79
|
},
|
|
69
80
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
81
|
+
"node": ">=22.13.0"
|
|
71
82
|
},
|
|
72
83
|
"keywords": [
|
|
73
84
|
"forge",
|
|
@@ -80,10 +91,14 @@
|
|
|
80
91
|
"publishConfig": {
|
|
81
92
|
"access": "public"
|
|
82
93
|
},
|
|
94
|
+
"homepage": "https://useafk.dev/forge",
|
|
95
|
+
"bugs": {
|
|
96
|
+
"email": "support@ipullabs.com"
|
|
97
|
+
},
|
|
83
98
|
"repository": {
|
|
84
99
|
"type": "git",
|
|
85
100
|
"url": "git+https://gitlab.com/ipul-labs/forge.git"
|
|
86
101
|
},
|
|
87
102
|
"license": "MIT",
|
|
88
|
-
"readme": "# Forge by iPuL\n\nAI-powered code change & deploy control panel. Connect an issue tracker, let Claude propose a fix, review the diff, approve — and Forge creates the branch, commits the changes, opens the MR/PR, and monitors the CI pipeline.\n\nBuilt on: Claude Code CLI · GitLab / GitHub / Azure DevOps · Kubernetes\n\n---\n\n## Why Forge\n\n**The CI refinement loop is the thing.** Every other AI coding tool hands off after the PR is open. Forge keeps going: when your pipeline fails, it grabs the last 150 lines of the failed job log, feeds them back to Claude with the original fix context, generates a targeted patch, and commits it to the branch — automatically. No human has to read the stack trace, translate it into a prompt, and paste it somewhere. The loop closes itself.\n\nEverything else fills in the gaps that matter for real teams:\n\n- **No per-token cost** — Claude runs via the `claude` CLI using your existing Claude subscription, not API credits. Heavy use doesn't trigger a bill.\n- **Multi-provider** — GitLab, GitHub, and Azure DevOps are all first-class. Switch providers with a single env var; all normalized data shapes stay the same.\n- **Self-hosted** — your code never leaves your infrastructure. The backend runs wherever you deploy it; AI calls go to Anthropic (or a local gateway via OpenClaw).\n- **Two-pass analysis keeps context focused** — Claude first identifies the 6 most relevant files, then reads only those when proposing the fix. This produces sharper diffs than dumping the whole repo into one prompt.\n\n---\n\n## How it works\n\n1. **Connect** — enter your Forge token to authenticate\n2. **Pick an issue** — Forge loads open issues from your project\n3. **Analyze** — Claude reads the repo file tree, identifies relevant files, and proposes a targeted fix\n4. **Review** — inspect the diff file-by-file; refine with natural-language feedback if needed\n5. **Apply** — Forge creates a branch, commits all changes, and opens a merge/pull request\n6. **Monitor** — watch the CI pipeline run; if it fails, click \"Fix with AI\" to iterate\n\n---\n\n## Getting started\n\n### Prerequisites\n\n- Node.js 20+\n- `claude` CLI installed and authenticated (`claude auth login`)\n- Credentials for your SCM provider (see [Configuration](#configuration))\n\n### Install\n\n```bash\ngit clone https://gitlab.com/ipul-labs/forge.git\ncd forge\nnpm install\n```\n\n### Configure\n\n```bash\n# Interactive setup — writes .env and ~/.forge/config.json\nnpx forge init\n```\n\nOr copy the example env and fill in the values manually:\n\n```bash\ncp .env.example .env\n# fill in FORGE_TOKEN plus your provider credentials\n```\n\n### Launch the UI\n\n```bash\nnpm run dev\n# opens http://localhost:5000 (frontend) with API on :5001\n```\n\nFor production:\n\n```bash\nnpm run build:app # builds Vite SPA to dist/\nnpm start # NODE_ENV=production node server.js\n```\n\n### CLI usage\n\nThe `forge` CLI drives the same orchestrator from the terminal. Install globally or use `npx`:\n\n```bash\n# Global install (adds `forge` to PATH)\nnpm install -g @ipul-labs/forge\n\n# Or run via npx from the repo\nnpx forge <command>\n```\n\n#### Interactive mode\n\nRun `forge` with no arguments to enter an interactive terminal session:\n\n```bash\nforge\n```\n\n```\n forge v1.15.1\n\n──────────────────────────────────────────────────\n ❯ issues --limit 5\n──────────────────────────────────────────────────\n group/repo | agent:claude | v1.15.1\n```\n\nTab-completes command names. Type `use <repo>` to switch repos. Commands that error stay in the session — only `exit`, `quit`, or Ctrl+D leave.\n\n#### End-to-end: issue to production\n\n```bash\nforge ship 42\n```\n\nRuns: analyze → review → validate → apply → watch CI → merge → watch deploy → close, with a `y/N` gate at every state-changing step.\n\n#### Step-by-step commands\n\n```bash\nforge issues # List open issues (--label X, --mine, --limit N)\nforge issue 42 # Show full description\nforge create-issue --title \"fix: broken widget\" # Create a new issue\nforge analyze 42 # Run two-pass analysis, cache result\nforge show # Re-render cached analysis\nforge refine --feedback \"...\" # Iterate with feedback\nforge validate # Run lint/typecheck/test against proposed changes\nforge apply # Push branch + open MR\nforge watch # Poll the MR pipeline\nforge ci-fix # Re-analyze with failed-pipeline logs\nforge merge # Merge the MR\nforge resolution-check # Verify merged MR closes the issue\nforge close # Close the issue\nforge use group/other-repo # Switch active repo\nforge update # Pull latest + reinstall dependencies\nforge stats # View telemetry — success rates, timing, failure patterns\nforge improve # Evaluate patterns and suggest improvements\nforge improve --create # Create improvement issues in the repo\n```\n\n#### Options\n\n```\n-p, --port <n> Port for start\n--repo <group/repo> Primary repo\n--secondary <repo> Additional repo (repeatable)\n--all-repos Include every configured repo\n--model <id> Claude model override\n--agent <name> Agent backend: claude | openclaw\n--prompt <text> Extra user prompt\n--json JSON output\n--quiet Suppress progress\n--yes Skip confirmation gates\n--validate Run validate before apply\n```\n\n#### Diagnostics\n\n```bash\nforge doctor # Check prerequisites (node, claude CLI, env vars)\nforge session list # List cached sessions\nforge session clean # Remove stale session data\n```\n\nSee [`docs/cli.md`](./docs/cli.md) for the full command reference and [`docs/cli-ship-workflow.md`](./docs/cli-ship-workflow.md) for the workflow design.\n\n---\n\n## Configuration\n\n### Core\n\n| Variable | Required | Description |\n|---|---|---|\n| `FORGE_TOKEN` | Yes | Dashboard password — also auto-fills the UI login form |\n| `FORGE_REPOS` | Yes | Comma-separated repo list; first entry is the primary project |\n| `SCM_PROVIDER` | — | `gitlab` (default) · `github` · `azuredevops` |\n| `ANTHROPIC_API_KEY` | — | Enables live model list from Anthropic; falls back to hardcoded list |\n| `FORGE_MODEL` | — | Override default model (default: `claude-sonnet-4-6`) |\n| `FORGE_AGENT_MODE` | — | `structured` (default) · `agentic` — how Claude proposes changes (see [Agent modes](#agent-modes)) |\n| `K8S_CLUSTER_TOKEN` | — | K8s service account token for rollout monitoring |\n| `K8S_CLUSTER_SERVER` | — | K8s API server URL |\n| `PORT` | — | HTTP server port (default: `5001`) |\n| `OPENCLAW_GATEWAY_URL` | — | Enables OpenClaw agent backend; point at your local Gateway |\n| `OPENCLAW_TOKEN` | — | Bearer token for OpenClaw Gateway auth |\n\n### Provider credentials\n\nSCM tokens can be set here **or** in the Forge Settings UI (Settings → Connections). The UI value takes precedence over env vars.\n\n#### GitLab (`SCM_PROVIDER=gitlab`, default)\n\n| Variable | Required | Description |\n|---|---|---|\n| `GITLAB_TOKEN` | Yes | Personal access token with `api` + `write_repository` scopes |\n\n#### GitHub (`SCM_PROVIDER=github`)\n\n| Variable | Required | Description |\n|---|---|---|\n| `GITHUB_TOKEN` | Yes | Personal access token with `repo` + `workflow` scopes |\n| `GITHUB_OWNER` | Yes | Organization or user, e.g. `ipul-labs` |\n| `GITHUB_REPO` | Yes | Repository name, e.g. `web-app` |\n| `GITHUB_BASE_BRANCH` | — | Default target branch (default: `main`) |\n\n#### Azure DevOps (`SCM_PROVIDER=azuredevops`)\n\n| Variable | Required | Description |\n|---|---|---|\n| `AZURE_DEVOPS_TOKEN` | Yes | Personal access token (Full access or Code + Work Items) |\n| `AZURE_DEVOPS_ORG` | Yes | Organization name, e.g. `ipul-labs` |\n| `AZURE_DEVOPS_PROJECT` | Yes | Team project name, e.g. `web-app` |\n| `AZURE_DEVOPS_REPO` | — | Git repo name (defaults to project name) |\n| `AZURE_DEVOPS_BASE_BRANCH` | — | Default target branch (default: `main`) |\n\n### Deprecated (still work as fallbacks)\n\n| Variable | Replaced by |\n|---|---|\n| `FORGE_GITLAB_PROJECT` | First entry in `FORGE_REPOS` |\n| `VITE_FORGE_TOKEN` | Auto-derived from `FORGE_TOKEN` |\n| `FORGE_REFINE_REPO_ACCESS` | Settings UI toggle (Settings → Defaults) |\n\nSee `.env.example` for a full annotated list.\n\n---\n\n## Multi-provider support\n\nForge's SCM layer is a clean provider abstraction — all three providers implement the same `ScmProvider` interface and return identical normalized shapes (`NormalIssue`, `NormalMR`, `NormalPipeline`, etc.). The rest of the codebase never knows which provider is active.\n\n### Switching providers\n\n```bash\n# .env\nSCM_PROVIDER=github\nGITHUB_TOKEN=ghp_...\nGITHUB_OWNER=my-org\nGITHUB_REPO=my-repo\n```\n\n### Per-repo prefix (multi-repo mixed-provider setups)\n\n```bash\nFORGE_REPOS=gitlab:ipul/web-app,github:my-org/mobile\n```\n\n### Provider capabilities\n\n| Feature | GitLab | GitHub | Azure DevOps |\n|---|---|---|---|\n| Issues / Work Items | Yes | Yes | Yes (Work Items) |\n| Multi-file commits | Yes | Yes (Git Data API) | Yes (Pushes API) |\n| Merge / Pull Requests | Yes | Yes | Yes |\n| CI pipelines | Yes (GitLab CI) | Yes (GitHub Actions) | Yes (Azure Pipelines) |\n| Job log traces | Yes | Yes | Yes |\n| Server-side rebase | Yes | — | — |\n\n---\n\n## Self-improvement\n\nForge monitors its own performance and proposes fixes autonomously. The loop:\n\n1. **Telemetry** — every operation records success/fail, duration, tokens, and cost to `~/.forge/telemetry/`\n2. **Pattern detection** — recurring failures are grouped and classified (timeout-tuning, provider-bug, prompt-quality, validation-gap, error-handling, ux-improvement)\n3. **Auto-evaluation** — runs automatically after every 25 operations (4-hour cooldown). High-severity patterns trigger issue creation.\n4. **Issue creation** — files issues in the configured repo with diagnosis, evidence, and suggested fixes. Tagged `[self-improve]` with category labels.\n5. **Human review** — Forge never auto-merges its own changes. All improvements go through normal MR review.\n6. **Resolution** — when a self-improve issue is closed, matching telemetry failure patterns are marked as resolved. They stop appearing in `forge stats` and won't trigger duplicate diagnoses. Resolution is tied to code state, not time — patterns only clear when the fix ships.\n\n```bash\nforge stats # View telemetry data\nforge improve # Run evaluation manually\nforge improve --create # Create issues for actionable patterns\nforge improve --ship # Create issues + analyze + propose fix + open MR\nforge improve --json # Pipe-friendly output\n```\n\nThe `--ship` flag runs the full loop: detect pattern → create issue → analyze → propose fix → open MR. All in one command. The MR goes through normal CI — you review and merge or reject.\n\nUX insights are also derived from telemetry: slow operations (>2 min avg), high token usage (>50k avg), and frequent cancellations surface as improvement suggestions.\n\n---\n\n## Security\n\nForge is designed for self-hosted deployment on trusted infrastructure. Security measures in place:\n\n- **Timing-safe auth** — token comparison uses `crypto.timingSafeEqual` to prevent timing attacks\n- **Rate limiting** — API endpoints are rate-limited (60 req/min per IP) to prevent brute-force\n- **Security headers** — Helmet middleware sets X-Frame-Options, HSTS, X-Content-Type-Options, and CSP (production)\n- **Request size limits** — JSON body capped at 1MB to prevent memory exhaustion\n- **Secret redaction** — error logs and API responses scrub tokens (`glpat-*`, `ghp_*`, `oauth2:*@`) before output\n- **File permissions** — config files (`~/.forge/config.json`) written with `0600`, session directories with `0700`\n- **Git credential isolation** — SCM tokens passed via `GIT_ASKPASS` helper, never embedded in clone URLs\n- **Path traversal protection** — symlink-aware `realpath` checks prevent file writes outside clone directories\n- **No shell injection** — all subprocess calls use `spawn()` with argument arrays, never shell strings\n- **Atomic config writes** — config updates use temp file + rename to prevent corruption\n\n`FORGE_TOKEN` is a standalone dashboard password — never reuse an SCM token for this value.\n\n---\n\n## Production deployment\n\n```bash\nnpm run build:app # builds Vite SPA to dist/\nNODE_ENV=production tsx server.ts\n```\n\nOr with Docker:\n\n```bash\ndocker build -t forge .\ndocker run -p 5001:5001 --env-file .env forge\n```\n\n---\n\n## Architecture\n\nFull-stack TypeScript. The backend runs via `tsx` (no build step); the frontend compiles through Vite.\n\n```\nbin/\n forge-agent.ts # CLI entry point (forge command)\n cli/\n ship.ts # End-to-end orchestrator (Ink UI)\n analyze.ts # Two-pass issue analysis\n repl.ts # Interactive terminal (Ink-based)\n serverClient.ts # CLI → Server API client (server/local mode)\n sessionStore.ts # ~/.forge/sessions/ persistence\n ...\n\nshared/\n events.ts # FORGE_EVENTS constants (server + client)\n\nserver/\n forge/\n routes.ts # Express router — all /api/forge/* endpoints\n core/\n ForgeAgent.ts # Orchestrates the full pipeline (analyze -> apply -> refine)\n claudeClient.ts # Shells out to the claude CLI for structured output\n openclawClient.ts # OpenClaw Gateway HTTP client\n agentClient.ts # Dispatcher: routes to claudeClient or openclawClient\n k8s.ts # Kubernetes client for rollout monitoring\n jobs.ts # Job store with SSE event buffering + replay\n providers/\n base.ts # Abstract ScmProvider — normalized shapes + interface\n gitlab.ts # GitLab REST API v4\n github.ts # GitHub REST API v3 + Git Data API\n azuredevops.ts # Azure DevOps REST API\n index.ts # createProvider() factory\n\nsrc/\n views/Forge/\n ForgeDashboard.tsx # Root UI component with tabbed issue/MR views\n api.ts # Token management + fetch helper\n types.ts # Shared TypeScript types\n utils.ts # SSE helper + state utilities\n components/ # Analysis progress, pipeline status, diff viewer\n hooks/\n useForgeDashboard.ts # All state, phase transitions, and API calls\n useForgeEvents.ts # SSE event bus subscription\n```\n\n### Agent modes\n\nForge can drive Claude in two ways, set by `FORGE_AGENT_MODE` (or the Settings default, or a per-request `agentMode`):\n\n- **`structured`** (default) — the two-pass JSON pipeline below. Deterministic and schema-validated: Claude runs single-turn with tools disabled and returns complete file contents that Forge overlays onto a clone.\n- **`agentic`** — Claude runs as a full Claude Code agent inside a checkout of the repo: real tools (Read/Edit/Write/Bash…), the project's own `CLAUDE.md`, and a multi-turn loop. Forge captures the resulting `git diff` instead of parsing JSON, then feeds those changes into the same apply/validate/MR pipeline. Higher fidelity, less determinism. Requires the `claude` backend, a single repo, and a GitLab primary — otherwise Forge logs why and falls back to structured.\n\n### Two-pass analysis (structured mode)\n\n**Pass 1** — `identifyRelevantFiles`: Claude reads the issue + file tree, returns the max-6 most relevant paths.\n\n**Pass 2** — `proposeFix`: Claude reads the actual file contents and proposes a targeted fix as a JSON diff.\n\nBoth passes use `claude --print --output-format json` so cost and service tier are tracked automatically.\n\n### CI refinement\n\nWhen a pipeline fails, Forge fetches the last 150 lines of each failed job's trace log and feeds them to pass 2 with an explicit \"pipeline failed\" framing — not generic reviewer feedback. This improves fix quality for common failures like lint errors and type errors.\n\n### Provider abstraction\n\nAll three SCM providers implement `ScmProvider` from `providers/base.ts`. The contract is:\n- **Normalized return types** — all methods return `NormalIssue`, `NormalMR`, `NormalPipeline`, etc., regardless of provider\n- **Instance-scoped** — each provider is instantiated with a repo string; no global state\n- **`supportsRebase`** — providers that don't support server-side rebase return `false`; the UI and API layer check this before showing the rebase button\n\n---\n\n## Programmatic usage\n\nThe npm package ships compiled JavaScript with TypeScript declarations — no `tsx` or TypeScript runtime needed by consumers.\n\n```ts\nimport forgeRouter from \"@ipul-labs/forge\"; // Express router\nimport { ForgeAgent } from \"@ipul-labs/forge/agent\"; // Core pipeline class\nimport { createProvider } from \"@ipul-labs/forge/providers\"; // SCM factory\n```\n\n```ts\nconst agent = new ForgeAgent({ project: \"group/repo\" });\nconst result = await agent.analyzeIssue(42, (event) => console.log(event));\nconst { branchName, mr } = await agent.applyFix(result);\n```\n\n### Development\n\nSource is TypeScript (`.ts`). The dev server runs via `tsx` (no build step). For the npm package, `tsc` compiles to `lib/` with declarations during `prepack`.\n\n```bash\nnpm run dev # tsx watch + vite (dev)\nnpm run build:server # compile server/bin/shared → lib/\nnpm run typecheck # check both frontend + server configs\n```\n\n---\n\n## License\n\nMIT\n"
|
|
103
|
+
"readme": "# Forge by iPuL\n\nAI-powered code change & deploy control panel. Connect an issue tracker, let Claude propose a fix, review the diff, approve — and Forge creates the branch, commits the changes, opens the MR/PR, and monitors the CI pipeline.\n\nBuilt on: Claude Code CLI · GitLab / GitHub / Azure DevOps · Kubernetes\n\n---\n\n## Why Forge\n\n**The CI refinement loop is the thing.** Every other AI coding tool hands off after the PR is open. Forge keeps going: when your pipeline fails, it grabs the last 150 lines of the failed job log, feeds them back to Claude with the original fix context, generates a targeted patch, and commits it to the branch — automatically. No human has to read the stack trace, translate it into a prompt, and paste it somewhere. The loop closes itself.\n\nEverything else fills in the gaps that matter for real teams:\n\n- **No per-token cost** — Claude runs via the `claude` CLI using your existing Claude subscription, not API credits. Heavy use doesn't trigger a bill. Hosted workspaces can instead save their own Anthropic API key (see [Claude billing](#claude-billing)).\n- **Multi-provider** — GitLab, GitHub, and Azure DevOps are all first-class. Switch providers with a single env var; all normalized data shapes stay the same.\n- **Self-hosted** — your code never leaves your infrastructure. The backend runs wherever you deploy it; AI calls go to Anthropic (or a local gateway via OpenClaw).\n- **Two-pass analysis keeps context focused** — Claude first identifies the 6 most relevant files, then reads only those when proposing the fix. This produces sharper diffs than dumping the whole repo into one prompt.\n\n---\n\n## How it works\n\n1. **Sign in** — with your Forge account or your company SSO\n2. **Pick an issue** — Forge loads open issues from your project. Create, edit, label (`type::` / `priority::` / `status::` / `area::`) and delete tickets right from Forge. Close and delete (in the issue's ⋯ menu) open a dialog that first shows what will be torn down (Forge branches deleted, review environments stopped) and names any open MR that blocks it; deleting also asks you to type the issue number. The preview comes from `GET /issues/:iid/footprint`\n3. **Analyze** — Claude reads the repo file tree, identifies relevant files, and proposes a targeted fix\n4. **Review** — inspect the diff file-by-file; refine with natural-language feedback if needed\n5. **Apply** — Forge creates a branch, commits all changes, and opens a merge/pull request\n6. **Monitor** — watch the CI pipeline run; if it fails, click \"Fix with AI\" to iterate\n\n---\n\n## Getting started\n\n### Prerequisites\n\n- Node.js 22.13+\n- `claude` CLI installed and authenticated (`claude auth login`)\n- Credentials for your SCM provider (see [Configuration](#configuration))\n\n### Install\n\nForge is published on npm as [`@ipul-labs/forge`](https://www.npmjs.com/package/@ipul-labs/forge). The package includes the server, the built dashboard and the `forge` CLI.\n\n```bash\nnpm install -g @ipul-labs/forge\n```\n\n### Configure\n\nPick a folder for this install's settings and run the setup there. It writes `.env` in that folder and your repos and code-host token to `~/.forge/config.json`:\n\n```bash\nmkdir forge-home && cd forge-home\nforge init\n```\n\n### Launch the dashboard\n\nFrom the same folder:\n\n```bash\nforge start # http://localhost:5001 (--port to change)\n```\n\nOpen it and create the first admin account (see [First run](#first-run)). `forge doctor` checks the Claude CLI, your config and the build if anything looks off, and `forge update` installs the latest release.\n\nPrefer not to install globally? `npx @ipul-labs/forge init` and `npx @ipul-labs/forge start` do the same.\n\n### Working on Forge itself\n\nFrom a checkout of the source:\n\n```bash\nnpm install\nnpm run dev # http://localhost:5000 (frontend) with the API on :5001\nnpm run build && npm start # production build, served on :5001\n```\n\n`npm run test:package` packs the repo exactly as npm would, installs the tarball into an empty folder, and runs the end-to-end checks against that install.\n\n### CLI usage\n\nThe `forge` CLI drives the same orchestrator from the terminal. After the global install above it is on your PATH; otherwise prefix commands with `npx @ipul-labs/forge`.\n\n#### Interactive mode\n\nRun `forge` with no arguments to enter an interactive terminal session:\n\n```bash\nforge\n```\n\n```\n forge v1.15.1\n\n──────────────────────────────────────────────────\n ❯ issues --limit 5\n──────────────────────────────────────────────────\n group/repo | agent:claude | v1.15.1\n```\n\nTab-completes command names. Type `use <repo>` to switch repos. Commands that error stay in the session — only `exit`, `quit`, or Ctrl+D leave.\n\n#### End-to-end: issue to production\n\n```bash\nforge ship 42\n```\n\nRuns: analyze → review → validate → apply → watch CI → merge → watch deploy → close, with a `y/N` gate at every state-changing step.\n\n#### Step-by-step commands\n\n```bash\nforge issues # List open issues (--label X, --mine, --limit N)\nforge issue 42 # Show full description\nforge create-issue --title \"fix: broken widget\" # Create a new issue\nforge analyze 42 # Run two-pass analysis, cache result\nforge show # Re-render cached analysis\nforge refine --feedback \"...\" # Iterate with feedback\nforge validate # Run lint/typecheck/test against proposed changes\nforge apply # Push branch + open MR\nforge watch # Poll the MR pipeline\nforge ci-fix # Re-analyze with failed-pipeline logs\nforge merge # Merge the MR\nforge resolution-check # Verify merged MR closes the issue\nforge close # Close the issue\nforge use group/other-repo # Switch active repo\nforge update # Install the latest release (a source checkout pulls instead)\nforge improve # Evaluate patterns and suggest improvements\nforge improve --create # Create improvement issues in the repo\n```\n\n#### Options\n\n```\n-p, --port <n> Port for start\n--repo <group/repo> Primary repo\n--secondary <repo> Additional repo (repeatable)\n--all-repos Include every configured repo\n--model <id> Claude model override\n--agent <name> Agent backend: claude\n--prompt <text> Extra user prompt\n--json JSON output\n--quiet Suppress progress\n--yes Skip confirmation gates\n--validate Run validate before apply\n```\n\n#### Diagnostics\n\n```bash\nforge doctor # Check prerequisites (node, claude CLI, env vars)\nforge session list # List cached sessions\nforge session clean # Remove stale session data\nforge reset-password <email> # Locked out? Set a new password on the Forge host\n```\n\n`reset-password` writes straight to the Forge database (`FORGE_DB_PATH`, default `~/.forge/forge.db`), so it works without signing in and only for someone with shell access to the host. It asks for the new password twice without echoing it (or reads one line from piped stdin), signs the account out everywhere, and records `user.password_reset` in the audit log. SSO accounts are refused; their passwords live with the identity provider.\n\n`forge help` lists every command and its options.\n\n---\n\n## Configuration\n\n### Core\n\n| Variable | Required | Description |\n|---|---|---|\n| `FORGE_TOKEN` | — | Admin credential for automation; also accepted as the remote setup code. Never sent to the browser |\n| `FORGE_REPOS` | Yes | Comma-separated repo list; first entry is the primary project |\n| `SCM_PROVIDER` | — | `gitlab` (default) · `github` · `azuredevops` |\n| `ANTHROPIC_API_KEY` | — | Enables live model list from Anthropic; falls back to hardcoded list. Never used to run Claude |\n| `FORGE_MODEL` | — | Override default model (default: `claude-sonnet-4-6`) |\n| `FORGE_AGENT_MODE` | — | `structured` (default) · `agentic` — how Claude proposes changes (see [Agent modes](#agent-modes)) |\n| `PORT` | — | HTTP server port (default: `5001`) |\n\n### Identity and storage\n\n| Variable | Required | Description |\n|---|---|---|\n| `FORGE_DB_PATH` | — | SQLite database for members, sessions, API tokens and the audit log (default `~/.forge/forge.db`) |\n| `FORGE_ENCRYPTION_KEY` | — | Base64 32-byte key used to encrypt SCM tokens at rest. Without it Forge generates `~/.forge/master.key` (`FORGE_KEY_PATH`) |\n| `FORGE_OIDC_ISSUER` | — | OIDC issuer URL (Okta, Entra ID, Google Workspace, GitLab, …). Enables \"Continue with SSO\" |\n| `FORGE_OIDC_CLIENT_ID` / `FORGE_OIDC_CLIENT_SECRET` | — | OIDC client credentials |\n| `FORGE_PUBLIC_URL` | — | External URL; the OIDC redirect is `${FORGE_PUBLIC_URL}/api/forge/auth/oidc/callback` unless `FORGE_OIDC_REDIRECT_URI` is set |\n| `FORGE_OIDC_NAME` | — | Label on the sign-in button (default `SSO`) |\n| `FORGE_OIDC_ALLOWED_DOMAINS` | — | Comma-separated email domains allowed to sign in with SSO |\n| `FORGE_OIDC_DEFAULT_ROLE` | — | Role given to new SSO members (default `viewer`) |\n| `FORGE_TRUST_PROXY` | — | Express `trust proxy` setting when behind a load balancer |\n| `FORGE_COOKIE_SECURE` | — | Override Secure cookies (on by default in production) |\n| `FORGE_DISABLE_SERVICE_TOKEN` | — | `1` stops `FORGE_TOKEN` working as an API credential once setup is done |\n\n### Claude billing\n\nBy default the `claude` CLI runs on the Claude Code subscription it is logged in with, and Forge strips `ANTHROPIC_API_KEY` from its environment so an env key can't quietly switch it to API credits.\n\nAn admin can save a workspace **Anthropic API key** in Settings → Connections. Claude then runs on that account's API credits instead. This is the mode for a hosted Forge serving other teams, since a personal subscription is only for its owner's own use. The key is encrypted at rest like SCM tokens, shown back only as a hint, and clearing it returns Claude to the subscription.\n\n### Provider credentials\n\nSCM tokens can be set here **or** in the Forge Settings UI (Settings → Connections). The UI value takes precedence over env vars.\n\n#### GitLab (`SCM_PROVIDER=gitlab`, default)\n\n| Variable | Required | Description |\n|---|---|---|\n| `GITLAB_TOKEN` | Yes | Personal access token with `api` + `write_repository` scopes |\n\n#### GitHub (`SCM_PROVIDER=github`)\n\n| Variable | Required | Description |\n|---|---|---|\n| `GITHUB_TOKEN` | Yes | Personal access token with `repo` + `workflow` scopes |\n| `GITHUB_OWNER` | Yes | Organization or user, e.g. `ipul-labs` |\n| `GITHUB_REPO` | Yes | Repository name, e.g. `web-app` |\n| `GITHUB_BASE_BRANCH` | — | Default target branch (default: `main`) |\n\n#### Azure DevOps (`SCM_PROVIDER=azuredevops`)\n\n| Variable | Required | Description |\n|---|---|---|\n| `AZURE_DEVOPS_TOKEN` | Yes | Personal access token (Full access or Code + Work Items) |\n| `AZURE_DEVOPS_ORG` | Yes | Organization name, e.g. `ipul-labs` |\n| `AZURE_DEVOPS_PROJECT` | Yes | Team project name, e.g. `web-app` |\n| `AZURE_DEVOPS_REPO` | — | Git repo name (defaults to project name) |\n| `AZURE_DEVOPS_BASE_BRANCH` | — | Default target branch (default: `main`) |\n\n### Deprecated (still work as fallbacks)\n\n| Variable | Replaced by |\n|---|---|\n| `FORGE_GITLAB_PROJECT` | First entry in `FORGE_REPOS` |\n| `FORGE_REFINE_REPO_ACCESS` | Settings UI toggle (Settings → Defaults) |\n\nSee `.env.example` for a full annotated list.\n\n---\n\n## Multi-provider support\n\nForge's SCM layer is a clean provider abstraction — all three providers implement the same `ScmProvider` interface and return identical normalized shapes (`NormalIssue`, `NormalMR`, `NormalPipeline`, etc.). The rest of the codebase never knows which provider is active.\n\n### Switching providers\n\n```bash\n# .env\nSCM_PROVIDER=github\nGITHUB_TOKEN=ghp_...\nGITHUB_OWNER=my-org\nGITHUB_REPO=my-repo\n```\n\n### Per-repo prefix (multi-repo mixed-provider setups)\n\n```bash\nFORGE_REPOS=gitlab:ipul/web-app,github:my-org/mobile\n```\n\n### Provider capabilities\n\n| Feature | GitLab | GitHub | Azure DevOps |\n|---|---|---|---|\n| Issues / Work Items | Yes | Yes | Yes (Work Items) |\n| Multi-file commits | Yes | Yes (Git Data API) | Yes (Pushes API) |\n| Merge / Pull Requests | Yes | Yes | Yes |\n| CI pipelines | Yes (GitLab CI) | Yes (GitHub Actions) | Yes (Azure Pipelines) |\n| Pipeline history page | Yes | — | — |\n| Job log traces | Yes | Yes | Yes |\n| Server-side rebase | Yes | — | — |\n| Ticket labels | Yes | Yes | Yes (Tags) |\n| Delete tickets | Yes (project Owner) | — (close instead) | Yes (recycle bin) |\n| Review env link on MRs | Yes (environment deployed by the MR pipeline) | — | — |\n\nOn GitLab, the MR tab shows a **Review env ↗** link when the MR's pipeline has deployed a live environment with an external URL (e.g. a `review/mr-<iid>` job with `environment:url`). No config needed; MRs without one show nothing.\n\n---\n\n## Security\n\nForge is designed for self-hosted deployment on trusted infrastructure. Security measures in place:\n\n- **Member accounts** — each person signs in with a password (scrypt) or SSO (OIDC with PKCE). Sessions are httpOnly, SameSite cookies stored server-side as hashes, with a 12-hour idle and 7-day absolute limit. No credential ever reaches browser JavaScript or the client bundle\n- **Roles** — viewer, operator, approver and admin, enforced on every API route. Merging needs approver; connections, repos and members need admin\n- **Audit log** — every sign-in and every change is recorded with who, what, where and the outcome. It is append-only and visible to admins under Audit log\n- **Encryption at rest** — SCM tokens in `~/.forge/config.json` are sealed with AES-256-GCM\n- **CSRF protection** — cookie-authenticated writes require a custom request header\n- **Brute-force protection** — accounts lock for 15 minutes after 5 failed sign-ins, and sign-in endpoints are rate-limited per IP. API calls are rate-limited per member\n- **API tokens** — personal tokens for the CLI and automation, shown once, stored hashed and revocable\n- **Security headers** — Helmet middleware sets X-Frame-Options, HSTS, X-Content-Type-Options, and CSP (production)\n- **Request size limits** — JSON body capped at 1MB to prevent memory exhaustion\n- **Secret redaction** — error logs and API responses scrub tokens (`glpat-*`, `ghp_*`, `oauth2:*@`) before output\n- **File permissions** — config files (`~/.forge/config.json`) written with `0600`, session directories with `0700`\n- **Git credential isolation** — SCM tokens passed via `GIT_ASKPASS` helper, never embedded in clone URLs\n- **Path traversal protection** — symlink-aware `realpath` checks prevent file writes outside clone directories\n- **No shell injection** — all subprocess calls use `spawn()` with argument arrays, never shell strings\n- **Atomic config writes** — config updates use temp file + rename to prevent corruption\n\n`FORGE_TOKEN`, when set, is an admin credential for automation. Use a long random value, never reuse an SCM token, and set `FORGE_DISABLE_SERVICE_TOKEN=1` once your team uses personal API tokens.\n\n### First run\n\nOpen Forge and create the first admin account. On the server machine itself (`localhost`) that is all it takes. From anywhere else the form asks for a setup code, which Forge prints to its log on first start (or your `FORGE_TOKEN`, if set), so nobody can claim a fresh install that is reachable on the network. Add the rest of your team under **Members**, or turn on SSO with the `FORGE_OIDC_*` variables.\n\nThe `forge` CLI authenticates with a personal API token: create one under **Settings → API tokens** and export it as `FORGE_API_TOKEN`.\n\n---\n\n## Production deployment\n\nOn a server, install from npm and run `forge start` as a service (systemd, pm2 or similar) from the folder holding your `.env`. Put it behind your HTTPS reverse proxy and set `FORGE_PUBLIC_URL` to the address people use.\n\nFrom a source checkout:\n\n```bash\nnpm run build # builds the SPA to dist/\nNODE_ENV=production tsx server.ts\n```\n\nOr with Docker, from a checkout:\n\n```bash\ndocker build -t forge .\ndocker run -p 5001:5001 --env-file .env -v forge-data:/data forge\n```\n\n### Kubernetes\n\n`manifests/forge/` holds an example Deployment, Service, ConfigMap and Secret template. Build and push the Docker image to your own registry, set `image` in `deployment.yaml`, create the secret, then:\n\n```bash\nkubectl create namespace forge\nkubectl apply -n forge -f manifests/forge/\n```\n\n---\n\n## Architecture\n\nFull-stack TypeScript. The backend runs via `tsx` (no build step); the frontend compiles through Vite.\n\n```\nbin/\n forge-agent.ts # CLI entry point (forge command)\n cli/\n ship.ts # End-to-end orchestrator (Ink UI)\n analyze.ts # Two-pass issue analysis\n repl.ts # Interactive terminal (Ink-based)\n serverClient.ts # CLI → Server API client (server/local mode)\n sessionStore.ts # ~/.forge/sessions/ persistence\n ...\n\nshared/\n events.ts # FORGE_EVENTS constants (server + client)\n\nserver/\n forge/\n routes.ts # Express router — all /api/forge/* endpoints\n core/\n ForgeAgent.ts # Orchestrates the full pipeline (analyze -> apply -> refine)\n claudeClient.ts # Shells out to the claude CLI for structured output\n agentClient.ts # Thin wrapper over claudeClient\n jobs.ts # Job store with SSE event buffering + replay\n providers/\n base.ts # Abstract ScmProvider — normalized shapes + interface\n gitlab.ts # GitLab REST API v4\n github.ts # GitHub REST API v3 + Git Data API\n azuredevops.ts # Azure DevOps REST API\n index.ts # createProvider() factory\n\nsrc/\n views/Forge/\n ForgeDashboard.tsx # Root UI component with tabbed issue/MR views\n api.ts # Session-aware fetch helper (cookie + CSRF header)\n types.ts # Shared TypeScript types\n utils.ts # SSE helper + state utilities\n ui.ts # Shared responsive class tokens (touch-sized actions)\n components/ # Analysis progress, pipeline status, diff viewer, Sheet, Switch\n shell/ # App chrome: sidebar (drawer on phones), top bar, command palette, phone tab bar\n useNav.ts # Single nav definition shared by sidebar, tab bar and command palette\n hooks/\n useForgeDashboard.ts # All state, phase transitions, and API calls\n useForgeEvents.ts # SSE event bus subscription\n```\n\n### Mobile layout\n\nBelow Tailwind's `md` breakpoint (768px) the dashboard adds iOS-style touches on top of the responsive shell: a bottom tab bar (Issues · Merge requests · Pipelines · Settings) on list pages, a New task button in the top bar, New Task as a bottom sheet, iOS switches, full-width 50pt primary actions, and 16px form fields so Safari doesn't zoom. The sidebar (repo picker, usage, theme, admin pages, sign-out) opens as a drawer from the top bar. It respects safe-area insets and uses `100dvh`, so it works as a home-screen web app on iPhone. Desktop layout is unchanged.\n\n### Install as an app (PWA)\n\nForge ships a web app manifest (`public/manifest.webmanifest`) and icons, so it can be installed. On iPhone open it in Safari → Share → **Add to Home Screen**; on Android/Chrome use **Install app**. It opens standalone at `/issues`. The icon source is `public/icon.svg`; regenerate the PNGs after changing it:\n\n```bash\nfor s in 180 192 512; do magick -background none -density 384 public/icon.svg -resize ${s}x${s} -strip PNG32:public/icon-$s.png; done\nmv public/icon-180.png public/apple-touch-icon.png\n```\n\nIf the app bundle fails to load or throws before React mounts, `public/boot-check.js` reloads once (a stale bundle after a deploy) and then shows the error with the browser's user agent and a Reload button instead of a blank screen. In production a missing file under `/assets/` returns 404 rather than `index.html`, so a stale bundle fails visibly.\n\n### Agent modes\n\nForge can drive Claude in two ways, set by `FORGE_AGENT_MODE` (or the Settings default, or a per-request `agentMode`):\n\n- **`structured`** (default) — the two-pass JSON pipeline below. Deterministic and schema-validated: Claude runs single-turn with tools disabled and returns complete file contents that Forge overlays onto a clone.\n- **`agentic`** — Claude runs as a full Claude Code agent inside a checkout of the repo: real tools (Read/Edit/Write/Bash…), the project's own `CLAUDE.md`, and a multi-turn loop. Forge captures the resulting `git diff` instead of parsing JSON, then feeds those changes into the same apply/validate/MR pipeline. The capture never includes symlinks or dependency folders (`node_modules`, `bower_components`, `jspm_packages`, `.venv`, `__pycache__`), whatever the repo's `.gitignore` says; anything left out is noted in the run log. Higher fidelity, less determinism. Requires the `claude` backend, a single repo, and a GitLab primary — otherwise Forge logs why and falls back to structured. Pick the mode under **Settings → Defaults → Agent mode**.\n\n Refine follows the mode too. In agentic mode a follow-up (\"open it in Playwright and check it\", \"rename the prop\") runs as the same full agent in the issue's worktree with the current proposal already applied, so it can run tests and browsers, gather evidence and edit. If it changes nothing and gathers no evidence, its reply comes back as an answer and the proposal is left as it was. In structured mode, refine only gets read-only repo access (Read/Glob/Grep), so it can't run anything. CI-fix refines always use the structured fix.\n\n### Rules and evidence\n\n**Settings → Defaults → Prompt rules** is free text added to every analysis and refine prompt as \"Custom rules — always follow these\", in both modes. In agentic mode the target repo's `CLAUDE.md` applies as well, so repo conventions belong there and Forge-wide instructions belong in the rules.\n\nIn agentic mode a rule can also ask for proof, e.g. *\"Run the e2e tests and screenshot every page you changed, at desktop and phone width.\"* Forge doesn't capture anything itself: the agent installs and runs what it needs (Playwright and its browsers included) and leaves the results in `.forge-evidence/` at the checkout root:\n\n- `.forge-evidence/EVIDENCE.md` — what it ran and what it saw; images are linked by file name (``)\n- PNG/JPEG/GIF/WebP screenshots next to it (nested folders are fine; up to 10 images, 10 MB each)\n\nAfter the run Forge uploads the images to the GitLab project, points the write-up's links at the uploads (appending any image it didn't mention), and puts the result in the MR's **🧪 Testing** section. The folder is cleared before each run and listed in the clone's `.git/info/exclude`, so it is never committed. A failed upload is logged in the activity feed and doesn't fail the analysis. The agent's run is bounded by `cliTimeout` (10 minutes by default), so a full browser install plus a long suite may need more.\n\n### Workspaces\n\nEvery local checkout Forge works in lives under `~/.forge/cache` (or `FORGE_VALIDATE_CACHE`):\n\n```\nrepos/<repo>/ shallow base clone, one per repo\nworktrees/<repo>/issue-<iid>/ git worktree per issue, on its forge/issue-… branch\n```\n\nAgentic runs, refine (with repo access) and validation each lease the issue's worktree, reset it to the remote HEAD, and release it when done. Different issues never share a tree, and git work on one repo (fetch, worktree add/remove) is serialised. Ignored files such as `node_modules` survive between runs of the same issue.\n\n**Settings → Workspaces** (admins) lists every base clone and worktree with its size, last use and whether a running job holds it, plus anything Forge doesn't own any more: clones from the old one-clone-per-repo layout (\"Old-layout clone\") and worktree folders git no longer knows about (\"Stray folder\"). You can delete one, or **Purge idle** to remove everything not in use; tick *Include base clones* to drop base clones that have no worktrees left too. A deleted workspace is simply re-created by the next job that needs it. The same actions are available as `GET /workspaces`, `DELETE /workspaces?id=<id>` and `POST /workspaces/purge` (`{\"includeBases\": true}`); a workspace in use answers 409.\n\n### Two-pass analysis (structured mode)\n\n**Pass 1** — `identifyRelevantFiles`: Claude reads the issue + file tree, returns the max-6 most relevant paths.\n\n**Pass 2** — `proposeFix`: Claude reads the actual file contents and proposes a targeted fix as a JSON diff.\n\nBoth passes use `claude --print --output-format json` so cost and service tier are tracked automatically.\n\n### CI refinement\n\nWhen a pipeline fails, Forge fetches the last 150 lines of each failed job's trace log and feeds them to pass 2 with an explicit \"pipeline failed\" framing — not generic reviewer feedback. This improves fix quality for common failures like lint errors and type errors.\n\n### Provider abstraction\n\nAll three SCM providers implement `ScmProvider` from `providers/base.ts`. The contract is:\n- **Normalized return types** — all methods return `NormalIssue`, `NormalMR`, `NormalPipeline`, etc., regardless of provider\n- **Instance-scoped** — each provider is instantiated with a repo string; no global state\n- **`supportsRebase`** — providers that don't support server-side rebase return `false`; the UI and API layer check this before showing the rebase button\n\n---\n\n## Programmatic usage\n\nThe npm package ships compiled JavaScript with TypeScript declarations — no `tsx` or TypeScript runtime needed by consumers.\n\n```ts\nimport { createApi } from \"@ipul-labs/forge/app\"; // Express app with auth + API\nimport { ForgeAgent } from \"@ipul-labs/forge/agent\"; // Core pipeline class\nimport { createProvider } from \"@ipul-labs/forge/providers\"; // SCM factory\n```\n\nThe bare router (`@ipul-labs/forge`) expects the auth stack in front of it and rejects requests without a signed-in principal. Mount `createApi({ db, env: process.env, isProd })` instead, with `db` from `openDatabase`.\n\n```ts\nconst agent = new ForgeAgent({ project: \"group/repo\" });\nconst result = await agent.analyzeIssue(42, (event) => console.log(event));\nconst { branchName, mr } = await agent.applyFix(result);\n```\n\n### Development\n\nSource is TypeScript (`.ts`). The dev server runs via `tsx` (no build step). For the npm package, `tsc` compiles to `lib/` with declarations during `prepack`.\n\n```bash\nnpm run dev # tsx watch + vite (dev)\nnpm run build:server # compile server/bin/shared → lib/\nnpm run typecheck # check both frontend + server configs\n```\n\n---\n\n## Contributing\n\nThe source repository is private for now. Send bug reports, ideas and security problems to support@ipullabs.com; please report security problems privately rather than in public.\n\n## Support\n\nQuestions or problems with Forge: support@ipullabs.com\n\n---\n\n## License\n\nMIT. Forge is free to use, change and share, for personal or commercial work. The full license text is in the `LICENSE` file that ships with the package.\n"
|
|
89
104
|
}
|
package/lib/bin/cli/improve.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"improve.d.ts","sourceRoot":"","sources":["../../../bin/cli/improve.ts"],"names":[],"mappings":"AAmMA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9D"}
|
package/lib/bin/cli/improve.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
import { useEffect, useState } from "react";
|
|
11
|
-
import Spinner from "ink-spinner";
|
|
12
|
-
import { h, Box, Text, useApp, runApp } from "./ink.js";
|
|
13
|
-
import { projectRoot, getFlag } from "./utils.js";
|
|
14
|
-
async function resolveSelfRepo(argv) {
|
|
15
|
-
const explicit = getFlag(argv, "--repo");
|
|
16
|
-
if (explicit)
|
|
17
|
-
return explicit;
|
|
18
|
-
if (process.env.FORGE_SELF_REPO)
|
|
19
|
-
return process.env.FORGE_SELF_REPO;
|
|
20
|
-
try {
|
|
21
|
-
const { get } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/configStore.ts")));
|
|
22
|
-
const repos = get()?.repos ?? [];
|
|
23
|
-
const forgeRepo = repos.find((r) => r.id.toLowerCase().includes("forge"));
|
|
24
|
-
if (forgeRepo)
|
|
25
|
-
return forgeRepo.id;
|
|
26
|
-
}
|
|
27
|
-
catch { }
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
function ImproveView({ mode, repo, onDone }) {
|
|
31
|
-
const { exit } = useApp();
|
|
32
|
-
const [phase, setPhase] = useState("evaluating");
|
|
33
|
-
const [result, setResult] = useState(null);
|
|
34
|
-
const [issues, setIssues] = useState([]);
|
|
35
|
-
const [currentShip, setCurrentShip] = useState(null);
|
|
36
|
-
const [error, setError] = useState(null);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (phase === "done" || phase === "error") {
|
|
39
|
-
onDone(result, issues);
|
|
40
|
-
exit();
|
|
41
|
-
}
|
|
42
|
-
}, [phase]);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
(async () => {
|
|
45
|
-
try {
|
|
46
|
-
const { evaluate, formatIssueBody } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/selfImprove.ts")));
|
|
47
|
-
const evalResult = await evaluate();
|
|
48
|
-
setResult(evalResult);
|
|
49
|
-
if (mode === "evaluate" || evalResult.diagnoses.length === 0 || !repo) {
|
|
50
|
-
setPhase("done");
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
setPhase("creating");
|
|
54
|
-
const { createProvider } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/providers/index.ts")));
|
|
55
|
-
const provider = createProvider(repo);
|
|
56
|
-
const created = [];
|
|
57
|
-
for (const diagnosis of evalResult.diagnoses.slice(0, 3)) {
|
|
58
|
-
const body = formatIssueBody(diagnosis);
|
|
59
|
-
const title = `[self-improve] ${diagnosis.title}`;
|
|
60
|
-
const issue = await provider.createIssue(title, body);
|
|
61
|
-
created.push({ iid: issue.iid, title, confidence: diagnosis.confidence, shipped: false });
|
|
62
|
-
}
|
|
63
|
-
setIssues(created);
|
|
64
|
-
if (mode !== "ship" || created.length === 0) {
|
|
65
|
-
setPhase("done");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
setPhase("shipping");
|
|
69
|
-
const { execSync } = await import("node:child_process");
|
|
70
|
-
for (const issue of created) {
|
|
71
|
-
if (issue.confidence === "low") {
|
|
72
|
-
issue.shipError = "skipped: low confidence — needs manual review";
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
setCurrentShip(`#${issue.iid}: ${issue.title}`);
|
|
76
|
-
try {
|
|
77
|
-
execSync(`forge ship ${issue.iid} --repo ${repo} --yes`, { cwd: projectRoot, stdio: "inherit", timeout: 600_000 });
|
|
78
|
-
issue.shipped = true;
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
issue.shipError = err.message?.slice(0, 200) ?? "ship failed";
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
setIssues([...created]);
|
|
85
|
-
setPhase("done");
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
setError(err.message);
|
|
89
|
-
setPhase("error");
|
|
90
|
-
}
|
|
91
|
-
})();
|
|
92
|
-
}, []);
|
|
93
|
-
if (phase === "evaluating") {
|
|
94
|
-
return h `<${Box}>
|
|
95
|
-
<${Text} color="cyan"><${Spinner} type="dots"/></>
|
|
96
|
-
<${Text}> Evaluating telemetry patterns...</>
|
|
97
|
-
</>`;
|
|
98
|
-
}
|
|
99
|
-
if (phase === "creating") {
|
|
100
|
-
return h `<${Box}>
|
|
101
|
-
<${Text} color="cyan"><${Spinner} type="dots"/></>
|
|
102
|
-
<${Text}> Creating improvement issues...</>
|
|
103
|
-
</>`;
|
|
104
|
-
}
|
|
105
|
-
if (phase === "shipping") {
|
|
106
|
-
return h `<${Box} flexDirection="column">
|
|
107
|
-
<${Box}>
|
|
108
|
-
<${Text} color="cyan"><${Spinner} type="dots"/></>
|
|
109
|
-
<${Text}> Shipping fix...</>
|
|
110
|
-
</>
|
|
111
|
-
${currentShip ? h `<${Text} dimColor> ${currentShip}</>` : null}
|
|
112
|
-
</>`;
|
|
113
|
-
}
|
|
114
|
-
if (phase === "error") {
|
|
115
|
-
return h `<${Text} color="red">Error: ${error}</>`;
|
|
116
|
-
}
|
|
117
|
-
if (!result)
|
|
118
|
-
return null;
|
|
119
|
-
const { diagnoses, summary } = result;
|
|
120
|
-
return h `<${Box} flexDirection="column" paddingLeft=${1}>
|
|
121
|
-
<${Text} bold>Self-improvement evaluation</>
|
|
122
|
-
<${Text} dimColor>${summary.totalEvents} telemetry events, ${result.patterns.length} failure patterns</>
|
|
123
|
-
|
|
124
|
-
${diagnoses.length === 0
|
|
125
|
-
? h `<${Box} marginTop=${1}><${Text} color="green">No actionable patterns found. Forge is operating normally.</></>`
|
|
126
|
-
: h `<${Box} flexDirection="column" marginTop=${1}>
|
|
127
|
-
<${Text} bold>${diagnoses.length} improvement${diagnoses.length === 1 ? "" : "s"} identified:</>
|
|
128
|
-
${diagnoses.map((d, i) => h `<${Box} key=${i} marginLeft=${1} marginTop=${1} flexDirection="column">
|
|
129
|
-
<${Box}>
|
|
130
|
-
<${Text} color=${d.severity === "high" ? "red" : d.severity === "medium" ? "yellow" : "white"}>
|
|
131
|
-
${d.severity === "high" ? "▲" : d.severity === "medium" ? "●" : "○"}
|
|
132
|
-
</>
|
|
133
|
-
<${Text} bold>${d.title}</>
|
|
134
|
-
</>
|
|
135
|
-
<${Text} dimColor> ${d.category} — ${d.evidence.length} evidence items</>
|
|
136
|
-
</>`)}
|
|
137
|
-
</>`}
|
|
138
|
-
|
|
139
|
-
${issues.length > 0
|
|
140
|
-
? h `<${Box} flexDirection="column" marginTop=${1}>
|
|
141
|
-
<${Text} bold>Issues:</>
|
|
142
|
-
${issues.map((iss, i) => h `<${Box} key=${i} marginLeft=${1}>
|
|
143
|
-
<${Text} color=${iss.shipped ? "green" : iss.shipError ? "red" : "yellow"}>
|
|
144
|
-
${iss.shipped ? "✓" : iss.shipError ? "✘" : "●"}
|
|
145
|
-
</>
|
|
146
|
-
<${Text}> #${iss.iid} ${iss.title}</>
|
|
147
|
-
${iss.shipped ? h `<${Text} color="green"> — MR opened</>` : null}
|
|
148
|
-
${iss.shipError ? h `<${Text} color="red"> — ${iss.shipError}</>` : null}
|
|
149
|
-
</>`)}
|
|
150
|
-
</>`
|
|
151
|
-
: null}
|
|
152
|
-
</>`;
|
|
153
|
-
}
|
|
154
|
-
async function isAuthorized() {
|
|
155
|
-
try {
|
|
156
|
-
const { get } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/configStore.ts")));
|
|
157
|
-
const config = get();
|
|
158
|
-
return config?.defaults?.selfImproveEnabled === true;
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
export async function cmdImprove(argv) {
|
|
165
|
-
if (!(await isAuthorized()) && !argv.includes("--force")) {
|
|
166
|
-
console.error("forge improve is disabled. Enable in Settings → Defaults → Self-improve.");
|
|
167
|
-
process.exit(1);
|
|
168
|
-
}
|
|
169
|
-
const ship = argv.includes("--ship");
|
|
170
|
-
const create = argv.includes("--create") || ship;
|
|
171
|
-
const json = argv.includes("--json");
|
|
172
|
-
const repo = await resolveSelfRepo(argv);
|
|
173
|
-
const mode = ship ? "ship" : create ? "create" : "evaluate";
|
|
174
|
-
if (json) {
|
|
175
|
-
const { evaluate } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/selfImprove.ts")));
|
|
176
|
-
const result = await evaluate();
|
|
177
|
-
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if ((create || ship) && !repo) {
|
|
181
|
-
console.error("No forge repo configured. Add a repo with 'forge' in its ID, or set FORGE_SELF_REPO.");
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
184
|
-
await runApp(h `<${ImproveView}
|
|
185
|
-
mode=${mode}
|
|
186
|
-
repo=${repo}
|
|
187
|
-
onDone=${(r, _issues) => { void r; }} />`);
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=improve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"improve.js","sourceRoot":"","sources":["../../../bin/cli/improve.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAA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AM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5D"}
|
package/lib/bin/cli/stats.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
import { useEffect, useState } from "react";
|
|
11
|
-
import { h, Box, Text, useApp, runApp } from "./ink.js";
|
|
12
|
-
import { projectRoot } from "./utils.js";
|
|
13
|
-
function StatsView({ json }) {
|
|
14
|
-
const { exit } = useApp();
|
|
15
|
-
const [summary, setSummary] = useState(null);
|
|
16
|
-
const [patterns, setPatterns] = useState([]);
|
|
17
|
-
const [error, setError] = useState(null);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
(async () => {
|
|
20
|
-
try {
|
|
21
|
-
const { getSummary, getFailurePatterns } = await import(__rewriteRelativeImportExtension(path.join(projectRoot, "server/forge/core/telemetry.ts")));
|
|
22
|
-
const [s, p] = await Promise.all([getSummary(), getFailurePatterns()]);
|
|
23
|
-
setSummary(s);
|
|
24
|
-
setPatterns(p);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
setError(err.message);
|
|
28
|
-
}
|
|
29
|
-
})();
|
|
30
|
-
}, []);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (summary || error)
|
|
33
|
-
exit();
|
|
34
|
-
}, [summary, error]);
|
|
35
|
-
if (error) {
|
|
36
|
-
return h `<${Box}><${Text} color="red">Failed to load telemetry: ${error}</></>`;
|
|
37
|
-
}
|
|
38
|
-
if (!summary)
|
|
39
|
-
return null;
|
|
40
|
-
if (json) {
|
|
41
|
-
process.stdout.write(JSON.stringify({ summary, patterns }, null, 2) + "\n");
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const ops = Object.entries(summary.byOperation);
|
|
45
|
-
return h `<${Box} flexDirection="column" paddingLeft=${1}>
|
|
46
|
-
<${Box} marginBottom=${1}>
|
|
47
|
-
<${Text} bold>Forge Telemetry</>
|
|
48
|
-
<${Text} dimColor> ${summary.totalEvents} events recorded</>
|
|
49
|
-
</>
|
|
50
|
-
|
|
51
|
-
${ops.length === 0
|
|
52
|
-
? h `<${Text} dimColor>No telemetry data yet. Run some commands first.</>`
|
|
53
|
-
: ops.map(([op, stats]) => h `<${Box} key=${op} flexDirection="column" marginBottom=${1}>
|
|
54
|
-
<${Box}>
|
|
55
|
-
<${Text} bold color="cyan">${op}</>
|
|
56
|
-
<${Text}> ${stats.total} total </>
|
|
57
|
-
<${Text} color="green">${stats.successes} ok</>
|
|
58
|
-
<${Text}> </>
|
|
59
|
-
<${Text} color=${stats.failures > 0 ? "red" : "green"}>${stats.failures} failed</>
|
|
60
|
-
<${Text} dimColor> avg ${(stats.avgDurationMs / 1000).toFixed(1)}s</>
|
|
61
|
-
${stats.totalCost > 0 ? h `<${Text} dimColor> $${stats.totalCost.toFixed(4)}</>` : null}
|
|
62
|
-
</>
|
|
63
|
-
</>`)}
|
|
64
|
-
|
|
65
|
-
${patterns.length > 0 ? h `<${Box} flexDirection="column" marginTop=${1}>
|
|
66
|
-
<${Text} bold color="yellow">Recurring failure patterns</>
|
|
67
|
-
${patterns.map((p, i) => h `<${Box} key=${i} marginLeft=${1}>
|
|
68
|
-
<${Text} color="red">${p.count}x</>
|
|
69
|
-
<${Text}> ${p.operation}: ${p.errorPattern}</>
|
|
70
|
-
</>`)}
|
|
71
|
-
</>` : null}
|
|
72
|
-
</>`;
|
|
73
|
-
}
|
|
74
|
-
export async function cmdStats(argv) {
|
|
75
|
-
const json = argv.includes("--json");
|
|
76
|
-
await runApp(h `<${StatsView} json=${json} />`);
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=stats.js.map
|
package/lib/bin/cli/stats.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../bin/cli/stats.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOzC,SAAS,SAAS,CAAC,EAAE,IAAI,EAAkB;IAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAmB,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACd,CAAC,KAAK,IAAI,EAAE;YACX,IAAI,CAAC;gBACJ,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,kCACtD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gCAAgC,CAAC,EACC,CAAC;gBAC3D,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC;gBACvE,UAAU,C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
|
-
desired: number;
|
|
7
|
-
ready: number;
|
|
8
|
-
available: number;
|
|
9
|
-
unavailable: number;
|
|
10
|
-
updated: number;
|
|
11
|
-
};
|
|
12
|
-
conditions: {
|
|
13
|
-
type: string;
|
|
14
|
-
status: string;
|
|
15
|
-
message: string;
|
|
16
|
-
}[];
|
|
17
|
-
}[]>;
|
|
18
|
-
//# sourceMappingURL=k8s.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"k8s.d.ts","sourceRoot":"","sources":["../../../../server/forge/core/k8s.ts"],"names":[],"mappings":"AA6DA,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;KAItD"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as k8s from "@kubernetes/client-node";
|
|
2
|
-
let kc = new k8s.KubeConfig();
|
|
3
|
-
function loadConfig() {
|
|
4
|
-
kc = new k8s.KubeConfig();
|
|
5
|
-
const token = process.env.K8S_CLUSTER_TOKEN;
|
|
6
|
-
const server = process.env.K8S_CLUSTER_SERVER;
|
|
7
|
-
if (token && server) {
|
|
8
|
-
kc.loadFromOptions({
|
|
9
|
-
clusters: [{ name: "cluster", server, skipTLSVerify: process.env.K8S_SKIP_TLS_VERIFY === "true" }],
|
|
10
|
-
users: [{ name: "admin", token }],
|
|
11
|
-
contexts: [{ name: "default", cluster: "cluster", user: "admin" }],
|
|
12
|
-
currentContext: "default",
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
kc.loadFromDefault();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
loadConfig();
|
|
20
|
-
function getAppsApi() {
|
|
21
|
-
return kc.makeApiClient(k8s.AppsV1Api);
|
|
22
|
-
}
|
|
23
|
-
function formatDeployment(dep) {
|
|
24
|
-
const containers = dep.spec?.template?.spec?.containers || [];
|
|
25
|
-
const status = dep.status || {};
|
|
26
|
-
return {
|
|
27
|
-
name: dep.metadata?.name,
|
|
28
|
-
namespace: dep.metadata?.namespace,
|
|
29
|
-
image: containers[0]?.image || "unknown",
|
|
30
|
-
replicas: {
|
|
31
|
-
desired: dep.spec?.replicas || 0,
|
|
32
|
-
ready: status.readyReplicas || 0,
|
|
33
|
-
available: status.availableReplicas || 0,
|
|
34
|
-
unavailable: status.unavailableReplicas || 0,
|
|
35
|
-
updated: status.updatedReplicas || 0,
|
|
36
|
-
},
|
|
37
|
-
conditions: (status.conditions || []).map((c) => ({
|
|
38
|
-
type: c.type,
|
|
39
|
-
status: c.status,
|
|
40
|
-
message: c.message,
|
|
41
|
-
})),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export async function listDeployments(namespace) {
|
|
45
|
-
const api = getAppsApi();
|
|
46
|
-
const res = await api.listNamespacedDeployment({ namespace });
|
|
47
|
-
return (res.items || []).map(formatDeployment);
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=k8s.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"k8s.js","sourceRoot":"","sources":["../../../../server/forge/core/k8s.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAc/C,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;AAE9B,SAAS,UAAU;IAClB,EAAE,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAE9C,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACrB,EAAE,CAAC,eAAe,CAAC;YAClB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,MAAM,EAAE,CAAC;YAClG,KAAK,EAAE,CAAC,E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