@craftspace/cli 0.9.0 → 0.9.1
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/index.js +21 -17
- package/dist/machine.js +1 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/migrate.js +18 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19892,7 +19892,7 @@ var SaveWorkstationBodySchema = external_exports.object({
|
|
|
19892
19892
|
var WorkstationResponseSchema = external_exports.object({ workstation: WorkstationSchema });
|
|
19893
19893
|
|
|
19894
19894
|
// ../../shared/dist/machines/machine.js
|
|
19895
|
-
var CLI_VERSION = "0.9.
|
|
19895
|
+
var CLI_VERSION = "0.9.1";
|
|
19896
19896
|
var CLI_PACKAGE = "@craftspace/cli";
|
|
19897
19897
|
var CLI_INSTALL = `npm i -g ${CLI_PACKAGE}`;
|
|
19898
19898
|
var MACHINE_BEAT_INTERVAL_MS = 15e3;
|
|
@@ -22259,6 +22259,24 @@ import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promise
|
|
|
22259
22259
|
import os from "node:os";
|
|
22260
22260
|
import path2 from "node:path";
|
|
22261
22261
|
var migrate = {
|
|
22262
|
+
async stripGlobalMcp() {
|
|
22263
|
+
const target = path2.join(os.homedir(), ".mcp.json");
|
|
22264
|
+
const raw = await readFile(target, "utf8").catch(() => null);
|
|
22265
|
+
if (raw === null)
|
|
22266
|
+
return;
|
|
22267
|
+
const parsed = JSON.parse(raw);
|
|
22268
|
+
const servers = parsed.mcpServers;
|
|
22269
|
+
if (typeof servers !== "object" || servers === null || !("craftspace" in servers))
|
|
22270
|
+
return;
|
|
22271
|
+
delete servers.craftspace;
|
|
22272
|
+
const emptied = Object.keys(servers).length === 0 && Object.keys(parsed).length === 1;
|
|
22273
|
+
const ours = await readFile(`${target}.craftspace-backup`, "utf8").catch(() => null) === null;
|
|
22274
|
+
if (emptied && ours)
|
|
22275
|
+
await rm(target, { force: true });
|
|
22276
|
+
else
|
|
22277
|
+
await writeFile(target, `${JSON.stringify(parsed, null, 2)}
|
|
22278
|
+
`, { mode: 384 });
|
|
22279
|
+
},
|
|
22262
22280
|
async toLatest({ home, workDir }) {
|
|
22263
22281
|
const done = new Set(await alreadyRan(home));
|
|
22264
22282
|
const ran = [];
|
|
@@ -22304,22 +22322,7 @@ var STEPS = [
|
|
|
22304
22322
|
{
|
|
22305
22323
|
id: "0002-mcp-out-of-home",
|
|
22306
22324
|
async run() {
|
|
22307
|
-
|
|
22308
|
-
const raw = await readFile(target, "utf8").catch(() => null);
|
|
22309
|
-
if (raw === null)
|
|
22310
|
-
return true;
|
|
22311
|
-
const parsed = JSON.parse(raw);
|
|
22312
|
-
const servers = parsed.mcpServers;
|
|
22313
|
-
if (typeof servers !== "object" || servers === null || !("craftspace" in servers))
|
|
22314
|
-
return true;
|
|
22315
|
-
delete servers.craftspace;
|
|
22316
|
-
const emptied = Object.keys(servers).length === 0 && Object.keys(parsed).length === 1;
|
|
22317
|
-
const ours = await readFile(`${target}.craftspace-backup`, "utf8").catch(() => null) === null;
|
|
22318
|
-
if (emptied && ours)
|
|
22319
|
-
await rm(target, { force: true });
|
|
22320
|
-
else
|
|
22321
|
-
await writeFile(target, `${JSON.stringify(parsed, null, 2)}
|
|
22322
|
-
`, { mode: 384 });
|
|
22325
|
+
await migrate.stripGlobalMcp();
|
|
22323
22326
|
return true;
|
|
22324
22327
|
}
|
|
22325
22328
|
}
|
|
@@ -23685,6 +23688,7 @@ function trimEnd(text) {
|
|
|
23685
23688
|
async function wireRepos({ url: url2, token, dirs }) {
|
|
23686
23689
|
if (dirs.length === 0)
|
|
23687
23690
|
return;
|
|
23691
|
+
await migrate.stripGlobalMcp();
|
|
23688
23692
|
const server = { type: "http", url: `${url2}/mcp`, headers: { Authorization: `Bearer ${token}` } };
|
|
23689
23693
|
await editClaudeConfig((projects) => {
|
|
23690
23694
|
for (const dir of dirs) {
|
package/dist/machine.js
CHANGED
|
@@ -443,6 +443,7 @@ function trimEnd(text) {
|
|
|
443
443
|
async function wireRepos({ url, token, dirs }) {
|
|
444
444
|
if (dirs.length === 0)
|
|
445
445
|
return;
|
|
446
|
+
await migrate.stripGlobalMcp();
|
|
446
447
|
const server = { type: 'http', url: `${url}/mcp`, headers: { Authorization: `Bearer ${token}` } };
|
|
447
448
|
await editClaudeConfig((projects) => {
|
|
448
449
|
for (const dir of dirs) {
|
package/dist/migrate.d.ts
CHANGED
package/dist/migrate.js
CHANGED
|
@@ -4,6 +4,23 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
export const migrate = {
|
|
7
|
+
async stripGlobalMcp() {
|
|
8
|
+
const target = path.join(os.homedir(), '.mcp.json');
|
|
9
|
+
const raw = await readFile(target, 'utf8').catch(() => null);
|
|
10
|
+
if (raw === null)
|
|
11
|
+
return;
|
|
12
|
+
const parsed = JSON.parse(raw);
|
|
13
|
+
const servers = parsed.mcpServers;
|
|
14
|
+
if (typeof servers !== 'object' || servers === null || !('craftspace' in servers))
|
|
15
|
+
return;
|
|
16
|
+
delete servers.craftspace;
|
|
17
|
+
const emptied = Object.keys(servers).length === 0 && Object.keys(parsed).length === 1;
|
|
18
|
+
const ours = (await readFile(`${target}.craftspace-backup`, 'utf8').catch(() => null)) === null;
|
|
19
|
+
if (emptied && ours)
|
|
20
|
+
await rm(target, { force: true });
|
|
21
|
+
else
|
|
22
|
+
await writeFile(target, `${JSON.stringify(parsed, null, 2)}\n`, { mode: 0o600 });
|
|
23
|
+
},
|
|
7
24
|
async toLatest({ home, workDir }) {
|
|
8
25
|
const done = new Set(await alreadyRan(home));
|
|
9
26
|
const ran = [];
|
|
@@ -48,21 +65,7 @@ const STEPS = [
|
|
|
48
65
|
{
|
|
49
66
|
id: '0002-mcp-out-of-home',
|
|
50
67
|
async run() {
|
|
51
|
-
|
|
52
|
-
const raw = await readFile(target, 'utf8').catch(() => null);
|
|
53
|
-
if (raw === null)
|
|
54
|
-
return true;
|
|
55
|
-
const parsed = JSON.parse(raw);
|
|
56
|
-
const servers = parsed.mcpServers;
|
|
57
|
-
if (typeof servers !== 'object' || servers === null || !('craftspace' in servers))
|
|
58
|
-
return true;
|
|
59
|
-
delete servers.craftspace;
|
|
60
|
-
const emptied = Object.keys(servers).length === 0 && Object.keys(parsed).length === 1;
|
|
61
|
-
const ours = (await readFile(`${target}.craftspace-backup`, 'utf8').catch(() => null)) === null;
|
|
62
|
-
if (emptied && ours)
|
|
63
|
-
await rm(target, { force: true });
|
|
64
|
-
else
|
|
65
|
-
await writeFile(target, `${JSON.stringify(parsed, null, 2)}\n`, { mode: 0o600 });
|
|
68
|
+
await migrate.stripGlobalMcp();
|
|
66
69
|
return true;
|
|
67
70
|
},
|
|
68
71
|
},
|