matthewwong525/WongStack / .agents/plugins/browser
browser
VerifiedThe person's own browser, for errands.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 4.4 KB |
| SKILL.md | skill md | 3.6 KB |
| VERSION | other | 6 B |
| addon/background.js | script | 1.1 KB |
| addon/check.svg | other | 591 B |
| addon/manifest.json | config | 462 B |
| references/browser-proxy.md | markdown | 5.2 KB |
| references/browser-window.md | markdown | 6.4 KB |
| references/browsing.md | markdown | 18.6 KB |
| references/login-codes.md | markdown | 5.6 KB |
| references/password-manager.md | markdown | 8.3 KB |
| references/setup.md | markdown | 6.4 KB |
| scripts/addons.mjs | script | 26.3 KB |
| scripts/browse.mjs | script | 53.5 KB |
| scripts/browser-server.mjs | script | 50.8 KB |
| scripts/connect-browser.mjs | script | 17.3 KB |
| scripts/forwarder.mjs | script | 14.5 KB |
| scripts/launch-config.py | script | 7.4 KB |
| scripts/lib/cli.mjs | script | 1.2 KB |
| scripts/lib/env.mjs | script | 614 B |
| scripts/lib/primary-root.mjsexecutable | script | 1.9 KB |
| scripts/lib/profile.mjs | script | 1.4 KB |
| scripts/login-move.mjs | script | 4.0 KB |
| scripts/mask-keys.mjs | script | 2.9 KB |
| scripts/proxy-lines.mjs | script | 4.7 KB |
| scripts/refs.mjs | script | 5.4 KB |
scripts/lib/primary-root.mjs
View on GitHub#!/usr/bin/env node
// The browser module's copy of memory's primary-root.mjs: the primary worktree, where durable secrets live.
// The primary is the common dir's parent, and Git must agree it is a checkout's top level; a bare repo fails that.
import { execFileSync } from 'node:child_process';
import { dirname } from 'node:path';
import { isMain, parseCli } from './cli.mjs';
export class PrimaryRootError extends Error {}
const git = (cwd, ...args) => execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
// { root, primary, linked, gitDir, commonDir }, or a PrimaryRootError that names what went wrong.
export function primaryRoot(cwd = process.cwd()) {
let root, gitDir, commonDir;
try {
[root, gitDir, commonDir] = git(cwd, 'rev-parse', '--path-format=absolute', '--show-toplevel', '--git-dir', '--git-common-dir').split('\n');
} catch (error) {
throw new PrimaryRootError(`not inside a Git checkout: ${String(error.stderr || error.message).trim().split('\n')[0]}`);
}
const linked = gitDir !== commonDir;
const primary = linked ? dirname(commonDir) : root;
let resolved;
try { resolved = git(primary, 'rev-parse', '--show-toplevel'); } catch { resolved = ''; }
if (resolved !== primary) throw new PrimaryRootError(`the parent of ${commonDir} is not a checkout, so the primary worktree is unknown`);
return { root, primary, linked, gitDir, commonDir };
}
const USAGE = 'usage: primary-root.mjs [dir] prints the primary checkout of dir (default: the current directory)';
if (isMain(import.meta.url)) {
const parsed = parseCli({ usage: USAGE, allowPositionals: true });
try {
console.log(primaryRoot(parsed.positionals[0] || process.cwd()).primary);
} catch (error) {
if (!(error instanceof PrimaryRootError)) throw error;
console.error(`primary-root: ${error.message}`);
process.exitCode = 1;
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |