@almightygpt/core 0.2.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/dist/adapters/claude.d.ts +31 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +90 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/gemini.d.ts +42 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +133 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/index.d.ts +16 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/mock.d.ts +23 -0
- package/dist/adapters/mock.d.ts.map +1 -0
- package/dist/adapters/mock.js +107 -0
- package/dist/adapters/mock.js.map +1 -0
- package/dist/adapters/openai.d.ts +38 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +105 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/adapters/types.d.ts +65 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +26 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/config/load.d.ts +15 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +46 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +260 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +58 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/context/manifest.d.ts +58 -0
- package/dist/context/manifest.d.ts.map +1 -0
- package/dist/context/manifest.js +49 -0
- package/dist/context/manifest.js.map +1 -0
- package/dist/context/redact.d.ts +26 -0
- package/dist/context/redact.d.ts.map +1 -0
- package/dist/context/redact.js +67 -0
- package/dist/context/redact.js.map +1 -0
- package/dist/git/status.d.ts +48 -0
- package/dist/git/status.d.ts.map +1 -0
- package/dist/git/status.js +79 -0
- package/dist/git/status.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/review/budget.d.ts +46 -0
- package/dist/review/budget.d.ts.map +1 -0
- package/dist/review/budget.js +83 -0
- package/dist/review/budget.js.map +1 -0
- package/dist/review/diff.d.ts +21 -0
- package/dist/review/diff.d.ts.map +1 -0
- package/dist/review/diff.js +55 -0
- package/dist/review/diff.js.map +1 -0
- package/dist/review/events.d.ts +76 -0
- package/dist/review/events.d.ts.map +1 -0
- package/dist/review/events.js +13 -0
- package/dist/review/events.js.map +1 -0
- package/dist/review/memory.d.ts +23 -0
- package/dist/review/memory.d.ts.map +1 -0
- package/dist/review/memory.js +42 -0
- package/dist/review/memory.js.map +1 -0
- package/dist/review/prompts.d.ts +34 -0
- package/dist/review/prompts.d.ts.map +1 -0
- package/dist/review/prompts.js +174 -0
- package/dist/review/prompts.js.map +1 -0
- package/dist/review/run-diff-review.d.ts +52 -0
- package/dist/review/run-diff-review.d.ts.map +1 -0
- package/dist/review/run-diff-review.js +258 -0
- package/dist/review/run-diff-review.js.map +1 -0
- package/dist/review/run-worker-reviewer.d.ts +72 -0
- package/dist/review/run-worker-reviewer.d.ts.map +1 -0
- package/dist/review/run-worker-reviewer.js +407 -0
- package/dist/review/run-worker-reviewer.js.map +1 -0
- package/dist/review/write.d.ts +44 -0
- package/dist/review/write.d.ts.map +1 -0
- package/dist/review/write.js +152 -0
- package/dist/review/write.js.map +1 -0
- package/dist/runs/decide.d.ts +45 -0
- package/dist/runs/decide.d.ts.map +1 -0
- package/dist/runs/decide.js +93 -0
- package/dist/runs/decide.js.map +1 -0
- package/dist/runs/folder.d.ts +42 -0
- package/dist/runs/folder.d.ts.map +1 -0
- package/dist/runs/folder.js +82 -0
- package/dist/runs/folder.js.map +1 -0
- package/dist/runs/list.d.ts +58 -0
- package/dist/runs/list.d.ts.map +1 -0
- package/dist/runs/list.js +117 -0
- package/dist/runs/list.js.map +1 -0
- package/dist/runs/types.d.ts +96 -0
- package/dist/runs/types.d.ts.map +1 -0
- package/dist/runs/types.js +13 -0
- package/dist/runs/types.js.map +1 -0
- package/dist/templates/install.d.ts +49 -0
- package/dist/templates/install.d.ts.map +1 -0
- package/dist/templates/install.js +154 -0
- package/dist/templates/install.js.map +1 -0
- package/package.json +34 -0
- package/src/adapters/claude.ts +133 -0
- package/src/adapters/gemini.ts +183 -0
- package/src/adapters/index.ts +21 -0
- package/src/adapters/mock.ts +125 -0
- package/src/adapters/openai.ts +150 -0
- package/src/adapters/types.ts +73 -0
- package/src/config/load.ts +61 -0
- package/src/config/schema.ts +64 -0
- package/src/context/manifest.ts +94 -0
- package/src/context/redact.ts +93 -0
- package/src/git/status.ts +108 -0
- package/src/index.ts +127 -0
- package/src/review/budget.ts +116 -0
- package/src/review/diff.ts +85 -0
- package/src/review/events.ts +86 -0
- package/src/review/memory.ts +57 -0
- package/src/review/prompts.ts +208 -0
- package/src/review/run-diff-review.ts +353 -0
- package/src/review/run-worker-reviewer.ts +528 -0
- package/src/review/write.ts +208 -0
- package/src/runs/decide.ts +153 -0
- package/src/runs/folder.ts +137 -0
- package/src/runs/list.ts +152 -0
- package/src/runs/types.ts +98 -0
- package/src/templates/install.ts +198 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/context/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AA2CD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAkB3D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret redaction.
|
|
3
|
+
*
|
|
4
|
+
* Runs a battery of regex patterns over text and replaces matches with a
|
|
5
|
+
* `[REDACTED:<kind>:<short-hash>]` placeholder. The hash lets the user
|
|
6
|
+
* confirm two redactions refer to the same secret (useful for audit) without
|
|
7
|
+
* leaking the value.
|
|
8
|
+
*
|
|
9
|
+
* This is a defense-in-depth measure. The first line of defense is the
|
|
10
|
+
* `.almightyignore` file which prevents secret-bearing files from being
|
|
11
|
+
* included in the first place. Redaction catches what slips through.
|
|
12
|
+
*
|
|
13
|
+
* Patterns are deliberately conservative — false positives are better than
|
|
14
|
+
* leaking real secrets. Users can disable redaction via config if needed.
|
|
15
|
+
*/
|
|
16
|
+
import { createHash } from "node:crypto";
|
|
17
|
+
const PATTERNS = [
|
|
18
|
+
// OpenAI keys
|
|
19
|
+
{ kind: "openai_key", regex: /\bsk-[A-Za-z0-9]{20,}\b/g },
|
|
20
|
+
// GitHub PATs (classic + fine-grained)
|
|
21
|
+
{ kind: "github_pat", regex: /\bgh[pousr]_[A-Za-z0-9]{20,}\b/g },
|
|
22
|
+
// Anthropic keys
|
|
23
|
+
{ kind: "anthropic_key", regex: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g },
|
|
24
|
+
// Generic AWS access key id
|
|
25
|
+
{ kind: "aws_access_key_id", regex: /\b(AKIA|ASIA)[A-Z0-9]{16}\b/g },
|
|
26
|
+
// Slack bot token
|
|
27
|
+
{ kind: "slack_token", regex: /\bxox[abp]-[A-Za-z0-9-]{20,}\b/g },
|
|
28
|
+
// Generic JWT (3 base64url segments)
|
|
29
|
+
{
|
|
30
|
+
kind: "jwt",
|
|
31
|
+
regex: /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,
|
|
32
|
+
},
|
|
33
|
+
// PEM private key block
|
|
34
|
+
{
|
|
35
|
+
kind: "pem_private_key",
|
|
36
|
+
regex: /-----BEGIN (?:RSA |EC |OPENSSH |PGP )?PRIVATE KEY-----[\s\S]+?-----END (?:RSA |EC |OPENSSH |PGP )?PRIVATE KEY-----/g,
|
|
37
|
+
},
|
|
38
|
+
// Bearer tokens in headers (catches "Authorization: Bearer <token>")
|
|
39
|
+
{
|
|
40
|
+
kind: "bearer_token",
|
|
41
|
+
regex: /\b[Bb]earer\s+[A-Za-z0-9_\-.~+/=]{16,}/g,
|
|
42
|
+
},
|
|
43
|
+
// Generic high-entropy key= or password= assignments in code / yaml / env
|
|
44
|
+
// (catches things like API_KEY="ABCDEFG..." or password: '...')
|
|
45
|
+
{
|
|
46
|
+
kind: "assignment_secret",
|
|
47
|
+
regex: /\b(?:api[_-]?key|secret|password|token|access[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_\-.]{20,})["']?/gi,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
export function redactSecrets(text) {
|
|
51
|
+
const counts = new Map();
|
|
52
|
+
let out = text;
|
|
53
|
+
for (const { kind, regex } of PATTERNS) {
|
|
54
|
+
out = out.replace(regex, (match) => {
|
|
55
|
+
const hash = shortHash(match);
|
|
56
|
+
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
57
|
+
return `[REDACTED:${kind}:${hash}]`;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const redactions = [...counts.entries()].map(([kind, count]) => ({ kind, count }));
|
|
61
|
+
const totalCount = redactions.reduce((sum, r) => sum + r.count, 0);
|
|
62
|
+
return { text: out, redactions, totalCount };
|
|
63
|
+
}
|
|
64
|
+
function shortHash(s) {
|
|
65
|
+
return createHash("sha256").update(s).digest("hex").slice(0, 8);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/context/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAk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AAG,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,UAAU,GAAqB,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAC5D,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CACrC,CAAC;IACF,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git status safety check.
|
|
3
|
+
*
|
|
4
|
+
* Before any agent (or `almightygpt init`) writes a file that already exists,
|
|
5
|
+
* we check whether the target has uncommitted changes. If it does, refuse to
|
|
6
|
+
* overwrite — the user has work in progress that we should not silently
|
|
7
|
+
* destroy.
|
|
8
|
+
*
|
|
9
|
+
* This is the same rule the project's own CLAUDE.md enforces for the team,
|
|
10
|
+
* and it ships in the default Convention Pack rules so every adopter gets
|
|
11
|
+
* the same protection.
|
|
12
|
+
*/
|
|
13
|
+
export interface GitStatusCheck {
|
|
14
|
+
/** True if the file is tracked but modified, staged, or is an untracked path. */
|
|
15
|
+
dirty: boolean;
|
|
16
|
+
/** True if the target path is not inside a git repository. */
|
|
17
|
+
notInGitRepo?: boolean;
|
|
18
|
+
/** Raw git porcelain output if dirty, useful for surfacing context to the user. */
|
|
19
|
+
porcelain?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check whether a path has uncommitted changes in its containing git repo.
|
|
23
|
+
*
|
|
24
|
+
* - Returns `{ dirty: false, notInGitRepo: true }` if `repoRoot` is not a git
|
|
25
|
+
* working tree. Callers may treat this as "no protection available; proceed".
|
|
26
|
+
* - Returns `{ dirty: false }` if the path is clean (or does not exist yet).
|
|
27
|
+
* - Returns `{ dirty: true, porcelain }` if `git status --short` reports
|
|
28
|
+
* anything for the path.
|
|
29
|
+
*
|
|
30
|
+
* The relative path is normalized to use forward slashes (git's preferred form).
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkGitStatus(repoRoot: string, relativePath: string): Promise<GitStatusCheck>;
|
|
33
|
+
/**
|
|
34
|
+
* Assert that a path is safe to overwrite. Throws if dirty unless `force` is set.
|
|
35
|
+
*
|
|
36
|
+
* Intended call sites:
|
|
37
|
+
* - `almightygpt init` when a convention file already exists.
|
|
38
|
+
* - Reviewer adapters before writing `docs/<reviewer>-reviews/<topic>.md`.
|
|
39
|
+
* - Any future agent that writes Markdown into a tracked path.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertSafeToWrite(repoRoot: string, relativePath: string, force?: boolean): Promise<void>;
|
|
42
|
+
export declare class GitStatusDirtyError extends Error {
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly porcelain: string;
|
|
45
|
+
readonly name = "GitStatusDirtyError";
|
|
46
|
+
constructor(message: string, path: string, porcelain: string);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/git/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,KAAK,EAAE,OAAO,CAAC;IACf,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,CAAC,CA8BzB;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAI1B,IAAI,EAAE,MAAM;aACZ,SAAS,EAAE,MAAM;IAJnC,SAAkB,IAAI,yBAAyB;gBAE7C,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM;CAIpC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git status safety check.
|
|
3
|
+
*
|
|
4
|
+
* Before any agent (or `almightygpt init`) writes a file that already exists,
|
|
5
|
+
* we check whether the target has uncommitted changes. If it does, refuse to
|
|
6
|
+
* overwrite — the user has work in progress that we should not silently
|
|
7
|
+
* destroy.
|
|
8
|
+
*
|
|
9
|
+
* This is the same rule the project's own CLAUDE.md enforces for the team,
|
|
10
|
+
* and it ships in the default Convention Pack rules so every adopter gets
|
|
11
|
+
* the same protection.
|
|
12
|
+
*/
|
|
13
|
+
import { execa } from "execa";
|
|
14
|
+
/**
|
|
15
|
+
* Check whether a path has uncommitted changes in its containing git repo.
|
|
16
|
+
*
|
|
17
|
+
* - Returns `{ dirty: false, notInGitRepo: true }` if `repoRoot` is not a git
|
|
18
|
+
* working tree. Callers may treat this as "no protection available; proceed".
|
|
19
|
+
* - Returns `{ dirty: false }` if the path is clean (or does not exist yet).
|
|
20
|
+
* - Returns `{ dirty: true, porcelain }` if `git status --short` reports
|
|
21
|
+
* anything for the path.
|
|
22
|
+
*
|
|
23
|
+
* The relative path is normalized to use forward slashes (git's preferred form).
|
|
24
|
+
*/
|
|
25
|
+
export async function checkGitStatus(repoRoot, relativePath) {
|
|
26
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
27
|
+
try {
|
|
28
|
+
const { stdout } = await execa("git", ["status", "--short", "--", normalized], {
|
|
29
|
+
cwd: repoRoot,
|
|
30
|
+
reject: false,
|
|
31
|
+
stripFinalNewline: true,
|
|
32
|
+
});
|
|
33
|
+
if (stdout.trim().length === 0) {
|
|
34
|
+
return { dirty: false };
|
|
35
|
+
}
|
|
36
|
+
return { dirty: true, porcelain: stdout };
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
// execa throws if git is missing. Surface as not-in-repo so callers can
|
|
40
|
+
// proceed cautiously rather than crash.
|
|
41
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
42
|
+
if (msg.includes("ENOENT")) {
|
|
43
|
+
return { dirty: false, notInGitRepo: true };
|
|
44
|
+
}
|
|
45
|
+
// "not a git repository" returns non-zero but we used reject:false above,
|
|
46
|
+
// so this branch is rare. Still, treat unknown errors as no-protection.
|
|
47
|
+
return { dirty: false, notInGitRepo: true };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Assert that a path is safe to overwrite. Throws if dirty unless `force` is set.
|
|
52
|
+
*
|
|
53
|
+
* Intended call sites:
|
|
54
|
+
* - `almightygpt init` when a convention file already exists.
|
|
55
|
+
* - Reviewer adapters before writing `docs/<reviewer>-reviews/<topic>.md`.
|
|
56
|
+
* - Any future agent that writes Markdown into a tracked path.
|
|
57
|
+
*/
|
|
58
|
+
export async function assertSafeToWrite(repoRoot, relativePath, force = false) {
|
|
59
|
+
if (force)
|
|
60
|
+
return;
|
|
61
|
+
const status = await checkGitStatus(repoRoot, relativePath);
|
|
62
|
+
if (!status.dirty)
|
|
63
|
+
return;
|
|
64
|
+
const lines = (status.porcelain ?? "").split("\n").filter(Boolean);
|
|
65
|
+
const detail = lines.map((l) => ` ${l}`).join("\n");
|
|
66
|
+
throw new GitStatusDirtyError(`Refusing to overwrite ${relativePath} — it has uncommitted changes:\n${detail}\n\n` +
|
|
67
|
+
`Commit or stash the changes, or re-run with --force to override.`, relativePath, status.porcelain ?? "");
|
|
68
|
+
}
|
|
69
|
+
export class GitStatusDirtyError extends Error {
|
|
70
|
+
path;
|
|
71
|
+
porcelain;
|
|
72
|
+
name = "GitStatusDirtyError";
|
|
73
|
+
constructor(message, path, porcelain) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.path = path;
|
|
76
|
+
this.porcelain = porcelain;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/git/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAW9B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,YAAoB;IAEpB,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAC5B,KAAK,EACL,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,EACvC;YACE,GAAG,EAAE,QAAQ;YACb,MAAM,EAAE,KAAK;YACb,iBAAiB,EAAE,IAAI;SACxB,CACF,CAAC;QAEF,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC1B,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wE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;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAQ;IAGnC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @almightygpt/core
|
|
3
|
+
*
|
|
4
|
+
* Core orchestrator, adapters, config, runs, and review logic.
|
|
5
|
+
* MVP 1 status:
|
|
6
|
+
* - git/ ✅ task #8
|
|
7
|
+
* - templates/ ✅ task #7 installer (used by init, task #6)
|
|
8
|
+
* - config/ ✅ task #11 schema + loader
|
|
9
|
+
* - adapters/ ✅ task #9 mock + task #10 OpenAI
|
|
10
|
+
* - context/ ✅ task #13 manifest + secret redaction
|
|
11
|
+
* - runs/ ✅ task #12 dual-artifact folder + run.json
|
|
12
|
+
* - review/ ✅ task #11 diff review pipeline (with #12/#13/#14 wiring)
|
|
13
|
+
* - budget/ ✅ task #14 BudgetTracker + BudgetExceededError
|
|
14
|
+
*/
|
|
15
|
+
export declare const VERSION = "0.2.0";
|
|
16
|
+
export { checkGitStatus, assertSafeToWrite, GitStatusDirtyError, type GitStatusCheck, } from "./git/status.js";
|
|
17
|
+
export { installTemplate, hasExistingConfig, type InstallOptions, type InstallResult, } from "./templates/install.js";
|
|
18
|
+
export { loadConfig, ConfigError } from "./config/load.js";
|
|
19
|
+
export { ConfigSchema, AgentConfigSchema, AgentRoleSchema, type Config, type AgentConfig, } from "./config/schema.js";
|
|
20
|
+
export { AdapterError, MockAdapter, OpenAIAdapter, ClaudeAdapter, GeminiAdapter, type Adapter, type AdapterInput, type AdapterOutput, type AgentRole, type OpenAIAdapterOptions, type ClaudeAdapterOptions, type GeminiAdapterOptions, } from "./adapters/index.js";
|
|
21
|
+
export { redactSecrets, type RedactionResult, type RedactionMatch } from "./context/redact.js";
|
|
22
|
+
export { buildContextManifest, writeContextManifest, type ContextManifest, type ManifestFile, } from "./context/manifest.js";
|
|
23
|
+
export { createRunFolder, writeRunMetadata, writeRunInput, writeAgentOutput, collectGitContext, type CreatedRunFolder, } from "./runs/folder.js";
|
|
24
|
+
export type { RunMetadata, RunStatus, RunType, AgentMetrics, HumanDecision, DecisionStatus, } from "./runs/types.js";
|
|
25
|
+
export { listRuns, findRunById, findLatestRun, formatDuration, type RunSummary, type ListRunsResult, type ListRunsOptions, } from "./runs/list.js";
|
|
26
|
+
export { recordDecision, type RecordDecisionOptions, type RecordDecisionResult, } from "./runs/decide.js";
|
|
27
|
+
export { runDiffReview, type DiffReviewOptions, type DiffReviewResult, } from "./review/run-diff-review.js";
|
|
28
|
+
export { runWorkerReviewerReview, type WorkerReviewerOptions, type WorkerReviewerResult, } from "./review/run-worker-reviewer.js";
|
|
29
|
+
export { collectGitDiff, type DiffOptions, type DiffResult } from "./review/diff.js";
|
|
30
|
+
export { writeHumanReviewFile, ReviewFileExistsError, type WriteReviewFileOptions, } from "./review/write.js";
|
|
31
|
+
export { BudgetTracker, BudgetExceededError, type BudgetCaps, } from "./review/budget.js";
|
|
32
|
+
export type { ReviewEvent, ReviewEventHandler, AgentRoleInRun, } from "./review/events.js";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,KAAK,MAA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ACrB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,cAAc,GACf,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @almightygpt/core
|
|
3
|
+
*
|
|
4
|
+
* Core orchestrator, adapters, config, runs, and review logic.
|
|
5
|
+
* MVP 1 status:
|
|
6
|
+
* - git/ ✅ task #8
|
|
7
|
+
* - templates/ ✅ task #7 installer (used by init, task #6)
|
|
8
|
+
* - config/ ✅ task #11 schema + loader
|
|
9
|
+
* - adapters/ ✅ task #9 mock + task #10 OpenAI
|
|
10
|
+
* - context/ ✅ task #13 manifest + secret redaction
|
|
11
|
+
* - runs/ ✅ task #12 dual-artifact folder + run.json
|
|
12
|
+
* - review/ ✅ task #11 diff review pipeline (with #12/#13/#14 wiring)
|
|
13
|
+
* - budget/ ✅ task #14 BudgetTracker + BudgetExceededError
|
|
14
|
+
*/
|
|
15
|
+
export const VERSION = "0.2.0";
|
|
16
|
+
// Git safety primitives
|
|
17
|
+
export { checkGitStatus, assertSafeToWrite, GitStatusDirtyError, } from "./git/status.js";
|
|
18
|
+
// Template installer
|
|
19
|
+
export { installTemplate, hasExistingConfig, } from "./templates/install.js";
|
|
20
|
+
// Config
|
|
21
|
+
export { loadConfig, ConfigError } from "./config/load.js";
|
|
22
|
+
export { ConfigSchema, AgentConfigSchema, AgentRoleSchema, } from "./config/schema.js";
|
|
23
|
+
// Adapters
|
|
24
|
+
export { AdapterError, MockAdapter, OpenAIAdapter, ClaudeAdapter, GeminiAdapter, } from "./adapters/index.js";
|
|
25
|
+
// Context / redaction
|
|
26
|
+
export { redactSecrets } from "./context/redact.js";
|
|
27
|
+
export { buildContextManifest, writeContextManifest, } from "./context/manifest.js";
|
|
28
|
+
// Runs
|
|
29
|
+
export { createRunFolder, writeRunMetadata, writeRunInput, writeAgentOutput, collectGitContext, } from "./runs/folder.js";
|
|
30
|
+
export { listRuns, findRunById, findLatestRun, formatDuration, } from "./runs/list.js";
|
|
31
|
+
export { recordDecision, } from "./runs/decide.js";
|
|
32
|
+
// Review pipeline
|
|
33
|
+
export { runDiffReview, } from "./review/run-diff-review.js";
|
|
34
|
+
export { runWorkerReviewerReview, } from "./review/run-worker-reviewer.js";
|
|
35
|
+
export { collectGitDiff } from "./review/diff.js";
|
|
36
|
+
export { writeHumanReviewFile, ReviewFileExistsError, } from "./review/write.js";
|
|
37
|
+
export { BudgetTracker, BudgetExceededError, } from "./review/budget.js";
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,wBAAwB;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,iBAAiB,CAAC;AAEzB,qBAAqB;AACrB,OAAO,EACL,eAAe,EACf,iBAAiB,GAGlB,MAAM,wBAAwB,CAAC;AAEhC,SAAS;AACT,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,GAGhB,MAAM,oBAAoB,CAAC;AAE5B,WAAW;AACX,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,GAQd,MAAM,qBAAqB,CAAC;AAE7B,sBAAsB;AACtB,OAAO,EAAE,aAAa,EAA6C,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAGrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO;AACP,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EACL,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,GAIf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAE1B,kBAAkB;AAClB,OAAO,EACL,aAAa,GAGd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,GAGxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,cAAc,EAAqC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Budget tracking and enforcement for review runs.
|
|
3
|
+
*
|
|
4
|
+
* Two checks:
|
|
5
|
+
* - Pre-flight: estimate cost from prompt size + max output tokens, abort
|
|
6
|
+
* if estimate already exceeds maxCostPerRunUsd.
|
|
7
|
+
* - Post-call: aggregate actual cost across all adapter calls in the run,
|
|
8
|
+
* abort if cap is breached.
|
|
9
|
+
*
|
|
10
|
+
* Estimates use the same PRICING_USD_PER_1M table as the OpenAI adapter.
|
|
11
|
+
* For non-OpenAI providers we fall back to a conservative default.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BudgetExceededError extends Error {
|
|
14
|
+
readonly stage: "pre-flight" | "post-call";
|
|
15
|
+
readonly capUsd: number;
|
|
16
|
+
readonly actualUsd: number;
|
|
17
|
+
readonly name = "BudgetExceededError";
|
|
18
|
+
constructor(message: string, stage: "pre-flight" | "post-call", capUsd: number, actualUsd: number);
|
|
19
|
+
}
|
|
20
|
+
export interface BudgetCaps {
|
|
21
|
+
maxCostPerRunUsd: number;
|
|
22
|
+
maxTokensPerRun: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class BudgetTracker {
|
|
25
|
+
private readonly caps;
|
|
26
|
+
private totalCostUsd;
|
|
27
|
+
private totalTokens;
|
|
28
|
+
constructor(caps: BudgetCaps);
|
|
29
|
+
/** Conservative pre-flight check before calling an adapter. */
|
|
30
|
+
preflightCheck(opts: {
|
|
31
|
+
model: string;
|
|
32
|
+
estimatedTokensIn: number;
|
|
33
|
+
maxOutputTokens: number;
|
|
34
|
+
}): void;
|
|
35
|
+
/** Record actual usage after a successful adapter call; trip the cap if exceeded. */
|
|
36
|
+
record(opts: {
|
|
37
|
+
tokensIn: number;
|
|
38
|
+
tokensOut: number;
|
|
39
|
+
costUsd: number;
|
|
40
|
+
}): void;
|
|
41
|
+
get totals(): {
|
|
42
|
+
costUsd: number;
|
|
43
|
+
tokens: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../src/review/budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoBH,qBAAa,mBAAoB,SAAQ,KAAK;aAI1B,KAAK,EAAE,YAAY,GAAG,WAAW;aACjC,MAAM,EAAE,MAAM;aACd,SAAS,EAAE,MAAM;IALnC,SAAkB,IAAI,yBAAyB;gBAE7C,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,YAAY,GAAG,WAAW,EACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM;CAIpC;AAED,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,aAAa;IAIZ,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,WAAW,CAAK;gBAEK,IAAI,EAAE,UAAU;IAE7C,+DAA+D;IAC/D,cAAc,CAAC,IAAI,EAAE;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,IAAI;IAmBR,qFAAqF;IACrF,MAAM,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAuB5E,IAAI,MAAM,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAEhD;CACF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Budget tracking and enforcement for review runs.
|
|
3
|
+
*
|
|
4
|
+
* Two checks:
|
|
5
|
+
* - Pre-flight: estimate cost from prompt size + max output tokens, abort
|
|
6
|
+
* if estimate already exceeds maxCostPerRunUsd.
|
|
7
|
+
* - Post-call: aggregate actual cost across all adapter calls in the run,
|
|
8
|
+
* abort if cap is breached.
|
|
9
|
+
*
|
|
10
|
+
* Estimates use the same PRICING_USD_PER_1M table as the OpenAI adapter.
|
|
11
|
+
* For non-OpenAI providers we fall back to a conservative default.
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_INPUT_USD_PER_1M = 3.0;
|
|
14
|
+
const DEFAULT_OUTPUT_USD_PER_1M = 15.0;
|
|
15
|
+
const KNOWN_PRICING = {
|
|
16
|
+
"gpt-4o": { input: 2.5, output: 10.0 },
|
|
17
|
+
"gpt-4o-mini": { input: 0.15, output: 0.6 },
|
|
18
|
+
"gpt-4-turbo": { input: 10.0, output: 30.0 },
|
|
19
|
+
"gpt-3.5-turbo": { input: 0.5, output: 1.5 },
|
|
20
|
+
"claude-3-5-sonnet": { input: 3.0, output: 15.0 },
|
|
21
|
+
"claude-3-5-haiku": { input: 0.8, output: 4.0 },
|
|
22
|
+
"claude-3-opus": { input: 15.0, output: 75.0 },
|
|
23
|
+
"gemini-2.5-pro": { input: 1.25, output: 10.0 },
|
|
24
|
+
"gemini-2.5-flash": { input: 0.3, output: 2.5 },
|
|
25
|
+
"gemini-2.0-flash": { input: 0.1, output: 0.4 },
|
|
26
|
+
"gemini-1.5-pro": { input: 1.25, output: 5.0 },
|
|
27
|
+
"gemini-1.5-flash": { input: 0.075, output: 0.3 },
|
|
28
|
+
};
|
|
29
|
+
export class BudgetExceededError extends Error {
|
|
30
|
+
stage;
|
|
31
|
+
capUsd;
|
|
32
|
+
actualUsd;
|
|
33
|
+
name = "BudgetExceededError";
|
|
34
|
+
constructor(message, stage, capUsd, actualUsd) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.stage = stage;
|
|
37
|
+
this.capUsd = capUsd;
|
|
38
|
+
this.actualUsd = actualUsd;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export class BudgetTracker {
|
|
42
|
+
caps;
|
|
43
|
+
totalCostUsd = 0;
|
|
44
|
+
totalTokens = 0;
|
|
45
|
+
constructor(caps) {
|
|
46
|
+
this.caps = caps;
|
|
47
|
+
}
|
|
48
|
+
/** Conservative pre-flight check before calling an adapter. */
|
|
49
|
+
preflightCheck(opts) {
|
|
50
|
+
const rates = lookupPricing(opts.model);
|
|
51
|
+
const estimatedCost = (opts.estimatedTokensIn / 1_000_000) * rates.input +
|
|
52
|
+
(opts.maxOutputTokens / 1_000_000) * rates.output;
|
|
53
|
+
const projected = this.totalCostUsd + estimatedCost;
|
|
54
|
+
if (projected > this.caps.maxCostPerRunUsd) {
|
|
55
|
+
throw new BudgetExceededError(`Pre-flight cost estimate $${projected.toFixed(4)} exceeds budget cap ` +
|
|
56
|
+
`$${this.caps.maxCostPerRunUsd.toFixed(4)}. Lower max_output_tokens, ` +
|
|
57
|
+
`shrink the diff, or raise budget.maxCostPerRunUsd in .almightygpt/config.yaml.`, "pre-flight", this.caps.maxCostPerRunUsd, projected);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Record actual usage after a successful adapter call; trip the cap if exceeded. */
|
|
61
|
+
record(opts) {
|
|
62
|
+
this.totalCostUsd += opts.costUsd;
|
|
63
|
+
this.totalTokens += opts.tokensIn + opts.tokensOut;
|
|
64
|
+
if (this.totalCostUsd > this.caps.maxCostPerRunUsd) {
|
|
65
|
+
throw new BudgetExceededError(`Run cost $${this.totalCostUsd.toFixed(4)} exceeded cap ` +
|
|
66
|
+
`$${this.caps.maxCostPerRunUsd.toFixed(4)} after adapter call.`, "post-call", this.caps.maxCostPerRunUsd, this.totalCostUsd);
|
|
67
|
+
}
|
|
68
|
+
if (this.totalTokens > this.caps.maxTokensPerRun) {
|
|
69
|
+
throw new BudgetExceededError(`Run tokens ${this.totalTokens} exceeded cap ${this.caps.maxTokensPerRun}.`, "post-call", this.caps.maxTokensPerRun, this.totalTokens);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
get totals() {
|
|
73
|
+
return { costUsd: this.totalCostUsd, tokens: this.totalTokens };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function lookupPricing(model) {
|
|
77
|
+
const key = Object.keys(KNOWN_PRICING).find((k) => model.toLowerCase().startsWith(k));
|
|
78
|
+
if (!key) {
|
|
79
|
+
return { input: DEFAULT_INPUT_USD_PER_1M, output: DEFAULT_OUTPUT_USD_PER_1M };
|
|
80
|
+
}
|
|
81
|
+
return KNOWN_PRICING[key];
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=budget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/review/budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAM,aAAa,GAAsD;IACvE,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IACtC,aAAa,EAAE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AClB,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACjD,MAAM,IAAI,mBAAmB,CAC3B,cAAc,IAAI,CAAC,WAAW,iBAAiB,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,EAC3E,WAAW,EACX,IAAI,CAAC,IAAI,CAAC,eAAe,EACzB,IAAI,CAAC,WAAW,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM;QACR,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IAClE,CAAC;CACF;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAChD,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAClC,CAAC;IACF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAChF,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,CAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collect a git diff for review.
|
|
3
|
+
*
|
|
4
|
+
* Default: uncommitted working tree changes (staged + unstaged).
|
|
5
|
+
* Optional range: e.g. "HEAD~1..HEAD" to review the last commit.
|
|
6
|
+
*/
|
|
7
|
+
export interface DiffResult {
|
|
8
|
+
diff: string;
|
|
9
|
+
/** Files touched in the diff (relative paths). */
|
|
10
|
+
files: string[];
|
|
11
|
+
/** True if the working tree had no changes and no range was supplied. */
|
|
12
|
+
empty: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface DiffOptions {
|
|
15
|
+
/** Optional git range like "HEAD~3..HEAD". If omitted, uncommitted changes. */
|
|
16
|
+
range?: string;
|
|
17
|
+
/** Hard cap on diff size to avoid blowing the context window. Default 200 KB. */
|
|
18
|
+
maxBytes?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function collectGitDiff(repoRoot: string, opts?: DiffOptions): Promise<DiffResult>;
|
|
21
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/review/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yEAAyE;IACzE,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,UAAU,CAAC,CAqCrB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collect a git diff for review.
|
|
3
|
+
*
|
|
4
|
+
* Default: uncommitted working tree changes (staged + unstaged).
|
|
5
|
+
* Optional range: e.g. "HEAD~1..HEAD" to review the last commit.
|
|
6
|
+
*/
|
|
7
|
+
import { execa } from "execa";
|
|
8
|
+
export async function collectGitDiff(repoRoot, opts = {}) {
|
|
9
|
+
const maxBytes = opts.maxBytes ?? 200_000;
|
|
10
|
+
const args = ["diff", "--no-color"];
|
|
11
|
+
if (opts.range) {
|
|
12
|
+
args.push(opts.range);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// Include staged + unstaged + untracked-vs-HEAD.
|
|
16
|
+
args.push("HEAD");
|
|
17
|
+
}
|
|
18
|
+
const { stdout, exitCode } = await execa("git", args, {
|
|
19
|
+
cwd: repoRoot,
|
|
20
|
+
reject: false,
|
|
21
|
+
stripFinalNewline: false,
|
|
22
|
+
maxBuffer: maxBytes * 2,
|
|
23
|
+
});
|
|
24
|
+
// exitCode is 0 on success, 1 on dirty diff in some git modes; treat both as ok.
|
|
25
|
+
if (exitCode !== 0 && exitCode !== 1) {
|
|
26
|
+
throw new Error(`git diff failed with exit ${exitCode}. Args: ${args.join(" ")}`);
|
|
27
|
+
}
|
|
28
|
+
const truncated = stdout.length > maxBytes
|
|
29
|
+
? stdout.slice(0, maxBytes) +
|
|
30
|
+
`\n\n[…truncated — diff exceeded ${maxBytes} bytes]\n`
|
|
31
|
+
: stdout;
|
|
32
|
+
const files = await collectFilesInDiff(repoRoot, opts.range);
|
|
33
|
+
return {
|
|
34
|
+
diff: truncated,
|
|
35
|
+
files,
|
|
36
|
+
empty: truncated.trim().length === 0,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function collectFilesInDiff(repoRoot, range) {
|
|
40
|
+
const args = ["diff", "--name-only"];
|
|
41
|
+
if (range)
|
|
42
|
+
args.push(range);
|
|
43
|
+
else
|
|
44
|
+
args.push("HEAD");
|
|
45
|
+
const { stdout } = await execa("git", args, {
|
|
46
|
+
cwd: repoRoot,
|
|
47
|
+
reject: false,
|
|
48
|
+
stripFinalNewline: true,
|
|
49
|
+
});
|
|
50
|
+
return stdout
|
|
51
|
+
.split("\n")
|
|
52
|
+
.map((s) => s.trim())
|
|
53
|
+
.filter(Boolean);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/review/diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAiB9B,MAAM,CAAC,KAAK,UAAU,cAAc,CACl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AAM,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,IAAI,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE;QAC1C,GAAG,EAAE,QAAQ;QACb,MAAM,EAAE,KAAK;QACb,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review run event stream.
|
|
3
|
+
*
|
|
4
|
+
* Emitted by review pipelines via an optional `onEvent` callback. The CLI
|
|
5
|
+
* uses these events to drive both human progress output and the structured
|
|
6
|
+
* --json stream that future VS Code / dashboard surfaces will consume.
|
|
7
|
+
*
|
|
8
|
+
* Each event is a discriminated union — the `type` field is the
|
|
9
|
+
* discriminator. Tooling should be tolerant of unknown event types so we
|
|
10
|
+
* can add new ones without breaking existing consumers.
|
|
11
|
+
*/
|
|
12
|
+
export type AgentRoleInRun = "worker" | "reviewer" | "judge";
|
|
13
|
+
export type ReviewEvent = RunStartedEvent | AgentStartedEvent | AgentCompletedEvent | RedactionCompleteEvent | ReviewWrittenEvent | RunCompletedEvent | RunFailedEvent;
|
|
14
|
+
export interface RunStartedEvent {
|
|
15
|
+
type: "run_started";
|
|
16
|
+
runId: string;
|
|
17
|
+
runType: string;
|
|
18
|
+
topic: string;
|
|
19
|
+
reviewsDir: string;
|
|
20
|
+
runFolder: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AgentStartedEvent {
|
|
23
|
+
type: "agent_started";
|
|
24
|
+
role: AgentRoleInRun;
|
|
25
|
+
agent: string;
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AgentCompletedEvent {
|
|
29
|
+
type: "agent_completed";
|
|
30
|
+
role: AgentRoleInRun;
|
|
31
|
+
agent: string;
|
|
32
|
+
provider: string;
|
|
33
|
+
model: string;
|
|
34
|
+
outputPath: string;
|
|
35
|
+
tokensIn: number;
|
|
36
|
+
tokensOut: number;
|
|
37
|
+
costUsd: number;
|
|
38
|
+
latencyMs: number;
|
|
39
|
+
}
|
|
40
|
+
export interface RedactionCompleteEvent {
|
|
41
|
+
type: "redaction_complete";
|
|
42
|
+
totalCount: number;
|
|
43
|
+
byKind: {
|
|
44
|
+
kind: string;
|
|
45
|
+
count: number;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
export interface ReviewWrittenEvent {
|
|
49
|
+
type: "review_written";
|
|
50
|
+
reviewPath: string;
|
|
51
|
+
bytes: number;
|
|
52
|
+
shallowWarning?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface RunCompletedEvent {
|
|
55
|
+
type: "run_completed";
|
|
56
|
+
runId: string;
|
|
57
|
+
reviewPath: string;
|
|
58
|
+
runFolder: string;
|
|
59
|
+
totals: {
|
|
60
|
+
tokensIn: number;
|
|
61
|
+
tokensOut: number;
|
|
62
|
+
costUsd: number;
|
|
63
|
+
latencyMs: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface RunFailedEvent {
|
|
67
|
+
type: "run_failed";
|
|
68
|
+
runId: string;
|
|
69
|
+
error: {
|
|
70
|
+
name: string;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Callback signature for receiving the event stream. */
|
|
75
|
+
export type ReviewEventHandler = (event: ReviewEvent) => void;
|
|
76
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceR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IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C;AAED,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review run event stream.
|
|
3
|
+
*
|
|
4
|
+
* Emitted by review pipelines via an optional `onEvent` callback. The CLI
|
|
5
|
+
* uses these events to drive both human progress output and the structured
|
|
6
|
+
* --json stream that future VS Code / dashboard surfaces will consume.
|
|
7
|
+
*
|
|
8
|
+
* Each event is a discriminated union — the `type` field is the
|
|
9
|
+
* discriminator. Tooling should be tolerant of unknown event types so we
|
|
10
|
+
* can add new ones without breaking existing consumers.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/review/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|