rulesync 7.20.0 → 7.22.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 +3 -2
- package/dist/{chunk-5OPNV62F.js → chunk-4WYBBN4I.js} +901 -666
- package/dist/cli/index.cjs +1393 -1077
- package/dist/cli/index.js +333 -254
- package/dist/index.cjs +776 -550
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -7
- package/package.json +21 -17
|
@@ -15,168 +15,6 @@ function formatError(error) {
|
|
|
15
15
|
return String(error);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// src/types/json-output.ts
|
|
19
|
-
var ErrorCodes = {
|
|
20
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
21
|
-
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
22
|
-
INVALID_TARGET: "INVALID_TARGET",
|
|
23
|
-
FETCH_FAILED: "FETCH_FAILED",
|
|
24
|
-
WRITE_FAILED: "WRITE_FAILED",
|
|
25
|
-
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
26
|
-
GENERATION_FAILED: "GENERATION_FAILED",
|
|
27
|
-
IMPORT_FAILED: "IMPORT_FAILED",
|
|
28
|
-
INSTALL_FAILED: "INSTALL_FAILED",
|
|
29
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
30
|
-
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
31
|
-
INIT_FAILED: "INIT_FAILED",
|
|
32
|
-
MCP_FAILED: "MCP_FAILED",
|
|
33
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
34
|
-
};
|
|
35
|
-
var CLIError = class extends Error {
|
|
36
|
-
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
37
|
-
super(message);
|
|
38
|
-
this.code = code;
|
|
39
|
-
this.exitCode = exitCode;
|
|
40
|
-
this.name = "CLIError";
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// src/utils/vitest.ts
|
|
45
|
-
function isEnvTest() {
|
|
46
|
-
return process.env.NODE_ENV === "test";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/utils/logger.ts
|
|
50
|
-
var BaseLogger = class {
|
|
51
|
-
_verbose = false;
|
|
52
|
-
_silent = false;
|
|
53
|
-
get verbose() {
|
|
54
|
-
return this._verbose;
|
|
55
|
-
}
|
|
56
|
-
get silent() {
|
|
57
|
-
return this._silent;
|
|
58
|
-
}
|
|
59
|
-
configure({ verbose, silent }) {
|
|
60
|
-
if (verbose && silent) {
|
|
61
|
-
this._silent = false;
|
|
62
|
-
if (!isEnvTest()) {
|
|
63
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
this._silent = silent;
|
|
67
|
-
this._verbose = verbose && !silent;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
71
|
-
isSuppressed() {
|
|
72
|
-
return isEnvTest() || this._silent;
|
|
73
|
-
}
|
|
74
|
-
get jsonMode() {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
captureData(_key, _value) {
|
|
78
|
-
}
|
|
79
|
-
getJsonData() {
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
outputJson(_success, _error) {
|
|
83
|
-
}
|
|
84
|
-
info(message, ...args) {
|
|
85
|
-
if (this.isSuppressed()) return;
|
|
86
|
-
console.log(message, ...args);
|
|
87
|
-
}
|
|
88
|
-
success(message, ...args) {
|
|
89
|
-
if (this.isSuppressed()) return;
|
|
90
|
-
console.log(message, ...args);
|
|
91
|
-
}
|
|
92
|
-
warn(message, ...args) {
|
|
93
|
-
if (this.isSuppressed()) return;
|
|
94
|
-
console.warn(message, ...args);
|
|
95
|
-
}
|
|
96
|
-
error(message, _code, ...args) {
|
|
97
|
-
if (isEnvTest()) return;
|
|
98
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
99
|
-
console.error(errorMessage, ...args);
|
|
100
|
-
}
|
|
101
|
-
debug(message, ...args) {
|
|
102
|
-
if (this.isSuppressed()) return;
|
|
103
|
-
if (this._verbose) {
|
|
104
|
-
console.log(message, ...args);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
var JsonLogger = class extends BaseLogger {
|
|
109
|
-
_jsonOutputDone = false;
|
|
110
|
-
_jsonData = {};
|
|
111
|
-
_commandName;
|
|
112
|
-
_version;
|
|
113
|
-
constructor({ command, version }) {
|
|
114
|
-
super();
|
|
115
|
-
this._commandName = command;
|
|
116
|
-
this._version = version;
|
|
117
|
-
}
|
|
118
|
-
get jsonMode() {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
captureData(key, value) {
|
|
122
|
-
this._jsonData[key] = value;
|
|
123
|
-
}
|
|
124
|
-
getJsonData() {
|
|
125
|
-
return { ...this._jsonData };
|
|
126
|
-
}
|
|
127
|
-
outputJson(success, error) {
|
|
128
|
-
if (this._jsonOutputDone) return;
|
|
129
|
-
this._jsonOutputDone = true;
|
|
130
|
-
const output = {
|
|
131
|
-
success,
|
|
132
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
133
|
-
command: this._commandName,
|
|
134
|
-
version: this._version
|
|
135
|
-
};
|
|
136
|
-
if (success) {
|
|
137
|
-
output.data = this._jsonData;
|
|
138
|
-
} else if (error) {
|
|
139
|
-
output.error = {
|
|
140
|
-
code: error.code,
|
|
141
|
-
message: error.message
|
|
142
|
-
};
|
|
143
|
-
if (error.details) {
|
|
144
|
-
output.error.details = error.details;
|
|
145
|
-
}
|
|
146
|
-
if (error.stack) {
|
|
147
|
-
output.error.stack = error.stack;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const jsonStr = JSON.stringify(output, null, 2);
|
|
151
|
-
if (success) {
|
|
152
|
-
console.log(jsonStr);
|
|
153
|
-
} else {
|
|
154
|
-
console.error(jsonStr);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
info(_message, ..._args) {
|
|
158
|
-
}
|
|
159
|
-
success(_message, ..._args) {
|
|
160
|
-
}
|
|
161
|
-
warn(_message, ..._args) {
|
|
162
|
-
}
|
|
163
|
-
error(message, code, ..._args) {
|
|
164
|
-
if (isEnvTest()) return;
|
|
165
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
166
|
-
const errorInfo = {
|
|
167
|
-
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
168
|
-
message: errorMessage
|
|
169
|
-
};
|
|
170
|
-
if (this._verbose && message instanceof Error && message.stack) {
|
|
171
|
-
errorInfo.stack = message.stack;
|
|
172
|
-
}
|
|
173
|
-
this.outputJson(false, errorInfo);
|
|
174
|
-
}
|
|
175
|
-
debug(_message, ..._args) {
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
var logger = new ConsoleLogger();
|
|
179
|
-
|
|
180
18
|
// src/types/features.ts
|
|
181
19
|
import { z } from "zod/mini";
|
|
182
20
|
var ALL_FEATURES = [
|
|
@@ -186,7 +24,8 @@ var ALL_FEATURES = [
|
|
|
186
24
|
"subagents",
|
|
187
25
|
"commands",
|
|
188
26
|
"skills",
|
|
189
|
-
"hooks"
|
|
27
|
+
"hooks",
|
|
28
|
+
"permissions"
|
|
190
29
|
];
|
|
191
30
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
192
31
|
var FeatureSchema = z.enum(ALL_FEATURES);
|
|
@@ -209,6 +48,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
209
48
|
"cline",
|
|
210
49
|
"codexcli",
|
|
211
50
|
"copilot",
|
|
51
|
+
"copilotcli",
|
|
212
52
|
"cursor",
|
|
213
53
|
"factorydroid",
|
|
214
54
|
"geminicli",
|
|
@@ -243,6 +83,10 @@ var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "comm
|
|
|
243
83
|
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
244
84
|
var RULESYNC_MCP_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
245
85
|
var RULESYNC_HOOKS_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "hooks.json");
|
|
86
|
+
var RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH = join(
|
|
87
|
+
RULESYNC_RELATIVE_DIR_PATH,
|
|
88
|
+
"permissions.json"
|
|
89
|
+
);
|
|
246
90
|
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
247
91
|
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
248
92
|
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
@@ -255,6 +99,7 @@ var RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH = join(
|
|
|
255
99
|
var RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH = "rulesync.lock";
|
|
256
100
|
var RULESYNC_MCP_FILE_NAME = "mcp.json";
|
|
257
101
|
var RULESYNC_HOOKS_FILE_NAME = "hooks.json";
|
|
102
|
+
var RULESYNC_PERMISSIONS_FILE_NAME = "permissions.json";
|
|
258
103
|
var RULESYNC_CONFIG_SCHEMA_URL = "https://github.com/dyoshikawa/rulesync/releases/latest/download/config-schema.json";
|
|
259
104
|
var RULESYNC_MCP_SCHEMA_URL = "https://github.com/dyoshikawa/rulesync/releases/latest/download/mcp-schema.json";
|
|
260
105
|
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
@@ -266,6 +111,13 @@ import os from "os";
|
|
|
266
111
|
import { dirname, join as join2, relative, resolve } from "path";
|
|
267
112
|
import { kebabCase } from "es-toolkit";
|
|
268
113
|
import { globbySync } from "globby";
|
|
114
|
+
|
|
115
|
+
// src/utils/vitest.ts
|
|
116
|
+
function isEnvTest() {
|
|
117
|
+
return process.env.NODE_ENV === "test";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/utils/file.ts
|
|
269
121
|
async function ensureDir(dirPath) {
|
|
270
122
|
try {
|
|
271
123
|
await stat(dirPath);
|
|
@@ -310,7 +162,6 @@ async function directoryExists(dirPath) {
|
|
|
310
162
|
}
|
|
311
163
|
}
|
|
312
164
|
async function readFileContent(filepath) {
|
|
313
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
314
165
|
return readFile(filepath, "utf-8");
|
|
315
166
|
}
|
|
316
167
|
async function readFileContentOrNull(filepath) {
|
|
@@ -320,7 +171,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
320
171
|
return null;
|
|
321
172
|
}
|
|
322
173
|
async function readFileBuffer(filepath) {
|
|
323
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
324
174
|
return readFile(filepath);
|
|
325
175
|
}
|
|
326
176
|
function addTrailingNewline(content) {
|
|
@@ -330,7 +180,6 @@ function addTrailingNewline(content) {
|
|
|
330
180
|
return content.trimEnd() + "\n";
|
|
331
181
|
}
|
|
332
182
|
async function writeFileContent(filepath, content) {
|
|
333
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
334
183
|
await ensureDir(dirname(filepath));
|
|
335
184
|
await writeFile(filepath, content, "utf-8");
|
|
336
185
|
}
|
|
@@ -381,25 +230,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
381
230
|
async function removeDirectory(dirPath) {
|
|
382
231
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
383
232
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
384
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
385
233
|
return;
|
|
386
234
|
}
|
|
387
235
|
try {
|
|
388
236
|
if (await fileExists(dirPath)) {
|
|
389
237
|
await rm(dirPath, { recursive: true, force: true });
|
|
390
238
|
}
|
|
391
|
-
} catch
|
|
392
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
239
|
+
} catch {
|
|
393
240
|
}
|
|
394
241
|
}
|
|
395
242
|
async function removeFile(filepath) {
|
|
396
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
397
243
|
try {
|
|
398
244
|
if (await fileExists(filepath)) {
|
|
399
245
|
await rm(filepath);
|
|
400
246
|
}
|
|
401
|
-
} catch
|
|
402
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
247
|
+
} catch {
|
|
403
248
|
}
|
|
404
249
|
}
|
|
405
250
|
function getHomeDirectory() {
|
|
@@ -433,9 +278,7 @@ async function createTempDirectory(prefix = "rulesync-fetch-") {
|
|
|
433
278
|
async function removeTempDirectory(tempDir) {
|
|
434
279
|
try {
|
|
435
280
|
await rm(tempDir, { recursive: true, force: true });
|
|
436
|
-
logger.debug(`Removed temp directory: ${tempDir}`);
|
|
437
281
|
} catch {
|
|
438
|
-
logger.debug(`Failed to clean up temp directory: ${tempDir}`);
|
|
439
282
|
}
|
|
440
283
|
}
|
|
441
284
|
|
|
@@ -673,16 +516,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
673
516
|
if (!await fileExists(filePath)) {
|
|
674
517
|
return {};
|
|
675
518
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
return configParams;
|
|
682
|
-
} catch (error) {
|
|
683
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
684
|
-
throw error;
|
|
685
|
-
}
|
|
519
|
+
const fileContent = await readFileContent(filePath);
|
|
520
|
+
const jsonData = parseJsonc(fileContent);
|
|
521
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
522
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
523
|
+
return configParams;
|
|
686
524
|
};
|
|
687
525
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
688
526
|
return {
|
|
@@ -763,7 +601,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
763
601
|
}
|
|
764
602
|
|
|
765
603
|
// src/lib/generate.ts
|
|
766
|
-
import { join as
|
|
604
|
+
import { join as join118 } from "path";
|
|
767
605
|
import { intersection } from "es-toolkit";
|
|
768
606
|
|
|
769
607
|
// src/features/commands/commands-processor.ts
|
|
@@ -774,9 +612,15 @@ import { z as z14 } from "zod/mini";
|
|
|
774
612
|
var FeatureProcessor = class {
|
|
775
613
|
baseDir;
|
|
776
614
|
dryRun;
|
|
777
|
-
|
|
615
|
+
logger;
|
|
616
|
+
constructor({
|
|
617
|
+
baseDir = process.cwd(),
|
|
618
|
+
dryRun = false,
|
|
619
|
+
logger
|
|
620
|
+
}) {
|
|
778
621
|
this.baseDir = baseDir;
|
|
779
622
|
this.dryRun = dryRun;
|
|
623
|
+
this.logger = logger;
|
|
780
624
|
}
|
|
781
625
|
/**
|
|
782
626
|
* Return tool targets that this feature supports.
|
|
@@ -799,7 +643,7 @@ var FeatureProcessor = class {
|
|
|
799
643
|
continue;
|
|
800
644
|
}
|
|
801
645
|
if (this.dryRun) {
|
|
802
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
646
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
803
647
|
} else {
|
|
804
648
|
await writeFileContent(filePath, contentWithNewline);
|
|
805
649
|
}
|
|
@@ -823,7 +667,7 @@ var FeatureProcessor = class {
|
|
|
823
667
|
for (const aiFile of orphanFiles) {
|
|
824
668
|
const filePath = aiFile.getFilePath();
|
|
825
669
|
if (this.dryRun) {
|
|
826
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
670
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
827
671
|
} else {
|
|
828
672
|
await removeFile(filePath);
|
|
829
673
|
}
|
|
@@ -3079,7 +2923,7 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
3079
2923
|
meta: {
|
|
3080
2924
|
extension: "md",
|
|
3081
2925
|
supportsProject: true,
|
|
3082
|
-
supportsGlobal:
|
|
2926
|
+
supportsGlobal: false,
|
|
3083
2927
|
isSimulated: true,
|
|
3084
2928
|
supportsSubdirectory: false
|
|
3085
2929
|
}
|
|
@@ -3195,9 +3039,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3195
3039
|
toolTarget,
|
|
3196
3040
|
global = false,
|
|
3197
3041
|
getFactory = defaultGetFactory,
|
|
3198
|
-
dryRun = false
|
|
3042
|
+
dryRun = false,
|
|
3043
|
+
logger
|
|
3199
3044
|
}) {
|
|
3200
|
-
super({ baseDir, dryRun });
|
|
3045
|
+
super({ baseDir, dryRun, logger });
|
|
3201
3046
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3202
3047
|
if (!result.success) {
|
|
3203
3048
|
throw new Error(
|
|
@@ -3224,7 +3069,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3224
3069
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3225
3070
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3226
3071
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3227
|
-
logger.warn(
|
|
3072
|
+
this.logger.warn(
|
|
3228
3073
|
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". Only the last processed command will be used.`
|
|
3229
3074
|
);
|
|
3230
3075
|
} else if (!firstOrigin) {
|
|
@@ -3270,7 +3115,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3270
3115
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3271
3116
|
)
|
|
3272
3117
|
);
|
|
3273
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3118
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3274
3119
|
return rulesyncCommands;
|
|
3275
3120
|
}
|
|
3276
3121
|
/**
|
|
@@ -3294,7 +3139,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3294
3139
|
global: this.global
|
|
3295
3140
|
})
|
|
3296
3141
|
).filter((cmd) => cmd.isDeletable());
|
|
3297
|
-
logger.debug(
|
|
3142
|
+
this.logger.debug(
|
|
3143
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3144
|
+
);
|
|
3298
3145
|
return toolCommands2;
|
|
3299
3146
|
}
|
|
3300
3147
|
const toolCommands = await Promise.all(
|
|
@@ -3306,7 +3153,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3306
3153
|
})
|
|
3307
3154
|
)
|
|
3308
3155
|
);
|
|
3309
|
-
logger.debug(
|
|
3156
|
+
this.logger.debug(
|
|
3157
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3158
|
+
);
|
|
3310
3159
|
return toolCommands;
|
|
3311
3160
|
}
|
|
3312
3161
|
/**
|
|
@@ -3575,7 +3424,8 @@ function isToolMatcherEntry(x) {
|
|
|
3575
3424
|
function canonicalToToolHooks({
|
|
3576
3425
|
config,
|
|
3577
3426
|
toolOverrideHooks,
|
|
3578
|
-
converterConfig
|
|
3427
|
+
converterConfig,
|
|
3428
|
+
logger
|
|
3579
3429
|
}) {
|
|
3580
3430
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3581
3431
|
const sharedHooks = {};
|
|
@@ -3602,7 +3452,7 @@ function canonicalToToolHooks({
|
|
|
3602
3452
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3603
3453
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3604
3454
|
if (isNoMatcherEvent && matcherKey) {
|
|
3605
|
-
logger
|
|
3455
|
+
logger?.warn(
|
|
3606
3456
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3607
3457
|
);
|
|
3608
3458
|
}
|
|
@@ -3799,7 +3649,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3799
3649
|
baseDir = process.cwd(),
|
|
3800
3650
|
rulesyncHooks,
|
|
3801
3651
|
validate = true,
|
|
3802
|
-
global = false
|
|
3652
|
+
global = false,
|
|
3653
|
+
logger
|
|
3803
3654
|
}) {
|
|
3804
3655
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3805
3656
|
const filePath = join22(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3820,7 +3671,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3820
3671
|
const claudeHooks = canonicalToToolHooks({
|
|
3821
3672
|
config,
|
|
3822
3673
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3823
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3674
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3675
|
+
logger
|
|
3824
3676
|
});
|
|
3825
3677
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3826
3678
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3920,14 +3772,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3920
3772
|
}
|
|
3921
3773
|
return copilot;
|
|
3922
3774
|
}
|
|
3923
|
-
function resolveImportCommand(entry) {
|
|
3775
|
+
function resolveImportCommand(entry, logger) {
|
|
3924
3776
|
const hasBash = typeof entry.bash === "string";
|
|
3925
3777
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3926
3778
|
if (hasBash && hasPowershell) {
|
|
3927
3779
|
const isWindows = process.platform === "win32";
|
|
3928
3780
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3929
3781
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3930
|
-
logger
|
|
3782
|
+
logger?.warn(
|
|
3931
3783
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3932
3784
|
);
|
|
3933
3785
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3938,7 +3790,7 @@ function resolveImportCommand(entry) {
|
|
|
3938
3790
|
}
|
|
3939
3791
|
return void 0;
|
|
3940
3792
|
}
|
|
3941
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3793
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3942
3794
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3943
3795
|
return {};
|
|
3944
3796
|
}
|
|
@@ -3951,7 +3803,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3951
3803
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3952
3804
|
if (!parseResult.success) continue;
|
|
3953
3805
|
const entry = parseResult.data;
|
|
3954
|
-
const command = resolveImportCommand(entry);
|
|
3806
|
+
const command = resolveImportCommand(entry, logger);
|
|
3955
3807
|
const timeout = entry.timeoutSec;
|
|
3956
3808
|
defs.push({
|
|
3957
3809
|
type: "command",
|
|
@@ -4011,7 +3863,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4011
3863
|
validate
|
|
4012
3864
|
});
|
|
4013
3865
|
}
|
|
4014
|
-
toRulesyncHooks() {
|
|
3866
|
+
toRulesyncHooks(options) {
|
|
4015
3867
|
let parsed;
|
|
4016
3868
|
try {
|
|
4017
3869
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -4023,7 +3875,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4023
3875
|
}
|
|
4024
3876
|
);
|
|
4025
3877
|
}
|
|
4026
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3878
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
4027
3879
|
return this.toRulesyncHooksDefault({
|
|
4028
3880
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
4029
3881
|
});
|
|
@@ -4195,7 +4047,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4195
4047
|
baseDir = process.cwd(),
|
|
4196
4048
|
rulesyncHooks,
|
|
4197
4049
|
validate = true,
|
|
4198
|
-
global = false
|
|
4050
|
+
global = false,
|
|
4051
|
+
logger
|
|
4199
4052
|
}) {
|
|
4200
4053
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4201
4054
|
const filePath = join25(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4216,7 +4069,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4216
4069
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4217
4070
|
config,
|
|
4218
4071
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4219
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4072
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4073
|
+
logger
|
|
4220
4074
|
});
|
|
4221
4075
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4222
4076
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4715,9 +4569,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4715
4569
|
baseDir = process.cwd(),
|
|
4716
4570
|
toolTarget,
|
|
4717
4571
|
global = false,
|
|
4718
|
-
dryRun = false
|
|
4572
|
+
dryRun = false,
|
|
4573
|
+
logger
|
|
4719
4574
|
}) {
|
|
4720
|
-
super({ baseDir, dryRun });
|
|
4575
|
+
super({ baseDir, dryRun, logger });
|
|
4721
4576
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4722
4577
|
if (!result.success) {
|
|
4723
4578
|
throw new Error(
|
|
@@ -4736,7 +4591,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4736
4591
|
})
|
|
4737
4592
|
];
|
|
4738
4593
|
} catch (error) {
|
|
4739
|
-
logger.error(
|
|
4594
|
+
this.logger.error(
|
|
4740
4595
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4741
4596
|
);
|
|
4742
4597
|
return [];
|
|
@@ -4755,7 +4610,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4755
4610
|
global: this.global
|
|
4756
4611
|
});
|
|
4757
4612
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4758
|
-
logger.debug(
|
|
4613
|
+
this.logger.debug(
|
|
4759
4614
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4760
4615
|
);
|
|
4761
4616
|
return list;
|
|
@@ -4765,14 +4620,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4765
4620
|
validate: true,
|
|
4766
4621
|
global: this.global
|
|
4767
4622
|
});
|
|
4768
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4623
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4769
4624
|
return [toolHooks];
|
|
4770
4625
|
} catch (error) {
|
|
4771
4626
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4772
4627
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4773
|
-
logger.debug(msg);
|
|
4628
|
+
this.logger.debug(msg);
|
|
4774
4629
|
} else {
|
|
4775
|
-
logger.error(msg);
|
|
4630
|
+
this.logger.error(msg);
|
|
4776
4631
|
}
|
|
4777
4632
|
return [];
|
|
4778
4633
|
}
|
|
@@ -4793,7 +4648,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4793
4648
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4794
4649
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4795
4650
|
if (skipped.length > 0) {
|
|
4796
|
-
logger.warn(
|
|
4651
|
+
this.logger.warn(
|
|
4797
4652
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4798
4653
|
);
|
|
4799
4654
|
}
|
|
@@ -4812,7 +4667,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4812
4667
|
}
|
|
4813
4668
|
}
|
|
4814
4669
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4815
|
-
logger.warn(
|
|
4670
|
+
this.logger.warn(
|
|
4816
4671
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4817
4672
|
);
|
|
4818
4673
|
}
|
|
@@ -4827,7 +4682,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4827
4682
|
}
|
|
4828
4683
|
}
|
|
4829
4684
|
if (eventsWithMatcher.size > 0) {
|
|
4830
|
-
logger.warn(
|
|
4685
|
+
this.logger.warn(
|
|
4831
4686
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4832
4687
|
);
|
|
4833
4688
|
}
|
|
@@ -5889,9 +5744,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5889
5744
|
baseDir = process.cwd(),
|
|
5890
5745
|
toolTarget,
|
|
5891
5746
|
getFactory = defaultGetFactory2,
|
|
5892
|
-
dryRun = false
|
|
5747
|
+
dryRun = false,
|
|
5748
|
+
logger
|
|
5893
5749
|
}) {
|
|
5894
|
-
super({ baseDir, dryRun });
|
|
5750
|
+
super({ baseDir, dryRun, logger });
|
|
5895
5751
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5896
5752
|
if (!result.success) {
|
|
5897
5753
|
throw new Error(
|
|
@@ -5913,7 +5769,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5913
5769
|
try {
|
|
5914
5770
|
return [await RulesyncIgnore.fromFile()];
|
|
5915
5771
|
} catch (error) {
|
|
5916
|
-
logger.error(
|
|
5772
|
+
this.logger.error(
|
|
5917
5773
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5918
5774
|
);
|
|
5919
5775
|
return [];
|
|
@@ -5943,9 +5799,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5943
5799
|
} catch (error) {
|
|
5944
5800
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5945
5801
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5946
|
-
logger.debug(errorMessage);
|
|
5802
|
+
this.logger.debug(errorMessage);
|
|
5947
5803
|
} else {
|
|
5948
|
-
logger.error(errorMessage);
|
|
5804
|
+
this.logger.error(errorMessage);
|
|
5949
5805
|
}
|
|
5950
5806
|
return [];
|
|
5951
5807
|
}
|
|
@@ -6075,7 +5931,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6075
5931
|
}
|
|
6076
5932
|
return { success: true, error: null };
|
|
6077
5933
|
}
|
|
6078
|
-
static async fromFile({
|
|
5934
|
+
static async fromFile({
|
|
5935
|
+
validate = true,
|
|
5936
|
+
logger
|
|
5937
|
+
}) {
|
|
6079
5938
|
const baseDir = process.cwd();
|
|
6080
5939
|
const paths = this.getSettablePaths();
|
|
6081
5940
|
const recommendedPath = join42(
|
|
@@ -6095,7 +5954,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6095
5954
|
});
|
|
6096
5955
|
}
|
|
6097
5956
|
if (await fileExists(legacyPath)) {
|
|
6098
|
-
logger
|
|
5957
|
+
logger?.warn(
|
|
6099
5958
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6100
5959
|
);
|
|
6101
5960
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6597,59 +6456,196 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6597
6456
|
}
|
|
6598
6457
|
};
|
|
6599
6458
|
|
|
6600
|
-
// src/features/mcp/
|
|
6459
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6601
6460
|
import { join as join47 } from "path";
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
}
|
|
6461
|
+
function addTypeField(mcpServers) {
|
|
6462
|
+
const result = {};
|
|
6463
|
+
for (const [name, server] of Object.entries(mcpServers)) {
|
|
6464
|
+
const parsed = McpServerSchema.parse(server);
|
|
6465
|
+
if (!parsed.command) {
|
|
6466
|
+
throw new Error(
|
|
6467
|
+
`MCP server "${name}" is missing a command. GitHub Copilot CLI stdio servers require a non-empty command.`
|
|
6468
|
+
);
|
|
6469
|
+
}
|
|
6470
|
+
let command;
|
|
6471
|
+
let args;
|
|
6472
|
+
if (typeof parsed.command === "string") {
|
|
6473
|
+
command = parsed.command;
|
|
6474
|
+
args = parsed.args;
|
|
6475
|
+
} else {
|
|
6476
|
+
const [cmd, ...cmdArgs] = parsed.command;
|
|
6477
|
+
if (!cmd) {
|
|
6478
|
+
throw new Error(`MCP server "${name}" has an empty command array.`);
|
|
6620
6479
|
}
|
|
6621
|
-
|
|
6622
|
-
|
|
6480
|
+
command = cmd;
|
|
6481
|
+
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6482
|
+
}
|
|
6483
|
+
result[name] = {
|
|
6484
|
+
type: "stdio",
|
|
6485
|
+
command,
|
|
6486
|
+
...args && { args },
|
|
6487
|
+
...parsed.env && { env: parsed.env }
|
|
6488
|
+
};
|
|
6489
|
+
}
|
|
6490
|
+
return result;
|
|
6623
6491
|
}
|
|
6624
|
-
function
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
env: Object.fromEntries(
|
|
6632
|
-
Object.entries(config.env).map(([k, v]) => [
|
|
6633
|
-
k,
|
|
6634
|
-
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
6635
|
-
])
|
|
6636
|
-
)
|
|
6637
|
-
}
|
|
6638
|
-
}
|
|
6639
|
-
])
|
|
6640
|
-
);
|
|
6492
|
+
function removeTypeField(config) {
|
|
6493
|
+
const result = {};
|
|
6494
|
+
for (const [name, server] of Object.entries(config.mcpServers ?? {})) {
|
|
6495
|
+
const { type: _, ...rest } = server;
|
|
6496
|
+
result[name] = rest;
|
|
6497
|
+
}
|
|
6498
|
+
return result;
|
|
6641
6499
|
}
|
|
6642
|
-
var
|
|
6500
|
+
var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
6643
6501
|
json;
|
|
6644
6502
|
constructor(params) {
|
|
6645
6503
|
super(params);
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6504
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
6505
|
+
}
|
|
6506
|
+
getJson() {
|
|
6507
|
+
return this.json;
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* In global mode, ~/.copilot/mcp-config.json should not be deleted
|
|
6511
|
+
* as it may contain other user settings.
|
|
6512
|
+
* In local mode, .copilot/mcp-config.json can be safely deleted.
|
|
6513
|
+
*/
|
|
6514
|
+
isDeletable() {
|
|
6515
|
+
return !this.global;
|
|
6516
|
+
}
|
|
6517
|
+
static getSettablePaths({ global } = {}) {
|
|
6518
|
+
if (global) {
|
|
6519
|
+
return {
|
|
6520
|
+
relativeDirPath: ".copilot",
|
|
6521
|
+
relativeFilePath: "mcp-config.json"
|
|
6522
|
+
};
|
|
6523
|
+
}
|
|
6524
|
+
return {
|
|
6525
|
+
relativeDirPath: ".copilot",
|
|
6526
|
+
relativeFilePath: "mcp-config.json"
|
|
6527
|
+
};
|
|
6528
|
+
}
|
|
6529
|
+
static async fromFile({
|
|
6530
|
+
baseDir = process.cwd(),
|
|
6531
|
+
validate = true,
|
|
6532
|
+
global = false
|
|
6533
|
+
}) {
|
|
6534
|
+
const paths = this.getSettablePaths({ global });
|
|
6535
|
+
const fileContent = await readFileContentOrNull(join47(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6536
|
+
const json = JSON.parse(fileContent);
|
|
6537
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6538
|
+
return new _CopilotcliMcp({
|
|
6539
|
+
baseDir,
|
|
6540
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6541
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6542
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
6543
|
+
validate,
|
|
6544
|
+
global
|
|
6545
|
+
});
|
|
6546
|
+
}
|
|
6547
|
+
static async fromRulesyncMcp({
|
|
6548
|
+
baseDir = process.cwd(),
|
|
6549
|
+
rulesyncMcp,
|
|
6550
|
+
validate = true,
|
|
6551
|
+
global = false
|
|
6552
|
+
}) {
|
|
6553
|
+
const paths = this.getSettablePaths({ global });
|
|
6554
|
+
const fileContent = await readOrInitializeFileContent(
|
|
6555
|
+
join47(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6556
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6557
|
+
);
|
|
6558
|
+
const json = JSON.parse(fileContent);
|
|
6559
|
+
const copilotCliMcpServers = addTypeField(rulesyncMcp.getMcpServers());
|
|
6560
|
+
const mcpJson = { ...json, mcpServers: copilotCliMcpServers };
|
|
6561
|
+
return new _CopilotcliMcp({
|
|
6562
|
+
baseDir,
|
|
6563
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6564
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6565
|
+
fileContent: JSON.stringify(mcpJson, null, 2),
|
|
6566
|
+
validate,
|
|
6567
|
+
global
|
|
6568
|
+
});
|
|
6569
|
+
}
|
|
6570
|
+
toRulesyncMcp() {
|
|
6571
|
+
const mcpServers = removeTypeField(this.json);
|
|
6572
|
+
return this.toRulesyncMcpDefault({
|
|
6573
|
+
fileContent: JSON.stringify({ mcpServers }, null, 2)
|
|
6574
|
+
});
|
|
6575
|
+
}
|
|
6576
|
+
validate() {
|
|
6577
|
+
return { success: true, error: null };
|
|
6578
|
+
}
|
|
6579
|
+
static forDeletion({
|
|
6580
|
+
baseDir = process.cwd(),
|
|
6581
|
+
relativeDirPath,
|
|
6582
|
+
relativeFilePath,
|
|
6583
|
+
global = false
|
|
6584
|
+
}) {
|
|
6585
|
+
return new _CopilotcliMcp({
|
|
6586
|
+
baseDir,
|
|
6587
|
+
relativeDirPath,
|
|
6588
|
+
relativeFilePath,
|
|
6589
|
+
fileContent: "{}",
|
|
6590
|
+
validate: false,
|
|
6591
|
+
global
|
|
6592
|
+
});
|
|
6593
|
+
}
|
|
6594
|
+
};
|
|
6595
|
+
|
|
6596
|
+
// src/features/mcp/cursor-mcp.ts
|
|
6597
|
+
import { join as join48 } from "path";
|
|
6598
|
+
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6599
|
+
function isMcpServers(value) {
|
|
6600
|
+
return value !== void 0 && value !== null && typeof value === "object";
|
|
6601
|
+
}
|
|
6602
|
+
function convertEnvFromCursorFormat(mcpServers) {
|
|
6603
|
+
return Object.fromEntries(
|
|
6604
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
6605
|
+
name,
|
|
6606
|
+
{
|
|
6607
|
+
...config,
|
|
6608
|
+
...config.env && {
|
|
6609
|
+
env: Object.fromEntries(
|
|
6610
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
6611
|
+
k,
|
|
6612
|
+
v.replace(CURSOR_ENV_VAR_PATTERN, "${$1}")
|
|
6613
|
+
])
|
|
6614
|
+
)
|
|
6615
|
+
}
|
|
6616
|
+
}
|
|
6617
|
+
])
|
|
6618
|
+
);
|
|
6619
|
+
}
|
|
6620
|
+
function convertEnvToCursorFormat(mcpServers) {
|
|
6621
|
+
return Object.fromEntries(
|
|
6622
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
6623
|
+
name,
|
|
6624
|
+
{
|
|
6625
|
+
...config,
|
|
6626
|
+
...config.env && {
|
|
6627
|
+
env: Object.fromEntries(
|
|
6628
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
6629
|
+
k,
|
|
6630
|
+
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
6631
|
+
])
|
|
6632
|
+
)
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
])
|
|
6636
|
+
);
|
|
6637
|
+
}
|
|
6638
|
+
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
6639
|
+
json;
|
|
6640
|
+
constructor(params) {
|
|
6641
|
+
super(params);
|
|
6642
|
+
if (this.fileContent !== void 0) {
|
|
6643
|
+
try {
|
|
6644
|
+
this.json = JSON.parse(this.fileContent);
|
|
6645
|
+
} catch (error) {
|
|
6646
|
+
throw new Error(
|
|
6647
|
+
`Failed to parse Cursor MCP config at ${join48(this.relativeDirPath, this.relativeFilePath)}: ${formatError(error)}`,
|
|
6648
|
+
{ cause: error }
|
|
6653
6649
|
);
|
|
6654
6650
|
}
|
|
6655
6651
|
} else {
|
|
@@ -6674,14 +6670,14 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6674
6670
|
global = false
|
|
6675
6671
|
}) {
|
|
6676
6672
|
const paths = this.getSettablePaths({ global });
|
|
6677
|
-
const filePath =
|
|
6673
|
+
const filePath = join48(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6678
6674
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6679
6675
|
let json;
|
|
6680
6676
|
try {
|
|
6681
6677
|
json = JSON.parse(fileContent);
|
|
6682
6678
|
} catch (error) {
|
|
6683
6679
|
throw new Error(
|
|
6684
|
-
`Failed to parse Cursor MCP config at ${
|
|
6680
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6685
6681
|
{ cause: error }
|
|
6686
6682
|
);
|
|
6687
6683
|
}
|
|
@@ -6703,7 +6699,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6703
6699
|
}) {
|
|
6704
6700
|
const paths = this.getSettablePaths({ global });
|
|
6705
6701
|
const fileContent = await readOrInitializeFileContent(
|
|
6706
|
-
|
|
6702
|
+
join48(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6707
6703
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6708
6704
|
);
|
|
6709
6705
|
let json;
|
|
@@ -6711,7 +6707,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6711
6707
|
json = JSON.parse(fileContent);
|
|
6712
6708
|
} catch (error) {
|
|
6713
6709
|
throw new Error(
|
|
6714
|
-
`Failed to parse Cursor MCP config at ${
|
|
6710
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6715
6711
|
{ cause: error }
|
|
6716
6712
|
);
|
|
6717
6713
|
}
|
|
@@ -6760,7 +6756,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6760
6756
|
};
|
|
6761
6757
|
|
|
6762
6758
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6763
|
-
import { join as
|
|
6759
|
+
import { join as join49 } from "path";
|
|
6764
6760
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6765
6761
|
json;
|
|
6766
6762
|
constructor(params) {
|
|
@@ -6781,7 +6777,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6781
6777
|
validate = true
|
|
6782
6778
|
}) {
|
|
6783
6779
|
const fileContent = await readFileContent(
|
|
6784
|
-
|
|
6780
|
+
join49(
|
|
6785
6781
|
baseDir,
|
|
6786
6782
|
this.getSettablePaths().relativeDirPath,
|
|
6787
6783
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6835,7 +6831,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6835
6831
|
};
|
|
6836
6832
|
|
|
6837
6833
|
// src/features/mcp/geminicli-mcp.ts
|
|
6838
|
-
import { join as
|
|
6834
|
+
import { join as join50 } from "path";
|
|
6839
6835
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6840
6836
|
json;
|
|
6841
6837
|
constructor(params) {
|
|
@@ -6863,7 +6859,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6863
6859
|
global = false
|
|
6864
6860
|
}) {
|
|
6865
6861
|
const paths = this.getSettablePaths({ global });
|
|
6866
|
-
const fileContent = await readFileContentOrNull(
|
|
6862
|
+
const fileContent = await readFileContentOrNull(join50(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6867
6863
|
const json = JSON.parse(fileContent);
|
|
6868
6864
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6869
6865
|
return new _GeminiCliMcp({
|
|
@@ -6882,7 +6878,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6882
6878
|
}) {
|
|
6883
6879
|
const paths = this.getSettablePaths({ global });
|
|
6884
6880
|
const fileContent = await readOrInitializeFileContent(
|
|
6885
|
-
|
|
6881
|
+
join50(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6886
6882
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6887
6883
|
);
|
|
6888
6884
|
const json = JSON.parse(fileContent);
|
|
@@ -6927,7 +6923,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6927
6923
|
};
|
|
6928
6924
|
|
|
6929
6925
|
// src/features/mcp/junie-mcp.ts
|
|
6930
|
-
import { join as
|
|
6926
|
+
import { join as join51 } from "path";
|
|
6931
6927
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6932
6928
|
json;
|
|
6933
6929
|
constructor(params) {
|
|
@@ -6939,7 +6935,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6939
6935
|
}
|
|
6940
6936
|
static getSettablePaths() {
|
|
6941
6937
|
return {
|
|
6942
|
-
relativeDirPath:
|
|
6938
|
+
relativeDirPath: join51(".junie", "mcp"),
|
|
6943
6939
|
relativeFilePath: "mcp.json"
|
|
6944
6940
|
};
|
|
6945
6941
|
}
|
|
@@ -6948,7 +6944,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6948
6944
|
validate = true
|
|
6949
6945
|
}) {
|
|
6950
6946
|
const fileContent = await readFileContent(
|
|
6951
|
-
|
|
6947
|
+
join51(
|
|
6952
6948
|
baseDir,
|
|
6953
6949
|
this.getSettablePaths().relativeDirPath,
|
|
6954
6950
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6997,7 +6993,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6997
6993
|
};
|
|
6998
6994
|
|
|
6999
6995
|
// src/features/mcp/kilo-mcp.ts
|
|
7000
|
-
import { join as
|
|
6996
|
+
import { join as join52 } from "path";
|
|
7001
6997
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
7002
6998
|
json;
|
|
7003
6999
|
constructor(params) {
|
|
@@ -7018,7 +7014,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7018
7014
|
validate = true
|
|
7019
7015
|
}) {
|
|
7020
7016
|
const paths = this.getSettablePaths();
|
|
7021
|
-
const fileContent = await readFileContentOrNull(
|
|
7017
|
+
const fileContent = await readFileContentOrNull(join52(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7022
7018
|
return new _KiloMcp({
|
|
7023
7019
|
baseDir,
|
|
7024
7020
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7066,7 +7062,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7066
7062
|
};
|
|
7067
7063
|
|
|
7068
7064
|
// src/features/mcp/kiro-mcp.ts
|
|
7069
|
-
import { join as
|
|
7065
|
+
import { join as join53 } from "path";
|
|
7070
7066
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
7071
7067
|
json;
|
|
7072
7068
|
constructor(params) {
|
|
@@ -7078,7 +7074,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7078
7074
|
}
|
|
7079
7075
|
static getSettablePaths() {
|
|
7080
7076
|
return {
|
|
7081
|
-
relativeDirPath:
|
|
7077
|
+
relativeDirPath: join53(".kiro", "settings"),
|
|
7082
7078
|
relativeFilePath: "mcp.json"
|
|
7083
7079
|
};
|
|
7084
7080
|
}
|
|
@@ -7087,7 +7083,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7087
7083
|
validate = true
|
|
7088
7084
|
}) {
|
|
7089
7085
|
const paths = this.getSettablePaths();
|
|
7090
|
-
const fileContent = await readFileContentOrNull(
|
|
7086
|
+
const fileContent = await readFileContentOrNull(join53(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7091
7087
|
return new _KiroMcp({
|
|
7092
7088
|
baseDir,
|
|
7093
7089
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7135,7 +7131,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7135
7131
|
};
|
|
7136
7132
|
|
|
7137
7133
|
// src/features/mcp/opencode-mcp.ts
|
|
7138
|
-
import { join as
|
|
7134
|
+
import { join as join54 } from "path";
|
|
7139
7135
|
import { parse as parseJsonc2 } from "jsonc-parser";
|
|
7140
7136
|
import { z as z22 } from "zod/mini";
|
|
7141
7137
|
var OpencodeMcpLocalServerSchema = z22.object({
|
|
@@ -7276,7 +7272,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7276
7272
|
static getSettablePaths({ global } = {}) {
|
|
7277
7273
|
if (global) {
|
|
7278
7274
|
return {
|
|
7279
|
-
relativeDirPath:
|
|
7275
|
+
relativeDirPath: join54(".config", "opencode"),
|
|
7280
7276
|
relativeFilePath: "opencode.json"
|
|
7281
7277
|
};
|
|
7282
7278
|
}
|
|
@@ -7291,11 +7287,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7291
7287
|
global = false
|
|
7292
7288
|
}) {
|
|
7293
7289
|
const basePaths = this.getSettablePaths({ global });
|
|
7294
|
-
const jsonDir =
|
|
7290
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7295
7291
|
let fileContent = null;
|
|
7296
7292
|
let relativeFilePath = "opencode.jsonc";
|
|
7297
|
-
const jsoncPath =
|
|
7298
|
-
const jsonPath =
|
|
7293
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7294
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7299
7295
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7300
7296
|
if (!fileContent) {
|
|
7301
7297
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7321,11 +7317,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7321
7317
|
global = false
|
|
7322
7318
|
}) {
|
|
7323
7319
|
const basePaths = this.getSettablePaths({ global });
|
|
7324
|
-
const jsonDir =
|
|
7320
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7325
7321
|
let fileContent = null;
|
|
7326
7322
|
let relativeFilePath = "opencode.jsonc";
|
|
7327
|
-
const jsoncPath =
|
|
7328
|
-
const jsonPath =
|
|
7323
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7324
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7329
7325
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7330
7326
|
if (!fileContent) {
|
|
7331
7327
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7386,7 +7382,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7386
7382
|
};
|
|
7387
7383
|
|
|
7388
7384
|
// src/features/mcp/roo-mcp.ts
|
|
7389
|
-
import { join as
|
|
7385
|
+
import { join as join55 } from "path";
|
|
7390
7386
|
function isRooMcpServers(value) {
|
|
7391
7387
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7392
7388
|
}
|
|
@@ -7438,7 +7434,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7438
7434
|
validate = true
|
|
7439
7435
|
}) {
|
|
7440
7436
|
const fileContent = await readFileContent(
|
|
7441
|
-
|
|
7437
|
+
join55(
|
|
7442
7438
|
baseDir,
|
|
7443
7439
|
this.getSettablePaths().relativeDirPath,
|
|
7444
7440
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7500,6 +7496,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7500
7496
|
"cline",
|
|
7501
7497
|
"codexcli",
|
|
7502
7498
|
"copilot",
|
|
7499
|
+
"copilotcli",
|
|
7503
7500
|
"cursor",
|
|
7504
7501
|
"factorydroid",
|
|
7505
7502
|
"geminicli",
|
|
@@ -7571,6 +7568,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7571
7568
|
}
|
|
7572
7569
|
}
|
|
7573
7570
|
],
|
|
7571
|
+
[
|
|
7572
|
+
"copilotcli",
|
|
7573
|
+
{
|
|
7574
|
+
class: CopilotcliMcp,
|
|
7575
|
+
meta: {
|
|
7576
|
+
supportsProject: true,
|
|
7577
|
+
supportsGlobal: true,
|
|
7578
|
+
supportsEnabledTools: false,
|
|
7579
|
+
supportsDisabledTools: false
|
|
7580
|
+
}
|
|
7581
|
+
}
|
|
7582
|
+
],
|
|
7574
7583
|
[
|
|
7575
7584
|
"cursor",
|
|
7576
7585
|
{
|
|
@@ -7693,9 +7702,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7693
7702
|
toolTarget,
|
|
7694
7703
|
global = false,
|
|
7695
7704
|
getFactory = defaultGetFactory3,
|
|
7696
|
-
dryRun = false
|
|
7705
|
+
dryRun = false,
|
|
7706
|
+
logger
|
|
7697
7707
|
}) {
|
|
7698
|
-
super({ baseDir, dryRun });
|
|
7708
|
+
super({ baseDir, dryRun, logger });
|
|
7699
7709
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7700
7710
|
if (!result.success) {
|
|
7701
7711
|
throw new Error(
|
|
@@ -7714,7 +7724,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7714
7724
|
try {
|
|
7715
7725
|
return [await RulesyncMcp.fromFile({})];
|
|
7716
7726
|
} catch (error) {
|
|
7717
|
-
logger.error(
|
|
7727
|
+
this.logger.error(
|
|
7718
7728
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7719
7729
|
);
|
|
7720
7730
|
return [];
|
|
@@ -7738,7 +7748,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7738
7748
|
global: this.global
|
|
7739
7749
|
});
|
|
7740
7750
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7741
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7751
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7742
7752
|
return toolMcps2;
|
|
7743
7753
|
}
|
|
7744
7754
|
const toolMcps = [
|
|
@@ -7748,14 +7758,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7748
7758
|
global: this.global
|
|
7749
7759
|
})
|
|
7750
7760
|
];
|
|
7751
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7761
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7752
7762
|
return toolMcps;
|
|
7753
7763
|
} catch (error) {
|
|
7754
7764
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7755
7765
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7756
|
-
logger.debug(errorMessage);
|
|
7766
|
+
this.logger.debug(errorMessage);
|
|
7757
7767
|
} else {
|
|
7758
|
-
logger.error(errorMessage);
|
|
7768
|
+
this.logger.error(errorMessage);
|
|
7759
7769
|
}
|
|
7760
7770
|
return [];
|
|
7761
7771
|
}
|
|
@@ -7811,7 +7821,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7811
7821
|
};
|
|
7812
7822
|
|
|
7813
7823
|
// src/features/rules/rules-processor.ts
|
|
7814
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
7824
|
+
import { basename as basename10, dirname as dirname3, join as join117, relative as relative5 } from "path";
|
|
7815
7825
|
import { encode } from "@toon-format/toon";
|
|
7816
7826
|
import { z as z57 } from "zod/mini";
|
|
7817
7827
|
|
|
@@ -7819,17 +7829,17 @@ import { z as z57 } from "zod/mini";
|
|
|
7819
7829
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7820
7830
|
|
|
7821
7831
|
// src/features/skills/agentsmd-skill.ts
|
|
7822
|
-
import { join as
|
|
7832
|
+
import { join as join59 } from "path";
|
|
7823
7833
|
|
|
7824
7834
|
// src/features/skills/simulated-skill.ts
|
|
7825
|
-
import { join as
|
|
7835
|
+
import { join as join58 } from "path";
|
|
7826
7836
|
import { z as z24 } from "zod/mini";
|
|
7827
7837
|
|
|
7828
7838
|
// src/features/skills/tool-skill.ts
|
|
7829
|
-
import { join as
|
|
7839
|
+
import { join as join57 } from "path";
|
|
7830
7840
|
|
|
7831
7841
|
// src/types/ai-dir.ts
|
|
7832
|
-
import path2, { basename as basename3, join as
|
|
7842
|
+
import path2, { basename as basename3, join as join56, relative as relative4, resolve as resolve4 } from "path";
|
|
7833
7843
|
var AiDir = class {
|
|
7834
7844
|
/**
|
|
7835
7845
|
* @example "."
|
|
@@ -7923,8 +7933,8 @@ var AiDir = class {
|
|
|
7923
7933
|
* @returns Array of files with their relative paths and buffers
|
|
7924
7934
|
*/
|
|
7925
7935
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7926
|
-
const dirPath =
|
|
7927
|
-
const glob =
|
|
7936
|
+
const dirPath = join56(baseDir, relativeDirPath, dirName);
|
|
7937
|
+
const glob = join56(dirPath, "**", "*");
|
|
7928
7938
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7929
7939
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
7930
7940
|
const files = await Promise.all(
|
|
@@ -8022,8 +8032,8 @@ var ToolSkill = class extends AiDir {
|
|
|
8022
8032
|
}) {
|
|
8023
8033
|
const settablePaths = getSettablePaths({ global });
|
|
8024
8034
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8025
|
-
const skillDirPath =
|
|
8026
|
-
const skillFilePath =
|
|
8035
|
+
const skillDirPath = join57(baseDir, actualRelativeDirPath, dirName);
|
|
8036
|
+
const skillFilePath = join57(skillDirPath, SKILL_FILE_NAME);
|
|
8027
8037
|
if (!await fileExists(skillFilePath)) {
|
|
8028
8038
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8029
8039
|
}
|
|
@@ -8047,7 +8057,7 @@ var ToolSkill = class extends AiDir {
|
|
|
8047
8057
|
}
|
|
8048
8058
|
requireMainFileFrontmatter() {
|
|
8049
8059
|
if (!this.mainFile?.frontmatter) {
|
|
8050
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8060
|
+
throw new Error(`Frontmatter is not defined in ${join57(this.relativeDirPath, this.dirName)}`);
|
|
8051
8061
|
}
|
|
8052
8062
|
return this.mainFile.frontmatter;
|
|
8053
8063
|
}
|
|
@@ -8087,7 +8097,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8087
8097
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8088
8098
|
if (!result.success) {
|
|
8089
8099
|
throw new Error(
|
|
8090
|
-
`Invalid frontmatter in ${
|
|
8100
|
+
`Invalid frontmatter in ${join58(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8091
8101
|
);
|
|
8092
8102
|
}
|
|
8093
8103
|
}
|
|
@@ -8146,8 +8156,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8146
8156
|
}) {
|
|
8147
8157
|
const settablePaths = this.getSettablePaths();
|
|
8148
8158
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8149
|
-
const skillDirPath =
|
|
8150
|
-
const skillFilePath =
|
|
8159
|
+
const skillDirPath = join58(baseDir, actualRelativeDirPath, dirName);
|
|
8160
|
+
const skillFilePath = join58(skillDirPath, SKILL_FILE_NAME);
|
|
8151
8161
|
if (!await fileExists(skillFilePath)) {
|
|
8152
8162
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8153
8163
|
}
|
|
@@ -8224,7 +8234,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8224
8234
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8225
8235
|
}
|
|
8226
8236
|
return {
|
|
8227
|
-
relativeDirPath:
|
|
8237
|
+
relativeDirPath: join59(".agents", "skills")
|
|
8228
8238
|
};
|
|
8229
8239
|
}
|
|
8230
8240
|
static async fromDir(params) {
|
|
@@ -8251,11 +8261,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8251
8261
|
};
|
|
8252
8262
|
|
|
8253
8263
|
// src/features/skills/factorydroid-skill.ts
|
|
8254
|
-
import { join as
|
|
8264
|
+
import { join as join60 } from "path";
|
|
8255
8265
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8256
8266
|
static getSettablePaths(_options) {
|
|
8257
8267
|
return {
|
|
8258
|
-
relativeDirPath:
|
|
8268
|
+
relativeDirPath: join60(".factory", "skills")
|
|
8259
8269
|
};
|
|
8260
8270
|
}
|
|
8261
8271
|
static async fromDir(params) {
|
|
@@ -8282,23 +8292,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8282
8292
|
};
|
|
8283
8293
|
|
|
8284
8294
|
// src/features/skills/skills-processor.ts
|
|
8285
|
-
import { basename as basename5, join as
|
|
8295
|
+
import { basename as basename5, join as join78 } from "path";
|
|
8286
8296
|
import { z as z40 } from "zod/mini";
|
|
8287
8297
|
|
|
8288
8298
|
// src/types/dir-feature-processor.ts
|
|
8289
|
-
import { join as
|
|
8299
|
+
import { join as join61 } from "path";
|
|
8290
8300
|
var DirFeatureProcessor = class {
|
|
8291
8301
|
baseDir;
|
|
8292
8302
|
dryRun;
|
|
8293
8303
|
avoidBlockScalars;
|
|
8304
|
+
logger;
|
|
8294
8305
|
constructor({
|
|
8295
8306
|
baseDir = process.cwd(),
|
|
8296
8307
|
dryRun = false,
|
|
8297
|
-
avoidBlockScalars = false
|
|
8308
|
+
avoidBlockScalars = false,
|
|
8309
|
+
logger
|
|
8298
8310
|
}) {
|
|
8299
8311
|
this.baseDir = baseDir;
|
|
8300
8312
|
this.dryRun = dryRun;
|
|
8301
8313
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8314
|
+
this.logger = logger;
|
|
8302
8315
|
}
|
|
8303
8316
|
/**
|
|
8304
8317
|
* Return tool targets that this feature supports.
|
|
@@ -8323,7 +8336,7 @@ var DirFeatureProcessor = class {
|
|
|
8323
8336
|
const mainFile = aiDir.getMainFile();
|
|
8324
8337
|
let mainFileContent;
|
|
8325
8338
|
if (mainFile) {
|
|
8326
|
-
const mainFilePath =
|
|
8339
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8327
8340
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8328
8341
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8329
8342
|
});
|
|
@@ -8339,7 +8352,7 @@ var DirFeatureProcessor = class {
|
|
|
8339
8352
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8340
8353
|
otherFileContents.push(contentWithNewline);
|
|
8341
8354
|
if (!dirHasChanges) {
|
|
8342
|
-
const filePath =
|
|
8355
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8343
8356
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8344
8357
|
if (existingContent !== contentWithNewline) {
|
|
8345
8358
|
dirHasChanges = true;
|
|
@@ -8351,24 +8364,26 @@ var DirFeatureProcessor = class {
|
|
|
8351
8364
|
}
|
|
8352
8365
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8353
8366
|
if (this.dryRun) {
|
|
8354
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8367
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8355
8368
|
if (mainFile) {
|
|
8356
|
-
logger.info(`[DRY RUN] Would write: ${
|
|
8357
|
-
changedPaths.push(
|
|
8369
|
+
this.logger.info(`[DRY RUN] Would write: ${join61(dirPath, mainFile.name)}`);
|
|
8370
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8358
8371
|
}
|
|
8359
8372
|
for (const file of otherFiles) {
|
|
8360
|
-
logger.info(
|
|
8361
|
-
|
|
8373
|
+
this.logger.info(
|
|
8374
|
+
`[DRY RUN] Would write: ${join61(dirPath, file.relativeFilePathToDirPath)}`
|
|
8375
|
+
);
|
|
8376
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8362
8377
|
}
|
|
8363
8378
|
} else {
|
|
8364
8379
|
await ensureDir(dirPath);
|
|
8365
8380
|
if (mainFile && mainFileContent) {
|
|
8366
|
-
const mainFilePath =
|
|
8381
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8367
8382
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8368
|
-
changedPaths.push(
|
|
8383
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8369
8384
|
}
|
|
8370
8385
|
for (const [i, file] of otherFiles.entries()) {
|
|
8371
|
-
const filePath =
|
|
8386
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8372
8387
|
const content = otherFileContents[i];
|
|
8373
8388
|
if (content === void 0) {
|
|
8374
8389
|
throw new Error(
|
|
@@ -8376,7 +8391,7 @@ var DirFeatureProcessor = class {
|
|
|
8376
8391
|
);
|
|
8377
8392
|
}
|
|
8378
8393
|
await writeFileContent(filePath, content);
|
|
8379
|
-
changedPaths.push(
|
|
8394
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8380
8395
|
}
|
|
8381
8396
|
}
|
|
8382
8397
|
changedCount++;
|
|
@@ -8398,7 +8413,7 @@ var DirFeatureProcessor = class {
|
|
|
8398
8413
|
for (const aiDir of orphanDirs) {
|
|
8399
8414
|
const dirPath = aiDir.getDirPath();
|
|
8400
8415
|
if (this.dryRun) {
|
|
8401
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8416
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8402
8417
|
} else {
|
|
8403
8418
|
await removeDirectory(dirPath);
|
|
8404
8419
|
}
|
|
@@ -8408,11 +8423,11 @@ var DirFeatureProcessor = class {
|
|
|
8408
8423
|
};
|
|
8409
8424
|
|
|
8410
8425
|
// src/features/skills/agentsskills-skill.ts
|
|
8411
|
-
import { join as
|
|
8426
|
+
import { join as join63 } from "path";
|
|
8412
8427
|
import { z as z26 } from "zod/mini";
|
|
8413
8428
|
|
|
8414
8429
|
// src/features/skills/rulesync-skill.ts
|
|
8415
|
-
import { join as
|
|
8430
|
+
import { join as join62 } from "path";
|
|
8416
8431
|
import { z as z25 } from "zod/mini";
|
|
8417
8432
|
var RulesyncSkillFrontmatterSchemaInternal = z25.looseObject({
|
|
8418
8433
|
name: z25.string(),
|
|
@@ -8481,7 +8496,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8481
8496
|
}
|
|
8482
8497
|
getFrontmatter() {
|
|
8483
8498
|
if (!this.mainFile?.frontmatter) {
|
|
8484
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8499
|
+
throw new Error(`Frontmatter is not defined in ${join62(this.relativeDirPath, this.dirName)}`);
|
|
8485
8500
|
}
|
|
8486
8501
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8487
8502
|
return result;
|
|
@@ -8507,8 +8522,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8507
8522
|
dirName,
|
|
8508
8523
|
global = false
|
|
8509
8524
|
}) {
|
|
8510
|
-
const skillDirPath =
|
|
8511
|
-
const skillFilePath =
|
|
8525
|
+
const skillDirPath = join62(baseDir, relativeDirPath, dirName);
|
|
8526
|
+
const skillFilePath = join62(skillDirPath, SKILL_FILE_NAME);
|
|
8512
8527
|
if (!await fileExists(skillFilePath)) {
|
|
8513
8528
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8514
8529
|
}
|
|
@@ -8545,7 +8560,7 @@ var AgentsSkillsSkillFrontmatterSchema = z26.looseObject({
|
|
|
8545
8560
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8546
8561
|
constructor({
|
|
8547
8562
|
baseDir = process.cwd(),
|
|
8548
|
-
relativeDirPath =
|
|
8563
|
+
relativeDirPath = join63(".agents", "skills"),
|
|
8549
8564
|
dirName,
|
|
8550
8565
|
frontmatter,
|
|
8551
8566
|
body,
|
|
@@ -8577,7 +8592,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8577
8592
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8578
8593
|
}
|
|
8579
8594
|
return {
|
|
8580
|
-
relativeDirPath:
|
|
8595
|
+
relativeDirPath: join63(".agents", "skills")
|
|
8581
8596
|
};
|
|
8582
8597
|
}
|
|
8583
8598
|
getFrontmatter() {
|
|
@@ -8657,9 +8672,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8657
8672
|
});
|
|
8658
8673
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8659
8674
|
if (!result.success) {
|
|
8660
|
-
const skillDirPath =
|
|
8675
|
+
const skillDirPath = join63(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8661
8676
|
throw new Error(
|
|
8662
|
-
`Invalid frontmatter in ${
|
|
8677
|
+
`Invalid frontmatter in ${join63(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8663
8678
|
);
|
|
8664
8679
|
}
|
|
8665
8680
|
return new _AgentsSkillsSkill({
|
|
@@ -8694,7 +8709,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8694
8709
|
};
|
|
8695
8710
|
|
|
8696
8711
|
// src/features/skills/antigravity-skill.ts
|
|
8697
|
-
import { join as
|
|
8712
|
+
import { join as join64 } from "path";
|
|
8698
8713
|
import { z as z27 } from "zod/mini";
|
|
8699
8714
|
var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
8700
8715
|
name: z27.string(),
|
|
@@ -8703,7 +8718,7 @@ var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
|
8703
8718
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8704
8719
|
constructor({
|
|
8705
8720
|
baseDir = process.cwd(),
|
|
8706
|
-
relativeDirPath =
|
|
8721
|
+
relativeDirPath = join64(".agent", "skills"),
|
|
8707
8722
|
dirName,
|
|
8708
8723
|
frontmatter,
|
|
8709
8724
|
body,
|
|
@@ -8735,11 +8750,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8735
8750
|
} = {}) {
|
|
8736
8751
|
if (global) {
|
|
8737
8752
|
return {
|
|
8738
|
-
relativeDirPath:
|
|
8753
|
+
relativeDirPath: join64(".gemini", "antigravity", "skills")
|
|
8739
8754
|
};
|
|
8740
8755
|
}
|
|
8741
8756
|
return {
|
|
8742
|
-
relativeDirPath:
|
|
8757
|
+
relativeDirPath: join64(".agent", "skills")
|
|
8743
8758
|
};
|
|
8744
8759
|
}
|
|
8745
8760
|
getFrontmatter() {
|
|
@@ -8819,9 +8834,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8819
8834
|
});
|
|
8820
8835
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8821
8836
|
if (!result.success) {
|
|
8822
|
-
const skillDirPath =
|
|
8837
|
+
const skillDirPath = join64(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8823
8838
|
throw new Error(
|
|
8824
|
-
`Invalid frontmatter in ${
|
|
8839
|
+
`Invalid frontmatter in ${join64(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8825
8840
|
);
|
|
8826
8841
|
}
|
|
8827
8842
|
return new _AntigravitySkill({
|
|
@@ -8855,7 +8870,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8855
8870
|
};
|
|
8856
8871
|
|
|
8857
8872
|
// src/features/skills/claudecode-skill.ts
|
|
8858
|
-
import { join as
|
|
8873
|
+
import { join as join65 } from "path";
|
|
8859
8874
|
import { z as z28 } from "zod/mini";
|
|
8860
8875
|
var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
8861
8876
|
name: z28.string(),
|
|
@@ -8867,7 +8882,7 @@ var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
8867
8882
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8868
8883
|
constructor({
|
|
8869
8884
|
baseDir = process.cwd(),
|
|
8870
|
-
relativeDirPath =
|
|
8885
|
+
relativeDirPath = join65(".claude", "skills"),
|
|
8871
8886
|
dirName,
|
|
8872
8887
|
frontmatter,
|
|
8873
8888
|
body,
|
|
@@ -8898,7 +8913,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8898
8913
|
global: _global = false
|
|
8899
8914
|
} = {}) {
|
|
8900
8915
|
return {
|
|
8901
|
-
relativeDirPath:
|
|
8916
|
+
relativeDirPath: join65(".claude", "skills")
|
|
8902
8917
|
};
|
|
8903
8918
|
}
|
|
8904
8919
|
getFrontmatter() {
|
|
@@ -8995,9 +9010,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8995
9010
|
});
|
|
8996
9011
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8997
9012
|
if (!result.success) {
|
|
8998
|
-
const skillDirPath =
|
|
9013
|
+
const skillDirPath = join65(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8999
9014
|
throw new Error(
|
|
9000
|
-
`Invalid frontmatter in ${
|
|
9015
|
+
`Invalid frontmatter in ${join65(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9001
9016
|
);
|
|
9002
9017
|
}
|
|
9003
9018
|
return new _ClaudecodeSkill({
|
|
@@ -9031,7 +9046,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9031
9046
|
};
|
|
9032
9047
|
|
|
9033
9048
|
// src/features/skills/cline-skill.ts
|
|
9034
|
-
import { join as
|
|
9049
|
+
import { join as join66 } from "path";
|
|
9035
9050
|
import { z as z29 } from "zod/mini";
|
|
9036
9051
|
var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
9037
9052
|
name: z29.string(),
|
|
@@ -9040,7 +9055,7 @@ var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
|
9040
9055
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
9041
9056
|
constructor({
|
|
9042
9057
|
baseDir = process.cwd(),
|
|
9043
|
-
relativeDirPath =
|
|
9058
|
+
relativeDirPath = join66(".cline", "skills"),
|
|
9044
9059
|
dirName,
|
|
9045
9060
|
frontmatter,
|
|
9046
9061
|
body,
|
|
@@ -9069,7 +9084,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9069
9084
|
}
|
|
9070
9085
|
static getSettablePaths(_options = {}) {
|
|
9071
9086
|
return {
|
|
9072
|
-
relativeDirPath:
|
|
9087
|
+
relativeDirPath: join66(".cline", "skills")
|
|
9073
9088
|
};
|
|
9074
9089
|
}
|
|
9075
9090
|
getFrontmatter() {
|
|
@@ -9157,13 +9172,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9157
9172
|
});
|
|
9158
9173
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9159
9174
|
if (!result.success) {
|
|
9160
|
-
const skillDirPath =
|
|
9175
|
+
const skillDirPath = join66(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9161
9176
|
throw new Error(
|
|
9162
|
-
`Invalid frontmatter in ${
|
|
9177
|
+
`Invalid frontmatter in ${join66(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9163
9178
|
);
|
|
9164
9179
|
}
|
|
9165
9180
|
if (result.data.name !== loaded.dirName) {
|
|
9166
|
-
const skillFilePath =
|
|
9181
|
+
const skillFilePath = join66(
|
|
9167
9182
|
loaded.baseDir,
|
|
9168
9183
|
loaded.relativeDirPath,
|
|
9169
9184
|
loaded.dirName,
|
|
@@ -9204,7 +9219,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9204
9219
|
};
|
|
9205
9220
|
|
|
9206
9221
|
// src/features/skills/codexcli-skill.ts
|
|
9207
|
-
import { join as
|
|
9222
|
+
import { join as join67 } from "path";
|
|
9208
9223
|
import { z as z30 } from "zod/mini";
|
|
9209
9224
|
var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
9210
9225
|
name: z30.string(),
|
|
@@ -9218,7 +9233,7 @@ var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
|
9218
9233
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9219
9234
|
constructor({
|
|
9220
9235
|
baseDir = process.cwd(),
|
|
9221
|
-
relativeDirPath =
|
|
9236
|
+
relativeDirPath = join67(".codex", "skills"),
|
|
9222
9237
|
dirName,
|
|
9223
9238
|
frontmatter,
|
|
9224
9239
|
body,
|
|
@@ -9249,7 +9264,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9249
9264
|
global: _global = false
|
|
9250
9265
|
} = {}) {
|
|
9251
9266
|
return {
|
|
9252
|
-
relativeDirPath:
|
|
9267
|
+
relativeDirPath: join67(".codex", "skills")
|
|
9253
9268
|
};
|
|
9254
9269
|
}
|
|
9255
9270
|
getFrontmatter() {
|
|
@@ -9339,9 +9354,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9339
9354
|
});
|
|
9340
9355
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9341
9356
|
if (!result.success) {
|
|
9342
|
-
const skillDirPath =
|
|
9357
|
+
const skillDirPath = join67(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9343
9358
|
throw new Error(
|
|
9344
|
-
`Invalid frontmatter in ${
|
|
9359
|
+
`Invalid frontmatter in ${join67(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9345
9360
|
);
|
|
9346
9361
|
}
|
|
9347
9362
|
return new _CodexCliSkill({
|
|
@@ -9375,7 +9390,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9375
9390
|
};
|
|
9376
9391
|
|
|
9377
9392
|
// src/features/skills/copilot-skill.ts
|
|
9378
|
-
import { join as
|
|
9393
|
+
import { join as join68 } from "path";
|
|
9379
9394
|
import { z as z31 } from "zod/mini";
|
|
9380
9395
|
var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
9381
9396
|
name: z31.string(),
|
|
@@ -9385,7 +9400,7 @@ var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
|
9385
9400
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9386
9401
|
constructor({
|
|
9387
9402
|
baseDir = process.cwd(),
|
|
9388
|
-
relativeDirPath =
|
|
9403
|
+
relativeDirPath = join68(".github", "skills"),
|
|
9389
9404
|
dirName,
|
|
9390
9405
|
frontmatter,
|
|
9391
9406
|
body,
|
|
@@ -9417,7 +9432,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9417
9432
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9418
9433
|
}
|
|
9419
9434
|
return {
|
|
9420
|
-
relativeDirPath:
|
|
9435
|
+
relativeDirPath: join68(".github", "skills")
|
|
9421
9436
|
};
|
|
9422
9437
|
}
|
|
9423
9438
|
getFrontmatter() {
|
|
@@ -9503,9 +9518,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9503
9518
|
});
|
|
9504
9519
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9505
9520
|
if (!result.success) {
|
|
9506
|
-
const skillDirPath =
|
|
9521
|
+
const skillDirPath = join68(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9507
9522
|
throw new Error(
|
|
9508
|
-
`Invalid frontmatter in ${
|
|
9523
|
+
`Invalid frontmatter in ${join68(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9509
9524
|
);
|
|
9510
9525
|
}
|
|
9511
9526
|
return new _CopilotSkill({
|
|
@@ -9540,7 +9555,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9540
9555
|
};
|
|
9541
9556
|
|
|
9542
9557
|
// src/features/skills/cursor-skill.ts
|
|
9543
|
-
import { join as
|
|
9558
|
+
import { join as join69 } from "path";
|
|
9544
9559
|
import { z as z32 } from "zod/mini";
|
|
9545
9560
|
var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
9546
9561
|
name: z32.string(),
|
|
@@ -9549,7 +9564,7 @@ var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
|
9549
9564
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9550
9565
|
constructor({
|
|
9551
9566
|
baseDir = process.cwd(),
|
|
9552
|
-
relativeDirPath =
|
|
9567
|
+
relativeDirPath = join69(".cursor", "skills"),
|
|
9553
9568
|
dirName,
|
|
9554
9569
|
frontmatter,
|
|
9555
9570
|
body,
|
|
@@ -9578,7 +9593,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9578
9593
|
}
|
|
9579
9594
|
static getSettablePaths(_options) {
|
|
9580
9595
|
return {
|
|
9581
|
-
relativeDirPath:
|
|
9596
|
+
relativeDirPath: join69(".cursor", "skills")
|
|
9582
9597
|
};
|
|
9583
9598
|
}
|
|
9584
9599
|
getFrontmatter() {
|
|
@@ -9658,9 +9673,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9658
9673
|
});
|
|
9659
9674
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9660
9675
|
if (!result.success) {
|
|
9661
|
-
const skillDirPath =
|
|
9676
|
+
const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9662
9677
|
throw new Error(
|
|
9663
|
-
`Invalid frontmatter in ${
|
|
9678
|
+
`Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9664
9679
|
);
|
|
9665
9680
|
}
|
|
9666
9681
|
return new _CursorSkill({
|
|
@@ -9695,7 +9710,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9695
9710
|
};
|
|
9696
9711
|
|
|
9697
9712
|
// src/features/skills/geminicli-skill.ts
|
|
9698
|
-
import { join as
|
|
9713
|
+
import { join as join70 } from "path";
|
|
9699
9714
|
import { z as z33 } from "zod/mini";
|
|
9700
9715
|
var GeminiCliSkillFrontmatterSchema = z33.looseObject({
|
|
9701
9716
|
name: z33.string(),
|
|
@@ -9735,7 +9750,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9735
9750
|
global: _global = false
|
|
9736
9751
|
} = {}) {
|
|
9737
9752
|
return {
|
|
9738
|
-
relativeDirPath:
|
|
9753
|
+
relativeDirPath: join70(".gemini", "skills")
|
|
9739
9754
|
};
|
|
9740
9755
|
}
|
|
9741
9756
|
getFrontmatter() {
|
|
@@ -9815,9 +9830,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9815
9830
|
});
|
|
9816
9831
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9817
9832
|
if (!result.success) {
|
|
9818
|
-
const skillDirPath =
|
|
9833
|
+
const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9819
9834
|
throw new Error(
|
|
9820
|
-
`Invalid frontmatter in ${
|
|
9835
|
+
`Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9821
9836
|
);
|
|
9822
9837
|
}
|
|
9823
9838
|
return new _GeminiCliSkill({
|
|
@@ -9852,7 +9867,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9852
9867
|
};
|
|
9853
9868
|
|
|
9854
9869
|
// src/features/skills/junie-skill.ts
|
|
9855
|
-
import { join as
|
|
9870
|
+
import { join as join71 } from "path";
|
|
9856
9871
|
import { z as z34 } from "zod/mini";
|
|
9857
9872
|
var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
9858
9873
|
name: z34.string(),
|
|
@@ -9861,7 +9876,7 @@ var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
|
9861
9876
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9862
9877
|
constructor({
|
|
9863
9878
|
baseDir = process.cwd(),
|
|
9864
|
-
relativeDirPath =
|
|
9879
|
+
relativeDirPath = join71(".junie", "skills"),
|
|
9865
9880
|
dirName,
|
|
9866
9881
|
frontmatter,
|
|
9867
9882
|
body,
|
|
@@ -9893,7 +9908,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9893
9908
|
throw new Error("JunieSkill does not support global mode.");
|
|
9894
9909
|
}
|
|
9895
9910
|
return {
|
|
9896
|
-
relativeDirPath:
|
|
9911
|
+
relativeDirPath: join71(".junie", "skills")
|
|
9897
9912
|
};
|
|
9898
9913
|
}
|
|
9899
9914
|
getFrontmatter() {
|
|
@@ -9980,13 +9995,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9980
9995
|
});
|
|
9981
9996
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9982
9997
|
if (!result.success) {
|
|
9983
|
-
const skillDirPath =
|
|
9998
|
+
const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9984
9999
|
throw new Error(
|
|
9985
|
-
`Invalid frontmatter in ${
|
|
10000
|
+
`Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9986
10001
|
);
|
|
9987
10002
|
}
|
|
9988
10003
|
if (result.data.name !== loaded.dirName) {
|
|
9989
|
-
const skillFilePath =
|
|
10004
|
+
const skillFilePath = join71(
|
|
9990
10005
|
loaded.baseDir,
|
|
9991
10006
|
loaded.relativeDirPath,
|
|
9992
10007
|
loaded.dirName,
|
|
@@ -10028,7 +10043,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10028
10043
|
};
|
|
10029
10044
|
|
|
10030
10045
|
// src/features/skills/kilo-skill.ts
|
|
10031
|
-
import { join as
|
|
10046
|
+
import { join as join72 } from "path";
|
|
10032
10047
|
import { z as z35 } from "zod/mini";
|
|
10033
10048
|
var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
10034
10049
|
name: z35.string(),
|
|
@@ -10037,7 +10052,7 @@ var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
|
10037
10052
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
10038
10053
|
constructor({
|
|
10039
10054
|
baseDir = process.cwd(),
|
|
10040
|
-
relativeDirPath =
|
|
10055
|
+
relativeDirPath = join72(".kilocode", "skills"),
|
|
10041
10056
|
dirName,
|
|
10042
10057
|
frontmatter,
|
|
10043
10058
|
body,
|
|
@@ -10068,7 +10083,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10068
10083
|
global: _global = false
|
|
10069
10084
|
} = {}) {
|
|
10070
10085
|
return {
|
|
10071
|
-
relativeDirPath:
|
|
10086
|
+
relativeDirPath: join72(".kilocode", "skills")
|
|
10072
10087
|
};
|
|
10073
10088
|
}
|
|
10074
10089
|
getFrontmatter() {
|
|
@@ -10156,13 +10171,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10156
10171
|
});
|
|
10157
10172
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10158
10173
|
if (!result.success) {
|
|
10159
|
-
const skillDirPath =
|
|
10174
|
+
const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10160
10175
|
throw new Error(
|
|
10161
|
-
`Invalid frontmatter in ${
|
|
10176
|
+
`Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10162
10177
|
);
|
|
10163
10178
|
}
|
|
10164
10179
|
if (result.data.name !== loaded.dirName) {
|
|
10165
|
-
const skillFilePath =
|
|
10180
|
+
const skillFilePath = join72(
|
|
10166
10181
|
loaded.baseDir,
|
|
10167
10182
|
loaded.relativeDirPath,
|
|
10168
10183
|
loaded.dirName,
|
|
@@ -10203,7 +10218,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10203
10218
|
};
|
|
10204
10219
|
|
|
10205
10220
|
// src/features/skills/kiro-skill.ts
|
|
10206
|
-
import { join as
|
|
10221
|
+
import { join as join73 } from "path";
|
|
10207
10222
|
import { z as z36 } from "zod/mini";
|
|
10208
10223
|
var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
10209
10224
|
name: z36.string(),
|
|
@@ -10212,7 +10227,7 @@ var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
|
10212
10227
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10213
10228
|
constructor({
|
|
10214
10229
|
baseDir = process.cwd(),
|
|
10215
|
-
relativeDirPath =
|
|
10230
|
+
relativeDirPath = join73(".kiro", "skills"),
|
|
10216
10231
|
dirName,
|
|
10217
10232
|
frontmatter,
|
|
10218
10233
|
body,
|
|
@@ -10244,7 +10259,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10244
10259
|
throw new Error("KiroSkill does not support global mode.");
|
|
10245
10260
|
}
|
|
10246
10261
|
return {
|
|
10247
|
-
relativeDirPath:
|
|
10262
|
+
relativeDirPath: join73(".kiro", "skills")
|
|
10248
10263
|
};
|
|
10249
10264
|
}
|
|
10250
10265
|
getFrontmatter() {
|
|
@@ -10332,13 +10347,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10332
10347
|
});
|
|
10333
10348
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10334
10349
|
if (!result.success) {
|
|
10335
|
-
const skillDirPath =
|
|
10350
|
+
const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10336
10351
|
throw new Error(
|
|
10337
|
-
`Invalid frontmatter in ${
|
|
10352
|
+
`Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10338
10353
|
);
|
|
10339
10354
|
}
|
|
10340
10355
|
if (result.data.name !== loaded.dirName) {
|
|
10341
|
-
const skillFilePath =
|
|
10356
|
+
const skillFilePath = join73(
|
|
10342
10357
|
loaded.baseDir,
|
|
10343
10358
|
loaded.relativeDirPath,
|
|
10344
10359
|
loaded.dirName,
|
|
@@ -10380,7 +10395,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10380
10395
|
};
|
|
10381
10396
|
|
|
10382
10397
|
// src/features/skills/opencode-skill.ts
|
|
10383
|
-
import { join as
|
|
10398
|
+
import { join as join74 } from "path";
|
|
10384
10399
|
import { z as z37 } from "zod/mini";
|
|
10385
10400
|
var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
10386
10401
|
name: z37.string(),
|
|
@@ -10390,7 +10405,7 @@ var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
|
10390
10405
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10391
10406
|
constructor({
|
|
10392
10407
|
baseDir = process.cwd(),
|
|
10393
|
-
relativeDirPath =
|
|
10408
|
+
relativeDirPath = join74(".opencode", "skill"),
|
|
10394
10409
|
dirName,
|
|
10395
10410
|
frontmatter,
|
|
10396
10411
|
body,
|
|
@@ -10419,7 +10434,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10419
10434
|
}
|
|
10420
10435
|
static getSettablePaths({ global = false } = {}) {
|
|
10421
10436
|
return {
|
|
10422
|
-
relativeDirPath: global ?
|
|
10437
|
+
relativeDirPath: global ? join74(".config", "opencode", "skill") : join74(".opencode", "skill")
|
|
10423
10438
|
};
|
|
10424
10439
|
}
|
|
10425
10440
|
getFrontmatter() {
|
|
@@ -10505,9 +10520,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10505
10520
|
});
|
|
10506
10521
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10507
10522
|
if (!result.success) {
|
|
10508
|
-
const skillDirPath =
|
|
10523
|
+
const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10509
10524
|
throw new Error(
|
|
10510
|
-
`Invalid frontmatter in ${
|
|
10525
|
+
`Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10511
10526
|
);
|
|
10512
10527
|
}
|
|
10513
10528
|
return new _OpenCodeSkill({
|
|
@@ -10541,7 +10556,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10541
10556
|
};
|
|
10542
10557
|
|
|
10543
10558
|
// src/features/skills/replit-skill.ts
|
|
10544
|
-
import { join as
|
|
10559
|
+
import { join as join75 } from "path";
|
|
10545
10560
|
import { z as z38 } from "zod/mini";
|
|
10546
10561
|
var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
10547
10562
|
name: z38.string(),
|
|
@@ -10550,7 +10565,7 @@ var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
|
10550
10565
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10551
10566
|
constructor({
|
|
10552
10567
|
baseDir = process.cwd(),
|
|
10553
|
-
relativeDirPath =
|
|
10568
|
+
relativeDirPath = join75(".agents", "skills"),
|
|
10554
10569
|
dirName,
|
|
10555
10570
|
frontmatter,
|
|
10556
10571
|
body,
|
|
@@ -10582,7 +10597,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10582
10597
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10583
10598
|
}
|
|
10584
10599
|
return {
|
|
10585
|
-
relativeDirPath:
|
|
10600
|
+
relativeDirPath: join75(".agents", "skills")
|
|
10586
10601
|
};
|
|
10587
10602
|
}
|
|
10588
10603
|
getFrontmatter() {
|
|
@@ -10662,9 +10677,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10662
10677
|
});
|
|
10663
10678
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10664
10679
|
if (!result.success) {
|
|
10665
|
-
const skillDirPath =
|
|
10680
|
+
const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10666
10681
|
throw new Error(
|
|
10667
|
-
`Invalid frontmatter in ${
|
|
10682
|
+
`Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10668
10683
|
);
|
|
10669
10684
|
}
|
|
10670
10685
|
return new _ReplitSkill({
|
|
@@ -10699,7 +10714,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10699
10714
|
};
|
|
10700
10715
|
|
|
10701
10716
|
// src/features/skills/roo-skill.ts
|
|
10702
|
-
import { join as
|
|
10717
|
+
import { join as join76 } from "path";
|
|
10703
10718
|
import { z as z39 } from "zod/mini";
|
|
10704
10719
|
var RooSkillFrontmatterSchema = z39.looseObject({
|
|
10705
10720
|
name: z39.string(),
|
|
@@ -10708,7 +10723,7 @@ var RooSkillFrontmatterSchema = z39.looseObject({
|
|
|
10708
10723
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10709
10724
|
constructor({
|
|
10710
10725
|
baseDir = process.cwd(),
|
|
10711
|
-
relativeDirPath =
|
|
10726
|
+
relativeDirPath = join76(".roo", "skills"),
|
|
10712
10727
|
dirName,
|
|
10713
10728
|
frontmatter,
|
|
10714
10729
|
body,
|
|
@@ -10739,7 +10754,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10739
10754
|
global: _global = false
|
|
10740
10755
|
} = {}) {
|
|
10741
10756
|
return {
|
|
10742
|
-
relativeDirPath:
|
|
10757
|
+
relativeDirPath: join76(".roo", "skills")
|
|
10743
10758
|
};
|
|
10744
10759
|
}
|
|
10745
10760
|
getFrontmatter() {
|
|
@@ -10827,13 +10842,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10827
10842
|
});
|
|
10828
10843
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10829
10844
|
if (!result.success) {
|
|
10830
|
-
const skillDirPath =
|
|
10845
|
+
const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10831
10846
|
throw new Error(
|
|
10832
|
-
`Invalid frontmatter in ${
|
|
10847
|
+
`Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10833
10848
|
);
|
|
10834
10849
|
}
|
|
10835
10850
|
if (result.data.name !== loaded.dirName) {
|
|
10836
|
-
const skillFilePath =
|
|
10851
|
+
const skillFilePath = join76(
|
|
10837
10852
|
loaded.baseDir,
|
|
10838
10853
|
loaded.relativeDirPath,
|
|
10839
10854
|
loaded.dirName,
|
|
@@ -10874,14 +10889,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10874
10889
|
};
|
|
10875
10890
|
|
|
10876
10891
|
// src/features/skills/skills-utils.ts
|
|
10877
|
-
import { basename as basename4, join as
|
|
10892
|
+
import { basename as basename4, join as join77 } from "path";
|
|
10878
10893
|
async function getLocalSkillDirNames(baseDir) {
|
|
10879
|
-
const skillsDir =
|
|
10894
|
+
const skillsDir = join77(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10880
10895
|
const names = /* @__PURE__ */ new Set();
|
|
10881
10896
|
if (!await directoryExists(skillsDir)) {
|
|
10882
10897
|
return names;
|
|
10883
10898
|
}
|
|
10884
|
-
const dirPaths = await findFilesByGlobs(
|
|
10899
|
+
const dirPaths = await findFilesByGlobs(join77(skillsDir, "*"), { type: "dir" });
|
|
10885
10900
|
for (const dirPath of dirPaths) {
|
|
10886
10901
|
const name = basename4(dirPath);
|
|
10887
10902
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -10979,7 +10994,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10979
10994
|
"factorydroid",
|
|
10980
10995
|
{
|
|
10981
10996
|
class: FactorydroidSkill,
|
|
10982
|
-
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal:
|
|
10997
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
10983
10998
|
}
|
|
10984
10999
|
],
|
|
10985
11000
|
[
|
|
@@ -11063,9 +11078,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11063
11078
|
toolTarget,
|
|
11064
11079
|
global = false,
|
|
11065
11080
|
getFactory = defaultGetFactory4,
|
|
11066
|
-
dryRun = false
|
|
11081
|
+
dryRun = false,
|
|
11082
|
+
logger
|
|
11067
11083
|
}) {
|
|
11068
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11084
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
11069
11085
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
11070
11086
|
if (!result.success) {
|
|
11071
11087
|
throw new Error(
|
|
@@ -11098,7 +11114,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11098
11114
|
const rulesyncSkills = [];
|
|
11099
11115
|
for (const toolSkill of toolSkills) {
|
|
11100
11116
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11101
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11117
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11102
11118
|
continue;
|
|
11103
11119
|
}
|
|
11104
11120
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11119,14 +11135,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11119
11135
|
)
|
|
11120
11136
|
);
|
|
11121
11137
|
const localSkillNames = new Set(localDirNames);
|
|
11122
|
-
const curatedDirPath =
|
|
11138
|
+
const curatedDirPath = join78(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11123
11139
|
let curatedSkills = [];
|
|
11124
11140
|
if (await directoryExists(curatedDirPath)) {
|
|
11125
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
11141
|
+
const curatedDirPaths = await findFilesByGlobs(join78(curatedDirPath, "*"), { type: "dir" });
|
|
11126
11142
|
const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
|
|
11127
11143
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11128
11144
|
if (localSkillNames.has(name)) {
|
|
11129
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11145
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11130
11146
|
return false;
|
|
11131
11147
|
}
|
|
11132
11148
|
return true;
|
|
@@ -11144,7 +11160,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11144
11160
|
);
|
|
11145
11161
|
}
|
|
11146
11162
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11147
|
-
logger.debug(
|
|
11163
|
+
this.logger.debug(
|
|
11148
11164
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11149
11165
|
);
|
|
11150
11166
|
return allSkills;
|
|
@@ -11156,8 +11172,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11156
11172
|
async loadToolDirs() {
|
|
11157
11173
|
const factory = this.getFactory(this.toolTarget);
|
|
11158
11174
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11159
|
-
const skillsDirPath =
|
|
11160
|
-
const dirPaths = await findFilesByGlobs(
|
|
11175
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11176
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11161
11177
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11162
11178
|
const toolSkills = await Promise.all(
|
|
11163
11179
|
dirNames.map(
|
|
@@ -11168,14 +11184,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11168
11184
|
})
|
|
11169
11185
|
)
|
|
11170
11186
|
);
|
|
11171
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11187
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11172
11188
|
return toolSkills;
|
|
11173
11189
|
}
|
|
11174
11190
|
async loadToolDirsToDelete() {
|
|
11175
11191
|
const factory = this.getFactory(this.toolTarget);
|
|
11176
11192
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11177
|
-
const skillsDirPath =
|
|
11178
|
-
const dirPaths = await findFilesByGlobs(
|
|
11193
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11194
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11179
11195
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11180
11196
|
const toolSkills = dirNames.map(
|
|
11181
11197
|
(dirName) => factory.class.forDeletion({
|
|
@@ -11185,7 +11201,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11185
11201
|
global: this.global
|
|
11186
11202
|
})
|
|
11187
11203
|
);
|
|
11188
|
-
logger.debug(
|
|
11204
|
+
this.logger.debug(
|
|
11189
11205
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11190
11206
|
);
|
|
11191
11207
|
return toolSkills;
|
|
@@ -11237,10 +11253,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11237
11253
|
};
|
|
11238
11254
|
|
|
11239
11255
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11240
|
-
import { join as
|
|
11256
|
+
import { join as join80 } from "path";
|
|
11241
11257
|
|
|
11242
11258
|
// src/features/subagents/simulated-subagent.ts
|
|
11243
|
-
import { basename as basename6, join as
|
|
11259
|
+
import { basename as basename6, join as join79 } from "path";
|
|
11244
11260
|
import { z as z41 } from "zod/mini";
|
|
11245
11261
|
|
|
11246
11262
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11305,7 +11321,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11305
11321
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11306
11322
|
if (!result.success) {
|
|
11307
11323
|
throw new Error(
|
|
11308
|
-
`Invalid frontmatter in ${
|
|
11324
|
+
`Invalid frontmatter in ${join79(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11309
11325
|
);
|
|
11310
11326
|
}
|
|
11311
11327
|
}
|
|
@@ -11356,7 +11372,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11356
11372
|
return {
|
|
11357
11373
|
success: false,
|
|
11358
11374
|
error: new Error(
|
|
11359
|
-
`Invalid frontmatter in ${
|
|
11375
|
+
`Invalid frontmatter in ${join79(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11360
11376
|
)
|
|
11361
11377
|
};
|
|
11362
11378
|
}
|
|
@@ -11366,7 +11382,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11366
11382
|
relativeFilePath,
|
|
11367
11383
|
validate = true
|
|
11368
11384
|
}) {
|
|
11369
|
-
const filePath =
|
|
11385
|
+
const filePath = join79(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11370
11386
|
const fileContent = await readFileContent(filePath);
|
|
11371
11387
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11372
11388
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11402,7 +11418,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11402
11418
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11403
11419
|
static getSettablePaths() {
|
|
11404
11420
|
return {
|
|
11405
|
-
relativeDirPath:
|
|
11421
|
+
relativeDirPath: join80(".agents", "subagents")
|
|
11406
11422
|
};
|
|
11407
11423
|
}
|
|
11408
11424
|
static async fromFile(params) {
|
|
@@ -11425,11 +11441,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11425
11441
|
};
|
|
11426
11442
|
|
|
11427
11443
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11428
|
-
import { join as
|
|
11444
|
+
import { join as join81 } from "path";
|
|
11429
11445
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11430
11446
|
static getSettablePaths(_options) {
|
|
11431
11447
|
return {
|
|
11432
|
-
relativeDirPath:
|
|
11448
|
+
relativeDirPath: join81(".factory", "droids")
|
|
11433
11449
|
};
|
|
11434
11450
|
}
|
|
11435
11451
|
static async fromFile(params) {
|
|
@@ -11452,11 +11468,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11452
11468
|
};
|
|
11453
11469
|
|
|
11454
11470
|
// src/features/subagents/geminicli-subagent.ts
|
|
11455
|
-
import { join as
|
|
11471
|
+
import { join as join82 } from "path";
|
|
11456
11472
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11457
11473
|
static getSettablePaths() {
|
|
11458
11474
|
return {
|
|
11459
|
-
relativeDirPath:
|
|
11475
|
+
relativeDirPath: join82(".gemini", "subagents")
|
|
11460
11476
|
};
|
|
11461
11477
|
}
|
|
11462
11478
|
static async fromFile(params) {
|
|
@@ -11479,11 +11495,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11479
11495
|
};
|
|
11480
11496
|
|
|
11481
11497
|
// src/features/subagents/roo-subagent.ts
|
|
11482
|
-
import { join as
|
|
11498
|
+
import { join as join83 } from "path";
|
|
11483
11499
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11484
11500
|
static getSettablePaths() {
|
|
11485
11501
|
return {
|
|
11486
|
-
relativeDirPath:
|
|
11502
|
+
relativeDirPath: join83(".roo", "subagents")
|
|
11487
11503
|
};
|
|
11488
11504
|
}
|
|
11489
11505
|
static async fromFile(params) {
|
|
@@ -11506,15 +11522,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11506
11522
|
};
|
|
11507
11523
|
|
|
11508
11524
|
// src/features/subagents/subagents-processor.ts
|
|
11509
|
-
import { basename as basename9, join as
|
|
11525
|
+
import { basename as basename9, join as join92 } from "path";
|
|
11510
11526
|
import { z as z50 } from "zod/mini";
|
|
11511
11527
|
|
|
11512
11528
|
// src/features/subagents/claudecode-subagent.ts
|
|
11513
|
-
import { join as
|
|
11529
|
+
import { join as join85 } from "path";
|
|
11514
11530
|
import { z as z43 } from "zod/mini";
|
|
11515
11531
|
|
|
11516
11532
|
// src/features/subagents/rulesync-subagent.ts
|
|
11517
|
-
import { basename as basename7, join as
|
|
11533
|
+
import { basename as basename7, join as join84 } from "path";
|
|
11518
11534
|
import { z as z42 } from "zod/mini";
|
|
11519
11535
|
var RulesyncSubagentFrontmatterSchema = z42.looseObject({
|
|
11520
11536
|
targets: z42._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11528,7 +11544,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11528
11544
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11529
11545
|
if (!parseResult.success && rest.validate !== false) {
|
|
11530
11546
|
throw new Error(
|
|
11531
|
-
`Invalid frontmatter in ${
|
|
11547
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11532
11548
|
);
|
|
11533
11549
|
}
|
|
11534
11550
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11561,7 +11577,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11561
11577
|
return {
|
|
11562
11578
|
success: false,
|
|
11563
11579
|
error: new Error(
|
|
11564
|
-
`Invalid frontmatter in ${
|
|
11580
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11565
11581
|
)
|
|
11566
11582
|
};
|
|
11567
11583
|
}
|
|
@@ -11569,7 +11585,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11569
11585
|
static async fromFile({
|
|
11570
11586
|
relativeFilePath
|
|
11571
11587
|
}) {
|
|
11572
|
-
const filePath =
|
|
11588
|
+
const filePath = join84(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11573
11589
|
const fileContent = await readFileContent(filePath);
|
|
11574
11590
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11575
11591
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11604,7 +11620,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11604
11620
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11605
11621
|
if (!result.success) {
|
|
11606
11622
|
throw new Error(
|
|
11607
|
-
`Invalid frontmatter in ${
|
|
11623
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11608
11624
|
);
|
|
11609
11625
|
}
|
|
11610
11626
|
}
|
|
@@ -11616,7 +11632,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11616
11632
|
}
|
|
11617
11633
|
static getSettablePaths(_options = {}) {
|
|
11618
11634
|
return {
|
|
11619
|
-
relativeDirPath:
|
|
11635
|
+
relativeDirPath: join85(".claude", "agents")
|
|
11620
11636
|
};
|
|
11621
11637
|
}
|
|
11622
11638
|
getFrontmatter() {
|
|
@@ -11695,7 +11711,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11695
11711
|
return {
|
|
11696
11712
|
success: false,
|
|
11697
11713
|
error: new Error(
|
|
11698
|
-
`Invalid frontmatter in ${
|
|
11714
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11699
11715
|
)
|
|
11700
11716
|
};
|
|
11701
11717
|
}
|
|
@@ -11713,7 +11729,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11713
11729
|
global = false
|
|
11714
11730
|
}) {
|
|
11715
11731
|
const paths = this.getSettablePaths({ global });
|
|
11716
|
-
const filePath =
|
|
11732
|
+
const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11717
11733
|
const fileContent = await readFileContent(filePath);
|
|
11718
11734
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11719
11735
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11748,7 +11764,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11748
11764
|
};
|
|
11749
11765
|
|
|
11750
11766
|
// src/features/subagents/codexcli-subagent.ts
|
|
11751
|
-
import { join as
|
|
11767
|
+
import { join as join86 } from "path";
|
|
11752
11768
|
import * as smolToml2 from "smol-toml";
|
|
11753
11769
|
import { z as z44 } from "zod/mini";
|
|
11754
11770
|
var CodexCliSubagentTomlSchema = z44.looseObject({
|
|
@@ -11768,7 +11784,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11768
11784
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11769
11785
|
} catch (error) {
|
|
11770
11786
|
throw new Error(
|
|
11771
|
-
`Invalid TOML in ${
|
|
11787
|
+
`Invalid TOML in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11772
11788
|
{ cause: error }
|
|
11773
11789
|
);
|
|
11774
11790
|
}
|
|
@@ -11780,7 +11796,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11780
11796
|
}
|
|
11781
11797
|
static getSettablePaths(_options = {}) {
|
|
11782
11798
|
return {
|
|
11783
|
-
relativeDirPath:
|
|
11799
|
+
relativeDirPath: join86(".codex", "agents")
|
|
11784
11800
|
};
|
|
11785
11801
|
}
|
|
11786
11802
|
getBody() {
|
|
@@ -11792,7 +11808,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11792
11808
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11793
11809
|
} catch (error) {
|
|
11794
11810
|
throw new Error(
|
|
11795
|
-
`Failed to parse TOML in ${
|
|
11811
|
+
`Failed to parse TOML in ${join86(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11796
11812
|
{ cause: error }
|
|
11797
11813
|
);
|
|
11798
11814
|
}
|
|
@@ -11873,7 +11889,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11873
11889
|
global = false
|
|
11874
11890
|
}) {
|
|
11875
11891
|
const paths = this.getSettablePaths({ global });
|
|
11876
|
-
const filePath =
|
|
11892
|
+
const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11877
11893
|
const fileContent = await readFileContent(filePath);
|
|
11878
11894
|
const subagent = new _CodexCliSubagent({
|
|
11879
11895
|
baseDir,
|
|
@@ -11911,7 +11927,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11911
11927
|
};
|
|
11912
11928
|
|
|
11913
11929
|
// src/features/subagents/copilot-subagent.ts
|
|
11914
|
-
import { join as
|
|
11930
|
+
import { join as join87 } from "path";
|
|
11915
11931
|
import { z as z45 } from "zod/mini";
|
|
11916
11932
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11917
11933
|
var CopilotSubagentFrontmatterSchema = z45.looseObject({
|
|
@@ -11937,7 +11953,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11937
11953
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11938
11954
|
if (!result.success) {
|
|
11939
11955
|
throw new Error(
|
|
11940
|
-
`Invalid frontmatter in ${
|
|
11956
|
+
`Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11941
11957
|
);
|
|
11942
11958
|
}
|
|
11943
11959
|
}
|
|
@@ -11949,7 +11965,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11949
11965
|
}
|
|
11950
11966
|
static getSettablePaths(_options = {}) {
|
|
11951
11967
|
return {
|
|
11952
|
-
relativeDirPath:
|
|
11968
|
+
relativeDirPath: join87(".github", "agents")
|
|
11953
11969
|
};
|
|
11954
11970
|
}
|
|
11955
11971
|
getFrontmatter() {
|
|
@@ -12023,7 +12039,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12023
12039
|
return {
|
|
12024
12040
|
success: false,
|
|
12025
12041
|
error: new Error(
|
|
12026
|
-
`Invalid frontmatter in ${
|
|
12042
|
+
`Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12027
12043
|
)
|
|
12028
12044
|
};
|
|
12029
12045
|
}
|
|
@@ -12041,7 +12057,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12041
12057
|
global = false
|
|
12042
12058
|
}) {
|
|
12043
12059
|
const paths = this.getSettablePaths({ global });
|
|
12044
|
-
const filePath =
|
|
12060
|
+
const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12045
12061
|
const fileContent = await readFileContent(filePath);
|
|
12046
12062
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12047
12063
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12077,7 +12093,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12077
12093
|
};
|
|
12078
12094
|
|
|
12079
12095
|
// src/features/subagents/cursor-subagent.ts
|
|
12080
|
-
import { join as
|
|
12096
|
+
import { join as join88 } from "path";
|
|
12081
12097
|
import { z as z46 } from "zod/mini";
|
|
12082
12098
|
var CursorSubagentFrontmatterSchema = z46.looseObject({
|
|
12083
12099
|
name: z46.string(),
|
|
@@ -12091,7 +12107,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12091
12107
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12092
12108
|
if (!result.success) {
|
|
12093
12109
|
throw new Error(
|
|
12094
|
-
`Invalid frontmatter in ${
|
|
12110
|
+
`Invalid frontmatter in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12095
12111
|
);
|
|
12096
12112
|
}
|
|
12097
12113
|
}
|
|
@@ -12103,7 +12119,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12103
12119
|
}
|
|
12104
12120
|
static getSettablePaths(_options = {}) {
|
|
12105
12121
|
return {
|
|
12106
|
-
relativeDirPath:
|
|
12122
|
+
relativeDirPath: join88(".cursor", "agents")
|
|
12107
12123
|
};
|
|
12108
12124
|
}
|
|
12109
12125
|
getFrontmatter() {
|
|
@@ -12170,7 +12186,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12170
12186
|
return {
|
|
12171
12187
|
success: false,
|
|
12172
12188
|
error: new Error(
|
|
12173
|
-
`Invalid frontmatter in ${
|
|
12189
|
+
`Invalid frontmatter in ${join88(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12174
12190
|
)
|
|
12175
12191
|
};
|
|
12176
12192
|
}
|
|
@@ -12188,7 +12204,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12188
12204
|
global = false
|
|
12189
12205
|
}) {
|
|
12190
12206
|
const paths = this.getSettablePaths({ global });
|
|
12191
|
-
const filePath =
|
|
12207
|
+
const filePath = join88(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12192
12208
|
const fileContent = await readFileContent(filePath);
|
|
12193
12209
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12194
12210
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12224,7 +12240,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12224
12240
|
};
|
|
12225
12241
|
|
|
12226
12242
|
// src/features/subagents/junie-subagent.ts
|
|
12227
|
-
import { join as
|
|
12243
|
+
import { join as join89 } from "path";
|
|
12228
12244
|
import { z as z47 } from "zod/mini";
|
|
12229
12245
|
var JunieSubagentFrontmatterSchema = z47.looseObject({
|
|
12230
12246
|
name: z47.optional(z47.string()),
|
|
@@ -12238,7 +12254,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12238
12254
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12239
12255
|
if (!result.success) {
|
|
12240
12256
|
throw new Error(
|
|
12241
|
-
`Invalid frontmatter in ${
|
|
12257
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12242
12258
|
);
|
|
12243
12259
|
}
|
|
12244
12260
|
}
|
|
@@ -12253,7 +12269,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12253
12269
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12254
12270
|
}
|
|
12255
12271
|
return {
|
|
12256
|
-
relativeDirPath:
|
|
12272
|
+
relativeDirPath: join89(".junie", "agents")
|
|
12257
12273
|
};
|
|
12258
12274
|
}
|
|
12259
12275
|
getFrontmatter() {
|
|
@@ -12329,7 +12345,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12329
12345
|
return {
|
|
12330
12346
|
success: false,
|
|
12331
12347
|
error: new Error(
|
|
12332
|
-
`Invalid frontmatter in ${
|
|
12348
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12333
12349
|
)
|
|
12334
12350
|
};
|
|
12335
12351
|
}
|
|
@@ -12347,7 +12363,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12347
12363
|
global = false
|
|
12348
12364
|
}) {
|
|
12349
12365
|
const paths = this.getSettablePaths({ global });
|
|
12350
|
-
const filePath =
|
|
12366
|
+
const filePath = join89(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12351
12367
|
const fileContent = await readFileContent(filePath);
|
|
12352
12368
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12353
12369
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12382,7 +12398,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12382
12398
|
};
|
|
12383
12399
|
|
|
12384
12400
|
// src/features/subagents/kiro-subagent.ts
|
|
12385
|
-
import { join as
|
|
12401
|
+
import { join as join90 } from "path";
|
|
12386
12402
|
import { z as z48 } from "zod/mini";
|
|
12387
12403
|
var KiroCliSubagentJsonSchema = z48.looseObject({
|
|
12388
12404
|
name: z48.string(),
|
|
@@ -12409,7 +12425,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12409
12425
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12410
12426
|
} catch (error) {
|
|
12411
12427
|
throw new Error(
|
|
12412
|
-
`Invalid JSON in ${
|
|
12428
|
+
`Invalid JSON in ${join90(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12413
12429
|
{ cause: error }
|
|
12414
12430
|
);
|
|
12415
12431
|
}
|
|
@@ -12421,7 +12437,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12421
12437
|
}
|
|
12422
12438
|
static getSettablePaths(_options = {}) {
|
|
12423
12439
|
return {
|
|
12424
|
-
relativeDirPath:
|
|
12440
|
+
relativeDirPath: join90(".kiro", "agents")
|
|
12425
12441
|
};
|
|
12426
12442
|
}
|
|
12427
12443
|
getBody() {
|
|
@@ -12433,7 +12449,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12433
12449
|
parsed = JSON.parse(this.body);
|
|
12434
12450
|
} catch (error) {
|
|
12435
12451
|
throw new Error(
|
|
12436
|
-
`Failed to parse JSON in ${
|
|
12452
|
+
`Failed to parse JSON in ${join90(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12437
12453
|
{ cause: error }
|
|
12438
12454
|
);
|
|
12439
12455
|
}
|
|
@@ -12514,7 +12530,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12514
12530
|
global = false
|
|
12515
12531
|
}) {
|
|
12516
12532
|
const paths = this.getSettablePaths({ global });
|
|
12517
|
-
const filePath =
|
|
12533
|
+
const filePath = join90(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12518
12534
|
const fileContent = await readFileContent(filePath);
|
|
12519
12535
|
const subagent = new _KiroSubagent({
|
|
12520
12536
|
baseDir,
|
|
@@ -12552,7 +12568,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12552
12568
|
};
|
|
12553
12569
|
|
|
12554
12570
|
// src/features/subagents/opencode-subagent.ts
|
|
12555
|
-
import { basename as basename8, join as
|
|
12571
|
+
import { basename as basename8, join as join91 } from "path";
|
|
12556
12572
|
import { z as z49 } from "zod/mini";
|
|
12557
12573
|
var OpenCodeSubagentFrontmatterSchema = z49.looseObject({
|
|
12558
12574
|
description: z49.optional(z49.string()),
|
|
@@ -12567,7 +12583,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12567
12583
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12568
12584
|
if (!result.success) {
|
|
12569
12585
|
throw new Error(
|
|
12570
|
-
`Invalid frontmatter in ${
|
|
12586
|
+
`Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12571
12587
|
);
|
|
12572
12588
|
}
|
|
12573
12589
|
}
|
|
@@ -12581,7 +12597,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12581
12597
|
global = false
|
|
12582
12598
|
} = {}) {
|
|
12583
12599
|
return {
|
|
12584
|
-
relativeDirPath: global ?
|
|
12600
|
+
relativeDirPath: global ? join91(".config", "opencode", "agent") : join91(".opencode", "agent")
|
|
12585
12601
|
};
|
|
12586
12602
|
}
|
|
12587
12603
|
getFrontmatter() {
|
|
@@ -12647,7 +12663,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12647
12663
|
return {
|
|
12648
12664
|
success: false,
|
|
12649
12665
|
error: new Error(
|
|
12650
|
-
`Invalid frontmatter in ${
|
|
12666
|
+
`Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12651
12667
|
)
|
|
12652
12668
|
};
|
|
12653
12669
|
}
|
|
@@ -12664,7 +12680,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12664
12680
|
global = false
|
|
12665
12681
|
}) {
|
|
12666
12682
|
const paths = this.getSettablePaths({ global });
|
|
12667
|
-
const filePath =
|
|
12683
|
+
const filePath = join91(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12668
12684
|
const fileContent = await readFileContent(filePath);
|
|
12669
12685
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12670
12686
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12741,7 +12757,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12741
12757
|
"codexcli",
|
|
12742
12758
|
{
|
|
12743
12759
|
class: CodexCliSubagent,
|
|
12744
|
-
meta: { supportsSimulated: false, supportsGlobal:
|
|
12760
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.toml" }
|
|
12745
12761
|
}
|
|
12746
12762
|
],
|
|
12747
12763
|
[
|
|
@@ -12762,7 +12778,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12762
12778
|
"factorydroid",
|
|
12763
12779
|
{
|
|
12764
12780
|
class: FactorydroidSubagent,
|
|
12765
|
-
meta: { supportsSimulated: true, supportsGlobal:
|
|
12781
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
12766
12782
|
}
|
|
12767
12783
|
],
|
|
12768
12784
|
[
|
|
@@ -12831,9 +12847,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12831
12847
|
toolTarget,
|
|
12832
12848
|
global = false,
|
|
12833
12849
|
getFactory = defaultGetFactory5,
|
|
12834
|
-
dryRun = false
|
|
12850
|
+
dryRun = false,
|
|
12851
|
+
logger
|
|
12835
12852
|
}) {
|
|
12836
|
-
super({ baseDir, dryRun });
|
|
12853
|
+
super({ baseDir, dryRun, logger });
|
|
12837
12854
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12838
12855
|
if (!result.success) {
|
|
12839
12856
|
throw new Error(
|
|
@@ -12869,7 +12886,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12869
12886
|
const rulesyncSubagents = [];
|
|
12870
12887
|
for (const toolSubagent of toolSubagents) {
|
|
12871
12888
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12872
|
-
logger.debug(
|
|
12889
|
+
this.logger.debug(
|
|
12873
12890
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12874
12891
|
);
|
|
12875
12892
|
continue;
|
|
@@ -12883,39 +12900,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12883
12900
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12884
12901
|
*/
|
|
12885
12902
|
async loadRulesyncFiles() {
|
|
12886
|
-
const subagentsDir =
|
|
12903
|
+
const subagentsDir = join92(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12887
12904
|
const dirExists = await directoryExists(subagentsDir);
|
|
12888
12905
|
if (!dirExists) {
|
|
12889
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12906
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12890
12907
|
return [];
|
|
12891
12908
|
}
|
|
12892
12909
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12893
12910
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12894
12911
|
if (mdFiles.length === 0) {
|
|
12895
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12912
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12896
12913
|
return [];
|
|
12897
12914
|
}
|
|
12898
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12915
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12899
12916
|
const rulesyncSubagents = [];
|
|
12900
12917
|
for (const mdFile of mdFiles) {
|
|
12901
|
-
const filepath =
|
|
12918
|
+
const filepath = join92(subagentsDir, mdFile);
|
|
12902
12919
|
try {
|
|
12903
12920
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12904
12921
|
relativeFilePath: mdFile,
|
|
12905
12922
|
validate: true
|
|
12906
12923
|
});
|
|
12907
12924
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12908
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12925
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12909
12926
|
} catch (error) {
|
|
12910
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12927
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12911
12928
|
continue;
|
|
12912
12929
|
}
|
|
12913
12930
|
}
|
|
12914
12931
|
if (rulesyncSubagents.length === 0) {
|
|
12915
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12932
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12916
12933
|
return [];
|
|
12917
12934
|
}
|
|
12918
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12935
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12919
12936
|
return rulesyncSubagents;
|
|
12920
12937
|
}
|
|
12921
12938
|
/**
|
|
@@ -12928,7 +12945,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12928
12945
|
const factory = this.getFactory(this.toolTarget);
|
|
12929
12946
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12930
12947
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12931
|
-
|
|
12948
|
+
join92(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12932
12949
|
);
|
|
12933
12950
|
if (forDeletion) {
|
|
12934
12951
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -12939,7 +12956,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12939
12956
|
global: this.global
|
|
12940
12957
|
})
|
|
12941
12958
|
).filter((subagent) => subagent.isDeletable());
|
|
12942
|
-
logger.debug(
|
|
12959
|
+
this.logger.debug(
|
|
12943
12960
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12944
12961
|
);
|
|
12945
12962
|
return toolSubagents2;
|
|
@@ -12953,7 +12970,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12953
12970
|
})
|
|
12954
12971
|
)
|
|
12955
12972
|
);
|
|
12956
|
-
logger.debug(
|
|
12973
|
+
this.logger.debug(
|
|
12974
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12975
|
+
);
|
|
12957
12976
|
return toolSubagents;
|
|
12958
12977
|
}
|
|
12959
12978
|
/**
|
|
@@ -12993,13 +13012,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12993
13012
|
};
|
|
12994
13013
|
|
|
12995
13014
|
// src/features/rules/agentsmd-rule.ts
|
|
12996
|
-
import { join as
|
|
13015
|
+
import { join as join95 } from "path";
|
|
12997
13016
|
|
|
12998
13017
|
// src/features/rules/tool-rule.ts
|
|
12999
|
-
import { join as
|
|
13018
|
+
import { join as join94 } from "path";
|
|
13000
13019
|
|
|
13001
13020
|
// src/features/rules/rulesync-rule.ts
|
|
13002
|
-
import { join as
|
|
13021
|
+
import { join as join93 } from "path";
|
|
13003
13022
|
import { z as z51 } from "zod/mini";
|
|
13004
13023
|
var RulesyncRuleFrontmatterSchema = z51.object({
|
|
13005
13024
|
root: z51.optional(z51.boolean()),
|
|
@@ -13046,7 +13065,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13046
13065
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13047
13066
|
if (!parseResult.success && rest.validate !== false) {
|
|
13048
13067
|
throw new Error(
|
|
13049
|
-
`Invalid frontmatter in ${
|
|
13068
|
+
`Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
13050
13069
|
);
|
|
13051
13070
|
}
|
|
13052
13071
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -13081,7 +13100,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13081
13100
|
return {
|
|
13082
13101
|
success: false,
|
|
13083
13102
|
error: new Error(
|
|
13084
|
-
`Invalid frontmatter in ${
|
|
13103
|
+
`Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13085
13104
|
)
|
|
13086
13105
|
};
|
|
13087
13106
|
}
|
|
@@ -13090,7 +13109,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13090
13109
|
relativeFilePath,
|
|
13091
13110
|
validate = true
|
|
13092
13111
|
}) {
|
|
13093
|
-
const filePath =
|
|
13112
|
+
const filePath = join93(
|
|
13094
13113
|
process.cwd(),
|
|
13095
13114
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13096
13115
|
relativeFilePath
|
|
@@ -13192,7 +13211,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13192
13211
|
rulesyncRule,
|
|
13193
13212
|
validate = true,
|
|
13194
13213
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13195
|
-
nonRootPath = { relativeDirPath:
|
|
13214
|
+
nonRootPath = { relativeDirPath: join94(".agents", "memories") }
|
|
13196
13215
|
}) {
|
|
13197
13216
|
const params = this.buildToolRuleParamsDefault({
|
|
13198
13217
|
baseDir,
|
|
@@ -13203,7 +13222,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13203
13222
|
});
|
|
13204
13223
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13205
13224
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13206
|
-
params.relativeDirPath =
|
|
13225
|
+
params.relativeDirPath = join94(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13207
13226
|
params.relativeFilePath = "AGENTS.md";
|
|
13208
13227
|
}
|
|
13209
13228
|
return params;
|
|
@@ -13252,7 +13271,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13252
13271
|
}
|
|
13253
13272
|
};
|
|
13254
13273
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13255
|
-
return excludeToolDir ? subDir :
|
|
13274
|
+
return excludeToolDir ? subDir : join94(toolDir, subDir);
|
|
13256
13275
|
}
|
|
13257
13276
|
|
|
13258
13277
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13281,8 +13300,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13281
13300
|
validate = true
|
|
13282
13301
|
}) {
|
|
13283
13302
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13284
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
13285
|
-
const fileContent = await readFileContent(
|
|
13303
|
+
const relativePath = isRoot ? "AGENTS.md" : join95(".agents", "memories", relativeFilePath);
|
|
13304
|
+
const fileContent = await readFileContent(join95(baseDir, relativePath));
|
|
13286
13305
|
return new _AgentsMdRule({
|
|
13287
13306
|
baseDir,
|
|
13288
13307
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13337,7 +13356,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13337
13356
|
};
|
|
13338
13357
|
|
|
13339
13358
|
// src/features/rules/antigravity-rule.ts
|
|
13340
|
-
import { join as
|
|
13359
|
+
import { join as join96 } from "path";
|
|
13341
13360
|
import { z as z52 } from "zod/mini";
|
|
13342
13361
|
var AntigravityRuleFrontmatterSchema = z52.looseObject({
|
|
13343
13362
|
trigger: z52.optional(
|
|
@@ -13496,7 +13515,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13496
13515
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13497
13516
|
if (!result.success) {
|
|
13498
13517
|
throw new Error(
|
|
13499
|
-
`Invalid frontmatter in ${
|
|
13518
|
+
`Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13500
13519
|
);
|
|
13501
13520
|
}
|
|
13502
13521
|
}
|
|
@@ -13520,7 +13539,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13520
13539
|
relativeFilePath,
|
|
13521
13540
|
validate = true
|
|
13522
13541
|
}) {
|
|
13523
|
-
const filePath =
|
|
13542
|
+
const filePath = join96(
|
|
13524
13543
|
baseDir,
|
|
13525
13544
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13526
13545
|
relativeFilePath
|
|
@@ -13660,7 +13679,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13660
13679
|
};
|
|
13661
13680
|
|
|
13662
13681
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13663
|
-
import { join as
|
|
13682
|
+
import { join as join97 } from "path";
|
|
13664
13683
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13665
13684
|
toRulesyncRule() {
|
|
13666
13685
|
const rulesyncFrontmatter = {
|
|
@@ -13720,8 +13739,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13720
13739
|
}) {
|
|
13721
13740
|
const settablePaths = this.getSettablePaths();
|
|
13722
13741
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13723
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
13724
|
-
const fileContent = await readFileContent(
|
|
13742
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join97(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13743
|
+
const fileContent = await readFileContent(join97(baseDir, relativePath));
|
|
13725
13744
|
return new _AugmentcodeLegacyRule({
|
|
13726
13745
|
baseDir,
|
|
13727
13746
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13750,7 +13769,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13750
13769
|
};
|
|
13751
13770
|
|
|
13752
13771
|
// src/features/rules/augmentcode-rule.ts
|
|
13753
|
-
import { join as
|
|
13772
|
+
import { join as join98 } from "path";
|
|
13754
13773
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13755
13774
|
toRulesyncRule() {
|
|
13756
13775
|
return this.toRulesyncRuleDefault();
|
|
@@ -13781,7 +13800,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13781
13800
|
relativeFilePath,
|
|
13782
13801
|
validate = true
|
|
13783
13802
|
}) {
|
|
13784
|
-
const filePath =
|
|
13803
|
+
const filePath = join98(
|
|
13785
13804
|
baseDir,
|
|
13786
13805
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13787
13806
|
relativeFilePath
|
|
@@ -13821,7 +13840,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13821
13840
|
};
|
|
13822
13841
|
|
|
13823
13842
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13824
|
-
import { join as
|
|
13843
|
+
import { join as join99 } from "path";
|
|
13825
13844
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13826
13845
|
static getSettablePaths({
|
|
13827
13846
|
global,
|
|
@@ -13863,7 +13882,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13863
13882
|
if (isRoot) {
|
|
13864
13883
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13865
13884
|
const fileContent2 = await readFileContent(
|
|
13866
|
-
|
|
13885
|
+
join99(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13867
13886
|
);
|
|
13868
13887
|
return new _ClaudecodeLegacyRule({
|
|
13869
13888
|
baseDir,
|
|
@@ -13877,8 +13896,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13877
13896
|
if (!paths.nonRoot) {
|
|
13878
13897
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13879
13898
|
}
|
|
13880
|
-
const relativePath =
|
|
13881
|
-
const fileContent = await readFileContent(
|
|
13899
|
+
const relativePath = join99(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13900
|
+
const fileContent = await readFileContent(join99(baseDir, relativePath));
|
|
13882
13901
|
return new _ClaudecodeLegacyRule({
|
|
13883
13902
|
baseDir,
|
|
13884
13903
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13937,7 +13956,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13937
13956
|
};
|
|
13938
13957
|
|
|
13939
13958
|
// src/features/rules/claudecode-rule.ts
|
|
13940
|
-
import { join as
|
|
13959
|
+
import { join as join100 } from "path";
|
|
13941
13960
|
import { z as z53 } from "zod/mini";
|
|
13942
13961
|
var ClaudecodeRuleFrontmatterSchema = z53.object({
|
|
13943
13962
|
paths: z53.optional(z53.array(z53.string()))
|
|
@@ -13978,7 +13997,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13978
13997
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13979
13998
|
if (!result.success) {
|
|
13980
13999
|
throw new Error(
|
|
13981
|
-
`Invalid frontmatter in ${
|
|
14000
|
+
`Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13982
14001
|
);
|
|
13983
14002
|
}
|
|
13984
14003
|
}
|
|
@@ -14008,7 +14027,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14008
14027
|
if (isRoot) {
|
|
14009
14028
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14010
14029
|
const fileContent2 = await readFileContent(
|
|
14011
|
-
|
|
14030
|
+
join100(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14012
14031
|
);
|
|
14013
14032
|
return new _ClaudecodeRule({
|
|
14014
14033
|
baseDir,
|
|
@@ -14023,8 +14042,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14023
14042
|
if (!paths.nonRoot) {
|
|
14024
14043
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14025
14044
|
}
|
|
14026
|
-
const relativePath =
|
|
14027
|
-
const filePath =
|
|
14045
|
+
const relativePath = join100(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14046
|
+
const filePath = join100(baseDir, relativePath);
|
|
14028
14047
|
const fileContent = await readFileContent(filePath);
|
|
14029
14048
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14030
14049
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14135,7 +14154,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14135
14154
|
return {
|
|
14136
14155
|
success: false,
|
|
14137
14156
|
error: new Error(
|
|
14138
|
-
`Invalid frontmatter in ${
|
|
14157
|
+
`Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14139
14158
|
)
|
|
14140
14159
|
};
|
|
14141
14160
|
}
|
|
@@ -14155,7 +14174,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14155
14174
|
};
|
|
14156
14175
|
|
|
14157
14176
|
// src/features/rules/cline-rule.ts
|
|
14158
|
-
import { join as
|
|
14177
|
+
import { join as join101 } from "path";
|
|
14159
14178
|
import { z as z54 } from "zod/mini";
|
|
14160
14179
|
var ClineRuleFrontmatterSchema = z54.object({
|
|
14161
14180
|
description: z54.string()
|
|
@@ -14201,7 +14220,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14201
14220
|
validate = true
|
|
14202
14221
|
}) {
|
|
14203
14222
|
const fileContent = await readFileContent(
|
|
14204
|
-
|
|
14223
|
+
join101(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14205
14224
|
);
|
|
14206
14225
|
return new _ClineRule({
|
|
14207
14226
|
baseDir,
|
|
@@ -14227,7 +14246,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14227
14246
|
};
|
|
14228
14247
|
|
|
14229
14248
|
// src/features/rules/codexcli-rule.ts
|
|
14230
|
-
import { join as
|
|
14249
|
+
import { join as join102 } from "path";
|
|
14231
14250
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14232
14251
|
static getSettablePaths({
|
|
14233
14252
|
global,
|
|
@@ -14262,7 +14281,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14262
14281
|
if (isRoot) {
|
|
14263
14282
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14264
14283
|
const fileContent2 = await readFileContent(
|
|
14265
|
-
|
|
14284
|
+
join102(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14266
14285
|
);
|
|
14267
14286
|
return new _CodexcliRule({
|
|
14268
14287
|
baseDir,
|
|
@@ -14276,8 +14295,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14276
14295
|
if (!paths.nonRoot) {
|
|
14277
14296
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14278
14297
|
}
|
|
14279
|
-
const relativePath =
|
|
14280
|
-
const fileContent = await readFileContent(
|
|
14298
|
+
const relativePath = join102(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14299
|
+
const fileContent = await readFileContent(join102(baseDir, relativePath));
|
|
14281
14300
|
return new _CodexcliRule({
|
|
14282
14301
|
baseDir,
|
|
14283
14302
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14336,7 +14355,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14336
14355
|
};
|
|
14337
14356
|
|
|
14338
14357
|
// src/features/rules/copilot-rule.ts
|
|
14339
|
-
import { join as
|
|
14358
|
+
import { join as join103 } from "path";
|
|
14340
14359
|
import { z as z55 } from "zod/mini";
|
|
14341
14360
|
var CopilotRuleFrontmatterSchema = z55.object({
|
|
14342
14361
|
description: z55.optional(z55.string()),
|
|
@@ -14373,7 +14392,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14373
14392
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14374
14393
|
if (!result.success) {
|
|
14375
14394
|
throw new Error(
|
|
14376
|
-
`Invalid frontmatter in ${
|
|
14395
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14377
14396
|
);
|
|
14378
14397
|
}
|
|
14379
14398
|
}
|
|
@@ -14463,8 +14482,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14463
14482
|
const paths = this.getSettablePaths({ global });
|
|
14464
14483
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14465
14484
|
if (isRoot) {
|
|
14466
|
-
const relativePath2 =
|
|
14467
|
-
const filePath2 =
|
|
14485
|
+
const relativePath2 = join103(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14486
|
+
const filePath2 = join103(baseDir, relativePath2);
|
|
14468
14487
|
const fileContent2 = await readFileContent(filePath2);
|
|
14469
14488
|
return new _CopilotRule({
|
|
14470
14489
|
baseDir,
|
|
@@ -14479,8 +14498,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14479
14498
|
if (!paths.nonRoot) {
|
|
14480
14499
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14481
14500
|
}
|
|
14482
|
-
const relativePath =
|
|
14483
|
-
const filePath =
|
|
14501
|
+
const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14502
|
+
const filePath = join103(baseDir, relativePath);
|
|
14484
14503
|
const fileContent = await readFileContent(filePath);
|
|
14485
14504
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14486
14505
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14526,7 +14545,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14526
14545
|
return {
|
|
14527
14546
|
success: false,
|
|
14528
14547
|
error: new Error(
|
|
14529
|
-
`Invalid frontmatter in ${
|
|
14548
|
+
`Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14530
14549
|
)
|
|
14531
14550
|
};
|
|
14532
14551
|
}
|
|
@@ -14546,7 +14565,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14546
14565
|
};
|
|
14547
14566
|
|
|
14548
14567
|
// src/features/rules/cursor-rule.ts
|
|
14549
|
-
import { join as
|
|
14568
|
+
import { join as join104 } from "path";
|
|
14550
14569
|
import { z as z56 } from "zod/mini";
|
|
14551
14570
|
var CursorRuleFrontmatterSchema = z56.object({
|
|
14552
14571
|
description: z56.optional(z56.string()),
|
|
@@ -14568,7 +14587,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14568
14587
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14569
14588
|
if (!result.success) {
|
|
14570
14589
|
throw new Error(
|
|
14571
|
-
`Invalid frontmatter in ${
|
|
14590
|
+
`Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14572
14591
|
);
|
|
14573
14592
|
}
|
|
14574
14593
|
}
|
|
@@ -14684,7 +14703,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14684
14703
|
relativeFilePath,
|
|
14685
14704
|
validate = true
|
|
14686
14705
|
}) {
|
|
14687
|
-
const filePath =
|
|
14706
|
+
const filePath = join104(
|
|
14688
14707
|
baseDir,
|
|
14689
14708
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14690
14709
|
relativeFilePath
|
|
@@ -14694,7 +14713,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14694
14713
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14695
14714
|
if (!result.success) {
|
|
14696
14715
|
throw new Error(
|
|
14697
|
-
`Invalid frontmatter in ${
|
|
14716
|
+
`Invalid frontmatter in ${join104(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14698
14717
|
);
|
|
14699
14718
|
}
|
|
14700
14719
|
return new _CursorRule({
|
|
@@ -14731,7 +14750,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14731
14750
|
return {
|
|
14732
14751
|
success: false,
|
|
14733
14752
|
error: new Error(
|
|
14734
|
-
`Invalid frontmatter in ${
|
|
14753
|
+
`Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14735
14754
|
)
|
|
14736
14755
|
};
|
|
14737
14756
|
}
|
|
@@ -14751,7 +14770,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14751
14770
|
};
|
|
14752
14771
|
|
|
14753
14772
|
// src/features/rules/factorydroid-rule.ts
|
|
14754
|
-
import { join as
|
|
14773
|
+
import { join as join105 } from "path";
|
|
14755
14774
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14756
14775
|
constructor({ fileContent, root, ...rest }) {
|
|
14757
14776
|
super({
|
|
@@ -14791,8 +14810,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14791
14810
|
const paths = this.getSettablePaths({ global });
|
|
14792
14811
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14793
14812
|
if (isRoot) {
|
|
14794
|
-
const relativePath2 =
|
|
14795
|
-
const fileContent2 = await readFileContent(
|
|
14813
|
+
const relativePath2 = join105(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14814
|
+
const fileContent2 = await readFileContent(join105(baseDir, relativePath2));
|
|
14796
14815
|
return new _FactorydroidRule({
|
|
14797
14816
|
baseDir,
|
|
14798
14817
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14805,8 +14824,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14805
14824
|
if (!paths.nonRoot) {
|
|
14806
14825
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14807
14826
|
}
|
|
14808
|
-
const relativePath =
|
|
14809
|
-
const fileContent = await readFileContent(
|
|
14827
|
+
const relativePath = join105(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14828
|
+
const fileContent = await readFileContent(join105(baseDir, relativePath));
|
|
14810
14829
|
return new _FactorydroidRule({
|
|
14811
14830
|
baseDir,
|
|
14812
14831
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14865,7 +14884,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14865
14884
|
};
|
|
14866
14885
|
|
|
14867
14886
|
// src/features/rules/geminicli-rule.ts
|
|
14868
|
-
import { join as
|
|
14887
|
+
import { join as join106 } from "path";
|
|
14869
14888
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14870
14889
|
static getSettablePaths({
|
|
14871
14890
|
global,
|
|
@@ -14900,7 +14919,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14900
14919
|
if (isRoot) {
|
|
14901
14920
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14902
14921
|
const fileContent2 = await readFileContent(
|
|
14903
|
-
|
|
14922
|
+
join106(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14904
14923
|
);
|
|
14905
14924
|
return new _GeminiCliRule({
|
|
14906
14925
|
baseDir,
|
|
@@ -14914,8 +14933,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14914
14933
|
if (!paths.nonRoot) {
|
|
14915
14934
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14916
14935
|
}
|
|
14917
|
-
const relativePath =
|
|
14918
|
-
const fileContent = await readFileContent(
|
|
14936
|
+
const relativePath = join106(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14937
|
+
const fileContent = await readFileContent(join106(baseDir, relativePath));
|
|
14919
14938
|
return new _GeminiCliRule({
|
|
14920
14939
|
baseDir,
|
|
14921
14940
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14974,7 +14993,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14974
14993
|
};
|
|
14975
14994
|
|
|
14976
14995
|
// src/features/rules/goose-rule.ts
|
|
14977
|
-
import { join as
|
|
14996
|
+
import { join as join107 } from "path";
|
|
14978
14997
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14979
14998
|
static getSettablePaths({
|
|
14980
14999
|
global,
|
|
@@ -15009,7 +15028,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15009
15028
|
if (isRoot) {
|
|
15010
15029
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15011
15030
|
const fileContent2 = await readFileContent(
|
|
15012
|
-
|
|
15031
|
+
join107(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15013
15032
|
);
|
|
15014
15033
|
return new _GooseRule({
|
|
15015
15034
|
baseDir,
|
|
@@ -15023,8 +15042,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15023
15042
|
if (!paths.nonRoot) {
|
|
15024
15043
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15025
15044
|
}
|
|
15026
|
-
const relativePath =
|
|
15027
|
-
const fileContent = await readFileContent(
|
|
15045
|
+
const relativePath = join107(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15046
|
+
const fileContent = await readFileContent(join107(baseDir, relativePath));
|
|
15028
15047
|
return new _GooseRule({
|
|
15029
15048
|
baseDir,
|
|
15030
15049
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15083,7 +15102,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15083
15102
|
};
|
|
15084
15103
|
|
|
15085
15104
|
// src/features/rules/junie-rule.ts
|
|
15086
|
-
import { join as
|
|
15105
|
+
import { join as join108 } from "path";
|
|
15087
15106
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15088
15107
|
static getSettablePaths(_options = {}) {
|
|
15089
15108
|
return {
|
|
@@ -15102,8 +15121,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15102
15121
|
validate = true
|
|
15103
15122
|
}) {
|
|
15104
15123
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15105
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
15106
|
-
const fileContent = await readFileContent(
|
|
15124
|
+
const relativePath = isRoot ? "guidelines.md" : join108(".junie", "memories", relativeFilePath);
|
|
15125
|
+
const fileContent = await readFileContent(join108(baseDir, relativePath));
|
|
15107
15126
|
return new _JunieRule({
|
|
15108
15127
|
baseDir,
|
|
15109
15128
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15158,7 +15177,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15158
15177
|
};
|
|
15159
15178
|
|
|
15160
15179
|
// src/features/rules/kilo-rule.ts
|
|
15161
|
-
import { join as
|
|
15180
|
+
import { join as join109 } from "path";
|
|
15162
15181
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15163
15182
|
static getSettablePaths(_options = {}) {
|
|
15164
15183
|
return {
|
|
@@ -15173,7 +15192,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15173
15192
|
validate = true
|
|
15174
15193
|
}) {
|
|
15175
15194
|
const fileContent = await readFileContent(
|
|
15176
|
-
|
|
15195
|
+
join109(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15177
15196
|
);
|
|
15178
15197
|
return new _KiloRule({
|
|
15179
15198
|
baseDir,
|
|
@@ -15225,7 +15244,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15225
15244
|
};
|
|
15226
15245
|
|
|
15227
15246
|
// src/features/rules/kiro-rule.ts
|
|
15228
|
-
import { join as
|
|
15247
|
+
import { join as join110 } from "path";
|
|
15229
15248
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15230
15249
|
static getSettablePaths(_options = {}) {
|
|
15231
15250
|
return {
|
|
@@ -15240,7 +15259,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15240
15259
|
validate = true
|
|
15241
15260
|
}) {
|
|
15242
15261
|
const fileContent = await readFileContent(
|
|
15243
|
-
|
|
15262
|
+
join110(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15244
15263
|
);
|
|
15245
15264
|
return new _KiroRule({
|
|
15246
15265
|
baseDir,
|
|
@@ -15294,7 +15313,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15294
15313
|
};
|
|
15295
15314
|
|
|
15296
15315
|
// src/features/rules/opencode-rule.ts
|
|
15297
|
-
import { join as
|
|
15316
|
+
import { join as join111 } from "path";
|
|
15298
15317
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15299
15318
|
static getSettablePaths({
|
|
15300
15319
|
global,
|
|
@@ -15329,7 +15348,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15329
15348
|
if (isRoot) {
|
|
15330
15349
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15331
15350
|
const fileContent2 = await readFileContent(
|
|
15332
|
-
|
|
15351
|
+
join111(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15333
15352
|
);
|
|
15334
15353
|
return new _OpenCodeRule({
|
|
15335
15354
|
baseDir,
|
|
@@ -15343,8 +15362,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15343
15362
|
if (!paths.nonRoot) {
|
|
15344
15363
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15345
15364
|
}
|
|
15346
|
-
const relativePath =
|
|
15347
|
-
const fileContent = await readFileContent(
|
|
15365
|
+
const relativePath = join111(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15366
|
+
const fileContent = await readFileContent(join111(baseDir, relativePath));
|
|
15348
15367
|
return new _OpenCodeRule({
|
|
15349
15368
|
baseDir,
|
|
15350
15369
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15403,7 +15422,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15403
15422
|
};
|
|
15404
15423
|
|
|
15405
15424
|
// src/features/rules/qwencode-rule.ts
|
|
15406
|
-
import { join as
|
|
15425
|
+
import { join as join112 } from "path";
|
|
15407
15426
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15408
15427
|
static getSettablePaths(_options = {}) {
|
|
15409
15428
|
return {
|
|
@@ -15422,8 +15441,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15422
15441
|
validate = true
|
|
15423
15442
|
}) {
|
|
15424
15443
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15425
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
15426
|
-
const fileContent = await readFileContent(
|
|
15444
|
+
const relativePath = isRoot ? "QWEN.md" : join112(".qwen", "memories", relativeFilePath);
|
|
15445
|
+
const fileContent = await readFileContent(join112(baseDir, relativePath));
|
|
15427
15446
|
return new _QwencodeRule({
|
|
15428
15447
|
baseDir,
|
|
15429
15448
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15475,7 +15494,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15475
15494
|
};
|
|
15476
15495
|
|
|
15477
15496
|
// src/features/rules/replit-rule.ts
|
|
15478
|
-
import { join as
|
|
15497
|
+
import { join as join113 } from "path";
|
|
15479
15498
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15480
15499
|
static getSettablePaths(_options = {}) {
|
|
15481
15500
|
return {
|
|
@@ -15497,7 +15516,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15497
15516
|
}
|
|
15498
15517
|
const relativePath = paths.root.relativeFilePath;
|
|
15499
15518
|
const fileContent = await readFileContent(
|
|
15500
|
-
|
|
15519
|
+
join113(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15501
15520
|
);
|
|
15502
15521
|
return new _ReplitRule({
|
|
15503
15522
|
baseDir,
|
|
@@ -15563,7 +15582,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15563
15582
|
};
|
|
15564
15583
|
|
|
15565
15584
|
// src/features/rules/roo-rule.ts
|
|
15566
|
-
import { join as
|
|
15585
|
+
import { join as join114 } from "path";
|
|
15567
15586
|
var RooRule = class _RooRule extends ToolRule {
|
|
15568
15587
|
static getSettablePaths(_options = {}) {
|
|
15569
15588
|
return {
|
|
@@ -15578,7 +15597,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15578
15597
|
validate = true
|
|
15579
15598
|
}) {
|
|
15580
15599
|
const fileContent = await readFileContent(
|
|
15581
|
-
|
|
15600
|
+
join114(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15582
15601
|
);
|
|
15583
15602
|
return new _RooRule({
|
|
15584
15603
|
baseDir,
|
|
@@ -15647,7 +15666,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15647
15666
|
};
|
|
15648
15667
|
|
|
15649
15668
|
// src/features/rules/warp-rule.ts
|
|
15650
|
-
import { join as
|
|
15669
|
+
import { join as join115 } from "path";
|
|
15651
15670
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15652
15671
|
constructor({ fileContent, root, ...rest }) {
|
|
15653
15672
|
super({
|
|
@@ -15673,8 +15692,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15673
15692
|
validate = true
|
|
15674
15693
|
}) {
|
|
15675
15694
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15676
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
15677
|
-
const fileContent = await readFileContent(
|
|
15695
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join115(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15696
|
+
const fileContent = await readFileContent(join115(baseDir, relativePath));
|
|
15678
15697
|
return new _WarpRule({
|
|
15679
15698
|
baseDir,
|
|
15680
15699
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15729,7 +15748,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15729
15748
|
};
|
|
15730
15749
|
|
|
15731
15750
|
// src/features/rules/windsurf-rule.ts
|
|
15732
|
-
import { join as
|
|
15751
|
+
import { join as join116 } from "path";
|
|
15733
15752
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15734
15753
|
static getSettablePaths(_options = {}) {
|
|
15735
15754
|
return {
|
|
@@ -15744,7 +15763,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15744
15763
|
validate = true
|
|
15745
15764
|
}) {
|
|
15746
15765
|
const fileContent = await readFileContent(
|
|
15747
|
-
|
|
15766
|
+
join116(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15748
15767
|
);
|
|
15749
15768
|
return new _WindsurfRule({
|
|
15750
15769
|
baseDir,
|
|
@@ -15821,7 +15840,7 @@ var rulesProcessorToolTargets = [
|
|
|
15821
15840
|
"windsurf"
|
|
15822
15841
|
];
|
|
15823
15842
|
var RulesProcessorToolTargetSchema = z57.enum(rulesProcessorToolTargets);
|
|
15824
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
15843
|
+
var formatRulePaths = (rules) => rules.map((r) => join117(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15825
15844
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15826
15845
|
[
|
|
15827
15846
|
"agentsmd",
|
|
@@ -16108,9 +16127,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16108
16127
|
global = false,
|
|
16109
16128
|
getFactory = defaultGetFactory6,
|
|
16110
16129
|
skills,
|
|
16111
|
-
dryRun = false
|
|
16130
|
+
dryRun = false,
|
|
16131
|
+
logger
|
|
16112
16132
|
}) {
|
|
16113
|
-
super({ baseDir, dryRun });
|
|
16133
|
+
super({ baseDir, dryRun, logger });
|
|
16114
16134
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16115
16135
|
if (!result.success) {
|
|
16116
16136
|
throw new Error(
|
|
@@ -16196,7 +16216,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16196
16216
|
}).relativeDirPath;
|
|
16197
16217
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16198
16218
|
const frontmatter = skill.getFrontmatter();
|
|
16199
|
-
const relativePath =
|
|
16219
|
+
const relativePath = join117(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16200
16220
|
return {
|
|
16201
16221
|
name: frontmatter.name,
|
|
16202
16222
|
description: frontmatter.description,
|
|
@@ -16309,9 +16329,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16309
16329
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16310
16330
|
*/
|
|
16311
16331
|
async loadRulesyncFiles() {
|
|
16312
|
-
const rulesyncBaseDir =
|
|
16313
|
-
const files = await findFilesByGlobs(
|
|
16314
|
-
logger.debug(`Found ${files.length} rulesync files`);
|
|
16332
|
+
const rulesyncBaseDir = join117(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
16333
|
+
const files = await findFilesByGlobs(join117(rulesyncBaseDir, "**", "*.md"));
|
|
16334
|
+
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
16315
16335
|
const rulesyncRules = await Promise.all(
|
|
16316
16336
|
files.map((file) => {
|
|
16317
16337
|
const relativeFilePath = relative5(rulesyncBaseDir, file);
|
|
@@ -16335,7 +16355,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16335
16355
|
);
|
|
16336
16356
|
}
|
|
16337
16357
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16338
|
-
logger.warn(
|
|
16358
|
+
this.logger.warn(
|
|
16339
16359
|
`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}.`
|
|
16340
16360
|
);
|
|
16341
16361
|
}
|
|
@@ -16360,12 +16380,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16360
16380
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16361
16381
|
);
|
|
16362
16382
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16363
|
-
logger.warn(
|
|
16383
|
+
this.logger.warn(
|
|
16364
16384
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16365
16385
|
);
|
|
16366
16386
|
}
|
|
16367
16387
|
if (targetedLocalRootRules.length > 0) {
|
|
16368
|
-
logger.warn(
|
|
16388
|
+
this.logger.warn(
|
|
16369
16389
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16370
16390
|
);
|
|
16371
16391
|
}
|
|
@@ -16407,13 +16427,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16407
16427
|
return [];
|
|
16408
16428
|
}
|
|
16409
16429
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16410
|
-
|
|
16430
|
+
join117(
|
|
16411
16431
|
this.baseDir,
|
|
16412
16432
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16413
16433
|
settablePaths.root.relativeFilePath
|
|
16414
16434
|
),
|
|
16415
16435
|
settablePaths.alternativeRoots,
|
|
16416
|
-
(alt) =>
|
|
16436
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16417
16437
|
);
|
|
16418
16438
|
if (forDeletion) {
|
|
16419
16439
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16446,7 +16466,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16446
16466
|
})
|
|
16447
16467
|
);
|
|
16448
16468
|
})();
|
|
16449
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16469
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16450
16470
|
const localRootToolRules = await (async () => {
|
|
16451
16471
|
if (!forDeletion) {
|
|
16452
16472
|
return [];
|
|
@@ -16458,9 +16478,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16458
16478
|
return [];
|
|
16459
16479
|
}
|
|
16460
16480
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16461
|
-
|
|
16481
|
+
join117(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16462
16482
|
settablePaths.alternativeRoots,
|
|
16463
|
-
(alt) =>
|
|
16483
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16464
16484
|
);
|
|
16465
16485
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16466
16486
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16476,14 +16496,16 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16476
16496
|
});
|
|
16477
16497
|
}).filter((rule) => rule.isDeletable());
|
|
16478
16498
|
})();
|
|
16479
|
-
logger.debug(
|
|
16499
|
+
this.logger.debug(
|
|
16500
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16501
|
+
);
|
|
16480
16502
|
const nonRootToolRules = await (async () => {
|
|
16481
16503
|
if (!settablePaths.nonRoot) {
|
|
16482
16504
|
return [];
|
|
16483
16505
|
}
|
|
16484
|
-
const nonRootBaseDir =
|
|
16506
|
+
const nonRootBaseDir = join117(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16485
16507
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16486
|
-
|
|
16508
|
+
join117(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16487
16509
|
);
|
|
16488
16510
|
if (forDeletion) {
|
|
16489
16511
|
return nonRootFilePaths.map((filePath) => {
|
|
@@ -16515,10 +16537,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16515
16537
|
})
|
|
16516
16538
|
);
|
|
16517
16539
|
})();
|
|
16518
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16540
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16519
16541
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16520
16542
|
} catch (error) {
|
|
16521
|
-
logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16543
|
+
this.logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16522
16544
|
return [];
|
|
16523
16545
|
}
|
|
16524
16546
|
}
|
|
@@ -16615,14 +16637,14 @@ s/<command> [arguments]
|
|
|
16615
16637
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16616
16638
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
16617
16639
|
|
|
16618
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
16640
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join117(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
16619
16641
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16620
16642
|
|
|
16621
16643
|
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.
|
|
16622
16644
|
|
|
16623
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
16645
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join117(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
16624
16646
|
|
|
16625
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
16647
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join117(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
16626
16648
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16627
16649
|
const result = [
|
|
16628
16650
|
overview,
|
|
@@ -16693,26 +16715,38 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16693
16715
|
}
|
|
16694
16716
|
return { count: totalCount, paths: [], hasDiff };
|
|
16695
16717
|
}
|
|
16718
|
+
var SIMULATE_OPTION_MAP = {
|
|
16719
|
+
commands: "--simulate-commands",
|
|
16720
|
+
subagents: "--simulate-subagents",
|
|
16721
|
+
skills: "--simulate-skills"
|
|
16722
|
+
};
|
|
16696
16723
|
function warnUnsupportedTargets(params) {
|
|
16697
|
-
const { config, supportedTargets, featureName } = params;
|
|
16724
|
+
const { config, supportedTargets, simulatedTargets = [], featureName, logger } = params;
|
|
16698
16725
|
for (const target of config.getTargets()) {
|
|
16699
16726
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16700
|
-
|
|
16727
|
+
const simulateOption = SIMULATE_OPTION_MAP[featureName];
|
|
16728
|
+
if (simulateOption && simulatedTargets.includes(target)) {
|
|
16729
|
+
logger.warn(
|
|
16730
|
+
`Target '${target}' only supports simulated '${featureName}'. Use '${simulateOption}' to enable it. Skipping.`
|
|
16731
|
+
);
|
|
16732
|
+
} else {
|
|
16733
|
+
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
16734
|
+
}
|
|
16701
16735
|
}
|
|
16702
16736
|
}
|
|
16703
16737
|
}
|
|
16704
16738
|
async function checkRulesyncDirExists(params) {
|
|
16705
|
-
return fileExists(
|
|
16739
|
+
return fileExists(join118(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16706
16740
|
}
|
|
16707
16741
|
async function generate(params) {
|
|
16708
|
-
const { config } = params;
|
|
16709
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16710
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16711
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16712
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16713
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16714
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16715
|
-
const rulesResult = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
16742
|
+
const { config, logger } = params;
|
|
16743
|
+
const ignoreResult = await generateIgnoreCore({ config, logger });
|
|
16744
|
+
const mcpResult = await generateMcpCore({ config, logger });
|
|
16745
|
+
const commandsResult = await generateCommandsCore({ config, logger });
|
|
16746
|
+
const subagentsResult = await generateSubagentsCore({ config, logger });
|
|
16747
|
+
const skillsResult = await generateSkillsCore({ config, logger });
|
|
16748
|
+
const hooksResult = await generateHooksCore({ config, logger });
|
|
16749
|
+
const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
|
|
16716
16750
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16717
16751
|
return {
|
|
16718
16752
|
rulesCount: rulesResult.count,
|
|
@@ -16734,13 +16768,13 @@ async function generate(params) {
|
|
|
16734
16768
|
};
|
|
16735
16769
|
}
|
|
16736
16770
|
async function generateRulesCore(params) {
|
|
16737
|
-
const { config, skills } = params;
|
|
16771
|
+
const { config, logger, skills } = params;
|
|
16738
16772
|
let totalCount = 0;
|
|
16739
16773
|
const allPaths = [];
|
|
16740
16774
|
let hasDiff = false;
|
|
16741
16775
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16742
16776
|
const toolTargets = intersection(config.getTargets(), supportedTargets);
|
|
16743
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16777
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16744
16778
|
for (const baseDir of config.getBaseDirs()) {
|
|
16745
16779
|
for (const toolTarget of toolTargets) {
|
|
16746
16780
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16754,7 +16788,8 @@ async function generateRulesCore(params) {
|
|
|
16754
16788
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16755
16789
|
simulateSkills: config.getSimulateSkills(),
|
|
16756
16790
|
skills,
|
|
16757
|
-
dryRun: config.isPreviewMode()
|
|
16791
|
+
dryRun: config.isPreviewMode(),
|
|
16792
|
+
logger
|
|
16758
16793
|
});
|
|
16759
16794
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16760
16795
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16771,12 +16806,13 @@ async function generateRulesCore(params) {
|
|
|
16771
16806
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16772
16807
|
}
|
|
16773
16808
|
async function generateIgnoreCore(params) {
|
|
16774
|
-
const { config } = params;
|
|
16809
|
+
const { config, logger } = params;
|
|
16775
16810
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16776
16811
|
warnUnsupportedTargets({
|
|
16777
16812
|
config,
|
|
16778
16813
|
supportedTargets: supportedIgnoreTargets,
|
|
16779
|
-
featureName: "ignore"
|
|
16814
|
+
featureName: "ignore",
|
|
16815
|
+
logger
|
|
16780
16816
|
});
|
|
16781
16817
|
if (config.getGlobal()) {
|
|
16782
16818
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16793,7 +16829,8 @@ async function generateIgnoreCore(params) {
|
|
|
16793
16829
|
const processor = new IgnoreProcessor({
|
|
16794
16830
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16795
16831
|
toolTarget,
|
|
16796
|
-
dryRun: config.isPreviewMode()
|
|
16832
|
+
dryRun: config.isPreviewMode(),
|
|
16833
|
+
logger
|
|
16797
16834
|
});
|
|
16798
16835
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16799
16836
|
let result;
|
|
@@ -16824,13 +16861,18 @@ async function generateIgnoreCore(params) {
|
|
|
16824
16861
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16825
16862
|
}
|
|
16826
16863
|
async function generateMcpCore(params) {
|
|
16827
|
-
const { config } = params;
|
|
16864
|
+
const { config, logger } = params;
|
|
16828
16865
|
let totalCount = 0;
|
|
16829
16866
|
const allPaths = [];
|
|
16830
16867
|
let hasDiff = false;
|
|
16831
16868
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16832
16869
|
const toolTargets = intersection(config.getTargets(), supportedMcpTargets);
|
|
16833
|
-
warnUnsupportedTargets({
|
|
16870
|
+
warnUnsupportedTargets({
|
|
16871
|
+
config,
|
|
16872
|
+
supportedTargets: supportedMcpTargets,
|
|
16873
|
+
featureName: "mcp",
|
|
16874
|
+
logger
|
|
16875
|
+
});
|
|
16834
16876
|
for (const baseDir of config.getBaseDirs()) {
|
|
16835
16877
|
for (const toolTarget of toolTargets) {
|
|
16836
16878
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16840,7 +16882,8 @@ async function generateMcpCore(params) {
|
|
|
16840
16882
|
baseDir,
|
|
16841
16883
|
toolTarget,
|
|
16842
16884
|
global: config.getGlobal(),
|
|
16843
|
-
dryRun: config.isPreviewMode()
|
|
16885
|
+
dryRun: config.isPreviewMode(),
|
|
16886
|
+
logger
|
|
16844
16887
|
});
|
|
16845
16888
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16846
16889
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16857,7 +16900,7 @@ async function generateMcpCore(params) {
|
|
|
16857
16900
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16858
16901
|
}
|
|
16859
16902
|
async function generateCommandsCore(params) {
|
|
16860
|
-
const { config } = params;
|
|
16903
|
+
const { config, logger } = params;
|
|
16861
16904
|
let totalCount = 0;
|
|
16862
16905
|
const allPaths = [];
|
|
16863
16906
|
let hasDiff = false;
|
|
@@ -16869,7 +16912,9 @@ async function generateCommandsCore(params) {
|
|
|
16869
16912
|
warnUnsupportedTargets({
|
|
16870
16913
|
config,
|
|
16871
16914
|
supportedTargets: supportedCommandsTargets,
|
|
16872
|
-
|
|
16915
|
+
simulatedTargets: CommandsProcessor.getToolTargetsSimulated(),
|
|
16916
|
+
featureName: "commands",
|
|
16917
|
+
logger
|
|
16873
16918
|
});
|
|
16874
16919
|
for (const baseDir of config.getBaseDirs()) {
|
|
16875
16920
|
for (const toolTarget of toolTargets) {
|
|
@@ -16880,7 +16925,8 @@ async function generateCommandsCore(params) {
|
|
|
16880
16925
|
baseDir,
|
|
16881
16926
|
toolTarget,
|
|
16882
16927
|
global: config.getGlobal(),
|
|
16883
|
-
dryRun: config.isPreviewMode()
|
|
16928
|
+
dryRun: config.isPreviewMode(),
|
|
16929
|
+
logger
|
|
16884
16930
|
});
|
|
16885
16931
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16886
16932
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16897,7 +16943,7 @@ async function generateCommandsCore(params) {
|
|
|
16897
16943
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16898
16944
|
}
|
|
16899
16945
|
async function generateSubagentsCore(params) {
|
|
16900
|
-
const { config } = params;
|
|
16946
|
+
const { config, logger } = params;
|
|
16901
16947
|
let totalCount = 0;
|
|
16902
16948
|
const allPaths = [];
|
|
16903
16949
|
let hasDiff = false;
|
|
@@ -16909,7 +16955,9 @@ async function generateSubagentsCore(params) {
|
|
|
16909
16955
|
warnUnsupportedTargets({
|
|
16910
16956
|
config,
|
|
16911
16957
|
supportedTargets: supportedSubagentsTargets,
|
|
16912
|
-
|
|
16958
|
+
simulatedTargets: SubagentsProcessor.getToolTargetsSimulated(),
|
|
16959
|
+
featureName: "subagents",
|
|
16960
|
+
logger
|
|
16913
16961
|
});
|
|
16914
16962
|
for (const baseDir of config.getBaseDirs()) {
|
|
16915
16963
|
for (const toolTarget of toolTargets) {
|
|
@@ -16920,7 +16968,8 @@ async function generateSubagentsCore(params) {
|
|
|
16920
16968
|
baseDir,
|
|
16921
16969
|
toolTarget,
|
|
16922
16970
|
global: config.getGlobal(),
|
|
16923
|
-
dryRun: config.isPreviewMode()
|
|
16971
|
+
dryRun: config.isPreviewMode(),
|
|
16972
|
+
logger
|
|
16924
16973
|
});
|
|
16925
16974
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16926
16975
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16937,7 +16986,7 @@ async function generateSubagentsCore(params) {
|
|
|
16937
16986
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16938
16987
|
}
|
|
16939
16988
|
async function generateSkillsCore(params) {
|
|
16940
|
-
const { config } = params;
|
|
16989
|
+
const { config, logger } = params;
|
|
16941
16990
|
let totalCount = 0;
|
|
16942
16991
|
const allPaths = [];
|
|
16943
16992
|
let hasDiff = false;
|
|
@@ -16950,7 +16999,9 @@ async function generateSkillsCore(params) {
|
|
|
16950
16999
|
warnUnsupportedTargets({
|
|
16951
17000
|
config,
|
|
16952
17001
|
supportedTargets: supportedSkillsTargets,
|
|
16953
|
-
|
|
17002
|
+
simulatedTargets: SkillsProcessor.getToolTargetsSimulated(),
|
|
17003
|
+
featureName: "skills",
|
|
17004
|
+
logger
|
|
16954
17005
|
});
|
|
16955
17006
|
for (const baseDir of config.getBaseDirs()) {
|
|
16956
17007
|
for (const toolTarget of toolTargets) {
|
|
@@ -16961,7 +17012,8 @@ async function generateSkillsCore(params) {
|
|
|
16961
17012
|
baseDir,
|
|
16962
17013
|
toolTarget,
|
|
16963
17014
|
global: config.getGlobal(),
|
|
16964
|
-
dryRun: config.isPreviewMode()
|
|
17015
|
+
dryRun: config.isPreviewMode(),
|
|
17016
|
+
logger
|
|
16965
17017
|
});
|
|
16966
17018
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16967
17019
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -16983,13 +17035,18 @@ async function generateSkillsCore(params) {
|
|
|
16983
17035
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
16984
17036
|
}
|
|
16985
17037
|
async function generateHooksCore(params) {
|
|
16986
|
-
const { config } = params;
|
|
17038
|
+
const { config, logger } = params;
|
|
16987
17039
|
let totalCount = 0;
|
|
16988
17040
|
const allPaths = [];
|
|
16989
17041
|
let hasDiff = false;
|
|
16990
17042
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16991
17043
|
const toolTargets = intersection(config.getTargets(), supportedHooksTargets);
|
|
16992
|
-
warnUnsupportedTargets({
|
|
17044
|
+
warnUnsupportedTargets({
|
|
17045
|
+
config,
|
|
17046
|
+
supportedTargets: supportedHooksTargets,
|
|
17047
|
+
featureName: "hooks",
|
|
17048
|
+
logger
|
|
17049
|
+
});
|
|
16993
17050
|
for (const baseDir of config.getBaseDirs()) {
|
|
16994
17051
|
for (const toolTarget of toolTargets) {
|
|
16995
17052
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -16999,7 +17056,8 @@ async function generateHooksCore(params) {
|
|
|
16999
17056
|
baseDir,
|
|
17000
17057
|
toolTarget,
|
|
17001
17058
|
global: config.getGlobal(),
|
|
17002
|
-
dryRun: config.isPreviewMode()
|
|
17059
|
+
dryRun: config.isPreviewMode(),
|
|
17060
|
+
logger
|
|
17003
17061
|
});
|
|
17004
17062
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
17005
17063
|
let result;
|
|
@@ -17026,14 +17084,14 @@ async function generateHooksCore(params) {
|
|
|
17026
17084
|
|
|
17027
17085
|
// src/lib/import.ts
|
|
17028
17086
|
async function importFromTool(params) {
|
|
17029
|
-
const { config, tool } = params;
|
|
17030
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
17031
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
17032
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
17033
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
17034
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
17035
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
17036
|
-
const hooksCount = await importHooksCore({ config, tool });
|
|
17087
|
+
const { config, tool, logger } = params;
|
|
17088
|
+
const rulesCount = await importRulesCore({ config, tool, logger });
|
|
17089
|
+
const ignoreCount = await importIgnoreCore({ config, tool, logger });
|
|
17090
|
+
const mcpCount = await importMcpCore({ config, tool, logger });
|
|
17091
|
+
const commandsCount = await importCommandsCore({ config, tool, logger });
|
|
17092
|
+
const subagentsCount = await importSubagentsCore({ config, tool, logger });
|
|
17093
|
+
const skillsCount = await importSkillsCore({ config, tool, logger });
|
|
17094
|
+
const hooksCount = await importHooksCore({ config, tool, logger });
|
|
17037
17095
|
return {
|
|
17038
17096
|
rulesCount,
|
|
17039
17097
|
ignoreCount,
|
|
@@ -17045,7 +17103,7 @@ async function importFromTool(params) {
|
|
|
17045
17103
|
};
|
|
17046
17104
|
}
|
|
17047
17105
|
async function importRulesCore(params) {
|
|
17048
|
-
const { config, tool } = params;
|
|
17106
|
+
const { config, tool, logger } = params;
|
|
17049
17107
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
17050
17108
|
return 0;
|
|
17051
17109
|
}
|
|
@@ -17057,7 +17115,8 @@ async function importRulesCore(params) {
|
|
|
17057
17115
|
const rulesProcessor = new RulesProcessor({
|
|
17058
17116
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17059
17117
|
toolTarget: tool,
|
|
17060
|
-
global
|
|
17118
|
+
global,
|
|
17119
|
+
logger
|
|
17061
17120
|
});
|
|
17062
17121
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
17063
17122
|
if (toolFiles.length === 0) {
|
|
@@ -17072,7 +17131,7 @@ async function importRulesCore(params) {
|
|
|
17072
17131
|
return writtenCount;
|
|
17073
17132
|
}
|
|
17074
17133
|
async function importIgnoreCore(params) {
|
|
17075
|
-
const { config, tool } = params;
|
|
17134
|
+
const { config, tool, logger } = params;
|
|
17076
17135
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
17077
17136
|
return 0;
|
|
17078
17137
|
}
|
|
@@ -17085,7 +17144,8 @@ async function importIgnoreCore(params) {
|
|
|
17085
17144
|
}
|
|
17086
17145
|
const ignoreProcessor = new IgnoreProcessor({
|
|
17087
17146
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17088
|
-
toolTarget: tool
|
|
17147
|
+
toolTarget: tool,
|
|
17148
|
+
logger
|
|
17089
17149
|
});
|
|
17090
17150
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17091
17151
|
if (toolFiles.length === 0) {
|
|
@@ -17103,7 +17163,7 @@ async function importIgnoreCore(params) {
|
|
|
17103
17163
|
return writtenCount;
|
|
17104
17164
|
}
|
|
17105
17165
|
async function importMcpCore(params) {
|
|
17106
|
-
const { config, tool } = params;
|
|
17166
|
+
const { config, tool, logger } = params;
|
|
17107
17167
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17108
17168
|
return 0;
|
|
17109
17169
|
}
|
|
@@ -17115,7 +17175,8 @@ async function importMcpCore(params) {
|
|
|
17115
17175
|
const mcpProcessor = new McpProcessor({
|
|
17116
17176
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17117
17177
|
toolTarget: tool,
|
|
17118
|
-
global
|
|
17178
|
+
global,
|
|
17179
|
+
logger
|
|
17119
17180
|
});
|
|
17120
17181
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17121
17182
|
if (toolFiles.length === 0) {
|
|
@@ -17130,7 +17191,7 @@ async function importMcpCore(params) {
|
|
|
17130
17191
|
return writtenCount;
|
|
17131
17192
|
}
|
|
17132
17193
|
async function importCommandsCore(params) {
|
|
17133
|
-
const { config, tool } = params;
|
|
17194
|
+
const { config, tool, logger } = params;
|
|
17134
17195
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17135
17196
|
return 0;
|
|
17136
17197
|
}
|
|
@@ -17142,7 +17203,8 @@ async function importCommandsCore(params) {
|
|
|
17142
17203
|
const commandsProcessor = new CommandsProcessor({
|
|
17143
17204
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17144
17205
|
toolTarget: tool,
|
|
17145
|
-
global
|
|
17206
|
+
global,
|
|
17207
|
+
logger
|
|
17146
17208
|
});
|
|
17147
17209
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17148
17210
|
if (toolFiles.length === 0) {
|
|
@@ -17157,7 +17219,7 @@ async function importCommandsCore(params) {
|
|
|
17157
17219
|
return writtenCount;
|
|
17158
17220
|
}
|
|
17159
17221
|
async function importSubagentsCore(params) {
|
|
17160
|
-
const { config, tool } = params;
|
|
17222
|
+
const { config, tool, logger } = params;
|
|
17161
17223
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17162
17224
|
return 0;
|
|
17163
17225
|
}
|
|
@@ -17169,7 +17231,8 @@ async function importSubagentsCore(params) {
|
|
|
17169
17231
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17170
17232
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17171
17233
|
toolTarget: tool,
|
|
17172
|
-
global: config.getGlobal()
|
|
17234
|
+
global: config.getGlobal(),
|
|
17235
|
+
logger
|
|
17173
17236
|
});
|
|
17174
17237
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17175
17238
|
if (toolFiles.length === 0) {
|
|
@@ -17184,7 +17247,7 @@ async function importSubagentsCore(params) {
|
|
|
17184
17247
|
return writtenCount;
|
|
17185
17248
|
}
|
|
17186
17249
|
async function importSkillsCore(params) {
|
|
17187
|
-
const { config, tool } = params;
|
|
17250
|
+
const { config, tool, logger } = params;
|
|
17188
17251
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17189
17252
|
return 0;
|
|
17190
17253
|
}
|
|
@@ -17196,7 +17259,8 @@ async function importSkillsCore(params) {
|
|
|
17196
17259
|
const skillsProcessor = new SkillsProcessor({
|
|
17197
17260
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17198
17261
|
toolTarget: tool,
|
|
17199
|
-
global
|
|
17262
|
+
global,
|
|
17263
|
+
logger
|
|
17200
17264
|
});
|
|
17201
17265
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17202
17266
|
if (toolDirs.length === 0) {
|
|
@@ -17211,7 +17275,7 @@ async function importSkillsCore(params) {
|
|
|
17211
17275
|
return writtenCount;
|
|
17212
17276
|
}
|
|
17213
17277
|
async function importHooksCore(params) {
|
|
17214
|
-
const { config, tool } = params;
|
|
17278
|
+
const { config, tool, logger } = params;
|
|
17215
17279
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17216
17280
|
return 0;
|
|
17217
17281
|
}
|
|
@@ -17228,7 +17292,8 @@ async function importHooksCore(params) {
|
|
|
17228
17292
|
const hooksProcessor = new HooksProcessor({
|
|
17229
17293
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17230
17294
|
toolTarget: tool,
|
|
17231
|
-
global
|
|
17295
|
+
global,
|
|
17296
|
+
logger
|
|
17232
17297
|
});
|
|
17233
17298
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17234
17299
|
if (toolFiles.length === 0) {
|
|
@@ -17243,6 +17308,176 @@ async function importHooksCore(params) {
|
|
|
17243
17308
|
return writtenCount;
|
|
17244
17309
|
}
|
|
17245
17310
|
|
|
17311
|
+
// src/types/json-output.ts
|
|
17312
|
+
var ErrorCodes = {
|
|
17313
|
+
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
17314
|
+
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
17315
|
+
INVALID_TARGET: "INVALID_TARGET",
|
|
17316
|
+
FETCH_FAILED: "FETCH_FAILED",
|
|
17317
|
+
WRITE_FAILED: "WRITE_FAILED",
|
|
17318
|
+
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
17319
|
+
GENERATION_FAILED: "GENERATION_FAILED",
|
|
17320
|
+
IMPORT_FAILED: "IMPORT_FAILED",
|
|
17321
|
+
INSTALL_FAILED: "INSTALL_FAILED",
|
|
17322
|
+
UPDATE_FAILED: "UPDATE_FAILED",
|
|
17323
|
+
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
17324
|
+
INIT_FAILED: "INIT_FAILED",
|
|
17325
|
+
MCP_FAILED: "MCP_FAILED",
|
|
17326
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
17327
|
+
};
|
|
17328
|
+
var CLIError = class extends Error {
|
|
17329
|
+
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
17330
|
+
super(message);
|
|
17331
|
+
this.code = code;
|
|
17332
|
+
this.exitCode = exitCode;
|
|
17333
|
+
this.name = "CLIError";
|
|
17334
|
+
}
|
|
17335
|
+
};
|
|
17336
|
+
|
|
17337
|
+
// src/utils/logger.ts
|
|
17338
|
+
var BaseLogger = class {
|
|
17339
|
+
_verbose = false;
|
|
17340
|
+
_silent = false;
|
|
17341
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
17342
|
+
this._silent = silent;
|
|
17343
|
+
this._verbose = verbose && !silent;
|
|
17344
|
+
}
|
|
17345
|
+
get verbose() {
|
|
17346
|
+
return this._verbose;
|
|
17347
|
+
}
|
|
17348
|
+
get silent() {
|
|
17349
|
+
return this._silent;
|
|
17350
|
+
}
|
|
17351
|
+
configure({ verbose, silent }) {
|
|
17352
|
+
if (verbose && silent) {
|
|
17353
|
+
this._silent = false;
|
|
17354
|
+
if (!isEnvTest()) {
|
|
17355
|
+
this.onConflictingFlags();
|
|
17356
|
+
}
|
|
17357
|
+
}
|
|
17358
|
+
this._silent = silent;
|
|
17359
|
+
this._verbose = verbose && !silent;
|
|
17360
|
+
}
|
|
17361
|
+
onConflictingFlags() {
|
|
17362
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
17363
|
+
}
|
|
17364
|
+
};
|
|
17365
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
17366
|
+
isSuppressed() {
|
|
17367
|
+
return isEnvTest() || this._silent;
|
|
17368
|
+
}
|
|
17369
|
+
get jsonMode() {
|
|
17370
|
+
return false;
|
|
17371
|
+
}
|
|
17372
|
+
captureData(_key, _value) {
|
|
17373
|
+
}
|
|
17374
|
+
getJsonData() {
|
|
17375
|
+
return {};
|
|
17376
|
+
}
|
|
17377
|
+
outputJson(_success, _error) {
|
|
17378
|
+
}
|
|
17379
|
+
info(message, ...args) {
|
|
17380
|
+
if (this.isSuppressed()) return;
|
|
17381
|
+
console.log(message, ...args);
|
|
17382
|
+
}
|
|
17383
|
+
success(message, ...args) {
|
|
17384
|
+
if (this.isSuppressed()) return;
|
|
17385
|
+
console.log(message, ...args);
|
|
17386
|
+
}
|
|
17387
|
+
warn(message, ...args) {
|
|
17388
|
+
if (this.isSuppressed()) return;
|
|
17389
|
+
console.warn(message, ...args);
|
|
17390
|
+
}
|
|
17391
|
+
// Errors are always emitted, even in silent mode
|
|
17392
|
+
error(message, _code, ...args) {
|
|
17393
|
+
if (isEnvTest()) return;
|
|
17394
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17395
|
+
console.error(errorMessage, ...args);
|
|
17396
|
+
}
|
|
17397
|
+
debug(message, ...args) {
|
|
17398
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
17399
|
+
console.log(message, ...args);
|
|
17400
|
+
}
|
|
17401
|
+
};
|
|
17402
|
+
var JsonLogger = class extends BaseLogger {
|
|
17403
|
+
_jsonOutputDone = false;
|
|
17404
|
+
_jsonData = {};
|
|
17405
|
+
_commandName;
|
|
17406
|
+
_version;
|
|
17407
|
+
constructor({
|
|
17408
|
+
command,
|
|
17409
|
+
version,
|
|
17410
|
+
verbose = false,
|
|
17411
|
+
silent = false
|
|
17412
|
+
}) {
|
|
17413
|
+
super({ verbose, silent });
|
|
17414
|
+
this._commandName = command;
|
|
17415
|
+
this._version = version;
|
|
17416
|
+
}
|
|
17417
|
+
// Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
|
|
17418
|
+
onConflictingFlags() {
|
|
17419
|
+
}
|
|
17420
|
+
get jsonMode() {
|
|
17421
|
+
return true;
|
|
17422
|
+
}
|
|
17423
|
+
captureData(key, value) {
|
|
17424
|
+
this._jsonData[key] = value;
|
|
17425
|
+
}
|
|
17426
|
+
getJsonData() {
|
|
17427
|
+
return { ...this._jsonData };
|
|
17428
|
+
}
|
|
17429
|
+
outputJson(success, error) {
|
|
17430
|
+
if (this._jsonOutputDone) return;
|
|
17431
|
+
this._jsonOutputDone = true;
|
|
17432
|
+
const output = {
|
|
17433
|
+
success,
|
|
17434
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17435
|
+
command: this._commandName,
|
|
17436
|
+
version: this._version
|
|
17437
|
+
};
|
|
17438
|
+
if (success) {
|
|
17439
|
+
output.data = this._jsonData;
|
|
17440
|
+
} else if (error) {
|
|
17441
|
+
output.error = {
|
|
17442
|
+
code: error.code,
|
|
17443
|
+
message: error.message
|
|
17444
|
+
};
|
|
17445
|
+
if (error.details) {
|
|
17446
|
+
output.error.details = error.details;
|
|
17447
|
+
}
|
|
17448
|
+
if (error.stack) {
|
|
17449
|
+
output.error.stack = error.stack;
|
|
17450
|
+
}
|
|
17451
|
+
}
|
|
17452
|
+
const jsonStr = JSON.stringify(output, null, 2);
|
|
17453
|
+
if (success) {
|
|
17454
|
+
console.log(jsonStr);
|
|
17455
|
+
} else {
|
|
17456
|
+
console.error(jsonStr);
|
|
17457
|
+
}
|
|
17458
|
+
}
|
|
17459
|
+
info(_message, ..._args) {
|
|
17460
|
+
}
|
|
17461
|
+
success(_message, ..._args) {
|
|
17462
|
+
}
|
|
17463
|
+
warn(_message, ..._args) {
|
|
17464
|
+
}
|
|
17465
|
+
error(message, code, ..._args) {
|
|
17466
|
+
if (isEnvTest()) return;
|
|
17467
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17468
|
+
const errorInfo = {
|
|
17469
|
+
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
17470
|
+
message: errorMessage
|
|
17471
|
+
};
|
|
17472
|
+
if (this._verbose && message instanceof Error && message.stack) {
|
|
17473
|
+
errorInfo.stack = message.stack;
|
|
17474
|
+
}
|
|
17475
|
+
this.outputJson(false, errorInfo);
|
|
17476
|
+
}
|
|
17477
|
+
debug(_message, ..._args) {
|
|
17478
|
+
}
|
|
17479
|
+
};
|
|
17480
|
+
|
|
17246
17481
|
export {
|
|
17247
17482
|
RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
17248
17483
|
RULESYNC_RELATIVE_DIR_PATH,
|
|
@@ -17260,16 +17495,12 @@ export {
|
|
|
17260
17495
|
RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH,
|
|
17261
17496
|
RULESYNC_MCP_FILE_NAME,
|
|
17262
17497
|
RULESYNC_HOOKS_FILE_NAME,
|
|
17498
|
+
RULESYNC_PERMISSIONS_FILE_NAME,
|
|
17263
17499
|
RULESYNC_CONFIG_SCHEMA_URL,
|
|
17264
17500
|
RULESYNC_MCP_SCHEMA_URL,
|
|
17265
17501
|
MAX_FILE_SIZE,
|
|
17266
17502
|
FETCH_CONCURRENCY_LIMIT,
|
|
17267
17503
|
formatError,
|
|
17268
|
-
ErrorCodes,
|
|
17269
|
-
CLIError,
|
|
17270
|
-
ConsoleLogger,
|
|
17271
|
-
JsonLogger,
|
|
17272
|
-
logger,
|
|
17273
17504
|
ensureDir,
|
|
17274
17505
|
checkPathTraversal,
|
|
17275
17506
|
directoryExists,
|
|
@@ -17313,5 +17544,9 @@ export {
|
|
|
17313
17544
|
RulesProcessor,
|
|
17314
17545
|
checkRulesyncDirExists,
|
|
17315
17546
|
generate,
|
|
17316
|
-
importFromTool
|
|
17547
|
+
importFromTool,
|
|
17548
|
+
ErrorCodes,
|
|
17549
|
+
CLIError,
|
|
17550
|
+
ConsoleLogger,
|
|
17551
|
+
JsonLogger
|
|
17317
17552
|
};
|