@inteeka/task-cli 0.1.8 → 0.1.9

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/cli.js CHANGED
@@ -1610,10 +1610,10 @@ async function runWork(ticketId, opts) {
1610
1610
  "GET",
1611
1611
  `/api/v1/cli/me/tickets/${targetId}`
1612
1612
  );
1613
- if (detail.ai_fix_status !== "approved") {
1613
+ if (detail.ai_fix_status !== "approved" && detail.ai_fix_status !== "building") {
1614
1614
  throw new CliError(
1615
1615
  CLI_EXIT_CODES.GENERIC_ERROR,
1616
- `Ticket #${detail.sequence_number} is in ai_fix_status='${detail.ai_fix_status}', expected 'approved'`,
1616
+ `Ticket #${detail.sequence_number} is in ai_fix_status='${detail.ai_fix_status}', expected 'approved' or 'building'`,
1617
1617
  "Ask an admin to re-approve, or run task work again to pick a different ticket."
1618
1618
  );
1619
1619
  }
@@ -1660,6 +1660,28 @@ ${c.bold(`#${detail.sequence_number}: ${detail.title}`)}
1660
1660
  output_excerpt: branchName
1661
1661
  }
1662
1662
  });
1663
+ try {
1664
+ await apiCallOrThrow(
1665
+ "POST",
1666
+ `/api/v1/cli/me/tickets/${detail.id}/claim`
1667
+ );
1668
+ } catch (err) {
1669
+ try {
1670
+ checkoutBranch(cwd, baseBranch);
1671
+ } catch {
1672
+ }
1673
+ deleteLocalBranch(cwd, branchName);
1674
+ await apiCall("POST", "/api/v1/cli/me/runs", {
1675
+ body: {
1676
+ ticket_id: detail.id,
1677
+ schedule_id: opts.scheduleId,
1678
+ event: "branch_check_failed",
1679
+ claude_session_id: runId,
1680
+ output_excerpt: err.message.slice(0, 4e3)
1681
+ }
1682
+ });
1683
+ throw err;
1684
+ }
1663
1685
  const approvedFix = detail.ai_fix_structured;
1664
1686
  const ticketBlock = [
1665
1687
  `# Ticket #${detail.sequence_number}: ${detail.title}`,
@@ -3740,7 +3762,7 @@ function checkBinary(name, command) {
3740
3762
  }
3741
3763
 
3742
3764
  // src/commands/version.ts
3743
- var CLI_VERSION = true ? "0.1.8" : "0.0.0-dev";
3765
+ var CLI_VERSION = true ? "0.1.9" : "0.0.0-dev";
3744
3766
  function registerVersion(program2) {
3745
3767
  program2.command("version").description("Print the CLI version").action(() => {
3746
3768
  process.stdout.write(CLI_VERSION + "\n");