@love-moon/conductor-cli 0.1.1 → 0.1.2

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.
@@ -11,8 +11,10 @@ import { startDaemon } from "../src/daemon.js";
11
11
 
12
12
  const argv = hideBin(process.argv);
13
13
 
14
+ const CLI_NAME = process.env.CONDUCTOR_CLI_NAME || "conductor-daemon";
15
+
14
16
  const args = yargs(argv)
15
- .scriptName("conductor-daemon")
17
+ .scriptName(CLI_NAME)
16
18
  .usage("Usage: $0 [--name <daemon-name>] [--clean-all] [--config-file <path>] [--nohup]")
17
19
  .option("name", {
18
20
  alias: "n",
@@ -56,7 +58,7 @@ if (args.nohup) {
56
58
  env: { ...process.env },
57
59
  });
58
60
  child.unref();
59
- process.stdout.write(`conductor-daemon running in background. Logs: ${logPath}\n`);
61
+ process.stdout.write(`${CLI_NAME} running in background. Logs: ${logPath}\n`);
60
62
  process.exit(0);
61
63
  }
62
64
 
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * conductor - Main CLI entry point with subcommand routing.
5
+ *
6
+ * Subcommands:
7
+ * fire - Run AI coding agents with Conductor integration
8
+ * daemon - Start long-running daemon for task orchestration
9
+ * config - Interactive configuration setup
10
+ */
11
+
12
+ import { fileURLToPath } from "node:url";
13
+ import path from "node:path";
14
+ import { createRequire } from "node:module";
15
+ import fs from "node:fs";
16
+ import yargs from "yargs/yargs";
17
+ import { hideBin } from "yargs/helpers";
18
+
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = path.dirname(__filename);
21
+ const require = createRequire(import.meta.url);
22
+ const PKG_ROOT = path.join(__dirname, "..");
23
+
24
+ const pkgJson = JSON.parse(fs.readFileSync(path.join(PKG_ROOT, "package.json"), "utf-8"));
25
+
26
+ // Parse command line arguments
27
+ const argv = process.argv.slice(2);
28
+
29
+ // If no arguments or help flag, show help
30
+ if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
31
+ showHelp();
32
+ process.exit(0);
33
+ }
34
+
35
+ // If version flag, show version
36
+ if (argv[0] === "--version" || argv[0] === "-v") {
37
+ console.log(`conductor version ${pkgJson.version}`);
38
+ process.exit(0);
39
+ }
40
+
41
+ // Get the subcommand
42
+ const subcommand = argv[0];
43
+
44
+ // Valid subcommands
45
+ const validSubcommands = ["fire", "daemon", "config"];
46
+
47
+ if (!validSubcommands.includes(subcommand)) {
48
+ console.error(`Error: Unknown subcommand '${subcommand}'`);
49
+ console.error(`Valid subcommands: ${validSubcommands.join(", ")}`);
50
+ console.error(`Run 'conductor --help' for usage information.`);
51
+ process.exit(1);
52
+ }
53
+
54
+ // Route to the appropriate subcommand
55
+ const subcommandArgs = argv.slice(1);
56
+
57
+ // Set environment variable to track the CLI name for logging
58
+ process.env.CONDUCTOR_CLI_NAME = `conductor ${subcommand}`;
59
+
60
+ // Import and execute the subcommand
61
+ const subcommandPath = path.join(__dirname, `conductor-${subcommand}.js`);
62
+
63
+ if (!fs.existsSync(subcommandPath)) {
64
+ console.error(`Error: Subcommand implementation not found: ${subcommandPath}`);
65
+ process.exit(1);
66
+ }
67
+
68
+ // Replace process.argv to pass the correct arguments to the subcommand
69
+ process.argv = [process.argv[0], subcommandPath, ...subcommandArgs];
70
+
71
+ // Dynamically import and execute the subcommand
72
+ import(subcommandPath).catch((error) => {
73
+ console.error(`Error loading subcommand '${subcommand}': ${error.message}`);
74
+ process.exit(1);
75
+ });
76
+
77
+ function showHelp() {
78
+ console.log(`conductor - Conductor CLI tool
79
+
80
+ Usage: conductor <subcommand> [options]
81
+
82
+ Subcommands:
83
+ fire Run AI coding agents with Conductor integration
84
+ daemon Start long-running daemon for task orchestration
85
+ config Interactive configuration setup
86
+
87
+ Options:
88
+ -h, --help Show this help message
89
+ -v, --version Show version information
90
+
91
+ Examples:
92
+ conductor fire -- "fix the bug"
93
+ conductor fire --backend claude -- "add feature"
94
+ conductor daemon --config-file ~/.conductor/config.yaml
95
+ conductor config
96
+
97
+ For subcommand-specific help:
98
+ conductor fire --help
99
+ conductor daemon --help
100
+ conductor config --help
101
+
102
+ Version: ${pkgJson.version}
103
+ `);
104
+ }
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@love-moon/conductor-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "bin": {
6
- "conductor-cli": "bin/conductor-fire.js",
7
- "conductor-fire": "bin/conductor-fire.js",
8
- "conductor-daemon": "bin/conductor-daemon.js",
9
- "conductor-config": "bin/conductor-config.js"
6
+ "conductor": "bin/conductor.js"
10
7
  },
11
8
  "files": [
12
9
  "bin",