dev-cockpit 0.2.1 → 0.2.2
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/CHANGELOG.md +58 -0
- package/README.md +22 -0
- package/dist/buildCli.d.ts.map +1 -1
- package/dist/chunk-C4GFJDMG.js +79 -0
- package/dist/chunk-C4GFJDMG.js.map +7 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/init-config.d.ts +2 -0
- package/dist/commands/init-config.d.ts.map +1 -1
- package/dist/commands/link.d.ts +20 -0
- package/dist/commands/link.d.ts.map +1 -0
- package/dist/commands/mount.d.ts.map +1 -1
- package/dist/core/config-discovery.d.ts +39 -0
- package/dist/core/config-discovery.d.ts.map +1 -0
- package/dist/core/manifest.d.ts +47 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/index.js +244 -137
- package/dist/index.js.map +4 -4
- package/dist/link-HXNII7EU.js +65 -0
- package/dist/link-HXNII7EU.js.map +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,11 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
require_react
|
|
17
17
|
} from "./chunk-VN6UILQW.js";
|
|
18
|
+
import {
|
|
19
|
+
canonical,
|
|
20
|
+
lookupConfig,
|
|
21
|
+
manifestPath
|
|
22
|
+
} from "./chunk-C4GFJDMG.js";
|
|
18
23
|
import {
|
|
19
24
|
__commonJS,
|
|
20
25
|
__export,
|
|
@@ -1197,7 +1202,7 @@ var require_atomic_sleep = __commonJS({
|
|
|
1197
1202
|
var require_sonic_boom = __commonJS({
|
|
1198
1203
|
"node_modules/sonic-boom/index.js"(exports, module) {
|
|
1199
1204
|
"use strict";
|
|
1200
|
-
var
|
|
1205
|
+
var fs18 = __require("fs");
|
|
1201
1206
|
var EventEmitter3 = __require("events");
|
|
1202
1207
|
var inherits = __require("util").inherits;
|
|
1203
1208
|
var path21 = __require("path");
|
|
@@ -1254,20 +1259,20 @@ var require_sonic_boom = __commonJS({
|
|
|
1254
1259
|
const mode = sonic.mode;
|
|
1255
1260
|
if (sonic.sync) {
|
|
1256
1261
|
try {
|
|
1257
|
-
if (sonic.mkdir)
|
|
1258
|
-
const fd =
|
|
1262
|
+
if (sonic.mkdir) fs18.mkdirSync(path21.dirname(file), { recursive: true });
|
|
1263
|
+
const fd = fs18.openSync(file, flags, mode);
|
|
1259
1264
|
fileOpened(null, fd);
|
|
1260
1265
|
} catch (err) {
|
|
1261
1266
|
fileOpened(err);
|
|
1262
1267
|
throw err;
|
|
1263
1268
|
}
|
|
1264
1269
|
} else if (sonic.mkdir) {
|
|
1265
|
-
|
|
1270
|
+
fs18.mkdir(path21.dirname(file), { recursive: true }, (err) => {
|
|
1266
1271
|
if (err) return fileOpened(err);
|
|
1267
|
-
|
|
1272
|
+
fs18.open(file, flags, mode, fileOpened);
|
|
1268
1273
|
});
|
|
1269
1274
|
} else {
|
|
1270
|
-
|
|
1275
|
+
fs18.open(file, flags, mode, fileOpened);
|
|
1271
1276
|
}
|
|
1272
1277
|
}
|
|
1273
1278
|
function SonicBoom(opts) {
|
|
@@ -1308,8 +1313,8 @@ var require_sonic_boom = __commonJS({
|
|
|
1308
1313
|
this.flush = flushBuffer;
|
|
1309
1314
|
this.flushSync = flushBufferSync;
|
|
1310
1315
|
this._actualWrite = actualWriteBuffer;
|
|
1311
|
-
fsWriteSync = () =>
|
|
1312
|
-
fsWrite = () =>
|
|
1316
|
+
fsWriteSync = () => fs18.writeSync(this.fd, this._writingBuf);
|
|
1317
|
+
fsWrite = () => fs18.write(this.fd, this._writingBuf, this.release);
|
|
1313
1318
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
1314
1319
|
this._writingBuf = "";
|
|
1315
1320
|
this.write = write;
|
|
@@ -1318,15 +1323,15 @@ var require_sonic_boom = __commonJS({
|
|
|
1318
1323
|
this._actualWrite = actualWrite;
|
|
1319
1324
|
fsWriteSync = () => {
|
|
1320
1325
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
1321
|
-
return
|
|
1326
|
+
return fs18.writeSync(this.fd, this._writingBuf);
|
|
1322
1327
|
}
|
|
1323
|
-
return
|
|
1328
|
+
return fs18.writeSync(this.fd, this._writingBuf, "utf8");
|
|
1324
1329
|
};
|
|
1325
1330
|
fsWrite = () => {
|
|
1326
1331
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
1327
|
-
return
|
|
1332
|
+
return fs18.write(this.fd, this._writingBuf, this.release);
|
|
1328
1333
|
}
|
|
1329
|
-
return
|
|
1334
|
+
return fs18.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
1330
1335
|
};
|
|
1331
1336
|
} else {
|
|
1332
1337
|
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
@@ -1383,7 +1388,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1383
1388
|
}
|
|
1384
1389
|
}
|
|
1385
1390
|
if (this._fsync) {
|
|
1386
|
-
|
|
1391
|
+
fs18.fsyncSync(this.fd);
|
|
1387
1392
|
}
|
|
1388
1393
|
const len = this._len;
|
|
1389
1394
|
if (this._reopening) {
|
|
@@ -1497,7 +1502,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1497
1502
|
const onDrain = () => {
|
|
1498
1503
|
if (!this._fsync) {
|
|
1499
1504
|
try {
|
|
1500
|
-
|
|
1505
|
+
fs18.fsync(this.fd, (err) => {
|
|
1501
1506
|
this._flushPending = false;
|
|
1502
1507
|
cb(err);
|
|
1503
1508
|
});
|
|
@@ -1599,7 +1604,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1599
1604
|
const fd = this.fd;
|
|
1600
1605
|
this.once("ready", () => {
|
|
1601
1606
|
if (fd !== this.fd) {
|
|
1602
|
-
|
|
1607
|
+
fs18.close(fd, (err) => {
|
|
1603
1608
|
if (err) {
|
|
1604
1609
|
return this.emit("error", err);
|
|
1605
1610
|
}
|
|
@@ -1648,7 +1653,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1648
1653
|
buf = this._bufs[0];
|
|
1649
1654
|
}
|
|
1650
1655
|
try {
|
|
1651
|
-
const n2 = Buffer.isBuffer(buf) ?
|
|
1656
|
+
const n2 = Buffer.isBuffer(buf) ? fs18.writeSync(this.fd, buf) : fs18.writeSync(this.fd, buf, "utf8");
|
|
1652
1657
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n2);
|
|
1653
1658
|
buf = releasedBufObj.writingBuf;
|
|
1654
1659
|
this._len = releasedBufObj.len;
|
|
@@ -1664,7 +1669,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1664
1669
|
}
|
|
1665
1670
|
}
|
|
1666
1671
|
try {
|
|
1667
|
-
|
|
1672
|
+
fs18.fsyncSync(this.fd);
|
|
1668
1673
|
} catch {
|
|
1669
1674
|
}
|
|
1670
1675
|
}
|
|
@@ -1685,7 +1690,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1685
1690
|
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
1686
1691
|
}
|
|
1687
1692
|
try {
|
|
1688
|
-
const n2 =
|
|
1693
|
+
const n2 = fs18.writeSync(this.fd, buf);
|
|
1689
1694
|
buf = buf.subarray(n2);
|
|
1690
1695
|
this._len = Math.max(this._len - n2, 0);
|
|
1691
1696
|
if (buf.length <= 0) {
|
|
@@ -1713,13 +1718,13 @@ var require_sonic_boom = __commonJS({
|
|
|
1713
1718
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
1714
1719
|
if (this.sync) {
|
|
1715
1720
|
try {
|
|
1716
|
-
const written = Buffer.isBuffer(this._writingBuf) ?
|
|
1721
|
+
const written = Buffer.isBuffer(this._writingBuf) ? fs18.writeSync(this.fd, this._writingBuf) : fs18.writeSync(this.fd, this._writingBuf, "utf8");
|
|
1717
1722
|
release(null, written);
|
|
1718
1723
|
} catch (err) {
|
|
1719
1724
|
release(err);
|
|
1720
1725
|
}
|
|
1721
1726
|
} else {
|
|
1722
|
-
|
|
1727
|
+
fs18.write(this.fd, this._writingBuf, release);
|
|
1723
1728
|
}
|
|
1724
1729
|
}
|
|
1725
1730
|
function actualWriteBuffer() {
|
|
@@ -1728,7 +1733,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1728
1733
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
1729
1734
|
if (this.sync) {
|
|
1730
1735
|
try {
|
|
1731
|
-
const written =
|
|
1736
|
+
const written = fs18.writeSync(this.fd, this._writingBuf);
|
|
1732
1737
|
release(null, written);
|
|
1733
1738
|
} catch (err) {
|
|
1734
1739
|
release(err);
|
|
@@ -1737,7 +1742,7 @@ var require_sonic_boom = __commonJS({
|
|
|
1737
1742
|
if (kCopyBuffer) {
|
|
1738
1743
|
this._writingBuf = Buffer.from(this._writingBuf);
|
|
1739
1744
|
}
|
|
1740
|
-
|
|
1745
|
+
fs18.write(this.fd, this._writingBuf, release);
|
|
1741
1746
|
}
|
|
1742
1747
|
}
|
|
1743
1748
|
function actualClose(sonic) {
|
|
@@ -1753,12 +1758,12 @@ var require_sonic_boom = __commonJS({
|
|
|
1753
1758
|
sonic._lens = [];
|
|
1754
1759
|
assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
1755
1760
|
try {
|
|
1756
|
-
|
|
1761
|
+
fs18.fsync(sonic.fd, closeWrapped);
|
|
1757
1762
|
} catch {
|
|
1758
1763
|
}
|
|
1759
1764
|
function closeWrapped() {
|
|
1760
1765
|
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
|
1761
|
-
|
|
1766
|
+
fs18.close(sonic.fd, done);
|
|
1762
1767
|
} else {
|
|
1763
1768
|
done();
|
|
1764
1769
|
}
|
|
@@ -4332,7 +4337,7 @@ var require_windows = __commonJS({
|
|
|
4332
4337
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
4333
4338
|
module.exports = isexe;
|
|
4334
4339
|
isexe.sync = sync;
|
|
4335
|
-
var
|
|
4340
|
+
var fs18 = __require("fs");
|
|
4336
4341
|
function checkPathExt(path21, options2) {
|
|
4337
4342
|
var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
|
|
4338
4343
|
if (!pathext) {
|
|
@@ -4357,12 +4362,12 @@ var require_windows = __commonJS({
|
|
|
4357
4362
|
return checkPathExt(path21, options2);
|
|
4358
4363
|
}
|
|
4359
4364
|
function isexe(path21, options2, cb) {
|
|
4360
|
-
|
|
4365
|
+
fs18.stat(path21, function(er, stat4) {
|
|
4361
4366
|
cb(er, er ? false : checkStat(stat4, path21, options2));
|
|
4362
4367
|
});
|
|
4363
4368
|
}
|
|
4364
4369
|
function sync(path21, options2) {
|
|
4365
|
-
return checkStat(
|
|
4370
|
+
return checkStat(fs18.statSync(path21), path21, options2);
|
|
4366
4371
|
}
|
|
4367
4372
|
}
|
|
4368
4373
|
});
|
|
@@ -4372,14 +4377,14 @@ var require_mode = __commonJS({
|
|
|
4372
4377
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
4373
4378
|
module.exports = isexe;
|
|
4374
4379
|
isexe.sync = sync;
|
|
4375
|
-
var
|
|
4380
|
+
var fs18 = __require("fs");
|
|
4376
4381
|
function isexe(path21, options2, cb) {
|
|
4377
|
-
|
|
4382
|
+
fs18.stat(path21, function(er, stat4) {
|
|
4378
4383
|
cb(er, er ? false : checkStat(stat4, options2));
|
|
4379
4384
|
});
|
|
4380
4385
|
}
|
|
4381
4386
|
function sync(path21, options2) {
|
|
4382
|
-
return checkStat(
|
|
4387
|
+
return checkStat(fs18.statSync(path21), options2);
|
|
4383
4388
|
}
|
|
4384
4389
|
function checkStat(stat4, options2) {
|
|
4385
4390
|
return stat4.isFile() && checkMode(stat4, options2);
|
|
@@ -4403,7 +4408,7 @@ var require_mode = __commonJS({
|
|
|
4403
4408
|
// node_modules/isexe/index.js
|
|
4404
4409
|
var require_isexe = __commonJS({
|
|
4405
4410
|
"node_modules/isexe/index.js"(exports, module) {
|
|
4406
|
-
var
|
|
4411
|
+
var fs18 = __require("fs");
|
|
4407
4412
|
var core;
|
|
4408
4413
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
4409
4414
|
core = require_windows();
|
|
@@ -4667,16 +4672,16 @@ var require_shebang_command = __commonJS({
|
|
|
4667
4672
|
var require_readShebang = __commonJS({
|
|
4668
4673
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
4669
4674
|
"use strict";
|
|
4670
|
-
var
|
|
4675
|
+
var fs18 = __require("fs");
|
|
4671
4676
|
var shebangCommand = require_shebang_command();
|
|
4672
4677
|
function readShebang(command) {
|
|
4673
4678
|
const size = 150;
|
|
4674
4679
|
const buffer = Buffer.alloc(size);
|
|
4675
4680
|
let fd;
|
|
4676
4681
|
try {
|
|
4677
|
-
fd =
|
|
4678
|
-
|
|
4679
|
-
|
|
4682
|
+
fd = fs18.openSync(command, "r");
|
|
4683
|
+
fs18.readSync(fd, buffer, 0, size, 0);
|
|
4684
|
+
fs18.closeSync(fd);
|
|
4680
4685
|
} catch (e) {
|
|
4681
4686
|
}
|
|
4682
4687
|
return shebangCommand(buffer.toString());
|
|
@@ -11683,14 +11688,14 @@ var require_parser = __commonJS({
|
|
|
11683
11688
|
case "scalar":
|
|
11684
11689
|
case "single-quoted-scalar":
|
|
11685
11690
|
case "double-quoted-scalar": {
|
|
11686
|
-
const
|
|
11691
|
+
const fs18 = this.flowScalar(this.type);
|
|
11687
11692
|
if (atNextItem || it.value) {
|
|
11688
|
-
map.items.push({ start, key:
|
|
11693
|
+
map.items.push({ start, key: fs18, sep: [] });
|
|
11689
11694
|
this.onKeyLine = true;
|
|
11690
11695
|
} else if (it.sep) {
|
|
11691
|
-
this.stack.push(
|
|
11696
|
+
this.stack.push(fs18);
|
|
11692
11697
|
} else {
|
|
11693
|
-
Object.assign(it, { key:
|
|
11698
|
+
Object.assign(it, { key: fs18, sep: [] });
|
|
11694
11699
|
this.onKeyLine = true;
|
|
11695
11700
|
}
|
|
11696
11701
|
return;
|
|
@@ -11818,13 +11823,13 @@ var require_parser = __commonJS({
|
|
|
11818
11823
|
case "scalar":
|
|
11819
11824
|
case "single-quoted-scalar":
|
|
11820
11825
|
case "double-quoted-scalar": {
|
|
11821
|
-
const
|
|
11826
|
+
const fs18 = this.flowScalar(this.type);
|
|
11822
11827
|
if (!it || it.value)
|
|
11823
|
-
fc.items.push({ start: [], key:
|
|
11828
|
+
fc.items.push({ start: [], key: fs18, sep: [] });
|
|
11824
11829
|
else if (it.sep)
|
|
11825
|
-
this.stack.push(
|
|
11830
|
+
this.stack.push(fs18);
|
|
11826
11831
|
else
|
|
11827
|
-
Object.assign(it, { key:
|
|
11832
|
+
Object.assign(it, { key: fs18, sep: [] });
|
|
11828
11833
|
return;
|
|
11829
11834
|
}
|
|
11830
11835
|
case "flow-map-end":
|
|
@@ -13066,7 +13071,7 @@ var require_command = __commonJS({
|
|
|
13066
13071
|
var EventEmitter3 = __require("node:events").EventEmitter;
|
|
13067
13072
|
var childProcess = __require("node:child_process");
|
|
13068
13073
|
var path21 = __require("node:path");
|
|
13069
|
-
var
|
|
13074
|
+
var fs18 = __require("node:fs");
|
|
13070
13075
|
var process10 = __require("node:process");
|
|
13071
13076
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
13072
13077
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -13999,10 +14004,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
13999
14004
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
14000
14005
|
function findFile(baseDir, baseName) {
|
|
14001
14006
|
const localBin = path21.resolve(baseDir, baseName);
|
|
14002
|
-
if (
|
|
14007
|
+
if (fs18.existsSync(localBin)) return localBin;
|
|
14003
14008
|
if (sourceExt.includes(path21.extname(baseName))) return void 0;
|
|
14004
14009
|
const foundExt = sourceExt.find(
|
|
14005
|
-
(ext) =>
|
|
14010
|
+
(ext) => fs18.existsSync(`${localBin}${ext}`)
|
|
14006
14011
|
);
|
|
14007
14012
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
14008
14013
|
return void 0;
|
|
@@ -14014,7 +14019,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
14014
14019
|
if (this._scriptPath) {
|
|
14015
14020
|
let resolvedScriptPath;
|
|
14016
14021
|
try {
|
|
14017
|
-
resolvedScriptPath =
|
|
14022
|
+
resolvedScriptPath = fs18.realpathSync(this._scriptPath);
|
|
14018
14023
|
} catch (err) {
|
|
14019
14024
|
resolvedScriptPath = this._scriptPath;
|
|
14020
14025
|
}
|
|
@@ -90787,8 +90792,8 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
|
90787
90792
|
import { dirname as dirname3, join as join3 } from "node:path";
|
|
90788
90793
|
|
|
90789
90794
|
// src/commands/dev.ts
|
|
90790
|
-
import
|
|
90791
|
-
import
|
|
90795
|
+
import path14 from "node:path";
|
|
90796
|
+
import fs9 from "node:fs";
|
|
90792
90797
|
|
|
90793
90798
|
// src/actions/registry.ts
|
|
90794
90799
|
function buildActionRegistry(configActions, profileActions = []) {
|
|
@@ -90798,23 +90803,78 @@ function buildActionRegistry(configActions, profileActions = []) {
|
|
|
90798
90803
|
return Array.from(byId.values());
|
|
90799
90804
|
}
|
|
90800
90805
|
|
|
90806
|
+
// src/core/config-discovery.ts
|
|
90807
|
+
import fs8 from "node:fs";
|
|
90808
|
+
import path13 from "node:path";
|
|
90809
|
+
var DiscoveryError = class extends Error {
|
|
90810
|
+
constructor(workspaceRoot) {
|
|
90811
|
+
super(
|
|
90812
|
+
`dev-cockpit: no cockpit.yaml found at ${workspaceRoot}/cockpit.yaml and no entry in ${manifestPath()}. Run \`dev-cockpit link <config-path>\` from this directory to register one, or pass --config <path>.`
|
|
90813
|
+
);
|
|
90814
|
+
this.workspaceRoot = workspaceRoot;
|
|
90815
|
+
this.name = "DiscoveryError";
|
|
90816
|
+
}
|
|
90817
|
+
};
|
|
90818
|
+
function discoverConfig(opts = {}) {
|
|
90819
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
90820
|
+
const envConfig = opts.envConfig ?? process.env["DEV_COCKPIT_CONFIG"];
|
|
90821
|
+
const profileRoot = opts.workspaceDiscoverer?.()?.root;
|
|
90822
|
+
const workspaceRoot = profileRoot ? canonical(profileRoot) : canonical(cwd);
|
|
90823
|
+
if (opts.cliConfig) {
|
|
90824
|
+
return {
|
|
90825
|
+
configPath: path13.resolve(cwd, opts.cliConfig),
|
|
90826
|
+
workspaceRoot,
|
|
90827
|
+
source: "cli"
|
|
90828
|
+
};
|
|
90829
|
+
}
|
|
90830
|
+
if (envConfig) {
|
|
90831
|
+
return {
|
|
90832
|
+
configPath: path13.resolve(cwd, envConfig),
|
|
90833
|
+
workspaceRoot,
|
|
90834
|
+
source: "env"
|
|
90835
|
+
};
|
|
90836
|
+
}
|
|
90837
|
+
const localConfig = path13.join(workspaceRoot, "cockpit.yaml");
|
|
90838
|
+
if (fs8.existsSync(localConfig)) {
|
|
90839
|
+
return { configPath: localConfig, workspaceRoot, source: "workspace" };
|
|
90840
|
+
}
|
|
90841
|
+
const mapped = lookupConfig(workspaceRoot);
|
|
90842
|
+
if (mapped) {
|
|
90843
|
+
return { configPath: mapped, workspaceRoot, source: "manifest" };
|
|
90844
|
+
}
|
|
90845
|
+
throw new DiscoveryError(workspaceRoot);
|
|
90846
|
+
}
|
|
90847
|
+
|
|
90801
90848
|
// src/commands/dev.ts
|
|
90802
90849
|
async function devCommand(opts = {}) {
|
|
90803
|
-
const
|
|
90804
|
-
|
|
90850
|
+
const profile = opts.profile;
|
|
90851
|
+
let configPath;
|
|
90852
|
+
let workspaceRoot;
|
|
90853
|
+
try {
|
|
90854
|
+
const result = discoverConfig({
|
|
90855
|
+
cliConfig: opts.config,
|
|
90856
|
+
workspaceDiscoverer: profile?.discoverer
|
|
90857
|
+
});
|
|
90858
|
+
configPath = result.configPath;
|
|
90859
|
+
workspaceRoot = result.workspaceRoot;
|
|
90860
|
+
} catch (err) {
|
|
90861
|
+
if (err instanceof DiscoveryError) {
|
|
90862
|
+
process.stderr.write(`${err.message}
|
|
90863
|
+
`);
|
|
90864
|
+
process.exit(1);
|
|
90865
|
+
}
|
|
90866
|
+
throw err;
|
|
90867
|
+
}
|
|
90868
|
+
if (!fs9.existsSync(configPath)) {
|
|
90805
90869
|
process.stderr.write(
|
|
90806
|
-
`dev-cockpit:
|
|
90807
|
-
Run \`dev-cockpit init-config\` to scaffold one.
|
|
90808
|
-
`
|
|
90870
|
+
`dev-cockpit: cockpit.yaml at ${configPath} doesn't exist (resolved via --config DEV_COCKPIT_CONFIG / link).`
|
|
90809
90871
|
);
|
|
90810
90872
|
process.exit(1);
|
|
90811
90873
|
}
|
|
90812
|
-
const profile = opts.profile;
|
|
90813
90874
|
const config = loadConfig(configPath, {
|
|
90814
90875
|
configSchemaExt: profile?.configSchemaExt,
|
|
90815
90876
|
profileKey: profile?.appName
|
|
90816
90877
|
});
|
|
90817
|
-
const workspaceRoot = profile?.discoverer?.()?.root ?? path13.dirname(configPath);
|
|
90818
90878
|
const seededRepos = {};
|
|
90819
90879
|
const seededOrder = [];
|
|
90820
90880
|
for (const repo of config.repos) {
|
|
@@ -90886,7 +90946,7 @@ async function devCommand(opts = {}) {
|
|
|
90886
90946
|
});
|
|
90887
90947
|
};
|
|
90888
90948
|
spawnStream(shell, [shellFlag, proc.command], {
|
|
90889
|
-
cwd: proc.cwd ?
|
|
90949
|
+
cwd: proc.cwd ? path14.resolve(workspaceRoot, proc.cwd) : workspaceRoot,
|
|
90890
90950
|
env: proc.env,
|
|
90891
90951
|
tag: proc.id,
|
|
90892
90952
|
onStdout: (line2) => emit(line2, "info"),
|
|
@@ -90958,7 +91018,7 @@ async function devCommand(opts = {}) {
|
|
|
90958
91018
|
});
|
|
90959
91019
|
return;
|
|
90960
91020
|
}
|
|
90961
|
-
const cwd = action.cwd ?
|
|
91021
|
+
const cwd = action.cwd ? path14.resolve(workspaceRoot, action.cwd) : workspaceRoot;
|
|
90962
91022
|
store.appendOutput({
|
|
90963
91023
|
ts: Date.now(),
|
|
90964
91024
|
source: action.id,
|
|
@@ -91024,8 +91084,7 @@ async function devCommand(opts = {}) {
|
|
|
91024
91084
|
}
|
|
91025
91085
|
|
|
91026
91086
|
// src/commands/doctor.ts
|
|
91027
|
-
import
|
|
91028
|
-
import fs9 from "node:fs";
|
|
91087
|
+
import fs10 from "node:fs";
|
|
91029
91088
|
var GLYPH = {
|
|
91030
91089
|
ok: "\u2713",
|
|
91031
91090
|
warn: "\u26A0",
|
|
@@ -91053,18 +91112,34 @@ function formatResults(results, appName) {
|
|
|
91053
91112
|
return { lines, exitCode: anyError ? 1 : 0 };
|
|
91054
91113
|
}
|
|
91055
91114
|
async function doctorCommand(opts = {}) {
|
|
91056
|
-
const
|
|
91057
|
-
|
|
91058
|
-
|
|
91115
|
+
const profile = opts.profile;
|
|
91116
|
+
let configPath;
|
|
91117
|
+
let workspaceRoot;
|
|
91118
|
+
try {
|
|
91119
|
+
const result = discoverConfig({
|
|
91120
|
+
cliConfig: opts.config,
|
|
91121
|
+
workspaceDiscoverer: profile?.discoverer
|
|
91122
|
+
});
|
|
91123
|
+
configPath = result.configPath;
|
|
91124
|
+
workspaceRoot = result.workspaceRoot;
|
|
91125
|
+
} catch (err) {
|
|
91126
|
+
if (err instanceof DiscoveryError) {
|
|
91127
|
+
process.stderr.write(`${err.message}
|
|
91059
91128
|
`);
|
|
91129
|
+
process.exit(1);
|
|
91130
|
+
}
|
|
91131
|
+
throw err;
|
|
91132
|
+
}
|
|
91133
|
+
if (!fs10.existsSync(configPath)) {
|
|
91134
|
+
process.stderr.write(
|
|
91135
|
+
`dev-cockpit: cockpit.yaml at ${configPath} doesn't exist (resolved via --config DEV_COCKPIT_CONFIG / link).`
|
|
91136
|
+
);
|
|
91060
91137
|
process.exit(1);
|
|
91061
91138
|
}
|
|
91062
|
-
const profile = opts.profile;
|
|
91063
91139
|
const config = loadConfig(configPath, {
|
|
91064
91140
|
configSchemaExt: profile?.configSchemaExt,
|
|
91065
91141
|
profileKey: profile?.appName
|
|
91066
91142
|
});
|
|
91067
|
-
const workspaceRoot = profile?.discoverer?.()?.root ?? path14.dirname(configPath);
|
|
91068
91143
|
const ctx = buildHealthContext(workspaceRoot);
|
|
91069
91144
|
const registry = buildHealthRegistry({
|
|
91070
91145
|
profileChecks: profile?.healthChecks,
|
|
@@ -91080,11 +91155,11 @@ async function doctorCommand(opts = {}) {
|
|
|
91080
91155
|
}
|
|
91081
91156
|
|
|
91082
91157
|
// src/commands/init-config.ts
|
|
91083
|
-
import
|
|
91158
|
+
import fs12 from "node:fs";
|
|
91084
91159
|
import path16 from "node:path";
|
|
91085
91160
|
|
|
91086
91161
|
// src/commands/init-config-wizard.ts
|
|
91087
|
-
import
|
|
91162
|
+
import fs11 from "node:fs";
|
|
91088
91163
|
import path15 from "node:path";
|
|
91089
91164
|
function indent(line2, level) {
|
|
91090
91165
|
return " ".repeat(level) + line2;
|
|
@@ -91266,20 +91341,20 @@ function showSummary(result) {
|
|
|
91266
91341
|
}
|
|
91267
91342
|
function safeReadJson(p) {
|
|
91268
91343
|
try {
|
|
91269
|
-
return JSON.parse(
|
|
91344
|
+
return JSON.parse(fs11.readFileSync(p, "utf8"));
|
|
91270
91345
|
} catch {
|
|
91271
91346
|
return null;
|
|
91272
91347
|
}
|
|
91273
91348
|
}
|
|
91274
91349
|
function detectComposeFile(cwd) {
|
|
91275
91350
|
for (const candidate of ["compose.yaml", "compose.yml", "docker-compose.yml", "docker-compose.yaml"]) {
|
|
91276
|
-
if (
|
|
91351
|
+
if (fs11.existsSync(path15.join(cwd, candidate))) return candidate;
|
|
91277
91352
|
}
|
|
91278
91353
|
return void 0;
|
|
91279
91354
|
}
|
|
91280
91355
|
function parseComposeServices(cwd, composeFile) {
|
|
91281
91356
|
try {
|
|
91282
|
-
const text =
|
|
91357
|
+
const text = fs11.readFileSync(path15.join(cwd, composeFile), "utf8");
|
|
91283
91358
|
const out = [];
|
|
91284
91359
|
let inServices = false;
|
|
91285
91360
|
for (const raw of text.split("\n")) {
|
|
@@ -91314,9 +91389,9 @@ function detectRepoSuggestions(cwd, pkg) {
|
|
|
91314
91389
|
}
|
|
91315
91390
|
}
|
|
91316
91391
|
const pnpmFile = path15.join(cwd, "pnpm-workspace.yaml");
|
|
91317
|
-
if (
|
|
91392
|
+
if (fs11.existsSync(pnpmFile)) {
|
|
91318
91393
|
try {
|
|
91319
|
-
const text =
|
|
91394
|
+
const text = fs11.readFileSync(pnpmFile, "utf8");
|
|
91320
91395
|
const inPackages = /packages:\s*([\s\S]*?)(?:\n[a-zA-Z]|$)/.exec(text);
|
|
91321
91396
|
if (inPackages?.[1]) {
|
|
91322
91397
|
for (const line2 of inPackages[1].split("\n")) {
|
|
@@ -91341,15 +91416,15 @@ function detectRepoSuggestions(cwd, pkg) {
|
|
|
91341
91416
|
}
|
|
91342
91417
|
function expandSimpleGlob(cwd, glob) {
|
|
91343
91418
|
if (!glob.includes("*")) {
|
|
91344
|
-
return
|
|
91419
|
+
return fs11.existsSync(path15.join(cwd, glob)) ? [glob] : [];
|
|
91345
91420
|
}
|
|
91346
91421
|
const m = /^([^*]+?)\/?\*$/.exec(glob);
|
|
91347
91422
|
if (!m?.[1]) return [];
|
|
91348
91423
|
const baseRel = m[1];
|
|
91349
91424
|
const baseAbs = path15.join(cwd, baseRel);
|
|
91350
|
-
if (!
|
|
91425
|
+
if (!fs11.existsSync(baseAbs)) return [];
|
|
91351
91426
|
try {
|
|
91352
|
-
return
|
|
91427
|
+
return fs11.readdirSync(baseAbs, { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => path15.posix.join(baseRel, d.name));
|
|
91353
91428
|
} catch {
|
|
91354
91429
|
return [];
|
|
91355
91430
|
}
|
|
@@ -91365,8 +91440,8 @@ function gatherHints(cwd) {
|
|
|
91365
91440
|
packageJsonScripts: pkgScripts,
|
|
91366
91441
|
composeFile,
|
|
91367
91442
|
composeServices,
|
|
91368
|
-
hasArtisan:
|
|
91369
|
-
hasComposerJson:
|
|
91443
|
+
hasArtisan: fs11.existsSync(path15.join(cwd, "artisan")),
|
|
91444
|
+
hasComposerJson: fs11.existsSync(path15.join(cwd, "composer.json")),
|
|
91370
91445
|
repoSuggestions: detectRepoSuggestions(cwd, pkg)
|
|
91371
91446
|
};
|
|
91372
91447
|
}
|
|
@@ -92092,8 +92167,8 @@ ${dockerBlock}
|
|
|
92092
92167
|
}
|
|
92093
92168
|
async function initConfigCommand(opts = {}) {
|
|
92094
92169
|
const cwd = opts.cwd ?? process.cwd();
|
|
92095
|
-
const target = path16.join(cwd, "cockpit.yaml");
|
|
92096
|
-
const exists =
|
|
92170
|
+
const target = opts.output ? path16.resolve(cwd, opts.output) : path16.join(cwd, "cockpit.yaml");
|
|
92171
|
+
const exists = fs12.existsSync(target);
|
|
92097
92172
|
if (exists && !opts.force) {
|
|
92098
92173
|
process.stdout.write(
|
|
92099
92174
|
`dev-cockpit init-config: ${target} already exists.
|
|
@@ -92112,7 +92187,7 @@ async function initConfigCommand(opts = {}) {
|
|
|
92112
92187
|
withDocker: opts.withDocker ?? false,
|
|
92113
92188
|
appName: opts.appName ?? "my-cockpit"
|
|
92114
92189
|
});
|
|
92115
|
-
|
|
92190
|
+
fs12.writeFileSync(target, content, "utf8");
|
|
92116
92191
|
process.stdout.write(`
|
|
92117
92192
|
dev-cockpit init-config: wrote ${target}
|
|
92118
92193
|
`);
|
|
@@ -92147,10 +92222,10 @@ doctor failed: ${err instanceof Error ? err.message : String(err)}
|
|
|
92147
92222
|
|
|
92148
92223
|
// src/commands/mount.ts
|
|
92149
92224
|
import path19 from "node:path";
|
|
92150
|
-
import
|
|
92225
|
+
import fs15 from "node:fs";
|
|
92151
92226
|
|
|
92152
92227
|
// src/mount/manifest.ts
|
|
92153
|
-
import
|
|
92228
|
+
import fs13 from "node:fs";
|
|
92154
92229
|
import path17 from "node:path";
|
|
92155
92230
|
var CURRENT_MANIFEST_VERSION = 1;
|
|
92156
92231
|
var MountManifestError = class extends Error {
|
|
@@ -92159,24 +92234,24 @@ var MountManifestError = class extends Error {
|
|
|
92159
92234
|
this.name = "MountManifestError";
|
|
92160
92235
|
}
|
|
92161
92236
|
};
|
|
92162
|
-
function readMountManifest(
|
|
92163
|
-
if (!
|
|
92237
|
+
function readMountManifest(manifestPath2) {
|
|
92238
|
+
if (!fs13.existsSync(manifestPath2)) return null;
|
|
92164
92239
|
let raw;
|
|
92165
92240
|
try {
|
|
92166
|
-
raw = JSON.parse(
|
|
92241
|
+
raw = JSON.parse(fs13.readFileSync(manifestPath2, "utf8"));
|
|
92167
92242
|
} catch (err) {
|
|
92168
|
-
throw new MountManifestError(
|
|
92243
|
+
throw new MountManifestError(manifestPath2, `JSON parse error: ${String(err)}`);
|
|
92169
92244
|
}
|
|
92170
|
-
validateMountManifest(
|
|
92245
|
+
validateMountManifest(manifestPath2, raw);
|
|
92171
92246
|
return raw;
|
|
92172
92247
|
}
|
|
92173
|
-
function writeMountManifest(
|
|
92174
|
-
|
|
92175
|
-
|
|
92248
|
+
function writeMountManifest(manifestPath2, manifest) {
|
|
92249
|
+
fs13.mkdirSync(path17.dirname(manifestPath2), { recursive: true });
|
|
92250
|
+
fs13.writeFileSync(manifestPath2, JSON.stringify(manifest, null, 2), "utf8");
|
|
92176
92251
|
}
|
|
92177
|
-
function deleteMountManifest(
|
|
92178
|
-
if (!
|
|
92179
|
-
|
|
92252
|
+
function deleteMountManifest(manifestPath2) {
|
|
92253
|
+
if (!fs13.existsSync(manifestPath2)) return false;
|
|
92254
|
+
fs13.rmSync(manifestPath2);
|
|
92180
92255
|
return true;
|
|
92181
92256
|
}
|
|
92182
92257
|
function validateMountManifest(filePath, raw) {
|
|
@@ -92233,7 +92308,7 @@ function renderDockerOverlay(mounts, opts) {
|
|
|
92233
92308
|
}
|
|
92234
92309
|
|
|
92235
92310
|
// src/mount/symlinks.ts
|
|
92236
|
-
import
|
|
92311
|
+
import fs14 from "node:fs";
|
|
92237
92312
|
import path18 from "node:path";
|
|
92238
92313
|
function applyManagedSymlinks(workspaceRoot, mounts, strategy) {
|
|
92239
92314
|
const report = { created: [], skipped: [] };
|
|
@@ -92241,24 +92316,24 @@ function applyManagedSymlinks(workspaceRoot, mounts, strategy) {
|
|
|
92241
92316
|
const linkPath = strategy.linkPath(m, workspaceRoot);
|
|
92242
92317
|
if (!linkPath) continue;
|
|
92243
92318
|
try {
|
|
92244
|
-
const lstat3 =
|
|
92319
|
+
const lstat3 = fs14.lstatSync(linkPath);
|
|
92245
92320
|
if (lstat3.isSymbolicLink()) {
|
|
92246
|
-
const existing =
|
|
92321
|
+
const existing = fs14.readlinkSync(linkPath);
|
|
92247
92322
|
if (existing === m.hostPath) {
|
|
92248
92323
|
report.created.push(linkPath);
|
|
92249
92324
|
continue;
|
|
92250
92325
|
}
|
|
92251
|
-
|
|
92326
|
+
fs14.unlinkSync(linkPath);
|
|
92252
92327
|
} else if (lstat3.isDirectory()) {
|
|
92253
92328
|
report.skipped.push(linkPath);
|
|
92254
92329
|
continue;
|
|
92255
92330
|
} else {
|
|
92256
|
-
|
|
92331
|
+
fs14.unlinkSync(linkPath);
|
|
92257
92332
|
}
|
|
92258
92333
|
} catch {
|
|
92259
92334
|
}
|
|
92260
|
-
|
|
92261
|
-
|
|
92335
|
+
fs14.mkdirSync(path18.dirname(linkPath), { recursive: true });
|
|
92336
|
+
fs14.symlinkSync(m.hostPath, linkPath);
|
|
92262
92337
|
report.created.push(linkPath);
|
|
92263
92338
|
}
|
|
92264
92339
|
return report;
|
|
@@ -92268,8 +92343,8 @@ function removeManagedSymlinks(workspaceRoot, mounts, strategy) {
|
|
|
92268
92343
|
const linkPath = strategy.linkPath(m, workspaceRoot);
|
|
92269
92344
|
if (!linkPath) continue;
|
|
92270
92345
|
try {
|
|
92271
|
-
const lstat3 =
|
|
92272
|
-
if (lstat3.isSymbolicLink())
|
|
92346
|
+
const lstat3 = fs14.lstatSync(linkPath);
|
|
92347
|
+
if (lstat3.isSymbolicLink()) fs14.unlinkSync(linkPath);
|
|
92273
92348
|
} catch {
|
|
92274
92349
|
}
|
|
92275
92350
|
}
|
|
@@ -92281,7 +92356,7 @@ function detectBrokenSymlinks(workspaceRoot, mounts, strategy) {
|
|
|
92281
92356
|
if (!linkPath) continue;
|
|
92282
92357
|
let lstat3 = null;
|
|
92283
92358
|
try {
|
|
92284
|
-
lstat3 =
|
|
92359
|
+
lstat3 = fs14.lstatSync(linkPath);
|
|
92285
92360
|
} catch {
|
|
92286
92361
|
broken.push({ linkPath, intendedTarget: m.hostPath, reason: "missing", mount: m });
|
|
92287
92362
|
continue;
|
|
@@ -92291,7 +92366,7 @@ function detectBrokenSymlinks(workspaceRoot, mounts, strategy) {
|
|
|
92291
92366
|
continue;
|
|
92292
92367
|
}
|
|
92293
92368
|
try {
|
|
92294
|
-
|
|
92369
|
+
fs14.statSync(linkPath);
|
|
92295
92370
|
} catch {
|
|
92296
92371
|
broken.push({ linkPath, intendedTarget: m.hostPath, reason: "broken", mount: m });
|
|
92297
92372
|
}
|
|
@@ -92339,17 +92414,34 @@ function mergeMounts(configMounts, providerMounts) {
|
|
|
92339
92414
|
}
|
|
92340
92415
|
async function resolveContext(opts) {
|
|
92341
92416
|
const profile = opts.profile;
|
|
92342
|
-
|
|
92343
|
-
|
|
92344
|
-
|
|
92417
|
+
let configPath;
|
|
92418
|
+
let workspaceRoot;
|
|
92419
|
+
try {
|
|
92420
|
+
const result = discoverConfig({
|
|
92421
|
+
cliConfig: opts.config,
|
|
92422
|
+
workspaceDiscoverer: profile?.discoverer
|
|
92423
|
+
});
|
|
92424
|
+
configPath = result.configPath;
|
|
92425
|
+
workspaceRoot = result.workspaceRoot;
|
|
92426
|
+
} catch (err) {
|
|
92427
|
+
if (err instanceof DiscoveryError) {
|
|
92428
|
+
process.stderr.write(`${err.message}
|
|
92345
92429
|
`);
|
|
92430
|
+
process.exit(1);
|
|
92431
|
+
}
|
|
92432
|
+
throw err;
|
|
92433
|
+
}
|
|
92434
|
+
if (!fs15.existsSync(configPath)) {
|
|
92435
|
+
process.stderr.write(
|
|
92436
|
+
`dev-cockpit mount: cockpit.yaml at ${configPath} doesn't exist.
|
|
92437
|
+
`
|
|
92438
|
+
);
|
|
92346
92439
|
process.exit(1);
|
|
92347
92440
|
}
|
|
92348
92441
|
const config = loadConfig(configPath, {
|
|
92349
92442
|
configSchemaExt: profile?.configSchemaExt,
|
|
92350
92443
|
profileKey: profile?.appName
|
|
92351
92444
|
});
|
|
92352
|
-
const workspaceRoot = profile?.discoverer?.()?.root ?? path19.dirname(configPath);
|
|
92353
92445
|
const explicitService = opts.service ?? config.docker?.services?.[0]?.name;
|
|
92354
92446
|
if (!explicitService) {
|
|
92355
92447
|
process.stderr.write(
|
|
@@ -92360,7 +92452,7 @@ async function resolveContext(opts) {
|
|
|
92360
92452
|
const providerMounts = await profile?.mountCandidatesProvider?.() ?? [];
|
|
92361
92453
|
const overlayPath = path19.resolve(workspaceRoot, config.mount.overlayPath);
|
|
92362
92454
|
const paths = getStatePaths(workspaceRoot, { appName: config.appName });
|
|
92363
|
-
const
|
|
92455
|
+
const manifestPath2 = path19.join(paths.stateDir, config.mount.manifestFile);
|
|
92364
92456
|
return {
|
|
92365
92457
|
configPath,
|
|
92366
92458
|
workspaceRoot,
|
|
@@ -92369,7 +92461,7 @@ async function resolveContext(opts) {
|
|
|
92369
92461
|
configMounts: config.mounts,
|
|
92370
92462
|
providerMounts,
|
|
92371
92463
|
overlayPath,
|
|
92372
|
-
manifestPath,
|
|
92464
|
+
manifestPath: manifestPath2,
|
|
92373
92465
|
profile
|
|
92374
92466
|
};
|
|
92375
92467
|
}
|
|
@@ -92400,7 +92492,7 @@ async function pickMounts(candidates) {
|
|
|
92400
92492
|
}
|
|
92401
92493
|
async function mountCommand(opts = {}) {
|
|
92402
92494
|
const ctx = await resolveContext(opts);
|
|
92403
|
-
const { workspaceRoot, appName, service, configMounts, providerMounts, overlayPath, manifestPath, profile } = ctx;
|
|
92495
|
+
const { workspaceRoot, appName, service, configMounts, providerMounts, overlayPath, manifestPath: manifestPath2, profile } = ctx;
|
|
92404
92496
|
const merged = applyExclude(mergeMounts(configMounts, providerMounts), opts.exclude ?? []);
|
|
92405
92497
|
if (merged.length === 0) {
|
|
92406
92498
|
process.stdout.write(
|
|
@@ -92422,11 +92514,11 @@ async function mountCommand(opts = {}) {
|
|
|
92422
92514
|
return;
|
|
92423
92515
|
}
|
|
92424
92516
|
}
|
|
92425
|
-
|
|
92426
|
-
|
|
92517
|
+
fs15.mkdirSync(path19.dirname(overlayPath), { recursive: true });
|
|
92518
|
+
fs15.writeFileSync(overlayPath, renderDockerOverlay(selected, { service }), "utf8");
|
|
92427
92519
|
process.stdout.write(`dev-cockpit mount: wrote ${overlayPath}
|
|
92428
92520
|
`);
|
|
92429
|
-
writeMountManifest(
|
|
92521
|
+
writeMountManifest(manifestPath2, {
|
|
92430
92522
|
version: 1,
|
|
92431
92523
|
appName,
|
|
92432
92524
|
workspaceRoot,
|
|
@@ -92435,7 +92527,7 @@ async function mountCommand(opts = {}) {
|
|
|
92435
92527
|
mounts: selected,
|
|
92436
92528
|
appliedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
92437
92529
|
});
|
|
92438
|
-
process.stdout.write(`dev-cockpit mount: wrote ${
|
|
92530
|
+
process.stdout.write(`dev-cockpit mount: wrote ${manifestPath2}
|
|
92439
92531
|
`);
|
|
92440
92532
|
if (profile?.mountSymlinks) {
|
|
92441
92533
|
const report = applyManagedSymlinks(workspaceRoot, selected, profile.mountSymlinks);
|
|
@@ -92461,8 +92553,8 @@ async function mountCommand(opts = {}) {
|
|
|
92461
92553
|
}
|
|
92462
92554
|
async function mountStatusCommand(opts = {}) {
|
|
92463
92555
|
const ctx = await resolveContext(opts);
|
|
92464
|
-
const { workspaceRoot, manifestPath, profile } = ctx;
|
|
92465
|
-
const manifest = readMountManifest(
|
|
92556
|
+
const { workspaceRoot, manifestPath: manifestPath2, profile } = ctx;
|
|
92557
|
+
const manifest = readMountManifest(manifestPath2);
|
|
92466
92558
|
if (!manifest || manifest.mounts.length === 0) {
|
|
92467
92559
|
process.stdout.write("dev-cockpit mount: no active mounts.\n");
|
|
92468
92560
|
return;
|
|
@@ -92526,8 +92618,8 @@ dev-cockpit mount status \u2014 service: ${manifest.service}
|
|
|
92526
92618
|
}
|
|
92527
92619
|
async function mountClearCommand(opts = {}) {
|
|
92528
92620
|
const ctx = await resolveContext(opts);
|
|
92529
|
-
const { workspaceRoot, overlayPath, manifestPath, profile } = ctx;
|
|
92530
|
-
const manifest = readMountManifest(
|
|
92621
|
+
const { workspaceRoot, overlayPath, manifestPath: manifestPath2, profile } = ctx;
|
|
92622
|
+
const manifest = readMountManifest(manifestPath2);
|
|
92531
92623
|
const previous = manifest?.mounts ?? [];
|
|
92532
92624
|
if (profile?.mountSymlinks && previous.length > 0) {
|
|
92533
92625
|
removeManagedSymlinks(workspaceRoot, previous, profile.mountSymlinks);
|
|
@@ -92535,14 +92627,14 @@ async function mountClearCommand(opts = {}) {
|
|
|
92535
92627
|
`);
|
|
92536
92628
|
}
|
|
92537
92629
|
let removed = 0;
|
|
92538
|
-
if (
|
|
92539
|
-
|
|
92630
|
+
if (fs15.existsSync(overlayPath)) {
|
|
92631
|
+
fs15.rmSync(overlayPath);
|
|
92540
92632
|
process.stdout.write(`dev-cockpit mount: removed ${overlayPath}
|
|
92541
92633
|
`);
|
|
92542
92634
|
removed += 1;
|
|
92543
92635
|
}
|
|
92544
|
-
if (deleteMountManifest(
|
|
92545
|
-
process.stdout.write(`dev-cockpit mount: removed ${
|
|
92636
|
+
if (deleteMountManifest(manifestPath2)) {
|
|
92637
|
+
process.stdout.write(`dev-cockpit mount: removed ${manifestPath2}
|
|
92546
92638
|
`);
|
|
92547
92639
|
removed += 1;
|
|
92548
92640
|
}
|
|
@@ -92563,16 +92655,16 @@ async function mountClearCommand(opts = {}) {
|
|
|
92563
92655
|
|
|
92564
92656
|
// src/commands/migrate-config.ts
|
|
92565
92657
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
92566
|
-
import
|
|
92658
|
+
import fs16 from "node:fs";
|
|
92567
92659
|
import path20 from "node:path";
|
|
92568
92660
|
async function migrateConfigCommand(opts = {}) {
|
|
92569
92661
|
const configPath = path20.resolve(opts.config ?? "cockpit.yaml");
|
|
92570
|
-
if (!
|
|
92662
|
+
if (!fs16.existsSync(configPath)) {
|
|
92571
92663
|
process.stderr.write(`dev-cockpit migrate-config: no file at ${configPath}.
|
|
92572
92664
|
`);
|
|
92573
92665
|
process.exit(1);
|
|
92574
92666
|
}
|
|
92575
|
-
const content =
|
|
92667
|
+
const content = fs16.readFileSync(configPath, "utf8");
|
|
92576
92668
|
const raw = (0, import_yaml2.parse)(content) ?? {};
|
|
92577
92669
|
if (typeof raw["version"] !== "number") {
|
|
92578
92670
|
process.stderr.write(
|
|
@@ -92612,7 +92704,7 @@ async function migrateConfigCommand(opts = {}) {
|
|
|
92612
92704
|
process.stdout.write(out);
|
|
92613
92705
|
return;
|
|
92614
92706
|
}
|
|
92615
|
-
|
|
92707
|
+
fs16.writeFileSync(configPath, out, "utf8");
|
|
92616
92708
|
process.stdout.write(
|
|
92617
92709
|
`dev-cockpit migrate-config: rewrote ${configPath} (v${fromVersion} \u2192 v${CONFIG_VERSION}).
|
|
92618
92710
|
`
|
|
@@ -92643,30 +92735,45 @@ function buildCli(opts = {}) {
|
|
|
92643
92735
|
profile.setupCli(program2);
|
|
92644
92736
|
}
|
|
92645
92737
|
if (!hasCommand(program2, "dev")) {
|
|
92646
|
-
program2.command("dev").description("Boot the three-pane TUI (Repos / Output / Health / Help)").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92738
|
+
program2.command("dev").description("Boot the three-pane TUI (Repos / Output / Health / Help)").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").action(async (cmdOpts) => {
|
|
92647
92739
|
await devCommand({ config: cmdOpts.config, profile });
|
|
92648
92740
|
});
|
|
92649
92741
|
}
|
|
92650
92742
|
if (!hasCommand(program2, "doctor")) {
|
|
92651
|
-
program2.command("doctor").description("Run all health checks once and print a status table").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92743
|
+
program2.command("doctor").description("Run all health checks once and print a status table").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").action(async (cmdOpts) => {
|
|
92652
92744
|
await doctorCommand({ config: cmdOpts.config, profile });
|
|
92653
92745
|
});
|
|
92654
92746
|
}
|
|
92655
92747
|
if (!hasCommand(program2, "init-config")) {
|
|
92656
|
-
program2.command("init-config").description("Write a starter cockpit.yaml in the current directory").option("-f, --force", "Overwrite an existing cockpit.yaml without prompting", false).option("--with-docker", "Include an uncommented docker block (static template only)", false).option("-i, --interactive", "Walk through prompts to populate the file (skips static template)", false).action(
|
|
92748
|
+
program2.command("init-config").description("Write a starter cockpit.yaml in the current directory").option("-f, --force", "Overwrite an existing cockpit.yaml without prompting", false).option("--with-docker", "Include an uncommented docker block (static template only)", false).option("-i, --interactive", "Walk through prompts to populate the file (skips static template)", false).option("-o, --output <path>", "Write the file to this path instead of <cwd>/cockpit.yaml").action(
|
|
92657
92749
|
async (cmdOpts) => {
|
|
92658
92750
|
await initConfigCommand({
|
|
92659
92751
|
force: cmdOpts.force ?? false,
|
|
92660
92752
|
withDocker: cmdOpts.withDocker ?? false,
|
|
92661
92753
|
interactive: cmdOpts.interactive ?? false,
|
|
92662
92754
|
appName,
|
|
92663
|
-
profile
|
|
92755
|
+
profile,
|
|
92756
|
+
output: cmdOpts.output
|
|
92664
92757
|
});
|
|
92665
92758
|
}
|
|
92666
92759
|
);
|
|
92667
92760
|
}
|
|
92761
|
+
if (!hasCommand(program2, "link")) {
|
|
92762
|
+
const linkCmd = program2.command("link").description("Register the current directory as using a cockpit.yaml that lives elsewhere").argument("<config-path>", "Path to the cockpit.yaml to associate with this directory").action(async (configPath) => {
|
|
92763
|
+
const { linkAddCommand } = await import("./link-HXNII7EU.js");
|
|
92764
|
+
linkAddCommand({ configPath });
|
|
92765
|
+
});
|
|
92766
|
+
linkCmd.command("list").description("Print all registered project \u2192 config mappings").action(async () => {
|
|
92767
|
+
const { linkListCommand } = await import("./link-HXNII7EU.js");
|
|
92768
|
+
linkListCommand();
|
|
92769
|
+
});
|
|
92770
|
+
linkCmd.command("remove").description("Unregister the current directory from the manifest").action(async () => {
|
|
92771
|
+
const { linkRemoveCommand } = await import("./link-HXNII7EU.js");
|
|
92772
|
+
linkRemoveCommand();
|
|
92773
|
+
});
|
|
92774
|
+
}
|
|
92668
92775
|
if (!hasCommand(program2, "mount")) {
|
|
92669
|
-
const mountCmd = program2.command("mount").description("Apply a docker-compose bind-mount overlay (interactive picker by default)").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92776
|
+
const mountCmd = program2.command("mount").description("Apply a docker-compose bind-mount overlay (interactive picker by default)").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").option("-s, --service <name>", "Target compose service (default: first in docker.services)").option("-q, --quiet", "Skip the interactive picker; apply all candidates").option(
|
|
92670
92777
|
"-e, --exclude <name>",
|
|
92671
92778
|
"Exclude a candidate by meta.name (repeatable)",
|
|
92672
92779
|
(val, prev) => [...prev, val],
|
|
@@ -92680,15 +92787,15 @@ function buildCli(opts = {}) {
|
|
|
92680
92787
|
profile
|
|
92681
92788
|
});
|
|
92682
92789
|
});
|
|
92683
|
-
mountCmd.command("status").description("Show active mounts with branch, dirty, and broken-symlink status").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92790
|
+
mountCmd.command("status").description("Show active mounts with branch, dirty, and broken-symlink status").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").action(async (cmdOpts) => {
|
|
92684
92791
|
await mountStatusCommand({ config: cmdOpts.config, profile });
|
|
92685
92792
|
});
|
|
92686
|
-
mountCmd.command("clear").description("Remove the overlay, manifest, and managed symlinks; runs profile.onMountClear").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92793
|
+
mountCmd.command("clear").description("Remove the overlay, manifest, and managed symlinks; runs profile.onMountClear").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").action(async (cmdOpts) => {
|
|
92687
92794
|
await mountClearCommand({ config: cmdOpts.config, profile });
|
|
92688
92795
|
});
|
|
92689
92796
|
}
|
|
92690
92797
|
if (!hasCommand(program2, "migrate-config")) {
|
|
92691
|
-
program2.command("migrate-config").description("Rewrite cockpit.yaml at the current CONFIG_VERSION").option("-c, --config <path>", "Path to cockpit.yaml
|
|
92798
|
+
program2.command("migrate-config").description("Rewrite cockpit.yaml at the current CONFIG_VERSION").option("-c, --config <path>", "Path to cockpit.yaml (default: <cwd>/cockpit.yaml or registered via `link`)").option("--dry-run", "Print the migrated YAML to stdout instead of writing").action(async (cmdOpts) => {
|
|
92692
92799
|
await migrateConfigCommand({ config: cmdOpts.config, dryRun: cmdOpts.dryRun });
|
|
92693
92800
|
});
|
|
92694
92801
|
}
|
|
@@ -92696,9 +92803,9 @@ function buildCli(opts = {}) {
|
|
|
92696
92803
|
}
|
|
92697
92804
|
|
|
92698
92805
|
// src/mount/discovery.ts
|
|
92699
|
-
import
|
|
92806
|
+
import fs17 from "node:fs";
|
|
92700
92807
|
function findHostClones(opts) {
|
|
92701
|
-
const fsImpl = opts.fsImpl ??
|
|
92808
|
+
const fsImpl = opts.fsImpl ?? fs17;
|
|
92702
92809
|
const found = [];
|
|
92703
92810
|
for (const pkg of opts.packages) {
|
|
92704
92811
|
const hostPath = opts.resolveHostPath(pkg, opts.parentDir);
|