opencode-pilot 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.
Files changed (2) hide show
  1. package/bin/opencode-pilot +41 -38
  2. package/package.json +1 -1
@@ -272,10 +272,20 @@ async function configCommand() {
272
272
  }
273
273
  }
274
274
 
275
- // Validate sources section
275
+ // Validate sources section (use getSources to expand presets)
276
276
  console.log("");
277
277
  console.log("Sources:");
278
- const sources = config.sources || [];
278
+ const { loadRepoConfig, getSources } = await import(join(serviceDir, "repo-config.js"));
279
+ loadRepoConfig(PILOT_CONFIG_FILE);
280
+
281
+ let sources;
282
+ try {
283
+ sources = getSources();
284
+ } catch (err) {
285
+ console.log(` ✗ Failed to load sources: ${err.message}`);
286
+ sources = [];
287
+ }
288
+
279
289
  if (sources.length === 0) {
280
290
  console.log(" (none configured)");
281
291
  } else {
@@ -351,30 +361,29 @@ async function configCommand() {
351
361
  // ============================================================================
352
362
 
353
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
+
354
376
  if (!sourceName) {
355
377
  console.error("Usage: opencode-pilot test-source <source-name>");
356
378
  console.error("");
357
379
  console.error("Available sources:");
358
380
 
359
- // Load and show available sources
360
- if (existsSync(PILOT_CONFIG_FILE)) {
361
- try {
362
- const { default: YAML } = await import("yaml");
363
- const content = readFileSync(PILOT_CONFIG_FILE, "utf8");
364
- const config = YAML.parse(content);
365
- const sources = config.sources || [];
366
- if (sources.length === 0) {
367
- console.error(" (no sources configured)");
368
- } else {
369
- for (const s of sources) {
370
- console.error(` ${s.name}`);
371
- }
372
- }
373
- } catch (err) {
374
- console.error(` Error loading config: ${err.message}`);
375
- }
381
+ if (sources.length === 0) {
382
+ console.error(" (no sources configured)");
376
383
  } else {
377
- console.error(" (config file not found)");
384
+ for (const s of sources) {
385
+ console.error(` ${s.name}`);
386
+ }
378
387
  }
379
388
  process.exit(1);
380
389
  }
@@ -383,18 +392,7 @@ async function testSourceCommand(sourceName) {
383
392
  console.log("=".repeat(40));
384
393
  console.log("");
385
394
 
386
- // Load config
387
- if (!existsSync(PILOT_CONFIG_FILE)) {
388
- console.error(`Config file not found: ${PILOT_CONFIG_FILE}`);
389
- process.exit(1);
390
- }
391
-
392
- const { default: YAML } = await import("yaml");
393
- const content = readFileSync(PILOT_CONFIG_FILE, "utf8");
394
- const config = YAML.parse(content);
395
-
396
395
  // Find source
397
- const sources = config.sources || [];
398
396
  const source = sources.find(s => s.name === sourceName);
399
397
 
400
398
  if (!source) {
@@ -419,19 +417,24 @@ async function testSourceCommand(sourceName) {
419
417
  if (source.prompt) console.log(` prompt: ${source.prompt}`);
420
418
  if (source.agent) console.log(` agent: ${source.agent}`);
421
419
 
422
- // Show mappings
423
- const tools = config.tools || {};
420
+ // Show mappings (using getToolProviderConfig which includes preset defaults)
421
+ const { getToolProviderConfig } = await import(join(serviceDir, "repo-config.js"));
424
422
  const provider = source.tool?.mcp;
425
- const mappings = tools[provider]?.mappings;
423
+ const toolProviderConfig = getToolProviderConfig(provider);
424
+ const mappings = toolProviderConfig?.mappings;
426
425
 
427
426
  console.log("");
428
427
  console.log("Field Mappings:");
429
- if (mappings) {
428
+ if (mappings && Object.keys(mappings).length > 0) {
430
429
  for (const [target, sourcePath] of Object.entries(mappings)) {
431
430
  console.log(` ${target} ← ${sourcePath}`);
432
431
  }
433
432
  } else {
434
- console.log(` (no mappings configured for provider '${provider}')`);
433
+ console.log(` (no mappings for provider '${provider}')`);
434
+ }
435
+
436
+ if (toolProviderConfig?.response_key) {
437
+ console.log(` response_key: ${toolProviderConfig.response_key}`);
435
438
  }
436
439
 
437
440
  // Fetch items
@@ -443,8 +446,8 @@ async function testSourceCommand(sourceName) {
443
446
  const pollerPath = join(serviceDir, "poller.js");
444
447
  const { pollGenericSource, applyMappings } = await import(pollerPath);
445
448
 
446
- // Fetch items with mappings applied
447
- const items = await pollGenericSource(source, { mappings });
449
+ // Fetch items with tool provider config (includes mappings and response_key)
450
+ const items = await pollGenericSource(source, { toolProviderConfig });
448
451
 
449
452
  console.log(`Found ${items.length} item(s)`);
450
453
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-pilot",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "main": "plugin/index.js",
6
6
  "description": "Automation daemon for OpenCode - polls for work and spawns sessions",