rulesync 7.13.0 → 7.15.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 +5 -5
- package/dist/{chunk-JGRHJWG5.js → chunk-L5AQUWUM.js} +871 -434
- package/dist/cli/index.cjs +1451 -715
- package/dist/cli/index.js +380 -77
- package/dist/index.cjs +1044 -627
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -69,7 +69,9 @@ function formatError(error) {
|
|
|
69
69
|
var import_consola = require("consola");
|
|
70
70
|
|
|
71
71
|
// src/utils/vitest.ts
|
|
72
|
-
|
|
72
|
+
function isEnvTest() {
|
|
73
|
+
return process.env.NODE_ENV === "test";
|
|
74
|
+
}
|
|
73
75
|
|
|
74
76
|
// src/utils/logger.ts
|
|
75
77
|
var Logger = class {
|
|
@@ -99,27 +101,27 @@ var Logger = class {
|
|
|
99
101
|
return this._silent;
|
|
100
102
|
}
|
|
101
103
|
info(message, ...args) {
|
|
102
|
-
if (isEnvTest || this._silent) return;
|
|
104
|
+
if (isEnvTest() || this._silent) return;
|
|
103
105
|
this.console.info(message, ...args);
|
|
104
106
|
}
|
|
105
107
|
// Success (always shown unless silent)
|
|
106
108
|
success(message, ...args) {
|
|
107
|
-
if (isEnvTest || this._silent) return;
|
|
109
|
+
if (isEnvTest() || this._silent) return;
|
|
108
110
|
this.console.success(message, ...args);
|
|
109
111
|
}
|
|
110
112
|
// Warning (always shown unless silent)
|
|
111
113
|
warn(message, ...args) {
|
|
112
|
-
if (isEnvTest || this._silent) return;
|
|
114
|
+
if (isEnvTest() || this._silent) return;
|
|
113
115
|
this.console.warn(message, ...args);
|
|
114
116
|
}
|
|
115
117
|
// Error (always shown, even in silent mode)
|
|
116
118
|
error(message, ...args) {
|
|
117
|
-
if (isEnvTest) return;
|
|
119
|
+
if (isEnvTest()) return;
|
|
118
120
|
this.console.error(message, ...args);
|
|
119
121
|
}
|
|
120
122
|
// Debug level (shown only in verbose mode)
|
|
121
123
|
debug(message, ...args) {
|
|
122
|
-
if (isEnvTest || this._silent) return;
|
|
124
|
+
if (isEnvTest() || this._silent) return;
|
|
123
125
|
if (this._verbose) {
|
|
124
126
|
this.console.info(message, ...args);
|
|
125
127
|
}
|
|
@@ -128,7 +130,7 @@ var Logger = class {
|
|
|
128
130
|
var logger = new Logger();
|
|
129
131
|
|
|
130
132
|
// src/lib/fetch.ts
|
|
131
|
-
var
|
|
133
|
+
var import_node_path116 = require("path");
|
|
132
134
|
var import_promise = require("es-toolkit/promise");
|
|
133
135
|
|
|
134
136
|
// src/constants/rulesync-paths.ts
|
|
@@ -242,6 +244,24 @@ async function fileExists(filepath) {
|
|
|
242
244
|
return false;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
247
|
+
async function getFileSize(filepath) {
|
|
248
|
+
try {
|
|
249
|
+
const stats = await (0, import_promises.stat)(filepath);
|
|
250
|
+
return stats.size;
|
|
251
|
+
} catch (error) {
|
|
252
|
+
throw new Error(`Failed to get file size for "${filepath}": ${formatError(error)}`, {
|
|
253
|
+
cause: error
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function isSymlink(filepath) {
|
|
258
|
+
try {
|
|
259
|
+
const stats = await (0, import_promises.lstat)(filepath);
|
|
260
|
+
return stats.isSymbolicLink();
|
|
261
|
+
} catch {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
245
265
|
async function listDirectoryFiles(dir) {
|
|
246
266
|
try {
|
|
247
267
|
return await (0, import_promises.readdir)(dir);
|
|
@@ -285,8 +305,14 @@ async function removeFile(filepath) {
|
|
|
285
305
|
}
|
|
286
306
|
}
|
|
287
307
|
function getHomeDirectory() {
|
|
288
|
-
|
|
289
|
-
|
|
308
|
+
const homeDirFromEnv = process.env.HOME_DIR;
|
|
309
|
+
if (homeDirFromEnv) {
|
|
310
|
+
return homeDirFromEnv;
|
|
311
|
+
}
|
|
312
|
+
if (isEnvTest()) {
|
|
313
|
+
throw new Error(
|
|
314
|
+
"getHomeDirectory() must be mocked in test environment, or set HOME_DIR environment variable"
|
|
315
|
+
);
|
|
290
316
|
}
|
|
291
317
|
return import_node_os.default.homedir();
|
|
292
318
|
}
|
|
@@ -7137,9 +7163,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7137
7163
|
};
|
|
7138
7164
|
|
|
7139
7165
|
// src/features/rules/rules-processor.ts
|
|
7140
|
-
var
|
|
7166
|
+
var import_node_path115 = require("path");
|
|
7141
7167
|
var import_toon = require("@toon-format/toon");
|
|
7142
|
-
var
|
|
7168
|
+
var import_mini55 = require("zod/mini");
|
|
7143
7169
|
|
|
7144
7170
|
// src/constants/general.ts
|
|
7145
7171
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -7446,6 +7472,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7446
7472
|
}
|
|
7447
7473
|
}
|
|
7448
7474
|
static fromRulesyncSkillDefault({
|
|
7475
|
+
baseDir = process.cwd(),
|
|
7449
7476
|
rulesyncSkill,
|
|
7450
7477
|
validate = true
|
|
7451
7478
|
}) {
|
|
@@ -7455,7 +7482,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7455
7482
|
description: rulesyncFrontmatter.description
|
|
7456
7483
|
};
|
|
7457
7484
|
return {
|
|
7458
|
-
baseDir
|
|
7485
|
+
baseDir,
|
|
7459
7486
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7460
7487
|
dirName: rulesyncSkill.getDirName(),
|
|
7461
7488
|
frontmatter: simulatedFrontmatter,
|
|
@@ -7607,8 +7634,8 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7607
7634
|
};
|
|
7608
7635
|
|
|
7609
7636
|
// src/features/skills/skills-processor.ts
|
|
7610
|
-
var
|
|
7611
|
-
var
|
|
7637
|
+
var import_node_path76 = require("path");
|
|
7638
|
+
var import_mini38 = require("zod/mini");
|
|
7612
7639
|
|
|
7613
7640
|
// src/types/dir-feature-processor.ts
|
|
7614
7641
|
var import_node_path59 = require("path");
|
|
@@ -7941,6 +7968,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7941
7968
|
});
|
|
7942
7969
|
}
|
|
7943
7970
|
static fromRulesyncSkill({
|
|
7971
|
+
baseDir = process.cwd(),
|
|
7944
7972
|
rulesyncSkill,
|
|
7945
7973
|
validate = true,
|
|
7946
7974
|
global = false
|
|
@@ -7952,7 +7980,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7952
7980
|
description: rulesyncFrontmatter.description
|
|
7953
7981
|
};
|
|
7954
7982
|
return new _AgentsSkillsSkill({
|
|
7955
|
-
baseDir
|
|
7983
|
+
baseDir,
|
|
7956
7984
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
7957
7985
|
dirName: rulesyncSkill.getDirName(),
|
|
7958
7986
|
frontmatter: agentsSkillsFrontmatter,
|
|
@@ -8102,6 +8130,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8102
8130
|
});
|
|
8103
8131
|
}
|
|
8104
8132
|
static fromRulesyncSkill({
|
|
8133
|
+
baseDir = process.cwd(),
|
|
8105
8134
|
rulesyncSkill,
|
|
8106
8135
|
validate = true,
|
|
8107
8136
|
global = false
|
|
@@ -8113,7 +8142,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8113
8142
|
};
|
|
8114
8143
|
const settablePaths = _AntigravitySkill.getSettablePaths({ global });
|
|
8115
8144
|
return new _AntigravitySkill({
|
|
8116
|
-
baseDir
|
|
8145
|
+
baseDir,
|
|
8117
8146
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8118
8147
|
dirName: rulesyncSkill.getDirName(),
|
|
8119
8148
|
frontmatter: antigravityFrontmatter,
|
|
@@ -8268,6 +8297,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8268
8297
|
});
|
|
8269
8298
|
}
|
|
8270
8299
|
static fromRulesyncSkill({
|
|
8300
|
+
baseDir = process.cwd(),
|
|
8271
8301
|
rulesyncSkill,
|
|
8272
8302
|
validate = true,
|
|
8273
8303
|
global = false
|
|
@@ -8288,7 +8318,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8288
8318
|
};
|
|
8289
8319
|
const settablePaths = _ClaudecodeSkill.getSettablePaths({ global });
|
|
8290
8320
|
return new _ClaudecodeSkill({
|
|
8291
|
-
baseDir
|
|
8321
|
+
baseDir,
|
|
8292
8322
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8293
8323
|
dirName: rulesyncSkill.getDirName(),
|
|
8294
8324
|
frontmatter: claudecodeFrontmatter,
|
|
@@ -8438,6 +8468,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8438
8468
|
});
|
|
8439
8469
|
}
|
|
8440
8470
|
static fromRulesyncSkill({
|
|
8471
|
+
baseDir = process.cwd(),
|
|
8441
8472
|
rulesyncSkill,
|
|
8442
8473
|
validate = true,
|
|
8443
8474
|
global = false
|
|
@@ -8449,7 +8480,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8449
8480
|
description: rulesyncFrontmatter.description
|
|
8450
8481
|
};
|
|
8451
8482
|
return new _ClineSkill({
|
|
8452
|
-
baseDir
|
|
8483
|
+
baseDir,
|
|
8453
8484
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8454
8485
|
dirName: clineFrontmatter.name,
|
|
8455
8486
|
frontmatter: clineFrontmatter,
|
|
@@ -8614,6 +8645,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8614
8645
|
});
|
|
8615
8646
|
}
|
|
8616
8647
|
static fromRulesyncSkill({
|
|
8648
|
+
baseDir = process.cwd(),
|
|
8617
8649
|
rulesyncSkill,
|
|
8618
8650
|
validate = true,
|
|
8619
8651
|
global = false
|
|
@@ -8630,7 +8662,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8630
8662
|
}
|
|
8631
8663
|
};
|
|
8632
8664
|
return new _CodexCliSkill({
|
|
8633
|
-
baseDir
|
|
8665
|
+
baseDir,
|
|
8634
8666
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8635
8667
|
dirName: rulesyncSkill.getDirName(),
|
|
8636
8668
|
frontmatter: codexFrontmatter,
|
|
@@ -8781,6 +8813,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8781
8813
|
});
|
|
8782
8814
|
}
|
|
8783
8815
|
static fromRulesyncSkill({
|
|
8816
|
+
baseDir = process.cwd(),
|
|
8784
8817
|
rulesyncSkill,
|
|
8785
8818
|
validate = true,
|
|
8786
8819
|
global = false
|
|
@@ -8793,7 +8826,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8793
8826
|
license: rulesyncFrontmatter.copilot?.license
|
|
8794
8827
|
};
|
|
8795
8828
|
return new _CopilotSkill({
|
|
8796
|
-
baseDir
|
|
8829
|
+
baseDir,
|
|
8797
8830
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8798
8831
|
dirName: rulesyncSkill.getDirName(),
|
|
8799
8832
|
frontmatter: copilotFrontmatter,
|
|
@@ -8936,6 +8969,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8936
8969
|
});
|
|
8937
8970
|
}
|
|
8938
8971
|
static fromRulesyncSkill({
|
|
8972
|
+
baseDir = process.cwd(),
|
|
8939
8973
|
rulesyncSkill,
|
|
8940
8974
|
validate = true,
|
|
8941
8975
|
global = false
|
|
@@ -8947,7 +8981,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8947
8981
|
description: rulesyncFrontmatter.description
|
|
8948
8982
|
};
|
|
8949
8983
|
return new _CursorSkill({
|
|
8950
|
-
baseDir
|
|
8984
|
+
baseDir,
|
|
8951
8985
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
8952
8986
|
dirName: rulesyncSkill.getDirName(),
|
|
8953
8987
|
frontmatter: cursorFrontmatter,
|
|
@@ -9092,6 +9126,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9092
9126
|
});
|
|
9093
9127
|
}
|
|
9094
9128
|
static fromRulesyncSkill({
|
|
9129
|
+
baseDir = process.cwd(),
|
|
9095
9130
|
rulesyncSkill,
|
|
9096
9131
|
validate = true,
|
|
9097
9132
|
global = false
|
|
@@ -9103,7 +9138,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9103
9138
|
description: rulesyncFrontmatter.description
|
|
9104
9139
|
};
|
|
9105
9140
|
return new _GeminiCliSkill({
|
|
9106
|
-
baseDir
|
|
9141
|
+
baseDir,
|
|
9107
9142
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9108
9143
|
dirName: rulesyncSkill.getDirName(),
|
|
9109
9144
|
frontmatter: geminiCliFrontmatter,
|
|
@@ -9160,17 +9195,17 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9160
9195
|
}
|
|
9161
9196
|
};
|
|
9162
9197
|
|
|
9163
|
-
// src/features/skills/
|
|
9198
|
+
// src/features/skills/junie-skill.ts
|
|
9164
9199
|
var import_node_path69 = require("path");
|
|
9165
9200
|
var import_mini32 = require("zod/mini");
|
|
9166
|
-
var
|
|
9201
|
+
var JunieSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9167
9202
|
name: import_mini32.z.string(),
|
|
9168
9203
|
description: import_mini32.z.string()
|
|
9169
9204
|
});
|
|
9170
|
-
var
|
|
9205
|
+
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9171
9206
|
constructor({
|
|
9172
9207
|
baseDir = process.cwd(),
|
|
9173
|
-
relativeDirPath = (0, import_node_path69.join)(".
|
|
9208
|
+
relativeDirPath = (0, import_node_path69.join)(".junie", "skills"),
|
|
9174
9209
|
dirName,
|
|
9175
9210
|
frontmatter,
|
|
9176
9211
|
body,
|
|
@@ -9197,15 +9232,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9197
9232
|
}
|
|
9198
9233
|
}
|
|
9199
9234
|
}
|
|
9200
|
-
static getSettablePaths({
|
|
9201
|
-
global
|
|
9202
|
-
|
|
9235
|
+
static getSettablePaths(options) {
|
|
9236
|
+
if (options?.global) {
|
|
9237
|
+
throw new Error("JunieSkill does not support global mode.");
|
|
9238
|
+
}
|
|
9203
9239
|
return {
|
|
9204
|
-
relativeDirPath: (0, import_node_path69.join)(".
|
|
9240
|
+
relativeDirPath: (0, import_node_path69.join)(".junie", "skills")
|
|
9205
9241
|
};
|
|
9206
9242
|
}
|
|
9207
9243
|
getFrontmatter() {
|
|
9208
|
-
const result =
|
|
9244
|
+
const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9209
9245
|
return result;
|
|
9210
9246
|
}
|
|
9211
9247
|
getBody() {
|
|
@@ -9218,7 +9254,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9218
9254
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9219
9255
|
};
|
|
9220
9256
|
}
|
|
9221
|
-
const result =
|
|
9257
|
+
const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9222
9258
|
if (!result.success) {
|
|
9223
9259
|
return {
|
|
9224
9260
|
success: false,
|
|
@@ -9260,17 +9296,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9260
9296
|
validate = true,
|
|
9261
9297
|
global = false
|
|
9262
9298
|
}) {
|
|
9263
|
-
const settablePaths =
|
|
9299
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9264
9300
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9265
|
-
const
|
|
9301
|
+
const junieFrontmatter = {
|
|
9266
9302
|
name: rulesyncFrontmatter.name,
|
|
9267
9303
|
description: rulesyncFrontmatter.description
|
|
9268
9304
|
};
|
|
9269
|
-
return new
|
|
9305
|
+
return new _JunieSkill({
|
|
9270
9306
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
9271
9307
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9272
|
-
dirName:
|
|
9273
|
-
frontmatter:
|
|
9308
|
+
dirName: junieFrontmatter.name,
|
|
9309
|
+
frontmatter: junieFrontmatter,
|
|
9274
9310
|
body: rulesyncSkill.getBody(),
|
|
9275
9311
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9276
9312
|
validate,
|
|
@@ -9279,14 +9315,14 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9279
9315
|
}
|
|
9280
9316
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9281
9317
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9282
|
-
return targets.includes("*") || targets.includes("
|
|
9318
|
+
return targets.includes("*") || targets.includes("junie");
|
|
9283
9319
|
}
|
|
9284
9320
|
static async fromDir(params) {
|
|
9285
9321
|
const loaded = await this.loadSkillDirContent({
|
|
9286
9322
|
...params,
|
|
9287
|
-
getSettablePaths:
|
|
9323
|
+
getSettablePaths: _JunieSkill.getSettablePaths
|
|
9288
9324
|
});
|
|
9289
|
-
const result =
|
|
9325
|
+
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9290
9326
|
if (!result.success) {
|
|
9291
9327
|
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9292
9328
|
throw new Error(
|
|
@@ -9304,7 +9340,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9304
9340
|
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9305
9341
|
);
|
|
9306
9342
|
}
|
|
9307
|
-
return new
|
|
9343
|
+
return new _JunieSkill({
|
|
9308
9344
|
baseDir: loaded.baseDir,
|
|
9309
9345
|
relativeDirPath: loaded.relativeDirPath,
|
|
9310
9346
|
dirName: loaded.dirName,
|
|
@@ -9321,9 +9357,10 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9321
9357
|
dirName,
|
|
9322
9358
|
global = false
|
|
9323
9359
|
}) {
|
|
9324
|
-
|
|
9360
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9361
|
+
return new _JunieSkill({
|
|
9325
9362
|
baseDir,
|
|
9326
|
-
relativeDirPath,
|
|
9363
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9327
9364
|
dirName,
|
|
9328
9365
|
frontmatter: { name: "", description: "" },
|
|
9329
9366
|
body: "",
|
|
@@ -9334,17 +9371,17 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9334
9371
|
}
|
|
9335
9372
|
};
|
|
9336
9373
|
|
|
9337
|
-
// src/features/skills/
|
|
9374
|
+
// src/features/skills/kilo-skill.ts
|
|
9338
9375
|
var import_node_path70 = require("path");
|
|
9339
9376
|
var import_mini33 = require("zod/mini");
|
|
9340
|
-
var
|
|
9377
|
+
var KiloSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9341
9378
|
name: import_mini33.z.string(),
|
|
9342
9379
|
description: import_mini33.z.string()
|
|
9343
9380
|
});
|
|
9344
|
-
var
|
|
9381
|
+
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9345
9382
|
constructor({
|
|
9346
9383
|
baseDir = process.cwd(),
|
|
9347
|
-
relativeDirPath = (0, import_node_path70.join)(".
|
|
9384
|
+
relativeDirPath = (0, import_node_path70.join)(".kilocode", "skills"),
|
|
9348
9385
|
dirName,
|
|
9349
9386
|
frontmatter,
|
|
9350
9387
|
body,
|
|
@@ -9371,16 +9408,15 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9371
9408
|
}
|
|
9372
9409
|
}
|
|
9373
9410
|
}
|
|
9374
|
-
static getSettablePaths(
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
}
|
|
9411
|
+
static getSettablePaths({
|
|
9412
|
+
global: _global = false
|
|
9413
|
+
} = {}) {
|
|
9378
9414
|
return {
|
|
9379
|
-
relativeDirPath: (0, import_node_path70.join)(".
|
|
9415
|
+
relativeDirPath: (0, import_node_path70.join)(".kilocode", "skills")
|
|
9380
9416
|
};
|
|
9381
9417
|
}
|
|
9382
9418
|
getFrontmatter() {
|
|
9383
|
-
const result =
|
|
9419
|
+
const result = KiloSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9384
9420
|
return result;
|
|
9385
9421
|
}
|
|
9386
9422
|
getBody() {
|
|
@@ -9393,7 +9429,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9393
9429
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9394
9430
|
};
|
|
9395
9431
|
}
|
|
9396
|
-
const result =
|
|
9432
|
+
const result = KiloSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9397
9433
|
if (!result.success) {
|
|
9398
9434
|
return {
|
|
9399
9435
|
success: false,
|
|
@@ -9431,21 +9467,22 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9431
9467
|
});
|
|
9432
9468
|
}
|
|
9433
9469
|
static fromRulesyncSkill({
|
|
9470
|
+
baseDir = process.cwd(),
|
|
9434
9471
|
rulesyncSkill,
|
|
9435
9472
|
validate = true,
|
|
9436
9473
|
global = false
|
|
9437
9474
|
}) {
|
|
9438
|
-
const settablePaths =
|
|
9475
|
+
const settablePaths = _KiloSkill.getSettablePaths({ global });
|
|
9439
9476
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9440
|
-
const
|
|
9477
|
+
const kiloFrontmatter = {
|
|
9441
9478
|
name: rulesyncFrontmatter.name,
|
|
9442
9479
|
description: rulesyncFrontmatter.description
|
|
9443
9480
|
};
|
|
9444
|
-
return new
|
|
9445
|
-
baseDir
|
|
9481
|
+
return new _KiloSkill({
|
|
9482
|
+
baseDir,
|
|
9446
9483
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9447
|
-
dirName:
|
|
9448
|
-
frontmatter:
|
|
9484
|
+
dirName: kiloFrontmatter.name,
|
|
9485
|
+
frontmatter: kiloFrontmatter,
|
|
9449
9486
|
body: rulesyncSkill.getBody(),
|
|
9450
9487
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9451
9488
|
validate,
|
|
@@ -9454,14 +9491,14 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9454
9491
|
}
|
|
9455
9492
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9456
9493
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9457
|
-
return targets.includes("*") || targets.includes("
|
|
9494
|
+
return targets.includes("*") || targets.includes("kilo");
|
|
9458
9495
|
}
|
|
9459
9496
|
static async fromDir(params) {
|
|
9460
9497
|
const loaded = await this.loadSkillDirContent({
|
|
9461
9498
|
...params,
|
|
9462
|
-
getSettablePaths:
|
|
9499
|
+
getSettablePaths: _KiloSkill.getSettablePaths
|
|
9463
9500
|
});
|
|
9464
|
-
const result =
|
|
9501
|
+
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9465
9502
|
if (!result.success) {
|
|
9466
9503
|
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9467
9504
|
throw new Error(
|
|
@@ -9479,7 +9516,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9479
9516
|
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9480
9517
|
);
|
|
9481
9518
|
}
|
|
9482
|
-
return new
|
|
9519
|
+
return new _KiloSkill({
|
|
9483
9520
|
baseDir: loaded.baseDir,
|
|
9484
9521
|
relativeDirPath: loaded.relativeDirPath,
|
|
9485
9522
|
dirName: loaded.dirName,
|
|
@@ -9496,10 +9533,9 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9496
9533
|
dirName,
|
|
9497
9534
|
global = false
|
|
9498
9535
|
}) {
|
|
9499
|
-
|
|
9500
|
-
return new _KiroSkill({
|
|
9536
|
+
return new _KiloSkill({
|
|
9501
9537
|
baseDir,
|
|
9502
|
-
relativeDirPath
|
|
9538
|
+
relativeDirPath,
|
|
9503
9539
|
dirName,
|
|
9504
9540
|
frontmatter: { name: "", description: "" },
|
|
9505
9541
|
body: "",
|
|
@@ -9510,18 +9546,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9510
9546
|
}
|
|
9511
9547
|
};
|
|
9512
9548
|
|
|
9513
|
-
// src/features/skills/
|
|
9549
|
+
// src/features/skills/kiro-skill.ts
|
|
9514
9550
|
var import_node_path71 = require("path");
|
|
9515
9551
|
var import_mini34 = require("zod/mini");
|
|
9516
|
-
var
|
|
9552
|
+
var KiroSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9517
9553
|
name: import_mini34.z.string(),
|
|
9518
|
-
description: import_mini34.z.string()
|
|
9519
|
-
"allowed-tools": import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string()))
|
|
9554
|
+
description: import_mini34.z.string()
|
|
9520
9555
|
});
|
|
9521
|
-
var
|
|
9556
|
+
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
9522
9557
|
constructor({
|
|
9523
9558
|
baseDir = process.cwd(),
|
|
9524
|
-
relativeDirPath = (0, import_node_path71.join)(".
|
|
9559
|
+
relativeDirPath = (0, import_node_path71.join)(".kiro", "skills"),
|
|
9525
9560
|
dirName,
|
|
9526
9561
|
frontmatter,
|
|
9527
9562
|
body,
|
|
@@ -9548,26 +9583,29 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9548
9583
|
}
|
|
9549
9584
|
}
|
|
9550
9585
|
}
|
|
9551
|
-
static getSettablePaths(
|
|
9586
|
+
static getSettablePaths(options) {
|
|
9587
|
+
if (options?.global) {
|
|
9588
|
+
throw new Error("KiroSkill does not support global mode.");
|
|
9589
|
+
}
|
|
9552
9590
|
return {
|
|
9553
|
-
relativeDirPath:
|
|
9591
|
+
relativeDirPath: (0, import_node_path71.join)(".kiro", "skills")
|
|
9554
9592
|
};
|
|
9555
9593
|
}
|
|
9556
9594
|
getFrontmatter() {
|
|
9557
|
-
const result =
|
|
9595
|
+
const result = KiroSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9558
9596
|
return result;
|
|
9559
9597
|
}
|
|
9560
9598
|
getBody() {
|
|
9561
9599
|
return this.mainFile?.body ?? "";
|
|
9562
9600
|
}
|
|
9563
9601
|
validate() {
|
|
9564
|
-
if (this.mainFile
|
|
9602
|
+
if (!this.mainFile) {
|
|
9565
9603
|
return {
|
|
9566
9604
|
success: false,
|
|
9567
9605
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9568
9606
|
};
|
|
9569
9607
|
}
|
|
9570
|
-
const result =
|
|
9608
|
+
const result = KiroSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9571
9609
|
if (!result.success) {
|
|
9572
9610
|
return {
|
|
9573
9611
|
success: false,
|
|
@@ -9576,6 +9614,14 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9576
9614
|
)
|
|
9577
9615
|
};
|
|
9578
9616
|
}
|
|
9617
|
+
if (result.data.name !== this.getDirName()) {
|
|
9618
|
+
return {
|
|
9619
|
+
success: false,
|
|
9620
|
+
error: new Error(
|
|
9621
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
9622
|
+
)
|
|
9623
|
+
};
|
|
9624
|
+
}
|
|
9579
9625
|
return { success: true, error: null };
|
|
9580
9626
|
}
|
|
9581
9627
|
toRulesyncSkill() {
|
|
@@ -9583,12 +9629,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9583
9629
|
const rulesyncFrontmatter = {
|
|
9584
9630
|
name: frontmatter.name,
|
|
9585
9631
|
description: frontmatter.description,
|
|
9586
|
-
targets: ["*"]
|
|
9587
|
-
...frontmatter["allowed-tools"] && {
|
|
9588
|
-
opencode: {
|
|
9589
|
-
"allowed-tools": frontmatter["allowed-tools"]
|
|
9590
|
-
}
|
|
9591
|
-
}
|
|
9632
|
+
targets: ["*"]
|
|
9592
9633
|
};
|
|
9593
9634
|
return new RulesyncSkill({
|
|
9594
9635
|
baseDir: this.baseDir,
|
|
@@ -9602,22 +9643,22 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9602
9643
|
});
|
|
9603
9644
|
}
|
|
9604
9645
|
static fromRulesyncSkill({
|
|
9646
|
+
baseDir = process.cwd(),
|
|
9605
9647
|
rulesyncSkill,
|
|
9606
9648
|
validate = true,
|
|
9607
9649
|
global = false
|
|
9608
9650
|
}) {
|
|
9651
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
9609
9652
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9610
|
-
const
|
|
9653
|
+
const kiroFrontmatter = {
|
|
9611
9654
|
name: rulesyncFrontmatter.name,
|
|
9612
|
-
description: rulesyncFrontmatter.description
|
|
9613
|
-
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
9655
|
+
description: rulesyncFrontmatter.description
|
|
9614
9656
|
};
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
baseDir: rulesyncSkill.getBaseDir(),
|
|
9657
|
+
return new _KiroSkill({
|
|
9658
|
+
baseDir,
|
|
9618
9659
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9619
9660
|
dirName: rulesyncSkill.getDirName(),
|
|
9620
|
-
frontmatter:
|
|
9661
|
+
frontmatter: kiroFrontmatter,
|
|
9621
9662
|
body: rulesyncSkill.getBody(),
|
|
9622
9663
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9623
9664
|
validate,
|
|
@@ -9626,21 +9667,32 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9626
9667
|
}
|
|
9627
9668
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9628
9669
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9629
|
-
return targets.includes("*") || targets.includes("
|
|
9670
|
+
return targets.includes("*") || targets.includes("kiro");
|
|
9630
9671
|
}
|
|
9631
9672
|
static async fromDir(params) {
|
|
9632
9673
|
const loaded = await this.loadSkillDirContent({
|
|
9633
9674
|
...params,
|
|
9634
|
-
getSettablePaths:
|
|
9675
|
+
getSettablePaths: _KiroSkill.getSettablePaths
|
|
9635
9676
|
});
|
|
9636
|
-
const result =
|
|
9677
|
+
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9637
9678
|
if (!result.success) {
|
|
9638
9679
|
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9639
9680
|
throw new Error(
|
|
9640
9681
|
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9641
9682
|
);
|
|
9642
9683
|
}
|
|
9643
|
-
|
|
9684
|
+
if (result.data.name !== loaded.dirName) {
|
|
9685
|
+
const skillFilePath = (0, import_node_path71.join)(
|
|
9686
|
+
loaded.baseDir,
|
|
9687
|
+
loaded.relativeDirPath,
|
|
9688
|
+
loaded.dirName,
|
|
9689
|
+
SKILL_FILE_NAME
|
|
9690
|
+
);
|
|
9691
|
+
throw new Error(
|
|
9692
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9693
|
+
);
|
|
9694
|
+
}
|
|
9695
|
+
return new _KiroSkill({
|
|
9644
9696
|
baseDir: loaded.baseDir,
|
|
9645
9697
|
relativeDirPath: loaded.relativeDirPath,
|
|
9646
9698
|
dirName: loaded.dirName,
|
|
@@ -9657,9 +9709,10 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9657
9709
|
dirName,
|
|
9658
9710
|
global = false
|
|
9659
9711
|
}) {
|
|
9660
|
-
|
|
9712
|
+
const settablePaths = _KiroSkill.getSettablePaths({ global });
|
|
9713
|
+
return new _KiroSkill({
|
|
9661
9714
|
baseDir,
|
|
9662
|
-
relativeDirPath,
|
|
9715
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9663
9716
|
dirName,
|
|
9664
9717
|
frontmatter: { name: "", description: "" },
|
|
9665
9718
|
body: "",
|
|
@@ -9670,17 +9723,18 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9670
9723
|
}
|
|
9671
9724
|
};
|
|
9672
9725
|
|
|
9673
|
-
// src/features/skills/
|
|
9726
|
+
// src/features/skills/opencode-skill.ts
|
|
9674
9727
|
var import_node_path72 = require("path");
|
|
9675
9728
|
var import_mini35 = require("zod/mini");
|
|
9676
|
-
var
|
|
9729
|
+
var OpenCodeSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9677
9730
|
name: import_mini35.z.string(),
|
|
9678
|
-
description: import_mini35.z.string()
|
|
9731
|
+
description: import_mini35.z.string(),
|
|
9732
|
+
"allowed-tools": import_mini35.z.optional(import_mini35.z.array(import_mini35.z.string()))
|
|
9679
9733
|
});
|
|
9680
|
-
var
|
|
9734
|
+
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9681
9735
|
constructor({
|
|
9682
9736
|
baseDir = process.cwd(),
|
|
9683
|
-
relativeDirPath = (0, import_node_path72.join)(".
|
|
9737
|
+
relativeDirPath = (0, import_node_path72.join)(".opencode", "skill"),
|
|
9684
9738
|
dirName,
|
|
9685
9739
|
frontmatter,
|
|
9686
9740
|
body,
|
|
@@ -9707,29 +9761,26 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9707
9761
|
}
|
|
9708
9762
|
}
|
|
9709
9763
|
}
|
|
9710
|
-
static getSettablePaths(
|
|
9711
|
-
if (options?.global) {
|
|
9712
|
-
throw new Error("ReplitSkill does not support global mode.");
|
|
9713
|
-
}
|
|
9764
|
+
static getSettablePaths({ global = false } = {}) {
|
|
9714
9765
|
return {
|
|
9715
|
-
relativeDirPath: (0, import_node_path72.join)(".
|
|
9766
|
+
relativeDirPath: global ? (0, import_node_path72.join)(".config", "opencode", "skill") : (0, import_node_path72.join)(".opencode", "skill")
|
|
9716
9767
|
};
|
|
9717
9768
|
}
|
|
9718
9769
|
getFrontmatter() {
|
|
9719
|
-
const result =
|
|
9770
|
+
const result = OpenCodeSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9720
9771
|
return result;
|
|
9721
9772
|
}
|
|
9722
9773
|
getBody() {
|
|
9723
9774
|
return this.mainFile?.body ?? "";
|
|
9724
9775
|
}
|
|
9725
9776
|
validate() {
|
|
9726
|
-
if (
|
|
9777
|
+
if (this.mainFile === void 0) {
|
|
9727
9778
|
return {
|
|
9728
9779
|
success: false,
|
|
9729
9780
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9730
9781
|
};
|
|
9731
9782
|
}
|
|
9732
|
-
const result =
|
|
9783
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9733
9784
|
if (!result.success) {
|
|
9734
9785
|
return {
|
|
9735
9786
|
success: false,
|
|
@@ -9745,7 +9796,12 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9745
9796
|
const rulesyncFrontmatter = {
|
|
9746
9797
|
name: frontmatter.name,
|
|
9747
9798
|
description: frontmatter.description,
|
|
9748
|
-
targets: ["*"]
|
|
9799
|
+
targets: ["*"],
|
|
9800
|
+
...frontmatter["allowed-tools"] && {
|
|
9801
|
+
opencode: {
|
|
9802
|
+
"allowed-tools": frontmatter["allowed-tools"]
|
|
9803
|
+
}
|
|
9804
|
+
}
|
|
9749
9805
|
};
|
|
9750
9806
|
return new RulesyncSkill({
|
|
9751
9807
|
baseDir: this.baseDir,
|
|
@@ -9759,21 +9815,23 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9759
9815
|
});
|
|
9760
9816
|
}
|
|
9761
9817
|
static fromRulesyncSkill({
|
|
9818
|
+
baseDir = process.cwd(),
|
|
9762
9819
|
rulesyncSkill,
|
|
9763
9820
|
validate = true,
|
|
9764
9821
|
global = false
|
|
9765
9822
|
}) {
|
|
9766
|
-
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
9767
9823
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9768
|
-
const
|
|
9824
|
+
const opencodeFrontmatter = {
|
|
9769
9825
|
name: rulesyncFrontmatter.name,
|
|
9770
|
-
description: rulesyncFrontmatter.description
|
|
9826
|
+
description: rulesyncFrontmatter.description,
|
|
9827
|
+
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
9771
9828
|
};
|
|
9772
|
-
|
|
9773
|
-
|
|
9829
|
+
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
9830
|
+
return new _OpenCodeSkill({
|
|
9831
|
+
baseDir,
|
|
9774
9832
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9775
9833
|
dirName: rulesyncSkill.getDirName(),
|
|
9776
|
-
frontmatter:
|
|
9834
|
+
frontmatter: opencodeFrontmatter,
|
|
9777
9835
|
body: rulesyncSkill.getBody(),
|
|
9778
9836
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9779
9837
|
validate,
|
|
@@ -9782,21 +9840,21 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9782
9840
|
}
|
|
9783
9841
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9784
9842
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9785
|
-
return targets.includes("*") || targets.includes("
|
|
9843
|
+
return targets.includes("*") || targets.includes("opencode");
|
|
9786
9844
|
}
|
|
9787
9845
|
static async fromDir(params) {
|
|
9788
9846
|
const loaded = await this.loadSkillDirContent({
|
|
9789
9847
|
...params,
|
|
9790
|
-
getSettablePaths:
|
|
9848
|
+
getSettablePaths: _OpenCodeSkill.getSettablePaths
|
|
9791
9849
|
});
|
|
9792
|
-
const result =
|
|
9850
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9793
9851
|
if (!result.success) {
|
|
9794
9852
|
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9795
9853
|
throw new Error(
|
|
9796
9854
|
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9797
9855
|
);
|
|
9798
9856
|
}
|
|
9799
|
-
return new
|
|
9857
|
+
return new _OpenCodeSkill({
|
|
9800
9858
|
baseDir: loaded.baseDir,
|
|
9801
9859
|
relativeDirPath: loaded.relativeDirPath,
|
|
9802
9860
|
dirName: loaded.dirName,
|
|
@@ -9813,10 +9871,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9813
9871
|
dirName,
|
|
9814
9872
|
global = false
|
|
9815
9873
|
}) {
|
|
9816
|
-
|
|
9817
|
-
return new _ReplitSkill({
|
|
9874
|
+
return new _OpenCodeSkill({
|
|
9818
9875
|
baseDir,
|
|
9819
|
-
relativeDirPath
|
|
9876
|
+
relativeDirPath,
|
|
9820
9877
|
dirName,
|
|
9821
9878
|
frontmatter: { name: "", description: "" },
|
|
9822
9879
|
body: "",
|
|
@@ -9827,17 +9884,17 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9827
9884
|
}
|
|
9828
9885
|
};
|
|
9829
9886
|
|
|
9830
|
-
// src/features/skills/
|
|
9887
|
+
// src/features/skills/replit-skill.ts
|
|
9831
9888
|
var import_node_path73 = require("path");
|
|
9832
9889
|
var import_mini36 = require("zod/mini");
|
|
9833
|
-
var
|
|
9890
|
+
var ReplitSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
9834
9891
|
name: import_mini36.z.string(),
|
|
9835
9892
|
description: import_mini36.z.string()
|
|
9836
9893
|
});
|
|
9837
|
-
var
|
|
9894
|
+
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9838
9895
|
constructor({
|
|
9839
9896
|
baseDir = process.cwd(),
|
|
9840
|
-
relativeDirPath = (0, import_node_path73.join)(".
|
|
9897
|
+
relativeDirPath = (0, import_node_path73.join)(".agents", "skills"),
|
|
9841
9898
|
dirName,
|
|
9842
9899
|
frontmatter,
|
|
9843
9900
|
body,
|
|
@@ -9864,15 +9921,16 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9864
9921
|
}
|
|
9865
9922
|
}
|
|
9866
9923
|
}
|
|
9867
|
-
static getSettablePaths({
|
|
9868
|
-
global
|
|
9869
|
-
|
|
9924
|
+
static getSettablePaths(options) {
|
|
9925
|
+
if (options?.global) {
|
|
9926
|
+
throw new Error("ReplitSkill does not support global mode.");
|
|
9927
|
+
}
|
|
9870
9928
|
return {
|
|
9871
|
-
relativeDirPath: (0, import_node_path73.join)(".
|
|
9929
|
+
relativeDirPath: (0, import_node_path73.join)(".agents", "skills")
|
|
9872
9930
|
};
|
|
9873
9931
|
}
|
|
9874
9932
|
getFrontmatter() {
|
|
9875
|
-
const result =
|
|
9933
|
+
const result = ReplitSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9876
9934
|
return result;
|
|
9877
9935
|
}
|
|
9878
9936
|
getBody() {
|
|
@@ -9885,7 +9943,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9885
9943
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9886
9944
|
};
|
|
9887
9945
|
}
|
|
9888
|
-
const result =
|
|
9946
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9889
9947
|
if (!result.success) {
|
|
9890
9948
|
return {
|
|
9891
9949
|
success: false,
|
|
@@ -9894,14 +9952,6 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9894
9952
|
)
|
|
9895
9953
|
};
|
|
9896
9954
|
}
|
|
9897
|
-
if (result.data.name !== this.getDirName()) {
|
|
9898
|
-
return {
|
|
9899
|
-
success: false,
|
|
9900
|
-
error: new Error(
|
|
9901
|
-
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
9902
|
-
)
|
|
9903
|
-
};
|
|
9904
|
-
}
|
|
9905
9955
|
return { success: true, error: null };
|
|
9906
9956
|
}
|
|
9907
9957
|
toRulesyncSkill() {
|
|
@@ -9923,18 +9973,184 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9923
9973
|
});
|
|
9924
9974
|
}
|
|
9925
9975
|
static fromRulesyncSkill({
|
|
9976
|
+
baseDir = process.cwd(),
|
|
9926
9977
|
rulesyncSkill,
|
|
9927
9978
|
validate = true,
|
|
9928
9979
|
global = false
|
|
9929
9980
|
}) {
|
|
9930
|
-
const settablePaths =
|
|
9981
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
9982
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9983
|
+
const replitFrontmatter = {
|
|
9984
|
+
name: rulesyncFrontmatter.name,
|
|
9985
|
+
description: rulesyncFrontmatter.description
|
|
9986
|
+
};
|
|
9987
|
+
return new _ReplitSkill({
|
|
9988
|
+
baseDir,
|
|
9989
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
9990
|
+
dirName: rulesyncSkill.getDirName(),
|
|
9991
|
+
frontmatter: replitFrontmatter,
|
|
9992
|
+
body: rulesyncSkill.getBody(),
|
|
9993
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9994
|
+
validate,
|
|
9995
|
+
global
|
|
9996
|
+
});
|
|
9997
|
+
}
|
|
9998
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9999
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
10000
|
+
return targets.includes("*") || targets.includes("replit");
|
|
10001
|
+
}
|
|
10002
|
+
static async fromDir(params) {
|
|
10003
|
+
const loaded = await this.loadSkillDirContent({
|
|
10004
|
+
...params,
|
|
10005
|
+
getSettablePaths: _ReplitSkill.getSettablePaths
|
|
10006
|
+
});
|
|
10007
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10008
|
+
if (!result.success) {
|
|
10009
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10010
|
+
throw new Error(
|
|
10011
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10012
|
+
);
|
|
10013
|
+
}
|
|
10014
|
+
return new _ReplitSkill({
|
|
10015
|
+
baseDir: loaded.baseDir,
|
|
10016
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
10017
|
+
dirName: loaded.dirName,
|
|
10018
|
+
frontmatter: result.data,
|
|
10019
|
+
body: loaded.body,
|
|
10020
|
+
otherFiles: loaded.otherFiles,
|
|
10021
|
+
validate: true,
|
|
10022
|
+
global: loaded.global
|
|
10023
|
+
});
|
|
10024
|
+
}
|
|
10025
|
+
static forDeletion({
|
|
10026
|
+
baseDir = process.cwd(),
|
|
10027
|
+
relativeDirPath,
|
|
10028
|
+
dirName,
|
|
10029
|
+
global = false
|
|
10030
|
+
}) {
|
|
10031
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
10032
|
+
return new _ReplitSkill({
|
|
10033
|
+
baseDir,
|
|
10034
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
10035
|
+
dirName,
|
|
10036
|
+
frontmatter: { name: "", description: "" },
|
|
10037
|
+
body: "",
|
|
10038
|
+
otherFiles: [],
|
|
10039
|
+
validate: false,
|
|
10040
|
+
global
|
|
10041
|
+
});
|
|
10042
|
+
}
|
|
10043
|
+
};
|
|
10044
|
+
|
|
10045
|
+
// src/features/skills/roo-skill.ts
|
|
10046
|
+
var import_node_path74 = require("path");
|
|
10047
|
+
var import_mini37 = require("zod/mini");
|
|
10048
|
+
var RooSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10049
|
+
name: import_mini37.z.string(),
|
|
10050
|
+
description: import_mini37.z.string()
|
|
10051
|
+
});
|
|
10052
|
+
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10053
|
+
constructor({
|
|
10054
|
+
baseDir = process.cwd(),
|
|
10055
|
+
relativeDirPath = (0, import_node_path74.join)(".roo", "skills"),
|
|
10056
|
+
dirName,
|
|
10057
|
+
frontmatter,
|
|
10058
|
+
body,
|
|
10059
|
+
otherFiles = [],
|
|
10060
|
+
validate = true,
|
|
10061
|
+
global = false
|
|
10062
|
+
}) {
|
|
10063
|
+
super({
|
|
10064
|
+
baseDir,
|
|
10065
|
+
relativeDirPath,
|
|
10066
|
+
dirName,
|
|
10067
|
+
mainFile: {
|
|
10068
|
+
name: SKILL_FILE_NAME,
|
|
10069
|
+
body,
|
|
10070
|
+
frontmatter: { ...frontmatter }
|
|
10071
|
+
},
|
|
10072
|
+
otherFiles,
|
|
10073
|
+
global
|
|
10074
|
+
});
|
|
10075
|
+
if (validate) {
|
|
10076
|
+
const result = this.validate();
|
|
10077
|
+
if (!result.success) {
|
|
10078
|
+
throw result.error;
|
|
10079
|
+
}
|
|
10080
|
+
}
|
|
10081
|
+
}
|
|
10082
|
+
static getSettablePaths({
|
|
10083
|
+
global: _global = false
|
|
10084
|
+
} = {}) {
|
|
10085
|
+
return {
|
|
10086
|
+
relativeDirPath: (0, import_node_path74.join)(".roo", "skills")
|
|
10087
|
+
};
|
|
10088
|
+
}
|
|
10089
|
+
getFrontmatter() {
|
|
10090
|
+
const result = RooSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
10091
|
+
return result;
|
|
10092
|
+
}
|
|
10093
|
+
getBody() {
|
|
10094
|
+
return this.mainFile?.body ?? "";
|
|
10095
|
+
}
|
|
10096
|
+
validate() {
|
|
10097
|
+
if (!this.mainFile) {
|
|
10098
|
+
return {
|
|
10099
|
+
success: false,
|
|
10100
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
10101
|
+
};
|
|
10102
|
+
}
|
|
10103
|
+
const result = RooSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
10104
|
+
if (!result.success) {
|
|
10105
|
+
return {
|
|
10106
|
+
success: false,
|
|
10107
|
+
error: new Error(
|
|
10108
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
10109
|
+
)
|
|
10110
|
+
};
|
|
10111
|
+
}
|
|
10112
|
+
if (result.data.name !== this.getDirName()) {
|
|
10113
|
+
return {
|
|
10114
|
+
success: false,
|
|
10115
|
+
error: new Error(
|
|
10116
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
10117
|
+
)
|
|
10118
|
+
};
|
|
10119
|
+
}
|
|
10120
|
+
return { success: true, error: null };
|
|
10121
|
+
}
|
|
10122
|
+
toRulesyncSkill() {
|
|
10123
|
+
const frontmatter = this.getFrontmatter();
|
|
10124
|
+
const rulesyncFrontmatter = {
|
|
10125
|
+
name: frontmatter.name,
|
|
10126
|
+
description: frontmatter.description,
|
|
10127
|
+
targets: ["*"]
|
|
10128
|
+
};
|
|
10129
|
+
return new RulesyncSkill({
|
|
10130
|
+
baseDir: this.baseDir,
|
|
10131
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
10132
|
+
dirName: this.getDirName(),
|
|
10133
|
+
frontmatter: rulesyncFrontmatter,
|
|
10134
|
+
body: this.getBody(),
|
|
10135
|
+
otherFiles: this.getOtherFiles(),
|
|
10136
|
+
validate: true,
|
|
10137
|
+
global: this.global
|
|
10138
|
+
});
|
|
10139
|
+
}
|
|
10140
|
+
static fromRulesyncSkill({
|
|
10141
|
+
baseDir = process.cwd(),
|
|
10142
|
+
rulesyncSkill,
|
|
10143
|
+
validate = true,
|
|
10144
|
+
global = false
|
|
10145
|
+
}) {
|
|
10146
|
+
const settablePaths = _RooSkill.getSettablePaths({ global });
|
|
9931
10147
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9932
10148
|
const rooFrontmatter = {
|
|
9933
10149
|
name: rulesyncFrontmatter.name,
|
|
9934
10150
|
description: rulesyncFrontmatter.description
|
|
9935
10151
|
};
|
|
9936
10152
|
return new _RooSkill({
|
|
9937
|
-
baseDir
|
|
10153
|
+
baseDir,
|
|
9938
10154
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
9939
10155
|
dirName: rooFrontmatter.name,
|
|
9940
10156
|
frontmatter: rooFrontmatter,
|
|
@@ -9955,13 +10171,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9955
10171
|
});
|
|
9956
10172
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9957
10173
|
if (!result.success) {
|
|
9958
|
-
const skillDirPath = (0,
|
|
10174
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9959
10175
|
throw new Error(
|
|
9960
|
-
`Invalid frontmatter in ${(0,
|
|
10176
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9961
10177
|
);
|
|
9962
10178
|
}
|
|
9963
10179
|
if (result.data.name !== loaded.dirName) {
|
|
9964
|
-
const skillFilePath = (0,
|
|
10180
|
+
const skillFilePath = (0, import_node_path74.join)(
|
|
9965
10181
|
loaded.baseDir,
|
|
9966
10182
|
loaded.relativeDirPath,
|
|
9967
10183
|
loaded.dirName,
|
|
@@ -10002,17 +10218,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10002
10218
|
};
|
|
10003
10219
|
|
|
10004
10220
|
// src/features/skills/skills-utils.ts
|
|
10005
|
-
var
|
|
10221
|
+
var import_node_path75 = require("path");
|
|
10006
10222
|
async function getLocalSkillDirNames(baseDir) {
|
|
10007
|
-
const skillsDir = (0,
|
|
10223
|
+
const skillsDir = (0, import_node_path75.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10008
10224
|
const names = /* @__PURE__ */ new Set();
|
|
10009
10225
|
if (!await directoryExists(skillsDir)) {
|
|
10010
10226
|
return names;
|
|
10011
10227
|
}
|
|
10012
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10228
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDir, "*"), { type: "dir" });
|
|
10013
10229
|
for (const dirPath of dirPaths) {
|
|
10014
|
-
const name = (0,
|
|
10015
|
-
if (name === (0,
|
|
10230
|
+
const name = (0, import_node_path75.basename)(dirPath);
|
|
10231
|
+
if (name === (0, import_node_path75.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
10016
10232
|
names.add(name);
|
|
10017
10233
|
}
|
|
10018
10234
|
return names;
|
|
@@ -10031,13 +10247,14 @@ var skillsProcessorToolTargetTuple = [
|
|
|
10031
10247
|
"cursor",
|
|
10032
10248
|
"factorydroid",
|
|
10033
10249
|
"geminicli",
|
|
10250
|
+
"junie",
|
|
10034
10251
|
"kilo",
|
|
10035
10252
|
"kiro",
|
|
10036
10253
|
"opencode",
|
|
10037
10254
|
"replit",
|
|
10038
10255
|
"roo"
|
|
10039
10256
|
];
|
|
10040
|
-
var SkillsProcessorToolTargetSchema =
|
|
10257
|
+
var SkillsProcessorToolTargetSchema = import_mini38.z.enum(skillsProcessorToolTargetTuple);
|
|
10041
10258
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
10042
10259
|
[
|
|
10043
10260
|
"agentsmd",
|
|
@@ -10116,6 +10333,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10116
10333
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
10117
10334
|
}
|
|
10118
10335
|
],
|
|
10336
|
+
[
|
|
10337
|
+
"junie",
|
|
10338
|
+
{
|
|
10339
|
+
class: JunieSkill,
|
|
10340
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
10341
|
+
}
|
|
10342
|
+
],
|
|
10119
10343
|
[
|
|
10120
10344
|
"kilo",
|
|
10121
10345
|
{
|
|
@@ -10206,6 +10430,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10206
10430
|
return null;
|
|
10207
10431
|
}
|
|
10208
10432
|
return factory.class.fromRulesyncSkill({
|
|
10433
|
+
baseDir: this.baseDir,
|
|
10209
10434
|
rulesyncSkill,
|
|
10210
10435
|
global: this.global
|
|
10211
10436
|
});
|
|
@@ -10238,11 +10463,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10238
10463
|
)
|
|
10239
10464
|
);
|
|
10240
10465
|
const localSkillNames = new Set(localDirNames);
|
|
10241
|
-
const curatedDirPath = (0,
|
|
10466
|
+
const curatedDirPath = (0, import_node_path76.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
10242
10467
|
let curatedSkills = [];
|
|
10243
10468
|
if (await directoryExists(curatedDirPath)) {
|
|
10244
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
10245
|
-
const curatedDirNames = curatedDirPaths.map((path4) => (0,
|
|
10469
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path76.join)(curatedDirPath, "*"), { type: "dir" });
|
|
10470
|
+
const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path76.basename)(path4));
|
|
10246
10471
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
10247
10472
|
if (localSkillNames.has(name)) {
|
|
10248
10473
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -10275,9 +10500,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10275
10500
|
async loadToolDirs() {
|
|
10276
10501
|
const factory = this.getFactory(this.toolTarget);
|
|
10277
10502
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10278
|
-
const skillsDirPath = (0,
|
|
10279
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10280
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10503
|
+
const skillsDirPath = (0, import_node_path76.join)(this.baseDir, paths.relativeDirPath);
|
|
10504
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path76.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10505
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path76.basename)(path4));
|
|
10281
10506
|
const toolSkills = await Promise.all(
|
|
10282
10507
|
dirNames.map(
|
|
10283
10508
|
(dirName) => factory.class.fromDir({
|
|
@@ -10293,9 +10518,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10293
10518
|
async loadToolDirsToDelete() {
|
|
10294
10519
|
const factory = this.getFactory(this.toolTarget);
|
|
10295
10520
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10296
|
-
const skillsDirPath = (0,
|
|
10297
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10298
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10521
|
+
const skillsDirPath = (0, import_node_path76.join)(this.baseDir, paths.relativeDirPath);
|
|
10522
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path76.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10523
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path76.basename)(path4));
|
|
10299
10524
|
const toolSkills = dirNames.map(
|
|
10300
10525
|
(dirName) => factory.class.forDeletion({
|
|
10301
10526
|
baseDir: this.baseDir,
|
|
@@ -10356,11 +10581,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10356
10581
|
};
|
|
10357
10582
|
|
|
10358
10583
|
// src/features/subagents/agentsmd-subagent.ts
|
|
10359
|
-
var
|
|
10584
|
+
var import_node_path78 = require("path");
|
|
10360
10585
|
|
|
10361
10586
|
// src/features/subagents/simulated-subagent.ts
|
|
10362
|
-
var
|
|
10363
|
-
var
|
|
10587
|
+
var import_node_path77 = require("path");
|
|
10588
|
+
var import_mini39 = require("zod/mini");
|
|
10364
10589
|
|
|
10365
10590
|
// src/features/subagents/tool-subagent.ts
|
|
10366
10591
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -10412,9 +10637,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
10412
10637
|
};
|
|
10413
10638
|
|
|
10414
10639
|
// src/features/subagents/simulated-subagent.ts
|
|
10415
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
10416
|
-
name:
|
|
10417
|
-
description:
|
|
10640
|
+
var SimulatedSubagentFrontmatterSchema = import_mini39.z.object({
|
|
10641
|
+
name: import_mini39.z.string(),
|
|
10642
|
+
description: import_mini39.z.optional(import_mini39.z.string())
|
|
10418
10643
|
});
|
|
10419
10644
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
10420
10645
|
frontmatter;
|
|
@@ -10424,7 +10649,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10424
10649
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10425
10650
|
if (!result.success) {
|
|
10426
10651
|
throw new Error(
|
|
10427
|
-
`Invalid frontmatter in ${(0,
|
|
10652
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10428
10653
|
);
|
|
10429
10654
|
}
|
|
10430
10655
|
}
|
|
@@ -10475,7 +10700,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10475
10700
|
return {
|
|
10476
10701
|
success: false,
|
|
10477
10702
|
error: new Error(
|
|
10478
|
-
`Invalid frontmatter in ${(0,
|
|
10703
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10479
10704
|
)
|
|
10480
10705
|
};
|
|
10481
10706
|
}
|
|
@@ -10485,7 +10710,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10485
10710
|
relativeFilePath,
|
|
10486
10711
|
validate = true
|
|
10487
10712
|
}) {
|
|
10488
|
-
const filePath = (0,
|
|
10713
|
+
const filePath = (0, import_node_path77.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10489
10714
|
const fileContent = await readFileContent(filePath);
|
|
10490
10715
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10491
10716
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10495,7 +10720,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10495
10720
|
return {
|
|
10496
10721
|
baseDir,
|
|
10497
10722
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
10498
|
-
relativeFilePath: (0,
|
|
10723
|
+
relativeFilePath: (0, import_node_path77.basename)(relativeFilePath),
|
|
10499
10724
|
frontmatter: result.data,
|
|
10500
10725
|
body: content.trim(),
|
|
10501
10726
|
validate
|
|
@@ -10521,7 +10746,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10521
10746
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10522
10747
|
static getSettablePaths() {
|
|
10523
10748
|
return {
|
|
10524
|
-
relativeDirPath: (0,
|
|
10749
|
+
relativeDirPath: (0, import_node_path78.join)(".agents", "subagents")
|
|
10525
10750
|
};
|
|
10526
10751
|
}
|
|
10527
10752
|
static async fromFile(params) {
|
|
@@ -10544,11 +10769,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10544
10769
|
};
|
|
10545
10770
|
|
|
10546
10771
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10547
|
-
var
|
|
10772
|
+
var import_node_path79 = require("path");
|
|
10548
10773
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10549
10774
|
static getSettablePaths(_options) {
|
|
10550
10775
|
return {
|
|
10551
|
-
relativeDirPath: (0,
|
|
10776
|
+
relativeDirPath: (0, import_node_path79.join)(".factory", "droids")
|
|
10552
10777
|
};
|
|
10553
10778
|
}
|
|
10554
10779
|
static async fromFile(params) {
|
|
@@ -10571,11 +10796,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10571
10796
|
};
|
|
10572
10797
|
|
|
10573
10798
|
// src/features/subagents/geminicli-subagent.ts
|
|
10574
|
-
var
|
|
10799
|
+
var import_node_path80 = require("path");
|
|
10575
10800
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10576
10801
|
static getSettablePaths() {
|
|
10577
10802
|
return {
|
|
10578
|
-
relativeDirPath: (0,
|
|
10803
|
+
relativeDirPath: (0, import_node_path80.join)(".gemini", "subagents")
|
|
10579
10804
|
};
|
|
10580
10805
|
}
|
|
10581
10806
|
static async fromFile(params) {
|
|
@@ -10598,11 +10823,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10598
10823
|
};
|
|
10599
10824
|
|
|
10600
10825
|
// src/features/subagents/roo-subagent.ts
|
|
10601
|
-
var
|
|
10826
|
+
var import_node_path81 = require("path");
|
|
10602
10827
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10603
10828
|
static getSettablePaths() {
|
|
10604
10829
|
return {
|
|
10605
|
-
relativeDirPath: (0,
|
|
10830
|
+
relativeDirPath: (0, import_node_path81.join)(".roo", "subagents")
|
|
10606
10831
|
};
|
|
10607
10832
|
}
|
|
10608
10833
|
static async fromFile(params) {
|
|
@@ -10625,20 +10850,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10625
10850
|
};
|
|
10626
10851
|
|
|
10627
10852
|
// src/features/subagents/subagents-processor.ts
|
|
10628
|
-
var
|
|
10629
|
-
var
|
|
10853
|
+
var import_node_path90 = require("path");
|
|
10854
|
+
var import_mini48 = require("zod/mini");
|
|
10630
10855
|
|
|
10631
10856
|
// src/features/subagents/claudecode-subagent.ts
|
|
10632
|
-
var
|
|
10633
|
-
var
|
|
10857
|
+
var import_node_path83 = require("path");
|
|
10858
|
+
var import_mini41 = require("zod/mini");
|
|
10634
10859
|
|
|
10635
10860
|
// src/features/subagents/rulesync-subagent.ts
|
|
10636
|
-
var
|
|
10637
|
-
var
|
|
10638
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10639
|
-
targets:
|
|
10640
|
-
name:
|
|
10641
|
-
description:
|
|
10861
|
+
var import_node_path82 = require("path");
|
|
10862
|
+
var import_mini40 = require("zod/mini");
|
|
10863
|
+
var RulesyncSubagentFrontmatterSchema = import_mini40.z.looseObject({
|
|
10864
|
+
targets: import_mini40.z._default(RulesyncTargetsSchema, ["*"]),
|
|
10865
|
+
name: import_mini40.z.string(),
|
|
10866
|
+
description: import_mini40.z.optional(import_mini40.z.string())
|
|
10642
10867
|
});
|
|
10643
10868
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10644
10869
|
frontmatter;
|
|
@@ -10647,7 +10872,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10647
10872
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10648
10873
|
if (!parseResult.success && rest.validate !== false) {
|
|
10649
10874
|
throw new Error(
|
|
10650
|
-
`Invalid frontmatter in ${(0,
|
|
10875
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10651
10876
|
);
|
|
10652
10877
|
}
|
|
10653
10878
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10680,7 +10905,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10680
10905
|
return {
|
|
10681
10906
|
success: false,
|
|
10682
10907
|
error: new Error(
|
|
10683
|
-
`Invalid frontmatter in ${(0,
|
|
10908
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10684
10909
|
)
|
|
10685
10910
|
};
|
|
10686
10911
|
}
|
|
@@ -10688,14 +10913,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10688
10913
|
static async fromFile({
|
|
10689
10914
|
relativeFilePath
|
|
10690
10915
|
}) {
|
|
10691
|
-
const filePath = (0,
|
|
10916
|
+
const filePath = (0, import_node_path82.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10692
10917
|
const fileContent = await readFileContent(filePath);
|
|
10693
10918
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10694
10919
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10695
10920
|
if (!result.success) {
|
|
10696
10921
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10697
10922
|
}
|
|
10698
|
-
const filename = (0,
|
|
10923
|
+
const filename = (0, import_node_path82.basename)(relativeFilePath);
|
|
10699
10924
|
return new _RulesyncSubagent({
|
|
10700
10925
|
baseDir: process.cwd(),
|
|
10701
10926
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -10707,13 +10932,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10707
10932
|
};
|
|
10708
10933
|
|
|
10709
10934
|
// src/features/subagents/claudecode-subagent.ts
|
|
10710
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
10711
|
-
name:
|
|
10712
|
-
description:
|
|
10713
|
-
model:
|
|
10714
|
-
tools:
|
|
10715
|
-
permissionMode:
|
|
10716
|
-
skills:
|
|
10935
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
10936
|
+
name: import_mini41.z.string(),
|
|
10937
|
+
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
10938
|
+
model: import_mini41.z.optional(import_mini41.z.string()),
|
|
10939
|
+
tools: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.string(), import_mini41.z.array(import_mini41.z.string())])),
|
|
10940
|
+
permissionMode: import_mini41.z.optional(import_mini41.z.string()),
|
|
10941
|
+
skills: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.string(), import_mini41.z.array(import_mini41.z.string())]))
|
|
10717
10942
|
});
|
|
10718
10943
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
10719
10944
|
frontmatter;
|
|
@@ -10723,7 +10948,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10723
10948
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10724
10949
|
if (!result.success) {
|
|
10725
10950
|
throw new Error(
|
|
10726
|
-
`Invalid frontmatter in ${(0,
|
|
10951
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10727
10952
|
);
|
|
10728
10953
|
}
|
|
10729
10954
|
}
|
|
@@ -10735,7 +10960,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10735
10960
|
}
|
|
10736
10961
|
static getSettablePaths(_options = {}) {
|
|
10737
10962
|
return {
|
|
10738
|
-
relativeDirPath: (0,
|
|
10963
|
+
relativeDirPath: (0, import_node_path83.join)(".claude", "agents")
|
|
10739
10964
|
};
|
|
10740
10965
|
}
|
|
10741
10966
|
getFrontmatter() {
|
|
@@ -10774,7 +10999,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10774
10999
|
global = false
|
|
10775
11000
|
}) {
|
|
10776
11001
|
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
10777
|
-
const claudecodeSection = rulesyncFrontmatter.claudecode ?? {}
|
|
11002
|
+
const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
|
|
11003
|
+
"name",
|
|
11004
|
+
"description"
|
|
11005
|
+
]);
|
|
10778
11006
|
const rawClaudecodeFrontmatter = {
|
|
10779
11007
|
name: rulesyncFrontmatter.name,
|
|
10780
11008
|
description: rulesyncFrontmatter.description,
|
|
@@ -10811,7 +11039,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10811
11039
|
return {
|
|
10812
11040
|
success: false,
|
|
10813
11041
|
error: new Error(
|
|
10814
|
-
`Invalid frontmatter in ${(0,
|
|
11042
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10815
11043
|
)
|
|
10816
11044
|
};
|
|
10817
11045
|
}
|
|
@@ -10829,7 +11057,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10829
11057
|
global = false
|
|
10830
11058
|
}) {
|
|
10831
11059
|
const paths = this.getSettablePaths({ global });
|
|
10832
|
-
const filePath = (0,
|
|
11060
|
+
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10833
11061
|
const fileContent = await readFileContent(filePath);
|
|
10834
11062
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10835
11063
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10864,16 +11092,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10864
11092
|
};
|
|
10865
11093
|
|
|
10866
11094
|
// src/features/subagents/codexcli-subagent.ts
|
|
10867
|
-
var
|
|
11095
|
+
var import_node_path84 = require("path");
|
|
10868
11096
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10869
|
-
var
|
|
10870
|
-
var CodexCliSubagentTomlSchema =
|
|
10871
|
-
name:
|
|
10872
|
-
description:
|
|
10873
|
-
developer_instructions:
|
|
10874
|
-
model:
|
|
10875
|
-
model_reasoning_effort:
|
|
10876
|
-
sandbox_mode:
|
|
11097
|
+
var import_mini42 = require("zod/mini");
|
|
11098
|
+
var CodexCliSubagentTomlSchema = import_mini42.z.looseObject({
|
|
11099
|
+
name: import_mini42.z.string(),
|
|
11100
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
11101
|
+
developer_instructions: import_mini42.z.optional(import_mini42.z.string()),
|
|
11102
|
+
model: import_mini42.z.optional(import_mini42.z.string()),
|
|
11103
|
+
model_reasoning_effort: import_mini42.z.optional(import_mini42.z.string()),
|
|
11104
|
+
sandbox_mode: import_mini42.z.optional(import_mini42.z.string())
|
|
10877
11105
|
});
|
|
10878
11106
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10879
11107
|
body;
|
|
@@ -10884,7 +11112,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10884
11112
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10885
11113
|
} catch (error) {
|
|
10886
11114
|
throw new Error(
|
|
10887
|
-
`Invalid TOML in ${(0,
|
|
11115
|
+
`Invalid TOML in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10888
11116
|
{ cause: error }
|
|
10889
11117
|
);
|
|
10890
11118
|
}
|
|
@@ -10896,7 +11124,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10896
11124
|
}
|
|
10897
11125
|
static getSettablePaths(_options = {}) {
|
|
10898
11126
|
return {
|
|
10899
|
-
relativeDirPath: (0,
|
|
11127
|
+
relativeDirPath: (0, import_node_path84.join)(".codex", "agents")
|
|
10900
11128
|
};
|
|
10901
11129
|
}
|
|
10902
11130
|
getBody() {
|
|
@@ -10908,7 +11136,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10908
11136
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10909
11137
|
} catch (error) {
|
|
10910
11138
|
throw new Error(
|
|
10911
|
-
`Failed to parse TOML in ${(0,
|
|
11139
|
+
`Failed to parse TOML in ${(0, import_node_path84.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10912
11140
|
{ cause: error }
|
|
10913
11141
|
);
|
|
10914
11142
|
}
|
|
@@ -10989,7 +11217,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10989
11217
|
global = false
|
|
10990
11218
|
}) {
|
|
10991
11219
|
const paths = this.getSettablePaths({ global });
|
|
10992
|
-
const filePath = (0,
|
|
11220
|
+
const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10993
11221
|
const fileContent = await readFileContent(filePath);
|
|
10994
11222
|
const subagent = new _CodexCliSubagent({
|
|
10995
11223
|
baseDir,
|
|
@@ -11027,13 +11255,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11027
11255
|
};
|
|
11028
11256
|
|
|
11029
11257
|
// src/features/subagents/copilot-subagent.ts
|
|
11030
|
-
var
|
|
11031
|
-
var
|
|
11258
|
+
var import_node_path85 = require("path");
|
|
11259
|
+
var import_mini43 = require("zod/mini");
|
|
11032
11260
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11033
|
-
var CopilotSubagentFrontmatterSchema =
|
|
11034
|
-
name:
|
|
11035
|
-
description:
|
|
11036
|
-
tools:
|
|
11261
|
+
var CopilotSubagentFrontmatterSchema = import_mini43.z.looseObject({
|
|
11262
|
+
name: import_mini43.z.string(),
|
|
11263
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
11264
|
+
tools: import_mini43.z.optional(import_mini43.z.union([import_mini43.z.string(), import_mini43.z.array(import_mini43.z.string())]))
|
|
11037
11265
|
});
|
|
11038
11266
|
var normalizeTools = (tools) => {
|
|
11039
11267
|
if (!tools) {
|
|
@@ -11053,7 +11281,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11053
11281
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11054
11282
|
if (!result.success) {
|
|
11055
11283
|
throw new Error(
|
|
11056
|
-
`Invalid frontmatter in ${(0,
|
|
11284
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11057
11285
|
);
|
|
11058
11286
|
}
|
|
11059
11287
|
}
|
|
@@ -11065,7 +11293,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11065
11293
|
}
|
|
11066
11294
|
static getSettablePaths(_options = {}) {
|
|
11067
11295
|
return {
|
|
11068
|
-
relativeDirPath: (0,
|
|
11296
|
+
relativeDirPath: (0, import_node_path85.join)(".github", "agents")
|
|
11069
11297
|
};
|
|
11070
11298
|
}
|
|
11071
11299
|
getFrontmatter() {
|
|
@@ -11139,7 +11367,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11139
11367
|
return {
|
|
11140
11368
|
success: false,
|
|
11141
11369
|
error: new Error(
|
|
11142
|
-
`Invalid frontmatter in ${(0,
|
|
11370
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11143
11371
|
)
|
|
11144
11372
|
};
|
|
11145
11373
|
}
|
|
@@ -11157,7 +11385,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11157
11385
|
global = false
|
|
11158
11386
|
}) {
|
|
11159
11387
|
const paths = this.getSettablePaths({ global });
|
|
11160
|
-
const filePath = (0,
|
|
11388
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11161
11389
|
const fileContent = await readFileContent(filePath);
|
|
11162
11390
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11163
11391
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11193,11 +11421,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11193
11421
|
};
|
|
11194
11422
|
|
|
11195
11423
|
// src/features/subagents/cursor-subagent.ts
|
|
11196
|
-
var
|
|
11197
|
-
var
|
|
11198
|
-
var CursorSubagentFrontmatterSchema =
|
|
11199
|
-
name:
|
|
11200
|
-
description:
|
|
11424
|
+
var import_node_path86 = require("path");
|
|
11425
|
+
var import_mini44 = require("zod/mini");
|
|
11426
|
+
var CursorSubagentFrontmatterSchema = import_mini44.z.looseObject({
|
|
11427
|
+
name: import_mini44.z.string(),
|
|
11428
|
+
description: import_mini44.z.optional(import_mini44.z.string())
|
|
11201
11429
|
});
|
|
11202
11430
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
11203
11431
|
frontmatter;
|
|
@@ -11207,7 +11435,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11207
11435
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11208
11436
|
if (!result.success) {
|
|
11209
11437
|
throw new Error(
|
|
11210
|
-
`Invalid frontmatter in ${(0,
|
|
11438
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11211
11439
|
);
|
|
11212
11440
|
}
|
|
11213
11441
|
}
|
|
@@ -11219,7 +11447,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11219
11447
|
}
|
|
11220
11448
|
static getSettablePaths(_options = {}) {
|
|
11221
11449
|
return {
|
|
11222
|
-
relativeDirPath: (0,
|
|
11450
|
+
relativeDirPath: (0, import_node_path86.join)(".cursor", "agents")
|
|
11223
11451
|
};
|
|
11224
11452
|
}
|
|
11225
11453
|
getFrontmatter() {
|
|
@@ -11286,7 +11514,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11286
11514
|
return {
|
|
11287
11515
|
success: false,
|
|
11288
11516
|
error: new Error(
|
|
11289
|
-
`Invalid frontmatter in ${(0,
|
|
11517
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11290
11518
|
)
|
|
11291
11519
|
};
|
|
11292
11520
|
}
|
|
@@ -11304,7 +11532,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11304
11532
|
global = false
|
|
11305
11533
|
}) {
|
|
11306
11534
|
const paths = this.getSettablePaths({ global });
|
|
11307
|
-
const filePath = (0,
|
|
11535
|
+
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11308
11536
|
const fileContent = await readFileContent(filePath);
|
|
11309
11537
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11310
11538
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11339,24 +11567,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11339
11567
|
}
|
|
11340
11568
|
};
|
|
11341
11569
|
|
|
11570
|
+
// src/features/subagents/junie-subagent.ts
|
|
11571
|
+
var import_node_path87 = require("path");
|
|
11572
|
+
var import_mini45 = require("zod/mini");
|
|
11573
|
+
var JunieSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
11574
|
+
name: import_mini45.z.optional(import_mini45.z.string()),
|
|
11575
|
+
description: import_mini45.z.string()
|
|
11576
|
+
});
|
|
11577
|
+
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
11578
|
+
frontmatter;
|
|
11579
|
+
body;
|
|
11580
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
11581
|
+
if (rest.validate !== false) {
|
|
11582
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11583
|
+
if (!result.success) {
|
|
11584
|
+
throw new Error(
|
|
11585
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11586
|
+
);
|
|
11587
|
+
}
|
|
11588
|
+
}
|
|
11589
|
+
super({
|
|
11590
|
+
...rest
|
|
11591
|
+
});
|
|
11592
|
+
this.frontmatter = frontmatter;
|
|
11593
|
+
this.body = body;
|
|
11594
|
+
}
|
|
11595
|
+
static getSettablePaths(options = {}) {
|
|
11596
|
+
if (options?.global) {
|
|
11597
|
+
throw new Error("JunieSubagent does not support global mode.");
|
|
11598
|
+
}
|
|
11599
|
+
return {
|
|
11600
|
+
relativeDirPath: (0, import_node_path87.join)(".junie", "agents")
|
|
11601
|
+
};
|
|
11602
|
+
}
|
|
11603
|
+
getFrontmatter() {
|
|
11604
|
+
return this.frontmatter;
|
|
11605
|
+
}
|
|
11606
|
+
getBody() {
|
|
11607
|
+
return this.body;
|
|
11608
|
+
}
|
|
11609
|
+
toRulesyncSubagent() {
|
|
11610
|
+
const { name, description, ...restFields } = this.frontmatter;
|
|
11611
|
+
const junieSection = {
|
|
11612
|
+
...restFields
|
|
11613
|
+
};
|
|
11614
|
+
const rulesyncFrontmatter = {
|
|
11615
|
+
targets: ["*"],
|
|
11616
|
+
name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
|
|
11617
|
+
description,
|
|
11618
|
+
...Object.keys(junieSection).length > 0 && { junie: junieSection }
|
|
11619
|
+
};
|
|
11620
|
+
return new RulesyncSubagent({
|
|
11621
|
+
baseDir: ".",
|
|
11622
|
+
frontmatter: rulesyncFrontmatter,
|
|
11623
|
+
body: this.body,
|
|
11624
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
11625
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
11626
|
+
validate: true
|
|
11627
|
+
});
|
|
11628
|
+
}
|
|
11629
|
+
static fromRulesyncSubagent({
|
|
11630
|
+
baseDir = process.cwd(),
|
|
11631
|
+
rulesyncSubagent,
|
|
11632
|
+
validate = true,
|
|
11633
|
+
global = false
|
|
11634
|
+
}) {
|
|
11635
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11636
|
+
const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
|
|
11637
|
+
"name",
|
|
11638
|
+
"description"
|
|
11639
|
+
]);
|
|
11640
|
+
const rawJunieFrontmatter = {
|
|
11641
|
+
name: rulesyncFrontmatter.name,
|
|
11642
|
+
description: rulesyncFrontmatter.description,
|
|
11643
|
+
...junieSection
|
|
11644
|
+
};
|
|
11645
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
|
|
11646
|
+
if (!result.success) {
|
|
11647
|
+
throw new Error(
|
|
11648
|
+
`Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
|
|
11649
|
+
);
|
|
11650
|
+
}
|
|
11651
|
+
const junieFrontmatter = result.data;
|
|
11652
|
+
const body = rulesyncSubagent.getBody();
|
|
11653
|
+
const fileContent = stringifyFrontmatter(body, junieFrontmatter);
|
|
11654
|
+
const paths = this.getSettablePaths({ global });
|
|
11655
|
+
return new _JunieSubagent({
|
|
11656
|
+
baseDir,
|
|
11657
|
+
frontmatter: junieFrontmatter,
|
|
11658
|
+
body,
|
|
11659
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11660
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
11661
|
+
fileContent,
|
|
11662
|
+
validate
|
|
11663
|
+
});
|
|
11664
|
+
}
|
|
11665
|
+
validate() {
|
|
11666
|
+
if (!this.frontmatter) {
|
|
11667
|
+
return { success: true, error: null };
|
|
11668
|
+
}
|
|
11669
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
11670
|
+
if (result.success) {
|
|
11671
|
+
return { success: true, error: null };
|
|
11672
|
+
} else {
|
|
11673
|
+
return {
|
|
11674
|
+
success: false,
|
|
11675
|
+
error: new Error(
|
|
11676
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11677
|
+
)
|
|
11678
|
+
};
|
|
11679
|
+
}
|
|
11680
|
+
}
|
|
11681
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
11682
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
11683
|
+
rulesyncSubagent,
|
|
11684
|
+
toolTarget: "junie"
|
|
11685
|
+
});
|
|
11686
|
+
}
|
|
11687
|
+
static async fromFile({
|
|
11688
|
+
baseDir = process.cwd(),
|
|
11689
|
+
relativeFilePath,
|
|
11690
|
+
validate = true,
|
|
11691
|
+
global = false
|
|
11692
|
+
}) {
|
|
11693
|
+
const paths = this.getSettablePaths({ global });
|
|
11694
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11695
|
+
const fileContent = await readFileContent(filePath);
|
|
11696
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11697
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11698
|
+
if (!result.success) {
|
|
11699
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
11700
|
+
}
|
|
11701
|
+
return new _JunieSubagent({
|
|
11702
|
+
baseDir,
|
|
11703
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11704
|
+
relativeFilePath,
|
|
11705
|
+
frontmatter: result.data,
|
|
11706
|
+
body: content.trim(),
|
|
11707
|
+
fileContent,
|
|
11708
|
+
validate
|
|
11709
|
+
});
|
|
11710
|
+
}
|
|
11711
|
+
static forDeletion({
|
|
11712
|
+
baseDir = process.cwd(),
|
|
11713
|
+
relativeDirPath,
|
|
11714
|
+
relativeFilePath
|
|
11715
|
+
}) {
|
|
11716
|
+
return new _JunieSubagent({
|
|
11717
|
+
baseDir,
|
|
11718
|
+
relativeDirPath,
|
|
11719
|
+
relativeFilePath,
|
|
11720
|
+
frontmatter: { name: "", description: "" },
|
|
11721
|
+
body: "",
|
|
11722
|
+
fileContent: "",
|
|
11723
|
+
validate: false
|
|
11724
|
+
});
|
|
11725
|
+
}
|
|
11726
|
+
};
|
|
11727
|
+
|
|
11342
11728
|
// src/features/subagents/kiro-subagent.ts
|
|
11343
|
-
var
|
|
11344
|
-
var
|
|
11345
|
-
var KiroCliSubagentJsonSchema =
|
|
11346
|
-
name:
|
|
11347
|
-
description:
|
|
11348
|
-
prompt:
|
|
11349
|
-
tools:
|
|
11350
|
-
toolAliases:
|
|
11351
|
-
toolSettings:
|
|
11352
|
-
toolSchema:
|
|
11353
|
-
hooks:
|
|
11354
|
-
model:
|
|
11355
|
-
mcpServers:
|
|
11356
|
-
useLegacyMcpJson:
|
|
11357
|
-
resources:
|
|
11358
|
-
allowedTools:
|
|
11359
|
-
includeMcpJson:
|
|
11729
|
+
var import_node_path88 = require("path");
|
|
11730
|
+
var import_mini46 = require("zod/mini");
|
|
11731
|
+
var KiroCliSubagentJsonSchema = import_mini46.z.looseObject({
|
|
11732
|
+
name: import_mini46.z.string(),
|
|
11733
|
+
description: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
|
|
11734
|
+
prompt: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
|
|
11735
|
+
tools: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
|
|
11736
|
+
toolAliases: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.string()))),
|
|
11737
|
+
toolSettings: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.unknown())),
|
|
11738
|
+
toolSchema: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.unknown())),
|
|
11739
|
+
hooks: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.array(import_mini46.z.unknown())))),
|
|
11740
|
+
model: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.string())),
|
|
11741
|
+
mcpServers: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.record(import_mini46.z.string(), import_mini46.z.unknown()))),
|
|
11742
|
+
useLegacyMcpJson: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.boolean())),
|
|
11743
|
+
resources: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
|
|
11744
|
+
allowedTools: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.array(import_mini46.z.string()))),
|
|
11745
|
+
includeMcpJson: import_mini46.z.optional(import_mini46.z.nullable(import_mini46.z.boolean()))
|
|
11360
11746
|
});
|
|
11361
11747
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
11362
11748
|
body;
|
|
@@ -11367,7 +11753,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11367
11753
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
11368
11754
|
} catch (error) {
|
|
11369
11755
|
throw new Error(
|
|
11370
|
-
`Invalid JSON in ${(0,
|
|
11756
|
+
`Invalid JSON in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11371
11757
|
{ cause: error }
|
|
11372
11758
|
);
|
|
11373
11759
|
}
|
|
@@ -11379,7 +11765,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11379
11765
|
}
|
|
11380
11766
|
static getSettablePaths(_options = {}) {
|
|
11381
11767
|
return {
|
|
11382
|
-
relativeDirPath: (0,
|
|
11768
|
+
relativeDirPath: (0, import_node_path88.join)(".kiro", "agents")
|
|
11383
11769
|
};
|
|
11384
11770
|
}
|
|
11385
11771
|
getBody() {
|
|
@@ -11391,7 +11777,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11391
11777
|
parsed = JSON.parse(this.body);
|
|
11392
11778
|
} catch (error) {
|
|
11393
11779
|
throw new Error(
|
|
11394
|
-
`Failed to parse JSON in ${(0,
|
|
11780
|
+
`Failed to parse JSON in ${(0, import_node_path88.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11395
11781
|
{ cause: error }
|
|
11396
11782
|
);
|
|
11397
11783
|
}
|
|
@@ -11472,7 +11858,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11472
11858
|
global = false
|
|
11473
11859
|
}) {
|
|
11474
11860
|
const paths = this.getSettablePaths({ global });
|
|
11475
|
-
const filePath = (0,
|
|
11861
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11476
11862
|
const fileContent = await readFileContent(filePath);
|
|
11477
11863
|
const subagent = new _KiroSubagent({
|
|
11478
11864
|
baseDir,
|
|
@@ -11510,12 +11896,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11510
11896
|
};
|
|
11511
11897
|
|
|
11512
11898
|
// src/features/subagents/opencode-subagent.ts
|
|
11513
|
-
var
|
|
11514
|
-
var
|
|
11515
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11516
|
-
description:
|
|
11517
|
-
mode:
|
|
11518
|
-
name:
|
|
11899
|
+
var import_node_path89 = require("path");
|
|
11900
|
+
var import_mini47 = require("zod/mini");
|
|
11901
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini47.z.looseObject({
|
|
11902
|
+
description: import_mini47.z.optional(import_mini47.z.string()),
|
|
11903
|
+
mode: import_mini47.z._default(import_mini47.z.string(), "subagent"),
|
|
11904
|
+
name: import_mini47.z.optional(import_mini47.z.string())
|
|
11519
11905
|
});
|
|
11520
11906
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11521
11907
|
frontmatter;
|
|
@@ -11525,7 +11911,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11525
11911
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11526
11912
|
if (!result.success) {
|
|
11527
11913
|
throw new Error(
|
|
11528
|
-
`Invalid frontmatter in ${(0,
|
|
11914
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11529
11915
|
);
|
|
11530
11916
|
}
|
|
11531
11917
|
}
|
|
@@ -11539,7 +11925,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11539
11925
|
global = false
|
|
11540
11926
|
} = {}) {
|
|
11541
11927
|
return {
|
|
11542
|
-
relativeDirPath: global ? (0,
|
|
11928
|
+
relativeDirPath: global ? (0, import_node_path89.join)(".config", "opencode", "agent") : (0, import_node_path89.join)(".opencode", "agent")
|
|
11543
11929
|
};
|
|
11544
11930
|
}
|
|
11545
11931
|
getFrontmatter() {
|
|
@@ -11552,7 +11938,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11552
11938
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
11553
11939
|
const rulesyncFrontmatter = {
|
|
11554
11940
|
targets: ["*"],
|
|
11555
|
-
name: name ?? (0,
|
|
11941
|
+
name: name ?? (0, import_node_path89.basename)(this.getRelativeFilePath(), ".md"),
|
|
11556
11942
|
description,
|
|
11557
11943
|
opencode: { mode, ...opencodeSection }
|
|
11558
11944
|
};
|
|
@@ -11605,7 +11991,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11605
11991
|
return {
|
|
11606
11992
|
success: false,
|
|
11607
11993
|
error: new Error(
|
|
11608
|
-
`Invalid frontmatter in ${(0,
|
|
11994
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11609
11995
|
)
|
|
11610
11996
|
};
|
|
11611
11997
|
}
|
|
@@ -11622,7 +12008,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11622
12008
|
global = false
|
|
11623
12009
|
}) {
|
|
11624
12010
|
const paths = this.getSettablePaths({ global });
|
|
11625
|
-
const filePath = (0,
|
|
12011
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11626
12012
|
const fileContent = await readFileContent(filePath);
|
|
11627
12013
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11628
12014
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11667,11 +12053,12 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11667
12053
|
"cursor",
|
|
11668
12054
|
"factorydroid",
|
|
11669
12055
|
"geminicli",
|
|
12056
|
+
"junie",
|
|
11670
12057
|
"kiro",
|
|
11671
12058
|
"opencode",
|
|
11672
12059
|
"roo"
|
|
11673
12060
|
];
|
|
11674
|
-
var SubagentsProcessorToolTargetSchema =
|
|
12061
|
+
var SubagentsProcessorToolTargetSchema = import_mini48.z.enum(subagentsProcessorToolTargetTuple);
|
|
11675
12062
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11676
12063
|
[
|
|
11677
12064
|
"agentsmd",
|
|
@@ -11729,6 +12116,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
11729
12116
|
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
11730
12117
|
}
|
|
11731
12118
|
],
|
|
12119
|
+
[
|
|
12120
|
+
"junie",
|
|
12121
|
+
{
|
|
12122
|
+
class: JunieSubagent,
|
|
12123
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
12124
|
+
}
|
|
12125
|
+
],
|
|
11732
12126
|
[
|
|
11733
12127
|
"kiro",
|
|
11734
12128
|
{
|
|
@@ -11833,7 +12227,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11833
12227
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
11834
12228
|
*/
|
|
11835
12229
|
async loadRulesyncFiles() {
|
|
11836
|
-
const subagentsDir = (0,
|
|
12230
|
+
const subagentsDir = (0, import_node_path90.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
11837
12231
|
const dirExists = await directoryExists(subagentsDir);
|
|
11838
12232
|
if (!dirExists) {
|
|
11839
12233
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -11848,7 +12242,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11848
12242
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
11849
12243
|
const rulesyncSubagents = [];
|
|
11850
12244
|
for (const mdFile of mdFiles) {
|
|
11851
|
-
const filepath = (0,
|
|
12245
|
+
const filepath = (0, import_node_path90.join)(subagentsDir, mdFile);
|
|
11852
12246
|
try {
|
|
11853
12247
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
11854
12248
|
relativeFilePath: mdFile,
|
|
@@ -11878,14 +12272,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11878
12272
|
const factory = this.getFactory(this.toolTarget);
|
|
11879
12273
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11880
12274
|
const subagentFilePaths = await findFilesByGlobs(
|
|
11881
|
-
(0,
|
|
12275
|
+
(0, import_node_path90.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
11882
12276
|
);
|
|
11883
12277
|
if (forDeletion) {
|
|
11884
12278
|
const toolSubagents2 = subagentFilePaths.map(
|
|
11885
12279
|
(path4) => factory.class.forDeletion({
|
|
11886
12280
|
baseDir: this.baseDir,
|
|
11887
12281
|
relativeDirPath: paths.relativeDirPath,
|
|
11888
|
-
relativeFilePath: (0,
|
|
12282
|
+
relativeFilePath: (0, import_node_path90.basename)(path4),
|
|
11889
12283
|
global: this.global
|
|
11890
12284
|
})
|
|
11891
12285
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -11898,7 +12292,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11898
12292
|
subagentFilePaths.map(
|
|
11899
12293
|
(path4) => factory.class.fromFile({
|
|
11900
12294
|
baseDir: this.baseDir,
|
|
11901
|
-
relativeFilePath: (0,
|
|
12295
|
+
relativeFilePath: (0, import_node_path90.basename)(path4),
|
|
11902
12296
|
global: this.global
|
|
11903
12297
|
})
|
|
11904
12298
|
)
|
|
@@ -11943,49 +12337,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11943
12337
|
};
|
|
11944
12338
|
|
|
11945
12339
|
// src/features/rules/agentsmd-rule.ts
|
|
11946
|
-
var
|
|
12340
|
+
var import_node_path93 = require("path");
|
|
11947
12341
|
|
|
11948
12342
|
// src/features/rules/tool-rule.ts
|
|
11949
|
-
var
|
|
12343
|
+
var import_node_path92 = require("path");
|
|
11950
12344
|
|
|
11951
12345
|
// src/features/rules/rulesync-rule.ts
|
|
11952
|
-
var
|
|
11953
|
-
var
|
|
11954
|
-
var RulesyncRuleFrontmatterSchema =
|
|
11955
|
-
root:
|
|
11956
|
-
localRoot:
|
|
11957
|
-
targets:
|
|
11958
|
-
description:
|
|
11959
|
-
globs:
|
|
11960
|
-
agentsmd:
|
|
11961
|
-
|
|
12346
|
+
var import_node_path91 = require("path");
|
|
12347
|
+
var import_mini49 = require("zod/mini");
|
|
12348
|
+
var RulesyncRuleFrontmatterSchema = import_mini49.z.object({
|
|
12349
|
+
root: import_mini49.z.optional(import_mini49.z.boolean()),
|
|
12350
|
+
localRoot: import_mini49.z.optional(import_mini49.z.boolean()),
|
|
12351
|
+
targets: import_mini49.z._default(RulesyncTargetsSchema, ["*"]),
|
|
12352
|
+
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
12353
|
+
globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string())),
|
|
12354
|
+
agentsmd: import_mini49.z.optional(
|
|
12355
|
+
import_mini49.z.object({
|
|
11962
12356
|
// @example "path/to/subproject"
|
|
11963
|
-
subprojectPath:
|
|
12357
|
+
subprojectPath: import_mini49.z.optional(import_mini49.z.string())
|
|
11964
12358
|
})
|
|
11965
12359
|
),
|
|
11966
|
-
claudecode:
|
|
11967
|
-
|
|
12360
|
+
claudecode: import_mini49.z.optional(
|
|
12361
|
+
import_mini49.z.object({
|
|
11968
12362
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
11969
12363
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
11970
|
-
paths:
|
|
12364
|
+
paths: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
|
|
11971
12365
|
})
|
|
11972
12366
|
),
|
|
11973
|
-
cursor:
|
|
11974
|
-
|
|
11975
|
-
alwaysApply:
|
|
11976
|
-
description:
|
|
11977
|
-
globs:
|
|
12367
|
+
cursor: import_mini49.z.optional(
|
|
12368
|
+
import_mini49.z.object({
|
|
12369
|
+
alwaysApply: import_mini49.z.optional(import_mini49.z.boolean()),
|
|
12370
|
+
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
12371
|
+
globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
|
|
11978
12372
|
})
|
|
11979
12373
|
),
|
|
11980
|
-
copilot:
|
|
11981
|
-
|
|
11982
|
-
excludeAgent:
|
|
12374
|
+
copilot: import_mini49.z.optional(
|
|
12375
|
+
import_mini49.z.object({
|
|
12376
|
+
excludeAgent: import_mini49.z.optional(import_mini49.z.union([import_mini49.z.literal("code-review"), import_mini49.z.literal("coding-agent")]))
|
|
11983
12377
|
})
|
|
11984
12378
|
),
|
|
11985
|
-
antigravity:
|
|
11986
|
-
|
|
11987
|
-
trigger:
|
|
11988
|
-
globs:
|
|
12379
|
+
antigravity: import_mini49.z.optional(
|
|
12380
|
+
import_mini49.z.looseObject({
|
|
12381
|
+
trigger: import_mini49.z.optional(import_mini49.z.string()),
|
|
12382
|
+
globs: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
|
|
11989
12383
|
})
|
|
11990
12384
|
)
|
|
11991
12385
|
});
|
|
@@ -11996,7 +12390,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11996
12390
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11997
12391
|
if (!parseResult.success && rest.validate !== false) {
|
|
11998
12392
|
throw new Error(
|
|
11999
|
-
`Invalid frontmatter in ${(0,
|
|
12393
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12000
12394
|
);
|
|
12001
12395
|
}
|
|
12002
12396
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12031,7 +12425,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12031
12425
|
return {
|
|
12032
12426
|
success: false,
|
|
12033
12427
|
error: new Error(
|
|
12034
|
-
`Invalid frontmatter in ${(0,
|
|
12428
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12035
12429
|
)
|
|
12036
12430
|
};
|
|
12037
12431
|
}
|
|
@@ -12040,7 +12434,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12040
12434
|
relativeFilePath,
|
|
12041
12435
|
validate = true
|
|
12042
12436
|
}) {
|
|
12043
|
-
const filePath = (0,
|
|
12437
|
+
const filePath = (0, import_node_path91.join)(
|
|
12044
12438
|
process.cwd(),
|
|
12045
12439
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
12046
12440
|
relativeFilePath
|
|
@@ -12142,7 +12536,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12142
12536
|
rulesyncRule,
|
|
12143
12537
|
validate = true,
|
|
12144
12538
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
12145
|
-
nonRootPath = { relativeDirPath: (0,
|
|
12539
|
+
nonRootPath = { relativeDirPath: (0, import_node_path92.join)(".agents", "memories") }
|
|
12146
12540
|
}) {
|
|
12147
12541
|
const params = this.buildToolRuleParamsDefault({
|
|
12148
12542
|
baseDir,
|
|
@@ -12153,7 +12547,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12153
12547
|
});
|
|
12154
12548
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
12155
12549
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
12156
|
-
params.relativeDirPath = (0,
|
|
12550
|
+
params.relativeDirPath = (0, import_node_path92.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
12157
12551
|
params.relativeFilePath = "AGENTS.md";
|
|
12158
12552
|
}
|
|
12159
12553
|
return params;
|
|
@@ -12202,7 +12596,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12202
12596
|
}
|
|
12203
12597
|
};
|
|
12204
12598
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
12205
|
-
return excludeToolDir ? subDir : (0,
|
|
12599
|
+
return excludeToolDir ? subDir : (0, import_node_path92.join)(toolDir, subDir);
|
|
12206
12600
|
}
|
|
12207
12601
|
|
|
12208
12602
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -12231,8 +12625,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12231
12625
|
validate = true
|
|
12232
12626
|
}) {
|
|
12233
12627
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
12234
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
12235
|
-
const fileContent = await readFileContent((0,
|
|
12628
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path93.join)(".agents", "memories", relativeFilePath);
|
|
12629
|
+
const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
|
|
12236
12630
|
return new _AgentsMdRule({
|
|
12237
12631
|
baseDir,
|
|
12238
12632
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12287,21 +12681,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12287
12681
|
};
|
|
12288
12682
|
|
|
12289
12683
|
// src/features/rules/antigravity-rule.ts
|
|
12290
|
-
var
|
|
12291
|
-
var
|
|
12292
|
-
var AntigravityRuleFrontmatterSchema =
|
|
12293
|
-
trigger:
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12684
|
+
var import_node_path94 = require("path");
|
|
12685
|
+
var import_mini50 = require("zod/mini");
|
|
12686
|
+
var AntigravityRuleFrontmatterSchema = import_mini50.z.looseObject({
|
|
12687
|
+
trigger: import_mini50.z.optional(
|
|
12688
|
+
import_mini50.z.union([
|
|
12689
|
+
import_mini50.z.literal("always_on"),
|
|
12690
|
+
import_mini50.z.literal("glob"),
|
|
12691
|
+
import_mini50.z.literal("manual"),
|
|
12692
|
+
import_mini50.z.literal("model_decision"),
|
|
12693
|
+
import_mini50.z.string()
|
|
12300
12694
|
// accepts any string for forward compatibility
|
|
12301
12695
|
])
|
|
12302
12696
|
),
|
|
12303
|
-
globs:
|
|
12304
|
-
description:
|
|
12697
|
+
globs: import_mini50.z.optional(import_mini50.z.string()),
|
|
12698
|
+
description: import_mini50.z.optional(import_mini50.z.string())
|
|
12305
12699
|
});
|
|
12306
12700
|
function parseGlobsString(globs) {
|
|
12307
12701
|
if (!globs) {
|
|
@@ -12446,7 +12840,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12446
12840
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12447
12841
|
if (!result.success) {
|
|
12448
12842
|
throw new Error(
|
|
12449
|
-
`Invalid frontmatter in ${(0,
|
|
12843
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12450
12844
|
);
|
|
12451
12845
|
}
|
|
12452
12846
|
}
|
|
@@ -12470,7 +12864,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12470
12864
|
relativeFilePath,
|
|
12471
12865
|
validate = true
|
|
12472
12866
|
}) {
|
|
12473
|
-
const filePath = (0,
|
|
12867
|
+
const filePath = (0, import_node_path94.join)(
|
|
12474
12868
|
baseDir,
|
|
12475
12869
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12476
12870
|
relativeFilePath
|
|
@@ -12610,7 +13004,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12610
13004
|
};
|
|
12611
13005
|
|
|
12612
13006
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12613
|
-
var
|
|
13007
|
+
var import_node_path95 = require("path");
|
|
12614
13008
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12615
13009
|
toRulesyncRule() {
|
|
12616
13010
|
const rulesyncFrontmatter = {
|
|
@@ -12670,8 +13064,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12670
13064
|
}) {
|
|
12671
13065
|
const settablePaths = this.getSettablePaths();
|
|
12672
13066
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12673
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
12674
|
-
const fileContent = await readFileContent((0,
|
|
13067
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path95.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13068
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12675
13069
|
return new _AugmentcodeLegacyRule({
|
|
12676
13070
|
baseDir,
|
|
12677
13071
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12700,7 +13094,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12700
13094
|
};
|
|
12701
13095
|
|
|
12702
13096
|
// src/features/rules/augmentcode-rule.ts
|
|
12703
|
-
var
|
|
13097
|
+
var import_node_path96 = require("path");
|
|
12704
13098
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12705
13099
|
toRulesyncRule() {
|
|
12706
13100
|
return this.toRulesyncRuleDefault();
|
|
@@ -12731,7 +13125,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12731
13125
|
relativeFilePath,
|
|
12732
13126
|
validate = true
|
|
12733
13127
|
}) {
|
|
12734
|
-
const filePath = (0,
|
|
13128
|
+
const filePath = (0, import_node_path96.join)(
|
|
12735
13129
|
baseDir,
|
|
12736
13130
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12737
13131
|
relativeFilePath
|
|
@@ -12771,7 +13165,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12771
13165
|
};
|
|
12772
13166
|
|
|
12773
13167
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
12774
|
-
var
|
|
13168
|
+
var import_node_path97 = require("path");
|
|
12775
13169
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
12776
13170
|
static getSettablePaths({
|
|
12777
13171
|
global,
|
|
@@ -12813,7 +13207,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12813
13207
|
if (isRoot) {
|
|
12814
13208
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
12815
13209
|
const fileContent2 = await readFileContent(
|
|
12816
|
-
(0,
|
|
13210
|
+
(0, import_node_path97.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
12817
13211
|
);
|
|
12818
13212
|
return new _ClaudecodeLegacyRule({
|
|
12819
13213
|
baseDir,
|
|
@@ -12827,8 +13221,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12827
13221
|
if (!paths.nonRoot) {
|
|
12828
13222
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12829
13223
|
}
|
|
12830
|
-
const relativePath = (0,
|
|
12831
|
-
const fileContent = await readFileContent((0,
|
|
13224
|
+
const relativePath = (0, import_node_path97.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13225
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12832
13226
|
return new _ClaudecodeLegacyRule({
|
|
12833
13227
|
baseDir,
|
|
12834
13228
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12887,10 +13281,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12887
13281
|
};
|
|
12888
13282
|
|
|
12889
13283
|
// src/features/rules/claudecode-rule.ts
|
|
12890
|
-
var
|
|
12891
|
-
var
|
|
12892
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
12893
|
-
paths:
|
|
13284
|
+
var import_node_path98 = require("path");
|
|
13285
|
+
var import_mini51 = require("zod/mini");
|
|
13286
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini51.z.object({
|
|
13287
|
+
paths: import_mini51.z.optional(import_mini51.z.array(import_mini51.z.string()))
|
|
12894
13288
|
});
|
|
12895
13289
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
12896
13290
|
frontmatter;
|
|
@@ -12928,7 +13322,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12928
13322
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12929
13323
|
if (!result.success) {
|
|
12930
13324
|
throw new Error(
|
|
12931
|
-
`Invalid frontmatter in ${(0,
|
|
13325
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12932
13326
|
);
|
|
12933
13327
|
}
|
|
12934
13328
|
}
|
|
@@ -12958,7 +13352,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12958
13352
|
if (isRoot) {
|
|
12959
13353
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
12960
13354
|
const fileContent2 = await readFileContent(
|
|
12961
|
-
(0,
|
|
13355
|
+
(0, import_node_path98.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
12962
13356
|
);
|
|
12963
13357
|
return new _ClaudecodeRule({
|
|
12964
13358
|
baseDir,
|
|
@@ -12973,8 +13367,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12973
13367
|
if (!paths.nonRoot) {
|
|
12974
13368
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12975
13369
|
}
|
|
12976
|
-
const relativePath = (0,
|
|
12977
|
-
const filePath = (0,
|
|
13370
|
+
const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13371
|
+
const filePath = (0, import_node_path98.join)(baseDir, relativePath);
|
|
12978
13372
|
const fileContent = await readFileContent(filePath);
|
|
12979
13373
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12980
13374
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13085,7 +13479,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13085
13479
|
return {
|
|
13086
13480
|
success: false,
|
|
13087
13481
|
error: new Error(
|
|
13088
|
-
`Invalid frontmatter in ${(0,
|
|
13482
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13089
13483
|
)
|
|
13090
13484
|
};
|
|
13091
13485
|
}
|
|
@@ -13105,10 +13499,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13105
13499
|
};
|
|
13106
13500
|
|
|
13107
13501
|
// src/features/rules/cline-rule.ts
|
|
13108
|
-
var
|
|
13109
|
-
var
|
|
13110
|
-
var ClineRuleFrontmatterSchema =
|
|
13111
|
-
description:
|
|
13502
|
+
var import_node_path99 = require("path");
|
|
13503
|
+
var import_mini52 = require("zod/mini");
|
|
13504
|
+
var ClineRuleFrontmatterSchema = import_mini52.z.object({
|
|
13505
|
+
description: import_mini52.z.string()
|
|
13112
13506
|
});
|
|
13113
13507
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
13114
13508
|
static getSettablePaths(_options = {}) {
|
|
@@ -13151,7 +13545,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13151
13545
|
validate = true
|
|
13152
13546
|
}) {
|
|
13153
13547
|
const fileContent = await readFileContent(
|
|
13154
|
-
(0,
|
|
13548
|
+
(0, import_node_path99.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13155
13549
|
);
|
|
13156
13550
|
return new _ClineRule({
|
|
13157
13551
|
baseDir,
|
|
@@ -13177,7 +13571,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13177
13571
|
};
|
|
13178
13572
|
|
|
13179
13573
|
// src/features/rules/codexcli-rule.ts
|
|
13180
|
-
var
|
|
13574
|
+
var import_node_path100 = require("path");
|
|
13181
13575
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
13182
13576
|
static getSettablePaths({
|
|
13183
13577
|
global,
|
|
@@ -13212,7 +13606,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13212
13606
|
if (isRoot) {
|
|
13213
13607
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13214
13608
|
const fileContent2 = await readFileContent(
|
|
13215
|
-
(0,
|
|
13609
|
+
(0, import_node_path100.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13216
13610
|
);
|
|
13217
13611
|
return new _CodexcliRule({
|
|
13218
13612
|
baseDir,
|
|
@@ -13226,8 +13620,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13226
13620
|
if (!paths.nonRoot) {
|
|
13227
13621
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13228
13622
|
}
|
|
13229
|
-
const relativePath = (0,
|
|
13230
|
-
const fileContent = await readFileContent((0,
|
|
13623
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13624
|
+
const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
|
|
13231
13625
|
return new _CodexcliRule({
|
|
13232
13626
|
baseDir,
|
|
13233
13627
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13286,12 +13680,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13286
13680
|
};
|
|
13287
13681
|
|
|
13288
13682
|
// src/features/rules/copilot-rule.ts
|
|
13289
|
-
var
|
|
13290
|
-
var
|
|
13291
|
-
var CopilotRuleFrontmatterSchema =
|
|
13292
|
-
description:
|
|
13293
|
-
applyTo:
|
|
13294
|
-
excludeAgent:
|
|
13683
|
+
var import_node_path101 = require("path");
|
|
13684
|
+
var import_mini53 = require("zod/mini");
|
|
13685
|
+
var CopilotRuleFrontmatterSchema = import_mini53.z.object({
|
|
13686
|
+
description: import_mini53.z.optional(import_mini53.z.string()),
|
|
13687
|
+
applyTo: import_mini53.z.optional(import_mini53.z.string()),
|
|
13688
|
+
excludeAgent: import_mini53.z.optional(import_mini53.z.union([import_mini53.z.literal("code-review"), import_mini53.z.literal("coding-agent")]))
|
|
13295
13689
|
});
|
|
13296
13690
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
13297
13691
|
frontmatter;
|
|
@@ -13302,6 +13696,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13302
13696
|
root: {
|
|
13303
13697
|
relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
|
|
13304
13698
|
relativeFilePath: "copilot-instructions.md"
|
|
13699
|
+
},
|
|
13700
|
+
nonRoot: {
|
|
13701
|
+
relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
|
|
13305
13702
|
}
|
|
13306
13703
|
};
|
|
13307
13704
|
}
|
|
@@ -13320,7 +13717,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13320
13717
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13321
13718
|
if (!result.success) {
|
|
13322
13719
|
throw new Error(
|
|
13323
|
-
`Invalid frontmatter in ${(0,
|
|
13720
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13324
13721
|
);
|
|
13325
13722
|
}
|
|
13326
13723
|
}
|
|
@@ -13410,8 +13807,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13410
13807
|
const paths = this.getSettablePaths({ global });
|
|
13411
13808
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13412
13809
|
if (isRoot) {
|
|
13413
|
-
const relativePath2 = (0,
|
|
13414
|
-
const filePath2 = (0,
|
|
13810
|
+
const relativePath2 = (0, import_node_path101.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13811
|
+
const filePath2 = (0, import_node_path101.join)(baseDir, relativePath2);
|
|
13415
13812
|
const fileContent2 = await readFileContent(filePath2);
|
|
13416
13813
|
return new _CopilotRule({
|
|
13417
13814
|
baseDir,
|
|
@@ -13426,8 +13823,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13426
13823
|
if (!paths.nonRoot) {
|
|
13427
13824
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13428
13825
|
}
|
|
13429
|
-
const relativePath = (0,
|
|
13430
|
-
const filePath = (0,
|
|
13826
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13827
|
+
const filePath = (0, import_node_path101.join)(baseDir, relativePath);
|
|
13431
13828
|
const fileContent = await readFileContent(filePath);
|
|
13432
13829
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13433
13830
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13473,7 +13870,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13473
13870
|
return {
|
|
13474
13871
|
success: false,
|
|
13475
13872
|
error: new Error(
|
|
13476
|
-
`Invalid frontmatter in ${(0,
|
|
13873
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13477
13874
|
)
|
|
13478
13875
|
};
|
|
13479
13876
|
}
|
|
@@ -13493,12 +13890,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13493
13890
|
};
|
|
13494
13891
|
|
|
13495
13892
|
// src/features/rules/cursor-rule.ts
|
|
13496
|
-
var
|
|
13497
|
-
var
|
|
13498
|
-
var CursorRuleFrontmatterSchema =
|
|
13499
|
-
description:
|
|
13500
|
-
globs:
|
|
13501
|
-
alwaysApply:
|
|
13893
|
+
var import_node_path102 = require("path");
|
|
13894
|
+
var import_mini54 = require("zod/mini");
|
|
13895
|
+
var CursorRuleFrontmatterSchema = import_mini54.z.object({
|
|
13896
|
+
description: import_mini54.z.optional(import_mini54.z.string()),
|
|
13897
|
+
globs: import_mini54.z.optional(import_mini54.z.string()),
|
|
13898
|
+
alwaysApply: import_mini54.z.optional(import_mini54.z.boolean())
|
|
13502
13899
|
});
|
|
13503
13900
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13504
13901
|
frontmatter;
|
|
@@ -13515,7 +13912,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13515
13912
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13516
13913
|
if (!result.success) {
|
|
13517
13914
|
throw new Error(
|
|
13518
|
-
`Invalid frontmatter in ${(0,
|
|
13915
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13519
13916
|
);
|
|
13520
13917
|
}
|
|
13521
13918
|
}
|
|
@@ -13631,7 +14028,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13631
14028
|
relativeFilePath,
|
|
13632
14029
|
validate = true
|
|
13633
14030
|
}) {
|
|
13634
|
-
const filePath = (0,
|
|
14031
|
+
const filePath = (0, import_node_path102.join)(
|
|
13635
14032
|
baseDir,
|
|
13636
14033
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13637
14034
|
relativeFilePath
|
|
@@ -13641,7 +14038,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13641
14038
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13642
14039
|
if (!result.success) {
|
|
13643
14040
|
throw new Error(
|
|
13644
|
-
`Invalid frontmatter in ${(0,
|
|
14041
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13645
14042
|
);
|
|
13646
14043
|
}
|
|
13647
14044
|
return new _CursorRule({
|
|
@@ -13678,7 +14075,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13678
14075
|
return {
|
|
13679
14076
|
success: false,
|
|
13680
14077
|
error: new Error(
|
|
13681
|
-
`Invalid frontmatter in ${(0,
|
|
14078
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13682
14079
|
)
|
|
13683
14080
|
};
|
|
13684
14081
|
}
|
|
@@ -13698,7 +14095,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13698
14095
|
};
|
|
13699
14096
|
|
|
13700
14097
|
// src/features/rules/factorydroid-rule.ts
|
|
13701
|
-
var
|
|
14098
|
+
var import_node_path103 = require("path");
|
|
13702
14099
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13703
14100
|
constructor({ fileContent, root, ...rest }) {
|
|
13704
14101
|
super({
|
|
@@ -13738,8 +14135,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13738
14135
|
const paths = this.getSettablePaths({ global });
|
|
13739
14136
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13740
14137
|
if (isRoot) {
|
|
13741
|
-
const relativePath2 = (0,
|
|
13742
|
-
const fileContent2 = await readFileContent((0,
|
|
14138
|
+
const relativePath2 = (0, import_node_path103.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14139
|
+
const fileContent2 = await readFileContent((0, import_node_path103.join)(baseDir, relativePath2));
|
|
13743
14140
|
return new _FactorydroidRule({
|
|
13744
14141
|
baseDir,
|
|
13745
14142
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -13752,8 +14149,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13752
14149
|
if (!paths.nonRoot) {
|
|
13753
14150
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13754
14151
|
}
|
|
13755
|
-
const relativePath = (0,
|
|
13756
|
-
const fileContent = await readFileContent((0,
|
|
14152
|
+
const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14153
|
+
const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
|
|
13757
14154
|
return new _FactorydroidRule({
|
|
13758
14155
|
baseDir,
|
|
13759
14156
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13812,7 +14209,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13812
14209
|
};
|
|
13813
14210
|
|
|
13814
14211
|
// src/features/rules/geminicli-rule.ts
|
|
13815
|
-
var
|
|
14212
|
+
var import_node_path104 = require("path");
|
|
13816
14213
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
13817
14214
|
static getSettablePaths({
|
|
13818
14215
|
global,
|
|
@@ -13847,7 +14244,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13847
14244
|
if (isRoot) {
|
|
13848
14245
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13849
14246
|
const fileContent2 = await readFileContent(
|
|
13850
|
-
(0,
|
|
14247
|
+
(0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13851
14248
|
);
|
|
13852
14249
|
return new _GeminiCliRule({
|
|
13853
14250
|
baseDir,
|
|
@@ -13861,8 +14258,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13861
14258
|
if (!paths.nonRoot) {
|
|
13862
14259
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13863
14260
|
}
|
|
13864
|
-
const relativePath = (0,
|
|
13865
|
-
const fileContent = await readFileContent((0,
|
|
14261
|
+
const relativePath = (0, import_node_path104.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14262
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
13866
14263
|
return new _GeminiCliRule({
|
|
13867
14264
|
baseDir,
|
|
13868
14265
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13921,7 +14318,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13921
14318
|
};
|
|
13922
14319
|
|
|
13923
14320
|
// src/features/rules/goose-rule.ts
|
|
13924
|
-
var
|
|
14321
|
+
var import_node_path105 = require("path");
|
|
13925
14322
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
13926
14323
|
static getSettablePaths({
|
|
13927
14324
|
global,
|
|
@@ -13956,7 +14353,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13956
14353
|
if (isRoot) {
|
|
13957
14354
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13958
14355
|
const fileContent2 = await readFileContent(
|
|
13959
|
-
(0,
|
|
14356
|
+
(0, import_node_path105.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13960
14357
|
);
|
|
13961
14358
|
return new _GooseRule({
|
|
13962
14359
|
baseDir,
|
|
@@ -13970,8 +14367,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13970
14367
|
if (!paths.nonRoot) {
|
|
13971
14368
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13972
14369
|
}
|
|
13973
|
-
const relativePath = (0,
|
|
13974
|
-
const fileContent = await readFileContent((0,
|
|
14370
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14371
|
+
const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
|
|
13975
14372
|
return new _GooseRule({
|
|
13976
14373
|
baseDir,
|
|
13977
14374
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14030,7 +14427,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14030
14427
|
};
|
|
14031
14428
|
|
|
14032
14429
|
// src/features/rules/junie-rule.ts
|
|
14033
|
-
var
|
|
14430
|
+
var import_node_path106 = require("path");
|
|
14034
14431
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
14035
14432
|
static getSettablePaths(_options = {}) {
|
|
14036
14433
|
return {
|
|
@@ -14049,8 +14446,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14049
14446
|
validate = true
|
|
14050
14447
|
}) {
|
|
14051
14448
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
14052
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
14053
|
-
const fileContent = await readFileContent((0,
|
|
14449
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path106.join)(".junie", "memories", relativeFilePath);
|
|
14450
|
+
const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
|
|
14054
14451
|
return new _JunieRule({
|
|
14055
14452
|
baseDir,
|
|
14056
14453
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14105,7 +14502,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14105
14502
|
};
|
|
14106
14503
|
|
|
14107
14504
|
// src/features/rules/kilo-rule.ts
|
|
14108
|
-
var
|
|
14505
|
+
var import_node_path107 = require("path");
|
|
14109
14506
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
14110
14507
|
static getSettablePaths(_options = {}) {
|
|
14111
14508
|
return {
|
|
@@ -14120,7 +14517,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14120
14517
|
validate = true
|
|
14121
14518
|
}) {
|
|
14122
14519
|
const fileContent = await readFileContent(
|
|
14123
|
-
(0,
|
|
14520
|
+
(0, import_node_path107.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14124
14521
|
);
|
|
14125
14522
|
return new _KiloRule({
|
|
14126
14523
|
baseDir,
|
|
@@ -14172,7 +14569,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14172
14569
|
};
|
|
14173
14570
|
|
|
14174
14571
|
// src/features/rules/kiro-rule.ts
|
|
14175
|
-
var
|
|
14572
|
+
var import_node_path108 = require("path");
|
|
14176
14573
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
14177
14574
|
static getSettablePaths(_options = {}) {
|
|
14178
14575
|
return {
|
|
@@ -14187,7 +14584,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14187
14584
|
validate = true
|
|
14188
14585
|
}) {
|
|
14189
14586
|
const fileContent = await readFileContent(
|
|
14190
|
-
(0,
|
|
14587
|
+
(0, import_node_path108.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14191
14588
|
);
|
|
14192
14589
|
return new _KiroRule({
|
|
14193
14590
|
baseDir,
|
|
@@ -14241,7 +14638,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14241
14638
|
};
|
|
14242
14639
|
|
|
14243
14640
|
// src/features/rules/opencode-rule.ts
|
|
14244
|
-
var
|
|
14641
|
+
var import_node_path109 = require("path");
|
|
14245
14642
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
14246
14643
|
static getSettablePaths({
|
|
14247
14644
|
global,
|
|
@@ -14276,7 +14673,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14276
14673
|
if (isRoot) {
|
|
14277
14674
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14278
14675
|
const fileContent2 = await readFileContent(
|
|
14279
|
-
(0,
|
|
14676
|
+
(0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14280
14677
|
);
|
|
14281
14678
|
return new _OpenCodeRule({
|
|
14282
14679
|
baseDir,
|
|
@@ -14290,8 +14687,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14290
14687
|
if (!paths.nonRoot) {
|
|
14291
14688
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14292
14689
|
}
|
|
14293
|
-
const relativePath = (0,
|
|
14294
|
-
const fileContent = await readFileContent((0,
|
|
14690
|
+
const relativePath = (0, import_node_path109.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14691
|
+
const fileContent = await readFileContent((0, import_node_path109.join)(baseDir, relativePath));
|
|
14295
14692
|
return new _OpenCodeRule({
|
|
14296
14693
|
baseDir,
|
|
14297
14694
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14350,7 +14747,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14350
14747
|
};
|
|
14351
14748
|
|
|
14352
14749
|
// src/features/rules/qwencode-rule.ts
|
|
14353
|
-
var
|
|
14750
|
+
var import_node_path110 = require("path");
|
|
14354
14751
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
14355
14752
|
static getSettablePaths(_options = {}) {
|
|
14356
14753
|
return {
|
|
@@ -14369,8 +14766,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14369
14766
|
validate = true
|
|
14370
14767
|
}) {
|
|
14371
14768
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
14372
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
14373
|
-
const fileContent = await readFileContent((0,
|
|
14769
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path110.join)(".qwen", "memories", relativeFilePath);
|
|
14770
|
+
const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
|
|
14374
14771
|
return new _QwencodeRule({
|
|
14375
14772
|
baseDir,
|
|
14376
14773
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14422,7 +14819,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14422
14819
|
};
|
|
14423
14820
|
|
|
14424
14821
|
// src/features/rules/replit-rule.ts
|
|
14425
|
-
var
|
|
14822
|
+
var import_node_path111 = require("path");
|
|
14426
14823
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
14427
14824
|
static getSettablePaths(_options = {}) {
|
|
14428
14825
|
return {
|
|
@@ -14444,7 +14841,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14444
14841
|
}
|
|
14445
14842
|
const relativePath = paths.root.relativeFilePath;
|
|
14446
14843
|
const fileContent = await readFileContent(
|
|
14447
|
-
(0,
|
|
14844
|
+
(0, import_node_path111.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
14448
14845
|
);
|
|
14449
14846
|
return new _ReplitRule({
|
|
14450
14847
|
baseDir,
|
|
@@ -14510,7 +14907,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14510
14907
|
};
|
|
14511
14908
|
|
|
14512
14909
|
// src/features/rules/roo-rule.ts
|
|
14513
|
-
var
|
|
14910
|
+
var import_node_path112 = require("path");
|
|
14514
14911
|
var RooRule = class _RooRule extends ToolRule {
|
|
14515
14912
|
static getSettablePaths(_options = {}) {
|
|
14516
14913
|
return {
|
|
@@ -14525,7 +14922,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14525
14922
|
validate = true
|
|
14526
14923
|
}) {
|
|
14527
14924
|
const fileContent = await readFileContent(
|
|
14528
|
-
(0,
|
|
14925
|
+
(0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14529
14926
|
);
|
|
14530
14927
|
return new _RooRule({
|
|
14531
14928
|
baseDir,
|
|
@@ -14594,7 +14991,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14594
14991
|
};
|
|
14595
14992
|
|
|
14596
14993
|
// src/features/rules/warp-rule.ts
|
|
14597
|
-
var
|
|
14994
|
+
var import_node_path113 = require("path");
|
|
14598
14995
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14599
14996
|
constructor({ fileContent, root, ...rest }) {
|
|
14600
14997
|
super({
|
|
@@ -14620,8 +15017,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14620
15017
|
validate = true
|
|
14621
15018
|
}) {
|
|
14622
15019
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14623
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
14624
|
-
const fileContent = await readFileContent((0,
|
|
15020
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path113.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15021
|
+
const fileContent = await readFileContent((0, import_node_path113.join)(baseDir, relativePath));
|
|
14625
15022
|
return new _WarpRule({
|
|
14626
15023
|
baseDir,
|
|
14627
15024
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14676,7 +15073,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14676
15073
|
};
|
|
14677
15074
|
|
|
14678
15075
|
// src/features/rules/windsurf-rule.ts
|
|
14679
|
-
var
|
|
15076
|
+
var import_node_path114 = require("path");
|
|
14680
15077
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14681
15078
|
static getSettablePaths(_options = {}) {
|
|
14682
15079
|
return {
|
|
@@ -14691,7 +15088,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14691
15088
|
validate = true
|
|
14692
15089
|
}) {
|
|
14693
15090
|
const fileContent = await readFileContent(
|
|
14694
|
-
(0,
|
|
15091
|
+
(0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14695
15092
|
);
|
|
14696
15093
|
return new _WindsurfRule({
|
|
14697
15094
|
baseDir,
|
|
@@ -14767,8 +15164,8 @@ var rulesProcessorToolTargets = [
|
|
|
14767
15164
|
"warp",
|
|
14768
15165
|
"windsurf"
|
|
14769
15166
|
];
|
|
14770
|
-
var RulesProcessorToolTargetSchema =
|
|
14771
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15167
|
+
var RulesProcessorToolTargetSchema = import_mini55.z.enum(rulesProcessorToolTargets);
|
|
15168
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path115.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
14772
15169
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
14773
15170
|
[
|
|
14774
15171
|
"agentsmd",
|
|
@@ -15143,7 +15540,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15143
15540
|
}).relativeDirPath;
|
|
15144
15541
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
15145
15542
|
const frontmatter = skill.getFrontmatter();
|
|
15146
|
-
const relativePath = (0,
|
|
15543
|
+
const relativePath = (0, import_node_path115.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
15147
15544
|
return {
|
|
15148
15545
|
name: frontmatter.name,
|
|
15149
15546
|
description: frontmatter.description,
|
|
@@ -15256,12 +15653,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15256
15653
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
15257
15654
|
*/
|
|
15258
15655
|
async loadRulesyncFiles() {
|
|
15259
|
-
const rulesyncBaseDir = (0,
|
|
15260
|
-
const files = await findFilesByGlobs((0,
|
|
15656
|
+
const rulesyncBaseDir = (0, import_node_path115.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15657
|
+
const files = await findFilesByGlobs((0, import_node_path115.join)(rulesyncBaseDir, "**", "*.md"));
|
|
15261
15658
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
15262
15659
|
const rulesyncRules = await Promise.all(
|
|
15263
15660
|
files.map((file) => {
|
|
15264
|
-
const relativeFilePath = (0,
|
|
15661
|
+
const relativeFilePath = (0, import_node_path115.relative)(rulesyncBaseDir, file);
|
|
15265
15662
|
checkPathTraversal({
|
|
15266
15663
|
relativePath: relativeFilePath,
|
|
15267
15664
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -15271,41 +15668,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15271
15668
|
});
|
|
15272
15669
|
})
|
|
15273
15670
|
);
|
|
15671
|
+
const factory = this.getFactory(this.toolTarget);
|
|
15274
15672
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
15275
|
-
|
|
15276
|
-
|
|
15673
|
+
const targetedRootRules = rootRules.filter(
|
|
15674
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15675
|
+
);
|
|
15676
|
+
if (targetedRootRules.length > 1) {
|
|
15677
|
+
throw new Error(
|
|
15678
|
+
`Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
|
|
15679
|
+
);
|
|
15277
15680
|
}
|
|
15278
|
-
if (
|
|
15681
|
+
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
15279
15682
|
logger.warn(
|
|
15280
|
-
`No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15683
|
+
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15281
15684
|
);
|
|
15282
15685
|
}
|
|
15283
15686
|
const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
|
|
15284
|
-
|
|
15687
|
+
const targetedLocalRootRules = localRootRules.filter(
|
|
15688
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15689
|
+
);
|
|
15690
|
+
if (targetedLocalRootRules.length > 1) {
|
|
15285
15691
|
throw new Error(
|
|
15286
|
-
`Multiple localRoot rules found: ${formatRulePaths(
|
|
15692
|
+
`Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
|
|
15287
15693
|
);
|
|
15288
15694
|
}
|
|
15289
|
-
if (
|
|
15695
|
+
if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
|
|
15290
15696
|
throw new Error(
|
|
15291
|
-
`localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(
|
|
15697
|
+
`localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
|
|
15292
15698
|
);
|
|
15293
15699
|
}
|
|
15294
15700
|
if (this.global) {
|
|
15295
|
-
const
|
|
15296
|
-
|
|
15701
|
+
const globalPaths = factory.class.getSettablePaths({ global: true });
|
|
15702
|
+
const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
|
|
15703
|
+
const nonRootRules2 = rulesyncRules.filter(
|
|
15704
|
+
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
15705
|
+
);
|
|
15706
|
+
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
15297
15707
|
logger.warn(
|
|
15298
|
-
`${
|
|
15708
|
+
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
15299
15709
|
);
|
|
15300
15710
|
}
|
|
15301
|
-
if (
|
|
15711
|
+
if (targetedLocalRootRules.length > 0) {
|
|
15302
15712
|
logger.warn(
|
|
15303
|
-
`${
|
|
15713
|
+
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
15304
15714
|
);
|
|
15305
15715
|
}
|
|
15306
|
-
return
|
|
15716
|
+
return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
|
|
15307
15717
|
}
|
|
15308
|
-
|
|
15718
|
+
const nonRootRules = rulesyncRules.filter(
|
|
15719
|
+
(rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
|
|
15720
|
+
);
|
|
15721
|
+
return [...targetedRootRules, ...nonRootRules];
|
|
15309
15722
|
}
|
|
15310
15723
|
/**
|
|
15311
15724
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -15320,7 +15733,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15320
15733
|
global: this.global
|
|
15321
15734
|
});
|
|
15322
15735
|
const resolveRelativeDirPath = (filePath) => {
|
|
15323
|
-
const dirName = (0,
|
|
15736
|
+
const dirName = (0, import_node_path115.dirname)((0, import_node_path115.relative)(this.baseDir, filePath));
|
|
15324
15737
|
return dirName === "" ? "." : dirName;
|
|
15325
15738
|
};
|
|
15326
15739
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -15338,13 +15751,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15338
15751
|
return [];
|
|
15339
15752
|
}
|
|
15340
15753
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
15341
|
-
(0,
|
|
15754
|
+
(0, import_node_path115.join)(
|
|
15342
15755
|
this.baseDir,
|
|
15343
15756
|
settablePaths.root.relativeDirPath ?? ".",
|
|
15344
15757
|
settablePaths.root.relativeFilePath
|
|
15345
15758
|
),
|
|
15346
15759
|
settablePaths.alternativeRoots,
|
|
15347
|
-
(alt) => (0,
|
|
15760
|
+
(alt) => (0, import_node_path115.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
15348
15761
|
);
|
|
15349
15762
|
if (forDeletion) {
|
|
15350
15763
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -15356,7 +15769,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15356
15769
|
return factory.class.forDeletion({
|
|
15357
15770
|
baseDir: this.baseDir,
|
|
15358
15771
|
relativeDirPath,
|
|
15359
|
-
relativeFilePath: (0,
|
|
15772
|
+
relativeFilePath: (0, import_node_path115.basename)(filePath),
|
|
15360
15773
|
global: this.global
|
|
15361
15774
|
});
|
|
15362
15775
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15370,7 +15783,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15370
15783
|
});
|
|
15371
15784
|
return factory.class.fromFile({
|
|
15372
15785
|
baseDir: this.baseDir,
|
|
15373
|
-
relativeFilePath: (0,
|
|
15786
|
+
relativeFilePath: (0, import_node_path115.basename)(filePath),
|
|
15374
15787
|
relativeDirPath,
|
|
15375
15788
|
global: this.global
|
|
15376
15789
|
});
|
|
@@ -15389,9 +15802,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15389
15802
|
return [];
|
|
15390
15803
|
}
|
|
15391
15804
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
15392
|
-
(0,
|
|
15805
|
+
(0, import_node_path115.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
15393
15806
|
settablePaths.alternativeRoots,
|
|
15394
|
-
(alt) => (0,
|
|
15807
|
+
(alt) => (0, import_node_path115.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
15395
15808
|
);
|
|
15396
15809
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
15397
15810
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -15402,7 +15815,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15402
15815
|
return factory.class.forDeletion({
|
|
15403
15816
|
baseDir: this.baseDir,
|
|
15404
15817
|
relativeDirPath,
|
|
15405
|
-
relativeFilePath: (0,
|
|
15818
|
+
relativeFilePath: (0, import_node_path115.basename)(filePath),
|
|
15406
15819
|
global: this.global
|
|
15407
15820
|
});
|
|
15408
15821
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -15412,13 +15825,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15412
15825
|
if (!settablePaths.nonRoot) {
|
|
15413
15826
|
return [];
|
|
15414
15827
|
}
|
|
15415
|
-
const nonRootBaseDir = (0,
|
|
15828
|
+
const nonRootBaseDir = (0, import_node_path115.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
15416
15829
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
15417
|
-
(0,
|
|
15830
|
+
(0, import_node_path115.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
15418
15831
|
);
|
|
15419
15832
|
if (forDeletion) {
|
|
15420
15833
|
return nonRootFilePaths.map((filePath) => {
|
|
15421
|
-
const relativeFilePath = (0,
|
|
15834
|
+
const relativeFilePath = (0, import_node_path115.relative)(nonRootBaseDir, filePath);
|
|
15422
15835
|
checkPathTraversal({
|
|
15423
15836
|
relativePath: relativeFilePath,
|
|
15424
15837
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15433,7 +15846,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15433
15846
|
}
|
|
15434
15847
|
return await Promise.all(
|
|
15435
15848
|
nonRootFilePaths.map((filePath) => {
|
|
15436
|
-
const relativeFilePath = (0,
|
|
15849
|
+
const relativeFilePath = (0, import_node_path115.relative)(nonRootBaseDir, filePath);
|
|
15437
15850
|
checkPathTraversal({
|
|
15438
15851
|
relativePath: relativeFilePath,
|
|
15439
15852
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15546,14 +15959,14 @@ s/<command> [arguments]
|
|
|
15546
15959
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15547
15960
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15548
15961
|
|
|
15549
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
15962
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path115.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15550
15963
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15551
15964
|
|
|
15552
15965
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
15553
15966
|
|
|
15554
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
15967
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path115.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15555
15968
|
|
|
15556
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
15969
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path115.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15557
15970
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15558
15971
|
const result = [
|
|
15559
15972
|
overview,
|
|
@@ -15585,51 +15998,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
15585
15998
|
var import_rest = require("@octokit/rest");
|
|
15586
15999
|
|
|
15587
16000
|
// src/types/fetch.ts
|
|
15588
|
-
var
|
|
16001
|
+
var import_mini57 = require("zod/mini");
|
|
15589
16002
|
|
|
15590
16003
|
// src/types/fetch-targets.ts
|
|
15591
|
-
var
|
|
16004
|
+
var import_mini56 = require("zod/mini");
|
|
15592
16005
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
15593
|
-
var FetchTargetSchema =
|
|
16006
|
+
var FetchTargetSchema = import_mini56.z.enum(ALL_FETCH_TARGETS);
|
|
15594
16007
|
|
|
15595
16008
|
// src/types/fetch.ts
|
|
15596
|
-
var ConflictStrategySchema =
|
|
15597
|
-
var GitHubFileTypeSchema =
|
|
15598
|
-
var GitHubFileEntrySchema =
|
|
15599
|
-
name:
|
|
15600
|
-
path:
|
|
15601
|
-
sha:
|
|
15602
|
-
size:
|
|
16009
|
+
var ConflictStrategySchema = import_mini57.z.enum(["skip", "overwrite"]);
|
|
16010
|
+
var GitHubFileTypeSchema = import_mini57.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
16011
|
+
var GitHubFileEntrySchema = import_mini57.z.looseObject({
|
|
16012
|
+
name: import_mini57.z.string(),
|
|
16013
|
+
path: import_mini57.z.string(),
|
|
16014
|
+
sha: import_mini57.z.string(),
|
|
16015
|
+
size: import_mini57.z.number(),
|
|
15603
16016
|
type: GitHubFileTypeSchema,
|
|
15604
|
-
download_url:
|
|
16017
|
+
download_url: import_mini57.z.nullable(import_mini57.z.string())
|
|
15605
16018
|
});
|
|
15606
|
-
var FetchOptionsSchema =
|
|
15607
|
-
target:
|
|
15608
|
-
features:
|
|
15609
|
-
ref:
|
|
15610
|
-
path:
|
|
15611
|
-
output:
|
|
15612
|
-
conflict:
|
|
15613
|
-
token:
|
|
15614
|
-
verbose:
|
|
15615
|
-
silent:
|
|
16019
|
+
var FetchOptionsSchema = import_mini57.z.looseObject({
|
|
16020
|
+
target: import_mini57.z.optional(FetchTargetSchema),
|
|
16021
|
+
features: import_mini57.z.optional(import_mini57.z.array(import_mini57.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
16022
|
+
ref: import_mini57.z.optional(import_mini57.z.string()),
|
|
16023
|
+
path: import_mini57.z.optional(import_mini57.z.string()),
|
|
16024
|
+
output: import_mini57.z.optional(import_mini57.z.string()),
|
|
16025
|
+
conflict: import_mini57.z.optional(ConflictStrategySchema),
|
|
16026
|
+
token: import_mini57.z.optional(import_mini57.z.string()),
|
|
16027
|
+
verbose: import_mini57.z.optional(import_mini57.z.boolean()),
|
|
16028
|
+
silent: import_mini57.z.optional(import_mini57.z.boolean())
|
|
15616
16029
|
});
|
|
15617
|
-
var FetchFileStatusSchema =
|
|
15618
|
-
var GitHubRepoInfoSchema =
|
|
15619
|
-
default_branch:
|
|
15620
|
-
private:
|
|
16030
|
+
var FetchFileStatusSchema = import_mini57.z.enum(["created", "overwritten", "skipped"]);
|
|
16031
|
+
var GitHubRepoInfoSchema = import_mini57.z.looseObject({
|
|
16032
|
+
default_branch: import_mini57.z.string(),
|
|
16033
|
+
private: import_mini57.z.boolean()
|
|
15621
16034
|
});
|
|
15622
|
-
var GitHubReleaseAssetSchema =
|
|
15623
|
-
name:
|
|
15624
|
-
browser_download_url:
|
|
15625
|
-
size:
|
|
16035
|
+
var GitHubReleaseAssetSchema = import_mini57.z.looseObject({
|
|
16036
|
+
name: import_mini57.z.string(),
|
|
16037
|
+
browser_download_url: import_mini57.z.string(),
|
|
16038
|
+
size: import_mini57.z.number()
|
|
15626
16039
|
});
|
|
15627
|
-
var GitHubReleaseSchema =
|
|
15628
|
-
tag_name:
|
|
15629
|
-
name:
|
|
15630
|
-
prerelease:
|
|
15631
|
-
draft:
|
|
15632
|
-
assets:
|
|
16040
|
+
var GitHubReleaseSchema = import_mini57.z.looseObject({
|
|
16041
|
+
tag_name: import_mini57.z.string(),
|
|
16042
|
+
name: import_mini57.z.nullable(import_mini57.z.string()),
|
|
16043
|
+
prerelease: import_mini57.z.boolean(),
|
|
16044
|
+
draft: import_mini57.z.boolean(),
|
|
16045
|
+
assets: import_mini57.z.array(GitHubReleaseAssetSchema)
|
|
15633
16046
|
});
|
|
15634
16047
|
|
|
15635
16048
|
// src/lib/github-client.ts
|
|
@@ -15929,9 +16342,9 @@ async function listDirectoryRecursive(params) {
|
|
|
15929
16342
|
}
|
|
15930
16343
|
|
|
15931
16344
|
// src/types/git-provider.ts
|
|
15932
|
-
var
|
|
16345
|
+
var import_mini58 = require("zod/mini");
|
|
15933
16346
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
15934
|
-
var GitProviderSchema =
|
|
16347
|
+
var GitProviderSchema = import_mini58.z.enum(ALL_GIT_PROVIDERS);
|
|
15935
16348
|
|
|
15936
16349
|
// src/lib/source-parser.ts
|
|
15937
16350
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -16056,8 +16469,8 @@ async function processFeatureConversion(params) {
|
|
|
16056
16469
|
}
|
|
16057
16470
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
16058
16471
|
for (const file of rulesyncFiles) {
|
|
16059
|
-
const relativePath = (0,
|
|
16060
|
-
const outputPath = (0,
|
|
16472
|
+
const relativePath = (0, import_node_path116.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
16473
|
+
const outputPath = (0, import_node_path116.join)(outputDir, relativePath);
|
|
16061
16474
|
await writeFileContent(outputPath, file.getFileContent());
|
|
16062
16475
|
paths.push(relativePath);
|
|
16063
16476
|
}
|
|
@@ -16203,7 +16616,7 @@ async function fetchFiles(params) {
|
|
|
16203
16616
|
skipped: 0
|
|
16204
16617
|
};
|
|
16205
16618
|
}
|
|
16206
|
-
const outputBasePath = (0,
|
|
16619
|
+
const outputBasePath = (0, import_node_path116.join)(baseDir, outputDir);
|
|
16207
16620
|
for (const { relativePath, size } of filesToFetch) {
|
|
16208
16621
|
checkPathTraversal({
|
|
16209
16622
|
relativePath,
|
|
@@ -16213,7 +16626,7 @@ async function fetchFiles(params) {
|
|
|
16213
16626
|
}
|
|
16214
16627
|
const results = await Promise.all(
|
|
16215
16628
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
16216
|
-
const localPath = (0,
|
|
16629
|
+
const localPath = (0, import_node_path116.join)(outputBasePath, relativePath);
|
|
16217
16630
|
const exists = await fileExists(localPath);
|
|
16218
16631
|
if (exists && conflictStrategy === "skip") {
|
|
16219
16632
|
logger.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -16255,7 +16668,7 @@ async function collectFeatureFiles(params) {
|
|
|
16255
16668
|
);
|
|
16256
16669
|
const results = await Promise.all(
|
|
16257
16670
|
tasks.map(async ({ featurePath }) => {
|
|
16258
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath : (0,
|
|
16671
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path116.join)(basePath, featurePath);
|
|
16259
16672
|
const collected = [];
|
|
16260
16673
|
try {
|
|
16261
16674
|
if (featurePath.includes(".")) {
|
|
@@ -16355,7 +16768,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
16355
16768
|
relativePath: toolRelativePath,
|
|
16356
16769
|
intendedRootDir: tempDir
|
|
16357
16770
|
});
|
|
16358
|
-
const localPath = (0,
|
|
16771
|
+
const localPath = (0, import_node_path116.join)(tempDir, toolRelativePath);
|
|
16359
16772
|
const content = await withSemaphore(
|
|
16360
16773
|
semaphore,
|
|
16361
16774
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -16364,7 +16777,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
16364
16777
|
logger.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
16365
16778
|
})
|
|
16366
16779
|
);
|
|
16367
|
-
const outputBasePath = (0,
|
|
16780
|
+
const outputBasePath = (0, import_node_path116.join)(baseDir, outputDir);
|
|
16368
16781
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
16369
16782
|
tempDir,
|
|
16370
16783
|
outputDir: outputBasePath,
|
|
@@ -16437,7 +16850,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
16437
16850
|
if (relativePath.startsWith("rules/")) {
|
|
16438
16851
|
const restPath = relativePath.substring("rules/".length);
|
|
16439
16852
|
if (toolPaths.rules?.nonRoot) {
|
|
16440
|
-
return (0,
|
|
16853
|
+
return (0, import_node_path116.join)(toolPaths.rules.nonRoot, restPath);
|
|
16441
16854
|
}
|
|
16442
16855
|
}
|
|
16443
16856
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -16446,19 +16859,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
16446
16859
|
if (relativePath.startsWith("commands/")) {
|
|
16447
16860
|
const restPath = relativePath.substring("commands/".length);
|
|
16448
16861
|
if (toolPaths.commands) {
|
|
16449
|
-
return (0,
|
|
16862
|
+
return (0, import_node_path116.join)(toolPaths.commands, restPath);
|
|
16450
16863
|
}
|
|
16451
16864
|
}
|
|
16452
16865
|
if (relativePath.startsWith("subagents/")) {
|
|
16453
16866
|
const restPath = relativePath.substring("subagents/".length);
|
|
16454
16867
|
if (toolPaths.subagents) {
|
|
16455
|
-
return (0,
|
|
16868
|
+
return (0, import_node_path116.join)(toolPaths.subagents, restPath);
|
|
16456
16869
|
}
|
|
16457
16870
|
}
|
|
16458
16871
|
if (relativePath.startsWith("skills/")) {
|
|
16459
16872
|
const restPath = relativePath.substring("skills/".length);
|
|
16460
16873
|
if (toolPaths.skills) {
|
|
16461
|
-
return (0,
|
|
16874
|
+
return (0, import_node_path116.join)(toolPaths.skills, restPath);
|
|
16462
16875
|
}
|
|
16463
16876
|
}
|
|
16464
16877
|
return relativePath;
|
|
@@ -16510,38 +16923,60 @@ async function fetchCommand(options) {
|
|
|
16510
16923
|
}
|
|
16511
16924
|
|
|
16512
16925
|
// src/config/config-resolver.ts
|
|
16513
|
-
var
|
|
16926
|
+
var import_node_path118 = require("path");
|
|
16514
16927
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
16515
16928
|
|
|
16516
16929
|
// src/config/config.ts
|
|
16517
|
-
var
|
|
16518
|
-
var
|
|
16519
|
-
|
|
16520
|
-
|
|
16930
|
+
var import_node_path117 = require("path");
|
|
16931
|
+
var import_mini59 = require("zod/mini");
|
|
16932
|
+
function hasControlCharacters(value) {
|
|
16933
|
+
for (let i = 0; i < value.length; i++) {
|
|
16934
|
+
const code = value.charCodeAt(i);
|
|
16935
|
+
if (code >= 0 && code <= 31 || code === 127) return true;
|
|
16936
|
+
}
|
|
16937
|
+
return false;
|
|
16938
|
+
}
|
|
16939
|
+
var SourceEntrySchema = import_mini59.z.object({
|
|
16940
|
+
source: import_mini59.z.string().check((0, import_mini59.minLength)(1, "source must be a non-empty string")),
|
|
16941
|
+
skills: (0, import_mini59.optional)(import_mini59.z.array(import_mini59.z.string())),
|
|
16942
|
+
transport: (0, import_mini59.optional)(import_mini59.z.enum(["github", "git"])),
|
|
16943
|
+
ref: (0, import_mini59.optional)(
|
|
16944
|
+
import_mini59.z.string().check(
|
|
16945
|
+
(0, import_mini59.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
16946
|
+
(0, import_mini59.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
16947
|
+
)
|
|
16948
|
+
),
|
|
16949
|
+
path: (0, import_mini59.optional)(
|
|
16950
|
+
import_mini59.z.string().check(
|
|
16951
|
+
(0, import_mini59.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
16952
|
+
(0, import_mini59.refine)((v) => !(0, import_node_path117.isAbsolute)(v), "path must not be absolute"),
|
|
16953
|
+
(0, import_mini59.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
16954
|
+
)
|
|
16955
|
+
)
|
|
16521
16956
|
});
|
|
16522
|
-
var ConfigParamsSchema =
|
|
16523
|
-
baseDirs:
|
|
16957
|
+
var ConfigParamsSchema = import_mini59.z.object({
|
|
16958
|
+
baseDirs: import_mini59.z.array(import_mini59.z.string()),
|
|
16524
16959
|
targets: RulesyncTargetsSchema,
|
|
16525
16960
|
features: RulesyncFeaturesSchema,
|
|
16526
|
-
verbose:
|
|
16527
|
-
delete:
|
|
16961
|
+
verbose: import_mini59.z.boolean(),
|
|
16962
|
+
delete: import_mini59.z.boolean(),
|
|
16528
16963
|
// New non-experimental options
|
|
16529
|
-
global: (0,
|
|
16530
|
-
silent: (0,
|
|
16531
|
-
simulateCommands: (0,
|
|
16532
|
-
simulateSubagents: (0,
|
|
16533
|
-
simulateSkills: (0,
|
|
16534
|
-
dryRun: (0,
|
|
16535
|
-
check: (0,
|
|
16964
|
+
global: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16965
|
+
silent: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16966
|
+
simulateCommands: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16967
|
+
simulateSubagents: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16968
|
+
simulateSkills: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16969
|
+
dryRun: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16970
|
+
check: (0, import_mini59.optional)(import_mini59.z.boolean()),
|
|
16536
16971
|
// Declarative skill sources
|
|
16537
|
-
sources: (0,
|
|
16972
|
+
sources: (0, import_mini59.optional)(import_mini59.z.array(SourceEntrySchema))
|
|
16538
16973
|
});
|
|
16539
|
-
var PartialConfigParamsSchema =
|
|
16540
|
-
var ConfigFileSchema =
|
|
16541
|
-
$schema: (0,
|
|
16542
|
-
...
|
|
16974
|
+
var PartialConfigParamsSchema = import_mini59.z.partial(ConfigParamsSchema);
|
|
16975
|
+
var ConfigFileSchema = import_mini59.z.object({
|
|
16976
|
+
$schema: (0, import_mini59.optional)(import_mini59.z.string()),
|
|
16977
|
+
...import_mini59.z.partial(ConfigParamsSchema).shape
|
|
16543
16978
|
});
|
|
16544
|
-
var RequiredConfigParamsSchema =
|
|
16979
|
+
var RequiredConfigParamsSchema = import_mini59.z.required(ConfigParamsSchema);
|
|
16545
16980
|
var CONFLICTING_TARGET_PAIRS = [
|
|
16546
16981
|
["augmentcode", "augmentcode-legacy"],
|
|
16547
16982
|
["claudecode", "claudecode-legacy"]
|
|
@@ -16762,8 +17197,8 @@ var ConfigResolver = class {
|
|
|
16762
17197
|
}) {
|
|
16763
17198
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
16764
17199
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
16765
|
-
const configDir = (0,
|
|
16766
|
-
const localConfigPath = (0,
|
|
17200
|
+
const configDir = (0, import_node_path118.dirname)(validatedConfigPath);
|
|
17201
|
+
const localConfigPath = (0, import_node_path118.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
16767
17202
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
16768
17203
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
16769
17204
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -16798,7 +17233,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16798
17233
|
if (global) {
|
|
16799
17234
|
return [getHomeDirectory()];
|
|
16800
17235
|
}
|
|
16801
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
17236
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path118.resolve)(baseDir));
|
|
16802
17237
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
16803
17238
|
validateBaseDir(baseDir);
|
|
16804
17239
|
});
|
|
@@ -16806,7 +17241,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16806
17241
|
}
|
|
16807
17242
|
|
|
16808
17243
|
// src/lib/generate.ts
|
|
16809
|
-
var
|
|
17244
|
+
var import_node_path119 = require("path");
|
|
16810
17245
|
var import_es_toolkit4 = require("es-toolkit");
|
|
16811
17246
|
async function processFeatureGeneration(params) {
|
|
16812
17247
|
const { config, processor, toolFiles } = params;
|
|
@@ -16860,7 +17295,7 @@ function warnUnsupportedTargets(params) {
|
|
|
16860
17295
|
}
|
|
16861
17296
|
}
|
|
16862
17297
|
async function checkRulesyncDirExists(params) {
|
|
16863
|
-
return fileExists((0,
|
|
17298
|
+
return fileExists((0, import_node_path119.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16864
17299
|
}
|
|
16865
17300
|
async function generate(params) {
|
|
16866
17301
|
const { config } = params;
|
|
@@ -17318,7 +17753,7 @@ async function generateCommand(options) {
|
|
|
17318
17753
|
}
|
|
17319
17754
|
|
|
17320
17755
|
// src/cli/commands/gitignore.ts
|
|
17321
|
-
var
|
|
17756
|
+
var import_node_path120 = require("path");
|
|
17322
17757
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
17323
17758
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
17324
17759
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -17386,6 +17821,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
17386
17821
|
// Junie
|
|
17387
17822
|
"**/.junie/guidelines.md",
|
|
17388
17823
|
"**/.junie/mcp.json",
|
|
17824
|
+
"**/.junie/skills/",
|
|
17825
|
+
"**/.junie/agents/",
|
|
17389
17826
|
// Kilo Code
|
|
17390
17827
|
"**/.kilocode/rules/",
|
|
17391
17828
|
"**/.kilocode/skills/",
|
|
@@ -17474,7 +17911,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
17474
17911
|
return result;
|
|
17475
17912
|
};
|
|
17476
17913
|
var gitignoreCommand = async () => {
|
|
17477
|
-
const gitignorePath = (0,
|
|
17914
|
+
const gitignorePath = (0, import_node_path120.join)(process.cwd(), ".gitignore");
|
|
17478
17915
|
let gitignoreContent = "";
|
|
17479
17916
|
if (await fileExists(gitignorePath)) {
|
|
17480
17917
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -17761,7 +18198,7 @@ async function importCommand(options) {
|
|
|
17761
18198
|
}
|
|
17762
18199
|
|
|
17763
18200
|
// src/lib/init.ts
|
|
17764
|
-
var
|
|
18201
|
+
var import_node_path121 = require("path");
|
|
17765
18202
|
async function init() {
|
|
17766
18203
|
const sampleFiles = await createSampleFiles();
|
|
17767
18204
|
const configFile = await createConfigFile();
|
|
@@ -17951,27 +18388,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
17951
18388
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
17952
18389
|
await ensureDir(skillPaths.relativeDirPath);
|
|
17953
18390
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
17954
|
-
const ruleFilepath = (0,
|
|
18391
|
+
const ruleFilepath = (0, import_node_path121.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
17955
18392
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
17956
|
-
const mcpFilepath = (0,
|
|
18393
|
+
const mcpFilepath = (0, import_node_path121.join)(
|
|
17957
18394
|
mcpPaths.recommended.relativeDirPath,
|
|
17958
18395
|
mcpPaths.recommended.relativeFilePath
|
|
17959
18396
|
);
|
|
17960
18397
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
17961
|
-
const commandFilepath = (0,
|
|
18398
|
+
const commandFilepath = (0, import_node_path121.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
17962
18399
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
17963
|
-
const subagentFilepath = (0,
|
|
18400
|
+
const subagentFilepath = (0, import_node_path121.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
17964
18401
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
17965
|
-
const skillDirPath = (0,
|
|
18402
|
+
const skillDirPath = (0, import_node_path121.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
17966
18403
|
await ensureDir(skillDirPath);
|
|
17967
|
-
const skillFilepath = (0,
|
|
18404
|
+
const skillFilepath = (0, import_node_path121.join)(skillDirPath, SKILL_FILE_NAME);
|
|
17968
18405
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
17969
|
-
const ignoreFilepath = (0,
|
|
18406
|
+
const ignoreFilepath = (0, import_node_path121.join)(
|
|
17970
18407
|
ignorePaths.recommended.relativeDirPath,
|
|
17971
18408
|
ignorePaths.recommended.relativeFilePath
|
|
17972
18409
|
);
|
|
17973
18410
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
17974
|
-
const hooksFilepath = (0,
|
|
18411
|
+
const hooksFilepath = (0, import_node_path121.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
17975
18412
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
17976
18413
|
return results;
|
|
17977
18414
|
}
|
|
@@ -18009,33 +18446,196 @@ async function initCommand() {
|
|
|
18009
18446
|
}
|
|
18010
18447
|
|
|
18011
18448
|
// src/lib/sources.ts
|
|
18012
|
-
var
|
|
18449
|
+
var import_node_path124 = require("path");
|
|
18013
18450
|
var import_promise2 = require("es-toolkit/promise");
|
|
18014
18451
|
|
|
18452
|
+
// src/lib/git-client.ts
|
|
18453
|
+
var import_node_child_process = require("child_process");
|
|
18454
|
+
var import_node_path122 = require("path");
|
|
18455
|
+
var import_node_util = require("util");
|
|
18456
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
18457
|
+
var GIT_TIMEOUT_MS = 6e4;
|
|
18458
|
+
var ALLOWED_URL_SCHEMES = /^(https?:\/\/|ssh:\/\/|git:\/\/|file:\/\/\/|[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+:[a-zA-Z0-9_.+/~-]+)/;
|
|
18459
|
+
var INSECURE_URL_SCHEMES = /^(git:\/\/|http:\/\/)/;
|
|
18460
|
+
function findControlCharacter(value) {
|
|
18461
|
+
for (let i = 0; i < value.length; i++) {
|
|
18462
|
+
const code = value.charCodeAt(i);
|
|
18463
|
+
if (code >= 0 && code <= 31 || code === 127) {
|
|
18464
|
+
return { position: i, hex: `0x${code.toString(16).padStart(2, "0")}` };
|
|
18465
|
+
}
|
|
18466
|
+
}
|
|
18467
|
+
return null;
|
|
18468
|
+
}
|
|
18469
|
+
var GitClientError = class extends Error {
|
|
18470
|
+
constructor(message, cause) {
|
|
18471
|
+
super(message, { cause });
|
|
18472
|
+
this.name = "GitClientError";
|
|
18473
|
+
}
|
|
18474
|
+
};
|
|
18475
|
+
function validateGitUrl(url) {
|
|
18476
|
+
const ctrl = findControlCharacter(url);
|
|
18477
|
+
if (ctrl) {
|
|
18478
|
+
throw new GitClientError(
|
|
18479
|
+
`Git URL contains control character ${ctrl.hex} at position ${ctrl.position}`
|
|
18480
|
+
);
|
|
18481
|
+
}
|
|
18482
|
+
if (!ALLOWED_URL_SCHEMES.test(url)) {
|
|
18483
|
+
throw new GitClientError(
|
|
18484
|
+
`Unsupported or unsafe git URL: "${url}". Use https, ssh, git, or file schemes.`
|
|
18485
|
+
);
|
|
18486
|
+
}
|
|
18487
|
+
if (INSECURE_URL_SCHEMES.test(url)) {
|
|
18488
|
+
logger.warn(
|
|
18489
|
+
`URL "${url}" uses an unencrypted protocol. Consider using https:// or ssh:// instead.`
|
|
18490
|
+
);
|
|
18491
|
+
}
|
|
18492
|
+
}
|
|
18493
|
+
function validateRef(ref) {
|
|
18494
|
+
if (ref.startsWith("-")) {
|
|
18495
|
+
throw new GitClientError(`Ref must not start with "-": "${ref}"`);
|
|
18496
|
+
}
|
|
18497
|
+
const ctrl = findControlCharacter(ref);
|
|
18498
|
+
if (ctrl) {
|
|
18499
|
+
throw new GitClientError(
|
|
18500
|
+
`Ref contains control character ${ctrl.hex} at position ${ctrl.position}`
|
|
18501
|
+
);
|
|
18502
|
+
}
|
|
18503
|
+
}
|
|
18504
|
+
var gitChecked = false;
|
|
18505
|
+
async function checkGitAvailable() {
|
|
18506
|
+
if (gitChecked) return;
|
|
18507
|
+
try {
|
|
18508
|
+
await execFileAsync("git", ["--version"], { timeout: GIT_TIMEOUT_MS });
|
|
18509
|
+
gitChecked = true;
|
|
18510
|
+
} catch {
|
|
18511
|
+
throw new GitClientError("git is not installed or not found in PATH");
|
|
18512
|
+
}
|
|
18513
|
+
}
|
|
18514
|
+
async function resolveDefaultRef(url) {
|
|
18515
|
+
validateGitUrl(url);
|
|
18516
|
+
await checkGitAvailable();
|
|
18517
|
+
try {
|
|
18518
|
+
const { stdout } = await execFileAsync("git", ["ls-remote", "--symref", "--", url, "HEAD"], {
|
|
18519
|
+
timeout: GIT_TIMEOUT_MS
|
|
18520
|
+
});
|
|
18521
|
+
const ref = stdout.match(/^ref: refs\/heads\/(.+)\tHEAD$/m)?.[1];
|
|
18522
|
+
const sha = stdout.match(/^([0-9a-f]{40})\tHEAD$/m)?.[1];
|
|
18523
|
+
if (!ref || !sha) throw new GitClientError(`Could not parse default branch from: ${url}`);
|
|
18524
|
+
return { ref, sha };
|
|
18525
|
+
} catch (error) {
|
|
18526
|
+
if (error instanceof GitClientError) throw error;
|
|
18527
|
+
throw new GitClientError(`Failed to resolve default ref for ${url}`, error);
|
|
18528
|
+
}
|
|
18529
|
+
}
|
|
18530
|
+
async function resolveRefToSha(url, ref) {
|
|
18531
|
+
validateGitUrl(url);
|
|
18532
|
+
validateRef(ref);
|
|
18533
|
+
await checkGitAvailable();
|
|
18534
|
+
try {
|
|
18535
|
+
const { stdout } = await execFileAsync("git", ["ls-remote", "--", url, ref], {
|
|
18536
|
+
timeout: GIT_TIMEOUT_MS
|
|
18537
|
+
});
|
|
18538
|
+
const sha = stdout.match(/^([0-9a-f]{40})\t/m)?.[1];
|
|
18539
|
+
if (!sha) throw new GitClientError(`Ref "${ref}" not found in ${url}`);
|
|
18540
|
+
return sha;
|
|
18541
|
+
} catch (error) {
|
|
18542
|
+
if (error instanceof GitClientError) throw error;
|
|
18543
|
+
throw new GitClientError(`Failed to resolve ref "${ref}" for ${url}`, error);
|
|
18544
|
+
}
|
|
18545
|
+
}
|
|
18546
|
+
async function fetchSkillFiles(params) {
|
|
18547
|
+
const { url, ref, skillsPath } = params;
|
|
18548
|
+
validateGitUrl(url);
|
|
18549
|
+
validateRef(ref);
|
|
18550
|
+
await checkGitAvailable();
|
|
18551
|
+
const tmpDir = await createTempDirectory("rulesync-git-");
|
|
18552
|
+
try {
|
|
18553
|
+
await execFileAsync(
|
|
18554
|
+
"git",
|
|
18555
|
+
[
|
|
18556
|
+
"clone",
|
|
18557
|
+
"--depth",
|
|
18558
|
+
"1",
|
|
18559
|
+
"--branch",
|
|
18560
|
+
ref,
|
|
18561
|
+
"--no-checkout",
|
|
18562
|
+
"--filter=blob:none",
|
|
18563
|
+
"--",
|
|
18564
|
+
url,
|
|
18565
|
+
tmpDir
|
|
18566
|
+
],
|
|
18567
|
+
{ timeout: GIT_TIMEOUT_MS }
|
|
18568
|
+
);
|
|
18569
|
+
await execFileAsync("git", ["-C", tmpDir, "sparse-checkout", "set", "--", skillsPath], {
|
|
18570
|
+
timeout: GIT_TIMEOUT_MS
|
|
18571
|
+
});
|
|
18572
|
+
await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
|
|
18573
|
+
const skillsDir = (0, import_node_path122.join)(tmpDir, skillsPath);
|
|
18574
|
+
if (!await directoryExists(skillsDir)) return [];
|
|
18575
|
+
return await walkDirectory(skillsDir, skillsDir);
|
|
18576
|
+
} catch (error) {
|
|
18577
|
+
if (error instanceof GitClientError) throw error;
|
|
18578
|
+
throw new GitClientError(`Failed to fetch skill files from ${url}`, error);
|
|
18579
|
+
} finally {
|
|
18580
|
+
await removeTempDirectory(tmpDir);
|
|
18581
|
+
}
|
|
18582
|
+
}
|
|
18583
|
+
var MAX_WALK_DEPTH = 20;
|
|
18584
|
+
async function walkDirectory(dir, baseDir, depth = 0) {
|
|
18585
|
+
if (depth > MAX_WALK_DEPTH) {
|
|
18586
|
+
throw new GitClientError(
|
|
18587
|
+
`Directory tree exceeds max depth of ${MAX_WALK_DEPTH}: "${dir}". Aborting to prevent resource exhaustion.`
|
|
18588
|
+
);
|
|
18589
|
+
}
|
|
18590
|
+
const results = [];
|
|
18591
|
+
for (const name of await listDirectoryFiles(dir)) {
|
|
18592
|
+
if (name === ".git") continue;
|
|
18593
|
+
const fullPath = (0, import_node_path122.join)(dir, name);
|
|
18594
|
+
if (await isSymlink(fullPath)) {
|
|
18595
|
+
logger.warn(`Skipping symlink "${fullPath}".`);
|
|
18596
|
+
continue;
|
|
18597
|
+
}
|
|
18598
|
+
if (await directoryExists(fullPath)) {
|
|
18599
|
+
results.push(...await walkDirectory(fullPath, baseDir, depth + 1));
|
|
18600
|
+
} else {
|
|
18601
|
+
const size = await getFileSize(fullPath);
|
|
18602
|
+
if (size > MAX_FILE_SIZE) {
|
|
18603
|
+
logger.warn(
|
|
18604
|
+
`Skipping file "${fullPath}" (${(size / 1024 / 1024).toFixed(2)}MB exceeds ${MAX_FILE_SIZE / 1024 / 1024}MB limit).`
|
|
18605
|
+
);
|
|
18606
|
+
continue;
|
|
18607
|
+
}
|
|
18608
|
+
const content = await readFileContent(fullPath);
|
|
18609
|
+
results.push({ relativePath: fullPath.substring(baseDir.length + 1), content, size });
|
|
18610
|
+
}
|
|
18611
|
+
}
|
|
18612
|
+
return results;
|
|
18613
|
+
}
|
|
18614
|
+
|
|
18015
18615
|
// src/lib/sources-lock.ts
|
|
18016
18616
|
var import_node_crypto = require("crypto");
|
|
18017
|
-
var
|
|
18018
|
-
var
|
|
18617
|
+
var import_node_path123 = require("path");
|
|
18618
|
+
var import_mini60 = require("zod/mini");
|
|
18019
18619
|
var LOCKFILE_VERSION = 1;
|
|
18020
|
-
var LockedSkillSchema =
|
|
18021
|
-
integrity:
|
|
18620
|
+
var LockedSkillSchema = import_mini60.z.object({
|
|
18621
|
+
integrity: import_mini60.z.string()
|
|
18022
18622
|
});
|
|
18023
|
-
var LockedSourceSchema =
|
|
18024
|
-
requestedRef: (0,
|
|
18025
|
-
resolvedRef:
|
|
18026
|
-
resolvedAt: (0,
|
|
18027
|
-
skills:
|
|
18623
|
+
var LockedSourceSchema = import_mini60.z.object({
|
|
18624
|
+
requestedRef: (0, import_mini60.optional)(import_mini60.z.string()),
|
|
18625
|
+
resolvedRef: import_mini60.z.string(),
|
|
18626
|
+
resolvedAt: (0, import_mini60.optional)(import_mini60.z.string()),
|
|
18627
|
+
skills: import_mini60.z.record(import_mini60.z.string(), LockedSkillSchema)
|
|
18028
18628
|
});
|
|
18029
|
-
var SourcesLockSchema =
|
|
18030
|
-
lockfileVersion:
|
|
18031
|
-
sources:
|
|
18629
|
+
var SourcesLockSchema = import_mini60.z.object({
|
|
18630
|
+
lockfileVersion: import_mini60.z.number(),
|
|
18631
|
+
sources: import_mini60.z.record(import_mini60.z.string(), LockedSourceSchema)
|
|
18032
18632
|
});
|
|
18033
|
-
var LegacyLockedSourceSchema =
|
|
18034
|
-
resolvedRef:
|
|
18035
|
-
skills:
|
|
18633
|
+
var LegacyLockedSourceSchema = import_mini60.z.object({
|
|
18634
|
+
resolvedRef: import_mini60.z.string(),
|
|
18635
|
+
skills: import_mini60.z.array(import_mini60.z.string())
|
|
18036
18636
|
});
|
|
18037
|
-
var LegacySourcesLockSchema =
|
|
18038
|
-
sources:
|
|
18637
|
+
var LegacySourcesLockSchema = import_mini60.z.object({
|
|
18638
|
+
sources: import_mini60.z.record(import_mini60.z.string(), LegacyLockedSourceSchema)
|
|
18039
18639
|
});
|
|
18040
18640
|
function migrateLegacyLock(legacy) {
|
|
18041
18641
|
const sources = {};
|
|
@@ -18058,7 +18658,7 @@ function createEmptyLock() {
|
|
|
18058
18658
|
return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
|
|
18059
18659
|
}
|
|
18060
18660
|
async function readLockFile(params) {
|
|
18061
|
-
const lockPath = (0,
|
|
18661
|
+
const lockPath = (0, import_node_path123.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
18062
18662
|
if (!await fileExists(lockPath)) {
|
|
18063
18663
|
logger.debug("No sources lockfile found, starting fresh.");
|
|
18064
18664
|
return createEmptyLock();
|
|
@@ -18086,7 +18686,7 @@ async function readLockFile(params) {
|
|
|
18086
18686
|
}
|
|
18087
18687
|
}
|
|
18088
18688
|
async function writeLockFile(params) {
|
|
18089
|
-
const lockPath = (0,
|
|
18689
|
+
const lockPath = (0, import_node_path123.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
18090
18690
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
18091
18691
|
await writeFileContent(lockPath, content);
|
|
18092
18692
|
logger.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -18192,15 +18792,30 @@ async function resolveAndFetchSources(params) {
|
|
|
18192
18792
|
const allFetchedSkillNames = /* @__PURE__ */ new Set();
|
|
18193
18793
|
for (const sourceEntry of sources) {
|
|
18194
18794
|
try {
|
|
18195
|
-
const
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18795
|
+
const transport = sourceEntry.transport ?? "github";
|
|
18796
|
+
let result;
|
|
18797
|
+
if (transport === "git") {
|
|
18798
|
+
result = await fetchSourceViaGit({
|
|
18799
|
+
sourceEntry,
|
|
18800
|
+
baseDir,
|
|
18801
|
+
lock,
|
|
18802
|
+
localSkillNames,
|
|
18803
|
+
alreadyFetchedSkillNames: allFetchedSkillNames,
|
|
18804
|
+
updateSources: options.updateSources ?? false,
|
|
18805
|
+
frozen: options.frozen ?? false
|
|
18806
|
+
});
|
|
18807
|
+
} else {
|
|
18808
|
+
result = await fetchSource({
|
|
18809
|
+
sourceEntry,
|
|
18810
|
+
client,
|
|
18811
|
+
baseDir,
|
|
18812
|
+
lock,
|
|
18813
|
+
localSkillNames,
|
|
18814
|
+
alreadyFetchedSkillNames: allFetchedSkillNames,
|
|
18815
|
+
updateSources: options.updateSources ?? false
|
|
18816
|
+
});
|
|
18817
|
+
}
|
|
18818
|
+
const { skillCount, fetchedSkillNames, updatedLock } = result;
|
|
18204
18819
|
lock = updatedLock;
|
|
18205
18820
|
totalSkillCount += skillCount;
|
|
18206
18821
|
for (const name of fetchedSkillNames) {
|
|
@@ -18233,7 +18848,7 @@ async function resolveAndFetchSources(params) {
|
|
|
18233
18848
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
18234
18849
|
if (skillNames.length === 0) return true;
|
|
18235
18850
|
for (const name of skillNames) {
|
|
18236
|
-
if (!await directoryExists((0,
|
|
18851
|
+
if (!await directoryExists((0, import_node_path124.join)(curatedDir, name))) {
|
|
18237
18852
|
return false;
|
|
18238
18853
|
}
|
|
18239
18854
|
}
|
|
@@ -18264,7 +18879,7 @@ async function fetchSource(params) {
|
|
|
18264
18879
|
ref = resolvedSha;
|
|
18265
18880
|
logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
18266
18881
|
}
|
|
18267
|
-
const curatedDir = (0,
|
|
18882
|
+
const curatedDir = (0, import_node_path124.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
18268
18883
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
18269
18884
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
18270
18885
|
if (allExist) {
|
|
@@ -18294,10 +18909,10 @@ async function fetchSource(params) {
|
|
|
18294
18909
|
const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
|
|
18295
18910
|
const fetchedSkills = {};
|
|
18296
18911
|
if (locked) {
|
|
18297
|
-
const resolvedCuratedDir = (0,
|
|
18912
|
+
const resolvedCuratedDir = (0, import_node_path124.resolve)(curatedDir);
|
|
18298
18913
|
for (const prevSkill of lockedSkillNames) {
|
|
18299
|
-
const prevDir = (0,
|
|
18300
|
-
if (!(0,
|
|
18914
|
+
const prevDir = (0, import_node_path124.join)(curatedDir, prevSkill);
|
|
18915
|
+
if (!(0, import_node_path124.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path124.sep)) {
|
|
18301
18916
|
logger.warn(
|
|
18302
18917
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
18303
18918
|
);
|
|
@@ -18347,10 +18962,10 @@ async function fetchSource(params) {
|
|
|
18347
18962
|
const skillFiles = [];
|
|
18348
18963
|
for (const file of files) {
|
|
18349
18964
|
const relativeToSkill = file.path.substring(skillDir.path.length + 1);
|
|
18350
|
-
const localFilePath = (0,
|
|
18965
|
+
const localFilePath = (0, import_node_path124.join)(curatedDir, skillDir.name, relativeToSkill);
|
|
18351
18966
|
checkPathTraversal({
|
|
18352
18967
|
relativePath: relativeToSkill,
|
|
18353
|
-
intendedRootDir: (0,
|
|
18968
|
+
intendedRootDir: (0, import_node_path124.join)(curatedDir, skillDir.name)
|
|
18354
18969
|
});
|
|
18355
18970
|
const content = await withSemaphore(
|
|
18356
18971
|
semaphore,
|
|
@@ -18393,6 +19008,127 @@ async function fetchSource(params) {
|
|
|
18393
19008
|
updatedLock: lock
|
|
18394
19009
|
};
|
|
18395
19010
|
}
|
|
19011
|
+
async function fetchSourceViaGit(params) {
|
|
19012
|
+
const { sourceEntry, baseDir, localSkillNames, alreadyFetchedSkillNames, updateSources, frozen } = params;
|
|
19013
|
+
let { lock } = params;
|
|
19014
|
+
const url = sourceEntry.source;
|
|
19015
|
+
const locked = getLockedSource(lock, url);
|
|
19016
|
+
const lockedSkillNames = locked ? getLockedSkillNames(locked) : [];
|
|
19017
|
+
let resolvedSha;
|
|
19018
|
+
let requestedRef;
|
|
19019
|
+
if (locked && !updateSources) {
|
|
19020
|
+
resolvedSha = locked.resolvedRef;
|
|
19021
|
+
requestedRef = locked.requestedRef;
|
|
19022
|
+
if (requestedRef) {
|
|
19023
|
+
validateRef(requestedRef);
|
|
19024
|
+
}
|
|
19025
|
+
} else if (sourceEntry.ref) {
|
|
19026
|
+
requestedRef = sourceEntry.ref;
|
|
19027
|
+
resolvedSha = await resolveRefToSha(url, requestedRef);
|
|
19028
|
+
} else {
|
|
19029
|
+
const def = await resolveDefaultRef(url);
|
|
19030
|
+
requestedRef = def.ref;
|
|
19031
|
+
resolvedSha = def.sha;
|
|
19032
|
+
}
|
|
19033
|
+
const curatedDir = (0, import_node_path124.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
19034
|
+
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
19035
|
+
if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
|
|
19036
|
+
return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
|
|
19037
|
+
}
|
|
19038
|
+
}
|
|
19039
|
+
if (!requestedRef) {
|
|
19040
|
+
if (frozen) {
|
|
19041
|
+
throw new Error(
|
|
19042
|
+
`Frozen install failed: lockfile entry for "${url}" is missing requestedRef. Run 'rulesync install' to update the lockfile.`
|
|
19043
|
+
);
|
|
19044
|
+
}
|
|
19045
|
+
const def = await resolveDefaultRef(url);
|
|
19046
|
+
requestedRef = def.ref;
|
|
19047
|
+
resolvedSha = def.sha;
|
|
19048
|
+
}
|
|
19049
|
+
const skillFilter = sourceEntry.skills ?? ["*"];
|
|
19050
|
+
const isWildcard = skillFilter.length === 1 && skillFilter[0] === "*";
|
|
19051
|
+
const remoteFiles = await fetchSkillFiles({
|
|
19052
|
+
url,
|
|
19053
|
+
ref: requestedRef,
|
|
19054
|
+
skillsPath: sourceEntry.path ?? "skills"
|
|
19055
|
+
});
|
|
19056
|
+
const skillFileMap = /* @__PURE__ */ new Map();
|
|
19057
|
+
for (const file of remoteFiles) {
|
|
19058
|
+
const idx = file.relativePath.indexOf("/");
|
|
19059
|
+
if (idx === -1) continue;
|
|
19060
|
+
const name = file.relativePath.substring(0, idx);
|
|
19061
|
+
const inner = file.relativePath.substring(idx + 1);
|
|
19062
|
+
const arr = skillFileMap.get(name) ?? [];
|
|
19063
|
+
arr.push({ relativePath: inner, content: file.content });
|
|
19064
|
+
skillFileMap.set(name, arr);
|
|
19065
|
+
}
|
|
19066
|
+
const allNames = [...skillFileMap.keys()];
|
|
19067
|
+
const filteredNames = isWildcard ? allNames : allNames.filter((n) => skillFilter.includes(n));
|
|
19068
|
+
if (locked) {
|
|
19069
|
+
const base = (0, import_node_path124.resolve)(curatedDir);
|
|
19070
|
+
for (const prev of lockedSkillNames) {
|
|
19071
|
+
const dir = (0, import_node_path124.join)(curatedDir, prev);
|
|
19072
|
+
if ((0, import_node_path124.resolve)(dir).startsWith(base + import_node_path124.sep) && await directoryExists(dir)) {
|
|
19073
|
+
await removeDirectory(dir);
|
|
19074
|
+
}
|
|
19075
|
+
}
|
|
19076
|
+
}
|
|
19077
|
+
const fetchedSkills = {};
|
|
19078
|
+
for (const skillName of filteredNames) {
|
|
19079
|
+
if (skillName.includes("..") || skillName.includes("/") || skillName.includes("\\")) {
|
|
19080
|
+
logger.warn(
|
|
19081
|
+
`Skipping skill with invalid name "${skillName}" from ${url}: contains path traversal characters.`
|
|
19082
|
+
);
|
|
19083
|
+
continue;
|
|
19084
|
+
}
|
|
19085
|
+
if (localSkillNames.has(skillName)) {
|
|
19086
|
+
logger.debug(
|
|
19087
|
+
`Skipping remote skill "${skillName}" from ${url}: local skill takes precedence.`
|
|
19088
|
+
);
|
|
19089
|
+
continue;
|
|
19090
|
+
}
|
|
19091
|
+
if (alreadyFetchedSkillNames.has(skillName)) {
|
|
19092
|
+
logger.warn(
|
|
19093
|
+
`Skipping duplicate skill "${skillName}" from ${url}: already fetched from another source.`
|
|
19094
|
+
);
|
|
19095
|
+
continue;
|
|
19096
|
+
}
|
|
19097
|
+
const files = skillFileMap.get(skillName) ?? [];
|
|
19098
|
+
const written = [];
|
|
19099
|
+
for (const file of files) {
|
|
19100
|
+
checkPathTraversal({
|
|
19101
|
+
relativePath: file.relativePath,
|
|
19102
|
+
intendedRootDir: (0, import_node_path124.join)(curatedDir, skillName)
|
|
19103
|
+
});
|
|
19104
|
+
await writeFileContent((0, import_node_path124.join)(curatedDir, skillName, file.relativePath), file.content);
|
|
19105
|
+
written.push({ path: file.relativePath, content: file.content });
|
|
19106
|
+
}
|
|
19107
|
+
const integrity = computeSkillIntegrity(written);
|
|
19108
|
+
const lockedSkillEntry = locked?.skills[skillName];
|
|
19109
|
+
if (lockedSkillEntry?.integrity && lockedSkillEntry.integrity !== integrity && resolvedSha === locked?.resolvedRef) {
|
|
19110
|
+
logger.warn(`Integrity mismatch for skill "${skillName}" from ${url}.`);
|
|
19111
|
+
}
|
|
19112
|
+
fetchedSkills[skillName] = { integrity };
|
|
19113
|
+
}
|
|
19114
|
+
const fetchedNames = Object.keys(fetchedSkills);
|
|
19115
|
+
const mergedSkills = { ...fetchedSkills };
|
|
19116
|
+
if (locked) {
|
|
19117
|
+
for (const [k, v] of Object.entries(locked.skills)) {
|
|
19118
|
+
if (!(k in mergedSkills)) mergedSkills[k] = v;
|
|
19119
|
+
}
|
|
19120
|
+
}
|
|
19121
|
+
lock = setLockedSource(lock, url, {
|
|
19122
|
+
requestedRef,
|
|
19123
|
+
resolvedRef: resolvedSha,
|
|
19124
|
+
resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19125
|
+
skills: mergedSkills
|
|
19126
|
+
});
|
|
19127
|
+
logger.info(
|
|
19128
|
+
`Fetched ${fetchedNames.length} skill(s) from ${url}: ${fetchedNames.join(", ") || "(none)"}`
|
|
19129
|
+
);
|
|
19130
|
+
return { skillCount: fetchedNames.length, fetchedSkillNames: fetchedNames, updatedLock: lock };
|
|
19131
|
+
}
|
|
18396
19132
|
|
|
18397
19133
|
// src/cli/commands/install.ts
|
|
18398
19134
|
async function installCommand(options) {
|
|
@@ -18433,15 +19169,15 @@ async function installCommand(options) {
|
|
|
18433
19169
|
var import_fastmcp = require("fastmcp");
|
|
18434
19170
|
|
|
18435
19171
|
// src/mcp/tools.ts
|
|
18436
|
-
var
|
|
19172
|
+
var import_mini69 = require("zod/mini");
|
|
18437
19173
|
|
|
18438
19174
|
// src/mcp/commands.ts
|
|
18439
|
-
var
|
|
18440
|
-
var
|
|
19175
|
+
var import_node_path125 = require("path");
|
|
19176
|
+
var import_mini61 = require("zod/mini");
|
|
18441
19177
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
18442
19178
|
var maxCommandsCount = 1e3;
|
|
18443
19179
|
async function listCommands() {
|
|
18444
|
-
const commandsDir = (0,
|
|
19180
|
+
const commandsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
18445
19181
|
try {
|
|
18446
19182
|
const files = await listDirectoryFiles(commandsDir);
|
|
18447
19183
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18457,7 +19193,7 @@ async function listCommands() {
|
|
|
18457
19193
|
});
|
|
18458
19194
|
const frontmatter = command.getFrontmatter();
|
|
18459
19195
|
return {
|
|
18460
|
-
relativePathFromCwd: (0,
|
|
19196
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
18461
19197
|
frontmatter
|
|
18462
19198
|
};
|
|
18463
19199
|
} catch (error) {
|
|
@@ -18479,13 +19215,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
18479
19215
|
relativePath: relativePathFromCwd,
|
|
18480
19216
|
intendedRootDir: process.cwd()
|
|
18481
19217
|
});
|
|
18482
|
-
const filename = (0,
|
|
19218
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
18483
19219
|
try {
|
|
18484
19220
|
const command = await RulesyncCommand.fromFile({
|
|
18485
19221
|
relativeFilePath: filename
|
|
18486
19222
|
});
|
|
18487
19223
|
return {
|
|
18488
|
-
relativePathFromCwd: (0,
|
|
19224
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
18489
19225
|
frontmatter: command.getFrontmatter(),
|
|
18490
19226
|
body: command.getBody()
|
|
18491
19227
|
};
|
|
@@ -18504,7 +19240,7 @@ async function putCommand({
|
|
|
18504
19240
|
relativePath: relativePathFromCwd,
|
|
18505
19241
|
intendedRootDir: process.cwd()
|
|
18506
19242
|
});
|
|
18507
|
-
const filename = (0,
|
|
19243
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
18508
19244
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18509
19245
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
18510
19246
|
throw new Error(
|
|
@@ -18514,7 +19250,7 @@ async function putCommand({
|
|
|
18514
19250
|
try {
|
|
18515
19251
|
const existingCommands = await listCommands();
|
|
18516
19252
|
const isUpdate = existingCommands.some(
|
|
18517
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
19253
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
18518
19254
|
);
|
|
18519
19255
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
18520
19256
|
throw new Error(
|
|
@@ -18531,11 +19267,11 @@ async function putCommand({
|
|
|
18531
19267
|
fileContent,
|
|
18532
19268
|
validate: true
|
|
18533
19269
|
});
|
|
18534
|
-
const commandsDir = (0,
|
|
19270
|
+
const commandsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
18535
19271
|
await ensureDir(commandsDir);
|
|
18536
19272
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
18537
19273
|
return {
|
|
18538
|
-
relativePathFromCwd: (0,
|
|
19274
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
18539
19275
|
frontmatter: command.getFrontmatter(),
|
|
18540
19276
|
body: command.getBody()
|
|
18541
19277
|
};
|
|
@@ -18550,12 +19286,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
18550
19286
|
relativePath: relativePathFromCwd,
|
|
18551
19287
|
intendedRootDir: process.cwd()
|
|
18552
19288
|
});
|
|
18553
|
-
const filename = (0,
|
|
18554
|
-
const fullPath = (0,
|
|
19289
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
19290
|
+
const fullPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
18555
19291
|
try {
|
|
18556
19292
|
await removeFile(fullPath);
|
|
18557
19293
|
return {
|
|
18558
|
-
relativePathFromCwd: (0,
|
|
19294
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
18559
19295
|
};
|
|
18560
19296
|
} catch (error) {
|
|
18561
19297
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18564,23 +19300,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
18564
19300
|
}
|
|
18565
19301
|
}
|
|
18566
19302
|
var commandToolSchemas = {
|
|
18567
|
-
listCommands:
|
|
18568
|
-
getCommand:
|
|
18569
|
-
relativePathFromCwd:
|
|
19303
|
+
listCommands: import_mini61.z.object({}),
|
|
19304
|
+
getCommand: import_mini61.z.object({
|
|
19305
|
+
relativePathFromCwd: import_mini61.z.string()
|
|
18570
19306
|
}),
|
|
18571
|
-
putCommand:
|
|
18572
|
-
relativePathFromCwd:
|
|
19307
|
+
putCommand: import_mini61.z.object({
|
|
19308
|
+
relativePathFromCwd: import_mini61.z.string(),
|
|
18573
19309
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
18574
|
-
body:
|
|
19310
|
+
body: import_mini61.z.string()
|
|
18575
19311
|
}),
|
|
18576
|
-
deleteCommand:
|
|
18577
|
-
relativePathFromCwd:
|
|
19312
|
+
deleteCommand: import_mini61.z.object({
|
|
19313
|
+
relativePathFromCwd: import_mini61.z.string()
|
|
18578
19314
|
})
|
|
18579
19315
|
};
|
|
18580
19316
|
var commandTools = {
|
|
18581
19317
|
listCommands: {
|
|
18582
19318
|
name: "listCommands",
|
|
18583
|
-
description: `List all commands from ${(0,
|
|
19319
|
+
description: `List all commands from ${(0, import_node_path125.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18584
19320
|
parameters: commandToolSchemas.listCommands,
|
|
18585
19321
|
execute: async () => {
|
|
18586
19322
|
const commands = await listCommands();
|
|
@@ -18622,15 +19358,15 @@ var commandTools = {
|
|
|
18622
19358
|
};
|
|
18623
19359
|
|
|
18624
19360
|
// src/mcp/generate.ts
|
|
18625
|
-
var
|
|
18626
|
-
var generateOptionsSchema =
|
|
18627
|
-
targets:
|
|
18628
|
-
features:
|
|
18629
|
-
delete:
|
|
18630
|
-
global:
|
|
18631
|
-
simulateCommands:
|
|
18632
|
-
simulateSubagents:
|
|
18633
|
-
simulateSkills:
|
|
19361
|
+
var import_mini62 = require("zod/mini");
|
|
19362
|
+
var generateOptionsSchema = import_mini62.z.object({
|
|
19363
|
+
targets: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
|
|
19364
|
+
features: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
|
|
19365
|
+
delete: import_mini62.z.optional(import_mini62.z.boolean()),
|
|
19366
|
+
global: import_mini62.z.optional(import_mini62.z.boolean()),
|
|
19367
|
+
simulateCommands: import_mini62.z.optional(import_mini62.z.boolean()),
|
|
19368
|
+
simulateSubagents: import_mini62.z.optional(import_mini62.z.boolean()),
|
|
19369
|
+
simulateSkills: import_mini62.z.optional(import_mini62.z.boolean())
|
|
18634
19370
|
});
|
|
18635
19371
|
async function executeGenerate(options = {}) {
|
|
18636
19372
|
try {
|
|
@@ -18707,11 +19443,11 @@ var generateTools = {
|
|
|
18707
19443
|
};
|
|
18708
19444
|
|
|
18709
19445
|
// src/mcp/ignore.ts
|
|
18710
|
-
var
|
|
18711
|
-
var
|
|
19446
|
+
var import_node_path126 = require("path");
|
|
19447
|
+
var import_mini63 = require("zod/mini");
|
|
18712
19448
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
18713
19449
|
async function getIgnoreFile() {
|
|
18714
|
-
const ignoreFilePath = (0,
|
|
19450
|
+
const ignoreFilePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18715
19451
|
try {
|
|
18716
19452
|
const content = await readFileContent(ignoreFilePath);
|
|
18717
19453
|
return {
|
|
@@ -18728,7 +19464,7 @@ async function getIgnoreFile() {
|
|
|
18728
19464
|
}
|
|
18729
19465
|
}
|
|
18730
19466
|
async function putIgnoreFile({ content }) {
|
|
18731
|
-
const ignoreFilePath = (0,
|
|
19467
|
+
const ignoreFilePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18732
19468
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
18733
19469
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
18734
19470
|
throw new Error(
|
|
@@ -18752,8 +19488,8 @@ async function putIgnoreFile({ content }) {
|
|
|
18752
19488
|
}
|
|
18753
19489
|
}
|
|
18754
19490
|
async function deleteIgnoreFile() {
|
|
18755
|
-
const aiignorePath = (0,
|
|
18756
|
-
const legacyIgnorePath = (0,
|
|
19491
|
+
const aiignorePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
19492
|
+
const legacyIgnorePath = (0, import_node_path126.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
18757
19493
|
try {
|
|
18758
19494
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
18759
19495
|
return {
|
|
@@ -18771,11 +19507,11 @@ async function deleteIgnoreFile() {
|
|
|
18771
19507
|
}
|
|
18772
19508
|
}
|
|
18773
19509
|
var ignoreToolSchemas = {
|
|
18774
|
-
getIgnoreFile:
|
|
18775
|
-
putIgnoreFile:
|
|
18776
|
-
content:
|
|
19510
|
+
getIgnoreFile: import_mini63.z.object({}),
|
|
19511
|
+
putIgnoreFile: import_mini63.z.object({
|
|
19512
|
+
content: import_mini63.z.string()
|
|
18777
19513
|
}),
|
|
18778
|
-
deleteIgnoreFile:
|
|
19514
|
+
deleteIgnoreFile: import_mini63.z.object({})
|
|
18779
19515
|
};
|
|
18780
19516
|
var ignoreTools = {
|
|
18781
19517
|
getIgnoreFile: {
|
|
@@ -18808,11 +19544,11 @@ var ignoreTools = {
|
|
|
18808
19544
|
};
|
|
18809
19545
|
|
|
18810
19546
|
// src/mcp/import.ts
|
|
18811
|
-
var
|
|
18812
|
-
var importOptionsSchema =
|
|
18813
|
-
target:
|
|
18814
|
-
features:
|
|
18815
|
-
global:
|
|
19547
|
+
var import_mini64 = require("zod/mini");
|
|
19548
|
+
var importOptionsSchema = import_mini64.z.object({
|
|
19549
|
+
target: import_mini64.z.string(),
|
|
19550
|
+
features: import_mini64.z.optional(import_mini64.z.array(import_mini64.z.string())),
|
|
19551
|
+
global: import_mini64.z.optional(import_mini64.z.boolean())
|
|
18816
19552
|
});
|
|
18817
19553
|
async function executeImport(options) {
|
|
18818
19554
|
try {
|
|
@@ -18881,15 +19617,15 @@ var importTools = {
|
|
|
18881
19617
|
};
|
|
18882
19618
|
|
|
18883
19619
|
// src/mcp/mcp.ts
|
|
18884
|
-
var
|
|
18885
|
-
var
|
|
19620
|
+
var import_node_path127 = require("path");
|
|
19621
|
+
var import_mini65 = require("zod/mini");
|
|
18886
19622
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
18887
19623
|
async function getMcpFile() {
|
|
18888
19624
|
try {
|
|
18889
19625
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
18890
19626
|
validate: true
|
|
18891
19627
|
});
|
|
18892
|
-
const relativePathFromCwd = (0,
|
|
19628
|
+
const relativePathFromCwd = (0, import_node_path127.join)(
|
|
18893
19629
|
rulesyncMcp.getRelativeDirPath(),
|
|
18894
19630
|
rulesyncMcp.getRelativeFilePath()
|
|
18895
19631
|
);
|
|
@@ -18927,7 +19663,7 @@ async function putMcpFile({ content }) {
|
|
|
18927
19663
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18928
19664
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
18929
19665
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
18930
|
-
const fullPath = (0,
|
|
19666
|
+
const fullPath = (0, import_node_path127.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
18931
19667
|
const rulesyncMcp = new RulesyncMcp({
|
|
18932
19668
|
baseDir,
|
|
18933
19669
|
relativeDirPath,
|
|
@@ -18935,9 +19671,9 @@ async function putMcpFile({ content }) {
|
|
|
18935
19671
|
fileContent: content,
|
|
18936
19672
|
validate: true
|
|
18937
19673
|
});
|
|
18938
|
-
await ensureDir((0,
|
|
19674
|
+
await ensureDir((0, import_node_path127.join)(baseDir, relativeDirPath));
|
|
18939
19675
|
await writeFileContent(fullPath, content);
|
|
18940
|
-
const relativePathFromCwd = (0,
|
|
19676
|
+
const relativePathFromCwd = (0, import_node_path127.join)(relativeDirPath, relativeFilePath);
|
|
18941
19677
|
return {
|
|
18942
19678
|
relativePathFromCwd,
|
|
18943
19679
|
content: rulesyncMcp.getFileContent()
|
|
@@ -18955,15 +19691,15 @@ async function deleteMcpFile() {
|
|
|
18955
19691
|
try {
|
|
18956
19692
|
const baseDir = process.cwd();
|
|
18957
19693
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18958
|
-
const recommendedPath = (0,
|
|
19694
|
+
const recommendedPath = (0, import_node_path127.join)(
|
|
18959
19695
|
baseDir,
|
|
18960
19696
|
paths.recommended.relativeDirPath,
|
|
18961
19697
|
paths.recommended.relativeFilePath
|
|
18962
19698
|
);
|
|
18963
|
-
const legacyPath = (0,
|
|
19699
|
+
const legacyPath = (0, import_node_path127.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
18964
19700
|
await removeFile(recommendedPath);
|
|
18965
19701
|
await removeFile(legacyPath);
|
|
18966
|
-
const relativePathFromCwd = (0,
|
|
19702
|
+
const relativePathFromCwd = (0, import_node_path127.join)(
|
|
18967
19703
|
paths.recommended.relativeDirPath,
|
|
18968
19704
|
paths.recommended.relativeFilePath
|
|
18969
19705
|
);
|
|
@@ -18980,11 +19716,11 @@ async function deleteMcpFile() {
|
|
|
18980
19716
|
}
|
|
18981
19717
|
}
|
|
18982
19718
|
var mcpToolSchemas = {
|
|
18983
|
-
getMcpFile:
|
|
18984
|
-
putMcpFile:
|
|
18985
|
-
content:
|
|
19719
|
+
getMcpFile: import_mini65.z.object({}),
|
|
19720
|
+
putMcpFile: import_mini65.z.object({
|
|
19721
|
+
content: import_mini65.z.string()
|
|
18986
19722
|
}),
|
|
18987
|
-
deleteMcpFile:
|
|
19723
|
+
deleteMcpFile: import_mini65.z.object({})
|
|
18988
19724
|
};
|
|
18989
19725
|
var mcpTools = {
|
|
18990
19726
|
getMcpFile: {
|
|
@@ -19017,12 +19753,12 @@ var mcpTools = {
|
|
|
19017
19753
|
};
|
|
19018
19754
|
|
|
19019
19755
|
// src/mcp/rules.ts
|
|
19020
|
-
var
|
|
19021
|
-
var
|
|
19756
|
+
var import_node_path128 = require("path");
|
|
19757
|
+
var import_mini66 = require("zod/mini");
|
|
19022
19758
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
19023
19759
|
var maxRulesCount = 1e3;
|
|
19024
19760
|
async function listRules() {
|
|
19025
|
-
const rulesDir = (0,
|
|
19761
|
+
const rulesDir = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
19026
19762
|
try {
|
|
19027
19763
|
const files = await listDirectoryFiles(rulesDir);
|
|
19028
19764
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -19035,7 +19771,7 @@ async function listRules() {
|
|
|
19035
19771
|
});
|
|
19036
19772
|
const frontmatter = rule.getFrontmatter();
|
|
19037
19773
|
return {
|
|
19038
|
-
relativePathFromCwd: (0,
|
|
19774
|
+
relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
19039
19775
|
frontmatter
|
|
19040
19776
|
};
|
|
19041
19777
|
} catch (error) {
|
|
@@ -19057,14 +19793,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
19057
19793
|
relativePath: relativePathFromCwd,
|
|
19058
19794
|
intendedRootDir: process.cwd()
|
|
19059
19795
|
});
|
|
19060
|
-
const filename = (0,
|
|
19796
|
+
const filename = (0, import_node_path128.basename)(relativePathFromCwd);
|
|
19061
19797
|
try {
|
|
19062
19798
|
const rule = await RulesyncRule.fromFile({
|
|
19063
19799
|
relativeFilePath: filename,
|
|
19064
19800
|
validate: true
|
|
19065
19801
|
});
|
|
19066
19802
|
return {
|
|
19067
|
-
relativePathFromCwd: (0,
|
|
19803
|
+
relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
19068
19804
|
frontmatter: rule.getFrontmatter(),
|
|
19069
19805
|
body: rule.getBody()
|
|
19070
19806
|
};
|
|
@@ -19083,7 +19819,7 @@ async function putRule({
|
|
|
19083
19819
|
relativePath: relativePathFromCwd,
|
|
19084
19820
|
intendedRootDir: process.cwd()
|
|
19085
19821
|
});
|
|
19086
|
-
const filename = (0,
|
|
19822
|
+
const filename = (0, import_node_path128.basename)(relativePathFromCwd);
|
|
19087
19823
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
19088
19824
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
19089
19825
|
throw new Error(
|
|
@@ -19093,7 +19829,7 @@ async function putRule({
|
|
|
19093
19829
|
try {
|
|
19094
19830
|
const existingRules = await listRules();
|
|
19095
19831
|
const isUpdate = existingRules.some(
|
|
19096
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
19832
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
19097
19833
|
);
|
|
19098
19834
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
19099
19835
|
throw new Error(
|
|
@@ -19108,11 +19844,11 @@ async function putRule({
|
|
|
19108
19844
|
body,
|
|
19109
19845
|
validate: true
|
|
19110
19846
|
});
|
|
19111
|
-
const rulesDir = (0,
|
|
19847
|
+
const rulesDir = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
19112
19848
|
await ensureDir(rulesDir);
|
|
19113
19849
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
19114
19850
|
return {
|
|
19115
|
-
relativePathFromCwd: (0,
|
|
19851
|
+
relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
19116
19852
|
frontmatter: rule.getFrontmatter(),
|
|
19117
19853
|
body: rule.getBody()
|
|
19118
19854
|
};
|
|
@@ -19127,12 +19863,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
19127
19863
|
relativePath: relativePathFromCwd,
|
|
19128
19864
|
intendedRootDir: process.cwd()
|
|
19129
19865
|
});
|
|
19130
|
-
const filename = (0,
|
|
19131
|
-
const fullPath = (0,
|
|
19866
|
+
const filename = (0, import_node_path128.basename)(relativePathFromCwd);
|
|
19867
|
+
const fullPath = (0, import_node_path128.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
19132
19868
|
try {
|
|
19133
19869
|
await removeFile(fullPath);
|
|
19134
19870
|
return {
|
|
19135
|
-
relativePathFromCwd: (0,
|
|
19871
|
+
relativePathFromCwd: (0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
19136
19872
|
};
|
|
19137
19873
|
} catch (error) {
|
|
19138
19874
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -19141,23 +19877,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
19141
19877
|
}
|
|
19142
19878
|
}
|
|
19143
19879
|
var ruleToolSchemas = {
|
|
19144
|
-
listRules:
|
|
19145
|
-
getRule:
|
|
19146
|
-
relativePathFromCwd:
|
|
19880
|
+
listRules: import_mini66.z.object({}),
|
|
19881
|
+
getRule: import_mini66.z.object({
|
|
19882
|
+
relativePathFromCwd: import_mini66.z.string()
|
|
19147
19883
|
}),
|
|
19148
|
-
putRule:
|
|
19149
|
-
relativePathFromCwd:
|
|
19884
|
+
putRule: import_mini66.z.object({
|
|
19885
|
+
relativePathFromCwd: import_mini66.z.string(),
|
|
19150
19886
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
19151
|
-
body:
|
|
19887
|
+
body: import_mini66.z.string()
|
|
19152
19888
|
}),
|
|
19153
|
-
deleteRule:
|
|
19154
|
-
relativePathFromCwd:
|
|
19889
|
+
deleteRule: import_mini66.z.object({
|
|
19890
|
+
relativePathFromCwd: import_mini66.z.string()
|
|
19155
19891
|
})
|
|
19156
19892
|
};
|
|
19157
19893
|
var ruleTools = {
|
|
19158
19894
|
listRules: {
|
|
19159
19895
|
name: "listRules",
|
|
19160
|
-
description: `List all rules from ${(0,
|
|
19896
|
+
description: `List all rules from ${(0, import_node_path128.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
19161
19897
|
parameters: ruleToolSchemas.listRules,
|
|
19162
19898
|
execute: async () => {
|
|
19163
19899
|
const rules = await listRules();
|
|
@@ -19199,8 +19935,8 @@ var ruleTools = {
|
|
|
19199
19935
|
};
|
|
19200
19936
|
|
|
19201
19937
|
// src/mcp/skills.ts
|
|
19202
|
-
var
|
|
19203
|
-
var
|
|
19938
|
+
var import_node_path129 = require("path");
|
|
19939
|
+
var import_mini67 = require("zod/mini");
|
|
19204
19940
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
19205
19941
|
var maxSkillsCount = 1e3;
|
|
19206
19942
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -19216,19 +19952,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
19216
19952
|
};
|
|
19217
19953
|
}
|
|
19218
19954
|
function extractDirName(relativeDirPathFromCwd) {
|
|
19219
|
-
const dirName = (0,
|
|
19955
|
+
const dirName = (0, import_node_path129.basename)(relativeDirPathFromCwd);
|
|
19220
19956
|
if (!dirName) {
|
|
19221
19957
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
19222
19958
|
}
|
|
19223
19959
|
return dirName;
|
|
19224
19960
|
}
|
|
19225
19961
|
async function listSkills() {
|
|
19226
|
-
const skillsDir = (0,
|
|
19962
|
+
const skillsDir = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
19227
19963
|
try {
|
|
19228
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
19964
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path129.join)(skillsDir, "*"), { type: "dir" });
|
|
19229
19965
|
const skills = await Promise.all(
|
|
19230
19966
|
skillDirPaths.map(async (dirPath) => {
|
|
19231
|
-
const dirName = (0,
|
|
19967
|
+
const dirName = (0, import_node_path129.basename)(dirPath);
|
|
19232
19968
|
if (!dirName) return null;
|
|
19233
19969
|
try {
|
|
19234
19970
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -19236,7 +19972,7 @@ async function listSkills() {
|
|
|
19236
19972
|
});
|
|
19237
19973
|
const frontmatter = skill.getFrontmatter();
|
|
19238
19974
|
return {
|
|
19239
|
-
relativeDirPathFromCwd: (0,
|
|
19975
|
+
relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
19240
19976
|
frontmatter
|
|
19241
19977
|
};
|
|
19242
19978
|
} catch (error) {
|
|
@@ -19264,7 +20000,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
19264
20000
|
dirName
|
|
19265
20001
|
});
|
|
19266
20002
|
return {
|
|
19267
|
-
relativeDirPathFromCwd: (0,
|
|
20003
|
+
relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
19268
20004
|
frontmatter: skill.getFrontmatter(),
|
|
19269
20005
|
body: skill.getBody(),
|
|
19270
20006
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -19298,7 +20034,7 @@ async function putSkill({
|
|
|
19298
20034
|
try {
|
|
19299
20035
|
const existingSkills = await listSkills();
|
|
19300
20036
|
const isUpdate = existingSkills.some(
|
|
19301
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
20037
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
19302
20038
|
);
|
|
19303
20039
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
19304
20040
|
throw new Error(
|
|
@@ -19315,9 +20051,9 @@ async function putSkill({
|
|
|
19315
20051
|
otherFiles: aiDirFiles,
|
|
19316
20052
|
validate: true
|
|
19317
20053
|
});
|
|
19318
|
-
const skillDirPath = (0,
|
|
20054
|
+
const skillDirPath = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
19319
20055
|
await ensureDir(skillDirPath);
|
|
19320
|
-
const skillFilePath = (0,
|
|
20056
|
+
const skillFilePath = (0, import_node_path129.join)(skillDirPath, SKILL_FILE_NAME);
|
|
19321
20057
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
19322
20058
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
19323
20059
|
for (const file of otherFiles) {
|
|
@@ -19325,15 +20061,15 @@ async function putSkill({
|
|
|
19325
20061
|
relativePath: file.name,
|
|
19326
20062
|
intendedRootDir: skillDirPath
|
|
19327
20063
|
});
|
|
19328
|
-
const filePath = (0,
|
|
19329
|
-
const fileDir = (0,
|
|
20064
|
+
const filePath = (0, import_node_path129.join)(skillDirPath, file.name);
|
|
20065
|
+
const fileDir = (0, import_node_path129.join)(skillDirPath, (0, import_node_path129.dirname)(file.name));
|
|
19330
20066
|
if (fileDir !== skillDirPath) {
|
|
19331
20067
|
await ensureDir(fileDir);
|
|
19332
20068
|
}
|
|
19333
20069
|
await writeFileContent(filePath, file.body);
|
|
19334
20070
|
}
|
|
19335
20071
|
return {
|
|
19336
|
-
relativeDirPathFromCwd: (0,
|
|
20072
|
+
relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
19337
20073
|
frontmatter: skill.getFrontmatter(),
|
|
19338
20074
|
body: skill.getBody(),
|
|
19339
20075
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -19355,13 +20091,13 @@ async function deleteSkill({
|
|
|
19355
20091
|
intendedRootDir: process.cwd()
|
|
19356
20092
|
});
|
|
19357
20093
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
19358
|
-
const skillDirPath = (0,
|
|
20094
|
+
const skillDirPath = (0, import_node_path129.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
19359
20095
|
try {
|
|
19360
20096
|
if (await directoryExists(skillDirPath)) {
|
|
19361
20097
|
await removeDirectory(skillDirPath);
|
|
19362
20098
|
}
|
|
19363
20099
|
return {
|
|
19364
|
-
relativeDirPathFromCwd: (0,
|
|
20100
|
+
relativeDirPathFromCwd: (0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
19365
20101
|
};
|
|
19366
20102
|
} catch (error) {
|
|
19367
20103
|
throw new Error(
|
|
@@ -19372,29 +20108,29 @@ async function deleteSkill({
|
|
|
19372
20108
|
);
|
|
19373
20109
|
}
|
|
19374
20110
|
}
|
|
19375
|
-
var McpSkillFileSchema =
|
|
19376
|
-
name:
|
|
19377
|
-
body:
|
|
20111
|
+
var McpSkillFileSchema = import_mini67.z.object({
|
|
20112
|
+
name: import_mini67.z.string(),
|
|
20113
|
+
body: import_mini67.z.string()
|
|
19378
20114
|
});
|
|
19379
20115
|
var skillToolSchemas = {
|
|
19380
|
-
listSkills:
|
|
19381
|
-
getSkill:
|
|
19382
|
-
relativeDirPathFromCwd:
|
|
20116
|
+
listSkills: import_mini67.z.object({}),
|
|
20117
|
+
getSkill: import_mini67.z.object({
|
|
20118
|
+
relativeDirPathFromCwd: import_mini67.z.string()
|
|
19383
20119
|
}),
|
|
19384
|
-
putSkill:
|
|
19385
|
-
relativeDirPathFromCwd:
|
|
20120
|
+
putSkill: import_mini67.z.object({
|
|
20121
|
+
relativeDirPathFromCwd: import_mini67.z.string(),
|
|
19386
20122
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
19387
|
-
body:
|
|
19388
|
-
otherFiles:
|
|
20123
|
+
body: import_mini67.z.string(),
|
|
20124
|
+
otherFiles: import_mini67.z.optional(import_mini67.z.array(McpSkillFileSchema))
|
|
19389
20125
|
}),
|
|
19390
|
-
deleteSkill:
|
|
19391
|
-
relativeDirPathFromCwd:
|
|
20126
|
+
deleteSkill: import_mini67.z.object({
|
|
20127
|
+
relativeDirPathFromCwd: import_mini67.z.string()
|
|
19392
20128
|
})
|
|
19393
20129
|
};
|
|
19394
20130
|
var skillTools = {
|
|
19395
20131
|
listSkills: {
|
|
19396
20132
|
name: "listSkills",
|
|
19397
|
-
description: `List all skills from ${(0,
|
|
20133
|
+
description: `List all skills from ${(0, import_node_path129.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
19398
20134
|
parameters: skillToolSchemas.listSkills,
|
|
19399
20135
|
execute: async () => {
|
|
19400
20136
|
const skills = await listSkills();
|
|
@@ -19437,12 +20173,12 @@ var skillTools = {
|
|
|
19437
20173
|
};
|
|
19438
20174
|
|
|
19439
20175
|
// src/mcp/subagents.ts
|
|
19440
|
-
var
|
|
19441
|
-
var
|
|
20176
|
+
var import_node_path130 = require("path");
|
|
20177
|
+
var import_mini68 = require("zod/mini");
|
|
19442
20178
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
19443
20179
|
var maxSubagentsCount = 1e3;
|
|
19444
20180
|
async function listSubagents() {
|
|
19445
|
-
const subagentsDir = (0,
|
|
20181
|
+
const subagentsDir = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
19446
20182
|
try {
|
|
19447
20183
|
const files = await listDirectoryFiles(subagentsDir);
|
|
19448
20184
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -19455,7 +20191,7 @@ async function listSubagents() {
|
|
|
19455
20191
|
});
|
|
19456
20192
|
const frontmatter = subagent.getFrontmatter();
|
|
19457
20193
|
return {
|
|
19458
|
-
relativePathFromCwd: (0,
|
|
20194
|
+
relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
19459
20195
|
frontmatter
|
|
19460
20196
|
};
|
|
19461
20197
|
} catch (error) {
|
|
@@ -19479,14 +20215,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
19479
20215
|
relativePath: relativePathFromCwd,
|
|
19480
20216
|
intendedRootDir: process.cwd()
|
|
19481
20217
|
});
|
|
19482
|
-
const filename = (0,
|
|
20218
|
+
const filename = (0, import_node_path130.basename)(relativePathFromCwd);
|
|
19483
20219
|
try {
|
|
19484
20220
|
const subagent = await RulesyncSubagent.fromFile({
|
|
19485
20221
|
relativeFilePath: filename,
|
|
19486
20222
|
validate: true
|
|
19487
20223
|
});
|
|
19488
20224
|
return {
|
|
19489
|
-
relativePathFromCwd: (0,
|
|
20225
|
+
relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
19490
20226
|
frontmatter: subagent.getFrontmatter(),
|
|
19491
20227
|
body: subagent.getBody()
|
|
19492
20228
|
};
|
|
@@ -19505,7 +20241,7 @@ async function putSubagent({
|
|
|
19505
20241
|
relativePath: relativePathFromCwd,
|
|
19506
20242
|
intendedRootDir: process.cwd()
|
|
19507
20243
|
});
|
|
19508
|
-
const filename = (0,
|
|
20244
|
+
const filename = (0, import_node_path130.basename)(relativePathFromCwd);
|
|
19509
20245
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
19510
20246
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
19511
20247
|
throw new Error(
|
|
@@ -19515,7 +20251,7 @@ async function putSubagent({
|
|
|
19515
20251
|
try {
|
|
19516
20252
|
const existingSubagents = await listSubagents();
|
|
19517
20253
|
const isUpdate = existingSubagents.some(
|
|
19518
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
20254
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
19519
20255
|
);
|
|
19520
20256
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
19521
20257
|
throw new Error(
|
|
@@ -19530,11 +20266,11 @@ async function putSubagent({
|
|
|
19530
20266
|
body,
|
|
19531
20267
|
validate: true
|
|
19532
20268
|
});
|
|
19533
|
-
const subagentsDir = (0,
|
|
20269
|
+
const subagentsDir = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
19534
20270
|
await ensureDir(subagentsDir);
|
|
19535
20271
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
19536
20272
|
return {
|
|
19537
|
-
relativePathFromCwd: (0,
|
|
20273
|
+
relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
19538
20274
|
frontmatter: subagent.getFrontmatter(),
|
|
19539
20275
|
body: subagent.getBody()
|
|
19540
20276
|
};
|
|
@@ -19549,12 +20285,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
19549
20285
|
relativePath: relativePathFromCwd,
|
|
19550
20286
|
intendedRootDir: process.cwd()
|
|
19551
20287
|
});
|
|
19552
|
-
const filename = (0,
|
|
19553
|
-
const fullPath = (0,
|
|
20288
|
+
const filename = (0, import_node_path130.basename)(relativePathFromCwd);
|
|
20289
|
+
const fullPath = (0, import_node_path130.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
19554
20290
|
try {
|
|
19555
20291
|
await removeFile(fullPath);
|
|
19556
20292
|
return {
|
|
19557
|
-
relativePathFromCwd: (0,
|
|
20293
|
+
relativePathFromCwd: (0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
19558
20294
|
};
|
|
19559
20295
|
} catch (error) {
|
|
19560
20296
|
throw new Error(
|
|
@@ -19566,23 +20302,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
19566
20302
|
}
|
|
19567
20303
|
}
|
|
19568
20304
|
var subagentToolSchemas = {
|
|
19569
|
-
listSubagents:
|
|
19570
|
-
getSubagent:
|
|
19571
|
-
relativePathFromCwd:
|
|
20305
|
+
listSubagents: import_mini68.z.object({}),
|
|
20306
|
+
getSubagent: import_mini68.z.object({
|
|
20307
|
+
relativePathFromCwd: import_mini68.z.string()
|
|
19572
20308
|
}),
|
|
19573
|
-
putSubagent:
|
|
19574
|
-
relativePathFromCwd:
|
|
20309
|
+
putSubagent: import_mini68.z.object({
|
|
20310
|
+
relativePathFromCwd: import_mini68.z.string(),
|
|
19575
20311
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
19576
|
-
body:
|
|
20312
|
+
body: import_mini68.z.string()
|
|
19577
20313
|
}),
|
|
19578
|
-
deleteSubagent:
|
|
19579
|
-
relativePathFromCwd:
|
|
20314
|
+
deleteSubagent: import_mini68.z.object({
|
|
20315
|
+
relativePathFromCwd: import_mini68.z.string()
|
|
19580
20316
|
})
|
|
19581
20317
|
};
|
|
19582
20318
|
var subagentTools = {
|
|
19583
20319
|
listSubagents: {
|
|
19584
20320
|
name: "listSubagents",
|
|
19585
|
-
description: `List all subagents from ${(0,
|
|
20321
|
+
description: `List all subagents from ${(0, import_node_path130.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
19586
20322
|
parameters: subagentToolSchemas.listSubagents,
|
|
19587
20323
|
execute: async () => {
|
|
19588
20324
|
const subagents = await listSubagents();
|
|
@@ -19624,7 +20360,7 @@ var subagentTools = {
|
|
|
19624
20360
|
};
|
|
19625
20361
|
|
|
19626
20362
|
// src/mcp/tools.ts
|
|
19627
|
-
var rulesyncFeatureSchema =
|
|
20363
|
+
var rulesyncFeatureSchema = import_mini69.z.enum([
|
|
19628
20364
|
"rule",
|
|
19629
20365
|
"command",
|
|
19630
20366
|
"subagent",
|
|
@@ -19634,21 +20370,21 @@ var rulesyncFeatureSchema = import_mini67.z.enum([
|
|
|
19634
20370
|
"generate",
|
|
19635
20371
|
"import"
|
|
19636
20372
|
]);
|
|
19637
|
-
var rulesyncOperationSchema =
|
|
19638
|
-
var skillFileSchema =
|
|
19639
|
-
name:
|
|
19640
|
-
body:
|
|
20373
|
+
var rulesyncOperationSchema = import_mini69.z.enum(["list", "get", "put", "delete", "run"]);
|
|
20374
|
+
var skillFileSchema = import_mini69.z.object({
|
|
20375
|
+
name: import_mini69.z.string(),
|
|
20376
|
+
body: import_mini69.z.string()
|
|
19641
20377
|
});
|
|
19642
|
-
var rulesyncToolSchema =
|
|
20378
|
+
var rulesyncToolSchema = import_mini69.z.object({
|
|
19643
20379
|
feature: rulesyncFeatureSchema,
|
|
19644
20380
|
operation: rulesyncOperationSchema,
|
|
19645
|
-
targetPathFromCwd:
|
|
19646
|
-
frontmatter:
|
|
19647
|
-
body:
|
|
19648
|
-
otherFiles:
|
|
19649
|
-
content:
|
|
19650
|
-
generateOptions:
|
|
19651
|
-
importOptions:
|
|
20381
|
+
targetPathFromCwd: import_mini69.z.optional(import_mini69.z.string()),
|
|
20382
|
+
frontmatter: import_mini69.z.optional(import_mini69.z.unknown()),
|
|
20383
|
+
body: import_mini69.z.optional(import_mini69.z.string()),
|
|
20384
|
+
otherFiles: import_mini69.z.optional(import_mini69.z.array(skillFileSchema)),
|
|
20385
|
+
content: import_mini69.z.optional(import_mini69.z.string()),
|
|
20386
|
+
generateOptions: import_mini69.z.optional(generateOptionsSchema),
|
|
20387
|
+
importOptions: import_mini69.z.optional(importOptionsSchema)
|
|
19652
20388
|
});
|
|
19653
20389
|
var supportedOperationsByFeature = {
|
|
19654
20390
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -20207,7 +20943,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
20207
20943
|
}
|
|
20208
20944
|
|
|
20209
20945
|
// src/cli/index.ts
|
|
20210
|
-
var getVersion = () => "7.
|
|
20946
|
+
var getVersion = () => "7.15.0";
|
|
20211
20947
|
var main = async () => {
|
|
20212
20948
|
const program = new import_commander.Command();
|
|
20213
20949
|
const version = getVersion();
|