@brainervirus/workit-cursor 7.0.0 → 7.1.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/.cursor-plugin/plugin.json +1 -1
- package/dist/cursor-session-start.js +205 -30
- package/dist/mcp-server.js +496 -61
- package/dist/workit-hook.js +207 -27
- package/package.json +3 -3
|
@@ -10081,14 +10081,14 @@ var diagnosticLogger, PRESETS, mergePreset = (preset, input = {}, current = {
|
|
|
10081
10081
|
if (result.status === "malformed")
|
|
10082
10082
|
throw new Error(result.error);
|
|
10083
10083
|
return result.config ?? DEFAULTS;
|
|
10084
|
-
}, resolveBranchPolicy = (config, workspace) => {
|
|
10084
|
+
}, branchGlobPattern = (glob) => new RegExp(`^${glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`, "i"), resolveBranchPolicy = (config, workspace) => {
|
|
10085
10085
|
const wp = workspace?.branchPolicy ?? {};
|
|
10086
10086
|
const preset = Object.hasOwn(PRESETS, wp.preset) ? wp.preset : config.branchPolicy?.preset ?? "gitflow";
|
|
10087
10087
|
const merged = mergePreset(preset, {
|
|
10088
10088
|
allowed: wp.allowed,
|
|
10089
10089
|
protectedNames: wp.protected
|
|
10090
10090
|
}, config);
|
|
10091
|
-
const allowed = merged.allowed.map(
|
|
10091
|
+
const allowed = merged.allowed.map(branchGlobPattern);
|
|
10092
10092
|
return {
|
|
10093
10093
|
preset,
|
|
10094
10094
|
allowed,
|
|
@@ -10334,7 +10334,7 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10334
10334
|
profiles: record(nonBlank, profileSchema).optional()
|
|
10335
10335
|
}).passthrough();
|
|
10336
10336
|
return entrySchema;
|
|
10337
|
-
}, runtimeWorkspaceIndexSchema,
|
|
10337
|
+
}, runtimeWorkspaceIndexSchema, matchRuntimeWorkspace = (cwd) => {
|
|
10338
10338
|
const file = path6.join(configDir(), "workspaces.json");
|
|
10339
10339
|
let raw;
|
|
10340
10340
|
try {
|
|
@@ -10369,8 +10369,15 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
10369
10369
|
});
|
|
10370
10370
|
const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
|
|
10371
10371
|
const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
|
|
10372
|
-
|
|
10372
|
+
return selected ? { file, selected } : null;
|
|
10373
|
+
}, resolveRuntimeReleaseTracks = (cwd) => {
|
|
10374
|
+
const matched = matchRuntimeWorkspace(cwd);
|
|
10375
|
+
return matched ? { workspace: matched.selected.name, releaseTracks: matched.selected.releaseTracks } : null;
|
|
10376
|
+
}, resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
|
|
10377
|
+
const matched = matchRuntimeWorkspace(cwd);
|
|
10378
|
+
if (!matched)
|
|
10373
10379
|
return null;
|
|
10380
|
+
const { file, selected } = matched;
|
|
10374
10381
|
const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
|
|
10375
10382
|
if (!policy.success) {
|
|
10376
10383
|
const detail = policy.error.issues.map((issue) => `${issue.path.map(String).join(".") || "workspace"}: ${issue.message}`).join("; ");
|
|
@@ -10431,26 +10438,31 @@ var init_workspaces = __esm(() => {
|
|
|
10431
10438
|
object({ kind: literal("manual") }).strict()
|
|
10432
10439
|
]);
|
|
10433
10440
|
releaseTrackSchema = object({
|
|
10434
|
-
strategy: branchPreset,
|
|
10441
|
+
strategy: branchPreset.optional(),
|
|
10435
10442
|
productionBranch: nonBlank,
|
|
10436
10443
|
integrationBranch: nonBlank,
|
|
10437
|
-
naming: object({
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10444
|
+
naming: object({
|
|
10445
|
+
feature: nonBlank.optional(),
|
|
10446
|
+
release: nonBlank.optional(),
|
|
10447
|
+
hotfix: nonBlank.optional()
|
|
10448
|
+
}).passthrough().optional(),
|
|
10449
|
+
baseBranch: nonBlank.optional(),
|
|
10450
|
+
mergeBackBranches: array(nonBlank).optional(),
|
|
10451
|
+
pullRequestTarget: nonBlank.optional(),
|
|
10452
|
+
tagNamespace: string2().optional(),
|
|
10453
|
+
versionSource: versionSourceSchema.optional(),
|
|
10454
|
+
requiredChecks: array(nonBlank).optional(),
|
|
10455
|
+
critical: array(nonBlank).optional()
|
|
10456
|
+
}).passthrough().superRefine((track, context) => {
|
|
10445
10457
|
for (const [field, values] of [
|
|
10446
|
-
["mergeBackBranches", track.mergeBackBranches],
|
|
10447
|
-
["requiredChecks", track.requiredChecks]
|
|
10458
|
+
["mergeBackBranches", track.mergeBackBranches ?? []],
|
|
10459
|
+
["requiredChecks", track.requiredChecks ?? []]
|
|
10448
10460
|
]) {
|
|
10449
10461
|
if (new Set(values).size !== values.length) {
|
|
10450
10462
|
context.addIssue({ code: "custom", path: [field], message: "entries must be unique" });
|
|
10451
10463
|
}
|
|
10452
10464
|
}
|
|
10453
|
-
if (track.versionSource
|
|
10465
|
+
if (track.versionSource?.kind === "package-json" && (path6.posix.isAbsolute(track.versionSource.path.replaceAll("\\", "/")) || /^[A-Za-z]:\//u.test(track.versionSource.path.replaceAll("\\", "/")) || track.versionSource.path.replaceAll("\\", "/").split("/").includes(".."))) {
|
|
10454
10466
|
context.addIssue({
|
|
10455
10467
|
code: "custom",
|
|
10456
10468
|
path: ["versionSource", "path"],
|
|
@@ -16225,11 +16237,150 @@ var init_commit_flavors = () => {};
|
|
|
16225
16237
|
// packages/workit-core/src/core/git.ts
|
|
16226
16238
|
var init_git = () => {};
|
|
16227
16239
|
|
|
16240
|
+
// packages/workit-core/src/core/release-tracks.ts
|
|
16241
|
+
function readReleaseTracks(raw) {
|
|
16242
|
+
const out = { tracks: [], issues: [], error: null, protectedBranches: [] };
|
|
16243
|
+
if (raw === undefined || raw === null)
|
|
16244
|
+
return out;
|
|
16245
|
+
if (!isRecord3(raw)) {
|
|
16246
|
+
out.issues.push("releaseTracks is not an object; ignored");
|
|
16247
|
+
return out;
|
|
16248
|
+
}
|
|
16249
|
+
const fatal = [];
|
|
16250
|
+
const protectedNames = new Set;
|
|
16251
|
+
for (const [name, entry] of Object.entries(raw).toSorted(([a], [b]) => a < b ? -1 : 1)) {
|
|
16252
|
+
const label = `release track ${JSON.stringify(name)}`;
|
|
16253
|
+
if (!isRecord3(entry)) {
|
|
16254
|
+
out.issues.push(`${label} is not an object; ignored`);
|
|
16255
|
+
continue;
|
|
16256
|
+
}
|
|
16257
|
+
for (const branch of namedBranches(entry))
|
|
16258
|
+
protectedNames.add(branch);
|
|
16259
|
+
if (!name.trim()) {
|
|
16260
|
+
out.issues.push("a release track with a blank name was ignored");
|
|
16261
|
+
continue;
|
|
16262
|
+
}
|
|
16263
|
+
let critical = [];
|
|
16264
|
+
if (Array.isArray(entry.critical))
|
|
16265
|
+
critical = entry.critical.filter((item) => typeof item === "string");
|
|
16266
|
+
else if (entry.critical !== undefined)
|
|
16267
|
+
out.issues.push(`${label} critical: must be a list of field names; ignored`);
|
|
16268
|
+
const isCritical = (field) => critical.some((item) => field === item || field.startsWith(`${item}.`));
|
|
16269
|
+
const problem = (field, message) => {
|
|
16270
|
+
if (isCritical(field))
|
|
16271
|
+
fatal.push(`${label} ${field}: ${message}`);
|
|
16272
|
+
else
|
|
16273
|
+
out.issues.push(`${label} ${field}: ${message}`);
|
|
16274
|
+
};
|
|
16275
|
+
for (const key of Object.keys(entry))
|
|
16276
|
+
if (!KNOWN_FIELDS.has(key))
|
|
16277
|
+
problem(key, "unknown field, ignored");
|
|
16278
|
+
const productionBranch = branchName(entry.productionBranch);
|
|
16279
|
+
const integrationBranch = branchName(entry.integrationBranch);
|
|
16280
|
+
if (!productionBranch)
|
|
16281
|
+
problem("productionBranch", "missing or not a branch name");
|
|
16282
|
+
if (!integrationBranch)
|
|
16283
|
+
problem("integrationBranch", "missing or not a branch name");
|
|
16284
|
+
const optionalBranch = (field) => {
|
|
16285
|
+
if (entry[field] === undefined)
|
|
16286
|
+
return null;
|
|
16287
|
+
const value = branchName(entry[field]);
|
|
16288
|
+
if (!value)
|
|
16289
|
+
problem(field, "not a branch name; using the integration branch");
|
|
16290
|
+
return value;
|
|
16291
|
+
};
|
|
16292
|
+
const baseBranch = optionalBranch("baseBranch");
|
|
16293
|
+
const pullRequestTarget = optionalBranch("pullRequestTarget");
|
|
16294
|
+
let mergeBackBranches = [];
|
|
16295
|
+
if (entry.mergeBackBranches !== undefined) {
|
|
16296
|
+
const list = Array.isArray(entry.mergeBackBranches) ? entry.mergeBackBranches.map(branchName) : [null];
|
|
16297
|
+
if (list.some((item) => item === null))
|
|
16298
|
+
problem("mergeBackBranches", "must be a list of branch names; ignored");
|
|
16299
|
+
else
|
|
16300
|
+
mergeBackBranches = [...new Set(list)];
|
|
16301
|
+
}
|
|
16302
|
+
const naming = {};
|
|
16303
|
+
if (entry.naming !== undefined) {
|
|
16304
|
+
if (!isRecord3(entry.naming))
|
|
16305
|
+
problem("naming", "not an object; ignored");
|
|
16306
|
+
else
|
|
16307
|
+
for (const kind of ["feature", "release", "hotfix"]) {
|
|
16308
|
+
const template = entry.naming[kind];
|
|
16309
|
+
if (template === undefined)
|
|
16310
|
+
continue;
|
|
16311
|
+
if (typeof template !== "string" || !template.trim())
|
|
16312
|
+
problem(`naming.${kind}`, "not a template string; ignored");
|
|
16313
|
+
else if (!literalOf(template))
|
|
16314
|
+
problem(`naming.${kind}`, "needs literal text besides placeholders; ignored");
|
|
16315
|
+
else
|
|
16316
|
+
naming[kind] = template.trim();
|
|
16317
|
+
}
|
|
16318
|
+
}
|
|
16319
|
+
if (!productionBranch || !integrationBranch) {
|
|
16320
|
+
out.issues.push(`${label} was skipped: it needs a productionBranch and integrationBranch`);
|
|
16321
|
+
continue;
|
|
16322
|
+
}
|
|
16323
|
+
out.tracks.push({
|
|
16324
|
+
name,
|
|
16325
|
+
productionBranch,
|
|
16326
|
+
integrationBranch,
|
|
16327
|
+
baseBranch: baseBranch ?? integrationBranch,
|
|
16328
|
+
pullRequestTarget: pullRequestTarget ?? integrationBranch,
|
|
16329
|
+
mergeBackBranches,
|
|
16330
|
+
naming
|
|
16331
|
+
});
|
|
16332
|
+
}
|
|
16333
|
+
out.protectedBranches = [...protectedNames];
|
|
16334
|
+
if (fatal.length)
|
|
16335
|
+
out.error = `workspace releaseTracks cannot be read by this Workit (${fatal.join("; ")}); upgrade Workit or fix the track`;
|
|
16336
|
+
return out;
|
|
16337
|
+
}
|
|
16338
|
+
function workspaceReleaseTracks(cwd) {
|
|
16339
|
+
const raw = resolveRuntimeReleaseTracks(cwd);
|
|
16340
|
+
return { workspace: raw?.workspace ?? null, ...readReleaseTracks(raw?.releaseTracks) };
|
|
16341
|
+
}
|
|
16342
|
+
var ReleaseTrackError, KNOWN_FIELDS, BRANCH_FIELDS, PLACEHOLDER, HAS_PLACEHOLDER, isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), branchName = (value) => typeof value === "string" && value.trim() && !value.trim().startsWith("-") ? value.trim() : null, namedBranches = (entry) => [
|
|
16343
|
+
...BRANCH_FIELDS.map((field) => branchName(entry[field])),
|
|
16344
|
+
...Array.isArray(entry.mergeBackBranches) ? entry.mergeBackBranches.map(branchName) : []
|
|
16345
|
+
].filter((name) => name !== null), literalOf = (template) => template.replace(PLACEHOLDER, "").replace(/[*/]/gu, "").trim(), trackBranches = (tracks) => [
|
|
16346
|
+
...new Set(tracks.flatMap((track) => [
|
|
16347
|
+
track.productionBranch,
|
|
16348
|
+
track.integrationBranch,
|
|
16349
|
+
track.baseBranch,
|
|
16350
|
+
track.pullRequestTarget,
|
|
16351
|
+
...track.mergeBackBranches
|
|
16352
|
+
]))
|
|
16353
|
+
], namingGlob = (template) => HAS_PLACEHOLDER.test(template) ? template.replace(PLACEHOLDER, "*") : `${template.replace(/\/?\*?$/u, "")}/*`, memo3;
|
|
16354
|
+
var init_release_tracks = __esm(() => {
|
|
16355
|
+
init_rev();
|
|
16356
|
+
init_config();
|
|
16357
|
+
init_workspaces();
|
|
16358
|
+
ReleaseTrackError = class ReleaseTrackError extends Error {
|
|
16359
|
+
};
|
|
16360
|
+
KNOWN_FIELDS = new Set([
|
|
16361
|
+
"strategy",
|
|
16362
|
+
"productionBranch",
|
|
16363
|
+
"integrationBranch",
|
|
16364
|
+
"naming",
|
|
16365
|
+
"baseBranch",
|
|
16366
|
+
"mergeBackBranches",
|
|
16367
|
+
"pullRequestTarget",
|
|
16368
|
+
"tagNamespace",
|
|
16369
|
+
"versionSource",
|
|
16370
|
+
"requiredChecks",
|
|
16371
|
+
"critical"
|
|
16372
|
+
]);
|
|
16373
|
+
BRANCH_FIELDS = ["productionBranch", "integrationBranch", "baseBranch", "pullRequestTarget"];
|
|
16374
|
+
PLACEHOLDER = /\{[^}]*\}/gu;
|
|
16375
|
+
HAS_PLACEHOLDER = /\{[^}]*\}/u;
|
|
16376
|
+
memo3 = new Map;
|
|
16377
|
+
});
|
|
16378
|
+
|
|
16228
16379
|
// packages/workit-core/src/core/vcs-config.ts
|
|
16229
16380
|
var init_vcs_config = __esm(() => {
|
|
16230
16381
|
init_config();
|
|
16231
16382
|
init_workspaces();
|
|
16232
|
-
|
|
16383
|
+
init_release_tracks();
|
|
16233
16384
|
});
|
|
16234
16385
|
|
|
16235
16386
|
// packages/workit-core/src/core/branch.ts
|
|
@@ -16238,14 +16389,37 @@ function effectiveWorkspacePolicy(workspaceRoot, kind, profileName) {
|
|
|
16238
16389
|
const selected = resolveRuntimeWorkspacePolicy(workspaceRoot, kind, profileName?.trim() || process.env.WORKFLOW_PROFILE?.trim() || undefined);
|
|
16239
16390
|
const config = readConfig();
|
|
16240
16391
|
return kind === "branch" ? {
|
|
16241
|
-
branchPolicy: resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null),
|
|
16392
|
+
branchPolicy: withReleaseTracks(workspaceRoot, resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null)),
|
|
16242
16393
|
provenance: { branchPolicy: selected.source }
|
|
16243
16394
|
} : {
|
|
16244
16395
|
commitPolicy: resolveCommitPolicy(config, selected.policy ? { commitPolicy: selected.policy } : null),
|
|
16245
16396
|
provenance: { commitPolicy: selected.source }
|
|
16246
16397
|
};
|
|
16247
16398
|
}
|
|
16248
|
-
var
|
|
16399
|
+
var withReleaseTracks = (workspaceRoot, policy) => {
|
|
16400
|
+
const read = workspaceReleaseTracks(workspaceRoot);
|
|
16401
|
+
if (read.error)
|
|
16402
|
+
throw new ReleaseTrackError(read.error);
|
|
16403
|
+
if (read.tracks.length === 0 && read.protectedBranches.length === 0)
|
|
16404
|
+
return policy;
|
|
16405
|
+
const known = new Set(policy.allowed.map((pattern) => pattern.source));
|
|
16406
|
+
const allowed = [...policy.allowed];
|
|
16407
|
+
for (const glob of read.tracks.flatMap((track) => Object.values(track.naming).map(namingGlob))) {
|
|
16408
|
+
const pattern = branchGlobPattern(glob);
|
|
16409
|
+
if (!known.has(pattern.source)) {
|
|
16410
|
+
known.add(pattern.source);
|
|
16411
|
+
allowed.push(pattern);
|
|
16412
|
+
}
|
|
16413
|
+
}
|
|
16414
|
+
return {
|
|
16415
|
+
...policy,
|
|
16416
|
+
allowed,
|
|
16417
|
+
protected: new Set([
|
|
16418
|
+
...policy.protected,
|
|
16419
|
+
...[...trackBranches(read.tracks), ...read.protectedBranches].map((name) => name.toLowerCase())
|
|
16420
|
+
])
|
|
16421
|
+
};
|
|
16422
|
+
}, validateBranchNamePolicy = (name, policy, source) => {
|
|
16249
16423
|
const allowed = policy.allowed.map((pattern) => `/${pattern.source}/${pattern.flags}`);
|
|
16250
16424
|
if (policy.protected.has(name.toLowerCase())) {
|
|
16251
16425
|
const correction = `choose a non-protected branch matching one of: ${allowed.join(", ")}`;
|
|
@@ -16305,6 +16479,7 @@ var init_branch = __esm(() => {
|
|
|
16305
16479
|
init_config();
|
|
16306
16480
|
init_workspaces();
|
|
16307
16481
|
init_vcs_config();
|
|
16482
|
+
init_release_tracks();
|
|
16308
16483
|
});
|
|
16309
16484
|
|
|
16310
16485
|
// packages/workit-core/src/core/route-intent.ts
|
|
@@ -16598,7 +16773,7 @@ var init_write_gate = __esm(() => {
|
|
|
16598
16773
|
// packages/workit-core/src/hooks/hosts/fields.ts
|
|
16599
16774
|
import { existsSync as existsSync6, realpathSync as realpathSync6, statSync as statSync2 } from "node:fs";
|
|
16600
16775
|
import path17 from "node:path";
|
|
16601
|
-
var
|
|
16776
|
+
var isRecord4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "", optionalText = (value) => typeof value === "string" ? value : null, existingDirectory = (value) => {
|
|
16602
16777
|
if (!nonEmpty2(value) || !path17.isAbsolute(value) || !existsSync6(value))
|
|
16603
16778
|
return null;
|
|
16604
16779
|
try {
|
|
@@ -16625,7 +16800,7 @@ var isRecord3 = (value) => value !== null && typeof value === "object" && !Array
|
|
|
16625
16800
|
const joined = argv.map(quoteArg).join(" ");
|
|
16626
16801
|
return nonEmpty2(joined) ? joined : null;
|
|
16627
16802
|
}, WRITE_TOOLS, isWriteTool = (name) => typeof name === "string" && WRITE_TOOLS.has(name.toLowerCase().replace(/[_-]/g, "")), PATH_KEYS, writePaths = (input) => {
|
|
16628
|
-
if (!
|
|
16803
|
+
if (!isRecord4(input))
|
|
16629
16804
|
return [];
|
|
16630
16805
|
const paths = PATH_KEYS.map((key) => input[key]).filter(nonEmpty2);
|
|
16631
16806
|
for (const value of Object.values(input))
|
|
@@ -16757,7 +16932,7 @@ var init_handle = __esm(() => {
|
|
|
16757
16932
|
});
|
|
16758
16933
|
|
|
16759
16934
|
// packages/workit-core/src/hooks/hosts/claude-code.ts
|
|
16760
|
-
var CLAUDE_CODE_DESCRIPTOR, EVENTS, SOURCES, SHELL_TOOLS, toolCommand = (value) =>
|
|
16935
|
+
var CLAUDE_CODE_DESCRIPTOR, EVENTS, SOURCES, SHELL_TOOLS, toolCommand = (value) => isRecord4(value.tool_input) ? commandText(value.tool_input.command) : null, eventOf = (name, value) => {
|
|
16761
16936
|
const toolUseId = optionalText(value.tool_use_id);
|
|
16762
16937
|
switch (name) {
|
|
16763
16938
|
case "SessionStart":
|
|
@@ -16786,7 +16961,7 @@ var CLAUDE_CODE_DESCRIPTOR, EVENTS, SOURCES, SHELL_TOOLS, toolCommand = (value)
|
|
|
16786
16961
|
const command = toolCommand(value);
|
|
16787
16962
|
if (!SHELL_TOOLS.has(String(value.tool_name)) || !command)
|
|
16788
16963
|
return { ok: false, error: "only shell PostToolUse is mapped" };
|
|
16789
|
-
const response =
|
|
16964
|
+
const response = isRecord4(value.tool_response) ? value.tool_response : {};
|
|
16790
16965
|
return {
|
|
16791
16966
|
ok: true,
|
|
16792
16967
|
event: {
|
|
@@ -16961,14 +17136,14 @@ var init_claude_code = __esm(() => {
|
|
|
16961
17136
|
claudeCodeAdapter = {
|
|
16962
17137
|
descriptor: CLAUDE_CODE_DESCRIPTOR,
|
|
16963
17138
|
parse(raw) {
|
|
16964
|
-
const native =
|
|
17139
|
+
const native = isRecord4(raw) && Object.hasOwn(EVENTS, String(raw.hook_event_name)) ? raw.hook_event_name : null;
|
|
16965
17140
|
const fail = (error) => ({
|
|
16966
17141
|
ok: false,
|
|
16967
17142
|
error,
|
|
16968
17143
|
native,
|
|
16969
17144
|
event: native ? EVENTS[native] : null
|
|
16970
17145
|
});
|
|
16971
|
-
if (!
|
|
17146
|
+
if (!isRecord4(raw) || !native)
|
|
16972
17147
|
return fail("hook_event_name is required");
|
|
16973
17148
|
if (!nonEmpty2(raw.session_id))
|
|
16974
17149
|
return fail("session_id is required");
|
|
@@ -17005,7 +17180,7 @@ function detectCodexSurface(env) {
|
|
|
17005
17180
|
return env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || Boolean(env.CODEX_ELECTRON_RESOURCES_PATH) ? "codex_desktop" : "codex_cli";
|
|
17006
17181
|
}
|
|
17007
17182
|
var undocumented, CODEX_DESCRIPTOR, EVENTS2, SHELL_TOOLS2, isShellTool = (name) => SHELL_TOOLS2.has(String(name).toLowerCase()), SOURCES2, parseCodexHookInput = (value) => {
|
|
17008
|
-
if (!
|
|
17183
|
+
if (!isRecord4(value) || !Object.hasOwn(EVENTS2, String(value.hook_event_name)))
|
|
17009
17184
|
return { ok: false, error: "hook_event_name is required" };
|
|
17010
17185
|
const event = value.hook_event_name;
|
|
17011
17186
|
const cwd = existingDirectory(value.cwd);
|
|
@@ -17013,7 +17188,7 @@ var undocumented, CODEX_DESCRIPTOR, EVENTS2, SHELL_TOOLS2, isShellTool = (name)
|
|
|
17013
17188
|
return { ok: false, error: "cwd must be an existing absolute directory" };
|
|
17014
17189
|
if (event === "PreToolUse" && !nonEmpty2(value.tool_name))
|
|
17015
17190
|
return { ok: false, error: "tool_name is required" };
|
|
17016
|
-
const command =
|
|
17191
|
+
const command = isRecord4(value.tool_input) ? commandText(value.tool_input.command) : null;
|
|
17017
17192
|
if (event === "PreToolUse" && isShellTool(value.tool_name) && !command)
|
|
17018
17193
|
return { ok: false, error: "tool_input.command is required for shell tools" };
|
|
17019
17194
|
if (event === "SubagentStart" && !nonEmpty2(value.agent_id))
|
|
@@ -17200,7 +17375,7 @@ var init_codex = __esm(() => {
|
|
|
17200
17375
|
const host = detectCodexSurface(env);
|
|
17201
17376
|
const parsed = parseCodexHookInput(raw);
|
|
17202
17377
|
if (!parsed.ok) {
|
|
17203
|
-
const native =
|
|
17378
|
+
const native = isRecord4(raw) && Object.hasOwn(EVENTS2, String(raw.hook_event_name)) ? raw.hook_event_name : null;
|
|
17204
17379
|
return { ok: false, error: parsed.error, native, event: native ? EVENTS2[native] : null };
|
|
17205
17380
|
}
|
|
17206
17381
|
const input = parsed.data;
|
|
@@ -17230,7 +17405,7 @@ var init_codex = __esm(() => {
|
|
|
17230
17405
|
// packages/workit-core/src/hooks/hosts/cursor.ts
|
|
17231
17406
|
import path18 from "node:path";
|
|
17232
17407
|
var undocumented2, none, CURSOR_DESCRIPTOR, EVENTS3, parseCursorHookInput = (value) => {
|
|
17233
|
-
if (!
|
|
17408
|
+
if (!isRecord4(value) || !Object.hasOwn(EVENTS3, String(value.hook_event_name)))
|
|
17234
17409
|
return { ok: false, error: "hook_event_name is required" };
|
|
17235
17410
|
const roots = value.workspace_roots;
|
|
17236
17411
|
if (!Array.isArray(roots) || roots.length === 0 || !roots.every(nonEmpty2))
|
|
@@ -17442,7 +17617,7 @@ var init_cursor = __esm(() => {
|
|
|
17442
17617
|
parse(raw) {
|
|
17443
17618
|
const parsed = parseCursorHookInput(raw);
|
|
17444
17619
|
if (!parsed.ok) {
|
|
17445
|
-
const native =
|
|
17620
|
+
const native = isRecord4(raw) && Object.hasOwn(EVENTS3, String(raw.hook_event_name)) ? raw.hook_event_name : null;
|
|
17446
17621
|
return { ok: false, error: parsed.error, native, event: native ? EVENTS3[native] : null };
|
|
17447
17622
|
}
|
|
17448
17623
|
const input = parsed.data;
|