open-azdo 0.2.6 → 0.2.8

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/open-azdo.js CHANGED
@@ -47256,6 +47256,12 @@ var buildOpenCodeArgs = (request3) => [
47256
47256
  ];
47257
47257
  var isRecord = (value3) => typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
47258
47258
  var toNumberOrUndefined = (value3) => typeof value3 === "number" && Number.isFinite(value3) ? value3 : undefined;
47259
+ var getNestedCacheTokenCount = (value3, key) => {
47260
+ if (!isRecord(value3) || !isRecord(value3.cache)) {
47261
+ return;
47262
+ }
47263
+ return toNumberOrUndefined(value3.cache[key]);
47264
+ };
47259
47265
  var parseTokenUsage = (value3) => {
47260
47266
  if (!isRecord(value3)) {
47261
47267
  return;
@@ -47269,8 +47275,8 @@ var parseTokenUsage = (value3) => {
47269
47275
  input,
47270
47276
  output,
47271
47277
  reasoning: toNumberOrUndefined(value3.reasoning) ?? 0,
47272
- cacheRead: toNumberOrUndefined(value3.cacheRead) ?? 0,
47273
- cacheWrite: toNumberOrUndefined(value3.cacheWrite) ?? 0
47278
+ cacheRead: toNumberOrUndefined(value3.cacheRead) ?? getNestedCacheTokenCount(value3, "read") ?? 0,
47279
+ cacheWrite: toNumberOrUndefined(value3.cacheWrite) ?? getNestedCacheTokenCount(value3, "write") ?? 0
47274
47280
  };
47275
47281
  };
47276
47282
  var buildUsage = ({
@@ -47618,6 +47624,7 @@ var ReviewHistoryTokensSchema = exports_Schema.Struct({
47618
47624
  });
47619
47625
  var ReviewHistoryEntrySchema = exports_Schema.Struct({
47620
47626
  reviewedCommit: exports_Schema.String,
47627
+ reviewedAt: exports_Schema.optionalKey(exports_Schema.String),
47621
47628
  reviewMode: exports_Schema.Literals(["full", "follow-up"]),
47622
47629
  model: exports_Schema.String,
47623
47630
  variant: exports_Schema.optionalKey(exports_Schema.String),
@@ -47718,6 +47725,20 @@ var formatReviewLabel = (entry) => {
47718
47725
  }
47719
47726
  return commitLabel;
47720
47727
  };
47728
+ var formatReviewTimestamp = (entry) => {
47729
+ if (!entry.reviewedAt) {
47730
+ return "-";
47731
+ }
47732
+ const date5 = new Date(entry.reviewedAt);
47733
+ if (Number.isNaN(date5.valueOf())) {
47734
+ return entry.reviewedAt;
47735
+ }
47736
+ return new Intl.DateTimeFormat("en-US", {
47737
+ dateStyle: "medium",
47738
+ timeStyle: "short",
47739
+ timeZone: "UTC"
47740
+ }).format(date5);
47741
+ };
47721
47742
  var formatTokenBreakdown = (tokens) => {
47722
47743
  if (!tokens) {
47723
47744
  return "-";
@@ -47739,9 +47760,9 @@ var appendReviewHistorySection = (lines, reviewHistory) => {
47739
47760
  if (reviewHistory.length === 0) {
47740
47761
  return;
47741
47762
  }
47742
- lines.push("", "Review cost history:", "", "| Review | Mode | Model | Tokens | Cost |", "| --- | --- | --- | --- | --- |");
47743
- for (const entry of reviewHistory) {
47744
- lines.push(`| ${escapeTableCell(formatReviewLabel(entry))} | ${escapeTableCell(entry.reviewMode)} | ${escapeTableCell(formatModelLabel(entry))} | ${escapeTableCell(formatTokenBreakdown(entry.tokens))} | ${escapeTableCell(entry.costUsd !== undefined ? formatCostUsd(entry.costUsd) : "-")} |`);
47763
+ lines.push("", "| Review | Reviewed At (UTC) | Mode | Model | Tokens | Cost |", "| --- | --- | --- | --- | --- | --- |");
47764
+ for (const entry of [...reviewHistory].reverse()) {
47765
+ lines.push(`| ${escapeTableCell(formatReviewLabel(entry))} | ${escapeTableCell(formatReviewTimestamp(entry))} | ${escapeTableCell(entry.reviewMode)} | ${escapeTableCell(formatModelLabel(entry))} | ${escapeTableCell(formatTokenBreakdown(entry.tokens))} | ${escapeTableCell(entry.costUsd !== undefined ? formatCostUsd(entry.costUsd) : "-")} |`);
47745
47766
  }
47746
47767
  };
47747
47768
  var buildSummaryComment = (snapshot) => {
@@ -48200,6 +48221,7 @@ var buildReviewHistoryEntry = ({
48200
48221
  const tokens = mapUsageTokens(usage);
48201
48222
  return {
48202
48223
  reviewedCommit,
48224
+ reviewedAt: new Date().toISOString(),
48203
48225
  reviewMode,
48204
48226
  model: config.model,
48205
48227
  ...config.opencodeVariant ? { variant: config.opencodeVariant } : {},
@@ -48694,7 +48716,7 @@ var reviewCommandConfig = {
48694
48716
  var reviewCommand = make33("review", reviewCommandConfig).pipe(withDescription3("Review an Azure DevOps pull request with OpenCode."), withHandler((input) => runReviewCommand(input)));
48695
48717
  var openAzdoCli = make33("open-azdo").pipe(withDescription3("Secure Azure DevOps pull-request review CLI powered by OpenCode."), withSubcommands([reviewCommand]));
48696
48718
  // package.json
48697
- var version2 = "0.2.6";
48719
+ var version2 = "0.2.8";
48698
48720
 
48699
48721
  // src/Main.ts
48700
48722
  var cliProgram = run3(openAzdoCli, { version: version2 }).pipe(exports_Effect.scoped, exports_Effect.provide(BaseRuntimeLayer));
@@ -48703,4 +48725,4 @@ var main = () => runMain2(cliProgram, { disableErrorReporting: true });
48703
48725
  // bin/open-azdo.ts
48704
48726
  main();
48705
48727
 
48706
- //# debugId=151A25C3CC4015FB64756E2164756E21
48728
+ //# debugId=DDCB7AE9503A353464756E2164756E21