rulesync 8.5.0 → 8.7.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/{chunk-Q5FDY7NL.js → chunk-QGQQJNZD.js} +932 -728
- package/dist/cli/index.cjs +2890 -1072
- package/dist/cli/index.js +1831 -211
- package/dist/index.cjs +822 -619
- package/dist/index.js +1 -1
- package/package.json +3 -2
|
@@ -349,7 +349,13 @@ var SourceEntrySchema = z3.object({
|
|
|
349
349
|
refine((v) => !isAbsolute(v), "path must not be absolute"),
|
|
350
350
|
refine((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
351
351
|
)
|
|
352
|
-
)
|
|
352
|
+
),
|
|
353
|
+
// gh-mode-only fields. Ignored by --mode rulesync. Defaults applied at the
|
|
354
|
+
// gh install site (`agent` defaults to "github-copilot", `scope` to "project").
|
|
355
|
+
agent: optional(
|
|
356
|
+
z3.enum(["github-copilot", "claude-code", "cursor", "codex", "gemini", "antigravity"])
|
|
357
|
+
),
|
|
358
|
+
scope: optional(z3.enum(["project", "user"]))
|
|
353
359
|
});
|
|
354
360
|
var ConfigParamsSchema = z3.object({
|
|
355
361
|
baseDirs: z3.array(z3.string()),
|
|
@@ -860,6 +866,176 @@ function getBaseDirsInLightOfGlobal({
|
|
|
860
866
|
return resolvedBaseDirs;
|
|
861
867
|
}
|
|
862
868
|
|
|
869
|
+
// src/types/json-output.ts
|
|
870
|
+
var ErrorCodes = {
|
|
871
|
+
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
872
|
+
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
873
|
+
INVALID_TARGET: "INVALID_TARGET",
|
|
874
|
+
FETCH_FAILED: "FETCH_FAILED",
|
|
875
|
+
WRITE_FAILED: "WRITE_FAILED",
|
|
876
|
+
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
877
|
+
GENERATION_FAILED: "GENERATION_FAILED",
|
|
878
|
+
IMPORT_FAILED: "IMPORT_FAILED",
|
|
879
|
+
INSTALL_FAILED: "INSTALL_FAILED",
|
|
880
|
+
UPDATE_FAILED: "UPDATE_FAILED",
|
|
881
|
+
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
882
|
+
INIT_FAILED: "INIT_FAILED",
|
|
883
|
+
MCP_FAILED: "MCP_FAILED",
|
|
884
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
885
|
+
};
|
|
886
|
+
var CLIError = class extends Error {
|
|
887
|
+
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
888
|
+
super(message);
|
|
889
|
+
this.code = code;
|
|
890
|
+
this.exitCode = exitCode;
|
|
891
|
+
this.name = "CLIError";
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
// src/utils/logger.ts
|
|
896
|
+
var BaseLogger = class {
|
|
897
|
+
_verbose = false;
|
|
898
|
+
_silent = false;
|
|
899
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
900
|
+
this._silent = silent;
|
|
901
|
+
this._verbose = verbose && !silent;
|
|
902
|
+
}
|
|
903
|
+
get verbose() {
|
|
904
|
+
return this._verbose;
|
|
905
|
+
}
|
|
906
|
+
get silent() {
|
|
907
|
+
return this._silent;
|
|
908
|
+
}
|
|
909
|
+
configure({ verbose, silent }) {
|
|
910
|
+
if (verbose && silent) {
|
|
911
|
+
this._silent = false;
|
|
912
|
+
if (!isEnvTest()) {
|
|
913
|
+
this.onConflictingFlags();
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
this._silent = silent;
|
|
917
|
+
this._verbose = verbose && !silent;
|
|
918
|
+
}
|
|
919
|
+
onConflictingFlags() {
|
|
920
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
924
|
+
isSuppressed() {
|
|
925
|
+
return isEnvTest() || this._silent;
|
|
926
|
+
}
|
|
927
|
+
get jsonMode() {
|
|
928
|
+
return false;
|
|
929
|
+
}
|
|
930
|
+
captureData(_key, _value) {
|
|
931
|
+
}
|
|
932
|
+
getJsonData() {
|
|
933
|
+
return {};
|
|
934
|
+
}
|
|
935
|
+
outputJson(_success, _error) {
|
|
936
|
+
}
|
|
937
|
+
info(message, ...args) {
|
|
938
|
+
if (this.isSuppressed()) return;
|
|
939
|
+
console.log(message, ...args);
|
|
940
|
+
}
|
|
941
|
+
success(message, ...args) {
|
|
942
|
+
if (this.isSuppressed()) return;
|
|
943
|
+
console.log(message, ...args);
|
|
944
|
+
}
|
|
945
|
+
warn(message, ...args) {
|
|
946
|
+
if (this.isSuppressed()) return;
|
|
947
|
+
console.warn(message, ...args);
|
|
948
|
+
}
|
|
949
|
+
// Errors are always emitted, even in silent mode
|
|
950
|
+
error(message, _code, ...args) {
|
|
951
|
+
if (isEnvTest()) return;
|
|
952
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
953
|
+
console.error(errorMessage, ...args);
|
|
954
|
+
}
|
|
955
|
+
debug(message, ...args) {
|
|
956
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
957
|
+
console.log(message, ...args);
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
var JsonLogger = class extends BaseLogger {
|
|
961
|
+
_jsonOutputDone = false;
|
|
962
|
+
_jsonData = {};
|
|
963
|
+
_commandName;
|
|
964
|
+
_version;
|
|
965
|
+
constructor({
|
|
966
|
+
command,
|
|
967
|
+
version,
|
|
968
|
+
verbose = false,
|
|
969
|
+
silent = false
|
|
970
|
+
}) {
|
|
971
|
+
super({ verbose, silent });
|
|
972
|
+
this._commandName = command;
|
|
973
|
+
this._version = version;
|
|
974
|
+
}
|
|
975
|
+
// Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
|
|
976
|
+
onConflictingFlags() {
|
|
977
|
+
}
|
|
978
|
+
get jsonMode() {
|
|
979
|
+
return true;
|
|
980
|
+
}
|
|
981
|
+
captureData(key, value) {
|
|
982
|
+
this._jsonData[key] = value;
|
|
983
|
+
}
|
|
984
|
+
getJsonData() {
|
|
985
|
+
return { ...this._jsonData };
|
|
986
|
+
}
|
|
987
|
+
outputJson(success, error) {
|
|
988
|
+
if (this._jsonOutputDone) return;
|
|
989
|
+
this._jsonOutputDone = true;
|
|
990
|
+
const output = {
|
|
991
|
+
success,
|
|
992
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
993
|
+
command: this._commandName,
|
|
994
|
+
version: this._version
|
|
995
|
+
};
|
|
996
|
+
if (success) {
|
|
997
|
+
output.data = this._jsonData;
|
|
998
|
+
} else if (error) {
|
|
999
|
+
output.error = {
|
|
1000
|
+
code: error.code,
|
|
1001
|
+
message: error.message
|
|
1002
|
+
};
|
|
1003
|
+
if (error.details) {
|
|
1004
|
+
output.error.details = error.details;
|
|
1005
|
+
}
|
|
1006
|
+
if (error.stack) {
|
|
1007
|
+
output.error.stack = error.stack;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
const jsonStr = JSON.stringify(output, null, 2);
|
|
1011
|
+
if (success) {
|
|
1012
|
+
console.log(jsonStr);
|
|
1013
|
+
} else {
|
|
1014
|
+
console.error(jsonStr);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
info(_message, ..._args) {
|
|
1018
|
+
}
|
|
1019
|
+
success(_message, ..._args) {
|
|
1020
|
+
}
|
|
1021
|
+
warn(_message, ..._args) {
|
|
1022
|
+
}
|
|
1023
|
+
error(message, code, ..._args) {
|
|
1024
|
+
if (isEnvTest()) return;
|
|
1025
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
1026
|
+
const errorInfo = {
|
|
1027
|
+
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
1028
|
+
message: errorMessage
|
|
1029
|
+
};
|
|
1030
|
+
if (this._verbose && message instanceof Error && message.stack) {
|
|
1031
|
+
errorInfo.stack = message.stack;
|
|
1032
|
+
}
|
|
1033
|
+
this.outputJson(false, errorInfo);
|
|
1034
|
+
}
|
|
1035
|
+
debug(_message, ..._args) {
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
|
|
863
1039
|
// src/lib/generate.ts
|
|
864
1040
|
import { join as join138 } from "path";
|
|
865
1041
|
import { intersection } from "es-toolkit";
|
|
@@ -3599,7 +3775,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3599
3775
|
};
|
|
3600
3776
|
|
|
3601
3777
|
// src/features/hooks/hooks-processor.ts
|
|
3602
|
-
import { z as
|
|
3778
|
+
import { z as z19 } from "zod/mini";
|
|
3603
3779
|
|
|
3604
3780
|
// src/types/hooks.ts
|
|
3605
3781
|
import { z as z16 } from "zod/mini";
|
|
@@ -3903,22 +4079,34 @@ function canonicalToToolHooks({
|
|
|
3903
4079
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3904
4080
|
);
|
|
3905
4081
|
}
|
|
3906
|
-
const hooks =
|
|
4082
|
+
const hooks = [];
|
|
4083
|
+
for (const def of defs) {
|
|
4084
|
+
const hookType = def.type ?? "command";
|
|
4085
|
+
if (converterConfig.supportedHookTypes && !converterConfig.supportedHookTypes.has(hookType)) {
|
|
4086
|
+
continue;
|
|
4087
|
+
}
|
|
3907
4088
|
const commandText = def.command;
|
|
3908
4089
|
const trimmedCommand = typeof commandText === "string" ? commandText.trimStart() : void 0;
|
|
3909
|
-
const shouldPrefix = typeof trimmedCommand === "string" && !trimmedCommand.startsWith("$") && (!converterConfig.prefixDotRelativeCommandsOnly || trimmedCommand.startsWith("."));
|
|
4090
|
+
const shouldPrefix = converterConfig.projectDirVar !== "" && typeof trimmedCommand === "string" && !trimmedCommand.startsWith("$") && (!converterConfig.prefixDotRelativeCommandsOnly || trimmedCommand.startsWith("."));
|
|
3910
4091
|
const command = shouldPrefix && typeof trimmedCommand === "string" ? `${converterConfig.projectDirVar}/${trimmedCommand.replace(/^\.\//, "")}` : def.command;
|
|
3911
|
-
|
|
3912
|
-
type:
|
|
4092
|
+
hooks.push({
|
|
4093
|
+
type: hookType,
|
|
3913
4094
|
...command !== void 0 && command !== null && { command },
|
|
3914
4095
|
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout },
|
|
3915
|
-
...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt }
|
|
3916
|
-
|
|
3917
|
-
|
|
4096
|
+
...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt },
|
|
4097
|
+
...converterConfig.passthroughFields?.includes("name") && def.name !== void 0 && def.name !== null && { name: def.name },
|
|
4098
|
+
...converterConfig.passthroughFields?.includes("description") && def.description !== void 0 && def.description !== null && { description: def.description }
|
|
4099
|
+
});
|
|
4100
|
+
}
|
|
4101
|
+
if (hooks.length === 0) {
|
|
4102
|
+
continue;
|
|
4103
|
+
}
|
|
3918
4104
|
const includeMatcher = matcherKey && !isNoMatcherEvent;
|
|
3919
4105
|
entries.push(includeMatcher ? { matcher: matcherKey, hooks } : { hooks });
|
|
3920
4106
|
}
|
|
3921
|
-
|
|
4107
|
+
if (entries.length > 0) {
|
|
4108
|
+
result[toolEventName] = entries;
|
|
4109
|
+
}
|
|
3922
4110
|
}
|
|
3923
4111
|
return result;
|
|
3924
4112
|
}
|
|
@@ -3939,7 +4127,7 @@ function toolHooksToCanonical({
|
|
|
3939
4127
|
const hookDefs = rawEntry.hooks ?? [];
|
|
3940
4128
|
for (const h of hookDefs) {
|
|
3941
4129
|
const cmd = typeof h.command === "string" ? h.command : void 0;
|
|
3942
|
-
const command = typeof cmd === "string" && cmd.includes(`${converterConfig.projectDirVar}/`) ? cmd.replace(
|
|
4130
|
+
const command = converterConfig.projectDirVar !== "" && typeof cmd === "string" && cmd.includes(`${converterConfig.projectDirVar}/`) ? cmd.replace(
|
|
3943
4131
|
new RegExp(
|
|
3944
4132
|
`^${converterConfig.projectDirVar.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\/?`
|
|
3945
4133
|
),
|
|
@@ -3953,6 +4141,8 @@ function toolHooksToCanonical({
|
|
|
3953
4141
|
...command !== void 0 && command !== null && { command },
|
|
3954
4142
|
...timeout !== void 0 && timeout !== null && { timeout },
|
|
3955
4143
|
...prompt !== void 0 && prompt !== null && { prompt },
|
|
4144
|
+
...converterConfig.passthroughFields?.includes("name") && typeof h.name === "string" && { name: h.name },
|
|
4145
|
+
...converterConfig.passthroughFields?.includes("description") && typeof h.description === "string" && { description: h.description },
|
|
3956
4146
|
...rawEntry.matcher !== void 0 && rawEntry.matcher !== null && rawEntry.matcher !== "" && { matcher: rawEntry.matcher }
|
|
3957
4147
|
});
|
|
3958
4148
|
}
|
|
@@ -4051,6 +4241,9 @@ var ToolHooks = class extends ToolFile {
|
|
|
4051
4241
|
static forDeletion(_params) {
|
|
4052
4242
|
throw new Error("Please implement this method in the subclass.");
|
|
4053
4243
|
}
|
|
4244
|
+
static async getAuxiliaryFiles(_params) {
|
|
4245
|
+
return [];
|
|
4246
|
+
}
|
|
4054
4247
|
};
|
|
4055
4248
|
|
|
4056
4249
|
// src/features/hooks/claudecode-hooks.ts
|
|
@@ -4172,89 +4365,28 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
4172
4365
|
// src/features/hooks/codexcli-hooks.ts
|
|
4173
4366
|
import { join as join23 } from "path";
|
|
4174
4367
|
import * as smolToml2 from "smol-toml";
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
}
|
|
4184
|
-
const effectiveHooks = {
|
|
4185
|
-
...sharedHooks,
|
|
4186
|
-
...config.codexcli?.hooks
|
|
4187
|
-
};
|
|
4188
|
-
const codex = {};
|
|
4189
|
-
for (const [eventName, definitions] of Object.entries(effectiveHooks)) {
|
|
4190
|
-
const codexEventName = CANONICAL_TO_CODEXCLI_EVENT_NAMES[eventName] ?? eventName;
|
|
4191
|
-
const byMatcher = /* @__PURE__ */ new Map();
|
|
4192
|
-
for (const def of definitions) {
|
|
4193
|
-
const key = def.matcher ?? "";
|
|
4194
|
-
const list = byMatcher.get(key);
|
|
4195
|
-
if (list) list.push(def);
|
|
4196
|
-
else byMatcher.set(key, [def]);
|
|
4197
|
-
}
|
|
4198
|
-
const entries = [];
|
|
4199
|
-
for (const [matcherKey, defs] of byMatcher) {
|
|
4200
|
-
const commandDefs = defs.filter((def) => !def.type || def.type === "command");
|
|
4201
|
-
if (commandDefs.length === 0) continue;
|
|
4202
|
-
const hooks = commandDefs.map((def) => ({
|
|
4203
|
-
type: "command",
|
|
4204
|
-
...def.command !== void 0 && def.command !== null && { command: def.command },
|
|
4205
|
-
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout }
|
|
4206
|
-
}));
|
|
4207
|
-
entries.push(matcherKey ? { matcher: matcherKey, hooks } : { hooks });
|
|
4208
|
-
}
|
|
4209
|
-
if (entries.length > 0) {
|
|
4210
|
-
codex[codexEventName] = entries;
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
return codex;
|
|
4214
|
-
}
|
|
4215
|
-
var CodexHookEntrySchema = z17.looseObject({
|
|
4216
|
-
type: z17.optional(z17.string()),
|
|
4217
|
-
command: z17.optional(z17.string()),
|
|
4218
|
-
timeout: z17.optional(z17.number())
|
|
4219
|
-
});
|
|
4220
|
-
var CodexMatcherEntrySchema = z17.looseObject({
|
|
4221
|
-
matcher: z17.optional(z17.string()),
|
|
4222
|
-
hooks: z17.optional(z17.array(CodexHookEntrySchema))
|
|
4223
|
-
});
|
|
4224
|
-
function codexcliHooksToCanonical(codexHooks) {
|
|
4225
|
-
if (codexHooks === null || codexHooks === void 0 || typeof codexHooks !== "object") {
|
|
4226
|
-
return {};
|
|
4227
|
-
}
|
|
4228
|
-
const canonical = {};
|
|
4229
|
-
for (const [codexEventName, matcherEntries] of Object.entries(codexHooks)) {
|
|
4230
|
-
const eventName = CODEXCLI_TO_CANONICAL_EVENT_NAMES[codexEventName] ?? codexEventName;
|
|
4231
|
-
if (!Array.isArray(matcherEntries)) continue;
|
|
4232
|
-
const defs = [];
|
|
4233
|
-
for (const rawEntry of matcherEntries) {
|
|
4234
|
-
const parseResult = CodexMatcherEntrySchema.safeParse(rawEntry);
|
|
4235
|
-
if (!parseResult.success) continue;
|
|
4236
|
-
const entry = parseResult.data;
|
|
4237
|
-
const hooks = entry.hooks ?? [];
|
|
4238
|
-
for (const h of hooks) {
|
|
4239
|
-
const hookType = h.type === "command" || h.type === "prompt" ? h.type : "command";
|
|
4240
|
-
defs.push({
|
|
4241
|
-
type: hookType,
|
|
4242
|
-
...h.command !== void 0 && h.command !== null && { command: h.command },
|
|
4243
|
-
...h.timeout !== void 0 && h.timeout !== null && { timeout: h.timeout },
|
|
4244
|
-
...entry.matcher !== void 0 && entry.matcher !== null && entry.matcher !== "" && { matcher: entry.matcher }
|
|
4245
|
-
});
|
|
4246
|
-
}
|
|
4247
|
-
}
|
|
4248
|
-
if (defs.length > 0) {
|
|
4249
|
-
canonical[eventName] = defs;
|
|
4250
|
-
}
|
|
4251
|
-
}
|
|
4252
|
-
return canonical;
|
|
4253
|
-
}
|
|
4368
|
+
var CODEXCLI_CONVERTER_CONFIG = {
|
|
4369
|
+
supportedEvents: CODEXCLI_HOOK_EVENTS,
|
|
4370
|
+
canonicalToToolEventNames: CANONICAL_TO_CODEXCLI_EVENT_NAMES,
|
|
4371
|
+
toolToCanonicalEventNames: CODEXCLI_TO_CANONICAL_EVENT_NAMES,
|
|
4372
|
+
projectDirVar: "",
|
|
4373
|
+
supportedHookTypes: /* @__PURE__ */ new Set(["command"]),
|
|
4374
|
+
passthroughFields: ["name", "description"]
|
|
4375
|
+
};
|
|
4254
4376
|
async function buildCodexConfigTomlContent({ baseDir }) {
|
|
4255
4377
|
const configPath = join23(baseDir, ".codex", "config.toml");
|
|
4256
4378
|
const existingContent = await readFileContentOrNull(configPath) ?? smolToml2.stringify({});
|
|
4257
|
-
|
|
4379
|
+
let configToml;
|
|
4380
|
+
try {
|
|
4381
|
+
configToml = smolToml2.parse(existingContent);
|
|
4382
|
+
} catch (error) {
|
|
4383
|
+
throw new Error(
|
|
4384
|
+
`Failed to parse existing Codex CLI config at ${configPath}: ${formatError(error)}`,
|
|
4385
|
+
{
|
|
4386
|
+
cause: error
|
|
4387
|
+
}
|
|
4388
|
+
);
|
|
4389
|
+
}
|
|
4258
4390
|
if (typeof configToml.features !== "object" || configToml.features === null) {
|
|
4259
4391
|
configToml.features = {};
|
|
4260
4392
|
}
|
|
@@ -4309,7 +4441,11 @@ var CodexcliHooks = class _CodexcliHooks extends ToolHooks {
|
|
|
4309
4441
|
}) {
|
|
4310
4442
|
const paths = _CodexcliHooks.getSettablePaths({ global });
|
|
4311
4443
|
const config = rulesyncHooks.getJson();
|
|
4312
|
-
const codexHooks =
|
|
4444
|
+
const codexHooks = canonicalToToolHooks({
|
|
4445
|
+
config,
|
|
4446
|
+
toolOverrideHooks: config.codexcli?.hooks,
|
|
4447
|
+
converterConfig: CODEXCLI_CONVERTER_CONFIG
|
|
4448
|
+
});
|
|
4313
4449
|
const fileContent = JSON.stringify({ hooks: codexHooks }, null, 2);
|
|
4314
4450
|
return new _CodexcliHooks({
|
|
4315
4451
|
baseDir,
|
|
@@ -4331,7 +4467,10 @@ var CodexcliHooks = class _CodexcliHooks extends ToolHooks {
|
|
|
4331
4467
|
}
|
|
4332
4468
|
);
|
|
4333
4469
|
}
|
|
4334
|
-
const hooks =
|
|
4470
|
+
const hooks = toolHooksToCanonical({
|
|
4471
|
+
hooks: parsed.hooks,
|
|
4472
|
+
converterConfig: CODEXCLI_CONVERTER_CONFIG
|
|
4473
|
+
});
|
|
4335
4474
|
return this.toRulesyncHooksDefault({
|
|
4336
4475
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
4337
4476
|
});
|
|
@@ -4352,16 +4491,21 @@ var CodexcliHooks = class _CodexcliHooks extends ToolHooks {
|
|
|
4352
4491
|
validate: false
|
|
4353
4492
|
});
|
|
4354
4493
|
}
|
|
4494
|
+
static async getAuxiliaryFiles({
|
|
4495
|
+
baseDir = process.cwd()
|
|
4496
|
+
} = {}) {
|
|
4497
|
+
return [await CodexcliConfigToml.fromBaseDir({ baseDir })];
|
|
4498
|
+
}
|
|
4355
4499
|
};
|
|
4356
4500
|
|
|
4357
4501
|
// src/features/hooks/copilot-hooks.ts
|
|
4358
4502
|
import { join as join24 } from "path";
|
|
4359
|
-
import { z as
|
|
4360
|
-
var CopilotHookEntrySchema =
|
|
4361
|
-
type:
|
|
4362
|
-
bash:
|
|
4363
|
-
powershell:
|
|
4364
|
-
timeoutSec:
|
|
4503
|
+
import { z as z17 } from "zod/mini";
|
|
4504
|
+
var CopilotHookEntrySchema = z17.looseObject({
|
|
4505
|
+
type: z17.string(),
|
|
4506
|
+
bash: z17.optional(z17.string()),
|
|
4507
|
+
powershell: z17.optional(z17.string()),
|
|
4508
|
+
timeoutSec: z17.optional(z17.number())
|
|
4365
4509
|
});
|
|
4366
4510
|
function canonicalToCopilotHooks(config) {
|
|
4367
4511
|
const canonicalSchemaKeys = Object.keys(HookDefinitionSchema.shape);
|
|
@@ -4892,7 +5036,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4892
5036
|
|
|
4893
5037
|
// src/features/hooks/geminicli-hooks.ts
|
|
4894
5038
|
import { join as join28 } from "path";
|
|
4895
|
-
import { z as
|
|
5039
|
+
import { z as z18 } from "zod/mini";
|
|
4896
5040
|
function canonicalToGeminicliHooks(config) {
|
|
4897
5041
|
const geminiSupported = new Set(GEMINICLI_HOOK_EVENTS);
|
|
4898
5042
|
const sharedHooks = {};
|
|
@@ -4936,16 +5080,16 @@ function canonicalToGeminicliHooks(config) {
|
|
|
4936
5080
|
}
|
|
4937
5081
|
return gemini;
|
|
4938
5082
|
}
|
|
4939
|
-
var GeminiHookEntrySchema =
|
|
4940
|
-
type:
|
|
4941
|
-
command:
|
|
4942
|
-
timeout:
|
|
4943
|
-
name:
|
|
4944
|
-
description:
|
|
5083
|
+
var GeminiHookEntrySchema = z18.looseObject({
|
|
5084
|
+
type: z18.optional(z18.string()),
|
|
5085
|
+
command: z18.optional(z18.string()),
|
|
5086
|
+
timeout: z18.optional(z18.number()),
|
|
5087
|
+
name: z18.optional(z18.string()),
|
|
5088
|
+
description: z18.optional(z18.string())
|
|
4945
5089
|
});
|
|
4946
|
-
var GeminiMatcherEntrySchema =
|
|
4947
|
-
matcher:
|
|
4948
|
-
hooks:
|
|
5090
|
+
var GeminiMatcherEntrySchema = z18.looseObject({
|
|
5091
|
+
matcher: z18.optional(z18.string()),
|
|
5092
|
+
hooks: z18.optional(z18.array(GeminiHookEntrySchema))
|
|
4949
5093
|
});
|
|
4950
5094
|
function geminiHooksToCanonical(geminiHooks) {
|
|
4951
5095
|
if (geminiHooks === null || geminiHooks === void 0 || typeof geminiHooks !== "object") {
|
|
@@ -5329,7 +5473,7 @@ var hooksProcessorToolTargetTuple = [
|
|
|
5329
5473
|
"geminicli",
|
|
5330
5474
|
"deepagents"
|
|
5331
5475
|
];
|
|
5332
|
-
var HooksProcessorToolTargetSchema =
|
|
5476
|
+
var HooksProcessorToolTargetSchema = z19.enum(hooksProcessorToolTargetTuple);
|
|
5333
5477
|
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
5334
5478
|
[
|
|
5335
5479
|
"cursor",
|
|
@@ -5588,8 +5732,12 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
5588
5732
|
global: this.global
|
|
5589
5733
|
});
|
|
5590
5734
|
const result = [toolHooks];
|
|
5591
|
-
|
|
5592
|
-
|
|
5735
|
+
const auxiliaryFiles = await factory.class.getAuxiliaryFiles?.({
|
|
5736
|
+
baseDir: this.baseDir,
|
|
5737
|
+
global: this.global
|
|
5738
|
+
});
|
|
5739
|
+
if (auxiliaryFiles && auxiliaryFiles.length > 0) {
|
|
5740
|
+
result.push(...auxiliaryFiles);
|
|
5593
5741
|
}
|
|
5594
5742
|
return result;
|
|
5595
5743
|
}
|
|
@@ -5609,7 +5757,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
5609
5757
|
};
|
|
5610
5758
|
|
|
5611
5759
|
// src/features/ignore/ignore-processor.ts
|
|
5612
|
-
import { z as
|
|
5760
|
+
import { z as z21 } from "zod/mini";
|
|
5613
5761
|
|
|
5614
5762
|
// src/features/ignore/augmentcode-ignore.ts
|
|
5615
5763
|
import { join as join32 } from "path";
|
|
@@ -5788,12 +5936,12 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
5788
5936
|
// src/features/ignore/claudecode-ignore.ts
|
|
5789
5937
|
import { join as join33 } from "path";
|
|
5790
5938
|
import { uniq } from "es-toolkit";
|
|
5791
|
-
import { z as
|
|
5939
|
+
import { z as z20 } from "zod/mini";
|
|
5792
5940
|
var SHARED_SETTINGS_FILE = "settings.json";
|
|
5793
5941
|
var LOCAL_SETTINGS_FILE = "settings.local.json";
|
|
5794
5942
|
var DEFAULT_FILE_MODE = "shared";
|
|
5795
|
-
var ClaudecodeIgnoreOptionsSchema =
|
|
5796
|
-
fileMode:
|
|
5943
|
+
var ClaudecodeIgnoreOptionsSchema = z20.looseObject({
|
|
5944
|
+
fileMode: z20.optional(z20.enum(["shared", "local"]))
|
|
5797
5945
|
});
|
|
5798
5946
|
var resolveFileMode = (options) => {
|
|
5799
5947
|
if (!options) return DEFAULT_FILE_MODE;
|
|
@@ -6637,7 +6785,7 @@ var ignoreProcessorToolTargets = [
|
|
|
6637
6785
|
"windsurf",
|
|
6638
6786
|
"zed"
|
|
6639
6787
|
];
|
|
6640
|
-
var IgnoreProcessorToolTargetSchema =
|
|
6788
|
+
var IgnoreProcessorToolTargetSchema = z21.enum(ignoreProcessorToolTargets);
|
|
6641
6789
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
6642
6790
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
6643
6791
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -6780,7 +6928,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6780
6928
|
};
|
|
6781
6929
|
|
|
6782
6930
|
// src/features/mcp/mcp-processor.ts
|
|
6783
|
-
import { z as
|
|
6931
|
+
import { z as z26 } from "zod/mini";
|
|
6784
6932
|
|
|
6785
6933
|
// src/features/mcp/claudecode-mcp.ts
|
|
6786
6934
|
import { join as join46 } from "path";
|
|
@@ -6788,47 +6936,47 @@ import { join as join46 } from "path";
|
|
|
6788
6936
|
// src/features/mcp/rulesync-mcp.ts
|
|
6789
6937
|
import { join as join45 } from "path";
|
|
6790
6938
|
import { omit } from "es-toolkit/object";
|
|
6791
|
-
import { z as
|
|
6939
|
+
import { z as z23 } from "zod/mini";
|
|
6792
6940
|
|
|
6793
6941
|
// src/types/mcp.ts
|
|
6794
|
-
import { z as
|
|
6795
|
-
var McpServerSchema =
|
|
6796
|
-
type:
|
|
6797
|
-
command:
|
|
6798
|
-
args:
|
|
6799
|
-
url:
|
|
6800
|
-
httpUrl:
|
|
6801
|
-
env:
|
|
6802
|
-
disabled:
|
|
6803
|
-
networkTimeout:
|
|
6804
|
-
timeout:
|
|
6805
|
-
trust:
|
|
6806
|
-
cwd:
|
|
6807
|
-
transport:
|
|
6808
|
-
alwaysAllow:
|
|
6809
|
-
tools:
|
|
6810
|
-
kiroAutoApprove:
|
|
6811
|
-
kiroAutoBlock:
|
|
6812
|
-
headers:
|
|
6813
|
-
enabledTools:
|
|
6814
|
-
disabledTools:
|
|
6942
|
+
import { z as z22 } from "zod/mini";
|
|
6943
|
+
var McpServerSchema = z22.looseObject({
|
|
6944
|
+
type: z22.optional(z22.enum(["local", "stdio", "sse", "http"])),
|
|
6945
|
+
command: z22.optional(z22.union([z22.string(), z22.array(z22.string())])),
|
|
6946
|
+
args: z22.optional(z22.array(z22.string())),
|
|
6947
|
+
url: z22.optional(z22.string()),
|
|
6948
|
+
httpUrl: z22.optional(z22.string()),
|
|
6949
|
+
env: z22.optional(z22.record(z22.string(), z22.string())),
|
|
6950
|
+
disabled: z22.optional(z22.boolean()),
|
|
6951
|
+
networkTimeout: z22.optional(z22.number()),
|
|
6952
|
+
timeout: z22.optional(z22.number()),
|
|
6953
|
+
trust: z22.optional(z22.boolean()),
|
|
6954
|
+
cwd: z22.optional(z22.string()),
|
|
6955
|
+
transport: z22.optional(z22.enum(["local", "stdio", "sse", "http"])),
|
|
6956
|
+
alwaysAllow: z22.optional(z22.array(z22.string())),
|
|
6957
|
+
tools: z22.optional(z22.array(z22.string())),
|
|
6958
|
+
kiroAutoApprove: z22.optional(z22.array(z22.string())),
|
|
6959
|
+
kiroAutoBlock: z22.optional(z22.array(z22.string())),
|
|
6960
|
+
headers: z22.optional(z22.record(z22.string(), z22.string())),
|
|
6961
|
+
enabledTools: z22.optional(z22.array(z22.string())),
|
|
6962
|
+
disabledTools: z22.optional(z22.array(z22.string()))
|
|
6815
6963
|
});
|
|
6816
|
-
var McpServersSchema =
|
|
6964
|
+
var McpServersSchema = z22.record(z22.string(), McpServerSchema);
|
|
6817
6965
|
function isMcpServers(value) {
|
|
6818
6966
|
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6819
6967
|
}
|
|
6820
6968
|
|
|
6821
6969
|
// src/features/mcp/rulesync-mcp.ts
|
|
6822
|
-
var RulesyncMcpServerSchema =
|
|
6823
|
-
targets:
|
|
6824
|
-
description:
|
|
6825
|
-
exposed:
|
|
6970
|
+
var RulesyncMcpServerSchema = z23.extend(McpServerSchema, {
|
|
6971
|
+
targets: z23.optional(RulesyncTargetsSchema),
|
|
6972
|
+
description: z23.optional(z23.string()),
|
|
6973
|
+
exposed: z23.optional(z23.boolean())
|
|
6826
6974
|
});
|
|
6827
|
-
var RulesyncMcpConfigSchema =
|
|
6828
|
-
mcpServers:
|
|
6975
|
+
var RulesyncMcpConfigSchema = z23.object({
|
|
6976
|
+
mcpServers: z23.record(z23.string(), RulesyncMcpServerSchema)
|
|
6829
6977
|
});
|
|
6830
|
-
var RulesyncMcpFileSchema =
|
|
6831
|
-
$schema:
|
|
6978
|
+
var RulesyncMcpFileSchema = z23.looseObject({
|
|
6979
|
+
$schema: z23.optional(z23.string()),
|
|
6832
6980
|
...RulesyncMcpConfigSchema.shape
|
|
6833
6981
|
});
|
|
6834
6982
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
@@ -8031,25 +8179,25 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
8031
8179
|
// src/features/mcp/kilo-mcp.ts
|
|
8032
8180
|
import { join as join56 } from "path";
|
|
8033
8181
|
import { parse as parseJsonc3 } from "jsonc-parser";
|
|
8034
|
-
import { z as
|
|
8035
|
-
var KiloMcpLocalServerSchema =
|
|
8036
|
-
type:
|
|
8037
|
-
command:
|
|
8038
|
-
environment:
|
|
8039
|
-
enabled:
|
|
8040
|
-
cwd:
|
|
8182
|
+
import { z as z24 } from "zod/mini";
|
|
8183
|
+
var KiloMcpLocalServerSchema = z24.object({
|
|
8184
|
+
type: z24.literal("local"),
|
|
8185
|
+
command: z24.array(z24.string()),
|
|
8186
|
+
environment: z24.optional(z24.record(z24.string(), z24.string())),
|
|
8187
|
+
enabled: z24._default(z24.boolean(), true),
|
|
8188
|
+
cwd: z24.optional(z24.string())
|
|
8041
8189
|
});
|
|
8042
|
-
var KiloMcpRemoteServerSchema =
|
|
8043
|
-
type:
|
|
8044
|
-
url:
|
|
8045
|
-
headers:
|
|
8046
|
-
enabled:
|
|
8190
|
+
var KiloMcpRemoteServerSchema = z24.object({
|
|
8191
|
+
type: z24.literal("remote"),
|
|
8192
|
+
url: z24.string(),
|
|
8193
|
+
headers: z24.optional(z24.record(z24.string(), z24.string())),
|
|
8194
|
+
enabled: z24._default(z24.boolean(), true)
|
|
8047
8195
|
});
|
|
8048
|
-
var KiloMcpServerSchema =
|
|
8049
|
-
var KiloConfigSchema =
|
|
8050
|
-
$schema:
|
|
8051
|
-
mcp:
|
|
8052
|
-
tools:
|
|
8196
|
+
var KiloMcpServerSchema = z24.union([KiloMcpLocalServerSchema, KiloMcpRemoteServerSchema]);
|
|
8197
|
+
var KiloConfigSchema = z24.looseObject({
|
|
8198
|
+
$schema: z24.optional(z24.string()),
|
|
8199
|
+
mcp: z24.optional(z24.record(z24.string(), KiloMcpServerSchema)),
|
|
8200
|
+
tools: z24.optional(z24.record(z24.string(), z24.boolean()))
|
|
8053
8201
|
});
|
|
8054
8202
|
function convertFromKiloFormat(kiloMcp, tools) {
|
|
8055
8203
|
return Object.fromEntries(
|
|
@@ -8346,28 +8494,28 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
8346
8494
|
// src/features/mcp/opencode-mcp.ts
|
|
8347
8495
|
import { join as join58 } from "path";
|
|
8348
8496
|
import { parse as parseJsonc4 } from "jsonc-parser";
|
|
8349
|
-
import { z as
|
|
8350
|
-
var OpencodeMcpLocalServerSchema =
|
|
8351
|
-
type:
|
|
8352
|
-
command:
|
|
8353
|
-
environment:
|
|
8354
|
-
enabled:
|
|
8355
|
-
cwd:
|
|
8497
|
+
import { z as z25 } from "zod/mini";
|
|
8498
|
+
var OpencodeMcpLocalServerSchema = z25.object({
|
|
8499
|
+
type: z25.literal("local"),
|
|
8500
|
+
command: z25.array(z25.string()),
|
|
8501
|
+
environment: z25.optional(z25.record(z25.string(), z25.string())),
|
|
8502
|
+
enabled: z25._default(z25.boolean(), true),
|
|
8503
|
+
cwd: z25.optional(z25.string())
|
|
8356
8504
|
});
|
|
8357
|
-
var OpencodeMcpRemoteServerSchema =
|
|
8358
|
-
type:
|
|
8359
|
-
url:
|
|
8360
|
-
headers:
|
|
8361
|
-
enabled:
|
|
8505
|
+
var OpencodeMcpRemoteServerSchema = z25.object({
|
|
8506
|
+
type: z25.literal("remote"),
|
|
8507
|
+
url: z25.string(),
|
|
8508
|
+
headers: z25.optional(z25.record(z25.string(), z25.string())),
|
|
8509
|
+
enabled: z25._default(z25.boolean(), true)
|
|
8362
8510
|
});
|
|
8363
|
-
var OpencodeMcpServerSchema =
|
|
8511
|
+
var OpencodeMcpServerSchema = z25.union([
|
|
8364
8512
|
OpencodeMcpLocalServerSchema,
|
|
8365
8513
|
OpencodeMcpRemoteServerSchema
|
|
8366
8514
|
]);
|
|
8367
|
-
var OpencodeConfigSchema =
|
|
8368
|
-
$schema:
|
|
8369
|
-
mcp:
|
|
8370
|
-
tools:
|
|
8515
|
+
var OpencodeConfigSchema = z25.looseObject({
|
|
8516
|
+
$schema: z25.optional(z25.string()),
|
|
8517
|
+
mcp: z25.optional(z25.record(z25.string(), OpencodeMcpServerSchema)),
|
|
8518
|
+
tools: z25.optional(z25.record(z25.string(), z25.boolean()))
|
|
8371
8519
|
});
|
|
8372
8520
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
8373
8521
|
return Object.fromEntries(
|
|
@@ -8838,7 +8986,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
8838
8986
|
"roo",
|
|
8839
8987
|
"rovodev"
|
|
8840
8988
|
];
|
|
8841
|
-
var McpProcessorToolTargetSchema =
|
|
8989
|
+
var McpProcessorToolTargetSchema = z26.enum(mcpProcessorToolTargetTuple);
|
|
8842
8990
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
8843
8991
|
[
|
|
8844
8992
|
"claudecode",
|
|
@@ -9177,7 +9325,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
9177
9325
|
};
|
|
9178
9326
|
|
|
9179
9327
|
// src/features/permissions/permissions-processor.ts
|
|
9180
|
-
import { z as
|
|
9328
|
+
import { z as z31 } from "zod/mini";
|
|
9181
9329
|
|
|
9182
9330
|
// src/features/permissions/claudecode-permissions.ts
|
|
9183
9331
|
import { join as join62 } from "path";
|
|
@@ -9187,14 +9335,14 @@ import { uniq as uniq3 } from "es-toolkit";
|
|
|
9187
9335
|
import { join as join61 } from "path";
|
|
9188
9336
|
|
|
9189
9337
|
// src/types/permissions.ts
|
|
9190
|
-
import { z as
|
|
9191
|
-
var PermissionActionSchema =
|
|
9192
|
-
var PermissionRulesSchema =
|
|
9193
|
-
var PermissionsConfigSchema =
|
|
9194
|
-
permission:
|
|
9338
|
+
import { z as z27 } from "zod/mini";
|
|
9339
|
+
var PermissionActionSchema = z27.enum(["allow", "ask", "deny"]);
|
|
9340
|
+
var PermissionRulesSchema = z27.record(z27.string(), PermissionActionSchema);
|
|
9341
|
+
var PermissionsConfigSchema = z27.looseObject({
|
|
9342
|
+
permission: z27.record(z27.string(), PermissionRulesSchema)
|
|
9195
9343
|
});
|
|
9196
|
-
var RulesyncPermissionsFileSchema =
|
|
9197
|
-
$schema:
|
|
9344
|
+
var RulesyncPermissionsFileSchema = z27.looseObject({
|
|
9345
|
+
$schema: z27.optional(z27.string()),
|
|
9198
9346
|
...PermissionsConfigSchema.shape
|
|
9199
9347
|
});
|
|
9200
9348
|
|
|
@@ -9763,15 +9911,10 @@ function mapBashActionToDecision(action) {
|
|
|
9763
9911
|
|
|
9764
9912
|
// src/features/permissions/geminicli-permissions.ts
|
|
9765
9913
|
import { join as join64 } from "path";
|
|
9766
|
-
import
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
allowed: z29.optional(z29.array(z29.string())),
|
|
9771
|
-
exclude: z29.optional(z29.array(z29.string()))
|
|
9772
|
-
})
|
|
9773
|
-
)
|
|
9774
|
-
});
|
|
9914
|
+
import * as smolToml5 from "smol-toml";
|
|
9915
|
+
import { z as z28 } from "zod/mini";
|
|
9916
|
+
var GEMINICLI_POLICY_RELATIVE_DIR_PATH = join64(".gemini", "policies");
|
|
9917
|
+
var GEMINICLI_POLICY_FILE_NAME = "rulesync.toml";
|
|
9775
9918
|
var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
9776
9919
|
bash: "run_shell_command",
|
|
9777
9920
|
read: "read_file",
|
|
@@ -9779,16 +9922,32 @@ var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
|
9779
9922
|
write: "write_file",
|
|
9780
9923
|
webfetch: "web_fetch"
|
|
9781
9924
|
};
|
|
9925
|
+
var GEMINICLI_TO_RULESYNC_TOOL_NAME = Object.fromEntries(
|
|
9926
|
+
Object.entries(RULESYNC_TO_GEMINICLI_TOOL_NAME).map(([k, v]) => [v, k])
|
|
9927
|
+
);
|
|
9928
|
+
var PRIORITY_DENY = 1e6;
|
|
9929
|
+
var PRIORITY_ASK = 1e3;
|
|
9930
|
+
var PRIORITY_ALLOW = 1;
|
|
9931
|
+
var SINGLE_STAR_REGEX = '[^/\\"]*';
|
|
9932
|
+
var DOUBLE_STAR_REGEX = '[^\\"]*';
|
|
9933
|
+
var SINGLE_CHAR_REGEX = '[^/\\"]';
|
|
9934
|
+
var LEGACY_SINGLE_STAR_REGEX = '[^\\"]*';
|
|
9935
|
+
var LEGACY_DOUBLE_STAR_REGEX = ".*";
|
|
9936
|
+
var COMMAND_ARGS_ANCHOR = '"command":"';
|
|
9937
|
+
var VALUE_END_ANCHOR = '\\"';
|
|
9938
|
+
var RESERVED_OBJECT_KEYS = /* @__PURE__ */ new Set([
|
|
9939
|
+
"__proto__",
|
|
9940
|
+
"constructor",
|
|
9941
|
+
"prototype"
|
|
9942
|
+
]);
|
|
9943
|
+
var moduleLogger = new ConsoleLogger();
|
|
9782
9944
|
var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
9783
9945
|
static getSettablePaths(_options = {}) {
|
|
9784
9946
|
return {
|
|
9785
|
-
relativeDirPath:
|
|
9786
|
-
relativeFilePath:
|
|
9947
|
+
relativeDirPath: GEMINICLI_POLICY_RELATIVE_DIR_PATH,
|
|
9948
|
+
relativeFilePath: GEMINICLI_POLICY_FILE_NAME
|
|
9787
9949
|
};
|
|
9788
9950
|
}
|
|
9789
|
-
isDeletable() {
|
|
9790
|
-
return false;
|
|
9791
|
-
}
|
|
9792
9951
|
static async fromFile({
|
|
9793
9952
|
baseDir = process.cwd(),
|
|
9794
9953
|
validate = true,
|
|
@@ -9796,7 +9955,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9796
9955
|
}) {
|
|
9797
9956
|
const paths = this.getSettablePaths({ global });
|
|
9798
9957
|
const filePath = join64(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
9799
|
-
const fileContent = await readFileContentOrNull(filePath) ??
|
|
9958
|
+
const fileContent = await readFileContentOrNull(filePath) ?? "";
|
|
9800
9959
|
return new _GeminicliPermissions({
|
|
9801
9960
|
baseDir,
|
|
9802
9961
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -9805,63 +9964,72 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9805
9964
|
validate
|
|
9806
9965
|
});
|
|
9807
9966
|
}
|
|
9808
|
-
static
|
|
9967
|
+
static fromRulesyncPermissions({
|
|
9809
9968
|
baseDir = process.cwd(),
|
|
9810
9969
|
rulesyncPermissions,
|
|
9811
9970
|
validate = true,
|
|
9812
|
-
|
|
9813
|
-
|
|
9971
|
+
global = false,
|
|
9972
|
+
logger = moduleLogger
|
|
9814
9973
|
}) {
|
|
9815
9974
|
const paths = this.getSettablePaths({ global });
|
|
9816
|
-
const
|
|
9817
|
-
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
9818
|
-
const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
|
|
9819
|
-
if (!settingsResult.success) {
|
|
9820
|
-
throw new Error(
|
|
9821
|
-
`Failed to parse existing Gemini CLI settings at ${filePath}: ${formatError(settingsResult.error)}`
|
|
9822
|
-
);
|
|
9823
|
-
}
|
|
9824
|
-
const { allowed, exclude } = convertRulesyncToGeminicliTools({
|
|
9825
|
-
config: rulesyncPermissions.getJson(),
|
|
9826
|
-
logger
|
|
9827
|
-
});
|
|
9828
|
-
const merged = {
|
|
9829
|
-
...settingsResult.data,
|
|
9830
|
-
tools: {
|
|
9831
|
-
...settingsResult.data.tools,
|
|
9832
|
-
...allowed.length > 0 ? { allowed } : {},
|
|
9833
|
-
...exclude.length > 0 ? { exclude } : {}
|
|
9834
|
-
}
|
|
9835
|
-
};
|
|
9975
|
+
const fileContent = buildGeminicliPolicyContent(rulesyncPermissions.getJson(), logger);
|
|
9836
9976
|
return new _GeminicliPermissions({
|
|
9837
9977
|
baseDir,
|
|
9838
9978
|
relativeDirPath: paths.relativeDirPath,
|
|
9839
9979
|
relativeFilePath: paths.relativeFilePath,
|
|
9840
|
-
fileContent
|
|
9980
|
+
fileContent,
|
|
9841
9981
|
validate
|
|
9842
9982
|
});
|
|
9843
9983
|
}
|
|
9844
9984
|
toRulesyncPermissions() {
|
|
9845
|
-
let settings;
|
|
9846
|
-
try {
|
|
9847
|
-
const parsed = JSON.parse(this.getFileContent());
|
|
9848
|
-
settings = GeminiCliSettingsSchema.parse(parsed);
|
|
9849
|
-
} catch (error) {
|
|
9850
|
-
throw new Error(
|
|
9851
|
-
`Failed to parse Gemini CLI permissions content in ${join64(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
9852
|
-
{ cause: error }
|
|
9853
|
-
);
|
|
9854
|
-
}
|
|
9855
9985
|
const permission = {};
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9986
|
+
const fileContent = this.getFileContent();
|
|
9987
|
+
if (fileContent.trim().length > 0) {
|
|
9988
|
+
let parsed;
|
|
9989
|
+
try {
|
|
9990
|
+
parsed = smolToml5.parse(fileContent);
|
|
9991
|
+
} catch (error) {
|
|
9992
|
+
throw new Error(
|
|
9993
|
+
`Failed to parse Gemini CLI policy TOML in ${join64(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
9994
|
+
{ cause: error }
|
|
9995
|
+
);
|
|
9996
|
+
}
|
|
9997
|
+
const rules = extractRules(parsed, moduleLogger);
|
|
9998
|
+
for (const [index, rule] of rules.entries()) {
|
|
9999
|
+
const mappedCategory = Object.hasOwn(GEMINICLI_TO_RULESYNC_TOOL_NAME, rule.toolName) ? GEMINICLI_TO_RULESYNC_TOOL_NAME[rule.toolName] : void 0;
|
|
10000
|
+
const category = mappedCategory ?? rule.toolName;
|
|
10001
|
+
if (RESERVED_OBJECT_KEYS.has(category)) {
|
|
10002
|
+
moduleLogger.warn(
|
|
10003
|
+
`Skipping rule #${index} in ${this.getRelativeFilePath()}: toolName "${rule.toolName}" maps to a reserved object key ("${category}") and would risk prototype pollution.`
|
|
10004
|
+
);
|
|
10005
|
+
continue;
|
|
10006
|
+
}
|
|
10007
|
+
const action = mapFromGeminicliDecision(rule.decision);
|
|
10008
|
+
if (!action) {
|
|
10009
|
+
moduleLogger.warn(
|
|
10010
|
+
`Skipping rule #${index} (toolName="${rule.toolName}", commandPrefix=${JSON.stringify(rule.commandPrefix)}, argsPattern=${JSON.stringify(rule.argsPattern)}) in ${this.getRelativeFilePath()}: unknown decision ${JSON.stringify(rule.decision)}`
|
|
10011
|
+
);
|
|
10012
|
+
continue;
|
|
10013
|
+
}
|
|
10014
|
+
if (rule.toolName === "run_shell_command" && rule.commandPrefix !== void 0 && rule.argsPattern !== void 0) {
|
|
10015
|
+
moduleLogger.warn(
|
|
10016
|
+
`Rule #${index} in ${this.getRelativeFilePath()} sets both commandPrefix and argsPattern; rulesync will honor argsPattern and ignore commandPrefix=${JSON.stringify(rule.commandPrefix)}.`
|
|
10017
|
+
);
|
|
10018
|
+
}
|
|
10019
|
+
const pattern = extractPattern(rule);
|
|
10020
|
+
if (RESERVED_OBJECT_KEYS.has(pattern)) {
|
|
10021
|
+
moduleLogger.warn(
|
|
10022
|
+
`Skipping rule #${index} in ${this.getRelativeFilePath()}: pattern "${pattern}" is a reserved object key.`
|
|
10023
|
+
);
|
|
10024
|
+
continue;
|
|
10025
|
+
}
|
|
10026
|
+
const existing = Object.hasOwn(permission, category) ? permission[category] : void 0;
|
|
10027
|
+
const target = existing ?? {};
|
|
10028
|
+
if (existing === void 0) {
|
|
10029
|
+
permission[category] = target;
|
|
10030
|
+
}
|
|
10031
|
+
target[pattern] = action;
|
|
10032
|
+
}
|
|
9865
10033
|
}
|
|
9866
10034
|
return this.toRulesyncPermissionsDefault({
|
|
9867
10035
|
fileContent: JSON.stringify({ permission }, null, 2)
|
|
@@ -9879,60 +10047,248 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9879
10047
|
baseDir,
|
|
9880
10048
|
relativeDirPath,
|
|
9881
10049
|
relativeFilePath,
|
|
9882
|
-
fileContent:
|
|
10050
|
+
fileContent: "",
|
|
9883
10051
|
validate: false
|
|
9884
10052
|
});
|
|
9885
10053
|
}
|
|
9886
10054
|
};
|
|
9887
|
-
function
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
const allowed = [];
|
|
9892
|
-
const exclude = [];
|
|
9893
|
-
for (const [toolName, rules] of Object.entries(config.permission)) {
|
|
10055
|
+
function buildGeminicliPolicyContent(config, logger) {
|
|
10056
|
+
const rules = [];
|
|
10057
|
+
let order = 0;
|
|
10058
|
+
for (const [toolName, entries] of Object.entries(config.permission)) {
|
|
9894
10059
|
const mappedToolName = RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName] ?? toolName;
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
if (action === "ask") {
|
|
9900
|
-
logger?.warn(
|
|
9901
|
-
`Gemini CLI does not support explicit "ask" rules in settings. Skipping ${toolName}:${pattern}`
|
|
10060
|
+
for (const [pattern, action] of Object.entries(entries)) {
|
|
10061
|
+
if (pattern === "") {
|
|
10062
|
+
logger.warn(
|
|
10063
|
+
`Skipping rule "${toolName}: "": empty pattern is not a valid permission target and would silently match every invocation (bash) or nothing (other tools).`
|
|
9902
10064
|
);
|
|
9903
10065
|
continue;
|
|
9904
10066
|
}
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
10067
|
+
if (hasUnsafeAnchorChar(pattern)) {
|
|
10068
|
+
logger.warn(
|
|
10069
|
+
`Skipping rule "${toolName}: ${pattern}": pattern contains a character (" or \\) that would break JSON-anchor matching in the Gemini CLI Policy Engine.`
|
|
10070
|
+
);
|
|
10071
|
+
continue;
|
|
9910
10072
|
}
|
|
10073
|
+
const decision = mapToGeminicliDecision(action);
|
|
10074
|
+
if (mappedToolName === "run_shell_command" && (pattern === "*" || pattern === "**") && decision !== "ask_user") {
|
|
10075
|
+
logger.warn(
|
|
10076
|
+
`Skipping rule "${toolName}: ${pattern}" with decision ${decision}: bash match-all patterns are only supported with "ask" because they would otherwise affect every shell command.`
|
|
10077
|
+
);
|
|
10078
|
+
continue;
|
|
10079
|
+
}
|
|
10080
|
+
const currentRule = {
|
|
10081
|
+
toolName: mappedToolName,
|
|
10082
|
+
decision,
|
|
10083
|
+
priority: priorityForDecision(decision)
|
|
10084
|
+
};
|
|
10085
|
+
if (mappedToolName === "run_shell_command") {
|
|
10086
|
+
applyShellPattern({ rule: currentRule, pattern, toolName, logger });
|
|
10087
|
+
} else if (pattern !== "*") {
|
|
10088
|
+
currentRule.argsPattern = buildNonShellArgsPattern(pattern);
|
|
10089
|
+
}
|
|
10090
|
+
rules.push({ rule: currentRule, order: order++ });
|
|
9911
10091
|
}
|
|
9912
10092
|
}
|
|
9913
|
-
|
|
10093
|
+
rules.sort((a, b) => {
|
|
10094
|
+
const diff = toNumber(b.rule.priority) - toNumber(a.rule.priority);
|
|
10095
|
+
return diff !== 0 ? diff : a.order - b.order;
|
|
10096
|
+
});
|
|
10097
|
+
return smolToml5.stringify({ rule: rules.map((entry) => entry.rule) });
|
|
9914
10098
|
}
|
|
9915
|
-
function
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
return
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
10099
|
+
function buildNonShellArgsPattern(pattern) {
|
|
10100
|
+
return `"${globPatternToRegex(pattern)}${VALUE_END_ANCHOR}`;
|
|
10101
|
+
}
|
|
10102
|
+
function hasUnsafeAnchorChar(pattern) {
|
|
10103
|
+
return pattern.includes('"') || pattern.includes("\\");
|
|
10104
|
+
}
|
|
10105
|
+
function toNumber(value) {
|
|
10106
|
+
return typeof value === "number" ? value : 0;
|
|
10107
|
+
}
|
|
10108
|
+
function applyShellPattern({
|
|
10109
|
+
rule,
|
|
10110
|
+
pattern,
|
|
10111
|
+
toolName,
|
|
10112
|
+
logger
|
|
10113
|
+
}) {
|
|
10114
|
+
if (pattern === "*") {
|
|
10115
|
+
return;
|
|
10116
|
+
}
|
|
10117
|
+
const trailingWildcardStripped = pattern.endsWith(" *") ? pattern.slice(0, -2) : pattern;
|
|
10118
|
+
if (hasGlobMetacharacter(trailingWildcardStripped)) {
|
|
10119
|
+
rule.argsPattern = `${COMMAND_ARGS_ANCHOR}${globPatternToRegex(pattern)}`;
|
|
10120
|
+
logger.warn(
|
|
10121
|
+
`Gemini CLI does not support glob metacharacters inside a bash command prefix; emitting argsPattern for rule "${toolName}: ${pattern}".`
|
|
10122
|
+
);
|
|
10123
|
+
return;
|
|
10124
|
+
}
|
|
10125
|
+
rule.commandPrefix = trailingWildcardStripped;
|
|
10126
|
+
}
|
|
10127
|
+
function hasGlobMetacharacter(pattern) {
|
|
10128
|
+
return /[*?[\]]/.test(pattern);
|
|
10129
|
+
}
|
|
10130
|
+
function priorityForDecision(decision) {
|
|
10131
|
+
if (decision === "deny") return PRIORITY_DENY;
|
|
10132
|
+
if (decision === "ask_user") return PRIORITY_ASK;
|
|
10133
|
+
return PRIORITY_ALLOW;
|
|
10134
|
+
}
|
|
10135
|
+
function mapToGeminicliDecision(action) {
|
|
10136
|
+
if (action === "ask") {
|
|
10137
|
+
return "ask_user";
|
|
10138
|
+
}
|
|
10139
|
+
return action;
|
|
10140
|
+
}
|
|
10141
|
+
function mapFromGeminicliDecision(decision) {
|
|
10142
|
+
if (decision === "allow") return "allow";
|
|
10143
|
+
if (decision === "deny") return "deny";
|
|
10144
|
+
if (decision === "ask_user") return "ask";
|
|
10145
|
+
return null;
|
|
10146
|
+
}
|
|
10147
|
+
function globPatternToRegex(pattern) {
|
|
10148
|
+
let regex = "";
|
|
10149
|
+
let i = 0;
|
|
10150
|
+
while (i < pattern.length) {
|
|
10151
|
+
const char = pattern[i];
|
|
10152
|
+
if (char === void 0) {
|
|
10153
|
+
break;
|
|
10154
|
+
}
|
|
10155
|
+
if (char === "*" && pattern[i + 1] === "*") {
|
|
10156
|
+
regex += DOUBLE_STAR_REGEX;
|
|
10157
|
+
i += 2;
|
|
10158
|
+
continue;
|
|
10159
|
+
}
|
|
10160
|
+
if (char === "*") {
|
|
10161
|
+
regex += SINGLE_STAR_REGEX;
|
|
10162
|
+
i += 1;
|
|
10163
|
+
continue;
|
|
10164
|
+
}
|
|
10165
|
+
if (char === "?") {
|
|
10166
|
+
regex += SINGLE_CHAR_REGEX;
|
|
10167
|
+
i += 1;
|
|
10168
|
+
continue;
|
|
10169
|
+
}
|
|
10170
|
+
if (char === "[") {
|
|
10171
|
+
regex += escapeRegexChar(char);
|
|
10172
|
+
i += 1;
|
|
10173
|
+
continue;
|
|
10174
|
+
}
|
|
10175
|
+
if (char === "]") {
|
|
10176
|
+
regex += escapeRegexChar(char);
|
|
10177
|
+
i += 1;
|
|
10178
|
+
continue;
|
|
10179
|
+
}
|
|
10180
|
+
if (isRegexMetacharacter(char)) {
|
|
10181
|
+
regex += `\\${char}`;
|
|
10182
|
+
i += 1;
|
|
10183
|
+
continue;
|
|
10184
|
+
}
|
|
10185
|
+
regex += char;
|
|
10186
|
+
i += 1;
|
|
10187
|
+
}
|
|
10188
|
+
return regex;
|
|
10189
|
+
}
|
|
10190
|
+
function escapeRegexChar(char) {
|
|
10191
|
+
return `\\${char}`;
|
|
10192
|
+
}
|
|
10193
|
+
function isRegexMetacharacter(char) {
|
|
10194
|
+
return /[.+^${}()|\\]/.test(char);
|
|
10195
|
+
}
|
|
10196
|
+
function regexToGlobPattern(regex) {
|
|
10197
|
+
let source = regex;
|
|
10198
|
+
if (source.endsWith(VALUE_END_ANCHOR)) {
|
|
10199
|
+
source = source.slice(0, -VALUE_END_ANCHOR.length);
|
|
10200
|
+
}
|
|
10201
|
+
let glob = "";
|
|
10202
|
+
let i = 0;
|
|
10203
|
+
while (i < source.length) {
|
|
10204
|
+
if (source.startsWith(DOUBLE_STAR_REGEX, i)) {
|
|
10205
|
+
glob += "**";
|
|
10206
|
+
i += DOUBLE_STAR_REGEX.length;
|
|
10207
|
+
continue;
|
|
10208
|
+
}
|
|
10209
|
+
if (source.startsWith(LEGACY_DOUBLE_STAR_REGEX, i)) {
|
|
10210
|
+
glob += "**";
|
|
10211
|
+
i += LEGACY_DOUBLE_STAR_REGEX.length;
|
|
10212
|
+
continue;
|
|
10213
|
+
}
|
|
10214
|
+
if (source.startsWith(SINGLE_STAR_REGEX, i)) {
|
|
10215
|
+
glob += "*";
|
|
10216
|
+
i += SINGLE_STAR_REGEX.length;
|
|
10217
|
+
continue;
|
|
10218
|
+
}
|
|
10219
|
+
if (source.startsWith(LEGACY_SINGLE_STAR_REGEX, i)) {
|
|
10220
|
+
glob += "*";
|
|
10221
|
+
i += LEGACY_SINGLE_STAR_REGEX.length;
|
|
10222
|
+
continue;
|
|
10223
|
+
}
|
|
10224
|
+
if (source.startsWith(SINGLE_CHAR_REGEX, i)) {
|
|
10225
|
+
glob += "?";
|
|
10226
|
+
i += SINGLE_CHAR_REGEX.length;
|
|
10227
|
+
continue;
|
|
10228
|
+
}
|
|
10229
|
+
const char = source[i];
|
|
10230
|
+
if (char === "\\") {
|
|
10231
|
+
const escaped = source[i + 1];
|
|
10232
|
+
if (escaped !== void 0) {
|
|
10233
|
+
glob += escaped;
|
|
10234
|
+
i += 2;
|
|
10235
|
+
continue;
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
glob += char ?? "";
|
|
10239
|
+
i += 1;
|
|
10240
|
+
}
|
|
10241
|
+
return glob;
|
|
10242
|
+
}
|
|
10243
|
+
var GeminicliPolicyRuleSchema = z28.looseObject({
|
|
10244
|
+
toolName: z28.string(),
|
|
10245
|
+
decision: z28.optional(z28.unknown()),
|
|
10246
|
+
commandPrefix: z28.optional(z28.string()),
|
|
10247
|
+
argsPattern: z28.optional(z28.string())
|
|
10248
|
+
});
|
|
10249
|
+
var GeminicliPolicyFileSchema = z28.looseObject({
|
|
10250
|
+
rule: z28.optional(z28.array(z28.looseObject({})))
|
|
10251
|
+
});
|
|
10252
|
+
function extractRules(parsed, logger) {
|
|
10253
|
+
const parsedFile = GeminicliPolicyFileSchema.safeParse(parsed);
|
|
10254
|
+
if (!parsedFile.success || !parsedFile.data.rule) {
|
|
10255
|
+
return [];
|
|
10256
|
+
}
|
|
10257
|
+
const rules = [];
|
|
10258
|
+
for (const [index, entry] of parsedFile.data.rule.entries()) {
|
|
10259
|
+
const result = GeminicliPolicyRuleSchema.safeParse(entry);
|
|
10260
|
+
if (result.success) {
|
|
10261
|
+
rules.push(result.data);
|
|
10262
|
+
continue;
|
|
10263
|
+
}
|
|
10264
|
+
logger.warn(
|
|
10265
|
+
`Skipping malformed Gemini CLI policy rule at index ${index}: ${formatError(result.error)}`
|
|
10266
|
+
);
|
|
10267
|
+
}
|
|
10268
|
+
return rules;
|
|
10269
|
+
}
|
|
10270
|
+
function extractPattern(rule) {
|
|
10271
|
+
if (rule.toolName === "run_shell_command") {
|
|
10272
|
+
if (rule.argsPattern) {
|
|
10273
|
+
const stripped = rule.argsPattern.startsWith(COMMAND_ARGS_ANCHOR) ? rule.argsPattern.slice(COMMAND_ARGS_ANCHOR.length) : rule.argsPattern;
|
|
10274
|
+
return regexToGlobPattern(stripped);
|
|
10275
|
+
}
|
|
10276
|
+
if (!rule.commandPrefix) return "*";
|
|
10277
|
+
return rule.commandPrefix.endsWith(" *") || rule.commandPrefix.endsWith("*") ? rule.commandPrefix : `${rule.commandPrefix} *`;
|
|
10278
|
+
}
|
|
10279
|
+
if (!rule.argsPattern) return "*";
|
|
10280
|
+
const regex = rule.argsPattern.startsWith('"') ? rule.argsPattern.slice(1) : rule.argsPattern;
|
|
10281
|
+
return regexToGlobPattern(regex);
|
|
9926
10282
|
}
|
|
9927
10283
|
|
|
9928
10284
|
// src/features/permissions/kiro-permissions.ts
|
|
9929
10285
|
import { join as join65 } from "path";
|
|
9930
|
-
import { z as
|
|
9931
|
-
var KiroAgentSchema =
|
|
9932
|
-
allowedTools:
|
|
9933
|
-
toolsSettings:
|
|
10286
|
+
import { z as z29 } from "zod/mini";
|
|
10287
|
+
var KiroAgentSchema = z29.looseObject({
|
|
10288
|
+
allowedTools: z29.optional(z29.array(z29.string())),
|
|
10289
|
+
toolsSettings: z29.optional(z29.record(z29.string(), z29.unknown()))
|
|
9934
10290
|
});
|
|
9935
|
-
var UnknownRecordSchema =
|
|
10291
|
+
var UnknownRecordSchema = z29.record(z29.string(), z29.unknown());
|
|
9936
10292
|
var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
9937
10293
|
static getSettablePaths(_options = {}) {
|
|
9938
10294
|
return {
|
|
@@ -10085,8 +10441,12 @@ function buildKiroPermissionsFromRulesync({
|
|
|
10085
10441
|
);
|
|
10086
10442
|
continue;
|
|
10087
10443
|
}
|
|
10088
|
-
|
|
10089
|
-
|
|
10444
|
+
const toolName = category === "webfetch" ? "web_fetch" : "web_search";
|
|
10445
|
+
if (action === "allow") {
|
|
10446
|
+
nextAllowedTools.add(toolName);
|
|
10447
|
+
} else {
|
|
10448
|
+
nextAllowedTools.delete(toolName);
|
|
10449
|
+
}
|
|
10090
10450
|
} else {
|
|
10091
10451
|
logger?.warn(`Kiro permissions do not support category: ${category}. Skipping.`);
|
|
10092
10452
|
}
|
|
@@ -10112,13 +10472,13 @@ function asStringArray(value) {
|
|
|
10112
10472
|
// src/features/permissions/opencode-permissions.ts
|
|
10113
10473
|
import { join as join66 } from "path";
|
|
10114
10474
|
import { parse as parseJsonc5 } from "jsonc-parser";
|
|
10115
|
-
import { z as
|
|
10116
|
-
var OpencodePermissionSchema =
|
|
10117
|
-
|
|
10118
|
-
|
|
10475
|
+
import { z as z30 } from "zod/mini";
|
|
10476
|
+
var OpencodePermissionSchema = z30.union([
|
|
10477
|
+
z30.enum(["allow", "ask", "deny"]),
|
|
10478
|
+
z30.record(z30.string(), z30.enum(["allow", "ask", "deny"]))
|
|
10119
10479
|
]);
|
|
10120
|
-
var OpencodePermissionsConfigSchema =
|
|
10121
|
-
permission:
|
|
10480
|
+
var OpencodePermissionsConfigSchema = z30.looseObject({
|
|
10481
|
+
permission: z30.optional(z30.record(z30.string(), OpencodePermissionSchema))
|
|
10122
10482
|
});
|
|
10123
10483
|
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
10124
10484
|
json;
|
|
@@ -10249,7 +10609,7 @@ var permissionsProcessorToolTargetTuple = [
|
|
|
10249
10609
|
"kiro",
|
|
10250
10610
|
"opencode"
|
|
10251
10611
|
];
|
|
10252
|
-
var PermissionsProcessorToolTargetSchema =
|
|
10612
|
+
var PermissionsProcessorToolTargetSchema = z31.enum(permissionsProcessorToolTargetTuple);
|
|
10253
10613
|
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
10254
10614
|
[
|
|
10255
10615
|
"claudecode",
|
|
@@ -10414,7 +10774,7 @@ var PermissionsProcessor = class extends FeatureProcessor {
|
|
|
10414
10774
|
// src/features/rules/rules-processor.ts
|
|
10415
10775
|
import { basename as basename10, dirname as dirname3, join as join137, relative as relative5 } from "path";
|
|
10416
10776
|
import { encode } from "@toon-format/toon";
|
|
10417
|
-
import { z as
|
|
10777
|
+
import { z as z71 } from "zod/mini";
|
|
10418
10778
|
|
|
10419
10779
|
// src/constants/general.ts
|
|
10420
10780
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -10424,7 +10784,7 @@ import { join as join70 } from "path";
|
|
|
10424
10784
|
|
|
10425
10785
|
// src/features/skills/simulated-skill.ts
|
|
10426
10786
|
import { join as join69 } from "path";
|
|
10427
|
-
import { z as
|
|
10787
|
+
import { z as z32 } from "zod/mini";
|
|
10428
10788
|
|
|
10429
10789
|
// src/features/skills/tool-skill.ts
|
|
10430
10790
|
import { join as join68 } from "path";
|
|
@@ -10661,9 +11021,9 @@ var ToolSkill = class extends AiDir {
|
|
|
10661
11021
|
};
|
|
10662
11022
|
|
|
10663
11023
|
// src/features/skills/simulated-skill.ts
|
|
10664
|
-
var SimulatedSkillFrontmatterSchema =
|
|
10665
|
-
name:
|
|
10666
|
-
description:
|
|
11024
|
+
var SimulatedSkillFrontmatterSchema = z32.looseObject({
|
|
11025
|
+
name: z32.string(),
|
|
11026
|
+
description: z32.string()
|
|
10667
11027
|
});
|
|
10668
11028
|
var SimulatedSkill = class extends ToolSkill {
|
|
10669
11029
|
frontmatter;
|
|
@@ -10890,49 +11250,49 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
10890
11250
|
|
|
10891
11251
|
// src/features/skills/rovodev-skill.ts
|
|
10892
11252
|
import { join as join73 } from "path";
|
|
10893
|
-
import { z as
|
|
11253
|
+
import { z as z34 } from "zod/mini";
|
|
10894
11254
|
|
|
10895
11255
|
// src/features/skills/rulesync-skill.ts
|
|
10896
11256
|
import { join as join72 } from "path";
|
|
10897
|
-
import { z as
|
|
10898
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
10899
|
-
name:
|
|
10900
|
-
description:
|
|
10901
|
-
targets:
|
|
10902
|
-
claudecode:
|
|
10903
|
-
|
|
10904
|
-
"allowed-tools":
|
|
10905
|
-
model:
|
|
10906
|
-
"disable-model-invocation":
|
|
11257
|
+
import { z as z33 } from "zod/mini";
|
|
11258
|
+
var RulesyncSkillFrontmatterSchemaInternal = z33.looseObject({
|
|
11259
|
+
name: z33.string(),
|
|
11260
|
+
description: z33.string(),
|
|
11261
|
+
targets: z33._default(RulesyncTargetsSchema, ["*"]),
|
|
11262
|
+
claudecode: z33.optional(
|
|
11263
|
+
z33.looseObject({
|
|
11264
|
+
"allowed-tools": z33.optional(z33.array(z33.string())),
|
|
11265
|
+
model: z33.optional(z33.string()),
|
|
11266
|
+
"disable-model-invocation": z33.optional(z33.boolean())
|
|
10907
11267
|
})
|
|
10908
11268
|
),
|
|
10909
|
-
codexcli:
|
|
10910
|
-
|
|
10911
|
-
"short-description":
|
|
11269
|
+
codexcli: z33.optional(
|
|
11270
|
+
z33.looseObject({
|
|
11271
|
+
"short-description": z33.optional(z33.string())
|
|
10912
11272
|
})
|
|
10913
11273
|
),
|
|
10914
|
-
opencode:
|
|
10915
|
-
|
|
10916
|
-
"allowed-tools":
|
|
11274
|
+
opencode: z33.optional(
|
|
11275
|
+
z33.looseObject({
|
|
11276
|
+
"allowed-tools": z33.optional(z33.array(z33.string()))
|
|
10917
11277
|
})
|
|
10918
11278
|
),
|
|
10919
|
-
kilo:
|
|
10920
|
-
|
|
10921
|
-
"allowed-tools":
|
|
11279
|
+
kilo: z33.optional(
|
|
11280
|
+
z33.looseObject({
|
|
11281
|
+
"allowed-tools": z33.optional(z33.array(z33.string()))
|
|
10922
11282
|
})
|
|
10923
11283
|
),
|
|
10924
|
-
deepagents:
|
|
10925
|
-
|
|
10926
|
-
"allowed-tools":
|
|
11284
|
+
deepagents: z33.optional(
|
|
11285
|
+
z33.looseObject({
|
|
11286
|
+
"allowed-tools": z33.optional(z33.array(z33.string()))
|
|
10927
11287
|
})
|
|
10928
11288
|
),
|
|
10929
|
-
copilot:
|
|
10930
|
-
|
|
10931
|
-
license:
|
|
11289
|
+
copilot: z33.optional(
|
|
11290
|
+
z33.looseObject({
|
|
11291
|
+
license: z33.optional(z33.string())
|
|
10932
11292
|
})
|
|
10933
11293
|
),
|
|
10934
|
-
cline:
|
|
10935
|
-
roo:
|
|
11294
|
+
cline: z33.optional(z33.looseObject({})),
|
|
11295
|
+
roo: z33.optional(z33.looseObject({}))
|
|
10936
11296
|
});
|
|
10937
11297
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
10938
11298
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -11029,9 +11389,9 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
11029
11389
|
};
|
|
11030
11390
|
|
|
11031
11391
|
// src/features/skills/rovodev-skill.ts
|
|
11032
|
-
var RovodevSkillFrontmatterSchema =
|
|
11033
|
-
name:
|
|
11034
|
-
description:
|
|
11392
|
+
var RovodevSkillFrontmatterSchema = z34.looseObject({
|
|
11393
|
+
name: z34.string(),
|
|
11394
|
+
description: z34.string()
|
|
11035
11395
|
});
|
|
11036
11396
|
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
11037
11397
|
constructor({
|
|
@@ -11203,7 +11563,7 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
11203
11563
|
|
|
11204
11564
|
// src/features/skills/skills-processor.ts
|
|
11205
11565
|
import { basename as basename5, join as join92 } from "path";
|
|
11206
|
-
import { z as
|
|
11566
|
+
import { z as z51 } from "zod/mini";
|
|
11207
11567
|
|
|
11208
11568
|
// src/types/dir-feature-processor.ts
|
|
11209
11569
|
import { join as join74 } from "path";
|
|
@@ -11342,10 +11702,10 @@ var DirFeatureProcessor = class {
|
|
|
11342
11702
|
|
|
11343
11703
|
// src/features/skills/agentsskills-skill.ts
|
|
11344
11704
|
import { join as join75 } from "path";
|
|
11345
|
-
import { z as
|
|
11346
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
11347
|
-
name:
|
|
11348
|
-
description:
|
|
11705
|
+
import { z as z35 } from "zod/mini";
|
|
11706
|
+
var AgentsSkillsSkillFrontmatterSchema = z35.looseObject({
|
|
11707
|
+
name: z35.string(),
|
|
11708
|
+
description: z35.string()
|
|
11349
11709
|
});
|
|
11350
11710
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
11351
11711
|
constructor({
|
|
@@ -11500,10 +11860,10 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
11500
11860
|
|
|
11501
11861
|
// src/features/skills/antigravity-skill.ts
|
|
11502
11862
|
import { join as join76 } from "path";
|
|
11503
|
-
import { z as
|
|
11504
|
-
var AntigravitySkillFrontmatterSchema =
|
|
11505
|
-
name:
|
|
11506
|
-
description:
|
|
11863
|
+
import { z as z36 } from "zod/mini";
|
|
11864
|
+
var AntigravitySkillFrontmatterSchema = z36.looseObject({
|
|
11865
|
+
name: z36.string(),
|
|
11866
|
+
description: z36.string()
|
|
11507
11867
|
});
|
|
11508
11868
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
11509
11869
|
constructor({
|
|
@@ -11661,13 +12021,13 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
11661
12021
|
|
|
11662
12022
|
// src/features/skills/claudecode-skill.ts
|
|
11663
12023
|
import { join as join77 } from "path";
|
|
11664
|
-
import { z as
|
|
11665
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
11666
|
-
name:
|
|
11667
|
-
description:
|
|
11668
|
-
"allowed-tools":
|
|
11669
|
-
model:
|
|
11670
|
-
"disable-model-invocation":
|
|
12024
|
+
import { z as z37 } from "zod/mini";
|
|
12025
|
+
var ClaudecodeSkillFrontmatterSchema = z37.looseObject({
|
|
12026
|
+
name: z37.string(),
|
|
12027
|
+
description: z37.string(),
|
|
12028
|
+
"allowed-tools": z37.optional(z37.array(z37.string())),
|
|
12029
|
+
model: z37.optional(z37.string()),
|
|
12030
|
+
"disable-model-invocation": z37.optional(z37.boolean())
|
|
11671
12031
|
});
|
|
11672
12032
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
11673
12033
|
constructor({
|
|
@@ -11837,10 +12197,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
11837
12197
|
|
|
11838
12198
|
// src/features/skills/cline-skill.ts
|
|
11839
12199
|
import { join as join78 } from "path";
|
|
11840
|
-
import { z as
|
|
11841
|
-
var ClineSkillFrontmatterSchema =
|
|
11842
|
-
name:
|
|
11843
|
-
description:
|
|
12200
|
+
import { z as z38 } from "zod/mini";
|
|
12201
|
+
var ClineSkillFrontmatterSchema = z38.looseObject({
|
|
12202
|
+
name: z38.string(),
|
|
12203
|
+
description: z38.string()
|
|
11844
12204
|
});
|
|
11845
12205
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
11846
12206
|
constructor({
|
|
@@ -12010,13 +12370,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
12010
12370
|
|
|
12011
12371
|
// src/features/skills/codexcli-skill.ts
|
|
12012
12372
|
import { join as join79 } from "path";
|
|
12013
|
-
import { z as
|
|
12014
|
-
var CodexCliSkillFrontmatterSchema =
|
|
12015
|
-
name:
|
|
12016
|
-
description:
|
|
12017
|
-
metadata:
|
|
12018
|
-
|
|
12019
|
-
"short-description":
|
|
12373
|
+
import { z as z39 } from "zod/mini";
|
|
12374
|
+
var CodexCliSkillFrontmatterSchema = z39.looseObject({
|
|
12375
|
+
name: z39.string(),
|
|
12376
|
+
description: z39.string(),
|
|
12377
|
+
metadata: z39.optional(
|
|
12378
|
+
z39.looseObject({
|
|
12379
|
+
"short-description": z39.optional(z39.string())
|
|
12020
12380
|
})
|
|
12021
12381
|
)
|
|
12022
12382
|
});
|
|
@@ -12181,11 +12541,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
12181
12541
|
|
|
12182
12542
|
// src/features/skills/copilot-skill.ts
|
|
12183
12543
|
import { join as join80 } from "path";
|
|
12184
|
-
import { z as
|
|
12185
|
-
var CopilotSkillFrontmatterSchema =
|
|
12186
|
-
name:
|
|
12187
|
-
description:
|
|
12188
|
-
license:
|
|
12544
|
+
import { z as z40 } from "zod/mini";
|
|
12545
|
+
var CopilotSkillFrontmatterSchema = z40.looseObject({
|
|
12546
|
+
name: z40.string(),
|
|
12547
|
+
description: z40.string(),
|
|
12548
|
+
license: z40.optional(z40.string())
|
|
12189
12549
|
});
|
|
12190
12550
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
12191
12551
|
constructor({
|
|
@@ -12346,10 +12706,10 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
12346
12706
|
|
|
12347
12707
|
// src/features/skills/cursor-skill.ts
|
|
12348
12708
|
import { join as join81 } from "path";
|
|
12349
|
-
import { z as
|
|
12350
|
-
var CursorSkillFrontmatterSchema =
|
|
12351
|
-
name:
|
|
12352
|
-
description:
|
|
12709
|
+
import { z as z41 } from "zod/mini";
|
|
12710
|
+
var CursorSkillFrontmatterSchema = z41.looseObject({
|
|
12711
|
+
name: z41.string(),
|
|
12712
|
+
description: z41.string()
|
|
12353
12713
|
});
|
|
12354
12714
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
12355
12715
|
constructor({
|
|
@@ -12501,11 +12861,11 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
12501
12861
|
|
|
12502
12862
|
// src/features/skills/deepagents-skill.ts
|
|
12503
12863
|
import { join as join82 } from "path";
|
|
12504
|
-
import { z as
|
|
12505
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
12506
|
-
name:
|
|
12507
|
-
description:
|
|
12508
|
-
"allowed-tools":
|
|
12864
|
+
import { z as z42 } from "zod/mini";
|
|
12865
|
+
var DeepagentsSkillFrontmatterSchema = z42.looseObject({
|
|
12866
|
+
name: z42.string(),
|
|
12867
|
+
description: z42.string(),
|
|
12868
|
+
"allowed-tools": z42.optional(z42.array(z42.string()))
|
|
12509
12869
|
});
|
|
12510
12870
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
12511
12871
|
constructor({
|
|
@@ -12663,10 +13023,10 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
12663
13023
|
|
|
12664
13024
|
// src/features/skills/geminicli-skill.ts
|
|
12665
13025
|
import { join as join83 } from "path";
|
|
12666
|
-
import { z as
|
|
12667
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
12668
|
-
name:
|
|
12669
|
-
description:
|
|
13026
|
+
import { z as z43 } from "zod/mini";
|
|
13027
|
+
var GeminiCliSkillFrontmatterSchema = z43.looseObject({
|
|
13028
|
+
name: z43.string(),
|
|
13029
|
+
description: z43.string()
|
|
12670
13030
|
});
|
|
12671
13031
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
12672
13032
|
constructor({
|
|
@@ -12820,10 +13180,10 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
12820
13180
|
|
|
12821
13181
|
// src/features/skills/junie-skill.ts
|
|
12822
13182
|
import { join as join84 } from "path";
|
|
12823
|
-
import { z as
|
|
12824
|
-
var JunieSkillFrontmatterSchema =
|
|
12825
|
-
name:
|
|
12826
|
-
description:
|
|
13183
|
+
import { z as z44 } from "zod/mini";
|
|
13184
|
+
var JunieSkillFrontmatterSchema = z44.looseObject({
|
|
13185
|
+
name: z44.string(),
|
|
13186
|
+
description: z44.string()
|
|
12827
13187
|
});
|
|
12828
13188
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
12829
13189
|
constructor({
|
|
@@ -12996,11 +13356,11 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
12996
13356
|
|
|
12997
13357
|
// src/features/skills/kilo-skill.ts
|
|
12998
13358
|
import { join as join85 } from "path";
|
|
12999
|
-
import { z as
|
|
13000
|
-
var KiloSkillFrontmatterSchema =
|
|
13001
|
-
name:
|
|
13002
|
-
description:
|
|
13003
|
-
"allowed-tools":
|
|
13359
|
+
import { z as z45 } from "zod/mini";
|
|
13360
|
+
var KiloSkillFrontmatterSchema = z45.looseObject({
|
|
13361
|
+
name: z45.string(),
|
|
13362
|
+
description: z45.string(),
|
|
13363
|
+
"allowed-tools": z45.optional(z45.array(z45.string()))
|
|
13004
13364
|
});
|
|
13005
13365
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
13006
13366
|
constructor({
|
|
@@ -13157,10 +13517,10 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
13157
13517
|
|
|
13158
13518
|
// src/features/skills/kiro-skill.ts
|
|
13159
13519
|
import { join as join86 } from "path";
|
|
13160
|
-
import { z as
|
|
13161
|
-
var KiroSkillFrontmatterSchema =
|
|
13162
|
-
name:
|
|
13163
|
-
description:
|
|
13520
|
+
import { z as z46 } from "zod/mini";
|
|
13521
|
+
var KiroSkillFrontmatterSchema = z46.looseObject({
|
|
13522
|
+
name: z46.string(),
|
|
13523
|
+
description: z46.string()
|
|
13164
13524
|
});
|
|
13165
13525
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
13166
13526
|
constructor({
|
|
@@ -13334,11 +13694,11 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
13334
13694
|
|
|
13335
13695
|
// src/features/skills/opencode-skill.ts
|
|
13336
13696
|
import { join as join87 } from "path";
|
|
13337
|
-
import { z as
|
|
13338
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
13339
|
-
name:
|
|
13340
|
-
description:
|
|
13341
|
-
"allowed-tools":
|
|
13697
|
+
import { z as z47 } from "zod/mini";
|
|
13698
|
+
var OpenCodeSkillFrontmatterSchema = z47.looseObject({
|
|
13699
|
+
name: z47.string(),
|
|
13700
|
+
description: z47.string(),
|
|
13701
|
+
"allowed-tools": z47.optional(z47.array(z47.string()))
|
|
13342
13702
|
});
|
|
13343
13703
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
13344
13704
|
constructor({
|
|
@@ -13495,10 +13855,10 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
13495
13855
|
|
|
13496
13856
|
// src/features/skills/replit-skill.ts
|
|
13497
13857
|
import { join as join88 } from "path";
|
|
13498
|
-
import { z as
|
|
13499
|
-
var ReplitSkillFrontmatterSchema =
|
|
13500
|
-
name:
|
|
13501
|
-
description:
|
|
13858
|
+
import { z as z48 } from "zod/mini";
|
|
13859
|
+
var ReplitSkillFrontmatterSchema = z48.looseObject({
|
|
13860
|
+
name: z48.string(),
|
|
13861
|
+
description: z48.string()
|
|
13502
13862
|
});
|
|
13503
13863
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
13504
13864
|
constructor({
|
|
@@ -13653,10 +14013,10 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
13653
14013
|
|
|
13654
14014
|
// src/features/skills/roo-skill.ts
|
|
13655
14015
|
import { join as join89 } from "path";
|
|
13656
|
-
import { z as
|
|
13657
|
-
var RooSkillFrontmatterSchema =
|
|
13658
|
-
name:
|
|
13659
|
-
description:
|
|
14016
|
+
import { z as z49 } from "zod/mini";
|
|
14017
|
+
var RooSkillFrontmatterSchema = z49.looseObject({
|
|
14018
|
+
name: z49.string(),
|
|
14019
|
+
description: z49.string()
|
|
13660
14020
|
});
|
|
13661
14021
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
13662
14022
|
constructor({
|
|
@@ -13845,10 +14205,10 @@ async function getLocalSkillDirNames(baseDir) {
|
|
|
13845
14205
|
|
|
13846
14206
|
// src/features/skills/windsurf-skill.ts
|
|
13847
14207
|
import { join as join91 } from "path";
|
|
13848
|
-
import { z as
|
|
13849
|
-
var WindsurfSkillFrontmatterSchema =
|
|
13850
|
-
name:
|
|
13851
|
-
description:
|
|
14208
|
+
import { z as z50 } from "zod/mini";
|
|
14209
|
+
var WindsurfSkillFrontmatterSchema = z50.looseObject({
|
|
14210
|
+
name: z50.string(),
|
|
14211
|
+
description: z50.string()
|
|
13852
14212
|
});
|
|
13853
14213
|
var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
13854
14214
|
constructor({
|
|
@@ -14026,7 +14386,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
14026
14386
|
"rovodev",
|
|
14027
14387
|
"windsurf"
|
|
14028
14388
|
];
|
|
14029
|
-
var SkillsProcessorToolTargetSchema =
|
|
14389
|
+
var SkillsProcessorToolTargetSchema = z51.enum(skillsProcessorToolTargetTuple);
|
|
14030
14390
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
14031
14391
|
[
|
|
14032
14392
|
"agentsmd",
|
|
@@ -14405,7 +14765,7 @@ import { join as join94 } from "path";
|
|
|
14405
14765
|
|
|
14406
14766
|
// src/features/subagents/simulated-subagent.ts
|
|
14407
14767
|
import { basename as basename6, join as join93 } from "path";
|
|
14408
|
-
import { z as
|
|
14768
|
+
import { z as z52 } from "zod/mini";
|
|
14409
14769
|
|
|
14410
14770
|
// src/features/subagents/tool-subagent.ts
|
|
14411
14771
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -14457,9 +14817,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
14457
14817
|
};
|
|
14458
14818
|
|
|
14459
14819
|
// src/features/subagents/simulated-subagent.ts
|
|
14460
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
14461
|
-
name:
|
|
14462
|
-
description:
|
|
14820
|
+
var SimulatedSubagentFrontmatterSchema = z52.object({
|
|
14821
|
+
name: z52.string(),
|
|
14822
|
+
description: z52.optional(z52.string())
|
|
14463
14823
|
});
|
|
14464
14824
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
14465
14825
|
frontmatter;
|
|
@@ -14617,15 +14977,15 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
14617
14977
|
|
|
14618
14978
|
// src/features/subagents/geminicli-subagent.ts
|
|
14619
14979
|
import { join as join97 } from "path";
|
|
14620
|
-
import { z as
|
|
14980
|
+
import { z as z54 } from "zod/mini";
|
|
14621
14981
|
|
|
14622
14982
|
// src/features/subagents/rulesync-subagent.ts
|
|
14623
14983
|
import { basename as basename7, join as join96 } from "path";
|
|
14624
|
-
import { z as
|
|
14625
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
14626
|
-
targets:
|
|
14627
|
-
name:
|
|
14628
|
-
description:
|
|
14984
|
+
import { z as z53 } from "zod/mini";
|
|
14985
|
+
var RulesyncSubagentFrontmatterSchema = z53.looseObject({
|
|
14986
|
+
targets: z53._default(RulesyncTargetsSchema, ["*"]),
|
|
14987
|
+
name: z53.string(),
|
|
14988
|
+
description: z53.optional(z53.string())
|
|
14629
14989
|
});
|
|
14630
14990
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
14631
14991
|
frontmatter;
|
|
@@ -14694,9 +15054,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
14694
15054
|
};
|
|
14695
15055
|
|
|
14696
15056
|
// src/features/subagents/geminicli-subagent.ts
|
|
14697
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
14698
|
-
name:
|
|
14699
|
-
description:
|
|
15057
|
+
var GeminiCliSubagentFrontmatterSchema = z54.looseObject({
|
|
15058
|
+
name: z54.string(),
|
|
15059
|
+
description: z54.optional(z54.string())
|
|
14700
15060
|
});
|
|
14701
15061
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
14702
15062
|
frontmatter;
|
|
@@ -14869,10 +15229,10 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
14869
15229
|
|
|
14870
15230
|
// src/features/subagents/rovodev-subagent.ts
|
|
14871
15231
|
import { join as join99 } from "path";
|
|
14872
|
-
import { z as
|
|
14873
|
-
var RovodevSubagentFrontmatterSchema =
|
|
14874
|
-
name:
|
|
14875
|
-
description:
|
|
15232
|
+
import { z as z55 } from "zod/mini";
|
|
15233
|
+
var RovodevSubagentFrontmatterSchema = z55.looseObject({
|
|
15234
|
+
name: z55.string(),
|
|
15235
|
+
description: z55.optional(z55.string())
|
|
14876
15236
|
});
|
|
14877
15237
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
14878
15238
|
frontmatter;
|
|
@@ -15014,18 +15374,18 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
15014
15374
|
|
|
15015
15375
|
// src/features/subagents/subagents-processor.ts
|
|
15016
15376
|
import { basename as basename9, join as join110 } from "path";
|
|
15017
|
-
import { z as
|
|
15377
|
+
import { z as z64 } from "zod/mini";
|
|
15018
15378
|
|
|
15019
15379
|
// src/features/subagents/claudecode-subagent.ts
|
|
15020
15380
|
import { join as join100 } from "path";
|
|
15021
|
-
import { z as
|
|
15022
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
15023
|
-
name:
|
|
15024
|
-
description:
|
|
15025
|
-
model:
|
|
15026
|
-
tools:
|
|
15027
|
-
permissionMode:
|
|
15028
|
-
skills:
|
|
15381
|
+
import { z as z56 } from "zod/mini";
|
|
15382
|
+
var ClaudecodeSubagentFrontmatterSchema = z56.looseObject({
|
|
15383
|
+
name: z56.string(),
|
|
15384
|
+
description: z56.optional(z56.string()),
|
|
15385
|
+
model: z56.optional(z56.string()),
|
|
15386
|
+
tools: z56.optional(z56.union([z56.string(), z56.array(z56.string())])),
|
|
15387
|
+
permissionMode: z56.optional(z56.string()),
|
|
15388
|
+
skills: z56.optional(z56.union([z56.string(), z56.array(z56.string())]))
|
|
15029
15389
|
});
|
|
15030
15390
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
15031
15391
|
frontmatter;
|
|
@@ -15180,25 +15540,25 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
15180
15540
|
|
|
15181
15541
|
// src/features/subagents/codexcli-subagent.ts
|
|
15182
15542
|
import { join as join101 } from "path";
|
|
15183
|
-
import * as
|
|
15184
|
-
import { z as
|
|
15185
|
-
var CodexCliSubagentTomlSchema =
|
|
15186
|
-
name:
|
|
15187
|
-
description:
|
|
15188
|
-
developer_instructions:
|
|
15189
|
-
model:
|
|
15190
|
-
model_reasoning_effort:
|
|
15191
|
-
sandbox_mode:
|
|
15543
|
+
import * as smolToml6 from "smol-toml";
|
|
15544
|
+
import { z as z57 } from "zod/mini";
|
|
15545
|
+
var CodexCliSubagentTomlSchema = z57.looseObject({
|
|
15546
|
+
name: z57.string(),
|
|
15547
|
+
description: z57.optional(z57.string()),
|
|
15548
|
+
developer_instructions: z57.optional(z57.string()),
|
|
15549
|
+
model: z57.optional(z57.string()),
|
|
15550
|
+
model_reasoning_effort: z57.optional(z57.string()),
|
|
15551
|
+
sandbox_mode: z57.optional(z57.string())
|
|
15192
15552
|
});
|
|
15193
15553
|
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
15194
15554
|
const { developer_instructions, ...restFields } = tomlObj;
|
|
15195
|
-
const restToml =
|
|
15555
|
+
const restToml = smolToml6.stringify(restFields).trimEnd();
|
|
15196
15556
|
if (developer_instructions === void 0) {
|
|
15197
15557
|
return restToml;
|
|
15198
15558
|
}
|
|
15199
|
-
const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ?
|
|
15559
|
+
const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ? smolToml6.stringify({ developer_instructions }).trimEnd() : `developer_instructions = '''
|
|
15200
15560
|
${developer_instructions}
|
|
15201
|
-
'''` :
|
|
15561
|
+
'''` : smolToml6.stringify({ developer_instructions }).trimEnd();
|
|
15202
15562
|
return [restToml, developerInstructionsToml].filter((value) => value.length > 0).join("\n");
|
|
15203
15563
|
}
|
|
15204
15564
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
@@ -15206,7 +15566,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15206
15566
|
constructor({ body, ...rest }) {
|
|
15207
15567
|
if (rest.validate !== false) {
|
|
15208
15568
|
try {
|
|
15209
|
-
const parsed =
|
|
15569
|
+
const parsed = smolToml6.parse(body);
|
|
15210
15570
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
15211
15571
|
} catch (error) {
|
|
15212
15572
|
throw new Error(
|
|
@@ -15231,7 +15591,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15231
15591
|
toRulesyncSubagent() {
|
|
15232
15592
|
let parsed;
|
|
15233
15593
|
try {
|
|
15234
|
-
parsed = CodexCliSubagentTomlSchema.parse(
|
|
15594
|
+
parsed = CodexCliSubagentTomlSchema.parse(smolToml6.parse(this.body));
|
|
15235
15595
|
} catch (error) {
|
|
15236
15596
|
throw new Error(
|
|
15237
15597
|
`Failed to parse TOML in ${join101(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -15292,7 +15652,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15292
15652
|
}
|
|
15293
15653
|
validate() {
|
|
15294
15654
|
try {
|
|
15295
|
-
const parsed =
|
|
15655
|
+
const parsed = smolToml6.parse(this.body);
|
|
15296
15656
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
15297
15657
|
return { success: true, error: null };
|
|
15298
15658
|
} catch (error) {
|
|
@@ -15354,12 +15714,12 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15354
15714
|
|
|
15355
15715
|
// src/features/subagents/copilot-subagent.ts
|
|
15356
15716
|
import { join as join102 } from "path";
|
|
15357
|
-
import { z as
|
|
15717
|
+
import { z as z58 } from "zod/mini";
|
|
15358
15718
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
15359
|
-
var CopilotSubagentFrontmatterSchema =
|
|
15360
|
-
name:
|
|
15361
|
-
description:
|
|
15362
|
-
tools:
|
|
15719
|
+
var CopilotSubagentFrontmatterSchema = z58.looseObject({
|
|
15720
|
+
name: z58.string(),
|
|
15721
|
+
description: z58.optional(z58.string()),
|
|
15722
|
+
tools: z58.optional(z58.union([z58.string(), z58.array(z58.string())]))
|
|
15363
15723
|
});
|
|
15364
15724
|
var normalizeTools = (tools) => {
|
|
15365
15725
|
if (!tools) {
|
|
@@ -15371,6 +15731,21 @@ var ensureRequiredTool = (tools) => {
|
|
|
15371
15731
|
const mergedTools = /* @__PURE__ */ new Set([REQUIRED_TOOL, ...tools]);
|
|
15372
15732
|
return Array.from(mergedTools);
|
|
15373
15733
|
};
|
|
15734
|
+
var toCopilotAgentFilePath = (relativeFilePath) => {
|
|
15735
|
+
if (relativeFilePath.endsWith(".agent.md")) {
|
|
15736
|
+
return relativeFilePath;
|
|
15737
|
+
}
|
|
15738
|
+
if (relativeFilePath.endsWith(".md")) {
|
|
15739
|
+
return relativeFilePath.replace(/\.md$/, ".agent.md");
|
|
15740
|
+
}
|
|
15741
|
+
return relativeFilePath;
|
|
15742
|
+
};
|
|
15743
|
+
var toRulesyncFilePath = (relativeFilePath) => {
|
|
15744
|
+
if (relativeFilePath.endsWith(".agent.md")) {
|
|
15745
|
+
return relativeFilePath.replace(/\.agent\.md$/, ".md");
|
|
15746
|
+
}
|
|
15747
|
+
return relativeFilePath;
|
|
15748
|
+
};
|
|
15374
15749
|
var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
15375
15750
|
frontmatter;
|
|
15376
15751
|
body;
|
|
@@ -15417,7 +15792,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15417
15792
|
frontmatter: rulesyncFrontmatter,
|
|
15418
15793
|
body: this.body,
|
|
15419
15794
|
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
15420
|
-
relativeFilePath: this.getRelativeFilePath(),
|
|
15795
|
+
relativeFilePath: toRulesyncFilePath(this.getRelativeFilePath()),
|
|
15421
15796
|
validate: true
|
|
15422
15797
|
});
|
|
15423
15798
|
}
|
|
@@ -15443,16 +15818,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15443
15818
|
const body = rulesyncSubagent.getBody();
|
|
15444
15819
|
const fileContent = stringifyFrontmatter(body, copilotFrontmatter);
|
|
15445
15820
|
const paths = this.getSettablePaths({ global });
|
|
15446
|
-
let relativeFilePath = rulesyncSubagent.getRelativeFilePath();
|
|
15447
|
-
if (!relativeFilePath.endsWith(".agent.md")) {
|
|
15448
|
-
relativeFilePath = relativeFilePath.replace(/\.md$/, ".agent.md");
|
|
15449
|
-
}
|
|
15450
15821
|
return new _CopilotSubagent({
|
|
15451
15822
|
baseDir,
|
|
15452
15823
|
frontmatter: copilotFrontmatter,
|
|
15453
15824
|
body,
|
|
15454
15825
|
relativeDirPath: paths.relativeDirPath,
|
|
15455
|
-
relativeFilePath,
|
|
15826
|
+
relativeFilePath: toCopilotAgentFilePath(rulesyncSubagent.getRelativeFilePath()),
|
|
15456
15827
|
fileContent,
|
|
15457
15828
|
validate,
|
|
15458
15829
|
global
|
|
@@ -15524,10 +15895,10 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15524
15895
|
|
|
15525
15896
|
// src/features/subagents/cursor-subagent.ts
|
|
15526
15897
|
import { join as join103 } from "path";
|
|
15527
|
-
import { z as
|
|
15528
|
-
var CursorSubagentFrontmatterSchema =
|
|
15529
|
-
name:
|
|
15530
|
-
description:
|
|
15898
|
+
import { z as z59 } from "zod/mini";
|
|
15899
|
+
var CursorSubagentFrontmatterSchema = z59.looseObject({
|
|
15900
|
+
name: z59.string(),
|
|
15901
|
+
description: z59.optional(z59.string())
|
|
15531
15902
|
});
|
|
15532
15903
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
15533
15904
|
frontmatter;
|
|
@@ -15671,11 +16042,11 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15671
16042
|
|
|
15672
16043
|
// src/features/subagents/deepagents-subagent.ts
|
|
15673
16044
|
import { join as join104 } from "path";
|
|
15674
|
-
import { z as
|
|
15675
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
15676
|
-
name:
|
|
15677
|
-
description:
|
|
15678
|
-
model:
|
|
16045
|
+
import { z as z60 } from "zod/mini";
|
|
16046
|
+
var DeepagentsSubagentFrontmatterSchema = z60.looseObject({
|
|
16047
|
+
name: z60.string(),
|
|
16048
|
+
description: z60.optional(z60.string()),
|
|
16049
|
+
model: z60.optional(z60.string())
|
|
15679
16050
|
});
|
|
15680
16051
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
15681
16052
|
frontmatter;
|
|
@@ -15824,10 +16195,10 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15824
16195
|
|
|
15825
16196
|
// src/features/subagents/junie-subagent.ts
|
|
15826
16197
|
import { join as join105 } from "path";
|
|
15827
|
-
import { z as
|
|
15828
|
-
var JunieSubagentFrontmatterSchema =
|
|
15829
|
-
name:
|
|
15830
|
-
description:
|
|
16198
|
+
import { z as z61 } from "zod/mini";
|
|
16199
|
+
var JunieSubagentFrontmatterSchema = z61.looseObject({
|
|
16200
|
+
name: z61.optional(z61.string()),
|
|
16201
|
+
description: z61.string()
|
|
15831
16202
|
});
|
|
15832
16203
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
15833
16204
|
frontmatter;
|
|
@@ -15985,11 +16356,11 @@ import { join as join107 } from "path";
|
|
|
15985
16356
|
|
|
15986
16357
|
// src/features/subagents/opencode-style-subagent.ts
|
|
15987
16358
|
import { basename as basename8, join as join106 } from "path";
|
|
15988
|
-
import { z as
|
|
15989
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
15990
|
-
description:
|
|
15991
|
-
mode:
|
|
15992
|
-
name:
|
|
16359
|
+
import { z as z62 } from "zod/mini";
|
|
16360
|
+
var OpenCodeStyleSubagentFrontmatterSchema = z62.looseObject({
|
|
16361
|
+
description: z62.optional(z62.string()),
|
|
16362
|
+
mode: z62._default(z62.string(), "subagent"),
|
|
16363
|
+
name: z62.optional(z62.string())
|
|
15993
16364
|
});
|
|
15994
16365
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
15995
16366
|
frontmatter;
|
|
@@ -16138,22 +16509,22 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
16138
16509
|
|
|
16139
16510
|
// src/features/subagents/kiro-subagent.ts
|
|
16140
16511
|
import { join as join108 } from "path";
|
|
16141
|
-
import { z as
|
|
16142
|
-
var KiroCliSubagentJsonSchema =
|
|
16143
|
-
name:
|
|
16144
|
-
description:
|
|
16145
|
-
prompt:
|
|
16146
|
-
tools:
|
|
16147
|
-
toolAliases:
|
|
16148
|
-
toolSettings:
|
|
16149
|
-
toolSchema:
|
|
16150
|
-
hooks:
|
|
16151
|
-
model:
|
|
16152
|
-
mcpServers:
|
|
16153
|
-
useLegacyMcpJson:
|
|
16154
|
-
resources:
|
|
16155
|
-
allowedTools:
|
|
16156
|
-
includeMcpJson:
|
|
16512
|
+
import { z as z63 } from "zod/mini";
|
|
16513
|
+
var KiroCliSubagentJsonSchema = z63.looseObject({
|
|
16514
|
+
name: z63.string(),
|
|
16515
|
+
description: z63.optional(z63.nullable(z63.string())),
|
|
16516
|
+
prompt: z63.optional(z63.nullable(z63.string())),
|
|
16517
|
+
tools: z63.optional(z63.nullable(z63.array(z63.string()))),
|
|
16518
|
+
toolAliases: z63.optional(z63.nullable(z63.record(z63.string(), z63.string()))),
|
|
16519
|
+
toolSettings: z63.optional(z63.nullable(z63.unknown())),
|
|
16520
|
+
toolSchema: z63.optional(z63.nullable(z63.unknown())),
|
|
16521
|
+
hooks: z63.optional(z63.nullable(z63.record(z63.string(), z63.array(z63.unknown())))),
|
|
16522
|
+
model: z63.optional(z63.nullable(z63.string())),
|
|
16523
|
+
mcpServers: z63.optional(z63.nullable(z63.record(z63.string(), z63.unknown()))),
|
|
16524
|
+
useLegacyMcpJson: z63.optional(z63.nullable(z63.boolean())),
|
|
16525
|
+
resources: z63.optional(z63.nullable(z63.array(z63.string()))),
|
|
16526
|
+
allowedTools: z63.optional(z63.nullable(z63.array(z63.string()))),
|
|
16527
|
+
includeMcpJson: z63.optional(z63.nullable(z63.boolean()))
|
|
16157
16528
|
});
|
|
16158
16529
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
16159
16530
|
body;
|
|
@@ -16414,7 +16785,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
16414
16785
|
"roo",
|
|
16415
16786
|
"rovodev"
|
|
16416
16787
|
];
|
|
16417
|
-
var SubagentsProcessorToolTargetSchema =
|
|
16788
|
+
var SubagentsProcessorToolTargetSchema = z64.enum(subagentsProcessorToolTargetTuple);
|
|
16418
16789
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
16419
16790
|
[
|
|
16420
16791
|
"agentsmd",
|
|
@@ -16724,42 +17095,42 @@ import { join as join112 } from "path";
|
|
|
16724
17095
|
|
|
16725
17096
|
// src/features/rules/rulesync-rule.ts
|
|
16726
17097
|
import { join as join111 } from "path";
|
|
16727
|
-
import { z as
|
|
16728
|
-
var RulesyncRuleFrontmatterSchema =
|
|
16729
|
-
root:
|
|
16730
|
-
localRoot:
|
|
16731
|
-
targets:
|
|
16732
|
-
description:
|
|
16733
|
-
globs:
|
|
16734
|
-
agentsmd:
|
|
16735
|
-
|
|
17098
|
+
import { z as z65 } from "zod/mini";
|
|
17099
|
+
var RulesyncRuleFrontmatterSchema = z65.object({
|
|
17100
|
+
root: z65.optional(z65.boolean()),
|
|
17101
|
+
localRoot: z65.optional(z65.boolean()),
|
|
17102
|
+
targets: z65._default(RulesyncTargetsSchema, ["*"]),
|
|
17103
|
+
description: z65.optional(z65.string()),
|
|
17104
|
+
globs: z65.optional(z65.array(z65.string())),
|
|
17105
|
+
agentsmd: z65.optional(
|
|
17106
|
+
z65.looseObject({
|
|
16736
17107
|
// @example "path/to/subproject"
|
|
16737
|
-
subprojectPath:
|
|
17108
|
+
subprojectPath: z65.optional(z65.string())
|
|
16738
17109
|
})
|
|
16739
17110
|
),
|
|
16740
|
-
claudecode:
|
|
16741
|
-
|
|
17111
|
+
claudecode: z65.optional(
|
|
17112
|
+
z65.looseObject({
|
|
16742
17113
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
16743
17114
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
16744
|
-
paths:
|
|
17115
|
+
paths: z65.optional(z65.array(z65.string()))
|
|
16745
17116
|
})
|
|
16746
17117
|
),
|
|
16747
|
-
cursor:
|
|
16748
|
-
|
|
16749
|
-
alwaysApply:
|
|
16750
|
-
description:
|
|
16751
|
-
globs:
|
|
17118
|
+
cursor: z65.optional(
|
|
17119
|
+
z65.looseObject({
|
|
17120
|
+
alwaysApply: z65.optional(z65.boolean()),
|
|
17121
|
+
description: z65.optional(z65.string()),
|
|
17122
|
+
globs: z65.optional(z65.array(z65.string()))
|
|
16752
17123
|
})
|
|
16753
17124
|
),
|
|
16754
|
-
copilot:
|
|
16755
|
-
|
|
16756
|
-
excludeAgent:
|
|
17125
|
+
copilot: z65.optional(
|
|
17126
|
+
z65.looseObject({
|
|
17127
|
+
excludeAgent: z65.optional(z65.union([z65.literal("code-review"), z65.literal("coding-agent")]))
|
|
16757
17128
|
})
|
|
16758
17129
|
),
|
|
16759
|
-
antigravity:
|
|
16760
|
-
|
|
16761
|
-
trigger:
|
|
16762
|
-
globs:
|
|
17130
|
+
antigravity: z65.optional(
|
|
17131
|
+
z65.looseObject({
|
|
17132
|
+
trigger: z65.optional(z65.string()),
|
|
17133
|
+
globs: z65.optional(z65.array(z65.string()))
|
|
16763
17134
|
})
|
|
16764
17135
|
)
|
|
16765
17136
|
});
|
|
@@ -17059,20 +17430,20 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
17059
17430
|
|
|
17060
17431
|
// src/features/rules/antigravity-rule.ts
|
|
17061
17432
|
import { join as join114 } from "path";
|
|
17062
|
-
import { z as
|
|
17063
|
-
var AntigravityRuleFrontmatterSchema =
|
|
17064
|
-
trigger:
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17433
|
+
import { z as z66 } from "zod/mini";
|
|
17434
|
+
var AntigravityRuleFrontmatterSchema = z66.looseObject({
|
|
17435
|
+
trigger: z66.optional(
|
|
17436
|
+
z66.union([
|
|
17437
|
+
z66.literal("always_on"),
|
|
17438
|
+
z66.literal("glob"),
|
|
17439
|
+
z66.literal("manual"),
|
|
17440
|
+
z66.literal("model_decision"),
|
|
17441
|
+
z66.string()
|
|
17071
17442
|
// accepts any string for forward compatibility
|
|
17072
17443
|
])
|
|
17073
17444
|
),
|
|
17074
|
-
globs:
|
|
17075
|
-
description:
|
|
17445
|
+
globs: z66.optional(z66.string()),
|
|
17446
|
+
description: z66.optional(z66.string())
|
|
17076
17447
|
});
|
|
17077
17448
|
function parseGlobsString(globs) {
|
|
17078
17449
|
if (!globs) {
|
|
@@ -17659,9 +18030,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
17659
18030
|
|
|
17660
18031
|
// src/features/rules/claudecode-rule.ts
|
|
17661
18032
|
import { join as join118 } from "path";
|
|
17662
|
-
import { z as
|
|
17663
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
17664
|
-
paths:
|
|
18033
|
+
import { z as z67 } from "zod/mini";
|
|
18034
|
+
var ClaudecodeRuleFrontmatterSchema = z67.object({
|
|
18035
|
+
paths: z67.optional(z67.array(z67.string()))
|
|
17665
18036
|
});
|
|
17666
18037
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
17667
18038
|
frontmatter;
|
|
@@ -17877,9 +18248,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17877
18248
|
|
|
17878
18249
|
// src/features/rules/cline-rule.ts
|
|
17879
18250
|
import { join as join119 } from "path";
|
|
17880
|
-
import { z as
|
|
17881
|
-
var ClineRuleFrontmatterSchema =
|
|
17882
|
-
description:
|
|
18251
|
+
import { z as z68 } from "zod/mini";
|
|
18252
|
+
var ClineRuleFrontmatterSchema = z68.object({
|
|
18253
|
+
description: z68.string()
|
|
17883
18254
|
});
|
|
17884
18255
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
17885
18256
|
static getSettablePaths(_options = {}) {
|
|
@@ -18058,11 +18429,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
18058
18429
|
|
|
18059
18430
|
// src/features/rules/copilot-rule.ts
|
|
18060
18431
|
import { join as join121 } from "path";
|
|
18061
|
-
import { z as
|
|
18062
|
-
var CopilotRuleFrontmatterSchema =
|
|
18063
|
-
description:
|
|
18064
|
-
applyTo:
|
|
18065
|
-
excludeAgent:
|
|
18432
|
+
import { z as z69 } from "zod/mini";
|
|
18433
|
+
var CopilotRuleFrontmatterSchema = z69.object({
|
|
18434
|
+
description: z69.optional(z69.string()),
|
|
18435
|
+
applyTo: z69.optional(z69.string()),
|
|
18436
|
+
excludeAgent: z69.optional(z69.union([z69.literal("code-review"), z69.literal("coding-agent")]))
|
|
18066
18437
|
});
|
|
18067
18438
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
18068
18439
|
frontmatter;
|
|
@@ -18304,11 +18675,11 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
18304
18675
|
|
|
18305
18676
|
// src/features/rules/cursor-rule.ts
|
|
18306
18677
|
import { join as join122 } from "path";
|
|
18307
|
-
import { z as
|
|
18308
|
-
var CursorRuleFrontmatterSchema =
|
|
18309
|
-
description:
|
|
18310
|
-
globs:
|
|
18311
|
-
alwaysApply:
|
|
18678
|
+
import { z as z70 } from "zod/mini";
|
|
18679
|
+
var CursorRuleFrontmatterSchema = z70.object({
|
|
18680
|
+
description: z70.optional(z70.string()),
|
|
18681
|
+
globs: z70.optional(z70.string()),
|
|
18682
|
+
alwaysApply: z70.optional(z70.boolean())
|
|
18312
18683
|
});
|
|
18313
18684
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
18314
18685
|
frontmatter;
|
|
@@ -19968,11 +20339,11 @@ var rulesProcessorToolTargets = [
|
|
|
19968
20339
|
"warp",
|
|
19969
20340
|
"windsurf"
|
|
19970
20341
|
];
|
|
19971
|
-
var RulesProcessorToolTargetSchema =
|
|
20342
|
+
var RulesProcessorToolTargetSchema = z71.enum(rulesProcessorToolTargets);
|
|
19972
20343
|
var formatRulePaths = (rules) => rules.map((r) => join137(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
19973
|
-
var RulesFeatureOptionsSchema =
|
|
19974
|
-
ruleDiscoveryMode:
|
|
19975
|
-
includeLocalRoot:
|
|
20344
|
+
var RulesFeatureOptionsSchema = z71.looseObject({
|
|
20345
|
+
ruleDiscoveryMode: z71.optional(z71.enum(["none", "explicit"])),
|
|
20346
|
+
includeLocalRoot: z71.optional(z71.boolean())
|
|
19976
20347
|
});
|
|
19977
20348
|
var resolveRuleDiscoveryMode = ({
|
|
19978
20349
|
defaultMode,
|
|
@@ -19993,8 +20364,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
19993
20364
|
}
|
|
19994
20365
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
19995
20366
|
};
|
|
19996
|
-
var IncludeLocalRootSchema =
|
|
19997
|
-
includeLocalRoot:
|
|
20367
|
+
var IncludeLocalRootSchema = z71.looseObject({
|
|
20368
|
+
includeLocalRoot: z71.optional(z71.boolean())
|
|
19998
20369
|
});
|
|
19999
20370
|
var resolveIncludeLocalRoot = (options) => {
|
|
20000
20371
|
if (!options) return true;
|
|
@@ -21616,176 +21987,6 @@ async function importPermissionsCore(params) {
|
|
|
21616
21987
|
return writtenCount;
|
|
21617
21988
|
}
|
|
21618
21989
|
|
|
21619
|
-
// src/types/json-output.ts
|
|
21620
|
-
var ErrorCodes = {
|
|
21621
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
21622
|
-
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
21623
|
-
INVALID_TARGET: "INVALID_TARGET",
|
|
21624
|
-
FETCH_FAILED: "FETCH_FAILED",
|
|
21625
|
-
WRITE_FAILED: "WRITE_FAILED",
|
|
21626
|
-
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
21627
|
-
GENERATION_FAILED: "GENERATION_FAILED",
|
|
21628
|
-
IMPORT_FAILED: "IMPORT_FAILED",
|
|
21629
|
-
INSTALL_FAILED: "INSTALL_FAILED",
|
|
21630
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
21631
|
-
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
21632
|
-
INIT_FAILED: "INIT_FAILED",
|
|
21633
|
-
MCP_FAILED: "MCP_FAILED",
|
|
21634
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
21635
|
-
};
|
|
21636
|
-
var CLIError = class extends Error {
|
|
21637
|
-
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
21638
|
-
super(message);
|
|
21639
|
-
this.code = code;
|
|
21640
|
-
this.exitCode = exitCode;
|
|
21641
|
-
this.name = "CLIError";
|
|
21642
|
-
}
|
|
21643
|
-
};
|
|
21644
|
-
|
|
21645
|
-
// src/utils/logger.ts
|
|
21646
|
-
var BaseLogger = class {
|
|
21647
|
-
_verbose = false;
|
|
21648
|
-
_silent = false;
|
|
21649
|
-
constructor({ verbose = false, silent = false } = {}) {
|
|
21650
|
-
this._silent = silent;
|
|
21651
|
-
this._verbose = verbose && !silent;
|
|
21652
|
-
}
|
|
21653
|
-
get verbose() {
|
|
21654
|
-
return this._verbose;
|
|
21655
|
-
}
|
|
21656
|
-
get silent() {
|
|
21657
|
-
return this._silent;
|
|
21658
|
-
}
|
|
21659
|
-
configure({ verbose, silent }) {
|
|
21660
|
-
if (verbose && silent) {
|
|
21661
|
-
this._silent = false;
|
|
21662
|
-
if (!isEnvTest()) {
|
|
21663
|
-
this.onConflictingFlags();
|
|
21664
|
-
}
|
|
21665
|
-
}
|
|
21666
|
-
this._silent = silent;
|
|
21667
|
-
this._verbose = verbose && !silent;
|
|
21668
|
-
}
|
|
21669
|
-
onConflictingFlags() {
|
|
21670
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
21671
|
-
}
|
|
21672
|
-
};
|
|
21673
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
21674
|
-
isSuppressed() {
|
|
21675
|
-
return isEnvTest() || this._silent;
|
|
21676
|
-
}
|
|
21677
|
-
get jsonMode() {
|
|
21678
|
-
return false;
|
|
21679
|
-
}
|
|
21680
|
-
captureData(_key, _value) {
|
|
21681
|
-
}
|
|
21682
|
-
getJsonData() {
|
|
21683
|
-
return {};
|
|
21684
|
-
}
|
|
21685
|
-
outputJson(_success, _error) {
|
|
21686
|
-
}
|
|
21687
|
-
info(message, ...args) {
|
|
21688
|
-
if (this.isSuppressed()) return;
|
|
21689
|
-
console.log(message, ...args);
|
|
21690
|
-
}
|
|
21691
|
-
success(message, ...args) {
|
|
21692
|
-
if (this.isSuppressed()) return;
|
|
21693
|
-
console.log(message, ...args);
|
|
21694
|
-
}
|
|
21695
|
-
warn(message, ...args) {
|
|
21696
|
-
if (this.isSuppressed()) return;
|
|
21697
|
-
console.warn(message, ...args);
|
|
21698
|
-
}
|
|
21699
|
-
// Errors are always emitted, even in silent mode
|
|
21700
|
-
error(message, _code, ...args) {
|
|
21701
|
-
if (isEnvTest()) return;
|
|
21702
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
21703
|
-
console.error(errorMessage, ...args);
|
|
21704
|
-
}
|
|
21705
|
-
debug(message, ...args) {
|
|
21706
|
-
if (!this._verbose || this.isSuppressed()) return;
|
|
21707
|
-
console.log(message, ...args);
|
|
21708
|
-
}
|
|
21709
|
-
};
|
|
21710
|
-
var JsonLogger = class extends BaseLogger {
|
|
21711
|
-
_jsonOutputDone = false;
|
|
21712
|
-
_jsonData = {};
|
|
21713
|
-
_commandName;
|
|
21714
|
-
_version;
|
|
21715
|
-
constructor({
|
|
21716
|
-
command,
|
|
21717
|
-
version,
|
|
21718
|
-
verbose = false,
|
|
21719
|
-
silent = false
|
|
21720
|
-
}) {
|
|
21721
|
-
super({ verbose, silent });
|
|
21722
|
-
this._commandName = command;
|
|
21723
|
-
this._version = version;
|
|
21724
|
-
}
|
|
21725
|
-
// Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
|
|
21726
|
-
onConflictingFlags() {
|
|
21727
|
-
}
|
|
21728
|
-
get jsonMode() {
|
|
21729
|
-
return true;
|
|
21730
|
-
}
|
|
21731
|
-
captureData(key, value) {
|
|
21732
|
-
this._jsonData[key] = value;
|
|
21733
|
-
}
|
|
21734
|
-
getJsonData() {
|
|
21735
|
-
return { ...this._jsonData };
|
|
21736
|
-
}
|
|
21737
|
-
outputJson(success, error) {
|
|
21738
|
-
if (this._jsonOutputDone) return;
|
|
21739
|
-
this._jsonOutputDone = true;
|
|
21740
|
-
const output = {
|
|
21741
|
-
success,
|
|
21742
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21743
|
-
command: this._commandName,
|
|
21744
|
-
version: this._version
|
|
21745
|
-
};
|
|
21746
|
-
if (success) {
|
|
21747
|
-
output.data = this._jsonData;
|
|
21748
|
-
} else if (error) {
|
|
21749
|
-
output.error = {
|
|
21750
|
-
code: error.code,
|
|
21751
|
-
message: error.message
|
|
21752
|
-
};
|
|
21753
|
-
if (error.details) {
|
|
21754
|
-
output.error.details = error.details;
|
|
21755
|
-
}
|
|
21756
|
-
if (error.stack) {
|
|
21757
|
-
output.error.stack = error.stack;
|
|
21758
|
-
}
|
|
21759
|
-
}
|
|
21760
|
-
const jsonStr = JSON.stringify(output, null, 2);
|
|
21761
|
-
if (success) {
|
|
21762
|
-
console.log(jsonStr);
|
|
21763
|
-
} else {
|
|
21764
|
-
console.error(jsonStr);
|
|
21765
|
-
}
|
|
21766
|
-
}
|
|
21767
|
-
info(_message, ..._args) {
|
|
21768
|
-
}
|
|
21769
|
-
success(_message, ..._args) {
|
|
21770
|
-
}
|
|
21771
|
-
warn(_message, ..._args) {
|
|
21772
|
-
}
|
|
21773
|
-
error(message, code, ..._args) {
|
|
21774
|
-
if (isEnvTest()) return;
|
|
21775
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
21776
|
-
const errorInfo = {
|
|
21777
|
-
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
21778
|
-
message: errorMessage
|
|
21779
|
-
};
|
|
21780
|
-
if (this._verbose && message instanceof Error && message.stack) {
|
|
21781
|
-
errorInfo.stack = message.stack;
|
|
21782
|
-
}
|
|
21783
|
-
this.outputJson(false, errorInfo);
|
|
21784
|
-
}
|
|
21785
|
-
debug(_message, ..._args) {
|
|
21786
|
-
}
|
|
21787
|
-
};
|
|
21788
|
-
|
|
21789
21990
|
export {
|
|
21790
21991
|
RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
21791
21992
|
RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH,
|
|
@@ -21795,6 +21996,7 @@ export {
|
|
|
21795
21996
|
RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
21796
21997
|
RULESYNC_MCP_RELATIVE_FILE_PATH,
|
|
21797
21998
|
RULESYNC_HOOKS_RELATIVE_FILE_PATH,
|
|
21999
|
+
RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH,
|
|
21798
22000
|
RULESYNC_AIIGNORE_FILE_NAME,
|
|
21799
22001
|
RULESYNC_AIIGNORE_RELATIVE_FILE_PATH,
|
|
21800
22002
|
RULESYNC_IGNORE_RELATIVE_FILE_PATH,
|
|
@@ -21823,6 +22025,7 @@ export {
|
|
|
21823
22025
|
findFilesByGlobs,
|
|
21824
22026
|
removeDirectory,
|
|
21825
22027
|
removeFile,
|
|
22028
|
+
getHomeDirectory,
|
|
21826
22029
|
createTempDirectory,
|
|
21827
22030
|
removeTempDirectory,
|
|
21828
22031
|
ALL_FEATURES,
|
|
@@ -21843,6 +22046,11 @@ export {
|
|
|
21843
22046
|
IgnoreProcessor,
|
|
21844
22047
|
RulesyncMcp,
|
|
21845
22048
|
McpProcessor,
|
|
22049
|
+
RulesyncPermissions,
|
|
22050
|
+
ErrorCodes,
|
|
22051
|
+
CLIError,
|
|
22052
|
+
ConsoleLogger,
|
|
22053
|
+
JsonLogger,
|
|
21846
22054
|
SKILL_FILE_NAME,
|
|
21847
22055
|
RulesyncSkillFrontmatterSchema,
|
|
21848
22056
|
RulesyncSkill,
|
|
@@ -21856,9 +22064,5 @@ export {
|
|
|
21856
22064
|
RulesProcessor,
|
|
21857
22065
|
checkRulesyncDirExists,
|
|
21858
22066
|
generate,
|
|
21859
|
-
importFromTool
|
|
21860
|
-
ErrorCodes,
|
|
21861
|
-
CLIError,
|
|
21862
|
-
ConsoleLogger,
|
|
21863
|
-
JsonLogger
|
|
22067
|
+
importFromTool
|
|
21864
22068
|
};
|