@sudosandwich/limps 2.12.0 → 2.13.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/README.md +184 -73
- package/dist/cli/config-cmd.d.ts.map +1 -1
- package/dist/cli/config-cmd.js +3 -3
- package/dist/cli/config-cmd.js.map +1 -1
- package/dist/cli/graph-check.d.ts +15 -0
- package/dist/cli/graph-check.d.ts.map +1 -0
- package/dist/cli/graph-check.js +36 -0
- package/dist/cli/graph-check.js.map +1 -0
- package/dist/cli/graph-db.d.ts +4 -0
- package/dist/cli/graph-db.d.ts.map +1 -0
- package/dist/cli/graph-db.js +14 -0
- package/dist/cli/graph-db.js.map +1 -0
- package/dist/cli/graph-entity.d.ts +11 -0
- package/dist/cli/graph-entity.d.ts.map +1 -0
- package/dist/cli/graph-entity.js +18 -0
- package/dist/cli/graph-entity.js.map +1 -0
- package/dist/cli/graph-health.d.ts +19 -0
- package/dist/cli/graph-health.d.ts.map +1 -0
- package/dist/cli/graph-health.js +59 -0
- package/dist/cli/graph-health.js.map +1 -0
- package/dist/cli/graph-overlap.d.ts +12 -0
- package/dist/cli/graph-overlap.d.ts.map +1 -0
- package/dist/cli/graph-overlap.js +21 -0
- package/dist/cli/graph-overlap.js.map +1 -0
- package/dist/cli/graph-reindex.d.ts +14 -0
- package/dist/cli/graph-reindex.d.ts.map +1 -0
- package/dist/cli/graph-reindex.js +49 -0
- package/dist/cli/graph-reindex.js.map +1 -0
- package/dist/cli/graph-search.d.ts +15 -0
- package/dist/cli/graph-search.d.ts.map +1 -0
- package/dist/cli/graph-search.js +37 -0
- package/dist/cli/graph-search.js.map +1 -0
- package/dist/cli/graph-suggest.d.ts +12 -0
- package/dist/cli/graph-suggest.d.ts.map +1 -0
- package/dist/cli/graph-suggest.js +35 -0
- package/dist/cli/graph-suggest.js.map +1 -0
- package/dist/cli/graph-trace.d.ts +17 -0
- package/dist/cli/graph-trace.d.ts.map +1 -0
- package/dist/cli/graph-trace.js +30 -0
- package/dist/cli/graph-trace.js.map +1 -0
- package/dist/cli/graph-watch.d.ts +10 -0
- package/dist/cli/graph-watch.d.ts.map +1 -0
- package/dist/cli/graph-watch.js +18 -0
- package/dist/cli/graph-watch.js.map +1 -0
- package/dist/cli/mcp-client-adapter.d.ts +14 -5
- package/dist/cli/mcp-client-adapter.d.ts.map +1 -1
- package/dist/cli/mcp-client-adapter.js +14 -3
- package/dist/cli/mcp-client-adapter.js.map +1 -1
- package/dist/cli/mcp-clients.d.ts +2 -2
- package/dist/cli/mcp-clients.d.ts.map +1 -1
- package/dist/cli/mcp-clients.js +15 -0
- package/dist/cli/mcp-clients.js.map +1 -1
- package/dist/cli/plan-repair.d.ts +26 -0
- package/dist/cli/plan-repair.d.ts.map +1 -1
- package/dist/cli/plan-repair.js +84 -0
- package/dist/cli/plan-repair.js.map +1 -1
- package/dist/commands/config/sync-mcp.d.ts +1 -0
- package/dist/commands/config/sync-mcp.d.ts.map +1 -1
- package/dist/commands/config/sync-mcp.js +2 -2
- package/dist/commands/config/sync-mcp.js.map +1 -1
- package/dist/commands/graph/check.d.ts +16 -0
- package/dist/commands/graph/check.d.ts.map +1 -0
- package/dist/commands/graph/check.js +88 -0
- package/dist/commands/graph/check.js.map +1 -0
- package/dist/commands/graph/entity.d.ts +16 -0
- package/dist/commands/graph/entity.d.ts.map +1 -0
- package/dist/commands/graph/entity.js +83 -0
- package/dist/commands/graph/entity.js.map +1 -0
- package/dist/commands/graph/health.d.ts +16 -0
- package/dist/commands/graph/health.d.ts.map +1 -0
- package/dist/commands/graph/health.js +78 -0
- package/dist/commands/graph/health.js.map +1 -0
- package/dist/commands/graph/index.d.ts +3 -0
- package/dist/commands/graph/index.d.ts.map +1 -0
- package/dist/commands/graph/index.js +33 -0
- package/dist/commands/graph/index.js.map +1 -0
- package/dist/commands/graph/overlap.d.ts +18 -0
- package/dist/commands/graph/overlap.d.ts.map +1 -0
- package/dist/commands/graph/overlap.js +88 -0
- package/dist/commands/graph/overlap.js.map +1 -0
- package/dist/commands/graph/reindex.d.ts +18 -0
- package/dist/commands/graph/reindex.d.ts.map +1 -0
- package/dist/commands/graph/reindex.js +92 -0
- package/dist/commands/graph/reindex.js.map +1 -0
- package/dist/commands/graph/search.d.ts +18 -0
- package/dist/commands/graph/search.d.ts.map +1 -0
- package/dist/commands/graph/search.js +105 -0
- package/dist/commands/graph/search.js.map +1 -0
- package/dist/commands/graph/suggest.d.ts +16 -0
- package/dist/commands/graph/suggest.d.ts.map +1 -0
- package/dist/commands/graph/suggest.js +88 -0
- package/dist/commands/graph/suggest.js.map +1 -0
- package/dist/commands/graph/trace.d.ts +22 -0
- package/dist/commands/graph/trace.d.ts.map +1 -0
- package/dist/commands/graph/trace.js +97 -0
- package/dist/commands/graph/trace.js.map +1 -0
- package/dist/commands/graph/watch.d.ts +17 -0
- package/dist/commands/graph/watch.d.ts.map +1 -0
- package/dist/commands/graph/watch.js +48 -0
- package/dist/commands/graph/watch.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/repair-plans.d.ts.map +1 -1
- package/dist/commands/repair-plans.js +74 -10
- package/dist/commands/repair-plans.js.map +1 -1
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +49 -0
- package/dist/config.js.map +1 -1
- package/dist/graph/conflict-detector.d.ts +27 -0
- package/dist/graph/conflict-detector.d.ts.map +1 -0
- package/dist/graph/conflict-detector.js +168 -0
- package/dist/graph/conflict-detector.js.map +1 -0
- package/dist/graph/extractor.d.ts +10 -0
- package/dist/graph/extractor.d.ts.map +1 -0
- package/dist/graph/extractor.js +266 -0
- package/dist/graph/extractor.js.map +1 -0
- package/dist/graph/notifier.d.ts +16 -0
- package/dist/graph/notifier.d.ts.map +1 -0
- package/dist/graph/notifier.js +61 -0
- package/dist/graph/notifier.js.map +1 -0
- package/dist/graph/parser.d.ts +10 -0
- package/dist/graph/parser.d.ts.map +1 -0
- package/dist/graph/parser.js +54 -0
- package/dist/graph/parser.js.map +1 -0
- package/dist/graph/patterns.d.ts +16 -0
- package/dist/graph/patterns.d.ts.map +1 -0
- package/dist/graph/patterns.js +23 -0
- package/dist/graph/patterns.js.map +1 -0
- package/dist/graph/resolver.d.ts +23 -0
- package/dist/graph/resolver.d.ts.map +1 -0
- package/dist/graph/resolver.js +98 -0
- package/dist/graph/resolver.js.map +1 -0
- package/dist/graph/similarity.d.ts +38 -0
- package/dist/graph/similarity.d.ts.map +1 -0
- package/dist/graph/similarity.js +74 -0
- package/dist/graph/similarity.js.map +1 -0
- package/dist/graph/storage.js +2 -2
- package/dist/graph/watcher.d.ts +23 -0
- package/dist/graph/watcher.d.ts.map +1 -0
- package/dist/graph/watcher.js +94 -0
- package/dist/graph/watcher.js.map +1 -0
- package/dist/resources/plans-summary.d.ts.map +1 -1
- package/dist/resources/plans-summary.js +7 -5
- package/dist/resources/plans-summary.js.map +1 -1
- package/dist/retrieval/bfs.d.ts +27 -0
- package/dist/retrieval/bfs.d.ts.map +1 -0
- package/dist/retrieval/bfs.js +77 -0
- package/dist/retrieval/bfs.js.map +1 -0
- package/dist/retrieval/hybrid.d.ts +25 -0
- package/dist/retrieval/hybrid.d.ts.map +1 -0
- package/dist/retrieval/hybrid.js +84 -0
- package/dist/retrieval/hybrid.js.map +1 -0
- package/dist/retrieval/recipes.d.ts +20 -0
- package/dist/retrieval/recipes.d.ts.map +1 -0
- package/dist/retrieval/recipes.js +123 -0
- package/dist/retrieval/recipes.js.map +1 -0
- package/dist/retrieval/router.d.ts +7 -0
- package/dist/retrieval/router.d.ts.map +1 -0
- package/dist/retrieval/router.js +51 -0
- package/dist/retrieval/router.js.map +1 -0
- package/dist/retrieval/rrf.d.ts +21 -0
- package/dist/retrieval/rrf.d.ts.map +1 -0
- package/dist/retrieval/rrf.js +27 -0
- package/dist/retrieval/rrf.js.map +1 -0
- package/dist/retrieval/types.d.ts +60 -0
- package/dist/retrieval/types.d.ts.map +1 -0
- package/dist/retrieval/types.js +18 -0
- package/dist/retrieval/types.js.map +1 -0
- package/dist/rlm/sandbox.d.ts.map +1 -1
- package/dist/rlm/sandbox.js +8 -1
- package/dist/rlm/sandbox.js.map +1 -1
- package/dist/tools/configure-scoring.d.ts.map +1 -1
- package/dist/tools/configure-scoring.js +3 -0
- package/dist/tools/configure-scoring.js.map +1 -1
- package/dist/tools/graph.d.ts +32 -0
- package/dist/tools/graph.d.ts.map +1 -0
- package/dist/tools/graph.js +105 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +21 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/process-doc.d.ts.map +1 -1
- package/dist/tools/process-doc.js +14 -0
- package/dist/tools/process-doc.js.map +1 -1
- package/dist/tools/process-docs.d.ts.map +1 -1
- package/dist/tools/process-docs.js +14 -0
- package/dist/tools/process-docs.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const description = "Search entities in the knowledge graph";
|
|
4
|
+
export declare const args: z.ZodTuple<[z.ZodString], null>;
|
|
5
|
+
export declare const options: z.ZodObject<{
|
|
6
|
+
config: z.ZodOptional<z.ZodString>;
|
|
7
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8
|
+
json: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
recipe: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
interface Props {
|
|
13
|
+
args: z.infer<typeof args>;
|
|
14
|
+
options: z.infer<typeof options>;
|
|
15
|
+
}
|
|
16
|
+
export default function GraphSearchCommand({ args, options }: Props): React.ReactNode;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/graph/search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,WAAW,2CAA2C,CAAC;AAEpE,eAAO,MAAM,IAAI,iCAAiD,CAAC;AAEnE,eAAO,MAAM,OAAO;;;;;;iBAMlB,CAAC;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAmEpF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { loadConfig } from '../../config.js';
|
|
6
|
+
import { resolveConfigPath, resolveProjectConfigPath } from '../../utils/config-resolver.js';
|
|
7
|
+
import { buildHelpOutput, getProjectLlmHints, getProjectTipLine } from '../../utils/cli-help.js';
|
|
8
|
+
import { handleJsonOutput, isJsonMode } from '../../cli/json-output.js';
|
|
9
|
+
import { openGraphDb } from '../../cli/graph-db.js';
|
|
10
|
+
import { graphSearch } from '../../cli/graph-search.js';
|
|
11
|
+
export const description = 'Search entities in the knowledge graph';
|
|
12
|
+
export const args = z.tuple([z.string().describe('search query')]);
|
|
13
|
+
export const options = z.object({
|
|
14
|
+
config: z.string().optional().describe('Path to config file'),
|
|
15
|
+
project: z.string().optional().describe('Registered project name'),
|
|
16
|
+
json: z.boolean().optional().describe('Output as JSON'),
|
|
17
|
+
top: z.number().optional().describe('Number of results to return'),
|
|
18
|
+
recipe: z.string().optional().describe('Search recipe name'),
|
|
19
|
+
});
|
|
20
|
+
export default function GraphSearchCommand({ args, options }) {
|
|
21
|
+
const [query] = args;
|
|
22
|
+
const configPath = options.project
|
|
23
|
+
? resolveProjectConfigPath(options.project)
|
|
24
|
+
: resolveConfigPath(options.config);
|
|
25
|
+
const config = loadConfig(configPath);
|
|
26
|
+
const jsonMode = isJsonMode(options);
|
|
27
|
+
const help = buildHelpOutput({
|
|
28
|
+
usage: 'limps graph search <query> [options]',
|
|
29
|
+
arguments: ['query Search query string'],
|
|
30
|
+
options: [
|
|
31
|
+
'--config Path to config file',
|
|
32
|
+
'--project Registered project name',
|
|
33
|
+
'--json Output as JSON',
|
|
34
|
+
'--top Number of results (default: 10)',
|
|
35
|
+
'--recipe Search recipe name',
|
|
36
|
+
],
|
|
37
|
+
sections: [
|
|
38
|
+
{
|
|
39
|
+
title: 'Examples',
|
|
40
|
+
lines: [
|
|
41
|
+
'limps graph search "auth"',
|
|
42
|
+
'limps graph search "plan 0042" --top 5',
|
|
43
|
+
'limps graph search "auth" --recipe LEXICAL_FIRST --json',
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
tips: [getProjectTipLine()],
|
|
48
|
+
llmHints: getProjectLlmHints(),
|
|
49
|
+
});
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!jsonMode)
|
|
52
|
+
return;
|
|
53
|
+
const timer = setTimeout(async () => {
|
|
54
|
+
try {
|
|
55
|
+
const db = openGraphDb(config);
|
|
56
|
+
try {
|
|
57
|
+
const result = await graphSearch(config, db, query, {
|
|
58
|
+
topK: options.top,
|
|
59
|
+
recipe: options.recipe,
|
|
60
|
+
});
|
|
61
|
+
handleJsonOutput(() => result, 'GRAPH_SEARCH_ERROR');
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
db.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// handleJsonOutput calls process.exit
|
|
69
|
+
}
|
|
70
|
+
}, 0);
|
|
71
|
+
return () => clearTimeout(timer);
|
|
72
|
+
}, [jsonMode, config, query, options.top, options.recipe]);
|
|
73
|
+
if (jsonMode)
|
|
74
|
+
return null;
|
|
75
|
+
if (!query) {
|
|
76
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "red", children: "Error: search query is required" }), '\n\n', help.text] }));
|
|
77
|
+
}
|
|
78
|
+
// For non-JSON mode, we need to handle async search
|
|
79
|
+
return _jsx(GraphSearchResults, { config: config, query: query, options: options, help: help });
|
|
80
|
+
}
|
|
81
|
+
function GraphSearchResults({ config, query, options, help, }) {
|
|
82
|
+
const [results, setResults] = React.useState(null);
|
|
83
|
+
const [error, setError] = React.useState(null);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const db = openGraphDb(config);
|
|
86
|
+
graphSearch(config, db, query, {
|
|
87
|
+
topK: options.top,
|
|
88
|
+
recipe: options.recipe,
|
|
89
|
+
})
|
|
90
|
+
.then(setResults)
|
|
91
|
+
.catch((err) => setError(err instanceof Error ? err.message : String(err)))
|
|
92
|
+
.finally(() => db.close());
|
|
93
|
+
}, [config, query, options.top, options.recipe]);
|
|
94
|
+
if (error) {
|
|
95
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "red", children: error }), '\n\n', help.text] }));
|
|
96
|
+
}
|
|
97
|
+
if (!results) {
|
|
98
|
+
return _jsx(Text, { children: "Searching..." });
|
|
99
|
+
}
|
|
100
|
+
if (results.results.length === 0) {
|
|
101
|
+
return _jsxs(Text, { children: ["No results found for \"", query, "\""] });
|
|
102
|
+
}
|
|
103
|
+
return (_jsxs(Text, { children: [results.results.map((r, i) => (_jsxs(React.Fragment, { children: [i > 0 && '\n', _jsx(Text, { color: "cyan", children: r.entity.canonicalId }), " (", r.entity.type, ") - ", r.entity.name, ' ', _jsxs(Text, { color: "gray", children: ["score: ", r.score.toFixed(3)] })] }, r.entity.canonicalId))), '\n', _jsxs(Text, { color: "gray", children: [results.total, " results (recipe: ", results.recipe, ")"] })] }));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/graph/search.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAEpE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC7D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAClE,IAAI,EAA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,QAAQ,eACZ,CAAC,GAAG,CAAC,IAAI,IAAI,EACd,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,CAAC,CAAC,MAAM,CAAC,WAAW,GAAQ,QAAG,CAAC,CAAC,MAAM,CAAC,IAAI,UAAM,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EACxF,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,wBAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAQ,KAHlC,CAAC,CAAC,MAAM,CAAC,WAAW,CAIxB,CAClB,CAAC,EACD,IAAI,EACL,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,aACf,OAAO,CAAC,KAAK,wBAAoB,OAAO,CAAC,MAAM,SAC3C,IACF,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const description = "Get graph-based suggestions";
|
|
4
|
+
export declare const args: z.ZodTuple<[z.ZodString], null>;
|
|
5
|
+
export declare const options: z.ZodObject<{
|
|
6
|
+
config: z.ZodOptional<z.ZodString>;
|
|
7
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8
|
+
json: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
interface Props {
|
|
11
|
+
args: z.infer<typeof args>;
|
|
12
|
+
options: z.infer<typeof options>;
|
|
13
|
+
}
|
|
14
|
+
export default function GraphSuggestCommand({ args, options }: Props): React.ReactNode;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=suggest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../src/commands/graph/suggest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,WAAW,gCAAgC,CAAC;AAEzD,eAAO,MAAM,IAAI,iCAA8E,CAAC;AAEhG,eAAO,MAAM,OAAO;;;;iBAIlB,CAAC;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAID,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAiGrF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { loadConfig } from '../../config.js';
|
|
6
|
+
import { resolveConfigPath, resolveProjectConfigPath } from '../../utils/config-resolver.js';
|
|
7
|
+
import { buildHelpOutput, getProjectLlmHints, getProjectTipLine } from '../../utils/cli-help.js';
|
|
8
|
+
import { handleJsonOutput, isJsonMode } from '../../cli/json-output.js';
|
|
9
|
+
import { openGraphDb } from '../../cli/graph-db.js';
|
|
10
|
+
import { graphSuggest } from '../../cli/graph-suggest.js';
|
|
11
|
+
export const description = 'Get graph-based suggestions';
|
|
12
|
+
export const args = z.tuple([z.string().describe('suggestion type: consolidate or next-task')]);
|
|
13
|
+
export const options = z.object({
|
|
14
|
+
config: z.string().optional().describe('Path to config file'),
|
|
15
|
+
project: z.string().optional().describe('Registered project name'),
|
|
16
|
+
json: z.boolean().optional().describe('Output as JSON'),
|
|
17
|
+
});
|
|
18
|
+
const VALID_TYPES = ['consolidate', 'next-task'];
|
|
19
|
+
export default function GraphSuggestCommand({ args, options }) {
|
|
20
|
+
const [typeArg] = args;
|
|
21
|
+
const configPath = options.project
|
|
22
|
+
? resolveProjectConfigPath(options.project)
|
|
23
|
+
: resolveConfigPath(options.config);
|
|
24
|
+
const config = loadConfig(configPath);
|
|
25
|
+
const jsonMode = isJsonMode(options);
|
|
26
|
+
const help = buildHelpOutput({
|
|
27
|
+
usage: 'limps graph suggest <type> [options]',
|
|
28
|
+
arguments: ['type Suggestion type: consolidate, next-task'],
|
|
29
|
+
options: [
|
|
30
|
+
'--config Path to config file',
|
|
31
|
+
'--project Registered project name',
|
|
32
|
+
'--json Output as JSON',
|
|
33
|
+
],
|
|
34
|
+
sections: [
|
|
35
|
+
{
|
|
36
|
+
title: 'Examples',
|
|
37
|
+
lines: ['limps graph suggest consolidate', 'limps graph suggest next-task --json'],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
tips: [getProjectTipLine()],
|
|
41
|
+
llmHints: getProjectLlmHints(),
|
|
42
|
+
});
|
|
43
|
+
const suggestType = VALID_TYPES.includes(typeArg) ? typeArg : undefined;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!jsonMode)
|
|
46
|
+
return;
|
|
47
|
+
const timer = setTimeout(() => {
|
|
48
|
+
try {
|
|
49
|
+
handleJsonOutput(() => {
|
|
50
|
+
if (!suggestType) {
|
|
51
|
+
throw new Error(`Invalid type: ${typeArg}. Must be one of: ${VALID_TYPES.join(', ')}`);
|
|
52
|
+
}
|
|
53
|
+
const db = openGraphDb(config);
|
|
54
|
+
try {
|
|
55
|
+
return graphSuggest(config, db, suggestType);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
db.close();
|
|
59
|
+
}
|
|
60
|
+
}, 'GRAPH_SUGGEST_ERROR');
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// handleJsonOutput calls process.exit
|
|
64
|
+
}
|
|
65
|
+
}, 0);
|
|
66
|
+
return () => clearTimeout(timer);
|
|
67
|
+
}, [jsonMode, config, suggestType, typeArg]);
|
|
68
|
+
if (jsonMode)
|
|
69
|
+
return null;
|
|
70
|
+
if (!suggestType) {
|
|
71
|
+
return (_jsxs(Text, { children: [_jsxs(Text, { color: "red", children: ["Error: type must be one of: ", VALID_TYPES.join(', ')] }), '\n\n', help.text] }));
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const db = openGraphDb(config);
|
|
75
|
+
try {
|
|
76
|
+
const result = graphSuggest(config, db, suggestType);
|
|
77
|
+
return (_jsxs(Text, { children: ["Type: ", result.type, result.suggestions.length > 0 ? (_jsx(_Fragment, { children: result.suggestions.map((s, i) => (_jsxs(React.Fragment, { children: ['\n', ' ', s] }, i))) })) : (_jsxs(_Fragment, { children: ['\n', "No suggestions."] }))] }));
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
db.close();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
85
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "red", children: message }), '\n\n', help.text] }));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=suggest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../../../src/commands/graph/suggest.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,W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
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const description = "Trace entity relationships";
|
|
4
|
+
export declare const args: z.ZodTuple<[z.ZodString], null>;
|
|
5
|
+
export declare const options: z.ZodObject<{
|
|
6
|
+
config: z.ZodOptional<z.ZodString>;
|
|
7
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8
|
+
json: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
both: "both";
|
|
11
|
+
up: "up";
|
|
12
|
+
down: "down";
|
|
13
|
+
}>>;
|
|
14
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
interface Props {
|
|
17
|
+
args: z.infer<typeof args>;
|
|
18
|
+
options: z.infer<typeof options>;
|
|
19
|
+
}
|
|
20
|
+
export default function GraphTraceCommand({ args, options }: Props): React.ReactNode;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/commands/graph/trace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,IAAI,iCAAwD,CAAC;AAE1E,eAAO,MAAM,OAAO;;;;;;;;;;iBAMlB,CAAC;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAuGnF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { loadConfig } from '../../config.js';
|
|
6
|
+
import { resolveConfigPath, resolveProjectConfigPath } from '../../utils/config-resolver.js';
|
|
7
|
+
import { buildHelpOutput, getProjectLlmHints, getProjectTipLine } from '../../utils/cli-help.js';
|
|
8
|
+
import { handleJsonOutput, isJsonMode } from '../../cli/json-output.js';
|
|
9
|
+
import { openGraphDb } from '../../cli/graph-db.js';
|
|
10
|
+
import { graphTrace } from '../../cli/graph-trace.js';
|
|
11
|
+
export const description = 'Trace entity relationships';
|
|
12
|
+
export const args = z.tuple([z.string().describe('entity canonical ID')]);
|
|
13
|
+
export const options = z.object({
|
|
14
|
+
config: z.string().optional().describe('Path to config file'),
|
|
15
|
+
project: z.string().optional().describe('Registered project name'),
|
|
16
|
+
json: z.boolean().optional().describe('Output as JSON'),
|
|
17
|
+
direction: z.enum(['up', 'down', 'both']).optional().describe('Traversal direction'),
|
|
18
|
+
depth: z.number().optional().describe('Max traversal depth'),
|
|
19
|
+
});
|
|
20
|
+
export default function GraphTraceCommand({ args, options }) {
|
|
21
|
+
const [entityId] = args;
|
|
22
|
+
const configPath = options.project
|
|
23
|
+
? resolveProjectConfigPath(options.project)
|
|
24
|
+
: resolveConfigPath(options.config);
|
|
25
|
+
const config = loadConfig(configPath);
|
|
26
|
+
const jsonMode = isJsonMode(options);
|
|
27
|
+
const help = buildHelpOutput({
|
|
28
|
+
usage: 'limps graph trace <entity> [options]',
|
|
29
|
+
arguments: ['entity Entity canonical ID (e.g. plan:0042, agent:0042#003)'],
|
|
30
|
+
options: [
|
|
31
|
+
'--config Path to config file',
|
|
32
|
+
'--project Registered project name',
|
|
33
|
+
'--json Output as JSON',
|
|
34
|
+
'--direction up|down|both (default: both)',
|
|
35
|
+
'--depth Max traversal depth (default: 2)',
|
|
36
|
+
],
|
|
37
|
+
sections: [
|
|
38
|
+
{
|
|
39
|
+
title: 'Examples',
|
|
40
|
+
lines: [
|
|
41
|
+
'limps graph trace plan:0042',
|
|
42
|
+
'limps graph trace agent:0042#003 --direction up',
|
|
43
|
+
'limps graph trace plan:0042 --depth 3 --json',
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
tips: [getProjectTipLine()],
|
|
48
|
+
llmHints: getProjectLlmHints(),
|
|
49
|
+
});
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!jsonMode)
|
|
52
|
+
return;
|
|
53
|
+
const timer = setTimeout(() => {
|
|
54
|
+
try {
|
|
55
|
+
handleJsonOutput(() => {
|
|
56
|
+
const db = openGraphDb(config);
|
|
57
|
+
try {
|
|
58
|
+
return graphTrace(config, db, entityId, {
|
|
59
|
+
direction: options.direction,
|
|
60
|
+
depth: options.depth,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
db.close();
|
|
65
|
+
}
|
|
66
|
+
}, 'GRAPH_TRACE_ERROR');
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// handleJsonOutput calls process.exit
|
|
70
|
+
}
|
|
71
|
+
}, 0);
|
|
72
|
+
return () => clearTimeout(timer);
|
|
73
|
+
}, [jsonMode, config, entityId, options.direction, options.depth]);
|
|
74
|
+
if (jsonMode)
|
|
75
|
+
return null;
|
|
76
|
+
if (!entityId) {
|
|
77
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "red", children: "Error: entity canonical ID is required" }), '\n\n', help.text] }));
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const db = openGraphDb(config);
|
|
81
|
+
try {
|
|
82
|
+
const result = graphTrace(config, db, entityId, {
|
|
83
|
+
direction: options.direction,
|
|
84
|
+
depth: options.depth,
|
|
85
|
+
});
|
|
86
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: result.root.canonicalId }), ' ', "(", result.root.type, ") - ", result.root.name, '\n', "Direction: ", result.direction, ", Depth: ", result.depth, '\n', "Neighbors: ", result.neighbors.length, ", Relations: ", result.relationships.length, result.neighbors.map((n) => (_jsxs(React.Fragment, { children: ['\n', ' ', _jsx(Text, { color: "green", children: n.canonicalId }), " - ", n.name] }, n.canonicalId)))] }));
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
db.close();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
94
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "red", children: message }), '\n\n', help.text] }));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/commands/graph/trace.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAExD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,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AAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,YAAE,OAAO,GAAQ,EACjC,MAAM,EACN,IAAI,CAAC,IAAI,IACL,CACR,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const description = "Watch for changes and update graph";
|
|
4
|
+
export declare const args: z.ZodTuple<[], null>;
|
|
5
|
+
export declare const options: z.ZodObject<{
|
|
6
|
+
config: z.ZodOptional<z.ZodString>;
|
|
7
|
+
project: z.ZodOptional<z.ZodString>;
|
|
8
|
+
channels: z.ZodOptional<z.ZodString>;
|
|
9
|
+
'webhook-url': z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
interface Props {
|
|
12
|
+
args: z.infer<typeof args>;
|
|
13
|
+
options: z.infer<typeof options>;
|
|
14
|
+
}
|
|
15
|
+
export default function GraphWatchCommand({ options }: Props): React.ReactNode;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/commands/graph/watch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW,uCAAuC,CAAC;AAEhE,eAAO,MAAM,IAAI,sBAAc,CAAC;AAEhC,eAAO,MAAM,OAAO;;;;;iBAQlB,CAAC;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAsC7E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { loadConfig } from '../../config.js';
|
|
6
|
+
import { resolveConfigPath, resolveProjectConfigPath } from '../../utils/config-resolver.js';
|
|
7
|
+
import { openGraphDb } from '../../cli/graph-db.js';
|
|
8
|
+
import { startGraphWatch } from '../../cli/graph-watch.js';
|
|
9
|
+
export const description = 'Watch for changes and update graph';
|
|
10
|
+
export const args = z.tuple([]);
|
|
11
|
+
export const options = z.object({
|
|
12
|
+
config: z.string().optional().describe('Path to config file'),
|
|
13
|
+
project: z.string().optional().describe('Registered project name'),
|
|
14
|
+
channels: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Notification channels (comma-separated: log,file,webhook)'),
|
|
18
|
+
'webhook-url': z.string().optional().describe('Webhook URL for notifications'),
|
|
19
|
+
});
|
|
20
|
+
export default function GraphWatchCommand({ options }) {
|
|
21
|
+
const configPath = options.project
|
|
22
|
+
? resolveProjectConfigPath(options.project)
|
|
23
|
+
: resolveConfigPath(options.config);
|
|
24
|
+
const config = loadConfig(configPath);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const db = openGraphDb(config);
|
|
27
|
+
const channels = options.channels?.split(',').map((c) => c.trim()) ?? ['log'];
|
|
28
|
+
const watcher = startGraphWatch(config, db, {
|
|
29
|
+
channels,
|
|
30
|
+
webhookUrl: options['webhook-url'],
|
|
31
|
+
});
|
|
32
|
+
const cleanup = () => {
|
|
33
|
+
void watcher
|
|
34
|
+
.stop()
|
|
35
|
+
.then(() => db.close())
|
|
36
|
+
.catch(() => db.close());
|
|
37
|
+
};
|
|
38
|
+
process.on('SIGINT', cleanup);
|
|
39
|
+
process.on('SIGTERM', cleanup);
|
|
40
|
+
return () => {
|
|
41
|
+
cleanup();
|
|
42
|
+
process.removeListener('SIGINT', cleanup);
|
|
43
|
+
process.removeListener('SIGTERM', cleanup);
|
|
44
|
+
};
|
|
45
|
+
}, [config, options.channels, options['webhook-url']]);
|
|
46
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", children: "Watching" }), " ", config.plansPath, " for changes...", '\n', "Press Ctrl+C to stop."] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/commands/graph/watch.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,CAAC,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEhE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC7D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAClE,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;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;YACV,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC1C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEvD,OAAO,CACL,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,yBAAgB,OAAE,MAAM,CAAC,SAAS,qBACnD,IAAI,6BACA,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,0CAA0C,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,CAqDxD"}
|
package/dist/commands/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export default function DefaultCommand() {
|
|
|
14
14
|
setShowWhatsNew(true);
|
|
15
15
|
}
|
|
16
16
|
}, [version]);
|
|
17
|
-
const defaultContent = (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: "limps" }), ' ', _jsxs(Text, { color: "yellow", children: ["v", version] }), " - Local Intelligent MCP Planning Server", '\n', '\n', _jsx(Text, { color: "yellow", children: "Usage:" }), " limps ", '<command>', " [options]", '\n', '\n', _jsx(Text, { color: "cyan", children: "Commands:" }), '\n', ' ', "serve", ' ', "Start the MCP server", '\n', ' ', "init ", '<name> ', "Initialize a new project", '\n', ' ', "list-plans", ' ', "List all plans with status", '\n', ' ', "list-agents", ' ', "List agents in a plan", '\n', ' ', "next-task", ' ', "Get the next best task", '\n', ' ', "score-task", ' ', "Show scoring for a task", '\n', ' ', "score-all", ' ', "Compare scores across tasks", '\n', ' ', "reindex", ' ', "Rebuild the document index", '\n', ' ', "repair-plans", ' ', "Repair plan frontmatter", '\n', ' ', "health", ' ', "Run plan health checks", '\n', ' ', "proposals", ' ', "List and apply update proposals", '\n', ' ', "status", ' ', "Show plan progress", '\n', ' ', "version", ' ', "Show version information", '\n', ' ', "config", ' ', "Manage project configuration", '\n', '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>'] }), " without args for usage help.", '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>', " --help"] }), " for full documentation."] }));
|
|
17
|
+
const defaultContent = (_jsxs(Text, { children: [_jsx(Text, { color: "cyan", bold: true, children: "limps" }), ' ', _jsxs(Text, { color: "yellow", children: ["v", version] }), " - Local Intelligent MCP Planning Server", '\n', '\n', _jsx(Text, { color: "yellow", children: "Usage:" }), " limps ", '<command>', " [options]", '\n', '\n', _jsx(Text, { color: "cyan", children: "Commands:" }), '\n', ' ', "serve", ' ', "Start the MCP server", '\n', ' ', "init ", '<name> ', "Initialize a new project", '\n', ' ', "list-plans", ' ', "List all plans with status", '\n', ' ', "list-agents", ' ', "List agents in a plan", '\n', ' ', "next-task", ' ', "Get the next best task", '\n', ' ', "score-task", ' ', "Show scoring for a task", '\n', ' ', "score-all", ' ', "Compare scores across tasks", '\n', ' ', "reindex", ' ', "Rebuild the document index", '\n', ' ', "repair-plans", ' ', "Repair plan frontmatter", '\n', ' ', "health", ' ', "Run plan health checks", '\n', ' ', "proposals", ' ', "List and apply update proposals", '\n', ' ', "status", ' ', "Show plan progress", '\n', ' ', "version", ' ', "Show version information", '\n', ' ', "config", ' ', "Manage project configuration", '\n', ' ', "graph", ' ', "Knowledge graph commands", '\n', '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>'] }), " without args for usage help.", '\n', "Run ", _jsxs(Text, { color: "green", children: ["limps ", '<command>', " --help"] }), " for full documentation."] }));
|
|
18
18
|
if (showWhatsNew) {
|
|
19
19
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(WhatsNew, { version: version, onDismiss: () => setShowWhatsNew(false) }), defaultContent] }));
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,MAAM,CAAC,MAAM,WAAW,GAAG,uCAAuC,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,cAAc;IACpC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACb,8CAA8C;QAC9C,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,eAAe,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,cAAc,GAAG,CACrB,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,4BAEhB,EAAC,GAAG,EACX,MAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,kBAAG,OAAO,IAAQ,8CAAyC,IAAI,EAClF,IAAI,EACL,KAAC,IAAI,IAAC,KAAK,EAAC,QA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W,OAAO,iCAA6B,IAAI,EACvD,IAAI,aAAS,SAAS,gCAA4B,IAAI,EACtD,IAAI,kBAAc,IAAI,6BAAyB,IAAI,EACnD,IAAI,YAAQ,UAAU,4BAAwB,IAAI,EAClD,IAAI,eAAW,OAAO,qCAAiC,IAAI,EAC3D,IAAI,YAAQ,UAAU,wBAAoB,IAAI,EAC9C,IAAI,aAAS,UAAU,8BAA0B,IAAI,EACrD,IAAI,YAAQ,UAAU,kCAA8B,IAAI,EACxD,IAAI,WAAO,WAAW,8BAA0B,IAAI,EACpD,IAAI,UACD,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,IAAQ,mCAA8B,IAAI,UAChF,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAQ,WAAW,eAAe,gCACpD,CACR,CAAC;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACzB,KAAC,QAAQ,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,GAAI,EACtE,cAAc,IACX,CACP,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-plans.d.ts","sourceRoot":"","sources":["../../src/commands/repair-plans.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"repair-plans.d.ts","sourceRoot":"","sources":["../../src/commands/repair-plans.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,WAAW,0DAA0D,CAAC;AAEnF,eAAO,MAAM,IAAI,gDAA+D,CAAC;AAEjF,eAAO,MAAM,OAAO;;;;;iBAKlB,CAAC;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAuBD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAiOpF"}
|
|
@@ -6,7 +6,7 @@ import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
|
6
6
|
import { join } from 'path';
|
|
7
7
|
import { loadConfig } from '../config.js';
|
|
8
8
|
import { resolveConfigPath, resolveProjectConfigPath } from '../utils/config-resolver.js';
|
|
9
|
-
import { repairPlanFrontmatter, inspectPlanFrontmatter } from '../cli/plan-repair.js';
|
|
9
|
+
import { repairPlanFrontmatter, inspectPlanFrontmatter, inspectAgentFrontmatter, repairAgentFrontmatter, } from '../cli/plan-repair.js';
|
|
10
10
|
import { isJsonMode, outputJson, wrapSuccess, wrapError } from '../cli/json-output.js';
|
|
11
11
|
export const description = 'Repair malformed plan frontmatter (priority/severity)';
|
|
12
12
|
export const args = z.tuple([z.string().describe('plan id or name').optional()]);
|
|
@@ -26,6 +26,15 @@ function findPlanDirs(plansPath) {
|
|
|
26
26
|
.map((entry) => entry.name)
|
|
27
27
|
.filter((name) => name !== 'Completed' && !name.startsWith('_'));
|
|
28
28
|
}
|
|
29
|
+
function findAgentFiles(planDirPath) {
|
|
30
|
+
const agentsDir = join(planDirPath, 'agents');
|
|
31
|
+
if (!existsSync(agentsDir)) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return readdirSync(agentsDir)
|
|
35
|
+
.filter((name) => name.endsWith('.agent.md'))
|
|
36
|
+
.map((name) => join(agentsDir, name));
|
|
37
|
+
}
|
|
29
38
|
export default function RepairPlansCommand({ args, options }) {
|
|
30
39
|
const [planId] = args;
|
|
31
40
|
const jsonMode = isJsonMode(options);
|
|
@@ -69,7 +78,28 @@ export default function RepairPlansCommand({ args, options }) {
|
|
|
69
78
|
});
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
|
-
|
|
81
|
+
const agentIssues = [];
|
|
82
|
+
for (const dir of planDirs) {
|
|
83
|
+
const planDirPath = join(config.plansPath, dir);
|
|
84
|
+
for (const agentPath of findAgentFiles(planDirPath)) {
|
|
85
|
+
const content = readFileSync(agentPath, 'utf-8');
|
|
86
|
+
const inspection = inspectAgentFrontmatter(content);
|
|
87
|
+
if (inspection.status === 'needs_repair') {
|
|
88
|
+
agentIssues.push({
|
|
89
|
+
plan: dir,
|
|
90
|
+
agent: agentPath,
|
|
91
|
+
badKeys: inspection.badKeys,
|
|
92
|
+
issues: inspection.issues,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
outputJson(wrapSuccess({
|
|
98
|
+
total: issues.length,
|
|
99
|
+
issues,
|
|
100
|
+
agents: agentIssues,
|
|
101
|
+
agentsTotal: agentIssues.length,
|
|
102
|
+
}));
|
|
73
103
|
}
|
|
74
104
|
catch (error) {
|
|
75
105
|
outputJson(wrapError(error instanceof Error ? error.message : String(error), {
|
|
@@ -106,15 +136,34 @@ export default function RepairPlansCommand({ args, options }) {
|
|
|
106
136
|
});
|
|
107
137
|
}
|
|
108
138
|
}
|
|
109
|
-
|
|
110
|
-
|
|
139
|
+
const brokenAgents = [];
|
|
140
|
+
for (const dir of planDirs) {
|
|
141
|
+
const planDirPath = join(config.plansPath, dir);
|
|
142
|
+
for (const agentPath of findAgentFiles(planDirPath)) {
|
|
143
|
+
const content = readFileSync(agentPath, 'utf-8');
|
|
144
|
+
const inspection = inspectAgentFrontmatter(content);
|
|
145
|
+
if (inspection.status === 'needs_repair') {
|
|
146
|
+
brokenAgents.push({ plan: dir, agent: agentPath, badKeys: inspection.badKeys });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (issues.length === 0 && brokenAgents.length === 0) {
|
|
151
|
+
return _jsx(Text, { color: "green", children: "No repairable plan or agent frontmatter issues found." });
|
|
111
152
|
}
|
|
112
153
|
const lines = [];
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
154
|
+
if (issues.length > 0) {
|
|
155
|
+
lines.push(`Found ${issues.length} plan(s) needing repair:`);
|
|
156
|
+
for (const issue of issues) {
|
|
157
|
+
lines.push(` - ${issue.plan}: ${issue.path}`);
|
|
158
|
+
for (const entry of issue.issues) {
|
|
159
|
+
lines.push(` ${entry.code}: ${entry.message}${entry.value ? ` (${entry.value})` : ''}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (brokenAgents.length > 0) {
|
|
164
|
+
lines.push(`Found ${brokenAgents.length} agent(s) with bad dependency keys:`);
|
|
165
|
+
for (const entry of brokenAgents) {
|
|
166
|
+
lines.push(` - ${entry.plan}: ${entry.agent} [${entry.badKeys.join(', ')}]`);
|
|
118
167
|
}
|
|
119
168
|
}
|
|
120
169
|
lines.push('');
|
|
@@ -136,6 +185,21 @@ export default function RepairPlansCommand({ args, options }) {
|
|
|
136
185
|
results.push(` skipped: ${dir} (${result.reason})`);
|
|
137
186
|
}
|
|
138
187
|
}
|
|
139
|
-
|
|
188
|
+
let agentRepairedCount = 0;
|
|
189
|
+
let agentSkippedCount = 0;
|
|
190
|
+
for (const dir of planDirs) {
|
|
191
|
+
const planDirPath = join(config.plansPath, dir);
|
|
192
|
+
for (const agentPath of findAgentFiles(planDirPath)) {
|
|
193
|
+
const result = repairAgentFrontmatter(agentPath);
|
|
194
|
+
if (result.repaired) {
|
|
195
|
+
agentRepairedCount++;
|
|
196
|
+
results.push(` repaired agent: ${agentPath} [${result.renamedKeys.join(', ')}]`);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
agentSkippedCount++;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return (_jsxs(Text, { children: ["Repaired ", repairedCount, " plan(s), skipped ", skippedCount, ".", '\n', "Repaired ", agentRepairedCount, " agent(s), skipped ", agentSkippedCount, ".", '\n', results.join('\n')] }));
|
|
140
204
|
}
|
|
141
205
|
//# sourceMappingURL=repair-plans.js.map
|