getshrike 1.0.0-rc.2 → 1.0.0
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/git.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/main.js +26 -7
- package/dist/session.d.ts +5 -2
- package/dist/version.d.ts +1 -1
- package/package.json +12 -11
package/dist/git.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ export declare function git(root: string, args: string[], allowFailure?: boolean
|
|
|
2
2
|
export declare function isDirty(root: string): boolean;
|
|
3
3
|
export declare function headCommit(root: string): string;
|
|
4
4
|
export declare function mergeBase(root: string, base: string): string;
|
|
5
|
+
export declare function listRemotes(root: string): string[];
|
|
6
|
+
/**
|
|
7
|
+
* `gh pr create --base` expects a branch name, but a plan records the ref it
|
|
8
|
+
* analyzed, which is usually the remote-tracking `origin/main`. Strip a
|
|
9
|
+
* leading remote name only when it is a configured remote, so a branch such
|
|
10
|
+
* as `release/1.0` is left alone.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pullRequestBase(baseRef: string, remotes: string[]): string;
|
|
5
13
|
export declare function resolveDefaultBase(root: string, explicit?: string): string;
|
|
6
14
|
export interface Worktree {
|
|
7
15
|
directory: string;
|
package/dist/index.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -1223,7 +1223,7 @@ var VERSION, PROTOCOL_VERSION;
|
|
|
1223
1223
|
var init_version = __esm({
|
|
1224
1224
|
"src/version.ts"() {
|
|
1225
1225
|
"use strict";
|
|
1226
|
-
VERSION = "1.0.0
|
|
1226
|
+
VERSION = "1.0.0";
|
|
1227
1227
|
PROTOCOL_VERSION = "1.0";
|
|
1228
1228
|
}
|
|
1229
1229
|
});
|
|
@@ -3223,6 +3223,15 @@ function mergeBase(root, base) {
|
|
|
3223
3223
|
if (fallback) return fallback;
|
|
3224
3224
|
throw new Error(`could not resolve base ref ${base}`);
|
|
3225
3225
|
}
|
|
3226
|
+
function listRemotes(root) {
|
|
3227
|
+
return git(root, ["remote"], true).split("\n").map((name) => name.trim()).filter((name) => name.length > 0);
|
|
3228
|
+
}
|
|
3229
|
+
function pullRequestBase(baseRef, remotes) {
|
|
3230
|
+
const slash = baseRef.indexOf("/");
|
|
3231
|
+
if (slash <= 0) return baseRef;
|
|
3232
|
+
const remote = baseRef.slice(0, slash);
|
|
3233
|
+
return remotes.includes(remote) ? baseRef.slice(slash + 1) : baseRef;
|
|
3234
|
+
}
|
|
3226
3235
|
function resolveDefaultBase(root, explicit) {
|
|
3227
3236
|
if (explicit) return explicit;
|
|
3228
3237
|
for (const candidate of ["origin/main", "main", "origin/master", "master"]) {
|
|
@@ -3330,7 +3339,8 @@ async function analyzePair(root, args, options = {}) {
|
|
|
3330
3339
|
"in-place",
|
|
3331
3340
|
// `prune --dry-run` computes a plan without touching the tree; the flag is
|
|
3332
3341
|
// owned by prune but must survive this shared validation.
|
|
3333
|
-
"dry-run"
|
|
3342
|
+
"dry-run",
|
|
3343
|
+
...options.extraFlags ?? []
|
|
3334
3344
|
]);
|
|
3335
3345
|
const config = await loadConfig(root);
|
|
3336
3346
|
const baseRef = resolveDefaultBase(root, stringFlag(args, "base"));
|
|
@@ -5199,7 +5209,10 @@ async function pruneCommand(root, args) {
|
|
|
5199
5209
|
const allowDirty = booleanFlag(args, "allow-dirty") || config.verification.allowDirty;
|
|
5200
5210
|
if (isDirty(root) && !allowDirty) throw new UsageError("prune requires a clean working tree");
|
|
5201
5211
|
const tier = parseTier(stringFlag(args, "tier"), config.verification.tier);
|
|
5202
|
-
const pair = await analyzePair(root, args, {
|
|
5212
|
+
const pair = await analyzePair(root, args, {
|
|
5213
|
+
allowDirty: config.verification.allowDirty,
|
|
5214
|
+
extraFlags: ["pr", "verify", "receipt"]
|
|
5215
|
+
});
|
|
5203
5216
|
const plan = await requestEngine("plan", { snapshot: pair.head, delta: pair.delta, config: engineConfig(config) });
|
|
5204
5217
|
storePlan(root, pair, plan, tier);
|
|
5205
5218
|
const receiptBuild = toReceiptBuild(pair.build);
|
|
@@ -5399,7 +5412,7 @@ async function pruneCommand(root, args) {
|
|
|
5399
5412
|
}
|
|
5400
5413
|
}
|
|
5401
5414
|
function openPullRequest(root, branch, plan, receiptPaths, config) {
|
|
5402
|
-
const base = config.pr.base ?? plan.base.ref ?? "main";
|
|
5415
|
+
const base = pullRequestBase(config.pr.base ?? plan.base.ref ?? "main", listRemotes(root));
|
|
5403
5416
|
const receipts = receiptPaths.map((path) => readReceipt(path));
|
|
5404
5417
|
const batches = receipts.map((receipt) => ({
|
|
5405
5418
|
id: receipt.batch.id,
|
|
@@ -5425,9 +5438,15 @@ function openPullRequest(root, branch, plan, receiptPaths, config) {
|
|
|
5425
5438
|
receipts
|
|
5426
5439
|
});
|
|
5427
5440
|
const title = config.pr.title === "Shrike: verified cleanup" ? `Shrike: remove ${plan.totals.symbols} dead symbols` : config.pr.title;
|
|
5428
|
-
const remote = spawnSync3("git", ["
|
|
5429
|
-
|
|
5430
|
-
|
|
5441
|
+
const remote = spawnSync3("git", ["ls-remote", "--heads", "origin", branch], { cwd: root, encoding: "utf8" });
|
|
5442
|
+
const remoteExists = remote.status === 0 && remote.stdout.trim().length > 0;
|
|
5443
|
+
if (remoteExists) {
|
|
5444
|
+
const fetched = spawnSync3("git", ["fetch", "--quiet", "origin", branch], { cwd: root, encoding: "utf8" });
|
|
5445
|
+
if (fetched.status !== 0) {
|
|
5446
|
+
writeStderr(`Could not fetch origin/${branch}; refusing to force-push. Push manually after review.`);
|
|
5447
|
+
return;
|
|
5448
|
+
}
|
|
5449
|
+
const ancestor = spawnSync3("git", ["merge-base", "--is-ancestor", "FETCH_HEAD", "HEAD"], { cwd: root, encoding: "utf8" });
|
|
5431
5450
|
if (ancestor.status !== 0) {
|
|
5432
5451
|
writeStderr(`Remote branch ${branch} diverged; refusing to force-push. Push manually after review.`);
|
|
5433
5452
|
return;
|
package/dist/session.d.ts
CHANGED
|
@@ -14,8 +14,11 @@ export interface AnalysisPair {
|
|
|
14
14
|
build: BuildEvidenceInfo | null;
|
|
15
15
|
cleanup: () => void;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export interface AnalyzePairOptions {
|
|
18
18
|
allowDirty?: boolean;
|
|
19
|
-
|
|
19
|
+
/** Flags owned by the calling command that the shared validation must accept. */
|
|
20
|
+
extraFlags?: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function analyzePair(root: string, args: ParsedArgs, options?: AnalyzePairOptions): Promise<AnalysisPair>;
|
|
20
23
|
export declare function attachBuildEvidence(root: string, head: Snapshot, args: ParsedArgs, config: ShrikeConfig): Promise<BuildEvidenceInfo | null>;
|
|
21
24
|
export declare function toReceiptBuild(info: BuildEvidenceInfo | null): ReceiptBuild;
|
package/dist/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "getshrike",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Verified dead-code cleanup: whole-graph orphan delta, verified deletion batches, and portable receipts.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"./config": {
|
|
18
18
|
"types": "./dist/config.d.ts",
|
|
19
19
|
"default": "./dist/config.js"
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|
|
@@ -50,17 +51,17 @@
|
|
|
50
51
|
"provenance": true
|
|
51
52
|
},
|
|
52
53
|
"optionalDependencies": {
|
|
53
|
-
"getshrike-linux-x64": "1.0.0
|
|
54
|
-
"getshrike-linux-arm64": "1.0.0
|
|
55
|
-
"getshrike-darwin-x64": "1.0.0
|
|
56
|
-
"getshrike-darwin-arm64": "1.0.0
|
|
57
|
-
"getshrike-windows-x64": "1.0.0
|
|
54
|
+
"getshrike-linux-x64": "1.0.0",
|
|
55
|
+
"getshrike-linux-arm64": "1.0.0",
|
|
56
|
+
"getshrike-darwin-x64": "1.0.0",
|
|
57
|
+
"getshrike-darwin-arm64": "1.0.0",
|
|
58
|
+
"getshrike-windows-x64": "1.0.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@shrike/agent": "1.0.0
|
|
61
|
-
"@shrike/receipts": "1.0.0
|
|
62
|
-
"@shrike/testkit": "1.0.0
|
|
63
|
-
"@shrike/verifier": "1.0.0
|
|
61
|
+
"@shrike/agent": "1.0.0",
|
|
62
|
+
"@shrike/receipts": "1.0.0",
|
|
63
|
+
"@shrike/testkit": "1.0.0",
|
|
64
|
+
"@shrike/verifier": "1.0.0",
|
|
64
65
|
"@types/node": "^24.0.0",
|
|
65
66
|
"typescript": "^5.9.3"
|
|
66
67
|
},
|