jj-octo 0.7.0 → 0.7.2
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/jj-octo.js +44 -15
- package/package.json +1 -1
package/dist/jj-octo.js
CHANGED
|
@@ -18239,7 +18239,7 @@ var layer14 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch)
|
|
|
18239
18239
|
// package.json
|
|
18240
18240
|
var package_default = {
|
|
18241
18241
|
name: "jj-octo",
|
|
18242
|
-
version: "0.7.
|
|
18242
|
+
version: "0.7.2",
|
|
18243
18243
|
description: "A jj subcommand for GitHub that supports stacked pull requests and works in Claude Code cloud sessions",
|
|
18244
18244
|
license: "MIT",
|
|
18245
18245
|
repository: {
|
|
@@ -18377,20 +18377,26 @@ class Jj extends Service()("jj-octo/Jj") {
|
|
|
18377
18377
|
var failed = (args, detail) => new JjFailed({
|
|
18378
18378
|
message: detail.trim() === "" ? `jj ${args.join(" ")} failed` : detail.trim().replace(/^Error: /u, "")
|
|
18379
18379
|
});
|
|
18380
|
-
var jjLayer = ({ cwd, env,
|
|
18380
|
+
var jjLayer = ({ cwd, env, printed } = {}) => effect(Jj, gen2(function* () {
|
|
18381
18381
|
const spawner = yield* ChildProcessSpawner;
|
|
18382
18382
|
const location2 = { cwd, env, extendEnv: true };
|
|
18383
|
-
const
|
|
18384
|
-
const read = (args) => scoped2(gen2(function* () {
|
|
18383
|
+
const captured = (args) => scoped2(gen2(function* () {
|
|
18385
18384
|
const handle = yield* spawner.spawn(make15("jj", args, location2));
|
|
18386
|
-
|
|
18385
|
+
return yield* all2([
|
|
18387
18386
|
mkString(decodeText(handle.stdout)),
|
|
18388
18387
|
mkString(decodeText(handle.stderr)),
|
|
18389
18388
|
handle.exitCode
|
|
18390
18389
|
], { concurrency: "unbounded" });
|
|
18391
|
-
return code === 0 ? stdout : yield* failed(args, stderr);
|
|
18392
18390
|
})).pipe(catchTag2("PlatformError", (error) => fail6(failed(args, error.message))));
|
|
18393
|
-
const
|
|
18391
|
+
const read = (args) => flatMap4(captured(args), ([stdout, stderr, code]) => code === 0 ? succeed6(stdout) : fail6(failed(args, stderr)));
|
|
18392
|
+
const run = (args) => printed === undefined ? spawner.exitCode(make15("jj", args, {
|
|
18393
|
+
...location2,
|
|
18394
|
+
stderr: "inherit",
|
|
18395
|
+
stdout: "inherit"
|
|
18396
|
+
})).pipe(catchTag2("PlatformError", (error) => fail6(failed(args, error.message))), flatMap4((code) => code === 0 ? void_3 : fail6(failed(args, "")))) : flatMap4(captured(args), ([stdout, stderr, code]) => {
|
|
18397
|
+
printed(stdout + stderr);
|
|
18398
|
+
return code === 0 ? void_3 : fail6(failed(args, stderr));
|
|
18399
|
+
});
|
|
18394
18400
|
return { read, run };
|
|
18395
18401
|
}));
|
|
18396
18402
|
var JjLive = jjLayer();
|
|
@@ -18443,6 +18449,10 @@ var anyOf = (revsets) => ["none()", ...revsets].join(" | ");
|
|
|
18443
18449
|
var bookmarkRevset = (bookmark) => `bookmarks(exact:"${bookmark}")`;
|
|
18444
18450
|
var lines2 = (output) => output.split(`
|
|
18445
18451
|
`).filter((line) => line !== "");
|
|
18452
|
+
var parseDescription = (json) => {
|
|
18453
|
+
const parsed = JSON.parse(json);
|
|
18454
|
+
return typeof parsed === "string" ? parsed : "";
|
|
18455
|
+
};
|
|
18446
18456
|
var readLog = (revset, template) => gen2(function* () {
|
|
18447
18457
|
const jj = yield* Jj;
|
|
18448
18458
|
return yield* jj.read(["log", "--no-graph", "--reversed", "-r", revset, "-T", template]);
|
|
@@ -18490,8 +18500,7 @@ var loggedChanges = (revset) => logLines(revset, CHANGE).pipe(map7((logged) => l
|
|
|
18490
18500
|
bookmarks = "",
|
|
18491
18501
|
json = '""'
|
|
18492
18502
|
] = line.split("\t");
|
|
18493
|
-
const
|
|
18494
|
-
const description = typeof parsed === "string" ? parsed : "";
|
|
18503
|
+
const description = parseDescription(json);
|
|
18495
18504
|
return {
|
|
18496
18505
|
bookmarks: bookmarks === "" ? [] : bookmarks.split(" "),
|
|
18497
18506
|
changeId,
|
|
@@ -18975,10 +18984,24 @@ var ignoreClaudeCodeFooterKey = "jj-octo.ignore-claude-code-footer";
|
|
|
18975
18984
|
var ignoresClaudeCodeFooter = jjFlag(ignoreClaudeCodeFooterKey);
|
|
18976
18985
|
var descriptionsOf = (commits) => commits.length === 0 ? succeed6(new Map) : readLog(commits.join(" | "), String.raw`commit_id ++ "\t" ++ description.escape_json() ++ "\n"`).pipe(map7((output) => new Map(lines2(output).map((line) => {
|
|
18977
18986
|
const [commit = "", json = '""'] = line.split("\t");
|
|
18978
|
-
|
|
18979
|
-
return [commit, typeof parsed === "string" ? parsed : ""];
|
|
18987
|
+
return [commit, parseDescription(json)];
|
|
18980
18988
|
}))));
|
|
18981
|
-
var
|
|
18989
|
+
var ownDescriptions = (bookmark, changeId) => gen2(function* () {
|
|
18990
|
+
const jj = yield* Jj;
|
|
18991
|
+
const output = yield* jj.read([
|
|
18992
|
+
"evolog",
|
|
18993
|
+
"--no-graph",
|
|
18994
|
+
"-r",
|
|
18995
|
+
bookmarkRevset(bookmark),
|
|
18996
|
+
"-T",
|
|
18997
|
+
String.raw`commit.change_id() ++ "\t" ++ commit.description().escape_json() ++ "\n"`
|
|
18998
|
+
]);
|
|
18999
|
+
return lines2(output).flatMap((line) => {
|
|
19000
|
+
const [change = "", json = '""'] = line.split("\t");
|
|
19001
|
+
return change === changeId ? [parseDescription(json)] : [];
|
|
19002
|
+
});
|
|
19003
|
+
});
|
|
19004
|
+
var syncDescription = ({ bookmark, changeId, description }, pullRequest, { ignoreClaudeCodeFooter, overwriteDescriptions, pushedDescription }) => gen2(function* () {
|
|
18982
19005
|
const git = yield* Git;
|
|
18983
19006
|
const jj = yield* Jj;
|
|
18984
19007
|
const describe = (text) => jj.run(["describe", "-r", bookmarkRevset(bookmark), "-m", text]);
|
|
@@ -18987,6 +19010,10 @@ var syncDescription = ({ bookmark, description }, pullRequest, { ignoreClaudeCod
|
|
|
18987
19010
|
ignoreClaudeCodeFooter
|
|
18988
19011
|
});
|
|
18989
19012
|
const pushed = normalizedDescription(pushedDescription, { ignoreClaudeCodeFooter });
|
|
19013
|
+
const isOwnEarlier = local !== onGitHub && onGitHub !== pushed && (yield* ownDescriptions(bookmark, changeId)).some((text) => normalizedDescription(text, { ignoreClaudeCodeFooter }) === onGitHub);
|
|
19014
|
+
if (isOwnEarlier) {
|
|
19015
|
+
return some2(local);
|
|
19016
|
+
}
|
|
18990
19017
|
return yield* value4(descriptionSyncFor({ local, onGitHub, pushed })).pipe(tag3("InSync", () => succeed6(none2())), tag3("TakeGitHub", () => describe(onGitHub).pipe(andThen2(error(`took the description of #${pullRequest.number} from GitHub`)), as2(none2()))), tag3("SendLocal", () => succeed6(some2(local))), tag3("Merge", () => gen2(function* () {
|
|
18991
19018
|
if (overwriteDescriptions) {
|
|
18992
19019
|
return some2(local);
|
|
@@ -19147,13 +19174,15 @@ var mergedIn = (bookmarks, heads) => gen2(function* () {
|
|
|
19147
19174
|
});
|
|
19148
19175
|
var mergedOnGitHub = (bookmarks) => flatMap4(mergedHeadsOf(bookmarks), (heads) => mergedIn(bookmarks, heads));
|
|
19149
19176
|
var forget = (names) => gen2(function* () {
|
|
19150
|
-
|
|
19177
|
+
const listed = yield* bookmarkTargets;
|
|
19178
|
+
const present = names.filter((name) => listed.has(name));
|
|
19179
|
+
if (present.length > 0) {
|
|
19151
19180
|
const jj = yield* Jj;
|
|
19152
19181
|
yield* jj.run([
|
|
19153
19182
|
"bookmark",
|
|
19154
19183
|
"forget",
|
|
19155
19184
|
"--include-remotes",
|
|
19156
|
-
...
|
|
19185
|
+
...present.map((name) => `exact:${name}`)
|
|
19157
19186
|
]);
|
|
19158
19187
|
}
|
|
19159
19188
|
});
|
|
@@ -19464,7 +19493,7 @@ var submitCommand = make31("submit", {
|
|
|
19464
19493
|
overwriteDescriptions: Boolean6("overwrite-descriptions").pipe(withDefault5(false), withDescription2("Where a description changed both locally and on GitHub, send the local one instead of merging the two")),
|
|
19465
19494
|
publish: Boolean6("publish").pipe(withDefault5(false), withDescription2("Open new pull requests ready for review, instead of as drafts")),
|
|
19466
19495
|
revision: revisionFlag("The top change to submit")
|
|
19467
|
-
}, ({ overwriteDescriptions, publish, revision }) => asUserError(submit(revision, { draft: !publish, overwriteDescriptions }).pipe(provide3(GitHubFromOrigin)))).pipe(withHelp("Push a change and the ones below it, and open their pull requests", "Pushes the bookmark of each of those changes. An empty working copy means the change below it, so from the top of a stack this submits all of it. Opens a pull request for each branch that has none, with the title and body from the change's description. Points each pull request at the branch below it, and the bottom one at the default branch.", "New pull requests are opened as drafts, or ready for review with `--publish`. The flag doesn't change a pull request that already exists.", "Keeps each pull request's title and body the same as its change's description. A description edited on GitHub is written into the change, one edited locally is sent to the pull request, and edits on both sides are merged line by line. Edits to the same lines stop the submit before anything is pushed.", "First, where any of those changes' pull requests merged or any of their branches changed on GitHub, syncs their stack as `jj gh sync` does, and leaves other stacks alone. That drops the merged changes, takes what GitHub added to the branches, and rebases the rest onto the trunk, so the push doesn't undo GitHub's work.", "Stops before changing anything where one of their branches was deleted on GitHub and their change doesn't count as merged: no pull request from it merged, another commit merged, or the change was edited since. It says how to push the change again, or drop it.", "Registers the pull requests as one GitHub stack. A stack of one change is a single pull request, which GitHub has no stack for.", "If changes were reordered, inserted or dropped since the last submit, the GitHub stack is dissolved and registered again under a new number. The pull requests stay open, including the one of a dropped change."));
|
|
19496
|
+
}, ({ overwriteDescriptions, publish, revision }) => asUserError(submit(revision, { draft: !publish, overwriteDescriptions }).pipe(provide3(GitHubFromOrigin)))).pipe(withHelp("Push a change and the ones below it, and open their pull requests", "Pushes the bookmark of each of those changes. An empty working copy means the change below it, so from the top of a stack this submits all of it. Opens a pull request for each branch that has none, with the title and body from the change's description. Points each pull request at the branch below it, and the bottom one at the default branch.", "New pull requests are opened as drafts, or ready for review with `--publish`. The flag doesn't change a pull request that already exists.", "Keeps each pull request's title and body the same as its change's description. A description edited on GitHub is written into the change, one edited locally is sent to the pull request, and edits on both sides are merged line by line. A local edit pushed with `jj git push` from this repository is sent too, unless the pull request was also edited on GitHub since the last submit. Edits to the same lines stop the submit before anything is pushed.", "First, where any of those changes' pull requests merged or any of their branches changed on GitHub, syncs their stack as `jj gh sync` does, and leaves other stacks alone. That drops the merged changes, takes what GitHub added to the branches, and rebases the rest onto the trunk, so the push doesn't undo GitHub's work.", "Stops before changing anything where one of their branches was deleted on GitHub and their change doesn't count as merged: no pull request from it merged, another commit merged, or the change was edited since. It says how to push the change again, or drop it.", "Registers the pull requests as one GitHub stack. A stack of one change is a single pull request, which GitHub has no stack for.", "If changes were reordered, inserted or dropped since the last submit, the GitHub stack is dissolved and registered again under a new number. The pull requests stay open, including the one of a dropped change."));
|
|
19468
19497
|
|
|
19469
19498
|
// src/cli/gh/command.ts
|
|
19470
19499
|
var jjGhCommand = make31("jj gh").pipe(withSubcommands([
|