deuk-agent-rule 2.2.0 → 2.2.1

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/scripts/cli.mjs CHANGED
@@ -1,110 +1,110 @@
1
- #!/usr/bin/env node
2
- import { existsSync } from "fs";
3
- import { dirname, join } from "path";
4
- import { fileURLToPath } from "url";
5
- import { parseArgs, parseTicketArgs } from "./cli-args.mjs";
6
- import { runInit, runMerge } from "./cli-init-commands.mjs";
7
- import { runTicketCreate, runTicketList, runTicketUse, runTicketClose } from "./cli-ticket-commands.mjs";
8
- import { loadInitConfig, writeInitConfig } from "./cli-prompts.mjs";
9
- import { runInteractive } from "./cli-prompts.mjs";
10
-
11
- const __dirname = dirname(fileURLToPath(import.meta.url));
12
- const pkgRoot = join(__dirname, "..");
13
- const bundleRoot = join(pkgRoot, "bundle");
14
- async function main() {
15
- const argv = process.argv.slice(2);
16
- const sub = argv[0];
17
- if (!sub || sub === "-h" || sub === "--help" || sub === "help") {
18
- printHelp();
19
- return;
20
- }
21
-
22
- const rest = argv.slice(1);
23
-
24
- if (sub === "ticket") {
25
- const action = rest[0];
26
- const opts = parseTicketArgs(rest.slice(1));
27
- if (action === "create") await runTicketCreate(opts);
28
- else if (action === "list") await runTicketList(opts);
29
- else if (action === "use") await runTicketUse(opts);
30
- else if (action === "close") await runTicketClose(opts);
31
- else if (action === "migrate") await runTicketMigrate(opts);
32
- else {
33
- console.error("Unknown ticket action: " + action);
34
- printHelp();
35
- }
36
- return;
37
- }
38
-
39
- if (sub === "init" || sub === "merge") {
40
- const opts = parseArgs(rest);
41
- if (opts.help) {
42
- printHelp();
43
- return;
44
- }
45
-
46
- const saved = loadInitConfig(opts.cwd);
47
- if (saved && !opts.interactive) {
48
- // CLI flags (opts) take precedence over saved config
49
- for (const key in saved) {
50
- if (opts[key] === undefined) opts[key] = saved[key];
51
- }
52
- console.log(`Using saved config from .deuk-agent-rule.config.json (CLI overrides applied)`);
53
- }
54
-
55
- if (sub === "init") {
56
- await handleInit(opts);
57
- } else {
58
- runMerge(opts, bundleRoot);
59
- }
60
- return;
61
- }
62
-
63
- console.error("Unknown command: " + sub);
64
- printHelp();
65
- }
66
-
67
- import { runTicketMigrate } from "./cli-ticket-commands.mjs";
68
-
69
- async function handleInit(opts) {
70
- if (!opts.interactive && !opts.nonInteractive && !loadInitConfig(opts.cwd)) {
71
- // If no config and not interactive, prompt unless non-interactive
72
- await runInteractive(opts);
73
- if (!opts.dryRun) writeInitConfig(opts.cwd, opts);
74
- } else if (opts.interactive) {
75
- await runInteractive(opts);
76
- if (!opts.dryRun) writeInitConfig(opts.cwd, opts);
77
- }
78
- await runInit(opts, bundleRoot);
79
- }
80
-
81
- function printHelp() {
82
- console.log(`DeukAgentRules CLI - Generalization Rules & Ticket Management
83
-
84
- Usage:
85
- npx deuk-agent-rule init [options]
86
- npx deuk-agent-rule merge [options]
87
- npx deuk-agent-rule ticket <create|list|use|close|migrate> [options]
88
-
89
- Options:
90
- --cwd <path> Target repo root
91
- --dry-run Print actions without writing
92
- --non-interactive CI/scripts mode: no prompts
93
- --tag <id> Custom marker ID (default: deuk-agent-rule)
94
- --agents <mode> inject | skip | overwrite
95
- --rules <mode> prefix | skip | overwrite
96
- --cursorrules <mode> inject | skip | overwrite
97
-
98
- Ticket Options:
99
- --topic <name> Ticket topic slug
100
- --group <name> Ticket group (sub|main|discussion)
101
- --project <name> Project filter (DeukUI|DeukAgentRules)
102
- --latest Use most recent ticket
103
- --path-only Print only the file path
104
- `);
105
- }
106
-
107
- main().catch(err => {
108
- console.error(err.message || err);
109
- process.exit(1);
110
- });
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "fs";
3
+ import { dirname, join } from "path";
4
+ import { fileURLToPath } from "url";
5
+ import { parseArgs, parseTicketArgs } from "./cli-args.mjs";
6
+ import { runInit, runMerge } from "./cli-init-commands.mjs";
7
+ import { runTicketCreate, runTicketList, runTicketUse, runTicketClose } from "./cli-ticket-commands.mjs";
8
+ import { loadInitConfig, writeInitConfig } from "./cli-prompts.mjs";
9
+ import { runInteractive } from "./cli-prompts.mjs";
10
+
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
12
+ const pkgRoot = join(__dirname, "..");
13
+ const bundleRoot = join(pkgRoot, "bundle");
14
+ async function main() {
15
+ const argv = process.argv.slice(2);
16
+ const sub = argv[0];
17
+ if (!sub || sub === "-h" || sub === "--help" || sub === "help") {
18
+ printHelp();
19
+ return;
20
+ }
21
+
22
+ const rest = argv.slice(1);
23
+
24
+ if (sub === "ticket") {
25
+ const action = rest[0];
26
+ const opts = parseTicketArgs(rest.slice(1));
27
+ if (action === "create") await runTicketCreate(opts);
28
+ else if (action === "list") await runTicketList(opts);
29
+ else if (action === "use") await runTicketUse(opts);
30
+ else if (action === "close") await runTicketClose(opts);
31
+ else if (action === "migrate") await runTicketMigrate(opts);
32
+ else {
33
+ console.error("Unknown ticket action: " + action);
34
+ printHelp();
35
+ }
36
+ return;
37
+ }
38
+
39
+ if (sub === "init" || sub === "merge") {
40
+ const opts = parseArgs(rest);
41
+ if (opts.help) {
42
+ printHelp();
43
+ return;
44
+ }
45
+
46
+ const saved = loadInitConfig(opts.cwd);
47
+ if (saved && !opts.interactive) {
48
+ // CLI flags (opts) take precedence over saved config
49
+ for (const key in saved) {
50
+ if (opts[key] === undefined) opts[key] = saved[key];
51
+ }
52
+ console.log(`Using saved config from .deuk-agent-rule.config.json (CLI overrides applied)`);
53
+ }
54
+
55
+ if (sub === "init") {
56
+ await handleInit(opts);
57
+ } else {
58
+ runMerge(opts, bundleRoot);
59
+ }
60
+ return;
61
+ }
62
+
63
+ console.error("Unknown command: " + sub);
64
+ printHelp();
65
+ }
66
+
67
+ import { runTicketMigrate } from "./cli-ticket-commands.mjs";
68
+
69
+ async function handleInit(opts) {
70
+ if (!opts.interactive && !opts.nonInteractive && !loadInitConfig(opts.cwd)) {
71
+ // If no config and not interactive, prompt unless non-interactive
72
+ await runInteractive(opts);
73
+ if (!opts.dryRun) writeInitConfig(opts.cwd, opts);
74
+ } else if (opts.interactive) {
75
+ await runInteractive(opts);
76
+ if (!opts.dryRun) writeInitConfig(opts.cwd, opts);
77
+ }
78
+ await runInit(opts, bundleRoot);
79
+ }
80
+
81
+ function printHelp() {
82
+ console.log(`DeukAgentRules CLI - Generalization Rules & Ticket Management
83
+
84
+ Usage:
85
+ npx deuk-agent-rule init [options]
86
+ npx deuk-agent-rule merge [options]
87
+ npx deuk-agent-rule ticket <create|list|use|close|migrate> [options]
88
+
89
+ Options:
90
+ --cwd <path> Target repo root
91
+ --dry-run Print actions without writing
92
+ --non-interactive CI/scripts mode: no prompts
93
+ --tag <id> Custom marker ID (default: deuk-agent-rule)
94
+ --agents <mode> inject | skip | overwrite
95
+ --rules <mode> prefix | skip | overwrite
96
+ --cursorrules <mode> inject | skip | overwrite
97
+
98
+ Ticket Options:
99
+ --topic <name> Ticket topic slug
100
+ --group <name> Ticket group (sub|main|discussion)
101
+ --project <name> Project filter (DeukUI|DeukAgentRules)
102
+ --latest Use most recent ticket
103
+ --path-only Print only the file path
104
+ `);
105
+ }
106
+
107
+ main().catch(err => {
108
+ console.error(err.message || err);
109
+ process.exit(1);
110
+ });