codebyplan 1.13.22 → 1.13.23
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 +0 -109
- package/dist/cli.js +44 -516
- package/package.json +1 -1
- package/templates/hooks/README.md +2 -52
- package/templates/hooks/cbp-test-hooks.sh +0 -71
- package/templates/hooks/hooks.json +0 -20
- package/templates/settings.project.base.json +0 -7
- package/templates/skills/cbp-round-execute/SKILL.md +0 -18
- package/templates/skills/cbp-task-complete/SKILL.md +0 -14
- package/templates/skills/cbp-task-start/SKILL.md +0 -8
- package/templates/hooks/cbp-cmux-branch-watch.sh +0 -39
- package/templates/hooks/cbp-cmux-workspace-sync.sh +0 -19
- package/templates/skills/cbp-setup-cmux/SKILL.md +0 -170
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var VERSION, PACKAGE_NAME;
|
|
|
14
14
|
var init_version = __esm({
|
|
15
15
|
"src/lib/version.ts"() {
|
|
16
16
|
"use strict";
|
|
17
|
-
VERSION = "1.13.
|
|
17
|
+
VERSION = "1.13.23";
|
|
18
18
|
PACKAGE_NAME = "codebyplan";
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -1994,11 +1994,6 @@ async function writeCodebyplanDirectory(projectPath, selectedRepo, deviceId) {
|
|
|
1994
1994
|
JSON.stringify({}, null, 2) + "\n",
|
|
1995
1995
|
"utf-8"
|
|
1996
1996
|
);
|
|
1997
|
-
await writeFile6(
|
|
1998
|
-
join9(codebyplanDir, "cmux.json"),
|
|
1999
|
-
JSON.stringify({}, null, 2) + "\n",
|
|
2000
|
-
"utf-8"
|
|
2001
|
-
);
|
|
2002
1997
|
const statuslinePath = join9(codebyplanDir, "statusline.json");
|
|
2003
1998
|
let statuslineExists = false;
|
|
2004
1999
|
try {
|
|
@@ -2016,7 +2011,7 @@ async function writeCodebyplanDirectory(projectPath, selectedRepo, deviceId) {
|
|
|
2016
2011
|
await writeLocalConfig(projectPath, { device_id: deviceId });
|
|
2017
2012
|
console.log(` Created ${codebyplanDir}/`);
|
|
2018
2013
|
console.log(
|
|
2019
|
-
` repo.json, server.json, git.json, shipment.json, vendor.json, e2e.json, eslint.json,
|
|
2014
|
+
` repo.json, server.json, git.json, shipment.json, vendor.json, e2e.json, eslint.json, statusline.json`
|
|
2020
2015
|
);
|
|
2021
2016
|
console.log(` device.local.json (gitignored)`);
|
|
2022
2017
|
const gitignoreAction = await ensureManagedGitignoreBlock(projectPath);
|
|
@@ -2093,8 +2088,8 @@ async function runSetup() {
|
|
|
2093
2088
|
const deviceId = await getOrCreateDeviceId(projectPath);
|
|
2094
2089
|
let branch = "main";
|
|
2095
2090
|
try {
|
|
2096
|
-
const { execSync:
|
|
2097
|
-
branch =
|
|
2091
|
+
const { execSync: execSync8 } = await import("node:child_process");
|
|
2092
|
+
branch = execSync8("git symbolic-ref --short HEAD", {
|
|
2098
2093
|
cwd: projectPath,
|
|
2099
2094
|
encoding: "utf-8"
|
|
2100
2095
|
}).trim();
|
|
@@ -3764,9 +3759,9 @@ async function eslintInit(repoId, projectPath) {
|
|
|
3764
3759
|
Install ${missingPkgs.length} missing packages? [Y/n] `
|
|
3765
3760
|
);
|
|
3766
3761
|
if (confirmed) {
|
|
3767
|
-
const { execSync:
|
|
3762
|
+
const { execSync: execSync8 } = await import("node:child_process");
|
|
3768
3763
|
try {
|
|
3769
|
-
|
|
3764
|
+
execSync8(installCmd, { cwd: projectPath, stdio: "inherit" });
|
|
3770
3765
|
console.log(" Packages installed.\n");
|
|
3771
3766
|
} catch (err) {
|
|
3772
3767
|
console.error(
|
|
@@ -6667,451 +6662,6 @@ var init_upload_e2e_images = __esm({
|
|
|
6667
6662
|
}
|
|
6668
6663
|
});
|
|
6669
6664
|
|
|
6670
|
-
// src/lib/cmux.ts
|
|
6671
|
-
import { readFileSync as readFileSync6 } from "node:fs";
|
|
6672
|
-
import { join as join22 } from "node:path";
|
|
6673
|
-
function insideCmux() {
|
|
6674
|
-
return !!process.env.CMUX_WORKSPACE_ID;
|
|
6675
|
-
}
|
|
6676
|
-
function resolveCmuxBin() {
|
|
6677
|
-
return process.env.CMUX_BUNDLED_CLI_PATH || process.env.CMUX_CLAUDE_HOOK_CMUX_BIN || "cmux";
|
|
6678
|
-
}
|
|
6679
|
-
function readCmuxConfig(projectRoot) {
|
|
6680
|
-
let raw = {};
|
|
6681
|
-
try {
|
|
6682
|
-
const text = readFileSync6(
|
|
6683
|
-
join22(projectRoot, ".codebyplan", "cmux.json"),
|
|
6684
|
-
"utf-8"
|
|
6685
|
-
);
|
|
6686
|
-
raw = JSON.parse(text);
|
|
6687
|
-
} catch {
|
|
6688
|
-
raw = {};
|
|
6689
|
-
}
|
|
6690
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
6691
|
-
raw = {};
|
|
6692
|
-
}
|
|
6693
|
-
const config = raw;
|
|
6694
|
-
return {
|
|
6695
|
-
...config,
|
|
6696
|
-
auto_status: config.auto_status ?? true,
|
|
6697
|
-
auto_dev_server: config.auto_dev_server ?? true
|
|
6698
|
-
};
|
|
6699
|
-
}
|
|
6700
|
-
var init_cmux = __esm({
|
|
6701
|
-
"src/lib/cmux.ts"() {
|
|
6702
|
-
"use strict";
|
|
6703
|
-
}
|
|
6704
|
-
});
|
|
6705
|
-
|
|
6706
|
-
// src/cli/cmux-sync.ts
|
|
6707
|
-
var cmux_sync_exports = {};
|
|
6708
|
-
__export(cmux_sync_exports, {
|
|
6709
|
-
runCmuxSync: () => runCmuxSync
|
|
6710
|
-
});
|
|
6711
|
-
import { execSync as execSync8, execFileSync as execFileSync2 } from "node:child_process";
|
|
6712
|
-
import { basename as basename2 } from "node:path";
|
|
6713
|
-
async function runCmuxSync() {
|
|
6714
|
-
try {
|
|
6715
|
-
if (!insideCmux()) {
|
|
6716
|
-
process.exit(0);
|
|
6717
|
-
}
|
|
6718
|
-
const bin = resolveCmuxBin();
|
|
6719
|
-
let branch = "";
|
|
6720
|
-
try {
|
|
6721
|
-
branch = execSync8("git rev-parse --abbrev-ref HEAD", {
|
|
6722
|
-
encoding: "utf8"
|
|
6723
|
-
}).trim();
|
|
6724
|
-
} catch {
|
|
6725
|
-
}
|
|
6726
|
-
let folder = "";
|
|
6727
|
-
let toplevel = "";
|
|
6728
|
-
try {
|
|
6729
|
-
toplevel = execSync8("git rev-parse --show-toplevel", {
|
|
6730
|
-
encoding: "utf8"
|
|
6731
|
-
}).trim();
|
|
6732
|
-
folder = basename2(toplevel);
|
|
6733
|
-
} catch {
|
|
6734
|
-
}
|
|
6735
|
-
if (branch) {
|
|
6736
|
-
try {
|
|
6737
|
-
execFileSync2(bin, [
|
|
6738
|
-
"workspace-action",
|
|
6739
|
-
"--action",
|
|
6740
|
-
"rename",
|
|
6741
|
-
"--title",
|
|
6742
|
-
branch
|
|
6743
|
-
]);
|
|
6744
|
-
} catch {
|
|
6745
|
-
}
|
|
6746
|
-
}
|
|
6747
|
-
if (folder) {
|
|
6748
|
-
try {
|
|
6749
|
-
execFileSync2(bin, [
|
|
6750
|
-
"workspace-action",
|
|
6751
|
-
"--action",
|
|
6752
|
-
"set-description",
|
|
6753
|
-
"--description",
|
|
6754
|
-
folder
|
|
6755
|
-
]);
|
|
6756
|
-
} catch {
|
|
6757
|
-
}
|
|
6758
|
-
}
|
|
6759
|
-
try {
|
|
6760
|
-
const cmuxCfg = readCmuxConfig(toplevel || process.cwd());
|
|
6761
|
-
if (typeof cmuxCfg.workspace_color === "string" && cmuxCfg.workspace_color !== "") {
|
|
6762
|
-
try {
|
|
6763
|
-
execFileSync2(bin, [
|
|
6764
|
-
"workspace-action",
|
|
6765
|
-
"--action",
|
|
6766
|
-
"set-color",
|
|
6767
|
-
"--color",
|
|
6768
|
-
cmuxCfg.workspace_color
|
|
6769
|
-
]);
|
|
6770
|
-
} catch {
|
|
6771
|
-
}
|
|
6772
|
-
} else {
|
|
6773
|
-
process.stdout.write(
|
|
6774
|
-
"cmux: no workspace color set \u2014 run /cbp-setup-cmux\n"
|
|
6775
|
-
);
|
|
6776
|
-
}
|
|
6777
|
-
} catch {
|
|
6778
|
-
}
|
|
6779
|
-
process.exit(0);
|
|
6780
|
-
} catch (err) {
|
|
6781
|
-
if (err instanceof ProcessExitSignal) throw err;
|
|
6782
|
-
process.exit(0);
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
var init_cmux_sync = __esm({
|
|
6786
|
-
"src/cli/cmux-sync.ts"() {
|
|
6787
|
-
"use strict";
|
|
6788
|
-
init_process_exit_signal();
|
|
6789
|
-
init_cmux();
|
|
6790
|
-
}
|
|
6791
|
-
});
|
|
6792
|
-
|
|
6793
|
-
// src/cli/cmux-status.ts
|
|
6794
|
-
var cmux_status_exports = {};
|
|
6795
|
-
__export(cmux_status_exports, {
|
|
6796
|
-
normalizeProgress: () => normalizeProgress,
|
|
6797
|
-
runCmuxStatus: () => runCmuxStatus
|
|
6798
|
-
});
|
|
6799
|
-
import { execSync as execSync9, execFileSync as execFileSync3 } from "node:child_process";
|
|
6800
|
-
function normalizeProgress(raw) {
|
|
6801
|
-
if (raw.includes("/")) {
|
|
6802
|
-
const [numStr, denStr] = raw.split("/", 2);
|
|
6803
|
-
const num = parseInt(numStr ?? "", 10);
|
|
6804
|
-
const den = parseInt(denStr ?? "", 10);
|
|
6805
|
-
if (!Number.isFinite(num) || !Number.isFinite(den) || den === 0) return "0";
|
|
6806
|
-
const ratio = num / den;
|
|
6807
|
-
const clamped2 = Math.max(0, Math.min(1, ratio));
|
|
6808
|
-
return String(clamped2);
|
|
6809
|
-
}
|
|
6810
|
-
const f = parseFloat(raw);
|
|
6811
|
-
if (!Number.isFinite(f)) return null;
|
|
6812
|
-
const clamped = Math.max(0, Math.min(1, f));
|
|
6813
|
-
return String(clamped);
|
|
6814
|
-
}
|
|
6815
|
-
async function runCmuxStatus(args) {
|
|
6816
|
-
try {
|
|
6817
|
-
if (!insideCmux()) {
|
|
6818
|
-
process.exit(0);
|
|
6819
|
-
}
|
|
6820
|
-
let toplevel = "";
|
|
6821
|
-
try {
|
|
6822
|
-
toplevel = execSync9("git rev-parse --show-toplevel", {
|
|
6823
|
-
encoding: "utf8"
|
|
6824
|
-
}).trim();
|
|
6825
|
-
} catch {
|
|
6826
|
-
toplevel = process.cwd();
|
|
6827
|
-
}
|
|
6828
|
-
const cfg = readCmuxConfig(toplevel);
|
|
6829
|
-
if (cfg.auto_status === false) {
|
|
6830
|
-
process.exit(0);
|
|
6831
|
-
}
|
|
6832
|
-
let checkpoint;
|
|
6833
|
-
let task;
|
|
6834
|
-
let qa;
|
|
6835
|
-
let progress;
|
|
6836
|
-
let clear = false;
|
|
6837
|
-
for (let i = 0; i < args.length; i++) {
|
|
6838
|
-
const flag = args[i];
|
|
6839
|
-
if (flag === "--checkpoint" && i + 1 < args.length) {
|
|
6840
|
-
checkpoint = args[++i];
|
|
6841
|
-
} else if (flag === "--task" && i + 1 < args.length) {
|
|
6842
|
-
task = args[++i];
|
|
6843
|
-
} else if (flag === "--qa" && i + 1 < args.length) {
|
|
6844
|
-
qa = args[++i];
|
|
6845
|
-
} else if (flag === "--progress" && i + 1 < args.length) {
|
|
6846
|
-
progress = args[++i];
|
|
6847
|
-
} else if (flag === "--clear") {
|
|
6848
|
-
clear = true;
|
|
6849
|
-
}
|
|
6850
|
-
}
|
|
6851
|
-
const bin = resolveCmuxBin();
|
|
6852
|
-
if (clear) {
|
|
6853
|
-
try {
|
|
6854
|
-
execFileSync3(bin, ["clear-status", "cbp-checkpoint"]);
|
|
6855
|
-
} catch {
|
|
6856
|
-
}
|
|
6857
|
-
try {
|
|
6858
|
-
execFileSync3(bin, ["clear-status", "cbp-task"]);
|
|
6859
|
-
} catch {
|
|
6860
|
-
}
|
|
6861
|
-
try {
|
|
6862
|
-
execFileSync3(bin, ["clear-status", "cbp-qa"]);
|
|
6863
|
-
} catch {
|
|
6864
|
-
}
|
|
6865
|
-
try {
|
|
6866
|
-
execFileSync3(bin, ["clear-progress"]);
|
|
6867
|
-
} catch {
|
|
6868
|
-
}
|
|
6869
|
-
} else {
|
|
6870
|
-
if (checkpoint !== void 0) {
|
|
6871
|
-
try {
|
|
6872
|
-
execFileSync3(bin, ["set-status", "cbp-checkpoint", checkpoint]);
|
|
6873
|
-
} catch {
|
|
6874
|
-
}
|
|
6875
|
-
}
|
|
6876
|
-
if (task !== void 0) {
|
|
6877
|
-
try {
|
|
6878
|
-
execFileSync3(bin, ["set-status", "cbp-task", task]);
|
|
6879
|
-
} catch {
|
|
6880
|
-
}
|
|
6881
|
-
}
|
|
6882
|
-
if (qa !== void 0) {
|
|
6883
|
-
try {
|
|
6884
|
-
execFileSync3(bin, ["set-status", "cbp-qa", qa]);
|
|
6885
|
-
} catch {
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
if (progress !== void 0) {
|
|
6889
|
-
const decimalStr = normalizeProgress(progress);
|
|
6890
|
-
if (decimalStr !== null) {
|
|
6891
|
-
try {
|
|
6892
|
-
execFileSync3(bin, ["set-progress", decimalStr]);
|
|
6893
|
-
} catch {
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
}
|
|
6897
|
-
}
|
|
6898
|
-
process.exit(0);
|
|
6899
|
-
} catch (err) {
|
|
6900
|
-
if (err instanceof ProcessExitSignal) throw err;
|
|
6901
|
-
process.exit(0);
|
|
6902
|
-
}
|
|
6903
|
-
}
|
|
6904
|
-
var init_cmux_status = __esm({
|
|
6905
|
-
"src/cli/cmux-status.ts"() {
|
|
6906
|
-
"use strict";
|
|
6907
|
-
init_process_exit_signal();
|
|
6908
|
-
init_cmux();
|
|
6909
|
-
}
|
|
6910
|
-
});
|
|
6911
|
-
|
|
6912
|
-
// src/cli/cmux-serve.ts
|
|
6913
|
-
var cmux_serve_exports = {};
|
|
6914
|
-
__export(cmux_serve_exports, {
|
|
6915
|
-
probePort: () => probePort,
|
|
6916
|
-
runCmuxServe: () => runCmuxServe
|
|
6917
|
-
});
|
|
6918
|
-
import { execSync as execSync10, execFileSync as execFileSync4 } from "node:child_process";
|
|
6919
|
-
import { readFileSync as readFileSync7 } from "node:fs";
|
|
6920
|
-
import * as net from "node:net";
|
|
6921
|
-
import { join as join23 } from "node:path";
|
|
6922
|
-
function resolveAppDir(allocation, toplevel) {
|
|
6923
|
-
if (allocation.command !== null && allocation.working_dir !== null) {
|
|
6924
|
-
const wd = allocation.working_dir;
|
|
6925
|
-
const dir = wd.startsWith(toplevel + "/") ? wd.slice(toplevel.length + 1) : wd;
|
|
6926
|
-
return { appDir: dir, devCommand: allocation.command };
|
|
6927
|
-
}
|
|
6928
|
-
const label = allocation.label ?? "";
|
|
6929
|
-
if (label === "E2E Tests") return { skip: "skip-e2e" };
|
|
6930
|
-
if (label.includes("Web Dev") && !label.toLowerCase().includes("desktop")) {
|
|
6931
|
-
return { appDir: "apps/web", devCommand: null };
|
|
6932
|
-
}
|
|
6933
|
-
if (label.toLowerCase().includes("desktop")) {
|
|
6934
|
-
return { appDir: "apps/desktop", devCommand: null };
|
|
6935
|
-
}
|
|
6936
|
-
const appDir = LABEL_APP_MAP[label];
|
|
6937
|
-
if (appDir !== void 0) {
|
|
6938
|
-
return { appDir, devCommand: null };
|
|
6939
|
-
}
|
|
6940
|
-
return { skip: "no-match" };
|
|
6941
|
-
}
|
|
6942
|
-
function probePort(port) {
|
|
6943
|
-
return new Promise((resolve8) => {
|
|
6944
|
-
const socket = new net.Socket();
|
|
6945
|
-
let settled = false;
|
|
6946
|
-
const settle = (result) => {
|
|
6947
|
-
if (!settled) {
|
|
6948
|
-
settled = true;
|
|
6949
|
-
socket.destroy();
|
|
6950
|
-
resolve8(result);
|
|
6951
|
-
}
|
|
6952
|
-
};
|
|
6953
|
-
socket.setTimeout(500);
|
|
6954
|
-
socket.on("connect", () => settle(true));
|
|
6955
|
-
socket.on("error", () => settle(false));
|
|
6956
|
-
socket.on("timeout", () => settle(false));
|
|
6957
|
-
socket.connect({ port, host: "127.0.0.1" });
|
|
6958
|
-
});
|
|
6959
|
-
}
|
|
6960
|
-
async function runCmuxServe(args) {
|
|
6961
|
-
try {
|
|
6962
|
-
if (!insideCmux()) {
|
|
6963
|
-
process.exit(0);
|
|
6964
|
-
}
|
|
6965
|
-
let toplevel = "";
|
|
6966
|
-
try {
|
|
6967
|
-
toplevel = execSync10("git rev-parse --show-toplevel", {
|
|
6968
|
-
encoding: "utf8"
|
|
6969
|
-
}).trim();
|
|
6970
|
-
} catch {
|
|
6971
|
-
toplevel = process.cwd();
|
|
6972
|
-
}
|
|
6973
|
-
const cfg = readCmuxConfig(toplevel);
|
|
6974
|
-
if (cfg.auto_dev_server === false) {
|
|
6975
|
-
process.exit(0);
|
|
6976
|
-
}
|
|
6977
|
-
let filesArg;
|
|
6978
|
-
let appArg;
|
|
6979
|
-
for (let i = 0; i < args.length; i++) {
|
|
6980
|
-
const flag = args[i];
|
|
6981
|
-
if (flag === "--files" && i + 1 < args.length) {
|
|
6982
|
-
filesArg = args[++i];
|
|
6983
|
-
} else if (flag === "--app" && i + 1 < args.length) {
|
|
6984
|
-
appArg = args[++i];
|
|
6985
|
-
}
|
|
6986
|
-
}
|
|
6987
|
-
const changedFiles = filesArg !== void 0 ? filesArg.split(",").map((f) => f.trim()).filter(Boolean) : [];
|
|
6988
|
-
let serverConfig = null;
|
|
6989
|
-
try {
|
|
6990
|
-
const raw = readFileSync7(
|
|
6991
|
-
join23(toplevel, ".codebyplan", "server.json"),
|
|
6992
|
-
"utf-8"
|
|
6993
|
-
);
|
|
6994
|
-
serverConfig = JSON.parse(raw);
|
|
6995
|
-
} catch {
|
|
6996
|
-
process.exit(0);
|
|
6997
|
-
}
|
|
6998
|
-
const allocations = serverConfig?.port_allocations ?? [];
|
|
6999
|
-
if (allocations.length === 0) {
|
|
7000
|
-
process.exit(0);
|
|
7001
|
-
}
|
|
7002
|
-
const bin = resolveCmuxBin();
|
|
7003
|
-
for (const allocation of allocations) {
|
|
7004
|
-
try {
|
|
7005
|
-
const resolved = resolveAppDir(allocation, toplevel);
|
|
7006
|
-
if ("skip" in resolved) {
|
|
7007
|
-
if (resolved.skip === "no-match") {
|
|
7008
|
-
process.stdout.write(
|
|
7009
|
-
`cmux-serve: no app mapping for allocation "${allocation.label ?? ""}" \u2014 skipped
|
|
7010
|
-
`
|
|
7011
|
-
);
|
|
7012
|
-
}
|
|
7013
|
-
continue;
|
|
7014
|
-
}
|
|
7015
|
-
const { appDir, devCommand } = resolved;
|
|
7016
|
-
const appDirWithSlash = appDir + "/";
|
|
7017
|
-
const intersects = appArg !== void 0 && (appArg === appDir || appArg.startsWith(appDirWithSlash)) || changedFiles.some(
|
|
7018
|
-
(f) => f === appDir || f.startsWith(appDirWithSlash)
|
|
7019
|
-
);
|
|
7020
|
-
if (!intersects) {
|
|
7021
|
-
continue;
|
|
7022
|
-
}
|
|
7023
|
-
const port = allocation.port;
|
|
7024
|
-
const listening = await probePort(port);
|
|
7025
|
-
if (!listening) {
|
|
7026
|
-
let shellCommand = null;
|
|
7027
|
-
if (devCommand !== null) {
|
|
7028
|
-
shellCommand = `cd "${join23(toplevel, appDir)}" && ${devCommand}`;
|
|
7029
|
-
} else {
|
|
7030
|
-
let hasDev = false;
|
|
7031
|
-
try {
|
|
7032
|
-
const pkgRaw = readFileSync7(
|
|
7033
|
-
join23(toplevel, appDir, "package.json"),
|
|
7034
|
-
"utf-8"
|
|
7035
|
-
);
|
|
7036
|
-
const pkg = JSON.parse(pkgRaw);
|
|
7037
|
-
hasDev = typeof pkg.scripts?.dev === "string";
|
|
7038
|
-
} catch {
|
|
7039
|
-
}
|
|
7040
|
-
if (!hasDev) {
|
|
7041
|
-
process.stdout.write(
|
|
7042
|
-
`cmux-serve: no "dev" script in ${appDir}/package.json \u2014 skipped
|
|
7043
|
-
`
|
|
7044
|
-
);
|
|
7045
|
-
continue;
|
|
7046
|
-
}
|
|
7047
|
-
shellCommand = `cd "${join23(toplevel, appDir)}" && pnpm run dev`;
|
|
7048
|
-
}
|
|
7049
|
-
let splitSurfaceRef = null;
|
|
7050
|
-
try {
|
|
7051
|
-
const splitOut = execFileSync4(
|
|
7052
|
-
bin,
|
|
7053
|
-
["new-split", "down", "--json"],
|
|
7054
|
-
{
|
|
7055
|
-
encoding: "utf8"
|
|
7056
|
-
}
|
|
7057
|
-
);
|
|
7058
|
-
const parsed = JSON.parse(splitOut);
|
|
7059
|
-
if (typeof parsed.surface_ref === "string" && parsed.surface_ref) {
|
|
7060
|
-
splitSurfaceRef = parsed.surface_ref;
|
|
7061
|
-
}
|
|
7062
|
-
} catch {
|
|
7063
|
-
}
|
|
7064
|
-
if (splitSurfaceRef !== null) {
|
|
7065
|
-
try {
|
|
7066
|
-
execFileSync4(bin, [
|
|
7067
|
-
"send",
|
|
7068
|
-
"--surface",
|
|
7069
|
-
splitSurfaceRef,
|
|
7070
|
-
`${shellCommand}
|
|
7071
|
-
`
|
|
7072
|
-
]);
|
|
7073
|
-
} catch {
|
|
7074
|
-
}
|
|
7075
|
-
} else {
|
|
7076
|
-
process.stdout.write(
|
|
7077
|
-
`cmux-serve: could not resolve new split surface for ${appDir} \u2014 dev server not auto-started (open it manually)
|
|
7078
|
-
`
|
|
7079
|
-
);
|
|
7080
|
-
}
|
|
7081
|
-
}
|
|
7082
|
-
try {
|
|
7083
|
-
execFileSync4(bin, [
|
|
7084
|
-
"new-pane",
|
|
7085
|
-
"--type",
|
|
7086
|
-
"browser",
|
|
7087
|
-
"--url",
|
|
7088
|
-
`http://localhost:${port}`
|
|
7089
|
-
]);
|
|
7090
|
-
} catch {
|
|
7091
|
-
}
|
|
7092
|
-
} catch {
|
|
7093
|
-
}
|
|
7094
|
-
}
|
|
7095
|
-
process.exit(0);
|
|
7096
|
-
} catch (err) {
|
|
7097
|
-
if (err instanceof ProcessExitSignal) throw err;
|
|
7098
|
-
process.exit(0);
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
var LABEL_APP_MAP;
|
|
7102
|
-
var init_cmux_serve = __esm({
|
|
7103
|
-
"src/cli/cmux-serve.ts"() {
|
|
7104
|
-
"use strict";
|
|
7105
|
-
init_process_exit_signal();
|
|
7106
|
-
init_cmux();
|
|
7107
|
-
LABEL_APP_MAP = {
|
|
7108
|
-
"Backend Dev": "apps/backend",
|
|
7109
|
-
"MCP Dev": "apps/mcp",
|
|
7110
|
-
"Docs Ingest": "apps/docs-ingest"
|
|
7111
|
-
};
|
|
7112
|
-
}
|
|
7113
|
-
});
|
|
7114
|
-
|
|
7115
6665
|
// src/lib/worktree-port-resolver.ts
|
|
7116
6666
|
async function resolveWorktreePortAllocations(repoId, projectPath) {
|
|
7117
6667
|
let resolvedWorktreeId;
|
|
@@ -7119,8 +6669,8 @@ async function resolveWorktreePortAllocations(repoId, projectPath) {
|
|
|
7119
6669
|
const deviceId = await getOrCreateDeviceId(projectPath);
|
|
7120
6670
|
let branch = "main";
|
|
7121
6671
|
try {
|
|
7122
|
-
const { execSync:
|
|
7123
|
-
branch =
|
|
6672
|
+
const { execSync: execSync8 } = await import("node:child_process");
|
|
6673
|
+
branch = execSync8("git symbolic-ref --short HEAD", {
|
|
7124
6674
|
cwd: projectPath,
|
|
7125
6675
|
encoding: "utf-8"
|
|
7126
6676
|
}).trim();
|
|
@@ -7202,18 +6752,18 @@ var init_worktree_port_resolver = __esm({
|
|
|
7202
6752
|
|
|
7203
6753
|
// src/lib/migrate-local-config.ts
|
|
7204
6754
|
import { mkdir as mkdir6, readFile as readFile16, unlink as unlink2, writeFile as writeFile12 } from "node:fs/promises";
|
|
7205
|
-
import { join as
|
|
6755
|
+
import { join as join22 } from "node:path";
|
|
7206
6756
|
function legacySharedPath(projectPath) {
|
|
7207
|
-
return
|
|
6757
|
+
return join22(projectPath, ".codebyplan.json");
|
|
7208
6758
|
}
|
|
7209
6759
|
function legacyLocalPath(projectPath) {
|
|
7210
|
-
return
|
|
6760
|
+
return join22(projectPath, ".codebyplan.local.json");
|
|
7211
6761
|
}
|
|
7212
6762
|
function newDirPath(projectPath) {
|
|
7213
|
-
return
|
|
6763
|
+
return join22(projectPath, ".codebyplan");
|
|
7214
6764
|
}
|
|
7215
6765
|
function sentinelPath(projectPath) {
|
|
7216
|
-
return
|
|
6766
|
+
return join22(projectPath, ".codebyplan", "repo.json");
|
|
7217
6767
|
}
|
|
7218
6768
|
async function statSafe(p) {
|
|
7219
6769
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
@@ -7307,7 +6857,7 @@ async function runLocalMigration(projectPath) {
|
|
|
7307
6857
|
if ("organization_id" in cfg) repoJson.organization_id = cfg.organization_id;
|
|
7308
6858
|
if ("project_id" in cfg) repoJson.project_id = cfg.project_id;
|
|
7309
6859
|
await writeFile12(
|
|
7310
|
-
|
|
6860
|
+
join22(projectPath, ".codebyplan", "repo.json"),
|
|
7311
6861
|
JSON.stringify(repoJson, null, 2) + "\n",
|
|
7312
6862
|
"utf-8"
|
|
7313
6863
|
);
|
|
@@ -7320,7 +6870,7 @@ async function runLocalMigration(projectPath) {
|
|
|
7320
6870
|
if ("port_allocations" in cfg)
|
|
7321
6871
|
serverJson.port_allocations = cfg.port_allocations;
|
|
7322
6872
|
await writeFile12(
|
|
7323
|
-
|
|
6873
|
+
join22(projectPath, ".codebyplan", "server.json"),
|
|
7324
6874
|
JSON.stringify(serverJson, null, 2) + "\n",
|
|
7325
6875
|
"utf-8"
|
|
7326
6876
|
);
|
|
@@ -7329,7 +6879,7 @@ async function runLocalMigration(projectPath) {
|
|
|
7329
6879
|
if ("git_branch" in cfg) gitJson.git_branch = cfg.git_branch;
|
|
7330
6880
|
if ("branch_config" in cfg) gitJson.branch_config = cfg.branch_config;
|
|
7331
6881
|
await writeFile12(
|
|
7332
|
-
|
|
6882
|
+
join22(projectPath, ".codebyplan", "git.json"),
|
|
7333
6883
|
JSON.stringify(gitJson, null, 2) + "\n",
|
|
7334
6884
|
"utf-8"
|
|
7335
6885
|
);
|
|
@@ -7337,35 +6887,35 @@ async function runLocalMigration(projectPath) {
|
|
|
7337
6887
|
const shipmentJson = {};
|
|
7338
6888
|
if ("shipment" in cfg) shipmentJson.shipment = cfg.shipment;
|
|
7339
6889
|
await writeFile12(
|
|
7340
|
-
|
|
6890
|
+
join22(projectPath, ".codebyplan", "shipment.json"),
|
|
7341
6891
|
JSON.stringify(shipmentJson, null, 2) + "\n",
|
|
7342
6892
|
"utf-8"
|
|
7343
6893
|
);
|
|
7344
6894
|
filesChanged.push(".codebyplan/shipment.json");
|
|
7345
6895
|
const vendorJson = {};
|
|
7346
6896
|
await writeFile12(
|
|
7347
|
-
|
|
6897
|
+
join22(projectPath, ".codebyplan", "vendor.json"),
|
|
7348
6898
|
JSON.stringify(vendorJson, null, 2) + "\n",
|
|
7349
6899
|
"utf-8"
|
|
7350
6900
|
);
|
|
7351
6901
|
filesChanged.push(".codebyplan/vendor.json");
|
|
7352
6902
|
const e2eJson = {};
|
|
7353
6903
|
await writeFile12(
|
|
7354
|
-
|
|
6904
|
+
join22(projectPath, ".codebyplan", "e2e.json"),
|
|
7355
6905
|
JSON.stringify(e2eJson, null, 2) + "\n",
|
|
7356
6906
|
"utf-8"
|
|
7357
6907
|
);
|
|
7358
6908
|
filesChanged.push(".codebyplan/e2e.json");
|
|
7359
6909
|
const eslintJson = {};
|
|
7360
6910
|
await writeFile12(
|
|
7361
|
-
|
|
6911
|
+
join22(projectPath, ".codebyplan", "eslint.json"),
|
|
7362
6912
|
JSON.stringify(eslintJson, null, 2) + "\n",
|
|
7363
6913
|
"utf-8"
|
|
7364
6914
|
);
|
|
7365
6915
|
filesChanged.push(".codebyplan/eslint.json");
|
|
7366
6916
|
if (!deviceWrittenByHelper) {
|
|
7367
6917
|
await writeFile12(
|
|
7368
|
-
|
|
6918
|
+
join22(projectPath, ".codebyplan", "device.local.json"),
|
|
7369
6919
|
JSON.stringify({ device_id: deviceId }, null, 2) + "\n",
|
|
7370
6920
|
"utf-8"
|
|
7371
6921
|
);
|
|
@@ -7377,7 +6927,7 @@ async function runLocalMigration(projectPath) {
|
|
|
7377
6927
|
"Migration write incomplete: .codebyplan/repo.json was not persisted. Re-run migration to retry from a clean state."
|
|
7378
6928
|
);
|
|
7379
6929
|
}
|
|
7380
|
-
const gitignorePath =
|
|
6930
|
+
const gitignorePath = join22(projectPath, ".gitignore");
|
|
7381
6931
|
try {
|
|
7382
6932
|
const gitignoreContent = await readFile16(gitignorePath, "utf-8");
|
|
7383
6933
|
const legacyLine = ".codebyplan.local.json";
|
|
@@ -7440,7 +6990,7 @@ __export(config_exports, {
|
|
|
7440
6990
|
runConfig: () => runConfig
|
|
7441
6991
|
});
|
|
7442
6992
|
import { mkdir as mkdir7, readFile as readFile17, writeFile as writeFile13 } from "node:fs/promises";
|
|
7443
|
-
import { join as
|
|
6993
|
+
import { join as join23 } from "node:path";
|
|
7444
6994
|
async function runConfig() {
|
|
7445
6995
|
const flags = parseFlags(3);
|
|
7446
6996
|
const dryRun = hasFlag("dry-run", 3);
|
|
@@ -7473,7 +7023,7 @@ async function runConfig() {
|
|
|
7473
7023
|
console.log("\n Config complete.\n");
|
|
7474
7024
|
}
|
|
7475
7025
|
async function syncConfigToFile(repoId, projectPath, dryRun) {
|
|
7476
|
-
const codebyplanDir =
|
|
7026
|
+
const codebyplanDir = join23(projectPath, ".codebyplan");
|
|
7477
7027
|
const {
|
|
7478
7028
|
resolvedWorktreeId,
|
|
7479
7029
|
portAllocations,
|
|
@@ -7541,7 +7091,6 @@ async function syncConfigToFile(repoId, projectPath, dryRun) {
|
|
|
7541
7091
|
const vendorPayload = {};
|
|
7542
7092
|
const e2ePayload = {};
|
|
7543
7093
|
const eslintPayload = {};
|
|
7544
|
-
const cmuxPayload = {};
|
|
7545
7094
|
if (dryRun) {
|
|
7546
7095
|
console.log(" Config would be updated (dry-run).");
|
|
7547
7096
|
return;
|
|
@@ -7554,12 +7103,11 @@ async function syncConfigToFile(repoId, projectPath, dryRun) {
|
|
|
7554
7103
|
{ name: "shipment.json", payload: shipmentPayload },
|
|
7555
7104
|
{ name: "vendor.json", payload: vendorPayload },
|
|
7556
7105
|
{ name: "e2e.json", payload: e2ePayload, createOnly: true },
|
|
7557
|
-
{ name: "eslint.json", payload: eslintPayload, createOnly: true }
|
|
7558
|
-
{ name: "cmux.json", payload: cmuxPayload, createOnly: true }
|
|
7106
|
+
{ name: "eslint.json", payload: eslintPayload, createOnly: true }
|
|
7559
7107
|
];
|
|
7560
7108
|
let anyUpdated = false;
|
|
7561
7109
|
for (const { name, payload, createOnly } of files) {
|
|
7562
|
-
const filePath =
|
|
7110
|
+
const filePath = join23(codebyplanDir, name);
|
|
7563
7111
|
const newJson = JSON.stringify(payload, null, 2) + "\n";
|
|
7564
7112
|
let currentJson = "";
|
|
7565
7113
|
try {
|
|
@@ -7579,7 +7127,7 @@ async function syncConfigToFile(repoId, projectPath, dryRun) {
|
|
|
7579
7127
|
async function readRepoConfig(projectPath) {
|
|
7580
7128
|
try {
|
|
7581
7129
|
const raw = await readFile17(
|
|
7582
|
-
|
|
7130
|
+
join23(projectPath, ".codebyplan", "repo.json"),
|
|
7583
7131
|
"utf-8"
|
|
7584
7132
|
);
|
|
7585
7133
|
return JSON.parse(raw);
|
|
@@ -7590,7 +7138,7 @@ async function readRepoConfig(projectPath) {
|
|
|
7590
7138
|
async function readServerConfig(projectPath) {
|
|
7591
7139
|
try {
|
|
7592
7140
|
const raw = await readFile17(
|
|
7593
|
-
|
|
7141
|
+
join23(projectPath, ".codebyplan", "server.json"),
|
|
7594
7142
|
"utf-8"
|
|
7595
7143
|
);
|
|
7596
7144
|
return JSON.parse(raw);
|
|
@@ -7601,7 +7149,7 @@ async function readServerConfig(projectPath) {
|
|
|
7601
7149
|
async function readGitConfig(projectPath) {
|
|
7602
7150
|
try {
|
|
7603
7151
|
const raw = await readFile17(
|
|
7604
|
-
|
|
7152
|
+
join23(projectPath, ".codebyplan", "git.json"),
|
|
7605
7153
|
"utf-8"
|
|
7606
7154
|
);
|
|
7607
7155
|
return JSON.parse(raw);
|
|
@@ -7612,7 +7160,7 @@ async function readGitConfig(projectPath) {
|
|
|
7612
7160
|
async function readShipmentConfig(projectPath) {
|
|
7613
7161
|
try {
|
|
7614
7162
|
const raw = await readFile17(
|
|
7615
|
-
|
|
7163
|
+
join23(projectPath, ".codebyplan", "shipment.json"),
|
|
7616
7164
|
"utf-8"
|
|
7617
7165
|
);
|
|
7618
7166
|
return JSON.parse(raw);
|
|
@@ -7623,7 +7171,7 @@ async function readShipmentConfig(projectPath) {
|
|
|
7623
7171
|
async function readVendorConfig(projectPath) {
|
|
7624
7172
|
try {
|
|
7625
7173
|
const raw = await readFile17(
|
|
7626
|
-
|
|
7174
|
+
join23(projectPath, ".codebyplan", "vendor.json"),
|
|
7627
7175
|
"utf-8"
|
|
7628
7176
|
);
|
|
7629
7177
|
return JSON.parse(raw);
|
|
@@ -7634,7 +7182,7 @@ async function readVendorConfig(projectPath) {
|
|
|
7634
7182
|
async function readE2eConfig2(projectPath) {
|
|
7635
7183
|
try {
|
|
7636
7184
|
const raw = await readFile17(
|
|
7637
|
-
|
|
7185
|
+
join23(projectPath, ".codebyplan", "e2e.json"),
|
|
7638
7186
|
"utf-8"
|
|
7639
7187
|
);
|
|
7640
7188
|
return JSON.parse(raw);
|
|
@@ -7645,7 +7193,7 @@ async function readE2eConfig2(projectPath) {
|
|
|
7645
7193
|
async function readServerLocalConfig(projectPath) {
|
|
7646
7194
|
try {
|
|
7647
7195
|
const raw = await readFile17(
|
|
7648
|
-
|
|
7196
|
+
join23(projectPath, ".codebyplan", "server.local.json"),
|
|
7649
7197
|
"utf-8"
|
|
7650
7198
|
);
|
|
7651
7199
|
return JSON.parse(raw);
|
|
@@ -7821,7 +7369,7 @@ __export(ports_exports, {
|
|
|
7821
7369
|
runPorts: () => runPorts
|
|
7822
7370
|
});
|
|
7823
7371
|
import { mkdir as mkdir8, readFile as readFile19, writeFile as writeFile14 } from "node:fs/promises";
|
|
7824
|
-
import { join as
|
|
7372
|
+
import { join as join24 } from "node:path";
|
|
7825
7373
|
async function runPorts() {
|
|
7826
7374
|
const flags = parseFlags(3);
|
|
7827
7375
|
const dryRun = hasFlag("dry-run", 3);
|
|
@@ -7942,8 +7490,8 @@ async function writeServerLocalConfig(repoId, projectPath, dryRun) {
|
|
|
7942
7490
|
// and ServerLocalConfig.port_allocations is typed the same — honest end-to-end.
|
|
7943
7491
|
port_allocations: portAllocations
|
|
7944
7492
|
};
|
|
7945
|
-
const codebyplanDir =
|
|
7946
|
-
const filePath =
|
|
7493
|
+
const codebyplanDir = join24(projectPath, ".codebyplan");
|
|
7494
|
+
const filePath = join24(codebyplanDir, "server.local.json");
|
|
7947
7495
|
const newJson = JSON.stringify(payload, null, 2) + "\n";
|
|
7948
7496
|
let currentJson = "";
|
|
7949
7497
|
try {
|
|
@@ -7965,8 +7513,8 @@ async function writeServerLocalConfig(repoId, projectPath, dryRun) {
|
|
|
7965
7513
|
);
|
|
7966
7514
|
}
|
|
7967
7515
|
async function provisionE2eEnv(projectPath, dryRun) {
|
|
7968
|
-
const relSource =
|
|
7969
|
-
const sourcePath =
|
|
7516
|
+
const relSource = join24("apps", "web", ".env.local");
|
|
7517
|
+
const sourcePath = join24(projectPath, relSource);
|
|
7970
7518
|
let sourceRaw;
|
|
7971
7519
|
try {
|
|
7972
7520
|
sourceRaw = await readFile19(sourcePath, "utf-8");
|
|
@@ -7998,8 +7546,8 @@ async function provisionE2eEnv(projectPath, dryRun) {
|
|
|
7998
7546
|
);
|
|
7999
7547
|
return;
|
|
8000
7548
|
}
|
|
8001
|
-
const codebyplanDir =
|
|
8002
|
-
const filePath =
|
|
7549
|
+
const codebyplanDir = join24(projectPath, ".codebyplan");
|
|
7550
|
+
const filePath = join24(codebyplanDir, "e2e.env");
|
|
8003
7551
|
const newContent = lines.join("\n") + "\n";
|
|
8004
7552
|
let currentContent = "";
|
|
8005
7553
|
try {
|
|
@@ -8127,10 +7675,10 @@ async function runTechStack() {
|
|
|
8127
7675
|
);
|
|
8128
7676
|
}
|
|
8129
7677
|
try {
|
|
8130
|
-
const { execSync:
|
|
7678
|
+
const { execSync: execSync8 } = await import("node:child_process");
|
|
8131
7679
|
let branch = "main";
|
|
8132
7680
|
try {
|
|
8133
|
-
branch =
|
|
7681
|
+
branch = execSync8("git symbolic-ref --short HEAD", {
|
|
8134
7682
|
cwd: projectPath,
|
|
8135
7683
|
encoding: "utf-8"
|
|
8136
7684
|
}).trim();
|
|
@@ -8929,13 +8477,13 @@ var init_uninstall = __esm({
|
|
|
8929
8477
|
|
|
8930
8478
|
// src/index.ts
|
|
8931
8479
|
init_version();
|
|
8932
|
-
import { readFileSync as
|
|
8480
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
8933
8481
|
import { resolve as resolve7 } from "node:path";
|
|
8934
8482
|
void (async () => {
|
|
8935
8483
|
if (!process.env.CODEBYPLAN_API_KEY) {
|
|
8936
8484
|
try {
|
|
8937
8485
|
const envPath = resolve7(process.cwd(), ".env.local");
|
|
8938
|
-
const content =
|
|
8486
|
+
const content = readFileSync8(envPath, "utf-8");
|
|
8939
8487
|
for (const line of content.split("\n")) {
|
|
8940
8488
|
const trimmed = line.trim();
|
|
8941
8489
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -9073,23 +8621,6 @@ void (async () => {
|
|
|
9073
8621
|
await runUploadE2eImagesCommand2(rest);
|
|
9074
8622
|
process.exit(0);
|
|
9075
8623
|
}
|
|
9076
|
-
if (arg === "cmux-sync") {
|
|
9077
|
-
const { runCmuxSync: runCmuxSync2 } = await Promise.resolve().then(() => (init_cmux_sync(), cmux_sync_exports));
|
|
9078
|
-
await runCmuxSync2();
|
|
9079
|
-
process.exit(0);
|
|
9080
|
-
}
|
|
9081
|
-
if (arg === "cmux-status") {
|
|
9082
|
-
const { runCmuxStatus: runCmuxStatus2 } = await Promise.resolve().then(() => (init_cmux_status(), cmux_status_exports));
|
|
9083
|
-
const rest = process.argv.slice(3);
|
|
9084
|
-
await runCmuxStatus2(rest);
|
|
9085
|
-
process.exit(0);
|
|
9086
|
-
}
|
|
9087
|
-
if (arg === "cmux-serve") {
|
|
9088
|
-
const { runCmuxServe: runCmuxServe2 } = await Promise.resolve().then(() => (init_cmux_serve(), cmux_serve_exports));
|
|
9089
|
-
const rest = process.argv.slice(3);
|
|
9090
|
-
await runCmuxServe2(rest);
|
|
9091
|
-
process.exit(0);
|
|
9092
|
-
}
|
|
9093
8624
|
if (arg === "config") {
|
|
9094
8625
|
const { runConfig: runConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
9095
8626
|
await runConfig2();
|
|
@@ -9193,9 +8724,6 @@ void (async () => {
|
|
|
9193
8724
|
codebyplan statusline Show or set the statusline renderer (bash/node/python)
|
|
9194
8725
|
codebyplan resolve-worktree Resolve active worktree UUID from device+path+branch tuple
|
|
9195
8726
|
codebyplan version-status Report installed vs latest version + update guard (JSON)
|
|
9196
|
-
codebyplan cmux-sync Sync cmux workspace title/description to current git branch and repo folder
|
|
9197
|
-
codebyplan cmux-status Push checkpoint/task/QA + progress to the cmux workspace sidebar
|
|
9198
|
-
codebyplan cmux-serve Auto-start dev server + browser pane for the round's app files (cmux)
|
|
9199
8727
|
codebyplan help Show this help message
|
|
9200
8728
|
codebyplan --version Print version
|
|
9201
8729
|
|