devsmind-mcp 2.1.0 → 2.2.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.
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Registry of AI coding tools DevsMind can integrate with. This single table
3
+ * drives both `devsmind mcp` (add the MCP server) and `devsmind rule` (write the
4
+ * workspace rule). To fix or add a tool, edit an entry here — nothing else.
5
+ */
6
+ export type Transport = 'stdio' | 'http';
7
+ export type ConfigFormat = 'json' | 'toml';
8
+ export type Scope = 'project' | 'global';
9
+ /** A path that may differ per-OS. Strings may contain a leading `~` for the home dir. */
10
+ export type OsPath = string | {
11
+ win32: string;
12
+ darwin: string;
13
+ linux: string;
14
+ };
15
+ export interface McpScope {
16
+ scope: Scope;
17
+ /** Project paths are relative to the workspace root; global paths are absolute (may start with `~`). */
18
+ file: OsPath;
19
+ format: ConfigFormat;
20
+ /** Key-path to the server map, e.g. ['mcpServers'] or ['servers'] or ['mcp_servers']. */
21
+ serverMapPath: string[];
22
+ }
23
+ export interface RuleScope {
24
+ scope: Scope;
25
+ file: OsPath;
26
+ }
27
+ export interface IdeTarget {
28
+ id: string;
29
+ label: string;
30
+ kind: 'ide' | 'cli';
31
+ mcp: {
32
+ scopes: McpScope[];
33
+ /** Supported transports; first is the preferred default. */
34
+ transports: Transport[];
35
+ /** The value object placed under serverMap['devsmind'] for a given transport. */
36
+ entry: (t: Transport, ctx: EntryContext) => Record<string, unknown>;
37
+ /** Optional CLI one-liner installer (e.g. `claude mcp add ...`). */
38
+ cliInstaller?: (t: Transport, ctx: EntryContext) => string;
39
+ /** Extra guidance printed in manual mode. */
40
+ note?: string;
41
+ };
42
+ rules: {
43
+ scopes: RuleScope[];
44
+ /** `standalone` = dedicated devsmind file; `append-section` = merge a delimited block into a shared file. */
45
+ style: 'standalone' | 'append-section';
46
+ /** Optional transform of the rule body before writing (e.g. Cursor .mdc frontmatter). */
47
+ wrap?: (body: string) => string;
48
+ };
49
+ }
50
+ /** Context available when rendering a server entry. */
51
+ export interface EntryContext {
52
+ devmindDir: string;
53
+ port: number;
54
+ }
55
+ /** Standard stdio entry: the IDE spawns `devsmind start --stdio`. */
56
+ export declare function stdioEntry(): Record<string, unknown>;
57
+ /** Standard HTTP entry: connect to the already-running server. */
58
+ export declare function httpEntry(ctx: EntryContext): Record<string, unknown>;
59
+ /** Resolve an {@link OsPath} to a concrete string for the current platform, expanding a leading `~`. */
60
+ export declare function resolveOsPath(p: OsPath): string;
61
+ /**
62
+ * Resolve the absolute file path for a config/rule scope.
63
+ * Project scopes are joined onto `workspaceRoot`; global scopes are absolute.
64
+ */
65
+ export declare function resolveScopeFile(file: OsPath, scope: Scope, workspaceRoot: string): string;
66
+ export declare const TARGETS: IdeTarget[];
67
+ export declare function getTarget(id: string): IdeTarget | undefined;
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TARGETS = void 0;
37
+ exports.stdioEntry = stdioEntry;
38
+ exports.httpEntry = httpEntry;
39
+ exports.resolveOsPath = resolveOsPath;
40
+ exports.resolveScopeFile = resolveScopeFile;
41
+ exports.getTarget = getTarget;
42
+ const os = __importStar(require("os"));
43
+ const path = __importStar(require("path"));
44
+ // ─── Shared entry payloads ───────────────────────────────────────────────────
45
+ /** Standard stdio entry: the IDE spawns `devsmind start --stdio`. */
46
+ function stdioEntry() {
47
+ return { command: 'devsmind', args: ['start', '--stdio'] };
48
+ }
49
+ /** Standard HTTP entry: connect to the already-running server. */
50
+ function httpEntry(ctx) {
51
+ return { url: `http://localhost:${ctx.port}/mcp` };
52
+ }
53
+ // ─── OS-aware path resolution ────────────────────────────────────────────────
54
+ /** Resolve an {@link OsPath} to a concrete string for the current platform, expanding a leading `~`. */
55
+ function resolveOsPath(p) {
56
+ const raw = typeof p === 'string' ? p : p[process.platform] ?? p.linux;
57
+ if (raw.startsWith('~')) {
58
+ return path.join(os.homedir(), raw.slice(1));
59
+ }
60
+ return raw;
61
+ }
62
+ /**
63
+ * Resolve the absolute file path for a config/rule scope.
64
+ * Project scopes are joined onto `workspaceRoot`; global scopes are absolute.
65
+ */
66
+ function resolveScopeFile(file, scope, workspaceRoot) {
67
+ const resolved = resolveOsPath(file);
68
+ if (scope === 'project') {
69
+ return path.isAbsolute(resolved) ? resolved : path.join(workspaceRoot, resolved);
70
+ }
71
+ return path.resolve(resolved);
72
+ }
73
+ // ─── Transport-specific entry helpers ────────────────────────────────────────
74
+ // Different tools key the HTTP endpoint differently (url / serverUrl / httpUrl)
75
+ // and some require an explicit `type`. These builders capture each tool's shape.
76
+ const httpUrl = (ctx) => `http://localhost:${ctx.port}/mcp`;
77
+ /** Cursor / Kiro: bare `url`, no type. */
78
+ const entryUrl = (t, ctx) => t === 'stdio' ? stdioEntry() : { url: httpUrl(ctx) };
79
+ /** VS Code / Claude Code: explicit `type` + url. */
80
+ const entryTyped = (t, ctx) => t === 'stdio'
81
+ ? { type: 'stdio', ...stdioEntry() }
82
+ : { type: 'http', url: httpUrl(ctx) };
83
+ /** Windsurf / Antigravity: HTTP endpoint keyed as `serverUrl`. */
84
+ const entryServerUrl = (t, ctx) => t === 'stdio' ? stdioEntry() : { serverUrl: httpUrl(ctx) };
85
+ /** Qwen Code: Streamable-HTTP endpoint keyed as `httpUrl`. */
86
+ const entryHttpUrl = (t, ctx) => t === 'stdio' ? stdioEntry() : { httpUrl: httpUrl(ctx) };
87
+ const cursorMdcWrap = (body) => `---\ndescription: DevsMind — Team AI Brain workspace rule\nalwaysApply: true\n---\n\n${body}\n`;
88
+ // VS Code user-profile mcp.json lives in the platform user-data dir.
89
+ const VSCODE_GLOBAL = {
90
+ win32: '~/AppData/Roaming/Code/User/mcp.json',
91
+ darwin: '~/Library/Application Support/Code/User/mcp.json',
92
+ linux: '~/.config/Code/User/mcp.json',
93
+ };
94
+ // ─── The registry ────────────────────────────────────────────────────────────
95
+ // IDEs first, then CLIs, for the picker menu. Each tool's HTTP-key quirk and
96
+ // rules location are encoded here — the rest of the code is tool-agnostic.
97
+ exports.TARGETS = [
98
+ // ── IDEs ──────────────────────────────────────────────────────────────────
99
+ {
100
+ id: 'cursor',
101
+ label: 'Cursor',
102
+ kind: 'ide',
103
+ mcp: {
104
+ scopes: [
105
+ { scope: 'project', file: '.cursor/mcp.json', format: 'json', serverMapPath: ['mcpServers'] },
106
+ { scope: 'global', file: '~/.cursor/mcp.json', format: 'json', serverMapPath: ['mcpServers'] },
107
+ ],
108
+ transports: ['stdio', 'http'],
109
+ entry: entryUrl,
110
+ },
111
+ rules: {
112
+ scopes: [{ scope: 'project', file: '.cursor/rules/devsmind.mdc' }],
113
+ style: 'standalone',
114
+ wrap: cursorMdcWrap,
115
+ },
116
+ },
117
+ {
118
+ id: 'vscode',
119
+ label: 'VS Code (GitHub Copilot)',
120
+ kind: 'ide',
121
+ mcp: {
122
+ scopes: [
123
+ { scope: 'project', file: '.vscode/mcp.json', format: 'json', serverMapPath: ['servers'] },
124
+ { scope: 'global', file: VSCODE_GLOBAL, format: 'json', serverMapPath: ['servers'] },
125
+ ],
126
+ transports: ['stdio', 'http'],
127
+ entry: entryTyped,
128
+ note: 'VS Code uses the "servers" key (not "mcpServers").',
129
+ },
130
+ rules: {
131
+ scopes: [{ scope: 'project', file: '.github/copilot-instructions.md' }],
132
+ style: 'append-section',
133
+ },
134
+ },
135
+ {
136
+ id: 'windsurf',
137
+ label: 'Windsurf (Cascade)',
138
+ kind: 'ide',
139
+ mcp: {
140
+ scopes: [
141
+ { scope: 'global', file: '~/.codeium/windsurf/mcp_config.json', format: 'json', serverMapPath: ['mcpServers'] },
142
+ ],
143
+ transports: ['stdio', 'http'],
144
+ entry: entryServerUrl,
145
+ note: 'Windsurf keys the remote endpoint as "serverUrl". Config is global-only.',
146
+ },
147
+ rules: {
148
+ scopes: [{ scope: 'project', file: '.windsurf/rules/devsmind.md' }],
149
+ style: 'standalone',
150
+ },
151
+ },
152
+ {
153
+ id: 'kiro',
154
+ label: 'Kiro',
155
+ kind: 'ide',
156
+ mcp: {
157
+ scopes: [
158
+ { scope: 'project', file: '.kiro/settings/mcp.json', format: 'json', serverMapPath: ['mcpServers'] },
159
+ { scope: 'global', file: '~/.kiro/settings/mcp.json', format: 'json', serverMapPath: ['mcpServers'] },
160
+ ],
161
+ transports: ['stdio', 'http'],
162
+ entry: entryUrl,
163
+ },
164
+ rules: {
165
+ scopes: [{ scope: 'project', file: '.kiro/steering/devsmind.md' }],
166
+ style: 'standalone',
167
+ },
168
+ },
169
+ {
170
+ id: 'antigravity',
171
+ label: 'Google Antigravity (IDE)',
172
+ kind: 'ide',
173
+ mcp: {
174
+ scopes: [
175
+ { scope: 'global', file: '~/.gemini/config/mcp_config.json', format: 'json', serverMapPath: ['mcpServers'] },
176
+ { scope: 'project', file: '.agents/mcp_config.json', format: 'json', serverMapPath: ['mcpServers'] },
177
+ ],
178
+ transports: ['stdio', 'http'],
179
+ entry: entryServerUrl,
180
+ note: 'Antigravity keys the remote endpoint as "serverUrl".',
181
+ },
182
+ rules: {
183
+ scopes: [{ scope: 'project', file: 'AGENTS.md' }],
184
+ style: 'append-section',
185
+ },
186
+ },
187
+ // ── CLI tools ───────────────────────────────────────────────────────────────
188
+ {
189
+ id: 'claude-code',
190
+ label: 'Claude Code (claude CLI / IDE extension)',
191
+ kind: 'cli',
192
+ mcp: {
193
+ scopes: [
194
+ { scope: 'project', file: '.mcp.json', format: 'json', serverMapPath: ['mcpServers'] },
195
+ ],
196
+ transports: ['stdio', 'http'],
197
+ entry: entryTyped,
198
+ cliInstaller: (t, ctx) => t === 'stdio'
199
+ ? 'claude mcp add --transport stdio devsmind -- devsmind start --stdio'
200
+ : `claude mcp add --transport http devsmind ${httpUrl(ctx)}`,
201
+ },
202
+ rules: {
203
+ scopes: [{ scope: 'project', file: 'CLAUDE.md' }],
204
+ style: 'append-section',
205
+ },
206
+ },
207
+ {
208
+ id: 'antigravity-cli',
209
+ label: 'Antigravity CLI',
210
+ kind: 'cli',
211
+ mcp: {
212
+ scopes: [
213
+ { scope: 'project', file: '.agents/mcp_config.json', format: 'json', serverMapPath: ['mcpServers'] },
214
+ { scope: 'global', file: '~/.gemini/config/mcp_config.json', format: 'json', serverMapPath: ['mcpServers'] },
215
+ ],
216
+ transports: ['stdio', 'http'],
217
+ entry: entryServerUrl,
218
+ note: 'Shares config with the Antigravity IDE; keys the remote endpoint as "serverUrl".',
219
+ },
220
+ rules: {
221
+ scopes: [{ scope: 'project', file: 'AGENTS.md' }],
222
+ style: 'append-section',
223
+ },
224
+ },
225
+ {
226
+ id: 'codex',
227
+ label: 'OpenAI Codex CLI',
228
+ kind: 'cli',
229
+ mcp: {
230
+ scopes: [
231
+ { scope: 'global', file: '~/.codex/config.toml', format: 'toml', serverMapPath: ['mcp_servers'] },
232
+ { scope: 'project', file: '.codex/config.toml', format: 'toml', serverMapPath: ['mcp_servers'] },
233
+ ],
234
+ transports: ['stdio', 'http'],
235
+ entry: entryUrl,
236
+ cliInstaller: (t) => t === 'stdio'
237
+ ? 'codex mcp add devsmind -- devsmind start --stdio'
238
+ : '# Codex: add the [mcp_servers.devsmind] url entry to ~/.codex/config.toml (no CLI flag for remote)',
239
+ note: 'Codex config is TOML. Remote (url) servers must be added by editing config.toml.',
240
+ },
241
+ rules: {
242
+ scopes: [{ scope: 'project', file: 'AGENTS.md' }],
243
+ style: 'append-section',
244
+ },
245
+ },
246
+ {
247
+ id: 'qwen',
248
+ label: 'Qwen Code CLI',
249
+ kind: 'cli',
250
+ mcp: {
251
+ scopes: [
252
+ { scope: 'project', file: '.qwen/settings.json', format: 'json', serverMapPath: ['mcpServers'] },
253
+ { scope: 'global', file: '~/.qwen/settings.json', format: 'json', serverMapPath: ['mcpServers'] },
254
+ ],
255
+ transports: ['stdio', 'http'],
256
+ entry: entryHttpUrl,
257
+ cliInstaller: (t, ctx) => t === 'stdio'
258
+ ? 'qwen mcp add devsmind devsmind start --stdio'
259
+ : `qwen mcp add --transport http devsmind ${httpUrl(ctx)}`,
260
+ note: 'Qwen keys the Streamable-HTTP endpoint as "httpUrl".',
261
+ },
262
+ rules: {
263
+ scopes: [{ scope: 'project', file: 'QWEN.md' }],
264
+ style: 'append-section',
265
+ },
266
+ },
267
+ ];
268
+ function getTarget(id) {
269
+ return exports.TARGETS.find(t => t.id === id);
270
+ }
271
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/cli/integrations/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,gCAEC;AAGD,8BAEC;AAKD,sCAMC;AAMD,4CAMC;AAwND,8B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AE,eAAe;QACtB,IAAI,EAAE,KAAK;QACX,GAAG,EAAE;YACH,MAAM,EAAE;gBACN,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,YAAY,CAAC,EAAE;gBAChG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,YAAY,CAAC,EAAE;aAClG;YACD,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;YAC7B,KAAK,EAAE,YAAY;YACnB,YAAY,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CACvB,CAAC,KAAK,OAAO;gBACX,CAAC,CAAC,8CAA8C;gBAChD,CAAC,CAAC,0CAA0C,OAAO,CAAC,GAAG,CAAC,EAAE;YAC9D,IAAI,EAAE,sDAAsD;SAC7D;QACD,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;YAC/C,KAAK,EAAE,gBAAgB;SACxB;KACF;CACF,CAAC;AAEF,SAAgB,SAAS,CAAC,EAAU;IAClC,OAAO,eAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -1,3 +1,16 @@
1
+ import { DevMindConfig } from '../utils/config';
2
+ /**
3
+ * Build the ready-to-paste DevsMind workspace rule from a project's config.
4
+ * Pure string builder — no I/O — so it can be printed or written to a file.
5
+ */
6
+ export declare function buildRule(config: DevMindConfig, devmindDir: string): string;
7
+ /**
8
+ * `devsmind rule` — print the workspace rule and, interactively, help place it
9
+ * in the chosen tool's native rules file (manual snippet or automatic write).
10
+ * Falls back to plain printing when piped/non-TTY or when `--print` is passed,
11
+ * preserving `devsmind rule > file` usage.
12
+ */
1
13
  export declare function handleRule(opts: {
2
14
  path?: string;
3
- }): void;
15
+ print?: boolean;
16
+ }): Promise<void>;
package/dist/cli/rule.js CHANGED
@@ -33,46 +33,18 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildRule = buildRule;
36
37
  exports.handleRule = handleRule;
