@pourkit/cli 0.0.0-next-20260622235247 → 0.0.0-next-20260623054630

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
@@ -6477,6 +6477,61 @@ function isAllowedDocumentationTokenReference(value) {
6477
6477
  return /^token\s*:\s*["']?<verdict>/i.test(value);
6478
6478
  }
6479
6479
 
6480
+ // issues/final-commit.ts
6481
+ init_common();
6482
+ async function runFinalCommit(options) {
6483
+ const { worktreePath, worktreeState, baseRef, title, body, logger } = options;
6484
+ if (worktreeState?.finalCommit?.completed) {
6485
+ const storedSha = worktreeState.finalCommit.sha;
6486
+ if (!storedSha) {
6487
+ throw new Error("Final Commit state is incomplete: missing stored sha");
6488
+ }
6489
+ const revParse2 = await execCapture("git", ["rev-parse", "HEAD"], {
6490
+ cwd: worktreePath,
6491
+ logger,
6492
+ label: "git rev-parse HEAD"
6493
+ });
6494
+ const currentSha = revParse2.stdout.trim();
6495
+ if (currentSha !== storedSha) {
6496
+ throw new Error(
6497
+ `Final Commit state is stale: stored sha ${storedSha} does not match current HEAD ${currentSha}`
6498
+ );
6499
+ }
6500
+ return { status: "skipped", sha: storedSha };
6501
+ }
6502
+ await assertCanonicalBaseAncestor2({
6503
+ worktreePath,
6504
+ baseRef,
6505
+ stageName: "final commit",
6506
+ logger
6507
+ });
6508
+ await execCapture("git", ["reset", "--soft", baseRef], {
6509
+ cwd: worktreePath,
6510
+ logger,
6511
+ label: "git reset"
6512
+ });
6513
+ await execCapture("git", ["add", "-A"], {
6514
+ cwd: worktreePath,
6515
+ logger,
6516
+ label: "git add"
6517
+ });
6518
+ await execCapture("git", ["commit", "--no-verify", "-m", title, "-m", body], {
6519
+ cwd: worktreePath,
6520
+ logger,
6521
+ label: "git commit"
6522
+ });
6523
+ const revParse = await execCapture("git", ["rev-parse", "HEAD"], {
6524
+ cwd: worktreePath,
6525
+ logger,
6526
+ label: "git rev-parse HEAD"
6527
+ });
6528
+ const sha = revParse.stdout.trim();
6529
+ updateWorktreeRunState(worktreePath, {
6530
+ finalCommit: { completed: true, sha }
6531
+ });
6532
+ return { status: "completed", sha };
6533
+ }
6534
+
6480
6535
  // issues/issue-worktree-resolution.ts
6481
6536
  init_common();
6482
6537
  import { join as join14 } from "path";
@@ -6895,35 +6950,20 @@ async function completeIssueRun(options) {
6895
6950
  );
6896
6951
  const prTitle = prDescriptionAgentResult.title;
6897
6952
  const prBody = prDescriptionAgentResult.body;
6898
- const stateBeforeFinalCommit = readCurrentWorktreeState();
6899
- const finalCommitFromState = stateBeforeFinalCommit?.finalCommit?.completed;
6900
- if (!finalCommitFromState) {
6901
- await finalizeWorktreeCommit({
6902
- worktreePath: executionResult.worktreePath,
6903
- baseRef: `origin/${effectiveBaseBranch}`,
6904
- title: prTitle,
6905
- body: prBody,
6906
- logger
6907
- });
6908
- if (executionResult.worktreePath) {
6909
- const revParse = await execCapture("git", ["rev-parse", "HEAD"], {
6910
- cwd: executionResult.worktreePath,
6911
- logger,
6912
- label: "git rev-parse HEAD"
6913
- });
6914
- updateWorktreeRunState(executionResult.worktreePath, {
6915
- finalCommit: {
6916
- completed: true,
6917
- sha: revParse.stdout.trim()
6918
- }
6919
- });
6920
- }
6921
- }
6922
6953
  if (!executionResult.worktreePath) {
6923
6954
  throw new Error(
6924
6955
  "Lifecycle invariant: GitHub Issue Publication requires a worktree path"
6925
6956
  );
6926
6957
  }
6958
+ const stateBeforeFinalCommit = readCurrentWorktreeState();
6959
+ await runFinalCommit({
6960
+ worktreePath: executionResult.worktreePath,
6961
+ worktreeState: stateBeforeFinalCommit,
6962
+ baseRef: `origin/${effectiveBaseBranch}`,
6963
+ title: prTitle,
6964
+ body: prBody,
6965
+ logger
6966
+ });
6927
6967
  const publication = await publishGitHubIssue({
6928
6968
  issue,
6929
6969
  branchName,
@@ -7008,30 +7048,6 @@ function extractHumanHandoffSummary(artifactContent) {
7008
7048
  function getRefactorArtifactDir(artifactPath) {
7009
7049
  return artifactPath.replace(/\/reviewers\//, "/refactors/").replace(/\/[^/]+$/, "");
7010
7050
  }
7011
- async function finalizeWorktreeCommit(options) {
7012
- const { worktreePath, baseRef, title, body, logger } = options;
7013
- await assertCanonicalBaseAncestor2({
7014
- worktreePath,
7015
- baseRef,
7016
- stageName: "final commit",
7017
- logger
7018
- });
7019
- await execCapture("git", ["reset", "--soft", baseRef], {
7020
- cwd: worktreePath,
7021
- logger,
7022
- label: "git reset"
7023
- });
7024
- await execCapture("git", ["add", "-A"], {
7025
- cwd: worktreePath,
7026
- logger,
7027
- label: "git add"
7028
- });
7029
- await execCapture("git", ["commit", "--no-verify", "-m", title, "-m", body], {
7030
- cwd: worktreePath,
7031
- logger,
7032
- label: "git commit"
7033
- });
7034
- }
7035
7051
  function makeIssueTransitions2(provider, config) {
7036
7052
  return createIssueTransitions(
7037
7053
  {
@@ -9918,6 +9934,7 @@ var BASELINE_MANAGED_SKILLS = [
9918
9934
  "ship-current-changes",
9919
9935
  "tdd",
9920
9936
  "to-issues",
9937
+ "to-oneshot",
9921
9938
  "to-prd",
9922
9939
  "triage",
9923
9940
  "write-a-skill",
@@ -10147,21 +10164,13 @@ var BASELINE_SKILL_NAMES = [
10147
10164
  "ship-current-changes",
10148
10165
  "tdd",
10149
10166
  "to-issues",
10167
+ "to-oneshot",
10150
10168
  "to-prd",
10151
10169
  "triage",
10152
10170
  "write-a-skill",
10153
10171
  "zoom-out"
10154
10172
  ];
10155
10173
  var NO_TOKEN_LABEL_PROVISIONING_WARNING = "Skipped GitHub label provisioning because no GitHub token was provided.";
10156
- var ALLOWED_VERIFICATION_SCRIPTS = [
10157
- "typecheck",
10158
- "lint",
10159
- "test",
10160
- "test:agent",
10161
- "build",
10162
- "check",
10163
- "prettier:check"
10164
- ];
10165
10174
  var DEFAULT_RUNNER_LABELS = {
10166
10175
  readyForAgent: "ready-for-agent",
10167
10176
  agentInProgress: "agent-in-progress",
@@ -10262,64 +10271,63 @@ function resolveCanonicalLabels(runnerLabels) {
10262
10271
  return { ...meta, name };
10263
10272
  });
10264
10273
  }
10265
- function inferVerificationCommands(scripts, pm) {
10266
- const pmPrefix = pm === "npm" ? "npm run" : pm === "pnpm" ? "pnpm run" : pm === "yarn" ? "yarn" : pm === "bun" ? "bun run" : "npm run";
10267
- const allowlist = ALLOWED_VERIFICATION_SCRIPTS;
10268
- const matched = allowlist.filter((s) => s in scripts);
10269
- const commands = [];
10270
- for (const script of matched) {
10271
- if (script === "test" && matched.includes("test:agent")) continue;
10272
- commands.push({ label: script, command: `${pmPrefix} ${script}` });
10273
- }
10274
- return commands;
10275
- }
10276
10274
  function generateConfigTemplate(options) {
10277
10275
  const {
10278
10276
  baseBranch,
10279
10277
  packageManager,
10280
- verificationCommands,
10281
10278
  hasPackageJson = true,
10282
10279
  labels: maybeLabels
10283
10280
  } = options;
10284
10281
  const labels = maybeLabels ?? DEFAULT_RUNNER_LABELS;
10285
- const setupCommand = `${packageManager} install`;
10282
+ const setupCommand = `HUSKY=0 ${packageManager} install`;
10283
+ const runCommand = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
10284
+ const verificationCommands = [
10285
+ { command: `${runCommand} lint`, label: "lint" },
10286
+ { command: `${runCommand} test`, label: "tests" },
10287
+ { command: `${runCommand} build`, label: "build" }
10288
+ ];
10286
10289
  const target = {
10287
10290
  name: "default",
10288
10291
  baseBranch,
10289
10292
  branchTemplate: "pourkit/{{issue.number}}/{{issue.slug}}",
10290
- autoMerge: false,
10293
+ autoMerge: true,
10291
10294
  strategy: {
10292
10295
  type: "review-refactor-loop",
10293
10296
  implement: {
10294
10297
  builder: {
10295
10298
  agent: "pourkit-builder",
10296
10299
  model: "opencode-go/deepseek-v4-flash",
10300
+ variant: "medium",
10297
10301
  promptTemplate: ".pourkit/managed/prompts/builder.prompt.md"
10298
10302
  }
10299
10303
  },
10300
10304
  failureResolution: {
10301
10305
  agent: "pourkit-failure-resolution-agent",
10302
10306
  model: "opencode-go/mimo-v2.5",
10307
+ variant: "high",
10303
10308
  promptTemplate: ".pourkit/managed/prompts/failure-resolution.prompt.md",
10304
10309
  maxAttemptsPerFailure: 1
10305
10310
  },
10306
10311
  review: {
10307
10312
  reviewer: {
10308
10313
  agent: "pourkit-reviewer",
10309
- model: "opencode-go/deepseek-v4-pro",
10314
+ model: "opencode-go/mimo-v2.5",
10315
+ variant: "high",
10310
10316
  promptTemplate: ".pourkit/managed/prompts/reviewer.prompt.md",
10311
10317
  criteria: ["correctness", "scope", "tests", "quality"]
10312
10318
  },
10313
10319
  refactor: {
10314
10320
  agent: "pourkit-refactor",
10315
- model: "opencode-go/qwen3.6-plus",
10321
+ model: "opencode-go/deepseek-v4-flash",
10322
+ variant: "medium",
10316
10323
  promptTemplate: ".pourkit/managed/prompts/refactor.prompt.md"
10317
10324
  },
10318
- maxIterations: 3
10325
+ maxIterations: 20
10319
10326
  },
10320
10327
  issueFinalReview: {
10321
10328
  agent: "pourkit-reviewer",
10322
- model: "opencode-go/deepseek-v4-pro",
10329
+ model: "opencode-go/kimi-k2.7-code",
10330
+ variant: "max",
10323
10331
  promptTemplate: ".pourkit/managed/prompts/issue-final-review.prompt.md",
10324
10332
  maxAttempts: 3
10325
10333
  },
@@ -10338,11 +10346,9 @@ function generateConfigTemplate(options) {
10338
10346
  { command: setupCommand, label: "install" }
10339
10347
  ];
10340
10348
  }
10341
- if (verificationCommands.length > 0) {
10342
- target.strategy.verify = {
10343
- commands: verificationCommands
10344
- };
10345
- }
10349
+ target.strategy.verify = {
10350
+ commands: verificationCommands
10351
+ };
10346
10352
  const config = {
10347
10353
  $schema: "./schema/pourkit.schema.json",
10348
10354
  schemaVersion: 3,
@@ -10364,10 +10370,12 @@ function generateConfigTemplate(options) {
10364
10370
  agentInProgress: labels.agentInProgress,
10365
10371
  blocked: labels.blocked,
10366
10372
  prOpenAwaitingMerge: labels.prOpenAwaitingMerge,
10367
- readyForHuman: labels.readyForHuman
10373
+ readyForHuman: labels.readyForHuman,
10374
+ needsTriage: "needs-triage"
10368
10375
  },
10369
10376
  sandbox: {
10370
10377
  provider: "docker",
10378
+ forceRebuild: true,
10371
10379
  copyToWorktree: ["node_modules"],
10372
10380
  mounts: [
10373
10381
  {
@@ -10385,18 +10393,13 @@ function generateConfigTemplate(options) {
10385
10393
  HOME: "/home/agent",
10386
10394
  XDG_DATA_HOME: "/home/agent/.local/share",
10387
10395
  XDG_CONFIG_HOME: "/home/agent/.config",
10388
- XDG_STATE_HOME: "/home/agent/.local/state",
10389
- XDG_CACHE_HOME: "/home/agent/.cache"
10396
+ XDG_STATE_HOME: "/home/agent/.local/state"
10390
10397
  },
10391
- idleTimeoutSeconds: 300
10398
+ idleTimeoutSeconds: 800
10392
10399
  },
10393
10400
  checks: {
10394
10401
  requiredLabels: [],
10395
- allowedAuthors: [],
10396
- checksFoundTimeoutSeconds: 60,
10397
- checksCompletionTimeoutSeconds: 1800,
10398
- pollIntervalSeconds: 15,
10399
- issueListLimit: 50
10402
+ allowedAuthors: []
10400
10403
  }
10401
10404
  };
10402
10405
  return JSON.stringify(config, null, 2) + "\n";
@@ -11048,17 +11051,9 @@ async function planInit(options) {
11048
11051
  });
11049
11052
  }
11050
11053
  }
11051
- let packageScripts = {};
11052
11054
  let hasPackageJson = true;
11053
11055
  try {
11054
- const pkgContent = await readFile4(
11055
- path5.join(targetRoot, "package.json"),
11056
- "utf-8"
11057
- );
11058
- const pkg = JSON.parse(pkgContent);
11059
- if (pkg.scripts && typeof pkg.scripts === "object") {
11060
- packageScripts = pkg.scripts;
11061
- }
11056
+ await readFile4(path5.join(targetRoot, "package.json"), "utf-8");
11062
11057
  } catch {
11063
11058
  hasPackageJson = false;
11064
11059
  }
@@ -11285,14 +11280,9 @@ Do not edit this file.
11285
11280
  }
11286
11281
  const configJsonPath = path5.join(targetRoot, ".pourkit", "config.json");
11287
11282
  if (!existsSync16(configJsonPath)) {
11288
- const verifyCommands = inferVerificationCommands(
11289
- packageScripts,
11290
- pm || "npm"
11291
- );
11292
11283
  const configContent = generateConfigTemplate({
11293
11284
  packageManager: pm || "npm",
11294
11285
  baseBranch,
11295
- verificationCommands: verifyCommands,
11296
11286
  hasPackageJson,
11297
11287
  labels: options.labels,
11298
11288
  releaseWorkflow: options.releaseWorkflow,
@@ -15543,11 +15533,11 @@ function createCliProgram(version) {
15543
15533
  return program;
15544
15534
  }
15545
15535
  async function resolveCliVersion() {
15546
- if (isPackageVersion("0.0.0-next-20260622235247")) {
15547
- return "0.0.0-next-20260622235247";
15536
+ if (isPackageVersion("0.0.0-next-20260623054630")) {
15537
+ return "0.0.0-next-20260623054630";
15548
15538
  }
15549
- if (isReleaseVersion("0.0.0-next-20260622235247")) {
15550
- return "0.0.0-next-20260622235247";
15539
+ if (isReleaseVersion("0.0.0-next-20260623054630")) {
15540
+ return "0.0.0-next-20260623054630";
15551
15541
  }
15552
15542
  try {
15553
15543
  const root = repoRoot();