rulesync 7.28.0 → 7.30.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/README.md +29 -27
- package/dist/{chunk-AKHOQKVV.js → chunk-IGW5DFPU.js} +1498 -752
- package/dist/cli/index.cjs +1403 -638
- package/dist/cli/index.js +29 -10
- package/dist/index.cjs +1530 -784
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -41,10 +41,21 @@ var ALL_FEATURES = [
|
|
|
41
41
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
42
42
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
43
43
|
var FeaturesSchema = import_mini.z.array(FeatureSchema);
|
|
44
|
+
var FeatureOptionsSchema = import_mini.z.record(import_mini.z.string(), import_mini.z.unknown());
|
|
45
|
+
var FeatureValueSchema = import_mini.z.union([import_mini.z.boolean(), FeatureOptionsSchema]);
|
|
46
|
+
var PerFeatureConfigSchema = import_mini.z.record(import_mini.z.string(), FeatureValueSchema);
|
|
44
47
|
var RulesyncFeaturesSchema = import_mini.z.union([
|
|
45
48
|
import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)),
|
|
46
|
-
import_mini.z.record(
|
|
49
|
+
import_mini.z.record(
|
|
50
|
+
import_mini.z.string(),
|
|
51
|
+
import_mini.z.union([import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)), PerFeatureConfigSchema])
|
|
52
|
+
)
|
|
47
53
|
]);
|
|
54
|
+
var isFeatureValueEnabled = (value) => {
|
|
55
|
+
if (value === true) return true;
|
|
56
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) return true;
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
48
59
|
|
|
49
60
|
// src/utils/error.ts
|
|
50
61
|
var import_zod = require("zod");
|
|
@@ -5064,7 +5075,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
5064
5075
|
};
|
|
5065
5076
|
|
|
5066
5077
|
// src/features/ignore/ignore-processor.ts
|
|
5067
|
-
var
|
|
5078
|
+
var import_mini21 = require("zod/mini");
|
|
5068
5079
|
|
|
5069
5080
|
// src/features/ignore/augmentcode-ignore.ts
|
|
5070
5081
|
var import_node_path33 = require("path");
|
|
@@ -5140,7 +5151,7 @@ var ToolIgnore = class extends ToolFile {
|
|
|
5140
5151
|
}
|
|
5141
5152
|
}
|
|
5142
5153
|
}
|
|
5143
|
-
static getSettablePaths() {
|
|
5154
|
+
static getSettablePaths(_params) {
|
|
5144
5155
|
throw new Error("Please implement this method in the subclass.");
|
|
5145
5156
|
}
|
|
5146
5157
|
getPatterns() {
|
|
@@ -5243,21 +5254,47 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
5243
5254
|
// src/features/ignore/claudecode-ignore.ts
|
|
5244
5255
|
var import_node_path34 = require("path");
|
|
5245
5256
|
var import_es_toolkit2 = require("es-toolkit");
|
|
5257
|
+
var import_mini20 = require("zod/mini");
|
|
5258
|
+
var SHARED_SETTINGS_FILE = "settings.json";
|
|
5259
|
+
var LOCAL_SETTINGS_FILE = "settings.local.json";
|
|
5260
|
+
var DEFAULT_FILE_MODE = "shared";
|
|
5261
|
+
var ClaudecodeIgnoreOptionsSchema = import_mini20.z.looseObject({
|
|
5262
|
+
fileMode: import_mini20.z.optional(import_mini20.z.enum(["shared", "local"]))
|
|
5263
|
+
});
|
|
5264
|
+
var resolveFileMode = (options) => {
|
|
5265
|
+
if (!options) return DEFAULT_FILE_MODE;
|
|
5266
|
+
const parsed = ClaudecodeIgnoreOptionsSchema.safeParse(options);
|
|
5267
|
+
if (!parsed.success) {
|
|
5268
|
+
throw new Error(
|
|
5269
|
+
`Invalid options for claudecode ignore feature: ${parsed.error.message}. \`fileMode\` must be either "shared" or "local".`
|
|
5270
|
+
);
|
|
5271
|
+
}
|
|
5272
|
+
return parsed.data.fileMode ?? DEFAULT_FILE_MODE;
|
|
5273
|
+
};
|
|
5274
|
+
var fileNameForMode = (fileMode) => {
|
|
5275
|
+
return fileMode === "local" ? LOCAL_SETTINGS_FILE : SHARED_SETTINGS_FILE;
|
|
5276
|
+
};
|
|
5246
5277
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
5247
5278
|
constructor(params) {
|
|
5248
5279
|
super(params);
|
|
5249
5280
|
const jsonValue = JSON.parse(this.fileContent);
|
|
5250
5281
|
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
5251
5282
|
}
|
|
5252
|
-
static getSettablePaths() {
|
|
5283
|
+
static getSettablePaths(params) {
|
|
5284
|
+
const fileMode = resolveFileMode(params?.options);
|
|
5253
5285
|
return {
|
|
5254
5286
|
relativeDirPath: ".claude",
|
|
5255
|
-
relativeFilePath:
|
|
5287
|
+
relativeFilePath: fileNameForMode(fileMode)
|
|
5256
5288
|
};
|
|
5257
5289
|
}
|
|
5258
5290
|
/**
|
|
5259
|
-
* ClaudecodeIgnore uses settings.json, which can
|
|
5260
|
-
* It should not be deleted by rulesync.
|
|
5291
|
+
* ClaudecodeIgnore uses settings.json (or settings.local.json), which can
|
|
5292
|
+
* include non-ignore settings. It should not be deleted by rulesync.
|
|
5293
|
+
*
|
|
5294
|
+
* NOTE: Because this returns `false`, switching `fileMode` (e.g. from
|
|
5295
|
+
* `"local"` to `"shared"`) will not automatically clean up deny patterns
|
|
5296
|
+
* in the previously-used file. Users must manually remove stale deny
|
|
5297
|
+
* entries from the old file when changing `fileMode`.
|
|
5261
5298
|
*/
|
|
5262
5299
|
isDeletable() {
|
|
5263
5300
|
return false;
|
|
@@ -5279,16 +5316,14 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
5279
5316
|
}
|
|
5280
5317
|
static async fromRulesyncIgnore({
|
|
5281
5318
|
baseDir = process.cwd(),
|
|
5282
|
-
rulesyncIgnore
|
|
5319
|
+
rulesyncIgnore,
|
|
5320
|
+
options
|
|
5283
5321
|
}) {
|
|
5284
5322
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
5285
5323
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
5286
5324
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
5287
|
-
const
|
|
5288
|
-
|
|
5289
|
-
this.getSettablePaths().relativeDirPath,
|
|
5290
|
-
this.getSettablePaths().relativeFilePath
|
|
5291
|
-
);
|
|
5325
|
+
const paths = this.getSettablePaths({ options });
|
|
5326
|
+
const filePath = (0, import_node_path34.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5292
5327
|
const exists = await fileExists(filePath);
|
|
5293
5328
|
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
5294
5329
|
const existingJsonValue = JSON.parse(existingFileContent);
|
|
@@ -5309,27 +5344,29 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
5309
5344
|
};
|
|
5310
5345
|
return new _ClaudecodeIgnore({
|
|
5311
5346
|
baseDir,
|
|
5312
|
-
relativeDirPath:
|
|
5313
|
-
relativeFilePath:
|
|
5347
|
+
relativeDirPath: paths.relativeDirPath,
|
|
5348
|
+
relativeFilePath: paths.relativeFilePath,
|
|
5314
5349
|
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
5315
5350
|
validate: true
|
|
5316
5351
|
});
|
|
5317
5352
|
}
|
|
5318
5353
|
static async fromFile({
|
|
5319
5354
|
baseDir = process.cwd(),
|
|
5320
|
-
validate = true
|
|
5355
|
+
validate = true,
|
|
5356
|
+
options
|
|
5321
5357
|
}) {
|
|
5322
|
-
const
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
)
|
|
5328
|
-
|
|
5358
|
+
const fileMode = resolveFileMode(options);
|
|
5359
|
+
const paths = this.getSettablePaths({ options });
|
|
5360
|
+
const filePath = (0, import_node_path34.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5361
|
+
const exists = await fileExists(filePath);
|
|
5362
|
+
if (!exists && fileMode === "shared") {
|
|
5363
|
+
throw new Error(`File not found: ${filePath}`);
|
|
5364
|
+
}
|
|
5365
|
+
const fileContent = exists ? await readFileContent(filePath) : "{}";
|
|
5329
5366
|
return new _ClaudecodeIgnore({
|
|
5330
5367
|
baseDir,
|
|
5331
|
-
relativeDirPath:
|
|
5332
|
-
relativeFilePath:
|
|
5368
|
+
relativeDirPath: paths.relativeDirPath,
|
|
5369
|
+
relativeFilePath: paths.relativeFilePath,
|
|
5333
5370
|
fileContent,
|
|
5334
5371
|
validate
|
|
5335
5372
|
});
|
|
@@ -6066,7 +6103,7 @@ var ignoreProcessorToolTargets = [
|
|
|
6066
6103
|
"windsurf",
|
|
6067
6104
|
"zed"
|
|
6068
6105
|
];
|
|
6069
|
-
var IgnoreProcessorToolTargetSchema =
|
|
6106
|
+
var IgnoreProcessorToolTargetSchema = import_mini21.z.enum(ignoreProcessorToolTargets);
|
|
6070
6107
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
6071
6108
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
6072
6109
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -6093,12 +6130,14 @@ var defaultGetFactory2 = (target) => {
|
|
|
6093
6130
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
6094
6131
|
toolTarget;
|
|
6095
6132
|
getFactory;
|
|
6133
|
+
featureOptions;
|
|
6096
6134
|
constructor({
|
|
6097
6135
|
baseDir = process.cwd(),
|
|
6098
6136
|
toolTarget,
|
|
6099
6137
|
getFactory = defaultGetFactory2,
|
|
6100
6138
|
dryRun = false,
|
|
6101
|
-
logger: logger5
|
|
6139
|
+
logger: logger5,
|
|
6140
|
+
featureOptions
|
|
6102
6141
|
}) {
|
|
6103
6142
|
super({ baseDir, dryRun, logger: logger5 });
|
|
6104
6143
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -6109,6 +6148,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6109
6148
|
}
|
|
6110
6149
|
this.toolTarget = result.data;
|
|
6111
6150
|
this.getFactory = getFactory;
|
|
6151
|
+
this.featureOptions = featureOptions;
|
|
6112
6152
|
}
|
|
6113
6153
|
async writeToolIgnoresFromRulesyncIgnores(rulesyncIgnores) {
|
|
6114
6154
|
const toolIgnores = await this.convertRulesyncFilesToToolFiles(rulesyncIgnores);
|
|
@@ -6137,7 +6177,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6137
6177
|
} = {}) {
|
|
6138
6178
|
try {
|
|
6139
6179
|
const factory = this.getFactory(this.toolTarget);
|
|
6140
|
-
const paths = factory.class.getSettablePaths();
|
|
6180
|
+
const paths = factory.class.getSettablePaths({ options: this.featureOptions });
|
|
6141
6181
|
if (forDeletion) {
|
|
6142
6182
|
const toolIgnore = factory.class.forDeletion({
|
|
6143
6183
|
baseDir: this.baseDir,
|
|
@@ -6161,7 +6201,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6161
6201
|
}
|
|
6162
6202
|
async loadToolIgnores() {
|
|
6163
6203
|
const factory = this.getFactory(this.toolTarget);
|
|
6164
|
-
return [await factory.class.fromFile({ baseDir: this.baseDir })];
|
|
6204
|
+
return [await factory.class.fromFile({ baseDir: this.baseDir, options: this.featureOptions })];
|
|
6165
6205
|
}
|
|
6166
6206
|
/**
|
|
6167
6207
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -6177,7 +6217,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6177
6217
|
const factory = this.getFactory(this.toolTarget);
|
|
6178
6218
|
const toolIgnore = await factory.class.fromRulesyncIgnore({
|
|
6179
6219
|
baseDir: this.baseDir,
|
|
6180
|
-
rulesyncIgnore
|
|
6220
|
+
rulesyncIgnore,
|
|
6221
|
+
options: this.featureOptions
|
|
6181
6222
|
});
|
|
6182
6223
|
return [toolIgnore];
|
|
6183
6224
|
}
|
|
@@ -6205,7 +6246,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6205
6246
|
};
|
|
6206
6247
|
|
|
6207
6248
|
// src/features/mcp/mcp-processor.ts
|
|
6208
|
-
var
|
|
6249
|
+
var import_mini26 = require("zod/mini");
|
|
6209
6250
|
|
|
6210
6251
|
// src/features/mcp/claudecode-mcp.ts
|
|
6211
6252
|
var import_node_path47 = require("path");
|
|
@@ -6213,47 +6254,47 @@ var import_node_path47 = require("path");
|
|
|
6213
6254
|
// src/features/mcp/rulesync-mcp.ts
|
|
6214
6255
|
var import_node_path46 = require("path");
|
|
6215
6256
|
var import_object = require("es-toolkit/object");
|
|
6216
|
-
var
|
|
6257
|
+
var import_mini23 = require("zod/mini");
|
|
6217
6258
|
|
|
6218
6259
|
// src/types/mcp.ts
|
|
6219
|
-
var
|
|
6220
|
-
var McpServerSchema =
|
|
6221
|
-
type:
|
|
6222
|
-
command:
|
|
6223
|
-
args:
|
|
6224
|
-
url:
|
|
6225
|
-
httpUrl:
|
|
6226
|
-
env:
|
|
6227
|
-
disabled:
|
|
6228
|
-
networkTimeout:
|
|
6229
|
-
timeout:
|
|
6230
|
-
trust:
|
|
6231
|
-
cwd:
|
|
6232
|
-
transport:
|
|
6233
|
-
alwaysAllow:
|
|
6234
|
-
tools:
|
|
6235
|
-
kiroAutoApprove:
|
|
6236
|
-
kiroAutoBlock:
|
|
6237
|
-
headers:
|
|
6238
|
-
enabledTools:
|
|
6239
|
-
disabledTools:
|
|
6260
|
+
var import_mini22 = require("zod/mini");
|
|
6261
|
+
var McpServerSchema = import_mini22.z.looseObject({
|
|
6262
|
+
type: import_mini22.z.optional(import_mini22.z.enum(["local", "stdio", "sse", "http"])),
|
|
6263
|
+
command: import_mini22.z.optional(import_mini22.z.union([import_mini22.z.string(), import_mini22.z.array(import_mini22.z.string())])),
|
|
6264
|
+
args: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6265
|
+
url: import_mini22.z.optional(import_mini22.z.string()),
|
|
6266
|
+
httpUrl: import_mini22.z.optional(import_mini22.z.string()),
|
|
6267
|
+
env: import_mini22.z.optional(import_mini22.z.record(import_mini22.z.string(), import_mini22.z.string())),
|
|
6268
|
+
disabled: import_mini22.z.optional(import_mini22.z.boolean()),
|
|
6269
|
+
networkTimeout: import_mini22.z.optional(import_mini22.z.number()),
|
|
6270
|
+
timeout: import_mini22.z.optional(import_mini22.z.number()),
|
|
6271
|
+
trust: import_mini22.z.optional(import_mini22.z.boolean()),
|
|
6272
|
+
cwd: import_mini22.z.optional(import_mini22.z.string()),
|
|
6273
|
+
transport: import_mini22.z.optional(import_mini22.z.enum(["local", "stdio", "sse", "http"])),
|
|
6274
|
+
alwaysAllow: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6275
|
+
tools: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6276
|
+
kiroAutoApprove: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6277
|
+
kiroAutoBlock: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6278
|
+
headers: import_mini22.z.optional(import_mini22.z.record(import_mini22.z.string(), import_mini22.z.string())),
|
|
6279
|
+
enabledTools: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string())),
|
|
6280
|
+
disabledTools: import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
6240
6281
|
});
|
|
6241
|
-
var McpServersSchema =
|
|
6282
|
+
var McpServersSchema = import_mini22.z.record(import_mini22.z.string(), McpServerSchema);
|
|
6242
6283
|
function isMcpServers(value) {
|
|
6243
6284
|
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6244
6285
|
}
|
|
6245
6286
|
|
|
6246
6287
|
// src/features/mcp/rulesync-mcp.ts
|
|
6247
|
-
var RulesyncMcpServerSchema =
|
|
6248
|
-
targets:
|
|
6249
|
-
description:
|
|
6250
|
-
exposed:
|
|
6288
|
+
var RulesyncMcpServerSchema = import_mini23.z.extend(McpServerSchema, {
|
|
6289
|
+
targets: import_mini23.z.optional(RulesyncTargetsSchema),
|
|
6290
|
+
description: import_mini23.z.optional(import_mini23.z.string()),
|
|
6291
|
+
exposed: import_mini23.z.optional(import_mini23.z.boolean())
|
|
6251
6292
|
});
|
|
6252
|
-
var RulesyncMcpConfigSchema =
|
|
6253
|
-
mcpServers:
|
|
6293
|
+
var RulesyncMcpConfigSchema = import_mini23.z.object({
|
|
6294
|
+
mcpServers: import_mini23.z.record(import_mini23.z.string(), RulesyncMcpServerSchema)
|
|
6254
6295
|
});
|
|
6255
|
-
var RulesyncMcpFileSchema =
|
|
6256
|
-
$schema:
|
|
6296
|
+
var RulesyncMcpFileSchema = import_mini23.z.looseObject({
|
|
6297
|
+
$schema: import_mini23.z.optional(import_mini23.z.string()),
|
|
6257
6298
|
...RulesyncMcpConfigSchema.shape
|
|
6258
6299
|
});
|
|
6259
6300
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
@@ -7454,25 +7495,25 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
7454
7495
|
// src/features/mcp/kilo-mcp.ts
|
|
7455
7496
|
var import_node_path57 = require("path");
|
|
7456
7497
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
7457
|
-
var
|
|
7458
|
-
var KiloMcpLocalServerSchema =
|
|
7459
|
-
type:
|
|
7460
|
-
command:
|
|
7461
|
-
environment:
|
|
7462
|
-
enabled:
|
|
7463
|
-
cwd:
|
|
7498
|
+
var import_mini24 = require("zod/mini");
|
|
7499
|
+
var KiloMcpLocalServerSchema = import_mini24.z.object({
|
|
7500
|
+
type: import_mini24.z.literal("local"),
|
|
7501
|
+
command: import_mini24.z.array(import_mini24.z.string()),
|
|
7502
|
+
environment: import_mini24.z.optional(import_mini24.z.record(import_mini24.z.string(), import_mini24.z.string())),
|
|
7503
|
+
enabled: import_mini24.z._default(import_mini24.z.boolean(), true),
|
|
7504
|
+
cwd: import_mini24.z.optional(import_mini24.z.string())
|
|
7464
7505
|
});
|
|
7465
|
-
var KiloMcpRemoteServerSchema =
|
|
7466
|
-
type:
|
|
7467
|
-
url:
|
|
7468
|
-
headers:
|
|
7469
|
-
enabled:
|
|
7506
|
+
var KiloMcpRemoteServerSchema = import_mini24.z.object({
|
|
7507
|
+
type: import_mini24.z.literal("remote"),
|
|
7508
|
+
url: import_mini24.z.string(),
|
|
7509
|
+
headers: import_mini24.z.optional(import_mini24.z.record(import_mini24.z.string(), import_mini24.z.string())),
|
|
7510
|
+
enabled: import_mini24.z._default(import_mini24.z.boolean(), true)
|
|
7470
7511
|
});
|
|
7471
|
-
var KiloMcpServerSchema =
|
|
7472
|
-
var KiloConfigSchema =
|
|
7473
|
-
$schema:
|
|
7474
|
-
mcp:
|
|
7475
|
-
tools:
|
|
7512
|
+
var KiloMcpServerSchema = import_mini24.z.union([KiloMcpLocalServerSchema, KiloMcpRemoteServerSchema]);
|
|
7513
|
+
var KiloConfigSchema = import_mini24.z.looseObject({
|
|
7514
|
+
$schema: import_mini24.z.optional(import_mini24.z.string()),
|
|
7515
|
+
mcp: import_mini24.z.optional(import_mini24.z.record(import_mini24.z.string(), KiloMcpServerSchema)),
|
|
7516
|
+
tools: import_mini24.z.optional(import_mini24.z.record(import_mini24.z.string(), import_mini24.z.boolean()))
|
|
7476
7517
|
});
|
|
7477
7518
|
function convertFromKiloFormat(kiloMcp, tools) {
|
|
7478
7519
|
return Object.fromEntries(
|
|
@@ -7769,28 +7810,28 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7769
7810
|
// src/features/mcp/opencode-mcp.ts
|
|
7770
7811
|
var import_node_path59 = require("path");
|
|
7771
7812
|
var import_jsonc_parser3 = require("jsonc-parser");
|
|
7772
|
-
var
|
|
7773
|
-
var OpencodeMcpLocalServerSchema =
|
|
7774
|
-
type:
|
|
7775
|
-
command:
|
|
7776
|
-
environment:
|
|
7777
|
-
enabled:
|
|
7778
|
-
cwd:
|
|
7813
|
+
var import_mini25 = require("zod/mini");
|
|
7814
|
+
var OpencodeMcpLocalServerSchema = import_mini25.z.object({
|
|
7815
|
+
type: import_mini25.z.literal("local"),
|
|
7816
|
+
command: import_mini25.z.array(import_mini25.z.string()),
|
|
7817
|
+
environment: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.string())),
|
|
7818
|
+
enabled: import_mini25.z._default(import_mini25.z.boolean(), true),
|
|
7819
|
+
cwd: import_mini25.z.optional(import_mini25.z.string())
|
|
7779
7820
|
});
|
|
7780
|
-
var OpencodeMcpRemoteServerSchema =
|
|
7781
|
-
type:
|
|
7782
|
-
url:
|
|
7783
|
-
headers:
|
|
7784
|
-
enabled:
|
|
7821
|
+
var OpencodeMcpRemoteServerSchema = import_mini25.z.object({
|
|
7822
|
+
type: import_mini25.z.literal("remote"),
|
|
7823
|
+
url: import_mini25.z.string(),
|
|
7824
|
+
headers: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.string())),
|
|
7825
|
+
enabled: import_mini25.z._default(import_mini25.z.boolean(), true)
|
|
7785
7826
|
});
|
|
7786
|
-
var OpencodeMcpServerSchema =
|
|
7827
|
+
var OpencodeMcpServerSchema = import_mini25.z.union([
|
|
7787
7828
|
OpencodeMcpLocalServerSchema,
|
|
7788
7829
|
OpencodeMcpRemoteServerSchema
|
|
7789
7830
|
]);
|
|
7790
|
-
var OpencodeConfigSchema =
|
|
7791
|
-
$schema:
|
|
7792
|
-
mcp:
|
|
7793
|
-
tools:
|
|
7831
|
+
var OpencodeConfigSchema = import_mini25.z.looseObject({
|
|
7832
|
+
$schema: import_mini25.z.optional(import_mini25.z.string()),
|
|
7833
|
+
mcp: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), OpencodeMcpServerSchema)),
|
|
7834
|
+
tools: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.boolean()))
|
|
7794
7835
|
});
|
|
7795
7836
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
7796
7837
|
return Object.fromEntries(
|
|
@@ -8261,7 +8302,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
8261
8302
|
"roo",
|
|
8262
8303
|
"rovodev"
|
|
8263
8304
|
];
|
|
8264
|
-
var McpProcessorToolTargetSchema =
|
|
8305
|
+
var McpProcessorToolTargetSchema = import_mini26.z.enum(mcpProcessorToolTargetTuple);
|
|
8265
8306
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
8266
8307
|
[
|
|
8267
8308
|
"claudecode",
|
|
@@ -8602,7 +8643,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
8602
8643
|
// src/features/rules/rules-processor.ts
|
|
8603
8644
|
var import_node_path131 = require("path");
|
|
8604
8645
|
var import_toon = require("@toon-format/toon");
|
|
8605
|
-
var
|
|
8646
|
+
var import_mini65 = require("zod/mini");
|
|
8606
8647
|
|
|
8607
8648
|
// src/constants/general.ts
|
|
8608
8649
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -8612,7 +8653,7 @@ var import_node_path65 = require("path");
|
|
|
8612
8653
|
|
|
8613
8654
|
// src/features/skills/simulated-skill.ts
|
|
8614
8655
|
var import_node_path64 = require("path");
|
|
8615
|
-
var
|
|
8656
|
+
var import_mini27 = require("zod/mini");
|
|
8616
8657
|
|
|
8617
8658
|
// src/features/skills/tool-skill.ts
|
|
8618
8659
|
var import_node_path63 = require("path");
|
|
@@ -8849,9 +8890,9 @@ var ToolSkill = class extends AiDir {
|
|
|
8849
8890
|
};
|
|
8850
8891
|
|
|
8851
8892
|
// src/features/skills/simulated-skill.ts
|
|
8852
|
-
var SimulatedSkillFrontmatterSchema =
|
|
8853
|
-
name:
|
|
8854
|
-
description:
|
|
8893
|
+
var SimulatedSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8894
|
+
name: import_mini27.z.string(),
|
|
8895
|
+
description: import_mini27.z.string()
|
|
8855
8896
|
});
|
|
8856
8897
|
var SimulatedSkill = class extends ToolSkill {
|
|
8857
8898
|
frontmatter;
|
|
@@ -9078,49 +9119,49 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
9078
9119
|
|
|
9079
9120
|
// src/features/skills/rovodev-skill.ts
|
|
9080
9121
|
var import_node_path68 = require("path");
|
|
9081
|
-
var
|
|
9122
|
+
var import_mini29 = require("zod/mini");
|
|
9082
9123
|
|
|
9083
9124
|
// src/features/skills/rulesync-skill.ts
|
|
9084
9125
|
var import_node_path67 = require("path");
|
|
9085
|
-
var
|
|
9086
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
9087
|
-
name:
|
|
9088
|
-
description:
|
|
9089
|
-
targets:
|
|
9090
|
-
claudecode:
|
|
9091
|
-
|
|
9092
|
-
"allowed-tools":
|
|
9093
|
-
model:
|
|
9094
|
-
"disable-model-invocation":
|
|
9126
|
+
var import_mini28 = require("zod/mini");
|
|
9127
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini28.z.looseObject({
|
|
9128
|
+
name: import_mini28.z.string(),
|
|
9129
|
+
description: import_mini28.z.string(),
|
|
9130
|
+
targets: import_mini28.z._default(RulesyncTargetsSchema, ["*"]),
|
|
9131
|
+
claudecode: import_mini28.z.optional(
|
|
9132
|
+
import_mini28.z.looseObject({
|
|
9133
|
+
"allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string())),
|
|
9134
|
+
model: import_mini28.z.optional(import_mini28.z.string()),
|
|
9135
|
+
"disable-model-invocation": import_mini28.z.optional(import_mini28.z.boolean())
|
|
9095
9136
|
})
|
|
9096
9137
|
),
|
|
9097
|
-
codexcli:
|
|
9098
|
-
|
|
9099
|
-
"short-description":
|
|
9138
|
+
codexcli: import_mini28.z.optional(
|
|
9139
|
+
import_mini28.z.looseObject({
|
|
9140
|
+
"short-description": import_mini28.z.optional(import_mini28.z.string())
|
|
9100
9141
|
})
|
|
9101
9142
|
),
|
|
9102
|
-
opencode:
|
|
9103
|
-
|
|
9104
|
-
"allowed-tools":
|
|
9143
|
+
opencode: import_mini28.z.optional(
|
|
9144
|
+
import_mini28.z.looseObject({
|
|
9145
|
+
"allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
|
|
9105
9146
|
})
|
|
9106
9147
|
),
|
|
9107
|
-
kilo:
|
|
9108
|
-
|
|
9109
|
-
"allowed-tools":
|
|
9148
|
+
kilo: import_mini28.z.optional(
|
|
9149
|
+
import_mini28.z.looseObject({
|
|
9150
|
+
"allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
|
|
9110
9151
|
})
|
|
9111
9152
|
),
|
|
9112
|
-
deepagents:
|
|
9113
|
-
|
|
9114
|
-
"allowed-tools":
|
|
9153
|
+
deepagents: import_mini28.z.optional(
|
|
9154
|
+
import_mini28.z.looseObject({
|
|
9155
|
+
"allowed-tools": import_mini28.z.optional(import_mini28.z.array(import_mini28.z.string()))
|
|
9115
9156
|
})
|
|
9116
9157
|
),
|
|
9117
|
-
copilot:
|
|
9118
|
-
|
|
9119
|
-
license:
|
|
9158
|
+
copilot: import_mini28.z.optional(
|
|
9159
|
+
import_mini28.z.looseObject({
|
|
9160
|
+
license: import_mini28.z.optional(import_mini28.z.string())
|
|
9120
9161
|
})
|
|
9121
9162
|
),
|
|
9122
|
-
cline:
|
|
9123
|
-
roo:
|
|
9163
|
+
cline: import_mini28.z.optional(import_mini28.z.looseObject({})),
|
|
9164
|
+
roo: import_mini28.z.optional(import_mini28.z.looseObject({}))
|
|
9124
9165
|
});
|
|
9125
9166
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
9126
9167
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -9217,9 +9258,9 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
9217
9258
|
};
|
|
9218
9259
|
|
|
9219
9260
|
// src/features/skills/rovodev-skill.ts
|
|
9220
|
-
var RovodevSkillFrontmatterSchema =
|
|
9221
|
-
name:
|
|
9222
|
-
description:
|
|
9261
|
+
var RovodevSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
9262
|
+
name: import_mini29.z.string(),
|
|
9263
|
+
description: import_mini29.z.string()
|
|
9223
9264
|
});
|
|
9224
9265
|
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
9225
9266
|
constructor({
|
|
@@ -9391,7 +9432,7 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
9391
9432
|
|
|
9392
9433
|
// src/features/skills/skills-processor.ts
|
|
9393
9434
|
var import_node_path86 = require("path");
|
|
9394
|
-
var
|
|
9435
|
+
var import_mini45 = require("zod/mini");
|
|
9395
9436
|
|
|
9396
9437
|
// src/types/dir-feature-processor.ts
|
|
9397
9438
|
var import_node_path69 = require("path");
|
|
@@ -9530,10 +9571,10 @@ var DirFeatureProcessor = class {
|
|
|
9530
9571
|
|
|
9531
9572
|
// src/features/skills/agentsskills-skill.ts
|
|
9532
9573
|
var import_node_path70 = require("path");
|
|
9533
|
-
var
|
|
9534
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
9535
|
-
name:
|
|
9536
|
-
description:
|
|
9574
|
+
var import_mini30 = require("zod/mini");
|
|
9575
|
+
var AgentsSkillsSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
9576
|
+
name: import_mini30.z.string(),
|
|
9577
|
+
description: import_mini30.z.string()
|
|
9537
9578
|
});
|
|
9538
9579
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
9539
9580
|
constructor({
|
|
@@ -9688,10 +9729,10 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
9688
9729
|
|
|
9689
9730
|
// src/features/skills/antigravity-skill.ts
|
|
9690
9731
|
var import_node_path71 = require("path");
|
|
9691
|
-
var
|
|
9692
|
-
var AntigravitySkillFrontmatterSchema =
|
|
9693
|
-
name:
|
|
9694
|
-
description:
|
|
9732
|
+
var import_mini31 = require("zod/mini");
|
|
9733
|
+
var AntigravitySkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9734
|
+
name: import_mini31.z.string(),
|
|
9735
|
+
description: import_mini31.z.string()
|
|
9695
9736
|
});
|
|
9696
9737
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
9697
9738
|
constructor({
|
|
@@ -9849,13 +9890,13 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
9849
9890
|
|
|
9850
9891
|
// src/features/skills/claudecode-skill.ts
|
|
9851
9892
|
var import_node_path72 = require("path");
|
|
9852
|
-
var
|
|
9853
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
9854
|
-
name:
|
|
9855
|
-
description:
|
|
9856
|
-
"allowed-tools":
|
|
9857
|
-
model:
|
|
9858
|
-
"disable-model-invocation":
|
|
9893
|
+
var import_mini32 = require("zod/mini");
|
|
9894
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9895
|
+
name: import_mini32.z.string(),
|
|
9896
|
+
description: import_mini32.z.string(),
|
|
9897
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string())),
|
|
9898
|
+
model: import_mini32.z.optional(import_mini32.z.string()),
|
|
9899
|
+
"disable-model-invocation": import_mini32.z.optional(import_mini32.z.boolean())
|
|
9859
9900
|
});
|
|
9860
9901
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
9861
9902
|
constructor({
|
|
@@ -10025,10 +10066,10 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
10025
10066
|
|
|
10026
10067
|
// src/features/skills/cline-skill.ts
|
|
10027
10068
|
var import_node_path73 = require("path");
|
|
10028
|
-
var
|
|
10029
|
-
var ClineSkillFrontmatterSchema =
|
|
10030
|
-
name:
|
|
10031
|
-
description:
|
|
10069
|
+
var import_mini33 = require("zod/mini");
|
|
10070
|
+
var ClineSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
10071
|
+
name: import_mini33.z.string(),
|
|
10072
|
+
description: import_mini33.z.string()
|
|
10032
10073
|
});
|
|
10033
10074
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
10034
10075
|
constructor({
|
|
@@ -10198,13 +10239,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
10198
10239
|
|
|
10199
10240
|
// src/features/skills/codexcli-skill.ts
|
|
10200
10241
|
var import_node_path74 = require("path");
|
|
10201
|
-
var
|
|
10202
|
-
var CodexCliSkillFrontmatterSchema =
|
|
10203
|
-
name:
|
|
10204
|
-
description:
|
|
10205
|
-
metadata:
|
|
10206
|
-
|
|
10207
|
-
"short-description":
|
|
10242
|
+
var import_mini34 = require("zod/mini");
|
|
10243
|
+
var CodexCliSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
10244
|
+
name: import_mini34.z.string(),
|
|
10245
|
+
description: import_mini34.z.string(),
|
|
10246
|
+
metadata: import_mini34.z.optional(
|
|
10247
|
+
import_mini34.z.looseObject({
|
|
10248
|
+
"short-description": import_mini34.z.optional(import_mini34.z.string())
|
|
10208
10249
|
})
|
|
10209
10250
|
)
|
|
10210
10251
|
});
|
|
@@ -10369,11 +10410,11 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
10369
10410
|
|
|
10370
10411
|
// src/features/skills/copilot-skill.ts
|
|
10371
10412
|
var import_node_path75 = require("path");
|
|
10372
|
-
var
|
|
10373
|
-
var CopilotSkillFrontmatterSchema =
|
|
10374
|
-
name:
|
|
10375
|
-
description:
|
|
10376
|
-
license:
|
|
10413
|
+
var import_mini35 = require("zod/mini");
|
|
10414
|
+
var CopilotSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
10415
|
+
name: import_mini35.z.string(),
|
|
10416
|
+
description: import_mini35.z.string(),
|
|
10417
|
+
license: import_mini35.z.optional(import_mini35.z.string())
|
|
10377
10418
|
});
|
|
10378
10419
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
10379
10420
|
constructor({
|
|
@@ -10534,10 +10575,10 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
10534
10575
|
|
|
10535
10576
|
// src/features/skills/cursor-skill.ts
|
|
10536
10577
|
var import_node_path76 = require("path");
|
|
10537
|
-
var
|
|
10538
|
-
var CursorSkillFrontmatterSchema =
|
|
10539
|
-
name:
|
|
10540
|
-
description:
|
|
10578
|
+
var import_mini36 = require("zod/mini");
|
|
10579
|
+
var CursorSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10580
|
+
name: import_mini36.z.string(),
|
|
10581
|
+
description: import_mini36.z.string()
|
|
10541
10582
|
});
|
|
10542
10583
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
10543
10584
|
constructor({
|
|
@@ -10689,11 +10730,11 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
10689
10730
|
|
|
10690
10731
|
// src/features/skills/deepagents-skill.ts
|
|
10691
10732
|
var import_node_path77 = require("path");
|
|
10692
|
-
var
|
|
10693
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
10694
|
-
name:
|
|
10695
|
-
description:
|
|
10696
|
-
"allowed-tools":
|
|
10733
|
+
var import_mini37 = require("zod/mini");
|
|
10734
|
+
var DeepagentsSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10735
|
+
name: import_mini37.z.string(),
|
|
10736
|
+
description: import_mini37.z.string(),
|
|
10737
|
+
"allowed-tools": import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string()))
|
|
10697
10738
|
});
|
|
10698
10739
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
10699
10740
|
constructor({
|
|
@@ -10851,10 +10892,10 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
10851
10892
|
|
|
10852
10893
|
// src/features/skills/geminicli-skill.ts
|
|
10853
10894
|
var import_node_path78 = require("path");
|
|
10854
|
-
var
|
|
10855
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
10856
|
-
name:
|
|
10857
|
-
description:
|
|
10895
|
+
var import_mini38 = require("zod/mini");
|
|
10896
|
+
var GeminiCliSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10897
|
+
name: import_mini38.z.string(),
|
|
10898
|
+
description: import_mini38.z.string()
|
|
10858
10899
|
});
|
|
10859
10900
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
10860
10901
|
constructor({
|
|
@@ -11008,10 +11049,10 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
11008
11049
|
|
|
11009
11050
|
// src/features/skills/junie-skill.ts
|
|
11010
11051
|
var import_node_path79 = require("path");
|
|
11011
|
-
var
|
|
11012
|
-
var JunieSkillFrontmatterSchema =
|
|
11013
|
-
name:
|
|
11014
|
-
description:
|
|
11052
|
+
var import_mini39 = require("zod/mini");
|
|
11053
|
+
var JunieSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
11054
|
+
name: import_mini39.z.string(),
|
|
11055
|
+
description: import_mini39.z.string()
|
|
11015
11056
|
});
|
|
11016
11057
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
11017
11058
|
constructor({
|
|
@@ -11184,11 +11225,11 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
11184
11225
|
|
|
11185
11226
|
// src/features/skills/kilo-skill.ts
|
|
11186
11227
|
var import_node_path80 = require("path");
|
|
11187
|
-
var
|
|
11188
|
-
var KiloSkillFrontmatterSchema =
|
|
11189
|
-
name:
|
|
11190
|
-
description:
|
|
11191
|
-
"allowed-tools":
|
|
11228
|
+
var import_mini40 = require("zod/mini");
|
|
11229
|
+
var KiloSkillFrontmatterSchema = import_mini40.z.looseObject({
|
|
11230
|
+
name: import_mini40.z.string(),
|
|
11231
|
+
description: import_mini40.z.string(),
|
|
11232
|
+
"allowed-tools": import_mini40.z.optional(import_mini40.z.array(import_mini40.z.string()))
|
|
11192
11233
|
});
|
|
11193
11234
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
11194
11235
|
constructor({
|
|
@@ -11345,10 +11386,10 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
11345
11386
|
|
|
11346
11387
|
// src/features/skills/kiro-skill.ts
|
|
11347
11388
|
var import_node_path81 = require("path");
|
|
11348
|
-
var
|
|
11349
|
-
var KiroSkillFrontmatterSchema =
|
|
11350
|
-
name:
|
|
11351
|
-
description:
|
|
11389
|
+
var import_mini41 = require("zod/mini");
|
|
11390
|
+
var KiroSkillFrontmatterSchema = import_mini41.z.looseObject({
|
|
11391
|
+
name: import_mini41.z.string(),
|
|
11392
|
+
description: import_mini41.z.string()
|
|
11352
11393
|
});
|
|
11353
11394
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
11354
11395
|
constructor({
|
|
@@ -11522,11 +11563,11 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
11522
11563
|
|
|
11523
11564
|
// src/features/skills/opencode-skill.ts
|
|
11524
11565
|
var import_node_path82 = require("path");
|
|
11525
|
-
var
|
|
11526
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
11527
|
-
name:
|
|
11528
|
-
description:
|
|
11529
|
-
"allowed-tools":
|
|
11566
|
+
var import_mini42 = require("zod/mini");
|
|
11567
|
+
var OpenCodeSkillFrontmatterSchema = import_mini42.z.looseObject({
|
|
11568
|
+
name: import_mini42.z.string(),
|
|
11569
|
+
description: import_mini42.z.string(),
|
|
11570
|
+
"allowed-tools": import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
|
|
11530
11571
|
});
|
|
11531
11572
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
11532
11573
|
constructor({
|
|
@@ -11683,10 +11724,10 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
11683
11724
|
|
|
11684
11725
|
// src/features/skills/replit-skill.ts
|
|
11685
11726
|
var import_node_path83 = require("path");
|
|
11686
|
-
var
|
|
11687
|
-
var ReplitSkillFrontmatterSchema =
|
|
11688
|
-
name:
|
|
11689
|
-
description:
|
|
11727
|
+
var import_mini43 = require("zod/mini");
|
|
11728
|
+
var ReplitSkillFrontmatterSchema = import_mini43.z.looseObject({
|
|
11729
|
+
name: import_mini43.z.string(),
|
|
11730
|
+
description: import_mini43.z.string()
|
|
11690
11731
|
});
|
|
11691
11732
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
11692
11733
|
constructor({
|
|
@@ -11841,10 +11882,10 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
11841
11882
|
|
|
11842
11883
|
// src/features/skills/roo-skill.ts
|
|
11843
11884
|
var import_node_path84 = require("path");
|
|
11844
|
-
var
|
|
11845
|
-
var RooSkillFrontmatterSchema =
|
|
11846
|
-
name:
|
|
11847
|
-
description:
|
|
11885
|
+
var import_mini44 = require("zod/mini");
|
|
11886
|
+
var RooSkillFrontmatterSchema = import_mini44.z.looseObject({
|
|
11887
|
+
name: import_mini44.z.string(),
|
|
11888
|
+
description: import_mini44.z.string()
|
|
11848
11889
|
});
|
|
11849
11890
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
11850
11891
|
constructor({
|
|
@@ -12053,7 +12094,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
12053
12094
|
"roo",
|
|
12054
12095
|
"rovodev"
|
|
12055
12096
|
];
|
|
12056
|
-
var SkillsProcessorToolTargetSchema =
|
|
12097
|
+
var SkillsProcessorToolTargetSchema = import_mini45.z.enum(skillsProcessorToolTargetTuple);
|
|
12057
12098
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
12058
12099
|
[
|
|
12059
12100
|
"agentsmd",
|
|
@@ -12425,7 +12466,7 @@ var import_node_path88 = require("path");
|
|
|
12425
12466
|
|
|
12426
12467
|
// src/features/subagents/simulated-subagent.ts
|
|
12427
12468
|
var import_node_path87 = require("path");
|
|
12428
|
-
var
|
|
12469
|
+
var import_mini46 = require("zod/mini");
|
|
12429
12470
|
|
|
12430
12471
|
// src/features/subagents/tool-subagent.ts
|
|
12431
12472
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -12477,9 +12518,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
12477
12518
|
};
|
|
12478
12519
|
|
|
12479
12520
|
// src/features/subagents/simulated-subagent.ts
|
|
12480
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
12481
|
-
name:
|
|
12482
|
-
description:
|
|
12521
|
+
var SimulatedSubagentFrontmatterSchema = import_mini46.z.object({
|
|
12522
|
+
name: import_mini46.z.string(),
|
|
12523
|
+
description: import_mini46.z.optional(import_mini46.z.string())
|
|
12483
12524
|
});
|
|
12484
12525
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
12485
12526
|
frontmatter;
|
|
@@ -12637,15 +12678,15 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
12637
12678
|
|
|
12638
12679
|
// src/features/subagents/geminicli-subagent.ts
|
|
12639
12680
|
var import_node_path91 = require("path");
|
|
12640
|
-
var
|
|
12681
|
+
var import_mini48 = require("zod/mini");
|
|
12641
12682
|
|
|
12642
12683
|
// src/features/subagents/rulesync-subagent.ts
|
|
12643
12684
|
var import_node_path90 = require("path");
|
|
12644
|
-
var
|
|
12645
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
12646
|
-
targets:
|
|
12647
|
-
name:
|
|
12648
|
-
description:
|
|
12685
|
+
var import_mini47 = require("zod/mini");
|
|
12686
|
+
var RulesyncSubagentFrontmatterSchema = import_mini47.z.looseObject({
|
|
12687
|
+
targets: import_mini47.z._default(RulesyncTargetsSchema, ["*"]),
|
|
12688
|
+
name: import_mini47.z.string(),
|
|
12689
|
+
description: import_mini47.z.optional(import_mini47.z.string())
|
|
12649
12690
|
});
|
|
12650
12691
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
12651
12692
|
frontmatter;
|
|
@@ -12714,9 +12755,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12714
12755
|
};
|
|
12715
12756
|
|
|
12716
12757
|
// src/features/subagents/geminicli-subagent.ts
|
|
12717
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
12718
|
-
name:
|
|
12719
|
-
description:
|
|
12758
|
+
var GeminiCliSubagentFrontmatterSchema = import_mini48.z.looseObject({
|
|
12759
|
+
name: import_mini48.z.string(),
|
|
12760
|
+
description: import_mini48.z.optional(import_mini48.z.string())
|
|
12720
12761
|
});
|
|
12721
12762
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
12722
12763
|
frontmatter;
|
|
@@ -12889,10 +12930,10 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
12889
12930
|
|
|
12890
12931
|
// src/features/subagents/rovodev-subagent.ts
|
|
12891
12932
|
var import_node_path93 = require("path");
|
|
12892
|
-
var
|
|
12893
|
-
var RovodevSubagentFrontmatterSchema =
|
|
12894
|
-
name:
|
|
12895
|
-
description:
|
|
12933
|
+
var import_mini49 = require("zod/mini");
|
|
12934
|
+
var RovodevSubagentFrontmatterSchema = import_mini49.z.looseObject({
|
|
12935
|
+
name: import_mini49.z.string(),
|
|
12936
|
+
description: import_mini49.z.optional(import_mini49.z.string())
|
|
12896
12937
|
});
|
|
12897
12938
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
12898
12939
|
frontmatter;
|
|
@@ -13034,18 +13075,18 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13034
13075
|
|
|
13035
13076
|
// src/features/subagents/subagents-processor.ts
|
|
13036
13077
|
var import_node_path104 = require("path");
|
|
13037
|
-
var
|
|
13078
|
+
var import_mini58 = require("zod/mini");
|
|
13038
13079
|
|
|
13039
13080
|
// src/features/subagents/claudecode-subagent.ts
|
|
13040
13081
|
var import_node_path94 = require("path");
|
|
13041
|
-
var
|
|
13042
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
13043
|
-
name:
|
|
13044
|
-
description:
|
|
13045
|
-
model:
|
|
13046
|
-
tools:
|
|
13047
|
-
permissionMode:
|
|
13048
|
-
skills:
|
|
13082
|
+
var import_mini50 = require("zod/mini");
|
|
13083
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini50.z.looseObject({
|
|
13084
|
+
name: import_mini50.z.string(),
|
|
13085
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
13086
|
+
model: import_mini50.z.optional(import_mini50.z.string()),
|
|
13087
|
+
tools: import_mini50.z.optional(import_mini50.z.union([import_mini50.z.string(), import_mini50.z.array(import_mini50.z.string())])),
|
|
13088
|
+
permissionMode: import_mini50.z.optional(import_mini50.z.string()),
|
|
13089
|
+
skills: import_mini50.z.optional(import_mini50.z.union([import_mini50.z.string(), import_mini50.z.array(import_mini50.z.string())]))
|
|
13049
13090
|
});
|
|
13050
13091
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
13051
13092
|
frontmatter;
|
|
@@ -13201,14 +13242,14 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13201
13242
|
// src/features/subagents/codexcli-subagent.ts
|
|
13202
13243
|
var import_node_path95 = require("path");
|
|
13203
13244
|
var smolToml4 = __toESM(require("smol-toml"), 1);
|
|
13204
|
-
var
|
|
13205
|
-
var CodexCliSubagentTomlSchema =
|
|
13206
|
-
name:
|
|
13207
|
-
description:
|
|
13208
|
-
developer_instructions:
|
|
13209
|
-
model:
|
|
13210
|
-
model_reasoning_effort:
|
|
13211
|
-
sandbox_mode:
|
|
13245
|
+
var import_mini51 = require("zod/mini");
|
|
13246
|
+
var CodexCliSubagentTomlSchema = import_mini51.z.looseObject({
|
|
13247
|
+
name: import_mini51.z.string(),
|
|
13248
|
+
description: import_mini51.z.optional(import_mini51.z.string()),
|
|
13249
|
+
developer_instructions: import_mini51.z.optional(import_mini51.z.string()),
|
|
13250
|
+
model: import_mini51.z.optional(import_mini51.z.string()),
|
|
13251
|
+
model_reasoning_effort: import_mini51.z.optional(import_mini51.z.string()),
|
|
13252
|
+
sandbox_mode: import_mini51.z.optional(import_mini51.z.string())
|
|
13212
13253
|
});
|
|
13213
13254
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
13214
13255
|
body;
|
|
@@ -13363,12 +13404,12 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13363
13404
|
|
|
13364
13405
|
// src/features/subagents/copilot-subagent.ts
|
|
13365
13406
|
var import_node_path96 = require("path");
|
|
13366
|
-
var
|
|
13407
|
+
var import_mini52 = require("zod/mini");
|
|
13367
13408
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
13368
|
-
var CopilotSubagentFrontmatterSchema =
|
|
13369
|
-
name:
|
|
13370
|
-
description:
|
|
13371
|
-
tools:
|
|
13409
|
+
var CopilotSubagentFrontmatterSchema = import_mini52.z.looseObject({
|
|
13410
|
+
name: import_mini52.z.string(),
|
|
13411
|
+
description: import_mini52.z.optional(import_mini52.z.string()),
|
|
13412
|
+
tools: import_mini52.z.optional(import_mini52.z.union([import_mini52.z.string(), import_mini52.z.array(import_mini52.z.string())]))
|
|
13372
13413
|
});
|
|
13373
13414
|
var normalizeTools = (tools) => {
|
|
13374
13415
|
if (!tools) {
|
|
@@ -13529,10 +13570,10 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13529
13570
|
|
|
13530
13571
|
// src/features/subagents/cursor-subagent.ts
|
|
13531
13572
|
var import_node_path97 = require("path");
|
|
13532
|
-
var
|
|
13533
|
-
var CursorSubagentFrontmatterSchema =
|
|
13534
|
-
name:
|
|
13535
|
-
description:
|
|
13573
|
+
var import_mini53 = require("zod/mini");
|
|
13574
|
+
var CursorSubagentFrontmatterSchema = import_mini53.z.looseObject({
|
|
13575
|
+
name: import_mini53.z.string(),
|
|
13576
|
+
description: import_mini53.z.optional(import_mini53.z.string())
|
|
13536
13577
|
});
|
|
13537
13578
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
13538
13579
|
frontmatter;
|
|
@@ -13676,11 +13717,11 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13676
13717
|
|
|
13677
13718
|
// src/features/subagents/deepagents-subagent.ts
|
|
13678
13719
|
var import_node_path98 = require("path");
|
|
13679
|
-
var
|
|
13680
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
13681
|
-
name:
|
|
13682
|
-
description:
|
|
13683
|
-
model:
|
|
13720
|
+
var import_mini54 = require("zod/mini");
|
|
13721
|
+
var DeepagentsSubagentFrontmatterSchema = import_mini54.z.looseObject({
|
|
13722
|
+
name: import_mini54.z.string(),
|
|
13723
|
+
description: import_mini54.z.optional(import_mini54.z.string()),
|
|
13724
|
+
model: import_mini54.z.optional(import_mini54.z.string())
|
|
13684
13725
|
});
|
|
13685
13726
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
13686
13727
|
frontmatter;
|
|
@@ -13829,10 +13870,10 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13829
13870
|
|
|
13830
13871
|
// src/features/subagents/junie-subagent.ts
|
|
13831
13872
|
var import_node_path99 = require("path");
|
|
13832
|
-
var
|
|
13833
|
-
var JunieSubagentFrontmatterSchema =
|
|
13834
|
-
name:
|
|
13835
|
-
description:
|
|
13873
|
+
var import_mini55 = require("zod/mini");
|
|
13874
|
+
var JunieSubagentFrontmatterSchema = import_mini55.z.looseObject({
|
|
13875
|
+
name: import_mini55.z.optional(import_mini55.z.string()),
|
|
13876
|
+
description: import_mini55.z.string()
|
|
13836
13877
|
});
|
|
13837
13878
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
13838
13879
|
frontmatter;
|
|
@@ -13990,11 +14031,11 @@ var import_node_path101 = require("path");
|
|
|
13990
14031
|
|
|
13991
14032
|
// src/features/subagents/opencode-style-subagent.ts
|
|
13992
14033
|
var import_node_path100 = require("path");
|
|
13993
|
-
var
|
|
13994
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
13995
|
-
description:
|
|
13996
|
-
mode:
|
|
13997
|
-
name:
|
|
14034
|
+
var import_mini56 = require("zod/mini");
|
|
14035
|
+
var OpenCodeStyleSubagentFrontmatterSchema = import_mini56.z.looseObject({
|
|
14036
|
+
description: import_mini56.z.optional(import_mini56.z.string()),
|
|
14037
|
+
mode: import_mini56.z._default(import_mini56.z.string(), "subagent"),
|
|
14038
|
+
name: import_mini56.z.optional(import_mini56.z.string())
|
|
13998
14039
|
});
|
|
13999
14040
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
14000
14041
|
frontmatter;
|
|
@@ -14143,22 +14184,22 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14143
14184
|
|
|
14144
14185
|
// src/features/subagents/kiro-subagent.ts
|
|
14145
14186
|
var import_node_path102 = require("path");
|
|
14146
|
-
var
|
|
14147
|
-
var KiroCliSubagentJsonSchema =
|
|
14148
|
-
name:
|
|
14149
|
-
description:
|
|
14150
|
-
prompt:
|
|
14151
|
-
tools:
|
|
14152
|
-
toolAliases:
|
|
14153
|
-
toolSettings:
|
|
14154
|
-
toolSchema:
|
|
14155
|
-
hooks:
|
|
14156
|
-
model:
|
|
14157
|
-
mcpServers:
|
|
14158
|
-
useLegacyMcpJson:
|
|
14159
|
-
resources:
|
|
14160
|
-
allowedTools:
|
|
14161
|
-
includeMcpJson:
|
|
14187
|
+
var import_mini57 = require("zod/mini");
|
|
14188
|
+
var KiroCliSubagentJsonSchema = import_mini57.z.looseObject({
|
|
14189
|
+
name: import_mini57.z.string(),
|
|
14190
|
+
description: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.string())),
|
|
14191
|
+
prompt: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.string())),
|
|
14192
|
+
tools: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.array(import_mini57.z.string()))),
|
|
14193
|
+
toolAliases: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.record(import_mini57.z.string(), import_mini57.z.string()))),
|
|
14194
|
+
toolSettings: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.unknown())),
|
|
14195
|
+
toolSchema: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.unknown())),
|
|
14196
|
+
hooks: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.record(import_mini57.z.string(), import_mini57.z.array(import_mini57.z.unknown())))),
|
|
14197
|
+
model: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.string())),
|
|
14198
|
+
mcpServers: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.record(import_mini57.z.string(), import_mini57.z.unknown()))),
|
|
14199
|
+
useLegacyMcpJson: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.boolean())),
|
|
14200
|
+
resources: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.array(import_mini57.z.string()))),
|
|
14201
|
+
allowedTools: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.array(import_mini57.z.string()))),
|
|
14202
|
+
includeMcpJson: import_mini57.z.optional(import_mini57.z.nullable(import_mini57.z.boolean()))
|
|
14162
14203
|
});
|
|
14163
14204
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
14164
14205
|
body;
|
|
@@ -14419,7 +14460,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
14419
14460
|
"roo",
|
|
14420
14461
|
"rovodev"
|
|
14421
14462
|
];
|
|
14422
|
-
var SubagentsProcessorToolTargetSchema =
|
|
14463
|
+
var SubagentsProcessorToolTargetSchema = import_mini58.z.enum(subagentsProcessorToolTargetTuple);
|
|
14423
14464
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
14424
14465
|
[
|
|
14425
14466
|
"agentsmd",
|
|
@@ -14729,42 +14770,42 @@ var import_node_path106 = require("path");
|
|
|
14729
14770
|
|
|
14730
14771
|
// src/features/rules/rulesync-rule.ts
|
|
14731
14772
|
var import_node_path105 = require("path");
|
|
14732
|
-
var
|
|
14733
|
-
var RulesyncRuleFrontmatterSchema =
|
|
14734
|
-
root:
|
|
14735
|
-
localRoot:
|
|
14736
|
-
targets:
|
|
14737
|
-
description:
|
|
14738
|
-
globs:
|
|
14739
|
-
agentsmd:
|
|
14740
|
-
|
|
14773
|
+
var import_mini59 = require("zod/mini");
|
|
14774
|
+
var RulesyncRuleFrontmatterSchema = import_mini59.z.object({
|
|
14775
|
+
root: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
14776
|
+
localRoot: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
14777
|
+
targets: import_mini59.z._default(RulesyncTargetsSchema, ["*"]),
|
|
14778
|
+
description: import_mini59.z.optional(import_mini59.z.string()),
|
|
14779
|
+
globs: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string())),
|
|
14780
|
+
agentsmd: import_mini59.z.optional(
|
|
14781
|
+
import_mini59.z.looseObject({
|
|
14741
14782
|
// @example "path/to/subproject"
|
|
14742
|
-
subprojectPath:
|
|
14783
|
+
subprojectPath: import_mini59.z.optional(import_mini59.z.string())
|
|
14743
14784
|
})
|
|
14744
14785
|
),
|
|
14745
|
-
claudecode:
|
|
14746
|
-
|
|
14786
|
+
claudecode: import_mini59.z.optional(
|
|
14787
|
+
import_mini59.z.looseObject({
|
|
14747
14788
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
14748
14789
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
14749
|
-
paths:
|
|
14790
|
+
paths: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string()))
|
|
14750
14791
|
})
|
|
14751
14792
|
),
|
|
14752
|
-
cursor:
|
|
14753
|
-
|
|
14754
|
-
alwaysApply:
|
|
14755
|
-
description:
|
|
14756
|
-
globs:
|
|
14793
|
+
cursor: import_mini59.z.optional(
|
|
14794
|
+
import_mini59.z.looseObject({
|
|
14795
|
+
alwaysApply: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
14796
|
+
description: import_mini59.z.optional(import_mini59.z.string()),
|
|
14797
|
+
globs: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string()))
|
|
14757
14798
|
})
|
|
14758
14799
|
),
|
|
14759
|
-
copilot:
|
|
14760
|
-
|
|
14761
|
-
excludeAgent:
|
|
14800
|
+
copilot: import_mini59.z.optional(
|
|
14801
|
+
import_mini59.z.looseObject({
|
|
14802
|
+
excludeAgent: import_mini59.z.optional(import_mini59.z.union([import_mini59.z.literal("code-review"), import_mini59.z.literal("coding-agent")]))
|
|
14762
14803
|
})
|
|
14763
14804
|
),
|
|
14764
|
-
antigravity:
|
|
14765
|
-
|
|
14766
|
-
trigger:
|
|
14767
|
-
globs:
|
|
14805
|
+
antigravity: import_mini59.z.optional(
|
|
14806
|
+
import_mini59.z.looseObject({
|
|
14807
|
+
trigger: import_mini59.z.optional(import_mini59.z.string()),
|
|
14808
|
+
globs: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string()))
|
|
14768
14809
|
})
|
|
14769
14810
|
)
|
|
14770
14811
|
});
|
|
@@ -15064,20 +15105,20 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15064
15105
|
|
|
15065
15106
|
// src/features/rules/antigravity-rule.ts
|
|
15066
15107
|
var import_node_path108 = require("path");
|
|
15067
|
-
var
|
|
15068
|
-
var AntigravityRuleFrontmatterSchema =
|
|
15069
|
-
trigger:
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15108
|
+
var import_mini60 = require("zod/mini");
|
|
15109
|
+
var AntigravityRuleFrontmatterSchema = import_mini60.z.looseObject({
|
|
15110
|
+
trigger: import_mini60.z.optional(
|
|
15111
|
+
import_mini60.z.union([
|
|
15112
|
+
import_mini60.z.literal("always_on"),
|
|
15113
|
+
import_mini60.z.literal("glob"),
|
|
15114
|
+
import_mini60.z.literal("manual"),
|
|
15115
|
+
import_mini60.z.literal("model_decision"),
|
|
15116
|
+
import_mini60.z.string()
|
|
15076
15117
|
// accepts any string for forward compatibility
|
|
15077
15118
|
])
|
|
15078
15119
|
),
|
|
15079
|
-
globs:
|
|
15080
|
-
description:
|
|
15120
|
+
globs: import_mini60.z.optional(import_mini60.z.string()),
|
|
15121
|
+
description: import_mini60.z.optional(import_mini60.z.string())
|
|
15081
15122
|
});
|
|
15082
15123
|
function parseGlobsString(globs) {
|
|
15083
15124
|
if (!globs) {
|
|
@@ -15664,9 +15705,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15664
15705
|
|
|
15665
15706
|
// src/features/rules/claudecode-rule.ts
|
|
15666
15707
|
var import_node_path112 = require("path");
|
|
15667
|
-
var
|
|
15668
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
15669
|
-
paths:
|
|
15708
|
+
var import_mini61 = require("zod/mini");
|
|
15709
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini61.z.object({
|
|
15710
|
+
paths: import_mini61.z.optional(import_mini61.z.array(import_mini61.z.string()))
|
|
15670
15711
|
});
|
|
15671
15712
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
15672
15713
|
frontmatter;
|
|
@@ -15882,9 +15923,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15882
15923
|
|
|
15883
15924
|
// src/features/rules/cline-rule.ts
|
|
15884
15925
|
var import_node_path113 = require("path");
|
|
15885
|
-
var
|
|
15886
|
-
var ClineRuleFrontmatterSchema =
|
|
15887
|
-
description:
|
|
15926
|
+
var import_mini62 = require("zod/mini");
|
|
15927
|
+
var ClineRuleFrontmatterSchema = import_mini62.z.object({
|
|
15928
|
+
description: import_mini62.z.string()
|
|
15888
15929
|
});
|
|
15889
15930
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
15890
15931
|
static getSettablePaths(_options = {}) {
|
|
@@ -16063,11 +16104,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16063
16104
|
|
|
16064
16105
|
// src/features/rules/copilot-rule.ts
|
|
16065
16106
|
var import_node_path115 = require("path");
|
|
16066
|
-
var
|
|
16067
|
-
var CopilotRuleFrontmatterSchema =
|
|
16068
|
-
description:
|
|
16069
|
-
applyTo:
|
|
16070
|
-
excludeAgent:
|
|
16107
|
+
var import_mini63 = require("zod/mini");
|
|
16108
|
+
var CopilotRuleFrontmatterSchema = import_mini63.z.object({
|
|
16109
|
+
description: import_mini63.z.optional(import_mini63.z.string()),
|
|
16110
|
+
applyTo: import_mini63.z.optional(import_mini63.z.string()),
|
|
16111
|
+
excludeAgent: import_mini63.z.optional(import_mini63.z.union([import_mini63.z.literal("code-review"), import_mini63.z.literal("coding-agent")]))
|
|
16071
16112
|
});
|
|
16072
16113
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
16073
16114
|
frontmatter;
|
|
@@ -16309,11 +16350,11 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
16309
16350
|
|
|
16310
16351
|
// src/features/rules/cursor-rule.ts
|
|
16311
16352
|
var import_node_path116 = require("path");
|
|
16312
|
-
var
|
|
16313
|
-
var CursorRuleFrontmatterSchema =
|
|
16314
|
-
description:
|
|
16315
|
-
globs:
|
|
16316
|
-
alwaysApply:
|
|
16353
|
+
var import_mini64 = require("zod/mini");
|
|
16354
|
+
var CursorRuleFrontmatterSchema = import_mini64.z.object({
|
|
16355
|
+
description: import_mini64.z.optional(import_mini64.z.string()),
|
|
16356
|
+
globs: import_mini64.z.optional(import_mini64.z.string()),
|
|
16357
|
+
alwaysApply: import_mini64.z.optional(import_mini64.z.boolean())
|
|
16317
16358
|
});
|
|
16318
16359
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
16319
16360
|
frontmatter;
|
|
@@ -17954,7 +17995,7 @@ var rulesProcessorToolTargets = [
|
|
|
17954
17995
|
"warp",
|
|
17955
17996
|
"windsurf"
|
|
17956
17997
|
];
|
|
17957
|
-
var RulesProcessorToolTargetSchema =
|
|
17998
|
+
var RulesProcessorToolTargetSchema = import_mini65.z.enum(rulesProcessorToolTargets);
|
|
17958
17999
|
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path131.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
17959
18000
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
17960
18001
|
[
|
|
@@ -18877,51 +18918,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
18877
18918
|
var import_rest = require("@octokit/rest");
|
|
18878
18919
|
|
|
18879
18920
|
// src/types/fetch.ts
|
|
18880
|
-
var
|
|
18921
|
+
var import_mini67 = require("zod/mini");
|
|
18881
18922
|
|
|
18882
18923
|
// src/types/fetch-targets.ts
|
|
18883
|
-
var
|
|
18924
|
+
var import_mini66 = require("zod/mini");
|
|
18884
18925
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
18885
|
-
var FetchTargetSchema =
|
|
18926
|
+
var FetchTargetSchema = import_mini66.z.enum(ALL_FETCH_TARGETS);
|
|
18886
18927
|
|
|
18887
18928
|
// src/types/fetch.ts
|
|
18888
|
-
var ConflictStrategySchema =
|
|
18889
|
-
var GitHubFileTypeSchema =
|
|
18890
|
-
var GitHubFileEntrySchema =
|
|
18891
|
-
name:
|
|
18892
|
-
path:
|
|
18893
|
-
sha:
|
|
18894
|
-
size:
|
|
18929
|
+
var ConflictStrategySchema = import_mini67.z.enum(["skip", "overwrite"]);
|
|
18930
|
+
var GitHubFileTypeSchema = import_mini67.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
18931
|
+
var GitHubFileEntrySchema = import_mini67.z.looseObject({
|
|
18932
|
+
name: import_mini67.z.string(),
|
|
18933
|
+
path: import_mini67.z.string(),
|
|
18934
|
+
sha: import_mini67.z.string(),
|
|
18935
|
+
size: import_mini67.z.number(),
|
|
18895
18936
|
type: GitHubFileTypeSchema,
|
|
18896
|
-
download_url:
|
|
18937
|
+
download_url: import_mini67.z.nullable(import_mini67.z.string())
|
|
18897
18938
|
});
|
|
18898
|
-
var FetchOptionsSchema =
|
|
18899
|
-
target:
|
|
18900
|
-
features:
|
|
18901
|
-
ref:
|
|
18902
|
-
path:
|
|
18903
|
-
output:
|
|
18904
|
-
conflict:
|
|
18905
|
-
token:
|
|
18906
|
-
verbose:
|
|
18907
|
-
silent:
|
|
18939
|
+
var FetchOptionsSchema = import_mini67.z.looseObject({
|
|
18940
|
+
target: import_mini67.z.optional(FetchTargetSchema),
|
|
18941
|
+
features: import_mini67.z.optional(import_mini67.z.array(import_mini67.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
18942
|
+
ref: import_mini67.z.optional(import_mini67.z.string()),
|
|
18943
|
+
path: import_mini67.z.optional(import_mini67.z.string()),
|
|
18944
|
+
output: import_mini67.z.optional(import_mini67.z.string()),
|
|
18945
|
+
conflict: import_mini67.z.optional(ConflictStrategySchema),
|
|
18946
|
+
token: import_mini67.z.optional(import_mini67.z.string()),
|
|
18947
|
+
verbose: import_mini67.z.optional(import_mini67.z.boolean()),
|
|
18948
|
+
silent: import_mini67.z.optional(import_mini67.z.boolean())
|
|
18908
18949
|
});
|
|
18909
|
-
var FetchFileStatusSchema =
|
|
18910
|
-
var GitHubRepoInfoSchema =
|
|
18911
|
-
default_branch:
|
|
18912
|
-
private:
|
|
18950
|
+
var FetchFileStatusSchema = import_mini67.z.enum(["created", "overwritten", "skipped"]);
|
|
18951
|
+
var GitHubRepoInfoSchema = import_mini67.z.looseObject({
|
|
18952
|
+
default_branch: import_mini67.z.string(),
|
|
18953
|
+
private: import_mini67.z.boolean()
|
|
18913
18954
|
});
|
|
18914
|
-
var GitHubReleaseAssetSchema =
|
|
18915
|
-
name:
|
|
18916
|
-
browser_download_url:
|
|
18917
|
-
size:
|
|
18955
|
+
var GitHubReleaseAssetSchema = import_mini67.z.looseObject({
|
|
18956
|
+
name: import_mini67.z.string(),
|
|
18957
|
+
browser_download_url: import_mini67.z.string(),
|
|
18958
|
+
size: import_mini67.z.number()
|
|
18918
18959
|
});
|
|
18919
|
-
var GitHubReleaseSchema =
|
|
18920
|
-
tag_name:
|
|
18921
|
-
name:
|
|
18922
|
-
prerelease:
|
|
18923
|
-
draft:
|
|
18924
|
-
assets:
|
|
18960
|
+
var GitHubReleaseSchema = import_mini67.z.looseObject({
|
|
18961
|
+
tag_name: import_mini67.z.string(),
|
|
18962
|
+
name: import_mini67.z.nullable(import_mini67.z.string()),
|
|
18963
|
+
prerelease: import_mini67.z.boolean(),
|
|
18964
|
+
draft: import_mini67.z.boolean(),
|
|
18965
|
+
assets: import_mini67.z.array(GitHubReleaseAssetSchema)
|
|
18925
18966
|
});
|
|
18926
18967
|
|
|
18927
18968
|
// src/lib/github-client.ts
|
|
@@ -19222,9 +19263,9 @@ async function listDirectoryRecursive(params) {
|
|
|
19222
19263
|
}
|
|
19223
19264
|
|
|
19224
19265
|
// src/types/git-provider.ts
|
|
19225
|
-
var
|
|
19266
|
+
var import_mini68 = require("zod/mini");
|
|
19226
19267
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
19227
|
-
var GitProviderSchema =
|
|
19268
|
+
var GitProviderSchema = import_mini68.z.enum(ALL_GIT_PROVIDERS);
|
|
19228
19269
|
|
|
19229
19270
|
// src/lib/source-parser.ts
|
|
19230
19271
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -19847,7 +19888,7 @@ var import_jsonc_parser4 = require("jsonc-parser");
|
|
|
19847
19888
|
|
|
19848
19889
|
// src/config/config.ts
|
|
19849
19890
|
var import_node_path133 = require("path");
|
|
19850
|
-
var
|
|
19891
|
+
var import_mini69 = require("zod/mini");
|
|
19851
19892
|
|
|
19852
19893
|
// src/utils/validation.ts
|
|
19853
19894
|
function findControlCharacter(value) {
|
|
@@ -19864,53 +19905,53 @@ function hasControlCharacters(value) {
|
|
|
19864
19905
|
}
|
|
19865
19906
|
|
|
19866
19907
|
// src/config/config.ts
|
|
19867
|
-
var SourceEntrySchema =
|
|
19868
|
-
source:
|
|
19869
|
-
skills: (0,
|
|
19870
|
-
transport: (0,
|
|
19871
|
-
ref: (0,
|
|
19872
|
-
|
|
19873
|
-
(0,
|
|
19874
|
-
(0,
|
|
19908
|
+
var SourceEntrySchema = import_mini69.z.object({
|
|
19909
|
+
source: import_mini69.z.string().check((0, import_mini69.minLength)(1, "source must be a non-empty string")),
|
|
19910
|
+
skills: (0, import_mini69.optional)(import_mini69.z.array(import_mini69.z.string())),
|
|
19911
|
+
transport: (0, import_mini69.optional)(import_mini69.z.enum(["github", "git"])),
|
|
19912
|
+
ref: (0, import_mini69.optional)(
|
|
19913
|
+
import_mini69.z.string().check(
|
|
19914
|
+
(0, import_mini69.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
19915
|
+
(0, import_mini69.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
19875
19916
|
)
|
|
19876
19917
|
),
|
|
19877
|
-
path: (0,
|
|
19878
|
-
|
|
19879
|
-
(0,
|
|
19880
|
-
(0,
|
|
19881
|
-
(0,
|
|
19918
|
+
path: (0, import_mini69.optional)(
|
|
19919
|
+
import_mini69.z.string().check(
|
|
19920
|
+
(0, import_mini69.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
19921
|
+
(0, import_mini69.refine)((v) => !(0, import_node_path133.isAbsolute)(v), "path must not be absolute"),
|
|
19922
|
+
(0, import_mini69.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
19882
19923
|
)
|
|
19883
19924
|
)
|
|
19884
19925
|
});
|
|
19885
|
-
var ConfigParamsSchema =
|
|
19886
|
-
baseDirs:
|
|
19926
|
+
var ConfigParamsSchema = import_mini69.z.object({
|
|
19927
|
+
baseDirs: import_mini69.z.array(import_mini69.z.string()),
|
|
19887
19928
|
targets: RulesyncTargetsSchema,
|
|
19888
19929
|
features: RulesyncFeaturesSchema,
|
|
19889
|
-
verbose:
|
|
19890
|
-
delete:
|
|
19930
|
+
verbose: import_mini69.z.boolean(),
|
|
19931
|
+
delete: import_mini69.z.boolean(),
|
|
19891
19932
|
// New non-experimental options
|
|
19892
|
-
global: (0,
|
|
19893
|
-
silent: (0,
|
|
19894
|
-
simulateCommands: (0,
|
|
19895
|
-
simulateSubagents: (0,
|
|
19896
|
-
simulateSkills: (0,
|
|
19897
|
-
dryRun: (0,
|
|
19898
|
-
check: (0,
|
|
19933
|
+
global: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19934
|
+
silent: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19935
|
+
simulateCommands: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19936
|
+
simulateSubagents: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19937
|
+
simulateSkills: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19938
|
+
dryRun: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19939
|
+
check: (0, import_mini69.optional)(import_mini69.z.boolean()),
|
|
19899
19940
|
// Declarative skill sources
|
|
19900
|
-
sources: (0,
|
|
19941
|
+
sources: (0, import_mini69.optional)(import_mini69.z.array(SourceEntrySchema))
|
|
19901
19942
|
});
|
|
19902
|
-
var PartialConfigParamsSchema =
|
|
19903
|
-
var ConfigFileSchema =
|
|
19904
|
-
$schema: (0,
|
|
19905
|
-
...
|
|
19943
|
+
var PartialConfigParamsSchema = import_mini69.z.partial(ConfigParamsSchema);
|
|
19944
|
+
var ConfigFileSchema = import_mini69.z.object({
|
|
19945
|
+
$schema: (0, import_mini69.optional)(import_mini69.z.string()),
|
|
19946
|
+
...import_mini69.z.partial(ConfigParamsSchema).shape
|
|
19906
19947
|
});
|
|
19907
|
-
var RequiredConfigParamsSchema =
|
|
19948
|
+
var RequiredConfigParamsSchema = import_mini69.z.required(ConfigParamsSchema);
|
|
19908
19949
|
var CONFLICTING_TARGET_PAIRS = [
|
|
19909
19950
|
["augmentcode", "augmentcode-legacy"],
|
|
19910
19951
|
["claudecode", "claudecode-legacy"]
|
|
19911
19952
|
];
|
|
19912
19953
|
var LEGACY_TARGETS = ["augmentcode-legacy", "claudecode-legacy"];
|
|
19913
|
-
var Config = class {
|
|
19954
|
+
var Config = class _Config {
|
|
19914
19955
|
baseDirs;
|
|
19915
19956
|
targets;
|
|
19916
19957
|
features;
|
|
@@ -19985,26 +20026,23 @@ var Config = class {
|
|
|
19985
20026
|
const perTargetFeatures = this.features;
|
|
19986
20027
|
if (target) {
|
|
19987
20028
|
const targetFeatures = perTargetFeatures[target];
|
|
19988
|
-
if (!targetFeatures
|
|
20029
|
+
if (!targetFeatures) {
|
|
19989
20030
|
return [];
|
|
19990
20031
|
}
|
|
19991
|
-
|
|
19992
|
-
return [...ALL_FEATURES];
|
|
19993
|
-
}
|
|
19994
|
-
return targetFeatures.filter((feature) => feature !== "*");
|
|
20032
|
+
return _Config.normalizeTargetFeatures(targetFeatures);
|
|
19995
20033
|
}
|
|
19996
20034
|
const allFeatures = [];
|
|
19997
20035
|
for (const features of Object.values(perTargetFeatures)) {
|
|
19998
|
-
if (features
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
if (feature !== "*" && !allFeatures.includes(feature)) {
|
|
20004
|
-
allFeatures.push(feature);
|
|
20005
|
-
}
|
|
20036
|
+
if (!features) continue;
|
|
20037
|
+
const normalized = _Config.normalizeTargetFeatures(features);
|
|
20038
|
+
for (const feature of normalized) {
|
|
20039
|
+
if (!allFeatures.includes(feature)) {
|
|
20040
|
+
allFeatures.push(feature);
|
|
20006
20041
|
}
|
|
20007
20042
|
}
|
|
20043
|
+
if (allFeatures.length === ALL_FEATURES.length) {
|
|
20044
|
+
return allFeatures;
|
|
20045
|
+
}
|
|
20008
20046
|
}
|
|
20009
20047
|
return allFeatures;
|
|
20010
20048
|
}
|
|
@@ -20014,19 +20052,60 @@ var Config = class {
|
|
|
20014
20052
|
return this.features.filter((feature) => feature !== "*");
|
|
20015
20053
|
}
|
|
20016
20054
|
/**
|
|
20017
|
-
*
|
|
20055
|
+
* Normalize a per-target features value (array or per-feature object) into
|
|
20056
|
+
* the flat list of enabled features.
|
|
20018
20057
|
*/
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20058
|
+
static normalizeTargetFeatures(value) {
|
|
20059
|
+
if (Array.isArray(value)) {
|
|
20060
|
+
if (value.length === 0) return [];
|
|
20061
|
+
if (value.includes("*")) return [...ALL_FEATURES];
|
|
20062
|
+
return value.filter((feature) => feature !== "*");
|
|
20063
|
+
}
|
|
20064
|
+
if (isFeatureValueEnabled(value["*"])) {
|
|
20065
|
+
return [...ALL_FEATURES];
|
|
20066
|
+
}
|
|
20067
|
+
const enabled = [];
|
|
20068
|
+
for (const [key, val] of Object.entries(value)) {
|
|
20069
|
+
if (key === "*") continue;
|
|
20070
|
+
if (!isFeatureValueEnabled(val)) continue;
|
|
20071
|
+
enabled.push(key);
|
|
20072
|
+
}
|
|
20073
|
+
return enabled;
|
|
20074
|
+
}
|
|
20075
|
+
/**
|
|
20076
|
+
* Returns the per-feature options object for a given target/feature, if any.
|
|
20077
|
+
* Returns `undefined` when no per-feature options were provided or when the
|
|
20078
|
+
* feature is not enabled for the given target.
|
|
20079
|
+
*/
|
|
20080
|
+
getFeatureOptions(target, feature) {
|
|
20081
|
+
if (Array.isArray(this.features)) {
|
|
20082
|
+
return void 0;
|
|
20083
|
+
}
|
|
20084
|
+
const targetFeatures = this.features[target];
|
|
20085
|
+
if (!targetFeatures || Array.isArray(targetFeatures)) {
|
|
20086
|
+
return void 0;
|
|
20087
|
+
}
|
|
20088
|
+
const perFeature = targetFeatures;
|
|
20089
|
+
const value = perFeature[feature];
|
|
20090
|
+
if (value && typeof value === "object" && isFeatureValueEnabled(value)) {
|
|
20091
|
+
return value;
|
|
20092
|
+
}
|
|
20093
|
+
return void 0;
|
|
20094
|
+
}
|
|
20095
|
+
/**
|
|
20096
|
+
* Check if per-target features configuration is being used.
|
|
20097
|
+
*/
|
|
20098
|
+
hasPerTargetFeatures() {
|
|
20099
|
+
return !Array.isArray(this.features);
|
|
20100
|
+
}
|
|
20101
|
+
getVerbose() {
|
|
20102
|
+
return this.verbose;
|
|
20103
|
+
}
|
|
20104
|
+
getDelete() {
|
|
20105
|
+
return this.delete;
|
|
20106
|
+
}
|
|
20107
|
+
getGlobal() {
|
|
20108
|
+
return this.global;
|
|
20030
20109
|
}
|
|
20031
20110
|
getSilent() {
|
|
20032
20111
|
return this.silent;
|
|
@@ -20164,8 +20243,592 @@ function getBaseDirsInLightOfGlobal({
|
|
|
20164
20243
|
}
|
|
20165
20244
|
|
|
20166
20245
|
// src/lib/generate.ts
|
|
20167
|
-
var
|
|
20246
|
+
var import_node_path138 = require("path");
|
|
20247
|
+
var import_es_toolkit5 = require("es-toolkit");
|
|
20248
|
+
|
|
20249
|
+
// src/features/permissions/permissions-processor.ts
|
|
20250
|
+
var import_mini72 = require("zod/mini");
|
|
20251
|
+
|
|
20252
|
+
// src/features/permissions/claudecode-permissions.ts
|
|
20253
|
+
var import_node_path136 = require("path");
|
|
20168
20254
|
var import_es_toolkit4 = require("es-toolkit");
|
|
20255
|
+
|
|
20256
|
+
// src/features/permissions/rulesync-permissions.ts
|
|
20257
|
+
var import_node_path135 = require("path");
|
|
20258
|
+
|
|
20259
|
+
// src/types/permissions.ts
|
|
20260
|
+
var import_mini70 = require("zod/mini");
|
|
20261
|
+
var PermissionActionSchema = import_mini70.z.enum(["allow", "ask", "deny"]);
|
|
20262
|
+
var PermissionRulesSchema = import_mini70.z.record(import_mini70.z.string(), PermissionActionSchema);
|
|
20263
|
+
var PermissionsConfigSchema = import_mini70.z.looseObject({
|
|
20264
|
+
permission: import_mini70.z.record(import_mini70.z.string(), PermissionRulesSchema)
|
|
20265
|
+
});
|
|
20266
|
+
var RulesyncPermissionsFileSchema = import_mini70.z.looseObject({
|
|
20267
|
+
$schema: import_mini70.z.optional(import_mini70.z.string()),
|
|
20268
|
+
...PermissionsConfigSchema.shape
|
|
20269
|
+
});
|
|
20270
|
+
|
|
20271
|
+
// src/features/permissions/rulesync-permissions.ts
|
|
20272
|
+
var RulesyncPermissions = class _RulesyncPermissions extends RulesyncFile {
|
|
20273
|
+
json;
|
|
20274
|
+
constructor(params) {
|
|
20275
|
+
super({ ...params });
|
|
20276
|
+
this.json = JSON.parse(this.fileContent);
|
|
20277
|
+
if (params.validate) {
|
|
20278
|
+
const result = this.validate();
|
|
20279
|
+
if (!result.success) {
|
|
20280
|
+
throw result.error;
|
|
20281
|
+
}
|
|
20282
|
+
}
|
|
20283
|
+
}
|
|
20284
|
+
static getSettablePaths() {
|
|
20285
|
+
return {
|
|
20286
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
20287
|
+
relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME
|
|
20288
|
+
};
|
|
20289
|
+
}
|
|
20290
|
+
validate() {
|
|
20291
|
+
const result = RulesyncPermissionsFileSchema.safeParse(this.json);
|
|
20292
|
+
if (!result.success) {
|
|
20293
|
+
return { success: false, error: result.error };
|
|
20294
|
+
}
|
|
20295
|
+
return { success: true, error: null };
|
|
20296
|
+
}
|
|
20297
|
+
static async fromFile({
|
|
20298
|
+
baseDir = process.cwd(),
|
|
20299
|
+
validate = true
|
|
20300
|
+
}) {
|
|
20301
|
+
const paths = _RulesyncPermissions.getSettablePaths();
|
|
20302
|
+
const filePath = (0, import_node_path135.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20303
|
+
if (!await fileExists(filePath)) {
|
|
20304
|
+
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
20305
|
+
}
|
|
20306
|
+
const fileContent = await readFileContent(filePath);
|
|
20307
|
+
return new _RulesyncPermissions({
|
|
20308
|
+
baseDir,
|
|
20309
|
+
relativeDirPath: paths.relativeDirPath,
|
|
20310
|
+
relativeFilePath: paths.relativeFilePath,
|
|
20311
|
+
fileContent,
|
|
20312
|
+
validate
|
|
20313
|
+
});
|
|
20314
|
+
}
|
|
20315
|
+
getJson() {
|
|
20316
|
+
return this.json;
|
|
20317
|
+
}
|
|
20318
|
+
};
|
|
20319
|
+
|
|
20320
|
+
// src/features/permissions/tool-permissions.ts
|
|
20321
|
+
var ToolPermissions = class extends ToolFile {
|
|
20322
|
+
static getSettablePaths(_options) {
|
|
20323
|
+
throw new Error("Please implement this method in the subclass.");
|
|
20324
|
+
}
|
|
20325
|
+
validate() {
|
|
20326
|
+
return { success: true, error: null };
|
|
20327
|
+
}
|
|
20328
|
+
static fromRulesyncPermissions(_params) {
|
|
20329
|
+
throw new Error("Please implement this method in the subclass.");
|
|
20330
|
+
}
|
|
20331
|
+
toRulesyncPermissionsDefault({
|
|
20332
|
+
fileContent
|
|
20333
|
+
}) {
|
|
20334
|
+
return new RulesyncPermissions({
|
|
20335
|
+
baseDir: this.baseDir,
|
|
20336
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
20337
|
+
relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME,
|
|
20338
|
+
fileContent
|
|
20339
|
+
});
|
|
20340
|
+
}
|
|
20341
|
+
static async fromFile(_params) {
|
|
20342
|
+
throw new Error("Please implement this method in the subclass.");
|
|
20343
|
+
}
|
|
20344
|
+
static forDeletion(_params) {
|
|
20345
|
+
throw new Error("Please implement this method in the subclass.");
|
|
20346
|
+
}
|
|
20347
|
+
};
|
|
20348
|
+
|
|
20349
|
+
// src/features/permissions/claudecode-permissions.ts
|
|
20350
|
+
var CANONICAL_TO_CLAUDE_TOOL_NAMES = {
|
|
20351
|
+
bash: "Bash",
|
|
20352
|
+
read: "Read",
|
|
20353
|
+
edit: "Edit",
|
|
20354
|
+
write: "Write",
|
|
20355
|
+
webfetch: "WebFetch",
|
|
20356
|
+
websearch: "WebSearch",
|
|
20357
|
+
grep: "Grep",
|
|
20358
|
+
glob: "Glob",
|
|
20359
|
+
notebookedit: "NotebookEdit",
|
|
20360
|
+
agent: "Agent"
|
|
20361
|
+
};
|
|
20362
|
+
var CLAUDE_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
20363
|
+
Object.entries(CANONICAL_TO_CLAUDE_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
20364
|
+
);
|
|
20365
|
+
function toClaudeToolName(canonical) {
|
|
20366
|
+
return CANONICAL_TO_CLAUDE_TOOL_NAMES[canonical] ?? canonical;
|
|
20367
|
+
}
|
|
20368
|
+
function toCanonicalToolName(claudeName) {
|
|
20369
|
+
return CLAUDE_TO_CANONICAL_TOOL_NAMES[claudeName] ?? claudeName;
|
|
20370
|
+
}
|
|
20371
|
+
function parseClaudePermissionEntry(entry) {
|
|
20372
|
+
const parenIndex = entry.indexOf("(");
|
|
20373
|
+
if (parenIndex === -1) {
|
|
20374
|
+
return { toolName: entry, pattern: "*" };
|
|
20375
|
+
}
|
|
20376
|
+
const toolName = entry.slice(0, parenIndex);
|
|
20377
|
+
if (!entry.endsWith(")")) {
|
|
20378
|
+
return { toolName, pattern: "*" };
|
|
20379
|
+
}
|
|
20380
|
+
const pattern = entry.slice(parenIndex + 1, -1);
|
|
20381
|
+
return { toolName, pattern: pattern || "*" };
|
|
20382
|
+
}
|
|
20383
|
+
function buildClaudePermissionEntry(toolName, pattern) {
|
|
20384
|
+
if (pattern === "*") {
|
|
20385
|
+
return toolName;
|
|
20386
|
+
}
|
|
20387
|
+
return `${toolName}(${pattern})`;
|
|
20388
|
+
}
|
|
20389
|
+
var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions {
|
|
20390
|
+
constructor(params) {
|
|
20391
|
+
super({
|
|
20392
|
+
...params,
|
|
20393
|
+
fileContent: params.fileContent ?? "{}"
|
|
20394
|
+
});
|
|
20395
|
+
}
|
|
20396
|
+
isDeletable() {
|
|
20397
|
+
return false;
|
|
20398
|
+
}
|
|
20399
|
+
static getSettablePaths() {
|
|
20400
|
+
return {
|
|
20401
|
+
relativeDirPath: ".claude",
|
|
20402
|
+
relativeFilePath: "settings.json"
|
|
20403
|
+
};
|
|
20404
|
+
}
|
|
20405
|
+
static async fromFile({
|
|
20406
|
+
baseDir = process.cwd(),
|
|
20407
|
+
validate = true
|
|
20408
|
+
}) {
|
|
20409
|
+
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20410
|
+
const filePath = (0, import_node_path136.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20411
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
20412
|
+
return new _ClaudecodePermissions({
|
|
20413
|
+
baseDir,
|
|
20414
|
+
relativeDirPath: paths.relativeDirPath,
|
|
20415
|
+
relativeFilePath: paths.relativeFilePath,
|
|
20416
|
+
fileContent,
|
|
20417
|
+
validate
|
|
20418
|
+
});
|
|
20419
|
+
}
|
|
20420
|
+
static async fromRulesyncPermissions({
|
|
20421
|
+
baseDir = process.cwd(),
|
|
20422
|
+
rulesyncPermissions,
|
|
20423
|
+
logger: logger5
|
|
20424
|
+
}) {
|
|
20425
|
+
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20426
|
+
const filePath = (0, import_node_path136.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20427
|
+
const existingContent = await readOrInitializeFileContent(
|
|
20428
|
+
filePath,
|
|
20429
|
+
JSON.stringify({}, null, 2)
|
|
20430
|
+
);
|
|
20431
|
+
let settings;
|
|
20432
|
+
try {
|
|
20433
|
+
settings = JSON.parse(existingContent);
|
|
20434
|
+
} catch (error) {
|
|
20435
|
+
throw new Error(
|
|
20436
|
+
`Failed to parse existing Claude settings at ${filePath}: ${formatError(error)}`,
|
|
20437
|
+
{ cause: error }
|
|
20438
|
+
);
|
|
20439
|
+
}
|
|
20440
|
+
const config = rulesyncPermissions.getJson();
|
|
20441
|
+
const { allow, ask, deny } = convertRulesyncToClaudePermissions(config);
|
|
20442
|
+
const managedToolNames = new Set(
|
|
20443
|
+
Object.keys(config.permission).map((category) => toClaudeToolName(category))
|
|
20444
|
+
);
|
|
20445
|
+
const existingPermissions = settings.permissions ?? {};
|
|
20446
|
+
const preservedAllow = (existingPermissions.allow ?? []).filter(
|
|
20447
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
20448
|
+
);
|
|
20449
|
+
const preservedAsk = (existingPermissions.ask ?? []).filter(
|
|
20450
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
20451
|
+
);
|
|
20452
|
+
const preservedDeny = (existingPermissions.deny ?? []).filter(
|
|
20453
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
20454
|
+
);
|
|
20455
|
+
if (logger5 && managedToolNames.has("Read")) {
|
|
20456
|
+
const droppedReadDenyEntries = (existingPermissions.deny ?? []).filter((entry) => {
|
|
20457
|
+
const { toolName } = parseClaudePermissionEntry(entry);
|
|
20458
|
+
return toolName === "Read";
|
|
20459
|
+
});
|
|
20460
|
+
if (droppedReadDenyEntries.length > 0) {
|
|
20461
|
+
logger5.warn(
|
|
20462
|
+
`Permissions feature manages 'Read' tool and will overwrite ${droppedReadDenyEntries.length} existing Read deny entries (possibly from ignore feature). Permissions take precedence.`
|
|
20463
|
+
);
|
|
20464
|
+
}
|
|
20465
|
+
}
|
|
20466
|
+
const mergedPermissions = {
|
|
20467
|
+
...existingPermissions
|
|
20468
|
+
};
|
|
20469
|
+
const mergedAllow = (0, import_es_toolkit4.uniq)([...preservedAllow, ...allow].toSorted());
|
|
20470
|
+
const mergedAsk = (0, import_es_toolkit4.uniq)([...preservedAsk, ...ask].toSorted());
|
|
20471
|
+
const mergedDeny = (0, import_es_toolkit4.uniq)([...preservedDeny, ...deny].toSorted());
|
|
20472
|
+
if (mergedAllow.length > 0) {
|
|
20473
|
+
mergedPermissions.allow = mergedAllow;
|
|
20474
|
+
} else {
|
|
20475
|
+
delete mergedPermissions.allow;
|
|
20476
|
+
}
|
|
20477
|
+
if (mergedAsk.length > 0) {
|
|
20478
|
+
mergedPermissions.ask = mergedAsk;
|
|
20479
|
+
} else {
|
|
20480
|
+
delete mergedPermissions.ask;
|
|
20481
|
+
}
|
|
20482
|
+
if (mergedDeny.length > 0) {
|
|
20483
|
+
mergedPermissions.deny = mergedDeny;
|
|
20484
|
+
} else {
|
|
20485
|
+
delete mergedPermissions.deny;
|
|
20486
|
+
}
|
|
20487
|
+
const merged = { ...settings, permissions: mergedPermissions };
|
|
20488
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
20489
|
+
return new _ClaudecodePermissions({
|
|
20490
|
+
baseDir,
|
|
20491
|
+
relativeDirPath: paths.relativeDirPath,
|
|
20492
|
+
relativeFilePath: paths.relativeFilePath,
|
|
20493
|
+
fileContent,
|
|
20494
|
+
validate: true
|
|
20495
|
+
});
|
|
20496
|
+
}
|
|
20497
|
+
toRulesyncPermissions() {
|
|
20498
|
+
let settings;
|
|
20499
|
+
try {
|
|
20500
|
+
settings = JSON.parse(this.getFileContent());
|
|
20501
|
+
} catch (error) {
|
|
20502
|
+
throw new Error(
|
|
20503
|
+
`Failed to parse Claude permissions content in ${(0, import_node_path136.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
20504
|
+
{ cause: error }
|
|
20505
|
+
);
|
|
20506
|
+
}
|
|
20507
|
+
const permissions = settings.permissions ?? {};
|
|
20508
|
+
const config = convertClaudeToRulesyncPermissions({
|
|
20509
|
+
allow: permissions.allow ?? [],
|
|
20510
|
+
ask: permissions.ask ?? [],
|
|
20511
|
+
deny: permissions.deny ?? []
|
|
20512
|
+
});
|
|
20513
|
+
return this.toRulesyncPermissionsDefault({
|
|
20514
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
20515
|
+
});
|
|
20516
|
+
}
|
|
20517
|
+
validate() {
|
|
20518
|
+
return { success: true, error: null };
|
|
20519
|
+
}
|
|
20520
|
+
static forDeletion({
|
|
20521
|
+
baseDir = process.cwd(),
|
|
20522
|
+
relativeDirPath,
|
|
20523
|
+
relativeFilePath
|
|
20524
|
+
}) {
|
|
20525
|
+
return new _ClaudecodePermissions({
|
|
20526
|
+
baseDir,
|
|
20527
|
+
relativeDirPath,
|
|
20528
|
+
relativeFilePath,
|
|
20529
|
+
fileContent: JSON.stringify({ permissions: {} }, null, 2),
|
|
20530
|
+
validate: false
|
|
20531
|
+
});
|
|
20532
|
+
}
|
|
20533
|
+
};
|
|
20534
|
+
function convertRulesyncToClaudePermissions(config) {
|
|
20535
|
+
const allow = [];
|
|
20536
|
+
const ask = [];
|
|
20537
|
+
const deny = [];
|
|
20538
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
20539
|
+
const claudeToolName = toClaudeToolName(category);
|
|
20540
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
20541
|
+
const entry = buildClaudePermissionEntry(claudeToolName, pattern);
|
|
20542
|
+
switch (action) {
|
|
20543
|
+
case "allow":
|
|
20544
|
+
allow.push(entry);
|
|
20545
|
+
break;
|
|
20546
|
+
case "ask":
|
|
20547
|
+
ask.push(entry);
|
|
20548
|
+
break;
|
|
20549
|
+
case "deny":
|
|
20550
|
+
deny.push(entry);
|
|
20551
|
+
break;
|
|
20552
|
+
}
|
|
20553
|
+
}
|
|
20554
|
+
}
|
|
20555
|
+
return { allow, ask, deny };
|
|
20556
|
+
}
|
|
20557
|
+
function convertClaudeToRulesyncPermissions(params) {
|
|
20558
|
+
const permission = {};
|
|
20559
|
+
const processEntries = (entries, action) => {
|
|
20560
|
+
for (const entry of entries) {
|
|
20561
|
+
const { toolName, pattern } = parseClaudePermissionEntry(entry);
|
|
20562
|
+
const canonical = toCanonicalToolName(toolName);
|
|
20563
|
+
if (!permission[canonical]) {
|
|
20564
|
+
permission[canonical] = {};
|
|
20565
|
+
}
|
|
20566
|
+
permission[canonical][pattern] = action;
|
|
20567
|
+
}
|
|
20568
|
+
};
|
|
20569
|
+
processEntries(params.allow, "allow");
|
|
20570
|
+
processEntries(params.ask, "ask");
|
|
20571
|
+
processEntries(params.deny, "deny");
|
|
20572
|
+
return { permission };
|
|
20573
|
+
}
|
|
20574
|
+
|
|
20575
|
+
// src/features/permissions/opencode-permissions.ts
|
|
20576
|
+
var import_node_path137 = require("path");
|
|
20577
|
+
var import_jsonc_parser5 = require("jsonc-parser");
|
|
20578
|
+
var import_mini71 = require("zod/mini");
|
|
20579
|
+
var OpencodePermissionSchema = import_mini71.z.union([
|
|
20580
|
+
import_mini71.z.enum(["allow", "ask", "deny"]),
|
|
20581
|
+
import_mini71.z.record(import_mini71.z.string(), import_mini71.z.enum(["allow", "ask", "deny"]))
|
|
20582
|
+
]);
|
|
20583
|
+
var OpencodePermissionsConfigSchema = import_mini71.z.looseObject({
|
|
20584
|
+
permission: import_mini71.z.optional(import_mini71.z.record(import_mini71.z.string(), OpencodePermissionSchema))
|
|
20585
|
+
});
|
|
20586
|
+
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
20587
|
+
json;
|
|
20588
|
+
constructor(params) {
|
|
20589
|
+
super(params);
|
|
20590
|
+
this.json = OpencodePermissionsConfigSchema.parse((0, import_jsonc_parser5.parse)(this.fileContent || "{}"));
|
|
20591
|
+
}
|
|
20592
|
+
getJson() {
|
|
20593
|
+
return this.json;
|
|
20594
|
+
}
|
|
20595
|
+
isDeletable() {
|
|
20596
|
+
return false;
|
|
20597
|
+
}
|
|
20598
|
+
static getSettablePaths({
|
|
20599
|
+
global = false
|
|
20600
|
+
} = {}) {
|
|
20601
|
+
return global ? { relativeDirPath: (0, import_node_path137.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
20602
|
+
}
|
|
20603
|
+
static async fromFile({
|
|
20604
|
+
baseDir = process.cwd(),
|
|
20605
|
+
validate = true,
|
|
20606
|
+
global = false
|
|
20607
|
+
}) {
|
|
20608
|
+
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
20609
|
+
const jsonDir = (0, import_node_path137.join)(baseDir, basePaths.relativeDirPath);
|
|
20610
|
+
const jsoncPath = (0, import_node_path137.join)(jsonDir, "opencode.jsonc");
|
|
20611
|
+
const jsonPath = (0, import_node_path137.join)(jsonDir, "opencode.json");
|
|
20612
|
+
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
20613
|
+
let relativeFilePath = "opencode.jsonc";
|
|
20614
|
+
if (!fileContent) {
|
|
20615
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
20616
|
+
if (fileContent) {
|
|
20617
|
+
relativeFilePath = "opencode.json";
|
|
20618
|
+
}
|
|
20619
|
+
}
|
|
20620
|
+
const parsed = (0, import_jsonc_parser5.parse)(fileContent ?? "{}");
|
|
20621
|
+
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
20622
|
+
return new _OpencodePermissions({
|
|
20623
|
+
baseDir,
|
|
20624
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
20625
|
+
relativeFilePath,
|
|
20626
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
20627
|
+
validate
|
|
20628
|
+
});
|
|
20629
|
+
}
|
|
20630
|
+
static async fromRulesyncPermissions({
|
|
20631
|
+
baseDir = process.cwd(),
|
|
20632
|
+
rulesyncPermissions,
|
|
20633
|
+
global = false
|
|
20634
|
+
}) {
|
|
20635
|
+
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
20636
|
+
const jsonDir = (0, import_node_path137.join)(baseDir, basePaths.relativeDirPath);
|
|
20637
|
+
const jsoncPath = (0, import_node_path137.join)(jsonDir, "opencode.jsonc");
|
|
20638
|
+
const jsonPath = (0, import_node_path137.join)(jsonDir, "opencode.json");
|
|
20639
|
+
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
20640
|
+
let relativeFilePath = "opencode.jsonc";
|
|
20641
|
+
if (!fileContent) {
|
|
20642
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
20643
|
+
if (fileContent) {
|
|
20644
|
+
relativeFilePath = "opencode.json";
|
|
20645
|
+
}
|
|
20646
|
+
}
|
|
20647
|
+
const parsed = (0, import_jsonc_parser5.parse)(fileContent ?? "{}");
|
|
20648
|
+
const nextJson = {
|
|
20649
|
+
...parsed,
|
|
20650
|
+
permission: rulesyncPermissions.getJson().permission
|
|
20651
|
+
};
|
|
20652
|
+
return new _OpencodePermissions({
|
|
20653
|
+
baseDir,
|
|
20654
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
20655
|
+
relativeFilePath,
|
|
20656
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
20657
|
+
validate: true
|
|
20658
|
+
});
|
|
20659
|
+
}
|
|
20660
|
+
toRulesyncPermissions() {
|
|
20661
|
+
const permission = this.normalizePermission(this.json.permission);
|
|
20662
|
+
return this.toRulesyncPermissionsDefault({
|
|
20663
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
20664
|
+
});
|
|
20665
|
+
}
|
|
20666
|
+
validate() {
|
|
20667
|
+
try {
|
|
20668
|
+
const json = JSON.parse(this.fileContent || "{}");
|
|
20669
|
+
const result = OpencodePermissionsConfigSchema.safeParse(json);
|
|
20670
|
+
if (!result.success) {
|
|
20671
|
+
return { success: false, error: result.error };
|
|
20672
|
+
}
|
|
20673
|
+
return { success: true, error: null };
|
|
20674
|
+
} catch (error) {
|
|
20675
|
+
return {
|
|
20676
|
+
success: false,
|
|
20677
|
+
error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
|
|
20678
|
+
};
|
|
20679
|
+
}
|
|
20680
|
+
}
|
|
20681
|
+
static forDeletion({
|
|
20682
|
+
baseDir = process.cwd(),
|
|
20683
|
+
relativeDirPath,
|
|
20684
|
+
relativeFilePath
|
|
20685
|
+
}) {
|
|
20686
|
+
return new _OpencodePermissions({
|
|
20687
|
+
baseDir,
|
|
20688
|
+
relativeDirPath,
|
|
20689
|
+
relativeFilePath,
|
|
20690
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
20691
|
+
validate: false
|
|
20692
|
+
});
|
|
20693
|
+
}
|
|
20694
|
+
normalizePermission(permission) {
|
|
20695
|
+
if (!permission) {
|
|
20696
|
+
return {};
|
|
20697
|
+
}
|
|
20698
|
+
return Object.fromEntries(
|
|
20699
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
20700
|
+
tool,
|
|
20701
|
+
typeof value === "string" ? { "*": value } : value
|
|
20702
|
+
])
|
|
20703
|
+
);
|
|
20704
|
+
}
|
|
20705
|
+
};
|
|
20706
|
+
|
|
20707
|
+
// src/features/permissions/permissions-processor.ts
|
|
20708
|
+
var permissionsProcessorToolTargetTuple = ["claudecode", "opencode"];
|
|
20709
|
+
var PermissionsProcessorToolTargetSchema = import_mini72.z.enum(permissionsProcessorToolTargetTuple);
|
|
20710
|
+
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
20711
|
+
[
|
|
20712
|
+
"claudecode",
|
|
20713
|
+
{
|
|
20714
|
+
class: ClaudecodePermissions,
|
|
20715
|
+
meta: {
|
|
20716
|
+
supportsProject: true,
|
|
20717
|
+
supportsGlobal: false,
|
|
20718
|
+
supportsImport: true
|
|
20719
|
+
}
|
|
20720
|
+
}
|
|
20721
|
+
],
|
|
20722
|
+
[
|
|
20723
|
+
"opencode",
|
|
20724
|
+
{
|
|
20725
|
+
class: OpencodePermissions,
|
|
20726
|
+
meta: {
|
|
20727
|
+
supportsProject: true,
|
|
20728
|
+
supportsGlobal: true,
|
|
20729
|
+
supportsImport: true
|
|
20730
|
+
}
|
|
20731
|
+
}
|
|
20732
|
+
]
|
|
20733
|
+
]);
|
|
20734
|
+
var PermissionsProcessor = class extends FeatureProcessor {
|
|
20735
|
+
toolTarget;
|
|
20736
|
+
global;
|
|
20737
|
+
constructor({
|
|
20738
|
+
baseDir = process.cwd(),
|
|
20739
|
+
toolTarget,
|
|
20740
|
+
global = false,
|
|
20741
|
+
dryRun = false,
|
|
20742
|
+
logger: logger5
|
|
20743
|
+
}) {
|
|
20744
|
+
super({ baseDir, dryRun, logger: logger5 });
|
|
20745
|
+
const result = PermissionsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
20746
|
+
if (!result.success) {
|
|
20747
|
+
throw new Error(
|
|
20748
|
+
`Invalid tool target for PermissionsProcessor: ${toolTarget}. ${formatError(result.error)}`
|
|
20749
|
+
);
|
|
20750
|
+
}
|
|
20751
|
+
this.toolTarget = result.data;
|
|
20752
|
+
this.global = global;
|
|
20753
|
+
}
|
|
20754
|
+
async loadRulesyncFiles() {
|
|
20755
|
+
try {
|
|
20756
|
+
return [
|
|
20757
|
+
await RulesyncPermissions.fromFile({
|
|
20758
|
+
baseDir: process.cwd(),
|
|
20759
|
+
validate: true
|
|
20760
|
+
})
|
|
20761
|
+
];
|
|
20762
|
+
} catch (error) {
|
|
20763
|
+
this.logger.error(
|
|
20764
|
+
`Failed to load Rulesync permissions file (${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
20765
|
+
);
|
|
20766
|
+
return [];
|
|
20767
|
+
}
|
|
20768
|
+
}
|
|
20769
|
+
async loadToolFiles({
|
|
20770
|
+
forDeletion = false
|
|
20771
|
+
} = {}) {
|
|
20772
|
+
try {
|
|
20773
|
+
const factory = toolPermissionsFactories.get(this.toolTarget);
|
|
20774
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
20775
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
20776
|
+
if (forDeletion) {
|
|
20777
|
+
const toolPermissions2 = factory.class.forDeletion({
|
|
20778
|
+
baseDir: this.baseDir,
|
|
20779
|
+
relativeDirPath: paths.relativeDirPath,
|
|
20780
|
+
relativeFilePath: paths.relativeFilePath,
|
|
20781
|
+
global: this.global
|
|
20782
|
+
});
|
|
20783
|
+
const list = toolPermissions2.isDeletable?.() !== false ? [toolPermissions2] : [];
|
|
20784
|
+
return list;
|
|
20785
|
+
}
|
|
20786
|
+
const toolPermissions = await factory.class.fromFile({
|
|
20787
|
+
baseDir: this.baseDir,
|
|
20788
|
+
validate: true,
|
|
20789
|
+
global: this.global
|
|
20790
|
+
});
|
|
20791
|
+
return [toolPermissions];
|
|
20792
|
+
} catch (error) {
|
|
20793
|
+
const msg = `Failed to load permissions files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
20794
|
+
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
20795
|
+
this.logger.debug(msg);
|
|
20796
|
+
} else {
|
|
20797
|
+
this.logger.error(msg);
|
|
20798
|
+
}
|
|
20799
|
+
return [];
|
|
20800
|
+
}
|
|
20801
|
+
}
|
|
20802
|
+
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
20803
|
+
const rulesyncPermissions = rulesyncFiles.find(
|
|
20804
|
+
(f) => f instanceof RulesyncPermissions
|
|
20805
|
+
);
|
|
20806
|
+
if (!rulesyncPermissions) {
|
|
20807
|
+
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
20808
|
+
}
|
|
20809
|
+
const factory = toolPermissionsFactories.get(this.toolTarget);
|
|
20810
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
20811
|
+
const toolPermissions = await factory.class.fromRulesyncPermissions({
|
|
20812
|
+
baseDir: this.baseDir,
|
|
20813
|
+
rulesyncPermissions,
|
|
20814
|
+
logger: this.logger,
|
|
20815
|
+
global: this.global
|
|
20816
|
+
});
|
|
20817
|
+
return [toolPermissions];
|
|
20818
|
+
}
|
|
20819
|
+
async convertToolFilesToRulesyncFiles(toolFiles) {
|
|
20820
|
+
const permissions = toolFiles.filter((f) => f instanceof ToolPermissions);
|
|
20821
|
+
return permissions.map((p) => p.toRulesyncPermissions());
|
|
20822
|
+
}
|
|
20823
|
+
static getToolTargets({
|
|
20824
|
+
global = false,
|
|
20825
|
+
importOnly = false
|
|
20826
|
+
} = {}) {
|
|
20827
|
+
return [...toolPermissionsFactories.entries()].filter(([, f]) => global ? f.meta.supportsGlobal : f.meta.supportsProject).filter(([, f]) => importOnly ? f.meta.supportsImport : true).map(([target]) => target);
|
|
20828
|
+
}
|
|
20829
|
+
};
|
|
20830
|
+
|
|
20831
|
+
// src/lib/generate.ts
|
|
20169
20832
|
async function processFeatureGeneration(params) {
|
|
20170
20833
|
const { config, processor, toolFiles } = params;
|
|
20171
20834
|
let totalCount = 0;
|
|
@@ -20238,7 +20901,7 @@ function warnUnsupportedTargets(params) {
|
|
|
20238
20901
|
}
|
|
20239
20902
|
}
|
|
20240
20903
|
async function checkRulesyncDirExists(params) {
|
|
20241
|
-
return fileExists((0,
|
|
20904
|
+
return fileExists((0, import_node_path138.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
20242
20905
|
}
|
|
20243
20906
|
async function generate(params) {
|
|
20244
20907
|
const { config, logger: logger5 } = params;
|
|
@@ -20248,8 +20911,9 @@ async function generate(params) {
|
|
|
20248
20911
|
const subagentsResult = await generateSubagentsCore({ config, logger: logger5 });
|
|
20249
20912
|
const skillsResult = await generateSkillsCore({ config, logger: logger5 });
|
|
20250
20913
|
const hooksResult = await generateHooksCore({ config, logger: logger5 });
|
|
20914
|
+
const permissionsResult = await generatePermissionsCore({ config, logger: logger5 });
|
|
20251
20915
|
const rulesResult = await generateRulesCore({ config, logger: logger5, skills: skillsResult.skills });
|
|
20252
|
-
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
20916
|
+
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || permissionsResult.hasDiff || rulesResult.hasDiff;
|
|
20253
20917
|
return {
|
|
20254
20918
|
rulesCount: rulesResult.count,
|
|
20255
20919
|
rulesPaths: rulesResult.paths,
|
|
@@ -20265,6 +20929,8 @@ async function generate(params) {
|
|
|
20265
20929
|
skillsPaths: skillsResult.paths,
|
|
20266
20930
|
hooksCount: hooksResult.count,
|
|
20267
20931
|
hooksPaths: hooksResult.paths,
|
|
20932
|
+
permissionsCount: permissionsResult.count,
|
|
20933
|
+
permissionsPaths: permissionsResult.paths,
|
|
20268
20934
|
skills: skillsResult.skills,
|
|
20269
20935
|
hasDiff
|
|
20270
20936
|
};
|
|
@@ -20275,7 +20941,7 @@ async function generateRulesCore(params) {
|
|
|
20275
20941
|
const allPaths = [];
|
|
20276
20942
|
let hasDiff = false;
|
|
20277
20943
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
20278
|
-
const toolTargets = (0,
|
|
20944
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedTargets);
|
|
20279
20945
|
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger: logger5 });
|
|
20280
20946
|
for (const baseDir of config.getBaseDirs()) {
|
|
20281
20947
|
for (const toolTarget of toolTargets) {
|
|
@@ -20317,7 +20983,7 @@ async function generateIgnoreCore(params) {
|
|
|
20317
20983
|
let totalCount = 0;
|
|
20318
20984
|
const allPaths = [];
|
|
20319
20985
|
let hasDiff = false;
|
|
20320
|
-
for (const toolTarget of (0,
|
|
20986
|
+
for (const toolTarget of (0, import_es_toolkit5.intersection)(config.getTargets(), supportedIgnoreTargets)) {
|
|
20321
20987
|
if (!config.getFeatures(toolTarget).includes("ignore")) {
|
|
20322
20988
|
continue;
|
|
20323
20989
|
}
|
|
@@ -20327,7 +20993,8 @@ async function generateIgnoreCore(params) {
|
|
|
20327
20993
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
20328
20994
|
toolTarget,
|
|
20329
20995
|
dryRun: config.isPreviewMode(),
|
|
20330
|
-
logger: logger5
|
|
20996
|
+
logger: logger5,
|
|
20997
|
+
featureOptions: config.getFeatureOptions(toolTarget, "ignore")
|
|
20331
20998
|
});
|
|
20332
20999
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
20333
21000
|
const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
|
|
@@ -20350,7 +21017,7 @@ async function generateMcpCore(params) {
|
|
|
20350
21017
|
const allPaths = [];
|
|
20351
21018
|
let hasDiff = false;
|
|
20352
21019
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
20353
|
-
const toolTargets = (0,
|
|
21020
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedMcpTargets);
|
|
20354
21021
|
warnUnsupportedTargets({
|
|
20355
21022
|
config,
|
|
20356
21023
|
supportedTargets: supportedMcpTargets,
|
|
@@ -20387,7 +21054,7 @@ async function generateCommandsCore(params) {
|
|
|
20387
21054
|
global: config.getGlobal(),
|
|
20388
21055
|
includeSimulated: config.getSimulateCommands()
|
|
20389
21056
|
});
|
|
20390
|
-
const toolTargets = (0,
|
|
21057
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedCommandsTargets);
|
|
20391
21058
|
warnUnsupportedTargets({
|
|
20392
21059
|
config,
|
|
20393
21060
|
supportedTargets: supportedCommandsTargets,
|
|
@@ -20425,7 +21092,7 @@ async function generateSubagentsCore(params) {
|
|
|
20425
21092
|
global: config.getGlobal(),
|
|
20426
21093
|
includeSimulated: config.getSimulateSubagents()
|
|
20427
21094
|
});
|
|
20428
|
-
const toolTargets = (0,
|
|
21095
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedSubagentsTargets);
|
|
20429
21096
|
warnUnsupportedTargets({
|
|
20430
21097
|
config,
|
|
20431
21098
|
supportedTargets: supportedSubagentsTargets,
|
|
@@ -20464,7 +21131,7 @@ async function generateSkillsCore(params) {
|
|
|
20464
21131
|
global: config.getGlobal(),
|
|
20465
21132
|
includeSimulated: config.getSimulateSkills()
|
|
20466
21133
|
});
|
|
20467
|
-
const toolTargets = (0,
|
|
21134
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedSkillsTargets);
|
|
20468
21135
|
warnUnsupportedTargets({
|
|
20469
21136
|
config,
|
|
20470
21137
|
supportedTargets: supportedSkillsTargets,
|
|
@@ -20509,7 +21176,7 @@ async function generateHooksCore(params) {
|
|
|
20509
21176
|
const allPaths = [];
|
|
20510
21177
|
let hasDiff = false;
|
|
20511
21178
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
20512
|
-
const toolTargets = (0,
|
|
21179
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedHooksTargets);
|
|
20513
21180
|
warnUnsupportedTargets({
|
|
20514
21181
|
config,
|
|
20515
21182
|
supportedTargets: supportedHooksTargets,
|
|
@@ -20537,10 +21204,52 @@ async function generateHooksCore(params) {
|
|
|
20537
21204
|
}
|
|
20538
21205
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
20539
21206
|
}
|
|
21207
|
+
async function generatePermissionsCore(params) {
|
|
21208
|
+
const { config, logger: logger5 } = params;
|
|
21209
|
+
const supportedPermissionsTargets = PermissionsProcessor.getToolTargets({
|
|
21210
|
+
global: config.getGlobal()
|
|
21211
|
+
});
|
|
21212
|
+
warnUnsupportedTargets({
|
|
21213
|
+
config,
|
|
21214
|
+
supportedTargets: supportedPermissionsTargets,
|
|
21215
|
+
featureName: "permissions",
|
|
21216
|
+
logger: logger5
|
|
21217
|
+
});
|
|
21218
|
+
let totalCount = 0;
|
|
21219
|
+
const allPaths = [];
|
|
21220
|
+
let hasDiff = false;
|
|
21221
|
+
for (const baseDir of config.getBaseDirs()) {
|
|
21222
|
+
for (const toolTarget of (0, import_es_toolkit5.intersection)(config.getTargets(), supportedPermissionsTargets)) {
|
|
21223
|
+
if (!config.getFeatures(toolTarget).includes("permissions")) {
|
|
21224
|
+
continue;
|
|
21225
|
+
}
|
|
21226
|
+
try {
|
|
21227
|
+
const processor = new PermissionsProcessor({
|
|
21228
|
+
baseDir,
|
|
21229
|
+
toolTarget,
|
|
21230
|
+
global: config.getGlobal(),
|
|
21231
|
+
dryRun: config.isPreviewMode(),
|
|
21232
|
+
logger: logger5
|
|
21233
|
+
});
|
|
21234
|
+
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
21235
|
+
const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
|
|
21236
|
+
totalCount += result.count;
|
|
21237
|
+
allPaths.push(...result.paths);
|
|
21238
|
+
if (result.hasDiff) hasDiff = true;
|
|
21239
|
+
} catch (error) {
|
|
21240
|
+
logger5.warn(
|
|
21241
|
+
`Failed to generate ${toolTarget} permissions files for ${baseDir}: ${formatError(error)}`
|
|
21242
|
+
);
|
|
21243
|
+
continue;
|
|
21244
|
+
}
|
|
21245
|
+
}
|
|
21246
|
+
}
|
|
21247
|
+
return { count: totalCount, paths: allPaths, hasDiff };
|
|
21248
|
+
}
|
|
20540
21249
|
|
|
20541
21250
|
// src/utils/result.ts
|
|
20542
21251
|
function calculateTotalCount(result) {
|
|
20543
|
-
return result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount;
|
|
21252
|
+
return result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount + result.permissionsCount;
|
|
20544
21253
|
}
|
|
20545
21254
|
|
|
20546
21255
|
// src/cli/commands/generate.ts
|
|
@@ -20601,6 +21310,7 @@ async function generateCommand(logger5, options) {
|
|
|
20601
21310
|
subagents: { count: result.subagentsCount, paths: result.subagentsPaths },
|
|
20602
21311
|
skills: { count: result.skillsCount, paths: result.skillsPaths },
|
|
20603
21312
|
hooks: { count: result.hooksCount, paths: result.hooksPaths },
|
|
21313
|
+
permissions: { count: result.permissionsCount, paths: result.permissionsPaths },
|
|
20604
21314
|
rules: { count: result.rulesCount, paths: result.rulesPaths }
|
|
20605
21315
|
};
|
|
20606
21316
|
const featureLabels = {
|
|
@@ -20610,7 +21320,8 @@ async function generateCommand(logger5, options) {
|
|
|
20610
21320
|
commands: (count) => `${count === 1 ? "command" : "commands"}`,
|
|
20611
21321
|
subagents: (count) => `${count === 1 ? "subagent" : "subagents"}`,
|
|
20612
21322
|
skills: (count) => `${count === 1 ? "skill" : "skills"}`,
|
|
20613
|
-
hooks: (count) => `${count === 1 ? "hooks file" : "hooks files"}
|
|
21323
|
+
hooks: (count) => `${count === 1 ? "hooks file" : "hooks files"}`,
|
|
21324
|
+
permissions: (count) => `${count === 1 ? "permissions file" : "permissions files"}`
|
|
20614
21325
|
};
|
|
20615
21326
|
for (const [feature, data] of Object.entries(featureResults)) {
|
|
20616
21327
|
logFeatureResult(logger5, {
|
|
@@ -20650,6 +21361,7 @@ async function generateCommand(logger5, options) {
|
|
|
20650
21361
|
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
20651
21362
|
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
20652
21363
|
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
21364
|
+
if (result.permissionsCount > 0) parts.push(`${result.permissionsCount} permissions`);
|
|
20653
21365
|
if (isPreview) {
|
|
20654
21366
|
logger5.info(`${modePrefix} Would write ${totalGenerated} file(s) total (${parts.join(" + ")})`);
|
|
20655
21367
|
} else {
|
|
@@ -20658,7 +21370,7 @@ async function generateCommand(logger5, options) {
|
|
|
20658
21370
|
}
|
|
20659
21371
|
|
|
20660
21372
|
// src/cli/commands/gitignore.ts
|
|
20661
|
-
var
|
|
21373
|
+
var import_node_path139 = require("path");
|
|
20662
21374
|
|
|
20663
21375
|
// src/cli/commands/gitignore-entries.ts
|
|
20664
21376
|
var normalizeGitignoreEntryTargets = (target) => {
|
|
@@ -20673,7 +21385,6 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
20673
21385
|
},
|
|
20674
21386
|
{ target: "common", feature: "general", entry: ".rulesync/rules/*.local.md" },
|
|
20675
21387
|
{ target: "common", feature: "general", entry: "rulesync.local.jsonc" },
|
|
20676
|
-
{ target: "common", feature: "general", entry: "!.rulesync/.aiignore" },
|
|
20677
21388
|
// AGENTS.local.md is placed in common scope (not rovodev-only) so that
|
|
20678
21389
|
// local rule files are always gitignored regardless of which targets are enabled.
|
|
20679
21390
|
// This prevents accidental commits when a user disables the rovodev target.
|
|
@@ -20805,6 +21516,8 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
20805
21516
|
{ target: "kiro", feature: "subagents", entry: "**/.kiro/agents/" },
|
|
20806
21517
|
{ target: "kiro", feature: "mcp", entry: "**/.kiro/settings/mcp.json" },
|
|
20807
21518
|
{ target: "kiro", feature: "ignore", entry: "**/.aiignore" },
|
|
21519
|
+
// Keep this after ignore entries like "**/.aiignore" so the exception remains effective.
|
|
21520
|
+
{ target: "common", feature: "general", entry: "!.rulesync/.aiignore" },
|
|
20808
21521
|
// OpenCode
|
|
20809
21522
|
{ target: "opencode", feature: "commands", entry: "**/.opencode/command/" },
|
|
20810
21523
|
{ target: "opencode", feature: "subagents", entry: "**/.opencode/agent/" },
|
|
@@ -20869,8 +21582,12 @@ var isFeatureSelectedForTarget = (feature, target, features) => {
|
|
|
20869
21582
|
if (target === "common") return true;
|
|
20870
21583
|
const targetFeatures = features[target];
|
|
20871
21584
|
if (!targetFeatures) return true;
|
|
20872
|
-
if (
|
|
20873
|
-
|
|
21585
|
+
if (Array.isArray(targetFeatures)) {
|
|
21586
|
+
if (targetFeatures.includes("*")) return true;
|
|
21587
|
+
return targetFeatures.includes(feature);
|
|
21588
|
+
}
|
|
21589
|
+
if (isFeatureValueEnabled(targetFeatures["*"])) return true;
|
|
21590
|
+
return isFeatureValueEnabled(targetFeatures[feature]);
|
|
20874
21591
|
};
|
|
20875
21592
|
var isFeatureSelected = (feature, target, features) => {
|
|
20876
21593
|
return normalizeGitignoreEntryTargets(target).some(
|
|
@@ -20905,8 +21622,14 @@ var warnInvalidFeatures = (features, logger5) => {
|
|
|
20905
21622
|
} else {
|
|
20906
21623
|
for (const targetFeatures of Object.values(features)) {
|
|
20907
21624
|
if (!targetFeatures) continue;
|
|
20908
|
-
|
|
20909
|
-
|
|
21625
|
+
if (Array.isArray(targetFeatures)) {
|
|
21626
|
+
for (const feature of targetFeatures) {
|
|
21627
|
+
warnOnce(feature);
|
|
21628
|
+
}
|
|
21629
|
+
} else {
|
|
21630
|
+
for (const feature of Object.keys(targetFeatures)) {
|
|
21631
|
+
warnOnce(feature);
|
|
21632
|
+
}
|
|
20910
21633
|
}
|
|
20911
21634
|
}
|
|
20912
21635
|
}
|
|
@@ -20985,7 +21708,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
20985
21708
|
return result;
|
|
20986
21709
|
};
|
|
20987
21710
|
var gitignoreCommand = async (logger5, options) => {
|
|
20988
|
-
const gitignorePath = (0,
|
|
21711
|
+
const gitignorePath = (0, import_node_path139.join)(process.cwd(), ".gitignore");
|
|
20989
21712
|
let gitignoreContent = "";
|
|
20990
21713
|
if (await fileExists(gitignorePath)) {
|
|
20991
21714
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -21047,6 +21770,7 @@ async function importFromTool(params) {
|
|
|
21047
21770
|
const subagentsCount = await importSubagentsCore({ config, tool, logger: logger5 });
|
|
21048
21771
|
const skillsCount = await importSkillsCore({ config, tool, logger: logger5 });
|
|
21049
21772
|
const hooksCount = await importHooksCore({ config, tool, logger: logger5 });
|
|
21773
|
+
const permissionsCount = await importPermissionsCore({ config, tool, logger: logger5 });
|
|
21050
21774
|
return {
|
|
21051
21775
|
rulesCount,
|
|
21052
21776
|
ignoreCount,
|
|
@@ -21054,7 +21778,8 @@ async function importFromTool(params) {
|
|
|
21054
21778
|
commandsCount,
|
|
21055
21779
|
subagentsCount,
|
|
21056
21780
|
skillsCount,
|
|
21057
|
-
hooksCount
|
|
21781
|
+
hooksCount,
|
|
21782
|
+
permissionsCount
|
|
21058
21783
|
};
|
|
21059
21784
|
}
|
|
21060
21785
|
async function importRulesCore(params) {
|
|
@@ -21100,7 +21825,8 @@ async function importIgnoreCore(params) {
|
|
|
21100
21825
|
const ignoreProcessor = new IgnoreProcessor({
|
|
21101
21826
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
21102
21827
|
toolTarget: tool,
|
|
21103
|
-
logger: logger5
|
|
21828
|
+
logger: logger5,
|
|
21829
|
+
featureOptions: config.getFeatureOptions(tool, "ignore")
|
|
21104
21830
|
});
|
|
21105
21831
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
21106
21832
|
if (toolFiles.length === 0) {
|
|
@@ -21262,6 +21988,41 @@ async function importHooksCore(params) {
|
|
|
21262
21988
|
}
|
|
21263
21989
|
return writtenCount;
|
|
21264
21990
|
}
|
|
21991
|
+
async function importPermissionsCore(params) {
|
|
21992
|
+
const { config, tool, logger: logger5 } = params;
|
|
21993
|
+
if (!config.getFeatures(tool).includes("permissions")) {
|
|
21994
|
+
return 0;
|
|
21995
|
+
}
|
|
21996
|
+
const allTargets = PermissionsProcessor.getToolTargets({ global: config.getGlobal() });
|
|
21997
|
+
const importableTargets = PermissionsProcessor.getToolTargets({
|
|
21998
|
+
global: config.getGlobal(),
|
|
21999
|
+
importOnly: true
|
|
22000
|
+
});
|
|
22001
|
+
if (!allTargets.includes(tool)) {
|
|
22002
|
+
return 0;
|
|
22003
|
+
}
|
|
22004
|
+
if (!importableTargets.includes(tool)) {
|
|
22005
|
+
logger5.warn(`Import is not supported for ${tool} permissions. Skipping.`);
|
|
22006
|
+
return 0;
|
|
22007
|
+
}
|
|
22008
|
+
const permissionsProcessor = new PermissionsProcessor({
|
|
22009
|
+
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
22010
|
+
toolTarget: tool,
|
|
22011
|
+
global: config.getGlobal(),
|
|
22012
|
+
logger: logger5
|
|
22013
|
+
});
|
|
22014
|
+
const toolFiles = await permissionsProcessor.loadToolFiles();
|
|
22015
|
+
if (toolFiles.length === 0) {
|
|
22016
|
+
logger5.warn(`No permissions files found for ${tool}. Skipping import.`);
|
|
22017
|
+
return 0;
|
|
22018
|
+
}
|
|
22019
|
+
const rulesyncFiles = await permissionsProcessor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
22020
|
+
const { count: writtenCount } = await permissionsProcessor.writeAiFiles(rulesyncFiles);
|
|
22021
|
+
if (config.getVerbose() && writtenCount > 0) {
|
|
22022
|
+
logger5.success(`Created ${writtenCount} permissions file(s)`);
|
|
22023
|
+
}
|
|
22024
|
+
return writtenCount;
|
|
22025
|
+
}
|
|
21265
22026
|
|
|
21266
22027
|
// src/cli/commands/import.ts
|
|
21267
22028
|
async function importCommand(logger5, options) {
|
|
@@ -21290,7 +22051,8 @@ async function importCommand(logger5, options) {
|
|
|
21290
22051
|
commands: { count: result.commandsCount },
|
|
21291
22052
|
subagents: { count: result.subagentsCount },
|
|
21292
22053
|
skills: { count: result.skillsCount },
|
|
21293
|
-
hooks: { count: result.hooksCount }
|
|
22054
|
+
hooks: { count: result.hooksCount },
|
|
22055
|
+
permissions: { count: result.permissionsCount }
|
|
21294
22056
|
});
|
|
21295
22057
|
logger5.captureData("totalFiles", totalImported);
|
|
21296
22058
|
}
|
|
@@ -21302,11 +22064,12 @@ async function importCommand(logger5, options) {
|
|
|
21302
22064
|
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
21303
22065
|
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
21304
22066
|
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
22067
|
+
if (result.permissionsCount > 0) parts.push(`${result.permissionsCount} permissions`);
|
|
21305
22068
|
logger5.success(`Imported ${totalImported} file(s) total (${parts.join(" + ")})`);
|
|
21306
22069
|
}
|
|
21307
22070
|
|
|
21308
22071
|
// src/lib/init.ts
|
|
21309
|
-
var
|
|
22072
|
+
var import_node_path140 = require("path");
|
|
21310
22073
|
async function init() {
|
|
21311
22074
|
const sampleFiles = await createSampleFiles();
|
|
21312
22075
|
const configFile = await createConfigFile();
|
|
@@ -21498,27 +22261,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
21498
22261
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
21499
22262
|
await ensureDir(skillPaths.relativeDirPath);
|
|
21500
22263
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
21501
|
-
const ruleFilepath = (0,
|
|
22264
|
+
const ruleFilepath = (0, import_node_path140.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
21502
22265
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
21503
|
-
const mcpFilepath = (0,
|
|
22266
|
+
const mcpFilepath = (0, import_node_path140.join)(
|
|
21504
22267
|
mcpPaths.recommended.relativeDirPath,
|
|
21505
22268
|
mcpPaths.recommended.relativeFilePath
|
|
21506
22269
|
);
|
|
21507
22270
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
21508
|
-
const commandFilepath = (0,
|
|
22271
|
+
const commandFilepath = (0, import_node_path140.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
21509
22272
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
21510
|
-
const subagentFilepath = (0,
|
|
22273
|
+
const subagentFilepath = (0, import_node_path140.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
21511
22274
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
21512
|
-
const skillDirPath = (0,
|
|
22275
|
+
const skillDirPath = (0, import_node_path140.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
21513
22276
|
await ensureDir(skillDirPath);
|
|
21514
|
-
const skillFilepath = (0,
|
|
22277
|
+
const skillFilepath = (0, import_node_path140.join)(skillDirPath, SKILL_FILE_NAME);
|
|
21515
22278
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
21516
|
-
const ignoreFilepath = (0,
|
|
22279
|
+
const ignoreFilepath = (0, import_node_path140.join)(
|
|
21517
22280
|
ignorePaths.recommended.relativeDirPath,
|
|
21518
22281
|
ignorePaths.recommended.relativeFilePath
|
|
21519
22282
|
);
|
|
21520
22283
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
21521
|
-
const hooksFilepath = (0,
|
|
22284
|
+
const hooksFilepath = (0, import_node_path140.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
21522
22285
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
21523
22286
|
return results;
|
|
21524
22287
|
}
|
|
@@ -21566,12 +22329,12 @@ async function initCommand(logger5) {
|
|
|
21566
22329
|
}
|
|
21567
22330
|
|
|
21568
22331
|
// src/lib/sources.ts
|
|
21569
|
-
var
|
|
22332
|
+
var import_node_path143 = require("path");
|
|
21570
22333
|
var import_promise2 = require("es-toolkit/promise");
|
|
21571
22334
|
|
|
21572
22335
|
// src/lib/git-client.ts
|
|
21573
22336
|
var import_node_child_process = require("child_process");
|
|
21574
|
-
var
|
|
22337
|
+
var import_node_path141 = require("path");
|
|
21575
22338
|
var import_node_util2 = require("util");
|
|
21576
22339
|
var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
|
|
21577
22340
|
var GIT_TIMEOUT_MS = 6e4;
|
|
@@ -21659,7 +22422,7 @@ async function fetchSkillFiles(params) {
|
|
|
21659
22422
|
const { url, ref, skillsPath, logger: logger5 } = params;
|
|
21660
22423
|
validateGitUrl(url, { logger: logger5 });
|
|
21661
22424
|
validateRef(ref);
|
|
21662
|
-
if (skillsPath.split(/[/\\]/).includes("..") || (0,
|
|
22425
|
+
if (skillsPath.split(/[/\\]/).includes("..") || (0, import_node_path141.isAbsolute)(skillsPath)) {
|
|
21663
22426
|
throw new GitClientError(
|
|
21664
22427
|
`Invalid skillsPath "${skillsPath}": must be a relative path without ".."`
|
|
21665
22428
|
);
|
|
@@ -21693,7 +22456,7 @@ async function fetchSkillFiles(params) {
|
|
|
21693
22456
|
timeout: GIT_TIMEOUT_MS
|
|
21694
22457
|
});
|
|
21695
22458
|
await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
|
|
21696
|
-
const skillsDir = (0,
|
|
22459
|
+
const skillsDir = (0, import_node_path141.join)(tmpDir, skillsPath);
|
|
21697
22460
|
if (!await directoryExists(skillsDir)) return [];
|
|
21698
22461
|
return await walkDirectory(skillsDir, skillsDir, 0, { totalFiles: 0, totalSize: 0 }, logger5);
|
|
21699
22462
|
} catch (error) {
|
|
@@ -21715,7 +22478,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
21715
22478
|
const results = [];
|
|
21716
22479
|
for (const name of await listDirectoryFiles(dir)) {
|
|
21717
22480
|
if (name === ".git") continue;
|
|
21718
|
-
const fullPath = (0,
|
|
22481
|
+
const fullPath = (0, import_node_path141.join)(dir, name);
|
|
21719
22482
|
if (await isSymlink(fullPath)) {
|
|
21720
22483
|
logger5?.warn(`Skipping symlink "${fullPath}".`);
|
|
21721
22484
|
continue;
|
|
@@ -21743,7 +22506,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
21743
22506
|
);
|
|
21744
22507
|
}
|
|
21745
22508
|
const content = await readFileContent(fullPath);
|
|
21746
|
-
results.push({ relativePath: (0,
|
|
22509
|
+
results.push({ relativePath: (0, import_node_path141.relative)(baseDir, fullPath), content, size });
|
|
21747
22510
|
}
|
|
21748
22511
|
}
|
|
21749
22512
|
return results;
|
|
@@ -21751,28 +22514,28 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
21751
22514
|
|
|
21752
22515
|
// src/lib/sources-lock.ts
|
|
21753
22516
|
var import_node_crypto = require("crypto");
|
|
21754
|
-
var
|
|
21755
|
-
var
|
|
22517
|
+
var import_node_path142 = require("path");
|
|
22518
|
+
var import_mini73 = require("zod/mini");
|
|
21756
22519
|
var LOCKFILE_VERSION = 1;
|
|
21757
|
-
var LockedSkillSchema =
|
|
21758
|
-
integrity:
|
|
22520
|
+
var LockedSkillSchema = import_mini73.z.object({
|
|
22521
|
+
integrity: import_mini73.z.string()
|
|
21759
22522
|
});
|
|
21760
|
-
var LockedSourceSchema =
|
|
21761
|
-
requestedRef: (0,
|
|
21762
|
-
resolvedRef:
|
|
21763
|
-
resolvedAt: (0,
|
|
21764
|
-
skills:
|
|
22523
|
+
var LockedSourceSchema = import_mini73.z.object({
|
|
22524
|
+
requestedRef: (0, import_mini73.optional)(import_mini73.z.string()),
|
|
22525
|
+
resolvedRef: import_mini73.z.string().check((0, import_mini73.refine)((v) => /^[0-9a-f]{40}$/.test(v), "resolvedRef must be a 40-character hex SHA")),
|
|
22526
|
+
resolvedAt: (0, import_mini73.optional)(import_mini73.z.string()),
|
|
22527
|
+
skills: import_mini73.z.record(import_mini73.z.string(), LockedSkillSchema)
|
|
21765
22528
|
});
|
|
21766
|
-
var SourcesLockSchema =
|
|
21767
|
-
lockfileVersion:
|
|
21768
|
-
sources:
|
|
22529
|
+
var SourcesLockSchema = import_mini73.z.object({
|
|
22530
|
+
lockfileVersion: import_mini73.z.number(),
|
|
22531
|
+
sources: import_mini73.z.record(import_mini73.z.string(), LockedSourceSchema)
|
|
21769
22532
|
});
|
|
21770
|
-
var LegacyLockedSourceSchema =
|
|
21771
|
-
resolvedRef:
|
|
21772
|
-
skills:
|
|
22533
|
+
var LegacyLockedSourceSchema = import_mini73.z.object({
|
|
22534
|
+
resolvedRef: import_mini73.z.string(),
|
|
22535
|
+
skills: import_mini73.z.array(import_mini73.z.string())
|
|
21773
22536
|
});
|
|
21774
|
-
var LegacySourcesLockSchema =
|
|
21775
|
-
sources:
|
|
22537
|
+
var LegacySourcesLockSchema = import_mini73.z.object({
|
|
22538
|
+
sources: import_mini73.z.record(import_mini73.z.string(), LegacyLockedSourceSchema)
|
|
21776
22539
|
});
|
|
21777
22540
|
function migrateLegacyLock(params) {
|
|
21778
22541
|
const { legacy, logger: logger5 } = params;
|
|
@@ -21797,7 +22560,7 @@ function createEmptyLock() {
|
|
|
21797
22560
|
}
|
|
21798
22561
|
async function readLockFile(params) {
|
|
21799
22562
|
const { logger: logger5 } = params;
|
|
21800
|
-
const lockPath = (0,
|
|
22563
|
+
const lockPath = (0, import_node_path142.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
21801
22564
|
if (!await fileExists(lockPath)) {
|
|
21802
22565
|
logger5.debug("No sources lockfile found, starting fresh.");
|
|
21803
22566
|
return createEmptyLock();
|
|
@@ -21826,7 +22589,7 @@ async function readLockFile(params) {
|
|
|
21826
22589
|
}
|
|
21827
22590
|
async function writeLockFile(params) {
|
|
21828
22591
|
const { logger: logger5 } = params;
|
|
21829
|
-
const lockPath = (0,
|
|
22592
|
+
const lockPath = (0, import_node_path142.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
21830
22593
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
21831
22594
|
await writeFileContent(lockPath, content);
|
|
21832
22595
|
logger5.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -22000,7 +22763,7 @@ function logGitClientHints(params) {
|
|
|
22000
22763
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
22001
22764
|
if (skillNames.length === 0) return true;
|
|
22002
22765
|
for (const name of skillNames) {
|
|
22003
|
-
if (!await directoryExists((0,
|
|
22766
|
+
if (!await directoryExists((0, import_node_path143.join)(curatedDir, name))) {
|
|
22004
22767
|
return false;
|
|
22005
22768
|
}
|
|
22006
22769
|
}
|
|
@@ -22008,10 +22771,10 @@ async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
|
22008
22771
|
}
|
|
22009
22772
|
async function cleanPreviousCuratedSkills(params) {
|
|
22010
22773
|
const { curatedDir, lockedSkillNames, logger: logger5 } = params;
|
|
22011
|
-
const resolvedCuratedDir = (0,
|
|
22774
|
+
const resolvedCuratedDir = (0, import_node_path143.resolve)(curatedDir);
|
|
22012
22775
|
for (const prevSkill of lockedSkillNames) {
|
|
22013
|
-
const prevDir = (0,
|
|
22014
|
-
if (!(0,
|
|
22776
|
+
const prevDir = (0, import_node_path143.join)(curatedDir, prevSkill);
|
|
22777
|
+
if (!(0, import_node_path143.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path143.sep)) {
|
|
22015
22778
|
logger5.warn(
|
|
22016
22779
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
22017
22780
|
);
|
|
@@ -22050,9 +22813,9 @@ async function writeSkillAndComputeIntegrity(params) {
|
|
|
22050
22813
|
for (const file of files) {
|
|
22051
22814
|
checkPathTraversal({
|
|
22052
22815
|
relativePath: file.relativePath,
|
|
22053
|
-
intendedRootDir: (0,
|
|
22816
|
+
intendedRootDir: (0, import_node_path143.join)(curatedDir, skillName)
|
|
22054
22817
|
});
|
|
22055
|
-
await writeFileContent((0,
|
|
22818
|
+
await writeFileContent((0, import_node_path143.join)(curatedDir, skillName, file.relativePath), file.content);
|
|
22056
22819
|
written.push({ path: file.relativePath, content: file.content });
|
|
22057
22820
|
}
|
|
22058
22821
|
const integrity = computeSkillIntegrity(written);
|
|
@@ -22129,7 +22892,7 @@ async function fetchSource(params) {
|
|
|
22129
22892
|
ref = resolvedSha;
|
|
22130
22893
|
logger5.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
22131
22894
|
}
|
|
22132
|
-
const curatedDir = (0,
|
|
22895
|
+
const curatedDir = (0, import_node_path143.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
22133
22896
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
22134
22897
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
22135
22898
|
if (allExist) {
|
|
@@ -22254,7 +23017,7 @@ async function fetchSourceViaGit(params) {
|
|
|
22254
23017
|
requestedRef = def.ref;
|
|
22255
23018
|
resolvedSha = def.sha;
|
|
22256
23019
|
}
|
|
22257
|
-
const curatedDir = (0,
|
|
23020
|
+
const curatedDir = (0, import_node_path143.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
22258
23021
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
22259
23022
|
if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
|
|
22260
23023
|
return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
|
|
@@ -22370,11 +23133,11 @@ async function installCommand(logger5, options) {
|
|
|
22370
23133
|
var import_fastmcp = require("fastmcp");
|
|
22371
23134
|
|
|
22372
23135
|
// src/mcp/tools.ts
|
|
22373
|
-
var
|
|
23136
|
+
var import_mini82 = require("zod/mini");
|
|
22374
23137
|
|
|
22375
23138
|
// src/mcp/commands.ts
|
|
22376
|
-
var
|
|
22377
|
-
var
|
|
23139
|
+
var import_node_path144 = require("path");
|
|
23140
|
+
var import_mini74 = require("zod/mini");
|
|
22378
23141
|
|
|
22379
23142
|
// src/utils/logger.ts
|
|
22380
23143
|
var BaseLogger = class {
|
|
@@ -22525,7 +23288,7 @@ var logger = new ConsoleLogger({ verbose: false, silent: true });
|
|
|
22525
23288
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
22526
23289
|
var maxCommandsCount = 1e3;
|
|
22527
23290
|
async function listCommands() {
|
|
22528
|
-
const commandsDir = (0,
|
|
23291
|
+
const commandsDir = (0, import_node_path144.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
22529
23292
|
try {
|
|
22530
23293
|
const files = await listDirectoryFiles(commandsDir);
|
|
22531
23294
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -22541,7 +23304,7 @@ async function listCommands() {
|
|
|
22541
23304
|
});
|
|
22542
23305
|
const frontmatter = command.getFrontmatter();
|
|
22543
23306
|
return {
|
|
22544
|
-
relativePathFromCwd: (0,
|
|
23307
|
+
relativePathFromCwd: (0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
22545
23308
|
frontmatter
|
|
22546
23309
|
};
|
|
22547
23310
|
} catch (error) {
|
|
@@ -22563,13 +23326,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
22563
23326
|
relativePath: relativePathFromCwd,
|
|
22564
23327
|
intendedRootDir: process.cwd()
|
|
22565
23328
|
});
|
|
22566
|
-
const filename = (0,
|
|
23329
|
+
const filename = (0, import_node_path144.basename)(relativePathFromCwd);
|
|
22567
23330
|
try {
|
|
22568
23331
|
const command = await RulesyncCommand.fromFile({
|
|
22569
23332
|
relativeFilePath: filename
|
|
22570
23333
|
});
|
|
22571
23334
|
return {
|
|
22572
|
-
relativePathFromCwd: (0,
|
|
23335
|
+
relativePathFromCwd: (0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
22573
23336
|
frontmatter: command.getFrontmatter(),
|
|
22574
23337
|
body: command.getBody()
|
|
22575
23338
|
};
|
|
@@ -22588,7 +23351,7 @@ async function putCommand({
|
|
|
22588
23351
|
relativePath: relativePathFromCwd,
|
|
22589
23352
|
intendedRootDir: process.cwd()
|
|
22590
23353
|
});
|
|
22591
|
-
const filename = (0,
|
|
23354
|
+
const filename = (0, import_node_path144.basename)(relativePathFromCwd);
|
|
22592
23355
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
22593
23356
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
22594
23357
|
throw new Error(
|
|
@@ -22598,7 +23361,7 @@ async function putCommand({
|
|
|
22598
23361
|
try {
|
|
22599
23362
|
const existingCommands = await listCommands();
|
|
22600
23363
|
const isUpdate = existingCommands.some(
|
|
22601
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
23364
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
22602
23365
|
);
|
|
22603
23366
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
22604
23367
|
throw new Error(
|
|
@@ -22615,11 +23378,11 @@ async function putCommand({
|
|
|
22615
23378
|
fileContent,
|
|
22616
23379
|
validate: true
|
|
22617
23380
|
});
|
|
22618
|
-
const commandsDir = (0,
|
|
23381
|
+
const commandsDir = (0, import_node_path144.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
22619
23382
|
await ensureDir(commandsDir);
|
|
22620
23383
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
22621
23384
|
return {
|
|
22622
|
-
relativePathFromCwd: (0,
|
|
23385
|
+
relativePathFromCwd: (0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
22623
23386
|
frontmatter: command.getFrontmatter(),
|
|
22624
23387
|
body: command.getBody()
|
|
22625
23388
|
};
|
|
@@ -22634,12 +23397,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
22634
23397
|
relativePath: relativePathFromCwd,
|
|
22635
23398
|
intendedRootDir: process.cwd()
|
|
22636
23399
|
});
|
|
22637
|
-
const filename = (0,
|
|
22638
|
-
const fullPath = (0,
|
|
23400
|
+
const filename = (0, import_node_path144.basename)(relativePathFromCwd);
|
|
23401
|
+
const fullPath = (0, import_node_path144.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
22639
23402
|
try {
|
|
22640
23403
|
await removeFile(fullPath);
|
|
22641
23404
|
return {
|
|
22642
|
-
relativePathFromCwd: (0,
|
|
23405
|
+
relativePathFromCwd: (0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
22643
23406
|
};
|
|
22644
23407
|
} catch (error) {
|
|
22645
23408
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -22648,23 +23411,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
22648
23411
|
}
|
|
22649
23412
|
}
|
|
22650
23413
|
var commandToolSchemas = {
|
|
22651
|
-
listCommands:
|
|
22652
|
-
getCommand:
|
|
22653
|
-
relativePathFromCwd:
|
|
23414
|
+
listCommands: import_mini74.z.object({}),
|
|
23415
|
+
getCommand: import_mini74.z.object({
|
|
23416
|
+
relativePathFromCwd: import_mini74.z.string()
|
|
22654
23417
|
}),
|
|
22655
|
-
putCommand:
|
|
22656
|
-
relativePathFromCwd:
|
|
23418
|
+
putCommand: import_mini74.z.object({
|
|
23419
|
+
relativePathFromCwd: import_mini74.z.string(),
|
|
22657
23420
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
22658
|
-
body:
|
|
23421
|
+
body: import_mini74.z.string()
|
|
22659
23422
|
}),
|
|
22660
|
-
deleteCommand:
|
|
22661
|
-
relativePathFromCwd:
|
|
23423
|
+
deleteCommand: import_mini74.z.object({
|
|
23424
|
+
relativePathFromCwd: import_mini74.z.string()
|
|
22662
23425
|
})
|
|
22663
23426
|
};
|
|
22664
23427
|
var commandTools = {
|
|
22665
23428
|
listCommands: {
|
|
22666
23429
|
name: "listCommands",
|
|
22667
|
-
description: `List all commands from ${(0,
|
|
23430
|
+
description: `List all commands from ${(0, import_node_path144.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
22668
23431
|
parameters: commandToolSchemas.listCommands,
|
|
22669
23432
|
execute: async () => {
|
|
22670
23433
|
const commands = await listCommands();
|
|
@@ -22706,15 +23469,15 @@ var commandTools = {
|
|
|
22706
23469
|
};
|
|
22707
23470
|
|
|
22708
23471
|
// src/mcp/generate.ts
|
|
22709
|
-
var
|
|
22710
|
-
var generateOptionsSchema =
|
|
22711
|
-
targets:
|
|
22712
|
-
features:
|
|
22713
|
-
delete:
|
|
22714
|
-
global:
|
|
22715
|
-
simulateCommands:
|
|
22716
|
-
simulateSubagents:
|
|
22717
|
-
simulateSkills:
|
|
23472
|
+
var import_mini75 = require("zod/mini");
|
|
23473
|
+
var generateOptionsSchema = import_mini75.z.object({
|
|
23474
|
+
targets: import_mini75.z.optional(import_mini75.z.array(import_mini75.z.string())),
|
|
23475
|
+
features: import_mini75.z.optional(import_mini75.z.array(import_mini75.z.string())),
|
|
23476
|
+
delete: import_mini75.z.optional(import_mini75.z.boolean()),
|
|
23477
|
+
global: import_mini75.z.optional(import_mini75.z.boolean()),
|
|
23478
|
+
simulateCommands: import_mini75.z.optional(import_mini75.z.boolean()),
|
|
23479
|
+
simulateSubagents: import_mini75.z.optional(import_mini75.z.boolean()),
|
|
23480
|
+
simulateSkills: import_mini75.z.optional(import_mini75.z.boolean())
|
|
22718
23481
|
});
|
|
22719
23482
|
async function executeGenerate(options = {}) {
|
|
22720
23483
|
try {
|
|
@@ -22763,6 +23526,7 @@ function buildSuccessResponse(params) {
|
|
|
22763
23526
|
subagentsCount: generateResult.subagentsCount,
|
|
22764
23527
|
skillsCount: generateResult.skillsCount,
|
|
22765
23528
|
hooksCount: generateResult.hooksCount,
|
|
23529
|
+
permissionsCount: generateResult.permissionsCount,
|
|
22766
23530
|
totalCount
|
|
22767
23531
|
},
|
|
22768
23532
|
config: {
|
|
@@ -22792,11 +23556,11 @@ var generateTools = {
|
|
|
22792
23556
|
};
|
|
22793
23557
|
|
|
22794
23558
|
// src/mcp/ignore.ts
|
|
22795
|
-
var
|
|
22796
|
-
var
|
|
23559
|
+
var import_node_path145 = require("path");
|
|
23560
|
+
var import_mini76 = require("zod/mini");
|
|
22797
23561
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
22798
23562
|
async function getIgnoreFile() {
|
|
22799
|
-
const ignoreFilePath = (0,
|
|
23563
|
+
const ignoreFilePath = (0, import_node_path145.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
22800
23564
|
try {
|
|
22801
23565
|
const content = await readFileContent(ignoreFilePath);
|
|
22802
23566
|
return {
|
|
@@ -22813,7 +23577,7 @@ async function getIgnoreFile() {
|
|
|
22813
23577
|
}
|
|
22814
23578
|
}
|
|
22815
23579
|
async function putIgnoreFile({ content }) {
|
|
22816
|
-
const ignoreFilePath = (0,
|
|
23580
|
+
const ignoreFilePath = (0, import_node_path145.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
22817
23581
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
22818
23582
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
22819
23583
|
throw new Error(
|
|
@@ -22837,8 +23601,8 @@ async function putIgnoreFile({ content }) {
|
|
|
22837
23601
|
}
|
|
22838
23602
|
}
|
|
22839
23603
|
async function deleteIgnoreFile() {
|
|
22840
|
-
const aiignorePath = (0,
|
|
22841
|
-
const legacyIgnorePath = (0,
|
|
23604
|
+
const aiignorePath = (0, import_node_path145.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
23605
|
+
const legacyIgnorePath = (0, import_node_path145.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
22842
23606
|
try {
|
|
22843
23607
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
22844
23608
|
return {
|
|
@@ -22856,11 +23620,11 @@ async function deleteIgnoreFile() {
|
|
|
22856
23620
|
}
|
|
22857
23621
|
}
|
|
22858
23622
|
var ignoreToolSchemas = {
|
|
22859
|
-
getIgnoreFile:
|
|
22860
|
-
putIgnoreFile:
|
|
22861
|
-
content:
|
|
23623
|
+
getIgnoreFile: import_mini76.z.object({}),
|
|
23624
|
+
putIgnoreFile: import_mini76.z.object({
|
|
23625
|
+
content: import_mini76.z.string()
|
|
22862
23626
|
}),
|
|
22863
|
-
deleteIgnoreFile:
|
|
23627
|
+
deleteIgnoreFile: import_mini76.z.object({})
|
|
22864
23628
|
};
|
|
22865
23629
|
var ignoreTools = {
|
|
22866
23630
|
getIgnoreFile: {
|
|
@@ -22893,11 +23657,11 @@ var ignoreTools = {
|
|
|
22893
23657
|
};
|
|
22894
23658
|
|
|
22895
23659
|
// src/mcp/import.ts
|
|
22896
|
-
var
|
|
22897
|
-
var importOptionsSchema =
|
|
22898
|
-
target:
|
|
22899
|
-
features:
|
|
22900
|
-
global:
|
|
23660
|
+
var import_mini77 = require("zod/mini");
|
|
23661
|
+
var importOptionsSchema = import_mini77.z.object({
|
|
23662
|
+
target: import_mini77.z.string(),
|
|
23663
|
+
features: import_mini77.z.optional(import_mini77.z.array(import_mini77.z.string())),
|
|
23664
|
+
global: import_mini77.z.optional(import_mini77.z.boolean())
|
|
22901
23665
|
});
|
|
22902
23666
|
async function executeImport(options) {
|
|
22903
23667
|
try {
|
|
@@ -22942,6 +23706,7 @@ function buildSuccessResponse2(params) {
|
|
|
22942
23706
|
subagentsCount: importResult.subagentsCount,
|
|
22943
23707
|
skillsCount: importResult.skillsCount,
|
|
22944
23708
|
hooksCount: importResult.hooksCount,
|
|
23709
|
+
permissionsCount: importResult.permissionsCount,
|
|
22945
23710
|
totalCount
|
|
22946
23711
|
},
|
|
22947
23712
|
config: {
|
|
@@ -22967,15 +23732,15 @@ var importTools = {
|
|
|
22967
23732
|
};
|
|
22968
23733
|
|
|
22969
23734
|
// src/mcp/mcp.ts
|
|
22970
|
-
var
|
|
22971
|
-
var
|
|
23735
|
+
var import_node_path146 = require("path");
|
|
23736
|
+
var import_mini78 = require("zod/mini");
|
|
22972
23737
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
22973
23738
|
async function getMcpFile() {
|
|
22974
23739
|
try {
|
|
22975
23740
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
22976
23741
|
validate: true
|
|
22977
23742
|
});
|
|
22978
|
-
const relativePathFromCwd = (0,
|
|
23743
|
+
const relativePathFromCwd = (0, import_node_path146.join)(
|
|
22979
23744
|
rulesyncMcp.getRelativeDirPath(),
|
|
22980
23745
|
rulesyncMcp.getRelativeFilePath()
|
|
22981
23746
|
);
|
|
@@ -23013,7 +23778,7 @@ async function putMcpFile({ content }) {
|
|
|
23013
23778
|
const paths = RulesyncMcp.getSettablePaths();
|
|
23014
23779
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
23015
23780
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
23016
|
-
const fullPath = (0,
|
|
23781
|
+
const fullPath = (0, import_node_path146.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
23017
23782
|
const rulesyncMcp = new RulesyncMcp({
|
|
23018
23783
|
baseDir,
|
|
23019
23784
|
relativeDirPath,
|
|
@@ -23021,9 +23786,9 @@ async function putMcpFile({ content }) {
|
|
|
23021
23786
|
fileContent: content,
|
|
23022
23787
|
validate: true
|
|
23023
23788
|
});
|
|
23024
|
-
await ensureDir((0,
|
|
23789
|
+
await ensureDir((0, import_node_path146.join)(baseDir, relativeDirPath));
|
|
23025
23790
|
await writeFileContent(fullPath, content);
|
|
23026
|
-
const relativePathFromCwd = (0,
|
|
23791
|
+
const relativePathFromCwd = (0, import_node_path146.join)(relativeDirPath, relativeFilePath);
|
|
23027
23792
|
return {
|
|
23028
23793
|
relativePathFromCwd,
|
|
23029
23794
|
content: rulesyncMcp.getFileContent()
|
|
@@ -23041,15 +23806,15 @@ async function deleteMcpFile() {
|
|
|
23041
23806
|
try {
|
|
23042
23807
|
const baseDir = process.cwd();
|
|
23043
23808
|
const paths = RulesyncMcp.getSettablePaths();
|
|
23044
|
-
const recommendedPath = (0,
|
|
23809
|
+
const recommendedPath = (0, import_node_path146.join)(
|
|
23045
23810
|
baseDir,
|
|
23046
23811
|
paths.recommended.relativeDirPath,
|
|
23047
23812
|
paths.recommended.relativeFilePath
|
|
23048
23813
|
);
|
|
23049
|
-
const legacyPath = (0,
|
|
23814
|
+
const legacyPath = (0, import_node_path146.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
23050
23815
|
await removeFile(recommendedPath);
|
|
23051
23816
|
await removeFile(legacyPath);
|
|
23052
|
-
const relativePathFromCwd = (0,
|
|
23817
|
+
const relativePathFromCwd = (0, import_node_path146.join)(
|
|
23053
23818
|
paths.recommended.relativeDirPath,
|
|
23054
23819
|
paths.recommended.relativeFilePath
|
|
23055
23820
|
);
|
|
@@ -23066,11 +23831,11 @@ async function deleteMcpFile() {
|
|
|
23066
23831
|
}
|
|
23067
23832
|
}
|
|
23068
23833
|
var mcpToolSchemas = {
|
|
23069
|
-
getMcpFile:
|
|
23070
|
-
putMcpFile:
|
|
23071
|
-
content:
|
|
23834
|
+
getMcpFile: import_mini78.z.object({}),
|
|
23835
|
+
putMcpFile: import_mini78.z.object({
|
|
23836
|
+
content: import_mini78.z.string()
|
|
23072
23837
|
}),
|
|
23073
|
-
deleteMcpFile:
|
|
23838
|
+
deleteMcpFile: import_mini78.z.object({})
|
|
23074
23839
|
};
|
|
23075
23840
|
var mcpTools = {
|
|
23076
23841
|
getMcpFile: {
|
|
@@ -23103,13 +23868,13 @@ var mcpTools = {
|
|
|
23103
23868
|
};
|
|
23104
23869
|
|
|
23105
23870
|
// src/mcp/rules.ts
|
|
23106
|
-
var
|
|
23107
|
-
var
|
|
23871
|
+
var import_node_path147 = require("path");
|
|
23872
|
+
var import_mini79 = require("zod/mini");
|
|
23108
23873
|
var logger2 = new ConsoleLogger({ verbose: false, silent: true });
|
|
23109
23874
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
23110
23875
|
var maxRulesCount = 1e3;
|
|
23111
23876
|
async function listRules() {
|
|
23112
|
-
const rulesDir = (0,
|
|
23877
|
+
const rulesDir = (0, import_node_path147.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
23113
23878
|
try {
|
|
23114
23879
|
const files = await listDirectoryFiles(rulesDir);
|
|
23115
23880
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -23122,7 +23887,7 @@ async function listRules() {
|
|
|
23122
23887
|
});
|
|
23123
23888
|
const frontmatter = rule.getFrontmatter();
|
|
23124
23889
|
return {
|
|
23125
|
-
relativePathFromCwd: (0,
|
|
23890
|
+
relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
23126
23891
|
frontmatter
|
|
23127
23892
|
};
|
|
23128
23893
|
} catch (error) {
|
|
@@ -23144,14 +23909,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
23144
23909
|
relativePath: relativePathFromCwd,
|
|
23145
23910
|
intendedRootDir: process.cwd()
|
|
23146
23911
|
});
|
|
23147
|
-
const filename = (0,
|
|
23912
|
+
const filename = (0, import_node_path147.basename)(relativePathFromCwd);
|
|
23148
23913
|
try {
|
|
23149
23914
|
const rule = await RulesyncRule.fromFile({
|
|
23150
23915
|
relativeFilePath: filename,
|
|
23151
23916
|
validate: true
|
|
23152
23917
|
});
|
|
23153
23918
|
return {
|
|
23154
|
-
relativePathFromCwd: (0,
|
|
23919
|
+
relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
23155
23920
|
frontmatter: rule.getFrontmatter(),
|
|
23156
23921
|
body: rule.getBody()
|
|
23157
23922
|
};
|
|
@@ -23170,7 +23935,7 @@ async function putRule({
|
|
|
23170
23935
|
relativePath: relativePathFromCwd,
|
|
23171
23936
|
intendedRootDir: process.cwd()
|
|
23172
23937
|
});
|
|
23173
|
-
const filename = (0,
|
|
23938
|
+
const filename = (0, import_node_path147.basename)(relativePathFromCwd);
|
|
23174
23939
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
23175
23940
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
23176
23941
|
throw new Error(
|
|
@@ -23180,7 +23945,7 @@ async function putRule({
|
|
|
23180
23945
|
try {
|
|
23181
23946
|
const existingRules = await listRules();
|
|
23182
23947
|
const isUpdate = existingRules.some(
|
|
23183
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
23948
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
23184
23949
|
);
|
|
23185
23950
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
23186
23951
|
throw new Error(
|
|
@@ -23195,11 +23960,11 @@ async function putRule({
|
|
|
23195
23960
|
body,
|
|
23196
23961
|
validate: true
|
|
23197
23962
|
});
|
|
23198
|
-
const rulesDir = (0,
|
|
23963
|
+
const rulesDir = (0, import_node_path147.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
23199
23964
|
await ensureDir(rulesDir);
|
|
23200
23965
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
23201
23966
|
return {
|
|
23202
|
-
relativePathFromCwd: (0,
|
|
23967
|
+
relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
23203
23968
|
frontmatter: rule.getFrontmatter(),
|
|
23204
23969
|
body: rule.getBody()
|
|
23205
23970
|
};
|
|
@@ -23214,12 +23979,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
23214
23979
|
relativePath: relativePathFromCwd,
|
|
23215
23980
|
intendedRootDir: process.cwd()
|
|
23216
23981
|
});
|
|
23217
|
-
const filename = (0,
|
|
23218
|
-
const fullPath = (0,
|
|
23982
|
+
const filename = (0, import_node_path147.basename)(relativePathFromCwd);
|
|
23983
|
+
const fullPath = (0, import_node_path147.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
23219
23984
|
try {
|
|
23220
23985
|
await removeFile(fullPath);
|
|
23221
23986
|
return {
|
|
23222
|
-
relativePathFromCwd: (0,
|
|
23987
|
+
relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
23223
23988
|
};
|
|
23224
23989
|
} catch (error) {
|
|
23225
23990
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -23228,23 +23993,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
23228
23993
|
}
|
|
23229
23994
|
}
|
|
23230
23995
|
var ruleToolSchemas = {
|
|
23231
|
-
listRules:
|
|
23232
|
-
getRule:
|
|
23233
|
-
relativePathFromCwd:
|
|
23996
|
+
listRules: import_mini79.z.object({}),
|
|
23997
|
+
getRule: import_mini79.z.object({
|
|
23998
|
+
relativePathFromCwd: import_mini79.z.string()
|
|
23234
23999
|
}),
|
|
23235
|
-
putRule:
|
|
23236
|
-
relativePathFromCwd:
|
|
24000
|
+
putRule: import_mini79.z.object({
|
|
24001
|
+
relativePathFromCwd: import_mini79.z.string(),
|
|
23237
24002
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
23238
|
-
body:
|
|
24003
|
+
body: import_mini79.z.string()
|
|
23239
24004
|
}),
|
|
23240
|
-
deleteRule:
|
|
23241
|
-
relativePathFromCwd:
|
|
24005
|
+
deleteRule: import_mini79.z.object({
|
|
24006
|
+
relativePathFromCwd: import_mini79.z.string()
|
|
23242
24007
|
})
|
|
23243
24008
|
};
|
|
23244
24009
|
var ruleTools = {
|
|
23245
24010
|
listRules: {
|
|
23246
24011
|
name: "listRules",
|
|
23247
|
-
description: `List all rules from ${(0,
|
|
24012
|
+
description: `List all rules from ${(0, import_node_path147.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
23248
24013
|
parameters: ruleToolSchemas.listRules,
|
|
23249
24014
|
execute: async () => {
|
|
23250
24015
|
const rules = await listRules();
|
|
@@ -23286,8 +24051,8 @@ var ruleTools = {
|
|
|
23286
24051
|
};
|
|
23287
24052
|
|
|
23288
24053
|
// src/mcp/skills.ts
|
|
23289
|
-
var
|
|
23290
|
-
var
|
|
24054
|
+
var import_node_path148 = require("path");
|
|
24055
|
+
var import_mini80 = require("zod/mini");
|
|
23291
24056
|
var logger3 = new ConsoleLogger({ verbose: false, silent: true });
|
|
23292
24057
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
23293
24058
|
var maxSkillsCount = 1e3;
|
|
@@ -23304,19 +24069,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
23304
24069
|
};
|
|
23305
24070
|
}
|
|
23306
24071
|
function extractDirName(relativeDirPathFromCwd) {
|
|
23307
|
-
const dirName = (0,
|
|
24072
|
+
const dirName = (0, import_node_path148.basename)(relativeDirPathFromCwd);
|
|
23308
24073
|
if (!dirName) {
|
|
23309
24074
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
23310
24075
|
}
|
|
23311
24076
|
return dirName;
|
|
23312
24077
|
}
|
|
23313
24078
|
async function listSkills() {
|
|
23314
|
-
const skillsDir = (0,
|
|
24079
|
+
const skillsDir = (0, import_node_path148.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
23315
24080
|
try {
|
|
23316
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
24081
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path148.join)(skillsDir, "*"), { type: "dir" });
|
|
23317
24082
|
const skills = await Promise.all(
|
|
23318
24083
|
skillDirPaths.map(async (dirPath) => {
|
|
23319
|
-
const dirName = (0,
|
|
24084
|
+
const dirName = (0, import_node_path148.basename)(dirPath);
|
|
23320
24085
|
if (!dirName) return null;
|
|
23321
24086
|
try {
|
|
23322
24087
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -23324,7 +24089,7 @@ async function listSkills() {
|
|
|
23324
24089
|
});
|
|
23325
24090
|
const frontmatter = skill.getFrontmatter();
|
|
23326
24091
|
return {
|
|
23327
|
-
relativeDirPathFromCwd: (0,
|
|
24092
|
+
relativeDirPathFromCwd: (0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
23328
24093
|
frontmatter
|
|
23329
24094
|
};
|
|
23330
24095
|
} catch (error) {
|
|
@@ -23352,7 +24117,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
23352
24117
|
dirName
|
|
23353
24118
|
});
|
|
23354
24119
|
return {
|
|
23355
|
-
relativeDirPathFromCwd: (0,
|
|
24120
|
+
relativeDirPathFromCwd: (0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
23356
24121
|
frontmatter: skill.getFrontmatter(),
|
|
23357
24122
|
body: skill.getBody(),
|
|
23358
24123
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -23386,7 +24151,7 @@ async function putSkill({
|
|
|
23386
24151
|
try {
|
|
23387
24152
|
const existingSkills = await listSkills();
|
|
23388
24153
|
const isUpdate = existingSkills.some(
|
|
23389
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
24154
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
23390
24155
|
);
|
|
23391
24156
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
23392
24157
|
throw new Error(
|
|
@@ -23403,9 +24168,9 @@ async function putSkill({
|
|
|
23403
24168
|
otherFiles: aiDirFiles,
|
|
23404
24169
|
validate: true
|
|
23405
24170
|
});
|
|
23406
|
-
const skillDirPath = (0,
|
|
24171
|
+
const skillDirPath = (0, import_node_path148.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
23407
24172
|
await ensureDir(skillDirPath);
|
|
23408
|
-
const skillFilePath = (0,
|
|
24173
|
+
const skillFilePath = (0, import_node_path148.join)(skillDirPath, SKILL_FILE_NAME);
|
|
23409
24174
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
23410
24175
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
23411
24176
|
for (const file of otherFiles) {
|
|
@@ -23413,15 +24178,15 @@ async function putSkill({
|
|
|
23413
24178
|
relativePath: file.name,
|
|
23414
24179
|
intendedRootDir: skillDirPath
|
|
23415
24180
|
});
|
|
23416
|
-
const filePath = (0,
|
|
23417
|
-
const fileDir = (0,
|
|
24181
|
+
const filePath = (0, import_node_path148.join)(skillDirPath, file.name);
|
|
24182
|
+
const fileDir = (0, import_node_path148.join)(skillDirPath, (0, import_node_path148.dirname)(file.name));
|
|
23418
24183
|
if (fileDir !== skillDirPath) {
|
|
23419
24184
|
await ensureDir(fileDir);
|
|
23420
24185
|
}
|
|
23421
24186
|
await writeFileContent(filePath, file.body);
|
|
23422
24187
|
}
|
|
23423
24188
|
return {
|
|
23424
|
-
relativeDirPathFromCwd: (0,
|
|
24189
|
+
relativeDirPathFromCwd: (0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
23425
24190
|
frontmatter: skill.getFrontmatter(),
|
|
23426
24191
|
body: skill.getBody(),
|
|
23427
24192
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -23443,13 +24208,13 @@ async function deleteSkill({
|
|
|
23443
24208
|
intendedRootDir: process.cwd()
|
|
23444
24209
|
});
|
|
23445
24210
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
23446
|
-
const skillDirPath = (0,
|
|
24211
|
+
const skillDirPath = (0, import_node_path148.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
23447
24212
|
try {
|
|
23448
24213
|
if (await directoryExists(skillDirPath)) {
|
|
23449
24214
|
await removeDirectory(skillDirPath);
|
|
23450
24215
|
}
|
|
23451
24216
|
return {
|
|
23452
|
-
relativeDirPathFromCwd: (0,
|
|
24217
|
+
relativeDirPathFromCwd: (0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
23453
24218
|
};
|
|
23454
24219
|
} catch (error) {
|
|
23455
24220
|
throw new Error(
|
|
@@ -23460,29 +24225,29 @@ async function deleteSkill({
|
|
|
23460
24225
|
);
|
|
23461
24226
|
}
|
|
23462
24227
|
}
|
|
23463
|
-
var McpSkillFileSchema =
|
|
23464
|
-
name:
|
|
23465
|
-
body:
|
|
24228
|
+
var McpSkillFileSchema = import_mini80.z.object({
|
|
24229
|
+
name: import_mini80.z.string(),
|
|
24230
|
+
body: import_mini80.z.string()
|
|
23466
24231
|
});
|
|
23467
24232
|
var skillToolSchemas = {
|
|
23468
|
-
listSkills:
|
|
23469
|
-
getSkill:
|
|
23470
|
-
relativeDirPathFromCwd:
|
|
24233
|
+
listSkills: import_mini80.z.object({}),
|
|
24234
|
+
getSkill: import_mini80.z.object({
|
|
24235
|
+
relativeDirPathFromCwd: import_mini80.z.string()
|
|
23471
24236
|
}),
|
|
23472
|
-
putSkill:
|
|
23473
|
-
relativeDirPathFromCwd:
|
|
24237
|
+
putSkill: import_mini80.z.object({
|
|
24238
|
+
relativeDirPathFromCwd: import_mini80.z.string(),
|
|
23474
24239
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
23475
|
-
body:
|
|
23476
|
-
otherFiles:
|
|
24240
|
+
body: import_mini80.z.string(),
|
|
24241
|
+
otherFiles: import_mini80.z.optional(import_mini80.z.array(McpSkillFileSchema))
|
|
23477
24242
|
}),
|
|
23478
|
-
deleteSkill:
|
|
23479
|
-
relativeDirPathFromCwd:
|
|
24243
|
+
deleteSkill: import_mini80.z.object({
|
|
24244
|
+
relativeDirPathFromCwd: import_mini80.z.string()
|
|
23480
24245
|
})
|
|
23481
24246
|
};
|
|
23482
24247
|
var skillTools = {
|
|
23483
24248
|
listSkills: {
|
|
23484
24249
|
name: "listSkills",
|
|
23485
|
-
description: `List all skills from ${(0,
|
|
24250
|
+
description: `List all skills from ${(0, import_node_path148.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
23486
24251
|
parameters: skillToolSchemas.listSkills,
|
|
23487
24252
|
execute: async () => {
|
|
23488
24253
|
const skills = await listSkills();
|
|
@@ -23525,13 +24290,13 @@ var skillTools = {
|
|
|
23525
24290
|
};
|
|
23526
24291
|
|
|
23527
24292
|
// src/mcp/subagents.ts
|
|
23528
|
-
var
|
|
23529
|
-
var
|
|
24293
|
+
var import_node_path149 = require("path");
|
|
24294
|
+
var import_mini81 = require("zod/mini");
|
|
23530
24295
|
var logger4 = new ConsoleLogger({ verbose: false, silent: true });
|
|
23531
24296
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
23532
24297
|
var maxSubagentsCount = 1e3;
|
|
23533
24298
|
async function listSubagents() {
|
|
23534
|
-
const subagentsDir = (0,
|
|
24299
|
+
const subagentsDir = (0, import_node_path149.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
23535
24300
|
try {
|
|
23536
24301
|
const files = await listDirectoryFiles(subagentsDir);
|
|
23537
24302
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -23544,7 +24309,7 @@ async function listSubagents() {
|
|
|
23544
24309
|
});
|
|
23545
24310
|
const frontmatter = subagent.getFrontmatter();
|
|
23546
24311
|
return {
|
|
23547
|
-
relativePathFromCwd: (0,
|
|
24312
|
+
relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
23548
24313
|
frontmatter
|
|
23549
24314
|
};
|
|
23550
24315
|
} catch (error) {
|
|
@@ -23568,14 +24333,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
23568
24333
|
relativePath: relativePathFromCwd,
|
|
23569
24334
|
intendedRootDir: process.cwd()
|
|
23570
24335
|
});
|
|
23571
|
-
const filename = (0,
|
|
24336
|
+
const filename = (0, import_node_path149.basename)(relativePathFromCwd);
|
|
23572
24337
|
try {
|
|
23573
24338
|
const subagent = await RulesyncSubagent.fromFile({
|
|
23574
24339
|
relativeFilePath: filename,
|
|
23575
24340
|
validate: true
|
|
23576
24341
|
});
|
|
23577
24342
|
return {
|
|
23578
|
-
relativePathFromCwd: (0,
|
|
24343
|
+
relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
23579
24344
|
frontmatter: subagent.getFrontmatter(),
|
|
23580
24345
|
body: subagent.getBody()
|
|
23581
24346
|
};
|
|
@@ -23594,7 +24359,7 @@ async function putSubagent({
|
|
|
23594
24359
|
relativePath: relativePathFromCwd,
|
|
23595
24360
|
intendedRootDir: process.cwd()
|
|
23596
24361
|
});
|
|
23597
|
-
const filename = (0,
|
|
24362
|
+
const filename = (0, import_node_path149.basename)(relativePathFromCwd);
|
|
23598
24363
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
23599
24364
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
23600
24365
|
throw new Error(
|
|
@@ -23604,7 +24369,7 @@ async function putSubagent({
|
|
|
23604
24369
|
try {
|
|
23605
24370
|
const existingSubagents = await listSubagents();
|
|
23606
24371
|
const isUpdate = existingSubagents.some(
|
|
23607
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
24372
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
23608
24373
|
);
|
|
23609
24374
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
23610
24375
|
throw new Error(
|
|
@@ -23619,11 +24384,11 @@ async function putSubagent({
|
|
|
23619
24384
|
body,
|
|
23620
24385
|
validate: true
|
|
23621
24386
|
});
|
|
23622
|
-
const subagentsDir = (0,
|
|
24387
|
+
const subagentsDir = (0, import_node_path149.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
23623
24388
|
await ensureDir(subagentsDir);
|
|
23624
24389
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
23625
24390
|
return {
|
|
23626
|
-
relativePathFromCwd: (0,
|
|
24391
|
+
relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
23627
24392
|
frontmatter: subagent.getFrontmatter(),
|
|
23628
24393
|
body: subagent.getBody()
|
|
23629
24394
|
};
|
|
@@ -23638,12 +24403,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
23638
24403
|
relativePath: relativePathFromCwd,
|
|
23639
24404
|
intendedRootDir: process.cwd()
|
|
23640
24405
|
});
|
|
23641
|
-
const filename = (0,
|
|
23642
|
-
const fullPath = (0,
|
|
24406
|
+
const filename = (0, import_node_path149.basename)(relativePathFromCwd);
|
|
24407
|
+
const fullPath = (0, import_node_path149.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
23643
24408
|
try {
|
|
23644
24409
|
await removeFile(fullPath);
|
|
23645
24410
|
return {
|
|
23646
|
-
relativePathFromCwd: (0,
|
|
24411
|
+
relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
23647
24412
|
};
|
|
23648
24413
|
} catch (error) {
|
|
23649
24414
|
throw new Error(
|
|
@@ -23655,23 +24420,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
23655
24420
|
}
|
|
23656
24421
|
}
|
|
23657
24422
|
var subagentToolSchemas = {
|
|
23658
|
-
listSubagents:
|
|
23659
|
-
getSubagent:
|
|
23660
|
-
relativePathFromCwd:
|
|
24423
|
+
listSubagents: import_mini81.z.object({}),
|
|
24424
|
+
getSubagent: import_mini81.z.object({
|
|
24425
|
+
relativePathFromCwd: import_mini81.z.string()
|
|
23661
24426
|
}),
|
|
23662
|
-
putSubagent:
|
|
23663
|
-
relativePathFromCwd:
|
|
24427
|
+
putSubagent: import_mini81.z.object({
|
|
24428
|
+
relativePathFromCwd: import_mini81.z.string(),
|
|
23664
24429
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
23665
|
-
body:
|
|
24430
|
+
body: import_mini81.z.string()
|
|
23666
24431
|
}),
|
|
23667
|
-
deleteSubagent:
|
|
23668
|
-
relativePathFromCwd:
|
|
24432
|
+
deleteSubagent: import_mini81.z.object({
|
|
24433
|
+
relativePathFromCwd: import_mini81.z.string()
|
|
23669
24434
|
})
|
|
23670
24435
|
};
|
|
23671
24436
|
var subagentTools = {
|
|
23672
24437
|
listSubagents: {
|
|
23673
24438
|
name: "listSubagents",
|
|
23674
|
-
description: `List all subagents from ${(0,
|
|
24439
|
+
description: `List all subagents from ${(0, import_node_path149.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
23675
24440
|
parameters: subagentToolSchemas.listSubagents,
|
|
23676
24441
|
execute: async () => {
|
|
23677
24442
|
const subagents = await listSubagents();
|
|
@@ -23713,7 +24478,7 @@ var subagentTools = {
|
|
|
23713
24478
|
};
|
|
23714
24479
|
|
|
23715
24480
|
// src/mcp/tools.ts
|
|
23716
|
-
var rulesyncFeatureSchema =
|
|
24481
|
+
var rulesyncFeatureSchema = import_mini82.z.enum([
|
|
23717
24482
|
"rule",
|
|
23718
24483
|
"command",
|
|
23719
24484
|
"subagent",
|
|
@@ -23723,21 +24488,21 @@ var rulesyncFeatureSchema = import_mini78.z.enum([
|
|
|
23723
24488
|
"generate",
|
|
23724
24489
|
"import"
|
|
23725
24490
|
]);
|
|
23726
|
-
var rulesyncOperationSchema =
|
|
23727
|
-
var skillFileSchema =
|
|
23728
|
-
name:
|
|
23729
|
-
body:
|
|
24491
|
+
var rulesyncOperationSchema = import_mini82.z.enum(["list", "get", "put", "delete", "run"]);
|
|
24492
|
+
var skillFileSchema = import_mini82.z.object({
|
|
24493
|
+
name: import_mini82.z.string(),
|
|
24494
|
+
body: import_mini82.z.string()
|
|
23730
24495
|
});
|
|
23731
|
-
var rulesyncToolSchema =
|
|
24496
|
+
var rulesyncToolSchema = import_mini82.z.object({
|
|
23732
24497
|
feature: rulesyncFeatureSchema,
|
|
23733
24498
|
operation: rulesyncOperationSchema,
|
|
23734
|
-
targetPathFromCwd:
|
|
23735
|
-
frontmatter:
|
|
23736
|
-
body:
|
|
23737
|
-
otherFiles:
|
|
23738
|
-
content:
|
|
23739
|
-
generateOptions:
|
|
23740
|
-
importOptions:
|
|
24499
|
+
targetPathFromCwd: import_mini82.z.optional(import_mini82.z.string()),
|
|
24500
|
+
frontmatter: import_mini82.z.optional(import_mini82.z.unknown()),
|
|
24501
|
+
body: import_mini82.z.optional(import_mini82.z.string()),
|
|
24502
|
+
otherFiles: import_mini82.z.optional(import_mini82.z.array(skillFileSchema)),
|
|
24503
|
+
content: import_mini82.z.optional(import_mini82.z.string()),
|
|
24504
|
+
generateOptions: import_mini82.z.optional(generateOptionsSchema),
|
|
24505
|
+
importOptions: import_mini82.z.optional(importOptionsSchema)
|
|
23741
24506
|
});
|
|
23742
24507
|
var supportedOperationsByFeature = {
|
|
23743
24508
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -24345,7 +25110,7 @@ function wrapCommand({
|
|
|
24345
25110
|
}
|
|
24346
25111
|
|
|
24347
25112
|
// src/cli/index.ts
|
|
24348
|
-
var getVersion = () => "7.
|
|
25113
|
+
var getVersion = () => "7.30.0";
|
|
24349
25114
|
function wrapCommand2(name, errorCode, handler) {
|
|
24350
25115
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
24351
25116
|
}
|