@workit-dev/opencode 2.22.0 → 2.22.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/plugin.js +33 -27
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -21879,26 +21879,34 @@ var normalizedUrl = (url, dir) => {
|
|
|
21879
21879
|
const value = scheme ? trimmed.slice(scheme[0].length).replace(/^[^@/]*@/, "").replace(/^([^/:]+):\d+(?=\/)/, "$1") : trimmed.replace(/^[^@/]*@/, "").replace(":", "/");
|
|
21880
21880
|
return value.toLowerCase().replace(/\/{2,}/g, "/").replace(/^www\./, "").replace(/\/+$/, "").replace(/\.git$/, "");
|
|
21881
21881
|
};
|
|
21882
|
-
var
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
const
|
|
21900
|
-
|
|
21882
|
+
var rewrite = (url, config, kind) => {
|
|
21883
|
+
let best = null;
|
|
21884
|
+
for (const [key, prefixes] of config) {
|
|
21885
|
+
if (!key.startsWith("url.") || !key.endsWith(`.${kind}`))
|
|
21886
|
+
continue;
|
|
21887
|
+
const base = key.slice(4, -(kind.length + 1));
|
|
21888
|
+
for (const prefix of prefixes)
|
|
21889
|
+
if (url.startsWith(prefix) && prefix.length > (best?.prefix.length ?? -1))
|
|
21890
|
+
best = { base, prefix };
|
|
21891
|
+
}
|
|
21892
|
+
return best ? best.base + url.slice(best.prefix.length) : null;
|
|
21893
|
+
};
|
|
21894
|
+
var rewrittenUrl = (url, config) => rewrite(url, config, "pushinsteadof") ?? rewrite(url, config, "insteadof") ?? url;
|
|
21895
|
+
var pushUrlsOf = (config, remote) => {
|
|
21896
|
+
const pushurls = config.get(`remote.${remote}.pushurl`) ?? [];
|
|
21897
|
+
if (pushurls.length)
|
|
21898
|
+
return pushurls.map((url) => rewrite(url, config, "insteadof") ?? url);
|
|
21899
|
+
const urls = config.get(`remote.${remote}.url`) ?? [remote];
|
|
21900
|
+
const aliased = urls.flatMap((url) => rewrite(url, config, "pushinsteadof") ?? []);
|
|
21901
|
+
return aliased.length ? aliased : urls.map((url) => rewrite(url, config, "insteadof") ?? url);
|
|
21902
|
+
};
|
|
21903
|
+
var singlePushUrl = (config, remote) => {
|
|
21904
|
+
if (!config.has(`remote.${remote}.url`) && !config.has(`remote.${remote}.pushurl`))
|
|
21905
|
+
return null;
|
|
21906
|
+
const urls = pushUrlsOf(config, remote);
|
|
21907
|
+
return urls.length === 1 ? urls[0] : null;
|
|
21901
21908
|
};
|
|
21909
|
+
var pushUrl2 = (config, remote, dir) => normalizedUrl(pushUrlsOf(config, remote).at(-1) ?? remote, dir);
|
|
21902
21910
|
var pushRemoteOf = (config, branch) => {
|
|
21903
21911
|
const remotes = new Set;
|
|
21904
21912
|
for (const key of config.keys()) {
|
|
@@ -22343,20 +22351,18 @@ var forgeRepo = (gh, named, env, config, branch, dir) => {
|
|
|
22343
22351
|
const hosted = gh ? parts.length > 2 : parts.length > 2 && parts[0].includes(".");
|
|
22344
22352
|
let url = /:\/\/|@/.test(repo) ? repo : parts.length > 1 ? `https://${hosted ? "" : `${host}/`}${repo}` : "";
|
|
22345
22353
|
if (!repo) {
|
|
22346
|
-
const
|
|
22347
|
-
|
|
22354
|
+
const pushHost = pushHostOf(config, pushRemoteOf(config, branch) ?? "origin");
|
|
22355
|
+
const remote = (gh ? ghDefaultOf(config, pushHost, dir, env) : null) ?? ["upstream", "origin"].find((name) => config.has(`remote.${name}.url`) && (name === "origin" || pushHost === null || pushHostOf(config, name) === pushHost));
|
|
22356
|
+
url = remote ? pushUrlsOf(config, remote).at(-1) ?? "" : "";
|
|
22348
22357
|
}
|
|
22349
22358
|
const key = remoteKey(url);
|
|
22350
22359
|
return key ? { remotes: [{ name: "forge", url, key }] } : Error("its repository is unknown");
|
|
22351
22360
|
};
|
|
22352
22361
|
var pushHostOf = (config, remote) => {
|
|
22353
|
-
const
|
|
22354
|
-
|
|
22355
|
-
return null;
|
|
22356
|
-
return remoteKey(rewrittenUrl(urls[0], config))?.split("/")[0] ?? null;
|
|
22362
|
+
const url = singlePushUrl(config, remote);
|
|
22363
|
+
return url === null ? null : remoteKey(url)?.split("/")[0] ?? null;
|
|
22357
22364
|
};
|
|
22358
|
-
var ghDefaultOf = (config,
|
|
22359
|
-
const pushHost = pushHostOf(config, pushRemoteOf(config, branch) ?? "origin");
|
|
22365
|
+
var ghDefaultOf = (config, pushHost, dir, env) => {
|
|
22360
22366
|
for (const [key, value] of localGhResolved(dir, env)) {
|
|
22361
22367
|
const name = key.slice(7, -12);
|
|
22362
22368
|
if (!name || value !== "base")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@opencode/plugin": "2.3.2",
|
|
44
|
-
"@workit-dev/core": "^2.22.
|
|
44
|
+
"@workit-dev/core": "^2.22.1"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|