up-cc 0.5.1 → 0.5.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.
Files changed (2) hide show
  1. package/bin/install.js +24 -0
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -280,6 +280,11 @@ function convertAgentToOpencode(content) {
280
280
  converted = converted.replace(/\bTodoWrite\b/g, 'todowrite');
281
281
  converted = converted.replace(/\/up:/g, '/up-'); // OpenCode flat command structure
282
282
 
283
+ // Replace Task tool calls with OpenCode format
284
+ // Claude Code: Task(subagent_type="up-xxx", ...) / Agent(subagent_type="up-xxx", ...)
285
+ // OpenCode: @up-xxx or task tool with agent name
286
+ converted = converted.replace(/subagent_type="up-/g, 'agent="up-');
287
+
283
288
  const { frontmatter, body } = extractFrontmatterAndBody(converted);
284
289
  if (!frontmatter) return converted;
285
290
 
@@ -287,11 +292,17 @@ function convertAgentToOpencode(content) {
287
292
  const newLines = [];
288
293
  const tools = [];
289
294
  let inTools = false;
295
+ let hasMode = false;
290
296
 
291
297
  for (const line of lines) {
292
298
  const trimmed = line.trim();
293
299
 
294
300
  if (trimmed.startsWith('name:')) continue; // OpenCode uses filename
301
+ if (trimmed.startsWith('mode:')) {
302
+ hasMode = true;
303
+ newLines.push(line);
304
+ continue;
305
+ }
295
306
  if (trimmed.startsWith('tools:')) {
296
307
  const toolsValue = trimmed.substring(6).trim();
297
308
  if (toolsValue) {
@@ -318,6 +329,13 @@ function convertAgentToOpencode(content) {
318
329
  if (!inTools) newLines.push(line);
319
330
  }
320
331
 
332
+ // CRITICAL: OpenCode requires mode: subagent for agents to be invokable via Task tool
333
+ // Without this, agents are treated as "primary" and isolated — primary agents cannot
334
+ // invoke each other. All UP agents are subagents (only user-facing primary is OpenCode itself).
335
+ if (!hasMode) {
336
+ newLines.push('mode: subagent');
337
+ }
338
+
321
339
  if (tools.length > 0) {
322
340
  newLines.push('tools:');
323
341
  for (const tool of tools) {
@@ -364,6 +382,12 @@ function replacePaths(content, pathPrefix, runtime) {
364
382
  if (runtime === 'opencode') {
365
383
  content = content.replace(/\/up:/g, '/up-');
366
384
  content = content.replace(/subagent_type="general-purpose"/g, 'subagent_type="general"');
385
+ // OpenCode invokes subagents via Task tool with agent name (not subagent_type)
386
+ // Keep subagent_type for compatibility but ensure agents have mode:subagent
387
+ // Replace AskUserQuestion with question (OpenCode native)
388
+ content = content.replace(/\bAskUserQuestion\b/g, 'question');
389
+ content = content.replace(/\bSlashCommand\b/g, 'skill');
390
+ content = content.replace(/\bTodoWrite\b/g, 'todowrite');
367
391
  }
368
392
 
369
393
  return content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "up-cc",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Simplified spec-driven development for Claude Code, Gemini and OpenCode.",
5
5
  "bin": {
6
6
  "up-cc": "bin/install.js"