@mutagent/cli 0.1.86 → 0.1.87

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/dist/bin/cli.js CHANGED
@@ -3710,6 +3710,30 @@ import { Command as Command4 } from "commander";
3710
3710
  import chalk8 from "chalk";
3711
3711
  init_errors();
3712
3712
 
3713
+ // src/lib/resolve-prompt-id.ts
3714
+ async function resolveNumericPromptId(client, promptGroupId) {
3715
+ if (!promptGroupId)
3716
+ return null;
3717
+ let prompts;
3718
+ try {
3719
+ prompts = await client.listPrompts();
3720
+ } catch {
3721
+ return null;
3722
+ }
3723
+ const matches = prompts.filter((p) => p.promptGroupId === promptGroupId);
3724
+ if (matches.length === 0)
3725
+ return null;
3726
+ const latestFlagged = matches.find((p) => p.isLatest);
3727
+ if (latestFlagged)
3728
+ return latestFlagged.id;
3729
+ const sorted = [...matches].sort((a, b) => {
3730
+ const ta = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
3731
+ const tb = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
3732
+ return tb - ta;
3733
+ });
3734
+ return sorted[0]?.id ?? null;
3735
+ }
3736
+
3713
3737
  // src/commands/prompts/guided-workflow.ts
3714
3738
  init_sdk_client();
3715
3739
  async function buildGuidedWorkflow(promptId) {
@@ -3876,10 +3900,16 @@ Examples:
3876
3900
  try {
3877
3901
  const client = await getSDKClient();
3878
3902
  const evalObj = await client.getEvaluation(evaluationId);
3903
+ const numericPromptId = await resolveNumericPromptId(client, evalObj.promptGroupId);
3904
+ if (numericPromptId === null) {
3905
+ if (process.env.DEBUG) {
3906
+ console.error(`[debug] Evaluation ${String(evalObj.id)} references promptGroupId ${evalObj.promptGroupId} but no prompts were found in that group. Falling back to prompts dashboard.`);
3907
+ }
3908
+ }
3879
3909
  if (isJson) {
3880
3910
  output.output({
3881
3911
  ...evalObj,
3882
- _links: evaluationLinks(evalObj.promptGroupId, evalObj.id)
3912
+ _links: numericPromptId !== null ? evaluationLinks(numericPromptId, evalObj.id) : { dashboard: promptsDashboardLink(), api: `/api/prompts/${evalObj.promptGroupId}/evaluations/${String(evalObj.id)}` }
3883
3913
  });
3884
3914
  } else {
3885
3915
  output.success(`Evaluation: ${evalObj.name} (ID: ${String(evalObj.id)})`);
@@ -3913,7 +3943,8 @@ Examples:
3913
3943
  }
3914
3944
  console.log("");
3915
3945
  }
3916
- output.info(`View in dashboard: ${evaluationLink(evalObj.promptGroupId, evalObj.id)}`);
3946
+ const dashboardUrl = numericPromptId !== null ? evaluationLink(numericPromptId, evalObj.id) : promptsDashboardLink();
3947
+ output.info(`View in dashboard: ${dashboardUrl}`);
3917
3948
  }
3918
3949
  } catch (error) {
3919
3950
  handleError(error, isJson);
@@ -9125,5 +9156,5 @@ program.addCommand(createHooksCommand());
9125
9156
  program.addCommand(createFeedbackCommand());
9126
9157
  program.parse();
9127
9158
 
9128
- //# debugId=F2490C97DAE1166264756E2164756E21
9159
+ //# debugId=2CB8DD62F405DABB64756E2164756E21
9129
9160
  //# sourceMappingURL=cli.js.map