@pourkit/cli 0.0.0-next-20260714073403 → 0.0.0-next-20260715085442
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 +215 -42
- package/dist/cli.js.map +1 -1
- package/dist/e2e/run-live-e2e.js +49 -7
- package/dist/e2e/run-live-e2e.js.map +1 -1
- package/dist/schema/pourkit.schema.hash +1 -1
- package/dist/schema/pourkit.schema.json +280 -90
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -370,10 +370,26 @@ function applyOutputRetriesDefaults(retries) {
|
|
|
370
370
|
}
|
|
371
371
|
function applyStageAgentDefaults(agent) {
|
|
372
372
|
return {
|
|
373
|
-
|
|
373
|
+
agent: agent.agent,
|
|
374
|
+
model: agent.model,
|
|
375
|
+
variant: agent.variant,
|
|
376
|
+
env: agent.env,
|
|
377
|
+
promptTemplate: agent.promptTemplate,
|
|
374
378
|
outputRetries: applyOutputRetriesDefaults(agent.outputRetries)
|
|
375
379
|
};
|
|
376
380
|
}
|
|
381
|
+
var DEFAULT_POST_COMPLETION_FINAL_REVIEW_PROMPT = "post-completion-final-review.prompt.md";
|
|
382
|
+
function applyPostCompletionFinalReviewDefaults(agent, issueFinalReview) {
|
|
383
|
+
if (agent) return applyStageAgentDefaults(agent);
|
|
384
|
+
return applyStageAgentDefaults({
|
|
385
|
+
agent: issueFinalReview.agent,
|
|
386
|
+
model: issueFinalReview.model,
|
|
387
|
+
variant: issueFinalReview.variant,
|
|
388
|
+
env: issueFinalReview.env,
|
|
389
|
+
promptTemplate: DEFAULT_POST_COMPLETION_FINAL_REVIEW_PROMPT,
|
|
390
|
+
outputRetries: issueFinalReview.outputRetries
|
|
391
|
+
});
|
|
392
|
+
}
|
|
377
393
|
function assertRepoRelativePath(value, location) {
|
|
378
394
|
const normalized = normalize(value);
|
|
379
395
|
if (isAbsolute(value) || isAbsolute(normalized) || normalized === ".." || normalized.startsWith(`..${sep}`)) {
|
|
@@ -432,6 +448,10 @@ function validateConfigSemantics(input) {
|
|
|
432
448
|
target.strategy.issueFinalReview,
|
|
433
449
|
`targets[${targetIndex}].strategy.issueFinalReview`
|
|
434
450
|
);
|
|
451
|
+
assertStageAgentPath(
|
|
452
|
+
target.strategy.postCompletionFinalReview,
|
|
453
|
+
`targets[${targetIndex}].strategy.postCompletionFinalReview`
|
|
454
|
+
);
|
|
435
455
|
assertStageAgentPath(
|
|
436
456
|
target.strategy.finalize.prDescriptionAgent,
|
|
437
457
|
`targets[${targetIndex}].strategy.finalize.prDescriptionAgent`
|
|
@@ -506,6 +526,10 @@ function normalizePourkitConfig(input) {
|
|
|
506
526
|
),
|
|
507
527
|
maxAttempts: t.strategy.issueFinalReview.maxAttempts
|
|
508
528
|
},
|
|
529
|
+
postCompletionFinalReview: applyPostCompletionFinalReviewDefaults(
|
|
530
|
+
t.strategy.postCompletionFinalReview,
|
|
531
|
+
t.strategy.issueFinalReview
|
|
532
|
+
),
|
|
509
533
|
finalize: {
|
|
510
534
|
prDescriptionAgent: applyStageAgentDefaults(
|
|
511
535
|
t.strategy.finalize.prDescriptionAgent
|
|
@@ -4257,6 +4281,20 @@ var POST_COMPLETION_FINAL_REVIEW_ARTIFACT_PATH = join9(
|
|
|
4257
4281
|
"post-completion-final-review",
|
|
4258
4282
|
"agent-output.json"
|
|
4259
4283
|
);
|
|
4284
|
+
var DEFAULT_POST_COMPLETION_FINAL_REVIEW_PROMPT2 = "post-completion-final-review.prompt.md";
|
|
4285
|
+
function resolvePostCompletionFinalReviewAgent(target) {
|
|
4286
|
+
const configured = target.strategy.postCompletionFinalReview;
|
|
4287
|
+
if (configured) return configured;
|
|
4288
|
+
const fallback = target.strategy.issueFinalReview;
|
|
4289
|
+
return {
|
|
4290
|
+
agent: fallback.agent,
|
|
4291
|
+
model: fallback.model,
|
|
4292
|
+
variant: fallback.variant,
|
|
4293
|
+
env: fallback.env,
|
|
4294
|
+
outputRetries: fallback.outputRetries,
|
|
4295
|
+
promptTemplate: DEFAULT_POST_COMPLETION_FINAL_REVIEW_PROMPT2
|
|
4296
|
+
};
|
|
4297
|
+
}
|
|
4260
4298
|
async function runPostCompletionFinalReview(options) {
|
|
4261
4299
|
const {
|
|
4262
4300
|
executionProvider,
|
|
@@ -4308,9 +4346,10 @@ async function runPostCompletionFinalReview(options) {
|
|
|
4308
4346
|
};
|
|
4309
4347
|
}
|
|
4310
4348
|
const strategy = target.strategy;
|
|
4311
|
-
const agent =
|
|
4349
|
+
const agent = resolvePostCompletionFinalReviewAgent(target);
|
|
4312
4350
|
const prompt = loadPostCompletionFinalReviewPrompt({
|
|
4313
4351
|
repoRoot: repoRoot2,
|
|
4352
|
+
promptTemplate: agent.promptTemplate,
|
|
4314
4353
|
sourceDocumentPath,
|
|
4315
4354
|
completedBranch,
|
|
4316
4355
|
validationCommand: `pourkit validate-artifact post-completion-final-review ${artifactPathInWorktree}`,
|
|
@@ -4452,11 +4491,14 @@ Completed branch: ${completedBranch}`,
|
|
|
4452
4491
|
);
|
|
4453
4492
|
}
|
|
4454
4493
|
function loadPostCompletionFinalReviewPrompt(options) {
|
|
4455
|
-
const {
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4494
|
+
const {
|
|
4495
|
+
repoRoot: repoRoot2,
|
|
4496
|
+
promptTemplate,
|
|
4497
|
+
sourceDocumentPath,
|
|
4498
|
+
completedBranch,
|
|
4499
|
+
validationCommand
|
|
4500
|
+
} = options;
|
|
4501
|
+
const promptPath = resolvePromptTemplatePath(repoRoot2, promptTemplate);
|
|
4460
4502
|
const promptBody = existsSync9(promptPath) ? readFileSync8(promptPath, "utf-8") : `Review the completed branch against the source document.
|
|
4461
4503
|
|
|
4462
4504
|
## Source Document
|
|
@@ -11090,10 +11132,11 @@ async function runPrdPlanWorkspacePublishCommand(options) {
|
|
|
11090
11132
|
|
|
11091
11133
|
// commands/prd-run.ts
|
|
11092
11134
|
import { lstatSync, realpathSync } from "fs";
|
|
11093
|
-
import { join as
|
|
11135
|
+
import { join as join24 } from "path";
|
|
11094
11136
|
|
|
11095
11137
|
// prd-run/coordinator.ts
|
|
11096
11138
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11139
|
+
import { join as join23 } from "path";
|
|
11097
11140
|
import { Match, pipe } from "effect";
|
|
11098
11141
|
init_common();
|
|
11099
11142
|
|
|
@@ -11810,7 +11853,8 @@ function validatePrdRunTerminalEvidence(record, context) {
|
|
|
11810
11853
|
humanReadableReason: `PRD Run ${context.prdRef} is missing proof that all child Issues finalized into ${context.prdBranch}.`,
|
|
11811
11854
|
repairability: "operator-action",
|
|
11812
11855
|
nextAction: "inspect-and-retry",
|
|
11813
|
-
nextRecommendedCommand: "pourkit prd-run launch"
|
|
11856
|
+
nextRecommendedCommand: "pourkit prd-run launch",
|
|
11857
|
+
diagnostics: [...context.childFinalizationDiagnostics ?? []]
|
|
11814
11858
|
})
|
|
11815
11859
|
};
|
|
11816
11860
|
}
|
|
@@ -13239,6 +13283,105 @@ async function selectPrdRunCoordinatorMode(options) {
|
|
|
13239
13283
|
})
|
|
13240
13284
|
};
|
|
13241
13285
|
}
|
|
13286
|
+
function escapeRegExp3(value) {
|
|
13287
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13288
|
+
}
|
|
13289
|
+
function normalizeChildRef2(value) {
|
|
13290
|
+
const match = value.match(/^I-0*(\d+)$/i);
|
|
13291
|
+
if (!match) return null;
|
|
13292
|
+
return `I-${match[1].padStart(2, "0")}`;
|
|
13293
|
+
}
|
|
13294
|
+
function issueChildRef(prdRef, issue) {
|
|
13295
|
+
const match = issue.title.match(
|
|
13296
|
+
new RegExp(`^${escapeRegExp3(prdRef)}\\s*/\\s*(I-0*\\d+)\\s*:`, "i")
|
|
13297
|
+
);
|
|
13298
|
+
return match ? normalizeChildRef2(match[1]) : null;
|
|
13299
|
+
}
|
|
13300
|
+
function issueSummary(issue) {
|
|
13301
|
+
return `#${issue.number} ${issue.title}`;
|
|
13302
|
+
}
|
|
13303
|
+
async function readPlannedChildRefs(options) {
|
|
13304
|
+
const sourceDocument = await resolvePrdPostCompletionSourceDocument(options);
|
|
13305
|
+
if (!sourceDocument || sourceDocument.status !== "resolved") {
|
|
13306
|
+
return {
|
|
13307
|
+
ok: false,
|
|
13308
|
+
diagnostics: sourceDocument && sourceDocument.status === "blocked" ? [...sourceDocument.diagnostics] : [
|
|
13309
|
+
sourceDocument?.reason ?? `Unable to resolve source document for ${options.prdRef}.`
|
|
13310
|
+
]
|
|
13311
|
+
};
|
|
13312
|
+
}
|
|
13313
|
+
const parsed = await parsePrdPlanWorkspace({
|
|
13314
|
+
workspacePath: join23(options.repoRoot, sourceDocument.workspacePath),
|
|
13315
|
+
prdRef: options.prdRef
|
|
13316
|
+
});
|
|
13317
|
+
if (!parsed.ok) {
|
|
13318
|
+
return {
|
|
13319
|
+
ok: false,
|
|
13320
|
+
diagnostics: parsed.diagnostics.map((diagnostic) => diagnostic.message)
|
|
13321
|
+
};
|
|
13322
|
+
}
|
|
13323
|
+
return {
|
|
13324
|
+
ok: true,
|
|
13325
|
+
childRefs: parsed.workspace.children.map((child) => child.childRef)
|
|
13326
|
+
};
|
|
13327
|
+
}
|
|
13328
|
+
async function verifyPrdChildFinalizationEvidence(options) {
|
|
13329
|
+
const diagnostics = [];
|
|
13330
|
+
const unfinalizedProcessed = options.processedResults.filter(
|
|
13331
|
+
(result) => !result.noOp && result.publicationStatus !== "merged"
|
|
13332
|
+
);
|
|
13333
|
+
if (unfinalizedProcessed.length > 0) {
|
|
13334
|
+
diagnostics.push(
|
|
13335
|
+
`Processed child Issues missing PRD Branch merge/no-op evidence: ${unfinalizedProcessed.map((result) => `#${result.issueNumber}`).join(", ")}.`
|
|
13336
|
+
);
|
|
13337
|
+
}
|
|
13338
|
+
let relatedIssues;
|
|
13339
|
+
try {
|
|
13340
|
+
relatedIssues = await options.issueProvider.listRelatedIssues(
|
|
13341
|
+
options.prdRef
|
|
13342
|
+
);
|
|
13343
|
+
} catch (error) {
|
|
13344
|
+
return {
|
|
13345
|
+
ok: false,
|
|
13346
|
+
diagnostics: [
|
|
13347
|
+
`Failed to list child Issues for ${options.prdRef}: ${error instanceof Error ? error.message : String(error)}`
|
|
13348
|
+
]
|
|
13349
|
+
};
|
|
13350
|
+
}
|
|
13351
|
+
if (relatedIssues.length === 0) {
|
|
13352
|
+
diagnostics.push(`No child Issue projections found for ${options.prdRef}.`);
|
|
13353
|
+
}
|
|
13354
|
+
const planned = await readPlannedChildRefs({
|
|
13355
|
+
repoRoot: options.repoRoot,
|
|
13356
|
+
prdRef: options.prdRef
|
|
13357
|
+
});
|
|
13358
|
+
if (!planned.ok) {
|
|
13359
|
+
diagnostics.push(...planned.diagnostics);
|
|
13360
|
+
} else if (planned.childRefs.length === 0) {
|
|
13361
|
+
diagnostics.push(`No planned child Issues found for ${options.prdRef}.`);
|
|
13362
|
+
} else {
|
|
13363
|
+
const relatedRefs = new Set(
|
|
13364
|
+
relatedIssues.map((issue) => issueChildRef(options.prdRef, issue)).filter((ref) => ref !== null)
|
|
13365
|
+
);
|
|
13366
|
+
const missingRefs = planned.childRefs.filter(
|
|
13367
|
+
(ref) => !relatedRefs.has(ref)
|
|
13368
|
+
);
|
|
13369
|
+
if (missingRefs.length > 0) {
|
|
13370
|
+
diagnostics.push(
|
|
13371
|
+
`Planned child Issues without published Issue projections: ${missingRefs.join(", ")}.`
|
|
13372
|
+
);
|
|
13373
|
+
}
|
|
13374
|
+
}
|
|
13375
|
+
const openRelatedIssues = relatedIssues.filter(
|
|
13376
|
+
(issue) => issue.state !== "closed"
|
|
13377
|
+
);
|
|
13378
|
+
if (openRelatedIssues.length > 0) {
|
|
13379
|
+
diagnostics.push(
|
|
13380
|
+
`Child Issues still open: ${openRelatedIssues.map(issueSummary).join(", ")}.`
|
|
13381
|
+
);
|
|
13382
|
+
}
|
|
13383
|
+
return { ok: diagnostics.length === 0, diagnostics };
|
|
13384
|
+
}
|
|
13242
13385
|
async function runPostCompletionAfterTerminal(options, prdRef, record, resumeFacts, startOutcome) {
|
|
13243
13386
|
const receipt = record.postCompletionFinalReview;
|
|
13244
13387
|
if (receipt?.status === "passed" || receipt?.status === "overridden") {
|
|
@@ -13798,17 +13941,25 @@ async function launchPrdRun(options) {
|
|
|
13798
13941
|
logger: options.logger
|
|
13799
13942
|
});
|
|
13800
13943
|
}
|
|
13801
|
-
|
|
13802
|
-
|
|
13944
|
+
const parentClosureIssueProvider = options.issueProvider;
|
|
13945
|
+
if (currentRecord && startReceipt && parentClosureIssueProvider && activeRepairGuidance?.failureCode === "missing-child-finalization-evidence" && await prdParentIssueIsClosed({
|
|
13946
|
+
issueProvider: parentClosureIssueProvider,
|
|
13803
13947
|
prdRef,
|
|
13804
13948
|
logger: options.logger
|
|
13805
13949
|
})) {
|
|
13806
13950
|
const prdBranch = startReceipt.prdBranch ?? prdRef;
|
|
13951
|
+
const childFinalizationEvidence = await verifyPrdChildFinalizationEvidence({
|
|
13952
|
+
repoRoot: options.repoRoot,
|
|
13953
|
+
prdRef,
|
|
13954
|
+
issueProvider: parentClosureIssueProvider,
|
|
13955
|
+
processedResults: []
|
|
13956
|
+
});
|
|
13807
13957
|
const terminalEvidence = validatePrdRunTerminalEvidence(currentRecord, {
|
|
13808
13958
|
prdRef,
|
|
13809
13959
|
baseBranch: startReceipt.startBaseBranch,
|
|
13810
13960
|
prdBranch,
|
|
13811
|
-
allChildIssuesFinalizedIntoPrdBranch:
|
|
13961
|
+
allChildIssuesFinalizedIntoPrdBranch: childFinalizationEvidence.ok,
|
|
13962
|
+
childFinalizationDiagnostics: childFinalizationEvidence.diagnostics
|
|
13812
13963
|
});
|
|
13813
13964
|
if (!terminalEvidence.ok) {
|
|
13814
13965
|
return buildLaunchBlockedOutcome(
|
|
@@ -14042,11 +14193,22 @@ async function launchGithubQueueDrain(options, prdRef, startReceipt, targetName,
|
|
|
14042
14193
|
writeDrainedRecord(options.repoRoot, prdRef, startReceipt, targetName);
|
|
14043
14194
|
const drainRecord = readPrdRun(options.repoRoot, prdRef).record;
|
|
14044
14195
|
if (drainRecord) {
|
|
14196
|
+
const childFinalizationEvidence = await verifyPrdChildFinalizationEvidence({
|
|
14197
|
+
repoRoot: options.repoRoot,
|
|
14198
|
+
prdRef,
|
|
14199
|
+
issueProvider,
|
|
14200
|
+
processedResults: outcome.results.map((result2) => ({
|
|
14201
|
+
issueNumber: result2.selected.number,
|
|
14202
|
+
noOp: result2.runResult.noOp,
|
|
14203
|
+
publicationStatus: result2.runResult.publicationStatus
|
|
14204
|
+
}))
|
|
14205
|
+
});
|
|
14045
14206
|
const drainContext = {
|
|
14046
14207
|
prdRef,
|
|
14047
14208
|
baseBranch: startReceipt.startBaseBranch,
|
|
14048
14209
|
prdBranch,
|
|
14049
|
-
allChildIssuesFinalizedIntoPrdBranch:
|
|
14210
|
+
allChildIssuesFinalizedIntoPrdBranch: childFinalizationEvidence.ok,
|
|
14211
|
+
childFinalizationDiagnostics: childFinalizationEvidence.diagnostics
|
|
14050
14212
|
};
|
|
14051
14213
|
const terminalEvidence = validatePrdRunTerminalEvidence(
|
|
14052
14214
|
drainRecord,
|
|
@@ -14801,13 +14963,18 @@ async function launchBeadsQueueDrain(options, prdRef, startReceipt, targetName,
|
|
|
14801
14963
|
writeDrainedRecord(options.repoRoot, prdRef, startReceipt, targetName);
|
|
14802
14964
|
const drainRecord = readPrdRun(options.repoRoot, prdRef).record;
|
|
14803
14965
|
if (drainRecord) {
|
|
14966
|
+
const childFinalizationEvidence = await verifyPrdChildFinalizationEvidence({
|
|
14967
|
+
repoRoot: options.repoRoot,
|
|
14968
|
+
prdRef,
|
|
14969
|
+
issueProvider,
|
|
14970
|
+
processedResults
|
|
14971
|
+
});
|
|
14804
14972
|
const drainContext = {
|
|
14805
14973
|
prdRef,
|
|
14806
14974
|
baseBranch: startReceipt.startBaseBranch,
|
|
14807
14975
|
prdBranch,
|
|
14808
|
-
allChildIssuesFinalizedIntoPrdBranch:
|
|
14809
|
-
|
|
14810
|
-
)
|
|
14976
|
+
allChildIssuesFinalizedIntoPrdBranch: childFinalizationEvidence.ok,
|
|
14977
|
+
childFinalizationDiagnostics: childFinalizationEvidence.diagnostics
|
|
14811
14978
|
};
|
|
14812
14979
|
const terminalEvidence = validatePrdRunTerminalEvidence(
|
|
14813
14980
|
drainRecord,
|
|
@@ -15764,12 +15931,12 @@ icm --db .pourkit/icm/memories.db topics # list a
|
|
|
15764
15931
|
var MANAGED_BLOCK_BEGIN = "<!-- BEGIN POURKIT MANAGED BLOCK -->";
|
|
15765
15932
|
var MANAGED_BLOCK_END = "<!-- END POURKIT MANAGED BLOCK -->";
|
|
15766
15933
|
var MANAGED_BLOCK_PATTERN = new RegExp(
|
|
15767
|
-
`${
|
|
15934
|
+
`${escapeRegExp4(MANAGED_BLOCK_BEGIN)}\\r?\\n[\\s\\S]*?${escapeRegExp4(
|
|
15768
15935
|
MANAGED_BLOCK_END
|
|
15769
15936
|
)}[ \\t]*(?:\\r?\\n)?`,
|
|
15770
15937
|
"g"
|
|
15771
15938
|
);
|
|
15772
|
-
function
|
|
15939
|
+
function escapeRegExp4(value) {
|
|
15773
15940
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
15774
15941
|
}
|
|
15775
15942
|
function buildManagedBlock(content) {
|
|
@@ -15984,6 +16151,12 @@ function generateConfigTemplate(options) {
|
|
|
15984
16151
|
promptTemplate: ".pourkit/managed/prompts/issue-final-review.prompt.md",
|
|
15985
16152
|
maxAttempts: 3
|
|
15986
16153
|
},
|
|
16154
|
+
postCompletionFinalReview: {
|
|
16155
|
+
agent: "pourkit-reviewer",
|
|
16156
|
+
model: "openai/gpt-5.5",
|
|
16157
|
+
variant: "max",
|
|
16158
|
+
promptTemplate: ".pourkit/managed/prompts/post-completion-final-review.prompt.md"
|
|
16159
|
+
},
|
|
15987
16160
|
finalize: {
|
|
15988
16161
|
prDescriptionAgent: {
|
|
15989
16162
|
agent: "pourkit-pr-description",
|
|
@@ -16004,7 +16177,7 @@ function generateConfigTemplate(options) {
|
|
|
16004
16177
|
};
|
|
16005
16178
|
const config = {
|
|
16006
16179
|
$schema: "./schema/pourkit.schema.json",
|
|
16007
|
-
schemaVersion:
|
|
16180
|
+
schemaVersion: 4,
|
|
16008
16181
|
targets: [target],
|
|
16009
16182
|
workflowPack: {
|
|
16010
16183
|
version: "1.0.0",
|
|
@@ -17947,13 +18120,13 @@ Init applied: ${result.applied} operations applied, ${result.skipped} skipped.`
|
|
|
17947
18120
|
// commands/memory-init.ts
|
|
17948
18121
|
import { existsSync as existsSync20, mkdirSync as mkdirSync8, readFileSync as readFileSync19, writeFileSync as writeFileSync5 } from "fs";
|
|
17949
18122
|
import { execFile as execFile3 } from "child_process";
|
|
17950
|
-
import { join as
|
|
18123
|
+
import { join as join25 } from "path";
|
|
17951
18124
|
import { promisify as promisify3 } from "util";
|
|
17952
18125
|
var execFileAsync3 = promisify3(execFile3);
|
|
17953
18126
|
async function runMemoryInitCommand(options) {
|
|
17954
18127
|
const cwd = options.cwd ?? process.cwd();
|
|
17955
18128
|
const execCommand = options.execCommand ?? execFileAsync3;
|
|
17956
|
-
const configPath =
|
|
18129
|
+
const configPath = join25(cwd, ".pourkit", "config.json");
|
|
17957
18130
|
if (!existsSync20(configPath)) {
|
|
17958
18131
|
return {
|
|
17959
18132
|
ok: false,
|
|
@@ -17985,8 +18158,8 @@ async function runMemoryInitCommand(options) {
|
|
|
17985
18158
|
const next = { ...raw, memory };
|
|
17986
18159
|
writeFileSync5(configPath, JSON.stringify(next, null, 2) + "\n");
|
|
17987
18160
|
}
|
|
17988
|
-
const memoryDir =
|
|
17989
|
-
const memoryDbPath =
|
|
18161
|
+
const memoryDir = join25(cwd, ".pourkit", "icm");
|
|
18162
|
+
const memoryDbPath = join25(memoryDir, "memories.db");
|
|
17990
18163
|
mkdirSync8(memoryDir, { recursive: true });
|
|
17991
18164
|
let dbInitialized = false;
|
|
17992
18165
|
let warning;
|
|
@@ -18000,7 +18173,7 @@ async function runMemoryInitCommand(options) {
|
|
|
18000
18173
|
} catch {
|
|
18001
18174
|
warning = "ICM is not available or could not initialize .pourkit/icm/memories.db. Install ICM and run `pourkit doctor` to verify repo-scoped memory setup.";
|
|
18002
18175
|
}
|
|
18003
|
-
const gitignorePath =
|
|
18176
|
+
const gitignorePath = join25(cwd, ".gitignore");
|
|
18004
18177
|
updateManagedBlockSync(gitignorePath, generateGitignoreBlock());
|
|
18005
18178
|
const managed = await generateManagedAgentInstructions({
|
|
18006
18179
|
sourceRoot: cwd,
|
|
@@ -18008,14 +18181,14 @@ async function runMemoryInitCommand(options) {
|
|
|
18008
18181
|
});
|
|
18009
18182
|
let updatedAgentFile = false;
|
|
18010
18183
|
for (const fileName of ["AGENTS.md", "CLAUDE.md"]) {
|
|
18011
|
-
const agentPath =
|
|
18184
|
+
const agentPath = join25(cwd, fileName);
|
|
18012
18185
|
if (existsSync20(agentPath)) {
|
|
18013
18186
|
updateManagedBlockSync(agentPath, managed);
|
|
18014
18187
|
updatedAgentFile = true;
|
|
18015
18188
|
}
|
|
18016
18189
|
}
|
|
18017
18190
|
if (!updatedAgentFile) {
|
|
18018
|
-
updateManagedBlockSync(
|
|
18191
|
+
updateManagedBlockSync(join25(cwd, "AGENTS.md"), managed);
|
|
18019
18192
|
}
|
|
18020
18193
|
return {
|
|
18021
18194
|
ok: true,
|
|
@@ -20287,7 +20460,7 @@ init_common();
|
|
|
20287
20460
|
|
|
20288
20461
|
// execution/sandcastle-execution.ts
|
|
20289
20462
|
import { existsSync as existsSync24, mkdirSync as mkdirSync9, statSync as statSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
20290
|
-
import { join as
|
|
20463
|
+
import { join as join28 } from "path";
|
|
20291
20464
|
import { createWorktree, opencode } from "@ai-hero/sandcastle";
|
|
20292
20465
|
import { docker } from "@ai-hero/sandcastle/sandboxes/docker";
|
|
20293
20466
|
|
|
@@ -20296,10 +20469,10 @@ init_common();
|
|
|
20296
20469
|
import { mkdtempSync } from "fs";
|
|
20297
20470
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
20298
20471
|
import { tmpdir } from "os";
|
|
20299
|
-
import { dirname as dirname8, join as
|
|
20472
|
+
import { dirname as dirname8, join as join26 } from "path";
|
|
20300
20473
|
async function writeExecutionArtifacts(worktreePath, artifacts) {
|
|
20301
20474
|
for (const artifact of artifacts) {
|
|
20302
|
-
const filePath =
|
|
20475
|
+
const filePath = join26(worktreePath, artifact.path);
|
|
20303
20476
|
await ensureDir(dirname8(filePath));
|
|
20304
20477
|
await writeFile5(filePath, artifact.content, "utf-8");
|
|
20305
20478
|
}
|
|
@@ -20361,7 +20534,7 @@ async function createSandboxFromExistingWorktree(options) {
|
|
|
20361
20534
|
}
|
|
20362
20535
|
|
|
20363
20536
|
// execution/sandbox-options.ts
|
|
20364
|
-
import { join as
|
|
20537
|
+
import { join as join27 } from "path";
|
|
20365
20538
|
var POURKIT_ICM_CONTAINER_DIR = "/home/agent/.pourkit/icm";
|
|
20366
20539
|
function buildSandboxOptions(repoRoot2, sandbox, memory) {
|
|
20367
20540
|
const mounts = [];
|
|
@@ -20370,12 +20543,12 @@ function buildSandboxOptions(repoRoot2, sandbox, memory) {
|
|
|
20370
20543
|
}
|
|
20371
20544
|
if (memory?.available) {
|
|
20372
20545
|
mounts.push({
|
|
20373
|
-
hostPath:
|
|
20546
|
+
hostPath: join27(repoRoot2, ".pourkit", "icm"),
|
|
20374
20547
|
sandboxPath: POURKIT_ICM_CONTAINER_DIR,
|
|
20375
20548
|
readonly: false
|
|
20376
20549
|
});
|
|
20377
20550
|
mounts.push({
|
|
20378
|
-
hostPath:
|
|
20551
|
+
hostPath: join27(repoRoot2, ".pourkit", "icm", "cache"),
|
|
20379
20552
|
sandboxPath: "/home/agent/.cache/icm",
|
|
20380
20553
|
readonly: false
|
|
20381
20554
|
});
|
|
@@ -20509,13 +20682,13 @@ var SandcastleExecutionSession = class {
|
|
|
20509
20682
|
"Memory enabled but memory context is invalid. Run `pourkit memory init` or install ICM for host planning use."
|
|
20510
20683
|
);
|
|
20511
20684
|
}
|
|
20512
|
-
const hostMemoryDir =
|
|
20685
|
+
const hostMemoryDir = join28(repoRoot2, ".pourkit", "icm");
|
|
20513
20686
|
if (!existsSync24(hostMemoryDir) || !statSync2(hostMemoryDir).isDirectory()) {
|
|
20514
20687
|
throw new MissingHostMemoryDirError(
|
|
20515
20688
|
"Memory enabled but host .pourkit/icm/ directory is missing. Run `pourkit memory init` to create the repo-scoped memory store."
|
|
20516
20689
|
);
|
|
20517
20690
|
}
|
|
20518
|
-
mkdirSync9(
|
|
20691
|
+
mkdirSync9(join28(hostMemoryDir, "cache"), { recursive: true });
|
|
20519
20692
|
}
|
|
20520
20693
|
const sandboxOptions = buildSandboxOptions(
|
|
20521
20694
|
repoRoot2,
|
|
@@ -20674,7 +20847,7 @@ function sanitizeBranch(branchName) {
|
|
|
20674
20847
|
}
|
|
20675
20848
|
function safeCopyToWorktreePaths(paths, repoRoot2, worktreePath) {
|
|
20676
20849
|
return paths.filter((relativePath) => {
|
|
20677
|
-
const source =
|
|
20850
|
+
const source = join28(repoRoot2, relativePath);
|
|
20678
20851
|
if (!existsSync24(source)) {
|
|
20679
20852
|
return true;
|
|
20680
20853
|
}
|
|
@@ -20685,7 +20858,7 @@ function safeCopyToWorktreePaths(paths, repoRoot2, worktreePath) {
|
|
|
20685
20858
|
} catch {
|
|
20686
20859
|
return true;
|
|
20687
20860
|
}
|
|
20688
|
-
const destination =
|
|
20861
|
+
const destination = join28(worktreePath, relativePath);
|
|
20689
20862
|
return !existsSync24(destination);
|
|
20690
20863
|
});
|
|
20691
20864
|
}
|
|
@@ -20750,12 +20923,12 @@ function isPlainObject(value) {
|
|
|
20750
20923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20751
20924
|
}
|
|
20752
20925
|
function savePromptToFile(repoRoot2, stage, iteration, prompt) {
|
|
20753
|
-
const promptsDir =
|
|
20926
|
+
const promptsDir = join28(repoRoot2, ".pourkit", ".tmp", "prompts");
|
|
20754
20927
|
mkdirSync9(promptsDir, { recursive: true });
|
|
20755
20928
|
const timestamp2 = Date.now();
|
|
20756
20929
|
const iterationSuffix = iteration !== void 0 ? `-iteration-${iteration}` : "";
|
|
20757
20930
|
const filename = `${stage}${iterationSuffix}-${timestamp2}.md`;
|
|
20758
|
-
const filePath =
|
|
20931
|
+
const filePath = join28(promptsDir, filename);
|
|
20759
20932
|
writeFileSync6(filePath, prompt, "utf-8");
|
|
20760
20933
|
}
|
|
20761
20934
|
|
|
@@ -21539,11 +21712,11 @@ function createCliProgram(version) {
|
|
|
21539
21712
|
return program;
|
|
21540
21713
|
}
|
|
21541
21714
|
async function resolveCliVersion() {
|
|
21542
|
-
if (isPackageVersion("0.0.0-next-
|
|
21543
|
-
return "0.0.0-next-
|
|
21715
|
+
if (isPackageVersion("0.0.0-next-20260715085442")) {
|
|
21716
|
+
return "0.0.0-next-20260715085442";
|
|
21544
21717
|
}
|
|
21545
|
-
if (isReleaseVersion("0.0.0-next-
|
|
21546
|
-
return "0.0.0-next-
|
|
21718
|
+
if (isReleaseVersion("0.0.0-next-20260715085442")) {
|
|
21719
|
+
return "0.0.0-next-20260715085442";
|
|
21547
21720
|
}
|
|
21548
21721
|
try {
|
|
21549
21722
|
const root = repoRoot();
|