opencode-pilot 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.
- package/bin/opencode-pilot +29 -36
- package/package.json +1 -1
package/bin/opencode-pilot
CHANGED
|
@@ -361,30 +361,29 @@ async function configCommand() {
|
|
|
361
361
|
// ============================================================================
|
|
362
362
|
|
|
363
363
|
async function testSourceCommand(sourceName) {
|
|
364
|
+
// Load sources using getSources() to expand presets
|
|
365
|
+
const { loadRepoConfig, getSources } = await import(join(serviceDir, "repo-config.js"));
|
|
366
|
+
loadRepoConfig(PILOT_CONFIG_FILE);
|
|
367
|
+
|
|
368
|
+
let sources;
|
|
369
|
+
try {
|
|
370
|
+
sources = getSources();
|
|
371
|
+
} catch (err) {
|
|
372
|
+
console.error(`Failed to load sources: ${err.message}`);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
|
|
364
376
|
if (!sourceName) {
|
|
365
377
|
console.error("Usage: opencode-pilot test-source <source-name>");
|
|
366
378
|
console.error("");
|
|
367
379
|
console.error("Available sources:");
|
|
368
380
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
try {
|
|
372
|
-
const { default: YAML } = await import("yaml");
|
|
373
|
-
const content = readFileSync(PILOT_CONFIG_FILE, "utf8");
|
|
374
|
-
const config = YAML.parse(content);
|
|
375
|
-
const sources = config.sources || [];
|
|
376
|
-
if (sources.length === 0) {
|
|
377
|
-
console.error(" (no sources configured)");
|
|
378
|
-
} else {
|
|
379
|
-
for (const s of sources) {
|
|
380
|
-
console.error(` ${s.name}`);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
} catch (err) {
|
|
384
|
-
console.error(` Error loading config: ${err.message}`);
|
|
385
|
-
}
|
|
381
|
+
if (sources.length === 0) {
|
|
382
|
+
console.error(" (no sources configured)");
|
|
386
383
|
} else {
|
|
387
|
-
|
|
384
|
+
for (const s of sources) {
|
|
385
|
+
console.error(` ${s.name}`);
|
|
386
|
+
}
|
|
388
387
|
}
|
|
389
388
|
process.exit(1);
|
|
390
389
|
}
|
|
@@ -393,18 +392,7 @@ async function testSourceCommand(sourceName) {
|
|
|
393
392
|
console.log("=".repeat(40));
|
|
394
393
|
console.log("");
|
|
395
394
|
|
|
396
|
-
// Load config
|
|
397
|
-
if (!existsSync(PILOT_CONFIG_FILE)) {
|
|
398
|
-
console.error(`Config file not found: ${PILOT_CONFIG_FILE}`);
|
|
399
|
-
process.exit(1);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const { default: YAML } = await import("yaml");
|
|
403
|
-
const content = readFileSync(PILOT_CONFIG_FILE, "utf8");
|
|
404
|
-
const config = YAML.parse(content);
|
|
405
|
-
|
|
406
395
|
// Find source
|
|
407
|
-
const sources = config.sources || [];
|
|
408
396
|
const source = sources.find(s => s.name === sourceName);
|
|
409
397
|
|
|
410
398
|
if (!source) {
|
|
@@ -429,19 +417,24 @@ async function testSourceCommand(sourceName) {
|
|
|
429
417
|
if (source.prompt) console.log(` prompt: ${source.prompt}`);
|
|
430
418
|
if (source.agent) console.log(` agent: ${source.agent}`);
|
|
431
419
|
|
|
432
|
-
// Show mappings
|
|
433
|
-
const
|
|
420
|
+
// Show mappings (using getToolProviderConfig which includes preset defaults)
|
|
421
|
+
const { getToolProviderConfig } = await import(join(serviceDir, "repo-config.js"));
|
|
434
422
|
const provider = source.tool?.mcp;
|
|
435
|
-
const
|
|
423
|
+
const toolProviderConfig = getToolProviderConfig(provider);
|
|
424
|
+
const mappings = toolProviderConfig?.mappings;
|
|
436
425
|
|
|
437
426
|
console.log("");
|
|
438
427
|
console.log("Field Mappings:");
|
|
439
|
-
if (mappings) {
|
|
428
|
+
if (mappings && Object.keys(mappings).length > 0) {
|
|
440
429
|
for (const [target, sourcePath] of Object.entries(mappings)) {
|
|
441
430
|
console.log(` ${target} ← ${sourcePath}`);
|
|
442
431
|
}
|
|
443
432
|
} else {
|
|
444
|
-
console.log(` (no mappings
|
|
433
|
+
console.log(` (no mappings for provider '${provider}')`);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (toolProviderConfig?.response_key) {
|
|
437
|
+
console.log(` response_key: ${toolProviderConfig.response_key}`);
|
|
445
438
|
}
|
|
446
439
|
|
|
447
440
|
// Fetch items
|
|
@@ -453,8 +446,8 @@ async function testSourceCommand(sourceName) {
|
|
|
453
446
|
const pollerPath = join(serviceDir, "poller.js");
|
|
454
447
|
const { pollGenericSource, applyMappings } = await import(pollerPath);
|
|
455
448
|
|
|
456
|
-
// Fetch items with mappings
|
|
457
|
-
const items = await pollGenericSource(source, {
|
|
449
|
+
// Fetch items with tool provider config (includes mappings and response_key)
|
|
450
|
+
const items = await pollGenericSource(source, { toolProviderConfig });
|
|
458
451
|
|
|
459
452
|
console.log(`Found ${items.length} item(s)`);
|
|
460
453
|
console.log("");
|