monty-cli 0.1.3 → 0.1.4
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/monty.js +47 -0
- package/package.json +1 -1
package/monty.js
CHANGED
|
@@ -61,12 +61,15 @@ async function install(args) {
|
|
|
61
61
|
upsertHookJson(codexPath, "codex");
|
|
62
62
|
upsertCodexOtelConfig(codexConfigPath, config);
|
|
63
63
|
|
|
64
|
+
installLaunchdDaemon();
|
|
65
|
+
|
|
64
66
|
console.log(`Monty installed for ${config.teamId}`);
|
|
65
67
|
console.log(`Site: ${config.siteUrl}`);
|
|
66
68
|
if (config.githubLogin) console.log(`GitHub avatar: ${config.githubLogin}`);
|
|
67
69
|
console.log(`Claude hook: ${claudePath}`);
|
|
68
70
|
console.log(`Codex hook: ${codexPath}`);
|
|
69
71
|
console.log(`Codex telemetry: ${codexConfigPath}`);
|
|
72
|
+
console.log(`Daemon: com.monty.daemon (launchd)`);
|
|
70
73
|
console.log("");
|
|
71
74
|
|
|
72
75
|
if (!options["no-sync"]) {
|
|
@@ -725,6 +728,50 @@ function doctor() {
|
|
|
725
728
|
}
|
|
726
729
|
}
|
|
727
730
|
|
|
731
|
+
function installLaunchdDaemon() {
|
|
732
|
+
const label = "com.monty.daemon";
|
|
733
|
+
const plistPath = path.join(home, "Library", "LaunchAgents", `${label}.plist`);
|
|
734
|
+
const logPath = path.join(montyDir, "daemon.log");
|
|
735
|
+
|
|
736
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
737
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
738
|
+
<plist version="1.0">
|
|
739
|
+
<dict>
|
|
740
|
+
<key>Label</key>
|
|
741
|
+
<string>${label}</string>
|
|
742
|
+
<key>ProgramArguments</key>
|
|
743
|
+
<array>
|
|
744
|
+
<string>${process.execPath}</string>
|
|
745
|
+
<string>${installedCliPath}</string>
|
|
746
|
+
<string>daemon</string>
|
|
747
|
+
</array>
|
|
748
|
+
<key>RunAtLoad</key>
|
|
749
|
+
<true/>
|
|
750
|
+
<key>KeepAlive</key>
|
|
751
|
+
<true/>
|
|
752
|
+
<key>StandardOutPath</key>
|
|
753
|
+
<string>${logPath}</string>
|
|
754
|
+
<key>StandardErrorPath</key>
|
|
755
|
+
<string>${logPath}</string>
|
|
756
|
+
</dict>
|
|
757
|
+
</plist>
|
|
758
|
+
`;
|
|
759
|
+
|
|
760
|
+
try {
|
|
761
|
+
spawnSync("launchctl", ["unload", plistPath], { stdio: "ignore" });
|
|
762
|
+
} catch {}
|
|
763
|
+
|
|
764
|
+
fs.mkdirSync(path.dirname(plistPath), { recursive: true });
|
|
765
|
+
fs.writeFileSync(plistPath, plist);
|
|
766
|
+
|
|
767
|
+
const result = spawnSync("launchctl", ["load", plistPath], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
768
|
+
if (result.status === 0) {
|
|
769
|
+
console.log(`Daemon started (${label})`);
|
|
770
|
+
} else {
|
|
771
|
+
console.log(`Daemon plist written to ${plistPath} (launchctl load may need manual run)`);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
728
775
|
function upsertHookJson(filePath, source) {
|
|
729
776
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
730
777
|
const data = readJson(filePath, {});
|