@phren/cli 0.1.31 → 0.1.32

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.
@@ -130,6 +130,9 @@ async function handleAddFinding(ctx, params) {
130
130
  });
131
131
  }
132
132
  }
133
+ const normalizedScope = normalizeMemoryScope(scope ?? "shared");
134
+ if (!normalizedScope)
135
+ return mcpResponse({ ok: false, error: `Invalid scope: "${scope}". Use lowercase letters/numbers with '-' or '_' (max 64 chars), e.g. "researcher".` });
133
136
  if (Array.isArray(finding)) {
134
137
  const findings = finding;
135
138
  if (findings.length > 100)
@@ -183,9 +186,6 @@ async function handleAddFinding(ctx, params) {
183
186
  }
184
187
  if (finding.length > 5000)
185
188
  return mcpResponse({ ok: false, error: "Finding text exceeds 5000 character limit." });
186
- const normalizedScope = normalizeMemoryScope(scope ?? "shared");
187
- if (!normalizedScope)
188
- return mcpResponse({ ok: false, error: `Invalid scope: "${scope}". Use lowercase letters/numbers with '-' or '_' (max 64 chars), e.g. "researcher".` });
189
189
  return withWriteQueue(async () => {
190
190
  try {
191
191
  const taggedFinding = applyFindingTypePrefix(finding, findingType);
@@ -629,10 +629,7 @@ export function register(server, ctx) {
629
629
  " Optionally classify with findingType: decision, pitfall, pattern, tradeoff, architecture, or bug.",
630
630
  inputSchema: z.object({
631
631
  project: z.string().describe("Project name (must match a directory in your phren store)."),
632
- finding: z.union([
633
- z.string().describe("A single insight, written as a bullet point."),
634
- z.array(z.string()).describe("Multiple insights to record in one call."),
635
- ]).describe("The insight(s) to save. Pass a string for one finding, or an array for bulk."),
632
+ finding: z.preprocess((v) => (typeof v === "string" ? [v] : v), z.array(z.string()).min(1)).describe("The insight(s) to save. Always pass as an array of strings — use a single-element array for one finding."),
636
633
  citation: z.object({
637
634
  file: z.string().optional().describe("Source file path that supports this finding."),
638
635
  line: z.number().int().positive().optional().describe("1-based line number in file."),
@@ -717,10 +714,7 @@ export function register(server, ctx) {
717
714
  " Pass a single string or an array of strings.",
718
715
  inputSchema: z.object({
719
716
  project: z.string().describe("Project name."),
720
- finding: z.union([
721
- z.string().describe("Partial text to match against existing findings."),
722
- z.array(z.string()).describe("List of partial texts to match and remove."),
723
- ]).describe("Text(s) to match and remove. Pass a string for one, or an array for bulk."),
717
+ finding: z.preprocess((v) => (typeof v === "string" ? [v] : v), z.array(z.string()).min(1)).describe("Text(s) to match and remove. Always pass as an array of strings — use a single-element array for one."),
724
718
  }),
725
719
  }, (params) => handleRemoveFinding(ctx, params));
726
720
  server.registerTool("push_changes", {
@@ -203,10 +203,7 @@ export function register(server, ctx) {
203
203
  description: "Append one or more tasks to a project's tasks.md file. Adds to the Queue section. Pass a single string or an array of strings.",
204
204
  inputSchema: z.object({
205
205
  project: z.string().describe("Project name (must match a directory in your phren)."),
206
- item: z.union([
207
- z.string().describe("A single task to add."),
208
- z.array(z.string()).describe("Multiple tasks to add in one call."),
209
- ]).describe("The task(s) to add. Pass a string for one task, or an array for bulk."),
206
+ item: z.preprocess((v) => (typeof v === "string" ? [v] : v), z.array(z.string()).min(1)).describe("The task(s) to add. Always pass as an array of strings — use a single-element array for one task."),
210
207
  scope: z.string().optional().describe("Optional memory scope label. Defaults to 'shared'. Example: 'researcher' or 'builder'."),
211
208
  }),
212
209
  }, async ({ project: projectInput, item, scope }) => {
@@ -253,10 +250,7 @@ export function register(server, ctx) {
253
250
  description: "Move one or more tasks to the Done section by matching text. Pass a single string or an array of strings.",
254
251
  inputSchema: z.object({
255
252
  project: z.string().describe("Project name."),
256
- item: z.union([
257
- z.string().describe("Exact or partial text of the item to complete."),
258
- z.array(z.string()).describe("List of partial item texts to complete."),
259
- ]).describe("The task(s) to complete. Pass a string for one, or an array for bulk."),
253
+ item: z.preprocess((v) => (typeof v === "string" ? [v] : v), z.array(z.string()).min(1)).describe("The task(s) to complete. Always pass as an array of strings — use a single-element array for one."),
260
254
  sessionId: z.string().optional().describe("Optional session ID from session_start. Pass this to track per-session task completion metrics."),
261
255
  }),
262
256
  }, async ({ project: projectInput, item, sessionId }) => {
@@ -324,10 +318,7 @@ export function register(server, ctx) {
324
318
  description: "Remove one or more tasks from a project's tasks.md file by matching text or ID. Pass a single string or an array of strings.",
325
319
  inputSchema: z.object({
326
320
  project: z.string().describe("Project name."),
327
- item: z.union([
328
- z.string().describe("Exact or partial text of the task, or a task ID like A1/Q3/D2."),
329
- z.array(z.string()).describe("List of partial item texts or IDs to remove."),
330
- ]).describe("The task(s) to remove. Pass a string for one, or an array for bulk."),
321
+ item: z.preprocess((v) => (typeof v === "string" ? [v] : v), z.array(z.string()).min(1)).describe("The task(s) to remove. Always pass as an array of strings (or task IDs like A1/Q3/D2) — use a single-element array for one."),
331
322
  }),
332
323
  }, async ({ project: projectInput, item }) => {
333
324
  const resolved = resolveStoreForProject(ctx, projectInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {