monty-cli 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/monty.js +48 -0
  2. 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"]) {
@@ -321,6 +324,7 @@ async function sendPresence() {
321
324
  headers,
322
325
  body: JSON.stringify({
323
326
  user_name: config.userName || process.env.MONTY_USER || process.env.USER || "unknown",
327
+ team_id: config.teamId || process.env.MONTY_TEAM_ID || "default",
324
328
  lid_closed: detectLidClosed(),
325
329
  sessions: detectSessions(),
326
330
  }),
@@ -725,6 +729,50 @@ function doctor() {
725
729
  }
726
730
  }
727
731
 
732
+ function installLaunchdDaemon() {
733
+ const label = "com.monty.daemon";
734
+ const plistPath = path.join(home, "Library", "LaunchAgents", `${label}.plist`);
735
+ const logPath = path.join(montyDir, "daemon.log");
736
+
737
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
738
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
739
+ <plist version="1.0">
740
+ <dict>
741
+ <key>Label</key>
742
+ <string>${label}</string>
743
+ <key>ProgramArguments</key>
744
+ <array>
745
+ <string>${process.execPath}</string>
746
+ <string>${installedCliPath}</string>
747
+ <string>daemon</string>
748
+ </array>
749
+ <key>RunAtLoad</key>
750
+ <true/>
751
+ <key>KeepAlive</key>
752
+ <true/>
753
+ <key>StandardOutPath</key>
754
+ <string>${logPath}</string>
755
+ <key>StandardErrorPath</key>
756
+ <string>${logPath}</string>
757
+ </dict>
758
+ </plist>
759
+ `;
760
+
761
+ try {
762
+ spawnSync("launchctl", ["unload", plistPath], { stdio: "ignore" });
763
+ } catch {}
764
+
765
+ fs.mkdirSync(path.dirname(plistPath), { recursive: true });
766
+ fs.writeFileSync(plistPath, plist);
767
+
768
+ const result = spawnSync("launchctl", ["load", plistPath], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
769
+ if (result.status === 0) {
770
+ console.log(`Daemon started (${label})`);
771
+ } else {
772
+ console.log(`Daemon plist written to ${plistPath} (launchctl load may need manual run)`);
773
+ }
774
+ }
775
+
728
776
  function upsertHookJson(filePath, source) {
729
777
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
730
778
  const data = readJson(filePath, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monty-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Live AI prompt feed and token leaderboard for your engineering team. Works with Claude Code and Codex CLI.",
5
5
  "license": "MIT",
6
6
  "bin": {