@iloom/cli 0.5.1 → 0.5.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.
- package/README.md +2 -0
- package/dist/{BranchNamingService-GCCWB3LK.js → BranchNamingService-B5PVRR7F.js} +4 -4
- package/dist/ClaudeContextManager-PQ46VILL.js +14 -0
- package/dist/ClaudeService-6OMO552H.js +13 -0
- package/dist/GitHubService-S2OGUTDR.js +12 -0
- package/dist/{LoomLauncher-JNWBMHES.js → LoomLauncher-ZHDTPKED.js} +13 -16
- package/dist/{LoomLauncher-JNWBMHES.js.map → LoomLauncher-ZHDTPKED.js.map} +1 -1
- package/dist/MetadataManager-DFI73J3G.js +10 -0
- package/dist/PRManager-OCSB2HPT.js +14 -0
- package/dist/PromptTemplateManager-5GNF7FCP.js +9 -0
- package/dist/README.md +2 -0
- package/dist/{SettingsManager-XPR4TEQL.js → SettingsManager-CNYBGXDT.js} +3 -3
- package/dist/SettingsMigrationManager-KZKDG66H.js +10 -0
- package/dist/{chunk-OEGECBFS.js → chunk-3PT7RKL5.js} +4 -4
- package/dist/{chunk-WUQQNE63.js → chunk-433MOLAU.js} +44 -7
- package/dist/chunk-433MOLAU.js.map +1 -0
- package/dist/{chunk-LN4H3A6A.js → chunk-53OMUNUN.js} +5 -5
- package/dist/{chunk-THF25ICZ.js → chunk-5F6IWWRS.js} +2 -2
- package/dist/{chunk-P2ZQ5LKB.js → chunk-5IWU3HXE.js} +5 -5
- package/dist/{chunk-QIUJPPJQ.js → chunk-5TXLVEXT.js} +3 -3
- package/dist/{chunk-TSLKDFAF.js → chunk-66BMJ25W.js} +7 -7
- package/dist/{chunk-6UIGZD2N.js → chunk-6MLEBAYZ.js} +2 -2
- package/dist/{chunk-BVIK2P6P.js → chunk-7HIRPCKU.js} +4 -4
- package/dist/{chunk-UNXRACJ7.js → chunk-7LSSNB7Y.js} +3 -3
- package/dist/{chunk-QHA67Q7A.js → chunk-7Q66W4OH.js} +2 -2
- package/dist/{chunk-RUC7OULH.js → chunk-AEIMYF4P.js} +6 -8
- package/dist/{chunk-RUC7OULH.js.map → chunk-AEIMYF4P.js.map} +1 -1
- package/dist/{chunk-MD6HA5IK.js → chunk-B2UO6EYE.js} +2 -2
- package/dist/{chunk-YZTDGPFB.js → chunk-CFUWQHCJ.js} +2 -2
- package/dist/{chunk-UYWAESOT.js → chunk-F2PWIRV4.js} +3 -3
- package/dist/{chunk-PSFVTBM7.js → chunk-FXDYIV3K.js} +2 -2
- package/dist/{chunk-CDQEK2WD.js → chunk-FXJKNVZW.js} +5 -5
- package/dist/{chunk-3CMGCRB5.js → chunk-HMMO2LDS.js} +3 -3
- package/dist/{chunk-OOU3DKNT.js → chunk-IDUICCZY.js} +2 -2
- package/dist/{chunk-HABINPX2.js → chunk-J7GHNTYK.js} +67 -11
- package/dist/chunk-J7GHNTYK.js.map +1 -0
- package/dist/{chunk-DKQ4SUII.js → chunk-K5G5SFWY.js} +2 -2
- package/dist/chunk-K5G5SFWY.js.map +1 -0
- package/dist/{chunk-KO2FOMHL.js → chunk-LT3SGBR7.js} +2 -2
- package/dist/{chunk-VBFDVGAE.js → chunk-LVLRMP7V.js} +2 -2
- package/dist/{chunk-RNZMHJK7.js → chunk-N4ZJVATC.js} +3 -3
- package/dist/chunk-NXMDEL3F.js +54 -0
- package/dist/chunk-NXMDEL3F.js.map +1 -0
- package/dist/{chunk-CDF7ZX2B.js → chunk-O7VL5N6S.js} +2 -2
- package/dist/{chunk-S65T4O6I.js → chunk-QPS6TZUW.js} +3 -3
- package/dist/{chunk-RJKMF6BC.js → chunk-SHVB3EFE.js} +3 -3
- package/dist/chunk-VT4PDUYT.js +578 -0
- package/dist/chunk-VT4PDUYT.js.map +1 -0
- package/dist/{chunk-4YTILIIH.js → chunk-VV66DH6T.js} +8 -8
- package/dist/{chunk-GVRO4PWE.js → chunk-XNNXAAZT.js} +6 -6
- package/dist/{chunk-AS2IRKLU.js → chunk-YU5HVI6B.js} +2 -2
- package/dist/{chunk-6KB7R22U.js → chunk-Z5BM4JWB.js} +25 -24
- package/dist/chunk-Z5BM4JWB.js.map +1 -0
- package/dist/{chunk-SJ2GZ6RF.js → chunk-ZX3GTM7O.js} +2 -2
- package/dist/{claude-ACVXNB6N.js → claude-H33OQMXO.js} +4 -6
- package/dist/{cleanup-LU6NU2NZ.js → cleanup-Y5W3CNUV.js} +20 -22
- package/dist/{cleanup-LU6NU2NZ.js.map → cleanup-Y5W3CNUV.js.map} +1 -1
- package/dist/cli.js +71 -73
- package/dist/cli.js.map +1 -1
- package/dist/{color-ZPIIUADB.js → color-4TJ4P5EY.js} +5 -3
- package/dist/{contribute-RS3DO3WP.js → contribute-SMIPMWCH.js} +9 -9
- package/dist/{contribute-RS3DO3WP.js.map → contribute-SMIPMWCH.js.map} +1 -1
- package/dist/{dev-server-ASH7HJVI.js → dev-server-HNBRWGCD.js} +11 -13
- package/dist/{dev-server-ASH7HJVI.js.map → dev-server-HNBRWGCD.js.map} +1 -1
- package/dist/{feedback-OFVW22UW.js → feedback-567ZH2O7.js} +11 -13
- package/dist/{feedback-OFVW22UW.js.map → feedback-567ZH2O7.js.map} +1 -1
- package/dist/{git-OQAPUPLP.js → git-OV6ADVO7.js} +6 -6
- package/dist/{ignite-NREQ3JRM.js → ignite-3HB3ZBEW.js} +15 -17
- package/dist/{ignite-NREQ3JRM.js.map → ignite-3HB3ZBEW.js.map} +1 -1
- package/dist/index.d.ts +54 -35
- package/dist/index.js +371 -276
- package/dist/index.js.map +1 -1
- package/dist/init-CMIRHFSR.js +19 -0
- package/dist/{installation-detector-6R6YOFVZ.js → installation-detector-VXZOCL6P.js} +3 -3
- package/dist/mcp/issue-management-server.js +62 -7
- package/dist/mcp/issue-management-server.js.map +1 -1
- package/dist/neon-helpers-3KBC4A3Y.js +11 -0
- package/dist/{open-KW4NTLXH.js → open-AXE225Z5.js} +11 -13
- package/dist/{open-KW4NTLXH.js.map → open-AXE225Z5.js.map} +1 -1
- package/dist/{projects-QEAEBAT2.js → projects-GVEMCN5R.js} +4 -4
- package/dist/{prompt-A7GGRHSY.js → prompt-3SAZYRUN.js} +3 -3
- package/dist/prompts/session-summary-prompt.txt +58 -4
- package/dist/{rebase-WZHHE5LU.js → rebase-6UIHMUWS.js} +9 -11
- package/dist/{rebase-WZHHE5LU.js.map → rebase-6UIHMUWS.js.map} +1 -1
- package/dist/{recap-33NPZ3ZO.js → recap-XTBNMEMO.js} +12 -19
- package/dist/recap-XTBNMEMO.js.map +1 -0
- package/dist/{remote-73TZ2ADI.js → remote-IJAMOEAP.js} +3 -3
- package/dist/{run-HRYQ7TR7.js → run-H375EYRB.js} +11 -13
- package/dist/{run-HRYQ7TR7.js.map → run-H375EYRB.js.map} +1 -1
- package/dist/{shell-JMU5XTHW.js → shell-33FJCWJQ.js} +9 -11
- package/dist/{shell-JMU5XTHW.js.map → shell-33FJCWJQ.js.map} +1 -1
- package/dist/{summary-4SSGGH7N.js → summary-JUMOCNLR.js} +14 -15
- package/dist/{summary-4SSGGH7N.js.map → summary-JUMOCNLR.js.map} +1 -1
- package/dist/{test-git-6SAIRBUD.js → test-git-CO3BA4BV.js} +6 -6
- package/dist/{test-prefix-RLVRK5ZD.js → test-prefix-HZYSDQYT.js} +6 -6
- package/dist/{test-tabs-3SCJWRKT.js → test-tabs-D3POYOJ5.js} +3 -6
- package/dist/{test-tabs-3SCJWRKT.js.map → test-tabs-D3POYOJ5.js.map} +1 -1
- package/dist/{test-webserver-VPNLAFZ3.js → test-webserver-YVQD42W6.js} +2 -2
- package/dist/{update-LETF5ASC.js → update-5NOHT4SG.js} +4 -4
- package/dist/{update-notifier-H55ZK7NU.js → update-notifier-ARA5SPUW.js} +3 -3
- package/package.json +1 -1
- package/dist/ClaudeContextManager-DQFKIMEP.js +0 -16
- package/dist/ClaudeService-CJS32WG2.js +0 -15
- package/dist/GitHubService-RPM27GWD.js +0 -12
- package/dist/MetadataManager-WXUVXKUS.js +0 -10
- package/dist/PRManager-7DSIMCAD.js +0 -16
- package/dist/PromptTemplateManager-72FEOGT6.js +0 -9
- package/dist/SettingsMigrationManager-EH3J2TCN.js +0 -10
- package/dist/chunk-6KB7R22U.js.map +0 -1
- package/dist/chunk-DKQ4SUII.js.map +0 -1
- package/dist/chunk-HABINPX2.js.map +0 -1
- package/dist/chunk-UYVWLISQ.js +0 -113
- package/dist/chunk-UYVWLISQ.js.map +0 -1
- package/dist/chunk-VAYGNQTE.js +0 -234
- package/dist/chunk-VAYGNQTE.js.map +0 -1
- package/dist/chunk-WUQQNE63.js.map +0 -1
- package/dist/chunk-Z5NXYJIG.js +0 -207
- package/dist/chunk-Z5NXYJIG.js.map +0 -1
- package/dist/init-F6PFMSU5.js +0 -21
- package/dist/neon-helpers-L5CXQ5CT.js +0 -11
- package/dist/recap-33NPZ3ZO.js.map +0 -1
- /package/dist/{BranchNamingService-GCCWB3LK.js.map → BranchNamingService-B5PVRR7F.js.map} +0 -0
- /package/dist/{ClaudeContextManager-DQFKIMEP.js.map → ClaudeContextManager-PQ46VILL.js.map} +0 -0
- /package/dist/{ClaudeService-CJS32WG2.js.map → ClaudeService-6OMO552H.js.map} +0 -0
- /package/dist/{GitHubService-RPM27GWD.js.map → GitHubService-S2OGUTDR.js.map} +0 -0
- /package/dist/{MetadataManager-WXUVXKUS.js.map → MetadataManager-DFI73J3G.js.map} +0 -0
- /package/dist/{PRManager-7DSIMCAD.js.map → PRManager-OCSB2HPT.js.map} +0 -0
- /package/dist/{PromptTemplateManager-72FEOGT6.js.map → PromptTemplateManager-5GNF7FCP.js.map} +0 -0
- /package/dist/{SettingsManager-XPR4TEQL.js.map → SettingsManager-CNYBGXDT.js.map} +0 -0
- /package/dist/{SettingsMigrationManager-EH3J2TCN.js.map → SettingsMigrationManager-KZKDG66H.js.map} +0 -0
- /package/dist/{chunk-OEGECBFS.js.map → chunk-3PT7RKL5.js.map} +0 -0
- /package/dist/{chunk-LN4H3A6A.js.map → chunk-53OMUNUN.js.map} +0 -0
- /package/dist/{chunk-THF25ICZ.js.map → chunk-5F6IWWRS.js.map} +0 -0
- /package/dist/{chunk-P2ZQ5LKB.js.map → chunk-5IWU3HXE.js.map} +0 -0
- /package/dist/{chunk-QIUJPPJQ.js.map → chunk-5TXLVEXT.js.map} +0 -0
- /package/dist/{chunk-TSLKDFAF.js.map → chunk-66BMJ25W.js.map} +0 -0
- /package/dist/{chunk-6UIGZD2N.js.map → chunk-6MLEBAYZ.js.map} +0 -0
- /package/dist/{chunk-BVIK2P6P.js.map → chunk-7HIRPCKU.js.map} +0 -0
- /package/dist/{chunk-UNXRACJ7.js.map → chunk-7LSSNB7Y.js.map} +0 -0
- /package/dist/{chunk-QHA67Q7A.js.map → chunk-7Q66W4OH.js.map} +0 -0
- /package/dist/{chunk-MD6HA5IK.js.map → chunk-B2UO6EYE.js.map} +0 -0
- /package/dist/{chunk-YZTDGPFB.js.map → chunk-CFUWQHCJ.js.map} +0 -0
- /package/dist/{chunk-UYWAESOT.js.map → chunk-F2PWIRV4.js.map} +0 -0
- /package/dist/{chunk-PSFVTBM7.js.map → chunk-FXDYIV3K.js.map} +0 -0
- /package/dist/{chunk-CDQEK2WD.js.map → chunk-FXJKNVZW.js.map} +0 -0
- /package/dist/{chunk-3CMGCRB5.js.map → chunk-HMMO2LDS.js.map} +0 -0
- /package/dist/{chunk-OOU3DKNT.js.map → chunk-IDUICCZY.js.map} +0 -0
- /package/dist/{chunk-KO2FOMHL.js.map → chunk-LT3SGBR7.js.map} +0 -0
- /package/dist/{chunk-VBFDVGAE.js.map → chunk-LVLRMP7V.js.map} +0 -0
- /package/dist/{chunk-RNZMHJK7.js.map → chunk-N4ZJVATC.js.map} +0 -0
- /package/dist/{chunk-CDF7ZX2B.js.map → chunk-O7VL5N6S.js.map} +0 -0
- /package/dist/{chunk-S65T4O6I.js.map → chunk-QPS6TZUW.js.map} +0 -0
- /package/dist/{chunk-RJKMF6BC.js.map → chunk-SHVB3EFE.js.map} +0 -0
- /package/dist/{chunk-4YTILIIH.js.map → chunk-VV66DH6T.js.map} +0 -0
- /package/dist/{chunk-GVRO4PWE.js.map → chunk-XNNXAAZT.js.map} +0 -0
- /package/dist/{chunk-AS2IRKLU.js.map → chunk-YU5HVI6B.js.map} +0 -0
- /package/dist/{chunk-SJ2GZ6RF.js.map → chunk-ZX3GTM7O.js.map} +0 -0
- /package/dist/{claude-ACVXNB6N.js.map → claude-H33OQMXO.js.map} +0 -0
- /package/dist/{color-ZPIIUADB.js.map → color-4TJ4P5EY.js.map} +0 -0
- /package/dist/{git-OQAPUPLP.js.map → git-OV6ADVO7.js.map} +0 -0
- /package/dist/{init-F6PFMSU5.js.map → init-CMIRHFSR.js.map} +0 -0
- /package/dist/{installation-detector-6R6YOFVZ.js.map → installation-detector-VXZOCL6P.js.map} +0 -0
- /package/dist/{neon-helpers-L5CXQ5CT.js.map → neon-helpers-3KBC4A3Y.js.map} +0 -0
- /package/dist/{projects-QEAEBAT2.js.map → projects-GVEMCN5R.js.map} +0 -0
- /package/dist/{prompt-A7GGRHSY.js.map → prompt-3SAZYRUN.js.map} +0 -0
- /package/dist/{remote-73TZ2ADI.js.map → remote-IJAMOEAP.js.map} +0 -0
- /package/dist/{test-git-6SAIRBUD.js.map → test-git-CO3BA4BV.js.map} +0 -0
- /package/dist/{test-prefix-RLVRK5ZD.js.map → test-prefix-HZYSDQYT.js.map} +0 -0
- /package/dist/{test-webserver-VPNLAFZ3.js.map → test-webserver-YVQD42W6.js.map} +0 -0
- /package/dist/{update-LETF5ASC.js.map → update-5NOHT4SG.js.map} +0 -0
- /package/dist/{update-notifier-H55ZK7NU.js.map → update-notifier-ARA5SPUW.js.map} +0 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/utils/env.ts
|
|
4
|
+
import path from "path";
|
|
5
|
+
import dotenvFlow from "dotenv-flow";
|
|
6
|
+
|
|
7
|
+
// src/utils/logger.ts
|
|
8
|
+
import chalk, { Chalk } from "chalk";
|
|
9
|
+
|
|
10
|
+
// src/utils/terminal.ts
|
|
11
|
+
import { execa } from "execa";
|
|
12
|
+
import { existsSync } from "fs";
|
|
13
|
+
function detectPlatform() {
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
if (platform === "darwin") return "darwin";
|
|
16
|
+
if (platform === "linux") return "linux";
|
|
17
|
+
if (platform === "win32") return "win32";
|
|
18
|
+
return "unsupported";
|
|
19
|
+
}
|
|
20
|
+
async function detectDarkMode() {
|
|
21
|
+
const platform = detectPlatform();
|
|
22
|
+
if (platform !== "darwin") {
|
|
23
|
+
return "light";
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const result = await execa("defaults", ["read", "-g", "AppleInterfaceStyle"]);
|
|
27
|
+
return result.stdout.trim().toLowerCase() === "dark" ? "dark" : "light";
|
|
28
|
+
} catch {
|
|
29
|
+
return "light";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function detectITerm2() {
|
|
33
|
+
const platform = detectPlatform();
|
|
34
|
+
if (platform !== "darwin") return false;
|
|
35
|
+
return existsSync("/Applications/iTerm.app");
|
|
36
|
+
}
|
|
37
|
+
async function openTerminalWindow(options) {
|
|
38
|
+
const platform = detectPlatform();
|
|
39
|
+
if (platform !== "darwin") {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Terminal window launching not yet supported on ${platform}. Currently only macOS is supported.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const hasITerm2 = await detectITerm2();
|
|
45
|
+
const applescript = hasITerm2 ? await buildITerm2SingleTabScript(options) : await buildAppleScript(options);
|
|
46
|
+
try {
|
|
47
|
+
await execa("osascript", ["-e", applescript]);
|
|
48
|
+
if (!hasITerm2) {
|
|
49
|
+
await execa("osascript", ["-e", 'tell application "Terminal" to activate']);
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Failed to open terminal window: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function buildAppleScript(options) {
|
|
58
|
+
const {
|
|
59
|
+
workspacePath,
|
|
60
|
+
command,
|
|
61
|
+
backgroundColor,
|
|
62
|
+
port,
|
|
63
|
+
includeEnvSetup,
|
|
64
|
+
includePortExport
|
|
65
|
+
} = options;
|
|
66
|
+
const commands = [];
|
|
67
|
+
if (workspacePath) {
|
|
68
|
+
commands.push(`cd '${escapePathForAppleScript(workspacePath)}'`);
|
|
69
|
+
}
|
|
70
|
+
if (includeEnvSetup && workspacePath) {
|
|
71
|
+
const sourceCommands = await buildEnvSourceCommands(
|
|
72
|
+
workspacePath,
|
|
73
|
+
async (p) => existsSync(p)
|
|
74
|
+
);
|
|
75
|
+
commands.push(...sourceCommands);
|
|
76
|
+
}
|
|
77
|
+
if (includePortExport && port !== void 0) {
|
|
78
|
+
commands.push(`export PORT=${port}`);
|
|
79
|
+
}
|
|
80
|
+
if (command) {
|
|
81
|
+
commands.push(command);
|
|
82
|
+
}
|
|
83
|
+
const fullCommand = commands.join(" && ");
|
|
84
|
+
const historyFreeCommand = ` ${fullCommand}`;
|
|
85
|
+
let script = `tell application "Terminal"
|
|
86
|
+
`;
|
|
87
|
+
script += ` set newTab to do script "${escapeForAppleScript(historyFreeCommand)}"
|
|
88
|
+
`;
|
|
89
|
+
if (backgroundColor) {
|
|
90
|
+
const { r, g, b } = backgroundColor;
|
|
91
|
+
script += ` set background color of newTab to {${Math.round(r * 257)}, ${Math.round(g * 257)}, ${Math.round(b * 257)}}
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
script += `end tell`;
|
|
95
|
+
return script;
|
|
96
|
+
}
|
|
97
|
+
function escapePathForAppleScript(path2) {
|
|
98
|
+
return path2.replace(/'/g, "'\\''");
|
|
99
|
+
}
|
|
100
|
+
function escapeForAppleScript(command) {
|
|
101
|
+
return command.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
102
|
+
}
|
|
103
|
+
async function buildITerm2SingleTabScript(options) {
|
|
104
|
+
const command = await buildCommandSequence(options);
|
|
105
|
+
let script = 'tell application id "com.googlecode.iterm2"\n';
|
|
106
|
+
script += " create window with default profile\n";
|
|
107
|
+
script += " set s1 to current session of current window\n\n";
|
|
108
|
+
if (options.backgroundColor) {
|
|
109
|
+
const { r, g, b } = options.backgroundColor;
|
|
110
|
+
script += ` set background color of s1 to {${Math.round(r * 257)}, ${Math.round(g * 257)}, ${Math.round(b * 257)}}
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
script += ` tell s1 to write text "${escapeForAppleScript(command)}"
|
|
114
|
+
|
|
115
|
+
`;
|
|
116
|
+
if (options.title) {
|
|
117
|
+
script += ` set name of s1 to "${escapeForAppleScript(options.title)}"
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
script += " activate\n";
|
|
122
|
+
script += "end tell";
|
|
123
|
+
return script;
|
|
124
|
+
}
|
|
125
|
+
async function buildCommandSequence(options) {
|
|
126
|
+
const {
|
|
127
|
+
workspacePath,
|
|
128
|
+
command,
|
|
129
|
+
port,
|
|
130
|
+
includeEnvSetup,
|
|
131
|
+
includePortExport
|
|
132
|
+
} = options;
|
|
133
|
+
const commands = [];
|
|
134
|
+
if (workspacePath) {
|
|
135
|
+
commands.push(`cd '${escapePathForAppleScript(workspacePath)}'`);
|
|
136
|
+
}
|
|
137
|
+
if (includeEnvSetup && workspacePath) {
|
|
138
|
+
const sourceCommands = await buildEnvSourceCommands(
|
|
139
|
+
workspacePath,
|
|
140
|
+
async (p) => existsSync(p)
|
|
141
|
+
);
|
|
142
|
+
commands.push(...sourceCommands);
|
|
143
|
+
}
|
|
144
|
+
if (includePortExport && port !== void 0) {
|
|
145
|
+
commands.push(`export PORT=${port}`);
|
|
146
|
+
}
|
|
147
|
+
if (command) {
|
|
148
|
+
commands.push(command);
|
|
149
|
+
}
|
|
150
|
+
const fullCommand = commands.join(" && ");
|
|
151
|
+
return ` ${fullCommand}`;
|
|
152
|
+
}
|
|
153
|
+
async function buildITerm2MultiTabScript(optionsArray) {
|
|
154
|
+
if (optionsArray.length < 2) {
|
|
155
|
+
throw new Error("buildITerm2MultiTabScript requires at least 2 terminal options");
|
|
156
|
+
}
|
|
157
|
+
let script = 'tell application id "com.googlecode.iterm2"\n';
|
|
158
|
+
script += " create window with default profile\n";
|
|
159
|
+
script += " set newWindow to current window\n";
|
|
160
|
+
const options1 = optionsArray[0];
|
|
161
|
+
if (!options1) {
|
|
162
|
+
throw new Error("First terminal option is undefined");
|
|
163
|
+
}
|
|
164
|
+
const command1 = await buildCommandSequence(options1);
|
|
165
|
+
script += " set s1 to current session of newWindow\n\n";
|
|
166
|
+
if (options1.backgroundColor) {
|
|
167
|
+
const { r, g, b } = options1.backgroundColor;
|
|
168
|
+
script += ` set background color of s1 to {${Math.round(r * 257)}, ${Math.round(g * 257)}, ${Math.round(b * 257)}}
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
script += ` tell s1 to write text "${escapeForAppleScript(command1)}"
|
|
172
|
+
|
|
173
|
+
`;
|
|
174
|
+
if (options1.title) {
|
|
175
|
+
script += ` set name of s1 to "${escapeForAppleScript(options1.title)}"
|
|
176
|
+
|
|
177
|
+
`;
|
|
178
|
+
}
|
|
179
|
+
for (let i = 1; i < optionsArray.length; i++) {
|
|
180
|
+
const options = optionsArray[i];
|
|
181
|
+
if (!options) {
|
|
182
|
+
throw new Error(`Terminal option at index ${i} is undefined`);
|
|
183
|
+
}
|
|
184
|
+
const command = await buildCommandSequence(options);
|
|
185
|
+
const sessionVar = `s${i + 1}`;
|
|
186
|
+
script += " tell newWindow\n";
|
|
187
|
+
script += ` set newTab${i} to (create tab with default profile)
|
|
188
|
+
`;
|
|
189
|
+
script += " end tell\n";
|
|
190
|
+
script += ` set ${sessionVar} to current session of newTab${i}
|
|
191
|
+
|
|
192
|
+
`;
|
|
193
|
+
if (options.backgroundColor) {
|
|
194
|
+
const { r, g, b } = options.backgroundColor;
|
|
195
|
+
script += ` set background color of ${sessionVar} to {${Math.round(r * 257)}, ${Math.round(g * 257)}, ${Math.round(b * 257)}}
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
script += ` tell ${sessionVar} to write text "${escapeForAppleScript(command)}"
|
|
199
|
+
|
|
200
|
+
`;
|
|
201
|
+
if (options.title) {
|
|
202
|
+
script += ` set name of ${sessionVar} to "${escapeForAppleScript(options.title)}"
|
|
203
|
+
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
script += " activate\n";
|
|
208
|
+
script += "end tell";
|
|
209
|
+
return script;
|
|
210
|
+
}
|
|
211
|
+
async function openMultipleTerminalWindows(optionsArray) {
|
|
212
|
+
if (optionsArray.length < 2) {
|
|
213
|
+
throw new Error("openMultipleTerminalWindows requires at least 2 terminal options. Use openTerminalWindow for single terminal.");
|
|
214
|
+
}
|
|
215
|
+
const platform = detectPlatform();
|
|
216
|
+
if (platform !== "darwin") {
|
|
217
|
+
throw new Error(
|
|
218
|
+
`Terminal window launching not yet supported on ${platform}. Currently only macOS is supported.`
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const hasITerm2 = await detectITerm2();
|
|
222
|
+
if (hasITerm2) {
|
|
223
|
+
const applescript = await buildITerm2MultiTabScript(optionsArray);
|
|
224
|
+
try {
|
|
225
|
+
await execa("osascript", ["-e", applescript]);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
`Failed to open iTerm2 window: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
for (let i = 0; i < optionsArray.length; i++) {
|
|
233
|
+
const options = optionsArray[i];
|
|
234
|
+
if (!options) {
|
|
235
|
+
throw new Error(`Terminal option at index ${i} is undefined`);
|
|
236
|
+
}
|
|
237
|
+
await openTerminalWindow(options);
|
|
238
|
+
if (i < optionsArray.length - 1) {
|
|
239
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/utils/logger.ts
|
|
246
|
+
var stdoutChalk = new Chalk({ level: chalk.level });
|
|
247
|
+
var stderrChalk = new Chalk({ level: chalk.level });
|
|
248
|
+
var currentThemeMode = "light";
|
|
249
|
+
async function initializeThemeMode() {
|
|
250
|
+
try {
|
|
251
|
+
currentThemeMode = await detectDarkMode();
|
|
252
|
+
} catch {
|
|
253
|
+
currentThemeMode = "light";
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
void initializeThemeMode();
|
|
257
|
+
function getInfoColor(chalkInstance) {
|
|
258
|
+
return currentThemeMode === "dark" ? chalkInstance.cyan : chalkInstance.blue;
|
|
259
|
+
}
|
|
260
|
+
function getSuccessColor(chalkInstance) {
|
|
261
|
+
return currentThemeMode === "dark" ? chalkInstance.greenBright : chalkInstance.green;
|
|
262
|
+
}
|
|
263
|
+
function getWarnColor(chalkInstance) {
|
|
264
|
+
return currentThemeMode === "dark" ? chalkInstance.yellowBright : chalkInstance.yellow;
|
|
265
|
+
}
|
|
266
|
+
function getErrorColor(chalkInstance) {
|
|
267
|
+
return currentThemeMode === "dark" ? chalkInstance.redBright : chalkInstance.red;
|
|
268
|
+
}
|
|
269
|
+
function getDebugColor(chalkInstance) {
|
|
270
|
+
return currentThemeMode === "dark" ? chalkInstance.gray : chalkInstance.gray;
|
|
271
|
+
}
|
|
272
|
+
function formatMessage(message, ...args) {
|
|
273
|
+
const formattedArgs = args.map(
|
|
274
|
+
(arg) => typeof arg === "object" ? JSON.stringify(arg, null, 2) : String(arg)
|
|
275
|
+
);
|
|
276
|
+
return formattedArgs.length > 0 ? `${message} ${formattedArgs.join(" ")}` : message;
|
|
277
|
+
}
|
|
278
|
+
function formatWithEmoji(message, emoji, colorFn) {
|
|
279
|
+
if (message.trim()) {
|
|
280
|
+
return colorFn(`${emoji} ${message}`);
|
|
281
|
+
} else {
|
|
282
|
+
return "";
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
var globalDebugEnabled = false;
|
|
286
|
+
var logger = {
|
|
287
|
+
info: (message, ...args) => {
|
|
288
|
+
const formatted = formatMessage(message, ...args);
|
|
289
|
+
const output = formatWithEmoji(formatted, "\u{1F5C2}\uFE0F ", getInfoColor(stdoutChalk));
|
|
290
|
+
console.log(output);
|
|
291
|
+
},
|
|
292
|
+
success: (message, ...args) => {
|
|
293
|
+
const formatted = formatMessage(message, ...args);
|
|
294
|
+
const output = formatWithEmoji(formatted, "\u2705", getSuccessColor(stdoutChalk));
|
|
295
|
+
console.log(output);
|
|
296
|
+
},
|
|
297
|
+
warn: (message, ...args) => {
|
|
298
|
+
const formatted = formatMessage(message, ...args);
|
|
299
|
+
const output = formatWithEmoji(formatted, "\u26A0\uFE0F ", getWarnColor(stderrChalk));
|
|
300
|
+
console.error(output);
|
|
301
|
+
},
|
|
302
|
+
error: (message, ...args) => {
|
|
303
|
+
const formatted = formatMessage(message, ...args);
|
|
304
|
+
const output = formatWithEmoji(formatted, "\u274C", getErrorColor(stderrChalk));
|
|
305
|
+
console.error(output);
|
|
306
|
+
},
|
|
307
|
+
debug: (message, ...args) => {
|
|
308
|
+
if (globalDebugEnabled) {
|
|
309
|
+
const formatted = formatMessage(message, ...args);
|
|
310
|
+
const output = formatWithEmoji(formatted, "\u{1F50D}", getDebugColor(stdoutChalk));
|
|
311
|
+
console.log(output);
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
setDebug: (enabled) => {
|
|
315
|
+
globalDebugEnabled = enabled;
|
|
316
|
+
},
|
|
317
|
+
isDebugEnabled: () => {
|
|
318
|
+
return globalDebugEnabled;
|
|
319
|
+
},
|
|
320
|
+
stdout: process.stdout
|
|
321
|
+
};
|
|
322
|
+
function createStderrLogger(options = {}) {
|
|
323
|
+
const { prefix = "", timestamp = false, forceColor, debug = globalDebugEnabled } = options;
|
|
324
|
+
let localDebugEnabled = debug;
|
|
325
|
+
const customChalk = forceColor !== void 0 ? new Chalk({ level: forceColor ? 3 : 0 }) : stderrChalk;
|
|
326
|
+
const prefixStr = prefix ? `[${prefix}] ` : "";
|
|
327
|
+
const getTimestamp = () => timestamp ? `[${(/* @__PURE__ */ new Date()).toISOString()}] ` : "";
|
|
328
|
+
return {
|
|
329
|
+
info: (message, ...args) => {
|
|
330
|
+
const formatted = formatMessage(message, ...args);
|
|
331
|
+
const fullMessage = `${getTimestamp()}${prefixStr}${formatted}`;
|
|
332
|
+
const output = formatWithEmoji(fullMessage, "\u{1F5C2}\uFE0F ", getInfoColor(customChalk));
|
|
333
|
+
console.error(output);
|
|
334
|
+
},
|
|
335
|
+
success: (message, ...args) => {
|
|
336
|
+
const formatted = formatMessage(message, ...args);
|
|
337
|
+
const fullMessage = `${getTimestamp()}${prefixStr}${formatted}`;
|
|
338
|
+
const output = formatWithEmoji(fullMessage, "\u2705", getSuccessColor(customChalk));
|
|
339
|
+
console.error(output);
|
|
340
|
+
},
|
|
341
|
+
warn: (message, ...args) => {
|
|
342
|
+
const formatted = formatMessage(message, ...args);
|
|
343
|
+
const fullMessage = `${getTimestamp()}${prefixStr}${formatted}`;
|
|
344
|
+
const output = formatWithEmoji(fullMessage, "\u26A0\uFE0F ", getWarnColor(customChalk));
|
|
345
|
+
console.error(output);
|
|
346
|
+
},
|
|
347
|
+
error: (message, ...args) => {
|
|
348
|
+
const formatted = formatMessage(message, ...args);
|
|
349
|
+
const fullMessage = `${getTimestamp()}${prefixStr}${formatted}`;
|
|
350
|
+
const output = formatWithEmoji(fullMessage, "\u274C", getErrorColor(customChalk));
|
|
351
|
+
console.error(output);
|
|
352
|
+
},
|
|
353
|
+
debug: (message, ...args) => {
|
|
354
|
+
if (localDebugEnabled) {
|
|
355
|
+
const formatted = formatMessage(message, ...args);
|
|
356
|
+
const fullMessage = `${getTimestamp()}${prefixStr}${formatted}`;
|
|
357
|
+
const output = formatWithEmoji(fullMessage, "\u{1F50D}", getDebugColor(customChalk));
|
|
358
|
+
console.error(output);
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
setDebug: (enabled) => {
|
|
362
|
+
localDebugEnabled = enabled;
|
|
363
|
+
},
|
|
364
|
+
isDebugEnabled: () => {
|
|
365
|
+
return globalDebugEnabled;
|
|
366
|
+
},
|
|
367
|
+
stdout: process.stderr
|
|
368
|
+
// Use stderr for progress output in JSON mode
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
var logger_default = logger;
|
|
372
|
+
|
|
373
|
+
// src/utils/env.ts
|
|
374
|
+
function parseEnvFile(content) {
|
|
375
|
+
const envMap = /* @__PURE__ */ new Map();
|
|
376
|
+
const lines = content.split("\n");
|
|
377
|
+
for (const line of lines) {
|
|
378
|
+
const trimmedLine = line.trim();
|
|
379
|
+
if (!trimmedLine || trimmedLine.startsWith("#")) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const cleanLine = trimmedLine.startsWith("export ") ? trimmedLine.substring(7) : trimmedLine;
|
|
383
|
+
const equalsIndex = cleanLine.indexOf("=");
|
|
384
|
+
if (equalsIndex === -1) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
const key = cleanLine.substring(0, equalsIndex).trim();
|
|
388
|
+
let value = cleanLine.substring(equalsIndex + 1);
|
|
389
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
390
|
+
value = value.substring(1, value.length - 1);
|
|
391
|
+
value = value.replace(/\\"/g, '"').replace(/\\'/g, "'");
|
|
392
|
+
value = value.replace(/\\n/g, "\n");
|
|
393
|
+
}
|
|
394
|
+
if (key) {
|
|
395
|
+
envMap.set(key, value);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return envMap;
|
|
399
|
+
}
|
|
400
|
+
function formatEnvLine(key, value) {
|
|
401
|
+
const escapedValue = value.replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
402
|
+
return `${key}="${escapedValue}"`;
|
|
403
|
+
}
|
|
404
|
+
function validateEnvVariable(key, _value) {
|
|
405
|
+
if (!key || key.length === 0) {
|
|
406
|
+
return {
|
|
407
|
+
valid: false,
|
|
408
|
+
error: "Environment variable key cannot be empty"
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
if (!isValidEnvKey(key)) {
|
|
412
|
+
return {
|
|
413
|
+
valid: false,
|
|
414
|
+
error: `Invalid environment variable name: ${key}. Must start with a letter or underscore and contain only letters, numbers, and underscores.`
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return { valid: true };
|
|
418
|
+
}
|
|
419
|
+
function extractPort(envContent) {
|
|
420
|
+
const portValue = envContent.get("PORT");
|
|
421
|
+
if (!portValue) {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
const port = parseInt(portValue, 10);
|
|
425
|
+
if (isNaN(port)) {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
return port;
|
|
429
|
+
}
|
|
430
|
+
function isValidEnvKey(key) {
|
|
431
|
+
if (!key || key.length === 0) {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
const validKeyRegex = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
435
|
+
return validKeyRegex.test(key);
|
|
436
|
+
}
|
|
437
|
+
function loadEnvIntoProcess(options) {
|
|
438
|
+
logger.debug("Loading environment variables with dotenv-flow", {
|
|
439
|
+
options: {
|
|
440
|
+
path: (options == null ? void 0 : options.path) ?? "current working directory",
|
|
441
|
+
nodeEnv: (options == null ? void 0 : options.nodeEnv) ?? "not specified",
|
|
442
|
+
defaultNodeEnv: (options == null ? void 0 : options.defaultNodeEnv) ?? "development (default)"
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
const configOptions = {
|
|
446
|
+
silent: true
|
|
447
|
+
// Don't throw errors if .env files are missing
|
|
448
|
+
};
|
|
449
|
+
if ((options == null ? void 0 : options.path) !== void 0) {
|
|
450
|
+
configOptions.path = options.path;
|
|
451
|
+
logger.debug(`Using custom path: ${options.path}`);
|
|
452
|
+
}
|
|
453
|
+
if ((options == null ? void 0 : options.nodeEnv) !== void 0) {
|
|
454
|
+
configOptions.node_env = options.nodeEnv;
|
|
455
|
+
logger.debug(`Using NODE_ENV: ${options.nodeEnv}`);
|
|
456
|
+
}
|
|
457
|
+
if ((options == null ? void 0 : options.defaultNodeEnv) !== void 0) {
|
|
458
|
+
configOptions.default_node_env = options.defaultNodeEnv;
|
|
459
|
+
logger.debug(`Using default NODE_ENV: ${options.defaultNodeEnv}`);
|
|
460
|
+
} else {
|
|
461
|
+
configOptions.default_node_env = "development";
|
|
462
|
+
logger.debug("Using default NODE_ENV: development");
|
|
463
|
+
}
|
|
464
|
+
logger.debug("dotenv-flow config options:", configOptions);
|
|
465
|
+
const result = dotenvFlow.config(configOptions);
|
|
466
|
+
const returnValue = {};
|
|
467
|
+
if (result.parsed) {
|
|
468
|
+
returnValue.parsed = result.parsed;
|
|
469
|
+
const variableCount = Object.keys(result.parsed).length;
|
|
470
|
+
logger.debug(`Successfully loaded ${variableCount} environment variables`);
|
|
471
|
+
} else {
|
|
472
|
+
logger.debug("No environment variables were parsed");
|
|
473
|
+
}
|
|
474
|
+
if (result.error) {
|
|
475
|
+
returnValue.error = result.error;
|
|
476
|
+
logger.debug("dotenv-flow returned an error", {
|
|
477
|
+
error: result.error.message,
|
|
478
|
+
name: result.error.name
|
|
479
|
+
});
|
|
480
|
+
} else {
|
|
481
|
+
logger.debug("dotenv-flow completed without errors");
|
|
482
|
+
}
|
|
483
|
+
return returnValue;
|
|
484
|
+
}
|
|
485
|
+
function isNoEnvFilesFoundError(error) {
|
|
486
|
+
return error.message.startsWith('no ".env*" files matching pattern');
|
|
487
|
+
}
|
|
488
|
+
function loadWorkspaceEnv(workspacePath) {
|
|
489
|
+
const nodeEnv = process.env.NODE_ENV ?? "development";
|
|
490
|
+
logger.debug("Loading workspace environment variables", {
|
|
491
|
+
workspacePath,
|
|
492
|
+
detectedNodeEnv: nodeEnv,
|
|
493
|
+
processNodeEnv: process.env.NODE_ENV ?? "not set"
|
|
494
|
+
});
|
|
495
|
+
return loadEnvIntoProcess({
|
|
496
|
+
path: workspacePath,
|
|
497
|
+
nodeEnv,
|
|
498
|
+
defaultNodeEnv: "development"
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
var DOTENV_FLOW_NODE_ENV = process.env.DOTENV_FLOW_NODE_ENV ?? "development";
|
|
502
|
+
function getDotenvFlowFiles() {
|
|
503
|
+
return [
|
|
504
|
+
".env",
|
|
505
|
+
".env.local",
|
|
506
|
+
`.env.${DOTENV_FLOW_NODE_ENV}`,
|
|
507
|
+
`.env.${DOTENV_FLOW_NODE_ENV}.local`
|
|
508
|
+
];
|
|
509
|
+
}
|
|
510
|
+
function getLocalEquivalent(filename) {
|
|
511
|
+
if (filename.endsWith(".local")) {
|
|
512
|
+
return filename;
|
|
513
|
+
}
|
|
514
|
+
return `${filename}.local`;
|
|
515
|
+
}
|
|
516
|
+
async function findEnvFileForDatabaseUrl(workspacePath, variableName, isFileTracked, fileExists, getEnvVariable) {
|
|
517
|
+
const file = await findEnvFileContainingVariable(workspacePath, variableName, fileExists, getEnvVariable);
|
|
518
|
+
if (file === null) {
|
|
519
|
+
return ".env.local";
|
|
520
|
+
}
|
|
521
|
+
const isTracked = await isFileTracked(file, workspacePath);
|
|
522
|
+
if (isTracked) {
|
|
523
|
+
return getLocalEquivalent(file);
|
|
524
|
+
}
|
|
525
|
+
return file;
|
|
526
|
+
}
|
|
527
|
+
async function buildEnvSourceCommands(workspacePath, fileExists) {
|
|
528
|
+
const files = getDotenvFlowFiles();
|
|
529
|
+
const commands = [];
|
|
530
|
+
for (const file of files) {
|
|
531
|
+
const fullPath = path.join(workspacePath, file);
|
|
532
|
+
const exists = await fileExists(fullPath);
|
|
533
|
+
if (exists) {
|
|
534
|
+
commands.push(`source ${file}`);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return commands;
|
|
538
|
+
}
|
|
539
|
+
async function findEnvFileContainingVariable(workspacePath, variableName, fileExists, getEnvVariable) {
|
|
540
|
+
const files = getDotenvFlowFiles().reverse();
|
|
541
|
+
for (const file of files) {
|
|
542
|
+
const fullPath = path.join(workspacePath, file);
|
|
543
|
+
if (!await fileExists(fullPath)) {
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
const value = await getEnvVariable(fullPath, variableName);
|
|
547
|
+
if (value !== null) {
|
|
548
|
+
return file;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
async function hasVariableInAnyEnvFile(workspacePath, variableName, fileExists, getEnvVariable) {
|
|
554
|
+
const file = await findEnvFileContainingVariable(workspacePath, variableName, fileExists, getEnvVariable);
|
|
555
|
+
return file !== null;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export {
|
|
559
|
+
parseEnvFile,
|
|
560
|
+
formatEnvLine,
|
|
561
|
+
validateEnvVariable,
|
|
562
|
+
extractPort,
|
|
563
|
+
loadEnvIntoProcess,
|
|
564
|
+
isNoEnvFilesFoundError,
|
|
565
|
+
loadWorkspaceEnv,
|
|
566
|
+
getDotenvFlowFiles,
|
|
567
|
+
findEnvFileForDatabaseUrl,
|
|
568
|
+
findEnvFileContainingVariable,
|
|
569
|
+
hasVariableInAnyEnvFile,
|
|
570
|
+
detectDarkMode,
|
|
571
|
+
detectITerm2,
|
|
572
|
+
openTerminalWindow,
|
|
573
|
+
openMultipleTerminalWindows,
|
|
574
|
+
logger,
|
|
575
|
+
createStderrLogger,
|
|
576
|
+
logger_default
|
|
577
|
+
};
|
|
578
|
+
//# sourceMappingURL=chunk-VT4PDUYT.js.map
|