@workit-dev/pi 1.14.1 → 1.14.3
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/worker.js +6 -4
- package/dist/workit.js +20 -6
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -7954,11 +7954,13 @@ function fastGit(root) {
|
|
|
7954
7954
|
}
|
|
7955
7955
|
function resolveStore(root) {
|
|
7956
7956
|
root = path7.resolve(root);
|
|
7957
|
-
let
|
|
7957
|
+
let stat = null;
|
|
7958
7958
|
try {
|
|
7959
|
-
|
|
7959
|
+
stat = fs4.statSync(root);
|
|
7960
7960
|
} catch {}
|
|
7961
|
-
if (!
|
|
7961
|
+
if (!stat)
|
|
7962
|
+
return new Error(`cannot locate the workit store: ${root} does not exist (removed while workit ran?); nothing is recorded under a missing directory`);
|
|
7963
|
+
if (!stat.isDirectory())
|
|
7962
7964
|
return { dir: path7.join(root, ".workit"), shared: false, top: null };
|
|
7963
7965
|
const fast = fastGit(root);
|
|
7964
7966
|
if (fast?.kind === "none")
|
|
@@ -8355,7 +8357,7 @@ var safeRef = (value) => value.length > 0 && !value.startsWith("-");
|
|
|
8355
8357
|
function storeRoot(cwd) {
|
|
8356
8358
|
const location = resolveStore(path10.resolve(cwd));
|
|
8357
8359
|
if (location instanceof Error)
|
|
8358
|
-
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), "fix the repository (git status should work here) or run from a non-git directory");
|
|
8360
|
+
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), / does not exist /u.test(location.message) ? "run workit from a directory that exists" : "fix the repository (git status should work here) or run from a non-git directory");
|
|
8359
8361
|
return { ok: true, value: { root: location.dir, shared: location.shared } };
|
|
8360
8362
|
}
|
|
8361
8363
|
function ledgerPath(cwd) {
|
package/dist/workit.js
CHANGED
|
@@ -10837,11 +10837,13 @@ function fastGit(root) {
|
|
|
10837
10837
|
}
|
|
10838
10838
|
function resolveStore(root) {
|
|
10839
10839
|
root = path9.resolve(root);
|
|
10840
|
-
let
|
|
10840
|
+
let stat = null;
|
|
10841
10841
|
try {
|
|
10842
|
-
|
|
10842
|
+
stat = fs5.statSync(root);
|
|
10843
10843
|
} catch {}
|
|
10844
|
-
if (!
|
|
10844
|
+
if (!stat)
|
|
10845
|
+
return new Error(`cannot locate the workit store: ${root} does not exist (removed while workit ran?); nothing is recorded under a missing directory`);
|
|
10846
|
+
if (!stat.isDirectory())
|
|
10845
10847
|
return { dir: path9.join(root, ".workit"), shared: false, top: null };
|
|
10846
10848
|
const fast = fastGit(root);
|
|
10847
10849
|
if (fast?.kind === "none")
|
|
@@ -15787,7 +15789,7 @@ function cleanRebase(cwd, range) {
|
|
|
15787
15789
|
function storeRoot(cwd) {
|
|
15788
15790
|
const location = resolveStore(path20.resolve(cwd));
|
|
15789
15791
|
if (location instanceof Error)
|
|
15790
|
-
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), "fix the repository (git status should work here) or run from a non-git directory");
|
|
15792
|
+
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), / does not exist /u.test(location.message) ? "run workit from a directory that exists" : "fix the repository (git status should work here) or run from a non-git directory");
|
|
15791
15793
|
return { ok: true, value: { root: location.dir, shared: location.shared } };
|
|
15792
15794
|
}
|
|
15793
15795
|
function ledgerPath(cwd) {
|
|
@@ -15988,7 +15990,7 @@ var sealed = (row, id, at, previous) => {
|
|
|
15988
15990
|
` };
|
|
15989
15991
|
};
|
|
15990
15992
|
function appendRaw(cwd, row, options) {
|
|
15991
|
-
const file = ledgerPath(cwd);
|
|
15993
|
+
const file = options.store ? { ok: true, value: path20.join(options.store.root, "ledger", "ledger.jsonl") } : ledgerPath(cwd);
|
|
15992
15994
|
if (!file.ok)
|
|
15993
15995
|
return file;
|
|
15994
15996
|
const id = newId2();
|
|
@@ -24771,8 +24773,18 @@ var WORKIT_USER_ONLY = [
|
|
|
24771
24773
|
["grant", "set"],
|
|
24772
24774
|
["grant", "raise"],
|
|
24773
24775
|
["ledger", "void"],
|
|
24774
|
-
["approve"]
|
|
24776
|
+
["approve"],
|
|
24777
|
+
["setup"],
|
|
24778
|
+
["uninstall"],
|
|
24779
|
+
["install"],
|
|
24780
|
+
["workspace", "seal"]
|
|
24775
24781
|
];
|
|
24782
|
+
var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set(WORKIT_USER_ONLY.map((words) => words[0]))].join("|")})\\b`);
|
|
24783
|
+
var mayRunUserOnly = (text) => {
|
|
24784
|
+
const joined = text.replace(/\\\r?\n/g, "");
|
|
24785
|
+
const bare = joined.replace(/['"\\]/g, "");
|
|
24786
|
+
return [bare, bare.replace(/`/g, "")].some((all) => /\bworkit\b/.test(all) && (USER_ONLY_WORD.test(all) || /\$['"]/.test(joined)));
|
|
24787
|
+
};
|
|
24776
24788
|
var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
|
|
24777
24789
|
var hasWordsInOrder = (words, needle) => {
|
|
24778
24790
|
let at = 0;
|
|
@@ -24805,6 +24817,8 @@ var workitBypassFlag = (command, dialect = "posix") => {
|
|
|
24805
24817
|
return null;
|
|
24806
24818
|
};
|
|
24807
24819
|
var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
24820
|
+
if (!mayRunUserOnly(command))
|
|
24821
|
+
return null;
|
|
24808
24822
|
for (const segment of segmentsOf(command, dialect)) {
|
|
24809
24823
|
if (segment.unanalyzable)
|
|
24810
24824
|
continue;
|