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.
- package/CHANGELOG.ko.md +259 -0
- package/CHANGELOG.md +769 -124
- package/LICENSE +0 -0
- package/README.ko.md +97 -17
- package/README.md +108 -25
- package/bin/deuk-agent-flow.js +11 -13
- package/bin/deuk-agent-rule.js +1 -1
- package/bundled/README.md +3 -0
- package/bundled/deuk-agent-flow.vsix +0 -0
- package/core-rules/AGENTS.md +30 -120
- package/docs/architecture.ko.md +155 -2
- package/docs/architecture.md +155 -2
- package/docs/assets/agentflow-panel-skills.png +0 -0
- package/docs/assets/agentflow-panel.png +0 -0
- package/docs/how-it-works.ko.md +109 -52
- package/docs/how-it-works.md +128 -71
- package/docs/principles.ko.md +68 -68
- package/docs/principles.md +68 -68
- package/docs/usage-guide.ko.md +251 -212
- package/package.json +42 -45
- package/scripts/bundle-vscode-vsix.ts +67 -0
- package/scripts/{cli-args.mjs → cli-args.ts} +49 -12
- package/scripts/cli-init-commands.ts +99 -0
- package/scripts/cli-init-logic.ts +46 -0
- package/scripts/{cli-prompts.mjs → cli-prompts.ts} +19 -34
- package/scripts/{cli-rule-compiler.mjs → cli-rule-compiler.ts} +128 -112
- package/scripts/cli-skill-commands.ts +707 -0
- package/scripts/{cli-telemetry-commands.mjs → cli-telemetry-commands.ts} +25 -22
- package/scripts/cli-ticket-command-shared.ts +4 -0
- package/scripts/cli-ticket-commands.ts +3723 -0
- package/scripts/cli-ticket-index.ts +283 -0
- package/scripts/{cli-ticket-migration.mjs → cli-ticket-migration.ts} +44 -68
- package/scripts/cli-ticket-parser.ts +100 -0
- package/scripts/{cli-usage-commands.mjs → cli-usage-commands.ts} +325 -326
- package/scripts/cli-utils.ts +1560 -0
- package/scripts/cli.ts +695 -0
- package/scripts/{lint-md.mjs → lint-md.ts} +32 -42
- package/scripts/lint-rules.ts +203 -0
- package/scripts/{merge-logic.mjs → merge-logic.ts} +44 -44
- package/scripts/{plan-parser.mjs → plan-parser.ts} +53 -53
- package/templates/MODULE_RULE_TEMPLATE.md +11 -11
- package/templates/PROJECT_RULE.md +46 -47
- package/templates/TICKET_TEMPLATE.ko.md +48 -44
- package/templates/TICKET_TEMPLATE.md +48 -44
- package/templates/project-memory.md +19 -0
- package/templates/project-pilot/CONFORMANCE_GATE_TEMPLATE.md +25 -25
- package/templates/project-pilot/DRIFT_CHECKLIST.md +27 -27
- package/templates/project-pilot/FLOW_CONTRACT_TEMPLATE.md +26 -26
- package/templates/project-pilot/IMPLEMENTATION_MATRIX_TEMPLATE.md +30 -30
- package/templates/project-pilot/INTEGRATION_CONTRACT_TEMPLATE.md +26 -26
- package/templates/project-pilot/OWNER_MAP_TEMPLATE.md +15 -15
- package/templates/project-pilot/PROJECT_PILOT_RULE_TEMPLATE.md +34 -34
- package/templates/project-pilot/REFACTOR_CONTRACT_TEMPLATE.md +32 -32
- package/templates/project-pilot/REMEDIATION_PLAN_TEMPLATE.md +33 -33
- package/templates/rules.d/deukcontext-mcp.md +31 -31
- package/templates/rules.d/platform-coexistence.md +29 -29
- package/templates/skills/context-recall/SKILL.md +3 -1
- package/templates/skills/doc-sync/SKILL.md +111 -0
- package/templates/skills/generated-file-guard/SKILL.md +3 -1
- package/templates/skills/persona-maid/SKILL.md +65 -0
- package/templates/skills/project-pilot/SKILL.md +14 -63
- package/templates/skills/safe-refactor/SKILL.md +3 -1
- package/templates/skills/ticket-status-surface/SKILL.md +17 -0
- package/NOTICE.md +0 -19
- package/core-rules/GEMINI.md +0 -7
- package/docs/npm-publish-guide.ko.md +0 -70
- package/scripts/cli-init-commands.mjs +0 -1759
- package/scripts/cli-init-logic.mjs +0 -64
- package/scripts/cli-skill-commands.mjs +0 -212
- package/scripts/cli-ticket-command-shared.mjs +0 -60
- package/scripts/cli-ticket-commands.mjs +0 -2474
- package/scripts/cli-ticket-index.mjs +0 -322
- package/scripts/cli-ticket-parser.mjs +0 -210
- package/scripts/cli-utils.mjs +0 -602
- package/scripts/cli.mjs +0 -256
- package/scripts/lint-rules.mjs +0 -197
- package/scripts/publish-dual-npm.mjs +0 -141
- package/scripts/smoke-npm-docker.mjs +0 -102
- package/scripts/smoke-npm-local.mjs +0 -110
- package/scripts/update-download-badge.mjs +0 -103
|
@@ -1,112 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
3
|
-
import {
|
|
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 =
|
|
12
|
-
const localRulesDir =
|
|
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(
|
|
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(
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
}
|