@devflow-tools/cli 0.1.0
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/bin/devflow.cjs +63 -0
- package/dist/commands/connect.d.ts +8 -0
- package/dist/commands/connect.d.ts.map +1 -0
- package/dist/commands/connect.js +26 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/context.d.ts +14 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +11 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/doctor.d.ts +28 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +73 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/graph.d.ts +10 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +12 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/index-cmd.d.ts +8 -0
- package/dist/commands/index-cmd.d.ts.map +1 -0
- package/dist/commands/index-cmd.js +12 -0
- package/dist/commands/index-cmd.js.map +1 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +44 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/knowledge.d.ts +5 -0
- package/dist/commands/knowledge.d.ts.map +1 -0
- package/dist/commands/knowledge.js +16 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/memory.d.ts +5 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +18 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/plugin-loader.d.ts +6 -0
- package/dist/commands/plugin-loader.d.ts.map +1 -0
- package/dist/commands/plugin-loader.js +71 -0
- package/dist/commands/plugin-loader.js.map +1 -0
- package/dist/commands/skill.d.ts +12 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +23 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/workflow.d.ts +7 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +22 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +279 -0
- package/dist/index.js.map +1 -0
- package/dist/mode.d.ts +10 -0
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +40 -0
- package/dist/mode.js.map +1 -0
- package/package.json +48 -0
package/bin/devflow.cjs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
//
|
|
4
|
+
// DevFlow CLI launcher — runs on the user's Node, locates the vendored Node 24
|
|
5
|
+
// runtime from @colbymchenry/codegraph (which bundles node:sqlite), and execs
|
|
6
|
+
// the real CLI with it. The user's Node is only ever a launcher.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
var childProcess = require('child_process');
|
|
10
|
+
var path = require('path');
|
|
11
|
+
|
|
12
|
+
var target = process.platform + '-' + process.arch;
|
|
13
|
+
var pkg = '@colbymchenry/codegraph-' + target;
|
|
14
|
+
var isWindows = process.platform === 'win32';
|
|
15
|
+
|
|
16
|
+
main();
|
|
17
|
+
|
|
18
|
+
function main() {
|
|
19
|
+
var nodeExe, entry;
|
|
20
|
+
|
|
21
|
+
if (isWindows) {
|
|
22
|
+
nodeExe = resolveSilent(pkg + '/node.exe');
|
|
23
|
+
entry = resolveSilent(pkg + '/lib/dist/bin/codegraph.js');
|
|
24
|
+
if (!nodeExe || !entry) fail();
|
|
25
|
+
// --liftoff-only keeps WASM grammars off V8's turboshaft tier (avoids Zone OOM on Node >= 22)
|
|
26
|
+
var args = ['--liftoff-only', entry, resolveEntry()].concat(process.argv.slice(2));
|
|
27
|
+
var res = childProcess.spawnSync(nodeExe, args, { stdio: 'inherit' });
|
|
28
|
+
process.exit(res.status === null ? 1 : res.status);
|
|
29
|
+
} else {
|
|
30
|
+
// Use the vendored Node directly — it has node:sqlite built in
|
|
31
|
+
nodeExe = resolveSilent(pkg + '/node');
|
|
32
|
+
if (nodeExe) {
|
|
33
|
+
var args2 = [resolveEntry()].concat(process.argv.slice(2));
|
|
34
|
+
var res2 = childProcess.spawnSync(nodeExe, args2, { stdio: 'inherit' });
|
|
35
|
+
process.exit(res2.status === null ? 1 : res2.status);
|
|
36
|
+
} else {
|
|
37
|
+
// Fallback: try the bin/codegraph launcher
|
|
38
|
+
var launcher = resolveSilent(pkg + '/bin/codegraph');
|
|
39
|
+
if (launcher) {
|
|
40
|
+
var res3 = childProcess.spawnSync(launcher, [resolveEntry()].concat(process.argv.slice(2)), { stdio: 'inherit' });
|
|
41
|
+
process.exit(res3.status === null ? 1 : res3.status);
|
|
42
|
+
}
|
|
43
|
+
fail();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function resolveEntry() {
|
|
49
|
+
// When installed globally, the real CLI is next to this shim's node_modules
|
|
50
|
+
return path.resolve(__dirname, '..', 'dist', 'index.js');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function resolveSilent(id) {
|
|
54
|
+
try { return require.resolve(id); } catch (e) { return null; }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function fail() {
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
'devflow: could not find the CodeGraph platform bundle (' + pkg + ').\n' +
|
|
60
|
+
'Make sure @colbymchenry/codegraph is installed.\n'
|
|
61
|
+
);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ConnectOptions {
|
|
2
|
+
agent?: string;
|
|
3
|
+
command?: string;
|
|
4
|
+
sseUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function connectAgent(options: ConnectOptions): Promise<string[]>;
|
|
7
|
+
export declare function getAvailableAgents(): string[];
|
|
8
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuB7E;AAED,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { connect, listAdapters } from "@devflow-tools/adapters";
|
|
2
|
+
export async function connectAgent(options) {
|
|
3
|
+
const results = [];
|
|
4
|
+
let connectionConfig;
|
|
5
|
+
if (options.sseUrl) {
|
|
6
|
+
connectionConfig = { url: options.sseUrl };
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
connectionConfig = {
|
|
10
|
+
command: options.command ?? "devflow-mcp",
|
|
11
|
+
args: ["--mode", "stdio"],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const targets = options.agent
|
|
15
|
+
? [options.agent]
|
|
16
|
+
: await import("@devflow-tools/adapters").then((m) => m.detectAll());
|
|
17
|
+
for (const agent of targets) {
|
|
18
|
+
const result = await connect(agent, connectionConfig);
|
|
19
|
+
results.push(`${agent}: ${result.configPath} (${result.written ? "written" : "skipped"})`);
|
|
20
|
+
}
|
|
21
|
+
return results;
|
|
22
|
+
}
|
|
23
|
+
export function getAvailableAgents() {
|
|
24
|
+
return listAdapters();
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAShE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAuB;IACxD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,gBAAkC,CAAC;IACvC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,gBAAgB,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,gBAAgB,GAAG;YACjB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,aAAa;YACzC,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;SAC1B,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK;QAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACjB,CAAC,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IAEvE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ContextOptions {
|
|
2
|
+
query: string;
|
|
3
|
+
mode?: "fast" | "deep";
|
|
4
|
+
maxTokens?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ContextResult {
|
|
7
|
+
files: unknown[];
|
|
8
|
+
graph?: unknown;
|
|
9
|
+
memory?: unknown;
|
|
10
|
+
confidence: number;
|
|
11
|
+
tokenCount: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function getContext(options: ContextOptions): Promise<ContextResult>;
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAQhF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getContext(options) {
|
|
3
|
+
const { context } = await createEngines(process.cwd());
|
|
4
|
+
return context.build({
|
|
5
|
+
query: options.query,
|
|
6
|
+
mode: options.mode ?? "fast",
|
|
7
|
+
maxTokens: options.maxTokens ?? 8000,
|
|
8
|
+
includeGraph: options.mode === "deep",
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAgB9D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAuB;IACtD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,OAAO,OAAO,CAAC,KAAK,CAAC;QACnB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,MAAM;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;QACpC,YAAY,EAAE,OAAO,CAAC,IAAI,KAAK,MAAM;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface DoctorReport {
|
|
2
|
+
index: {
|
|
3
|
+
totalFiles: number;
|
|
4
|
+
totalSymbols: number;
|
|
5
|
+
indexing: boolean;
|
|
6
|
+
};
|
|
7
|
+
graph: {
|
|
8
|
+
nodes: number;
|
|
9
|
+
edges: number;
|
|
10
|
+
};
|
|
11
|
+
memory: {
|
|
12
|
+
projectReady: boolean;
|
|
13
|
+
userPrefs: number;
|
|
14
|
+
};
|
|
15
|
+
knowledge: {
|
|
16
|
+
sources: number;
|
|
17
|
+
};
|
|
18
|
+
plugins: {
|
|
19
|
+
installed: number;
|
|
20
|
+
names: string[];
|
|
21
|
+
};
|
|
22
|
+
workflows: {
|
|
23
|
+
registered: number;
|
|
24
|
+
};
|
|
25
|
+
readyScore: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function runDoctor(): Promise<DoctorReport>;
|
|
28
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE;QACN,YAAY,EAAE,OAAO,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,SAAS,EAAE;QACT,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,CAmEvD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function runDoctor() {
|
|
3
|
+
const { codegraph, graph, memory, knowledge, workflow } = await createEngines(process.cwd());
|
|
4
|
+
const stats = codegraph.getStats();
|
|
5
|
+
const graphOutput = graph.export();
|
|
6
|
+
let workflowCount = 0;
|
|
7
|
+
try {
|
|
8
|
+
const wfList = await workflow.list();
|
|
9
|
+
workflowCount = wfList.length;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// workflow engine not initialized
|
|
13
|
+
}
|
|
14
|
+
let memoryReady = false;
|
|
15
|
+
let userPrefs = 0;
|
|
16
|
+
try {
|
|
17
|
+
const mem = await memory.getAll();
|
|
18
|
+
memoryReady = !!mem?.project;
|
|
19
|
+
const prefs = mem?.user ?? {};
|
|
20
|
+
userPrefs = Object.keys(prefs).length;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// memory engine not initialized
|
|
24
|
+
}
|
|
25
|
+
let knowledgeSources = 0;
|
|
26
|
+
try {
|
|
27
|
+
const sources = await knowledge.getSources();
|
|
28
|
+
knowledgeSources = sources.length;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// knowledge engine not initialized
|
|
32
|
+
}
|
|
33
|
+
let readyScore = 0;
|
|
34
|
+
if (stats.fileCount > 0)
|
|
35
|
+
readyScore += 25;
|
|
36
|
+
if (stats.nodeCount > 0)
|
|
37
|
+
readyScore += 15;
|
|
38
|
+
if (graphOutput.nodes.length > 0)
|
|
39
|
+
readyScore += 20;
|
|
40
|
+
if (memoryReady)
|
|
41
|
+
readyScore += 15;
|
|
42
|
+
if (knowledgeSources > 0)
|
|
43
|
+
readyScore += 10;
|
|
44
|
+
if (workflowCount > 0)
|
|
45
|
+
readyScore += 5;
|
|
46
|
+
return {
|
|
47
|
+
index: {
|
|
48
|
+
totalFiles: stats.fileCount,
|
|
49
|
+
totalSymbols: stats.nodeCount,
|
|
50
|
+
indexing: codegraph.isIndexing(),
|
|
51
|
+
},
|
|
52
|
+
graph: {
|
|
53
|
+
nodes: graphOutput.nodes.length,
|
|
54
|
+
edges: graphOutput.edges.length,
|
|
55
|
+
},
|
|
56
|
+
memory: {
|
|
57
|
+
projectReady: memoryReady,
|
|
58
|
+
userPrefs,
|
|
59
|
+
},
|
|
60
|
+
knowledge: {
|
|
61
|
+
sources: knowledgeSources,
|
|
62
|
+
},
|
|
63
|
+
plugins: {
|
|
64
|
+
installed: 0,
|
|
65
|
+
names: [],
|
|
66
|
+
},
|
|
67
|
+
workflows: {
|
|
68
|
+
registered: workflowCount,
|
|
69
|
+
},
|
|
70
|
+
readyScore,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA6B9D,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE7F,MAAM,KAAK,GAAG,SAAS,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GAAG,CAAC;QAAE,UAAU,IAAI,EAAE,CAAC;IAC3C,IAAI,aAAa,GAAG,CAAC;QAAE,UAAU,IAAI,CAAC,CAAC;IAEvC,OAAO;QACL,KAAK,EAAE;YACL,UAAU,EAAE,KAAK,CAAC,SAAS;YAC3B,YAAY,EAAE,KAAK,CAAC,SAAS;YAC7B,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM;YAC/B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM;SAChC;QACD,MAAM,EAAE;YACN,YAAY,EAAE,WAAW;YACzB,SAAS;SACV;QACD,SAAS,EAAE;YACT,OAAO,EAAE,gBAAgB;SAC1B;QACD,OAAO,EAAE;YACP,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,EAAE;SACV;QACD,SAAS,EAAE;YACT,UAAU,EAAE,aAAa;SAC1B;QACD,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface GraphOptions {
|
|
2
|
+
target?: string;
|
|
3
|
+
depth?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface GraphOutput {
|
|
6
|
+
nodes: unknown[];
|
|
7
|
+
edges: unknown[];
|
|
8
|
+
}
|
|
9
|
+
export declare function getGraph(options?: GraphOptions): Promise<GraphOutput>;
|
|
10
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,wBAAsB,QAAQ,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAU/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getGraph(options = {}) {
|
|
3
|
+
const target = options.target ?? "all";
|
|
4
|
+
const depth = options.depth ?? 2;
|
|
5
|
+
const { graph } = await createEngines(process.cwd());
|
|
6
|
+
if (target === "all") {
|
|
7
|
+
return graph.export();
|
|
8
|
+
}
|
|
9
|
+
const sub = graph.getSubGraph(target, depth);
|
|
10
|
+
return { nodes: sub.nodes, edges: sub.edges };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAY9D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,UAAwB,EAAE;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAErD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/index-cmd.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CASxE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getIndexStatus(root) {
|
|
3
|
+
const { codegraph } = await createEngines(root ?? process.cwd());
|
|
4
|
+
const stats = codegraph.getStats();
|
|
5
|
+
return {
|
|
6
|
+
totalFiles: stats.fileCount,
|
|
7
|
+
totalSymbols: stats.nodeCount,
|
|
8
|
+
lastIndexTime: stats.lastUpdated,
|
|
9
|
+
indexing: codegraph.isIndexing(),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-cmd.js","sourceRoot":"","sources":["../../src/commands/index-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAS9D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAa;IAChD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,SAAS;QAC3B,YAAY,EAAE,KAAK,CAAC,SAAS;QAC7B,aAAa,EAAE,KAAK,CAAC,WAAW;QAChC,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
force?: boolean;
|
|
3
|
+
scan?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function initProject(projectRoot: string, options?: InitOptions): Promise<{
|
|
6
|
+
created: string[];
|
|
7
|
+
indexed?: {
|
|
8
|
+
files: number;
|
|
9
|
+
symbols: number;
|
|
10
|
+
graphNodes: number;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAkDlL"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync, existsSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import CGModule from "@colbymchenry/codegraph";
|
|
4
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
5
|
+
const CodeGraph = CGModule.default ?? CGModule;
|
|
6
|
+
export async function initProject(projectRoot, options = {}) {
|
|
7
|
+
const devflowDir = join(projectRoot, ".devflow");
|
|
8
|
+
const created = [];
|
|
9
|
+
if (!existsSync(devflowDir)) {
|
|
10
|
+
mkdirSync(devflowDir, { recursive: true });
|
|
11
|
+
created.push(".devflow/");
|
|
12
|
+
}
|
|
13
|
+
const configPath = join(devflowDir, "config.json");
|
|
14
|
+
if (!existsSync(configPath) || options.force) {
|
|
15
|
+
writeFileSync(configPath, JSON.stringify({
|
|
16
|
+
version: "0.1.0",
|
|
17
|
+
initialized: new Date().toISOString(),
|
|
18
|
+
}, null, 2), "utf-8");
|
|
19
|
+
created.push(".devflow/config.json");
|
|
20
|
+
}
|
|
21
|
+
const result = { created };
|
|
22
|
+
// Initialize CodeGraph if not already done
|
|
23
|
+
if (!CodeGraph.isInitialized(projectRoot)) {
|
|
24
|
+
await CodeGraph.init(projectRoot, { index: options.scan !== false });
|
|
25
|
+
}
|
|
26
|
+
if (options.scan !== false) {
|
|
27
|
+
try {
|
|
28
|
+
const { indexer, graph } = await createEngines(projectRoot);
|
|
29
|
+
const { files, symbols, imports } = await indexer.indexAll(projectRoot);
|
|
30
|
+
const graphResult = await graph.build(symbols, imports);
|
|
31
|
+
result.indexed = {
|
|
32
|
+
files: files.length,
|
|
33
|
+
symbols: symbols.length,
|
|
34
|
+
graphNodes: graphResult.nodes.length,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
// Indexing is best-effort during init; errors are non-fatal
|
|
39
|
+
result.indexed = { files: 0, symbols: 0, graphNodes: 0 };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,SAAS,GAAK,QAAgB,CAAC,OAA2B,IAAI,QAAQ,CAAC;AAO7E,MAAM,CAA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AAQ,CAAC,WAAW,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxD,MAAM,CAAC,OAAO,GAAG;gBACf,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,OAAO,EAAE,OAAO,CAAC,MAAM;gBACvB,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM;aACrC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,4DAA4D;YAC5D,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KnowledgeEntry } from "@devflow-tools/sdk";
|
|
2
|
+
export declare function getKnowledgeEngine(): Promise<import("@devflow-tools/knowledge-engine").KnowledgeEngine>;
|
|
3
|
+
export declare function searchKnowledge(query: string, scope?: string): Promise<KnowledgeEntry[]>;
|
|
4
|
+
export declare function getDocsStatus(): Promise<import("@devflow-tools/sdk").KnowledgeSourceStatus[]>;
|
|
5
|
+
//# sourceMappingURL=knowledge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../../src/commands/knowledge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAsB,kBAAkB,uEAGvC;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,EAAE,CAAC,CAK3B;AAED,wBAAsB,aAAa,kEAGlC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getKnowledgeEngine() {
|
|
3
|
+
const { knowledge } = await createEngines(process.cwd());
|
|
4
|
+
return knowledge;
|
|
5
|
+
}
|
|
6
|
+
export async function searchKnowledge(query, scope) {
|
|
7
|
+
const engine = await getKnowledgeEngine();
|
|
8
|
+
return engine.search(query, {
|
|
9
|
+
sources: scope && scope !== "all" ? [scope] : undefined,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export async function getDocsStatus() {
|
|
13
|
+
const engine = await getKnowledgeEngine();
|
|
14
|
+
return engine.getSources();
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=knowledge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../src/commands/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAa,EACb,KAAc;IAEd,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAC1B,OAAO,EAAE,KAAK,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;KACxD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC1C,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getMemoryEngine(): Promise<import("@devflow-tools/memory-engine").MemoryEngine>;
|
|
2
|
+
export declare function showMemory(): Promise<unknown>;
|
|
3
|
+
export declare function setMemory(key: string, value: string): Promise<void>;
|
|
4
|
+
export declare function reviewCandidates(): Promise<unknown>;
|
|
5
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,iEAGpC;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAGnD;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAGzD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getMemoryEngine() {
|
|
3
|
+
const { memory } = await createEngines(process.cwd());
|
|
4
|
+
return memory;
|
|
5
|
+
}
|
|
6
|
+
export async function showMemory() {
|
|
7
|
+
const engine = await getMemoryEngine();
|
|
8
|
+
return engine.getAll();
|
|
9
|
+
}
|
|
10
|
+
export async function setMemory(key, value) {
|
|
11
|
+
const engine = await getMemoryEngine();
|
|
12
|
+
await engine.updateUserPreference(key, value);
|
|
13
|
+
}
|
|
14
|
+
export async function reviewCandidates() {
|
|
15
|
+
const engine = await getMemoryEngine();
|
|
16
|
+
return engine.getCandidates();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa;IACxD,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DevFlowPlugin } from "@devflow-tools/sdk";
|
|
2
|
+
export declare function loadPlugins(): Promise<Map<string, DevFlowPlugin>>;
|
|
3
|
+
export declare function loadPluginsSync(): Map<string, DevFlowPlugin>;
|
|
4
|
+
export declare function clearPluginCache(): void;
|
|
5
|
+
export declare function getPluginsDir(): string;
|
|
6
|
+
//# sourceMappingURL=plugin-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/commands/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAoDxD,wBAAsB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAavE;AAED,wBAAgB,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAG5D;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
let _loadedPlugins = null;
|
|
5
|
+
const KNOWN_PLUGINS = [
|
|
6
|
+
"@devflow-tools/plugin-react",
|
|
7
|
+
"@devflow-tools/plugin-git",
|
|
8
|
+
"@devflow-tools/plugin-vue",
|
|
9
|
+
"@devflow-tools/plugin-css",
|
|
10
|
+
"@devflow-tools/plugin-tailwind",
|
|
11
|
+
"@devflow-tools/plugin-taro",
|
|
12
|
+
"@devflow-tools/plugin-nest",
|
|
13
|
+
"@devflow-tools/plugin-graphql",
|
|
14
|
+
"@devflow-tools/plugin-docker",
|
|
15
|
+
"@devflow-tools/plugin-ui-layout",
|
|
16
|
+
"@devflow-tools/plugin-performance",
|
|
17
|
+
"@devflow-tools/plugin-animation",
|
|
18
|
+
"@devflow-tools/plugin-nextjs",
|
|
19
|
+
"@devflow-tools/plugin-electron",
|
|
20
|
+
];
|
|
21
|
+
async function tryLoad(packageName) {
|
|
22
|
+
try {
|
|
23
|
+
// ESM dynamic import — the plugin package exports { reactPlugin } or { gitPlugin }
|
|
24
|
+
const mod = await import(packageName);
|
|
25
|
+
// Try to find the exported plugin object (convention: name without @devflow-tools/plugin- prefix)
|
|
26
|
+
const name = packageName.replace("@devflow-tools/plugin-", "");
|
|
27
|
+
const exportName = `${name}Plugin`;
|
|
28
|
+
const plugin = mod[exportName];
|
|
29
|
+
if (plugin && plugin.meta && plugin.knowledge) {
|
|
30
|
+
return plugin;
|
|
31
|
+
}
|
|
32
|
+
// Fallback: look for any export that looks like a plugin
|
|
33
|
+
for (const key of Object.keys(mod)) {
|
|
34
|
+
const candidate = mod[key];
|
|
35
|
+
if (candidate && candidate.meta && candidate.knowledge) {
|
|
36
|
+
return candidate;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function loadPlugins() {
|
|
46
|
+
if (_loadedPlugins)
|
|
47
|
+
return _loadedPlugins;
|
|
48
|
+
_loadedPlugins = new Map();
|
|
49
|
+
for (const packageName of KNOWN_PLUGINS) {
|
|
50
|
+
const plugin = await tryLoad(packageName);
|
|
51
|
+
if (plugin) {
|
|
52
|
+
_loadedPlugins.set(plugin.meta.name, plugin);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return _loadedPlugins;
|
|
56
|
+
}
|
|
57
|
+
export function loadPluginsSync() {
|
|
58
|
+
// Return cached or empty — async loading is preferred
|
|
59
|
+
return _loadedPlugins ?? new Map();
|
|
60
|
+
}
|
|
61
|
+
export function clearPluginCache() {
|
|
62
|
+
_loadedPlugins = null;
|
|
63
|
+
}
|
|
64
|
+
export function getPluginsDir() {
|
|
65
|
+
const devPluginsDir = join(process.cwd(), "plugins");
|
|
66
|
+
if (existsSync(devPluginsDir)) {
|
|
67
|
+
return devPluginsDir;
|
|
68
|
+
}
|
|
69
|
+
return join(homedir(), ".devflow", "skills");
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=plugin-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/commands/plugin-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,IAAI,cAAc,GAAsC,IAAI,CAAC;AAE7D,MAAM,aAAa,GAAG;IACpB,6BAA6B;IAC7B,2BAA2B;IAC3B,2BAA2B;IAC3B,2BAA2B;IAC3B,gCAAgC;IAChC,4BAA4B;IAC5B,4BAA4B;IAC5B,+BAA+B;IAC/B,8BAA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AE,MAAM,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,sDAAsD;IACtD,OAAO,cAAc,IAAI,IAAI,GAAG,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;IACrD,IAAI,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SkillMeta {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
tags: string[];
|
|
7
|
+
installed: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function listSkills(): Promise<SkillMeta[]>;
|
|
10
|
+
export declare function listSkillsSync(): SkillMeta[];
|
|
11
|
+
export declare function searchSkills(query: string): Promise<SkillMeta[]>;
|
|
12
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/commands/skill.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAUvD;AAED,wBAAgB,cAAc,IAAI,SAAS,EAAE,CAE5C;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAStE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { loadPlugins } from "./plugin-loader.js";
|
|
2
|
+
export async function listSkills() {
|
|
3
|
+
const plugins = await loadPlugins();
|
|
4
|
+
return Array.from(plugins.values()).map((p) => ({
|
|
5
|
+
name: p.meta.name,
|
|
6
|
+
version: p.meta.version,
|
|
7
|
+
description: p.meta.description,
|
|
8
|
+
icon: p.meta.icon,
|
|
9
|
+
tags: p.meta.tags,
|
|
10
|
+
installed: true,
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
export function listSkillsSync() {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
export async function searchSkills(query) {
|
|
17
|
+
const all = await listSkills();
|
|
18
|
+
const q = query.toLowerCase();
|
|
19
|
+
return all.filter((s) => s.name.toLowerCase().includes(q) ||
|
|
20
|
+
s.description.toLowerCase().includes(q) ||
|
|
21
|
+
s.tags.some((t) => t.toLowerCase().includes(q)));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/commands/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAWjD,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;QACjB,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO;QACvB,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;QACjB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;QACjB,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa;IAC9C,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC;IAC/B,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowMeta, WorkflowRun, WorkflowRunResult } from "@devflow-tools/sdk";
|
|
2
|
+
export declare function getWorkflowEngine(): Promise<import("@devflow-tools/workflow-engine").WorkflowEngine>;
|
|
3
|
+
export declare function listWorkflows(): Promise<WorkflowMeta[]>;
|
|
4
|
+
export declare function runWorkflow(type: string, input: Record<string, unknown>): Promise<WorkflowRunResult>;
|
|
5
|
+
export declare function getWorkflowStatus(): Promise<WorkflowRun[]>;
|
|
6
|
+
export declare function getWorkflowRuns(): Promise<WorkflowRun[]>;
|
|
7
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvF,wBAAsB,iBAAiB,qEAGtC;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAG7D;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAGhE;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAG9D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createEngines } from "@devflow-tools/context-engine";
|
|
2
|
+
export async function getWorkflowEngine() {
|
|
3
|
+
const { workflow } = await createEngines(process.cwd());
|
|
4
|
+
return workflow;
|
|
5
|
+
}
|
|
6
|
+
export async function listWorkflows() {
|
|
7
|
+
const engine = await getWorkflowEngine();
|
|
8
|
+
return engine.list();
|
|
9
|
+
}
|
|
10
|
+
export async function runWorkflow(type, input) {
|
|
11
|
+
const engine = await getWorkflowEngine();
|
|
12
|
+
return engine.run(type, input);
|
|
13
|
+
}
|
|
14
|
+
export async function getWorkflowStatus() {
|
|
15
|
+
const engine = await getWorkflowEngine();
|
|
16
|
+
return engine.listRuns();
|
|
17
|
+
}
|
|
18
|
+
export async function getWorkflowRuns() {
|
|
19
|
+
const engine = await getWorkflowEngine();
|
|
20
|
+
return engine.listRuns();
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAY,EACZ,KAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { detectMode } from "./mode.js";
|
|
5
|
+
import { initProject } from "./commands/init.js";
|
|
6
|
+
import { connectAgent, getAvailableAgents } from "./commands/connect.js";
|
|
7
|
+
import { getIndexStatus } from "./commands/index-cmd.js";
|
|
8
|
+
import { getGraph } from "./commands/graph.js";
|
|
9
|
+
import { getContext } from "./commands/context.js";
|
|
10
|
+
import { listWorkflows, runWorkflow, getWorkflowStatus, getWorkflowRuns, } from "./commands/workflow.js";
|
|
11
|
+
import { showMemory, setMemory, reviewCandidates } from "./commands/memory.js";
|
|
12
|
+
import { searchKnowledge } from "./commands/knowledge.js";
|
|
13
|
+
import { listSkills, searchSkills } from "./commands/skill.js";
|
|
14
|
+
import { runDoctor } from "./commands/doctor.js";
|
|
15
|
+
const program = new Command();
|
|
16
|
+
program
|
|
17
|
+
.name("devflow")
|
|
18
|
+
.description("Developer Intelligence Platform for AI Coding Agents")
|
|
19
|
+
.version("0.1.0");
|
|
20
|
+
// --- init ---
|
|
21
|
+
program
|
|
22
|
+
.command("init")
|
|
23
|
+
.description("Initialize .devflow/ in the current project")
|
|
24
|
+
.option("--force", "Overwrite existing config")
|
|
25
|
+
.action(async (opts) => {
|
|
26
|
+
const root = process.cwd();
|
|
27
|
+
const mode = detectMode(root);
|
|
28
|
+
console.log(chalk.blue(`DevFlow init — mode: ${mode}`));
|
|
29
|
+
const result = await initProject(root, { force: opts.force });
|
|
30
|
+
if (result.created.length > 0) {
|
|
31
|
+
console.log(chalk.green("Created:"));
|
|
32
|
+
for (const path of result.created) {
|
|
33
|
+
console.log(` ${chalk.dim("+")} ${path}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.log(chalk.dim("Already initialized. Use --force to overwrite config."));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
// --- connect ---
|
|
41
|
+
program
|
|
42
|
+
.command("connect [agent]")
|
|
43
|
+
.description("Configure MCP connection for AI coding agents")
|
|
44
|
+
.option("--command <cmd>", "MCP server command", "devflow-mcp")
|
|
45
|
+
.option("--sse <url>", "SSE server URL (instead of stdio)")
|
|
46
|
+
.action(async (agent, opts) => {
|
|
47
|
+
const root = process.cwd();
|
|
48
|
+
const mode = detectMode(root);
|
|
49
|
+
console.log(chalk.blue(`DevFlow connect — mode: ${mode}`));
|
|
50
|
+
if (agent) {
|
|
51
|
+
const available = getAvailableAgents();
|
|
52
|
+
if (!available.includes(agent)) {
|
|
53
|
+
console.log(chalk.red(`Unknown agent: ${agent}`));
|
|
54
|
+
console.log(`Available: ${available.join(", ")}`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const results = await connectAgent({
|
|
60
|
+
agent: agent,
|
|
61
|
+
command: opts.command,
|
|
62
|
+
sseUrl: opts.sse,
|
|
63
|
+
});
|
|
64
|
+
for (const r of results) {
|
|
65
|
+
console.log(chalk.green(`✓ ${r}`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// --- index ---
|
|
74
|
+
program
|
|
75
|
+
.command("index")
|
|
76
|
+
.description("Show index status")
|
|
77
|
+
.option("--watch", "Start file watcher for hot updates (stub)")
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
const status = await getIndexStatus();
|
|
80
|
+
console.log(chalk.blue("Index Status"));
|
|
81
|
+
console.log(` Files: ${status.totalFiles}`);
|
|
82
|
+
console.log(` Symbols: ${status.totalSymbols}`);
|
|
83
|
+
console.log(` Indexing: ${status.indexing ? "active" : "idle"}`);
|
|
84
|
+
if (opts.watch) {
|
|
85
|
+
console.log(chalk.dim(" (watch mode not yet implemented)"));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// --- graph ---
|
|
89
|
+
program
|
|
90
|
+
.command("graph [target]")
|
|
91
|
+
.description("Show dependency graph")
|
|
92
|
+
.option("--depth <n>", "Expansion depth", "2")
|
|
93
|
+
.action(async (target, opts) => {
|
|
94
|
+
const graph = await getGraph({ target, depth: parseInt(opts.depth, 10) });
|
|
95
|
+
console.log(chalk.blue("Dependency Graph"));
|
|
96
|
+
console.log(` Nodes: ${graph.nodes.length}`);
|
|
97
|
+
console.log(` Edges: ${graph.edges.length}`);
|
|
98
|
+
});
|
|
99
|
+
// --- context ---
|
|
100
|
+
program
|
|
101
|
+
.command("context <query>")
|
|
102
|
+
.description("Retrieve project context for a query")
|
|
103
|
+
.option("--mode <mode>", "fast | deep", "fast")
|
|
104
|
+
.option("--max-tokens <n>", "Max token budget", "4000")
|
|
105
|
+
.action(async (query, opts) => {
|
|
106
|
+
const result = await getContext({
|
|
107
|
+
query,
|
|
108
|
+
mode: opts.mode,
|
|
109
|
+
maxTokens: parseInt(opts.maxTokens, 10),
|
|
110
|
+
});
|
|
111
|
+
console.log(chalk.blue(`Context: "${query}"`));
|
|
112
|
+
console.log(` Files: ${result.files.length}`);
|
|
113
|
+
console.log(` Confidence: ${(result.confidence * 100).toFixed(0)}%`);
|
|
114
|
+
console.log(` Tokens: ${result.tokenCount}`);
|
|
115
|
+
});
|
|
116
|
+
// --- workflow ---
|
|
117
|
+
const workflowCmd = program
|
|
118
|
+
.command("workflow")
|
|
119
|
+
.description("Workflow management");
|
|
120
|
+
workflowCmd
|
|
121
|
+
.command("list")
|
|
122
|
+
.description("List available workflows")
|
|
123
|
+
.action(async () => {
|
|
124
|
+
const workflows = await listWorkflows();
|
|
125
|
+
if (workflows.length === 0) {
|
|
126
|
+
console.log(chalk.dim("No workflows registered."));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
for (const w of workflows) {
|
|
130
|
+
console.log(`${chalk.green(w.name)} — ${w.description} (${w.stepCount} steps)`);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
workflowCmd
|
|
134
|
+
.command("run <type> [input]")
|
|
135
|
+
.description("Run a workflow")
|
|
136
|
+
.action(async (type, input) => {
|
|
137
|
+
const result = await runWorkflow(type, { input: input ?? "" });
|
|
138
|
+
console.log(`Run: ${result.runId}`);
|
|
139
|
+
console.log(`Status: ${result.status}`);
|
|
140
|
+
console.log(`Duration: ${result.duration}ms`);
|
|
141
|
+
});
|
|
142
|
+
workflowCmd
|
|
143
|
+
.command("status")
|
|
144
|
+
.description("Show running workflows")
|
|
145
|
+
.action(async () => {
|
|
146
|
+
const runs = await getWorkflowStatus();
|
|
147
|
+
console.log(`${runs.length} run(s)`);
|
|
148
|
+
for (const r of runs) {
|
|
149
|
+
console.log(` ${r.runId} — ${r.status}`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
workflowCmd
|
|
153
|
+
.command("runs")
|
|
154
|
+
.description("Show workflow history")
|
|
155
|
+
.action(async () => {
|
|
156
|
+
const runs = await getWorkflowRuns();
|
|
157
|
+
if (runs.length === 0) {
|
|
158
|
+
console.log(chalk.dim("No runs yet."));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (const r of runs) {
|
|
162
|
+
const duration = r.finishedAt ? `${r.finishedAt - r.startedAt}ms` : "running";
|
|
163
|
+
console.log(` ${r.runId} ${chalk.yellow(r.status)} ${duration}`);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
// --- memory ---
|
|
167
|
+
const memoryCmd = program
|
|
168
|
+
.command("memory")
|
|
169
|
+
.description("Memory management");
|
|
170
|
+
memoryCmd
|
|
171
|
+
.command("show")
|
|
172
|
+
.description("Show current project memory")
|
|
173
|
+
.action(async () => {
|
|
174
|
+
const mem = await showMemory();
|
|
175
|
+
console.log(JSON.stringify(mem, null, 2));
|
|
176
|
+
});
|
|
177
|
+
memoryCmd
|
|
178
|
+
.command("set <key> <value>")
|
|
179
|
+
.description("Set a memory key")
|
|
180
|
+
.action(async (key, value) => {
|
|
181
|
+
await setMemory(key, value);
|
|
182
|
+
console.log(chalk.green(`Memory set: ${key} = ${value}`));
|
|
183
|
+
});
|
|
184
|
+
memoryCmd
|
|
185
|
+
.command("review")
|
|
186
|
+
.description("Review memory candidates")
|
|
187
|
+
.action(async () => {
|
|
188
|
+
const candidates = await reviewCandidates();
|
|
189
|
+
console.log(JSON.stringify(candidates, null, 2));
|
|
190
|
+
});
|
|
191
|
+
// --- knowledge ---
|
|
192
|
+
const knowledgeCmd = program
|
|
193
|
+
.command("knowledge <query>")
|
|
194
|
+
.description("Search knowledge base")
|
|
195
|
+
.action(async (query) => {
|
|
196
|
+
const results = await searchKnowledge(query);
|
|
197
|
+
console.log(chalk.blue(`Knowledge: "${query}"`));
|
|
198
|
+
console.log(` Results: ${results.length}`);
|
|
199
|
+
for (const r of results.slice(0, 5)) {
|
|
200
|
+
console.log(` — ${r.title}`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
// docs (alias under knowledge)
|
|
204
|
+
program
|
|
205
|
+
.command("docs")
|
|
206
|
+
.description("Document sync status")
|
|
207
|
+
.action(async () => {
|
|
208
|
+
console.log(chalk.blue("Docs sync status (stub)"));
|
|
209
|
+
console.log(chalk.dim(" Full docs sync will be available in server mode."));
|
|
210
|
+
});
|
|
211
|
+
// --- skill ---
|
|
212
|
+
const skillCmd = program
|
|
213
|
+
.command("skill")
|
|
214
|
+
.description("Plugin/Skill management");
|
|
215
|
+
skillCmd
|
|
216
|
+
.command("list")
|
|
217
|
+
.description("List installed skills")
|
|
218
|
+
.action(async () => {
|
|
219
|
+
const skills = await listSkills();
|
|
220
|
+
if (skills.length === 0) {
|
|
221
|
+
console.log(chalk.dim("No skills installed. Use 'devflow skill search' to find plugins."));
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
for (const s of skills) {
|
|
225
|
+
console.log(` ${chalk.green(s.name)} @ ${s.version} — ${s.description}`);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
skillCmd
|
|
229
|
+
.command("search <query>")
|
|
230
|
+
.description("Search available plugins")
|
|
231
|
+
.action(async (query) => {
|
|
232
|
+
const results = await searchSkills(query);
|
|
233
|
+
console.log(chalk.blue(`Search: "${query}"`));
|
|
234
|
+
if (results.length === 0) {
|
|
235
|
+
console.log(chalk.dim(" No matching plugins found."));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
for (const s of results) {
|
|
239
|
+
console.log(` ${chalk.green(s.name)} @ ${s.version} — ${s.description}`);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
// --- doctor ---
|
|
243
|
+
program
|
|
244
|
+
.command("doctor")
|
|
245
|
+
.description("Run project health check")
|
|
246
|
+
.action(async () => {
|
|
247
|
+
console.log(chalk.blue("DevFlow Doctor v0.1.0\n"));
|
|
248
|
+
const report = await runDoctor();
|
|
249
|
+
console.log(chalk.bold("◉ Index Status"));
|
|
250
|
+
console.log(` Files ${report.index.totalFiles.toLocaleString()}`);
|
|
251
|
+
console.log(` Symbols ${report.index.totalSymbols.toLocaleString()}`);
|
|
252
|
+
console.log(` Graph (${report.graph.edges.toLocaleString()} edges)`);
|
|
253
|
+
console.log(` Status ${report.index.indexing ? "indexing" : "idle"}`);
|
|
254
|
+
console.log();
|
|
255
|
+
console.log(chalk.bold("◉ Memory"));
|
|
256
|
+
console.log(` Project ${report.memory.projectReady ? "ready" : "not set"}`);
|
|
257
|
+
console.log(` Preferences ${report.memory.userPrefs} set`);
|
|
258
|
+
console.log();
|
|
259
|
+
console.log(chalk.bold("◉ Knowledge"));
|
|
260
|
+
console.log(` Sources ${report.knowledge.sources}`);
|
|
261
|
+
console.log();
|
|
262
|
+
console.log(chalk.bold("◉ Plugins"));
|
|
263
|
+
if (report.plugins.installed === 0) {
|
|
264
|
+
console.log(` ${chalk.dim("No plugins installed")}`);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
for (const name of report.plugins.names) {
|
|
268
|
+
console.log(` ${name}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
console.log();
|
|
272
|
+
console.log(chalk.bold("◉ Workflows"));
|
|
273
|
+
console.log(` Registered ${report.workflows.registered}`);
|
|
274
|
+
console.log();
|
|
275
|
+
const scoreColor = report.readyScore >= 70 ? chalk.green : report.readyScore >= 40 ? chalk.yellow : chalk.red;
|
|
276
|
+
console.log(`AI Ready: ${scoreColor(report.readyScore + "%")}`);
|
|
277
|
+
});
|
|
278
|
+
program.parse();
|
|
279
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,sDAAsD,CAAC;KACnE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,eAAe;AACf,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,6CAA6C,CAAC;KAC1D,MAAM,CAAC,SAAS,EAAE,2BAA2B,CAAC;KAC9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.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type RunMode = "local" | "server";
|
|
2
|
+
export interface CLIConfig {
|
|
3
|
+
serverUrl?: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
mode: RunMode;
|
|
7
|
+
}
|
|
8
|
+
export declare function detectMode(projectRoot: string): RunMode;
|
|
9
|
+
export declare function loadConfig(projectRoot: string): CLIConfig;
|
|
10
|
+
//# sourceMappingURL=mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzC,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAYvD;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAsBzD"}
|
package/dist/mode.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
export function detectMode(projectRoot) {
|
|
4
|
+
const configPath = join(projectRoot, ".devflow", "config.json");
|
|
5
|
+
if (existsSync(configPath)) {
|
|
6
|
+
try {
|
|
7
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
8
|
+
const config = JSON.parse(raw);
|
|
9
|
+
if (config.serverUrl)
|
|
10
|
+
return "server";
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// corrupt config — fall back to local
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return "local";
|
|
17
|
+
}
|
|
18
|
+
export function loadConfig(projectRoot) {
|
|
19
|
+
const configPath = join(projectRoot, ".devflow", "config.json");
|
|
20
|
+
let serverUrl;
|
|
21
|
+
let apiKey;
|
|
22
|
+
if (existsSync(configPath)) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
25
|
+
const config = JSON.parse(raw);
|
|
26
|
+
serverUrl = config.serverUrl;
|
|
27
|
+
apiKey = config.apiKey;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// ignore corrupt config
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
projectRoot,
|
|
35
|
+
serverUrl,
|
|
36
|
+
apiKey,
|
|
37
|
+
mode: serverUrl ? "server" : "local",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=mode.js.map
|
package/dist/mode.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAW5B,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAChE,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,MAAM,CAAC,SAAS;gBAAE,OAAO,QAAQ,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,sCAAsC;QACxC,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAChE,IAAI,SAA6B,CAAC;IAClC,IAAI,MAA0B,CAAC;IAE/B,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;YAC7B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW;QACX,SAAS;QACT,MAAM;QACN,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;KACrC,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devflow-tools/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"devflow": "./bin/devflow.cjs"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"test": "cgnode ../../node_modules/.bin/vitest run",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"clean": "rm -rf dist"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@devflow-tools/adapters": "*",
|
|
17
|
+
"@devflow-tools/context-engine": "*",
|
|
18
|
+
"@devflow-tools/knowledge-engine": "*",
|
|
19
|
+
"@devflow-tools/memory-engine": "*",
|
|
20
|
+
"@devflow-tools/plugin-animation": "*",
|
|
21
|
+
"@devflow-tools/plugin-css": "*",
|
|
22
|
+
"@devflow-tools/plugin-docker": "*",
|
|
23
|
+
"@devflow-tools/plugin-electron": "*",
|
|
24
|
+
"@devflow-tools/plugin-git": "*",
|
|
25
|
+
"@devflow-tools/plugin-graphql": "*",
|
|
26
|
+
"@devflow-tools/plugin-nest": "*",
|
|
27
|
+
"@devflow-tools/plugin-nextjs": "*",
|
|
28
|
+
"@devflow-tools/plugin-performance": "*",
|
|
29
|
+
"@devflow-tools/plugin-react": "*",
|
|
30
|
+
"@devflow-tools/plugin-tailwind": "*",
|
|
31
|
+
"@devflow-tools/plugin-taro": "*",
|
|
32
|
+
"@devflow-tools/plugin-ui-layout": "*",
|
|
33
|
+
"@devflow-tools/plugin-vue": "*",
|
|
34
|
+
"@devflow-tools/sdk": "*",
|
|
35
|
+
"@devflow-tools/workflow-engine": "*",
|
|
36
|
+
"chalk": "^5.3.0",
|
|
37
|
+
"commander": "^12.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.5.0",
|
|
41
|
+
"vitest": "^2.0.0"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"bin"
|
|
46
|
+
],
|
|
47
|
+
"gitHead": "4cede97fc7fc673f929427fac169acab100ca8ed"
|
|
48
|
+
}
|