@aviaratech/ai-delivery 0.3.34 → 0.3.36
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/CONTRIBUTING.md +12 -206
- package/README.md +57 -506
- package/dist/agent.d.ts +0 -2
- package/dist/agent.js +76 -16
- package/dist/agent.js.map +7 -1
- package/dist/agentReadiness.test.js +73 -67
- package/dist/agentReadiness.test.js.map +7 -1
- package/dist/boardReconcile.test.js +1746 -0
- package/dist/boardReconcile.test.js.map +7 -0
- package/dist/build.test.js +130 -0
- package/dist/build.test.js.map +7 -0
- package/dist/callerErrors.test.js +105 -0
- package/dist/callerErrors.test.js.map +7 -0
- package/dist/cli.js +406 -485
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -25
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +434 -297
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +320 -14
- package/dist/config/deliveryConfig.js +472 -385
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +775 -584
- package/dist/config/deliveryConfig.test.js.map +7 -1
- package/dist/contributorChecks.test.js +1694 -916
- package/dist/contributorChecks.test.js.map +7 -1
- package/dist/currentConsumer.test.js +819 -737
- package/dist/currentConsumer.test.js.map +7 -1
- package/dist/currentTrackingScenario.test.js +499 -477
- package/dist/currentTrackingScenario.test.js.map +7 -1
- package/dist/delivery/common.js +160 -172
- package/dist/delivery/common.js.map +7 -1
- package/dist/delivery/delivery.test.js +509 -431
- package/dist/delivery/delivery.test.js.map +7 -1
- package/dist/delivery/evidence.d.ts +2 -2
- package/dist/delivery/evidence.js +133 -120
- package/dist/delivery/evidence.js.map +7 -1
- package/dist/delivery/index.js +7 -2
- package/dist/delivery/index.js.map +7 -1
- package/dist/delivery/legacy.js +65 -5
- package/dist/delivery/legacy.js.map +7 -1
- package/dist/delivery/policy.d.ts +10 -10
- package/dist/delivery/policy.js +211 -238
- package/dist/delivery/policy.js.map +7 -1
- package/dist/delivery/stage.d.ts +18 -18
- package/dist/delivery/stage.js +220 -235
- package/dist/delivery/stage.js.map +7 -1
- package/dist/deliveryBoard.d.ts +74 -0
- package/dist/deliveryBoard.js +644 -0
- package/dist/deliveryBoard.js.map +7 -0
- package/dist/deliveryBoard.test.d.ts +1 -0
- package/dist/deliveryBoard.test.js +649 -0
- package/dist/deliveryBoard.test.js.map +7 -0
- package/dist/deliveryHealth.test.js +179 -155
- package/dist/deliveryHealth.test.js.map +7 -1
- package/dist/dependencyCompatibility.test.js +154 -140
- package/dist/dependencyCompatibility.test.js.map +7 -1
- package/dist/directoryIndependent.test.js +417 -383
- package/dist/directoryIndependent.test.js.map +7 -1
- package/dist/dispatch.d.ts +17 -12
- package/dist/dispatch.js +330 -322
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +16 -3
- package/dist/errors.js +104 -82
- package/dist/errors.js.map +7 -1
- package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
- package/dist/fixtures/deliveryBoardReplay.js +617 -0
- package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
- package/dist/fixtures/discovery.d.ts +59 -19
- package/dist/fixtures/discovery.js +96 -90
- package/dist/fixtures/discovery.js.map +7 -1
- package/dist/fixtures/inertEntrypointChild.js +57 -56
- package/dist/fixtures/inertEntrypointChild.js.map +7 -1
- package/dist/fixtures/inertEntrypoints.d.ts +1 -1
- package/dist/fixtures/inertEntrypoints.js +321 -276
- package/dist/fixtures/inertEntrypoints.js.map +7 -1
- package/dist/fixtures/inertTarget.d.ts +78 -7
- package/dist/fixtures/inertTarget.js +769 -691
- package/dist/fixtures/inertTarget.js.map +7 -1
- package/dist/fixtures/issue63.d.ts +4 -3
- package/dist/fixtures/issue63.js +260 -274
- package/dist/fixtures/issue63.js.map +7 -1
- package/dist/fixtures/issueProjectItems.d.ts +20 -0
- package/dist/fixtures/issueProjectItems.js +15 -0
- package/dist/fixtures/issueProjectItems.js.map +7 -0
- package/dist/fixtures/readView.d.ts +120 -0
- package/dist/fixtures/readView.js +172 -0
- package/dist/fixtures/readView.js.map +7 -0
- package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
- package/dist/fixtures/recordedGitHubFlows.js +109 -0
- package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
- package/dist/genericCompatibility.test.js +64 -55
- package/dist/genericCompatibility.test.js.map +7 -1
- package/dist/git.js +73 -67
- package/dist/git.js.map +7 -1
- package/dist/gitProcess.d.ts +1 -1
- package/dist/gitProcess.js +58 -53
- package/dist/gitProcess.js.map +7 -1
- package/dist/github/client.d.ts +2 -2
- package/dist/github/client.js +484 -379
- package/dist/github/client.js.map +7 -1
- package/dist/github/commandIdentityPolicy.js +44 -51
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +3 -0
- package/dist/github/discovery.js +197 -201
- package/dist/github/discovery.js.map +7 -1
- package/dist/github/discovery.test.js +223 -177
- package/dist/github/discovery.test.js.map +7 -1
- package/dist/github/issueHistory.d.ts +2 -2
- package/dist/github/issueHistory.js +117 -125
- package/dist/github/issueHistory.js.map +7 -1
- package/dist/github/machineAuth.d.ts +1 -1
- package/dist/github/machineAuth.js +126 -117
- package/dist/github/machineAuth.js.map +7 -1
- package/dist/github/machineAuth.test.js +755 -639
- package/dist/github/machineAuth.test.js.map +7 -1
- package/dist/github/nativeIssueMetadata.js +286 -273
- package/dist/github/nativeIssueMetadata.js.map +7 -1
- package/dist/github/projectDelivery.d.ts +53 -1
- package/dist/github/projectDelivery.js +623 -460
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.d.ts +5 -2
- package/dist/github/relationships.js +434 -333
- package/dist/github/relationships.js.map +7 -1
- package/dist/github/repo.d.ts +1 -0
- package/dist/github/repo.js +123 -96
- package/dist/github/repo.js.map +7 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +7 -1
- package/dist/issue.d.ts +103 -7
- package/dist/issue.js +2104 -1547
- package/dist/issue.js.map +7 -1
- package/dist/issue63History.test.js +40 -42
- package/dist/issue63History.test.js.map +7 -1
- package/dist/issue63Routes.test.js +154 -143
- package/dist/issue63Routes.test.js.map +7 -1
- package/dist/issueBatchUpdate.test.js +1004 -683
- package/dist/issueBatchUpdate.test.js.map +7 -1
- package/dist/issueBlockerGuard.test.js +262 -226
- package/dist/issueBlockerGuard.test.js.map +7 -1
- package/dist/issueContract.d.ts +23 -4
- package/dist/issueContract.js +416 -395
- package/dist/issueContract.js.map +7 -1
- package/dist/issueContract.test.d.ts +4 -3
- package/dist/issueContract.test.js +358 -321
- package/dist/issueContract.test.js.map +7 -1
- package/dist/issueDates.test.js +235 -233
- package/dist/issueDates.test.js.map +7 -1
- package/dist/issueInfoReadback.test.js +304 -190
- package/dist/issueInfoReadback.test.js.map +7 -1
- package/dist/issueIntake.test.js +1945 -1732
- package/dist/issueIntake.test.js.map +7 -1
- package/dist/issueJournal.d.ts +40 -19
- package/dist/issueJournal.js +229 -138
- package/dist/issueJournal.js.map +7 -1
- package/dist/issueJournal.test.js +605 -422
- package/dist/issueJournal.test.js.map +7 -1
- package/dist/issueRollup.test.d.ts +1 -0
- package/dist/issueRollup.test.js +476 -0
- package/dist/issueRollup.test.js.map +7 -0
- package/dist/issueTracking.test.js +1088 -593
- package/dist/issueTracking.test.js.map +7 -1
- package/dist/issueWriteRecovery.test.d.ts +1 -0
- package/dist/issueWriteRecovery.test.js +260 -0
- package/dist/issueWriteRecovery.test.js.map +7 -0
- package/dist/lifecycle.test.js +112 -441
- package/dist/lifecycle.test.js.map +7 -1
- package/dist/logger.js +80 -74
- package/dist/logger.js.map +7 -1
- package/dist/mcp/index.js +116 -90
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +790 -220
- package/dist/mcp/tools.js +267 -333
- package/dist/mcp/tools.js.map +7 -1
- package/dist/pluginAuthProbe.js +63 -52
- package/dist/pluginAuthProbe.js.map +7 -1
- package/dist/pluginAuthProbe.test.js +85 -62
- package/dist/pluginAuthProbe.test.js.map +7 -1
- package/dist/pluginCredentials.test.js +282 -259
- package/dist/pluginCredentials.test.js.map +7 -1
- package/dist/pluginDoctor.test.js +653 -588
- package/dist/pluginDoctor.test.js.map +7 -1
- package/dist/pluginInstaller.d.ts +7 -5
- package/dist/pluginInstaller.js +1173 -1231
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1822 -1283
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +485 -305
- package/dist/pluginPackaging.test.js.map +7 -1
- package/dist/pr.d.ts +132 -94
- package/dist/pr.js +1521 -1323
- package/dist/pr.js.map +7 -1
- package/dist/pr.test.js +1678 -632
- package/dist/pr.test.js.map +7 -1
- package/dist/prAssociation.test.js +2419 -1788
- package/dist/prAssociation.test.js.map +7 -1
- package/dist/prDispatch.test.js +150 -89
- package/dist/prDispatch.test.js.map +7 -1
- package/dist/readView.d.ts +183 -0
- package/dist/readView.js +217 -0
- package/dist/readView.js.map +7 -0
- package/dist/readView.test.d.ts +1 -0
- package/dist/readView.test.js +119 -0
- package/dist/readView.test.js.map +7 -0
- package/dist/releaseReconciliation.test.js +267 -288
- package/dist/releaseReconciliation.test.js.map +7 -1
- package/dist/releaseWorkflow.test.js +2493 -422
- package/dist/releaseWorkflow.test.js.map +7 -1
- package/dist/review.d.ts +738 -2
- package/dist/review.js +601 -348
- package/dist/review.js.map +7 -1
- package/dist/review.test.js +1218 -812
- package/dist/review.test.js.map +7 -1
- package/dist/reviewSubmit.test.d.ts +1 -0
- package/dist/reviewSubmit.test.js +747 -0
- package/dist/reviewSubmit.test.js.map +7 -0
- package/dist/services/agentReadinessService.js +42 -37
- package/dist/services/agentReadinessService.js.map +7 -1
- package/dist/services/blockerGuardService.js +188 -188
- package/dist/services/blockerGuardService.js.map +7 -1
- package/dist/services/boardReconcileService.d.ts +1204 -0
- package/dist/services/boardReconcileService.js +1445 -0
- package/dist/services/boardReconcileService.js.map +7 -0
- package/dist/services/deliveryAdmission.d.ts +2 -0
- package/dist/services/deliveryAdmission.js +129 -152
- package/dist/services/deliveryAdmission.js.map +7 -1
- package/dist/services/deliveryHealthService.js +197 -199
- package/dist/services/deliveryHealthService.js.map +7 -1
- package/dist/services/legacyIssueMigration.js +263 -277
- package/dist/services/legacyIssueMigration.js.map +7 -1
- package/dist/services/worktreeRegistry.d.ts +27 -119
- package/dist/services/worktreeRegistry.js +765 -1182
- package/dist/services/worktreeRegistry.js.map +7 -1
- package/dist/stagedChecks.test.js +396 -194
- package/dist/stagedChecks.test.js.map +7 -1
- package/dist/start.test.js +99 -95
- package/dist/start.test.js.map +7 -1
- package/dist/stdoutRegression.test.js +354 -350
- package/dist/stdoutRegression.test.js.map +7 -1
- package/dist/targetPolicyDiscovery.test.js +141 -143
- package/dist/targetPolicyDiscovery.test.js.map +7 -1
- package/dist/targetPolicyEntrypoints.test.js +308 -269
- package/dist/targetPolicyEntrypoints.test.js.map +7 -1
- package/dist/targetPolicyLocal.test.js +580 -1051
- package/dist/targetPolicyLocal.test.js.map +7 -1
- package/dist/targetPolicyRoutes.test.js +305 -281
- package/dist/targetPolicyRoutes.test.js.map +7 -1
- package/dist/targetRepositoryExecution.test.d.ts +1 -0
- package/dist/targetRepositoryExecution.test.js +463 -0
- package/dist/targetRepositoryExecution.test.js.map +7 -0
- package/dist/terminalMessages.js +41 -35
- package/dist/terminalMessages.js.map +7 -1
- package/dist/toolOutput.d.ts +2 -0
- package/dist/toolOutput.js +36 -0
- package/dist/toolOutput.js.map +7 -0
- package/dist/toolOutput.test.d.ts +1 -0
- package/dist/toolOutput.test.js +240 -0
- package/dist/toolOutput.test.js.map +7 -0
- package/dist/utils/atomicJson.js +84 -76
- package/dist/utils/atomicJson.js.map +7 -1
- package/dist/utils/filesystem.js +15 -18
- package/dist/utils/filesystem.js.map +7 -1
- package/dist/utils/lockfile.js +68 -71
- package/dist/utils/lockfile.js.map +7 -1
- package/dist/verification.d.ts +1 -19
- package/dist/verification.js +1020 -1929
- package/dist/verification.js.map +7 -1
- package/dist/verificationGate.test.js +127 -117
- package/dist/verificationGate.test.js.map +7 -1
- package/dist/version.d.ts +6 -0
- package/dist/version.js +24 -10
- package/dist/version.js.map +7 -1
- package/dist/worktree.d.ts +3 -15
- package/dist/worktree.js +97 -177
- package/dist/worktree.js.map +7 -1
- package/package.json +10 -8
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/README.md +47 -156
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +261 -43
- package/plugins/ai-delivery/runtime/dist/cli.js +369 -125
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
- package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
- package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
- package/dist/investigationCompletion.test.js +0 -728
- package/dist/investigationCompletion.test.js.map +0 -1
- package/dist/setup.d.ts +0 -60
- package/dist/setup.js +0 -585
- package/dist/setup.js.map +0 -1
- package/dist/setup.test.js +0 -3058
- package/dist/setup.test.js.map +0 -1
- package/dist/worktreeTransition.d.ts +0 -211
- package/dist/worktreeTransition.js +0 -1037
- package/dist/worktreeTransition.js.map +0 -1
- package/dist/worktreeTransition.test.js +0 -1191
- package/dist/worktreeTransition.test.js.map +0 -1
- /package/dist/{investigationCompletion.test.d.ts → boardReconcile.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → build.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → callerErrors.test.d.ts} +0 -0
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/atomicJson.ts"],
|
|
4
|
+
"sourcesContent": ["import { randomUUID } from 'node:crypto';\nimport {\n closeSync,\n existsSync,\n fsyncSync,\n lstatSync,\n mkdirSync,\n openSync,\n renameSync,\n unlinkSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\n\n/** Create a private directory hierarchy and durably publish every new directory entry. */\nexport function ensurePrivateDirectoryDurably(path: string): void {\n ensureDirectoryDurably(path, 0o700);\n}\n\n/** Publish a complete JSON file with a same-directory durable rename. */\nexport function writeJsonFileAtomically(path: string, value: unknown): void {\n writeJsonAtomically({ directoryMode: 0o777, mode: 0o666, path, value });\n}\n\n/** Publish private JSON evidence with the same durable rename contract. */\nexport function writePrivateJsonFileAtomically(path: string, value: unknown): void {\n writeJsonAtomically({ directoryMode: 0o700, mode: 0o600, path, value });\n}\n\nfunction ensureDirectoryDurably(directory: string, mode: number): void {\n const missing: string[] = [];\n let candidate = directory;\n while (!existsSync(candidate)) {\n missing.push(candidate);\n const parent = dirname(candidate);\n if (parent === candidate) break;\n candidate = parent;\n }\n for (const path of missing.reverse()) {\n try {\n mkdirSync(path, { mode });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;\n const metadata = lstatSync(path);\n if (!metadata.isDirectory() || metadata.isSymbolicLink() || (mode === 0o700 && (metadata.mode & 0o077) !== 0))\n throw new Error('Concurrent directory creation did not publish a safe directory.');\n }\n fsyncDirectory(dirname(path));\n }\n}\n\nfunction fsyncDirectory(directory: string): void {\n const descriptor = openSync(directory, 'r');\n try {\n fsyncSync(descriptor);\n } finally {\n closeSync(descriptor);\n }\n}\n\nfunction writeJsonAtomically({\n directoryMode,\n mode,\n path,\n value,\n}: {\n directoryMode: number;\n mode: number;\n path: string;\n value: unknown;\n}): void {\n const directory = dirname(path);\n ensureDirectoryDurably(directory, directoryMode);\n const temporaryPath = join(directory, `.${String(process.pid)}.${randomUUID()}.tmp`);\n let creationDescriptor: number | undefined;\n let fileDescriptor: number | undefined;\n let directoryDescriptor: number | undefined;\n try {\n creationDescriptor = openSync(temporaryPath, 'wx', mode);\n closeSync(creationDescriptor);\n creationDescriptor = undefined;\n writeFileSync(temporaryPath, `${JSON.stringify(value, null, 2)}\\n`, 'utf8');\n fileDescriptor = openSync(temporaryPath, 'r');\n fsyncSync(fileDescriptor);\n closeSync(fileDescriptor);\n fileDescriptor = undefined;\n renameSync(temporaryPath, path);\n directoryDescriptor = openSync(directory, 'r');\n fsyncSync(directoryDescriptor);\n closeSync(directoryDescriptor);\n directoryDescriptor = undefined;\n } catch (error: unknown) {\n if (creationDescriptor !== undefined) closeSync(creationDescriptor);\n if (fileDescriptor !== undefined) closeSync(fileDescriptor);\n if (directoryDescriptor !== undefined) closeSync(directoryDescriptor);\n try {\n unlinkSync(temporaryPath);\n } catch {\n // The temporary file was never created or has already been renamed.\n }\n throw error;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,YAAY;AAGvB,SAAS,8BAA8B,MAAoB;AAChE,yBAAuB,MAAM,GAAK;AACpC;AAGO,SAAS,wBAAwB,MAAc,OAAsB;AAC1E,sBAAoB,EAAE,eAAe,KAAO,MAAM,KAAO,MAAM,MAAM,CAAC;AACxE;AAGO,SAAS,+BAA+B,MAAc,OAAsB;AACjF,sBAAoB,EAAE,eAAe,KAAO,MAAM,KAAO,MAAM,MAAM,CAAC;AACxE;AAEA,SAAS,uBAAuB,WAAmB,MAAoB;AACrE,QAAM,UAAoB,CAAC;AAC3B,MAAI,YAAY;AAChB,SAAO,CAAC,WAAW,SAAS,GAAG;AAC7B,YAAQ,KAAK,SAAS;AACtB,UAAM,SAAS,QAAQ,SAAS;AAChC,QAAI,WAAW,UAAW;AAC1B,gBAAY;AAAA,EACd;AACA,aAAW,QAAQ,QAAQ,QAAQ,GAAG;AACpC,QAAI;AACF,gBAAU,MAAM,EAAE,KAAK,CAAC;AAAA,IAC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AAA,IAER;AACA,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/utils/filesystem.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from
|
|
2
|
-
import { resolve } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function ensureDataDirectory(projectRoot) {
|
|
12
|
-
const root = projectRoot ?? process.cwd();
|
|
13
|
-
const dataDir = resolve(root, ISSUE_CLI_DATA_DIR);
|
|
14
|
-
if (!existsSync(dataDir)) {
|
|
15
|
-
mkdirSync(dataDir, { recursive: true });
|
|
16
|
-
}
|
|
17
|
-
return dataDir;
|
|
1
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
const ISSUE_CLI_DATA_DIR = ".issue-cli";
|
|
4
|
+
function ensureDataDirectory(projectRoot) {
|
|
5
|
+
const root = projectRoot ?? process.cwd();
|
|
6
|
+
const dataDir = resolve(root, ISSUE_CLI_DATA_DIR);
|
|
7
|
+
if (!existsSync(dataDir)) {
|
|
8
|
+
mkdirSync(dataDir, { recursive: true });
|
|
9
|
+
}
|
|
10
|
+
return dataDir;
|
|
18
11
|
}
|
|
19
|
-
|
|
12
|
+
export {
|
|
13
|
+
ISSUE_CLI_DATA_DIR,
|
|
14
|
+
ensureDataDirectory
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/filesystem.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, mkdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nexport const ISSUE_CLI_DATA_DIR = '.issue-cli';\n\n/**\n * Ensure the `.issue-cli` runtime directory exists.\n * All agent runtime data (worktrees, metrics, audit logs) lives here.\n *\n * @param projectRoot - Project root directory (defaults to cwd)\n * @returns Absolute path to the data directory\n */\nexport function ensureDataDirectory(projectRoot?: string): string {\n const root = projectRoot ?? process.cwd();\n const dataDir = resolve(root, ISSUE_CLI_DATA_DIR);\n\n if (!existsSync(dataDir)) {\n mkdirSync(dataDir, { recursive: true });\n }\n\n return dataDir;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AAEjB,MAAM,qBAAqB;AAS3B,SAAS,oBAAoB,aAA8B;AAChE,QAAM,OAAO,eAAe,QAAQ,IAAI;AACxC,QAAM,UAAU,QAAQ,MAAM,kBAAkB;AAEhD,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/utils/lockfile.js
CHANGED
|
@@ -1,82 +1,79 @@
|
|
|
1
|
-
import { resolve } from
|
|
2
|
-
import * as lockfile from
|
|
3
|
-
import { logDebug, logWarn } from
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import * as lockfile from "proper-lockfile";
|
|
3
|
+
import { logDebug, logWarn } from "../logger.js";
|
|
4
4
|
const LOCK_OPTIONS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
realpath: false,
|
|
6
|
+
retries: 0,
|
|
7
|
+
stale: 1e4
|
|
8
|
+
// 10 seconds - auto-release stale locks
|
|
8
9
|
};
|
|
9
10
|
const LOCK_RETRY_DELAY_MS = 200;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (!isLockError(error)) {
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
if (!warned) {
|
|
46
|
-
logWarn(`Unable to acquire lock on ${lockPath} - another agent is modifying it. Retrying...`);
|
|
47
|
-
warned = true;
|
|
48
|
-
}
|
|
49
|
-
if (nextTimeoutAt !== null && timeoutInterval !== null && Date.now() >= nextTimeoutAt) {
|
|
50
|
-
onTimeout?.();
|
|
51
|
-
nextTimeoutAt = Date.now() + timeoutInterval;
|
|
52
|
-
}
|
|
53
|
-
await delay(LOCK_RETRY_DELAY_MS);
|
|
54
|
-
}
|
|
11
|
+
async function withLock(filePath, { onCompromised, onReleaseError, onTimeout, operation, projectRoot, timeout }) {
|
|
12
|
+
const root = projectRoot ?? process.cwd();
|
|
13
|
+
const lockPath = resolve(root, filePath);
|
|
14
|
+
let release = null;
|
|
15
|
+
const timeoutInterval = typeof timeout === "number" && timeout > 0 ? timeout : null;
|
|
16
|
+
const maxAttempts = timeoutInterval !== null ? Math.ceil(timeoutInterval / LOCK_RETRY_DELAY_MS) : null;
|
|
17
|
+
let attempts = 0;
|
|
18
|
+
let nextTimeoutAt = timeoutInterval === null ? null : Date.now() + timeoutInterval;
|
|
19
|
+
let warned = false;
|
|
20
|
+
try {
|
|
21
|
+
for (; ; ) {
|
|
22
|
+
if (maxAttempts !== null && attempts >= maxAttempts) {
|
|
23
|
+
const timeoutLabel = timeoutInterval === null ? "unknown" : String(timeoutInterval);
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Lock acquisition timeout after ${timeoutLabel}ms on ${lockPath}. Another process may be holding the lock.`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
attempts += 1;
|
|
29
|
+
const attemptLabel = maxAttempts !== null ? `${String(attempts)}/${String(maxAttempts)}` : String(attempts);
|
|
30
|
+
logDebug(`Acquiring lock on ${lockPath}... (attempt ${attemptLabel})`);
|
|
31
|
+
try {
|
|
32
|
+
release = await lockfile.lock(lockPath, {
|
|
33
|
+
...LOCK_OPTIONS,
|
|
34
|
+
...onCompromised === void 0 ? {} : { onCompromised }
|
|
35
|
+
});
|
|
36
|
+
logDebug(`Lock acquired on ${lockPath}`);
|
|
37
|
+
break;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (!isLockError(error)) {
|
|
40
|
+
throw error;
|
|
55
41
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
onReleaseError?.(error);
|
|
66
|
-
// Lock release failure is non-fatal - stale lock will auto-expire
|
|
67
|
-
logDebug(`Failed to release lock on ${lockPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
68
|
-
}
|
|
42
|
+
if (!warned) {
|
|
43
|
+
logWarn(`Unable to acquire lock on ${lockPath} - another agent is modifying it. Retrying...`);
|
|
44
|
+
warned = true;
|
|
45
|
+
}
|
|
46
|
+
if (nextTimeoutAt !== null && timeoutInterval !== null && Date.now() >= nextTimeoutAt) {
|
|
47
|
+
onTimeout?.();
|
|
48
|
+
nextTimeoutAt = Date.now() + timeoutInterval;
|
|
69
49
|
}
|
|
50
|
+
await delay(LOCK_RETRY_DELAY_MS);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return await operation();
|
|
54
|
+
} finally {
|
|
55
|
+
if (release !== null) {
|
|
56
|
+
try {
|
|
57
|
+
await release();
|
|
58
|
+
logDebug(`Lock released on ${lockPath}`);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
onReleaseError?.(error);
|
|
61
|
+
logDebug(`Failed to release lock on ${lockPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
62
|
+
}
|
|
70
63
|
}
|
|
64
|
+
}
|
|
71
65
|
}
|
|
72
66
|
function delay(ms) {
|
|
73
|
-
|
|
67
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
74
68
|
}
|
|
75
69
|
function isLockError(error) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
if (typeof error !== "object" || error === null) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const code = error.code;
|
|
74
|
+
return code === "ELOCKED";
|
|
81
75
|
}
|
|
82
|
-
|
|
76
|
+
export {
|
|
77
|
+
withLock
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=lockfile.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/lockfile.ts"],
|
|
4
|
+
"sourcesContent": ["import { resolve } from 'node:path';\nimport * as lockfile from 'proper-lockfile';\n\nimport { logDebug, logWarn } from '../logger.js';\n\nconst LOCK_OPTIONS = {\n realpath: false,\n retries: 0,\n stale: 10000, // 10 seconds - auto-release stale locks\n};\n\nconst LOCK_RETRY_DELAY_MS = 200;\n\ninterface WithLockOptions<T> {\n onCompromised?: (error: Error) => void;\n onReleaseError?: (error: unknown) => void;\n onTimeout?: () => void;\n operation: () => Promise<T> | T;\n projectRoot?: string;\n timeout?: number;\n}\n\n/**\n * Execute a function with exclusive file lock\n * Prevents concurrent modifications to the worktree registry\n */\nexport async function withLock<T>(\n filePath: string,\n { onCompromised, onReleaseError, onTimeout, operation, projectRoot, timeout }: WithLockOptions<T>,\n): Promise<T> {\n const root = projectRoot ?? process.cwd();\n const lockPath = resolve(root, filePath);\n\n let release: (() => Promise<void>) | null = null;\n const timeoutInterval = typeof timeout === 'number' && timeout > 0 ? timeout : null;\n const maxAttempts = timeoutInterval !== null ? Math.ceil(timeoutInterval / LOCK_RETRY_DELAY_MS) : null;\n let attempts = 0;\n let nextTimeoutAt = timeoutInterval === null ? null : Date.now() + timeoutInterval;\n let warned = false;\n\n try {\n for (;;) {\n // Enforce hard timeout by breaking after max attempts\n if (maxAttempts !== null && attempts >= maxAttempts) {\n const timeoutLabel = timeoutInterval === null ? 'unknown' : String(timeoutInterval);\n throw new Error(\n `Lock acquisition timeout after ${timeoutLabel}ms on ${lockPath}. Another process may be holding the lock.`,\n );\n }\n\n attempts += 1;\n const attemptLabel = maxAttempts !== null ? `${String(attempts)}/${String(maxAttempts)}` : String(attempts);\n logDebug(`Acquiring lock on ${lockPath}... (attempt ${attemptLabel})`);\n\n try {\n release = await lockfile.lock(lockPath, {\n ...LOCK_OPTIONS,\n ...(onCompromised === undefined ? {} : { onCompromised }),\n });\n logDebug(`Lock acquired on ${lockPath}`);\n break;\n } catch (error: unknown) {\n if (!isLockError(error)) {\n throw error;\n }\n\n if (!warned) {\n logWarn(`Unable to acquire lock on ${lockPath} - another agent is modifying it. Retrying...`);\n warned = true;\n }\n\n if (nextTimeoutAt !== null && timeoutInterval !== null && Date.now() >= nextTimeoutAt) {\n onTimeout?.();\n nextTimeoutAt = Date.now() + timeoutInterval;\n }\n\n await delay(LOCK_RETRY_DELAY_MS);\n }\n }\n\n return await operation();\n } finally {\n if (release !== null) {\n try {\n await release();\n logDebug(`Lock released on ${lockPath}`);\n } catch (error: unknown) {\n onReleaseError?.(error);\n // Lock release failure is non-fatal - stale lock will auto-expire\n logDebug(`Failed to release lock on ${lockPath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n }\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction isLockError(error: unknown): boolean {\n if (typeof error !== 'object' || error === null) {\n return false;\n }\n\n const code = (error as { code?: unknown }).code;\n return code === 'ELOCKED';\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,YAAY,cAAc;AAE1B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,kBAAkB,QAAQ,oBAAoB,QAAQ,KAAK,IAAI,KAAK,eAAe;AACrF,sBAAY;AACZ,0BAAgB,KAAK,IAAI,IAAI;AAAA,QAC/B;AAEA,cAAM,MAAM,mBAAmB;AAAA,MACjC;AAAA,IACF;AAEA,WAAO,MAAM,UAAU;AAAA,EACzB,UAAE;AACA,QAAI,YAAY,MAAM;AACpB,UAAI;AACF,cAAM,QAAQ;AACd,iBAAS,oBAAoB,QAAQ,EAAE;AAAA,MACzC,SAAS,OAAgB;AACvB,yBAAiB,KAAK;AAEtB,iBAAS,6BAA6B,QAAQ,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAAA,MAC7G;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,CAACA,aAAY,WAAWA,UAAS,EAAE,CAAC;AACzD;AAEA,SAAS,YAAY,OAAyB;AAC5C,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,OAAQ,MAA6B;AAC3C,SAAO,SAAS;AAClB;",
|
|
6
|
+
"names": ["resolve"]
|
|
7
|
+
}
|
package/dist/verification.d.ts
CHANGED
|
@@ -108,10 +108,6 @@ export interface WorktreeTransitionWriterLeaseInput {
|
|
|
108
108
|
}
|
|
109
109
|
/** @internal Read-only closure check shared by inspection and the locked transition lease. */
|
|
110
110
|
export declare function assertWorktreeTransitionWriterQuiescent(worktreePath: string, bytes: Buffer | undefined): void;
|
|
111
|
-
/** @internal Hold the existing writer lock while reading a sealed transition; never claim or recover its slot. */
|
|
112
|
-
export declare function withWorktreeTransitionWriterAbsent<T>(repoRoot: string, worktreePath: string, operation: () => Promise<T>): Promise<T>;
|
|
113
|
-
/** @internal Check-only lease for the explicit transition owner; never recovers or signals old commands. */
|
|
114
|
-
export declare function withWorktreeTransitionWriterLease<T>(input: WorktreeTransitionWriterLeaseInput, operation: () => Promise<T>): Promise<T>;
|
|
115
111
|
/** @internal Retained public code is hashed as data; it is never imported or executed. */
|
|
116
112
|
export declare function retainedWorktreeTransitionProducerDigest(distDirectory: string): string;
|
|
117
113
|
/** @internal Preserve the same dependency manifests that participate in the existing producer digest. */
|
|
@@ -119,8 +115,6 @@ export declare function retainedWorktreeTransitionDependencyManifests(distDirect
|
|
|
119
115
|
source: string;
|
|
120
116
|
digest: string;
|
|
121
117
|
}[];
|
|
122
|
-
/** @internal Original manifests validate as history and cannot authorize current verification. */
|
|
123
|
-
export declare function readWorktreeTransitionRun(bytes: Buffer): VerificationRun;
|
|
124
118
|
export declare function runStageCommand(repoRoot: string, argv: readonly string[], abortSignal?: AbortSignal, onRunning?: (capturedOutputBytes: number, resource?: ResourceSample, reason?: string) => void, resourceBounds?: VerificationResourceBounds, baseline?: OutputBaseline, onResourceSample?: (sample: ResourceSample) => void, writer?: VerificationWriter, execution?: {
|
|
125
119
|
environment: NodeJS.ProcessEnv;
|
|
126
120
|
cwd?: string;
|
|
@@ -260,22 +254,10 @@ declare const IssueSourcePhaseReceiptSchema: z.ZodObject<{
|
|
|
260
254
|
outputDigest: z.ZodNullable<z.ZodString>;
|
|
261
255
|
outputBytes: z.ZodNumber;
|
|
262
256
|
status: z.ZodEnum<{
|
|
263
|
-
failed: "failed";
|
|
264
257
|
complete: "complete";
|
|
258
|
+
failed: "failed";
|
|
265
259
|
}>;
|
|
266
260
|
}, z.core.$strict>>;
|
|
267
261
|
}, z.core.$strict>;
|
|
268
262
|
export type IssueSourcePhaseReceipt = z.infer<typeof IssueSourcePhaseReceiptSchema>;
|
|
269
|
-
/** @internal Runtime setup shares the existing writer, ownership handshake and bounded command runner. */
|
|
270
|
-
export declare function withRuntimeSetupWriter<T>(root: string, operation: (runner: {
|
|
271
|
-
assertQuiescent(): void;
|
|
272
|
-
bindCapturedOutput(stageId: string): void;
|
|
273
|
-
checkResources: () => Promise<void>;
|
|
274
|
-
signal: AbortSignal;
|
|
275
|
-
run(argv: readonly string[], bounds: VerificationResourceBounds, signal?: AbortSignal, environment?: NodeJS.ProcessEnv, cwd?: string): Promise<Buffer>;
|
|
276
|
-
}) => Promise<T>, scope?: {
|
|
277
|
-
bounds: VerificationResourceBounds;
|
|
278
|
-
maxCapturedOutputBytes: number;
|
|
279
|
-
signal?: AbortSignal;
|
|
280
|
-
}): Promise<T>;
|
|
281
263
|
export {};
|