37
38
  const fs = __importStar(require("fs"));
38
39
  const path = __importStar(require("path"));
39
- function findDevmindDir(startDir) {
40
- let current = path.resolve(startDir);
41
- while (true) {
42
- const candidate = path.join(current, '.devmind');
43
- if (fs.existsSync(path.join(candidate, 'config.json'))) {
44
- return candidate;
45
- }
46
- const parent = path.dirname(current);
47
- if (parent === current)
48
- return null;
49
- current = parent;
50
- }
51
- }
52
- function handleRule(opts) {
53
- const cwd = process.cwd();
54
- let devmindDir;
55
- if (opts.path) {
56
- const resolved = path.resolve(opts.path);
57
- devmindDir = fs.existsSync(path.join(resolved, 'config.json')) ? resolved : null;
58
- }
59
- else {
60
- devmindDir = findDevmindDir(cwd);
61
- }
62
- if (!devmindDir) {
63
- console.error(`❌ No .devmind directory found.\n` +
64
- ` Run from inside a DevsMind brain folder, or pass --path <devmind_path>.`);
65
- process.exit(1);
66
- }
67
- const configPath = path.join(devmindDir, 'config.json');
68
- let config;
69
- try {
70
- config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
71
- }
72
- catch {
73
- console.error(`❌ Failed to read config.json at ${configPath}`);
74
- process.exit(1);
75
- }
40
+ const config_1 = require("../utils/config");
41
+ const prompt_1 = require("./integrations/prompt");
42
+ const registry_1 = require("./integrations/registry");
43
+ /**
44
+ * Build the ready-to-paste DevsMind workspace rule from a project's config.
45
+ * Pure string builder — no I/O — so it can be printed or written to a file.
46
+ */
47
+ function buildRule(config, devmindDir) {
76
48
  const projectName = config.project_name;
77
49
  const mode = config.mode;
78
50
  const notes = config.notes;
@@ -99,13 +71,20 @@ function handleRule(opts) {
99
71
  '',
100
72
  'Before executing any filesystem search or reading any file contents, you MUST perform this check:',
101
73
  `1. **Am I searching for code/modules/features?** -> You MUST use ${bt}search_nodes${bt} or ${bt}search_code${bt} first. DO NOT start with grep or native filesystem search.`,
102
- `2. **Am I reading a source file?** -> You MUST call ${bt}get_node_code${bt} first to check if a cached snapshot exists. Only read the file directly if the node code is missing or stale.`,
74
+ `2. **Am I reading a source file?** -> You MUST call ${bt}get_node_code${bt} instead. It returns that one function/class parsed live from the file, not the whole file — far cheaper. Only read the raw file if the node genuinely isn't in the graph.`,
75
+ `3. **Am I tracing how something flows through the code?** -> You MUST call ${bt}get_node_graph${bt} with ${bt}direction: "out"${bt} and ${bt}include_code: true${bt}. This returns the entry point PLUS everything it transitively calls, each with its source, in ONE call. Do NOT chain ${bt}get_node_code${bt} calls one function at a time — that wastes a chat turn per function.`,
103
76
  '',
104
- '#### Correct Workflow Example:',
77
+ '#### Correct Workflow Example (single entity):',
105
78
  '* **User asks:** "Explain how rule generation works."',
106
79
  `* **Step 1 (Search):** Call ${bt}search_nodes${bt} with query "rule".`,
107
80
  `* **Step 2 (Get Code):** Call ${bt}get_node_code${bt} with node_id "${bt}{DevMinds}/src/cli/rule.ts#handleRule${bt}".`,
108
- '* **Step 3 (Explain):** Explain the logic using the retrieved code snapshot.',
81
+ '* **Step 3 (Explain):** Explain the logic using the returned code.',
82
+ '',
83
+ '#### Correct Workflow Example (tracing a flow — DO THIS, it is 2 turns not 15):',
84
+ '* **User asks:** "How does an Alipay payment get processed end to end?"',
85
+ `* **Step 1 (Find the entry point):** Call ${bt}search_nodes${bt} with query "alipay".`,
86
+ `* **Step 2 (Pull the whole flow at once):** Call ${bt}get_node_graph${bt} with the entry node_id, ${bt}direction: "out"${bt}, ${bt}include_code: true${bt}, ${bt}max_depth: 3${bt}.`,
87
+ '* **Step 3 (Explain):** You now have every function in the call chain with its code. Explain the flow. Do NOT make further tool calls to fetch code you already have.',
109
88
  '',
110
89
  '### Tool Triggers',
111
90
  '',
@@ -114,7 +93,9 @@ function handleRule(opts) {
114
93
  `| Searching for a module, feature, or concept | ${bt}search_nodes${bt} |`,
115
94
  `| Searching for specific code fragments, variables, or regex patterns | ${bt}search_code${bt} |`,
116
95
  `| Want to list/discover all nodes for a component or directory | ${bt}list_nodes${bt} |`,
117
- `| Need to read the code of a specific function/class | ${bt}get_node_code${bt} |`,
96
+ `| Need to read the code of ONE specific function/class | ${bt}get_node_code${bt} |`,
97
+ `| Tracing a request/feature/flow through MULTIPLE functions | ${bt}get_node_graph${bt} with ${bt}direction:"out"${bt} + ${bt}include_code:true${bt} (ONE call — never chain ${bt}get_node_code${bt}) |`,
98
+ `| Need to know what would break if I change this | ${bt}get_node_graph${bt} with ${bt}direction:"in"${bt} (finds every caller) |`,
118
99
  `| Working on / debugging a specific function or class | ${bt}get_node_summary${bt} → ${bt}get_node_history${bt} → ${bt}get_node_graph${bt} |`,
119
100
  `| After adding/editing code (one file or many) | ${bt}stage_change${bt} once per touched entity, then ${bt}commit_changes${bt} once |`,
120
101
  `| Function/class is renamed | ${bt}rename_node${bt} |`,
@@ -136,8 +117,8 @@ function handleRule(opts) {
136
117
  `3. **No deletions** — never delete nodes. Use ${bt}deprecate_node${bt} to preserve history.`,
137
118
  `4. **Resurrecting nodes** — calling ${bt}stage_change${bt} on a deprecated node automatically re-activates it on the next ${bt}commit_changes${bt}.`,
138
119
  `5. **Search before grep** — use ${bt}search_nodes${bt} or ${bt}search_code${bt} before any filesystem search. If no nodes are found using ${bt}search_nodes${bt}, use the ${bt}list_nodes${bt} tool to see all available nodes in the graph.`,
139
- `6. **Code snapshots populate if missing** — always call ${bt}get_node_code${bt} before reading a source file. If no snapshot exists, read the file, then ${bt}stage_change${bt} + ${bt}commit_changes${bt} with the current code. Do not skip this — it caches the code for all future agents.`,
140
- `7. **Code snapshots refresh if stale** — if you open a source file and notice the stored snapshot differs from the actual file, ${bt}stage_change${bt} + ${bt}commit_changes${bt} with the fresh code before making any changes. Stale snapshots must be corrected first.`,
120
+ `6. **Read code through the graph, not the filesystem** — call ${bt}get_node_code${bt} instead of opening a source file. It parses the node live from disk and returns only that entity, so it is always current AND far cheaper than reading the whole file. If the node isn't in the graph at all, read the file, then ${bt}stage_change${bt} + ${bt}commit_changes${bt} to add it.`,
121
+ `7. **Fix drift when the tools report it** — if ${bt}get_node_code${bt} returns ${bt}snapshot_outdated: true${bt}, the graph has fallen behind the code on disk. Re-record that node with ${bt}stage_change${bt} + ${bt}commit_changes${bt}. If it returns ${bt}source: "cached"${bt}, the symbol could NOT be found in its file — it was likely renamed, moved, or deleted, so the code you got may be wrong. Verify against the file, then ${bt}rename_node${bt} or ${bt}deprecate_node${bt} as appropriate.`,
141
122
  `8. **No external scripts for indexing** — When indexing a repository, NEVER write or run external scripts (like Python, Bash, or Node.js) to automate or lazy load indexing. You must perform the indexing natively step-by-step in the chat using the designated tools: ${bt}index_start${bt}, ${bt}index_checkpoint${bt}, ${bt}index_continue${bt}, and ${bt}index_complete${bt}. This ensures progress is tracked in the SQLite scratchpad database and allows indexing to be safely resumed across chat sessions if context limits are hit.`,
142
123
  `9. **Continuous Indexing** — Once you start the codebase indexing process, do not stop, pause, or ask for user confirmation between checkpoints. Keep executing and indexing files continuously until the workspace is fully indexed, or until the chat session's context token limit is reached.`,
143
124
  `10. **Grow-as-you-go Graph Maintenance (MANDATORY)** — DevsMind is a living code graph and keeping it in sync is a hard requirement, not a nicety. At the end of EVERY task or message where code was added, modified, renamed, or deleted, you MUST record it per the "MANDATORY: Record Every Code Change" section above — ${bt}stage_change${bt} per touched entity then ${bt}commit_changes${bt} once. NEVER finish a turn with un-committed staged changes. If you notice deprecated/stale nodes, clean them up with ${bt}deprecate_node${bt} or ${bt}rename_node${bt}. Do not let the graph go stale.`,
@@ -150,8 +131,8 @@ function handleRule(opts) {
150
131
  `| ${bt}search_code${bt} | Regex or string search over cached codebase code snapshots |`,
151
132
  `| ${bt}list_nodes${bt} | List nodes in the graph with optional filters (type, file path, etc.) |`,
152
133
  `| ${bt}get_node_summary${bt} | Get file location, connection count, history count for a node |`,
153
- `| ${bt}get_node_code${bt} | Get latest stored code snapshot for a node (check before reading file) |`,
154
- `| ${bt}get_node_graph${bt} | See all callers/dependencies of a node up to N levels deep |`,
134
+ `| ${bt}get_node_code${bt} | Get ONE node's current source, parsed live from its file (use instead of reading the file) |`,
135
+ `| ${bt}get_node_graph${bt} | See a node's callers/dependencies. With ${bt}direction:"out"${bt} + ${bt}include_code:true${bt}, returns an entire call flow WITH source code in a single call |`,
155
136
  `| ${bt}get_node_history${bt} | Read all past snapshots and reasoning logs for a node |`,
156
137
  `| ${bt}stage_change${bt} | Buffer one touched node after a code change (code + reasoning only; no edge reasoning) |`,
157
138
  `| ${bt}commit_changes${bt} | Flush all staged changes: create nodes, save history, resolve all connections via AST |`,
@@ -167,7 +148,9 @@ function handleRule(opts) {
167
148
  '',
168
149
  '> All tool argument schemas are exposed automatically by the MCP server.'
169
150
  ];
170
- const rule = lines.filter(l => l !== null).join('\n');
151
+ return lines.filter(l => l !== null).join('\n');
152
+ }
153
+ function printRuleBanner(rule, projectName, tip) {
171
154
  const divider = '═'.repeat(70);
172
155
  console.log(`\n${divider}`);
173
156
  console.log(` DevsMind Workspace Rule — "${projectName}"`);
@@ -175,8 +158,86 @@ function handleRule(opts) {
175
158
  console.log(`${divider}\n`);
176
159
  console.log(rule);
177
160
  console.log(`\n${divider}`);
178
- console.log(` 💡 Tip: save this to .agents/AGENTS.md in your workspace root`);
179
- console.log(` or paste directly into your IDE's AI rules/instructions panel.`);
161
+ if (tip) {
162
+ console.log(tip);
163
+ }
164
+ else {
165
+ console.log(` 💡 Tip: save this to .agents/AGENTS.md in your workspace root`);
166
+ console.log(` or paste directly into your IDE's AI rules/instructions panel.`);
167
+ }
180
168
  console.log(`${divider}\n`);
181
169
  }
170
+ /**
171
+ * `devsmind rule` — print the workspace rule and, interactively, help place it
172
+ * in the chosen tool's native rules file (manual snippet or automatic write).
173
+ * Falls back to plain printing when piped/non-TTY or when `--print` is passed,
174
+ * preserving `devsmind rule > file` usage.
175
+ */
176
+ async function handleRule(opts) {
177
+ const devmindDir = (0, config_1.resolveDevmindDir)(opts.path);
178
+ if (!devmindDir) {
179
+ console.error(`❌ No .devmind directory found.\n` +
180
+ ` Run from inside a DevsMind brain folder, or pass --path <devmind_path>.`);
181
+ process.exit(1);
182
+ }
183
+ const configPath = path.join(devmindDir, 'config.json');
184
+ let config;
185
+ try {
186
+ config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
187
+ }
188
+ catch {
189
+ console.error(`❌ Failed to read config.json at ${configPath}`);
190
+ process.exit(1);
191
+ return;
192
+ }
193
+ const rule = buildRule(config, devmindDir);
194
+ const projectName = config.project_name;
195
+ // Backward-compat: piped/redirected output or explicit --print → plain print.
196
+ if (opts.print || !process.stdout.isTTY) {
197
+ printRuleBanner(rule, projectName);
198
+ return;
199
+ }
200
+ const workspaceRoot = path.dirname(devmindDir);
201
+ try {
202
+ const target = await (0, prompt_1.pickTarget)();
203
+ const mode = await (0, prompt_1.pickMode)();
204
+ if (mode === 'manual') {
205
+ const scope = target.rules.scopes[0];
206
+ const file = (0, registry_1.resolveScopeFile)(scope.file, scope.scope, workspaceRoot);
207
+ const noteFrontmatter = target.rules.wrap
208
+ ? '\n (this file needs frontmatter — automatic mode adds it for you)'
209
+ : '';
210
+ printRuleBanner(rule, projectName, ` 💡 Save this to ${file.replace(/\\/g, '/')}${noteFrontmatter}`);
211
+ return;
212
+ }
213
+ // Automatic mode.
214
+ const scope = await (0, prompt_1.pickRuleScope)(target);
215
+ let filePath;
216
+ if (scope.scope === 'project') {
217
+ const base = await (0, prompt_1.pickDirectory)(workspaceRoot, `Where is the project root for ${target.label}?`);
218
+ filePath = path.join(base, (0, registry_1.resolveOsPath)(scope.file));
219
+ }
220
+ else {
221
+ filePath = (0, registry_1.resolveScopeFile)(scope.file, 'global', workspaceRoot);
222
+ }
223
+ const merged = (0, prompt_1.mergeRuleFile)(filePath, rule, target.rules.style, target.rules.wrap);
224
+ console.log(`\n📝 Target: ${filePath.replace(/\\/g, '/')} (${merged.existed ? (target.rules.style === 'append-section' ? 'merge DevsMind block into existing' : 'overwrite dedicated file') : 'create new'})`);
225
+ console.log(`\n${target.rules.style === 'append-section' ? 'The DevsMind block to be written:' : 'File contents to be written:'}\n`);
226
+ console.log(merged.preview.split('\n').map(l => ' ' + l).join('\n'));
227
+ const ok = await (0, prompt_1.confirmPrompt)('Write this?', true);
228
+ if (!ok) {
229
+ console.log('\nAborted — nothing written.');
230
+ return;
231
+ }
232
+ (0, prompt_1.writeConfigFile)(filePath, merged.content);
233
+ console.log(`\n✅ DevsMind rule written to ${filePath.replace(/\\/g, '/')} for ${target.label}.`);
234
+ }
235
+ catch (err) {
236
+ if (err instanceof prompt_1.CancelledError) {
237
+ console.log('\nCancelled.');
238
+ return;
239
+ }
240
+ throw err;
241
+ }
242
+ }
182
243
  //# sourceMappingURL=rule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/cli/rule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,gCA6IC;AA9JD,uCAAyB;AACzB,2CAA6B;AAG7B,SAAS,cAAc,CAAC,QAAgB;IACtC,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC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AAM,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,gCAAgC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IACnG,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,uBAAc,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `devsmind sync` — force the on-disk graph (`graph/**`) and history
3
+ * (`history/*.json`) into the local `brain.db`.
4
+ *
5
+ * Under `--stdio` (VS Code and other IDE-managed setups) the MCP process is
6
+ * spawned by the editor and never serves the HTTP routes that would otherwise
7
+ * trigger a sync, and the DB's constructor-time `syncFromDisk()` only runs once
8
+ * per process. So after a `git pull` the committed graph changes never reach the
9
+ * local DB without a restart. This command applies them on demand.
10
+ */
11
+ export declare function handleSync(opts: {
12
+ path?: string;
13
+ }): Promise<void>;