@devflow-tools/cli 0.12.4 → 0.12.6

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 (154) hide show
  1. package/package.json +13 -13
  2. package/dist/commands/benchmark-cmd.d.ts +0 -5
  3. package/dist/commands/benchmark-cmd.d.ts.map +0 -1
  4. package/dist/commands/benchmark-cmd.js +0 -18
  5. package/dist/commands/benchmark-cmd.js.map +0 -1
  6. package/dist/commands/connect.d.ts +0 -8
  7. package/dist/commands/connect.d.ts.map +0 -1
  8. package/dist/commands/connect.js +0 -26
  9. package/dist/commands/connect.js.map +0 -1
  10. package/dist/commands/context.d.ts +0 -15
  11. package/dist/commands/context.d.ts.map +0 -1
  12. package/dist/commands/context.js +0 -24
  13. package/dist/commands/context.js.map +0 -1
  14. package/dist/commands/dashboard.d.ts +0 -3
  15. package/dist/commands/dashboard.d.ts.map +0 -1
  16. package/dist/commands/dashboard.js +0 -10
  17. package/dist/commands/dashboard.js.map +0 -1
  18. package/dist/commands/doctor.d.ts +0 -56
  19. package/dist/commands/doctor.d.ts.map +0 -1
  20. package/dist/commands/doctor.js +0 -156
  21. package/dist/commands/doctor.js.map +0 -1
  22. package/dist/commands/graph.d.ts +0 -11
  23. package/dist/commands/graph.d.ts.map +0 -1
  24. package/dist/commands/graph.js +0 -14
  25. package/dist/commands/graph.js.map +0 -1
  26. package/dist/commands/index-cmd.d.ts +0 -4
  27. package/dist/commands/index-cmd.d.ts.map +0 -1
  28. package/dist/commands/index-cmd.js +0 -15
  29. package/dist/commands/index-cmd.js.map +0 -1
  30. package/dist/commands/init.d.ts +0 -20
  31. package/dist/commands/init.d.ts.map +0 -1
  32. package/dist/commands/init.js +0 -145
  33. package/dist/commands/init.js.map +0 -1
  34. package/dist/commands/knowledge.d.ts +0 -5
  35. package/dist/commands/knowledge.d.ts.map +0 -1
  36. package/dist/commands/knowledge.js +0 -23
  37. package/dist/commands/knowledge.js.map +0 -1
  38. package/dist/commands/memory.d.ts +0 -5
  39. package/dist/commands/memory.d.ts.map +0 -1
  40. package/dist/commands/memory.js +0 -72
  41. package/dist/commands/memory.js.map +0 -1
  42. package/dist/commands/plugin/install.d.ts +0 -3
  43. package/dist/commands/plugin/install.d.ts.map +0 -1
  44. package/dist/commands/plugin/install.js +0 -22
  45. package/dist/commands/plugin/install.js.map +0 -1
  46. package/dist/commands/plugin/list.d.ts +0 -3
  47. package/dist/commands/plugin/list.d.ts.map +0 -1
  48. package/dist/commands/plugin/list.js +0 -47
  49. package/dist/commands/plugin/list.js.map +0 -1
  50. package/dist/commands/plugin/search.d.ts +0 -3
  51. package/dist/commands/plugin/search.d.ts.map +0 -1
  52. package/dist/commands/plugin/search.js +0 -29
  53. package/dist/commands/plugin/search.js.map +0 -1
  54. package/dist/commands/plugin/uninstall.d.ts +0 -3
  55. package/dist/commands/plugin/uninstall.d.ts.map +0 -1
  56. package/dist/commands/plugin/uninstall.js +0 -21
  57. package/dist/commands/plugin/uninstall.js.map +0 -1
  58. package/dist/commands/plugin-guide.d.ts +0 -19
  59. package/dist/commands/plugin-guide.d.ts.map +0 -1
  60. package/dist/commands/plugin-guide.js +0 -131
  61. package/dist/commands/plugin-guide.js.map +0 -1
  62. package/dist/commands/plugin-loader.d.ts +0 -2
  63. package/dist/commands/plugin-loader.d.ts.map +0 -1
  64. package/dist/commands/plugin-loader.js +0 -2
  65. package/dist/commands/plugin-loader.js.map +0 -1
  66. package/dist/commands/review.d.ts +0 -6
  67. package/dist/commands/review.d.ts.map +0 -1
  68. package/dist/commands/review.js +0 -75
  69. package/dist/commands/review.js.map +0 -1
  70. package/dist/commands/server.d.ts +0 -16
  71. package/dist/commands/server.d.ts.map +0 -1
  72. package/dist/commands/server.js +0 -88
  73. package/dist/commands/server.js.map +0 -1
  74. package/dist/commands/session.d.ts +0 -7
  75. package/dist/commands/session.d.ts.map +0 -1
  76. package/dist/commands/session.js +0 -20
  77. package/dist/commands/session.js.map +0 -1
  78. package/dist/commands/setup.d.ts +0 -6
  79. package/dist/commands/setup.d.ts.map +0 -1
  80. package/dist/commands/setup.js +0 -78
  81. package/dist/commands/setup.js.map +0 -1
  82. package/dist/commands/skill.d.ts +0 -18
  83. package/dist/commands/skill.d.ts.map +0 -1
  84. package/dist/commands/skill.js +0 -105
  85. package/dist/commands/skill.js.map +0 -1
  86. package/dist/commands/start.d.ts +0 -5
  87. package/dist/commands/start.d.ts.map +0 -1
  88. package/dist/commands/start.js +0 -58
  89. package/dist/commands/start.js.map +0 -1
  90. package/dist/commands/status.d.ts +0 -2
  91. package/dist/commands/status.d.ts.map +0 -1
  92. package/dist/commands/status.js +0 -33
  93. package/dist/commands/status.js.map +0 -1
  94. package/dist/commands/stop.d.ts +0 -2
  95. package/dist/commands/stop.d.ts.map +0 -1
  96. package/dist/commands/stop.js +0 -12
  97. package/dist/commands/stop.js.map +0 -1
  98. package/dist/commands/workflow.d.ts +0 -6
  99. package/dist/commands/workflow.d.ts.map +0 -1
  100. package/dist/commands/workflow.js +0 -24
  101. package/dist/commands/workflow.js.map +0 -1
  102. package/dist/index.d.ts +0 -3
  103. package/dist/index.d.ts.map +0 -1
  104. package/dist/index.js +0 -606
  105. package/dist/index.js.map +0 -1
  106. package/dist/lib/dashboard-cache.d.ts +0 -3
  107. package/dist/lib/dashboard-cache.d.ts.map +0 -1
  108. package/dist/lib/dashboard-cache.js +0 -97
  109. package/dist/lib/dashboard-cache.js.map +0 -1
  110. package/dist/lib/paths.d.ts +0 -1
  111. package/dist/lib/paths.d.ts.map +0 -1
  112. package/dist/lib/paths.js +0 -4
  113. package/dist/lib/paths.js.map +0 -1
  114. package/dist/lib/plugin-registry.d.ts +0 -18
  115. package/dist/lib/plugin-registry.d.ts.map +0 -1
  116. package/dist/lib/plugin-registry.js +0 -39
  117. package/dist/lib/plugin-registry.js.map +0 -1
  118. package/dist/lib/plugin-setup.d.ts +0 -23
  119. package/dist/lib/plugin-setup.d.ts.map +0 -1
  120. package/dist/lib/plugin-setup.js +0 -141
  121. package/dist/lib/plugin-setup.js.map +0 -1
  122. package/dist/lib/with-server.d.ts +0 -7
  123. package/dist/lib/with-server.d.ts.map +0 -1
  124. package/dist/lib/with-server.js +0 -28
  125. package/dist/lib/with-server.js.map +0 -1
  126. package/dist/mode.d.ts +0 -10
  127. package/dist/mode.d.ts.map +0 -1
  128. package/dist/mode.js +0 -40
  129. package/dist/mode.js.map +0 -1
  130. package/dist/plugin-files/.claude-plugin/plugin.json +0 -20
  131. package/dist/plugin-files/CLAUDE.md +0 -34
  132. package/dist/plugin-files/dist/command-registry.json +0 -235
  133. package/dist/plugin-files/dist/skills/devflow:context/SKILL.md +0 -49
  134. package/dist/plugin-files/dist/skills/devflow:docker/SKILL.md +0 -67
  135. package/dist/plugin-files/dist/skills/devflow:electron/SKILL.md +0 -67
  136. package/dist/plugin-files/dist/skills/devflow:graph/SKILL.md +0 -42
  137. package/dist/plugin-files/dist/skills/devflow:graphql/SKILL.md +0 -68
  138. package/dist/plugin-files/dist/skills/devflow:knowledge/SKILL.md +0 -42
  139. package/dist/plugin-files/dist/skills/devflow:memory/SKILL.md +0 -41
  140. package/dist/plugin-files/dist/skills/devflow:nest/SKILL.md +0 -68
  141. package/dist/plugin-files/dist/skills/devflow:nextjs/SKILL.md +0 -65
  142. package/dist/plugin-files/dist/skills/devflow:performance/SKILL.md +0 -67
  143. package/dist/plugin-files/dist/skills/devflow:react/SKILL.md +0 -85
  144. package/dist/plugin-files/dist/skills/devflow:tailwind/SKILL.md +0 -63
  145. package/dist/plugin-files/dist/skills/devflow:taro/SKILL.md +0 -66
  146. package/dist/plugin-files/dist/skills/devflow:vue/SKILL.md +0 -74
  147. package/dist/plugin-files/dist/skills/devflow:workflow/SKILL.md +0 -42
  148. package/dist/plugin-files/hooks/constitution.md +0 -20
  149. package/dist/plugin-files/hooks/post-tool-use +0 -16
  150. package/dist/plugin-files/hooks/pre-tool-use +0 -23
  151. package/dist/plugin-files/hooks/session-start +0 -165
  152. package/dist/plugin-files/hooks/stop +0 -32
  153. package/dist/plugin-files/hooks.json +0 -52
  154. package/dist/plugin-files/package.json +0 -31
