@roarpeng/graphflow 1.9.6 → 1.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +132 -0
- package/README.md +190 -113
- package/dist/agents/atp-example-producer.d.ts +33 -0
- package/dist/agents/atp-example-producer.d.ts.map +1 -0
- package/dist/agents/atp-example-producer.js +154 -0
- package/dist/agents/atp-example-producer.js.map +1 -0
- package/dist/agents/planner.d.ts.map +1 -1
- package/dist/agents/planner.js +14 -8
- package/dist/agents/planner.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +5 -3
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/include-extensions.d.ts +10 -1
- package/dist/config/include-extensions.d.ts.map +1 -1
- package/dist/config/include-extensions.js +29 -3
- package/dist/config/include-extensions.js.map +1 -1
- package/dist/config/loader.js +1 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/core/agent-delegation.d.ts +16 -2
- package/dist/core/agent-delegation.d.ts.map +1 -1
- package/dist/core/agent-delegation.js +48 -5
- package/dist/core/agent-delegation.js.map +1 -1
- package/dist/core/merge-agent-insight.d.ts.map +1 -1
- package/dist/core/merge-agent-insight.js +10 -0
- package/dist/core/merge-agent-insight.js.map +1 -1
- package/dist/core/orchestrator-episode.js +1 -1
- package/dist/core/orchestrator.js +52 -1
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/submit-agent-insight.d.ts +17 -0
- package/dist/core/submit-agent-insight.d.ts.map +1 -1
- package/dist/core/submit-agent-insight.js +28 -0
- package/dist/core/submit-agent-insight.js.map +1 -1
- package/dist/core/types.d.ts +35 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/graph/context-slicer-types.d.ts +4 -0
- package/dist/graph/context-slicer-types.d.ts.map +1 -1
- package/dist/graph/context-slicer-types.js +3 -0
- package/dist/graph/context-slicer-types.js.map +1 -1
- package/dist/graph/context-slicer.d.ts.map +1 -1
- package/dist/graph/context-slicer.js +154 -6
- package/dist/graph/context-slicer.js.map +1 -1
- package/dist/graph/document-convert.d.ts +33 -0
- package/dist/graph/document-convert.d.ts.map +1 -0
- package/dist/graph/document-convert.js +137 -0
- package/dist/graph/document-convert.js.map +1 -0
- package/dist/graph/document-semantic-bridge.d.ts +23 -0
- package/dist/graph/document-semantic-bridge.d.ts.map +1 -0
- package/dist/graph/document-semantic-bridge.js +61 -0
- package/dist/graph/document-semantic-bridge.js.map +1 -0
- package/dist/graph/document-semantic-ingest.d.ts +48 -0
- package/dist/graph/document-semantic-ingest.d.ts.map +1 -0
- package/dist/graph/document-semantic-ingest.js +229 -0
- package/dist/graph/document-semantic-ingest.js.map +1 -0
- package/dist/graph/episode-engineering-links.d.ts +29 -0
- package/dist/graph/episode-engineering-links.d.ts.map +1 -0
- package/dist/graph/episode-engineering-links.js +63 -0
- package/dist/graph/episode-engineering-links.js.map +1 -0
- package/dist/graph/file-indexer-edges.d.ts +15 -0
- package/dist/graph/file-indexer-edges.d.ts.map +1 -1
- package/dist/graph/file-indexer-edges.js +60 -5
- package/dist/graph/file-indexer-edges.js.map +1 -1
- package/dist/graph/file-indexer-walker.d.ts +2 -1
- package/dist/graph/file-indexer-walker.d.ts.map +1 -1
- package/dist/graph/file-indexer-walker.js +29 -16
- package/dist/graph/file-indexer-walker.js.map +1 -1
- package/dist/graph/file-indexer.d.ts +5 -0
- package/dist/graph/file-indexer.d.ts.map +1 -1
- package/dist/graph/file-indexer.js +121 -17
- package/dist/graph/file-indexer.js.map +1 -1
- package/dist/graph/graph-compression.d.ts.map +1 -1
- package/dist/graph/graph-compression.js +17 -2
- package/dist/graph/graph-compression.js.map +1 -1
- package/dist/graph/language-indexers/c-cpp.d.ts.map +1 -1
- package/dist/graph/language-indexers/c-cpp.js +19 -13
- package/dist/graph/language-indexers/c-cpp.js.map +1 -1
- package/dist/graph/language-indexers/dart.d.ts.map +1 -1
- package/dist/graph/language-indexers/dart.js +2 -6
- package/dist/graph/language-indexers/dart.js.map +1 -1
- package/dist/graph/language-indexers/go.d.ts.map +1 -1
- package/dist/graph/language-indexers/go.js +3 -6
- package/dist/graph/language-indexers/go.js.map +1 -1
- package/dist/graph/language-indexers/java.d.ts.map +1 -1
- package/dist/graph/language-indexers/java.js +2 -6
- package/dist/graph/language-indexers/java.js.map +1 -1
- package/dist/graph/language-indexers/kotlin.d.ts.map +1 -1
- package/dist/graph/language-indexers/kotlin.js +2 -6
- package/dist/graph/language-indexers/kotlin.js.map +1 -1
- package/dist/graph/language-indexers/python.d.ts.map +1 -1
- package/dist/graph/language-indexers/python.js +4 -6
- package/dist/graph/language-indexers/python.js.map +1 -1
- package/dist/graph/language-indexers/ruby.d.ts.map +1 -1
- package/dist/graph/language-indexers/ruby.js +2 -6
- package/dist/graph/language-indexers/ruby.js.map +1 -1
- package/dist/graph/language-indexers/rust.d.ts.map +1 -1
- package/dist/graph/language-indexers/rust.js +3 -6
- package/dist/graph/language-indexers/rust.js.map +1 -1
- package/dist/graph/language-indexers/swift.d.ts.map +1 -1
- package/dist/graph/language-indexers/swift.js +2 -6
- package/dist/graph/language-indexers/swift.js.map +1 -1
- package/dist/graph/language-indexers/tree-sitter-loader.d.ts +20 -0
- package/dist/graph/language-indexers/tree-sitter-loader.d.ts.map +1 -1
- package/dist/graph/language-indexers/tree-sitter-loader.js +42 -0
- package/dist/graph/language-indexers/tree-sitter-loader.js.map +1 -1
- package/dist/graph/memory-pack.d.ts +46 -0
- package/dist/graph/memory-pack.d.ts.map +1 -0
- package/dist/graph/memory-pack.js +204 -0
- package/dist/graph/memory-pack.js.map +1 -0
- package/dist/graph/snapshot-view.d.ts.map +1 -1
- package/dist/graph/snapshot-view.js +26 -1
- package/dist/graph/snapshot-view.js.map +1 -1
- package/dist/graph/symbol-extract.d.ts +39 -0
- package/dist/graph/symbol-extract.d.ts.map +1 -0
- package/dist/graph/symbol-extract.js +187 -0
- package/dist/graph/symbol-extract.js.map +1 -0
- package/dist/hooks/auto-capture.d.ts +3 -2
- package/dist/hooks/auto-capture.d.ts.map +1 -1
- package/dist/hooks/auto-capture.js +5 -3
- package/dist/hooks/auto-capture.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/agent-mcp-installer.d.ts +87 -5
- package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
- package/dist/integrations/agent-mcp-installer.js +418 -60
- package/dist/integrations/agent-mcp-installer.js.map +1 -1
- package/dist/integrations/agent-profiles/profiles/qoder.d.ts.map +1 -1
- package/dist/integrations/agent-profiles/profiles/qoder.js +14 -2
- package/dist/integrations/agent-profiles/profiles/qoder.js.map +1 -1
- package/dist/integrations/agent-profiles/skills/qoder.js +6 -0
- package/dist/integrations/agent-profiles/skills/qoder.js.map +1 -1
- package/dist/integrations/claude-code-hooks.d.ts +33 -1
- package/dist/integrations/claude-code-hooks.d.ts.map +1 -1
- package/dist/integrations/claude-code-hooks.js +99 -13
- package/dist/integrations/claude-code-hooks.js.map +1 -1
- package/dist/integrations/ensure-anydoc.d.ts +46 -0
- package/dist/integrations/ensure-anydoc.d.ts.map +1 -0
- package/dist/integrations/ensure-anydoc.js +228 -0
- package/dist/integrations/ensure-anydoc.js.map +1 -0
- package/dist/integrations/skill-installer.d.ts +26 -3
- package/dist/integrations/skill-installer.d.ts.map +1 -1
- package/dist/integrations/skill-installer.js +147 -5
- package/dist/integrations/skill-installer.js.map +1 -1
- package/dist/learning/canary-gate.d.ts +39 -0
- package/dist/learning/canary-gate.d.ts.map +1 -0
- package/dist/learning/canary-gate.js +57 -0
- package/dist/learning/canary-gate.js.map +1 -0
- package/dist/learning/skill-consolidate.d.ts +84 -0
- package/dist/learning/skill-consolidate.d.ts.map +1 -0
- package/dist/learning/skill-consolidate.js +353 -0
- package/dist/learning/skill-consolidate.js.map +1 -0
- package/dist/learning/skill-flywheel.d.ts +26 -0
- package/dist/learning/skill-flywheel.d.ts.map +1 -1
- package/dist/learning/skill-flywheel.js +192 -29
- package/dist/learning/skill-flywheel.js.map +1 -1
- package/dist/learning/skill-opt-lite.d.ts +46 -0
- package/dist/learning/skill-opt-lite.d.ts.map +1 -0
- package/dist/learning/skill-opt-lite.js +270 -0
- package/dist/learning/skill-opt-lite.js.map +1 -0
- package/dist/learning/skill-package.d.ts.map +1 -1
- package/dist/learning/skill-package.js +80 -6
- package/dist/learning/skill-package.js.map +1 -1
- package/dist/learning/skill-store.d.ts.map +1 -1
- package/dist/learning/skill-store.js +13 -0
- package/dist/learning/skill-store.js.map +1 -1
- package/dist/learning/skill-types.d.ts +32 -0
- package/dist/learning/skill-types.d.ts.map +1 -1
- package/dist/learning/skill-types.js +17 -0
- package/dist/learning/skill-types.js.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/surfaces/cli/index.js +46 -5
- package/dist/surfaces/cli/index.js.map +1 -1
- package/dist/surfaces/cli/init.d.ts +17 -4
- package/dist/surfaces/cli/init.d.ts.map +1 -1
- package/dist/surfaces/cli/init.js +71 -8
- package/dist/surfaces/cli/init.js.map +1 -1
- package/dist/surfaces/cli/output.d.ts.map +1 -1
- package/dist/surfaces/cli/output.js +4 -2
- package/dist/surfaces/cli/output.js.map +1 -1
- package/dist/surfaces/cli/runtime/facade.d.ts +2 -1
- package/dist/surfaces/cli/runtime/facade.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/facade.js +1 -0
- package/dist/surfaces/cli/runtime/facade.js.map +1 -1
- package/dist/surfaces/cli/runtime/graph.d.ts +53 -0
- package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/graph.js +116 -5
- package/dist/surfaces/cli/runtime/graph.js.map +1 -1
- package/dist/surfaces/cli/runtime/learning.d.ts +19 -0
- package/dist/surfaces/cli/runtime/learning.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/learning.js +46 -0
- package/dist/surfaces/cli/runtime/learning.js.map +1 -1
- package/dist/surfaces/cli/runtime/routing.d.ts +6 -3
- package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/routing.js +70 -7
- package/dist/surfaces/cli/runtime/routing.js.map +1 -1
- package/dist/surfaces/cli/runtime/settings.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime/settings.js +13 -0
- package/dist/surfaces/cli/runtime/settings.js.map +1 -1
- package/dist/surfaces/cli/runtime/types.d.ts +62 -0
- package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime.d.ts +3 -3
- package/dist/surfaces/cli/runtime.d.ts.map +1 -1
- package/dist/surfaces/cli/runtime.js +6 -2
- package/dist/surfaces/cli/runtime.js.map +1 -1
- package/dist/surfaces/mcp/server.js +1 -1
- package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
- package/dist/surfaces/mcp/tool-definitions.js +15 -0
- package/dist/surfaces/mcp/tool-definitions.js.map +1 -1
- package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -1
- package/dist/surfaces/mcp/tool-handlers.js +24 -3
- package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
- package/mcp.json +14 -0
- package/package.json +19 -1
- package/plugin.json +21 -0
- package/scripts/safe-postinstall.cjs +36 -1
- package/skills/graphflow/SKILL.md +565 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure optional @firecrawl/anydoc is available for Office/PDF → Markdown.
|
|
3
|
+
*
|
|
4
|
+
* VSIX does not ship native anydoc binaries. The VS Code/Cursor extension
|
|
5
|
+
* (and optionally CLI) downloads the current-platform package into
|
|
6
|
+
* ~/.graphflow/optional-deps via npm, then sets GRAPHFLOW_ANYDOC_NODE_MODULES.
|
|
7
|
+
*/
|
|
8
|
+
/** Keep in sync with package.json optionalDependencies[@firecrawl/anydoc]. */
|
|
9
|
+
export declare const ANYDOC_NPM_PACKAGE = "@firecrawl/anydoc";
|
|
10
|
+
export declare const ANYDOC_PINNED_VERSION = "0.1.7";
|
|
11
|
+
export type EnsureAnydocStatus = "already" | "installed" | "skipped" | "failed";
|
|
12
|
+
export interface EnsureAnydocResult {
|
|
13
|
+
status: EnsureAnydocStatus;
|
|
14
|
+
message: string;
|
|
15
|
+
nodeModules?: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolveAnydocOptionalDepsRoot(home?: string): string;
|
|
19
|
+
export declare function resolveAnydocNodeModules(home?: string): string;
|
|
20
|
+
export declare function readInstalledAnydocVersion(depsRoot?: string): string | undefined;
|
|
21
|
+
export declare function isAnydocPresent(nodeModules?: string): boolean;
|
|
22
|
+
export declare function inspectAnydocStatus(home?: string): {
|
|
23
|
+
ready: boolean;
|
|
24
|
+
version?: string;
|
|
25
|
+
nodeModules: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Point Node resolution at the optional-deps node_modules (extension + MCP child).
|
|
29
|
+
*/
|
|
30
|
+
export declare function applyAnydocRequireEnv(nodeModules?: string): boolean;
|
|
31
|
+
/** Try loading anydoc from env path or default resolution. */
|
|
32
|
+
export declare function tryRequireAnydoc(): unknown | null;
|
|
33
|
+
/**
|
|
34
|
+
* Ensure platform anydoc binary is installed under ~/.graphflow/optional-deps.
|
|
35
|
+
* No-op when disabled, already present at the pinned version, or already require-able.
|
|
36
|
+
*/
|
|
37
|
+
export declare function ensureAnydocInstalled(options?: {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
version?: string;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
home?: string;
|
|
42
|
+
/** Inject install for tests. */
|
|
43
|
+
installFn?: (depsRoot: string, version: string) => Promise<void>;
|
|
44
|
+
logger?: (message: string) => void;
|
|
45
|
+
}): Promise<EnsureAnydocResult>;
|
|
46
|
+
//# sourceMappingURL=ensure-anydoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-anydoc.d.ts","sourceRoot":"","sources":["../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AAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2E9B"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Ensure optional @firecrawl/anydoc is available for Office/PDF → Markdown.
|
|
4
|
+
*
|
|
5
|
+
* VSIX does not ship native anydoc binaries. The VS Code/Cursor extension
|
|
6
|
+
* (and optionally CLI) downloads the current-platform package into
|
|
7
|
+
* ~/.graphflow/optional-deps via npm, then sets GRAPHFLOW_ANYDOC_NODE_MODULES.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ANYDOC_PINNED_VERSION = exports.ANYDOC_NPM_PACKAGE = void 0;
|
|
11
|
+
exports.resolveAnydocOptionalDepsRoot = resolveAnydocOptionalDepsRoot;
|
|
12
|
+
exports.resolveAnydocNodeModules = resolveAnydocNodeModules;
|
|
13
|
+
exports.readInstalledAnydocVersion = readInstalledAnydocVersion;
|
|
14
|
+
exports.isAnydocPresent = isAnydocPresent;
|
|
15
|
+
exports.inspectAnydocStatus = inspectAnydocStatus;
|
|
16
|
+
exports.applyAnydocRequireEnv = applyAnydocRequireEnv;
|
|
17
|
+
exports.tryRequireAnydoc = tryRequireAnydoc;
|
|
18
|
+
exports.ensureAnydocInstalled = ensureAnydocInstalled;
|
|
19
|
+
const node_child_process_1 = require("node:child_process");
|
|
20
|
+
const node_fs_1 = require("node:fs");
|
|
21
|
+
const node_module_1 = require("node:module");
|
|
22
|
+
const node_os_1 = require("node:os");
|
|
23
|
+
const node_path_1 = require("node:path");
|
|
24
|
+
/** Keep in sync with package.json optionalDependencies[@firecrawl/anydoc]. */
|
|
25
|
+
exports.ANYDOC_NPM_PACKAGE = "@firecrawl/anydoc";
|
|
26
|
+
exports.ANYDOC_PINNED_VERSION = "0.1.7";
|
|
27
|
+
function resolveAnydocOptionalDepsRoot(home = (0, node_os_1.homedir)()) {
|
|
28
|
+
return (0, node_path_1.join)(home, ".graphflow", "optional-deps");
|
|
29
|
+
}
|
|
30
|
+
function resolveAnydocNodeModules(home = (0, node_os_1.homedir)()) {
|
|
31
|
+
return (0, node_path_1.join)(resolveAnydocOptionalDepsRoot(home), "node_modules");
|
|
32
|
+
}
|
|
33
|
+
function versionMarkerPath(depsRoot) {
|
|
34
|
+
return (0, node_path_1.join)(depsRoot, ".anydoc-version");
|
|
35
|
+
}
|
|
36
|
+
function readInstalledAnydocVersion(depsRoot = resolveAnydocOptionalDepsRoot()) {
|
|
37
|
+
try {
|
|
38
|
+
const marker = (0, node_fs_1.readFileSync)(versionMarkerPath(depsRoot), "utf8").trim();
|
|
39
|
+
if (marker) {
|
|
40
|
+
return marker;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// fall through
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const pkgPath = (0, node_path_1.join)(depsRoot, "node_modules", "@firecrawl", "anydoc", "package.json");
|
|
48
|
+
const pkg = JSON.parse((0, node_fs_1.readFileSync)(pkgPath, "utf8"));
|
|
49
|
+
return pkg.version;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isAnydocPresent(nodeModules = resolveAnydocNodeModules()) {
|
|
56
|
+
return (0, node_fs_1.existsSync)((0, node_path_1.join)(nodeModules, "@firecrawl", "anydoc", "package.json"));
|
|
57
|
+
}
|
|
58
|
+
function inspectAnydocStatus(home = (0, node_os_1.homedir)()) {
|
|
59
|
+
const nodeModules = resolveAnydocNodeModules(home);
|
|
60
|
+
const version = readInstalledAnydocVersion(resolveAnydocOptionalDepsRoot(home));
|
|
61
|
+
const ready = Boolean(tryRequireAnydoc() || isAnydocPresent(nodeModules));
|
|
62
|
+
return { ready, ...(version ? { version } : {}), nodeModules };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Point Node resolution at the optional-deps node_modules (extension + MCP child).
|
|
66
|
+
*/
|
|
67
|
+
function applyAnydocRequireEnv(nodeModules = resolveAnydocNodeModules()) {
|
|
68
|
+
if (!(0, node_fs_1.existsSync)(nodeModules)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
process.env.GRAPHFLOW_ANYDOC_NODE_MODULES = nodeModules;
|
|
72
|
+
const parts = (process.env.NODE_PATH ?? "")
|
|
73
|
+
.split(node_path_1.delimiter)
|
|
74
|
+
.map((p) => p.trim())
|
|
75
|
+
.filter(Boolean);
|
|
76
|
+
if (!parts.includes(nodeModules)) {
|
|
77
|
+
process.env.NODE_PATH = parts.length > 0 ? `${nodeModules}${node_path_1.delimiter}${parts.join(node_path_1.delimiter)}` : nodeModules;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
// Refresh Node's module search paths after NODE_PATH mutation.
|
|
81
|
+
const Module = require("node:module");
|
|
82
|
+
Module._initPaths?.();
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// ignore — createRequire(path) still works for document-convert
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
/** Try loading anydoc from env path or default resolution. */
|
|
90
|
+
function tryRequireAnydoc() {
|
|
91
|
+
const existing = process.env.GRAPHFLOW_ANYDOC_NODE_MODULES?.trim();
|
|
92
|
+
if (existing && (0, node_fs_1.existsSync)((0, node_path_1.join)(existing, "@firecrawl", "anydoc", "package.json"))) {
|
|
93
|
+
try {
|
|
94
|
+
const req = (0, node_module_1.createRequire)((0, node_path_1.join)(existing, "@firecrawl", "anydoc", "package.json"));
|
|
95
|
+
return req(exports.ANYDOC_NPM_PACKAGE);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// fall through to default home path
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
applyAnydocRequireEnv(resolveAnydocNodeModules());
|
|
102
|
+
const fromEnv = process.env.GRAPHFLOW_ANYDOC_NODE_MODULES?.trim();
|
|
103
|
+
if (fromEnv) {
|
|
104
|
+
try {
|
|
105
|
+
const req = (0, node_module_1.createRequire)((0, node_path_1.join)(fromEnv, "@firecrawl", "anydoc", "package.json"));
|
|
106
|
+
return req(exports.ANYDOC_NPM_PACKAGE);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// fall through
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const req = (0, node_module_1.createRequire)(__filename);
|
|
114
|
+
return req(exports.ANYDOC_NPM_PACKAGE);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function resolveNpmCommand() {
|
|
121
|
+
if (process.env.GRAPHFLOW_NPM?.trim()) {
|
|
122
|
+
return process.env.GRAPHFLOW_NPM.trim();
|
|
123
|
+
}
|
|
124
|
+
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
125
|
+
}
|
|
126
|
+
function runNpmInstall(depsRoot, version, timeoutMs) {
|
|
127
|
+
const npm = resolveNpmCommand();
|
|
128
|
+
const spec = `${exports.ANYDOC_NPM_PACKAGE}@${version}`;
|
|
129
|
+
return new Promise((resolve, reject) => {
|
|
130
|
+
const child = (0, node_child_process_1.spawn)(npm, ["install", "--ignore-scripts", "--no-save", "--no-package-lock", spec], {
|
|
131
|
+
cwd: depsRoot,
|
|
132
|
+
env: process.env,
|
|
133
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
134
|
+
windowsHide: true,
|
|
135
|
+
shell: process.platform === "win32",
|
|
136
|
+
});
|
|
137
|
+
let stderr = "";
|
|
138
|
+
child.stderr?.on("data", (chunk) => {
|
|
139
|
+
stderr += chunk.toString("utf8");
|
|
140
|
+
});
|
|
141
|
+
const timer = setTimeout(() => {
|
|
142
|
+
child.kill("SIGTERM");
|
|
143
|
+
reject(new Error(`npm install ${spec} timed out after ${timeoutMs}ms`));
|
|
144
|
+
}, timeoutMs);
|
|
145
|
+
child.on("error", (err) => {
|
|
146
|
+
clearTimeout(timer);
|
|
147
|
+
reject(err);
|
|
148
|
+
});
|
|
149
|
+
child.on("close", (code) => {
|
|
150
|
+
clearTimeout(timer);
|
|
151
|
+
if (code === 0) {
|
|
152
|
+
resolve();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
reject(new Error(`npm install ${spec} exited ${code}: ${stderr.slice(0, 500)}`));
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Ensure platform anydoc binary is installed under ~/.graphflow/optional-deps.
|
|
161
|
+
* No-op when disabled, already present at the pinned version, or already require-able.
|
|
162
|
+
*/
|
|
163
|
+
async function ensureAnydocInstalled(options) {
|
|
164
|
+
const enabled = options?.enabled ?? true;
|
|
165
|
+
const version = options?.version ?? exports.ANYDOC_PINNED_VERSION;
|
|
166
|
+
const timeoutMs = options?.timeoutMs ?? 180_000;
|
|
167
|
+
const home = options?.home ?? (0, node_os_1.homedir)();
|
|
168
|
+
const log = options?.logger ?? (() => undefined);
|
|
169
|
+
if (!enabled) {
|
|
170
|
+
return { status: "skipped", message: "anydoc auto-download disabled" };
|
|
171
|
+
}
|
|
172
|
+
const depsRoot = resolveAnydocOptionalDepsRoot(home);
|
|
173
|
+
const nodeModules = resolveAnydocNodeModules(home);
|
|
174
|
+
if (tryRequireAnydoc()) {
|
|
175
|
+
const nm = isAnydocPresent(nodeModules) ? nodeModules : process.env.GRAPHFLOW_ANYDOC_NODE_MODULES;
|
|
176
|
+
return {
|
|
177
|
+
status: "already",
|
|
178
|
+
message: "anydoc already resolvable",
|
|
179
|
+
...(nm ? { nodeModules: nm } : {}),
|
|
180
|
+
version: readInstalledAnydocVersion(depsRoot) ?? version,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (isAnydocPresent(nodeModules) && readInstalledAnydocVersion(depsRoot) === version) {
|
|
184
|
+
applyAnydocRequireEnv(nodeModules);
|
|
185
|
+
if (tryRequireAnydoc()) {
|
|
186
|
+
return {
|
|
187
|
+
status: "already",
|
|
188
|
+
message: `anydoc ${version} already installed in ${nodeModules}`,
|
|
189
|
+
nodeModules,
|
|
190
|
+
version,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
(0, node_fs_1.mkdirSync)(depsRoot, { recursive: true });
|
|
196
|
+
// Minimal package.json so npm install --prefix-like cwd works cleanly
|
|
197
|
+
const pkgJson = (0, node_path_1.join)(depsRoot, "package.json");
|
|
198
|
+
if (!(0, node_fs_1.existsSync)(pkgJson)) {
|
|
199
|
+
(0, node_fs_1.writeFileSync)(pkgJson, JSON.stringify({ name: "graphflow-optional-deps", private: true, version: "0.0.0" }, null, 2), "utf8");
|
|
200
|
+
}
|
|
201
|
+
log(`[GraphFlow] Downloading ${exports.ANYDOC_NPM_PACKAGE}@${version} into ${depsRoot} …`);
|
|
202
|
+
const install = options?.installFn ?? ((root, ver) => runNpmInstall(root, ver, timeoutMs));
|
|
203
|
+
await install(depsRoot, version);
|
|
204
|
+
(0, node_fs_1.writeFileSync)(versionMarkerPath(depsRoot), `${version}\n`, "utf8");
|
|
205
|
+
applyAnydocRequireEnv(nodeModules);
|
|
206
|
+
if (!tryRequireAnydoc()) {
|
|
207
|
+
return {
|
|
208
|
+
status: "failed",
|
|
209
|
+
message: `installed files under ${nodeModules} but require(@firecrawl/anydoc) still failed`,
|
|
210
|
+
nodeModules,
|
|
211
|
+
version,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
log(`[GraphFlow] anydoc ${version} ready`);
|
|
215
|
+
return {
|
|
216
|
+
status: "installed",
|
|
217
|
+
message: `installed ${exports.ANYDOC_NPM_PACKAGE}@${version}`,
|
|
218
|
+
nodeModules,
|
|
219
|
+
version,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
224
|
+
log(`[GraphFlow] anydoc download failed: ${message}`);
|
|
225
|
+
return { status: "failed", message };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=ensure-anydoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-anydoc.js","sourceRoot":"","sources":["../../src/integrations/ensure-anydoc.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqBH,sEAEC;AAED,4DAEC;AAMD,gEAgBC;AAED,0CAEC;AAED,kDASC;AAKD,sDAqBC;AAGD,4CA2BC;AAmDD,sDAmFC;AA5PD,2DAA2C;AAC3C,qCAA6E;AAC7E,6CAA4C;AAC5C,qCAAkC;AAClC,yCAA4C;AAE5C,8EAA8E;AACjE,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,qBAAqB,GAAG,OAAO,CAAC;AAW7C,SAAgB,6BAA6B,CAAC,IAAI,GAAG,IAAA,iBAAO,GAAE;IAC5D,OAAO,IAAA,gBAAI,EAAC,IAAI,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;AACnD,CAAC;AAED,SAAgB,wBAAwB,CAAC,IAAI,GAAG,IAAA,iBAAO,GAAE;IACvD,OAAO,IAAA,gBAAI,EAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,IAAA,gBAAI,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,0BAA0B,CAAC,QAAQ,GAAG,6BAA6B,EAAE;IACnF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QACxE,IAAI,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AC3C,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,OAAO,EAAE,aAAa,0BAAkB,IAAI,OAAO,EAAE;YACrD,WAAW;YACX,OAAO;SACR,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,GAAG,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -31,9 +31,9 @@ export interface AgentInstructionStatus {
|
|
|
31
31
|
/**
|
|
32
32
|
* 解析 Trae Skill 源文件路径。
|
|
33
33
|
* 支持以下候选路径(按优先级排序):
|
|
34
|
-
* 1.
|
|
35
|
-
* 2.
|
|
36
|
-
* 3. src/surfaces/
|
|
34
|
+
* 1. Agent Plugins 1.0 `skills/graphflow/`(规范源)
|
|
35
|
+
* 2. vendorRuntimeRoot(VS Code 扩展打包后 vendor/graphflow 路径)
|
|
36
|
+
* 3. 兼容副本:dist/surfaces/trae-skill、src/surfaces/trae-skill
|
|
37
37
|
*/
|
|
38
38
|
export declare function resolveSkillSourcePath(vendorRuntimeRoot?: string): string | undefined;
|
|
39
39
|
/**
|
|
@@ -145,4 +145,27 @@ export declare function installAllSkills(vendorRuntimeRoot?: string, log?: (mess
|
|
|
145
145
|
export declare function removeManagedBlock(filePath: string): boolean;
|
|
146
146
|
/** 移除指定 agent 的 GraphFlow Skill 目录 */
|
|
147
147
|
export declare function removeAgentSkill(skillsRoot: string, skillName?: string): boolean;
|
|
148
|
+
/** True when content looks like a GraphFlow-owned install (not a lightly annotated user file). */
|
|
149
|
+
export declare function looksLikeGraphFlowOwnedContent(content: string): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Remove a GraphFlow-owned file:
|
|
152
|
+
* - `graphflow.md` / `graphflow.mdc` → delete
|
|
153
|
+
* - managed-marker files → strip block
|
|
154
|
+
* - known instruction filenames that are wholly GraphFlow content → delete
|
|
155
|
+
*/
|
|
156
|
+
export declare function removeGraphFlowOwnedFile(filePath: string): boolean;
|
|
157
|
+
export interface SkillUninstallResult {
|
|
158
|
+
target: string;
|
|
159
|
+
path: string;
|
|
160
|
+
removed: boolean;
|
|
161
|
+
message?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Uninstall all GraphFlow Skills, Rules, and managed instruction blocks
|
|
165
|
+
* written by `graphflow install` / `installAllSkills`.
|
|
166
|
+
*
|
|
167
|
+
* Call this together with MCP uninstall so Agent Plugin / IDE uninstall
|
|
168
|
+
* leftovers cannot keep guiding agents toward GraphFlow tools.
|
|
169
|
+
*/
|
|
170
|
+
export declare function uninstallAllSkillsAndRules(workspaceRoot?: string): SkillUninstallResult[];
|
|
148
171
|
//# sourceMappingURL=skill-installer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-installer.d.ts","sourceRoot":"","sources":["../../src/integrations/skill-installer.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACpD,cAAc;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,8EAA8E;IAC9E,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;IACxC,wFAAwF;IACxF,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,mFAAmF;IACnF,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAED,gFAAgF;AAChF,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;CACpB;AAiHD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"skill-installer.d.ts","sourceRoot":"","sources":["../../src/integrations/skill-installer.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACpD,cAAc;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,8EAA8E;IAC9E,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;IACxC,wFAAwF;IACxF,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,mFAAmF;IACnF,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAED,gFAAgF;AAChF,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;CACpB;AAiHD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAA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BAAkB,EAAE,CAK5F;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,iBAAiB,CAAC,EAAE,MAAM,EAC1B,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAC/B,aAAa,CAAC,EAAE,MAAM,GACrB,mBAAmB,CA+ErB;AAID,mCAAmC;AACnC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAiB5D;AAED,sCAAsC;AACtC,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,SAAc,GAAG,OAAO,CAYrF;AA2BD,kGAAkG;AAClG,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAUvE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkClE;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAqEzF"}
|
|
@@ -25,6 +25,9 @@ exports.installProjectGeminiInstructions = installProjectGeminiInstructions;
|
|
|
25
25
|
exports.installAllSkills = installAllSkills;
|
|
26
26
|
exports.removeManagedBlock = removeManagedBlock;
|
|
27
27
|
exports.removeAgentSkill = removeAgentSkill;
|
|
28
|
+
exports.looksLikeGraphFlowOwnedContent = looksLikeGraphFlowOwnedContent;
|
|
29
|
+
exports.removeGraphFlowOwnedFile = removeGraphFlowOwnedFile;
|
|
30
|
+
exports.uninstallAllSkillsAndRules = uninstallAllSkillsAndRules;
|
|
28
31
|
/**
|
|
29
32
|
* skill-installer.ts — 共享的 Skill / Rules 安装模块
|
|
30
33
|
*
|
|
@@ -130,20 +133,24 @@ function getClaudeCodeDirs() {
|
|
|
130
133
|
/**
|
|
131
134
|
* 解析 Trae Skill 源文件路径。
|
|
132
135
|
* 支持以下候选路径(按优先级排序):
|
|
133
|
-
* 1.
|
|
134
|
-
* 2.
|
|
135
|
-
* 3. src/surfaces/
|
|
136
|
+
* 1. Agent Plugins 1.0 `skills/graphflow/`(规范源)
|
|
137
|
+
* 2. vendorRuntimeRoot(VS Code 扩展打包后 vendor/graphflow 路径)
|
|
138
|
+
* 3. 兼容副本:dist/surfaces/trae-skill、src/surfaces/trae-skill
|
|
136
139
|
*/
|
|
137
140
|
function resolveSkillSourcePath(vendorRuntimeRoot) {
|
|
138
141
|
const candidates = [
|
|
142
|
+
// Agent Plugins 1.0 fixed discovery path (canonical source)
|
|
143
|
+
(0, node_path_1.join)(process.cwd(), "skills", "graphflow"),
|
|
144
|
+
(0, node_path_1.join)(__dirname, "..", "..", "..", "skills", "graphflow"),
|
|
139
145
|
// VS Code 扩展 vendor 路径(打包后)
|
|
140
146
|
...(vendorRuntimeRoot
|
|
141
147
|
? [
|
|
148
|
+
(0, node_path_1.join)(vendorRuntimeRoot, "skills", "graphflow"),
|
|
142
149
|
(0, node_path_1.join)(vendorRuntimeRoot, "src", "surfaces", "trae-skill", "graphflow"),
|
|
143
150
|
(0, node_path_1.join)(vendorRuntimeRoot, "dist", "surfaces", "trae-skill", "graphflow"),
|
|
144
151
|
]
|
|
145
152
|
: []),
|
|
146
|
-
// 标准构建产物路径
|
|
153
|
+
// 兼容副本 / 标准构建产物路径
|
|
147
154
|
(0, node_path_1.join)(__dirname, "..", "..", "surfaces", "trae-skill", "graphflow"),
|
|
148
155
|
(0, node_path_1.join)(__dirname, "..", "..", "..", "src", "surfaces", "trae-skill", "graphflow"),
|
|
149
156
|
(0, node_path_1.join)(process.cwd(), "src", "surfaces", "trae-skill", "graphflow"),
|
|
@@ -300,7 +307,7 @@ function buildInstructionBlock() {
|
|
|
300
307
|
"4. For multi-step or ambiguous work, call `graphflow_plan` before implementing.",
|
|
301
308
|
"5. After project changes, call `graphflow_index` to keep the graph fresh.",
|
|
302
309
|
"6. The flywheel auto-closes: pending episodes are backfilled by Claude Code",
|
|
303
|
-
" hooks (or `graphflow_report_outcome`)
|
|
310
|
+
" hooks (or `graphflow_report_outcome`) by default; set GRAPHFLOW_AUTO_CAPTURE=0 to opt out.",
|
|
304
311
|
"",
|
|
305
312
|
"When using Cursor `CallMcpTool`, always pass `server` + `toolName` + `arguments`",
|
|
306
313
|
"(e.g. server `\"graphflow\"` / `\"user-graphflow\"`, toolName `\"graphflow_context\"`).",
|
|
@@ -578,6 +585,12 @@ function getAgentSkillTargets() {
|
|
|
578
585
|
markerDir: (0, node_path_1.join)(home, ".qoder"),
|
|
579
586
|
skillsRoot: (0, node_path_1.join)(home, ".qoder", "skills"),
|
|
580
587
|
},
|
|
588
|
+
{
|
|
589
|
+
// Qoder CN 版(~/.qoder-cn/skills)
|
|
590
|
+
agent: "Qoder CN",
|
|
591
|
+
markerDir: (0, node_path_1.join)(home, ".qoder-cn"),
|
|
592
|
+
skillsRoot: (0, node_path_1.join)(home, ".qoder-cn", "skills"),
|
|
593
|
+
},
|
|
581
594
|
];
|
|
582
595
|
}
|
|
583
596
|
/**
|
|
@@ -1139,4 +1152,133 @@ function _rimraf(dirPath) {
|
|
|
1139
1152
|
}
|
|
1140
1153
|
catch { /* ignore */ }
|
|
1141
1154
|
}
|
|
1155
|
+
function removeFileIfExists(filePath) {
|
|
1156
|
+
if (!(0, node_fs_1.existsSync)(filePath))
|
|
1157
|
+
return false;
|
|
1158
|
+
try {
|
|
1159
|
+
(0, node_fs_1.rmSync)(filePath, { force: true });
|
|
1160
|
+
return !(0, node_fs_1.existsSync)(filePath);
|
|
1161
|
+
}
|
|
1162
|
+
catch {
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
/** True when content looks like a GraphFlow-owned install (not a lightly annotated user file). */
|
|
1167
|
+
function looksLikeGraphFlowOwnedContent(content) {
|
|
1168
|
+
if (!content.includes("graphflow_context"))
|
|
1169
|
+
return false;
|
|
1170
|
+
return (content.includes(INSTRUCTION_BEGIN) ||
|
|
1171
|
+
content.includes("Token-First Rule") ||
|
|
1172
|
+
content.includes("10 MCP tools") ||
|
|
1173
|
+
content.includes("graphflow-mcp") ||
|
|
1174
|
+
content.includes("A Context-Aware Multi-Agent Orchestration Engine") ||
|
|
1175
|
+
/^\s*#\s*GraphFlow\b/m.test(content));
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Remove a GraphFlow-owned file:
|
|
1179
|
+
* - `graphflow.md` / `graphflow.mdc` → delete
|
|
1180
|
+
* - managed-marker files → strip block
|
|
1181
|
+
* - known instruction filenames that are wholly GraphFlow content → delete
|
|
1182
|
+
*/
|
|
1183
|
+
function removeGraphFlowOwnedFile(filePath) {
|
|
1184
|
+
if (!(0, node_fs_1.existsSync)(filePath))
|
|
1185
|
+
return false;
|
|
1186
|
+
const name = (0, node_path_1.basename)(filePath);
|
|
1187
|
+
if (/^graphflow\.(md|mdc)$/i.test(name)) {
|
|
1188
|
+
return removeFileIfExists(filePath);
|
|
1189
|
+
}
|
|
1190
|
+
if (removeManagedBlock(filePath)) {
|
|
1191
|
+
return true;
|
|
1192
|
+
}
|
|
1193
|
+
try {
|
|
1194
|
+
const content = (0, node_fs_1.readFileSync)(filePath, "utf8");
|
|
1195
|
+
const whollyOwnedNames = new Set([
|
|
1196
|
+
"CLAUDE.md",
|
|
1197
|
+
"AGENTS.md",
|
|
1198
|
+
"GEMINI.md",
|
|
1199
|
+
".windsurfrules",
|
|
1200
|
+
"copilot-instructions.md",
|
|
1201
|
+
"global_rules.md",
|
|
1202
|
+
]);
|
|
1203
|
+
if (whollyOwnedNames.has(name) && looksLikeGraphFlowOwnedContent(content)) {
|
|
1204
|
+
// Prefer strip if markers exist (already tried). Otherwise delete only when
|
|
1205
|
+
// the file is clearly a GraphFlow template, not a mixed user doc.
|
|
1206
|
+
const mostlyOurs = content.includes(INSTRUCTION_BEGIN) ||
|
|
1207
|
+
/^\s*#\s*GraphFlow\b/m.test(content) ||
|
|
1208
|
+
content.includes("A Context-Aware Multi-Agent Orchestration Engine");
|
|
1209
|
+
if (mostlyOurs) {
|
|
1210
|
+
return removeFileIfExists(filePath);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
catch {
|
|
1215
|
+
return false;
|
|
1216
|
+
}
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Uninstall all GraphFlow Skills, Rules, and managed instruction blocks
|
|
1221
|
+
* written by `graphflow install` / `installAllSkills`.
|
|
1222
|
+
*
|
|
1223
|
+
* Call this together with MCP uninstall so Agent Plugin / IDE uninstall
|
|
1224
|
+
* leftovers cannot keep guiding agents toward GraphFlow tools.
|
|
1225
|
+
*/
|
|
1226
|
+
function uninstallAllSkillsAndRules(workspaceRoot) {
|
|
1227
|
+
const results = [];
|
|
1228
|
+
const root = workspaceRoot?.trim() ? workspaceRoot : process.cwd();
|
|
1229
|
+
const push = (target, path, removed, message) => {
|
|
1230
|
+
results.push({ target, path, removed, ...(message ? { message } : {}) });
|
|
1231
|
+
};
|
|
1232
|
+
// 1) User-level agent skills (~/.cursor/skills/graphflow, etc.)
|
|
1233
|
+
for (const target of getAgentSkillTargets()) {
|
|
1234
|
+
const skillDir = (0, node_path_1.join)(target.skillsRoot, "graphflow");
|
|
1235
|
+
const removed = removeAgentSkill(target.skillsRoot);
|
|
1236
|
+
push(`${target.agent} skill`, skillDir, removed, removed ? "removed" : "not found");
|
|
1237
|
+
}
|
|
1238
|
+
// 2) Trae user skills
|
|
1239
|
+
for (const trae of getTraeUserDirs()) {
|
|
1240
|
+
const skillDir = (0, node_path_1.join)(trae.skillsDir, "graphflow");
|
|
1241
|
+
const removed = removeAgentSkill(trae.skillsDir);
|
|
1242
|
+
push(`${trae.name} skill`, skillDir, removed, removed ? "removed" : "not found");
|
|
1243
|
+
}
|
|
1244
|
+
// 3) Cursor user rules
|
|
1245
|
+
for (const cursor of getCursorRulesDirs()) {
|
|
1246
|
+
const filePath = (0, node_path_1.join)(cursor.rulesDir, "graphflow.mdc");
|
|
1247
|
+
const removed = removeFileIfExists(filePath);
|
|
1248
|
+
push(`${cursor.name} rules`, filePath, removed, removed ? "removed" : "not found");
|
|
1249
|
+
}
|
|
1250
|
+
// 4) Claude Code user CLAUDE.md
|
|
1251
|
+
for (const claude of getClaudeCodeDirs()) {
|
|
1252
|
+
const filePath = (0, node_path_1.join)(claude.claudeDir, "CLAUDE.md");
|
|
1253
|
+
const removed = removeGraphFlowOwnedFile(filePath);
|
|
1254
|
+
push(`${claude.name} CLAUDE.md`, filePath, removed, removed ? "removed" : "not found / kept (user content)");
|
|
1255
|
+
}
|
|
1256
|
+
// 5) Global agent instruction targets
|
|
1257
|
+
for (const target of getAgentInstructionTargets()) {
|
|
1258
|
+
const removed = removeGraphFlowOwnedFile(target.filePath);
|
|
1259
|
+
push(`${target.agent} instructions`, target.filePath, removed, removed ? "removed" : "not found / kept");
|
|
1260
|
+
}
|
|
1261
|
+
// 6) Project-level rules / skills / instruction files
|
|
1262
|
+
for (const target of getProjectLevelRuleTargets(root)) {
|
|
1263
|
+
if (target.sourceType === "trae-skill-file" ||
|
|
1264
|
+
target.sourceType === "antigravity-skill-file") {
|
|
1265
|
+
// destDir is .../skills/graphflow — parent is the skills root
|
|
1266
|
+
const skillsRoot = (0, node_path_1.dirname)(target.destDir);
|
|
1267
|
+
const ok = removeAgentSkill(skillsRoot);
|
|
1268
|
+
push(target.agent, target.destDir, ok, ok ? "removed" : "not found");
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
const removed = removeGraphFlowOwnedFile(target.filePath);
|
|
1272
|
+
push(target.agent, target.filePath, removed, removed ? "removed" : "not found / kept");
|
|
1273
|
+
}
|
|
1274
|
+
// 7) Workspace fallback skill cache
|
|
1275
|
+
const workspaceSkillParent = (0, node_path_1.join)(root, ".graphflow", "skills");
|
|
1276
|
+
const wsRemoved = removeAgentSkill(workspaceSkillParent);
|
|
1277
|
+
push("Workspace .graphflow/skills", (0, node_path_1.join)(workspaceSkillParent, "graphflow"), wsRemoved, wsRemoved ? "removed" : "not found");
|
|
1278
|
+
// 8) Project GEMINI.md managed block / owned file
|
|
1279
|
+
const geminiPath = (0, node_path_1.join)(root, "GEMINI.md");
|
|
1280
|
+
const geminiRemoved = removeGraphFlowOwnedFile(geminiPath);
|
|
1281
|
+
push("Project GEMINI.md", geminiPath, geminiRemoved, geminiRemoved ? "removed" : "not found / kept");
|
|
1282
|
+
return results;
|
|
1283
|
+
}
|
|
1142
1284
|
//# sourceMappingURL=skill-installer.js.map
|