@workit-dev/mcp 2.18.1 → 2.20.0
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/index.js +752 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17886,6 +17886,7 @@ var workspaceConfigSchema = object({
|
|
|
17886
17886
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
17887
17887
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
17888
17888
|
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
17889
|
+
feedback: unknown().optional().describe('`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
|
|
17889
17890
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
17890
17891
|
fanout: object({
|
|
17891
17892
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
@@ -17928,7 +17929,10 @@ var workspaceConfigSchema = object({
|
|
|
17928
17929
|
});
|
|
17929
17930
|
var workspacesFileSchema = object({
|
|
17930
17931
|
workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
|
|
17931
|
-
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
|
|
17932
|
+
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false)."),
|
|
17933
|
+
feedback: object({
|
|
17934
|
+
account: nonBlank.optional().describe("The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
|
|
17935
|
+
}).passthrough().optional().describe("`workit feedback` defaults for every workspace.")
|
|
17932
17936
|
}).passthrough().superRefine((file, context) => {
|
|
17933
17937
|
const names = new Set;
|
|
17934
17938
|
for (const [index, workspace] of (file.workspaces ?? []).entries()) {
|
|
@@ -23274,6 +23278,203 @@ function generatedByAttributes(files, paths) {
|
|
|
23274
23278
|
return out;
|
|
23275
23279
|
}
|
|
23276
23280
|
|
|
23281
|
+
// packages/workit-core/src/core/policy/dep-bump.ts
|
|
23282
|
+
var MANIFESTS = new Set(["package.json", "go.mod", "Cargo.toml", "pyproject.toml"]);
|
|
23283
|
+
var basename = (file) => file.slice(file.lastIndexOf("/") + 1);
|
|
23284
|
+
var isManifest = (file) => MANIFESTS.has(basename(file));
|
|
23285
|
+
var refused = (why) => ({ pins: false, bumped: 0, scripts: [], why });
|
|
23286
|
+
var pinned = (bumped, scripts = []) => ({
|
|
23287
|
+
pins: true,
|
|
23288
|
+
bumped,
|
|
23289
|
+
scripts,
|
|
23290
|
+
why: ""
|
|
23291
|
+
});
|
|
23292
|
+
var DEP_FIELDS = new Set([
|
|
23293
|
+
"dependencies",
|
|
23294
|
+
"devDependencies",
|
|
23295
|
+
"peerDependencies",
|
|
23296
|
+
"optionalDependencies"
|
|
23297
|
+
]);
|
|
23298
|
+
var NPM_COMPARATOR = /^(?:[~^]|[<>]=?|=)?v?\d+(?:\.(?:\d+|x|\*)){0,2}(?:-[\da-z.-]+)?(?:\+[\da-z.-]+)?$/iu;
|
|
23299
|
+
function npmVersion(spec) {
|
|
23300
|
+
if (spec.length > 256)
|
|
23301
|
+
return false;
|
|
23302
|
+
return spec.split("||").every((set) => {
|
|
23303
|
+
const tokens = set.trim().replace(/([<>]=?|=|[~^])\s+/gu, "$1").split(/\s+/u);
|
|
23304
|
+
if (tokens.length === 3 && tokens[1] === "-")
|
|
23305
|
+
return NPM_COMPARATOR.test(tokens[0] ?? "") && NPM_COMPARATOR.test(tokens[2] ?? "");
|
|
23306
|
+
return tokens.every((token) => NPM_COMPARATOR.test(token));
|
|
23307
|
+
});
|
|
23308
|
+
}
|
|
23309
|
+
var HOOK_SCRIPT = /^(?:pre|post)|^(?:install|uninstall|prepare|publish|pack|version|dependencies|start|stop|restart|test)$/u;
|
|
23310
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23311
|
+
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
23312
|
+
function packageJson(before, after) {
|
|
23313
|
+
let old;
|
|
23314
|
+
let now;
|
|
23315
|
+
try {
|
|
23316
|
+
old = JSON.parse(before);
|
|
23317
|
+
now = JSON.parse(after);
|
|
23318
|
+
} catch {
|
|
23319
|
+
return refused("does not parse");
|
|
23320
|
+
}
|
|
23321
|
+
if (!isRecord3(old) || !isRecord3(now))
|
|
23322
|
+
return refused("is no JSON object");
|
|
23323
|
+
let bumped = 0;
|
|
23324
|
+
const scripts = [];
|
|
23325
|
+
for (const field of new Set([...Object.keys(old), ...Object.keys(now)])) {
|
|
23326
|
+
const a = old[field];
|
|
23327
|
+
const b = now[field];
|
|
23328
|
+
if (same(a, b))
|
|
23329
|
+
continue;
|
|
23330
|
+
if (DEP_FIELDS.has(field)) {
|
|
23331
|
+
if (!isRecord3(a) || !isRecord3(b))
|
|
23332
|
+
return refused(`changes ${field}`);
|
|
23333
|
+
for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {
|
|
23334
|
+
if (a[name] === b[name])
|
|
23335
|
+
continue;
|
|
23336
|
+
if (!(name in a))
|
|
23337
|
+
return refused(`adds the dependency ${name}`);
|
|
23338
|
+
if (!(name in b))
|
|
23339
|
+
return refused(`removes the dependency ${name}`);
|
|
23340
|
+
const from = a[name];
|
|
23341
|
+
const to = b[name];
|
|
23342
|
+
if (typeof from !== "string" || typeof to !== "string")
|
|
23343
|
+
return refused(`changes ${field}.${name}`);
|
|
23344
|
+
if (!npmVersion(from.trim()) || !npmVersion(to.trim()))
|
|
23345
|
+
return refused(`changes the source of ${name}`);
|
|
23346
|
+
bumped += 1;
|
|
23347
|
+
}
|
|
23348
|
+
} else if (field === "scripts") {
|
|
23349
|
+
if (!isRecord3(a) || !isRecord3(b))
|
|
23350
|
+
return refused("changes scripts");
|
|
23351
|
+
for (const name of Object.keys(a))
|
|
23352
|
+
if (a[name] !== b[name])
|
|
23353
|
+
return refused(`changes the script ${name}`);
|
|
23354
|
+
for (const name of Object.keys(b)) {
|
|
23355
|
+
if (name in a)
|
|
23356
|
+
continue;
|
|
23357
|
+
if (HOOK_SCRIPT.test(name))
|
|
23358
|
+
return refused(`adds the lifecycle script ${name}`);
|
|
23359
|
+
if (name.startsWith("pnpm:"))
|
|
23360
|
+
return refused(`adds the pnpm: script ${name}`);
|
|
23361
|
+
const runner = Object.entries(a).find(([, command]) => typeof command === "string" && runsByGlob(command, name));
|
|
23362
|
+
if (runner)
|
|
23363
|
+
return refused(`adds the script ${name}, which the script ${runner[0]} runs by glob`);
|
|
23364
|
+
scripts.push(name);
|
|
23365
|
+
}
|
|
23366
|
+
} else
|
|
23367
|
+
return refused(`changes ${field}`);
|
|
23368
|
+
}
|
|
23369
|
+
return pinned(bumped, scripts);
|
|
23370
|
+
}
|
|
23371
|
+
function runsByGlob(command, name) {
|
|
23372
|
+
const tokens = command.split(/\s+/u).map((token) => token.replace(/^--filter=/u, "").replaceAll(/^["']|["']$/gu, "").replace(/^(?:npm|pnpm|yarn|bun):/u, ""));
|
|
23373
|
+
if (/\bpnpm\b/u.test(command) && tokens.some((token) => /^\/.+\/$/u.test(token)))
|
|
23374
|
+
return true;
|
|
23375
|
+
return tokens.filter((token) => token.includes("*")).some((glob) => new RegExp(`^${glob.split(/\*+/u).map((part) => part.replaceAll(/[.+?^${}()|[\]\\]/gu, "\\$&")).join(".*")}$`, "u").test(name));
|
|
23376
|
+
}
|
|
23377
|
+
function goDirectives(text) {
|
|
23378
|
+
const out = [];
|
|
23379
|
+
let block = null;
|
|
23380
|
+
for (const raw of text.split(`
|
|
23381
|
+
`)) {
|
|
23382
|
+
const indirect = /\/\/\s*indirect\s*$/u.test(raw);
|
|
23383
|
+
const line = raw.replace(/\/\/.*$/u, "").trim();
|
|
23384
|
+
if (!line)
|
|
23385
|
+
continue;
|
|
23386
|
+
if (block !== null) {
|
|
23387
|
+
if (line === ")")
|
|
23388
|
+
block = null;
|
|
23389
|
+
else
|
|
23390
|
+
out.push({ verb: block, args: line.replace(/\s+/gu, " "), indirect });
|
|
23391
|
+
continue;
|
|
23392
|
+
}
|
|
23393
|
+
const match = /^(\S+)\s*(.*)$/u.exec(line);
|
|
23394
|
+
if (!match)
|
|
23395
|
+
return null;
|
|
23396
|
+
const [, verb = "", rest = ""] = match;
|
|
23397
|
+
if (rest === "(")
|
|
23398
|
+
block = verb;
|
|
23399
|
+
else
|
|
23400
|
+
out.push({ verb, args: rest.replace(/\s+/gu, " "), indirect });
|
|
23401
|
+
}
|
|
23402
|
+
return block === null ? out : null;
|
|
23403
|
+
}
|
|
23404
|
+
var GO_VERSION = /^v\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+incompatible)?$/u;
|
|
23405
|
+
function goMod(before, after) {
|
|
23406
|
+
const old = goDirectives(before);
|
|
23407
|
+
const now = goDirectives(after);
|
|
23408
|
+
if (!old || !now)
|
|
23409
|
+
return refused("does not parse");
|
|
23410
|
+
if (old.length !== now.length)
|
|
23411
|
+
return refused("adds or removes a directive");
|
|
23412
|
+
let bumped = 0;
|
|
23413
|
+
for (const [index, a] of old.entries()) {
|
|
23414
|
+
const b = now[index];
|
|
23415
|
+
if (a.verb === b.verb && a.args === b.args && a.indirect === b.indirect)
|
|
23416
|
+
continue;
|
|
23417
|
+
if (a.verb !== "require" || b.verb !== "require" || a.indirect !== b.indirect)
|
|
23418
|
+
return refused(`changes ${a.verb}`);
|
|
23419
|
+
const [module, from, extra] = a.args.split(" ");
|
|
23420
|
+
const [moduleAfter, to, extraAfter] = b.args.split(" ");
|
|
23421
|
+
if (module !== moduleAfter || extra !== undefined || extraAfter !== undefined)
|
|
23422
|
+
return refused(`changes require ${module ?? ""}`);
|
|
23423
|
+
if (!GO_VERSION.test(from ?? "") || !GO_VERSION.test(to ?? ""))
|
|
23424
|
+
return refused(`changes the source of ${module ?? ""}`);
|
|
23425
|
+
bumped += 1;
|
|
23426
|
+
}
|
|
23427
|
+
return pinned(bumped);
|
|
23428
|
+
}
|
|
23429
|
+
var CARGO_TABLE = /^(?:workspace\.)?(?:target\..+\.)?(?:dev-|build-)?dependencies(?:\.[^.]+)?$/u;
|
|
23430
|
+
var PYPROJECT_TABLE = /^(?:project\.optional-dependencies|dependency-groups|tool\.poetry\.(?:dev-)?dependencies|tool\.poetry\.group\.[^.]+\.dependencies)$/u;
|
|
23431
|
+
var OTHER_SOURCE = /\b(?:git|rev|branch|tag|path|url|registry|package)\s*=|@|:\/\//u;
|
|
23432
|
+
var VERSION_TOKEN = /(?<=[\s"'=<>~^!,*v])\d+(?:\.\d+)*(?:[a-z]+\d*)?(?:\.(?:post|dev)\d+)?/giu;
|
|
23433
|
+
function tomlPins(before, after, cargo) {
|
|
23434
|
+
const old = before.split(`
|
|
23435
|
+
`);
|
|
23436
|
+
const now = after.split(`
|
|
23437
|
+
`);
|
|
23438
|
+
if (old.length !== now.length)
|
|
23439
|
+
return refused("adds or removes lines");
|
|
23440
|
+
let table = "";
|
|
23441
|
+
let inArray = false;
|
|
23442
|
+
let bumped = 0;
|
|
23443
|
+
for (const [index, a] of old.entries()) {
|
|
23444
|
+
const b = now[index] ?? "";
|
|
23445
|
+
const header = /^\s*\[\[?([^\]]+)\]\]?\s*(?:#.*)?$/u.exec(a);
|
|
23446
|
+
if (header) {
|
|
23447
|
+
table = (header[1] ?? "").replace(/\s+/gu, "");
|
|
23448
|
+
inArray = false;
|
|
23449
|
+
} else if (!cargo && table === "project" && /^\s*dependencies\s*=\s*\[\s*(?:#.*)?$/u.test(a))
|
|
23450
|
+
inArray = true;
|
|
23451
|
+
else if (inArray && /^\s*\]/u.test(a))
|
|
23452
|
+
inArray = false;
|
|
23453
|
+
if (a === b)
|
|
23454
|
+
continue;
|
|
23455
|
+
const listed = cargo ? CARGO_TABLE.test(table) : PYPROJECT_TABLE.test(table) || inArray || table === "project" && /^\s*dependencies\s*=/u.test(a);
|
|
23456
|
+
if (header || !listed)
|
|
23457
|
+
return refused(`changes line ${index + 1} outside a dependency table`);
|
|
23458
|
+
if (OTHER_SOURCE.test(a) || OTHER_SOURCE.test(b))
|
|
23459
|
+
return refused(`changes a dependency source on line ${index + 1}`);
|
|
23460
|
+
const key = (line) => /^\s*("?[\w.[\],-]+"?)/u.exec(line)?.[1] ?? "";
|
|
23461
|
+
const versionless = (line) => line.replace(VERSION_TOKEN, "V");
|
|
23462
|
+
const names = (line) => cargo ? "" : [...line.matchAll(/"([A-Za-z_][\w.-]*)/gu)].map((match) => match[1]).join(",");
|
|
23463
|
+
if (key(a) !== key(b) || names(a) !== names(b) || versionless(a) !== versionless(b))
|
|
23464
|
+
return refused(`changes more than a version on line ${index + 1}`);
|
|
23465
|
+
bumped += 1;
|
|
23466
|
+
}
|
|
23467
|
+
return pinned(bumped);
|
|
23468
|
+
}
|
|
23469
|
+
function manifestEdit(file, before, after) {
|
|
23470
|
+
const name = basename(file);
|
|
23471
|
+
if (name === "package.json")
|
|
23472
|
+
return packageJson(before, after);
|
|
23473
|
+
if (name === "go.mod")
|
|
23474
|
+
return goMod(before, after);
|
|
23475
|
+
return tomlPins(before, after, name === "Cargo.toml");
|
|
23476
|
+
}
|
|
23477
|
+
|
|
23277
23478
|
// packages/workit-core/src/core/policy/substance.ts
|
|
23278
23479
|
var SLASH_BLOCK = [["/*", "*/"]];
|
|
23279
23480
|
var C_LIKE = { line: ["//"], block: SLASH_BLOCK, quotes: `"'` };
|
|
@@ -23592,6 +23793,483 @@ function cosmeticChange(file, before, after) {
|
|
|
23592
23793
|
return a !== null && a === substanceOf(file, right);
|
|
23593
23794
|
}
|
|
23594
23795
|
|
|
23796
|
+
// packages/workit-core/src/core/policy/workflow-edit.ts
|
|
23797
|
+
class Unparsed extends Error {
|
|
23798
|
+
}
|
|
23799
|
+
var refuse = (why) => {
|
|
23800
|
+
throw new Unparsed(why);
|
|
23801
|
+
};
|
|
23802
|
+
var NON_STRING = /^(?:~|null|true|false|yes|no|on|off|y|n|[-+]?(?:\d[\d_]*(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?|0x[\da-f]+|0o[0-7]+|[-+]?\.inf|\.nan)$/iu;
|
|
23803
|
+
var HEX_DIGITS = { x: 2, u: 4, U: 8 };
|
|
23804
|
+
var ESCAPES = {
|
|
23805
|
+
n: `
|
|
23806
|
+
`,
|
|
23807
|
+
t: "\t",
|
|
23808
|
+
r: "\r",
|
|
23809
|
+
"0": "\x00",
|
|
23810
|
+
'"': '"',
|
|
23811
|
+
"\\": "\\",
|
|
23812
|
+
"/": "/",
|
|
23813
|
+
" ": " "
|
|
23814
|
+
};
|
|
23815
|
+
var scalar = (text, string, folded = false) => ({
|
|
23816
|
+
kind: "scalar",
|
|
23817
|
+
text,
|
|
23818
|
+
string,
|
|
23819
|
+
folded
|
|
23820
|
+
});
|
|
23821
|
+
function quoted(text, start) {
|
|
23822
|
+
const quote = text[start];
|
|
23823
|
+
let out = "";
|
|
23824
|
+
for (let index = start + 1;index < text.length; index += 1) {
|
|
23825
|
+
const char = text[index] ?? "";
|
|
23826
|
+
if (quote === "'" && char === "'") {
|
|
23827
|
+
if (text[index + 1] !== "'")
|
|
23828
|
+
return { value: out, end: index + 1 };
|
|
23829
|
+
out += "'";
|
|
23830
|
+
index += 1;
|
|
23831
|
+
} else if (quote === '"' && char === '"')
|
|
23832
|
+
return { value: out, end: index + 1 };
|
|
23833
|
+
else if (quote === '"' && char === "\\") {
|
|
23834
|
+
const next = text[index + 1] ?? "";
|
|
23835
|
+
const hex = HEX_DIGITS[next];
|
|
23836
|
+
if (hex) {
|
|
23837
|
+
const digits = text.slice(index + 2, index + 2 + hex);
|
|
23838
|
+
if (!/^[\da-f]+$/iu.test(digits) || digits.length !== hex)
|
|
23839
|
+
refuse("a bad escape");
|
|
23840
|
+
out += String.fromCodePoint(Number.parseInt(digits, 16));
|
|
23841
|
+
index += 1 + hex;
|
|
23842
|
+
} else {
|
|
23843
|
+
out += ESCAPES[next] ?? refuse("an unknown escape");
|
|
23844
|
+
index += 1;
|
|
23845
|
+
}
|
|
23846
|
+
} else
|
|
23847
|
+
out += char;
|
|
23848
|
+
}
|
|
23849
|
+
return refuse("a quoted scalar spans lines");
|
|
23850
|
+
}
|
|
23851
|
+
function trailing(text, end) {
|
|
23852
|
+
const rest = text.slice(end);
|
|
23853
|
+
if (rest.trim() && !/^\s+#/u.test(rest))
|
|
23854
|
+
refuse("text after a value");
|
|
23855
|
+
}
|
|
23856
|
+
var INDICATOR = /^[&*!%@`|>,[\]{}?:#-]/u;
|
|
23857
|
+
function plain(text) {
|
|
23858
|
+
const value = text.replace(/\s+#.*$/u, "").trimEnd();
|
|
23859
|
+
if (INDICATOR.test(value) && !/^-[^\s]/u.test(value))
|
|
23860
|
+
refuse("an indicator starts a scalar");
|
|
23861
|
+
if (/:\s|:$/u.test(value))
|
|
23862
|
+
refuse("a mapping inside a scalar");
|
|
23863
|
+
return scalar(value, !NON_STRING.test(value));
|
|
23864
|
+
}
|
|
23865
|
+
function flow(text, start) {
|
|
23866
|
+
const close = text[start] === "[" ? "]" : "}";
|
|
23867
|
+
const items = [];
|
|
23868
|
+
const entries = new Map;
|
|
23869
|
+
let index = start + 1;
|
|
23870
|
+
const skip = () => {
|
|
23871
|
+
while (text[index] === " ")
|
|
23872
|
+
index += 1;
|
|
23873
|
+
};
|
|
23874
|
+
const element = (stops) => {
|
|
23875
|
+
skip();
|
|
23876
|
+
const char = text[index];
|
|
23877
|
+
if (char === '"' || char === "'") {
|
|
23878
|
+
const read = quoted(text, index);
|
|
23879
|
+
index = read.end;
|
|
23880
|
+
return scalar(read.value, true);
|
|
23881
|
+
}
|
|
23882
|
+
if (char === "[" || char === "{") {
|
|
23883
|
+
const read = flow(text, index);
|
|
23884
|
+
index = read.end;
|
|
23885
|
+
return read.node;
|
|
23886
|
+
}
|
|
23887
|
+
let end = index;
|
|
23888
|
+
while (end < text.length && !stops.test(text[end] ?? ""))
|
|
23889
|
+
end += 1;
|
|
23890
|
+
const value = text.slice(index, end).trim();
|
|
23891
|
+
index = end;
|
|
23892
|
+
if (!value || value.includes("#"))
|
|
23893
|
+
refuse("an empty or commented flow element");
|
|
23894
|
+
return plain(value);
|
|
23895
|
+
};
|
|
23896
|
+
for (;; ) {
|
|
23897
|
+
skip();
|
|
23898
|
+
if (index >= text.length)
|
|
23899
|
+
refuse("a flow collection spans lines");
|
|
23900
|
+
if (text[index] === close)
|
|
23901
|
+
return {
|
|
23902
|
+
node: close === "]" ? { kind: "seq", items } : { kind: "map", entries },
|
|
23903
|
+
end: index + 1
|
|
23904
|
+
};
|
|
23905
|
+
if (close === "]")
|
|
23906
|
+
items.push(element(/[,\]]/u));
|
|
23907
|
+
else {
|
|
23908
|
+
const key = element(/[:,}]/u);
|
|
23909
|
+
skip();
|
|
23910
|
+
if (text[index] !== ":" || key.kind !== "scalar")
|
|
23911
|
+
refuse("a flow mapping without a value");
|
|
23912
|
+
index += 1;
|
|
23913
|
+
const value = element(/[,}]/u);
|
|
23914
|
+
const name = key.kind === "scalar" ? key.text : "";
|
|
23915
|
+
if (entries.has(name))
|
|
23916
|
+
refuse("a duplicate key");
|
|
23917
|
+
entries.set(name, value);
|
|
23918
|
+
}
|
|
23919
|
+
skip();
|
|
23920
|
+
if (text[index] === ",")
|
|
23921
|
+
index += 1;
|
|
23922
|
+
else if (text[index] !== close)
|
|
23923
|
+
refuse("a malformed flow collection");
|
|
23924
|
+
}
|
|
23925
|
+
}
|
|
23926
|
+
var isItem = (text) => text === "-" || text.startsWith("- ");
|
|
23927
|
+
function splitKey(text) {
|
|
23928
|
+
if (text[0] === '"' || text[0] === "'") {
|
|
23929
|
+
const read = quoted(text, 0);
|
|
23930
|
+
const after = text.slice(read.end);
|
|
23931
|
+
const match = /^\s*:(?:\s+|$)/u.exec(after);
|
|
23932
|
+
return match ? { key: read.value, rest: after.slice(match[0].length) } : null;
|
|
23933
|
+
}
|
|
23934
|
+
const match = /:(?:\s|$)/u.exec(text);
|
|
23935
|
+
if (!match || INDICATOR.test(text))
|
|
23936
|
+
return null;
|
|
23937
|
+
const key = text.slice(0, match.index).trimEnd();
|
|
23938
|
+
if (!key || key.includes(" #"))
|
|
23939
|
+
return null;
|
|
23940
|
+
return { key, rest: text.slice(match.index + 1).trimStart() };
|
|
23941
|
+
}
|
|
23942
|
+
|
|
23943
|
+
class Reader {
|
|
23944
|
+
lines;
|
|
23945
|
+
pos = 0;
|
|
23946
|
+
constructor(text) {
|
|
23947
|
+
const normal = text.replace(/\r\n/gu, `
|
|
23948
|
+
`);
|
|
23949
|
+
if (normal.includes("\r") || normal.charCodeAt(0) === 65279)
|
|
23950
|
+
refuse("an odd line break or BOM");
|
|
23951
|
+
this.lines = normal.split(`
|
|
23952
|
+
`);
|
|
23953
|
+
const first = this.lines.findIndex((line) => line.trim() && !line.trimStart().startsWith("#"));
|
|
23954
|
+
if (first >= 0 && /^---\s*(?:#.*)?$/u.test(this.lines[first] ?? ""))
|
|
23955
|
+
this.lines[first] = "";
|
|
23956
|
+
}
|
|
23957
|
+
next() {
|
|
23958
|
+
while (this.pos < this.lines.length) {
|
|
23959
|
+
const raw = this.lines[this.pos] ?? "";
|
|
23960
|
+
const text = raw.trimStart();
|
|
23961
|
+
if (text === "" || text.startsWith("#")) {
|
|
23962
|
+
this.pos += 1;
|
|
23963
|
+
continue;
|
|
23964
|
+
}
|
|
23965
|
+
const indent = raw.length - text.length;
|
|
23966
|
+
if (raw.slice(0, indent).includes("\t"))
|
|
23967
|
+
refuse("a tab indents a line");
|
|
23968
|
+
if (indent === 0 && /^(?:---|\.\.\.)(?:\s|$)|^%/u.test(text))
|
|
23969
|
+
refuse("several documents");
|
|
23970
|
+
return { indent, text: text.trimEnd() };
|
|
23971
|
+
}
|
|
23972
|
+
return null;
|
|
23973
|
+
}
|
|
23974
|
+
document() {
|
|
23975
|
+
const root = this.block(0);
|
|
23976
|
+
if (this.next())
|
|
23977
|
+
refuse("content after the document");
|
|
23978
|
+
return root;
|
|
23979
|
+
}
|
|
23980
|
+
block(min) {
|
|
23981
|
+
const line = this.next();
|
|
23982
|
+
if (!line || line.indent < min)
|
|
23983
|
+
return scalar("", false);
|
|
23984
|
+
return isItem(line.text) ? this.sequence(line.indent) : this.mapping(line.indent);
|
|
23985
|
+
}
|
|
23986
|
+
mapping(indent) {
|
|
23987
|
+
const entries = new Map;
|
|
23988
|
+
for (let line = this.next();line && line.indent >= indent; line = this.next()) {
|
|
23989
|
+
if (line.indent > indent || isItem(line.text))
|
|
23990
|
+
refuse("bad indentation");
|
|
23991
|
+
const split = splitKey(line.text) ?? refuse("a line that is no mapping entry");
|
|
23992
|
+
if (entries.has(split.key))
|
|
23993
|
+
refuse("a duplicate key");
|
|
23994
|
+
this.pos += 1;
|
|
23995
|
+
entries.set(split.key, this.value(split.rest, indent, true));
|
|
23996
|
+
}
|
|
23997
|
+
return { kind: "map", entries };
|
|
23998
|
+
}
|
|
23999
|
+
sequence(indent) {
|
|
24000
|
+
const items = [];
|
|
24001
|
+
for (let line = this.next();line && line.indent === indent && isItem(line.text); line = this.next()) {
|
|
24002
|
+
const rest = line.text.slice(1).trimStart();
|
|
24003
|
+
const offset = indent + line.text.length - rest.length;
|
|
24004
|
+
if (isItem(rest))
|
|
24005
|
+
refuse("a sequence inside a sequence item");
|
|
24006
|
+
if (rest && !/^[|>[{]/u.test(rest) && splitKey(rest)) {
|
|
24007
|
+
this.lines[this.pos] = " ".repeat(offset) + rest;
|
|
24008
|
+
items.push(this.mapping(offset));
|
|
24009
|
+
} else {
|
|
24010
|
+
this.pos += 1;
|
|
24011
|
+
items.push(this.value(rest, indent, false));
|
|
24012
|
+
}
|
|
24013
|
+
}
|
|
24014
|
+
const line = this.next();
|
|
24015
|
+
if (line && line.indent > indent)
|
|
24016
|
+
refuse("bad indentation");
|
|
24017
|
+
return { kind: "seq", items };
|
|
24018
|
+
}
|
|
24019
|
+
value(rest, indent, inMapping) {
|
|
24020
|
+
if (rest === "" || rest.startsWith("#")) {
|
|
24021
|
+
const line = this.next();
|
|
24022
|
+
if (line && line.indent > indent)
|
|
24023
|
+
return this.block(line.indent);
|
|
24024
|
+
if (inMapping && line?.indent === indent && isItem(line.text))
|
|
24025
|
+
return this.sequence(indent);
|
|
24026
|
+
return scalar("", false);
|
|
24027
|
+
}
|
|
24028
|
+
let node;
|
|
24029
|
+
if (rest[0] === "|" || rest[0] === ">")
|
|
24030
|
+
return this.blockScalar(rest, indent);
|
|
24031
|
+
if (rest[0] === '"' || rest[0] === "'") {
|
|
24032
|
+
const read = quoted(rest, 0);
|
|
24033
|
+
trailing(rest, read.end);
|
|
24034
|
+
node = scalar(read.value, true);
|
|
24035
|
+
} else if (rest[0] === "[" || rest[0] === "{") {
|
|
24036
|
+
const read = flow(rest, 0);
|
|
24037
|
+
trailing(rest, read.end);
|
|
24038
|
+
node = read.node;
|
|
24039
|
+
} else
|
|
24040
|
+
node = plain(rest);
|
|
24041
|
+
const line = this.next();
|
|
24042
|
+
if (line && line.indent > indent)
|
|
24043
|
+
refuse("a value continues on the next line");
|
|
24044
|
+
return node;
|
|
24045
|
+
}
|
|
24046
|
+
blockScalar(header, indent) {
|
|
24047
|
+
const match = /^([|>])(?:([-+])([1-9])?|([1-9])([-+])?)?\s*(?:#.*)?$/u.exec(header);
|
|
24048
|
+
if (!match)
|
|
24049
|
+
return refuse("a bad block scalar header");
|
|
24050
|
+
const chomp = match[2] ?? match[5] ?? "";
|
|
24051
|
+
const indicator = match[3] ?? match[4];
|
|
24052
|
+
let column = indicator ? indent + Number(indicator) : null;
|
|
24053
|
+
const body = [];
|
|
24054
|
+
while (this.pos < this.lines.length) {
|
|
24055
|
+
const raw = this.lines[this.pos] ?? "";
|
|
24056
|
+
if (raw.trim() === "") {
|
|
24057
|
+
body.push(column !== null && raw.length > column ? raw.slice(column) : "");
|
|
24058
|
+
this.pos += 1;
|
|
24059
|
+
continue;
|
|
24060
|
+
}
|
|
24061
|
+
const lead = raw.length - raw.trimStart().length;
|
|
24062
|
+
if (column === null) {
|
|
24063
|
+
if (lead <= indent)
|
|
24064
|
+
break;
|
|
24065
|
+
column = lead;
|
|
24066
|
+
}
|
|
24067
|
+
if (lead < column) {
|
|
24068
|
+
if (lead > indent)
|
|
24069
|
+
refuse("an under-indented block line");
|
|
24070
|
+
break;
|
|
24071
|
+
}
|
|
24072
|
+
if (raw.slice(0, column).includes("\t"))
|
|
24073
|
+
refuse("a tab indents a line");
|
|
24074
|
+
body.push(raw.slice(column));
|
|
24075
|
+
this.pos += 1;
|
|
24076
|
+
}
|
|
24077
|
+
let end = body.length;
|
|
24078
|
+
while (end > 0 && body[end - 1] === "")
|
|
24079
|
+
end -= 1;
|
|
24080
|
+
const content = body.slice(0, end).join(`
|
|
24081
|
+
`);
|
|
24082
|
+
const text = chomp === "+" ? `${body.join(`
|
|
24083
|
+
`)}
|
|
24084
|
+
` : chomp === "-" || !content ? content : `${content}
|
|
24085
|
+
`;
|
|
24086
|
+
return scalar(text, true, match[1] === ">");
|
|
24087
|
+
}
|
|
24088
|
+
}
|
|
24089
|
+
function parseWorkflowYaml(text) {
|
|
24090
|
+
try {
|
|
24091
|
+
return new Reader(text).document();
|
|
24092
|
+
} catch (error) {
|
|
24093
|
+
if (error instanceof Unparsed)
|
|
24094
|
+
return null;
|
|
24095
|
+
throw error;
|
|
24096
|
+
}
|
|
24097
|
+
}
|
|
24098
|
+
var isWorkflowFile = (file) => /^\.github\/workflows\/[^/]+\.ya?ml$/u.test(file);
|
|
24099
|
+
var GUARDED = new Set(["permissions", "secrets", "on", "uses", "environment", "if"]);
|
|
24100
|
+
var pathText = (keys) => keys.join(".").replaceAll(".[", "[");
|
|
24101
|
+
var WORD2 = /[\w./:@=+,-]+/uy;
|
|
24102
|
+
var QUOTED = /"[^"$`\\]*"/uy;
|
|
24103
|
+
var COMMAND = /^[\w.+][\w./+-]*$/u;
|
|
24104
|
+
var SHELL_STATE = new Set(". alias bg bind break builtin call caller case cd command compgen complete compopt continue coproc declare dirs disown do done elif else enable esac eval exec exit export fc fg fi for function getopts goto hash help history if in jobs kill let local logout mapfile popd pushd read readarray readonly return select set shift shopt source suspend then time times trap type typeset ulimit umask unalias unset until wait while".split(" "));
|
|
24105
|
+
var FALLBACK = new Set(["echo", "true"]);
|
|
24106
|
+
var FORM = 'more than && <command> or && (<command> || echo "<text>")';
|
|
24107
|
+
var OUTSIDE = '(outside plain words and "double-quoted text")';
|
|
24108
|
+
var COMMAND_INPUT = /(?:^|[-_])(?:commands?|cmd|script)$/iu;
|
|
24109
|
+
function tokens2(text) {
|
|
24110
|
+
const out = [];
|
|
24111
|
+
let index = 0;
|
|
24112
|
+
while (index < text.length) {
|
|
24113
|
+
const char = text[index] ?? "";
|
|
24114
|
+
if (char === " " || char === "\t")
|
|
24115
|
+
index += 1;
|
|
24116
|
+
else if (char === "(" || char === ")") {
|
|
24117
|
+
out.push({ op: char });
|
|
24118
|
+
index += 1;
|
|
24119
|
+
} else if ((char === "&" || char === "|") && text[index + 1] === char) {
|
|
24120
|
+
out.push({ op: char + char });
|
|
24121
|
+
index += 2;
|
|
24122
|
+
} else {
|
|
24123
|
+
const pattern = char === '"' ? QUOTED : WORD2;
|
|
24124
|
+
pattern.lastIndex = index;
|
|
24125
|
+
const match = pattern.exec(text);
|
|
24126
|
+
if (!match)
|
|
24127
|
+
return char === '"' ? 'a "quoted text" left open or holding $, a backtick or a backslash' : `the character ${char} ${OUTSIDE}`;
|
|
24128
|
+
index += match[0].length;
|
|
24129
|
+
const next = text[index] ?? " ";
|
|
24130
|
+
if (!" \t)&|".includes(next))
|
|
24131
|
+
return `the character ${next} ${OUTSIDE}`;
|
|
24132
|
+
out.push(char === '"' ? { quoted: match[0] } : { word: match[0] });
|
|
24133
|
+
}
|
|
24134
|
+
}
|
|
24135
|
+
return out;
|
|
24136
|
+
}
|
|
24137
|
+
function masking(before, appended) {
|
|
24138
|
+
if (appended.includes("${{"))
|
|
24139
|
+
return "an expression";
|
|
24140
|
+
if (/[\n\r]/u.test(appended))
|
|
24141
|
+
return "a new line";
|
|
24142
|
+
if (!before.trim())
|
|
24143
|
+
return "a command where none ran before";
|
|
24144
|
+
if (before.endsWith("\\"))
|
|
24145
|
+
return "a command after a trailing backslash";
|
|
24146
|
+
if (!appended.trimStart().startsWith("&&"))
|
|
24147
|
+
return "a command not chained with a leading &&";
|
|
24148
|
+
const list = tokens2(appended);
|
|
24149
|
+
if (typeof list === "string")
|
|
24150
|
+
return list;
|
|
24151
|
+
let index = 0;
|
|
24152
|
+
const op = (text) => {
|
|
24153
|
+
const token = list[index];
|
|
24154
|
+
if (!token || !("op" in token) || token.op !== text)
|
|
24155
|
+
return false;
|
|
24156
|
+
index += 1;
|
|
24157
|
+
return true;
|
|
24158
|
+
};
|
|
24159
|
+
const command = (names) => {
|
|
24160
|
+
const name = list[index];
|
|
24161
|
+
if (!name || !("word" in name) || !COMMAND.test(name.word))
|
|
24162
|
+
return FORM;
|
|
24163
|
+
if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
|
|
24164
|
+
return names ? FORM : `the shell command ${name.word}`;
|
|
24165
|
+
index += 1;
|
|
24166
|
+
for (let token = list[index];token && !("op" in token); token = list[index])
|
|
24167
|
+
index += 1;
|
|
24168
|
+
return null;
|
|
24169
|
+
};
|
|
24170
|
+
while (index < list.length) {
|
|
24171
|
+
if (!op("&&"))
|
|
24172
|
+
return FORM;
|
|
24173
|
+
const group = op("(");
|
|
24174
|
+
const bad = command() ?? (group && op("||") ? command(FALLBACK) : null);
|
|
24175
|
+
if (bad)
|
|
24176
|
+
return bad;
|
|
24177
|
+
if (group && !op(")"))
|
|
24178
|
+
return FORM;
|
|
24179
|
+
}
|
|
24180
|
+
return null;
|
|
24181
|
+
}
|
|
24182
|
+
function compare(before, after, at, room, out) {
|
|
24183
|
+
if (before.kind === "scalar" && after.kind === "scalar") {
|
|
24184
|
+
if (before.text === after.text && before.string === after.string)
|
|
24185
|
+
return;
|
|
24186
|
+
const grown = room !== null && before.string && after.string && before.folded === after.folded && after.text.length > before.text.length && after.text.startsWith(before.text);
|
|
24187
|
+
const masks = grown ? masking(before.text, after.text.slice(before.text.length)) : null;
|
|
24188
|
+
if (masks)
|
|
24189
|
+
out.refused.push({ path: at, what: `appends ${masks} to ${pathText(at)}` });
|
|
24190
|
+
else if (grown)
|
|
24191
|
+
out.allowed.push(`${pathText(at)} appended`);
|
|
24192
|
+
else
|
|
24193
|
+
out.refused.push({ path: at, what: `changes ${pathText(at)}` });
|
|
24194
|
+
return;
|
|
24195
|
+
}
|
|
24196
|
+
if (before.kind === "seq" && after.kind === "seq") {
|
|
24197
|
+
if (before.items.length !== after.items.length) {
|
|
24198
|
+
const fewer = after.items.length < before.items.length;
|
|
24199
|
+
const noun = at.at(-1) === "steps" ? "a step" : "an item";
|
|
24200
|
+
out.refused.push({
|
|
24201
|
+
path: at,
|
|
24202
|
+
what: `${fewer ? "removes" : "adds"} ${noun} ${fewer ? "from" : "to"} ${pathText(at)}`
|
|
24203
|
+
});
|
|
24204
|
+
return;
|
|
24205
|
+
}
|
|
24206
|
+
before.items.forEach((item, index) => compare(item, after.items[index], [...at, `[${index}]`], null, out));
|
|
24207
|
+
return;
|
|
24208
|
+
}
|
|
24209
|
+
if (before.kind === "map" && after.kind === "map") {
|
|
24210
|
+
const step = at.at(-2) === "steps";
|
|
24211
|
+
const job = at.length === 2 && at[0] === "jobs";
|
|
24212
|
+
const usesBoth = before.entries.has("uses") && after.entries.has("uses");
|
|
24213
|
+
for (const [key, value] of before.entries) {
|
|
24214
|
+
const next = after.entries.get(key);
|
|
24215
|
+
if (!next) {
|
|
24216
|
+
out.refused.push({
|
|
24217
|
+
path: [...at, key],
|
|
24218
|
+
what: at.length === 1 && at[0] === "jobs" ? `removes the job ${key}` : `removes ${pathText([...at, key])}`
|
|
24219
|
+
});
|
|
24220
|
+
continue;
|
|
24221
|
+
}
|
|
24222
|
+
if (key === "with" && job && usesBoth && value.kind === "map" && next.kind === "map")
|
|
24223
|
+
compareInputs(value, next, [...at, key], out);
|
|
24224
|
+
else
|
|
24225
|
+
compare(value, next, [...at, key], key === "run" && step ? "run" : null, out);
|
|
24226
|
+
}
|
|
24227
|
+
for (const [key] of after.entries)
|
|
24228
|
+
if (!before.entries.has(key))
|
|
24229
|
+
out.refused.push({ path: [...at, key], what: `adds ${pathText([...at, key])}` });
|
|
24230
|
+
return;
|
|
24231
|
+
}
|
|
24232
|
+
out.refused.push({ path: at, what: `changes the shape of ${pathText(at) || "the file"}` });
|
|
24233
|
+
}
|
|
24234
|
+
function compareInputs(before, after, at, out) {
|
|
24235
|
+
for (const [key, value] of before.entries) {
|
|
24236
|
+
const next = after.entries.get(key);
|
|
24237
|
+
if (next)
|
|
24238
|
+
compare(value, next, [...at, key], COMMAND_INPUT.test(key) ? "with" : null, out);
|
|
24239
|
+
else
|
|
24240
|
+
out.refused.push({ path: [...at, key], what: `removes ${pathText([...at, key])}` });
|
|
24241
|
+
}
|
|
24242
|
+
for (const [key] of after.entries)
|
|
24243
|
+
if (!before.entries.has(key))
|
|
24244
|
+
out.refused.push({ path: [...at, key], what: `adds the input ${pathText([...at, key])}` });
|
|
24245
|
+
}
|
|
24246
|
+
function decisive(refused) {
|
|
24247
|
+
for (const change of refused) {
|
|
24248
|
+
const key = change.path.find((part) => GUARDED.has(part));
|
|
24249
|
+
if (key === "uses")
|
|
24250
|
+
return `moves a uses: ref (${pathText(change.path)})`;
|
|
24251
|
+
if (key)
|
|
24252
|
+
return `changes ${key}: (${pathText(change.path)})`;
|
|
24253
|
+
}
|
|
24254
|
+
return (refused.find((change) => change.what.startsWith("removes")) ?? refused[0])?.what ?? "changes it";
|
|
24255
|
+
}
|
|
24256
|
+
function workflowEdit(before, after) {
|
|
24257
|
+
const old = parseWorkflowYaml(before);
|
|
24258
|
+
const now = parseWorkflowYaml(after);
|
|
24259
|
+
if (!old || !now)
|
|
24260
|
+
return { additive: false, detail: "does not parse as plain workflow YAML" };
|
|
24261
|
+
const out = { allowed: [], refused: [] };
|
|
24262
|
+
compare(old, now, [], null, out);
|
|
24263
|
+
if (out.refused.length)
|
|
24264
|
+
return { additive: false, detail: decisive(out.refused) };
|
|
24265
|
+
if (!out.allowed.length)
|
|
24266
|
+
return { additive: false, detail: "changes only comments or layout, read as code" };
|
|
24267
|
+
return {
|
|
24268
|
+
additive: true,
|
|
24269
|
+
detail: out.allowed.slice(0, 3).join(", ") + (out.allowed.length > 3 ? ", …" : "")
|
|
24270
|
+
};
|
|
24271
|
+
}
|
|
24272
|
+
|
|
23595
24273
|
// packages/workit-core/src/core/policy/lane.ts
|
|
23596
24274
|
var LANE_THRESHOLDS = {
|
|
23597
24275
|
selfMaxLines: 100,
|
|
@@ -23652,15 +24330,16 @@ var DOC_EXT = /\.(?:md|mdx|markdown|rst|adoc)$/iu;
|
|
|
23652
24330
|
var DOC_NAMES = /^(?:license|licence|notice|authors|changelog|changes|contributors)$/iu;
|
|
23653
24331
|
var INSTRUCTIONS = /(?:^|\/)(?:AGENTS|CLAUDE|GEMINI|SKILL)\.md$|(?:^|\/)(?:skills|agents|commands|rules|prompts)\/[^/]+/iu;
|
|
23654
24332
|
var TEST_PATH = /(?:^|\/)(?:test|tests|__tests__)\/|\.(?:test|spec)\.[^/]+$|_test\.[^/]+$/iu;
|
|
24333
|
+
var DEPENDENCY_BUMP_EVIDENCE = "green CI on the head";
|
|
23655
24334
|
var plural = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
23656
|
-
var
|
|
23657
|
-
var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(
|
|
24335
|
+
var basename2 = (file) => file.slice(file.lastIndexOf("/") + 1);
|
|
24336
|
+
var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(basename2(file)));
|
|
23658
24337
|
function kindOf(file) {
|
|
23659
24338
|
if (file.binary)
|
|
23660
24339
|
return "behavior";
|
|
23661
24340
|
if (file.generated)
|
|
23662
24341
|
return "generated";
|
|
23663
|
-
if (LOCKFILES.has(
|
|
24342
|
+
if (LOCKFILES.has(basename2(file.path)))
|
|
23664
24343
|
return "lockfile";
|
|
23665
24344
|
if (isDoc(file.path))
|
|
23666
24345
|
return "doc";
|
|
@@ -23693,7 +24372,7 @@ function globMatch(pattern, file) {
|
|
|
23693
24372
|
function isRiskPath(file, extra = []) {
|
|
23694
24373
|
if (extra.some((pattern) => globMatch(pattern, file)))
|
|
23695
24374
|
return true;
|
|
23696
|
-
if (RISK_FILES.has(file) || RISK_NAMES.has(
|
|
24375
|
+
if (RISK_FILES.has(file) || RISK_NAMES.has(basename2(file)))
|
|
23697
24376
|
return true;
|
|
23698
24377
|
if (TEST_PATH.test(file) || isDoc(file))
|
|
23699
24378
|
return false;
|
|
@@ -23701,8 +24380,41 @@ function isRiskPath(file, extra = []) {
|
|
|
23701
24380
|
}
|
|
23702
24381
|
var parseRiskPaths = (text) => text.split(`
|
|
23703
24382
|
`).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => line.replace(/^\//u, ""));
|
|
24383
|
+
function additiveWorkflow(file, extra) {
|
|
24384
|
+
if (file.workflow?.additive !== true || file.binary || !isWorkflowFile(file.path))
|
|
24385
|
+
return false;
|
|
24386
|
+
if (extra.some((pattern) => globMatch(pattern, file.path)))
|
|
24387
|
+
return false;
|
|
24388
|
+
return !isRiskPath(file.path.replace(/^\.github\/workflows\//u, ".github/"), extra);
|
|
24389
|
+
}
|
|
24390
|
+
var ADDITIVE_CI_FLOOR = "an additive workflow edit needs a non-author verdict unless it rides a dependency bump";
|
|
24391
|
+
var CHANGELOG = /^(?:changelog|changes)(?:\.[^.]+)?$/iu;
|
|
24392
|
+
function dependencyBump(files, additive) {
|
|
24393
|
+
const manifests = files.filter((file) => file.manifest?.pins && !file.binary);
|
|
24394
|
+
if (!manifests.some((file) => (file.manifest?.bumped ?? 0) > 0))
|
|
24395
|
+
return null;
|
|
24396
|
+
const locks = [];
|
|
24397
|
+
for (const file of files) {
|
|
24398
|
+
if (additive.has(file.path) || manifests.includes(file))
|
|
24399
|
+
continue;
|
|
24400
|
+
if (LOCKFILES.has(basename2(file.path)))
|
|
24401
|
+
locks.push(file.path);
|
|
24402
|
+
else if (file.binary || !(isDoc(file.path) && CHANGELOG.test(basename2(file.path))))
|
|
24403
|
+
return null;
|
|
24404
|
+
}
|
|
24405
|
+
const bumped = manifests.reduce((sum, file) => sum + (file.manifest?.bumped ?? 0), 0);
|
|
24406
|
+
const scripts = manifests.flatMap((file) => file.manifest?.scripts ?? []);
|
|
24407
|
+
const list = (paths) => `${paths.slice(0, 3).join(", ")}${paths.length > 3 ? ", …" : ""}`;
|
|
24408
|
+
return `dependency-bump: ${plural(bumped, "version pin")} in ${list(manifests.map((file) => file.path))}${scripts.length ? `, ${plural(scripts.length, "new script")} (${list(scripts)})` : ""}${locks.length ? `, lockfile ${list(locks)}` : ""}; ${DEPENDENCY_BUMP_EVIDENCE} is its evidence`;
|
|
24409
|
+
}
|
|
23704
24410
|
function computeLane(input) {
|
|
23705
|
-
const
|
|
24411
|
+
const extra = input.riskPaths ?? [];
|
|
24412
|
+
const additive = input.files.filter((file) => additiveWorkflow(file, extra));
|
|
24413
|
+
const relaxed = new Set(additive.map((file) => file.path));
|
|
24414
|
+
const workflowNote = additive.length ? [
|
|
24415
|
+
`additive workflow edit: ${additive.slice(0, 3).map((file) => `${file.path} (${file.workflow?.detail ?? ""})`).join(", ")}${additive.length > 3 ? ", …" : ""}`
|
|
24416
|
+
] : [];
|
|
24417
|
+
const riskFiles = input.files.filter((file) => isRiskPath(file.path, extra) && !relaxed.has(file.path)).map((file) => file.path);
|
|
23706
24418
|
const risky = new Set(riskFiles);
|
|
23707
24419
|
const kinds = input.files.map((file) => ({
|
|
23708
24420
|
file,
|
|
@@ -23713,20 +24425,30 @@ function computeLane(input) {
|
|
|
23713
24425
|
const opaque = behavior.filter((entry) => entry.kind === "lockfile" || entry.file.binary);
|
|
23714
24426
|
const diffLines = input.files.reduce((sum, file) => sum + file.added + file.deleted, 0);
|
|
23715
24427
|
const counted = diffLines === lines && input.files.length === behavior.length ? "" : ` counted (the whole diff is ${plural(diffLines, "line")} in ${plural(input.files.length, "file")}; docs, comments, formatting, generated copies and lockfile lines are not counted)`;
|
|
23716
|
-
const result = (lane, reasons) =>
|
|
23717
|
-
lane
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
24428
|
+
const result = (lane, reasons, classification) => {
|
|
24429
|
+
const floor = additive.length > 0 && !classification && (lane === "none" || lane === "self");
|
|
24430
|
+
return {
|
|
24431
|
+
lane: floor ? "focused" : lane,
|
|
24432
|
+
reasons: [...floor ? [ADDITIVE_CI_FLOOR] : [], ...reasons, ...workflowNote],
|
|
24433
|
+
lines,
|
|
24434
|
+
files: behavior.length,
|
|
24435
|
+
riskFiles,
|
|
24436
|
+
...classification ? { classification } : {}
|
|
24437
|
+
};
|
|
24438
|
+
};
|
|
23723
24439
|
const { selfMaxLines, selfMaxFiles, fullMinLines } = LANE_THRESHOLDS;
|
|
23724
24440
|
if (input.riskTier === "high")
|
|
23725
24441
|
return result("full", ["the task judgment records high risk"]);
|
|
23726
24442
|
if (riskFiles.length)
|
|
23727
24443
|
return result("full", [
|
|
23728
|
-
`touches a risk path: ${riskFiles.slice(0, 3).
|
|
24444
|
+
`touches a risk path: ${riskFiles.slice(0, 3).map((file) => {
|
|
24445
|
+
const refused = input.files.find((entry) => entry.path === file)?.workflow;
|
|
24446
|
+
return refused && !refused.additive ? `${file} (${refused.detail})` : file;
|
|
24447
|
+
}).join(", ")}${riskFiles.length > 3 ? ", …" : ""}`
|
|
23729
24448
|
]);
|
|
24449
|
+
const bump = dependencyBump(input.files, relaxed);
|
|
24450
|
+
if (bump && lines < fullMinLines)
|
|
24451
|
+
return result("self", [bump], "dependency-bump");
|
|
23730
24452
|
if (!behavior.length)
|
|
23731
24453
|
return result("none", [
|
|
23732
24454
|
input.files.length ? "only docs, comments, formatting or generated copies changed" : "no changes"
|
|
@@ -23773,6 +24495,7 @@ function cosmeticFiles(cwd, fork, head) {
|
|
|
23773
24495
|
return null;
|
|
23774
24496
|
const out = new Set;
|
|
23775
24497
|
const opaque = new Set;
|
|
24498
|
+
const facts = new Map;
|
|
23776
24499
|
for (const entry of candidates) {
|
|
23777
24500
|
const before = blobs.get(entry.oldBlob);
|
|
23778
24501
|
let after = blobs.get(entry.newBlob);
|
|
@@ -23782,12 +24505,20 @@ function cosmeticFiles(cwd, fork, head) {
|
|
|
23782
24505
|
} catch {
|
|
23783
24506
|
after = undefined;
|
|
23784
24507
|
}
|
|
24508
|
+
if (before && after && isWorkflowFile(entry.path))
|
|
24509
|
+
facts.set(entry.path, {
|
|
24510
|
+
workflow: workflowEdit(before.toString("utf8"), after.toString("utf8"))
|
|
24511
|
+
});
|
|
24512
|
+
else if (before && after && isManifest(entry.path))
|
|
24513
|
+
facts.set(entry.path, {
|
|
24514
|
+
manifest: manifestEdit(entry.path, before.toString("utf8"), after.toString("utf8"))
|
|
24515
|
+
});
|
|
23785
24516
|
if (before && after && cosmeticChange(entry.path, before, after))
|
|
23786
24517
|
out.add(entry.path);
|
|
23787
24518
|
else if ([before, after].some((bytes) => bytes && hasOpaqueLineBreak(bytes.toString("utf8"))))
|
|
23788
24519
|
opaque.add(entry.path);
|
|
23789
24520
|
}
|
|
23790
|
-
return { cosmetic: out, opaque };
|
|
24521
|
+
return { cosmetic: out, opaque, facts };
|
|
23791
24522
|
}
|
|
23792
24523
|
function generatedAt(cwd, fork, paths) {
|
|
23793
24524
|
const files = treeFilesNamed(cwd, fork, ".gitattributes");
|
|
@@ -23812,7 +24543,8 @@ function laneFiles(cwd, fork, head, attributesAt = fork) {
|
|
|
23812
24543
|
...stats.map((entry) => ({
|
|
23813
24544
|
...entry,
|
|
23814
24545
|
...cosmetic.opaque.has(entry.path) ? { binary: true } : {},
|
|
23815
|
-
cosmetic: !entry.binary && cosmetic.cosmetic.has(entry.path)
|
|
24546
|
+
cosmetic: !entry.binary && cosmetic.cosmetic.has(entry.path),
|
|
24547
|
+
...cosmetic.facts.get(entry.path)
|
|
23816
24548
|
})),
|
|
23817
24549
|
...head === null ? untrackedFiles(cwd).map((file) => untrackedStat(cwd, file)) : []
|
|
23818
24550
|
];
|
|
@@ -24247,10 +24979,10 @@ function observedRowBytes(row) {
|
|
|
24247
24979
|
function appendObserved(cwd, row, options = {}) {
|
|
24248
24980
|
return appendRaw(cwd, { ...row, observer: "workit_cli" }, options);
|
|
24249
24981
|
}
|
|
24250
|
-
var
|
|
24982
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24251
24983
|
var str2 = (value) => typeof value === "string" ? value : null;
|
|
24252
24984
|
var normalizeActor = (value) => {
|
|
24253
|
-
const actor =
|
|
24985
|
+
const actor = isRecord4(value) ? value : {};
|
|
24254
24986
|
return {
|
|
24255
24987
|
host: str2(actor.host) ?? "unknown",
|
|
24256
24988
|
session: str2(actor.session),
|
|
@@ -24314,7 +25046,7 @@ function readLedgerAt(cwd, file, options) {
|
|
|
24314
25046
|
skipped += 1;
|
|
24315
25047
|
continue;
|
|
24316
25048
|
}
|
|
24317
|
-
if (!
|
|
25049
|
+
if (!isRecord4(parsed) || !str2(parsed.id) || !str2(parsed.type) || !str2(parsed.at)) {
|
|
24318
25050
|
skipped += 1;
|
|
24319
25051
|
continue;
|
|
24320
25052
|
}
|
|
@@ -26088,6 +26820,7 @@ effect before a retry.
|
|
|
26088
26820
|
Mid-task: never silently drop or resume an objective (workit-continue).
|
|
26089
26821
|
Notes, drafts, logs, resume files: \`workit dir notes|handoffs\` (outside the
|
|
26090
26822
|
repo), never the repo tree.
|
|
26823
|
+
FEEDBACK_LINE
|
|
26091
26824
|
|
|
26092
26825
|
Skills: load the skill, never act from memory.
|
|
26093
26826
|
- brainstorm, plan, spec, grill, should we: workit-shape
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit shared MCP transport for the eight task and policy operation families",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "1.32.0",
|
|
47
|
-
"@workit-dev/core": "^2.
|
|
47
|
+
"@workit-dev/core": "^2.20.0",
|
|
48
48
|
"zod": "4.6.5"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|