@hone-ai/cli 1.12.2 → 1.14.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.
- package/hone-cli.js +78 -1
- package/package.json +1 -1
package/hone-cli.js
CHANGED
|
@@ -4447,9 +4447,42 @@ program
|
|
|
4447
4447
|
try { branch = execSync('git symbolic-ref --short HEAD', { encoding: 'utf8' }).trim(); } catch { branch = null; }
|
|
4448
4448
|
}
|
|
4449
4449
|
|
|
4450
|
+
// HC-019n-followup-11: when storyId is a bare integer, treat it as a
|
|
4451
|
+
// GitHub issue number and fetch the issue's title + body via the local
|
|
4452
|
+
// `gh` CLI. Inject into config.story_description so the orchestrator's
|
|
4453
|
+
// buildStepContext (HC-019n root-cause fix B) hands the real story
|
|
4454
|
+
// text to step_0 instead of letting the LLM produce placeholder
|
|
4455
|
+
// [ASSUMPTION] grooming. Hook reused — no server change required.
|
|
4456
|
+
//
|
|
4457
|
+
// Gracefully degrade on any error (gh missing, no remote, network
|
|
4458
|
+
// fail, private repo without auth): warn and proceed without context.
|
|
4459
|
+
// The existing HC-019n-followup-7 hard_pause safety net catches the
|
|
4460
|
+
// resulting placeholder cascade at step_1.
|
|
4461
|
+
const orchestrateConfig = {};
|
|
4462
|
+
if (/^\d+$/.test(storyIdOrRunId)) {
|
|
4463
|
+
try {
|
|
4464
|
+
const remoteUrl = execSync('git remote get-url origin', { encoding: 'utf8' }).trim();
|
|
4465
|
+
const m = remoteUrl.match(/[/:]([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
4466
|
+
if (!m) throw new Error(`could not parse owner/repo from remote: ${remoteUrl}`);
|
|
4467
|
+
const ownerRepo = `${m[1]}/${m[2]}`;
|
|
4468
|
+
const issueJson = execSync(
|
|
4469
|
+
`gh issue view ${storyIdOrRunId} --repo ${ownerRepo} --json title,body,url`,
|
|
4470
|
+
{ encoding: 'utf8' }
|
|
4471
|
+
);
|
|
4472
|
+
const issue = JSON.parse(issueJson);
|
|
4473
|
+
const desc = `# ${issue.title}\n\n${issue.body || '_(issue body is empty)_'}\n\n_Source: ${issue.url}_`;
|
|
4474
|
+
orchestrateConfig.story_description = desc;
|
|
4475
|
+
console.log(` → fetched GitHub issue #${storyIdOrRunId} for story context (${desc.length} chars)`);
|
|
4476
|
+
} catch (e) {
|
|
4477
|
+
const msg = (e && e.message) ? e.message.split('\n')[0] : String(e);
|
|
4478
|
+
console.warn(` ⚠ could not fetch GitHub issue context: ${msg}`);
|
|
4479
|
+
console.warn(' → proceeding without story_description; step_0 may produce placeholder output');
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4450
4483
|
try {
|
|
4451
4484
|
const { data } = await client.post('/orchestrate', {
|
|
4452
|
-
storyId: storyIdOrRunId, repoName, branch, mode: opts.mode, config:
|
|
4485
|
+
storyId: storyIdOrRunId, repoName, branch, mode: opts.mode, config: orchestrateConfig,
|
|
4453
4486
|
});
|
|
4454
4487
|
|
|
4455
4488
|
console.log('');
|
|
@@ -5277,6 +5310,50 @@ program
|
|
|
5277
5310
|
}
|
|
5278
5311
|
});
|
|
5279
5312
|
|
|
5313
|
+
// ── SHOW step output (HC-019n-followup-6) ─────────────────────────────────────
|
|
5314
|
+
// `hone show step <workflowId> <stepKey> [--attempt N]` — fetch the
|
|
5315
|
+
// actual LLM output of a specific orchestrator step. Pre-fix, the
|
|
5316
|
+
// /orchestrate/<id> endpoint returned step METADATA only; operators
|
|
5317
|
+
// approving a human gate (step_4 typically) had no way to see what
|
|
5318
|
+
// they were approving, and review-fail loops were undiagnosable.
|
|
5319
|
+
const showCmd = program.command('show').description('Inspect orchestrator step output (HC-019n-followup-6)');
|
|
5320
|
+
showCmd
|
|
5321
|
+
.command('step <workflowId> <stepKey>')
|
|
5322
|
+
.description('Print the actual LLM output of an orchestrator step (latest attempt by default)')
|
|
5323
|
+
.option('--attempt <n>', 'Specific attempt number (default: latest)')
|
|
5324
|
+
.action(async (workflowId, stepKey, opts) => {
|
|
5325
|
+
const config = getConfig();
|
|
5326
|
+
const client = api(config);
|
|
5327
|
+
try {
|
|
5328
|
+
const url = `/orchestrate/${workflowId}/step/${stepKey}${opts.attempt ? `?attempt=${opts.attempt}` : ''}`;
|
|
5329
|
+
const r = await client.get(url);
|
|
5330
|
+
const s = r.data;
|
|
5331
|
+
console.log(`── step output ──────────────────────────────────────────`);
|
|
5332
|
+
console.log(` runId: ${s.runId}`);
|
|
5333
|
+
console.log(` stepKey: ${s.stepKey}`);
|
|
5334
|
+
console.log(` agent: ${s.agent}`);
|
|
5335
|
+
console.log(` attempt: ${s.attempt}`);
|
|
5336
|
+
console.log(` status: ${s.status}`);
|
|
5337
|
+
console.log(` gateResult: ${s.gateResult || '(none)'}`);
|
|
5338
|
+
console.log(` startedAt: ${s.startedAt || '(not started)'}`);
|
|
5339
|
+
console.log(` completedAt: ${s.completedAt || '(not completed)'}`);
|
|
5340
|
+
if (s.tokenUsage) console.log(` tokenUsage: ${JSON.stringify(s.tokenUsage)}`);
|
|
5341
|
+
if (s.errorContext) {
|
|
5342
|
+
console.log(``);
|
|
5343
|
+
console.log(`── error_context (retry feedback) ──────────────────────`);
|
|
5344
|
+
console.log(s.errorContext);
|
|
5345
|
+
}
|
|
5346
|
+
console.log(``);
|
|
5347
|
+
console.log(`── output (the LLM's actual response) ──────────────────`);
|
|
5348
|
+
console.log(s.output || '(no output recorded — step may not have completed)');
|
|
5349
|
+
console.log(`────────────────────────────────────────────────────────`);
|
|
5350
|
+
} catch (e) {
|
|
5351
|
+
const msg = e.response?.data?.error || e.message;
|
|
5352
|
+
console.error(`hone show step failed: ${msg}`);
|
|
5353
|
+
process.exit(1);
|
|
5354
|
+
}
|
|
5355
|
+
});
|
|
5356
|
+
|
|
5280
5357
|
// ── CLI setup ─────────────────────────────────────────────────────────────────
|
|
5281
5358
|
program
|
|
5282
5359
|
.name('hone')
|