rulesync 43.17.0 → 43.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.cjs +5 -5
- package/dist/cli/index.js +5 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/{import-C_TEclz6.js → import-1IIVv7h3.js} +257 -25
- package/dist/{import-C_TEclz6.js.map → import-1IIVv7h3.js.map} +1 -1
- package/dist/{import-DzRS2z_a.cjs → import-T-69RQxs.cjs} +277 -45
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -381,40 +381,40 @@ function formatError(error) {
|
|
|
381
381
|
return boundErrorMessage(String(error));
|
|
382
382
|
}
|
|
383
383
|
// src/constants/rulesync-paths.ts
|
|
384
|
-
const { join: join$
|
|
384
|
+
const { join: join$387 } = node_path.posix;
|
|
385
385
|
const RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
386
386
|
const RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH = "rulesync.local.jsonc";
|
|
387
387
|
const RULESYNC_USER_CONFIG_DIR_NAME = "rulesync";
|
|
388
388
|
const RULESYNC_XDG_CONFIG_HOME_DEFAULT_DIR_NAME = ".config";
|
|
389
389
|
const RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
390
390
|
const RULES_FEATURE_SUBDIR = "rules";
|
|
391
|
-
const CURATED_RULES_FEATURE_SUBDIR = join$
|
|
391
|
+
const CURATED_RULES_FEATURE_SUBDIR = join$387(RULES_FEATURE_SUBDIR, ".curated");
|
|
392
392
|
const COMMANDS_FEATURE_SUBDIR = "commands";
|
|
393
|
-
const CURATED_COMMANDS_FEATURE_SUBDIR = join$
|
|
393
|
+
const CURATED_COMMANDS_FEATURE_SUBDIR = join$387(COMMANDS_FEATURE_SUBDIR, ".curated");
|
|
394
394
|
const SUBAGENTS_FEATURE_SUBDIR = "subagents";
|
|
395
|
-
const CURATED_SUBAGENTS_FEATURE_SUBDIR = join$
|
|
395
|
+
const CURATED_SUBAGENTS_FEATURE_SUBDIR = join$387(SUBAGENTS_FEATURE_SUBDIR, ".curated");
|
|
396
396
|
const CHECKS_FEATURE_SUBDIR = "checks";
|
|
397
397
|
const SKILLS_FEATURE_SUBDIR = "skills";
|
|
398
|
-
const CURATED_SKILLS_FEATURE_SUBDIR = join$
|
|
399
|
-
const RULESYNC_RULES_RELATIVE_DIR_PATH = join$
|
|
400
|
-
const RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH = join$
|
|
401
|
-
const RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join$
|
|
402
|
-
const RULESYNC_CURATED_COMMANDS_RELATIVE_DIR_PATH = join$
|
|
403
|
-
const RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join$
|
|
404
|
-
const RULESYNC_CURATED_SUBAGENTS_RELATIVE_DIR_PATH = join$
|
|
405
|
-
const RULESYNC_CHECKS_RELATIVE_DIR_PATH = join$
|
|
406
|
-
const RULESYNC_MCP_RELATIVE_FILE_PATH = join$
|
|
407
|
-
const RULESYNC_HOOKS_RELATIVE_FILE_PATH = join$
|
|
408
|
-
const RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH = join$
|
|
409
|
-
join$
|
|
410
|
-
const RULESYNC_HOOKS_LEGACY_RELATIVE_FILE_PATH = join$
|
|
411
|
-
const RULESYNC_PERMISSIONS_LEGACY_RELATIVE_FILE_PATH = join$
|
|
398
|
+
const CURATED_SKILLS_FEATURE_SUBDIR = join$387(SKILLS_FEATURE_SUBDIR, ".curated");
|
|
399
|
+
const RULESYNC_RULES_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, RULES_FEATURE_SUBDIR);
|
|
400
|
+
const RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, CURATED_RULES_FEATURE_SUBDIR);
|
|
401
|
+
const RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, COMMANDS_FEATURE_SUBDIR);
|
|
402
|
+
const RULESYNC_CURATED_COMMANDS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, CURATED_COMMANDS_FEATURE_SUBDIR);
|
|
403
|
+
const RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, SUBAGENTS_FEATURE_SUBDIR);
|
|
404
|
+
const RULESYNC_CURATED_SUBAGENTS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, CURATED_SUBAGENTS_FEATURE_SUBDIR);
|
|
405
|
+
const RULESYNC_CHECKS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, CHECKS_FEATURE_SUBDIR);
|
|
406
|
+
const RULESYNC_MCP_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, "mcp.jsonc");
|
|
407
|
+
const RULESYNC_HOOKS_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, "hooks.jsonc");
|
|
408
|
+
const RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, "permissions.jsonc");
|
|
409
|
+
join$387(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
410
|
+
const RULESYNC_HOOKS_LEGACY_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, "hooks.json");
|
|
411
|
+
const RULESYNC_PERMISSIONS_LEGACY_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, "permissions.json");
|
|
412
412
|
const RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
413
|
-
const RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join$
|
|
413
|
+
const RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
414
414
|
const RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
415
415
|
const RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
416
|
-
const RULESYNC_SKILLS_RELATIVE_DIR_PATH = join$
|
|
417
|
-
const RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH = join$
|
|
416
|
+
const RULESYNC_SKILLS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, SKILLS_FEATURE_SUBDIR);
|
|
417
|
+
const RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH = join$387(RULESYNC_RELATIVE_DIR_PATH, CURATED_SKILLS_FEATURE_SUBDIR);
|
|
418
418
|
const RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH = "rulesync.lock";
|
|
419
419
|
const RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH = "rulesync-npm.lock.json";
|
|
420
420
|
const RULESYNC_MCP_FILE_NAME = "mcp.jsonc";
|
|
@@ -3293,6 +3293,7 @@ const ConfigParamsSchema = zod_mini.z.object({
|
|
|
3293
3293
|
preserveUnownedHooks: (0, zod_mini.optional)(zod_mini.z.boolean()),
|
|
3294
3294
|
preserveUnmanagedRuleContent: (0, zod_mini.optional)(zod_mini.z.boolean()),
|
|
3295
3295
|
preserveUnownedSkills: (0, zod_mini.optional)(zod_mini.z.boolean()),
|
|
3296
|
+
preserveUnownedMcpServers: (0, zod_mini.optional)(zod_mini.z.boolean()),
|
|
3296
3297
|
deriveSubprojectPathFromGlobs: (0, zod_mini.optional)(zod_mini.z.boolean()),
|
|
3297
3298
|
flattenedCommandNaming: (0, zod_mini.optional)(FlattenedCommandNamingSchema),
|
|
3298
3299
|
/**
|
|
@@ -3477,6 +3478,7 @@ var Config = class Config {
|
|
|
3477
3478
|
preserveUnownedHooks;
|
|
3478
3479
|
preserveUnmanagedRuleContent;
|
|
3479
3480
|
preserveUnownedSkills;
|
|
3481
|
+
preserveUnownedMcpServers;
|
|
3480
3482
|
deriveSubprojectPathFromGlobs;
|
|
3481
3483
|
flattenedCommandNaming;
|
|
3482
3484
|
language;
|
|
@@ -3505,7 +3507,7 @@ var Config = class Config {
|
|
|
3505
3507
|
inputRoots;
|
|
3506
3508
|
configFilePath;
|
|
3507
3509
|
sources;
|
|
3508
|
-
constructor({ outputRoots, targets, features, verbose, delete: isDelete, global, silent, simulateCommands, simulateSubagents, simulateSkills, preserveUnownedHooks, preserveUnmanagedRuleContent, preserveUnownedSkills, deriveSubprojectPathFromGlobs, flattenedCommandNaming, language, gitignoreTargetsOnly, gitignoreDestination, dryRun, check, retireTargets, retireFeatures, inputRoot, inputRoots, configFilePath, sources, configFileTargets, configFileSelection }) {
|
|
3510
|
+
constructor({ outputRoots, targets, features, verbose, delete: isDelete, global, silent, simulateCommands, simulateSubagents, simulateSkills, preserveUnownedHooks, preserveUnmanagedRuleContent, preserveUnownedSkills, preserveUnownedMcpServers, deriveSubprojectPathFromGlobs, flattenedCommandNaming, language, gitignoreTargetsOnly, gitignoreDestination, dryRun, check, retireTargets, retireFeatures, inputRoot, inputRoots, configFilePath, sources, configFileTargets, configFileSelection }) {
|
|
3509
3511
|
assertTargetsFeaturesExclusive({
|
|
3510
3512
|
targets,
|
|
3511
3513
|
features
|
|
@@ -3541,6 +3543,7 @@ var Config = class Config {
|
|
|
3541
3543
|
this.preserveUnownedHooks = preserveUnownedHooks ?? false;
|
|
3542
3544
|
this.preserveUnmanagedRuleContent = preserveUnmanagedRuleContent === true;
|
|
3543
3545
|
this.preserveUnownedSkills = preserveUnownedSkills === true;
|
|
3546
|
+
this.preserveUnownedMcpServers = preserveUnownedMcpServers === true;
|
|
3544
3547
|
this.deriveSubprojectPathFromGlobs = deriveSubprojectPathFromGlobs ?? false;
|
|
3545
3548
|
this.flattenedCommandNaming = flattenedCommandNaming ?? "basename";
|
|
3546
3549
|
this.language = language;
|
|
@@ -3807,6 +3810,9 @@ var Config = class Config {
|
|
|
3807
3810
|
getPreserveUnownedSkills() {
|
|
3808
3811
|
return this.preserveUnownedSkills;
|
|
3809
3812
|
}
|
|
3813
|
+
getPreserveUnownedMcpServers() {
|
|
3814
|
+
return this.preserveUnownedMcpServers;
|
|
3815
|
+
}
|
|
3810
3816
|
getFlattenedCommandNaming() {
|
|
3811
3817
|
return this.flattenedCommandNaming;
|
|
3812
3818
|
}
|
|
@@ -3906,6 +3912,7 @@ const getDefaults = () => ({
|
|
|
3906
3912
|
preserveUnownedHooks: false,
|
|
3907
3913
|
preserveUnmanagedRuleContent: false,
|
|
3908
3914
|
preserveUnownedSkills: false,
|
|
3915
|
+
preserveUnownedMcpServers: false,
|
|
3909
3916
|
deriveSubprojectPathFromGlobs: false,
|
|
3910
3917
|
flattenedCommandNaming: "basename",
|
|
3911
3918
|
gitignoreTargetsOnly: true,
|
|
@@ -4254,6 +4261,11 @@ var ConfigResolver = class {
|
|
|
4254
4261
|
file: configByFile.preserveUnownedSkills,
|
|
4255
4262
|
fallback: getDefaults().preserveUnownedSkills
|
|
4256
4263
|
}),
|
|
4264
|
+
preserveUnownedMcpServers: pick({
|
|
4265
|
+
cli: void 0,
|
|
4266
|
+
file: configByFile.preserveUnownedMcpServers,
|
|
4267
|
+
fallback: getDefaults().preserveUnownedMcpServers
|
|
4268
|
+
}),
|
|
4257
4269
|
deriveSubprojectPathFromGlobs: pick({
|
|
4258
4270
|
cli: deriveSubprojectPathFromGlobs,
|
|
4259
4271
|
file: configByFile.deriveSubprojectPathFromGlobs,
|
|
@@ -42811,6 +42823,15 @@ const findFence = (content) => {
|
|
|
42811
42823
|
*
|
|
42812
42824
|
* When the generated content starts with frontmatter, the existing file's
|
|
42813
42825
|
* leading frontmatter is rulesync's too and is replaced rather than kept.
|
|
42826
|
+
*
|
|
42827
|
+
* When the generated content has no frontmatter, an existing leading
|
|
42828
|
+
* frontmatter block is kept as part of the content before the fence, even if
|
|
42829
|
+
* rulesync wrote it on an earlier run (a target or rule that no longer emits
|
|
42830
|
+
* frontmatter). Nothing in the file tells such a block apart from one a person
|
|
42831
|
+
* wrote: a hand-written block also sits right above the start marker, since
|
|
42832
|
+
* the fence opens the file rulesync writes. Keeping it never loses hand-written
|
|
42833
|
+
* content, and the result is stable across runs; a stale block is removed by
|
|
42834
|
+
* hand once.
|
|
42814
42835
|
*/
|
|
42815
42836
|
const spliceRuleManagedBlock = ({ existingContent, generatedContent }) => {
|
|
42816
42837
|
const generated = splitLeadingFrontmatter(generatedContent);
|
|
@@ -54739,6 +54760,11 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
54739
54760
|
featureOptions;
|
|
54740
54761
|
deleteOrphans;
|
|
54741
54762
|
preserveUnmanagedContent;
|
|
54763
|
+
/**
|
|
54764
|
+
* Whether the last `loadRulesyncFiles` call's `include` option left out a
|
|
54765
|
+
* rule that targets this tool.
|
|
54766
|
+
*/
|
|
54767
|
+
includeNarrowedSelection = false;
|
|
54742
54768
|
constructor({ outputRoot = process.cwd(), inputRoots, toolTarget, simulateCommands = false, simulateSubagents = false, simulateSkills = false, language, deriveSubprojectPathFromGlobs = false, global = false, getFactory = defaultGetFactory$3, skills, featureOptions, delete: deleteOrphans = false, preserveUnmanagedContent = false, dryRun = false, logger }) {
|
|
54743
54769
|
super({
|
|
54744
54770
|
outputRoot,
|
|
@@ -55394,6 +55420,8 @@ As this project's AI coding tool, you must follow the additional conventions bel
|
|
|
55394
55420
|
rules: mergedRules,
|
|
55395
55421
|
factory
|
|
55396
55422
|
});
|
|
55423
|
+
const isTargeted = (rule) => factory.class.isTargetedByRulesyncRule(rule);
|
|
55424
|
+
this.includeNarrowedSelection = rulesyncRules.filter(isTargeted).length < mergedRules.filter(isTargeted).length;
|
|
55397
55425
|
const targetedRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root).filter((rule) => factory.class.isTargetedByRulesyncRule(rule));
|
|
55398
55426
|
const rootRuleLeftOutByInclude = mergedRules.some((rule) => rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule) && !rulesyncRules.includes(rule));
|
|
55399
55427
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0 && !rootRuleLeftOutByInclude) this.logger.warn(`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}.`);
|
|
@@ -55414,6 +55442,14 @@ As this project's AI coding tool, you must follow the additional conventions bel
|
|
|
55414
55442
|
return [...targetedRootRules, ...nonRootRules];
|
|
55415
55443
|
}
|
|
55416
55444
|
/**
|
|
55445
|
+
* Whether the target's `include` rules option left out at least one rule
|
|
55446
|
+
* that targets this tool in the last `loadRulesyncFiles` call. `["*"]`, or a
|
|
55447
|
+
* list naming every rule the tool would receive, narrows nothing.
|
|
55448
|
+
*/
|
|
55449
|
+
didIncludeNarrowSelection() {
|
|
55450
|
+
return this.includeNarrowedSelection;
|
|
55451
|
+
}
|
|
55452
|
+
/**
|
|
55417
55453
|
* Narrow the rules to the ones the target's `include` rules option names.
|
|
55418
55454
|
* The option is a pure narrowing filter: a named rule still has to target
|
|
55419
55455
|
* this tool through its `targets` frontmatter, which is checked afterwards
|
|
@@ -66068,7 +66104,9 @@ const BLOCKING_HOOKS = new Set(Object.keys(NAMED_HOOK_MATCHER_SUBJECTS).filter((
|
|
|
66068
66104
|
* Shell echoed them; a `preToolUse` command's are read, 1 MiB each kept (more
|
|
66069
66105
|
* stdout denies; on the Bun Shell fallback the whole output is buffered before
|
|
66070
66106
|
* that check), and a `sessionStart` command's stdout is read the same way while
|
|
66071
|
-
* its stderr goes to the host's (after the command, on Bun Shell)
|
|
66107
|
+
* its stderr goes to the host's (after the command, on Bun Shell); an OpenCode
|
|
66108
|
+
* 2.x `postToolUse` command is the other way round, its stderr read and its
|
|
66109
|
+
* stdout going to the host's. Output
|
|
66072
66110
|
* pipes a background process keeps open are read for 1 s after the command
|
|
66073
66111
|
* exits; what arrived by then is kept, and the reads are then cancelled, as
|
|
66074
66112
|
* they are at a timeout. The OpenCode 1.x-style `event` hooks (`inProcess`)
|
|
@@ -66217,28 +66255,37 @@ function buildRunHelperLinesFor(cwdExpression) {
|
|
|
66217
66255
|
" if (inProcess || !(await __rulesyncCanExec)) {",
|
|
66218
66256
|
` const run = Bun.$\`echo \${input} | \${{ raw: command }}\`.cwd(${cwdExpression}).nothrow();`,
|
|
66219
66257
|
" // A sessionStart command's stderr reaches the host when it ends, even after its timeout.",
|
|
66220
|
-
"
|
|
66258
|
+
" // A postToolUse command's (`echo: \"stdout\"`) stdout and stderr reach it when it ends, too.",
|
|
66259
|
+
" const finished = echo === true ? run : run.quiet().then((done) => {",
|
|
66260
|
+
" if (echo === \"stdout\") process.stdout.write(done.stdout);",
|
|
66261
|
+
" if (echo) process.stderr.write(done.stderr);",
|
|
66262
|
+
" return done;",
|
|
66263
|
+
" });",
|
|
66221
66264
|
" const result = await Promise.race([finished, timeout()]).finally(() => clearTimeout(timer));",
|
|
66222
66265
|
" if (!result || echo === true) return result && { exitCode: result.exitCode };",
|
|
66223
66266
|
" const { exitCode, stdout, stderr } = result;",
|
|
66224
66267
|
" return { exitCode, stdout: stdout.toString(), stderr: stderr.toString(), overflow: stdout.length > 1048576 };",
|
|
66225
66268
|
" }",
|
|
66226
|
-
" // An ordinary command writes to the host's stdout and stderr; a preToolUse one is read,
|
|
66227
|
-
" // a sessionStart one (`echo: \"stderr\"`) has its stdout read
|
|
66228
|
-
|
|
66229
|
-
|
|
66230
|
-
" const
|
|
66269
|
+
" // An ordinary command writes to the host's stdout and stderr; a preToolUse one is read,",
|
|
66270
|
+
" // a sessionStart one (`echo: \"stderr\"`) has its stdout read, and a postToolUse one",
|
|
66271
|
+
" // (`echo: \"stdout\"`) its stderr.",
|
|
66272
|
+
` const proc = ${spawn("\"export BUN_BE_BUN=\\n\" + command", "new TextEncoder().encode(input + \"\\n\")", "echo === true || echo === \"stdout\" ? \"inherit\" : \"pipe\"", "echo === true || echo === \"stderr\" ? \"inherit\" : \"pipe\"")};`,
|
|
66273
|
+
" const stdout = echo === true || echo === \"stdout\" ? undefined : __rulesyncRead(proc.stdout);",
|
|
66274
|
+
" const stderr = echo === true || echo === \"stderr\" ? undefined : __rulesyncRead(proc.stderr);",
|
|
66231
66275
|
" const exitCode = await Promise.race([proc.exited, timeout()]).finally(() => clearTimeout(timer));",
|
|
66232
66276
|
" if (exitCode === null) {",
|
|
66233
66277
|
" stdout?.stop(), stderr?.stop();",
|
|
66278
|
+
" // A postToolUse command's stderr is read, so what it wrote before the timeout reaches the host here.",
|
|
66279
|
+
" if (echo === \"stdout\") process.stderr.write(stderr.text());",
|
|
66234
66280
|
" if (process.platform === \"win32\") __rulesyncKillWindowsTree(proc);",
|
|
66235
66281
|
" else __rulesyncKillTree(proc);",
|
|
66236
66282
|
" return null;",
|
|
66237
66283
|
" }",
|
|
66238
66284
|
" if (echo === true) return { exitCode };",
|
|
66239
|
-
" await Promise.race([Promise.all([stdout
|
|
66240
|
-
" stdout
|
|
66241
|
-
"
|
|
66285
|
+
" await Promise.race([Promise.all([stdout?.done, stderr?.done]), Bun.sleep(1000)]);",
|
|
66286
|
+
" stdout?.stop(), stderr?.stop();",
|
|
66287
|
+
" if (echo === \"stdout\") process.stderr.write(stderr.text());",
|
|
66288
|
+
" return { exitCode, stdout: stdout?.text() ?? \"\", stderr: stderr?.text() ?? \"\", overflow: stdout?.overflow() ?? false };",
|
|
66242
66289
|
"};",
|
|
66243
66290
|
"const __rulesyncRunHook = async ({ label, command, input, blocking, seconds, inProcess = false, context = false }) => {",
|
|
66244
66291
|
" let result;",
|
|
@@ -67767,6 +67814,92 @@ function wrapInConditions(handler, statement, indent) {
|
|
|
67767
67814
|
`${indent}}`
|
|
67768
67815
|
];
|
|
67769
67816
|
}
|
|
67817
|
+
/**
|
|
67818
|
+
* Helpers the generated plugin defines when a `postToolUse` handler is present,
|
|
67819
|
+
* giving it Claude Code's `PostToolUse` exit-code contract: the tool already
|
|
67820
|
+
* ran, so nothing is blocked, but a command that exits with code 2 has its
|
|
67821
|
+
* stderr (sanitized, see `hook-block-reason.ts`) shown to the model with the
|
|
67822
|
+
* tool result. Any other non-zero exit, a timeout or a command that cannot be
|
|
67823
|
+
* run is only logged, as before. The command's stdout still streams to the
|
|
67824
|
+
* host's; its stderr is read (1 MiB kept) and written to the host's by
|
|
67825
|
+
* `__rulesyncRunCommand` when the command ends or times out, so it stays
|
|
67826
|
+
* visible there too.
|
|
67827
|
+
*
|
|
67828
|
+
* OpenCode 2.x lets an `execute.after` hook replace a completed call's
|
|
67829
|
+
* `event.result` (`{ output?, content?, metadata? }`), which the host
|
|
67830
|
+
* normalizes again before the model sees it; its own tool-repair plugin adds a
|
|
67831
|
+
* note the same way. The text goes into both fields, since the model reads the
|
|
67832
|
+
* result from either: `output` when it is a string, and `content` whether it
|
|
67833
|
+
* is a string or an array of parts. A missing or empty `content` stands for
|
|
67834
|
+
* the output upstream, so that output is kept ahead of the text. A failure
|
|
67835
|
+
* here is logged: a hook that throws would fail the call.
|
|
67836
|
+
*
|
|
67837
|
+
* `postToolUseFailure` stays observe-only. Claude Code shows its exit-2 stderr
|
|
67838
|
+
* to the model too, but a failed call's `event.error` is the host's typed tool
|
|
67839
|
+
* error (`ToolFailure` / `Tool.Error`), which the host yields after the hook;
|
|
67840
|
+
* a plugin cannot build one, and anything else in its place would turn the
|
|
67841
|
+
* call's failure into a defect.
|
|
67842
|
+
*
|
|
67843
|
+
* @see https://github.com/anomalyco/opencode/blob/v2.4.3/packages/core/src/tool.ts
|
|
67844
|
+
* @see https://github.com/anomalyco/opencode/blob/v2.4.3/packages/plugin/src/promise/adapter.ts
|
|
67845
|
+
* @see https://code.claude.com/docs/en/hooks
|
|
67846
|
+
*/
|
|
67847
|
+
const POST_TOOL_USE_HELPER_LINES = [
|
|
67848
|
+
"const __rulesyncRunPostToolUseHook = async ({ command, input, seconds }) => {",
|
|
67849
|
+
" let result;",
|
|
67850
|
+
" try {",
|
|
67851
|
+
" result = await __rulesyncRunCommand({ command, input, seconds, echo: \"stdout\" });",
|
|
67852
|
+
" } catch (error) {",
|
|
67853
|
+
" console.error(\"[rulesync-hooks] postToolUse hook failed:\", error);",
|
|
67854
|
+
" return undefined;",
|
|
67855
|
+
" }",
|
|
67856
|
+
" if (result === null) {",
|
|
67857
|
+
" console.error(\"[rulesync-hooks] postToolUse hook timed out after \" + seconds + \"s\");",
|
|
67858
|
+
" return undefined;",
|
|
67859
|
+
" }",
|
|
67860
|
+
" const stderr = String(result.stderr ?? \"\");",
|
|
67861
|
+
" if (result.exitCode === 0) return undefined;",
|
|
67862
|
+
" if (result.exitCode === 2) return sanitizeBlockReason(stderr) || \"postToolUse hook exited with code 2.\";",
|
|
67863
|
+
" console.error(\"[rulesync-hooks] postToolUse hook exited with code \" + result.exitCode);",
|
|
67864
|
+
" return undefined;",
|
|
67865
|
+
"};",
|
|
67866
|
+
"// Like OpenCode's own `stringify`: a value JSON cannot hold (a BigInt, a cycle) falls back to `String`.",
|
|
67867
|
+
"const __rulesyncStringify = (value) => {",
|
|
67868
|
+
" try {",
|
|
67869
|
+
" return JSON.stringify(value) ?? String(value);",
|
|
67870
|
+
" } catch {",
|
|
67871
|
+
" return String(value);",
|
|
67872
|
+
" }",
|
|
67873
|
+
"};",
|
|
67874
|
+
"const __rulesyncAppendToolResult = (event, reason) => {",
|
|
67875
|
+
" if (!reason || event.status !== \"completed\") return;",
|
|
67876
|
+
" try {",
|
|
67877
|
+
" const text = \"PostToolUse hook feedback:\\n\" + reason;",
|
|
67878
|
+
" const result = event.result ?? {};",
|
|
67879
|
+
" const next = { ...result };",
|
|
67880
|
+
" if (typeof result.output === \"string\") next.output = result.output + \"\\n\\n\" + text;",
|
|
67881
|
+
" if (typeof result.content === \"string\") next.content = result.content + \"\\n\\n\" + text;",
|
|
67882
|
+
" else if (Array.isArray(result.content) && result.content.length > 0) next.content = [...result.content, { type: \"text\", text }];",
|
|
67883
|
+
" else {",
|
|
67884
|
+
" const output = result.output;",
|
|
67885
|
+
" const kept = output === undefined ? \"\" : typeof output === \"string\" ? output : __rulesyncStringify(output);",
|
|
67886
|
+
" next.content = [...(kept ? [{ type: \"text\", text: kept }] : []), { type: \"text\", text }];",
|
|
67887
|
+
" }",
|
|
67888
|
+
" event.result = next;",
|
|
67889
|
+
" } catch (error) {",
|
|
67890
|
+
" console.error(\"[rulesync-hooks] could not add postToolUse feedback to the tool result:\", error);",
|
|
67891
|
+
" }",
|
|
67892
|
+
"};"
|
|
67893
|
+
];
|
|
67894
|
+
/** The statement that runs a `postToolUse` handler and passes its feedback on. */
|
|
67895
|
+
function buildPostToolUseRunStatement(handler) {
|
|
67896
|
+
const { command, input } = commandAndInputOf(handler);
|
|
67897
|
+
return `__rulesyncAppendToolResult(event, await __rulesyncRunPostToolUseHook({ command: ${command}, input: ${input}, seconds: ${handler.timeout} }));`;
|
|
67898
|
+
}
|
|
67899
|
+
/** Whether a handler is a `postToolUse` one, which reports back to the model. */
|
|
67900
|
+
function isPostToolUseHandler(handler) {
|
|
67901
|
+
return handler.payload?.name === "PostToolUse";
|
|
67902
|
+
}
|
|
67770
67903
|
/** Emit one `ctx.<domain>.hook(name, ...)` registration. */
|
|
67771
67904
|
function buildHookRegistrationLines(hookPoint, handlers) {
|
|
67772
67905
|
const separator = hookPoint.indexOf(":");
|
|
@@ -67779,7 +67912,10 @@ function buildHookRegistrationLines(hookPoint, handlers) {
|
|
|
67779
67912
|
handlers,
|
|
67780
67913
|
cwdExpression: "directory"
|
|
67781
67914
|
}).map((line) => ` ${line}`));
|
|
67782
|
-
for (const handler of handlers)
|
|
67915
|
+
for (const handler of handlers) {
|
|
67916
|
+
const statement = isPostToolUseHandler(handler) ? buildPostToolUseRunStatement(handler) : buildRunStatement(handler);
|
|
67917
|
+
lines.push(...wrapInConditions(handler, statement, " "));
|
|
67918
|
+
}
|
|
67783
67919
|
lines.push(" }),");
|
|
67784
67920
|
lines.push(");");
|
|
67785
67921
|
return lines;
|
|
@@ -68028,10 +68164,12 @@ function buildSetupBodyLines({ hookHandlers, eventHandlers, stopHandlers }) {
|
|
|
68028
68164
|
cwdExpression: "directory"
|
|
68029
68165
|
})
|
|
68030
68166
|
];
|
|
68031
|
-
|
|
68167
|
+
const usesPostToolUse = allHandlers.some(isPostToolUseHandler);
|
|
68168
|
+
if (stopHandlers.length > 0 || usesPostToolUse) {
|
|
68032
68169
|
if (!allHandlers.some((handler) => handler.payload?.name === "PreToolUse")) body.push("", ...buildBlockReasonSanitizerLines({ typed: false }));
|
|
68033
|
-
body.push("", ...STOP_HOOK_HELPER_LINES$1);
|
|
68034
68170
|
}
|
|
68171
|
+
if (stopHandlers.length > 0) body.push("", ...STOP_HOOK_HELPER_LINES$1);
|
|
68172
|
+
if (usesPostToolUse) body.push("", ...POST_TOOL_USE_HELPER_LINES);
|
|
68035
68173
|
if ([...hookHandlers.values()].some((handlers) => handlers.some((handler) => handler.matcher !== void 0))) body.push("", ...TOOL_MATCHER_HELPER_LINES);
|
|
68036
68174
|
const usesContext = [...eventHandlers.values()].some(usesSessionContext);
|
|
68037
68175
|
const registers = hookHandlers.size > 0 || usesContext || stopHandlers.length > 0;
|
|
@@ -77342,7 +77480,7 @@ var CodexcliMcp = class CodexcliMcp extends ToolMcp {
|
|
|
77342
77480
|
validate
|
|
77343
77481
|
});
|
|
77344
77482
|
}
|
|
77345
|
-
static async fromRulesyncMcp({ outputRoot = process.cwd(), rulesyncMcp, validate = true, global = false }) {
|
|
77483
|
+
static async fromRulesyncMcp({ outputRoot = process.cwd(), rulesyncMcp, validate = true, global = false, preserveUnowned = false }) {
|
|
77346
77484
|
const paths = this.getSettablePaths({ global });
|
|
77347
77485
|
const configTomlFilePath = (0, node_path.join)(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
77348
77486
|
const configTomlFileContent = await readFileContentOrNull(configTomlFilePath) ?? "";
|
|
@@ -77353,7 +77491,7 @@ var CodexcliMcp = class CodexcliMcp extends ToolMcp {
|
|
|
77353
77491
|
throw new Error(`Failed to parse existing Codex CLI config at ${configTomlFilePath}: ${formatError(error)}`, { cause: error });
|
|
77354
77492
|
}
|
|
77355
77493
|
const strippedMcpServers = rulesyncMcp.getMcpServers();
|
|
77356
|
-
const
|
|
77494
|
+
const mcpServersWithCodexFields = Object.fromEntries(Object.entries(strippedMcpServers).map(([serverName, serverConfig]) => {
|
|
77357
77495
|
const rawServer = rulesyncMcp.getRawMcpServer(serverName);
|
|
77358
77496
|
return [serverName, {
|
|
77359
77497
|
...serverConfig,
|
|
@@ -77362,7 +77500,8 @@ var CodexcliMcp = class CodexcliMcp extends ToolMcp {
|
|
|
77362
77500
|
...isRecord(rawServer) && typeof rawServer.experimentalEnvironment === "string" ? { experimentalEnvironment: rawServer.experimentalEnvironment } : {},
|
|
77363
77501
|
...isRecord(rawServer) && rawServer.codexcliTools !== void 0 ? { codexcliTools: rawServer.codexcliTools } : {}
|
|
77364
77502
|
}];
|
|
77365
|
-
}))
|
|
77503
|
+
}));
|
|
77504
|
+
const converted = convertToCodexFormat(mcpServersWithCodexFields);
|
|
77366
77505
|
const filteredMcpServers = this.removeEmptyEntries(converted);
|
|
77367
77506
|
for (const name of Object.keys(converted)) if (!Object.hasOwn(filteredMcpServers, name)) warnWithFallback(void 0, `MCP server "${name}" had no non-empty configuration and was dropped from the codex CLI config`);
|
|
77368
77507
|
const existingMcpServers = isRecord(configToml["mcp_servers"]) ? configToml["mcp_servers"] : {};
|
|
@@ -77386,6 +77525,11 @@ var CodexcliMcp = class CodexcliMcp extends ToolMcp {
|
|
|
77386
77525
|
}
|
|
77387
77526
|
return [name, serverConfig];
|
|
77388
77527
|
}));
|
|
77528
|
+
const declaredCodexNames = new Set(Object.keys(mcpServersWithCodexFields).map((name) => normalizeCodexMcpServerName(name).codexName));
|
|
77529
|
+
const outputMcpServers = preserveUnowned ? {
|
|
77530
|
+
...Object.fromEntries(Object.entries(omitPrototypePollutionKeys(existingMcpServers)).filter(([name]) => !declaredCodexNames.has(name))),
|
|
77531
|
+
...mergedMcpServers
|
|
77532
|
+
} : mergedMcpServers;
|
|
77389
77533
|
return new CodexcliMcp({
|
|
77390
77534
|
outputRoot,
|
|
77391
77535
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -77394,7 +77538,7 @@ var CodexcliMcp = class CodexcliMcp extends ToolMcp {
|
|
|
77394
77538
|
fileKey: sharedConfigFileKey(paths),
|
|
77395
77539
|
feature: "mcp",
|
|
77396
77540
|
existingContent: configTomlFileContent,
|
|
77397
|
-
patch: { mcp_servers: Object.keys(
|
|
77541
|
+
patch: { mcp_servers: Object.keys(outputMcpServers).length > 0 ? outputMcpServers : void 0 },
|
|
77398
77542
|
filePath: configTomlFilePath
|
|
77399
77543
|
}),
|
|
77400
77544
|
validate
|
|
@@ -89234,7 +89378,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
89234
89378
|
}
|
|
89235
89379
|
getFactory;
|
|
89236
89380
|
featureOptions;
|
|
89237
|
-
|
|
89381
|
+
preserveUnownedMcpServers;
|
|
89382
|
+
constructor({ outputRoot = process.cwd(), inputRoots, toolTarget, global = false, getFactory = defaultGetFactory, dryRun = false, logger, featureOptions, preserveUnownedMcpServers = false }) {
|
|
89238
89383
|
super({
|
|
89239
89384
|
outputRoot,
|
|
89240
89385
|
inputRoots,
|
|
@@ -89247,6 +89392,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
89247
89392
|
this.global = global;
|
|
89248
89393
|
this.getFactory = getFactory;
|
|
89249
89394
|
this.featureOptions = featureOptions;
|
|
89395
|
+
this.preserveUnownedMcpServers = preserveUnownedMcpServers;
|
|
89250
89396
|
}
|
|
89251
89397
|
/**
|
|
89252
89398
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -89328,7 +89474,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
89328
89474
|
rulesyncMcp: filteredRulesyncMcp,
|
|
89329
89475
|
global: this.global,
|
|
89330
89476
|
logger: this.logger,
|
|
89331
|
-
featureOptions: this.featureOptions
|
|
89477
|
+
featureOptions: this.featureOptions,
|
|
89478
|
+
preserveUnowned: this.preserveUnownedMcpServers
|
|
89332
89479
|
}), ...await factory.class.getAuxiliaryFiles?.({
|
|
89333
89480
|
outputRoot: this.outputRoot,
|
|
89334
89481
|
global: this.global,
|
|
@@ -116984,14 +117131,20 @@ function createFoldRootOverwriteWatch({ logger }) {
|
|
|
116984
117131
|
writesByPath.set(path, writes);
|
|
116985
117132
|
}
|
|
116986
117133
|
},
|
|
116987
|
-
report: () => {
|
|
117134
|
+
report: ({ skip } = {}) => {
|
|
117135
|
+
const warnedPaths = /* @__PURE__ */ new Set();
|
|
116988
117136
|
for (const [path, writes] of writesByPath) {
|
|
116989
117137
|
const last = writes.at(-1);
|
|
116990
117138
|
if (last === void 0 || last.folds) continue;
|
|
116991
117139
|
const fold = writes.findLast((write) => write.folds && write.content !== last.content);
|
|
116992
|
-
if (fold === void 0
|
|
117140
|
+
if (fold === void 0 || skip?.({
|
|
117141
|
+
path,
|
|
117142
|
+
foldTarget: fold.target
|
|
117143
|
+
})) continue;
|
|
117144
|
+
warnedPaths.add(path);
|
|
116993
117145
|
logger.warn(`Target '${last.target}' overwrites ${displayPath({ filePath: path })}, the file target '${fold.target}' folds every non-root rule into, so '${fold.target}' is left with the root rule only. The last target in config order wins a shared file: list '${fold.target}' after '${last.target}' to keep the folded content (see "Target Order and File Conflicts" in the configuration guide).`);
|
|
116994
117146
|
}
|
|
117147
|
+
return warnedPaths;
|
|
116995
117148
|
}
|
|
116996
117149
|
};
|
|
116997
117150
|
}
|
|
@@ -117497,6 +117650,73 @@ const deriveSharedWriteSteps = () => {
|
|
|
117497
117650
|
});
|
|
117498
117651
|
return steps;
|
|
117499
117652
|
};
|
|
117653
|
+
// src/lib/shared-root-selection-watch.ts
|
|
117654
|
+
const selectionKeyOf = (rulesyncFiles) => [...new Set(rulesyncFiles.map((file) => toPosixPath((0, node_path.join)(file.getRelativeDirPath(), file.getRelativeFilePath()))))].toSorted().join("\n");
|
|
117655
|
+
/**
|
|
117656
|
+
* Watches for targets that write the same root rule file (`AGENTS.md` for
|
|
117657
|
+
* `codexcli` and `opencode`, for example) with different contents because at
|
|
117658
|
+
* least one of them narrows its rules through the per-target `include` rules
|
|
117659
|
+
* option.
|
|
117660
|
+
*
|
|
117661
|
+
* A shared file holds one target's output only: the last target in config
|
|
117662
|
+
* order wins, as for any shared file. That is documented, but nothing in the
|
|
117663
|
+
* output said so when the targets disagree. The watch does not change what is
|
|
117664
|
+
* written; it names the file, the targets and the winner, once per file.
|
|
117665
|
+
*
|
|
117666
|
+
* It stays quiet when the file would be the same whoever writes it: many
|
|
117667
|
+
* targets keep non-root rules in their own directories, so a different
|
|
117668
|
+
* selection of non-root rules does not change the shared root file. It also
|
|
117669
|
+
* stays quiet when no sharing target's `include` actually leaves a rule out
|
|
117670
|
+
* (`["*"]`, a list naming every rule, or no option): a difference there comes
|
|
117671
|
+
* from the rules' own `targets` frontmatter, which has always worked this way.
|
|
117672
|
+
*
|
|
117673
|
+
* When a fold target's content is overwritten and that fold target folded at
|
|
117674
|
+
* least one non-root rule into it, the folded rules are lost because of the
|
|
117675
|
+
* target order: the fold-root overwrite warning names it with the reordering
|
|
117676
|
+
* that fixes it, and this watch skips the file (`skipPaths`), so each file
|
|
117677
|
+
* gets one warning. Only a fold target that folded nothing (its `include`
|
|
117678
|
+
* left it the root rule alone) is handed to this watch (`foldedNothing`).
|
|
117679
|
+
*
|
|
117680
|
+
* `observe` records what each target resolved and writes; `report` decides
|
|
117681
|
+
* once every target has been seen. Files are keyed by their resolved output
|
|
117682
|
+
* path, so each output root is compared on its own.
|
|
117683
|
+
*/
|
|
117684
|
+
function createSharedRootSelectionWatch({ logger }) {
|
|
117685
|
+
const writesByPath = /* @__PURE__ */ new Map();
|
|
117686
|
+
return {
|
|
117687
|
+
observe: ({ toolTarget, includeNarrowed, rulesyncFiles, toolFiles }) => {
|
|
117688
|
+
for (const file of toolFiles) {
|
|
117689
|
+
if (!(file instanceof ToolRule) || !file.isRoot()) continue;
|
|
117690
|
+
const path = (0, node_path.resolve)(file.getFilePath());
|
|
117691
|
+
const writes = writesByPath.get(path) ?? [];
|
|
117692
|
+
if (!writes.some((write) => write.target === toolTarget)) writes.push({
|
|
117693
|
+
target: toolTarget,
|
|
117694
|
+
includeNarrowed,
|
|
117695
|
+
rulesyncFiles,
|
|
117696
|
+
content: file.getFileContent()
|
|
117697
|
+
});
|
|
117698
|
+
writesByPath.set(path, writes);
|
|
117699
|
+
}
|
|
117700
|
+
},
|
|
117701
|
+
foldedNothing: ({ path, target }) => {
|
|
117702
|
+
const write = writesByPath.get(path)?.find((entry) => entry.target === target);
|
|
117703
|
+
return write !== void 0 && write.rulesyncFiles.every((file) => file instanceof RulesyncRule && (file.getFrontmatter().root === true || file.getFrontmatter().localRoot === true));
|
|
117704
|
+
},
|
|
117705
|
+
report: ({ skipPaths } = {}) => {
|
|
117706
|
+
for (const [path, writes] of writesByPath) {
|
|
117707
|
+
if (skipPaths?.has(path)) continue;
|
|
117708
|
+
const last = writes.at(-1);
|
|
117709
|
+
if (last === void 0 || writes.length < 2) continue;
|
|
117710
|
+
if (writes.every((write) => write.content === last.content)) continue;
|
|
117711
|
+
if (!writes.some((write) => write.includeNarrowed())) continue;
|
|
117712
|
+
const lastKey = selectionKeyOf(last.rulesyncFiles);
|
|
117713
|
+
if (writes.every((write) => selectionKeyOf(write.rulesyncFiles) === lastKey)) continue;
|
|
117714
|
+
const targets = writes.map((write) => `'${write.target}'`).join(", ");
|
|
117715
|
+
logger.warn(`Targets ${targets} write ${displayPath({ filePath: path })} with different contents, and the \`include\` rules option narrows the rule selection of at least one of them. A shared file holds one target's output: '${last.target}' wins as the last target in config order. Give targets that share a file the same \`include\` list (or none); see "Selecting rules per target" in the configuration guide.`);
|
|
117716
|
+
}
|
|
117717
|
+
}
|
|
117718
|
+
};
|
|
117719
|
+
}
|
|
117500
117720
|
// src/lib/generate.ts
|
|
117501
117721
|
/**
|
|
117502
117722
|
* The message to report when a run left some `.rulesync/` source unread, or
|
|
@@ -118234,6 +118454,7 @@ async function generateRulesCore(params) {
|
|
|
118234
118454
|
logger
|
|
118235
118455
|
});
|
|
118236
118456
|
const foldRootOverwriteWatch = createFoldRootOverwriteWatch({ logger });
|
|
118457
|
+
const sharedRootSelectionWatch = createSharedRootSelectionWatch({ logger });
|
|
118237
118458
|
let fullRunSkills;
|
|
118238
118459
|
const loadFullRunSkills = () => {
|
|
118239
118460
|
fullRunSkills ??= loadConfigFileSkills({
|
|
@@ -118293,6 +118514,12 @@ async function generateRulesCore(params) {
|
|
|
118293
118514
|
toolTarget,
|
|
118294
118515
|
toolFiles
|
|
118295
118516
|
});
|
|
118517
|
+
sharedRootSelectionWatch.observe({
|
|
118518
|
+
toolTarget,
|
|
118519
|
+
includeNarrowed: () => processor.didIncludeNarrowSelection(),
|
|
118520
|
+
rulesyncFiles,
|
|
118521
|
+
toolFiles
|
|
118522
|
+
});
|
|
118296
118523
|
skippedRootFileCheck.observe({
|
|
118297
118524
|
toolTarget,
|
|
118298
118525
|
outputRoot,
|
|
@@ -118321,7 +118548,11 @@ async function generateRulesCore(params) {
|
|
|
118321
118548
|
if (skippedResult.hasDiff) hasDiff = true;
|
|
118322
118549
|
if (skippedResult.sourceLoadFailed) sourceLoadFailed = true;
|
|
118323
118550
|
}
|
|
118324
|
-
foldRootOverwriteWatch.report()
|
|
118551
|
+
const foldWarnedPaths = foldRootOverwriteWatch.report({ skip: ({ path, foldTarget }) => sharedRootSelectionWatch.foldedNothing({
|
|
118552
|
+
path,
|
|
118553
|
+
target: foldTarget
|
|
118554
|
+
}) });
|
|
118555
|
+
sharedRootSelectionWatch.report({ skipPaths: foldWarnedPaths });
|
|
118325
118556
|
return {
|
|
118326
118557
|
count: totalCount,
|
|
118327
118558
|
paths: allPaths,
|
|
@@ -118438,7 +118669,8 @@ function generateMcpCore(params) {
|
|
|
118438
118669
|
supportedTargets: McpProcessor.getToolTargets({ global: config.getGlobal() }),
|
|
118439
118670
|
createProcessor: (options) => new McpProcessor({
|
|
118440
118671
|
...options,
|
|
118441
|
-
featureOptions: config.getFeatureOptions(options.toolTarget, "mcp")
|
|
118672
|
+
featureOptions: config.getFeatureOptions(options.toolTarget, "mcp"),
|
|
118673
|
+
preserveUnownedMcpServers: config.getPreserveUnownedMcpServers()
|
|
118442
118674
|
})
|
|
118443
118675
|
});
|
|
118444
118676
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_import = require("./import-
|
|
2
|
+
const require_import = require("./import-T-69RQxs.cjs");
|
|
3
3
|
// src/index.ts
|
|
4
4
|
async function generate(options = {}) {
|
|
5
5
|
const { silent = true, verbose = false, ...rest } = options;
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/features.ts","../src/types/tool-target-tuples.ts","../src/types/tool-targets.ts","../src/lib/orphan-sweep.ts","../src/utils/result.ts","../src/lib/convert.ts","../src/types/ai-file.ts","../src/types/ai-dir.ts","../src/features/skills/rulesync-skill.ts","../src/lib/generate.ts","../src/lib/import.ts","../src/index.ts"],"mappings":";qBAaa;cA+BP,eAAa,EAAA,uBAAA,EAAA;;;;;;;;;IAAoE,EAAA;KAE3E,UAAU,EAAE,aAAa;cCudxB;KC3fR,wBAAwB;qBAEhB,4BAA4B,kBAAkB;cAM9C,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEjB,aAAa,EAAE,aAAa;;KCb5B;EAAgB;EAAc;;;;;;;KAO9B;EAAiB;EAA4B;EAAc;;;;;;KCmB3D;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KCxBU,gBAAgB;KCbhB;EAEN;EACA;;EAGA;EACA,OAAO;;KC8CD;EACV;EACA,YAAY;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gC,EAAE,aAAa;KAG/C,2BAA2B,EAAE,aAAa;KAOjD;EACH;EACA;EACA;EACA,aAAa;EACb;EACA,aAAa;EACb;EACA;;KAGG;EACH;;KAGG;EACH;EACA;EACA;EACA;;;;;;cAOW,sBAAsB;EACjC,cACE,YACA,iBACA,SACA,aACA,MACA,YACA,UACA,UACC;SAsBI,oBAAoB;EAU3B,kBAAkB;EAQlB;EAIA,YAAY;SAcC,UACX,YACA,iBACA,SACA,UACC,6BAA6B,QAAQ;iBAsBnB;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types/features.ts","../src/types/tool-target-tuples.ts","../src/types/tool-targets.ts","../src/lib/orphan-sweep.ts","../src/utils/result.ts","../src/lib/convert.ts","../src/types/ai-file.ts","../src/types/ai-dir.ts","../src/features/skills/rulesync-skill.ts","../src/lib/generate.ts","../src/lib/import.ts","../src/index.ts"],"mappings":";qBAaa;cA+BP,eAAa,EAAA,uBAAA,EAAA;;;;;;;;;IAAoE,EAAA;KAE3E,UAAU,EAAE,aAAa;cCudxB;KC3fR,wBAAwB;qBAEhB,4BAA4B,kBAAkB;cAM9C,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEjB,aAAa,EAAE,aAAa;;KCb5B;EAAgB;EAAc;;;;;;;KAO9B;EAAiB;EAA4B;EAAc;;;;;;KCmB3D;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KCxBU,gBAAgB;KCbhB;EAEN;EACA;;EAGA;EACA,OAAO;;KC8CD;EACV;EACA,YAAY;;;;;;;;EAQZ;;;;;;;EAOA;;KAmnBU;EACV;EACA;EACA;EACA;IACE;IACA;IACA,cAAc;;EAEhB,aAAa;EACb;;KAGU,qBAAqB,KAC/B;uBAIoB;;;;qBAID;;;;qBAKA;;;;qBAKA;;;;YAKT;IACR;IACA;IACA,cAAc;;;;;YAM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A,UACA,UACC;SAsBI,oBAAoB;EAU3B,kBAAkB;EAQlB;EAIA,YAAY;SAcC,UACX,YACA,iBACA,SACA,UACC,6BAA6B,QAAQ;iBAsBnB;;KClnBX;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;;;;EAMA;;;;;EAKA,0BAA0B;;;;;;;EAO1B,uBAAuB,QAAQ,OAAO,2BAA2B;;;;;;;EAOjE,wBAAwB,QAAQ,OAAO,2BAA2B;;KAoe/D;KCzhBO,eAAe;KC7CtB;EACH;EACA;EACA;EACA;;YAGU,kBAAkB;EAC5B,UAAU;EACV,WAAW;EACX;;;;;;;;;;;;;EAaA;;;;;;;;EAQA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU,gBAAgB;EAC1B,QAAQ;EACR,WAAW;;YAGD,iBAAiB;EAC3B,MAAM;EACN,IAAI;EACJ,WAAW;EACX;;wBAGoB,SAAS,UAAS,kBAAuB,QAAQ;wBAyBjD,eAAe,SAAS,gBAAgB,QAAQ;wBAehD,gBAAgB,SAAS,iBAAiB,QAAQ"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/features.ts","../src/types/tool-target-tuples.ts","../src/types/tool-targets.ts","../src/lib/orphan-sweep.ts","../src/utils/result.ts","../src/lib/convert.ts","../src/types/ai-file.ts","../src/types/ai-dir.ts","../src/features/skills/rulesync-skill.ts","../src/lib/generate.ts","../src/lib/import.ts","../src/index.ts"],"mappings":";qBAaa;cA+BP,eAAa,EAAA,uBAAA,EAAA;;;;;;;;;IAAoE,EAAA;KAE3E,UAAU,EAAE,aAAa;cCudxB;KC3fR,wBAAwB;qBAEhB,4BAA4B,kBAAkB;cAM9C,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0fzC,EAAA,KAAA;KAGU,gCAAgC,EAAE,aAAa;KAG/C,2BAA2B,EAAE,aAAa;KAOjD;EACH;EACA;EACA;EACA,aAAa;EACb;EACA,aAAa;EACb;EACA;;KAGG;EACH;;KAGG;EACH;EACA;EACA;EACA;;;;;;cAOW,sBAAsB;EACjC,cACE,YACA,iBACA,SACA,aACA,MACA,YACA,UACA,UACC;SAsBI,oBAAoB;EAU3B,kBAAkB;EAQlB;EAIA,YAAY;SAcC,UACX,YACA,iBACA,SACA,UACC,6BAA6B,QAAQ;iBAsBnB;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/features.ts","../src/types/tool-target-tuples.ts","../src/types/tool-targets.ts","../src/lib/orphan-sweep.ts","../src/utils/result.ts","../src/lib/convert.ts","../src/types/ai-file.ts","../src/types/ai-dir.ts","../src/features/skills/rulesync-skill.ts","../src/lib/generate.ts","../src/lib/import.ts","../src/index.ts"],"mappings":";qBAaa;cA+BP,eAAa,EAAA,uBAAA,EAAA;;;;;;;;;IAAoE,EAAA;KAE3E,UAAU,EAAE,aAAa;cCudxB;KC3fR,wBAAwB;qBAEhB,4BAA4B,kBAAkB;cAM9C,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEjB,aAAa,EAAE,aAAa;;KCb5B;EAAgB;EAAc;;;;;;;KAO9B;EAAiB;EAA4B;EAAc;;;;;;KCmB3D;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KCxB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0fzC,EAAA,KAAA;KAGU,gCAAgC,EAAE,aAAa;KAG/C,2BAA2B,EAAE,aAAa;KAOjD;EACH;EACA;EACA;EACA,aAAa;EACb;EACA,aAAa;EACb;EACA;;KAGG;EACH;;KAGG;EACH;EACA;EACA;EACA;;;;;;cAOW,sBAAsB;EACjC,cACE,YACA,iBACA,SACA,aACA,MACA,YACA,UACA,UACC;SAsBI,oBAAoB;EAU3B,kBAAkB;EAQlB;EAIA,YAAY;SAcC,UACX,YACA,iBACA,SACA,UACC,6BAA6B,QAAQ;iBAsBnB;;KClnBX;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;;;;EAMA;;;;;EAKA,0BAA0B;;;;;;;EAO1B,uBAAuB,QAAQ,OAAO,2BAA2B;;;;;;;EAOjE,wBAAwB,QAAQ,OAAO,2BAA2B;;KAoe/D;KCzhBO,eAAe;KC7CtB;EACH;EACA;EACA;EACA;;YAGU,kBAAkB;EAC5B,UAAU;EACV,WAAW;EACX;;;;;;;;;;;;;EAaA;;;;;;;;EAQA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU,gBAAgB;EAC1B,QAAQ;EACR,WAAW;;YAGD,iBAAiB;EAC3B,MAAM;EACN,IAAI;EACJ,WAAW;EACX;;wBAGoB,SAAS,UAAS,kBAAuB,QAAQ;wBAyBjD,eAAe,SAAS,gBAAgB,QAAQ;wBAehD,gBAAgB,SAAS,iBAAiB,QAAQ"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cr as ALL_TOOL_TARGETS, Dr as ALL_FEATURES, Tn as ConsoleLogger, a as convertFromTool$1, i as inspectInputRoots, mn as ConfigResolver, r as generate$1, t as importFromTool$1 } from "./import-
|
|
1
|
+
import { Cr as ALL_TOOL_TARGETS, Dr as ALL_FEATURES, Tn as ConsoleLogger, a as convertFromTool$1, i as inspectInputRoots, mn as ConfigResolver, r as generate$1, t as importFromTool$1 } from "./import-1IIVv7h3.js";
|
|
2
2
|
// src/index.ts
|
|
3
3
|
async function generate(options = {}) {
|
|
4
4
|
const { silent = true, verbose = false, ...rest } = options;
|