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,8 +1,6 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from "fs";
2
- import { join } from "path";
3
- import { loadInitConfig, AGENT_ROOT_DIR, SPOKE_REGISTRY, toSlug } from "./cli-utils.mjs";
4
-
5
- const TELEMETRY_FILE = `${AGENT_ROOT_DIR}/telemetry.jsonl`;
2
+ import { CliOpts, SPOKE_REGISTRY, loadInitConfig, makePath, toSlug } from "./cli-utils.js";
3
+ import { resolveHomeTicketDirForWorkspace } from "./cli-ticket-home.js";
6
4
  const RAG_RESULTS = new Set(["hit", "weak-hit", "miss", "stale"]);
7
5
  const KNOWLEDGE_ACTIONS = new Set(["none", "add_knowledge", "refresh_document"]);
8
6
  const TOKEN_QUALITIES = new Set(["useful", "waste", "rework", "saved"]);
@@ -47,11 +45,15 @@ function accumulateTotals(logs, keySelector) {
47
45
  }, {});
48
46
  }
49
47
 
48
+ function resolveTelemetryPath(cwd) {
49
+ return makePath(resolveHomeTicketDirForWorkspace(cwd), "telemetry.jsonl");
50
+ }
51
+
50
52
  function loadTelemetryEntries(cwd) {
51
- const absPath = join(cwd, TELEMETRY_FILE);
53
+ const absPath = resolveTelemetryPath(cwd);
52
54
  if (!existsSync(absPath)) return null;
53
55
  const lines = readFileSync(absPath, "utf8").split("\n").filter(l => l.trim());
54
- return lines.map(l => JSON.parse(l));
56
+ return lines.map(l => JSON.parse(l) as Record<string, any>);
55
57
  }
56
58
 
57
59
  export function buildTelemetrySummary(cwd) {
@@ -200,11 +202,11 @@ async function logAction(opts) {
200
202
  occurredAt: opts.occurredAt || ""
201
203
  });
202
204
 
203
- console.log(`[TELEMETRY] Logged ${entry.tokens} tokens for ticket ${entry.ticket} in ${TELEMETRY_FILE}`);
205
+ console.log(`[TELEMETRY] Logged ${entry.tokens} tokens for ticket ${entry.ticket}`);
204
206
  }
205
207
 
