@runchr/gstack-antigravity 0.1.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.
Potentially problematic release.
This version of @runchr/gstack-antigravity might be problematic. Click here for more details.
- package/.agents/rules/ETHOS.md +129 -0
- package/.agents/rules/global-gstack.md +117 -0
- package/.agents/rules/persona-gstack-autoplan.md +14 -0
- package/.agents/rules/persona-gstack-benchmark.md +14 -0
- package/.agents/rules/persona-gstack-browse.md +14 -0
- package/.agents/rules/persona-gstack-canary.md +14 -0
- package/.agents/rules/persona-gstack-careful.md +14 -0
- package/.agents/rules/persona-gstack-codex.md +14 -0
- package/.agents/rules/persona-gstack-cso.md +14 -0
- package/.agents/rules/persona-gstack-design-consultation.md +14 -0
- package/.agents/rules/persona-gstack-design-review.md +14 -0
- package/.agents/rules/persona-gstack-document-release.md +14 -0
- package/.agents/rules/persona-gstack-freeze.md +14 -0
- package/.agents/rules/persona-gstack-gstack-upgrade.md +14 -0
- package/.agents/rules/persona-gstack-guard.md +14 -0
- package/.agents/rules/persona-gstack-investigate.md +14 -0
- package/.agents/rules/persona-gstack-land-and-deploy.md +14 -0
- package/.agents/rules/persona-gstack-office-hours.md +14 -0
- package/.agents/rules/persona-gstack-plan-ceo-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-design-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-eng-review.md +14 -0
- package/.agents/rules/persona-gstack-qa-only.md +14 -0
- package/.agents/rules/persona-gstack-qa.md +14 -0
- package/.agents/rules/persona-gstack-retro.md +14 -0
- package/.agents/rules/persona-gstack-review.md +14 -0
- package/.agents/rules/persona-gstack-setup-browser-cookies.md +14 -0
- package/.agents/rules/persona-gstack-setup-deploy.md +14 -0
- package/.agents/rules/persona-gstack-ship.md +14 -0
- package/.agents/rules/persona-gstack-unfreeze.md +14 -0
- package/.agents/rules/persona-gstack.md +40 -0
- package/.agents/rules/recursive-identities.md +22 -0
- package/.agents/workflows/autoplan.md +30 -0
- package/.agents/workflows/benchmark.md +31 -0
- package/.agents/workflows/browse.md +26 -0
- package/.agents/workflows/canary.md +33 -0
- package/.agents/workflows/careful.md +22 -0
- package/.agents/workflows/codex.md +36 -0
- package/.agents/workflows/cso.md +29 -0
- package/.agents/workflows/design-consultation.md +28 -0
- package/.agents/workflows/design-review.md +28 -0
- package/.agents/workflows/document-release.md +32 -0
- package/.agents/workflows/freeze.md +17 -0
- package/.agents/workflows/gstack-upgrade.md +54 -0
- package/.agents/workflows/gstack.md +56 -0
- package/.agents/workflows/guard.md +18 -0
- package/.agents/workflows/investigate.md +37 -0
- package/.agents/workflows/land-and-deploy.md +35 -0
- package/.agents/workflows/office-hours.md +27 -0
- package/.agents/workflows/plan-ceo-review.md +34 -0
- package/.agents/workflows/plan-design-review.md +31 -0
- package/.agents/workflows/plan-eng-review.md +28 -0
- package/.agents/workflows/qa-only.md +28 -0
- package/.agents/workflows/qa.md +73 -0
- package/.agents/workflows/retro.md +34 -0
- package/.agents/workflows/review.md +30 -0
- package/.agents/workflows/setup-browser-cookies.md +15 -0
- package/.agents/workflows/setup-cookies.md +8 -0
- package/.agents/workflows/setup-deploy.md +21 -0
- package/.agents/workflows/ship.md +93 -0
- package/.agents/workflows/unfreeze.md +12 -0
- package/LICENSE +22 -0
- package/README.md +189 -0
- package/README_KO.md +191 -0
- package/bin/install.js +105 -0
- package/gstack-origin/.agents/skills/gstack/SKILL.md +651 -0
- package/gstack-origin/.agents/skills/gstack-autoplan/SKILL.md +678 -0
- package/gstack-origin/.agents/skills/gstack-benchmark/SKILL.md +482 -0
- package/gstack-origin/.agents/skills/gstack-browse/SKILL.md +511 -0
- package/gstack-origin/.agents/skills/gstack-canary/SKILL.md +486 -0
- package/gstack-origin/.agents/skills/gstack-careful/SKILL.md +50 -0
- package/gstack-origin/.agents/skills/gstack-cso/SKILL.md +607 -0
- package/gstack-origin/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
- package/gstack-origin/.agents/skills/gstack-design-review/SKILL.md +988 -0
- package/gstack-origin/.agents/skills/gstack-document-release/SKILL.md +604 -0
- package/gstack-origin/.agents/skills/gstack-freeze/SKILL.md +67 -0
- package/gstack-origin/.agents/skills/gstack-guard/SKILL.md +62 -0
- package/gstack-origin/.agents/skills/gstack-investigate/SKILL.md +415 -0
- package/gstack-origin/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
- package/gstack-origin/.agents/skills/gstack-office-hours/SKILL.md +986 -0
- package/gstack-origin/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
- package/gstack-origin/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
- package/gstack-origin/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
- package/gstack-origin/.agents/skills/gstack-qa/SKILL.md +1006 -0
- package/gstack-origin/.agents/skills/gstack-qa-only/SKILL.md +626 -0
- package/gstack-origin/.agents/skills/gstack-retro/SKILL.md +1065 -0
- package/gstack-origin/.agents/skills/gstack-review/SKILL.md +704 -0
- package/gstack-origin/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
- package/gstack-origin/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
- package/gstack-origin/.agents/skills/gstack-ship/SKILL.md +1312 -0
- package/gstack-origin/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
- package/gstack-origin/.agents/skills/gstack-upgrade/SKILL.md +220 -0
- package/gstack-origin/.env.example +5 -0
- package/gstack-origin/.github/workflows/skill-docs.yml +17 -0
- package/gstack-origin/AGENTS.md +49 -0
- package/gstack-origin/ARCHITECTURE.md +359 -0
- package/gstack-origin/BROWSER.md +271 -0
- package/gstack-origin/CHANGELOG.md +800 -0
- package/gstack-origin/CLAUDE.md +284 -0
- package/gstack-origin/CONTRIBUTING.md +370 -0
- package/gstack-origin/ETHOS.md +129 -0
- package/gstack-origin/LICENSE +21 -0
- package/gstack-origin/README.md +228 -0
- package/gstack-origin/SKILL.md +657 -0
- package/gstack-origin/SKILL.md.tmpl +281 -0
- package/gstack-origin/TODOS.md +564 -0
- package/gstack-origin/VERSION +1 -0
- package/gstack-origin/autoplan/SKILL.md +689 -0
- package/gstack-origin/autoplan/SKILL.md.tmpl +416 -0
- package/gstack-origin/benchmark/SKILL.md +489 -0
- package/gstack-origin/benchmark/SKILL.md.tmpl +233 -0
- package/gstack-origin/bin/dev-setup +68 -0
- package/gstack-origin/bin/dev-teardown +56 -0
- package/gstack-origin/bin/gstack-analytics +191 -0
- package/gstack-origin/bin/gstack-community-dashboard +113 -0
- package/gstack-origin/bin/gstack-config +38 -0
- package/gstack-origin/bin/gstack-diff-scope +71 -0
- package/gstack-origin/bin/gstack-global-discover.ts +591 -0
- package/gstack-origin/bin/gstack-repo-mode +93 -0
- package/gstack-origin/bin/gstack-review-log +9 -0
- package/gstack-origin/bin/gstack-review-read +12 -0
- package/gstack-origin/bin/gstack-slug +15 -0
- package/gstack-origin/bin/gstack-telemetry-log +158 -0
- package/gstack-origin/bin/gstack-telemetry-sync +127 -0
- package/gstack-origin/bin/gstack-update-check +196 -0
- package/gstack-origin/browse/SKILL.md +517 -0
- package/gstack-origin/browse/SKILL.md.tmpl +141 -0
- package/gstack-origin/browse/bin/find-browse +21 -0
- package/gstack-origin/browse/bin/remote-slug +14 -0
- package/gstack-origin/browse/scripts/build-node-server.sh +48 -0
- package/gstack-origin/browse/src/browser-manager.ts +634 -0
- package/gstack-origin/browse/src/buffers.ts +137 -0
- package/gstack-origin/browse/src/bun-polyfill.cjs +109 -0
- package/gstack-origin/browse/src/cli.ts +420 -0
- package/gstack-origin/browse/src/commands.ts +111 -0
- package/gstack-origin/browse/src/config.ts +150 -0
- package/gstack-origin/browse/src/cookie-import-browser.ts +417 -0
- package/gstack-origin/browse/src/cookie-picker-routes.ts +207 -0
- package/gstack-origin/browse/src/cookie-picker-ui.ts +541 -0
- package/gstack-origin/browse/src/find-browse.ts +61 -0
- package/gstack-origin/browse/src/meta-commands.ts +269 -0
- package/gstack-origin/browse/src/platform.ts +17 -0
- package/gstack-origin/browse/src/read-commands.ts +335 -0
- package/gstack-origin/browse/src/server.ts +369 -0
- package/gstack-origin/browse/src/snapshot.ts +398 -0
- package/gstack-origin/browse/src/url-validation.ts +91 -0
- package/gstack-origin/browse/src/write-commands.ts +352 -0
- package/gstack-origin/browse/test/bun-polyfill.test.ts +72 -0
- package/gstack-origin/browse/test/commands.test.ts +1836 -0
- package/gstack-origin/browse/test/config.test.ts +250 -0
- package/gstack-origin/browse/test/cookie-import-browser.test.ts +397 -0
- package/gstack-origin/browse/test/cookie-picker-routes.test.ts +205 -0
- package/gstack-origin/browse/test/find-browse.test.ts +50 -0
- package/gstack-origin/browse/test/fixtures/basic.html +33 -0
- package/gstack-origin/browse/test/fixtures/cursor-interactive.html +22 -0
- package/gstack-origin/browse/test/fixtures/dialog.html +15 -0
- package/gstack-origin/browse/test/fixtures/empty.html +2 -0
- package/gstack-origin/browse/test/fixtures/forms.html +55 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-checkout.html +108 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-spa.html +98 -0
- package/gstack-origin/browse/test/fixtures/qa-eval.html +51 -0
- package/gstack-origin/browse/test/fixtures/responsive.html +49 -0
- package/gstack-origin/browse/test/fixtures/snapshot.html +55 -0
- package/gstack-origin/browse/test/fixtures/spa.html +24 -0
- package/gstack-origin/browse/test/fixtures/states.html +17 -0
- package/gstack-origin/browse/test/fixtures/upload.html +25 -0
- package/gstack-origin/browse/test/gstack-config.test.ts +125 -0
- package/gstack-origin/browse/test/gstack-update-check.test.ts +467 -0
- package/gstack-origin/browse/test/handoff.test.ts +235 -0
- package/gstack-origin/browse/test/path-validation.test.ts +63 -0
- package/gstack-origin/browse/test/platform.test.ts +37 -0
- package/gstack-origin/browse/test/snapshot.test.ts +467 -0
- package/gstack-origin/browse/test/test-server.ts +57 -0
- package/gstack-origin/browse/test/url-validation.test.ts +72 -0
- package/gstack-origin/canary/SKILL.md +493 -0
- package/gstack-origin/canary/SKILL.md.tmpl +220 -0
- package/gstack-origin/careful/SKILL.md +59 -0
- package/gstack-origin/careful/SKILL.md.tmpl +57 -0
- package/gstack-origin/careful/bin/check-careful.sh +112 -0
- package/gstack-origin/codex/SKILL.md +677 -0
- package/gstack-origin/codex/SKILL.md.tmpl +356 -0
- package/gstack-origin/conductor.json +6 -0
- package/gstack-origin/cso/SKILL.md +615 -0
- package/gstack-origin/cso/SKILL.md.tmpl +376 -0
- package/gstack-origin/design-consultation/SKILL.md +625 -0
- package/gstack-origin/design-consultation/SKILL.md.tmpl +369 -0
- package/gstack-origin/design-review/SKILL.md +998 -0
- package/gstack-origin/design-review/SKILL.md.tmpl +262 -0
- package/gstack-origin/docs/images/github-2013.png +0 -0
- package/gstack-origin/docs/images/github-2026.png +0 -0
- package/gstack-origin/docs/skills.md +877 -0
- package/gstack-origin/document-release/SKILL.md +613 -0
- package/gstack-origin/document-release/SKILL.md.tmpl +357 -0
- package/gstack-origin/freeze/SKILL.md +82 -0
- package/gstack-origin/freeze/SKILL.md.tmpl +80 -0
- package/gstack-origin/freeze/bin/check-freeze.sh +68 -0
- package/gstack-origin/gstack-upgrade/SKILL.md +226 -0
- package/gstack-origin/gstack-upgrade/SKILL.md.tmpl +224 -0
- package/gstack-origin/guard/SKILL.md +82 -0
- package/gstack-origin/guard/SKILL.md.tmpl +80 -0
- package/gstack-origin/investigate/SKILL.md +435 -0
- package/gstack-origin/investigate/SKILL.md.tmpl +196 -0
- package/gstack-origin/land-and-deploy/SKILL.md +880 -0
- package/gstack-origin/land-and-deploy/SKILL.md.tmpl +575 -0
- package/gstack-origin/office-hours/SKILL.md +996 -0
- package/gstack-origin/office-hours/SKILL.md.tmpl +624 -0
- package/gstack-origin/package.json +55 -0
- package/gstack-origin/plan-ceo-review/SKILL.md +1277 -0
- package/gstack-origin/plan-ceo-review/SKILL.md.tmpl +838 -0
- package/gstack-origin/plan-design-review/SKILL.md +676 -0
- package/gstack-origin/plan-design-review/SKILL.md.tmpl +314 -0
- package/gstack-origin/plan-eng-review/SKILL.md +836 -0
- package/gstack-origin/plan-eng-review/SKILL.md.tmpl +279 -0
- package/gstack-origin/qa/SKILL.md +1016 -0
- package/gstack-origin/qa/SKILL.md.tmpl +316 -0
- package/gstack-origin/qa/references/issue-taxonomy.md +85 -0
- package/gstack-origin/qa/templates/qa-report-template.md +126 -0
- package/gstack-origin/qa-only/SKILL.md +633 -0
- package/gstack-origin/qa-only/SKILL.md.tmpl +101 -0
- package/gstack-origin/retro/SKILL.md +1072 -0
- package/gstack-origin/retro/SKILL.md.tmpl +833 -0
- package/gstack-origin/review/SKILL.md +849 -0
- package/gstack-origin/review/SKILL.md.tmpl +259 -0
- package/gstack-origin/review/TODOS-format.md +62 -0
- package/gstack-origin/review/checklist.md +190 -0
- package/gstack-origin/review/design-checklist.md +132 -0
- package/gstack-origin/review/greptile-triage.md +220 -0
- package/gstack-origin/scripts/analytics.ts +190 -0
- package/gstack-origin/scripts/dev-skill.ts +82 -0
- package/gstack-origin/scripts/eval-compare.ts +96 -0
- package/gstack-origin/scripts/eval-list.ts +116 -0
- package/gstack-origin/scripts/eval-select.ts +86 -0
- package/gstack-origin/scripts/eval-summary.ts +187 -0
- package/gstack-origin/scripts/eval-watch.ts +172 -0
- package/gstack-origin/scripts/gen-skill-docs.ts +2414 -0
- package/gstack-origin/scripts/skill-check.ts +167 -0
- package/gstack-origin/setup +269 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md +330 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md.tmpl +74 -0
- package/gstack-origin/setup-deploy/SKILL.md +459 -0
- package/gstack-origin/setup-deploy/SKILL.md.tmpl +220 -0
- package/gstack-origin/ship/SKILL.md +1457 -0
- package/gstack-origin/ship/SKILL.md.tmpl +528 -0
- package/gstack-origin/supabase/config.sh +10 -0
- package/gstack-origin/supabase/functions/community-pulse/index.ts +59 -0
- package/gstack-origin/supabase/functions/telemetry-ingest/index.ts +135 -0
- package/gstack-origin/supabase/functions/update-check/index.ts +37 -0
- package/gstack-origin/supabase/migrations/001_telemetry.sql +89 -0
- package/gstack-origin/test/analytics.test.ts +277 -0
- package/gstack-origin/test/codex-e2e.test.ts +197 -0
- package/gstack-origin/test/fixtures/coverage-audit-fixture.ts +76 -0
- package/gstack-origin/test/fixtures/eval-baselines.json +7 -0
- package/gstack-origin/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.css +86 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.html +41 -0
- package/gstack-origin/test/fixtures/review-eval-enum-diff.rb +30 -0
- package/gstack-origin/test/fixtures/review-eval-enum.rb +27 -0
- package/gstack-origin/test/fixtures/review-eval-vuln.rb +14 -0
- package/gstack-origin/test/gemini-e2e.test.ts +173 -0
- package/gstack-origin/test/gen-skill-docs.test.ts +1049 -0
- package/gstack-origin/test/global-discover.test.ts +187 -0
- package/gstack-origin/test/helpers/codex-session-runner.ts +282 -0
- package/gstack-origin/test/helpers/e2e-helpers.ts +239 -0
- package/gstack-origin/test/helpers/eval-store.test.ts +548 -0
- package/gstack-origin/test/helpers/eval-store.ts +689 -0
- package/gstack-origin/test/helpers/gemini-session-runner.test.ts +104 -0
- package/gstack-origin/test/helpers/gemini-session-runner.ts +201 -0
- package/gstack-origin/test/helpers/llm-judge.ts +130 -0
- package/gstack-origin/test/helpers/observability.test.ts +283 -0
- package/gstack-origin/test/helpers/session-runner.test.ts +96 -0
- package/gstack-origin/test/helpers/session-runner.ts +357 -0
- package/gstack-origin/test/helpers/skill-parser.ts +206 -0
- package/gstack-origin/test/helpers/touchfiles.ts +260 -0
- package/gstack-origin/test/hook-scripts.test.ts +373 -0
- package/gstack-origin/test/skill-e2e-browse.test.ts +293 -0
- package/gstack-origin/test/skill-e2e-deploy.test.ts +279 -0
- package/gstack-origin/test/skill-e2e-design.test.ts +614 -0
- package/gstack-origin/test/skill-e2e-plan.test.ts +538 -0
- package/gstack-origin/test/skill-e2e-qa-bugs.test.ts +194 -0
- package/gstack-origin/test/skill-e2e-qa-workflow.test.ts +412 -0
- package/gstack-origin/test/skill-e2e-review.test.ts +535 -0
- package/gstack-origin/test/skill-e2e-workflow.test.ts +586 -0
- package/gstack-origin/test/skill-e2e.test.ts +3325 -0
- package/gstack-origin/test/skill-llm-eval.test.ts +787 -0
- package/gstack-origin/test/skill-parser.test.ts +179 -0
- package/gstack-origin/test/skill-routing-e2e.test.ts +605 -0
- package/gstack-origin/test/skill-validation.test.ts +1520 -0
- package/gstack-origin/test/telemetry.test.ts +278 -0
- package/gstack-origin/test/touchfiles.test.ts +262 -0
- package/gstack-origin/unfreeze/SKILL.md +40 -0
- package/gstack-origin/unfreeze/SKILL.md.tmpl +38 -0
- package/package.json +38 -0
- package/scripts/install-antigravity-skill.ps1 +33 -0
- package/scripts/install-antigravity-skill.sh +41 -0
- package/scripts/sync-gstack-origin.ps1 +37 -0
- package/scripts/sync-gstack-origin.sh +35 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie picker UI — self-contained HTML page
|
|
3
|
+
*
|
|
4
|
+
* Dark theme, two-panel layout, vanilla HTML/CSS/JS.
|
|
5
|
+
* Left: source browser domains with search + import buttons.
|
|
6
|
+
* Right: imported domains with trash buttons.
|
|
7
|
+
* No cookie values exposed anywhere.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export function getCookiePickerHTML(serverPort: number): string {
|
|
11
|
+
const baseUrl = `http://127.0.0.1:${serverPort}`;
|
|
12
|
+
|
|
13
|
+
return `<!DOCTYPE html>
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<head>
|
|
16
|
+
<meta charset="utf-8">
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
18
|
+
<title>Cookie Import — gstack browse</title>
|
|
19
|
+
<style>
|
|
20
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
21
|
+
body {
|
|
22
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
|
|
23
|
+
background: #0a0a0a;
|
|
24
|
+
color: #e0e0e0;
|
|
25
|
+
height: 100vh;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* ─── Header ──────────────────────────── */
|
|
30
|
+
.header {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: 16px 24px;
|
|
35
|
+
border-bottom: 1px solid #222;
|
|
36
|
+
background: #0f0f0f;
|
|
37
|
+
}
|
|
38
|
+
.header h1 {
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
color: #fff;
|
|
42
|
+
}
|
|
43
|
+
.header .port {
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
color: #666;
|
|
46
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ─── Layout ──────────────────────────── */
|
|
50
|
+
.container {
|
|
51
|
+
display: flex;
|
|
52
|
+
height: calc(100vh - 53px);
|
|
53
|
+
}
|
|
54
|
+
.panel {
|
|
55
|
+
flex: 1;
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
.panel-left {
|
|
61
|
+
border-right: 1px solid #222;
|
|
62
|
+
}
|
|
63
|
+
.panel-header {
|
|
64
|
+
padding: 16px 20px 12px;
|
|
65
|
+
font-size: 11px;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
letter-spacing: 0.5px;
|
|
69
|
+
color: #888;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ─── Browser Pills ───────────────────── */
|
|
73
|
+
.browser-pills {
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: 8px;
|
|
76
|
+
padding: 0 20px 12px;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
}
|
|
79
|
+
.pill {
|
|
80
|
+
padding: 6px 14px;
|
|
81
|
+
border-radius: 20px;
|
|
82
|
+
border: 1px solid #333;
|
|
83
|
+
background: #1a1a1a;
|
|
84
|
+
color: #aaa;
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
transition: all 0.15s;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 6px;
|
|
91
|
+
}
|
|
92
|
+
.pill:hover { border-color: #555; color: #ddd; }
|
|
93
|
+
.pill.active {
|
|
94
|
+
border-color: #4ade80;
|
|
95
|
+
background: #0a2a14;
|
|
96
|
+
color: #4ade80;
|
|
97
|
+
}
|
|
98
|
+
.pill .dot {
|
|
99
|
+
width: 6px; height: 6px;
|
|
100
|
+
border-radius: 50%;
|
|
101
|
+
background: #4ade80;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* ─── Search ──────────────────────────── */
|
|
105
|
+
.search-wrap {
|
|
106
|
+
padding: 0 20px 12px;
|
|
107
|
+
}
|
|
108
|
+
.search-input {
|
|
109
|
+
width: 100%;
|
|
110
|
+
padding: 8px 12px;
|
|
111
|
+
border-radius: 8px;
|
|
112
|
+
border: 1px solid #333;
|
|
113
|
+
background: #141414;
|
|
114
|
+
color: #e0e0e0;
|
|
115
|
+
font-size: 13px;
|
|
116
|
+
outline: none;
|
|
117
|
+
transition: border-color 0.15s;
|
|
118
|
+
}
|
|
119
|
+
.search-input::placeholder { color: #555; }
|
|
120
|
+
.search-input:focus { border-color: #555; }
|
|
121
|
+
|
|
122
|
+
/* ─── Domain List ─────────────────────── */
|
|
123
|
+
.domain-list {
|
|
124
|
+
flex: 1;
|
|
125
|
+
overflow-y: auto;
|
|
126
|
+
padding: 0 12px;
|
|
127
|
+
}
|
|
128
|
+
.domain-list::-webkit-scrollbar { width: 6px; }
|
|
129
|
+
.domain-list::-webkit-scrollbar-track { background: transparent; }
|
|
130
|
+
.domain-list::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
|
|
131
|
+
|
|
132
|
+
.domain-row {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
padding: 8px 10px;
|
|
136
|
+
border-radius: 6px;
|
|
137
|
+
transition: background 0.1s;
|
|
138
|
+
gap: 8px;
|
|
139
|
+
}
|
|
140
|
+
.domain-row:hover { background: #1a1a1a; }
|
|
141
|
+
.domain-name {
|
|
142
|
+
flex: 1;
|
|
143
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
144
|
+
font-size: 13px;
|
|
145
|
+
color: #ccc;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
text-overflow: ellipsis;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
}
|
|
150
|
+
.domain-count {
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
color: #666;
|
|
153
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
154
|
+
min-width: 28px;
|
|
155
|
+
text-align: right;
|
|
156
|
+
}
|
|
157
|
+
.btn-add, .btn-trash {
|
|
158
|
+
width: 28px; height: 28px;
|
|
159
|
+
border-radius: 6px;
|
|
160
|
+
border: 1px solid #333;
|
|
161
|
+
background: #1a1a1a;
|
|
162
|
+
color: #888;
|
|
163
|
+
font-size: 16px;
|
|
164
|
+
cursor: pointer;
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
transition: all 0.15s;
|
|
169
|
+
flex-shrink: 0;
|
|
170
|
+
}
|
|
171
|
+
.btn-add:hover { border-color: #4ade80; color: #4ade80; background: #0a2a14; }
|
|
172
|
+
.btn-trash:hover { border-color: #f87171; color: #f87171; background: #2a0a0a; }
|
|
173
|
+
.btn-add:disabled, .btn-trash:disabled {
|
|
174
|
+
opacity: 0.3;
|
|
175
|
+
cursor: not-allowed;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
.btn-add.imported {
|
|
179
|
+
border-color: #333;
|
|
180
|
+
color: #4ade80;
|
|
181
|
+
background: transparent;
|
|
182
|
+
cursor: default;
|
|
183
|
+
font-size: 14px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* ─── Footer ──────────────────────────── */
|
|
187
|
+
.panel-footer {
|
|
188
|
+
padding: 12px 20px;
|
|
189
|
+
border-top: 1px solid #222;
|
|
190
|
+
font-size: 12px;
|
|
191
|
+
color: #666;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ─── Imported Panel ──────────────────── */
|
|
195
|
+
.imported-empty {
|
|
196
|
+
flex: 1;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: center;
|
|
200
|
+
color: #444;
|
|
201
|
+
font-size: 13px;
|
|
202
|
+
padding: 20px;
|
|
203
|
+
text-align: center;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* ─── Banner ──────────────────────────── */
|
|
207
|
+
.banner {
|
|
208
|
+
padding: 10px 20px;
|
|
209
|
+
font-size: 13px;
|
|
210
|
+
display: none;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 10px;
|
|
213
|
+
}
|
|
214
|
+
.banner.error {
|
|
215
|
+
background: #1a0a0a;
|
|
216
|
+
border-bottom: 1px solid #3a1111;
|
|
217
|
+
color: #f87171;
|
|
218
|
+
}
|
|
219
|
+
.banner.info {
|
|
220
|
+
background: #0a1a2a;
|
|
221
|
+
border-bottom: 1px solid #112233;
|
|
222
|
+
color: #60a5fa;
|
|
223
|
+
}
|
|
224
|
+
.banner .banner-text { flex: 1; }
|
|
225
|
+
.banner .banner-close, .banner .banner-retry {
|
|
226
|
+
background: none;
|
|
227
|
+
border: 1px solid currentColor;
|
|
228
|
+
color: inherit;
|
|
229
|
+
padding: 3px 10px;
|
|
230
|
+
border-radius: 4px;
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
font-size: 12px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* ─── Spinner ─────────────────────────── */
|
|
236
|
+
.spinner {
|
|
237
|
+
display: inline-block;
|
|
238
|
+
width: 14px; height: 14px;
|
|
239
|
+
border: 2px solid #333;
|
|
240
|
+
border-top-color: #4ade80;
|
|
241
|
+
border-radius: 50%;
|
|
242
|
+
animation: spin 0.6s linear infinite;
|
|
243
|
+
}
|
|
244
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
245
|
+
|
|
246
|
+
.loading-row {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
padding: 40px;
|
|
251
|
+
gap: 10px;
|
|
252
|
+
color: #666;
|
|
253
|
+
font-size: 13px;
|
|
254
|
+
}
|
|
255
|
+
</style>
|
|
256
|
+
</head>
|
|
257
|
+
<body>
|
|
258
|
+
|
|
259
|
+
<div class="header">
|
|
260
|
+
<h1>Cookie Import</h1>
|
|
261
|
+
<span class="port">localhost:${serverPort}</span>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div id="banner" class="banner"></div>
|
|
265
|
+
|
|
266
|
+
<div class="container">
|
|
267
|
+
<!-- Left Panel: Source Browser -->
|
|
268
|
+
<div class="panel panel-left">
|
|
269
|
+
<div class="panel-header">Source Browser</div>
|
|
270
|
+
<div id="browser-pills" class="browser-pills"></div>
|
|
271
|
+
<div class="search-wrap">
|
|
272
|
+
<input type="text" class="search-input" id="search" placeholder="Search domains..." />
|
|
273
|
+
</div>
|
|
274
|
+
<div class="domain-list" id="source-domains">
|
|
275
|
+
<div class="loading-row"><span class="spinner"></span> Detecting browsers...</div>
|
|
276
|
+
</div>
|
|
277
|
+
<div class="panel-footer" id="source-footer"></div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<!-- Right Panel: Imported -->
|
|
281
|
+
<div class="panel panel-right">
|
|
282
|
+
<div class="panel-header">Imported to Session</div>
|
|
283
|
+
<div class="domain-list" id="imported-domains">
|
|
284
|
+
<div class="imported-empty">No cookies imported yet</div>
|
|
285
|
+
</div>
|
|
286
|
+
<div class="panel-footer" id="imported-footer"></div>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<script>
|
|
291
|
+
(function() {
|
|
292
|
+
const BASE = '${baseUrl}';
|
|
293
|
+
let activeBrowser = null;
|
|
294
|
+
let allDomains = [];
|
|
295
|
+
let importedSet = {}; // domain → count
|
|
296
|
+
let inflight = {}; // domain → true (prevents double-click)
|
|
297
|
+
|
|
298
|
+
const $pills = document.getElementById('browser-pills');
|
|
299
|
+
const $search = document.getElementById('search');
|
|
300
|
+
const $sourceDomains = document.getElementById('source-domains');
|
|
301
|
+
const $importedDomains = document.getElementById('imported-domains');
|
|
302
|
+
const $sourceFooter = document.getElementById('source-footer');
|
|
303
|
+
const $importedFooter = document.getElementById('imported-footer');
|
|
304
|
+
const $banner = document.getElementById('banner');
|
|
305
|
+
|
|
306
|
+
// ─── Banner ────────────────────────────
|
|
307
|
+
function showBanner(msg, type, retryFn) {
|
|
308
|
+
$banner.className = 'banner ' + type;
|
|
309
|
+
$banner.style.display = 'flex';
|
|
310
|
+
let html = '<span class="banner-text">' + escHtml(msg) + '</span>';
|
|
311
|
+
if (retryFn) {
|
|
312
|
+
html += '<button class="banner-retry" id="banner-retry">Retry</button>';
|
|
313
|
+
}
|
|
314
|
+
html += '<button class="banner-close" id="banner-close">×</button>';
|
|
315
|
+
$banner.innerHTML = html;
|
|
316
|
+
document.getElementById('banner-close').onclick = () => { $banner.style.display = 'none'; };
|
|
317
|
+
if (retryFn) {
|
|
318
|
+
document.getElementById('banner-retry').onclick = () => {
|
|
319
|
+
$banner.style.display = 'none';
|
|
320
|
+
retryFn();
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function escHtml(s) {
|
|
326
|
+
return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// ─── API ────────────────────────────────
|
|
330
|
+
async function api(path, opts) {
|
|
331
|
+
const res = await fetch(BASE + '/cookie-picker' + path, opts);
|
|
332
|
+
const data = await res.json();
|
|
333
|
+
if (!res.ok) {
|
|
334
|
+
const err = new Error(data.error || 'Request failed');
|
|
335
|
+
err.code = data.code;
|
|
336
|
+
err.action = data.action;
|
|
337
|
+
throw err;
|
|
338
|
+
}
|
|
339
|
+
return data;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// ─── Init ───────────────────────────────
|
|
343
|
+
async function init() {
|
|
344
|
+
try {
|
|
345
|
+
const [browserData, importedData] = await Promise.all([
|
|
346
|
+
api('/browsers'),
|
|
347
|
+
api('/imported'),
|
|
348
|
+
]);
|
|
349
|
+
|
|
350
|
+
// Populate imported state
|
|
351
|
+
for (const entry of importedData.domains) {
|
|
352
|
+
importedSet[entry.domain] = entry.count;
|
|
353
|
+
}
|
|
354
|
+
renderImported();
|
|
355
|
+
|
|
356
|
+
// Render browser pills
|
|
357
|
+
const browsers = browserData.browsers;
|
|
358
|
+
if (browsers.length === 0) {
|
|
359
|
+
$sourceDomains.innerHTML = '<div class="imported-empty">No Chromium browsers detected</div>';
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
$pills.innerHTML = '';
|
|
364
|
+
browsers.forEach(b => {
|
|
365
|
+
const pill = document.createElement('button');
|
|
366
|
+
pill.className = 'pill';
|
|
367
|
+
pill.innerHTML = '<span class="dot"></span>' + escHtml(b.name);
|
|
368
|
+
pill.onclick = () => selectBrowser(b.name);
|
|
369
|
+
$pills.appendChild(pill);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// Auto-select first browser
|
|
373
|
+
selectBrowser(browsers[0].name);
|
|
374
|
+
} catch (err) {
|
|
375
|
+
showBanner(err.message, 'error', init);
|
|
376
|
+
$sourceDomains.innerHTML = '<div class="imported-empty">Failed to load</div>';
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// ─── Select Browser ────────────────────
|
|
381
|
+
async function selectBrowser(name) {
|
|
382
|
+
activeBrowser = name;
|
|
383
|
+
|
|
384
|
+
// Update pills
|
|
385
|
+
$pills.querySelectorAll('.pill').forEach(p => {
|
|
386
|
+
p.classList.toggle('active', p.textContent === name);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
$sourceDomains.innerHTML = '<div class="loading-row"><span class="spinner"></span> Loading domains...</div>';
|
|
390
|
+
$sourceFooter.textContent = '';
|
|
391
|
+
$search.value = '';
|
|
392
|
+
|
|
393
|
+
try {
|
|
394
|
+
const data = await api('/domains?browser=' + encodeURIComponent(name));
|
|
395
|
+
allDomains = data.domains;
|
|
396
|
+
renderSourceDomains();
|
|
397
|
+
} catch (err) {
|
|
398
|
+
showBanner(err.message, 'error', err.action === 'retry' ? () => selectBrowser(name) : null);
|
|
399
|
+
$sourceDomains.innerHTML = '<div class="imported-empty">Failed to load domains</div>';
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// ─── Render Source Domains ─────────────
|
|
404
|
+
function renderSourceDomains() {
|
|
405
|
+
const query = $search.value.toLowerCase();
|
|
406
|
+
const filtered = query
|
|
407
|
+
? allDomains.filter(d => d.domain.toLowerCase().includes(query))
|
|
408
|
+
: allDomains;
|
|
409
|
+
|
|
410
|
+
if (filtered.length === 0) {
|
|
411
|
+
$sourceDomains.innerHTML = '<div class="imported-empty">' +
|
|
412
|
+
(query ? 'No matching domains' : 'No cookie domains found') + '</div>';
|
|
413
|
+
$sourceFooter.textContent = '';
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
let html = '';
|
|
418
|
+
for (const d of filtered) {
|
|
419
|
+
const isImported = d.domain in importedSet;
|
|
420
|
+
const isInflight = inflight[d.domain];
|
|
421
|
+
html += '<div class="domain-row">';
|
|
422
|
+
html += '<span class="domain-name">' + escHtml(d.domain) + '</span>';
|
|
423
|
+
html += '<span class="domain-count">' + d.count + '</span>';
|
|
424
|
+
if (isInflight) {
|
|
425
|
+
html += '<span class="btn-add" disabled><span class="spinner" style="width:12px;height:12px;border-width:1.5px;"></span></span>';
|
|
426
|
+
} else if (isImported) {
|
|
427
|
+
html += '<span class="btn-add imported">✓</span>';
|
|
428
|
+
} else {
|
|
429
|
+
html += '<button class="btn-add" data-domain="' + escHtml(d.domain) + '" title="Import">+</button>';
|
|
430
|
+
}
|
|
431
|
+
html += '</div>';
|
|
432
|
+
}
|
|
433
|
+
$sourceDomains.innerHTML = html;
|
|
434
|
+
|
|
435
|
+
// Total counts
|
|
436
|
+
const totalDomains = allDomains.length;
|
|
437
|
+
const totalCookies = allDomains.reduce((s, d) => s + d.count, 0);
|
|
438
|
+
$sourceFooter.textContent = totalDomains + ' domains · ' + totalCookies.toLocaleString() + ' cookies';
|
|
439
|
+
|
|
440
|
+
// Click handlers
|
|
441
|
+
$sourceDomains.querySelectorAll('.btn-add[data-domain]').forEach(btn => {
|
|
442
|
+
btn.addEventListener('click', () => importDomain(btn.dataset.domain));
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// ─── Import Domain ─────────────────────
|
|
447
|
+
async function importDomain(domain) {
|
|
448
|
+
if (inflight[domain] || domain in importedSet) return;
|
|
449
|
+
inflight[domain] = true;
|
|
450
|
+
renderSourceDomains();
|
|
451
|
+
|
|
452
|
+
try {
|
|
453
|
+
const data = await api('/import', {
|
|
454
|
+
method: 'POST',
|
|
455
|
+
headers: { 'Content-Type': 'application/json' },
|
|
456
|
+
body: JSON.stringify({ browser: activeBrowser, domains: [domain] }),
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
if (data.domainCounts) {
|
|
460
|
+
for (const [d, count] of Object.entries(data.domainCounts)) {
|
|
461
|
+
importedSet[d] = (importedSet[d] || 0) + count;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
renderImported();
|
|
465
|
+
} catch (err) {
|
|
466
|
+
showBanner('Import failed for ' + domain + ': ' + err.message, 'error',
|
|
467
|
+
err.action === 'retry' ? () => importDomain(domain) : null);
|
|
468
|
+
} finally {
|
|
469
|
+
delete inflight[domain];
|
|
470
|
+
renderSourceDomains();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// ─── Render Imported ───────────────────
|
|
475
|
+
function renderImported() {
|
|
476
|
+
const entries = Object.entries(importedSet).sort((a, b) => b[1] - a[1]);
|
|
477
|
+
|
|
478
|
+
if (entries.length === 0) {
|
|
479
|
+
$importedDomains.innerHTML = '<div class="imported-empty">No cookies imported yet</div>';
|
|
480
|
+
$importedFooter.textContent = '';
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
let html = '';
|
|
485
|
+
for (const [domain, count] of entries) {
|
|
486
|
+
const isInflight = inflight['remove:' + domain];
|
|
487
|
+
html += '<div class="domain-row">';
|
|
488
|
+
html += '<span class="domain-name">' + escHtml(domain) + '</span>';
|
|
489
|
+
html += '<span class="domain-count">' + count + '</span>';
|
|
490
|
+
if (isInflight) {
|
|
491
|
+
html += '<span class="btn-trash" disabled><span class="spinner" style="width:12px;height:12px;border-width:1.5px;border-top-color:#f87171;"></span></span>';
|
|
492
|
+
} else {
|
|
493
|
+
html += '<button class="btn-trash" data-domain="' + escHtml(domain) + '" title="Remove">🗑</button>';
|
|
494
|
+
}
|
|
495
|
+
html += '</div>';
|
|
496
|
+
}
|
|
497
|
+
$importedDomains.innerHTML = html;
|
|
498
|
+
|
|
499
|
+
const totalCookies = entries.reduce((s, e) => s + e[1], 0);
|
|
500
|
+
$importedFooter.textContent = entries.length + ' domains · ' + totalCookies.toLocaleString() + ' cookies imported';
|
|
501
|
+
|
|
502
|
+
// Click handlers
|
|
503
|
+
$importedDomains.querySelectorAll('.btn-trash[data-domain]').forEach(btn => {
|
|
504
|
+
btn.addEventListener('click', () => removeDomain(btn.dataset.domain));
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// ─── Remove Domain ─────────────────────
|
|
509
|
+
async function removeDomain(domain) {
|
|
510
|
+
if (inflight['remove:' + domain]) return;
|
|
511
|
+
inflight['remove:' + domain] = true;
|
|
512
|
+
renderImported();
|
|
513
|
+
|
|
514
|
+
try {
|
|
515
|
+
await api('/remove', {
|
|
516
|
+
method: 'POST',
|
|
517
|
+
headers: { 'Content-Type': 'application/json' },
|
|
518
|
+
body: JSON.stringify({ domains: [domain] }),
|
|
519
|
+
});
|
|
520
|
+
delete importedSet[domain];
|
|
521
|
+
renderImported();
|
|
522
|
+
renderSourceDomains(); // update checkmarks
|
|
523
|
+
} catch (err) {
|
|
524
|
+
showBanner('Remove failed for ' + domain + ': ' + err.message, 'error',
|
|
525
|
+
err.action === 'retry' ? () => removeDomain(domain) : null);
|
|
526
|
+
} finally {
|
|
527
|
+
delete inflight['remove:' + domain];
|
|
528
|
+
renderImported();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// ─── Search ────────────────────────────
|
|
533
|
+
$search.addEventListener('input', renderSourceDomains);
|
|
534
|
+
|
|
535
|
+
// ─── Start ─────────────────────────────
|
|
536
|
+
init();
|
|
537
|
+
})();
|
|
538
|
+
</script>
|
|
539
|
+
</body>
|
|
540
|
+
</html>`;
|
|
541
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* find-browse — locate the gstack browse binary.
|
|
3
|
+
*
|
|
4
|
+
* Compiled to browse/dist/find-browse (standalone binary, no bun runtime needed).
|
|
5
|
+
* Outputs the absolute path to the browse binary on stdout, or exits 1 if not found.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { homedir } from 'os';
|
|
11
|
+
|
|
12
|
+
// ─── Binary Discovery ───────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
function getGitRoot(): string | null {
|
|
15
|
+
try {
|
|
16
|
+
const proc = Bun.spawnSync(['git', 'rev-parse', '--show-toplevel'], {
|
|
17
|
+
stdout: 'pipe',
|
|
18
|
+
stderr: 'pipe',
|
|
19
|
+
});
|
|
20
|
+
if (proc.exitCode !== 0) return null;
|
|
21
|
+
return proc.stdout.toString().trim();
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function locateBinary(): string | null {
|
|
28
|
+
const root = getGitRoot();
|
|
29
|
+
const home = homedir();
|
|
30
|
+
const markers = ['.codex', '.agents', '.claude'];
|
|
31
|
+
|
|
32
|
+
// Workspace-local takes priority (for development)
|
|
33
|
+
if (root) {
|
|
34
|
+
for (const m of markers) {
|
|
35
|
+
const local = join(root, m, 'skills', 'gstack', 'browse', 'dist', 'browse');
|
|
36
|
+
if (existsSync(local)) return local;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Global fallback
|
|
41
|
+
for (const m of markers) {
|
|
42
|
+
const global = join(home, m, 'skills', 'gstack', 'browse', 'dist', 'browse');
|
|
43
|
+
if (existsSync(global)) return global;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ─── Main ───────────────────────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
function main() {
|
|
52
|
+
const bin = locateBinary();
|
|
53
|
+
if (!bin) {
|
|
54
|
+
process.stderr.write('ERROR: browse binary not found. Run: cd <skill-dir> && ./setup\n');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(bin);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main();
|