@@ -1 +0,0 @@
1
- {"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAGA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAO7C"}
@@ -1,12 +0,0 @@
1
- import chalk from "chalk";
2
- import { stopServer } from "./server.js";
3
- export async function stopAll() {
4
- const stopped = await stopServer();
5
- if (stopped) {
6
- console.log(chalk.green("Server stopped"));
7
- }
8
- else {
9
- console.log(chalk.dim("No DevFlow services running"));
10
- }
11
- }
12
- //# sourceMappingURL=stop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IACnC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { WorkflowMeta, WorkflowRun, WorkflowRunResult } from "@devflow-tools/sdk";
2
- export declare function listWorkflows(skipServer?: boolean): Promise<WorkflowMeta[]>;
3
- export declare function runWorkflow(type: string, input: Record<string, unknown>, skipServer?: boolean): Promise<WorkflowRunResult>;
4
- export declare function getWorkflowStatus(skipServer?: boolean): Promise<WorkflowRun[]>;
5
- export declare function getWorkflowRuns(skipServer?: boolean): Promise<WorkflowRun[]>;
6
- //# sourceMappingURL=workflow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvF,wBAAsB,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAUjF;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAU5B;AAED,wBAAsB,iBAAiB,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAEpF;AAED,wBAAsB,eAAe,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAUlF"}
@@ -1,24 +0,0 @@
1
- import { withServer } from "../lib/with-server.js";
2
- import { createEngines } from "@devflow-tools/context-engine";
3
- export async function listWorkflows(skipServer) {
4
- return withServer(process.cwd(), (client) => client.listWorkflows(), async () => {
5
- const { workflow } = await createEngines(process.cwd());
6
- return workflow.list();
7
- }, { skipServer });
8
- }
9
- export async function runWorkflow(type, input, skipServer) {
10
- return withServer(process.cwd(), (client) => client.runWorkflow(type, input), async () => {
11
- const { workflow } = await createEngines(process.cwd());
12
- return workflow.run(type, input);
13
- }, { skipServer });
14
- }
15
- export async function getWorkflowStatus(skipServer) {
16
- return getWorkflowRuns(skipServer);
17
- }
18
- export async function getWorkflowRuns(skipServer) {
19
- return withServer(process.cwd(), (client) => client.getWorkflowRuns(), async () => {
20
- const { workflow } = await createEngines(process.cwd());
21
- return workflow.listRuns();
22
- }, { skipServer });
23
- }
24
- //# sourceMappingURL=workflow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAoB;IACtD,OAAO,UAAU,CACf,OAAO,CAAC,GAAG,EAAE,EACb,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAA6B,EAC7D,KAAK,IAAI,EAAE;QACT,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC,EACD,EAAE,UAAU,EAAE,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,KAA8B,EAC9B,UAAoB;IAEpB,OAAO,UAAU,CACf,OAAO,CAAC,GAAG,EAAE,EACb,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAA+B,EACzE,KAAK,IAAI,EAAE;QACT,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC,EACD,EAAE,UAAU,EAAE,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAoB;IAC1D,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAoB;IACxD,OAAO,UAAU,CACf,OAAO,CAAC,GAAG,EAAE,EACb,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,EAA4B,EAC9D,KAAK,IAAI,EAAE;QACT,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC,EACD,EAAE,UAAU,EAAE,CACf,CAAC;AACJ,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js DELETED
@@ -1,606 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from "commander";
3
- import chalk from "chalk";
4
- import fs from "fs";
5
- import path from "path";
6
- import { detectMode } from "./mode.js";
7
- import { initProject } from "./commands/init.js";
8
- import { guidePluginInstallation, installPluginsFromList } from "./commands/plugin-guide.js";
9
- import { connectAgent, getAvailableAgents } from "./commands/connect.js";
10
- import { getIndexStatus } from "./commands/index-cmd.js";
11
- import { getGraph } from "./commands/graph.js";
12
- import { getContext, getTaskContext } from "./commands/context.js";
13
- import { listWorkflows, runWorkflow, getWorkflowStatus, getWorkflowRuns, } from "./commands/workflow.js";
14
- import { showMemory, setMemory, reviewCandidates } from "./commands/memory.js";
15
- import { searchKnowledge } from "./commands/knowledge.js";
16
- import { listSkills, searchSkills, installSkill, uninstallSkill } from "./commands/skill.js";
17
- import { runDoctor, runDoctorAudit, runDoctorAuditFix, runDoctorViolations, runDoctorReceipts } from "./commands/doctor.js";
18
- import { generateToken } from "./commands/session.js";
19
- import { runBenchmark } from "./commands/benchmark-cmd.js";
20
- import { runReview } from "./commands/review.js";
21
- import { startServer, stopServer, serverStatus } from "./commands/server.js";
22
- import { startAll } from "./commands/start.js";
23
- import { stopAll } from "./commands/stop.js";
24
- import { showStatus } from "./commands/status.js";
25
- import { setupCommand } from "./commands/setup.js";
26
- import { pluginListCommand } from "./commands/plugin/list.js";
27
- import { pluginSearchCommand } from "./commands/plugin/search.js";
28
- import { pluginInstallCommand } from "./commands/plugin/install.js";
29
- import { pluginUninstallCommand } from "./commands/plugin/uninstall.js";
30
- import { dashboardCommand } from "./commands/dashboard.js";
31
- import { KnowledgeEngine } from "@devflow-tools/knowledge-engine";
32
- import { createRequire } from "module";
33
- const require = createRequire(import.meta.url);
34
- // Read version from package.json at runtime
35
- // Installed: dist/cli.js → ../package.json = packages/devflow/package.json
36
- // Dev: dist/index.js → ../package.json = apps/cli/package.json
37
- let pkgVersion = "0.0.0";
38
- try {
39
- pkgVersion = require("../package.json").version;
40
- }
41
- catch {
42
- try {
43
- pkgVersion = require("../../package.json").version;
44
- }
45
- catch {
46
- // Should not happen
47
- }
48
- }
49
- const program = new Command();
50
- program
51
- .name("devflow")
52
- .description("Developer Intelligence Platform for AI Coding Agents")
53
- .version(pkgVersion)
54
- .option("--local", "Force local engine, skip server");
55
- // --- init ---
56
- program
57
- .command("init")
58
- .description("Initialize .devflow/ in the current project")
59
- .option("--force", "Overwrite existing config")
60
- .option("--abort", "Force delete .codegraph and .devflow directories before reinitializing")
61
- .option("--report", "Output onboarding markdown report to stdout")
62
- .option("--json", "Output onboarding pack as JSON to stdout")
63
- .option("--plugins <names>", "Comma-separated list of plugins to install (non-interactive)")
64
- .option("--no-plugins", "Skip plugin installation guide")
65
- .action(async (opts) => {
66
- const root = process.cwd();
67
- if (opts.abort) {
68
- console.log(chalk.yellow("🗑️ --abort flag detected, removing existing directories..."));
69
- const dirsToRemove = [".codegraph", ".devflow"];
70
- for (const dir of dirsToRemove) {
71
- const dirPath = path.join(root, dir);
72
- if (fs.existsSync(dirPath)) {
73
- console.log(chalk.dim(` Removing ${dir}/...`));
74
- fs.rmSync(dirPath, { recursive: true, force: true });
75
- }
76
- }
77
- console.log(chalk.green("✅ Existing directories removed\n"));
78
- }
79
- const mode = detectMode(root);
80
- console.error(chalk.blue(`DevFlow init — mode: ${mode}`));
81
- const result = await initProject(root, { force: opts.force });
82
- if (opts.json && result.onboardingPack) {
83
- console.log(JSON.stringify(result.onboardingPack, null, 2));
84
- }
85
- else if (opts.report && result.onboardingPack) {
86
- const { renderInitReport } = await import("./commands/init.js");
87
- console.log(renderInitReport(result.onboardingPack));
88
- }
89
- else {
90
- if (result.created.length > 0) {
91
- console.log(chalk.green("Created:"));
92
- for (const path of result.created) {
93
- console.log(` ${chalk.dim("+")} ${path}`);
94
- }
95
- }
96
- else {
97
- console.log(chalk.dim("Already initialized. Use --force to overwrite config."));
98
- }
99
- if (result.indexed) {
100
- console.log(chalk.green(`✅ CodeGraph initialized (${result.indexed.files} files, ${result.indexed.symbols} symbols)`));
101
- }
102
- if (result.onboardingPack) {
103
- const pack = result.onboardingPack;
104
- console.log(chalk.green(`✅ Onboarding pack generated`));
105
- console.log(chalk.dim(` ${pack.stats.files} files, ${pack.stack.frameworks.join(", ") || "no framework"}`));
106
- }
107
- if (result.pluginDeployed) {
108
- console.log(chalk.green("✅ Plugin deployed to ~/.claude/plugins/cache/"));
109
- }
110
- if (result.pluginEnabled) {
111
- console.log(chalk.green("✅ Plugin enabled in ~/.claude/settings.json"));
112
- }
113
- if (result.mcpConfigured) {
114
- console.log(chalk.green("✅ MCP config written to .claude/mcp.json"));
115
- }
116
- if (result.pluginDeployed && result.pluginEnabled && result.mcpConfigured) {
117
- console.log(chalk.green("\nDevFlow is ready! Run `claude` to start."));
118
- }
119
- // ── Plugin installation guide ──
120
- if (typeof opts.plugins === "string") {
121
- // Non-interactive: --plugins <names>
122
- await installPluginsFromList(opts.plugins);
123
- }
124
- else if (opts.plugins !== false) {
125
- // Interactive: no --plugins flag and not --no-plugins
126
- await guidePluginInstallation(root);
127
- }
128
- }
129
- });
130
- // --- connect ---
131
- program
132
- .command("connect [agent]")
133
- .description("Configure MCP connection for AI coding agents")
134
- .option("--command <cmd>", "MCP server command", "devflow-mcp")
135
- .option("--sse <url>", "SSE server URL (instead of stdio)")
136
- .action(async (agent, opts) => {
137
- const root = process.cwd();
138
- const mode = detectMode(root);
139
- console.log(chalk.blue(`DevFlow connect — mode: ${mode}`));
140
- if (agent) {
141
- const available = getAvailableAgents();
142
- if (!available.includes(agent)) {
143
- console.log(chalk.red(`Unknown agent: ${agent}`));
144
- console.log(`Available: ${available.join(", ")}`);
145
- process.exit(1);
146
- }
147
- }
148
- try {
149
- const results = await connectAgent({
150
- agent: agent,
151
- command: opts.command,
152
- sseUrl: opts.sse,
153
- });
154
- for (const r of results) {
155
- console.log(chalk.green(`✓ ${r}`));
156
- }
157
- }
158
- catch (err) {
159
- console.error(chalk.red(`Error: ${err.message}`));
160
- process.exit(1);
161
- }
162
- });
163
- // --- index ---
164
- program
165
- .command("index")
166
- .description("Show index status")
167
- .option("--watch", "Start file watcher for hot updates (stub)")
168
- .action(async (opts) => {
169
- const status = await getIndexStatus(program.opts().local);
170
- console.log(chalk.blue("Index Status"));
171
- console.log(` Files: ${status.totalFiles}`);
172
- console.log(` Symbols: ${status.totalSymbols}`);
173
- console.log(` Indexing: ${status.indexing ? "active" : "idle"}`);
174
- if (opts.watch) {
175
- console.log(chalk.dim(" (watch mode not yet implemented)"));
176
- }
177
- });
178
- // --- graph ---
179
- program
180
- .command("graph [target]")
181
- .description("Show dependency graph")
182
- .option("--depth <n>", "Expansion depth", "2")
183
- .action(async (target, opts) => {
184
- const graph = await getGraph({ target, depth: parseInt(opts.depth, 10), skipServer: program.opts().local });
185
- console.log(chalk.blue("Dependency Graph"));
186
- console.log(` Nodes: ${graph.nodes.length}`);
187
- console.log(` Edges: ${graph.edges.length}`);
188
- });
189
- // --- context ---
190
- program
191
- .command("context <query>")
192
- .description("Retrieve project context for a query")
193
- .option("--mode <mode>", "fast | deep", "fast")
194
- .option("--max-tokens <n>", "Max token budget", "4000")
195
- .option("--task", "Use task-oriented mode with risk hints and next actions")
196
- .option("--why", "Show reasoning for file selection")
197
- .action(async (query, opts) => {
198
- if (opts.task) {
199
- const result = await getTaskContext({
200
- query,
201
- mode: opts.mode,
202
- maxTokens: parseInt(opts.maxTokens, 10),
203
- skipServer: program.opts().local,
204
- });
205
- console.log(JSON.stringify({
206
- requiredFiles: result.requiredFiles,
207
- optionalFiles: result.optionalFiles,
208
- riskHints: result.riskHints,
209
- nextActions: result.nextActions,
210
- reasoning: opts.why ? result.reasoning : undefined,
211
- }, null, 2));
212
- }
213
- else {
214
- const result = await getContext({
215
- query,
216
- mode: opts.mode,
217
- maxTokens: parseInt(opts.maxTokens, 10),
218
- skipServer: program.opts().local,
219
- });
220
- console.log(chalk.blue(`Context: "${query}"`));
221
- console.log(` Files: ${result.files.length}`);
222
- console.log(` Confidence: ${(result.confidence * 100).toFixed(0)}%`);
223
- console.log(` Tokens: ${result.tokenCount}`);
224
- }
225
- });
226
- // --- workflow ---
227
- const workflowCmd = program
228
- .command("workflow")
229
- .description("Workflow management");
230
- workflowCmd
231
- .command("list")
232
- .description("List available workflows")
233
- .action(async () => {
234
- const workflows = await listWorkflows(program.opts().local);
235
- if (workflows.length === 0) {
236
- console.log(chalk.dim("No workflows registered."));
237
- return;
238
- }
239
- for (const w of workflows) {
240
- console.log(`${chalk.green(w.name)} — ${w.description} (${w.stepCount} steps)`);
241
- }
242
- });
243
- workflowCmd
244
- .command("run <type> [input]")
245
- .description("Run a workflow")
246
- .action(async (type, input) => {
247
- const result = await runWorkflow(type, { input: input ?? "" }, program.opts().local);
248
- console.log(`Run: ${result.runId}`);
249
- console.log(`Status: ${result.status}`);
250
- console.log(`Duration: ${result.duration}ms`);
251
- });
252
- workflowCmd
253
- .command("status")
254
- .description("Show running workflows")
255
- .action(async () => {
256
- const runs = await getWorkflowStatus(program.opts().local);
257
- console.log(`${runs.length} run(s)`);
258
- for (const r of runs) {
259
- console.log(` ${r.runId} — ${r.status}`);
260
- }
261
- });
262
- workflowCmd
263
- .command("runs")
264
- .description("Show workflow history")
265
- .action(async () => {
266
- const runs = await getWorkflowRuns(program.opts().local);
267
- if (runs.length === 0) {
268
- console.log(chalk.dim("No runs yet."));
269
- return;
270
- }
271
- for (const r of runs) {
272
- const duration = r.finishedAt ? `${r.finishedAt - r.startedAt}ms` : "running";
273
- console.log(` ${r.runId} ${chalk.yellow(r.status)} ${duration}`);
274
- }
275
- });
276
- // --- memory ---
277
- const memoryCmd = program
278
- .command("memory")
279
- .description("Memory management");
280
- memoryCmd
281
- .command("show")
282
- .description("Show current project memory")
283
- .action(async () => {
284
- const mem = await showMemory(program.opts().local);
285
- console.log(JSON.stringify(mem, null, 2));
286
- });
287
- memoryCmd
288
- .command("set <key> <value>")
289
- .description("Set a memory key")
290
- .action(async (key, value) => {
291
- await setMemory(key, value, program.opts().local);
292
- console.log(chalk.green(`Memory set: ${key} = ${value}`));
293
- });
294
- memoryCmd
295
- .command("review")
296
- .description("Review memory candidates")
297
- .action(async () => {
298
- const candidates = await reviewCandidates(program.opts().local);
299
- console.log(JSON.stringify(candidates, null, 2));
300
- });
301
- // --- knowledge ---
302
- const knowledgeCmd = program
303
- .command("knowledge <query>")
304
- .description("Search knowledge base")
305
- .action(async (query) => {
306
- const results = await searchKnowledge(query, undefined, program.opts().local);
307
- console.log(chalk.blue(`Knowledge: "${query}"`));
308
- console.log(` Results: ${results.length}`);
309
- for (const r of results.slice(0, 5)) {
310
- console.log(` — ${r.title}`);
311
- }
312
- });
313
- // docs sync
314
- program
315
- .command("docs sync [plugin-name]")
316
- .description("Sync documentation for plugins")
317
- .action(async (pluginName) => {
318
- console.log(chalk.blue(`◉ Syncing docs${pluginName ? ` for ${pluginName} plugin` : ""}`));
319
- const engine = new KnowledgeEngine({ projectRoot: process.cwd() });
320
- if (pluginName) {
321
- const results = await engine.syncDocs(pluginName);
322
- for (const r of results) {
323
- if (r.added > 0) {
324
- console.log(` ${chalk.green("✓")} ${r.source} → ${r.added} chunks`);
325
- }
326
- else {
327
- console.log(` ${chalk.red("✗")} ${r.source} — ${r.errors.join(", ") || "no content"}`);
328
- }
329
- }
330
- console.log(chalk.green(`\n ${pluginName} docs synced to .devflow/knowledge/${pluginName}/`));
331
- }
332
- else {
333
- const sources = await engine.getSources();
334
- for (const s of sources) {
335
- const results = await engine.syncDocs(s.source.name);
336
- for (const r of results) {
337
- if (r.added > 0) {
338
- console.log(` ${chalk.green("✓")} ${r.source} → ${r.added} chunks`);
339
- }
340
- else {
341
- console.log(` ${chalk.red("✗")} ${r.source} — ${r.errors.join(", ") || "no content"}`);
342
- }
343
- }
344
- }
345
- console.log(chalk.green("\n All docs synced."));
346
- }
347
- });
348
- // --- skill ---
349
- const skillCmd = program
350
- .command("skill")
351
- .description("Plugin/Skill management");
352
- skillCmd
353
- .command("list")
354
- .description("List installed skills")
355
- .action(async () => {
356
- const skills = await listSkills(program.opts().local);
357
- if (skills.length === 0) {
358
- console.log(chalk.dim("No skills installed. Use 'devflow skill search' to find plugins."));
359
- return;
360
- }
361
- for (const s of skills) {
362
- console.log(` ${chalk.green(s.name)} @ ${s.version} — ${s.description}`);
363
- }
364
- });
365
- skillCmd
366
- .command("search <query>")
367
- .description("Search available plugins")
368
- .action(async (query) => {
369
- const results = await searchSkills(query, program.opts().local);
370
- console.log(chalk.blue(`Search: "${query}"`));
371
- if (results.length === 0) {
372
- console.log(chalk.dim(" No matching plugins found."));
373
- return;
374
- }
375
- for (const s of results) {
376
- console.log(` ${chalk.green(s.name)} @ ${s.version} — ${s.description}`);
377
- }
378
- });
379
- skillCmd
380
- .command("install <name>")
381
- .description("Install a plugin/skill")
382
- .action(async (name) => {
383
- try {
384
- const result = await installSkill(name, process.cwd(), program.opts().local);
385
- console.log(chalk.green(`✓ Installed @devflow-tools/plugin-${result.name}@${result.version}`));
386
- if (result.templates.length > 0) {
387
- console.log(` Templates: ${result.templates.join(", ")}`);
388
- }
389
- }
390
- catch (err) {
391
- console.log(chalk.red(`Error: ${err.message}`));
392
- process.exit(1);
393
- }
394
- });
395
- skillCmd
396
- .command("uninstall <name>")
397
- .description("Uninstall a plugin/skill")
398
- .action(async (name) => {
399
- try {
400
- await uninstallSkill(name, process.cwd(), program.opts().local);
401
- console.log(chalk.green(`✓ Uninstalled ${name}`));
402
- }
403
- catch (err) {
404
- console.log(chalk.red(`Error: ${err.message}`));
405
- process.exit(1);
406
- }
407
- });
408
- // --- doctor ---
409
- program
410
- .command("doctor")
411
- .description("Run project health check")
412
- .option("--json", "Output as JSON")
413
- .option("--audit", "Verify audit chain integrity")
414
- .option("--audit-fix", "Rebuild audit chain signatures")
415
- .option("--violations", "Show violation records")
416
- .option("--last <period>", "Filter violations by time (e.g. 7d, 24h)")
417
- .option("--receipts", "Show current session receipt status")
418
- .action(async (opts) => {
419
- if (opts.audit) {
420
- const report = await runDoctorAudit();
421
- console.log(opts.json ? JSON.stringify(report) : `Audit chain: ${report.valid ? "VALID" : `BROKEN at seq ${report.brokenAt}`} (${report.entryCount} entries)`);
422
- return;
423
- }
424
- if (opts.auditFix) {
425
- const report = await runDoctorAuditFix();
426
- console.log(opts.json ? JSON.stringify(report) : "Audit chain rebuilt.");
427
- return;
428
- }
429
- if (opts.violations) {
430
- const report = await runDoctorViolations(opts.last);
431
- console.log(opts.json ? JSON.stringify(report) : JSON.stringify(report, null, 2));
432
- return;
433
- }
434
- if (opts.receipts) {
435
- const result = runDoctorReceipts();
436
- if (opts.json) {
437
- console.log(JSON.stringify(result));
438
- }
439
- else if (result.data) {
440
- console.log(JSON.stringify(result.data, null, 2));
441
- }
442
- else {
443
- console.log(`No active receipt found for session ${result.sessionId}.`);
444
- }
445
- return;
446
- }
447
- // Default: full health report
448
- const report = await runDoctor();
449
- if (opts.json) {
450
- console.log(JSON.stringify(report));
451
- return;
452
- }
453
- console.log(chalk.blue(`DevFlow Doctor v${pkgVersion}\n`));
454
- console.log(chalk.bold("◉ Index Status"));
455
- console.log(` Files ${report.index.totalFiles.toLocaleString()}`);
456
- console.log(` Symbols ${report.index.totalSymbols.toLocaleString()}`);
457
- console.log(` Graph (${report.graph.edges.toLocaleString()} edges)`);
458
- console.log(` Status ${report.index.indexing ? "indexing" : "idle"}`);
459
- console.log();
460
- console.log(chalk.bold("◉ Memory"));
461
- console.log(` Project ${report.memory.projectReady ? "ready" : "not set"}`);
462
- console.log(` Preferences ${report.memory.userPrefs} set`);
463
- console.log();
464
- console.log(chalk.bold("◉ Knowledge"));
465
- console.log(` Sources ${report.knowledge.sources}`);
466
- console.log();
467
- console.log(chalk.bold("◉ Server"));
468
- if (report.server.running) {
469
- console.log(` ${chalk.green("✔")} Running on http://localhost:13337`);
470
- }
471
- else {
472
- console.log(` ${chalk.yellow("○")} Not running — run \`devflow server start\` for telemetry`);
473
- }
474
- console.log();
475
- console.log(chalk.bold("◉ Plugins"));
476
- if (report.plugins.installed === 0) {
477
- console.log(` ${chalk.dim("No plugins installed")}`);
478
- }
479
- else {
480
- for (const name of report.plugins.names) {
481
- console.log(` ${name}`);
482
- }
483
- }
484
- console.log();
485
- console.log(chalk.bold("◉ Workflows"));
486
- console.log(` Registered ${report.workflows.registered}`);
487
- console.log();
488
- const scoreColor = report.readyScore >= 70 ? chalk.green : report.readyScore >= 40 ? chalk.yellow : chalk.red;
489
- console.log(`AI Ready: ${scoreColor(report.readyScore + "%")}`);
490
- });
491
- // --- session ---
492
- program
493
- .command("session token")
494
- .description("Generate a session token for MCP Gateway authentication")
495
- .option("--expires <seconds>", "Token TTL in seconds", "3600")
496
- .action(async (opts) => {
497
- const result = await generateToken(process.cwd(), parseInt(opts.expires, 10));
498
- console.log(JSON.stringify(result, null, 2));
499
- });
500
- // --- benchmark ---
501
- program
502
- .command("benchmark [target]")
503
- .description("Run benchmark on engines")
504
- .option("--iterations <n>", "Number of iterations", "5")
505
- .option("--output <format>", "json | text", "text")
506
- .action(async (target, opts) => {
507
- const output = await runBenchmark(target ?? "all", {
508
- iterations: parseInt(opts.iterations, 10),
509
- output: opts.output,
510
- });
511
- console.log(output);
512
- });
513
- // --- review ---
514
- program
515
- .command("review [pr-url]")
516
- .description("Review a PR or current branch diff")
517
- .option("--agent <agent>", "AI agent to use", "claude")
518
- .action(async (prUrl, opts) => {
519
- const output = await runReview({ prUrl, agent: opts.agent });
520
- console.log(output);
521
- });
522
- // --- server ---
523
- const serverCmd = program
524
- .command("server")
525
- .description("Manage DevFlow server");
526
- serverCmd
527
- .command("start")
528
- .description("Start the DevFlow REST server")
529
- .option("--port <n>", "Port number", "13337")
530
- .action(async (opts) => {
531
- console.log(chalk.blue("Starting DevFlow server..."));
532
- const result = await startServer({ port: parseInt(opts.port, 10) });
533
- console.log(chalk.green(`Server started (pid: ${result.pid}) on port ${opts.port}`));
534
- });
535
- serverCmd
536
- .command("stop")
537
- .description("Stop the DevFlow REST server")
538
- .action(async () => {
539
- const ok = await stopServer();
540
- if (ok)
541
- console.log(chalk.green("Server stopped"));
542
- else
543
- console.log(chalk.dim("No server running"));
544
- });
545
- serverCmd
546
- .command("status")
547
- .description("Show server status")
548
- .action(async () => {
549
- const status = await serverStatus();
550
- if (status.running)
551
- console.log(chalk.green(`Running (pid: ${status.pid})`));
552
- else
553
- console.log(chalk.yellow("Not running"));
554
- });
555
- // --- dashboard ---
556
- program.addCommand(dashboardCommand);
557
- // --- start ---
558
- program
559
- .command("start")
560
- .description("Start DevFlow server (API + Dashboard)")
561
- .option("--port <n>", "Server port", "13337")
562
- .option("-d, --background", "Run in background (detached)")
563
- .action(async (opts) => {
564
- await startAll({
565
- port: parseInt(opts.port, 10),
566
- background: !!opts.background,
567
- });
568
- });
569
- // --- stop ---
570
- program
571
- .command("stop")
572
- .description("Stop DevFlow server")
573
- .action(async () => {
574
- await stopAll();
575
- });
576
- // --- status ---
577
- program
578
- .command("status")
579
- .description("Show DevFlow services status")
580
- .action(async () => {
581
- await showStatus();
582
- });
583
- // --- setup ---
584
- program
585
- .command("setup")
586
- .description("Configure Claude Code integration (MCP + plugin)")
587
- .option("--agent <agent>", "Target agent (claude/cursor/cline)")
588
- .option("--skip-mcp", "Skip MCP configuration")
589
- .option("--skip-plugin", "Skip plugin registration")
590
- .action(async (opts) => {
591
- await setupCommand({
592
- agent: opts.agent,
593
- skipMcp: !!opts.skipMcp,
594
- skipPlugin: !!opts.skipPlugin,
595
- });
596
- });
597
- // --- plugin ---
598
- const pluginCmd = program
599
- .command("plugin")
600
- .description("Manage DevFlow plugins");
601
- pluginCmd.addCommand(pluginListCommand);
602
- pluginCmd.addCommand(pluginSearchCommand);
603
- pluginCmd.addCommand(pluginInstallCommand);
604
- pluginCmd.addCommand(pluginUninstallCommand);
605
- program.parse();
606
- //# sourceMappingURL=index.js.map