geloforge 0.6.0 → 0.9.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/README.md +84 -87
- package/VERSION +1 -1
- package/adapters/n8n/staging-audit-error-workflow.json +132 -0
- package/core/audit-learning.mjs +68 -0
- package/core/audit-provider.mjs +157 -0
- package/core/autonomous-audit.mjs +214 -0
- package/core/checkpoint.mjs +20 -10
- package/core/coding-loop.mjs +500 -0
- package/core/compatibility.json +1 -1
- package/core/context-cache.mjs +114 -0
- package/core/context-compiler.mjs +77 -10
- package/core/doctor.mjs +319 -0
- package/core/evidence-capture.mjs +24 -3
- package/core/hooks-init.mjs +245 -0
- package/core/mcp-init.mjs +13 -9
- package/core/mcp-lock.mjs +488 -0
- package/core/mcp-server.mjs +70 -8
- package/core/operation-approval.mjs +102 -0
- package/core/project-lock.mjs +49 -17
- package/core/project-status.mjs +68 -0
- package/core/promotion.mjs +90 -0
- package/core/runtime-files.mjs +40 -0
- package/core/skills-advisor.mjs +944 -0
- package/core/staging-audit.mjs +454 -0
- package/core/staging-evidence.mjs +127 -0
- package/core/task-manager.mjs +3 -1
- package/core/text-utils.mjs +63 -5
- package/core/worktrees.mjs +64 -0
- package/package.json +6 -2
- package/policies/approval-boundaries.md +4 -4
- package/policies/token-efficiency.md +9 -9
- package/schemas/approval-record.schema.json +9 -0
- package/scripts/geloforge.mjs +648 -14
- package/templates/project-starter/AGENTS.md +4 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { getGitRepoInfo } from "./git-utils.mjs";
|
|
5
|
+
import { assertSafeWithinRoot, isSameOrInside, validateSlug } from "./path-safety.mjs";
|
|
6
|
+
import { withProjectLock } from "./project-lock.mjs";
|
|
7
|
+
|
|
8
|
+
function git(projectDir, ...args) {
|
|
9
|
+
return execFileSync("git", ["-C", projectDir, ...args], {
|
|
10
|
+
encoding: "utf8", windowsHide: true, timeout: 30_000, stdio: ["ignore", "pipe", "pipe"],
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function manageWorktrees({ projectDir, workspace = path.dirname(projectDir), action, name, ref = "HEAD" }) {
|
|
15
|
+
const root = fs.realpathSync(path.resolve(workspace));
|
|
16
|
+
const worktreesDir = assertSafeWithinRoot(root, "worktrees");
|
|
17
|
+
if (isSameOrInside(worktreesDir, projectDir)) throw new Error("Worktrees must be outside the project's main checkout.");
|
|
18
|
+
const info = getGitRepoInfo(projectDir);
|
|
19
|
+
if (!info.isRepoRoot || info.unborn) throw new Error("Use an initialized Git project root with at least one commit.");
|
|
20
|
+
|
|
21
|
+
const list = () => {
|
|
22
|
+
if (!fs.existsSync(worktreesDir)) return [];
|
|
23
|
+
const canonicalDir = fs.realpathSync.native(worktreesDir);
|
|
24
|
+
const entries = git(projectDir, "worktree", "list", "--porcelain", "-z").split("\0\0");
|
|
25
|
+
return entries.flatMap((block) => {
|
|
26
|
+
const [entry, head, branch, ...flags] = block.split("\0");
|
|
27
|
+
if (!entry.startsWith("worktree ") || !head?.startsWith("HEAD ") || !branch?.startsWith("branch refs/heads/geloforge/")) return [];
|
|
28
|
+
const target = path.resolve(entry.slice(9));
|
|
29
|
+
try {
|
|
30
|
+
// Git for Windows may report a long path even when the workspace uses a short alias.
|
|
31
|
+
const canonicalParent = fs.realpathSync.native(path.dirname(target));
|
|
32
|
+
if (path.relative(canonicalDir, canonicalParent) !== "" || isSameOrInside(projectDir, target)) return [];
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (error.code === "ENOENT") return [];
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
const name = path.basename(target);
|
|
38
|
+
return [{ path: path.join(worktreesDir, name), name, commit: head.slice(5), branch: branch.slice(18), locked: flags.some((flag) => flag.startsWith("locked")) }];
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
if (action === "list") return { worktrees: list() };
|
|
42
|
+
|
|
43
|
+
validateSlug(name);
|
|
44
|
+
const target = assertSafeWithinRoot(root, `worktrees/${name}`);
|
|
45
|
+
return withProjectLock(projectDir, () => {
|
|
46
|
+
if (action === "add") {
|
|
47
|
+
const commit = git(projectDir, "rev-parse", "--verify", "--end-of-options", `${ref}^{commit}`).trim();
|
|
48
|
+
if (!/^[a-f0-9]{40,64}$/.test(commit) || fs.existsSync(target)) {
|
|
49
|
+
throw new Error("Worktree target must be unused and the ref must resolve to a commit.");
|
|
50
|
+
}
|
|
51
|
+
fs.mkdirSync(worktreesDir, { recursive: true });
|
|
52
|
+
git(projectDir, "worktree", "add", "-b", `geloforge/${name}`, "--", target, commit);
|
|
53
|
+
return { path: target, branch: `geloforge/${name}`, commit };
|
|
54
|
+
}
|
|
55
|
+
const existing = list().find((item) => item.path === target && item.branch === `geloforge/${name}`);
|
|
56
|
+
if (!existing) throw new Error("Managed worktree not found.");
|
|
57
|
+
// Git's default removal can discard ignored files, including local runtime state.
|
|
58
|
+
if (git(target, "status", "--porcelain=v1", "-z", "--untracked-files=all", "--ignored=matching")) {
|
|
59
|
+
throw new Error("Worktree contains uncommitted, untracked, or ignored files. Preserve them before removal.");
|
|
60
|
+
}
|
|
61
|
+
git(projectDir, "worktree", "remove", "--", target);
|
|
62
|
+
return { ...existing, removed: true };
|
|
63
|
+
});
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geloforge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Local, provider-neutral CLI for AI coding project memory, command-backed evidence, portable skills, and cross-agent handoffs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"core/",
|
|
32
|
+
"adapters/n8n/staging-audit-error-workflow.json",
|
|
32
33
|
"policies/",
|
|
33
34
|
"schemas/",
|
|
34
35
|
"scripts/bootstrap-project.mjs",
|
|
@@ -44,6 +45,9 @@
|
|
|
44
45
|
"bootstrap": "node scripts/bootstrap-project.mjs",
|
|
45
46
|
"geloforge": "node scripts/geloforge.mjs",
|
|
46
47
|
"benchmark": "node scripts/benchmark-context.mjs",
|
|
47
|
-
"
|
|
48
|
+
"eval": "node scripts/run-evals.mjs",
|
|
49
|
+
"smoke:package": "node scripts/smoke-fresh-install.mjs --packed",
|
|
50
|
+
"benchmark:cache": "node scripts/benchmark-context-cache.mjs",
|
|
51
|
+
"benchmark:audits": "node --test tests/staging-audit-worker.test.mjs"
|
|
48
52
|
}
|
|
49
53
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Security and Approval Boundaries Policy
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Enforcement scope:** GeloForge enforces the CLI checks listed below. OS permissions and provider sandbox settings govern other processes and their access.
|
|
4
4
|
|
|
5
5
|
## Technically Enforced Controls vs. Documented-Only Safeguards
|
|
6
6
|
|
|
7
|
-
| Control |
|
|
7
|
+
| Control | Status | Mechanism / Scope |
|
|
8
8
|
| :--- | :--- | :--- |
|
|
9
9
|
| Traversal, UNC, Windows reserved names, trailing dot/space refusal | **Technically enforced** | [core/path-safety.mjs](../core/path-safety.mjs) |
|
|
10
10
|
| Symbolic link / NTFS junction ancestor refusal | **Technically enforced** | [core/path-safety.mjs](../core/path-safety.mjs) (`lstatSync` + `realpathSync`) |
|
|
11
11
|
| Overwrite refusal & transactional staging rollback | **Technically enforced** | [scripts/bootstrap-project.mjs](../scripts/bootstrap-project.mjs) |
|
|
12
12
|
| Single-pass placeholder substitution (no double-interpolation) | **Technically enforced** | [scripts/bootstrap-project.mjs](../scripts/bootstrap-project.mjs) |
|
|
13
13
|
| Secret & `.env` `.gitignore` rules + zero-network tooling | **Technically enforced** | [.gitignore](../.gitignore), verified by `tests/security.test.mjs` |
|
|
14
|
-
| `APPR-NNNN` owner approval gates
|
|
15
|
-
|
|
|
14
|
+
| `APPR-NNNN` owner approval gates | **Technically enforced for signed operations** | Canonical promotion and staging worker launches verify an owner key. See [setup](../docs/advanced-usage.md). |
|
|
15
|
+
| Specialist and retry limits | **Technically enforced for staging audits** | Up to two concurrent specialists and two report repair retries per task. Owner approval caps provider launches. |
|
|
16
16
|
|
|
17
17
|
## Authority Level `A0` — Global Harness Security Rules
|
|
18
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Token Efficiency Policy
|
|
2
2
|
|
|
3
|
-
> **Status:**
|
|
3
|
+
> **Status:** Context budgets are estimated by the compiler. The staging worker limits launches and retries under owner approval. Provider token usage is measured separately.
|
|
4
4
|
> **Measurement Rule:** **No token savings percentages are claimed without empirical measurement** from future provider execution logs.
|
|
5
5
|
|
|
6
6
|
## Structural Efficiencies Established in Phase 1.2
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
- **Context Compaction:** Summarize completed milestones into `brain/state/current.yaml`, `HANDOFF-NNNN`, and `CHKPT-NNNN` instead of carrying growing chat transcripts.
|
|
19
19
|
- **Model / Task Routing & Usage Measurement:** Route narrow edits/checks to lighter models where verified and record per-task input/cached/output token counts before claiming efficiency gains.
|
|
20
20
|
|
|
21
|
-
## Starting Context Budget Targets
|
|
21
|
+
## Starting Context Budget Targets
|
|
22
22
|
|
|
23
|
-
| Control / Target | Starting Target |
|
|
23
|
+
| Control / Target | Starting Target | Scope |
|
|
24
24
|
| :--- | :--- | :--- |
|
|
25
|
-
| `quick` context pack | ~2,000 tokens (starting target, not hard truncation) |
|
|
26
|
-
| `working` context pack | ~8,000 tokens (starting target, not hard truncation) |
|
|
27
|
-
| `deep` context pack | Task-driven expansion per requirements |
|
|
28
|
-
| Concurrent specialist agents | Max 2 active specialists
|
|
29
|
-
| Automatic repair retries | Max 2
|
|
30
|
-
|
|
|
25
|
+
| `quick` context pack | ~2,000 tokens (starting target, not hard truncation) | Context Compiler |
|
|
26
|
+
| `working` context pack | ~8,000 tokens (starting target, not hard truncation) | Context Compiler |
|
|
27
|
+
| `deep` context pack | Task-driven expansion per requirements | Context Compiler |
|
|
28
|
+
| Concurrent specialist agents | Max 2 active specialists | Staging audit worker |
|
|
29
|
+
| Automatic report repair retries | Max 2 retries per audit | Staging audit worker |
|
|
30
|
+
| Provider launches | Signed owner `APPR-NNNN` with counted launches | Staging audit worker |
|
|
@@ -95,6 +95,15 @@
|
|
|
95
95
|
"signature_base64": { "type": ["string", "null"] }
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
+
"operation_authorization": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": ["digest", "signature_base64"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
104
|
+
"signature_base64": { "type": "string", "pattern": "^[A-Za-z0-9+/]{86}==$" }
|
|
105
|
+
}
|
|
106
|
+
},
|
|
98
107
|
"is_example": { "type": "boolean" },
|
|
99
108
|
"example_notice": { "type": "string" }
|
|
100
109
|
}
|