@ctxo/cli 0.9.2 → 0.9.3
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.
|
@@ -494,6 +494,25 @@ function detectFromLockfileWalkUp(startDir) {
|
|
|
494
494
|
}
|
|
495
495
|
return null;
|
|
496
496
|
}
|
|
497
|
+
function readWorkspaceLinks(projectRoot) {
|
|
498
|
+
const links = /* @__PURE__ */ new Set();
|
|
499
|
+
const pkgPath = join3(projectRoot, "package.json");
|
|
500
|
+
if (!existsSync4(pkgPath)) return links;
|
|
501
|
+
try {
|
|
502
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
503
|
+
for (const group of [pkg.dependencies, pkg.devDependencies, pkg.peerDependencies, pkg.optionalDependencies]) {
|
|
504
|
+
if (!group) continue;
|
|
505
|
+
for (const [name, spec] of Object.entries(group)) {
|
|
506
|
+
if (typeof spec === "string" && spec.startsWith("workspace:")) {
|
|
507
|
+
links.add(name);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return links;
|
|
512
|
+
} catch {
|
|
513
|
+
return links;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
497
516
|
function isWorkspaceRoot(projectRoot) {
|
|
498
517
|
if (existsSync4(join3(projectRoot, "pnpm-workspace.yaml"))) return true;
|
|
499
518
|
const pkgPath = join3(projectRoot, "package.json");
|
|
@@ -3632,7 +3651,7 @@ var DoctorCommand = class {
|
|
|
3632
3651
|
this.ctxoRoot = join22(projectRoot, ".ctxo");
|
|
3633
3652
|
}
|
|
3634
3653
|
async run(options = {}) {
|
|
3635
|
-
const { getVersion: getVersion2 } = await import("./cli-router-
|
|
3654
|
+
const { getVersion: getVersion2 } = await import("./cli-router-CQJ7CN6E.js");
|
|
3636
3655
|
console.error(`ctxo v${getVersion2()} \u2014 health check
|
|
3637
3656
|
`);
|
|
3638
3657
|
const checks = [
|
|
@@ -4038,6 +4057,11 @@ function computePackageStates(installed, results) {
|
|
|
4038
4057
|
function selectInstallTargets(states) {
|
|
4039
4058
|
return states.filter((s) => s.status === "update" && typeof s.latest === "string").filter((s) => isSafeVersionSpecifier(s.latest)).map((s) => ({ name: s.name, version: s.latest }));
|
|
4040
4059
|
}
|
|
4060
|
+
function markWorkspaceLinks(states, workspaceLinkNames) {
|
|
4061
|
+
return states.map(
|
|
4062
|
+
(s) => workspaceLinkNames.has(s.name) ? { ...s, status: "workspace", latest: null } : s
|
|
4063
|
+
);
|
|
4064
|
+
}
|
|
4041
4065
|
var SAFE_SPECIFIER_RE = /^[0-9A-Za-z.+-]+$/;
|
|
4042
4066
|
function isSafeVersionSpecifier(version) {
|
|
4043
4067
|
return SAFE_SPECIFIER_RE.test(version);
|
|
@@ -4056,17 +4080,20 @@ function formatText(report) {
|
|
|
4056
4080
|
lines.push(`All ${total} package${total === 1 ? "" : "s"} are up to date.`);
|
|
4057
4081
|
return lines.join("\n");
|
|
4058
4082
|
}
|
|
4083
|
+
const latestCell = (p) => {
|
|
4084
|
+
if (p.status === "workspace") return "(local)";
|
|
4085
|
+
return p.latest ?? "(not found)";
|
|
4086
|
+
};
|
|
4059
4087
|
const nameCol = Math.max(7, ...report.packages.map((p) => p.name.length));
|
|
4060
4088
|
const curCol = Math.max(7, ...report.packages.map((p) => p.current.length));
|
|
4061
|
-
const latestCol = Math.max(15, ...report.packages.map((p) => (p
|
|
4089
|
+
const latestCol = Math.max(15, ...report.packages.map((p) => latestCell(p).length));
|
|
4062
4090
|
lines.push(
|
|
4063
4091
|
`${"PACKAGE".padEnd(nameCol)} ${"CURRENT".padEnd(curCol)} ${`LATEST (${report.channel})`.padEnd(latestCol)} STATUS`
|
|
4064
4092
|
);
|
|
4065
4093
|
for (const pkg of report.packages) {
|
|
4066
|
-
const latestText = pkg.latest ?? "(not found)";
|
|
4067
4094
|
const statusText = renderStatus(pkg, report.channel);
|
|
4068
4095
|
lines.push(
|
|
4069
|
-
`${pkg.name.padEnd(nameCol)} ${pkg.current.padEnd(curCol)} ${
|
|
4096
|
+
`${pkg.name.padEnd(nameCol)} ${pkg.current.padEnd(curCol)} ${latestCell(pkg).padEnd(latestCol)} ${statusText}`
|
|
4070
4097
|
);
|
|
4071
4098
|
}
|
|
4072
4099
|
if (report.plan && report.strategy === "execute") {
|
|
@@ -4088,6 +4115,8 @@ function renderStatus(pkg, reportChannel) {
|
|
|
4088
4115
|
return "up to date";
|
|
4089
4116
|
case "ahead":
|
|
4090
4117
|
return "ahead of registry";
|
|
4118
|
+
case "workspace":
|
|
4119
|
+
return "workspace link";
|
|
4091
4120
|
case "unknown":
|
|
4092
4121
|
return pkg.reason === "registry-404" ? "skipped" : `error${pkg.reason ? ` (${pkg.reason})` : ""}`;
|
|
4093
4122
|
case "update":
|
|
@@ -4138,7 +4167,8 @@ var UpdateCommand = class {
|
|
|
4138
4167
|
this.deps.setExitCode?.(1);
|
|
4139
4168
|
return;
|
|
4140
4169
|
}
|
|
4141
|
-
const
|
|
4170
|
+
const rawStates = computePackageStates(installed, results);
|
|
4171
|
+
const states = markWorkspaceLinks(rawStates, readWorkspaceLinks(this.projectRoot));
|
|
4142
4172
|
const targets = selectInstallTargets(states);
|
|
4143
4173
|
const cliVersion = getVersion();
|
|
4144
4174
|
const channel = detectChannel(cliVersion);
|
|
@@ -4518,4 +4548,4 @@ export {
|
|
|
4518
4548
|
getVersion,
|
|
4519
4549
|
locateGitRoot
|
|
4520
4550
|
};
|
|
4521
|
-
//# sourceMappingURL=cli-router-
|
|
4551
|
+
//# sourceMappingURL=cli-router-CQJ7CN6E.js.map
|