deuk-agent-flow 4.0.37 → 5.0.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.
Files changed (78) hide show
  1. package/CHANGELOG.ko.md +282 -0
  2. package/CHANGELOG.md +788 -120
  3. package/LICENSE +0 -0
  4. package/README.ko.md +97 -17
  5. package/README.md +108 -25
  6. package/bin/deuk-agent-flow.js +11 -13
  7. package/bin/deuk-agent-rule.js +1 -1
  8. package/bundled/README.md +3 -0
  9. package/bundled/deuk-agent-flow.vsix +0 -0
  10. package/core-rules/AGENTS.md +30 -118
  11. package/docs/architecture.ko.md +155 -2
  12. package/docs/architecture.md +155 -2
  13. package/docs/assets/agentflow-panel-skills.png +0 -0
  14. package/docs/assets/agentflow-panel.png +0 -0
  15. package/docs/how-it-works.ko.md +109 -52
  16. package/docs/how-it-works.md +128 -71
  17. package/docs/principles.ko.md +68 -68
  18. package/docs/principles.md +68 -68
  19. package/docs/usage-guide.ko.md +251 -212
  20. package/package.json +41 -34
  21. package/scripts/bundle-vscode-vsix.ts +67 -0
  22. package/scripts/{cli-args.mjs → cli-args.ts} +49 -12
  23. package/scripts/cli-init-commands.ts +99 -0
  24. package/scripts/cli-init-logic.ts +46 -0
  25. package/scripts/{cli-prompts.mjs → cli-prompts.ts} +19 -34
  26. package/scripts/{cli-rule-compiler.mjs → cli-rule-compiler.ts} +128 -112
  27. package/scripts/cli-skill-commands.ts +707 -0
  28. package/scripts/{cli-telemetry-commands.mjs → cli-telemetry-commands.ts} +25 -22
  29. package/scripts/cli-ticket-command-shared.ts +4 -0
  30. package/scripts/cli-ticket-commands.ts +3723 -0
  31. package/scripts/cli-ticket-index.ts +283 -0
  32. package/scripts/{cli-ticket-migration.mjs → cli-ticket-migration.ts} +44 -68
  33. package/scripts/cli-ticket-parser.ts +100 -0
  34. package/scripts/{cli-usage-commands.mjs → cli-usage-commands.ts} +325 -326
  35. package/scripts/cli-utils.ts +1560 -0
  36. package/scripts/cli.ts +695 -0
  37. package/scripts/{lint-md.mjs → lint-md.ts} +32 -42
  38. package/scripts/lint-rules.ts +203 -0
  39. package/scripts/{merge-logic.mjs → merge-logic.ts} +44 -44
  40. package/scripts/{plan-parser.mjs → plan-parser.ts} +53 -53
  41. package/templates/MODULE_RULE_TEMPLATE.md +11 -11
  42. package/templates/PROJECT_RULE.md +46 -47
  43. package/templates/TICKET_TEMPLATE.ko.md +48 -44
  44. package/templates/TICKET_TEMPLATE.md +48 -44
  45. package/templates/project-memory.md +19 -0
  46. package/templates/project-pilot/CONFORMANCE_GATE_TEMPLATE.md +25 -23
  47. package/templates/project-pilot/DRIFT_CHECKLIST.md +27 -19
  48. package/templates/project-pilot/FLOW_CONTRACT_TEMPLATE.md +26 -26
  49. package/templates/project-pilot/IMPLEMENTATION_MATRIX_TEMPLATE.md +30 -30
  50. package/templates/project-pilot/INTEGRATION_CONTRACT_TEMPLATE.md +26 -26
  51. package/templates/project-pilot/OWNER_MAP_TEMPLATE.md +15 -15
  52. package/templates/project-pilot/PROJECT_PILOT_RULE_TEMPLATE.md +34 -34
  53. package/templates/project-pilot/REFACTOR_CONTRACT_TEMPLATE.md +32 -32
  54. package/templates/project-pilot/REMEDIATION_PLAN_TEMPLATE.md +33 -33
  55. package/templates/rules.d/deukcontext-mcp.md +31 -31
  56. package/templates/rules.d/platform-coexistence.md +29 -29
  57. package/templates/skills/context-recall/SKILL.md +3 -1
  58. package/templates/skills/doc-sync/SKILL.md +111 -0
  59. package/templates/skills/generated-file-guard/SKILL.md +3 -1
  60. package/templates/skills/persona-maid/SKILL.md +65 -0
  61. package/templates/skills/project-pilot/SKILL.md +13 -52
  62. package/templates/skills/safe-refactor/SKILL.md +3 -1
  63. package/templates/skills/ticket-status-surface/SKILL.md +17 -0
  64. package/core-rules/GEMINI.md +0 -7
  65. package/docs/badges/npm-downloads.json +0 -8
  66. package/scripts/cli-init-commands.mjs +0 -1750
  67. package/scripts/cli-init-logic.mjs +0 -64
  68. package/scripts/cli-skill-commands.mjs +0 -201
  69. package/scripts/cli-ticket-commands.mjs +0 -2427
  70. package/scripts/cli-ticket-index.mjs +0 -298
  71. package/scripts/cli-ticket-parser.mjs +0 -209
  72. package/scripts/cli-utils.mjs +0 -602
  73. package/scripts/cli.mjs +0 -256
  74. package/scripts/lint-rules.mjs +0 -196
  75. package/scripts/publish-dual-npm.mjs +0 -141
  76. package/scripts/smoke-npm-docker.mjs +0 -102
  77. package/scripts/smoke-npm-local.mjs +0 -109
  78. package/scripts/update-download-badge.mjs +0 -103
