deuk-agent-rule 2.2.2 → 2.3.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.
@@ -1,5 +1,51 @@
1
- import { existsSync, readFileSync } from "fs";
1
+ import { existsSync, readFileSync, writeFileSync } from "fs";
2
2
  import { basename, dirname, join, relative } from "path";
3
+ import YAML from "../node_modules/yaml/dist/index.js";
4
+
5
+ export const INIT_CONFIG_FILENAME = ".deuk-agent-rule.config.json";
6
+ export const INIT_CONFIG_VERSION = 1;
7
+
8
+ export const STACKS = [
9
+ { label: "Unity / C#", value: "unity" },
10
+ { label: "Unity + WebApp + C++ Server (Hybrid)", value: "unity-webapp-cpp" },
11
+ { label: "Next.js + C#", value: "nextjs-dotnet" },
12
+ { label: "Web (React / Vue / general)", value: "web" },
13
+ { label: "Java / Spring Boot", value: "java" },
14
+ { label: "Other / skip", value: "other" },
15
+ ];
16
+
17
+ export const AGENT_TOOLS = [
18
+ { label: "Cursor (Rule System)", value: "cursor" },
19
+ { label: "Gemini / Antigravity", value: "gemini" },
20
+ { label: "Claude / Dev", value: "claude" },
21
+ ];
22
+
23
+ export function loadInitConfig(cwd) {
24
+ const p = join(cwd, INIT_CONFIG_FILENAME);
25
+ if (!existsSync(p)) return null;
26
+ try {
27
+ const j = JSON.parse(readFileSync(p, "utf8"));
28
+ if (j.version !== INIT_CONFIG_VERSION) return null;
29
+ return j;
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+
35
+ export function writeInitConfig(cwd, opts) {
36
+ const p = join(cwd, INIT_CONFIG_FILENAME);
37
+ const data = {
38
+ version: INIT_CONFIG_VERSION,
39
+ agentsMode: opts.agents || "inject",
40
+ stack: opts.stack,
41
+ agentTools: opts.agentTools,
42
+ shareTickets: !!opts.shareTickets,
43
+ remoteSync: !!opts.remoteSync,
44
+ pipelineUrl: opts.pipelineUrl,
45
+ updatedAt: new Date().toISOString(),
46
+ };
47
+ writeFileSync(p, JSON.stringify(data, null, 2), "utf8");
48
+ }
3
49
 
4
50
  export function toPosixPath(p) {
5
51
  return p.replace(/\\/g, "/");
@@ -80,3 +126,20 @@ export function inferRefTitleAndTopic(opts) {
80
126
  topic,
81
127
  };
82
128
  }
129
+
130
+ export function parseFrontMatter(content) {
131
+ const match = content.match(/^---\r?\n([\s\S]+?)\r?\n---\r?\n?([\s\S]*)$/);
132
+ if (!match) return { meta: {}, content };
133
+ try {
134
+ const meta = YAML.parse(match[1]);
135
+ return { meta: meta || {}, content: match[2] };
136
+ } catch (e) {
137
+ console.error("YAML Parse Error:", e);
138
+ return { meta: {}, content };
139
+ }
140
+ }
141
+
142
+ export function stringifyFrontMatter(meta, content) {
143
+ const yamlStr = YAML.stringify(meta).trim();
144
+ return `---\n${yamlStr}\n---\n\n${content.trim()}\n`;
145
+ }
package/scripts/cli.mjs CHANGED
@@ -4,8 +4,9 @@ import { dirname, join } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
  import { parseArgs, parseTicketArgs } from "./cli-args.mjs";
6
6
  import { runInit, runMerge } from "./cli-init-commands.mjs";
7
- import { runTicketCreate, runTicketList, runTicketUse, runTicketClose, runTicketArchive, runTicketReports } from "./cli-ticket-commands.mjs";
8
- import { loadInitConfig, writeInitConfig } from "./cli-prompts.mjs";
7
+ import { runTicketCreate, runTicketList, runTicketUse, runTicketClose, runTicketArchive, runTicketReports, runTicketMeta, runTicketConnect } from "./cli-ticket-commands.mjs";
8
+ import { performUpgradeMigration } from "./cli-ticket-logic.mjs";
9
+ import { loadInitConfig, writeInitConfig } from "./cli-utils.mjs";
9
10
  import { runInteractive } from "./cli-prompts.mjs";
10
11
 
11
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -30,7 +31,12 @@ async function main() {
30
31
  else if (action === "close") await runTicketClose(opts);
31
32
  else if (action === "archive") await runTicketArchive(opts);
32
33
  else if (action === "reports") await runTicketReports(opts);
33
- else if (action === "migrate") await runTicketMigrate(opts);
34
+ else if (action === "meta") await runTicketMeta(opts);
35
+ else if (action === "connect") await runTicketConnect(opts);
36
+ else if (action === "upgrade" || action === "migrate") {
37
+ const count = performUpgradeMigration(opts.cwd, opts);
38
+ console.log(`Migration complete: ${count} tickets upgraded.`);
39
+ }
34
40
  else {
35
41
  console.error("Unknown ticket action: " + action);
36
42
  printHelp();
@@ -66,7 +72,7 @@ async function main() {
66
72
  printHelp();
67
73
  }
68
74
 
69
- import { runTicketMigrate } from "./cli-ticket-commands.mjs";
75
+ // Removed legacy migration runTicketMigrate
70
76
 
71
77
  async function handleInit(opts) {
72
78
  if (!opts.interactive && !opts.nonInteractive && !loadInitConfig(opts.cwd)) {
@@ -86,7 +92,7 @@ function printHelp() {
86
92
  Usage:
87
93
  npx deuk-agent-rule init [options]
88
94
  npx deuk-agent-rule merge [options]
89
- npx deuk-agent-rule ticket <create|list|use|close|archive|reports|migrate> [options]
95
+ npx deuk-agent-rule ticket <create|list|use|close|archive|reports|migrate|upgrade|meta|connect> [options]
90
96
 
91
97
  Options:
92
98
  --cwd <path> Target repo root
@@ -96,13 +102,19 @@ Options:
96
102
  --agents <mode> inject | skip | overwrite
97
103
  --rules <mode> prefix | skip | overwrite
98
104
  --cursorrules <mode> inject | skip | overwrite
105
+ --json Output result in JSON format
106
+ --remote <url> Temporary pipeline URL
107
+ --sync Force enable remote sync
108
+ --no-sync Force disable remote sync
99
109
 
100
110
  Ticket Options:
101
111
  --topic <name> Ticket topic slug
102
112
  --group <name> Ticket group (sub|main|discussion)
103
113
  --project <name> Project filter (DeukUI|DeukAgentRules)
104
- --latest Use most recent ticket
114
+ --submodule <name> Submodule filter (DeukPack|DeukUI)
115
+ --latest Use most recent ticket (default if no topic)
105
116
  --path-only Print only the file path
117
+ --json Output result in JSON format
106
118
  `);
107
119
  }
108
120
 
@@ -119,4 +119,4 @@ if (existsSync(ossPolish)) {
119
119
  }
120
120
 
121
121
  console.log("deuk-agent-rule: synced OSS tree at " + ossRoot);
122
- console.log(" Override repo URL: DEUK_AGENT_RULES_OSS_REPO=https://github.com/org/DeukAgentRulesOSS");
122
+ console.log(" Override repo URL: DEUK_AGENT_RULES_OSS_REPO=https://github.com/joygram/DeukAgentRules");