pi-agents-switch 0.2.0 → 0.2.2

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/frontmatter.ts CHANGED
@@ -57,10 +57,10 @@ export function parseFrontmatter(content: string): FrontmatterResult {
57
57
  continue;
58
58
  }
59
59
 
60
- // Array item: ` - value` or `- value`
61
- const arrayMatch = line.match(/^\s*-\s+(.+)$/);
60
+ // Array item: `- value`, `- "value"`, or `-value`
61
+ const arrayMatch = line.match(/^\s*-\s*(.+)$/);
62
62
  if (arrayMatch) {
63
- currentArray.push(arrayMatch[1].trim());
63
+ currentArray.push(parseArrayItem(arrayMatch[1]));
64
64
  continue;
65
65
  }
66
66
 
@@ -94,6 +94,24 @@ export function parseFrontmatter(content: string): FrontmatterResult {
94
94
  return { frontmatter: fm, body, keyOrder };
95
95
  }
96
96
 
97
+ /**
98
+ * Parse an array item value (always a string).
99
+ * Strips surrounding whitespace and optional YAML quotes.
100
+ */
101
+ function parseArrayItem(raw: string): string {
102
+ const trimmed = raw.trim();
103
+
104
+ // Quoted strings
105
+ if (
106
+ (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
107
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))
108
+ ) {
109
+ return trimmed.slice(1, -1);
110
+ }
111
+
112
+ return trimmed;
113
+ }
114
+
97
115
  /**
98
116
  * Parse a scalar YAML value.
99
117
  * Handles: unquoted strings, quoted strings, booleans, numbers.
package/index.ts CHANGED
@@ -359,11 +359,10 @@ export default function agentsSwitch(pi: ExtensionAPI) {
359
359
 
360
360
  if (resolved.thinkingLevel) pi.setThinkingLevel(resolved.thinkingLevel);
361
361
 
362
- if (resolved.tools.length > 0) {
363
- const allNames = new Set(pi.getAllTools().map((t) => t.name));
364
- const valid = resolved.tools.filter((t) => allNames.has(t));
365
- if (valid.length > 0) pi.setActiveTools(valid);
366
- }
362
+ // Apply resolved tools even if empty (e.g. excluded_tools: ["*"] with no additions)
363
+ const allNames = new Set(pi.getAllTools().map((t) => t.name));
364
+ const valid = resolved.tools.filter((t) => allNames.has(t));
365
+ pi.setActiveTools(valid);
367
366
  }
368
367
 
369
368
  // ─── Agent cycling / switching ──────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agents-switch",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Tab to switch primary agents in Pi — like OpenCode's agent switching. Each agent gets an isolated profile with its own AGENTS.md, extensions, skills, and settings.",
5
5
  "type": "module",
6
6
  "pi": {