@mrciphersmith/keryx 0.3.76 → 0.3.77
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/cli.js +86 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20145,7 +20145,7 @@ var package_default;
|
|
|
20145
20145
|
var init_package = __esm(() => {
|
|
20146
20146
|
package_default = {
|
|
20147
20147
|
name: "@mrciphersmith/keryx",
|
|
20148
|
-
version: "0.3.
|
|
20148
|
+
version: "0.3.77",
|
|
20149
20149
|
description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
20150
20150
|
private: false,
|
|
20151
20151
|
publishConfig: {
|
|
@@ -126919,13 +126919,75 @@ var init_proxy = __esm(() => {
|
|
|
126919
126919
|
init_guard();
|
|
126920
126920
|
});
|
|
126921
126921
|
|
|
126922
|
+
// src/commands/granted-json-ids.ts
|
|
126923
|
+
function letters(index) {
|
|
126924
|
+
return String(index).replace(/\d/g, (d) => String.fromCharCode(97 + Number(d)));
|
|
126925
|
+
}
|
|
126926
|
+
function protectJsonIds(text) {
|
|
126927
|
+
const head = text.trim();
|
|
126928
|
+
if (head.length === 0 || head[0] !== "[" && head[0] !== "{")
|
|
126929
|
+
return;
|
|
126930
|
+
if (text.includes(PLACEHOLDER))
|
|
126931
|
+
return;
|
|
126932
|
+
try {
|
|
126933
|
+
JSON.parse(head);
|
|
126934
|
+
} catch {
|
|
126935
|
+
return;
|
|
126936
|
+
}
|
|
126937
|
+
const hidden = [];
|
|
126938
|
+
const hide = (value) => {
|
|
126939
|
+
hidden.push(value);
|
|
126940
|
+
return `${PLACEHOLDER}${letters(hidden.length - 1)}x`;
|
|
126941
|
+
};
|
|
126942
|
+
let out = "";
|
|
126943
|
+
let i = 0;
|
|
126944
|
+
while (i < text.length) {
|
|
126945
|
+
const ch = text[i];
|
|
126946
|
+
if (ch === '"') {
|
|
126947
|
+
let j = i + 1;
|
|
126948
|
+
while (j < text.length && text[j] !== '"')
|
|
126949
|
+
j += text[j] === "\\" ? 2 : 1;
|
|
126950
|
+
const literal = text.slice(i, j + 1);
|
|
126951
|
+
const inner = literal.slice(1, -1);
|
|
126952
|
+
const prefix = GITHUB_URL_PREFIX.exec(inner);
|
|
126953
|
+
const rest = prefix === null ? "" : inner.slice(prefix[0].length);
|
|
126954
|
+
out += prefix !== null && GITHUB_URL_REST.test(rest) ? `"${prefix[0]}${rest.replace(/\d+/g, hide)}"` : literal;
|
|
126955
|
+
i = j + 1;
|
|
126956
|
+
continue;
|
|
126957
|
+
}
|
|
126958
|
+
const number = ch === "-" || ch >= "0" && ch <= "9" ? NUMBER2.exec(text.slice(i, i + 40)) : null;
|
|
126959
|
+
if (number !== null) {
|
|
126960
|
+
const key = /"((?:[^"\\]|\\.)*)"\s*:\s*$/.exec(out.slice(-120))?.[1] ?? "";
|
|
126961
|
+
out += SENSITIVE_KEY.test(key) ? number[0] : hide(number[0]);
|
|
126962
|
+
i += number[0].length;
|
|
126963
|
+
continue;
|
|
126964
|
+
}
|
|
126965
|
+
out += ch;
|
|
126966
|
+
i += 1;
|
|
126967
|
+
}
|
|
126968
|
+
return {
|
|
126969
|
+
text: out,
|
|
126970
|
+
restore: (scrubbed) => scrubbed.replace(new RegExp(`${PLACEHOLDER}([a-j]+)x`, "g"), (whole, index) => {
|
|
126971
|
+
const at = Number(index.replace(/[a-j]/g, (c) => String(c.charCodeAt(0) - 97)));
|
|
126972
|
+
return hidden[at] ?? whole;
|
|
126973
|
+
})
|
|
126974
|
+
};
|
|
126975
|
+
}
|
|
126976
|
+
var PLACEHOLDER = "kxjsonid", GITHUB_URL_PREFIX, GITHUB_URL_REST, SENSITIVE_KEY, NUMBER2;
|
|
126977
|
+
var init_granted_json_ids = __esm(() => {
|
|
126978
|
+
GITHUB_URL_PREFIX = /^https:\/\/(?:api\.)?github\.com\/(?:repos\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\//;
|
|
126979
|
+
GITHUB_URL_REST = /^(?:actions\/runs|pull|issues)\/\d+(?:\/[A-Za-z0-9_-]+)*(?:#[A-Za-z_-]+-?\d+)?$/;
|
|
126980
|
+
SENSITIVE_KEY = /token|secret|pass|key|auth|credential|private|ssn|phone|card|account|iban|pin|otp/i;
|
|
126981
|
+
NUMBER2 = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/;
|
|
126982
|
+
});
|
|
126983
|
+
|
|
126922
126984
|
// src/commands/trigger-agent-task.ts
|
|
126923
126985
|
import { execFile as execFile11 } from "child_process";
|
|
126924
126986
|
import { randomUUID as randomUUID35 } from "crypto";
|
|
126925
126987
|
import { mkdtemp as mkdtemp5, mkdir as mkdir60, readdir as readdir42, rm as rm19, writeFile as writeFile37 } from "fs/promises";
|
|
126926
126988
|
import { homedir as homedir12, tmpdir as tmpdir11 } from "os";
|
|
126927
126989
|
import path266 from "path";
|
|
126928
|
-
function scrubGrantedOutput(text, env, secrets = []) {
|
|
126990
|
+
function scrubGrantedOutput(text, env, secrets = [], json = false) {
|
|
126929
126991
|
let out = text;
|
|
126930
126992
|
for (const value of secrets) {
|
|
126931
126993
|
if (value.length >= 8)
|
|
@@ -126938,10 +127000,18 @@ function scrubGrantedOutput(text, env, secrets = []) {
|
|
|
126938
127000
|
}
|
|
126939
127001
|
for (const [shape, mask] of TOKEN_SHAPES)
|
|
126940
127002
|
out = out.replace(shape, mask);
|
|
127003
|
+
if (json) {
|
|
127004
|
+
const at = out.indexOf(STDERR_MARK);
|
|
127005
|
+
const protectedJson = protectJsonIds(at === -1 ? out : out.slice(0, at));
|
|
127006
|
+
if (protectedJson !== undefined) {
|
|
127007
|
+
const tail = at === -1 ? "" : redactSensitiveText(out.slice(at));
|
|
127008
|
+
return protectedJson.restore(redactSensitiveText(protectedJson.text)) + tail;
|
|
127009
|
+
}
|
|
127010
|
+
}
|
|
126941
127011
|
return redactSensitiveText(out);
|
|
126942
127012
|
}
|
|
126943
|
-
function scrubThenCap(raw, env, secrets, max = GRANTED_MAX_BYTES) {
|
|
126944
|
-
const scrubbed = scrubGrantedOutput(raw, env, secrets);
|
|
127013
|
+
function scrubThenCap(raw, env, secrets, max = GRANTED_MAX_BYTES, json = false) {
|
|
127014
|
+
const scrubbed = scrubGrantedOutput(raw, env, secrets, json);
|
|
126945
127015
|
if (scrubbed.length <= max)
|
|
126946
127016
|
return scrubbed;
|
|
126947
127017
|
const head = scrubbed.slice(0, max);
|
|
@@ -126959,7 +127029,7 @@ ${stderr}` : ""}`;
|
|
|
126959
127029
|
const code = error === null ? 0 : typeof error.code === "number" ? error.code : null;
|
|
126960
127030
|
const reason = error === null ? "" : `
|
|
126961
127031
|
[exit: ${code ?? error.message}]`;
|
|
126962
|
-
resolve({ output: `${scrubThenCap(raw, env, secrets)}${scrubGrantedOutput(reason, env, secrets)}`, exitCode: code, ok: error === null });
|
|
127032
|
+
resolve({ output: `${scrubThenCap(raw, env, secrets, GRANTED_MAX_BYTES, true)}${scrubGrantedOutput(reason, env, secrets)}`, exitCode: code, ok: error === null });
|
|
126963
127033
|
});
|
|
126964
127034
|
});
|
|
126965
127035
|
}
|
|
@@ -127326,7 +127396,9 @@ function defaultArmTimeout2(ms, fire) {
|
|
|
127326
127396
|
timer.unref?.();
|
|
127327
127397
|
return () => clearTimeout(timer);
|
|
127328
127398
|
}
|
|
127329
|
-
var GRANTED_TIMEOUT_MS = 30000, GRANTED_MAX_BYTES,
|
|
127399
|
+
var GRANTED_TIMEOUT_MS = 30000, GRANTED_MAX_BYTES, STDERR_MARK = `
|
|
127400
|
+
[stderr]
|
|
127401
|
+
`, SECRET_ENV_NAME, TOKEN_SHAPES;
|
|
127330
127402
|
var init_trigger_agent_task = __esm(() => {
|
|
127331
127403
|
init_agent();
|
|
127332
127404
|
init_agent_hooks();
|
|
@@ -127338,6 +127410,7 @@ var init_trigger_agent_task = __esm(() => {
|
|
|
127338
127410
|
init_fs();
|
|
127339
127411
|
init_maintenance_lock();
|
|
127340
127412
|
init_service2();
|
|
127413
|
+
init_granted_json_ids();
|
|
127341
127414
|
init_granted_binary();
|
|
127342
127415
|
init_schedule_verify();
|
|
127343
127416
|
init_granted_tools();
|
|
@@ -127388,9 +127461,9 @@ function ghEnvForProject(projectRoot, base = process.env) {
|
|
|
127388
127461
|
function parseGrantedOutput(output, ok, exitCode) {
|
|
127389
127462
|
const exit = EXIT_MARK.exec(output);
|
|
127390
127463
|
const withoutExit = exit === null ? output : output.slice(0, exit.index);
|
|
127391
|
-
const stderrAt = withoutExit.indexOf(
|
|
127464
|
+
const stderrAt = withoutExit.indexOf(STDERR_MARK2);
|
|
127392
127465
|
const stdout = stderrAt === -1 ? withoutExit : withoutExit.slice(0, stderrAt);
|
|
127393
|
-
const stderr = stderrAt === -1 ? "" : withoutExit.slice(stderrAt +
|
|
127466
|
+
const stderr = stderrAt === -1 ? "" : withoutExit.slice(stderrAt + STDERR_MARK2.length).trim();
|
|
127394
127467
|
if (!ok) {
|
|
127395
127468
|
const why = stderr.length > 0 ? stderr : exit !== null ? exit[0].trim() : "gh failed";
|
|
127396
127469
|
return { ok: false, stdout: "", detail: `${why.replace(/\s+/g, " ").slice(0, 300)}`, exitCode };
|
|
@@ -127400,7 +127473,7 @@ function parseGrantedOutput(output, ok, exitCode) {
|
|
|
127400
127473
|
}
|
|
127401
127474
|
return { ok: true, stdout, detail: "", exitCode };
|
|
127402
127475
|
}
|
|
127403
|
-
var GH_ENV_ALLOWED,
|
|
127476
|
+
var GH_ENV_ALLOWED, STDERR_MARK2 = `
|
|
127404
127477
|
[stderr]
|
|
127405
127478
|
`, TRUNCATED, EXIT_MARK, defaultGhRunner = async (call) => {
|
|
127406
127479
|
const result = await runGrantedCommand(call.bin, call.argv, call.cwd, call.env, call.signal, call.secrets);
|
|
@@ -185268,10 +185341,10 @@ function codeOf(text) {
|
|
|
185268
185341
|
return stripTrailingComment2(text).trimEnd();
|
|
185269
185342
|
}
|
|
185270
185343
|
function numericSkeleton(text) {
|
|
185271
|
-
return text.replace(
|
|
185344
|
+
return text.replace(NUMBER3, "\x00");
|
|
185272
185345
|
}
|
|
185273
185346
|
function numbersOf(text) {
|
|
185274
|
-
return [...text.matchAll(
|
|
185347
|
+
return [...text.matchAll(NUMBER3)].map((match) => ({ value: Number(match[0]), index: match.index ?? 0 }));
|
|
185275
185348
|
}
|
|
185276
185349
|
function enclosingNames(code, index) {
|
|
185277
185350
|
const names = [];
|
|
@@ -185534,7 +185607,7 @@ function renderFloorMarkdown(report) {
|
|
|
185534
185607
|
return lines.join(`
|
|
185535
185608
|
`);
|
|
185536
185609
|
}
|
|
185537
|
-
var FLOOR_FINDING_KINDS, COMMENT_OPENER, FLOOR_WORDS, CEILING_WORDS, CAPACITY_WORDS,
|
|
185610
|
+
var FLOOR_FINDING_KINDS, COMMENT_OPENER, FLOOR_WORDS, CEILING_WORDS, CAPACITY_WORDS, NUMBER3, KEY_SEPARATORS, TRAILING_IDENTIFIER, TRAILING_INDEX, OPENS_CONTAINER, TYPE_KEYWORDS, COMMENTED_LINE, MODIFIER_SEGMENT, DISABLED_CALL, DISABLED_ANNOTATION, OTHER_TEST_PATHS, ASSERTION_HEAD, SUPPRESSION_MARKERS, ANNOTATION_MARKERS;
|
|
185538
185611
|
var init_floor = __esm(() => {
|
|
185539
185612
|
init_selection();
|
|
185540
185613
|
FLOOR_FINDING_KINDS = [
|
|
@@ -185624,7 +185697,7 @@ var init_floor = __esm(() => {
|
|
|
185624
185697
|
"parallel",
|
|
185625
185698
|
"batch"
|
|
185626
185699
|
]);
|
|
185627
|
-
|
|
185700
|
+
NUMBER3 = /[0-9]+(?:\.[0-9]+)?/g;
|
|
185628
185701
|
KEY_SEPARATORS = /[\s:=(["'`{<]*$/;
|
|
185629
185702
|
TRAILING_IDENTIFIER = /[A-Za-z0-9_$.-]+$/;
|
|
185630
185703
|
TRAILING_INDEX = /\[\s*[0-9]*\s*\]$/;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.77",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|