206
208
  async function syncAction(opts) {
207
- const absPath = join(opts.cwd, TELEMETRY_FILE);
209
+ const absPath = resolveTelemetryPath(opts.cwd);
208
210
  if (!existsSync(absPath)) {
209
211
  console.log("[TELEMETRY] No local logs to sync.");
210
212
  return;
@@ -214,7 +216,7 @@ async function syncAction(opts) {
214
216
  const pipelineUrl = opts.remote || config?.pipelineUrl || "http://localhost:8001/api/telemetry/ingest";
215
217
 
216
218
  const lines = readFileSync(absPath, "utf8").split("\n").filter(l => l.trim());
217
- const entries = lines.map(l => JSON.parse(l));
219
+ const entries = lines.map(l => JSON.parse(l) as Record<string, any>);
218
220
  const unsynced = entries.filter(e => !e.synced);
219
221
 
220
222
  if (unsynced.length === 0) {
@@ -309,14 +311,14 @@ async function summaryAction(opts) {
309
311
  }
310
312
 
311
313
  async function migrateAction(opts) {
312
- const absPath = join(opts.cwd, TELEMETRY_FILE);
314
+ const absPath = resolveTelemetryPath(opts.cwd);
313
315
  if (!existsSync(absPath)) {
314
316
  console.log("[TELEMETRY] No logs found.");
315
317
  return;
316
318
  }
317
319
 
318
320
  const lines = readFileSync(absPath, "utf8").split("\n").filter(l => l.trim());
319
- const entries = lines.map(l => JSON.parse(l));
321
+ const entries = lines.map(l => JSON.parse(l) as Record<string, any>);
320
322
  const migrated = entries.map(entry => normalizeTelemetryRecord(entry));
321
323
  const changedCount = migrated.filter((entry, index) => JSON.stringify(entry) !== JSON.stringify(entries[index])).length;
322
324
 
@@ -329,10 +331,10 @@ async function migrateAction(opts) {
329
331
  console.log(`[TELEMETRY] Migrated ${changedCount} telemetry entries.`);
330
332
  }
331
333
 
332
- export function appendTelemetryRecord(cwd, entry = {}) {
333
- const telemetryDir = join(cwd, AGENT_ROOT_DIR);
334
+ export function appendTelemetryRecord(cwd, entry: Record<string, any> = {}) {
335
+ const telemetryPath = resolveTelemetryPath(cwd);
336
+ const telemetryDir = makePath(resolveHomeTicketDirForWorkspace(cwd));
334
337
  if (!existsSync(telemetryDir)) mkdirSync(telemetryDir, { recursive: true });
335
- const telemetryPath = join(cwd, TELEMETRY_FILE);
336
338
  const occurredAt = entry.occurredAt || new Date().toISOString();
337
339
  const event = resolveTelemetryEvent(entry);
338
340
  const payload = {
@@ -374,7 +376,7 @@ export function appendTelemetryRecord(cwd, entry = {}) {
374
376
  return payload;
375
377
  }
376
378
 
377
- export function appendInternalWorkflowEvent(cwd, event = {}) {
379
+ export function appendInternalWorkflowEvent(cwd, event: Record<string, any> = {}) {
378
380
  return appendTelemetryRecord(cwd, {
379
381
  ...event,
380
382
  source: INTERNAL_SOURCE,
@@ -387,7 +389,7 @@ export function appendInternalWorkflowEvent(cwd, event = {}) {
387
389
  });
388
390
  }
389
391
 
390
- function resolveTelemetryEvent(entry = {}) {
392
+ function resolveTelemetryEvent(entry: Record<string, any> = {}) {
391
393
  const explicitEvent = normalizeText(entry.event);
392
394
  if (explicitEvent) return explicitEvent;
393
395
 
@@ -401,7 +403,7 @@ function resolveTelemetryEvent(entry = {}) {
401
403
  return normalizeText(entry.kind) || "work";
402
404
  }
403
405
 
404
- function normalizeTelemetryRecord(entry = {}) {
406
+ function normalizeTelemetryRecord(entry: Record<string, any> = {}) {
405
407
  const cloned = { ...entry };
406
408
  cloned.source = cloned.source || "manual";
407
409
  cloned.kind = cloned.kind || "work";
@@ -431,12 +433,12 @@ function normalizeSyncedState(value) {
431
433
  return value === true || value === "true";
432
434
  }
433
435
 
434
- function countBy(logs, key) {
435
- return logs.reduce((acc, log) => {
436
+ function countBy(logs, key): Record<string, number> {
437
+ return logs.reduce((acc: Record<string, number>, log) => {
436
438
  const value = log[key];
437
439
  if (value) acc[value] = (acc[value] || 0) + 1;
438
440
  return acc;
439
- }, {});
441
+ }, {} as Record<string, number>);
440
442
  }
441
443
 
442
444
  function isInternalWorkflowEvent(log) {
@@ -478,7 +480,7 @@ function summarizeWorkflowEvents(events) {
478
480
  }
479
481
 
480
482
  function summarizeSessionModes(logs) {
481
- const grouped = {};
483
+ const grouped: Record<string, any> = {};
482
484
  for (const log of logs) {
483
485
  const mode = normalizeEnum(log.sessionMode, SESSION_MODES);
484
486
  if (!mode) continue;
@@ -594,6 +596,7 @@ function printSessionModeComparison(summary) {
594
596
  if (entries.length === 0) return;
595
597
  console.log(`Session Mode Comparison:`);
596
598
  for (const [mode, row] of entries) {
597
- console.log(` - ${mode}: entries=${row.entries}, tokens=${row.tokens}, retries=${row.retries}, turns=${row.turns}, failures=${row.failures}, success=${formatRate(row.successCount, row.entries)}, quality=${row.averageQualityScore.toFixed(1)}`);
599
+ const r = row as Record<string, any>;
600
+ console.log(` - ${mode}: entries=${r.entries}, tokens=${r.tokens}, retries=${r.retries}, turns=${r.turns}, failures=${r.failures}, success=${formatRate(r.successCount, r.entries)}, quality=${r.averageQualityScore.toFixed(1)}`);
598
601
  }
599
602
  }
@@ -0,0 +1,4 @@
1
+ export {
2
+ readTicketDocument,
3
+ resolveTicketEntryOrComputedPath
4
+ } from "./cli-ticket-document.js";