@polka-codes/cli 0.9.98 → 0.9.99
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/dist/index.js +35 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112338,7 +112338,7 @@ var {
|
|
|
112338
112338
|
Help
|
|
112339
112339
|
} = import__.default;
|
|
112340
112340
|
// package.json
|
|
112341
|
-
var version = "0.9.
|
|
112341
|
+
var version = "0.9.99";
|
|
112342
112342
|
|
|
112343
112343
|
// src/commands/agent.ts
|
|
112344
112344
|
init_src();
|
|
@@ -120125,10 +120125,12 @@ init_code_workflow();
|
|
|
120125
120125
|
init_fix_workflow();
|
|
120126
120126
|
init_plan_workflow();
|
|
120127
120127
|
init_review_workflow();
|
|
120128
|
-
var memoryStoreCache =
|
|
120129
|
-
async function getMemoryStore(logger) {
|
|
120130
|
-
|
|
120131
|
-
|
|
120128
|
+
var memoryStoreCache = new Map;
|
|
120129
|
+
async function getMemoryStore(logger, projectPath) {
|
|
120130
|
+
const normalizedPath = path11.resolve(projectPath).split(path11.sep).join("/");
|
|
120131
|
+
const cached2 = memoryStoreCache.get(normalizedPath);
|
|
120132
|
+
if (cached2) {
|
|
120133
|
+
return cached2;
|
|
120132
120134
|
}
|
|
120133
120135
|
try {
|
|
120134
120136
|
const globalConfigPath = getGlobalConfigPath();
|
|
@@ -120137,20 +120139,20 @@ async function getMemoryStore(logger) {
|
|
|
120137
120139
|
if (!memoryConfig.enabled || memoryConfig.type === "memory") {
|
|
120138
120140
|
return null;
|
|
120139
120141
|
}
|
|
120140
|
-
const
|
|
120141
|
-
const scope = detectProjectScope(cwd);
|
|
120142
|
+
const scope = `project:${normalizedPath}`;
|
|
120142
120143
|
const dbPath = memoryConfig.path || DEFAULT_MEMORY_CONFIG.path;
|
|
120143
120144
|
const resolvedDbPath = path11.resolve(resolveHomePath(dbPath));
|
|
120144
120145
|
const sqliteStore = new SQLiteMemoryStore({ enabled: true, type: "sqlite", path: resolvedDbPath }, scope);
|
|
120145
120146
|
const memoryManager = new MemoryManager(sqliteStore);
|
|
120146
|
-
|
|
120147
|
+
const store = {
|
|
120147
120148
|
store: memoryManager,
|
|
120148
120149
|
close: () => {
|
|
120149
120150
|
sqliteStore.close();
|
|
120150
|
-
memoryStoreCache
|
|
120151
|
+
memoryStoreCache.delete(normalizedPath);
|
|
120151
120152
|
}
|
|
120152
120153
|
};
|
|
120153
|
-
|
|
120154
|
+
memoryStoreCache.set(normalizedPath, store);
|
|
120155
|
+
return store;
|
|
120154
120156
|
} catch (error48) {
|
|
120155
120157
|
logger.error(`Failed to initialize memory store: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
120156
120158
|
return null;
|
|
@@ -120534,16 +120536,18 @@ Memory persists across tool calls, allowing you to maintain context
|
|
|
120534
120536
|
between different operations.
|
|
120535
120537
|
|
|
120536
120538
|
Parameters:
|
|
120539
|
+
- project (required): Absolute path to the project directory. This isolates memory to a specific project.
|
|
120537
120540
|
- topic (optional): The memory topic to read from. Defaults to ":default:" which stores general conversation context.
|
|
120538
120541
|
|
|
120539
120542
|
Returns the content stored in the specified topic, or a message indicating the topic is empty.`,
|
|
120540
120543
|
inputSchema: exports_external.object({
|
|
120544
|
+
project: exports_external.string().describe('Absolute path to the project directory (e.g., "/home/user/my-project")'),
|
|
120541
120545
|
topic: exports_external.string().optional().describe('The memory topic to read from (defaults to ":default:")')
|
|
120542
120546
|
}),
|
|
120543
120547
|
handler: async (args, toolContext) => {
|
|
120544
|
-
const { topic = ":default:" } = args;
|
|
120545
|
-
toolContext.logger.info(`MCP: Reading from memory topic "${topic}"`);
|
|
120546
|
-
const memoryStore = await getMemoryStore(toolContext.logger);
|
|
120548
|
+
const { project, topic = ":default:" } = args;
|
|
120549
|
+
toolContext.logger.info(`MCP: Reading from memory topic "${topic}" for project "${project}"`);
|
|
120550
|
+
const memoryStore = await getMemoryStore(toolContext.logger, project);
|
|
120547
120551
|
if (!memoryStore) {
|
|
120548
120552
|
return "Error: Memory store is not enabled. Configure it in your .polkacodes.yml with memory.enabled: true";
|
|
120549
120553
|
}
|
|
@@ -120567,6 +120571,7 @@ Memory persists across tool calls, allowing you to maintain context
|
|
|
120567
120571
|
between different operations.
|
|
120568
120572
|
|
|
120569
120573
|
Parameters:
|
|
120574
|
+
- project (required): Absolute path to the project directory. This isolates memory to a specific project.
|
|
120570
120575
|
- operation (required): The operation to perform. Use "append" to add content, "replace" to overwrite all content, or "remove" to delete the topic.
|
|
120571
120576
|
- topics (optional): Array of topic names for batch operations. Content can be an array (one per topic) or a single string (broadcast to all topics).
|
|
120572
120577
|
- topic (optional): Single memory topic to update. Defaults to ":default:".
|
|
@@ -120578,6 +120583,7 @@ Supports wildcards in topic name for remove operation:
|
|
|
120578
120583
|
|
|
120579
120584
|
Returns a message confirming the operation performed.`,
|
|
120580
120585
|
inputSchema: exports_external.object({
|
|
120586
|
+
project: exports_external.string().describe('Absolute path to the project directory (e.g., "/home/user/my-project")'),
|
|
120581
120587
|
operation: exports_external.enum(["append", "replace", "remove"]).describe("The operation: append (add content), replace (overwrite), or remove (delete topic(s))"),
|
|
120582
120588
|
topic: exports_external.string().optional().describe('Single memory topic to update (defaults to ":default:")'),
|
|
120583
120589
|
topics: exports_external.array(exports_external.string()).min(1).optional().describe("Array of topics for batch operations"),
|
|
@@ -120598,13 +120604,14 @@ Returns a message confirming the operation performed.`,
|
|
|
120598
120604
|
}),
|
|
120599
120605
|
handler: async (args, toolContext) => {
|
|
120600
120606
|
const {
|
|
120607
|
+
project,
|
|
120601
120608
|
operation,
|
|
120602
120609
|
topic: singleTopic,
|
|
120603
120610
|
topics,
|
|
120604
120611
|
content: contentInput
|
|
120605
120612
|
} = args;
|
|
120606
|
-
toolContext.logger.info(`MCP: Memory operation "${operation}" on ${topics ? `${topics.length} topics` : `topic "${singleTopic}"`}`);
|
|
120607
|
-
const memoryStore = await getMemoryStore(toolContext.logger);
|
|
120613
|
+
toolContext.logger.info(`MCP: Memory operation "${operation}" on ${topics ? `${topics.length} topics` : `topic "${singleTopic}"`} for project "${project}"`);
|
|
120614
|
+
const memoryStore = await getMemoryStore(toolContext.logger, project);
|
|
120608
120615
|
if (!memoryStore) {
|
|
120609
120616
|
return "Error: Memory store is not enabled. Configure it in your .polkacodes.yml with memory.enabled: true";
|
|
120610
120617
|
}
|
|
@@ -120674,23 +120681,21 @@ Use this to see what information has been stored and which topics are
|
|
|
120674
120681
|
available to read from. Returns a list of topic names that have content.
|
|
120675
120682
|
|
|
120676
120683
|
Parameters:
|
|
120677
|
-
-
|
|
120678
|
-
-
|
|
120684
|
+
- project (required): Absolute path to the project directory. This isolates memory to a specific project.
|
|
120685
|
+
- pattern (optional): Filter topics by wildcard pattern (e.g., ":plan:*" for all plan topics)`,
|
|
120679
120686
|
inputSchema: exports_external.object({
|
|
120680
|
-
|
|
120681
|
-
|
|
120687
|
+
project: exports_external.string().describe('Absolute path to the project directory (e.g., "/home/user/my-project")'),
|
|
120688
|
+
pattern: exports_external.string().optional().describe('Filter topics by wildcard pattern (e.g., ":plan:*")')
|
|
120682
120689
|
}),
|
|
120683
120690
|
handler: async (args, toolContext) => {
|
|
120684
|
-
const {
|
|
120685
|
-
toolContext.logger.info(`MCP: Listing memory topics${pattern ? ` with pattern "${pattern}"` : ""}`);
|
|
120686
|
-
const memoryStore = await getMemoryStore(toolContext.logger);
|
|
120691
|
+
const { project, pattern } = args;
|
|
120692
|
+
toolContext.logger.info(`MCP: Listing memory topics for project "${project}"${pattern ? ` with pattern "${pattern}"` : ""}`);
|
|
120693
|
+
const memoryStore = await getMemoryStore(toolContext.logger, project);
|
|
120687
120694
|
if (!memoryStore) {
|
|
120688
120695
|
return "Error: Memory store is not enabled. Configure it in your .polkacodes.yml with memory.enabled: true";
|
|
120689
120696
|
}
|
|
120690
120697
|
try {
|
|
120691
|
-
const
|
|
120692
|
-
query.scope = scope ?? "auto";
|
|
120693
|
-
const entries = await memoryStore.store.queryMemory(query, { operation: "select" });
|
|
120698
|
+
const entries = await memoryStore.store.queryMemory({}, { operation: "select" });
|
|
120694
120699
|
if (!entries || !Array.isArray(entries) || entries.length === 0) {
|
|
120695
120700
|
return "No memory topics found.";
|
|
120696
120701
|
}
|
|
@@ -120718,42 +120723,41 @@ Use this to search memory entries by content, metadata, or other criteria.
|
|
|
120718
120723
|
Returns detailed entry information with metadata.
|
|
120719
120724
|
|
|
120720
120725
|
Parameters:
|
|
120726
|
+
- project (required): Absolute path to the project directory. This isolates memory to a specific project.
|
|
120721
120727
|
- search (optional): Search text to find in content
|
|
120722
120728
|
- type (optional): Filter by entry type (note, todo, plan, etc.)
|
|
120723
120729
|
- status (optional): Filter by status (open, completed, closed, etc.)
|
|
120724
120730
|
- priority (optional): Filter by priority (null, low, medium, high)
|
|
120725
120731
|
- tags (optional): Filter by tags
|
|
120726
|
-
- scope (optional): Filter by scope ("auto", "project", or "global")
|
|
120727
120732
|
- operation (optional): Query operation - "select" returns entries, "count" returns count
|
|
120728
120733
|
|
|
120729
120734
|
Returns matching entries with full metadata.`,
|
|
120730
120735
|
inputSchema: exports_external.object({
|
|
120736
|
+
project: exports_external.string().describe('Absolute path to the project directory (e.g., "/home/user/my-project")'),
|
|
120731
120737
|
search: exports_external.string().optional().describe("Search text to find in content"),
|
|
120732
120738
|
type: exports_external.string().optional().describe("Filter by entry type (note, todo, plan, etc.)"),
|
|
120733
120739
|
status: exports_external.string().optional().describe("Filter by status (open, completed, closed, etc.)"),
|
|
120734
120740
|
priority: exports_external.string().optional().describe("Filter by priority (null, low, medium, high)"),
|
|
120735
120741
|
tags: exports_external.string().optional().describe("Filter by tags"),
|
|
120736
|
-
scope: exports_external.enum(["auto", "project", "global"]).optional().describe('Filter by scope (defaults to "auto")'),
|
|
120737
120742
|
operation: exports_external.enum(["select", "count"]).optional().describe('Query operation (defaults to "select")')
|
|
120738
120743
|
}),
|
|
120739
120744
|
handler: async (args, toolContext) => {
|
|
120740
120745
|
const {
|
|
120746
|
+
project,
|
|
120741
120747
|
search,
|
|
120742
120748
|
type,
|
|
120743
120749
|
status,
|
|
120744
120750
|
priority,
|
|
120745
120751
|
tags,
|
|
120746
|
-
scope,
|
|
120747
120752
|
operation = "select"
|
|
120748
120753
|
} = args;
|
|
120749
|
-
toolContext.logger.info(`MCP: Querying memory - operation: "${operation}"`);
|
|
120750
|
-
const memoryStore = await getMemoryStore(toolContext.logger);
|
|
120754
|
+
toolContext.logger.info(`MCP: Querying memory for project "${project}" - operation: "${operation}"`);
|
|
120755
|
+
const memoryStore = await getMemoryStore(toolContext.logger, project);
|
|
120751
120756
|
if (!memoryStore) {
|
|
120752
120757
|
return "Error: Memory store is not enabled. Configure it in your .polkacodes.yml with memory.enabled: true";
|
|
120753
120758
|
}
|
|
120754
120759
|
try {
|
|
120755
120760
|
const memoryQuery = {};
|
|
120756
|
-
memoryQuery.scope = scope ?? "auto";
|
|
120757
120761
|
if (search)
|
|
120758
120762
|
memoryQuery.search = search;
|
|
120759
120763
|
if (type)
|