@oss-autopilot/core 3.8.0 → 3.9.0

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.
@@ -167,6 +167,56 @@ export const commands = [
167
167
  });
168
168
  },
169
169
  },
170
+ // ── Strategy ───────────────────────────────────────────────────────────
171
+ {
172
+ name: 'strategy',
173
+ localOnly: true,
174
+ register(program) {
175
+ program
176
+ .command('strategy')
177
+ .description('On-demand contribution-strategy snapshot via the typed `computeStrategy` function (#1243). ' +
178
+ 'Always runs against local state regardless of the auto-display cadence gate; returns ' +
179
+ 'null + message when fewer than the minimum tracked PRs are available.')
180
+ .option('--json', 'Output as JSON')
181
+ .action(async (options) => {
182
+ const { StrategyOutputSchema } = await import('./formatters/json.js');
183
+ await executeAction(options, async () => (await import('./commands/strategy.js')).runStrategy(), (data) => {
184
+ if (!data.strategy) {
185
+ console.log(`\n${data.message ?? 'Strategy unavailable.'}\n`);
186
+ return;
187
+ }
188
+ const { profile, capacity, patterns, recommendations } = data.strategy;
189
+ const mergeRatePct = Math.round(profile.mergeRate * 100);
190
+ console.log(`\nProfile: ${profile.style}`);
191
+ console.log(`${profile.totalPRs} PRs tracked, ${profile.mergedCount} merged (${mergeRatePct}% merge rate).`);
192
+ if (profile.primaryLanguages.length > 0) {
193
+ console.log(`Top languages: ${profile.primaryLanguages.join(', ')}`);
194
+ }
195
+ if (profile.favoriteRepos.length > 0) {
196
+ console.log(`Top repos: ${profile.favoriteRepos.join(', ')}`);
197
+ }
198
+ console.log(`\nCapacity: ${capacity.openPRCount} open, ${capacity.dormantPRCount} dormant across ${capacity.dormantRepoCount} repo(s).`);
199
+ if (capacity.overExtended) {
200
+ console.log(`Overextended — suggested action: ${capacity.suggestedAction ?? 'review dormant PRs'}.`);
201
+ }
202
+ console.log(`\nTrajectory: ${patterns.trajectoryDirection}`);
203
+ const dist = patterns.prTypeDistribution;
204
+ const parts = [];
205
+ for (const [k, v] of Object.entries(dist)) {
206
+ if (typeof v === 'number' && v > 0)
207
+ parts.push([k, v]);
208
+ }
209
+ if (parts.length > 0) {
210
+ console.log(`PR types (recent): ${parts.map(([k, v]) => `${k}=${v}`).join(', ')}`);
211
+ }
212
+ if (recommendations.avoidPatterns.length > 0) {
213
+ console.log(`\nWatch for: ${recommendations.avoidPatterns.join('; ')}`);
214
+ }
215
+ console.log('\nRun with --json for structured output');
216
+ }, StrategyOutputSchema);
217
+ });
218
+ },
219
+ },
170
220
  // ── State ──────────────────────────────────────────────────────────────
171
221
  {
172
222
  name: 'state',