up-cc 0.5.0 → 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.
- package/bin/install.js +25 -0
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -269,6 +269,7 @@ function convertAgentToGemini(content) {
|
|
|
269
269
|
const colorNameToHex = {
|
|
270
270
|
cyan: '#00FFFF', red: '#FF0000', green: '#00FF00', blue: '#0000FF',
|
|
271
271
|
yellow: '#FFFF00', magenta: '#FF00FF', orange: '#FFA500', purple: '#800080',
|
|
272
|
+
gold: '#FFD700', pink: '#FFC0CB', brown: '#8B4513',
|
|
272
273
|
};
|
|
273
274
|
|
|
274
275
|
function convertAgentToOpencode(content) {
|
|
@@ -279,6 +280,11 @@ function convertAgentToOpencode(content) {
|
|
|
279
280
|
converted = converted.replace(/\bTodoWrite\b/g, 'todowrite');
|
|
280
281
|
converted = converted.replace(/\/up:/g, '/up-'); // OpenCode flat command structure
|
|
281
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
|
+
|
|
282
288
|
const { frontmatter, body } = extractFrontmatterAndBody(converted);
|
|
283
289
|
if (!frontmatter) return converted;
|
|
284
290
|
|
|
@@ -286,11 +292,17 @@ function convertAgentToOpencode(content) {
|
|
|
286
292
|
const newLines = [];
|
|
287
293
|
const tools = [];
|
|
288
294
|
let inTools = false;
|
|
295
|
+
let hasMode = false;
|
|
289
296
|
|
|
290
297
|
for (const line of lines) {
|
|
291
298
|
const trimmed = line.trim();
|
|
292
299
|
|
|
293
300
|
if (trimmed.startsWith('name:')) continue; // OpenCode uses filename
|
|
301
|
+
if (trimmed.startsWith('mode:')) {
|
|
302
|
+
hasMode = true;
|
|
303
|
+
newLines.push(line);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
294
306
|
if (trimmed.startsWith('tools:')) {
|
|
295
307
|
const toolsValue = trimmed.substring(6).trim();
|
|
296
308
|
if (toolsValue) {
|
|
@@ -317,6 +329,13 @@ function convertAgentToOpencode(content) {
|
|
|
317
329
|
if (!inTools) newLines.push(line);
|
|
318
330
|
}
|
|
319
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
|
+
|
|
320
339
|
if (tools.length > 0) {
|
|
321
340
|
newLines.push('tools:');
|
|
322
341
|
for (const tool of tools) {
|
|
@@ -363,6 +382,12 @@ function replacePaths(content, pathPrefix, runtime) {
|
|
|
363
382
|
if (runtime === 'opencode') {
|
|
364
383
|
content = content.replace(/\/up:/g, '/up-');
|
|
365
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');
|
|
366
391
|
}
|
|
367
392
|
|
|
368
393
|
return content;
|