mcp-task-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,317 @@
1
+ # MCP Task Server
2
+
3
+ A Model Context Protocol (MCP) server for task management with multi-agent coordination. Designed for use with Cursor IDE and other MCP-compatible AI tools.
4
+
5
+ ## Features
6
+
7
+ - **Task Management**: Create, update, complete, and track tasks
8
+ - **Multi-Agent Coordination**: Support for Planner, Worker, and Judge roles
9
+ - **Dependency Tracking**: Tasks can depend on other tasks
10
+ - **Priority Levels**: Critical, High, Medium, Low
11
+ - **Scalable Storage**: Individual task files with JSON registry and markdown summary
12
+ - **Prompt-Based Operations**: PRD parsing, task expansion, complexity analysis
13
+ - **Shared Context**: Reads user preferences from `~/.cursor/shared-context.json` to personalise prompts
14
+ - **Project Initialization**: Scaffolds agent-kit, memory_bank, and cursor rules
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ # Add to a new project and initialize
20
+ init_project({ project_name: "my-app" })
21
+
22
+ # Add your first task
23
+ add_task({ title: "Set up development environment" })
24
+
25
+ # Get recommended next task
26
+ next_task()
27
+ ```
28
+
29
+ ## Shared Context
30
+
31
+ The server reads `~/.cursor/shared-context.json` for user preferences (writing style, identity, workflow) and includes them in generated prompts. This bridges the gap between Cursor's memory system and isolated MCP servers.
32
+
33
+ ### Compliance Checking
34
+
35
+ Validate files against your preferences:
36
+
37
+ ```typescript
38
+ // Review only
39
+ check_compliance({ path: "README.md" })
40
+
41
+ // Review a folder
42
+ check_compliance({ path: "docs/" })
43
+
44
+ // Review and fix issues
45
+ check_compliance({ path: "README.md", fix: true })
46
+ ```
47
+
48
+ See [agent-kit/SHARED_CONTEXT.md](agent-kit/SHARED_CONTEXT.md) for full setup and usage.
49
+
50
+ ## Installation
51
+
52
+ ### Via npx (recommended)
53
+
54
+ ```bash
55
+ npx mcp-task-server
56
+ ```
57
+
58
+ ### Global Install
59
+
60
+ ```bash
61
+ npm install -g mcp-task-server
62
+ mcp-task-server
63
+ ```
64
+
65
+ ### From Source
66
+
67
+ ```bash
68
+ git clone https://github.com/yourusername/mcp-task-server.git
69
+ cd mcp-task-server
70
+ npm install
71
+ npm run build
72
+ npm start
73
+ ```
74
+
75
+ ## Cursor IDE Integration
76
+
77
+ Add to your `.cursor/mcp.json`:
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "task-server": {
83
+ "command": "npx",
84
+ "args": ["-y", "mcp-task-server"],
85
+ "cwd": "/path/to/your/project"
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ The `cwd` parameter sets the workspace root where task files will be stored.
92
+
93
+ ## Configuration
94
+
95
+ Configure via environment variables:
96
+
97
+ | Variable | Default | Description |
98
+ |----------|---------|-------------|
99
+ | `TASK_MD_PATH` | `memory_bank/execution/progress.md` | Path to markdown summary |
100
+ | `TASK_JSON_PATH` | `memory_bank/tasks/tasks.json` | Path to JSON registry |
101
+ | `TASK_DIR` | `memory_bank/tasks` | Directory for task files |
102
+
103
+ ## Storage Architecture
104
+
105
+ The server uses a scalable storage model with three layers:
106
+
107
+ ### 1. JSON Registry (`memory_bank/tasks/tasks.json`)
108
+
109
+ Machine-readable source of truth containing task IDs, status, dependencies, and subtasks.
110
+
111
+ ```json
112
+ {
113
+ "version": "2.0.0",
114
+ "tasks": [
115
+ {
116
+ "id": "1",
117
+ "title": "Project Setup",
118
+ "status": "done",
119
+ "priority": "high",
120
+ "subtasks": [
121
+ { "id": 1, "title": "Init project", "status": "done" }
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+ ```
127
+
128
+ ### 2. Task Files (`memory_bank/tasks/task_XXX.txt`)
129
+
130
+ Human-readable detailed task files for each top-level task:
131
+
132
+ ```
133
+ # Task ID: 1
134
+ # Title: Project Setup and Configuration
135
+ # Status: done
136
+ # Dependencies: None
137
+ # Priority: high
138
+ # Description: Initialize the project with required tooling.
139
+ # Details:
140
+ Full implementation details here...
141
+
142
+ # Subtasks:
143
+ ## 1. Init project [done]
144
+ ### Dependencies: None
145
+ ### Description: Create initial project structure
146
+ ```
147
+
148
+ ### 3. Progress Summary (`memory_bank/execution/progress.md`)
149
+
150
+ High-level overview auto-generated from tasks.json:
151
+
152
+ ```markdown
153
+ # Implementation Progress
154
+
155
+ ## Task Completion Summary
156
+
157
+ ### Completed Tasks (3/5)
158
+ - ✅ Task 1: Project Setup
159
+ - ✅ Task 2: Database Schema
160
+ ```
161
+
162
+ This architecture scales well for complex projects with many tasks and subtasks.
163
+
164
+ ## Tools
165
+
166
+ ### Project Initialization
167
+
168
+ | Tool | Description |
169
+ |------|-------------|
170
+ | `init_project` | Initialize project with agent-kit, memory_bank, and cursor rules |
171
+
172
+ ```typescript
173
+ // Initialize with auto-detected project name
174
+ init_project()
175
+
176
+ // Initialize with custom name
177
+ init_project({ project_name: "my-app" })
178
+
179
+ // Force overwrite existing files
180
+ init_project({ force: true })
181
+ ```
182
+
183
+ ### Core Tools
184
+
185
+ | Tool | Description |
186
+ |------|-------------|
187
+ | `list_tasks` | List all tasks, optionally filtered by status or assignee |
188
+ | `get_task` | Get a specific task by ID with subtasks |
189
+ | `add_task` | Create a new task |
190
+ | `update_task` | Update task title, description, status, priority, or metadata |
191
+ | `complete_task` | Mark a task as completed |
192
+ | `next_task` | Get the next recommended task based on priority/dependencies |
193
+
194
+ ### Multi-Agent Coordination
195
+
196
+ | Tool | Description |
197
+ |------|-------------|
198
+ | `claim_task` | Claim a task for the calling agent |
199
+ | `release_task` | Release a claimed task |
200
+ | `handoff_task` | Transfer task to another role |
201
+ | `review_task` | Review a task (Judge role) |
202
+ | `approve_task` | Approve completed task (Judge role) |
203
+ | `reject_task` | Reject with feedback (Judge role) |
204
+
205
+ ### Task Breakdown
206
+
207
+ | Tool | Description |
208
+ |------|-------------|
209
+ | `expand_task` | Get prompt to break task into subtasks |
210
+ | `add_subtask` | Add a subtask to existing task |
211
+ | `set_dependencies` | Set task dependencies |
212
+ | `remove_task` | Remove a task |
213
+
214
+ ### Prompt-Based Tools
215
+
216
+ | Tool | Description |
217
+ |------|-------------|
218
+ | `parse_prd` | Get prompt to parse PRD into tasks |
219
+ | `research_task` | Get prompt to research a task |
220
+ | `analyze_complexity` | Get prompt to analyze task complexity |
221
+ | `check_compliance` | Check file/folder against user preferences from shared context |
222
+
223
+ ## Multi-Agent Mode
224
+
225
+ The server supports three agent roles:
226
+
227
+ ### Planner
228
+ - Creates and organizes tasks
229
+ - Sets dependencies and priorities
230
+ - Analyzes complexity
231
+ - Cannot execute tasks
232
+
233
+ ### Worker
234
+ - Claims and executes tasks
235
+ - Updates progress
236
+ - Adds subtasks during implementation
237
+ - Cannot create top-level tasks
238
+
239
+ ### Judge
240
+ - Reviews completed work
241
+ - Approves or rejects with feedback
242
+ - Cannot claim or modify tasks
243
+
244
+ ### Usage
245
+
246
+ ```typescript
247
+ // Solo mode (no role required)
248
+ add_task({ title: "Build login page" })
249
+
250
+ // Multi-agent mode (explicit identification)
251
+ add_task({
252
+ title: "Build login page",
253
+ description: "Create a secure login page with form validation",
254
+ agent_id: "planner-1",
255
+ role: "planner"
256
+ })
257
+
258
+ claim_task({
259
+ task_id: "5",
260
+ agent_id: "worker-1",
261
+ role: "worker"
262
+ })
263
+ ```
264
+
265
+ ## Project Structure
266
+
267
+ After running `init_project`:
268
+
269
+ ```
270
+ your-project/
271
+ ├── agent-kit/
272
+ │ ├── AGENT_RULES.md # Role definitions and permissions
273
+ │ ├── TASKS.md # Task reference (points to memory_bank)
274
+ │ ├── HANDOFF.md # Handoff protocol reference
275
+ │ └── SHARED_CONTEXT.md # Shared context documentation
276
+ ├── memory_bank/
277
+ │ ├── context/
278
+ │ │ ├── brief.md # Project overview
279
+ │ │ └── active.md # Current focus
280
+ │ ├── execution/
281
+ │ │ ├── progress.md # Task summary (auto-synced)
282
+ │ │ └── decisions.md # Decision log
283
+ │ └── tasks/
284
+ │ ├── tasks.json # Task registry (source of truth)
285
+ │ ├── task_001.txt # Detailed task file
286
+ │ ├── task_002.txt # ...
287
+ │ └── ...
288
+ └── .cursor/
289
+ └── rules/
290
+ └── agent-workflow.mdc # Cursor agent rules
291
+ ```
292
+
293
+ ## Migration from v1.x
294
+
295
+ If you have existing `.taskmaster/tasks.json`:
296
+
297
+ 1. Run any task command (e.g., `list_tasks`)
298
+ 2. The server auto-migrates to `memory_bank/tasks/`
299
+ 3. Individual task files are generated
300
+ 4. Progress summary is updated
301
+
302
+ ## Development
303
+
304
+ ```bash
305
+ # Install dependencies
306
+ npm install
307
+
308
+ # Build
309
+ npm run build
310
+
311
+ # Watch mode
312
+ npm run dev
313
+ ```
314
+
315
+ ## License
316
+
317
+ MIT
@@ -0,0 +1,25 @@
1
+ import { Agent, AgentRole, TaskStore } from "./types.js";
2
+ /**
3
+ * Check if an agent role has permission for a tool
4
+ */
5
+ export declare function hasPermission(role: AgentRole | undefined, tool: string): boolean;
6
+ /**
7
+ * Get or create an agent in the store
8
+ */
9
+ export declare function getOrCreateAgent(store: TaskStore, agentId: string, role: AgentRole): Agent;
10
+ /**
11
+ * Validate that an agent can perform an action on a task
12
+ */
13
+ export declare function canActOnTask(store: TaskStore, taskId: string, agentId: string | undefined, action: "update" | "complete" | "release"): {
14
+ allowed: boolean;
15
+ reason?: string;
16
+ };
17
+ /**
18
+ * Get the default agent ID for solo mode
19
+ */
20
+ export declare function getDefaultAgentId(): string;
21
+ /**
22
+ * Get the default role for solo mode
23
+ */
24
+ export declare function getDefaultRole(): AgentRole;
25
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAqCzD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,IAAI,EAAE,MAAM,GACX,OAAO,CAKT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,GACd,KAAK,CAcP;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GACxC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,SAAS,CAE1C"}
package/dist/agents.js ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Permission matrix for agent roles
3
+ */
4
+ const ROLE_PERMISSIONS = {
5
+ planner: new Set([
6
+ "list_tasks",
7
+ "get_task",
8
+ "add_task",
9
+ "expand_task",
10
+ "parse_prd",
11
+ "set_dependencies",
12
+ "analyze_complexity",
13
+ "remove_task",
14
+ ]),
15
+ worker: new Set([
16
+ "list_tasks",
17
+ "get_task",
18
+ "next_task",
19
+ "claim_task",
20
+ "update_task",
21
+ "complete_task",
22
+ "add_subtask",
23
+ "research_task",
24
+ "release_task",
25
+ "handoff_task",
26
+ ]),
27
+ judge: new Set([
28
+ "list_tasks",
29
+ "get_task",
30
+ "review_task",
31
+ "approve_task",
32
+ "reject_task",
33
+ ]),
34
+ };
35
+ /**
36
+ * Check if an agent role has permission for a tool
37
+ */
38
+ export function hasPermission(role, tool) {
39
+ // Solo mode - no role specified, allow everything
40
+ if (!role)
41
+ return true;
42
+ return ROLE_PERMISSIONS[role]?.has(tool) ?? false;
43
+ }
44
+ /**
45
+ * Get or create an agent in the store
46
+ */
47
+ export function getOrCreateAgent(store, agentId, role) {
48
+ let agent = store.agents.find((a) => a.id === agentId);
49
+ if (!agent) {
50
+ agent = {
51
+ id: agentId,
52
+ role,
53
+ registered_at: new Date().toISOString(),
54
+ };
55
+ store.agents.push(agent);
56
+ }
57
+ agent.last_seen = new Date().toISOString();
58
+ return agent;
59
+ }
60
+ /**
61
+ * Validate that an agent can perform an action on a task
62
+ */
63
+ export function canActOnTask(store, taskId, agentId, action) {
64
+ const task = store.tasks.find((t) => t.id === taskId);
65
+ if (!task) {
66
+ return { allowed: false, reason: "Task not found" };
67
+ }
68
+ // Solo mode - no agent specified
69
+ if (!agentId) {
70
+ return { allowed: true };
71
+ }
72
+ // Check ownership for modification actions
73
+ if (task.assigned_to && task.assigned_to !== agentId) {
74
+ return {
75
+ allowed: false,
76
+ reason: `Task is assigned to ${task.assigned_to}`,
77
+ };
78
+ }
79
+ return { allowed: true };
80
+ }
81
+ /**
82
+ * Get the default agent ID for solo mode
83
+ */
84
+ export function getDefaultAgentId() {
85
+ return "default-worker";
86
+ }
87
+ /**
88
+ * Get the default role for solo mode
89
+ */
90
+ export function getDefaultRole() {
91
+ return "worker";
92
+ }
93
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,gBAAgB,GAAmC;IACvD,OAAO,EAAE,IAAI,GAAG,CAAC;QACf,YAAY;QACZ,UAAU;QACV,UAAU;QACV,aAAa;QACb,WAAW;QACX,kBAAkB;QAClB,oBAAoB;QACpB,aAAa;KACd,CAAC;IACF,MAAM,EAAE,IAAI,GAAG,CAAC;QACd,YAAY;QACZ,UAAU;QACV,WAAW;QACX,YAAY;QACZ,aAAa;QACb,eAAe;QACf,aAAa;QACb,eAAe;QACf,cAAc;QACd,cAAc;KACf,CAAC;IACF,KAAK,EAAE,IAAI,GAAG,CAAC;QACb,YAAY;QACZ,UAAU;QACV,aAAa;QACb,cAAc;QACd,aAAa;KACd,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,IAA2B,EAC3B,IAAY;IAEZ,kDAAkD;IAClD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAgB,EAChB,OAAe,EACf,IAAe;IAEf,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IAEvD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG;YACN,EAAE,EAAE,OAAO;YACX,IAAI;YACJ,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACxC,CAAC;QACF,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAgB,EAChB,MAAc,EACd,OAA2B,EAC3B,MAAyC;IAEzC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IAEtD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IACtD,CAAC;IAED,iCAAiC;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED,2CAA2C;IAC3C,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,uBAAuB,IAAI,CAAC,WAAW,EAAE;SAClD,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Config } from "./types.js";
2
+ /**
3
+ * Get configuration from environment variables with sensible defaults
4
+ */
5
+ export declare function getConfig(): Config;
6
+ /**
7
+ * Resolve a path relative to the workspace root
8
+ */
9
+ export declare function resolvePath(config: Config, relativePath: string): string;
10
+ /**
11
+ * Get the path for an individual task file
12
+ */
13
+ export declare function getTaskFilePath(config: Config, taskId: string): string;
14
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAQlC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAKxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGtE"}
package/dist/config.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Get configuration from environment variables with sensible defaults
3
+ */
4
+ export function getConfig() {
5
+ return {
6
+ markdownPath: process.env.TASK_MD_PATH || "memory_bank/execution/progress.md",
7
+ jsonPath: process.env.TASK_JSON_PATH || "memory_bank/tasks/tasks.json",
8
+ tasksDir: process.env.TASK_DIR || "memory_bank/tasks",
9
+ workspaceRoot: process.cwd(),
10
+ };
11
+ }
12
+ /**
13
+ * Resolve a path relative to the workspace root
14
+ */
15
+ export function resolvePath(config, relativePath) {
16
+ if (relativePath.startsWith("/")) {
17
+ return relativePath;
18
+ }
19
+ return `${config.workspaceRoot}/${relativePath}`;
20
+ }
21
+ /**
22
+ * Get the path for an individual task file
23
+ */
24
+ export function getTaskFilePath(config, taskId) {
25
+ const paddedId = taskId.padStart(3, "0");
26
+ return resolvePath(config, `${config.tasksDir}/task_${paddedId}.txt`);
27
+ }
28
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,YAAY,EACV,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,mCAAmC;QACjE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,8BAA8B;QACtE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,mBAAmB;QACrD,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE;KAC7B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,YAAoB;IAC9D,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,aAAa,IAAI,YAAY,EAAE,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,MAAc;IAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzC,OAAO,WAAW,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,SAAS,QAAQ,MAAM,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,38 @@
1
+ export interface CursorMemory {
2
+ id: string;
3
+ title: string;
4
+ content: string;
5
+ }
6
+ export interface SharedContext {
7
+ cursor_memories: CursorMemory[];
8
+ }
9
+ /**
10
+ * Load shared context from ~/.cursor/shared-context.json
11
+ * Caches the result for subsequent calls
12
+ */
13
+ export declare function loadSharedContext(): SharedContext | null;
14
+ /**
15
+ * Find a memory by partial title match (case-insensitive)
16
+ */
17
+ export declare function getMemoryByTitle(title: string): CursorMemory | undefined;
18
+ /**
19
+ * Get all memories as a formatted string for prompts
20
+ */
21
+ export declare function getAllMemoriesForPrompt(): string | null;
22
+ /**
23
+ * Get writing preferences from shared context
24
+ */
25
+ export declare function getWritingPreferences(): string | null;
26
+ /**
27
+ * Get user identity/values from shared context
28
+ */
29
+ export declare function getUserIdentity(): string | null;
30
+ /**
31
+ * Get workflow preferences from shared context
32
+ */
33
+ export declare function getWorkflowPreferences(): string | null;
34
+ /**
35
+ * Clear the cached context (useful for testing or reloading)
36
+ */
37
+ export declare function clearContextCache(): void;
38
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,YAAY,EAAE,CAAC;CACjC;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,IAAI,CAgBxD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAKxE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAOvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAGrD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAI/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAGtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -0,0 +1,70 @@
1
+ import { homedir } from "os";
2
+ import { join } from "path";
3
+ import { existsSync, readFileSync } from "fs";
4
+ let cachedContext = null;
5
+ /**
6
+ * Load shared context from ~/.cursor/shared-context.json
7
+ * Caches the result for subsequent calls
8
+ */
9
+ export function loadSharedContext() {
10
+ if (cachedContext)
11
+ return cachedContext;
12
+ const contextPath = join(homedir(), ".cursor", "shared-context.json");
13
+ if (!existsSync(contextPath)) {
14
+ return null;
15
+ }
16
+ try {
17
+ cachedContext = JSON.parse(readFileSync(contextPath, "utf-8"));
18
+ return cachedContext;
19
+ }
20
+ catch {
21
+ // Failed to parse shared-context.json - continue without it
22
+ return null;
23
+ }
24
+ }
25
+ /**
26
+ * Find a memory by partial title match (case-insensitive)
27
+ */
28
+ export function getMemoryByTitle(title) {
29
+ const ctx = loadSharedContext();
30
+ return ctx?.cursor_memories?.find((m) => m.title.toLowerCase().includes(title.toLowerCase()));
31
+ }
32
+ /**
33
+ * Get all memories as a formatted string for prompts
34
+ */
35
+ export function getAllMemoriesForPrompt() {
36
+ const ctx = loadSharedContext();
37
+ if (!ctx?.cursor_memories?.length)
38
+ return null;
39
+ return ctx.cursor_memories
40
+ .map((m) => `**${m.title}**: ${m.content}`)
41
+ .join("\n\n");
42
+ }
43
+ /**
44
+ * Get writing preferences from shared context
45
+ */
46
+ export function getWritingPreferences() {
47
+ const memory = getMemoryByTitle("writing preferences");
48
+ return memory?.content || null;
49
+ }
50
+ /**
51
+ * Get user identity/values from shared context
52
+ */
53
+ export function getUserIdentity() {
54
+ const memory = getMemoryByTitle("identity") || getMemoryByTitle("values");
55
+ return memory?.content || null;
56
+ }
57
+ /**
58
+ * Get workflow preferences from shared context
59
+ */
60
+ export function getWorkflowPreferences() {
61
+ const memory = getMemoryByTitle("workflow") || getMemoryByTitle("memory bank");
62
+ return memory?.content || null;
63
+ }
64
+ /**
65
+ * Clear the cached context (useful for testing or reloading)
66
+ */
67
+ export function clearContextCache() {
68
+ cachedContext = null;
69
+ }
70
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAY9C,IAAI,aAAa,GAAyB,IAAI,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,aAAa;QAAE,OAAO,aAAa,CAAC;IAExC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEtE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAC/D,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,OAAO,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACtC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CACpD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAE/C,OAAO,GAAG,CAAC,eAAe;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;SAC1C,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IACvD,OAAO,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GACV,gBAAgB,CAAC,UAAU,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC/E,OAAO,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}