deuk-agent-flow 4.2.7 → 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 (80) hide show
  1. package/CHANGELOG.ko.md +259 -0
  2. package/CHANGELOG.md +769 -124
  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 -120
  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 +42 -45
  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 -25
  47. package/templates/project-pilot/DRIFT_CHECKLIST.md +27 -27
  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 +14 -63
  62. package/templates/skills/safe-refactor/SKILL.md +3 -1
  63. package/templates/skills/ticket-status-surface/SKILL.md +17 -0
  64. package/NOTICE.md +0 -19
  65. package/core-rules/GEMINI.md +0 -7
  66. package/docs/npm-publish-guide.ko.md +0 -70
  67. package/scripts/cli-init-commands.mjs +0 -1759
  68. package/scripts/cli-init-logic.mjs +0 -64
  69. package/scripts/cli-skill-commands.mjs +0 -212
  70. package/scripts/cli-ticket-command-shared.mjs +0 -60
  71. package/scripts/cli-ticket-commands.mjs +0 -2474
  72. package/scripts/cli-ticket-index.mjs +0 -322
  73. package/scripts/cli-ticket-parser.mjs +0 -210
  74. package/scripts/cli-utils.mjs +0 -602
  75. package/scripts/cli.mjs +0 -256
  76. package/scripts/lint-rules.mjs +0 -197
  77. package/scripts/publish-dual-npm.mjs +0 -141
  78. package/scripts/smoke-npm-docker.mjs +0 -102
  79. package/scripts/smoke-npm-local.mjs +0 -110
  80. package/scripts/update-download-badge.mjs +0 -103
