@clipboard-health/groundcrew 4.0.3 → 4.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 +37 -13
- package/crew.config.example.ts +5 -18
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +27 -49
- package/dist/commands/resumeWorkspace.d.ts.map +1 -1
- package/dist/commands/resumeWorkspace.js +1 -2
- package/dist/commands/setupWorkspace.d.ts.map +1 -1
- package/dist/commands/setupWorkspace.js +1 -7
- package/dist/commands/upgrade.d.ts +0 -11
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +14 -100
- package/dist/lib/agentLaunch.d.ts +0 -6
- package/dist/lib/agentLaunch.d.ts.map +1 -1
- package/dist/lib/agentLaunch.js +1 -12
- package/dist/lib/cmuxAdapter.d.ts +8 -0
- package/dist/lib/cmuxAdapter.d.ts.map +1 -0
- package/dist/lib/cmuxAdapter.js +163 -0
- package/dist/lib/config.d.ts +2 -76
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +29 -102
- package/dist/lib/launchCommand.d.ts +3 -3
- package/dist/lib/sandboxName.d.ts +9 -0
- package/dist/lib/sandboxName.d.ts.map +1 -0
- package/dist/lib/sandboxName.js +12 -0
- package/dist/lib/tmuxAdapter.d.ts +9 -0
- package/dist/lib/tmuxAdapter.d.ts.map +1 -0
- package/dist/lib/tmuxAdapter.js +156 -0
- package/dist/lib/workspaceAdapter.d.ts +79 -0
- package/dist/lib/workspaceAdapter.d.ts.map +1 -0
- package/dist/lib/workspaceAdapter.js +17 -0
- package/dist/lib/workspaces.d.ts +7 -55
- package/dist/lib/workspaces.d.ts.map +1 -1
- package/dist/lib/workspaces.js +8 -404
- package/package.json +1 -2
- package/dist/commands/sandbox/auth.d.ts +0 -3
- package/dist/commands/sandbox/auth.d.ts.map +0 -1
- package/dist/commands/sandbox/auth.js +0 -227
- package/dist/commands/sandbox/index.d.ts +0 -2
- package/dist/commands/sandbox/index.d.ts.map +0 -1
- package/dist/commands/sandbox/index.js +0 -47
- package/dist/commands/sandbox/inspect.d.ts +0 -2
- package/dist/commands/sandbox/inspect.d.ts.map +0 -1
- package/dist/commands/sandbox/inspect.js +0 -18
- package/dist/commands/sandbox/lifecycle.d.ts +0 -7
- package/dist/commands/sandbox/lifecycle.d.ts.map +0 -1
- package/dist/commands/sandbox/lifecycle.js +0 -68
- package/dist/commands/sandbox/model.d.ts +0 -10
- package/dist/commands/sandbox/model.d.ts.map +0 -1
- package/dist/commands/sandbox/model.js +0 -37
- package/dist/commands/sandbox/picker.d.ts +0 -20
- package/dist/commands/sandbox/picker.d.ts.map +0 -1
- package/dist/commands/sandbox/picker.js +0 -23
- package/dist/commands/setupRepos.d.ts +0 -44
- package/dist/commands/setupRepos.d.ts.map +0 -1
- package/dist/commands/setupRepos.js +0 -212
- package/dist/lib/dockerSandbox.d.ts +0 -43
- package/dist/lib/dockerSandbox.d.ts.map +0 -1
- package/dist/lib/dockerSandbox.js +0 -69
- package/dist/lib/sandboxGitDefaults.d.ts +0 -10
- package/dist/lib/sandboxGitDefaults.d.ts.map +0 -1
- package/dist/lib/sandboxGitDefaults.js +0 -31
- package/dist/lib/upgrade.d.ts +0 -66
- package/dist/lib/upgrade.d.ts.map +0 -1
- package/dist/lib/upgrade.js +0 -178
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { runCommandAsync } from "./commandRunner.js";
|
|
2
|
-
/**
|
|
3
|
-
* Git defaults applied inside every sandbox when `sandbox.gitDefaults`
|
|
4
|
-
* is enabled (the default).
|
|
5
|
-
*
|
|
6
|
-
* - Disable GPG signing — robot commits inside the sandbox have no key
|
|
7
|
-
* and would otherwise fail or end up unsigned silently.
|
|
8
|
-
* - Rewrite GitHub SSH URLs to HTTPS so push/fetch go through the `gh`
|
|
9
|
-
* credential helper (wired by `gh auth setup-git` after a successful
|
|
10
|
-
* `crew sandbox auth` github login), regardless of how the user
|
|
11
|
-
* originally cloned the repo on the host.
|
|
12
|
-
*
|
|
13
|
-
* `url.<base>.insteadOf` is multi-valued in git; `--unset-all` before
|
|
14
|
-
* `--add` keeps the set identical across repeated runs instead of
|
|
15
|
-
* appending duplicates.
|
|
16
|
-
*/
|
|
17
|
-
const GIT_DEFAULT_COMMANDS = [
|
|
18
|
-
"git config --global commit.gpgsign false",
|
|
19
|
-
"git config --global tag.gpgsign false",
|
|
20
|
-
'(git config --global --unset-all url."https://github.com/".insteadOf 2>/dev/null || true)',
|
|
21
|
-
'git config --global --add url."https://github.com/".insteadOf "git@github.com:"',
|
|
22
|
-
'git config --global --add url."https://github.com/".insteadOf "ssh://git@github.com/"',
|
|
23
|
-
].join(" && ");
|
|
24
|
-
/**
|
|
25
|
-
* Apply the standard git defaults inside `sandboxName`. Idempotent —
|
|
26
|
-
* safe to call on every `ensure`/`auth` run to repair drift.
|
|
27
|
-
*/
|
|
28
|
-
export async function applyGitDefaults(arguments_, signal) {
|
|
29
|
-
const options = signal === undefined ? {} : { signal };
|
|
30
|
-
await runCommandAsync("sbx", ["exec", arguments_.sandboxName, "sh", "-c", GIT_DEFAULT_COMMANDS], options);
|
|
31
|
-
}
|
package/dist/lib/upgrade.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
interface Version {
|
|
2
|
-
major: number;
|
|
3
|
-
minor: number;
|
|
4
|
-
patch: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function parseVersion(version: string): Version;
|
|
7
|
-
export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
|
|
8
|
-
export declare function normalizeRegistry(registry: string | undefined): string;
|
|
9
|
-
export interface FetchOptions {
|
|
10
|
-
timeoutMs: number;
|
|
11
|
-
registry?: string | undefined;
|
|
12
|
-
}
|
|
13
|
-
export declare function fetchLatestVersion(packageName: string, options: FetchOptions): Promise<string>;
|
|
14
|
-
export interface UpgradeCheckCacheEntry {
|
|
15
|
-
latest: string;
|
|
16
|
-
fetchedAt: number;
|
|
17
|
-
registry: string;
|
|
18
|
-
}
|
|
19
|
-
export interface PrimeUpgradeCheckCacheOptions {
|
|
20
|
-
path: string;
|
|
21
|
-
latest: string;
|
|
22
|
-
registry?: string | undefined;
|
|
23
|
-
now: () => number;
|
|
24
|
-
}
|
|
25
|
-
export type UpgradeCheckCacheResult = {
|
|
26
|
-
kind: "missing";
|
|
27
|
-
} | {
|
|
28
|
-
kind: "fresh";
|
|
29
|
-
entry: UpgradeCheckCacheEntry;
|
|
30
|
-
} | {
|
|
31
|
-
kind: "stale";
|
|
32
|
-
entry: UpgradeCheckCacheEntry;
|
|
33
|
-
};
|
|
34
|
-
export declare function defaultUpgradeCheckCachePath(): string;
|
|
35
|
-
export declare function readUpgradeCheckCache(path: string, options: {
|
|
36
|
-
now: () => number;
|
|
37
|
-
ttlMs: number;
|
|
38
|
-
registry?: string | undefined;
|
|
39
|
-
}): UpgradeCheckCacheResult;
|
|
40
|
-
export declare function writeUpgradeCheckCache(path: string, entry: UpgradeCheckCacheEntry): void;
|
|
41
|
-
export declare function primeUpgradeCheckCache(options: PrimeUpgradeCheckCacheOptions): void;
|
|
42
|
-
export declare function composeNudgeMessage(current: string, latest: string): string | undefined;
|
|
43
|
-
export type VersionFetcher = (packageName: string, options: FetchOptions) => Promise<string>;
|
|
44
|
-
export interface FetchAndPrimeUpgradeCheckCacheOptions {
|
|
45
|
-
packageName: string;
|
|
46
|
-
cachePath: string;
|
|
47
|
-
fetchTimeoutMs: number;
|
|
48
|
-
registry?: string | undefined;
|
|
49
|
-
now: () => number;
|
|
50
|
-
fetcher: VersionFetcher;
|
|
51
|
-
}
|
|
52
|
-
export declare function fetchAndPrimeUpgradeCheckCache(options: FetchAndPrimeUpgradeCheckCacheOptions): Promise<string>;
|
|
53
|
-
export interface ComputeUpgradeNudgeOptions {
|
|
54
|
-
currentVersion: string;
|
|
55
|
-
packageName: string;
|
|
56
|
-
cachePath: string;
|
|
57
|
-
ttlMs: number;
|
|
58
|
-
fetchTimeoutMs: number;
|
|
59
|
-
registry?: string | undefined;
|
|
60
|
-
noUpgradeCheck: boolean;
|
|
61
|
-
now: () => number;
|
|
62
|
-
fetcher: VersionFetcher;
|
|
63
|
-
}
|
|
64
|
-
export declare function computeUpgradeNudge(options: ComputeUpgradeNudgeOptions): Promise<string | undefined>;
|
|
65
|
-
export {};
|
|
66
|
-
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/lib/upgrade.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/upgrade.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { errorMessage, readEnvironmentVariable } from "./util.js";
|
|
5
|
-
const NUMERIC_IDENTIFIER_PATTERN = String.raw `0|[1-9]\d*`;
|
|
6
|
-
const VERSION_RE = new RegExp(String.raw `^(${NUMERIC_IDENTIFIER_PATTERN})\.(${NUMERIC_IDENTIFIER_PATTERN})\.(${NUMERIC_IDENTIFIER_PATTERN})$`);
|
|
7
|
-
export function parseVersion(version) {
|
|
8
|
-
const match = VERSION_RE.exec(version);
|
|
9
|
-
if (!match) {
|
|
10
|
-
throw new Error(`invalid version: ${JSON.stringify(version)}`);
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
// oxlint-disable typescript/no-non-null-assertion -- VERSION_RE guarantees groups 1–3 on match; group 4 is optional.
|
|
14
|
-
major: Number.parseInt(match[1], 10),
|
|
15
|
-
minor: Number.parseInt(match[2], 10),
|
|
16
|
-
patch: Number.parseInt(match[3], 10),
|
|
17
|
-
// oxlint-enable typescript/no-non-null-assertion
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export function compareVersions(a, b) {
|
|
21
|
-
const left = parseVersion(a);
|
|
22
|
-
const right = parseVersion(b);
|
|
23
|
-
for (const key of ["major", "minor", "patch"]) {
|
|
24
|
-
if (left[key] !== right[key]) {
|
|
25
|
-
return left[key] > right[key] ? 1 : -1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return 0;
|
|
29
|
-
}
|
|
30
|
-
const DEFAULT_REGISTRY = "https://registry.npmjs.org";
|
|
31
|
-
export function normalizeRegistry(registry) {
|
|
32
|
-
return (registry ?? DEFAULT_REGISTRY).replace(/\/$/, "");
|
|
33
|
-
}
|
|
34
|
-
function encodePackageNameForRegistry(packageName) {
|
|
35
|
-
return encodeURIComponent(packageName).replace(/^%40/, "@");
|
|
36
|
-
}
|
|
37
|
-
export async function fetchLatestVersion(packageName, options) {
|
|
38
|
-
const registry = normalizeRegistry(options.registry);
|
|
39
|
-
const url = `${registry}/${encodePackageNameForRegistry(packageName)}/latest`;
|
|
40
|
-
const controller = new AbortController();
|
|
41
|
-
const timer = setTimeout(() => {
|
|
42
|
-
controller.abort();
|
|
43
|
-
}, options.timeoutMs);
|
|
44
|
-
try {
|
|
45
|
-
let response;
|
|
46
|
-
try {
|
|
47
|
-
response = await fetch(url, { signal: controller.signal });
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
throw new Error(`registry request failed: ${errorMessage(error)}`, { cause: error });
|
|
51
|
-
}
|
|
52
|
-
if (!response.ok) {
|
|
53
|
-
throw new Error(`registry returned ${response.status} for ${url}`);
|
|
54
|
-
}
|
|
55
|
-
const body = await response.json();
|
|
56
|
-
if (typeof body !== "object" || body === null || !("version" in body)) {
|
|
57
|
-
throw new TypeError(`registry response missing 'version' field`);
|
|
58
|
-
}
|
|
59
|
-
const { version } = body;
|
|
60
|
-
if (typeof version !== "string") {
|
|
61
|
-
throw new TypeError(`registry response 'version' field is not a string`);
|
|
62
|
-
}
|
|
63
|
-
parseVersion(version);
|
|
64
|
-
return version;
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
clearTimeout(timer);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export function defaultUpgradeCheckCachePath() {
|
|
71
|
-
const override = readEnvironmentVariable("XDG_CACHE_HOME");
|
|
72
|
-
const base = override === undefined || override.length === 0 ? join(homedir(), ".cache") : override;
|
|
73
|
-
return join(base, "groundcrew", "upgrade-check.json");
|
|
74
|
-
}
|
|
75
|
-
function parseCacheEntry(value) {
|
|
76
|
-
if (typeof value !== "object" || value === null) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
const candidate = value;
|
|
80
|
-
if (typeof candidate.latest !== "string" ||
|
|
81
|
-
typeof candidate.fetchedAt !== "number" ||
|
|
82
|
-
typeof candidate.registry !== "string") {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
parseVersion(candidate.latest);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
return { latest: candidate.latest, fetchedAt: candidate.fetchedAt, registry: candidate.registry };
|
|
92
|
-
}
|
|
93
|
-
export function readUpgradeCheckCache(path, options) {
|
|
94
|
-
let raw;
|
|
95
|
-
try {
|
|
96
|
-
raw = readFileSync(path, "utf8");
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return { kind: "missing" };
|
|
100
|
-
}
|
|
101
|
-
let parsed;
|
|
102
|
-
try {
|
|
103
|
-
parsed = JSON.parse(raw);
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return { kind: "missing" };
|
|
107
|
-
}
|
|
108
|
-
const entry = parseCacheEntry(parsed);
|
|
109
|
-
if (!entry) {
|
|
110
|
-
return { kind: "missing" };
|
|
111
|
-
}
|
|
112
|
-
if (entry.registry !== normalizeRegistry(options.registry)) {
|
|
113
|
-
return { kind: "missing" };
|
|
114
|
-
}
|
|
115
|
-
const ageMs = options.now() - entry.fetchedAt;
|
|
116
|
-
return ageMs >= options.ttlMs ? { kind: "stale", entry } : { kind: "fresh", entry };
|
|
117
|
-
}
|
|
118
|
-
export function writeUpgradeCheckCache(path, entry) {
|
|
119
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
120
|
-
writeFileSync(path, JSON.stringify(entry));
|
|
121
|
-
}
|
|
122
|
-
function writeUpgradeCheckCacheBestEffort(path, entry) {
|
|
123
|
-
try {
|
|
124
|
-
writeUpgradeCheckCache(path, entry);
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
// Upgrade-check cache writes are best-effort; callers should keep using current data.
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export function primeUpgradeCheckCache(options) {
|
|
131
|
-
writeUpgradeCheckCacheBestEffort(options.path, {
|
|
132
|
-
latest: options.latest,
|
|
133
|
-
fetchedAt: options.now(),
|
|
134
|
-
registry: normalizeRegistry(options.registry),
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
export function composeNudgeMessage(current, latest) {
|
|
138
|
-
if (compareVersions(current, latest) >= 0) {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
return `[crew] ${latest} available — run \`crew upgrade\` (you have ${current})`;
|
|
142
|
-
}
|
|
143
|
-
export async function fetchAndPrimeUpgradeCheckCache(options) {
|
|
144
|
-
const latest = await options.fetcher(options.packageName, {
|
|
145
|
-
timeoutMs: options.fetchTimeoutMs,
|
|
146
|
-
registry: options.registry,
|
|
147
|
-
});
|
|
148
|
-
primeUpgradeCheckCache({
|
|
149
|
-
path: options.cachePath,
|
|
150
|
-
latest,
|
|
151
|
-
registry: options.registry,
|
|
152
|
-
now: options.now,
|
|
153
|
-
});
|
|
154
|
-
return latest;
|
|
155
|
-
}
|
|
156
|
-
export async function computeUpgradeNudge(options) {
|
|
157
|
-
if (options.noUpgradeCheck) {
|
|
158
|
-
return undefined;
|
|
159
|
-
}
|
|
160
|
-
const cacheResult = readUpgradeCheckCache(options.cachePath, {
|
|
161
|
-
now: options.now,
|
|
162
|
-
ttlMs: options.ttlMs,
|
|
163
|
-
registry: options.registry,
|
|
164
|
-
});
|
|
165
|
-
if (cacheResult.kind === "fresh") {
|
|
166
|
-
return composeNudgeMessage(options.currentVersion, cacheResult.entry.latest);
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const latest = await fetchAndPrimeUpgradeCheckCache(options);
|
|
170
|
-
return composeNudgeMessage(options.currentVersion, latest);
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
if (cacheResult.kind === "stale") {
|
|
174
|
-
return composeNudgeMessage(options.currentVersion, cacheResult.entry.latest);
|
|
175
|
-
}
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
}
|