@plannotator/opencode 0.26.0 → 0.26.1
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/embedded.js +32 -6
- package/package.json +2 -2
- package/plannotator.html +2 -2
- package/review-editor.html +2 -2
package/dist/embedded.js
CHANGED
|
@@ -77755,6 +77755,9 @@ var init_jj_core = __esm(() => {
|
|
|
77755
77755
|
// ../../packages/shared/gitbutler-core.ts
|
|
77756
77756
|
import { lstat as lstat3, readlink } from "fs/promises";
|
|
77757
77757
|
import { basename as basename6, resolve as resolve10 } from "path";
|
|
77758
|
+
function isUnexpectedArgumentRejection(result, flag) {
|
|
77759
|
+
return result.exitCode !== 0 && result.stderr.includes(`unexpected argument '${flag}'`);
|
|
77760
|
+
}
|
|
77758
77761
|
function isRecord(value) {
|
|
77759
77762
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
77760
77763
|
}
|
|
@@ -77803,12 +77806,12 @@ function parseStack(value, path2) {
|
|
|
77803
77806
|
const branches = requireArray(record.branches, `${path2}.branches`).map((branch, index) => parseBranch(branch, `${path2}.branches[${index}]`));
|
|
77804
77807
|
return { branches };
|
|
77805
77808
|
}
|
|
77806
|
-
function parseGitButlerStatus(output) {
|
|
77809
|
+
function parseGitButlerStatus(output, commandLabel = GITBUTLER_STATUS_SYNTAXES[0].label) {
|
|
77807
77810
|
let decoded;
|
|
77808
77811
|
try {
|
|
77809
77812
|
decoded = JSON.parse(output);
|
|
77810
77813
|
} catch {
|
|
77811
|
-
throw new GitButlerContractError(
|
|
77814
|
+
throw new GitButlerContractError(`GitButler returned invalid JSON from \`${commandLabel}\`.`);
|
|
77812
77815
|
}
|
|
77813
77816
|
const root3 = requireRecord(decoded, "root");
|
|
77814
77817
|
requireArray(root3.uncommittedChanges, "uncommittedChanges");
|
|
@@ -77879,15 +77882,33 @@ async function loadStatus(runtime, cwd) {
|
|
|
77879
77882
|
if (existing && (existing.inFlight || existing.expiresAt > now))
|
|
77880
77883
|
return existing.status;
|
|
77881
77884
|
const status = (async () => {
|
|
77882
|
-
const
|
|
77885
|
+
const preferredIndex = statusSyntaxPreferences.get(runtime) ?? 0;
|
|
77886
|
+
let syntaxIndex = preferredIndex;
|
|
77887
|
+
let syntax = GITBUTLER_STATUS_SYNTAXES[syntaxIndex];
|
|
77888
|
+
let result = await runtime.runBut([...syntax.args], {
|
|
77883
77889
|
cwd,
|
|
77884
77890
|
timeoutMs: STATUS_TIMEOUT_MS
|
|
77885
77891
|
});
|
|
77892
|
+
if (isUnexpectedArgumentRejection(result, syntax.flag)) {
|
|
77893
|
+
syntaxIndex = preferredIndex === 0 ? 1 : 0;
|
|
77894
|
+
const fallback = GITBUTLER_STATUS_SYNTAXES[syntaxIndex];
|
|
77895
|
+
const retried = await runtime.runBut([...fallback.args], {
|
|
77896
|
+
cwd,
|
|
77897
|
+
timeoutMs: STATUS_TIMEOUT_MS
|
|
77898
|
+
});
|
|
77899
|
+
if (isUnexpectedArgumentRejection(retried, fallback.flag)) {
|
|
77900
|
+
throw new GitButlerContractError(`GitButler rejected both \`${syntax.label}\` and \`${fallback.label}\`; ` + `Plannotator requires GitButler ${GITBUTLER_MIN_VERSION} or newer.`);
|
|
77901
|
+
}
|
|
77902
|
+
syntax = fallback;
|
|
77903
|
+
result = retried;
|
|
77904
|
+
}
|
|
77886
77905
|
if (result.exitCode !== 0) {
|
|
77887
77906
|
const detail = result.stderr.trim();
|
|
77888
|
-
throw new GitButlerContractError(`GitButler status failed${detail ? `: ${detail}` : ` with exit code ${result.exitCode}`}`);
|
|
77907
|
+
throw new GitButlerContractError(`GitButler status (\`${syntax.label}\`) failed${detail ? `: ${detail}` : ` with exit code ${result.exitCode}`}`);
|
|
77889
77908
|
}
|
|
77890
|
-
|
|
77909
|
+
const parsed = parseGitButlerStatus(result.stdout, syntax.label);
|
|
77910
|
+
statusSyntaxPreferences.set(runtime, syntaxIndex);
|
|
77911
|
+
return parsed;
|
|
77891
77912
|
})();
|
|
77892
77913
|
const entry = { expiresAt: 0, inFlight: true, status };
|
|
77893
77914
|
cache2.set(cwd, entry);
|
|
@@ -78262,7 +78283,7 @@ async function getGitButlerDiffFingerprint(runtime, diffType, cwd, options) {
|
|
|
78262
78283
|
const detail = result.error ?? `No fingerprint for ${result.label}`;
|
|
78263
78284
|
return `gitbutler:${diffType}:error:${hashFingerprintPart(detail)}`;
|
|
78264
78285
|
}
|
|
78265
|
-
var GITBUTLER_MIN_VERSION = "0.21.0", GITBUTLER_WORKSPACE_DIFF = "gitbutler:workspace", GITBUTLER_STACK_PREFIX = "gitbutler:stack:", GITBUTLER_BRANCH_PREFIX = "gitbutler:branch:", GITBUTLER_WORKSPACE_REFS, STATUS_TIMEOUT_MS = 30000, VERSION_TIMEOUT_MS = 5000, OBJECT_ID_RE, STATUS_CACHE_MS = 1000, GitButlerContractError, versionChecks, statusCaches;
|
|
78286
|
+
var GITBUTLER_MIN_VERSION = "0.21.0", GITBUTLER_WORKSPACE_DIFF = "gitbutler:workspace", GITBUTLER_STACK_PREFIX = "gitbutler:stack:", GITBUTLER_BRANCH_PREFIX = "gitbutler:branch:", GITBUTLER_WORKSPACE_REFS, STATUS_TIMEOUT_MS = 30000, VERSION_TIMEOUT_MS = 5000, OBJECT_ID_RE, STATUS_CACHE_MS = 1000, GITBUTLER_STATUS_SYNTAXES, GitButlerContractError, versionChecks, statusSyntaxPreferences, statusCaches;
|
|
78266
78287
|
var init_gitbutler_core = __esm(() => {
|
|
78267
78288
|
init_review_core();
|
|
78268
78289
|
GITBUTLER_WORKSPACE_REFS = new Set([
|
|
@@ -78270,6 +78291,10 @@ var init_gitbutler_core = __esm(() => {
|
|
|
78270
78291
|
"refs/heads/gitbutler/integration"
|
|
78271
78292
|
]);
|
|
78272
78293
|
OBJECT_ID_RE = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i;
|
|
78294
|
+
GITBUTLER_STATUS_SYNTAXES = [
|
|
78295
|
+
{ args: ["--format", "json", "status"], flag: "--format", label: "but --format json status" },
|
|
78296
|
+
{ args: ["--json", "status"], flag: "--json", label: "but --json status" }
|
|
78297
|
+
];
|
|
78273
78298
|
GitButlerContractError = class GitButlerContractError extends Error {
|
|
78274
78299
|
_tag = "GitButlerContractError";
|
|
78275
78300
|
constructor(message) {
|
|
@@ -78278,6 +78303,7 @@ var init_gitbutler_core = __esm(() => {
|
|
|
78278
78303
|
}
|
|
78279
78304
|
};
|
|
78280
78305
|
versionChecks = new WeakMap;
|
|
78306
|
+
statusSyntaxPreferences = new WeakMap;
|
|
78281
78307
|
statusCaches = new WeakMap;
|
|
78282
78308
|
});
|
|
78283
78309
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plannotator/opencode",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plannotator plugin for OpenCode - interactive plan review with visual annotation",
|
|
6
6
|
"author": "backnotprop",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@opencode-ai/plugin": "0.0.0-next-16775",
|
|
45
|
-
"@plannotator/server": "0.26.
|
|
45
|
+
"@plannotator/server": "0.26.1",
|
|
46
46
|
"@plannotator/shared": "0.0.1"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|