@@ -1,64 +0,0 @@
1
- import { existsSync, appendFileSync, writeFileSync, mkdirSync, readFileSync } from "fs";
2
- import { join } from "path";
3
- import { AGENT_ROOT_DIR, LEGACY_IGNORE_DIR, LEGACY_TICKET_DIR, LEGACY_TICKET_DIR_PLURAL, TICKET_DIR_NAME } from "./cli-utils.mjs";
4
-
5
- const GITIGNORE_AGENT_MARKER = "# deuk-agent-flow: agent hub directory (local, not committed by default)";
6
- const LEGACY_GITIGNORE_AGENT_MARKER = "# deuk-agent-rule: agent hub directory (local, not committed by default)";
7
-
8
- function hasExactGitignoreLine(content, line) {
9
- return content
10
- .split(/\r?\n/)
11
- .map(s => s.trim())
12
- .includes(line);
13
- }
14
-
15
- function removeExactGitignoreLines(content, lines) {
16
- const remove = new Set(lines);
17
- return content
18
- .split(/\r?\n/)
19
- .filter(line => !remove.has(line.trim()))
20
- .join("\n");
21
- }
22
-
23
- export function ensureTicketDirAndGitignore(opts) {
24
- const ticketPath = join(opts.cwd, TICKET_DIR_NAME);
25
- const gitignorePath = join(opts.cwd, ".gitignore");
26
- const ignoreLine = AGENT_ROOT_DIR + "/";
27
-
28
- if (opts.dryRun) return;
29
-
30
- mkdirSync(ticketPath, { recursive: true });
31
- if (opts.shareTickets) {
32
- console.log(`[INIT] Ticket sharing enabled. Skipping .gitignore entry for ${AGENT_ROOT_DIR}/`);
33
- return;
34
- }
35
-
36
- let gi = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf8") : "";
37
-
38
- // 1. Create document directories
39
- const docsPath = join(opts.cwd, AGENT_ROOT_DIR, "docs");
40
- mkdirSync(join(docsPath, "plan"), { recursive: true });
41
- mkdirSync(join(docsPath, "archive"), { recursive: true });
42
-
43
- // Also check for legacy ignore lines to clean up or at least check presence
44
- const legacyIgnore1 = `${LEGACY_TICKET_DIR}/`;
45
- const legacyIgnore2 = `${LEGACY_TICKET_DIR_PLURAL}/`;
46
- const legacyIgnore3 = LEGACY_IGNORE_DIR;
47
- const cleanedGi = removeExactGitignoreLines(gi, [legacyIgnore1, legacyIgnore2, legacyIgnore3, LEGACY_GITIGNORE_AGENT_MARKER]);
48
- if (cleanedGi !== gi) {
49
- writeFileSync(gitignorePath, cleanedGi.replace(/\n*$/, "\n"), "utf8");
50
- gi = cleanedGi;
51
- console.log("[INIT] Removed legacy deuk-agent-rule .gitignore entries");
52
- }
53
-
54
- const hasIgnoreLine = hasExactGitignoreLine(gi, ignoreLine);
55
- const hasMarkerLine = hasExactGitignoreLine(gi, GITIGNORE_AGENT_MARKER);
56
- if ((!hasIgnoreLine || !hasMarkerLine) && !opts.shareTickets) {
57
- const linesToAdd = [];
58
- if (!hasMarkerLine) linesToAdd.push(GITIGNORE_AGENT_MARKER);
59
- if (!hasIgnoreLine) linesToAdd.push(ignoreLine);
60
- const block = "\n" + linesToAdd.join("\n") + "\n";
61
- appendFileSync(gitignorePath, block, "utf8");
62
- console.log(`[INIT] Added ${ignoreLine} to .gitignore`);
63
- }
64
- }
@@ -1,201 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
2
- import { dirname, join } from "path";
3
- import { fileURLToPath } from "url";
4
- import { AGENT_ROOT_DIR } from "./cli-utils.mjs";
5
-
6
- const SKILL_IDS = ["safe-refactor", "generated-file-guard", "context-recall", "project-pilot"];
7
- const SKILL_ROOT = "templates/skills";
8
- const CONFIG_FILE = `${AGENT_ROOT_DIR}/skills.json`;
9
- const REPO_SKILL_TEMPLATE_ROOT = `${AGENT_ROOT_DIR}/skill-templates`;
10
- const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
11
-
12
- function repoSkillPath(cwd, id) {
13
- return join(cwd, AGENT_ROOT_DIR, "skills", id, "SKILL.md");
14
- }
15
-
16
- function sourceSkillPath(cwd, id) {
17
- const localTemplate = join(cwd, REPO_SKILL_TEMPLATE_ROOT, id, "SKILL.md");
18
- if (existsSync(localTemplate)) return localTemplate;
19
- const repoTemplate = join(cwd, SKILL_ROOT, id, "SKILL.md");
20
- if (existsSync(repoTemplate)) return repoTemplate;
21
- return join(PACKAGE_ROOT, SKILL_ROOT, id, "SKILL.md");
22
- }
23
-
24
- function loadSkillSource(cwd, id) {
25
- const source = sourceSkillPath(cwd, id);
26
- if (!existsSync(source)) throw new Error(`skill not found: ${id}`);
27
- return readFileSync(source, "utf8");
28
- }
29
-
30
- function loadSkillConfig(cwd) {
31
- const path = join(cwd, CONFIG_FILE);
32
- if (!existsSync(path)) return { version: 1, installed: [], exposed: {} };
33
- return JSON.parse(readFileSync(path, "utf8"));
34
- }
35
-
36
- function detectExposedPlatforms(cwd, id) {
37
- const platforms = [];
38
- const claudePath = join(cwd, ".claude", "skills", id, "SKILL.md");
39
- if (existsSync(claudePath)) {
40
- platforms.push("claude");
41
- }
42
-
43
- const cursorPath = join(cwd, ".cursor", "rules", "deuk-agent-skills.mdc");
44
- if (existsSync(cursorPath)) {
45
- try {
46
- const body = readFileSync(cursorPath, "utf8");
47
- if (body.includes(`.deuk-agent/skills/${id}/SKILL.md`)) {
48
- platforms.push("cursor");
49
- }
50
- } catch {
51
- // Ignore pointer read failures and fall back to config-based exposure only.
52
- }
53
- }
54
-
55
- return platforms;
56
- }
57
-
58
- function writeSkillConfig(cwd, config, dryRun) {
59
- if (dryRun) return;
60
- const path = join(cwd, CONFIG_FILE);
61
- mkdirSync(dirname(path), { recursive: true });
62
- writeFileSync(path, JSON.stringify(config, null, 2), "utf8");
63
- }
64
-
65
- function ensureKnownSkill(id) {
66
- if (!SKILL_IDS.includes(id)) throw new Error(`unknown skill: ${id}`);
67
- }
68
-
69
- export function listSkills(cwd = process.cwd()) {
70
- const config = loadSkillConfig(cwd);
71
- return SKILL_IDS.map(id => ({
72
- id,
73
- installed: config.installed.includes(id) || existsSync(repoSkillPath(cwd, id)),
74
- exposed: Array.from(new Set([
75
- ...Object.entries(config.exposed || {})
76
- .filter(([, ids]) => Array.isArray(ids) && ids.includes(id))
77
- .map(([platform]) => platform),
78
- ...detectExposedPlatforms(cwd, id)
79
- ]))
80
- }));
81
- }
82
-
83
- export function addSkill(opts = {}) {
84
- const cwd = opts.cwd || process.cwd();
85
- const id = opts.skill;
86
- ensureKnownSkill(id);
87
- const body = loadSkillSource(cwd, id);
88
- const target = repoSkillPath(cwd, id);
89
- const config = loadSkillConfig(cwd);
90
-
91
- if (!opts.dryRun) {
92
- mkdirSync(dirname(target), { recursive: true });
93
- writeFileSync(target, body, "utf8");
94
- }
95
-
96
- if (!config.installed.includes(id)) config.installed.push(id);
97
- writeSkillConfig(cwd, config, opts.dryRun);
98
- return { id, target };
99
- }
100
-
101
- function exposeClaude(cwd, ids, dryRun) {
102
- for (const id of ids) {
103
- const body = readFileSync(repoSkillPath(cwd, id), "utf8");
104
- const target = join(cwd, ".claude", "skills", id, "SKILL.md");
105
- if (!dryRun) {
106
- mkdirSync(dirname(target), { recursive: true });
107
- writeFileSync(target, body, "utf8");
108
- }
109
- }
110
- }
111
-
112
- function exposeCursor(cwd, ids, dryRun) {
113
- const target = join(cwd, ".cursor", "rules", "deuk-agent-skills.mdc");
114
- const body = [
115
- "---",
116
- "description: \"DeukAgentFlow skill pointers\"",
117
- "globs: [\"**/*\"]",
118
- "alwaysApply: false",
119
- "---",
120
- "# DeukAgentFlow Skills",
121
- "",
122
- "These are thin behavior playbooks. They do not override `core-rules/AGENTS.md`, TDW, APC, Phase Gate, or PROJECT_RULE.md.",
123
- "",
124
- ...ids.map(id => `- ${id}: .deuk-agent/skills/${id}/SKILL.md`),
125
- ""
126
- ].join("\n");
127
- if (!dryRun) {
128
- mkdirSync(dirname(target), { recursive: true });
129
- writeFileSync(target, body, "utf8");
130
- }
131
- }
132
-
133
- export function exposeSkills(opts = {}) {
134
- const cwd = opts.cwd || process.cwd();
135
- const platform = String(opts.platform || "").toLowerCase();
136
- if (!["claude", "cursor"].includes(platform)) throw new Error("skill expose requires --platform claude|cursor");
137
-
138
- const config = loadSkillConfig(cwd);
139
- const ids = config.installed || [];
140
- if (ids.length === 0) throw new Error("no skills installed; run skill add first");
141
- for (const id of ids) {
142
- if (!existsSync(repoSkillPath(cwd, id))) addSkill({ cwd, skill: id, dryRun: opts.dryRun });
143
- }
144
-
145
- if (platform === "claude") exposeClaude(cwd, ids, opts.dryRun);
146
- if (platform === "cursor") exposeCursor(cwd, ids, opts.dryRun);
147
-
148
- config.exposed = config.exposed || {};
149
- config.exposed[platform] = Array.from(new Set([...(config.exposed[platform] || []), ...ids]));
150
- writeSkillConfig(cwd, config, opts.dryRun);
151
- return { platform, ids };
152
- }
153
-
154
- export function lintSkills(cwd = process.cwd()) {
155
- const paths = [];
156
- for (const root of [join(cwd, SKILL_ROOT), join(cwd, REPO_SKILL_TEMPLATE_ROOT), join(cwd, AGENT_ROOT_DIR, "skills")]) {
157
- if (!existsSync(root)) continue;
158
- for (const id of readdirSync(root)) {
159
- const path = join(root, id, "SKILL.md");
160
- if (existsSync(path)) paths.push(path);
161
- }
162
- }
163
-
164
- const violations = [];
165
- const forbidden = [/ignore ticket/i, /skip verification/i, /override (tdw|apc|phase gate)/i, /edit generated output directly/i];
166
- for (const path of paths) {
167
- const body = readFileSync(path, "utf8");
168
- if (!/Authority:.*core-rules\/AGENTS\.md/i.test(body)) violations.push(`${path}: missing authority line`);
169
- for (const pattern of forbidden) {
170
- if (pattern.test(body)) violations.push(`${path}: forbidden phrase ${pattern}`);
171
- }
172
- }
173
- return { ok: violations.length === 0, paths, violations };
174
- }
175
-
176
- export async function runSkill(action, opts = {}) {
177
- if (action === "list") {
178
- const rows = listSkills(opts.cwd);
179
- if (opts.json) console.log(JSON.stringify(rows, null, 2));
180
- else rows.forEach(row => console.log(`${row.id} installed=${row.installed ? "yes" : "no"} exposed=${row.exposed.join(",") || "-"}`));
181
- return;
182
- }
183
- if (action === "add") {
184
- const result = addSkill(opts);
185
- console.log(`skill added: ${result.id}`);
186
- return;
187
- }
188
- if (action === "expose") {
189
- const result = exposeSkills(opts);
190
- console.log(`skills exposed: ${result.platform} ${result.ids.join(",")}`);
191
- return;
192
- }
193
- if (action === "lint") {
194
- const result = lintSkills(opts.cwd);
195
- if (opts.json) console.log(JSON.stringify(result, null, 2));
196
- else console.log(result.ok ? "skill:lint ok" : `skill:lint failed ${result.violations.length}`);
197
- if (!result.ok) throw new Error(result.violations.join("\n"));
198
- return;
199
- }
200
- throw new Error("Unknown skill action: " + action);
201
- }