@aviaratech/ai-delivery 0.3.35 → 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 -554
- 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 +1651 -1590
- package/dist/boardReconcile.test.js.map +7 -1
- 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 +402 -515
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -45
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +424 -369
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +288 -14
- package/dist/config/deliveryConfig.js +472 -390
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +773 -649
- 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 -479
- 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.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 +16 -11
- package/dist/dispatch.js +329 -353
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +103 -96
- 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 -52
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +1 -0
- package/dist/github/discovery.js +197 -215
- 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 +18 -2
- package/dist/github/projectDelivery.js +615 -557
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.js +433 -389
- 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 +40 -9
- package/dist/issue.js +2102 -1742
- 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 +989 -885
- 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 +1059 -989
- 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 -94
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +264 -286
- package/dist/mcp/tools.js +267 -340
- 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 -1229
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1842 -1423
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +460 -409
- 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 +125 -125
- package/dist/services/boardReconcileService.js +1295 -1421
- package/dist/services/boardReconcileService.js.map +7 -1
- package/dist/services/deliveryAdmission.js +131 -154
- 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 +353 -352
- 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 -1939
- 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.js +23 -24
- 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 +9 -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 +238 -44
- package/plugins/ai-delivery/runtime/dist/cli.js +358 -115
- 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 -3329
- 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 → build.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → callerErrors.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → deliveryBoard.test.d.ts} +0 -0
|
@@ -1,57 +1,66 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { execFileSync } from
|
|
3
|
-
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from
|
|
4
|
-
import { tmpdir } from
|
|
5
|
-
import { join } from
|
|
6
|
-
import { test } from
|
|
7
|
-
import { planOfflineLegacyIssueMigration } from
|
|
8
|
-
test(
|
|
9
|
-
|
|
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
|
-
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { test } from "vitest";
|
|
7
|
+
import { planOfflineLegacyIssueMigration } from "./services/legacyIssueMigration.js";
|
|
8
|
+
test("offline legacy normalization preserves native blockers and refuses an unproven tracking parent", () => {
|
|
9
|
+
const input = {
|
|
10
|
+
issues: [
|
|
11
|
+
{
|
|
12
|
+
number: 17,
|
|
13
|
+
body: '<!-- dependencyDeclaration: {"blockedBy":["#9"]} -->\n## Outcome\nDeliver.',
|
|
14
|
+
labels: ["area:delivery", "effort:s", "type:task", "status:blocked"]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
repositoryLabels: ["area:delivery", "effort:s"]
|
|
18
|
+
};
|
|
19
|
+
const report = planOfflineLegacyIssueMigration(input);
|
|
20
|
+
assert.equal(report.schemaVersion, "ai-delivery.legacy-issue-migration@1");
|
|
21
|
+
assert.equal(report.mode, "dry-run");
|
|
22
|
+
assert.deepEqual(report.plans[0]?.native, {
|
|
23
|
+
blockedBy: [9],
|
|
24
|
+
issueType: "Task",
|
|
25
|
+
points: 2,
|
|
26
|
+
projectStatus: "Blocked"
|
|
27
|
+
});
|
|
28
|
+
assert.deepEqual(report.retiredRepositoryLabels, ["effort:s"]);
|
|
29
|
+
assert.doesNotMatch(report.plans[0]?.body ?? "", /dependencyDeclaration/u);
|
|
30
|
+
assert.throws(
|
|
31
|
+
() => planOfflineLegacyIssueMigration({
|
|
32
|
+
issues: [
|
|
33
|
+
{
|
|
34
|
+
number: 18,
|
|
35
|
+
body: "Track children",
|
|
36
|
+
labels: ["type:tracking"]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}),
|
|
40
|
+
/native sub-issue/u
|
|
41
|
+
);
|
|
42
|
+
assert.throws(
|
|
43
|
+
() => planOfflineLegacyIssueMigration({ issues: [input.issues[0], input.issues[0]] }),
|
|
44
|
+
/repeats an issue number/u
|
|
45
|
+
);
|
|
40
46
|
});
|
|
41
|
-
test(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
test("legacy CLI emits an offline plan without modifying its input", { tags: ["release"] }, () => {
|
|
48
|
+
const root = mkdtempSync(join(tmpdir(), "ai-delivery-migration-"));
|
|
49
|
+
try {
|
|
50
|
+
const path = join(root, "issues.json");
|
|
51
|
+
const bytes = JSON.stringify({ issues: [{ number: 5, body: "## Outcome\nDeliver.", labels: ["effort:xs"] }] });
|
|
52
|
+
writeFileSync(path, bytes);
|
|
53
|
+
const output = execFileSync(
|
|
54
|
+
process.execPath,
|
|
55
|
+
[join(process.cwd(), "dist", "cli.js"), "migrate:legacy-issues", "--input-file", path],
|
|
56
|
+
{ encoding: "utf8" }
|
|
57
|
+
);
|
|
58
|
+
const report = JSON.parse(output);
|
|
59
|
+
assert.equal(report.mode, "dry-run");
|
|
60
|
+
assert.equal(report.plans[0]?.native.points, 1);
|
|
61
|
+
assert.equal(readFileSync(path, "utf8"), bytes);
|
|
62
|
+
} finally {
|
|
63
|
+
rmSync(root, { recursive: true, force: true });
|
|
64
|
+
}
|
|
56
65
|
});
|
|
57
|
-
//# sourceMappingURL=genericCompatibility.test.js.map
|
|
66
|
+
//# sourceMappingURL=genericCompatibility.test.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/genericCompatibility.test.ts"],
|
|
4
|
+
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { test } from 'vitest';\n\nimport { planOfflineLegacyIssueMigration } from './services/legacyIssueMigration.js';\n\ntest('offline legacy normalization preserves native blockers and refuses an unproven tracking parent', () => {\n const input = {\n issues: [\n {\n number: 17,\n body: '<!-- dependencyDeclaration: {\"blockedBy\":[\"#9\"]} -->\\n## Outcome\\nDeliver.',\n labels: ['area:delivery', 'effort:s', 'type:task', 'status:blocked'],\n },\n ],\n repositoryLabels: ['area:delivery', 'effort:s'],\n };\n const report = planOfflineLegacyIssueMigration(input);\n assert.equal(report.schemaVersion, 'ai-delivery.legacy-issue-migration@1');\n assert.equal(report.mode, 'dry-run');\n assert.deepEqual(report.plans[0]?.native, {\n blockedBy: [9],\n issueType: 'Task',\n points: 2,\n projectStatus: 'Blocked',\n });\n assert.deepEqual(report.retiredRepositoryLabels, ['effort:s']);\n assert.doesNotMatch(report.plans[0]?.body ?? '', /dependencyDeclaration/u);\n assert.throws(\n () =>\n planOfflineLegacyIssueMigration({\n issues: [\n {\n number: 18,\n body: 'Track children',\n labels: ['type:tracking'],\n },\n ],\n }),\n /native sub-issue/u,\n );\n assert.throws(\n () => planOfflineLegacyIssueMigration({ issues: [input.issues[0], input.issues[0]] }),\n /repeats an issue number/u,\n );\n});\n\ntest('legacy CLI emits an offline plan without modifying its input', { tags: ['release'] }, () => {\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-migration-'));\n try {\n const path = join(root, 'issues.json');\n const bytes = JSON.stringify({ issues: [{ number: 5, body: '## Outcome\\nDeliver.', labels: ['effort:xs'] }] });\n writeFileSync(path, bytes);\n const output = execFileSync(\n process.execPath,\n [join(process.cwd(), 'dist', 'cli.js'), 'migrate:legacy-issues', '--input-file', path],\n { encoding: 'utf8' },\n );\n const report = JSON.parse(output) as { mode: string; plans: { native: { points: number } }[] };\n assert.equal(report.mode, 'dry-run');\n assert.equal(report.plans[0]?.native.points, 1);\n assert.equal(readFileSync(path, 'utf8'), bytes);\n } finally {\n rmSync(root, { recursive: true, force: true });\n }\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,cAAc,QAAQ,qBAAqB;AACjE,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AAErB,SAAS,uCAAuC;AAEhD,KAAK,kGAAkG,MAAM;AAC3G,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,MACN;AAAA,QACE,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,QAAQ,CAAC,iBAAiB,YAAY,aAAa,gBAAgB;AAAA,MACrE;AAAA,IACF;AAAA,IACA,kBAAkB,CAAC,iBAAiB,UAAU;AAAA,EAChD;AACA,QAAM,SAAS,gCAAgC,KAAK;AACpD,SAAO,MAAM,OAAO,eAAe,sCAAsC;AACzE,SAAO,MAAM,OAAO,MAAM,SAAS;AACnC,SAAO,UAAU,OAAO,MAAM,CAAC,GAAG,QAAQ;AAAA,IACxC,WAAW,CAAC,CAAC;AAAA,IACb,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB,CAAC;AACD,SAAO,UAAU,OAAO,yBAAyB,CAAC,UAAU,CAAC;AAC7D,SAAO,aAAa,OAAO,MAAM,CAAC,GAAG,QAAQ,IAAI,wBAAwB;AACzE,SAAO;AAAA,IACL,MACE,gCAAgC;AAAA,MAC9B,QAAQ;AAAA,QACN;AAAA,UACE,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,QAAQ,CAAC,eAAe;AAAA,QAC1B;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM,gCAAgC,EAAE,QAAQ,CAAC,MAAM,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC;AAAA,IACpF;AAAA,EACF;AACF,CAAC;AAED,KAAK,gEAAgE,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,MAAM;AAChG,QAAM,OAAO,YAAY,KAAK,OAAO,GAAG,wBAAwB,CAAC;AACjE,MAAI;AACF,UAAM,OAAO,KAAK,MAAM,aAAa;AACrC,UAAM,QAAQ,KAAK,UAAU,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,wBAAwB,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;AAC7G,kBAAc,MAAM,KAAK;AACzB,UAAM,SAAS;AAAA,MACb,QAAQ;AAAA,MACR,CAAC,KAAK,QAAQ,IAAI,GAAG,QAAQ,QAAQ,GAAG,yBAAyB,gBAAgB,IAAI;AAAA,MACrF,EAAE,UAAU,OAAO;AAAA,IACrB;AACA,UAAM,SAAS,KAAK,MAAM,MAAM;AAChC,WAAO,MAAM,OAAO,MAAM,SAAS;AACnC,WAAO,MAAM,OAAO,MAAM,CAAC,GAAG,OAAO,QAAQ,CAAC;AAC9C,WAAO,MAAM,aAAa,MAAM,MAAM,GAAG,KAAK;AAAA,EAChD,UAAE;AACA,WAAO,MAAM,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EAC/C;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/git.js
CHANGED
|
@@ -1,76 +1,82 @@
|
|
|
1
|
-
import { execFileSync, spawnSync } from
|
|
2
|
-
import { realpathSync } from
|
|
3
|
-
import { basename, dirname, resolve } from
|
|
4
|
-
import { GIT_EXECUTABLE, inertGitArguments, gitEnvironment } from
|
|
5
|
-
import { DeliveryError } from
|
|
6
|
-
import { resolveGitRemoteName } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
1
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, resolve } from "node:path";
|
|
4
|
+
import { GIT_EXECUTABLE, inertGitArguments, gitEnvironment } from "./gitProcess.js";
|
|
5
|
+
import { DeliveryError } from "./errors.js";
|
|
6
|
+
import { resolveGitRemoteName } from "./github/repo.js";
|
|
7
|
+
function git(cwd, ...args) {
|
|
8
|
+
try {
|
|
9
|
+
return execFileSync(GIT_EXECUTABLE, [...inertGitArguments(cwd), ...args], {
|
|
10
|
+
env: gitEnvironment(),
|
|
11
|
+
cwd,
|
|
12
|
+
encoding: "utf8",
|
|
13
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
14
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
15
|
+
}).trim();
|
|
16
|
+
} catch (cause) {
|
|
17
|
+
const error = cause;
|
|
18
|
+
const detail = String(error.stderr ?? "").trim();
|
|
19
|
+
throw new DeliveryError(`git ${args[0] ?? ""} failed${detail ? `: ${detail}` : ""}`);
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return result.status ?? 1;
|
|
22
|
+
function gitExitCode(cwd, ...args) {
|
|
23
|
+
const result = spawnSync(GIT_EXECUTABLE, [...inertGitArguments(cwd), ...args], {
|
|
24
|
+
env: gitEnvironment(),
|
|
25
|
+
cwd,
|
|
26
|
+
encoding: "utf8",
|
|
27
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
28
|
+
});
|
|
29
|
+
if (result.error) throw result.error;
|
|
30
|
+
return result.status ?? 1;
|
|
33
31
|
}
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
function gitRoot(cwd) {
|
|
33
|
+
return realpathSync(resolve(cwd, git(cwd, "rev-parse", "--show-toplevel")));
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
function gitCommonDir(cwd) {
|
|
36
|
+
return realpathSync(resolve(cwd, git(cwd, "rev-parse", "--git-common-dir")));
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return dirname(common);
|
|
38
|
+
function primaryGitRoot(cwd) {
|
|
39
|
+
const common = gitCommonDir(cwd);
|
|
40
|
+
if (basename(common) !== ".git") throw new DeliveryError("Expected a conventional non-bare Git repository.");
|
|
41
|
+
return dirname(common);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
function coordinate(cwd, ref = "HEAD") {
|
|
44
|
+
const sha = git(cwd, "rev-parse", "--verify", ref);
|
|
45
|
+
const tree = git(cwd, "rev-parse", `${sha}^{tree}`);
|
|
46
|
+
if (!/^[a-f0-9]{40}$/u.test(sha) || !/^[a-f0-9]{40}$/u.test(tree)) {
|
|
47
|
+
throw new DeliveryError("Git coordinate is not a SHA-1 commit and tree.");
|
|
48
|
+
}
|
|
49
|
+
return { sha, tree };
|
|
53
50
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
function assertClean(cwd) {
|
|
52
|
+
if (git(cwd, "status", "--porcelain", "--untracked-files=all") !== "") {
|
|
53
|
+
throw new DeliveryError("Delivery requires an exact clean worktree.");
|
|
54
|
+
}
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
function changedPaths(cwd, baseSha, headSha) {
|
|
57
|
+
const output = git(cwd, "diff", "--no-ext-diff", "--no-textconv", "--name-only", "-z", baseSha, headSha);
|
|
58
|
+
return output.split("\0").filter(Boolean).sort();
|
|
62
59
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return `${prefix}main`;
|
|
74
|
-
throw new DeliveryError(`Fetch the selected remote ${remote} and set its default branch before delivery.`);
|
|
60
|
+
function defaultBaseRef(cwd, selectedRemote) {
|
|
61
|
+
const remote = resolveGitRemoteName(cwd, selectedRemote);
|
|
62
|
+
const prefix = `refs/remotes/${remote}/`;
|
|
63
|
+
if (gitExitCode(cwd, "symbolic-ref", "--quiet", `${prefix}HEAD`) === 0) {
|
|
64
|
+
const ref = git(cwd, "symbolic-ref", "--quiet", `${prefix}HEAD`);
|
|
65
|
+
if (!ref.startsWith(prefix)) throw new DeliveryError("Selected remote HEAD points outside its tracking refs.");
|
|
66
|
+
return ref;
|
|
67
|
+
}
|
|
68
|
+
if (gitExitCode(cwd, "show-ref", "--verify", "--quiet", `${prefix}main`) === 0) return `${prefix}main`;
|
|
69
|
+
throw new DeliveryError(`Fetch the selected remote ${remote} and set its default branch before delivery.`);
|
|
75
70
|
}
|
|
76
|
-
|
|
71
|
+
export {
|
|
72
|
+
assertClean,
|
|
73
|
+
changedPaths,
|
|
74
|
+
coordinate,
|
|
75
|
+
defaultBaseRef,
|
|
76
|
+
git,
|
|
77
|
+
gitCommonDir,
|
|
78
|
+
gitExitCode,
|
|
79
|
+
gitRoot,
|
|
80
|
+
primaryGitRoot
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=git.js.map
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/git.ts"],
|
|
4
|
+
"sourcesContent": ["import { execFileSync, spawnSync } from 'node:child_process';\nimport { realpathSync } from 'node:fs';\nimport { basename, dirname, resolve } from 'node:path';\n\nimport { GIT_EXECUTABLE, inertGitArguments, gitEnvironment } from './gitProcess.js';\n\nimport { DeliveryError } from './errors.js';\nimport { resolveGitRemoteName } from './github/repo.js';\n\nexport interface GitCoordinate {\n sha: string;\n tree: string;\n}\n\nexport function git(cwd: string, ...args: string[]): string {\n try {\n return execFileSync(GIT_EXECUTABLE, [...inertGitArguments(cwd), ...args], {\n env: gitEnvironment(),\n cwd,\n encoding: 'utf8',\n maxBuffer: 4 * 1024 * 1024,\n stdio: ['ignore', 'pipe', 'pipe'],\n }).trim();\n } catch (cause) {\n const error = cause as Error & { stderr?: Buffer | string };\n const detail = String(error.stderr ?? '').trim();\n throw new DeliveryError(`git ${args[0] ?? ''} failed${detail ? `: ${detail}` : ''}`);\n }\n}\n\nexport function gitExitCode(cwd: string, ...args: string[]): number {\n const result = spawnSync(GIT_EXECUTABLE, [...inertGitArguments(cwd), ...args], {\n env: gitEnvironment(),\n cwd,\n encoding: 'utf8',\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n if (result.error) throw result.error;\n return result.status ?? 1;\n}\n\nexport function gitRoot(cwd: string): string {\n return realpathSync(resolve(cwd, git(cwd, 'rev-parse', '--show-toplevel')));\n}\n\nexport function gitCommonDir(cwd: string): string {\n return realpathSync(resolve(cwd, git(cwd, 'rev-parse', '--git-common-dir')));\n}\n\nexport function primaryGitRoot(cwd: string): string {\n const common = gitCommonDir(cwd);\n if (basename(common) !== '.git') throw new DeliveryError('Expected a conventional non-bare Git repository.');\n return dirname(common);\n}\n\nexport function coordinate(cwd: string, ref = 'HEAD'): GitCoordinate {\n const sha = git(cwd, 'rev-parse', '--verify', ref);\n const tree = git(cwd, 'rev-parse', `${sha}^{tree}`);\n if (!/^[a-f0-9]{40}$/u.test(sha) || !/^[a-f0-9]{40}$/u.test(tree)) {\n throw new DeliveryError('Git coordinate is not a SHA-1 commit and tree.');\n }\n return { sha, tree };\n}\n\nexport function assertClean(cwd: string): void {\n if (git(cwd, 'status', '--porcelain', '--untracked-files=all') !== '') {\n throw new DeliveryError('Delivery requires an exact clean worktree.');\n }\n}\n\nexport function changedPaths(cwd: string, baseSha: string, headSha: string): string[] {\n const output = git(cwd, 'diff', '--no-ext-diff', '--no-textconv', '--name-only', '-z', baseSha, headSha);\n return output.split('\\0').filter(Boolean).sort();\n}\n\nexport function defaultBaseRef(cwd: string, selectedRemote?: string): string {\n const remote = resolveGitRemoteName(cwd, selectedRemote);\n const prefix = `refs/remotes/${remote}/`;\n if (gitExitCode(cwd, 'symbolic-ref', '--quiet', `${prefix}HEAD`) === 0) {\n const ref = git(cwd, 'symbolic-ref', '--quiet', `${prefix}HEAD`);\n if (!ref.startsWith(prefix)) throw new DeliveryError('Selected remote HEAD points outside its tracking refs.');\n return ref;\n }\n if (gitExitCode(cwd, 'show-ref', '--verify', '--quiet', `${prefix}main`) === 0) return `${prefix}main`;\n throw new DeliveryError(`Fetch the selected remote ${remote} and set its default branch before delivery.`);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/gitProcess.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Local probes use the system Git, never a checkout's PATH shim. */
|
|
2
2
|
export declare const GIT_EXECUTABLE = "/usr/bin/git";
|
|
3
|
-
export declare const GIT_INERT_ARGUMENTS: readonly [
|
|
3
|
+
export declare const GIT_INERT_ARGUMENTS: readonly ['--no-replace-objects', '-c', 'core.hooksPath=/dev/null', '-c', 'core.fsmonitor=false', '-c', 'core.attributesFile=/dev/null', '-c', 'diff.external='];
|
|
4
4
|
export declare function gitEnvironment(): NodeJS.ProcessEnv;
|
|
5
5
|
/** Even status can invoke a tracked attribute's clean filter; neutralize every configured driver. */
|
|
6
6
|
export declare function inertGitArguments(cwd: string): string[];
|
package/dist/gitProcess.js
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
import { spawnSync } from
|
|
2
|
-
import { DeliveryError } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'diff.external=',
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { DeliveryError } from "./errors.js";
|
|
3
|
+
const GIT_EXECUTABLE = "/usr/bin/git";
|
|
4
|
+
const GIT_INERT_ARGUMENTS = [
|
|
5
|
+
"--no-replace-objects",
|
|
6
|
+
"-c",
|
|
7
|
+
"core.hooksPath=/dev/null",
|
|
8
|
+
"-c",
|
|
9
|
+
"core.fsmonitor=false",
|
|
10
|
+
"-c",
|
|
11
|
+
"core.attributesFile=/dev/null",
|
|
12
|
+
"-c",
|
|
13
|
+
"diff.external="
|
|
15
14
|
];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
GIT_TERMINAL_PROMPT: '0',
|
|
27
|
-
};
|
|
15
|
+
function gitEnvironment() {
|
|
16
|
+
const env = { ...process.env };
|
|
17
|
+
for (const name of Object.keys(env)) if (name.startsWith("GIT_")) delete env[name];
|
|
18
|
+
return {
|
|
19
|
+
...env,
|
|
20
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
21
|
+
GIT_CONFIG_GLOBAL: "/dev/null",
|
|
22
|
+
GIT_ATTR_NOSYSTEM: "1",
|
|
23
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
24
|
+
};
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
function inertGitArguments(cwd) {
|
|
27
|
+
const result = spawnSync(
|
|
28
|
+
GIT_EXECUTABLE,
|
|
29
|
+
[
|
|
30
|
+
...GIT_INERT_ARGUMENTS,
|
|
31
|
+
"config",
|
|
32
|
+
"--includes",
|
|
33
|
+
"--name-only",
|
|
34
|
+
"--get-regexp",
|
|
35
|
+
"^filter\\..*\\.(clean|smudge|process|required)$"
|
|
36
|
+
],
|
|
37
|
+
{
|
|
38
|
+
cwd,
|
|
39
|
+
env: gitEnvironment(),
|
|
40
|
+
encoding: "utf8",
|
|
41
|
+
maxBuffer: 1024 * 1024,
|
|
42
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
if (result.error || result.status !== 0 && result.status !== 1)
|
|
46
|
+
throw new DeliveryError("Unable to inspect Git filters safely.");
|
|
47
|
+
const keys = result.stdout.trim().split("\n").filter(Boolean);
|
|
48
|
+
if (keys.length > 4096 || keys.some((key) => !/^filter\.[^\r\n]+\.(clean|smudge|process|required)$/u.test(key) || key.length > 1024))
|
|
49
|
+
throw new DeliveryError("Git filter configuration exceeds the safe probe boundary.");
|
|
50
|
+
return [
|
|
51
|
+
...GIT_INERT_ARGUMENTS,
|
|
52
|
+
...keys.flatMap((key) => ["-c", `${key}=${key.endsWith(".required") ? "false" : ""}`])
|
|
53
|
+
];
|
|
55
54
|
}
|
|
56
|
-
|
|
55
|
+
export {
|
|
56
|
+
GIT_EXECUTABLE,
|
|
57
|
+
GIT_INERT_ARGUMENTS,
|
|
58
|
+
gitEnvironment,
|
|
59
|
+
inertGitArguments
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=gitProcess.js.map
|
package/dist/gitProcess.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/gitProcess.ts"],
|
|
4
|
+
"sourcesContent": ["import { spawnSync } from 'node:child_process';\nimport { DeliveryError } from './errors.js';\n\n/** Local probes use the system Git, never a checkout's PATH shim. */\nexport const GIT_EXECUTABLE = '/usr/bin/git';\nexport const GIT_INERT_ARGUMENTS = [\n '--no-replace-objects',\n '-c',\n 'core.hooksPath=/dev/null',\n '-c',\n 'core.fsmonitor=false',\n '-c',\n 'core.attributesFile=/dev/null',\n '-c',\n 'diff.external=',\n] as const;\nexport function gitEnvironment(): NodeJS.ProcessEnv {\n const env = { ...process.env };\n for (const name of Object.keys(env)) if (name.startsWith('GIT_')) delete env[name];\n return {\n ...env,\n GIT_CONFIG_NOSYSTEM: '1',\n GIT_CONFIG_GLOBAL: '/dev/null',\n GIT_ATTR_NOSYSTEM: '1',\n GIT_TERMINAL_PROMPT: '0',\n };\n}\n/** Even status can invoke a tracked attribute's clean filter; neutralize every configured driver. */\nexport function inertGitArguments(cwd: string): string[] {\n const result = spawnSync(\n GIT_EXECUTABLE,\n [\n ...GIT_INERT_ARGUMENTS,\n 'config',\n '--includes',\n '--name-only',\n '--get-regexp',\n '^filter\\\\..*\\\\.(clean|smudge|process|required)$',\n ],\n {\n cwd,\n env: gitEnvironment(),\n encoding: 'utf8',\n maxBuffer: 1024 * 1024,\n stdio: ['ignore', 'pipe', 'pipe'],\n },\n );\n if (result.error || (result.status !== 0 && result.status !== 1))\n throw new DeliveryError('Unable to inspect Git filters safely.');\n const keys = result.stdout.trim().split('\\n').filter(Boolean);\n if (\n keys.length > 4096 ||\n keys.some((key) => !/^filter\\.[^\\r\\n]+\\.(clean|smudge|process|required)$/u.test(key) || key.length > 1024)\n )\n throw new DeliveryError('Git filter configuration exceeds the safe probe boundary.');\n return [\n ...GIT_INERT_ARGUMENTS,\n ...keys.flatMap((key) => ['-c', `${key}=${key.endsWith('.required') ? 'false' : ''}`]),\n ];\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAGvB,MAAM,iBAAiB;AACvB,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,SAAS,iBAAoC;AAClD,QAAM,MAAM,EAAE,GAAG,QAAQ,IAAI;AAC7B,aAAW,QAAQ,OAAO,KAAK,GAAG,EAAG,KAAI,KAAK,WAAW,MAAM,EAAG,QAAO,IAAI,IAAI;AACjF,SAAO;AAAA,IACL,GAAG;AAAA,IACH,qBAAqB;AAAA,IACrB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,EACvB;AACF;AAEO,SAAS,kBAAkB,KAAuB;AACvD,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA,KAAK,eAAe;AAAA,MACpB,UAAU;AAAA,MACV,WAAW,OAAO;AAAA,MAClB,OAAO,CAAC,UAAU,QAAQ,MAAM;AAAA,IAClC;AAAA,EACF;AACA,MAAI,OAAO,SAAU,OAAO,WAAW,KAAK,OAAO,WAAW;AAC5D,UAAM,IAAI,cAAc,uCAAuC;AACjE,QAAM,OAAO,OAAO,OAAO,KAAK,EAAE,MAAM,IAAI,EAAE,OAAO,OAAO;AAC5D,MACE,KAAK,SAAS,QACd,KAAK,KAAK,CAAC,QAAQ,CAAC,uDAAuD,KAAK,GAAG,KAAK,IAAI,SAAS,IAAI;AAEzG,UAAM,IAAI,cAAc,2DAA2D;AACrF,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,SAAS,WAAW,IAAI,UAAU,EAAE,EAAE,CAAC;AAAA,EACvF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/github/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { graphql as GraphQLType } from '@octokit/graphql';
|
|
2
2
|
import { Octokit } from '@octokit/rest';
|
|
3
|
-
import type { DeliveryConfig, DeliveryRole } from '../config/deliveryConfig.js';
|
|
3
|
+
import type { DeliveryConfig, DeliveryRole, LoadedDeliverySettings } from '../config/deliveryConfig.js';
|
|
4
4
|
import { type RateLimitDiagnostics } from '../errors.js';
|
|
5
5
|
export interface GitHubClients {
|
|
6
6
|
authSource: 'app' | 'personal';
|
|
@@ -29,7 +29,7 @@ export declare function assertDeliveryRolePermissions(input: {
|
|
|
29
29
|
}): void;
|
|
30
30
|
/** The author role may use a personal token only after an explicit operator opt-in. */
|
|
31
31
|
export declare function createDeliveryGitHubClients(input: {
|
|
32
|
-
config: Pick<DeliveryConfig, 'roles'>;
|
|
32
|
+
config: Pick<DeliveryConfig, 'roles'> & Pick<LoadedDeliverySettings, 'credentialKeyReferences'>;
|
|
33
33
|
env?: NodeJS.ProcessEnv;
|
|
34
34
|
identity: string;
|
|
35
35
|
personalAuth?: {
|