@@ -1,112 +1,128 @@
1
- import { join, basename, resolve, dirname } from "path";
2
- import { existsSync, readdirSync, readFileSync } from "fs";
3
- import { parseFrontMatter, AGENT_ROOT_DIR } from "./cli-utils.mjs";
4
- import YAML from "yaml";
5
-
6
- /**
7
- * Scans directories for rule markdown files, evaluates their Frontmatter conditions,
8
- * and compiles a single rule string for injection.
9
- */
10
- export function compileDynamicRules(cwd, bundleRoot, targetFileName) {
11
- const bundleRulesDir = join(bundleRoot, "templates", "rules.d");
12
- const localRulesDir = join(cwd, AGENT_ROOT_DIR, "project-rules");
13
-
14
- const allRuleFiles = [];
15
-
16
- // 1. Gather global rules
17
- if (existsSync(bundleRulesDir)) {
18
- readdirSync(bundleRulesDir).forEach(f => {
19
- if (f.endsWith(".md")) allRuleFiles.push(join(bundleRulesDir, f));
20
- });
21
- }
22
-
23
- // 2. Gather local domain rules
24
- if (existsSync(localRulesDir)) {
25
- readdirSync(localRulesDir).forEach(f => {
26
- if (f.endsWith(".md")) allRuleFiles.push(join(localRulesDir, f));
27
- });
28
- }
29
-
30
- let compiledContent = "";
31
-
32
- for (const filePath of allRuleFiles) {
33
- try {
34
- const rawContent = readFileSync(filePath, "utf8");
35
- const { meta, content } = parseFrontMatter(rawContent);
36
-
37
- // Check if this rule is intended for the current target file (e.g., AGENTS.md)
38
- if (meta.inject_target && !meta.inject_target.includes(targetFileName)) {
39
- continue;
40
- }
41
-
42
- // Evaluate conditions
43
- let shouldInclude = true;
44
- if (meta.condition) {
45
- shouldInclude = evaluateCondition(meta.condition, cwd);
46
- }
47
-
48
- if (shouldInclude) {
49
- const sourceId = meta.id || basename(filePath);
50
- compiledContent += `\n<!-- RULE MODULE: ${sourceId} -->\n`;
51
- compiledContent += content.trim() + "\n";
52
- }
53
- } catch (err) {
54
- console.warn(`[WARNING] Skipping malformed rule file at ${filePath}:`, err.message);
55
- continue;
56
- }
57
- }
58
-
59
- return compiledContent.trim();
60
- }
61
-
62
- /**
63
- * Attempts to locate and parse the DeukContext config.yaml from the workspace root.
64
- */
65
- function resolveDeukContextConfig(cwd) {
66
- // Go up directories until we find a sibling DeukAgentContext folder, or hit root
67
- let current = resolve(cwd);
68
- while (current && current !== "/") {
69
- const candidates = [
70
- join(current, "DeukAgentContext", ".local", "config.yaml"),
71
- join(current, "DeukContext", ".local", "config.yaml") // Legacy fallback
72
- ];
73
- for (const candidatePath of candidates) {
74
- if (existsSync(candidatePath)) {
75
- try {
76
- const raw = readFileSync(candidatePath, "utf8");
77
- return YAML.parse(raw);
78
- } catch (e) {
79
- console.error("Failed to parse DeukContext config.yaml:", e);
80
- return null;
81
- }
82
- }
83
- }
84
- const parent = dirname(current);
85
- if (parent === current) break;
86
- current = parent;
87
- }
88
- return null;
89
- }
90
-
91
- /**
92
- * Evaluates Frontmatter conditions to determine if a rule should be included.
93
- */
94
- function evaluateCondition(condition, cwd) {
95
- if (!condition) return true;
96
-
97
- // Example: condition: { mcp: "deuk-agent-context" }
98
- if (condition.mcp === "deuk-agent-context" || condition.mcp === "deuk_agent_context") {
99
- const ragConfig = resolveDeukContextConfig(cwd);
100
- if (!ragConfig || !ragConfig.projects) return false;
101
-
102
- // Check if the current cwd is managed by DeukContext
103
- const isManaged = ragConfig.projects.some(p => {
104
- // If the project path is a prefix of cwd, it's managed
105
- return cwd.startsWith(p.path);
106
- });
107
-
108
- return isManaged;
109
- }
110
-
111
- return true;
112
- }
1
+ import { basename, resolve, dirname, isAbsolute } from "path";
2
+ import { existsSync, readdirSync, readFileSync } from "fs";
3
+ import { DEUK_ROOT_DIR, CliOpts, makePath, parseFrontMatter } from "./cli-utils.js";
4
+ import YAML from "yaml";
5
+
6
+ /**
7
+ * Scans directories for rule markdown files, evaluates their Frontmatter conditions,
8
+ * and compiles a single rule string for injection.
9
+ */
10
+ export function compileDynamicRules(cwd, bundleRoot, targetFileName) {
11
+ const bundleRulesDir = makePath(bundleRoot, "templates", "rules.d");
12
+ const localRulesDir = makePath(cwd, DEUK_ROOT_DIR, "project-rules");
13
+
14
+ const allRuleFiles = [];
15
+
16
+ // 1. Gather global rules
17
+ if (existsSync(bundleRulesDir)) {
18
+ readdirSync(bundleRulesDir).forEach(f => {
19
+ if (f.endsWith(".md")) allRuleFiles.push(makePath(bundleRulesDir, f));
20
+ });
21
+ }
22
+
23
+ // 2. Gather local domain rules
24
+ if (existsSync(localRulesDir)) {
25
+ readdirSync(localRulesDir).forEach(f => {
26
+ if (f.endsWith(".md")) allRuleFiles.push(makePath(localRulesDir, f));
27
+ });
28
+ }
29
+
30
+ let compiledContent = "";
31
+
32
+ for (const filePath of allRuleFiles) {
33
+ try {
34
+ const rawContent = readFileSync(filePath, "utf8");
35
+ const { meta, content } = parseFrontMatter(rawContent);
36
+
37
+ // Check if this rule is intended for the current target file (e.g., AGENTS.md)
38
+ if (meta.inject_target && !meta.inject_target.includes(targetFileName)) {
39
+ continue;
40
+ }
41
+
42
+ // Evaluate conditions
43
+ let shouldInclude = true;
44
+ if (meta.condition) {
45
+ shouldInclude = evaluateCondition(meta.condition, cwd);
46
+ }
47
+
48
+ if (shouldInclude) {
49
+ const sourceId = meta.id || basename(filePath);
50
+ compiledContent += `\n<!-- RULE MODULE: ${sourceId} -->\n`;
51
+ compiledContent += content.trim() + "\n";
52
+ }
53
+ } catch (err) {
54
+ console.warn(`[WARNING] Skipping malformed rule file at ${filePath}:`, err.message);
55
+ continue;
56
+ }
57
+ }
58
+
59
+ return compiledContent.trim();
60
+ }
61
+
62
+ function normalizeProjects(projects, contextRoot) {
63
+ if (!Array.isArray(projects)) return [];
64
+ return projects
65
+ .filter(p => p && typeof p.path === "string")
66
+ .map(p => ({
67
+ ...p,
68
+ path: isAbsolute(p.path) ? resolve(p.path) : resolve(contextRoot, p.path)
69
+ }));
70
+ }
71
+
72
+ /**
73
+ * Attempts to locate and parse the DeukContext project registry from the workspace root.
74
+ * Current deployments store projects in ingest.yaml; config.yaml remains a legacy fallback.
75
+ */
76
+ function resolveDeukContextProjects(cwd) {
77
+ // Go up directories until we find a sibling DeukAgentContext folder, or hit root
78
+ let current = resolve(cwd);
79
+ while (current && current !== "/") {
80
+ const candidates = [
81
+ makePath(current, "DeukAgentContext", ".local", "ingest.yaml"),
82
+ makePath(current, "DeukAgentContext", ".local", "config.yaml"),
83
+ makePath(current, "DeukContext", ".local", "ingest.yaml"),
84
+ makePath(current, "DeukContext", ".local", "config.yaml") // Legacy fallback
85
+ ];
86
+ for (const candidatePath of candidates) {
87
+ if (existsSync(candidatePath)) {
88
+ try {
89
+ const raw = readFileSync(candidatePath, "utf8");
90
+ const parsed = YAML.parse(raw);
91
+ const contextRoot = dirname(dirname(candidatePath));
92
+ const projects = normalizeProjects(parsed?.projects, contextRoot);
93
+ if (projects.length > 0) return projects;
94
+ } catch (e) {
95
+ console.error(`Failed to parse DeukContext registry at ${candidatePath}:`, e);
96
+ return null;
97
+ }
98
+ }
99
+ }
100
+ const parent = dirname(current);
101
+ if (parent === current) break;
102
+ current = parent;
103
+ }
104
+ return null;
105
+ }
106
+
107
+ /**
108
+ * Evaluates Frontmatter conditions to determine if a rule should be included.
109
+ */
110
+ function evaluateCondition(condition, cwd) {
111
+ if (!condition) return true;
112
+
113
+ // Example: condition: { mcp: "deuk-agent-context" }
114
+ if (condition.mcp === "deuk-agent-context" || condition.mcp === "deuk_agent_context") {
115
+ const projects = resolveDeukContextProjects(cwd);
116
+ if (!projects || projects.length === 0) return false;
117
+
118
+ // Check if the current cwd is managed by DeukContext
119
+ const isManaged = projects.some(p => {
120
+ // If the project path is a prefix of cwd, it's managed
121
+ return cwd.startsWith(p.path);
122
+ });
123
+
124
+ return isManaged;
125
+ }
126
+
127
+ return true;
128
+ }