borgmcp 4.6.1 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assimilate-cmd.d.ts +8 -23
- package/dist/assimilate-cmd.d.ts.map +1 -1
- package/dist/assimilate-cmd.js +9 -5
- package/dist/assimilate-cmd.js.map +1 -1
- package/dist/assimilate-deps.d.ts.map +1 -1
- package/dist/assimilate-deps.js +3 -16
- package/dist/assimilate-deps.js.map +1 -1
- package/dist/claude.d.ts +5 -3
- package/dist/claude.d.ts.map +1 -1
- package/dist/claude.js +82 -30
- package/dist/claude.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/codex-launch.d.ts +1 -1
- package/dist/codex-launch.d.ts.map +1 -1
- package/dist/codex-launch.js.map +1 -1
- package/dist/config-utils.d.ts +3 -0
- package/dist/config-utils.d.ts.map +1 -1
- package/dist/config-utils.js +141 -4
- package/dist/config-utils.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -18
- package/dist/config.js.map +1 -1
- package/dist/cubes.d.ts +0 -7
- package/dist/cubes.d.ts.map +1 -1
- package/dist/cubes.js +0 -9
- package/dist/cubes.js.map +1 -1
- package/dist/gc-orphan-inboxes.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -47
- package/dist/index.js.map +1 -1
- package/dist/log-stream.d.ts +6 -16
- package/dist/log-stream.d.ts.map +1 -1
- package/dist/log-stream.js.map +1 -1
- package/dist/opencode-drone.d.ts +2 -0
- package/dist/opencode-drone.d.ts.map +1 -1
- package/dist/opencode-drone.js +101 -28
- package/dist/opencode-drone.js.map +1 -1
- package/dist/opencode-launch-trust.d.ts +1 -0
- package/dist/opencode-launch-trust.d.ts.map +1 -1
- package/dist/opencode-launch-trust.js +4 -0
- package/dist/opencode-launch-trust.js.map +1 -1
- package/dist/quickstart-cmd.d.ts.map +1 -1
- package/dist/quickstart-cmd.js +9 -2
- package/dist/quickstart-cmd.js.map +1 -1
- package/dist/regen-format.d.ts +1 -2
- package/dist/regen-format.d.ts.map +1 -1
- package/dist/regen-format.js.map +1 -1
- package/dist/regen.js +1 -1
- package/dist/regen.js.map +1 -1
- package/dist/remote-client.d.ts.map +1 -1
- package/dist/remote-client.js +8 -8
- package/dist/remote-client.js.map +1 -1
- package/dist/repository-cube-init.d.ts +1 -1
- package/dist/repository-cube-init.d.ts.map +1 -1
- package/dist/repository-cube-init.js +2 -5
- package/dist/repository-cube-init.js.map +1 -1
- package/dist/repository-identity.d.ts +14 -4
- package/dist/repository-identity.d.ts.map +1 -1
- package/dist/repository-identity.js +86 -18
- package/dist/repository-identity.js.map +1 -1
- package/dist/self-path.d.ts.map +1 -1
- package/dist/self-path.js.map +1 -1
- package/dist/server-handshake.d.ts +1 -1
- package/dist/server-handshake.d.ts.map +1 -1
- package/dist/server-handshake.js +0 -1
- package/dist/server-handshake.js.map +1 -1
- package/dist/tool-manifest.js +3 -3
- package/dist/tool-manifest.js.map +1 -1
- package/dist/unknown-subcommand.d.ts +1 -1
- package/dist/unknown-subcommand.d.ts.map +1 -1
- package/dist/unknown-subcommand.js +1 -0
- package/dist/unknown-subcommand.js.map +1 -1
- package/dist/update-cmd.js +1 -1
- package/dist/update-cmd.js.map +1 -1
- package/docs/RELEASING.md +5 -4
- package/package.json +2 -2
- package/src/assimilate-cmd.ts +29 -37
- package/src/assimilate-deps.ts +2 -18
- package/src/claude.ts +91 -31
- package/src/cli-help.ts +1 -0
- package/src/codex-launch.ts +2 -1
- package/src/config-utils.ts +156 -4
- package/src/config.ts +58 -22
- package/src/cubes.ts +0 -10
- package/src/gc-orphan-inboxes.ts +1 -1
- package/src/index.ts +24 -51
- package/src/log-stream.ts +12 -17
- package/src/opencode-drone.ts +112 -30
- package/src/opencode-launch-trust.ts +5 -0
- package/src/quickstart-cmd.ts +10 -2
- package/src/regen-format.ts +1 -3
- package/src/regen.ts +2 -3
- package/src/remote-client.ts +12 -9
- package/src/repository-cube-init.ts +3 -6
- package/src/repository-identity.ts +125 -20
- package/src/self-path.ts +0 -1
- package/src/server-handshake.ts +1 -2
- package/src/tool-manifest.ts +3 -3
- package/src/unknown-subcommand.ts +1 -0
- package/src/update-cmd.ts +1 -1
- package/dist/postinstall-banner.d.ts +0 -2
- package/dist/postinstall-banner.d.ts.map +0 -1
- package/dist/postinstall-banner.js +0 -27
- package/dist/postinstall-banner.js.map +0 -1
- package/dist/postinstall.d.ts +0 -11
- package/dist/postinstall.d.ts.map +0 -1
- package/dist/postinstall.js +0 -33
- package/dist/postinstall.js.map +0 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/src/postinstall-banner.ts +0 -37
- package/src/postinstall.ts +0 -36
- package/src/types.ts +0 -5
|
@@ -37,39 +37,132 @@ interface RepositoryIdentityState {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export interface RepositoryIdentityDeps {
|
|
40
|
-
runGit?: (cwd: string, args: string[]) =>
|
|
40
|
+
runGit?: (cwd: string, args: string[]) => GitCommandResult;
|
|
41
41
|
canonicalPath?: (path: string) => Promise<string>;
|
|
42
42
|
root?: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
interface GitCommandResult {
|
|
46
|
+
status: number | null;
|
|
47
|
+
stdout?: string | null;
|
|
48
|
+
stderr?: string | null;
|
|
49
|
+
error?: Error;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class RepositoryDiscoveryError extends Error {
|
|
53
|
+
readonly name = 'RepositoryDiscoveryError';
|
|
54
|
+
|
|
55
|
+
constructor(
|
|
56
|
+
readonly kind: 'git-execution' | 'git-query' | 'canonical-path',
|
|
57
|
+
message: string,
|
|
58
|
+
options?: ErrorOptions,
|
|
59
|
+
) {
|
|
60
|
+
super(message, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function repositoryDiscoveryFailureMessage(error: unknown): string {
|
|
65
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
66
|
+
return message.replace(/[\x00-\x1F\x7F]/g, '').trim() || 'Unknown repository discovery failure';
|
|
67
|
+
}
|
|
68
|
+
|
|
45
69
|
function defaultRunGit(cwd: string, args: string[]) {
|
|
46
|
-
const result = spawnSync('git', args, {
|
|
47
|
-
|
|
70
|
+
const result = spawnSync('git', args, {
|
|
71
|
+
cwd,
|
|
72
|
+
encoding: 'utf8',
|
|
73
|
+
env: { ...process.env, LC_ALL: 'C' },
|
|
74
|
+
});
|
|
75
|
+
return { status: result.status, stdout: result.stdout, stderr: result.stderr, error: result.error };
|
|
48
76
|
}
|
|
49
77
|
|
|
50
|
-
function output(result:
|
|
78
|
+
function output(result: GitCommandResult): string | null {
|
|
51
79
|
const value = result.status === 0 ? result.stdout?.trim() : null;
|
|
52
80
|
return value || null;
|
|
53
81
|
}
|
|
54
82
|
|
|
83
|
+
function runGitForDiscovery(
|
|
84
|
+
runGit: NonNullable<RepositoryIdentityDeps['runGit']>,
|
|
85
|
+
cwd: string,
|
|
86
|
+
args: string[],
|
|
87
|
+
): GitCommandResult {
|
|
88
|
+
let result: GitCommandResult;
|
|
89
|
+
try {
|
|
90
|
+
result = runGit(cwd, args);
|
|
91
|
+
} catch (cause) {
|
|
92
|
+
throw new RepositoryDiscoveryError(
|
|
93
|
+
'git-execution',
|
|
94
|
+
`Git repository discovery could not run: ${repositoryDiscoveryFailureMessage(cause)}`,
|
|
95
|
+
{ cause },
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (result.error) {
|
|
99
|
+
throw new RepositoryDiscoveryError(
|
|
100
|
+
'git-execution',
|
|
101
|
+
`Git repository discovery could not run: ${repositoryDiscoveryFailureMessage(result.error)}`,
|
|
102
|
+
{ cause: result.error },
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function gitQueryFailure(label: string, result: GitCommandResult): RepositoryDiscoveryError {
|
|
109
|
+
const detail = (result.stderr ?? '').replace(/[\x00-\x1F\x7F]/g, '').trim();
|
|
110
|
+
const suffix = detail ? `: ${detail}` : ` (Git exited with status ${result.status ?? 'unknown'})`;
|
|
111
|
+
return new RepositoryDiscoveryError(
|
|
112
|
+
'git-query',
|
|
113
|
+
`Git repository discovery failed while querying ${label}${suffix}`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function canonicalizeRepositoryPath(
|
|
118
|
+
canonicalPath: NonNullable<RepositoryIdentityDeps['canonicalPath']>,
|
|
119
|
+
path: string,
|
|
120
|
+
label: string,
|
|
121
|
+
): Promise<string> {
|
|
122
|
+
try {
|
|
123
|
+
return await canonicalPath(path);
|
|
124
|
+
} catch (cause) {
|
|
125
|
+
throw new RepositoryDiscoveryError(
|
|
126
|
+
'canonical-path',
|
|
127
|
+
`Could not resolve the ${label}: ${repositoryDiscoveryFailureMessage(cause)}`,
|
|
128
|
+
{ cause },
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
55
133
|
export async function resolveGitRepositoryContext(
|
|
56
134
|
cwd: string,
|
|
57
135
|
deps: RepositoryIdentityDeps = {},
|
|
58
136
|
): Promise<GitRepositoryContext | null> {
|
|
59
137
|
const runGit = deps.runGit ?? defaultRunGit;
|
|
60
138
|
const canonicalPath = deps.canonicalPath ?? realpath;
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
|
|
139
|
+
const bareResult = runGitForDiscovery(runGit, cwd, ['rev-parse', '--is-bare-repository']);
|
|
140
|
+
if (bareResult.status !== 0) {
|
|
141
|
+
if (/not a git repository/i.test(bareResult.stderr ?? '')) return null;
|
|
142
|
+
throw gitQueryFailure('whether the repository is bare', bareResult);
|
|
143
|
+
}
|
|
144
|
+
const bare = output(bareResult);
|
|
64
145
|
if (bare === 'true') throw new Error('BARE_REPOSITORY');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
146
|
+
if (bare !== 'false') throw gitQueryFailure('whether the repository is bare', bareResult);
|
|
147
|
+
|
|
148
|
+
const rootResult = runGitForDiscovery(runGit, cwd, ['rev-parse', '--show-toplevel']);
|
|
149
|
+
const rootRaw = output(rootResult);
|
|
150
|
+
if (!rootRaw || !isAbsolute(rootRaw)) throw gitQueryFailure('the repository root', rootResult);
|
|
151
|
+
|
|
152
|
+
const commonResult = runGitForDiscovery(runGit, cwd, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
153
|
+
const commonRaw = output(commonResult);
|
|
154
|
+
if (!commonRaw || !isAbsolute(commonRaw)) throw gitQueryFailure('the Git common directory', commonResult);
|
|
155
|
+
|
|
156
|
+
const root = await canonicalizeRepositoryPath(canonicalPath, rootRaw, 'repository root path');
|
|
157
|
+
const commonDir = await canonicalizeRepositoryPath(canonicalPath, commonRaw, 'Git common directory path');
|
|
69
158
|
const derivedName = normalizeCubeName(basename(root));
|
|
70
159
|
if (!derivedName) return null;
|
|
71
160
|
|
|
72
|
-
const
|
|
161
|
+
const originResult = runGitForDiscovery(runGit, root, ['config', '--get', 'remote.origin.url']);
|
|
162
|
+
if (originResult.status !== 0 && (originResult.status !== 1 || originResult.stderr?.trim())) {
|
|
163
|
+
throw gitQueryFailure('the origin remote', originResult);
|
|
164
|
+
}
|
|
165
|
+
const originRaw = output(originResult);
|
|
73
166
|
const canonical = originRaw ? canonicalizeWorkingRepoIdentity(originRaw) : null;
|
|
74
167
|
return {
|
|
75
168
|
root,
|
|
@@ -94,8 +187,8 @@ function emptyState(): RepositoryIdentityState {
|
|
|
94
187
|
return { version: STORE_VERSION, localIdentities: {}, associations: {} };
|
|
95
188
|
}
|
|
96
189
|
|
|
97
|
-
function parseState(raw: string | null): RepositoryIdentityState {
|
|
98
|
-
if (raw === null) return emptyState();
|
|
190
|
+
function parseState(raw: string | null): { state: RepositoryIdentityState; migrated: boolean } {
|
|
191
|
+
if (raw === null) return { state: emptyState(), migrated: false };
|
|
99
192
|
const parsed = JSON.parse(raw) as Partial<RepositoryIdentityState>;
|
|
100
193
|
if (
|
|
101
194
|
parsed.version !== STORE_VERSION ||
|
|
@@ -109,7 +202,9 @@ function parseState(raw: string | null): RepositoryIdentityState {
|
|
|
109
202
|
throw new Error('Borg repository identity store is malformed or unsupported');
|
|
110
203
|
}
|
|
111
204
|
}
|
|
112
|
-
|
|
205
|
+
let migrated = false;
|
|
206
|
+
for (const [key, rawAssociation] of Object.entries(parsed.associations)) {
|
|
207
|
+
const value = rawAssociation as Omit<Partial<RepositoryAssociation>, 'template'> & { template?: unknown };
|
|
113
208
|
if (
|
|
114
209
|
!/^[a-f0-9]{64}$/.test(key) ||
|
|
115
210
|
!value || typeof value !== 'object' || Array.isArray(value) ||
|
|
@@ -117,13 +212,22 @@ function parseState(raw: string | null): RepositoryIdentityState {
|
|
|
117
212
|
typeof value.name !== 'string' || Buffer.byteLength(value.name, 'utf8') > 120 ||
|
|
118
213
|
!DISPLAY_NAME_RE.test(value.name) ||
|
|
119
214
|
typeof value.workingRepoName !== 'string' || Buffer.byteLength(value.workingRepoName, 'utf8') > 120 ||
|
|
120
|
-
!DISPLAY_NAME_RE.test(value.workingRepoName)
|
|
121
|
-
!CUBE_TEMPLATES.some((template) => template === value.template)
|
|
215
|
+
!DISPLAY_NAME_RE.test(value.workingRepoName)
|
|
122
216
|
) {
|
|
123
217
|
throw new Error('Borg repository identity store is malformed or unsupported');
|
|
124
218
|
}
|
|
219
|
+
// Tag 12 persisted the removed legacy seed. Dropping only this valid
|
|
220
|
+
// association makes the caller re-resolve authoritative state from tag 13.
|
|
221
|
+
if (value.template === 'default') {
|
|
222
|
+
delete parsed.associations[key];
|
|
223
|
+
migrated = true;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (!CUBE_TEMPLATES.some((template) => template === value.template)) {
|
|
227
|
+
throw new Error('Borg repository identity store is malformed or unsupported');
|
|
228
|
+
}
|
|
125
229
|
}
|
|
126
|
-
return parsed as RepositoryIdentityState;
|
|
230
|
+
return { state: parsed as RepositoryIdentityState, migrated };
|
|
127
231
|
}
|
|
128
232
|
|
|
129
233
|
function digest(secret: Buffer, purpose: string, value: string): string {
|
|
@@ -145,9 +249,10 @@ async function withIdentityState<T>(
|
|
|
145
249
|
await atomicWrite0600(secretPath, `${secret.toString('hex')}\n`, options);
|
|
146
250
|
}
|
|
147
251
|
const statePath = join(root, STATE_FILE);
|
|
148
|
-
const
|
|
252
|
+
const parsed = parseState(await readStoreFile(statePath, options));
|
|
253
|
+
const state = parsed.state;
|
|
149
254
|
const outcome = await operation(secret, state);
|
|
150
|
-
if (outcome.changed) {
|
|
255
|
+
if (parsed.migrated || outcome.changed) {
|
|
151
256
|
await atomicWrite0600(statePath, `${JSON.stringify(state, null, 2)}\n`, options);
|
|
152
257
|
}
|
|
153
258
|
return outcome.result;
|
package/src/self-path.ts
CHANGED
package/src/server-handshake.ts
CHANGED
|
@@ -89,7 +89,6 @@ import type { EnrollmentArtifactBinding } from './enrollment-types.js';
|
|
|
89
89
|
const HANDSHAKE_BODY_LIMIT = 64 * 1024;
|
|
90
90
|
const HANDSHAKE_TIMEOUT_MS = 5_000;
|
|
91
91
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
92
|
-
const CLIENT_ATTACH_PATH = '/api/client/attach';
|
|
93
92
|
export const DEFAULT_LOCAL_SERVER_ORIGIN = 'https://127.0.0.1:7091' as const;
|
|
94
93
|
|
|
95
94
|
type FetchLike = typeof fetch;
|
|
@@ -215,7 +214,7 @@ export interface ServerAttachResult {
|
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
/**
|
|
218
|
-
* Attach an enrolled client principal to one granted cube/role over protocol
|
|
217
|
+
* Attach an enrolled client principal to one granted cube/role over protocol v13.
|
|
219
218
|
* The client CSPRNG-generates the session bearer and persists it PENDING in the
|
|
220
219
|
* local 0600 credential store (keyed by the stable per-seat identity) BEFORE
|
|
221
220
|
* this request, so an interrupted/lost response is recovered by re-sending the
|
package/src/tool-manifest.ts
CHANGED
|
@@ -452,8 +452,8 @@ const BASE_TOOL_MANIFEST: ToolManifestEntry[] = [
|
|
|
452
452
|
{
|
|
453
453
|
name: 'borg_create-cube',
|
|
454
454
|
description:
|
|
455
|
-
'Create a new cube bound to an explicit repository. The server homes ONE cube per repository: if the given repository already has a cube, this reports that existing cube and leaves its directive unchanged (it never overwrites it). The server seeds
|
|
456
|
-
'Pass an optional `template` name to
|
|
455
|
+
'Create a new cube bound to an explicit repository. The server homes ONE cube per repository: if the given repository already has a cube, this reports that existing cube and leaves its directive unchanged (it never overwrites it). The server seeds the selected named template atomically; `software-dev` is selected by default. ' +
|
|
456
|
+
'Pass an optional `template` name to select another role set (see borg_list-templates / borg_apply-template).',
|
|
457
457
|
inputSchema: {
|
|
458
458
|
type: 'object',
|
|
459
459
|
properties: {
|
|
@@ -476,7 +476,7 @@ const BASE_TOOL_MANIFEST: ToolManifestEntry[] = [
|
|
|
476
476
|
},
|
|
477
477
|
template: {
|
|
478
478
|
type: 'string',
|
|
479
|
-
description: 'Optional template
|
|
479
|
+
description: 'Optional named template (default: "software-dev"). The server seeds its roles atomically when a cube is newly created; it is never applied to an already-existing repository cube.',
|
|
480
480
|
},
|
|
481
481
|
},
|
|
482
482
|
required: ['name', 'cube_directive', 'repository'],
|
package/src/update-cmd.ts
CHANGED
|
@@ -1370,7 +1370,7 @@ export async function runEarlyUpdate(
|
|
|
1370
1370
|
argv: readonly string[],
|
|
1371
1371
|
deps?: UpdateDeps,
|
|
1372
1372
|
): Promise<number | null> {
|
|
1373
|
-
if (argv[2] !== 'update') return null;
|
|
1373
|
+
if (argv[2] !== 'update' && argv[2] !== 'upgrade') return null;
|
|
1374
1374
|
const parsed = parseUpdateArgs(argv.slice(3), process.env[REENTRY_ENV] === '1');
|
|
1375
1375
|
const resolvedDeps = deps ?? buildDefaultUpdateDeps(parsed.ok ? parsed.registry : undefined);
|
|
1376
1376
|
if (!parsed.ok) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall-banner.d.ts","sourceRoot":"","sources":["../src/postinstall-banner.ts"],"names":[],"mappings":"AAWA,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAyBjE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Pure builder for the post-install banner text. Kept separate from
|
|
2
|
-
// postinstall.ts (which is a side-effectful entry script that runs detection
|
|
3
|
-
// + console output + process.exit on import) so the message content is unit-
|
|
4
|
-
// testable without triggering those side effects.
|
|
5
|
-
//
|
|
6
|
-
// gh#653 B1: a non-expert who installs borgmcp WITHOUT an agent CLI (Claude
|
|
7
|
-
// Code / Codex) present would otherwise be sent straight to "Next step: borg
|
|
8
|
-
// setup", which dead-ends at "No supported agent CLI found". When no agent CLI
|
|
9
|
-
// is detected, surface the install-an-agent-CLI step FIRST so the banner never
|
|
10
|
-
// points the user into a wall.
|
|
11
|
-
export function composeInstallBanner(hasAgentCli) {
|
|
12
|
-
const lines = [
|
|
13
|
-
'',
|
|
14
|
-
'╔════════════════════════════════════╗',
|
|
15
|
-
'║ ◼ Borg MCP Installed ◼ ║',
|
|
16
|
-
'╚════════════════════════════════════╝',
|
|
17
|
-
'',
|
|
18
|
-
];
|
|
19
|
-
if (!hasAgentCli) {
|
|
20
|
-
lines.push('⚠ No agent CLI detected. Borg runs on top of Claude Code or Codex —', ' install one first:', ' Claude Code: https://claude.ai/download', ' Codex: https://developers.openai.com/codex', '', 'Then run:', ' borg setup', '');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
lines.push('Next step:', ' borg setup', '');
|
|
24
|
-
}
|
|
25
|
-
return lines.join('\n');
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=postinstall-banner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall-banner.js","sourceRoot":"","sources":["../src/postinstall-banner.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,6EAA6E;AAC7E,6EAA6E;AAC7E,kDAAkD;AAClD,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,+BAA+B;AAE/B,MAAM,UAAU,oBAAoB,CAAC,WAAoB;IACvD,MAAM,KAAK,GAAG;QACZ,EAAE;QACF,wCAAwC;QACxC,wCAAwC;QACxC,wCAAwC;QACxC,EAAE;KACH,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CACR,qEAAqE,EACrE,sBAAsB,EACtB,6CAA6C,EAC7C,sDAAsD,EACtD,EAAE,EACF,WAAW,EACX,cAAc,EACd,EAAE,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/postinstall.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Post-install script
|
|
4
|
-
*
|
|
5
|
-
* Detects local vs global installation and rejects local installs.
|
|
6
|
-
* gh#653 B1: also detects whether an agent CLI (Claude Code / Codex) is present
|
|
7
|
-
* and adjusts the "next step" banner so a user with no agent CLI is told to
|
|
8
|
-
* install one FIRST rather than being sent into `borg setup`'s dead-end.
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=postinstall.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
|
package/dist/postinstall.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Post-install script
|
|
4
|
-
*
|
|
5
|
-
* Detects local vs global installation and rejects local installs.
|
|
6
|
-
* gh#653 B1: also detects whether an agent CLI (Claude Code / Codex) is present
|
|
7
|
-
* and adjusts the "next step" banner so a user with no agent CLI is told to
|
|
8
|
-
* install one FIRST rather than being sent into `borg setup`'s dead-end.
|
|
9
|
-
*/
|
|
10
|
-
import { detectCliAvailability, installedCliNames } from './cli-platform.js';
|
|
11
|
-
import { composeInstallBanner } from './postinstall-banner.js';
|
|
12
|
-
// Check if this is a local install (npm_config_global is not set)
|
|
13
|
-
const isGlobal = process.env.npm_config_global === 'true';
|
|
14
|
-
if (!isGlobal) {
|
|
15
|
-
console.error('\n◼ Error: borg must be installed globally\n');
|
|
16
|
-
console.error('Please install with:');
|
|
17
|
-
console.error(' npm install -g borgmcp\n');
|
|
18
|
-
console.error('Local installation is not supported.\n');
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
// Global install — show instructions. Detect agent-CLI presence so the banner
|
|
22
|
-
// never points a user with no Claude Code / Codex at `borg setup` (which would
|
|
23
|
-
// dead-end). On any detection error, default to assuming an agent CLI is
|
|
24
|
-
// present so we never emit a false "install an agent CLI" warning.
|
|
25
|
-
let hasAgentCli = true;
|
|
26
|
-
try {
|
|
27
|
-
hasAgentCli = installedCliNames(detectCliAvailability()).length > 0;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
hasAgentCli = true;
|
|
31
|
-
}
|
|
32
|
-
console.log(composeInstallBanner(hasAgentCli));
|
|
33
|
-
//# sourceMappingURL=postinstall.js.map
|
package/dist/postinstall.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,kEAAkE;AAClE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM,CAAC;AAE1D,IAAI,CAAC,QAAQ,EAAE,CAAC;IACd,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC5C,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,mEAAmE;AACnE,IAAI,WAAW,GAAG,IAAI,CAAC;AACvB,IAAI,CAAC;IACH,WAAW,GAAG,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACtE,CAAC;AAAC,MAAM,CAAC;IACP,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/types.d.ts
DELETED
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Pure builder for the post-install banner text. Kept separate from
|
|
2
|
-
// postinstall.ts (which is a side-effectful entry script that runs detection
|
|
3
|
-
// + console output + process.exit on import) so the message content is unit-
|
|
4
|
-
// testable without triggering those side effects.
|
|
5
|
-
//
|
|
6
|
-
// gh#653 B1: a non-expert who installs borgmcp WITHOUT an agent CLI (Claude
|
|
7
|
-
// Code / Codex) present would otherwise be sent straight to "Next step: borg
|
|
8
|
-
// setup", which dead-ends at "No supported agent CLI found". When no agent CLI
|
|
9
|
-
// is detected, surface the install-an-agent-CLI step FIRST so the banner never
|
|
10
|
-
// points the user into a wall.
|
|
11
|
-
|
|
12
|
-
export function composeInstallBanner(hasAgentCli: boolean): string {
|
|
13
|
-
const lines = [
|
|
14
|
-
'',
|
|
15
|
-
'╔════════════════════════════════════╗',
|
|
16
|
-
'║ ◼ Borg MCP Installed ◼ ║',
|
|
17
|
-
'╚════════════════════════════════════╝',
|
|
18
|
-
'',
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
if (!hasAgentCli) {
|
|
22
|
-
lines.push(
|
|
23
|
-
'⚠ No agent CLI detected. Borg runs on top of Claude Code or Codex —',
|
|
24
|
-
' install one first:',
|
|
25
|
-
' Claude Code: https://claude.ai/download',
|
|
26
|
-
' Codex: https://developers.openai.com/codex',
|
|
27
|
-
'',
|
|
28
|
-
'Then run:',
|
|
29
|
-
' borg setup',
|
|
30
|
-
'',
|
|
31
|
-
);
|
|
32
|
-
} else {
|
|
33
|
-
lines.push('Next step:', ' borg setup', '');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return lines.join('\n');
|
|
37
|
-
}
|
package/src/postinstall.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Post-install script
|
|
4
|
-
*
|
|
5
|
-
* Detects local vs global installation and rejects local installs.
|
|
6
|
-
* gh#653 B1: also detects whether an agent CLI (Claude Code / Codex) is present
|
|
7
|
-
* and adjusts the "next step" banner so a user with no agent CLI is told to
|
|
8
|
-
* install one FIRST rather than being sent into `borg setup`'s dead-end.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { detectCliAvailability, installedCliNames } from './cli-platform.js';
|
|
12
|
-
import { composeInstallBanner } from './postinstall-banner.js';
|
|
13
|
-
|
|
14
|
-
// Check if this is a local install (npm_config_global is not set)
|
|
15
|
-
const isGlobal = process.env.npm_config_global === 'true';
|
|
16
|
-
|
|
17
|
-
if (!isGlobal) {
|
|
18
|
-
console.error('\n◼ Error: borg must be installed globally\n');
|
|
19
|
-
console.error('Please install with:');
|
|
20
|
-
console.error(' npm install -g borgmcp\n');
|
|
21
|
-
console.error('Local installation is not supported.\n');
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Global install — show instructions. Detect agent-CLI presence so the banner
|
|
26
|
-
// never points a user with no Claude Code / Codex at `borg setup` (which would
|
|
27
|
-
// dead-end). On any detection error, default to assuming an agent CLI is
|
|
28
|
-
// present so we never emit a false "install an agent CLI" warning.
|
|
29
|
-
let hasAgentCli = true;
|
|
30
|
-
try {
|
|
31
|
-
hasAgentCli = installedCliNames(detectCliAvailability()).length > 0;
|
|
32
|
-
} catch {
|
|
33
|
-
hasAgentCli = true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log(composeInstallBanner(hasAgentCli));
|