getgloss 0.1.1 → 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/README.md +43 -14
- package/dist/cli/index.js +236 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/mcp/index.js +86 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/server/daemon.js +100 -2
- package/dist/server/daemon.js.map +1 -1
- package/dist/web/CNAME +1 -0
- package/dist/web/assets/index-BQXNNRgM.css +1 -0
- package/dist/web/assets/index-xfsP7fu_.js +186 -0
- package/dist/web/index.html +27 -4
- package/dist/web/install.sh +10 -0
- package/dist/web/logo.svg +14 -0
- package/dist/web/og.png +0 -0
- package/dist/web/prompt.md +5 -4
- package/dist/web/setup/index.html +279 -0
- package/dist/web/setup.md +24 -2
- package/dist/web/skill/SKILL.md +22 -0
- package/package.json +1 -1
- package/skill/SKILL.md +11 -7
- package/dist/web/assets/index-BiGi3rBS.css +0 -1
- package/dist/web/assets/index-GpOF1p41.js +0 -149
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="public/logo.svg" alt="Gloss logo" width="88" height="88" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# Gloss
|
|
2
6
|
|
|
3
7
|
Gloss is a local browser review loop for coding agents. It captures your current
|
|
@@ -9,21 +13,37 @@ agent to re-ingest.
|
|
|
9
13
|
|
|
10
14
|
```bash
|
|
11
15
|
npm install -g getgloss
|
|
12
|
-
gloss open --
|
|
16
|
+
gloss open --json
|
|
13
17
|
```
|
|
14
18
|
|
|
15
19
|
For one-off use:
|
|
16
20
|
|
|
17
21
|
```bash
|
|
18
|
-
npx getgloss open --
|
|
22
|
+
npx getgloss open --json
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
For agent
|
|
25
|
+
For a new agent chat, use:
|
|
22
26
|
|
|
23
27
|
```text
|
|
24
|
-
Install Gloss
|
|
28
|
+
Install Gloss with npm. Then read https://getgloss.dev/setup.md.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Claude Code Skill
|
|
32
|
+
|
|
33
|
+
Gloss ships a Claude Code skill at `skill/SKILL.md`. Install it with the
|
|
34
|
+
[`skills` CLI](https://github.com/vercel-labs/agent-skills):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Global (available across all projects)
|
|
38
|
+
npx skills add iamrajjoshi/gloss --skill gloss -g -a claude-code
|
|
39
|
+
|
|
40
|
+
# Project-local (only inside the current project)
|
|
41
|
+
npx skills add iamrajjoshi/gloss --skill gloss -a claude-code
|
|
25
42
|
```
|
|
26
43
|
|
|
44
|
+
`-g` installs to `~/.claude/skills/`, `-a claude-code` targets Claude Code, and
|
|
45
|
+
`--skill gloss` installs only the Gloss skill from the repo.
|
|
46
|
+
|
|
27
47
|
The hosted install script is npm-only:
|
|
28
48
|
|
|
29
49
|
```bash
|
|
@@ -42,10 +62,16 @@ gloss mcp
|
|
|
42
62
|
gloss doctor
|
|
43
63
|
```
|
|
44
64
|
|
|
45
|
-
`gloss open` lazy-starts a background server, captures
|
|
46
|
-
|
|
65
|
+
`gloss open` lazy-starts a background server, captures staged, unstaged, and
|
|
66
|
+
untracked working changes, registers a review session, opens
|
|
47
67
|
`http://localhost:<port>/review/<reviewId>`, and waits for submission unless
|
|
48
|
-
`--no-watch` is passed.
|
|
68
|
+
`--no-watch` is passed. When the working tree is clean and no explicit
|
|
69
|
+
`--base` is provided, Gloss falls back to the current branch diff against the
|
|
70
|
+
best available merge-base from upstream, `origin/HEAD`, `origin/main`, or
|
|
71
|
+
`origin/master`.
|
|
72
|
+
|
|
73
|
+
Use `--base <ref>` when you want an explicit comparison. Explicit base mode
|
|
74
|
+
keeps the old behavior and does not fall back to a branch diff.
|
|
49
75
|
|
|
50
76
|
## Feedback Files
|
|
51
77
|
|
|
@@ -60,8 +86,8 @@ Completed reviews are written to:
|
|
|
60
86
|
original/
|
|
61
87
|
```
|
|
62
88
|
|
|
63
|
-
`feedback.json` is the
|
|
64
|
-
|
|
89
|
+
`feedback.json` is the machine-readable payload. `feedback.md` is a readable
|
|
90
|
+
summary ordered by file and line.
|
|
65
91
|
|
|
66
92
|
## MCP
|
|
67
93
|
|
|
@@ -101,9 +127,12 @@ Required repository secrets:
|
|
|
101
127
|
|
|
102
128
|
- `NPM_TOKEN`
|
|
103
129
|
|
|
104
|
-
##
|
|
130
|
+
## Attribution
|
|
131
|
+
|
|
132
|
+
Gloss uses [`@pierre/diffs`](https://www.npmjs.com/package/@pierre/diffs) by
|
|
133
|
+
[The Pierre Computer Company](https://pierre.computer/) for diff parsing and
|
|
134
|
+
rendering integration points, with Gloss-specific browser chrome around the
|
|
135
|
+
local review workflow.
|
|
105
136
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Apache-2.0 licensed, which is compatible with this MIT project but worth
|
|
109
|
-
calling out before publication.
|
|
137
|
+
`@pierre/diffs` is licensed under Apache-2.0. Gloss is not affiliated with or
|
|
138
|
+
endorsed by The Pierre Computer Company.
|
package/dist/cli/index.js
CHANGED
|
@@ -20,7 +20,92 @@ import getPort from "get-port";
|
|
|
20
20
|
import { mkdir } from "fs/promises";
|
|
21
21
|
import { homedir } from "os";
|
|
22
22
|
import path from "path";
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
// package.json
|
|
25
|
+
var package_default = {
|
|
26
|
+
name: "getgloss",
|
|
27
|
+
version: "0.2.0",
|
|
28
|
+
description: "Local browser-based diff review for coding-agent loops.",
|
|
29
|
+
type: "module",
|
|
30
|
+
packageManager: "pnpm@10.33.2",
|
|
31
|
+
bin: {
|
|
32
|
+
getgloss: "./dist/cli/index.js",
|
|
33
|
+
gloss: "./dist/cli/index.js"
|
|
34
|
+
},
|
|
35
|
+
files: [
|
|
36
|
+
"dist",
|
|
37
|
+
"skill",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
scripts: {
|
|
42
|
+
build: "pnpm build:web && pnpm build:node",
|
|
43
|
+
"build:web": "vite build",
|
|
44
|
+
"build:node": "tsup",
|
|
45
|
+
check: "biome check .",
|
|
46
|
+
format: "biome format --write .",
|
|
47
|
+
prepack: "pnpm build",
|
|
48
|
+
"dev:web": "vite --host 127.0.0.1",
|
|
49
|
+
setup: "tsx scripts/dev-cli.ts",
|
|
50
|
+
test: "vitest run",
|
|
51
|
+
"test:watch": "vitest"
|
|
52
|
+
},
|
|
53
|
+
engines: {
|
|
54
|
+
node: ">=20"
|
|
55
|
+
},
|
|
56
|
+
dependencies: {
|
|
57
|
+
"@hono/node-server": "^1.14.4",
|
|
58
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
59
|
+
"@pierre/diffs": "^1.2.1",
|
|
60
|
+
"@tailwindcss/vite": "^4.1.7",
|
|
61
|
+
commander: "^14.0.0",
|
|
62
|
+
execa: "^9.5.3",
|
|
63
|
+
"get-port": "^7.1.0",
|
|
64
|
+
hono: "^4.7.10",
|
|
65
|
+
"lucide-react": "^1.16.0",
|
|
66
|
+
open: "^10.1.2",
|
|
67
|
+
react: "^19.1.0",
|
|
68
|
+
"react-dom": "^19.1.0",
|
|
69
|
+
ulid: "^3.0.0",
|
|
70
|
+
zod: "^4.4.3",
|
|
71
|
+
zustand: "^5.0.5"
|
|
72
|
+
},
|
|
73
|
+
devDependencies: {
|
|
74
|
+
"@biomejs/biome": "^2.0.6",
|
|
75
|
+
"@types/node": "^24.0.1",
|
|
76
|
+
"@types/react": "^19.1.6",
|
|
77
|
+
"@types/react-dom": "^19.1.5",
|
|
78
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
79
|
+
playwright: "^1.52.0",
|
|
80
|
+
tsup: "^8.5.0",
|
|
81
|
+
tsx: "^4.20.3",
|
|
82
|
+
typescript: "^5.8.3",
|
|
83
|
+
vite: "^6.3.5",
|
|
84
|
+
vitest: "^3.2.3"
|
|
85
|
+
},
|
|
86
|
+
keywords: [
|
|
87
|
+
"diff",
|
|
88
|
+
"review",
|
|
89
|
+
"coding-agents",
|
|
90
|
+
"mcp"
|
|
91
|
+
],
|
|
92
|
+
author: "Raj Joshi",
|
|
93
|
+
license: "MIT",
|
|
94
|
+
homepage: "https://getgloss.dev",
|
|
95
|
+
repository: {
|
|
96
|
+
type: "git",
|
|
97
|
+
url: "git+https://github.com/iamrajjoshi/gloss.git"
|
|
98
|
+
},
|
|
99
|
+
bugs: {
|
|
100
|
+
url: "https://github.com/iamrajjoshi/gloss/issues"
|
|
101
|
+
},
|
|
102
|
+
publishConfig: {
|
|
103
|
+
access: "public"
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/shared/paths.ts
|
|
108
|
+
var packageVersion = package_default.version;
|
|
24
109
|
function expandHome(input) {
|
|
25
110
|
if (input === "~") {
|
|
26
111
|
return homedir();
|
|
@@ -459,10 +544,15 @@ function parseUnifiedDiff(diffText) {
|
|
|
459
544
|
}
|
|
460
545
|
|
|
461
546
|
// src/cli/git.ts
|
|
547
|
+
var DIFF_ARGS = ["diff", "--no-color", "--find-renames", "--find-copies"];
|
|
462
548
|
async function git(args, cwd = process.cwd()) {
|
|
463
549
|
const result = await execa("git", args, { cwd });
|
|
464
550
|
return result.stdout.trimEnd();
|
|
465
551
|
}
|
|
552
|
+
async function gitMaybe(args, cwd) {
|
|
553
|
+
const result = await execa("git", args, { cwd, reject: false });
|
|
554
|
+
return result.exitCode === 0 ? result.stdout.trimEnd() : null;
|
|
555
|
+
}
|
|
466
556
|
async function gitLenient(args, cwd) {
|
|
467
557
|
const result = await execa("git", args, { cwd, reject: false });
|
|
468
558
|
if (result.exitCode !== 0 && result.stdout.length === 0) {
|
|
@@ -473,31 +563,156 @@ async function gitLenient(args, cwd) {
|
|
|
473
563
|
async function getRepoRoot(cwd = process.cwd()) {
|
|
474
564
|
return git(["rev-parse", "--show-toplevel"], cwd);
|
|
475
565
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const untrackedFiles = untrackedFilesRaw.split("\0").filter(Boolean);
|
|
485
|
-
const untrackedDiffs = await Promise.all(
|
|
486
|
-
untrackedFiles.map(
|
|
487
|
-
(filePath) => gitLenient(["diff", "--no-color", "--no-index", "--", "/dev/null", filePath], repoRoot)
|
|
488
|
-
)
|
|
566
|
+
function summarize(files) {
|
|
567
|
+
return files.reduce(
|
|
568
|
+
(stats, file) => ({
|
|
569
|
+
files: stats.files + 1,
|
|
570
|
+
additions: stats.additions + file.additions,
|
|
571
|
+
deletions: stats.deletions + file.deletions
|
|
572
|
+
}),
|
|
573
|
+
{ files: 0, additions: 0, deletions: 0 }
|
|
489
574
|
);
|
|
490
|
-
|
|
491
|
-
|
|
575
|
+
}
|
|
576
|
+
function buildPayload({
|
|
577
|
+
repoRoot,
|
|
578
|
+
branch,
|
|
579
|
+
rawDiff,
|
|
580
|
+
base,
|
|
581
|
+
mode,
|
|
582
|
+
requestedBase,
|
|
583
|
+
comparison,
|
|
584
|
+
fallbackReason
|
|
585
|
+
}) {
|
|
586
|
+
const files = parseUnifiedDiff(rawDiff);
|
|
492
587
|
return {
|
|
493
|
-
base
|
|
494
|
-
branch
|
|
588
|
+
base,
|
|
589
|
+
branch,
|
|
495
590
|
cwd: repoRoot,
|
|
591
|
+
scope: {
|
|
592
|
+
mode,
|
|
593
|
+
requestedBase,
|
|
594
|
+
base,
|
|
595
|
+
comparison,
|
|
596
|
+
fallbackReason
|
|
597
|
+
},
|
|
598
|
+
stats: summarize(files),
|
|
496
599
|
rawDiff,
|
|
497
|
-
files
|
|
600
|
+
files,
|
|
498
601
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
499
602
|
};
|
|
500
603
|
}
|
|
604
|
+
async function currentBranch(repoRoot) {
|
|
605
|
+
const branch = await gitMaybe(["rev-parse", "--abbrev-ref", "HEAD"], repoRoot);
|
|
606
|
+
return branch && branch !== "HEAD" ? branch : null;
|
|
607
|
+
}
|
|
608
|
+
async function captureUntrackedDiff(repoRoot) {
|
|
609
|
+
const untrackedFilesRaw = await git(
|
|
610
|
+
["ls-files", "--others", "--exclude-standard", "-z"],
|
|
611
|
+
repoRoot
|
|
612
|
+
);
|
|
613
|
+
const untrackedFiles = untrackedFilesRaw.split("\0").filter(Boolean);
|
|
614
|
+
return Promise.all(
|
|
615
|
+
untrackedFiles.map(
|
|
616
|
+
(filePath) => gitLenient(["diff", "--no-color", "--no-index", "--", "/dev/null", filePath], repoRoot)
|
|
617
|
+
)
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
async function captureWorkingDiff(baseRef, repoRoot) {
|
|
621
|
+
const [trackedDiff, untrackedDiffs] = await Promise.all([
|
|
622
|
+
git([...DIFF_ARGS, baseRef, "--"], repoRoot),
|
|
623
|
+
captureUntrackedDiff(repoRoot)
|
|
624
|
+
]);
|
|
625
|
+
return [trackedDiff, ...untrackedDiffs].filter(Boolean).join("\n");
|
|
626
|
+
}
|
|
627
|
+
async function resolveCommit(ref, repoRoot) {
|
|
628
|
+
return gitMaybe(["rev-parse", "--verify", `${ref}^{commit}`], repoRoot);
|
|
629
|
+
}
|
|
630
|
+
async function resolveBranchBase(repoRoot) {
|
|
631
|
+
const candidates = [];
|
|
632
|
+
const upstream = await gitMaybe(
|
|
633
|
+
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"],
|
|
634
|
+
repoRoot
|
|
635
|
+
);
|
|
636
|
+
const originHead = await gitMaybe(
|
|
637
|
+
["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"],
|
|
638
|
+
repoRoot
|
|
639
|
+
);
|
|
640
|
+
for (const ref of [upstream, originHead, "origin/main", "origin/master"]) {
|
|
641
|
+
if (ref && !candidates.includes(ref)) {
|
|
642
|
+
candidates.push(ref);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
for (const sourceRef of candidates) {
|
|
646
|
+
const [sourceSha, mergeBaseSha] = await Promise.all([
|
|
647
|
+
resolveCommit(sourceRef, repoRoot),
|
|
648
|
+
gitMaybe(["merge-base", "HEAD", sourceRef], repoRoot)
|
|
649
|
+
]);
|
|
650
|
+
if (sourceSha && mergeBaseSha) {
|
|
651
|
+
return { sourceRef, mergeBaseSha };
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
async function captureDiff(baseRef, cwd = process.cwd()) {
|
|
657
|
+
const repoRoot = await getRepoRoot(cwd);
|
|
658
|
+
const [headSha, branch] = await Promise.all([
|
|
659
|
+
git(["rev-parse", "HEAD"], repoRoot),
|
|
660
|
+
currentBranch(repoRoot)
|
|
661
|
+
]);
|
|
662
|
+
if (baseRef) {
|
|
663
|
+
const [baseSha, rawDiff2] = await Promise.all([
|
|
664
|
+
git(["rev-parse", baseRef], repoRoot),
|
|
665
|
+
captureWorkingDiff(baseRef, repoRoot)
|
|
666
|
+
]);
|
|
667
|
+
return buildPayload({
|
|
668
|
+
repoRoot,
|
|
669
|
+
branch,
|
|
670
|
+
rawDiff: rawDiff2,
|
|
671
|
+
base: { ref: baseRef, sha: baseSha },
|
|
672
|
+
mode: "explicit",
|
|
673
|
+
requestedBase: baseRef,
|
|
674
|
+
comparison: { ref: "working tree", sha: null },
|
|
675
|
+
fallbackReason: null
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
const workingDiff = await captureWorkingDiff("HEAD", repoRoot);
|
|
679
|
+
if (workingDiff.trim().length > 0) {
|
|
680
|
+
return buildPayload({
|
|
681
|
+
repoRoot,
|
|
682
|
+
branch,
|
|
683
|
+
rawDiff: workingDiff,
|
|
684
|
+
base: { ref: "HEAD", sha: headSha },
|
|
685
|
+
mode: "working",
|
|
686
|
+
requestedBase: null,
|
|
687
|
+
comparison: { ref: "working tree", sha: null },
|
|
688
|
+
fallbackReason: null
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
const branchBase = await resolveBranchBase(repoRoot);
|
|
692
|
+
if (!branchBase) {
|
|
693
|
+
return buildPayload({
|
|
694
|
+
repoRoot,
|
|
695
|
+
branch,
|
|
696
|
+
rawDiff: "",
|
|
697
|
+
base: { ref: "HEAD", sha: headSha },
|
|
698
|
+
mode: "working",
|
|
699
|
+
requestedBase: null,
|
|
700
|
+
comparison: { ref: "working tree", sha: null },
|
|
701
|
+
fallbackReason: "missing-branch-base"
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
const rawDiff = await git([...DIFF_ARGS, branchBase.mergeBaseSha, "HEAD", "--"], repoRoot);
|
|
705
|
+
return buildPayload({
|
|
706
|
+
repoRoot,
|
|
707
|
+
branch,
|
|
708
|
+
rawDiff,
|
|
709
|
+
base: { ref: `merge-base(${branchBase.sourceRef})`, sha: branchBase.mergeBaseSha },
|
|
710
|
+
mode: "branch",
|
|
711
|
+
requestedBase: null,
|
|
712
|
+
comparison: { ref: "HEAD", sha: headSha },
|
|
713
|
+
fallbackReason: "working-tree-clean"
|
|
714
|
+
});
|
|
715
|
+
}
|
|
501
716
|
async function assertGitAvailable() {
|
|
502
717
|
await execa("git", ["--version"]);
|
|
503
718
|
}
|
|
@@ -513,7 +728,7 @@ function printPlain(value) {
|
|
|
513
728
|
}
|
|
514
729
|
var program = new Command();
|
|
515
730
|
program.name("gloss").description("Local browser-based diff review for coding-agent loops.").version(packageVersion).option("--json", "print JSON for supported commands").option("--no-color", "disable color output");
|
|
516
|
-
program.command("open").description("Capture
|
|
731
|
+
program.command("open").description("Capture local changes and open them for review").option("--base <ref>", "explicit base git ref").option("--print-url", "print review URL").option("--no-open", "do not open a browser").option("--no-watch", "return immediately after registering the review").option("--timeout <seconds>", "watch timeout in seconds", Number).action(
|
|
517
732
|
async (options) => {
|
|
518
733
|
const globals = program.opts();
|
|
519
734
|
const info = await ensureServer();
|
|
@@ -527,7 +742,7 @@ program.command("open").description("Capture diff vs. base and open it for revie
|
|
|
527
742
|
await openBrowser(url);
|
|
528
743
|
}
|
|
529
744
|
if (options.watch === false) {
|
|
530
|
-
const result2 = { reviewId: meta.id, url, files: diff.files.length };
|
|
745
|
+
const result2 = { reviewId: meta.id, url, files: diff.files.length, scope: diff.scope.mode };
|
|
531
746
|
globals.json ? printJson(result2) : printPlain(`Review ${meta.id}: ${url}`);
|
|
532
747
|
return;
|
|
533
748
|
}
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/mcp/index.ts","../../src/cli/lifecycle.ts","../../src/shared/paths.ts","../../src/cli/server-client.ts","../../src/cli/git.ts","../../src/cli/diff-parser.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport openBrowser from 'open';\nimport { startMcpServer } from '../mcp/index';\nimport { packageVersion } from '../shared/paths';\nimport { assertGitAvailable, captureDiff, getRepoRoot } from './git';\nimport {\n ensureServer,\n isServerResponsive,\n readServerInfo,\n serverUrl,\n startServer,\n stopServer\n} from './lifecycle';\nimport { ServerClient } from './server-client';\n\ninterface GlobalOptions {\n json?: boolean;\n noColor?: boolean;\n}\n\nfunction printJson(value: unknown): void {\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction printPlain(value: string): void {\n process.stdout.write(`${value}\\n`);\n}\n\nconst program = new Command();\n\nprogram\n .name('gloss')\n .description('Local browser-based diff review for coding-agent loops.')\n .version(packageVersion)\n .option('--json', 'print JSON for supported commands')\n .option('--no-color', 'disable color output');\n\nprogram\n .command('open')\n .description('Capture diff vs. base and open it for review')\n .option('--base <ref>', 'base git ref', 'HEAD')\n .option('--print-url', 'print review URL')\n .option('--no-open', 'do not open a browser')\n .option('--no-watch', 'return immediately after registering the review')\n .option('--timeout <seconds>', 'watch timeout in seconds', Number)\n .action(\n async (options: {\n base: string;\n printUrl?: boolean;\n open?: boolean;\n watch?: boolean;\n timeout?: number;\n }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await ensureServer();\n const client = new ServerClient(serverUrl(info));\n const diff = await captureDiff(options.base);\n const { meta, url } = await client.createReview(diff);\n\n if (options.printUrl) {\n printPlain(url);\n }\n if (options.open !== false) {\n await openBrowser(url);\n }\n\n if (options.watch === false) {\n const result = { reviewId: meta.id, url, files: diff.files.length };\n globals.json ? printJson(result) : printPlain(`Review ${meta.id}: ${url}`);\n return;\n }\n\n const event = await client.watchReview(meta.id, options.timeout);\n if (event.type === 'review.cancelled') {\n process.exitCode = 2;\n globals.json ? printJson(event) : printPlain(`Review ${meta.id} cancelled`);\n return;\n }\n if (event.type !== 'review.completed') {\n throw new Error(`Unexpected review event ${event.type}`);\n }\n\n const feedback = await client.getFeedback(meta.id);\n const result = {\n reviewId: meta.id,\n url,\n files: event.counts.files,\n comments: event.counts.comments,\n feedbackPath: `${diff.cwd}/.gloss/reviews/${meta.id}/feedback.json`,\n markdownPath: `${diff.cwd}/.gloss/reviews/${meta.id}/feedback.md`,\n feedback\n };\n globals.json\n ? printJson(result)\n : printPlain(`Review ${meta.id} completed with ${event.counts.comments} comments`);\n }\n );\n\nprogram\n .command('watch')\n .argument('<reviewId>', 'review id')\n .description('Wait for review.completed for an existing review')\n .option('--timeout <seconds>', 'watch timeout in seconds', Number)\n .action(async (reviewId: string, options: { timeout?: number }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await ensureServer();\n const client = new ServerClient(serverUrl(info));\n const event = await client.watchReview(reviewId, options.timeout);\n globals.json ? printJson(event) : printPlain(`${event.type} ${event.reviewId}`);\n });\n\nprogram\n .command('start')\n .description('Start or reuse the background server')\n .option('--port <port>', 'port to bind', Number)\n .action(async (options: { port?: number }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await startServer({ port: options.port });\n globals.json\n ? printJson(info)\n : printPlain(`Gloss server running at ${serverUrl(info)} (pid ${info.pid})`);\n });\n\nprogram\n .command('status')\n .description('Show server and active reviews')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const info = await readServerInfo();\n const responsive = info ? await isServerResponsive(info) : false;\n let reviews: unknown[] = [];\n if (info && responsive) {\n reviews = (await new ServerClient(serverUrl(info)).listReviews()).reviews;\n }\n const status = { running: responsive, server: info, reviews };\n globals.json\n ? printJson(status)\n : printPlain(\n responsive && info\n ? `Gloss server running at ${serverUrl(info)} with ${reviews.length} active review(s)`\n : 'Gloss server is not running'\n );\n });\n\nprogram\n .command('stop')\n .description('Stop the managed background server')\n .option('--all', 'reserved for future multi-server cleanup')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const result = await stopServer();\n globals.json\n ? printJson(result)\n : printPlain(result.stopped ? 'Gloss server stopped' : 'Gloss server was not running');\n });\n\nprogram\n .command('mcp')\n .description('Start the experimental stdio MCP server')\n .action(async () => {\n await startMcpServer();\n });\n\nprogram\n .command('doctor')\n .description('Diagnose setup and validate git/state')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const checks: Array<{ name: string; ok: boolean; detail?: string }> = [];\n try {\n await assertGitAvailable();\n checks.push({ name: 'git', ok: true });\n } catch (error) {\n checks.push({\n name: 'git',\n ok: false,\n detail: error instanceof Error ? error.message : String(error)\n });\n }\n try {\n const root = await getRepoRoot();\n checks.push({ name: 'repo', ok: true, detail: root });\n } catch (error) {\n checks.push({\n name: 'repo',\n ok: false,\n detail: error instanceof Error ? error.message : String(error)\n });\n }\n const info = await readServerInfo();\n checks.push({\n name: 'server',\n ok: info ? await isServerResponsive(info) : false,\n detail: info ? serverUrl(info) : 'not started'\n });\n checks.push({\n name: '@pierre/diffs license',\n ok: true,\n detail: 'apache-2.0 dependency present'\n });\n\n if (globals.json) {\n printJson({ checks });\n } else {\n for (const check of checks) {\n printPlain(\n `${check.ok ? 'ok' : 'fail'} ${check.name}${check.detail ? ` - ${check.detail}` : ''}`\n );\n }\n }\n });\n\nprogram.parseAsync(process.argv).catch((error: unknown) => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n});\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod/v4';\nimport { ensureServer, serverUrl } from '../cli/lifecycle';\nimport { ServerClient } from '../cli/server-client';\nimport { packageVersion } from '../shared/paths';\n\nfunction textResult(value: unknown) {\n return {\n content: [\n {\n type: 'text' as const,\n text: typeof value === 'string' ? value : JSON.stringify(value, null, 2)\n }\n ]\n };\n}\n\nasync function client(): Promise<ServerClient> {\n const info = await ensureServer();\n return new ServerClient(serverUrl(info));\n}\n\nexport async function startMcpServer(): Promise<void> {\n const server = new McpServer({\n name: 'gloss',\n version: packageVersion\n });\n\n server.registerTool(\n 'list_pending_reviews',\n {\n title: 'List pending Gloss reviews',\n description: 'List pending local Gloss review sessions.'\n },\n async () => {\n const api = await client();\n const { reviews } = await api.listReviews();\n return textResult({ reviews: reviews.filter((review) => review.status === 'pending') });\n }\n );\n\n server.registerTool(\n 'get_review',\n {\n title: 'Get Gloss review',\n description: 'Fetch review metadata and diff payload.',\n inputSchema: { id: z.string() }\n },\n async ({ id }) => textResult(await (await client()).getReview(id))\n );\n\n server.registerTool(\n 'watch_review',\n {\n title: 'Watch Gloss review',\n description: 'Block until a review completes, then return feedback.',\n inputSchema: {\n id: z.string(),\n timeout: z.number().optional()\n }\n },\n async ({ id, timeout }) => {\n const api = await client();\n await api.watchReview(id, timeout);\n return textResult(await api.getFeedback(id));\n }\n );\n\n server.registerTool(\n 'get_review_feedback',\n {\n title: 'Get Gloss review feedback',\n description: 'Fetch completed review feedback.',\n inputSchema: { id: z.string() }\n },\n async ({ id }) => textResult(await (await client()).getFeedback(id))\n );\n\n server.registerTool(\n 'mark_review_resolved',\n {\n title: 'Mark Gloss review resolved',\n description: 'Write a resolved marker for a completed review.',\n inputSchema: {\n id: z.string(),\n summary: z.string().optional()\n }\n },\n async ({ id, summary }) => textResult(await (await client()).markResolved(id, summary))\n );\n\n await server.connect(new StdioServerTransport());\n}\n","import { spawn } from 'node:child_process';\nimport { existsSync, openSync } from 'node:fs';\nimport { readFile, rm, writeFile } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport getPort from 'get-port';\nimport {\n ensureDir,\n globalLogDir,\n globalServerFile,\n globalServerLogFile,\n globalStateDir,\n packageVersion\n} from '../shared/paths';\nimport type { ServerInfo } from '../shared/types';\nimport { ServerClient } from './server-client';\n\nexport async function readServerInfo(): Promise<ServerInfo | null> {\n try {\n return JSON.parse(await readFile(globalServerFile(), 'utf8')) as ServerInfo;\n } catch {\n return null;\n }\n}\n\nexport function serverUrl(info: Pick<ServerInfo, 'port'>): string {\n return `http://localhost:${info.port}`;\n}\n\nexport async function isServerResponsive(info: ServerInfo): Promise<boolean> {\n if (!isPidAlive(info.pid)) {\n return false;\n }\n try {\n const health = await new ServerClient(serverUrl(info)).health();\n return health.ok === true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureServer(options: { port?: number } = {}): Promise<ServerInfo> {\n const existing = await readServerInfo();\n if (existing && (await isServerResponsive(existing))) {\n return existing;\n }\n return startServer(options);\n}\n\nexport async function startServer(options: { port?: number } = {}): Promise<ServerInfo> {\n const existing = await readServerInfo();\n if (existing && (await isServerResponsive(existing))) {\n return existing;\n }\n\n await ensureDir(globalStateDir());\n await ensureDir(globalLogDir());\n const port = options.port ?? (await getPort());\n const daemonPath = fileURLToPath(new URL('../server/daemon.js', import.meta.url));\n if (!existsSync(daemonPath)) {\n throw new Error(`Cannot find server daemon at ${daemonPath}. Run pnpm build first.`);\n }\n\n const logFd = openSync(globalServerLogFile(), 'a');\n const child = spawn(process.execPath, [daemonPath], {\n detached: true,\n env: {\n ...process.env,\n GLOSS_PORT: String(port),\n GLOSS_STATE_DIR: globalStateDir()\n },\n stdio: ['ignore', logFd, logFd]\n });\n child.unref();\n\n const info: ServerInfo = {\n pid: child.pid ?? -1,\n port,\n version: packageVersion,\n startedAt: new Date().toISOString(),\n stateDir: globalStateDir()\n };\n await writeFile(globalServerFile(), `${JSON.stringify(info, null, 2)}\\n`);\n\n const deadline = Date.now() + 8000;\n while (Date.now() < deadline) {\n if (await isServerResponsive(info)) {\n return info;\n }\n await new Promise((resolve) => setTimeout(resolve, 150));\n }\n\n throw new Error(`Server did not become responsive. See ${globalServerLogFile()}`);\n}\n\nexport async function stopServer(): Promise<{ stopped: boolean; info: ServerInfo | null }> {\n const info = await readServerInfo();\n if (!info) {\n return { stopped: false, info: null };\n }\n\n if (isPidAlive(info.pid)) {\n process.kill(info.pid, 'SIGTERM');\n }\n await rm(globalServerFile(), { force: true });\n return { stopped: true, info };\n}\n\nexport async function writeServerInfo(info: ServerInfo): Promise<void> {\n await ensureDir(globalStateDir());\n await writeFile(globalServerFile(), `${JSON.stringify(info, null, 2)}\\n`);\n}\n\nexport function isPidAlive(pid: number): boolean {\n if (pid <= 0) {\n return false;\n }\n try {\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n","import { mkdir } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport path from 'node:path';\n\nexport const packageVersion = '0.1.0';\n\nexport function expandHome(input: string): string {\n if (input === '~') {\n return homedir();\n }\n if (input.startsWith('~/')) {\n return path.join(homedir(), input.slice(2));\n }\n return input;\n}\n\nexport function globalStateDir(): string {\n return expandHome(process.env.GLOSS_STATE_DIR ?? '~/.gloss');\n}\n\nexport function globalServerFile(): string {\n return path.join(globalStateDir(), 'server.json');\n}\n\nexport function globalLogDir(): string {\n return path.join(globalStateDir(), 'logs');\n}\n\nexport function globalServerLogFile(): string {\n return path.join(globalLogDir(), 'server.log');\n}\n\nexport function repoGlossDir(cwd: string): string {\n return path.join(cwd, '.gloss');\n}\n\nexport function reviewsDir(cwd: string): string {\n return path.join(repoGlossDir(cwd), 'reviews');\n}\n\nexport function reviewDir(cwd: string, reviewId: string): string {\n return path.join(reviewsDir(cwd), reviewId);\n}\n\nexport async function ensureDir(dir: string): Promise<void> {\n await mkdir(dir, { recursive: true });\n}\n","import type {\n Comment,\n DiffPayload,\n FeedbackBundle,\n OpenResult,\n ReviewEvent,\n ReviewMeta,\n ReviewRecord\n} from '../shared/types';\n\nexport class ServerClient {\n constructor(private readonly baseUrl: string) {}\n\n async health(): Promise<{ ok: boolean; version: string; activeReviews: number }> {\n return this.get('/api/health');\n }\n\n async createReview(diff: DiffPayload): Promise<{ meta: ReviewMeta; url: string }> {\n return this.post('/api/reviews', diff);\n }\n\n async getReview(reviewId: string): Promise<ReviewRecord> {\n return this.get(`/api/reviews/${reviewId}`);\n }\n\n async listReviews(): Promise<{ reviews: ReviewMeta[] }> {\n return this.get('/api/reviews');\n }\n\n async getFeedback(reviewId: string): Promise<FeedbackBundle> {\n return this.get(`/api/reviews/${reviewId}/feedback`);\n }\n\n async markResolved(reviewId: string, summary?: string): Promise<{ ok: true; path: string }> {\n return this.post(`/api/reviews/${reviewId}/resolved`, { summary });\n }\n\n async submitReview(reviewId: string, comments: Comment[]): Promise<OpenResult> {\n return this.post(`/api/reviews/${reviewId}/submit`, { comments });\n }\n\n async watchReview(reviewId: string, timeoutSeconds?: number): Promise<ReviewEvent> {\n const controller = new AbortController();\n const timeout =\n timeoutSeconds && timeoutSeconds > 0\n ? setTimeout(() => controller.abort(), timeoutSeconds * 1000)\n : null;\n\n try {\n const response = await fetch(`${this.baseUrl}/api/reviews/${reviewId}/events`, {\n signal: controller.signal\n });\n if (!response.ok || !response.body) {\n throw new Error(`watch failed: ${response.status} ${await response.text()}`);\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n throw new Error('watch stream ended before completion');\n }\n buffer += decoder.decode(value, { stream: true });\n const events = buffer.split('\\n\\n');\n buffer = events.pop() ?? '';\n for (const eventChunk of events) {\n const dataLine = eventChunk.split('\\n').find((line) => line.startsWith('data:'));\n if (!dataLine) {\n continue;\n }\n const event = JSON.parse(dataLine.slice(5).trim()) as ReviewEvent;\n if (event.type === 'review.completed' || event.type === 'review.cancelled') {\n return event;\n }\n }\n }\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n }\n\n private async get<T>(path: string): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`);\n return parseResponse<T>(response);\n }\n\n private async post<T>(path: string, body: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body)\n });\n return parseResponse<T>(response);\n }\n}\n\nasync function parseResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);\n }\n return (await response.json()) as T;\n}\n","import { execa } from 'execa';\nimport type { DiffPayload } from '../shared/types';\nimport { parseUnifiedDiff } from './diff-parser';\n\nasync function git(args: string[], cwd = process.cwd()): Promise<string> {\n const result = await execa('git', args, { cwd });\n return result.stdout.trimEnd();\n}\n\nasync function gitLenient(args: string[], cwd: string): Promise<string> {\n const result = await execa('git', args, { cwd, reject: false });\n if (result.exitCode !== 0 && result.stdout.length === 0) {\n throw new Error(result.stderr || `git ${args.join(' ')} failed`);\n }\n return result.stdout.trimEnd();\n}\n\nexport async function getRepoRoot(cwd = process.cwd()): Promise<string> {\n return git(['rev-parse', '--show-toplevel'], cwd);\n}\n\nexport async function captureDiff(baseRef = 'HEAD', cwd = process.cwd()): Promise<DiffPayload> {\n const repoRoot = await getRepoRoot(cwd);\n const [baseSha, branchResult, trackedDiff, untrackedFilesRaw] = await Promise.all([\n git(['rev-parse', baseRef], repoRoot),\n execa('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: repoRoot, reject: false }),\n git(['diff', '--no-color', '--find-renames', '--find-copies', baseRef, '--'], repoRoot),\n git(['ls-files', '--others', '--exclude-standard', '-z'], repoRoot)\n ]);\n\n const untrackedFiles = untrackedFilesRaw.split('\\0').filter(Boolean);\n const untrackedDiffs = await Promise.all(\n untrackedFiles.map((filePath) =>\n gitLenient(['diff', '--no-color', '--no-index', '--', '/dev/null', filePath], repoRoot)\n )\n );\n const rawDiff = [trackedDiff, ...untrackedDiffs].filter(Boolean).join('\\n');\n const branch = branchResult.exitCode === 0 ? branchResult.stdout.trim() : null;\n\n return {\n base: { ref: baseRef, sha: baseSha },\n branch: branch && branch !== 'HEAD' ? branch : null,\n cwd: repoRoot,\n rawDiff,\n files: parseUnifiedDiff(rawDiff),\n capturedAt: new Date().toISOString()\n };\n}\n\nexport async function assertGitAvailable(): Promise<void> {\n await execa('git', ['--version']);\n}\n","import path from 'node:path';\nimport type { DiffFile, DiffHunk, DiffLine } from '../shared/types';\n\nconst hunkHeaderPattern = /^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@(.*)$/;\n\nfunction stripGitPath(input: string): string {\n return input.replace(/^[ab]\\//, '');\n}\n\nfunction languageForPath(filePath: string): string | null {\n const ext = path.extname(filePath).slice(1).toLowerCase();\n if (!ext) {\n return null;\n }\n const map: Record<string, string> = {\n cjs: 'js',\n mjs: 'js',\n js: 'js',\n jsx: 'jsx',\n ts: 'ts',\n tsx: 'tsx',\n py: 'python',\n rb: 'ruby',\n sh: 'bash',\n md: 'markdown',\n yml: 'yaml',\n yaml: 'yaml'\n };\n return map[ext] ?? ext;\n}\n\nfunction emptyFile(): DiffFile {\n return {\n path: '',\n oldPath: null,\n additions: 0,\n deletions: 0,\n isBinary: false,\n isDeleted: false,\n isNew: false,\n isRenamed: false,\n language: null,\n hunks: []\n };\n}\n\nexport function parseUnifiedDiff(diffText: string): DiffFile[] {\n const files: DiffFile[] = [];\n let current: DiffFile | null = null;\n let currentHunk: DiffHunk | null = null;\n let oldCursor = 0;\n let newCursor = 0;\n\n const finalizeFile = () => {\n if (current?.path) {\n current.language = languageForPath(current.path);\n files.push(current);\n }\n };\n\n for (const line of diffText.split('\\n')) {\n if (line.startsWith('diff --git ')) {\n finalizeFile();\n current = emptyFile();\n currentHunk = null;\n oldCursor = 0;\n newCursor = 0;\n const match = /^diff --git a\\/(.+) b\\/(.+)$/.exec(line);\n if (match) {\n current.oldPath = match[1];\n current.path = match[2];\n }\n continue;\n }\n\n if (!current) {\n continue;\n }\n\n if (line.startsWith('new file mode')) {\n current.isNew = true;\n continue;\n }\n\n if (line.startsWith('deleted file mode')) {\n current.isDeleted = true;\n continue;\n }\n\n if (line.startsWith('rename from ')) {\n current.oldPath = line.slice('rename from '.length);\n current.isRenamed = true;\n continue;\n }\n\n if (line.startsWith('rename to ')) {\n current.path = line.slice('rename to '.length);\n current.isRenamed = true;\n continue;\n }\n\n if (line.startsWith('Binary files ') || line.startsWith('GIT binary patch')) {\n current.isBinary = true;\n continue;\n }\n\n if (line.startsWith('--- ')) {\n const oldPath = line.slice(4).trim();\n current.oldPath = oldPath === '/dev/null' ? null : stripGitPath(oldPath);\n continue;\n }\n\n if (line.startsWith('+++ ')) {\n const newPath = line.slice(4).trim();\n current.path =\n newPath === '/dev/null' ? (current.oldPath ?? current.path) : stripGitPath(newPath);\n continue;\n }\n\n const hunkMatch = hunkHeaderPattern.exec(line);\n if (hunkMatch) {\n const oldStart = Number(hunkMatch[1]);\n const oldLines = Number(hunkMatch[2] ?? '1');\n const newStart = Number(hunkMatch[3]);\n const newLines = Number(hunkMatch[4] ?? '1');\n currentHunk = {\n oldStart,\n oldLines,\n newStart,\n newLines,\n header: hunkMatch[5]?.trim() ?? '',\n lines: []\n };\n current.hunks.push(currentHunk);\n oldCursor = oldStart;\n newCursor = newStart;\n continue;\n }\n\n if (!currentHunk) {\n continue;\n }\n\n const marker = line[0];\n const content = line.slice(1);\n let diffLine: DiffLine | null = null;\n\n if (marker === '+') {\n diffLine = { type: 'add', oldLine: null, newLine: newCursor, content };\n current.additions += 1;\n newCursor += 1;\n } else if (marker === '-') {\n diffLine = { type: 'delete', oldLine: oldCursor, newLine: null, content };\n current.deletions += 1;\n oldCursor += 1;\n } else if (marker === ' ') {\n diffLine = { type: 'context', oldLine: oldCursor, newLine: newCursor, content };\n oldCursor += 1;\n newCursor += 1;\n } else if (line.startsWith('\\\')) {\n continue;\n }\n\n if (diffLine) {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ACrB,CAAC;","names":["path","path","client","result"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/mcp/index.ts","../../src/cli/lifecycle.ts","../../src/shared/paths.ts","../../package.json","../../src/cli/server-client.ts","../../src/cli/git.ts","../../src/cli/diff-parser.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from 'commander';\nimport openBrowser from 'open';\nimport { startMcpServer } from '../mcp/index';\nimport { packageVersion } from '../shared/paths';\nimport { assertGitAvailable, captureDiff, getRepoRoot } from './git';\nimport {\n ensureServer,\n isServerResponsive,\n readServerInfo,\n serverUrl,\n startServer,\n stopServer\n} from './lifecycle';\nimport { ServerClient } from './server-client';\n\ninterface GlobalOptions {\n json?: boolean;\n noColor?: boolean;\n}\n\nfunction printJson(value: unknown): void {\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction printPlain(value: string): void {\n process.stdout.write(`${value}\\n`);\n}\n\nconst program = new Command();\n\nprogram\n .name('gloss')\n .description('Local browser-based diff review for coding-agent loops.')\n .version(packageVersion)\n .option('--json', 'print JSON for supported commands')\n .option('--no-color', 'disable color output');\n\nprogram\n .command('open')\n .description('Capture local changes and open them for review')\n .option('--base <ref>', 'explicit base git ref')\n .option('--print-url', 'print review URL')\n .option('--no-open', 'do not open a browser')\n .option('--no-watch', 'return immediately after registering the review')\n .option('--timeout <seconds>', 'watch timeout in seconds', Number)\n .action(\n async (options: {\n base?: string;\n printUrl?: boolean;\n open?: boolean;\n watch?: boolean;\n timeout?: number;\n }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await ensureServer();\n const client = new ServerClient(serverUrl(info));\n const diff = await captureDiff(options.base);\n const { meta, url } = await client.createReview(diff);\n\n if (options.printUrl) {\n printPlain(url);\n }\n if (options.open !== false) {\n await openBrowser(url);\n }\n\n if (options.watch === false) {\n const result = { reviewId: meta.id, url, files: diff.files.length, scope: diff.scope.mode };\n globals.json ? printJson(result) : printPlain(`Review ${meta.id}: ${url}`);\n return;\n }\n\n const event = await client.watchReview(meta.id, options.timeout);\n if (event.type === 'review.cancelled') {\n process.exitCode = 2;\n globals.json ? printJson(event) : printPlain(`Review ${meta.id} cancelled`);\n return;\n }\n if (event.type !== 'review.completed') {\n throw new Error(`Unexpected review event ${event.type}`);\n }\n\n const feedback = await client.getFeedback(meta.id);\n const result = {\n reviewId: meta.id,\n url,\n files: event.counts.files,\n comments: event.counts.comments,\n feedbackPath: `${diff.cwd}/.gloss/reviews/${meta.id}/feedback.json`,\n markdownPath: `${diff.cwd}/.gloss/reviews/${meta.id}/feedback.md`,\n feedback\n };\n globals.json\n ? printJson(result)\n : printPlain(`Review ${meta.id} completed with ${event.counts.comments} comments`);\n }\n );\n\nprogram\n .command('watch')\n .argument('<reviewId>', 'review id')\n .description('Wait for review.completed for an existing review')\n .option('--timeout <seconds>', 'watch timeout in seconds', Number)\n .action(async (reviewId: string, options: { timeout?: number }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await ensureServer();\n const client = new ServerClient(serverUrl(info));\n const event = await client.watchReview(reviewId, options.timeout);\n globals.json ? printJson(event) : printPlain(`${event.type} ${event.reviewId}`);\n });\n\nprogram\n .command('start')\n .description('Start or reuse the background server')\n .option('--port <port>', 'port to bind', Number)\n .action(async (options: { port?: number }) => {\n const globals = program.opts<GlobalOptions>();\n const info = await startServer({ port: options.port });\n globals.json\n ? printJson(info)\n : printPlain(`Gloss server running at ${serverUrl(info)} (pid ${info.pid})`);\n });\n\nprogram\n .command('status')\n .description('Show server and active reviews')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const info = await readServerInfo();\n const responsive = info ? await isServerResponsive(info) : false;\n let reviews: unknown[] = [];\n if (info && responsive) {\n reviews = (await new ServerClient(serverUrl(info)).listReviews()).reviews;\n }\n const status = { running: responsive, server: info, reviews };\n globals.json\n ? printJson(status)\n : printPlain(\n responsive && info\n ? `Gloss server running at ${serverUrl(info)} with ${reviews.length} active review(s)`\n : 'Gloss server is not running'\n );\n });\n\nprogram\n .command('stop')\n .description('Stop the managed background server')\n .option('--all', 'reserved for future multi-server cleanup')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const result = await stopServer();\n globals.json\n ? printJson(result)\n : printPlain(result.stopped ? 'Gloss server stopped' : 'Gloss server was not running');\n });\n\nprogram\n .command('mcp')\n .description('Start the experimental stdio MCP server')\n .action(async () => {\n await startMcpServer();\n });\n\nprogram\n .command('doctor')\n .description('Diagnose setup and validate git/state')\n .action(async () => {\n const globals = program.opts<GlobalOptions>();\n const checks: Array<{ name: string; ok: boolean; detail?: string }> = [];\n try {\n await assertGitAvailable();\n checks.push({ name: 'git', ok: true });\n } catch (error) {\n checks.push({\n name: 'git',\n ok: false,\n detail: error instanceof Error ? error.message : String(error)\n });\n }\n try {\n const root = await getRepoRoot();\n checks.push({ name: 'repo', ok: true, detail: root });\n } catch (error) {\n checks.push({\n name: 'repo',\n ok: false,\n detail: error instanceof Error ? error.message : String(error)\n });\n }\n const info = await readServerInfo();\n checks.push({\n name: 'server',\n ok: info ? await isServerResponsive(info) : false,\n detail: info ? serverUrl(info) : 'not started'\n });\n checks.push({\n name: '@pierre/diffs license',\n ok: true,\n detail: 'apache-2.0 dependency present'\n });\n\n if (globals.json) {\n printJson({ checks });\n } else {\n for (const check of checks) {\n printPlain(\n `${check.ok ? 'ok' : 'fail'} ${check.name}${check.detail ? ` - ${check.detail}` : ''}`\n );\n }\n }\n });\n\nprogram.parseAsync(process.argv).catch((error: unknown) => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n});\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod/v4';\nimport { ensureServer, serverUrl } from '../cli/lifecycle';\nimport { ServerClient } from '../cli/server-client';\nimport { packageVersion } from '../shared/paths';\n\nfunction textResult(value: unknown) {\n return {\n content: [\n {\n type: 'text' as const,\n text: typeof value === 'string' ? value : JSON.stringify(value, null, 2)\n }\n ]\n };\n}\n\nasync function client(): Promise<ServerClient> {\n const info = await ensureServer();\n return new ServerClient(serverUrl(info));\n}\n\nexport async function startMcpServer(): Promise<void> {\n const server = new McpServer({\n name: 'gloss',\n version: packageVersion\n });\n\n server.registerTool(\n 'list_pending_reviews',\n {\n title: 'List pending Gloss reviews',\n description: 'List pending local Gloss review sessions.'\n },\n async () => {\n const api = await client();\n const { reviews } = await api.listReviews();\n return textResult({ reviews: reviews.filter((review) => review.status === 'pending') });\n }\n );\n\n server.registerTool(\n 'get_review',\n {\n title: 'Get Gloss review',\n description: 'Fetch review metadata and diff payload.',\n inputSchema: { id: z.string() }\n },\n async ({ id }) => textResult(await (await client()).getReview(id))\n );\n\n server.registerTool(\n 'watch_review',\n {\n title: 'Watch Gloss review',\n description: 'Block until a review completes, then return feedback.',\n inputSchema: {\n id: z.string(),\n timeout: z.number().optional()\n }\n },\n async ({ id, timeout }) => {\n const api = await client();\n await api.watchReview(id, timeout);\n return textResult(await api.getFeedback(id));\n }\n );\n\n server.registerTool(\n 'get_review_feedback',\n {\n title: 'Get Gloss review feedback',\n description: 'Fetch completed review feedback.',\n inputSchema: { id: z.string() }\n },\n async ({ id }) => textResult(await (await client()).getFeedback(id))\n );\n\n server.registerTool(\n 'mark_review_resolved',\n {\n title: 'Mark Gloss review resolved',\n description: 'Write a resolved marker for a completed review.',\n inputSchema: {\n id: z.string(),\n summary: z.string().optional()\n }\n },\n async ({ id, summary }) => textResult(await (await client()).markResolved(id, summary))\n );\n\n await server.connect(new StdioServerTransport());\n}\n","import { spawn } from 'node:child_process';\nimport { existsSync, openSync } from 'node:fs';\nimport { readFile, rm, writeFile } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport getPort from 'get-port';\nimport {\n ensureDir,\n globalLogDir,\n globalServerFile,\n globalServerLogFile,\n globalStateDir,\n packageVersion\n} from '../shared/paths';\nimport type { ServerInfo } from '../shared/types';\nimport { ServerClient } from './server-client';\n\nexport async function readServerInfo(): Promise<ServerInfo | null> {\n try {\n return JSON.parse(await readFile(globalServerFile(), 'utf8')) as ServerInfo;\n } catch {\n return null;\n }\n}\n\nexport function serverUrl(info: Pick<ServerInfo, 'port'>): string {\n return `http://localhost:${info.port}`;\n}\n\nexport async function isServerResponsive(info: ServerInfo): Promise<boolean> {\n if (!isPidAlive(info.pid)) {\n return false;\n }\n try {\n const health = await new ServerClient(serverUrl(info)).health();\n return health.ok === true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureServer(options: { port?: number } = {}): Promise<ServerInfo> {\n const existing = await readServerInfo();\n if (existing && (await isServerResponsive(existing))) {\n return existing;\n }\n return startServer(options);\n}\n\nexport async function startServer(options: { port?: number } = {}): Promise<ServerInfo> {\n const existing = await readServerInfo();\n if (existing && (await isServerResponsive(existing))) {\n return existing;\n }\n\n await ensureDir(globalStateDir());\n await ensureDir(globalLogDir());\n const port = options.port ?? (await getPort());\n const daemonPath = fileURLToPath(new URL('../server/daemon.js', import.meta.url));\n if (!existsSync(daemonPath)) {\n throw new Error(`Cannot find server daemon at ${daemonPath}. Run pnpm build first.`);\n }\n\n const logFd = openSync(globalServerLogFile(), 'a');\n const child = spawn(process.execPath, [daemonPath], {\n detached: true,\n env: {\n ...process.env,\n GLOSS_PORT: String(port),\n GLOSS_STATE_DIR: globalStateDir()\n },\n stdio: ['ignore', logFd, logFd]\n });\n child.unref();\n\n const info: ServerInfo = {\n pid: child.pid ?? -1,\n port,\n version: packageVersion,\n startedAt: new Date().toISOString(),\n stateDir: globalStateDir()\n };\n await writeFile(globalServerFile(), `${JSON.stringify(info, null, 2)}\\n`);\n\n const deadline = Date.now() + 8000;\n while (Date.now() < deadline) {\n if (await isServerResponsive(info)) {\n return info;\n }\n await new Promise((resolve) => setTimeout(resolve, 150));\n }\n\n throw new Error(`Server did not become responsive. See ${globalServerLogFile()}`);\n}\n\nexport async function stopServer(): Promise<{ stopped: boolean; info: ServerInfo | null }> {\n const info = await readServerInfo();\n if (!info) {\n return { stopped: false, info: null };\n }\n\n if (isPidAlive(info.pid)) {\n process.kill(info.pid, 'SIGTERM');\n }\n await rm(globalServerFile(), { force: true });\n return { stopped: true, info };\n}\n\nexport async function writeServerInfo(info: ServerInfo): Promise<void> {\n await ensureDir(globalStateDir());\n await writeFile(globalServerFile(), `${JSON.stringify(info, null, 2)}\\n`);\n}\n\nexport function isPidAlive(pid: number): boolean {\n if (pid <= 0) {\n return false;\n }\n try {\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n","import { mkdir } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport path from 'node:path';\nimport packageJson from '../../package.json';\n\nexport const packageVersion = packageJson.version;\n\nexport function expandHome(input: string): string {\n if (input === '~') {\n return homedir();\n }\n if (input.startsWith('~/')) {\n return path.join(homedir(), input.slice(2));\n }\n return input;\n}\n\nexport function globalStateDir(): string {\n return expandHome(process.env.GLOSS_STATE_DIR ?? '~/.gloss');\n}\n\nexport function globalServerFile(): string {\n return path.join(globalStateDir(), 'server.json');\n}\n\nexport function globalLogDir(): string {\n return path.join(globalStateDir(), 'logs');\n}\n\nexport function globalServerLogFile(): string {\n return path.join(globalLogDir(), 'server.log');\n}\n\nexport function repoGlossDir(cwd: string): string {\n return path.join(cwd, '.gloss');\n}\n\nexport function reviewsDir(cwd: string): string {\n return path.join(repoGlossDir(cwd), 'reviews');\n}\n\nexport function reviewDir(cwd: string, reviewId: string): string {\n return path.join(reviewsDir(cwd), reviewId);\n}\n\nexport async function ensureDir(dir: string): Promise<void> {\n await mkdir(dir, { recursive: true });\n}\n","{\n \"name\": \"getgloss\",\n \"version\": \"0.2.0\",\n \"description\": \"Local browser-based diff review for coding-agent loops.\",\n \"type\": \"module\",\n \"packageManager\": \"pnpm@10.33.2\",\n \"bin\": {\n \"getgloss\": \"./dist/cli/index.js\",\n \"gloss\": \"./dist/cli/index.js\"\n },\n \"files\": [\n \"dist\",\n \"skill\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"scripts\": {\n \"build\": \"pnpm build:web && pnpm build:node\",\n \"build:web\": \"vite build\",\n \"build:node\": \"tsup\",\n \"check\": \"biome check .\",\n \"format\": \"biome format --write .\",\n \"prepack\": \"pnpm build\",\n \"dev:web\": \"vite --host 127.0.0.1\",\n \"setup\": \"tsx scripts/dev-cli.ts\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"dependencies\": {\n \"@hono/node-server\": \"^1.14.4\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@pierre/diffs\": \"^1.2.1\",\n \"@tailwindcss/vite\": \"^4.1.7\",\n \"commander\": \"^14.0.0\",\n \"execa\": \"^9.5.3\",\n \"get-port\": \"^7.1.0\",\n \"hono\": \"^4.7.10\",\n \"lucide-react\": \"^1.16.0\",\n \"open\": \"^10.1.2\",\n \"react\": \"^19.1.0\",\n \"react-dom\": \"^19.1.0\",\n \"ulid\": \"^3.0.0\",\n \"zod\": \"^4.4.3\",\n \"zustand\": \"^5.0.5\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.6\",\n \"@types/node\": \"^24.0.1\",\n \"@types/react\": \"^19.1.6\",\n \"@types/react-dom\": \"^19.1.5\",\n \"@vitejs/plugin-react\": \"^4.5.2\",\n \"playwright\": \"^1.52.0\",\n \"tsup\": \"^8.5.0\",\n \"tsx\": \"^4.20.3\",\n \"typescript\": \"^5.8.3\",\n \"vite\": \"^6.3.5\",\n \"vitest\": \"^3.2.3\"\n },\n \"keywords\": [\n \"diff\",\n \"review\",\n \"coding-agents\",\n \"mcp\"\n ],\n \"author\": \"Raj Joshi\",\n \"license\": \"MIT\",\n \"homepage\": \"https://getgloss.dev\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/iamrajjoshi/gloss.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/iamrajjoshi/gloss/issues\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import type {\n Comment,\n DiffPayload,\n FeedbackBundle,\n OpenResult,\n ReviewEvent,\n ReviewMeta,\n ReviewRecord\n} from '../shared/types';\n\nexport class ServerClient {\n constructor(private readonly baseUrl: string) {}\n\n async health(): Promise<{ ok: boolean; version: string; activeReviews: number }> {\n return this.get('/api/health');\n }\n\n async createReview(diff: DiffPayload): Promise<{ meta: ReviewMeta; url: string }> {\n return this.post('/api/reviews', diff);\n }\n\n async getReview(reviewId: string): Promise<ReviewRecord> {\n return this.get(`/api/reviews/${reviewId}`);\n }\n\n async listReviews(): Promise<{ reviews: ReviewMeta[] }> {\n return this.get('/api/reviews');\n }\n\n async getFeedback(reviewId: string): Promise<FeedbackBundle> {\n return this.get(`/api/reviews/${reviewId}/feedback`);\n }\n\n async markResolved(reviewId: string, summary?: string): Promise<{ ok: true; path: string }> {\n return this.post(`/api/reviews/${reviewId}/resolved`, { summary });\n }\n\n async submitReview(reviewId: string, comments: Comment[]): Promise<OpenResult> {\n return this.post(`/api/reviews/${reviewId}/submit`, { comments });\n }\n\n async watchReview(reviewId: string, timeoutSeconds?: number): Promise<ReviewEvent> {\n const controller = new AbortController();\n const timeout =\n timeoutSeconds && timeoutSeconds > 0\n ? setTimeout(() => controller.abort(), timeoutSeconds * 1000)\n : null;\n\n try {\n const response = await fetch(`${this.baseUrl}/api/reviews/${reviewId}/events`, {\n signal: controller.signal\n });\n if (!response.ok || !response.body) {\n throw new Error(`watch failed: ${response.status} ${await response.text()}`);\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n throw new Error('watch stream ended before completion');\n }\n buffer += decoder.decode(value, { stream: true });\n const events = buffer.split('\\n\\n');\n buffer = events.pop() ?? '';\n for (const eventChunk of events) {\n const dataLine = eventChunk.split('\\n').find((line) => line.startsWith('data:'));\n if (!dataLine) {\n continue;\n }\n const event = JSON.parse(dataLine.slice(5).trim()) as ReviewEvent;\n if (event.type === 'review.completed' || event.type === 'review.cancelled') {\n return event;\n }\n }\n }\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n }\n\n private async get<T>(path: string): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`);\n return parseResponse<T>(response);\n }\n\n private async post<T>(path: string, body: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body)\n });\n return parseResponse<T>(response);\n }\n}\n\nasync function parseResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}: ${await response.text()}`);\n }\n return (await response.json()) as T;\n}\n","import { execa } from 'execa';\nimport type {\n DiffFallbackReason,\n DiffFile,\n DiffPayload,\n DiffScopeMode,\n DiffStats\n} from '../shared/types';\nimport { parseUnifiedDiff } from './diff-parser';\n\nconst DIFF_ARGS = ['diff', '--no-color', '--find-renames', '--find-copies'];\n\nasync function git(args: string[], cwd = process.cwd()): Promise<string> {\n const result = await execa('git', args, { cwd });\n return result.stdout.trimEnd();\n}\n\nasync function gitMaybe(args: string[], cwd: string): Promise<string | null> {\n const result = await execa('git', args, { cwd, reject: false });\n return result.exitCode === 0 ? result.stdout.trimEnd() : null;\n}\n\nasync function gitLenient(args: string[], cwd: string): Promise<string> {\n const result = await execa('git', args, { cwd, reject: false });\n if (result.exitCode !== 0 && result.stdout.length === 0) {\n throw new Error(result.stderr || `git ${args.join(' ')} failed`);\n }\n return result.stdout.trimEnd();\n}\n\nexport async function getRepoRoot(cwd = process.cwd()): Promise<string> {\n return git(['rev-parse', '--show-toplevel'], cwd);\n}\n\ninterface ResolvedBranchBase {\n sourceRef: string;\n mergeBaseSha: string;\n}\n\ninterface PayloadOptions {\n repoRoot: string;\n branch: string | null;\n rawDiff: string;\n base: { ref: string; sha: string };\n mode: DiffScopeMode;\n requestedBase: string | null;\n comparison: { ref: string; sha: string | null };\n fallbackReason: DiffFallbackReason;\n}\n\nfunction summarize(files: DiffFile[]): DiffStats {\n return files.reduce(\n (stats, file) => ({\n files: stats.files + 1,\n additions: stats.additions + file.additions,\n deletions: stats.deletions + file.deletions\n }),\n { files: 0, additions: 0, deletions: 0 }\n );\n}\n\nfunction buildPayload({\n repoRoot,\n branch,\n rawDiff,\n base,\n mode,\n requestedBase,\n comparison,\n fallbackReason\n}: PayloadOptions): DiffPayload {\n const files = parseUnifiedDiff(rawDiff);\n return {\n base,\n branch,\n cwd: repoRoot,\n scope: {\n mode,\n requestedBase,\n base,\n comparison,\n fallbackReason\n },\n stats: summarize(files),\n rawDiff,\n files,\n capturedAt: new Date().toISOString()\n };\n}\n\nasync function currentBranch(repoRoot: string): Promise<string | null> {\n const branch = await gitMaybe(['rev-parse', '--abbrev-ref', 'HEAD'], repoRoot);\n return branch && branch !== 'HEAD' ? branch : null;\n}\n\nasync function captureUntrackedDiff(repoRoot: string): Promise<string[]> {\n const untrackedFilesRaw = await git(\n ['ls-files', '--others', '--exclude-standard', '-z'],\n repoRoot\n );\n const untrackedFiles = untrackedFilesRaw.split('\\0').filter(Boolean);\n return Promise.all(\n untrackedFiles.map((filePath) =>\n gitLenient(['diff', '--no-color', '--no-index', '--', '/dev/null', filePath], repoRoot)\n )\n );\n}\n\nasync function captureWorkingDiff(baseRef: string, repoRoot: string): Promise<string> {\n const [trackedDiff, untrackedDiffs] = await Promise.all([\n git([...DIFF_ARGS, baseRef, '--'], repoRoot),\n captureUntrackedDiff(repoRoot)\n ]);\n return [trackedDiff, ...untrackedDiffs].filter(Boolean).join('\\n');\n}\n\nasync function resolveCommit(ref: string, repoRoot: string): Promise<string | null> {\n return gitMaybe(['rev-parse', '--verify', `${ref}^{commit}`], repoRoot);\n}\n\nasync function resolveBranchBase(repoRoot: string): Promise<ResolvedBranchBase | null> {\n const candidates: string[] = [];\n const upstream = await gitMaybe(\n ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'],\n repoRoot\n );\n const originHead = await gitMaybe(\n ['symbolic-ref', '--quiet', '--short', 'refs/remotes/origin/HEAD'],\n repoRoot\n );\n\n for (const ref of [upstream, originHead, 'origin/main', 'origin/master']) {\n if (ref && !candidates.includes(ref)) {\n candidates.push(ref);\n }\n }\n\n for (const sourceRef of candidates) {\n const [sourceSha, mergeBaseSha] = await Promise.all([\n resolveCommit(sourceRef, repoRoot),\n gitMaybe(['merge-base', 'HEAD', sourceRef], repoRoot)\n ]);\n if (sourceSha && mergeBaseSha) {\n return { sourceRef, mergeBaseSha };\n }\n }\n\n return null;\n}\n\nexport async function captureDiff(baseRef?: string, cwd = process.cwd()): Promise<DiffPayload> {\n const repoRoot = await getRepoRoot(cwd);\n const [headSha, branch] = await Promise.all([\n git(['rev-parse', 'HEAD'], repoRoot),\n currentBranch(repoRoot)\n ]);\n\n if (baseRef) {\n const [baseSha, rawDiff] = await Promise.all([\n git(['rev-parse', baseRef], repoRoot),\n captureWorkingDiff(baseRef, repoRoot)\n ]);\n return buildPayload({\n repoRoot,\n branch,\n rawDiff,\n base: { ref: baseRef, sha: baseSha },\n mode: 'explicit',\n requestedBase: baseRef,\n comparison: { ref: 'working tree', sha: null },\n fallbackReason: null\n });\n }\n\n const workingDiff = await captureWorkingDiff('HEAD', repoRoot);\n if (workingDiff.trim().length > 0) {\n return buildPayload({\n repoRoot,\n branch,\n rawDiff: workingDiff,\n base: { ref: 'HEAD', sha: headSha },\n mode: 'working',\n requestedBase: null,\n comparison: { ref: 'working tree', sha: null },\n fallbackReason: null\n });\n }\n\n const branchBase = await resolveBranchBase(repoRoot);\n if (!branchBase) {\n return buildPayload({\n repoRoot,\n branch,\n rawDiff: '',\n base: { ref: 'HEAD', sha: headSha },\n mode: 'working',\n requestedBase: null,\n comparison: { ref: 'working tree', sha: null },\n fallbackReason: 'missing-branch-base'\n });\n }\n\n const rawDiff = await git([...DIFF_ARGS, branchBase.mergeBaseSha, 'HEAD', '--'], repoRoot);\n return buildPayload({\n repoRoot,\n branch,\n rawDiff,\n base: { ref: `merge-base(${branchBase.sourceRef})`, sha: branchBase.mergeBaseSha },\n mode: 'branch',\n requestedBase: null,\n comparison: { ref: 'HEAD', sha: headSha },\n fallbackReason: 'working-tree-clean'\n });\n}\n\nexport async function assertGitAvailable(): Promise<void> {\n await execa('git', ['--version']);\n}\n","import path from 'node:path';\nimport type { DiffFile, DiffHunk, DiffLine } from '../shared/types';\n\nconst hunkHeaderPattern = /^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@(.*)$/;\n\nfunction stripGitPath(input: string): string {\n return input.replace(/^[ab]\\//, '');\n}\n\nfunction languageForPath(filePath: string): string | null {\n const ext = path.extname(filePath).slice(1).toLowerCase();\n if (!ext) {\n return null;\n }\n const map: Record<string, string> = {\n cjs: 'js',\n mjs: 'js',\n js: 'js',\n jsx: 'jsx',\n ts: 'ts',\n tsx: 'tsx',\n py: 'python',\n rb: 'ruby',\n sh: 'bash',\n md: 'markdown',\n yml: 'yaml',\n yaml: 'yaml'\n };\n return map[ext] ?? ext;\n}\n\nfunction emptyFile(): DiffFile {\n return {\n path: '',\n oldPath: null,\n additions: 0,\n deletions: 0,\n isBinary: false,\n isDeleted: false,\n isNew: false,\n isRenamed: false,\n language: null,\n hunks: []\n };\n}\n\nexport function parseUnifiedDiff(diffText: string): DiffFile[] {\n const files: DiffFile[] = [];\n let current: DiffFile | null = null;\n let currentHunk: DiffHunk | null = null;\n let oldCursor = 0;\n let newCursor = 0;\n\n const finalizeFile = () => {\n if (current?.path) {\n current.language = languageForPath(current.path);\n files.push(current);\n }\n };\n\n for (const line of diffText.split('\\n')) {\n if (line.startsWith('diff --git ')) {\n finalizeFile();\n current = emptyFile();\n currentHunk = null;\n oldCursor = 0;\n newCursor = 0;\n const match = /^diff --git a\\/(.+) b\\/(.+)$/.exec(line);\n if (match) {\n current.oldPath = match[1];\n current.path = match[2];\n }\n continue;\n }\n\n if (!current) {\n continue;\n }\n\n if (line.startsWith('new file mode')) {\n current.isNew = true;\n continue;\n }\n\n if (line.startsWith('deleted file mode')) {\n current.isDeleted = true;\n continue;\n }\n\n if (line.startsWith('rename from ')) {\n current.oldPath = line.slice('rename from '.length);\n current.isRenamed = true;\n continue;\n }\n\n if (line.startsWith('rename to ')) {\n current.path = line.slice('rename to '.length);\n current.isRenamed = true;\n continue;\n }\n\n if (line.startsWith('Binary files ') || line.startsWith('GIT binary patch')) {\n current.isBinary = true;\n continue;\n }\n\n if (line.startsWith('--- ')) {\n const oldPath = line.slice(4).trim();\n current.oldPath = oldPath === '/dev/null' ? null : stripGitPath(oldPath);\n continue;\n }\n\n if (line.startsWith('+++ ')) {\n const newPath = line.slice(4).trim();\n current.path =\n newPath === '/dev/null' ? (current.oldPath ?? current.path) : stripGitPath(newPath);\n continue;\n }\n\n const hunkMatch = hunkHeaderPattern.exec(line);\n if (hunkMatch) {\n const oldStart = Number(hunkMatch[1]);\n const oldLines = Number(hunkMatch[2] ?? '1');\n const newStart = Number(hunkMatch[3]);\n const newLines = Number(hunkMatch[4] ?? '1');\n currentHunk = {\n oldStart,\n oldLines,\n newStart,\n newLines,\n header: hunkMatch[5]?.trim() ?? '',\n lines: []\n };\n current.hunks.push(currentHunk);\n oldCursor = oldStart;\n newCursor = newStart;\n continue;\n }\n\n if (!currentHunk) {\n continue;\n }\n\n const marker = line[0];\n const content = line.slice(1);\n let diffLine: DiffLine | null = null;\n\n if (marker === '+') {\n diffLine = { type: 'add', oldLine: null, newLine: newCursor, content };\n current.additions += 1;\n newCursor += 1;\n } else if (marker === '-') {\n diffLine = { type: 'delete', oldLine: oldCursor, newLine: null, content };\n current.deletions += 1;\n oldCursor += 1;\n } else if (marker === ' ') {\n diffLine = { type: 'context', oldLine: oldCursor, newLine: newCursor, content };\n oldCursor += 1;\n newCursor += 1;\n } else if (line.startsWith('\\\')) {\n continue;\n }\n\n if (diffLine) {\n currentHunk.lines.push(diffLine);\n }\n }\n\n finalizeFile();\n return files;\n}\n"],"mappings":";;;AACA,SAAS,eAAe;AACxB,OAAO,iBAAiB;;;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