@mnemonik/cli 7.104.2 → 7.104.5
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/auth/credentials.js +11 -6
- package/dist/bin.js +5 -4
- package/dist/bin.js.map +1 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +12 -7
- package/dist/diagnostics.js.map +1 -1
- package/dist/digests.json +68 -64
- package/dist/humanReason.d.ts +19 -0
- package/dist/humanReason.d.ts.map +1 -0
- package/dist/humanReason.js +222 -0
- package/dist/humanReason.js.map +1 -0
- package/dist/identity/migrate.js +8 -2
- package/dist/install/journal.d.ts +1 -0
- package/dist/install/journal.d.ts.map +1 -1
- package/dist/install/journal.js +25 -2
- package/dist/install/journal.js.map +1 -1
- package/dist/install/journey.js +8 -2
- package/dist/install/ownership.js +8 -2
- package/dist/install/ui.d.ts.map +1 -1
- package/dist/install/ui.js +3 -2
- package/dist/install/ui.js.map +1 -1
- package/dist/installSession.d.ts.map +1 -1
- package/dist/installSession.js +3 -2
- package/dist/installSession.js.map +1 -1
- package/dist/installation.js +8 -2
- package/dist/launcher.js +8 -2
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/preflight.d.ts +1 -0
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +9 -6
- package/dist/preflight.js.map +1 -1
- package/dist/project/records.js +8 -2
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +20 -10
- package/dist/project.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +100 -96
- package/dist/router.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts.map +1 -1
- package/dist/runtime/bootstrap.js +57 -9
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/selfUpdate.d.ts.map +1 -1
- package/dist/runtime/selfUpdate.js +10 -3
- package/dist/runtime/selfUpdate.js.map +1 -1
- package/dist/runtime/signers.js +53 -23
- package/dist/runtime/store.js +40 -12
- package/dist/runtime/store.js.map +1 -1
- package/dist/sbom.json +50 -21
- package/dist/scanner/control.js +8 -2
- package/dist/scanner/enable.js +10 -4
- package/dist/scanner/enable.js.map +1 -1
- package/dist/scanner/picker.d.ts.map +1 -1
- package/dist/scanner/picker.js +2 -6
- package/dist/scanner/picker.js.map +1 -1
- package/dist/scanner/update.js +8 -2
- package/dist/scanner-release.json +23 -23
- package/dist/screens/journey.d.ts +1 -0
- package/dist/screens/journey.d.ts.map +1 -1
- package/dist/screens/journey.js +11 -9
- package/dist/screens/journey.js.map +1 -1
- package/dist/status.d.ts +12 -4
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +802 -152
- package/dist/status.js.map +1 -1
- package/dist/vendor/local-setup.js +15 -5
- package/dist/vendor/shared/runtimeSigners.js +65 -19
- package/package.json +31 -31
package/dist/status.js
CHANGED
|
@@ -60,8 +60,8 @@ var require_ignore = __commonJS({
|
|
|
60
60
|
TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
|
|
61
61
|
}
|
|
62
62
|
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
63
|
-
var define = (
|
|
64
|
-
Object.defineProperty(
|
|
63
|
+
var define = (object2, key, value) => {
|
|
64
|
+
Object.defineProperty(object2, key, { value });
|
|
65
65
|
return value;
|
|
66
66
|
};
|
|
67
67
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
@@ -566,8 +566,8 @@ async function pendingProjectSetup(root) {
|
|
|
566
566
|
for (const host of ["credit", "cursor", "grok"]) {
|
|
567
567
|
const directory = join2(tmpdir(), `mnemonik-${host}-${uid}`);
|
|
568
568
|
try {
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
569
|
+
const stat2 = await lstat(directory);
|
|
570
|
+
if (stat2.isSymbolicLink() || !stat2.isDirectory())
|
|
571
571
|
continue;
|
|
572
572
|
for (const name2 of await readdir(directory)) {
|
|
573
573
|
if (!/^[a-f0-9]{64}$/.test(name2))
|
|
@@ -608,6 +608,8 @@ var init_hookRuntime = __esm({
|
|
|
608
608
|
});
|
|
609
609
|
|
|
610
610
|
// packages/cli/src/status.ts
|
|
611
|
+
import { genericReadinessMessage, messageFor } from "./humanReason.js";
|
|
612
|
+
import { CODEX_TRUST_MESSAGE } from "./humanReason.js";
|
|
611
613
|
import { cliCredentialStatus } from "./auth/credentials.js";
|
|
612
614
|
import { readOwnership } from "./install/ownership.js";
|
|
613
615
|
import { scannerReceipt } from "./scanner/control.js";
|
|
@@ -4904,9 +4906,657 @@ function stateDirectory(platform = process.platform, env = process.env, home = h
|
|
|
4904
4906
|
var MAX_ORIGINAL_BYTES = 64 * 1024;
|
|
4905
4907
|
|
|
4906
4908
|
// packages/cli/src/status.ts
|
|
4907
|
-
|
|
4908
|
-
import { readFile } from "node:fs/promises";
|
|
4909
|
+
import { readFile, stat } from "node:fs/promises";
|
|
4909
4910
|
import { join as join4 } from "node:path";
|
|
4911
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4912
|
+
|
|
4913
|
+
// node_modules/smol-toml/dist/date.js
|
|
4914
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
4915
|
+
var TomlDate = class _TomlDate extends Date {
|
|
4916
|
+
#hasDate = false;
|
|
4917
|
+
#hasTime = false;
|
|
4918
|
+
#offset = null;
|
|
4919
|
+
constructor(date) {
|
|
4920
|
+
let hasDate = true;
|
|
4921
|
+
let hasTime = true;
|
|
4922
|
+
let offset = "Z";
|
|
4923
|
+
if (typeof date === "string") {
|
|
4924
|
+
let match = date.match(DATE_TIME_RE);
|
|
4925
|
+
if (match) {
|
|
4926
|
+
if (!match[1]) {
|
|
4927
|
+
hasDate = false;
|
|
4928
|
+
date = `0000-01-01T${date}`;
|
|
4929
|
+
}
|
|
4930
|
+
hasTime = !!match[2];
|
|
4931
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
4932
|
+
if (match[2] && +match[2] > 23) {
|
|
4933
|
+
date = "";
|
|
4934
|
+
} else {
|
|
4935
|
+
offset = match[3] || null;
|
|
4936
|
+
date = date.toUpperCase();
|
|
4937
|
+
if (!offset && hasTime)
|
|
4938
|
+
date += "Z";
|
|
4939
|
+
}
|
|
4940
|
+
} else {
|
|
4941
|
+
date = "";
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
super(date);
|
|
4945
|
+
if (!isNaN(this.getTime())) {
|
|
4946
|
+
this.#hasDate = hasDate;
|
|
4947
|
+
this.#hasTime = hasTime;
|
|
4948
|
+
this.#offset = offset;
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
isDateTime() {
|
|
4952
|
+
return this.#hasDate && this.#hasTime;
|
|
4953
|
+
}
|
|
4954
|
+
isLocal() {
|
|
4955
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
4956
|
+
}
|
|
4957
|
+
isDate() {
|
|
4958
|
+
return this.#hasDate && !this.#hasTime;
|
|
4959
|
+
}
|
|
4960
|
+
isTime() {
|
|
4961
|
+
return this.#hasTime && !this.#hasDate;
|
|
4962
|
+
}
|
|
4963
|
+
isValid() {
|
|
4964
|
+
return this.#hasDate || this.#hasTime;
|
|
4965
|
+
}
|
|
4966
|
+
toISOString() {
|
|
4967
|
+
let iso = super.toISOString();
|
|
4968
|
+
if (this.isDate())
|
|
4969
|
+
return iso.slice(0, 10);
|
|
4970
|
+
if (this.isTime())
|
|
4971
|
+
return iso.slice(11, 23);
|
|
4972
|
+
if (this.#offset === null)
|
|
4973
|
+
return iso.slice(0, -1);
|
|
4974
|
+
if (this.#offset === "Z")
|
|
4975
|
+
return iso;
|
|
4976
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
4977
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
4978
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
4979
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
4980
|
+
}
|
|
4981
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
4982
|
+
let date = new _TomlDate(jsDate);
|
|
4983
|
+
date.#offset = offset;
|
|
4984
|
+
return date;
|
|
4985
|
+
}
|
|
4986
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
4987
|
+
let date = new _TomlDate(jsDate);
|
|
4988
|
+
date.#offset = null;
|
|
4989
|
+
return date;
|
|
4990
|
+
}
|
|
4991
|
+
static wrapAsLocalDate(jsDate) {
|
|
4992
|
+
let date = new _TomlDate(jsDate);
|
|
4993
|
+
date.#hasTime = false;
|
|
4994
|
+
date.#offset = null;
|
|
4995
|
+
return date;
|
|
4996
|
+
}
|
|
4997
|
+
static wrapAsLocalTime(jsDate) {
|
|
4998
|
+
let date = new _TomlDate(jsDate);
|
|
4999
|
+
date.#hasDate = false;
|
|
5000
|
+
date.#offset = null;
|
|
5001
|
+
return date;
|
|
5002
|
+
}
|
|
5003
|
+
};
|
|
5004
|
+
|
|
5005
|
+
// node_modules/smol-toml/dist/error.js
|
|
5006
|
+
function getLineColFromPtr(string, ptr) {
|
|
5007
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
5008
|
+
return [lines.length, lines.pop().length + 1];
|
|
5009
|
+
}
|
|
5010
|
+
function makeCodeBlock(string, line, column) {
|
|
5011
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
5012
|
+
let codeblock = "";
|
|
5013
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
5014
|
+
for (let i2 = line - 1; i2 <= line + 1; i2++) {
|
|
5015
|
+
let l = lines[i2 - 1];
|
|
5016
|
+
if (!l)
|
|
5017
|
+
continue;
|
|
5018
|
+
codeblock += i2.toString().padEnd(numberLen, " ");
|
|
5019
|
+
codeblock += ": ";
|
|
5020
|
+
codeblock += l;
|
|
5021
|
+
codeblock += "\n";
|
|
5022
|
+
if (i2 === line) {
|
|
5023
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
5024
|
+
codeblock += "^\n";
|
|
5025
|
+
}
|
|
5026
|
+
}
|
|
5027
|
+
return codeblock;
|
|
5028
|
+
}
|
|
5029
|
+
var TomlError = class extends Error {
|
|
5030
|
+
line;
|
|
5031
|
+
column;
|
|
5032
|
+
codeblock;
|
|
5033
|
+
constructor(message, options) {
|
|
5034
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
5035
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
5036
|
+
super(`Invalid TOML document: ${message}
|
|
5037
|
+
|
|
5038
|
+
${codeblock}`, options);
|
|
5039
|
+
this.line = line;
|
|
5040
|
+
this.column = column;
|
|
5041
|
+
this.codeblock = codeblock;
|
|
5042
|
+
}
|
|
5043
|
+
};
|
|
5044
|
+
|
|
5045
|
+
// node_modules/smol-toml/dist/util.js
|
|
5046
|
+
function indexOfNewline(str, start2 = 0) {
|
|
5047
|
+
let idx = str.indexOf("\n", start2);
|
|
5048
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
5049
|
+
idx--;
|
|
5050
|
+
return idx;
|
|
5051
|
+
}
|
|
5052
|
+
function skipComment(ctx) {
|
|
5053
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
5054
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
5055
|
+
if (c === 10)
|
|
5056
|
+
break;
|
|
5057
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
5058
|
+
ctx.p++;
|
|
5059
|
+
break;
|
|
5060
|
+
}
|
|
5061
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
5062
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
5063
|
+
toml: ctx.s,
|
|
5064
|
+
ptr: ctx.p
|
|
5065
|
+
});
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
}
|
|
5069
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
5070
|
+
let c;
|
|
5071
|
+
while (1) {
|
|
5072
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
5073
|
+
ctx.p++;
|
|
5074
|
+
if (banComments || c !== 35)
|
|
5075
|
+
break;
|
|
5076
|
+
skipComment(ctx);
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
function skipUntil(ctx, sep, end) {
|
|
5080
|
+
let ptr = ctx.p;
|
|
5081
|
+
if (!end) {
|
|
5082
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
5083
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
5084
|
+
return;
|
|
5085
|
+
}
|
|
5086
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
5087
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
5088
|
+
if (c === 35) {
|
|
5089
|
+
skipComment(ctx);
|
|
5090
|
+
} else if (c === end || c === sep) {
|
|
5091
|
+
return;
|
|
5092
|
+
}
|
|
5093
|
+
}
|
|
5094
|
+
throw new TomlError("cannot find end of structure", {
|
|
5095
|
+
toml: ctx.s,
|
|
5096
|
+
ptr
|
|
5097
|
+
});
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5100
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
5101
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
5102
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
5103
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
5104
|
+
function parseString(ctx) {
|
|
5105
|
+
let start2 = ctx.p;
|
|
5106
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
5107
|
+
let first = c;
|
|
5108
|
+
let isLiteral = c === 39;
|
|
5109
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
5110
|
+
if (isMultiline) {
|
|
5111
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
5112
|
+
ctx.p++;
|
|
5113
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
5114
|
+
ctx.p += 2;
|
|
5115
|
+
}
|
|
5116
|
+
let parsed = "";
|
|
5117
|
+
let sliceStart = ctx.p;
|
|
5118
|
+
let state = 0;
|
|
5119
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
5120
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
5121
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
5122
|
+
state = state && 3;
|
|
5123
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
5124
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
5125
|
+
toml: ctx.s,
|
|
5126
|
+
ptr: ctx.p
|
|
5127
|
+
});
|
|
5128
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
5129
|
+
if (isMultiline) {
|
|
5130
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
5131
|
+
ctx.p++;
|
|
5132
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
5133
|
+
ctx.p++;
|
|
5134
|
+
}
|
|
5135
|
+
if (!state)
|
|
5136
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
5137
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
5138
|
+
return parsed;
|
|
5139
|
+
} else if (!state) {
|
|
5140
|
+
if (!isLiteral && c === 92) {
|
|
5141
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
5142
|
+
state = 1;
|
|
5143
|
+
}
|
|
5144
|
+
} else if (state === 1) {
|
|
5145
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
5146
|
+
let value = 0;
|
|
5147
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
5148
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
5149
|
+
let hex = ctx.s.charCodeAt(ctx.p + 1);
|
|
5150
|
+
let digit = (
|
|
5151
|
+
/* 0-9 */
|
|
5152
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
5153
|
+
/* A-F */
|
|
5154
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
5155
|
+
/* a-f */
|
|
5156
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
5157
|
+
)
|
|
5158
|
+
)
|
|
5159
|
+
);
|
|
5160
|
+
if (digit < 0)
|
|
5161
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
5162
|
+
value = value << 4 | digit;
|
|
5163
|
+
}
|
|
5164
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
5165
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
5166
|
+
}
|
|
5167
|
+
parsed += String.fromCodePoint(value);
|
|
5168
|
+
sliceStart = ctx.p + 1;
|
|
5169
|
+
state = 0;
|
|
5170
|
+
} else if (c === 32 || c === 9) {
|
|
5171
|
+
state = 2;
|
|
5172
|
+
} else {
|
|
5173
|
+
if (c === 98)
|
|
5174
|
+
parsed += "\b";
|
|
5175
|
+
else if (c === 116)
|
|
5176
|
+
parsed += " ";
|
|
5177
|
+
else if (c === 110)
|
|
5178
|
+
parsed += "\n";
|
|
5179
|
+
else if (c === 102)
|
|
5180
|
+
parsed += "\f";
|
|
5181
|
+
else if (c === 114)
|
|
5182
|
+
parsed += "\r";
|
|
5183
|
+
else if (c === 101)
|
|
5184
|
+
parsed += "\x1B";
|
|
5185
|
+
else if (c === 34)
|
|
5186
|
+
parsed += '"';
|
|
5187
|
+
else if (c === 92)
|
|
5188
|
+
parsed += "\\";
|
|
5189
|
+
else
|
|
5190
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
5191
|
+
sliceStart = ctx.p + 1;
|
|
5192
|
+
state = 0;
|
|
5193
|
+
}
|
|
5194
|
+
} else if (c !== 32 && c !== 9) {
|
|
5195
|
+
if (state === 2) {
|
|
5196
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
5197
|
+
toml: ctx.s,
|
|
5198
|
+
ptr: sliceStart
|
|
5199
|
+
});
|
|
5200
|
+
}
|
|
5201
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
5202
|
+
sliceStart = ctx.p;
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start2 });
|
|
5206
|
+
}
|
|
5207
|
+
function sliceAndTrimEndOf(ctx, start2, end) {
|
|
5208
|
+
let value = ctx.s.slice(start2, end);
|
|
5209
|
+
let commentIdx = value.indexOf("#");
|
|
5210
|
+
if (commentIdx > 0) {
|
|
5211
|
+
skipComment({ s: value, p: commentIdx, d: 0 });
|
|
5212
|
+
value = value.slice(0, commentIdx);
|
|
5213
|
+
}
|
|
5214
|
+
return value.trimEnd();
|
|
5215
|
+
}
|
|
5216
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
5217
|
+
let ptr = ctx.p;
|
|
5218
|
+
let err2 = { toml: ctx.s, ptr };
|
|
5219
|
+
skipUntil(ctx, 44, end);
|
|
5220
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
5221
|
+
if (!value)
|
|
5222
|
+
throw new TomlError("incomplete declaration: value expected", err2);
|
|
5223
|
+
if (value === "-inf")
|
|
5224
|
+
return -Infinity;
|
|
5225
|
+
if (value === "inf" || value === "+inf")
|
|
5226
|
+
return Infinity;
|
|
5227
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
5228
|
+
return NaN;
|
|
5229
|
+
if (value === "-0")
|
|
5230
|
+
return integersAsBigInt ? 0n : 0;
|
|
5231
|
+
let isInt = INT_REGEX.test(value);
|
|
5232
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
5233
|
+
if (LEADING_ZERO.test(value)) {
|
|
5234
|
+
throw new TomlError("leading zeroes are not allowed", err2);
|
|
5235
|
+
}
|
|
5236
|
+
value = value.replace(/_/g, "");
|
|
5237
|
+
let numeric = +value;
|
|
5238
|
+
if (isNaN(numeric)) {
|
|
5239
|
+
throw new TomlError("invalid number", err2);
|
|
5240
|
+
}
|
|
5241
|
+
if (isInt) {
|
|
5242
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
5243
|
+
throw new TomlError("integer value cannot be represented losslessly", err2);
|
|
5244
|
+
}
|
|
5245
|
+
if (isInt || integersAsBigInt === true)
|
|
5246
|
+
numeric = BigInt(value);
|
|
5247
|
+
}
|
|
5248
|
+
return numeric;
|
|
5249
|
+
}
|
|
5250
|
+
const date = new TomlDate(value);
|
|
5251
|
+
if (!date.isValid())
|
|
5252
|
+
throw new TomlError("invalid value", err2);
|
|
5253
|
+
return date;
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5256
|
+
// node_modules/smol-toml/dist/extract.js
|
|
5257
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
5258
|
+
let ptr = ctx.p;
|
|
5259
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
5260
|
+
if (c === 91 || c === 123) {
|
|
5261
|
+
if (!ctx.d--) {
|
|
5262
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
5263
|
+
toml: ctx.s,
|
|
5264
|
+
ptr
|
|
5265
|
+
});
|
|
5266
|
+
}
|
|
5267
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
5268
|
+
ctx.d++;
|
|
5269
|
+
return value;
|
|
5270
|
+
}
|
|
5271
|
+
if (c === 34 || c === 39) {
|
|
5272
|
+
return parseString(ctx);
|
|
5273
|
+
}
|
|
5274
|
+
if (c === 116) {
|
|
5275
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
5276
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
5277
|
+
ctx.p++;
|
|
5278
|
+
return true;
|
|
5279
|
+
}
|
|
5280
|
+
if (c === 102) {
|
|
5281
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
5282
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
5283
|
+
ctx.p++;
|
|
5284
|
+
return false;
|
|
5285
|
+
}
|
|
5286
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
// node_modules/smol-toml/dist/struct.js
|
|
5290
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
5291
|
+
function parseKey(ctx, end = "=") {
|
|
5292
|
+
let start2 = ctx.p;
|
|
5293
|
+
let dot = start2 - 1;
|
|
5294
|
+
let parsed = [];
|
|
5295
|
+
let endPtr = ctx.s.indexOf(end, start2);
|
|
5296
|
+
if (endPtr < 0) {
|
|
5297
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
5298
|
+
toml: ctx.s,
|
|
5299
|
+
ptr: start2
|
|
5300
|
+
});
|
|
5301
|
+
}
|
|
5302
|
+
do {
|
|
5303
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
5304
|
+
if (c !== 32 && c !== 9) {
|
|
5305
|
+
if (c === 34 || c === 39) {
|
|
5306
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
5307
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
5308
|
+
toml: ctx.s,
|
|
5309
|
+
ptr: ctx.p
|
|
5310
|
+
});
|
|
5311
|
+
}
|
|
5312
|
+
let part = parseString(ctx);
|
|
5313
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
5314
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
5315
|
+
let newLine = indexOfNewline(strEnd);
|
|
5316
|
+
if (newLine > -1) {
|
|
5317
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
5318
|
+
toml: ctx.s,
|
|
5319
|
+
ptr: newLine
|
|
5320
|
+
});
|
|
5321
|
+
}
|
|
5322
|
+
if (strEnd.trimStart()) {
|
|
5323
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
5324
|
+
toml: ctx.s,
|
|
5325
|
+
ptr: ctx.p
|
|
5326
|
+
});
|
|
5327
|
+
}
|
|
5328
|
+
if (endPtr < ctx.p) {
|
|
5329
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
5330
|
+
if (endPtr < 0) {
|
|
5331
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
5332
|
+
toml: ctx.s,
|
|
5333
|
+
ptr: start2
|
|
5334
|
+
});
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5337
|
+
parsed.push(part);
|
|
5338
|
+
} else {
|
|
5339
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
5340
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
5341
|
+
if (!KEY_PART_RE.test(part)) {
|
|
5342
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
5343
|
+
toml: ctx.s,
|
|
5344
|
+
ptr: ctx.p
|
|
5345
|
+
});
|
|
5346
|
+
}
|
|
5347
|
+
parsed.push(part.trimEnd());
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
} while (dot + 1 && dot < endPtr);
|
|
5351
|
+
ctx.p = endPtr + 1;
|
|
5352
|
+
skipVoid(ctx, true, true);
|
|
5353
|
+
return parsed;
|
|
5354
|
+
}
|
|
5355
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
5356
|
+
let res = {};
|
|
5357
|
+
let seen = /* @__PURE__ */ new Set();
|
|
5358
|
+
let c;
|
|
5359
|
+
ctx.p++;
|
|
5360
|
+
while (ctx.p < ctx.s.length) {
|
|
5361
|
+
skipVoid(ctx);
|
|
5362
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
5363
|
+
ctx.p++;
|
|
5364
|
+
return res;
|
|
5365
|
+
}
|
|
5366
|
+
let k;
|
|
5367
|
+
let t = res;
|
|
5368
|
+
let hasOwn = false;
|
|
5369
|
+
let p = ctx.p;
|
|
5370
|
+
let key = parseKey(ctx);
|
|
5371
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
5372
|
+
if (i2)
|
|
5373
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
5374
|
+
k = key[i2];
|
|
5375
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
5376
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
5377
|
+
toml: ctx.s,
|
|
5378
|
+
ptr: p
|
|
5379
|
+
});
|
|
5380
|
+
}
|
|
5381
|
+
if (!hasOwn && k === "__proto__") {
|
|
5382
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
if (hasOwn) {
|
|
5386
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
5387
|
+
toml: ctx.s,
|
|
5388
|
+
ptr: ctx.p
|
|
5389
|
+
});
|
|
5390
|
+
}
|
|
5391
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
5392
|
+
seen.add(t[k] = value);
|
|
5393
|
+
skipVoid(ctx);
|
|
5394
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
5395
|
+
return res;
|
|
5396
|
+
}
|
|
5397
|
+
if (c !== 44) {
|
|
5398
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
5399
|
+
}
|
|
5400
|
+
}
|
|
5401
|
+
throw new TomlError("unfinished table encountered", {
|
|
5402
|
+
toml: ctx.s,
|
|
5403
|
+
ptr: ctx.p
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5406
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
5407
|
+
let res = [];
|
|
5408
|
+
let c;
|
|
5409
|
+
ctx.p++;
|
|
5410
|
+
while (ctx.p < ctx.s.length) {
|
|
5411
|
+
skipVoid(ctx);
|
|
5412
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
5413
|
+
ctx.p++;
|
|
5414
|
+
return res;
|
|
5415
|
+
}
|
|
5416
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
5417
|
+
skipVoid(ctx);
|
|
5418
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
5419
|
+
return res;
|
|
5420
|
+
}
|
|
5421
|
+
if (c !== 44) {
|
|
5422
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
throw new TomlError("unfinished array encountered", {
|
|
5426
|
+
toml: ctx.s,
|
|
5427
|
+
ptr: ctx.p
|
|
5428
|
+
});
|
|
5429
|
+
}
|
|
5430
|
+
|
|
5431
|
+
// node_modules/smol-toml/dist/parse.js
|
|
5432
|
+
function peekTable(key, table, meta, type) {
|
|
5433
|
+
let t = table;
|
|
5434
|
+
let m = meta;
|
|
5435
|
+
let k;
|
|
5436
|
+
let hasOwn = false;
|
|
5437
|
+
let state;
|
|
5438
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
5439
|
+
if (i2) {
|
|
5440
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
5441
|
+
m = (state = m[k]).c;
|
|
5442
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
5443
|
+
return null;
|
|
5444
|
+
}
|
|
5445
|
+
if (state.t === 2) {
|
|
5446
|
+
let l = t.length - 1;
|
|
5447
|
+
t = t[l];
|
|
5448
|
+
m = m[l].c;
|
|
5449
|
+
}
|
|
5450
|
+
}
|
|
5451
|
+
k = key[i2];
|
|
5452
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
5453
|
+
return null;
|
|
5454
|
+
}
|
|
5455
|
+
if (!hasOwn) {
|
|
5456
|
+
if (k === "__proto__") {
|
|
5457
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
5458
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
5459
|
+
}
|
|
5460
|
+
m[k] = {
|
|
5461
|
+
t: i2 < key.length - 1 && type === 2 ? 3 : type,
|
|
5462
|
+
d: false,
|
|
5463
|
+
i: 0,
|
|
5464
|
+
c: {}
|
|
5465
|
+
};
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
state = m[k];
|
|
5469
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
5470
|
+
return null;
|
|
5471
|
+
}
|
|
5472
|
+
if (type === 2) {
|
|
5473
|
+
if (!state.d) {
|
|
5474
|
+
state.d = true;
|
|
5475
|
+
t[k] = [];
|
|
5476
|
+
}
|
|
5477
|
+
t[k].push(t = {});
|
|
5478
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
5479
|
+
}
|
|
5480
|
+
if (state.d) {
|
|
5481
|
+
return null;
|
|
5482
|
+
}
|
|
5483
|
+
state.d = true;
|
|
5484
|
+
if (type === 1) {
|
|
5485
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
5486
|
+
} else if (type === 0 && hasOwn) {
|
|
5487
|
+
return null;
|
|
5488
|
+
}
|
|
5489
|
+
return [k, t, state.c];
|
|
5490
|
+
}
|
|
5491
|
+
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
5492
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
5493
|
+
let res = {};
|
|
5494
|
+
let meta = {};
|
|
5495
|
+
let tmp;
|
|
5496
|
+
let tbl = res;
|
|
5497
|
+
let m = meta;
|
|
5498
|
+
skipVoid(ctx);
|
|
5499
|
+
while (ctx.p < toml.length) {
|
|
5500
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
5501
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
5502
|
+
tmp = ctx.p += +isTableArray;
|
|
5503
|
+
let k = parseKey(ctx, "]");
|
|
5504
|
+
if (isTableArray) {
|
|
5505
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
5506
|
+
throw new TomlError("expected end of table declaration", {
|
|
5507
|
+
toml,
|
|
5508
|
+
ptr: ctx.p - 1
|
|
5509
|
+
});
|
|
5510
|
+
}
|
|
5511
|
+
ctx.p++;
|
|
5512
|
+
}
|
|
5513
|
+
let p = peekTable(
|
|
5514
|
+
k,
|
|
5515
|
+
res,
|
|
5516
|
+
meta,
|
|
5517
|
+
isTableArray ? 2 : 1
|
|
5518
|
+
/* Type.EXPLICIT */
|
|
5519
|
+
);
|
|
5520
|
+
if (!p) {
|
|
5521
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
5522
|
+
toml,
|
|
5523
|
+
ptr: tmp
|
|
5524
|
+
});
|
|
5525
|
+
}
|
|
5526
|
+
m = p[2];
|
|
5527
|
+
tbl = p[1];
|
|
5528
|
+
} else {
|
|
5529
|
+
tmp = ctx.p;
|
|
5530
|
+
let k = parseKey(ctx);
|
|
5531
|
+
let p = peekTable(
|
|
5532
|
+
k,
|
|
5533
|
+
tbl,
|
|
5534
|
+
m,
|
|
5535
|
+
0
|
|
5536
|
+
/* Type.DOTTED */
|
|
5537
|
+
);
|
|
5538
|
+
if (!p) {
|
|
5539
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
5540
|
+
toml,
|
|
5541
|
+
ptr: tmp
|
|
5542
|
+
});
|
|
5543
|
+
}
|
|
5544
|
+
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
5545
|
+
}
|
|
5546
|
+
skipVoid(ctx, true);
|
|
5547
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
5548
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
5549
|
+
toml,
|
|
5550
|
+
ptr: ctx.p
|
|
5551
|
+
});
|
|
5552
|
+
}
|
|
5553
|
+
skipVoid(ctx);
|
|
5554
|
+
}
|
|
5555
|
+
return res;
|
|
5556
|
+
}
|
|
5557
|
+
|
|
5558
|
+
// packages/cli/src/status.ts
|
|
5559
|
+
init_hookRuntime();
|
|
4910
5560
|
import { devReadiness } from "./runtime/releaseSource.js";
|
|
4911
5561
|
import { basename, isAbsolute, relative as relative2, resolve } from "node:path";
|
|
4912
5562
|
import { Output } from "./output.js";
|
|
@@ -4916,6 +5566,109 @@ import {
|
|
|
4916
5566
|
import { hostOrder } from "./install/adapters.js";
|
|
4917
5567
|
import { hookStatusConditions } from "./install/hosts.js";
|
|
4918
5568
|
import { launcherStatus } from "./launcher.js";
|
|
5569
|
+
var editorFiles = [
|
|
5570
|
+
["claude-code", "Claude Code", ".claude/settings.json", ".claude.json"],
|
|
5571
|
+
["codex", "Codex", ".codex/hooks.json", ".codex/config.toml"],
|
|
5572
|
+
["cursor", "Cursor", ".cursor/hooks.json", ".cursor/mcp.json"]
|
|
5573
|
+
];
|
|
5574
|
+
var object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
5575
|
+
function hookCommands(value, owner) {
|
|
5576
|
+
if (Array.isArray(value)) return value.flatMap((entry) => hookCommands(entry, owner));
|
|
5577
|
+
if (!object(value)) return [];
|
|
5578
|
+
return [
|
|
5579
|
+
...typeof value.command === "string" && value.command.includes(`--mnemonik-owner=${owner}`) ? [value.command] : [],
|
|
5580
|
+
...Object.values(value).flatMap((entry) => hookCommands(entry, owner))
|
|
5581
|
+
];
|
|
5582
|
+
}
|
|
5583
|
+
function hookTarget(command) {
|
|
5584
|
+
try {
|
|
5585
|
+
const plain = /^node ("(?:[^"\\]|\\.)*")/u.exec(command)?.[1];
|
|
5586
|
+
if (plain) {
|
|
5587
|
+
const parsed = JSON.parse(plain);
|
|
5588
|
+
if (typeof parsed === "string") return parsed;
|
|
5589
|
+
}
|
|
5590
|
+
const token = /^node -e .* -- ([A-Za-z0-9_-]+)(?:\s|$)/u.exec(command)?.[1];
|
|
5591
|
+
if (token) return fileURLToPath2(Buffer.from(token, "base64url").toString("utf8"));
|
|
5592
|
+
} catch {
|
|
5593
|
+
}
|
|
5594
|
+
return void 0;
|
|
5595
|
+
}
|
|
5596
|
+
async function localEditorStatus(home) {
|
|
5597
|
+
return Promise.all(
|
|
5598
|
+
editorFiles.map(async ([host, name2, hooksFile, mcpFile]) => {
|
|
5599
|
+
const read = (file) => readFile(join4(home, file), "utf8").catch(
|
|
5600
|
+
(error) => error.code === "ENOENT" ? null : ""
|
|
5601
|
+
);
|
|
5602
|
+
const [hooksRaw, mcpRaw] = await Promise.all([read(hooksFile), read(mcpFile)]);
|
|
5603
|
+
let commands = [];
|
|
5604
|
+
try {
|
|
5605
|
+
commands = hookCommands(JSON.parse(hooksRaw ?? "{}"), `${host}-hooks`);
|
|
5606
|
+
} catch {
|
|
5607
|
+
}
|
|
5608
|
+
const hooks = commands.length > 0 && (await Promise.all(
|
|
5609
|
+
commands.map(async (command) => {
|
|
5610
|
+
const target = hookTarget(command);
|
|
5611
|
+
return !!target && (await stat(target).catch(() => null))?.isFile() === true;
|
|
5612
|
+
})
|
|
5613
|
+
)).every(Boolean);
|
|
5614
|
+
let declaration;
|
|
5615
|
+
try {
|
|
5616
|
+
const config = host === "codex" ? parse(mcpRaw ?? "") : JSON.parse(mcpRaw ?? "{}");
|
|
5617
|
+
declaration = object(config.mcp_servers) ? config.mcp_servers.mnemonik : object(config.mcpServers) ? config.mcpServers.mnemonik : void 0;
|
|
5618
|
+
} catch {
|
|
5619
|
+
}
|
|
5620
|
+
return {
|
|
5621
|
+
host,
|
|
5622
|
+
name: name2,
|
|
5623
|
+
// Only a Mnemonik mark in the editor's own settings counts. The mere
|
|
5624
|
+
// presence of ~/.codex or a project-local .cursor is not a choice.
|
|
5625
|
+
marked: commands.length > 0 || object(declaration),
|
|
5626
|
+
hooks,
|
|
5627
|
+
mcp: !object(declaration) ? "missing" : declaration.enabled === false || declaration.disabled === true ? "disabled" : "ready"
|
|
5628
|
+
};
|
|
5629
|
+
})
|
|
5630
|
+
);
|
|
5631
|
+
}
|
|
5632
|
+
var mcpTurnOnAction = {
|
|
5633
|
+
"claude-code": "In Claude Code, type /mcp, choose mnemonik, then turn it on.",
|
|
5634
|
+
codex: "Open ~/.codex/config.toml, find mnemonik and set enabled = true.",
|
|
5635
|
+
cursor: "Open Cursor Settings, Customize, MCPs, then turn on mnemonik."
|
|
5636
|
+
};
|
|
5637
|
+
async function localInstallationConditions(home, stateDir, launcherOptions) {
|
|
5638
|
+
const conditions = [];
|
|
5639
|
+
const issue = (reason, action, component) => conditions.push({
|
|
5640
|
+
kind: "selected_component_failed",
|
|
5641
|
+
reason,
|
|
5642
|
+
action,
|
|
5643
|
+
...component ? { component } : {}
|
|
5644
|
+
});
|
|
5645
|
+
if ((await launcherStatus({ stateDir, home, ...launcherOptions })).ownership !== "ours")
|
|
5646
|
+
issue(
|
|
5647
|
+
"The mnemonik command is missing.",
|
|
5648
|
+
"Run npx -y @mnemonik/cli@latest install to restore it."
|
|
5649
|
+
);
|
|
5650
|
+
const owned = (await readOwnership(stateDir)).targets.map((target) => target.host);
|
|
5651
|
+
const editors = (await localEditorStatus(home)).filter(
|
|
5652
|
+
(editor) => editor.marked || owned.includes(editor.host)
|
|
5653
|
+
);
|
|
5654
|
+
if (!editors.length)
|
|
5655
|
+
issue("No editor connections were found.", "Run mnemonik install to set them up again.");
|
|
5656
|
+
for (const editor of editors) {
|
|
5657
|
+
if (!editor.hooks)
|
|
5658
|
+
issue(
|
|
5659
|
+
`${editor.name} hooks are missing.`,
|
|
5660
|
+
"Run mnemonik install to set them up again.",
|
|
5661
|
+
editor.host
|
|
5662
|
+
);
|
|
5663
|
+
if (editor.mcp !== "ready")
|
|
5664
|
+
issue(
|
|
5665
|
+
`${editor.name} connection is ${editor.mcp === "disabled" ? "turned off" : "missing"}.`,
|
|
5666
|
+
editor.mcp === "missing" ? "Run mnemonik install to set it up again." : mcpTurnOnAction[editor.host],
|
|
5667
|
+
editor.host
|
|
5668
|
+
);
|
|
5669
|
+
}
|
|
5670
|
+
return conditions;
|
|
5671
|
+
}
|
|
4919
5672
|
var contains = (parent, child) => {
|
|
4920
5673
|
const path = relative2(resolve(parent), resolve(child));
|
|
4921
5674
|
return path === "" || !path.startsWith("..") && !isAbsolute(path);
|
|
@@ -5046,144 +5799,6 @@ function buildStatusDocument(input) {
|
|
|
5046
5799
|
generatedAt: input.generatedAt
|
|
5047
5800
|
});
|
|
5048
5801
|
}
|
|
5049
|
-
var CODEX_TRUST_MESSAGE = {
|
|
5050
|
-
sentence: "Codex needs permission to use the Mnemonik hooks.",
|
|
5051
|
-
nextStep: "Open Codex, allow the Mnemonik hooks, then quit and reopen Codex."
|
|
5052
|
-
};
|
|
5053
|
-
var readinessMessages = [
|
|
5054
|
-
[/host_trust_pending|trust_pending/iu, CODEX_TRUST_MESSAGE],
|
|
5055
|
-
[
|
|
5056
|
-
/vendor_policy_pending|vendor policy/iu,
|
|
5057
|
-
{
|
|
5058
|
-
sentence: "Your editor is waiting for permission to use Mnemonik.",
|
|
5059
|
-
nextStep: "Open the editor, approve Mnemonik, then start a new session."
|
|
5060
|
-
}
|
|
5061
|
-
],
|
|
5062
|
-
[
|
|
5063
|
-
/restart_pending|needs? (?:a )?restart/iu,
|
|
5064
|
-
{
|
|
5065
|
-
sentence: "An editor needs to restart before Mnemonik can work.",
|
|
5066
|
-
nextStep: "Quit and reopen the editor, then start a new session."
|
|
5067
|
-
}
|
|
5068
|
-
],
|
|
5069
|
-
[
|
|
5070
|
-
/project_identity_choice_pending|project_setup_required|project identity|pending project setup/iu,
|
|
5071
|
-
{
|
|
5072
|
-
sentence: "A project on this machine still needs to be connected.",
|
|
5073
|
-
nextStep: "Run mnemonik status in the project and follow the project setup step."
|
|
5074
|
-
}
|
|
5075
|
-
],
|
|
5076
|
-
[
|
|
5077
|
-
/scanner_not_verified|background_indexing_not_verified|scanner_paused|dev_release_source/iu,
|
|
5078
|
-
{
|
|
5079
|
-
sentence: "The scanner has not checked in yet.",
|
|
5080
|
-
nextStep: "Run mnemonik status on this machine after the scanner starts."
|
|
5081
|
-
}
|
|
5082
|
-
],
|
|
5083
|
-
[
|
|
5084
|
-
/hook_not_verified|hooks? (?:still )?needs? verification|could not be inspected/iu,
|
|
5085
|
-
{
|
|
5086
|
-
sentence: "Mnemonik has not received context from an editor hook yet.",
|
|
5087
|
-
nextStep: "Start a new editor session, then run mnemonik status."
|
|
5088
|
-
}
|
|
5089
|
-
],
|
|
5090
|
-
[
|
|
5091
|
-
/hooks_missing|hook (?:declaration|credential family) is missing|hooks are not installed/iu,
|
|
5092
|
-
{
|
|
5093
|
-
sentence: "The Mnemonik hooks are not installed correctly for an editor.",
|
|
5094
|
-
nextStep: "Run mnemonik repair on this machine, then restart the editor."
|
|
5095
|
-
}
|
|
5096
|
-
],
|
|
5097
|
-
[
|
|
5098
|
-
/host_grant_unbound|credential_revoked/iu,
|
|
5099
|
-
{
|
|
5100
|
-
sentence: "An editor is signed out of Mnemonik on this machine.",
|
|
5101
|
-
nextStep: "Sign in to Mnemonik from that editor to restore context."
|
|
5102
|
-
}
|
|
5103
|
-
],
|
|
5104
|
-
[
|
|
5105
|
-
/host_not_connected|signed in, not connected yet/iu,
|
|
5106
|
-
{
|
|
5107
|
-
sentence: "An editor is signed in but has not used Mnemonik yet.",
|
|
5108
|
-
nextStep: "Open the editor and start a session in a connected project."
|
|
5109
|
-
}
|
|
5110
|
-
],
|
|
5111
|
-
[
|
|
5112
|
-
/scanner_omitted|scanner (?:was |coverage was )?(?:deliberately )?(?:omitted|skipped)/iu,
|
|
5113
|
-
{
|
|
5114
|
-
sentence: "The scanner is not watching projects on this machine.",
|
|
5115
|
-
nextStep: "Run mnemonik scanner enable to choose the projects to watch."
|
|
5116
|
-
}
|
|
5117
|
-
],
|
|
5118
|
-
[
|
|
5119
|
-
/project_uncovered|outside approved scanner roots/iu,
|
|
5120
|
-
{
|
|
5121
|
-
sentence: "A connected project is outside the folders watched by the scanner.",
|
|
5122
|
-
nextStep: "Run mnemonik scanner enable and add that project."
|
|
5123
|
-
}
|
|
5124
|
-
],
|
|
5125
|
-
[
|
|
5126
|
-
/host_skipped/iu,
|
|
5127
|
-
{
|
|
5128
|
-
sentence: "An editor on this machine is not connected to Mnemonik.",
|
|
5129
|
-
nextStep: "Open that editor and sign in to Mnemonik."
|
|
5130
|
-
}
|
|
5131
|
-
],
|
|
5132
|
-
[
|
|
5133
|
-
/windows_task_creation_failed|windows.*task/iu,
|
|
5134
|
-
{
|
|
5135
|
-
sentence: "Windows could not start the scanner in the background.",
|
|
5136
|
-
nextStep: "Run mnemonik scanner enable again from a terminal with permission to create tasks."
|
|
5137
|
-
}
|
|
5138
|
-
],
|
|
5139
|
-
[
|
|
5140
|
-
/post_commit_upload_failed|status could not be uploaded/iu,
|
|
5141
|
-
{
|
|
5142
|
-
sentence: "Setup finished on this machine, but its status did not reach Mnemonik.",
|
|
5143
|
-
nextStep: "Run mnemonik doctor, then run mnemonik status again."
|
|
5144
|
-
}
|
|
5145
|
-
],
|
|
5146
|
-
[
|
|
5147
|
-
/indexing_failed|indexing failed/iu,
|
|
5148
|
-
{
|
|
5149
|
-
sentence: "The scanner could not index one or more projects.",
|
|
5150
|
-
nextStep: "Run mnemonik doctor on this machine and follow the scanner repair step."
|
|
5151
|
-
}
|
|
5152
|
-
],
|
|
5153
|
-
[
|
|
5154
|
-
/indexing_stalled|not_reporting|indexing stalled/iu,
|
|
5155
|
-
{
|
|
5156
|
-
sentence: "The scanner stopped making progress.",
|
|
5157
|
-
nextStep: "Run mnemonik doctor on this machine and restart the scanner when prompted."
|
|
5158
|
-
}
|
|
5159
|
-
],
|
|
5160
|
-
[
|
|
5161
|
-
/selected_component_failed|failed|unreachable/iu,
|
|
5162
|
-
{
|
|
5163
|
-
sentence: "Part of Mnemonik did not finish setting up.",
|
|
5164
|
-
nextStep: "Run mnemonik doctor on this machine and follow the first repair step."
|
|
5165
|
-
}
|
|
5166
|
-
],
|
|
5167
|
-
[
|
|
5168
|
-
/login_pending|sign.?in|grants? could not be verified|access has not been verified/iu,
|
|
5169
|
-
{
|
|
5170
|
-
sentence: "A Mnemonik sign-in has not finished on this machine.",
|
|
5171
|
-
nextStep: "Finish signing in from the editor, then run mnemonik status."
|
|
5172
|
-
}
|
|
5173
|
-
]
|
|
5174
|
-
];
|
|
5175
|
-
var genericReadinessMessage = {
|
|
5176
|
-
sentence: "This machine needs attention before Mnemonik can work fully.",
|
|
5177
|
-
nextStep: "Run mnemonik doctor on this machine and follow the first repair step."
|
|
5178
|
-
};
|
|
5179
|
-
function messageFor(reason, actions) {
|
|
5180
|
-
const message = readinessMessages.find(([pattern]) => pattern.test(reason))?.[1] ?? genericReadinessMessage;
|
|
5181
|
-
if (!/host_trust_pending|trust_pending/iu.test(reason)) return message;
|
|
5182
|
-
const nextStep = actions.find(
|
|
5183
|
-
(action) => action.startsWith("Run the codex command in a terminal ") || action.startsWith("Open the ChatGPT app ")
|
|
5184
|
-
);
|
|
5185
|
-
return nextStep ? { ...message, nextStep } : message;
|
|
5186
|
-
}
|
|
5187
5802
|
function renderAttention(label, summary2, output, rendered) {
|
|
5188
5803
|
output.line(`${label}: Needs attention.`);
|
|
5189
5804
|
const messages = summary2.reasons.length ? summary2.reasons.map((reason) => messageFor(reason, summary2.actions)) : [genericReadinessMessage];
|
|
@@ -5277,14 +5892,7 @@ async function collectStatusDocument(input) {
|
|
|
5277
5892
|
reason: "scanner_paused",
|
|
5278
5893
|
action: "mnemonik install"
|
|
5279
5894
|
};
|
|
5280
|
-
|
|
5281
|
-
if (snapshot?.lifecycle.pid)
|
|
5282
|
-
try {
|
|
5283
|
-
process.kill(snapshot.lifecycle.pid, 0);
|
|
5284
|
-
alive = true;
|
|
5285
|
-
} catch {
|
|
5286
|
-
}
|
|
5287
|
-
if (state && alive && (snapshot?.lifecycle.state === "running" || snapshot?.lifecycle.state === "starting") && heartbeat && Date.now() - heartbeat < 36e4) {
|
|
5895
|
+
if (state && (snapshot?.lifecycle.state === "running" || snapshot?.lifecycle.state === "starting") && heartbeat && Date.now() - heartbeat < 36e4) {
|
|
5288
5896
|
scannerStatus = {
|
|
5289
5897
|
roots: state.config.roots,
|
|
5290
5898
|
exclusions: state.config.exclusions ?? [],
|
|
@@ -5358,7 +5966,49 @@ export {
|
|
|
5358
5966
|
CODEX_TRUST_MESSAGE,
|
|
5359
5967
|
buildStatusDocument,
|
|
5360
5968
|
collectStatusDocument,
|
|
5969
|
+
localEditorStatus,
|
|
5970
|
+
localInstallationConditions,
|
|
5971
|
+
mcpTurnOnAction,
|
|
5361
5972
|
readProjectStatus,
|
|
5362
5973
|
renderStatusSummaries,
|
|
5363
5974
|
statusExitCode
|
|
5364
5975
|
};
|
|
5976
|
+
/*! Bundled license information:
|
|
5977
|
+
|
|
5978
|
+
smol-toml/dist/date.js:
|
|
5979
|
+
smol-toml/dist/error.js:
|
|
5980
|
+
smol-toml/dist/util.js:
|
|
5981
|
+
smol-toml/dist/primitive.js:
|
|
5982
|
+
smol-toml/dist/extract.js:
|
|
5983
|
+
smol-toml/dist/struct.js:
|
|
5984
|
+
smol-toml/dist/parse.js:
|
|
5985
|
+
smol-toml/dist/stringify.js:
|
|
5986
|
+
smol-toml/dist/index.js:
|
|
5987
|
+
(*!
|
|
5988
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
5989
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5990
|
+
*
|
|
5991
|
+
* Redistribution and use in source and binary forms, with or without
|
|
5992
|
+
* modification, are permitted provided that the following conditions are met:
|
|
5993
|
+
*
|
|
5994
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
5995
|
+
* list of conditions and the following disclaimer.
|
|
5996
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
5997
|
+
* this list of conditions and the following disclaimer in the
|
|
5998
|
+
* documentation and/or other materials provided with the distribution.
|
|
5999
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
6000
|
+
* may be used to endorse or promote products derived from this software without
|
|
6001
|
+
* specific prior written permission.
|
|
6002
|
+
*
|
|
6003
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
6004
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
6005
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
6006
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
6007
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
6008
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
6009
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
6010
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
6011
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
6012
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
6013
|
+
*)
|
|
6014
|
+
*/
|