rulesync 16.30.0 → 16.30.2
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 +4 -4
- package/dist/cli/index.js +4 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/{import-BDlmyTcr.js → import-BknrMODR.js} +84 -4
- package/dist/import-BknrMODR.js.map +1 -0
- package/dist/{import-WJZi59fO.cjs → import-auwKp4Mm.cjs} +83 -3
- 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 +7 -7
- package/dist/import-BDlmyTcr.js.map +0 -1
|
@@ -69862,6 +69862,78 @@ const getProcessorRegistryEntry = (feature) => {
|
|
|
69862
69862
|
return entry;
|
|
69863
69863
|
};
|
|
69864
69864
|
//#endregion
|
|
69865
|
+
//#region src/lib/fold-root-overwrite-watch.ts
|
|
69866
|
+
/**
|
|
69867
|
+
* Whether a target folds every non-root rule into its root file, i.e. its tool
|
|
69868
|
+
* reads the one root file and nothing else.
|
|
69869
|
+
*/
|
|
69870
|
+
function foldsIntoRoot({ toolTarget }) {
|
|
69871
|
+
return RulesProcessor.getFactory(toolTarget)?.meta.collisionPolicy === "fold";
|
|
69872
|
+
}
|
|
69873
|
+
/**
|
|
69874
|
+
* Names the root file the way the rest of the run does: relative to the
|
|
69875
|
+
* working directory when it lives under it (so `AGENTS.md`, or
|
|
69876
|
+
* `packages/app/AGENTS.md` for a second output root), absolute otherwise.
|
|
69877
|
+
*/
|
|
69878
|
+
function displayPath({ filePath }) {
|
|
69879
|
+
const rel = relative(process.cwd(), filePath);
|
|
69880
|
+
return rel === "" || isAbsolute(rel) || rel === ".." || rel.startsWith(`..${sep}`) ? filePath : toPosixPath(rel);
|
|
69881
|
+
}
|
|
69882
|
+
/**
|
|
69883
|
+
* Watches for a later target overwriting a fold target's root file with
|
|
69884
|
+
* different content, which silently loses every non-root rule for that tool.
|
|
69885
|
+
*
|
|
69886
|
+
* Several targets write the same root file (`AGENTS.md` above all), and the
|
|
69887
|
+
* documented rule is that the last target in config order wins. For a target
|
|
69888
|
+
* that files non-root rules in its own directory that is harmless: it keeps the
|
|
69889
|
+
* root body either way. A `collisionPolicy: "fold"` target (codexcli and the
|
|
69890
|
+
* others whose tool reads only the one root file) has nowhere else to put its
|
|
69891
|
+
* non-root rules, so when a sibling that emits the root body alone comes later
|
|
69892
|
+
* in config order — `["codexcli", "zoocode"]` — the fold is overwritten and
|
|
69893
|
+
* Codex CLI is left with the root rule only, in a diff that reads as a large
|
|
69894
|
+
* deletion of `AGENTS.md`. See issue #3022.
|
|
69895
|
+
*
|
|
69896
|
+
* The overwrite itself is not prevented (last-wins is what the docs promise);
|
|
69897
|
+
* it is named, once per root file, together with the reordering that keeps the
|
|
69898
|
+
* folded content. `observe` only records what each target would write; the
|
|
69899
|
+
* verdict is `report`'s, once every target has been seen, because only the
|
|
69900
|
+
* final writer decides what is on disk: with `["codexcli", "zoocode", "pi"]`
|
|
69901
|
+
* the fold target `pi` wins the file with every non-root body in it, so nothing
|
|
69902
|
+
* is lost and nothing is reported. Files are keyed by their resolved output
|
|
69903
|
+
* path, so a project with several output roots is compared root by root
|
|
69904
|
+
* however each root was spelled. In `--check` mode nothing is
|
|
69905
|
+
* written, but the sentence describes the same outcome of the same config, so
|
|
69906
|
+
* it is worded the same.
|
|
69907
|
+
*/
|
|
69908
|
+
function createFoldRootOverwriteWatch({ logger }) {
|
|
69909
|
+
const writesByPath = /* @__PURE__ */ new Map();
|
|
69910
|
+
return {
|
|
69911
|
+
observe: ({ toolTarget, toolFiles }) => {
|
|
69912
|
+
const folds = foldsIntoRoot({ toolTarget });
|
|
69913
|
+
for (const file of toolFiles) {
|
|
69914
|
+
if (!(file instanceof ToolRule) || !file.isRoot()) continue;
|
|
69915
|
+
const path = resolve(file.getFilePath());
|
|
69916
|
+
const writes = writesByPath.get(path) ?? [];
|
|
69917
|
+
writes.push({
|
|
69918
|
+
target: toolTarget,
|
|
69919
|
+
folds,
|
|
69920
|
+
content: file.getFileContent()
|
|
69921
|
+
});
|
|
69922
|
+
writesByPath.set(path, writes);
|
|
69923
|
+
}
|
|
69924
|
+
},
|
|
69925
|
+
report: () => {
|
|
69926
|
+
for (const [path, writes] of writesByPath) {
|
|
69927
|
+
const last = writes.at(-1);
|
|
69928
|
+
if (last === void 0 || last.folds) continue;
|
|
69929
|
+
const fold = writes.findLast((write) => write.folds && write.content !== last.content);
|
|
69930
|
+
if (fold === void 0) continue;
|
|
69931
|
+
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).`);
|
|
69932
|
+
}
|
|
69933
|
+
}
|
|
69934
|
+
};
|
|
69935
|
+
}
|
|
69936
|
+
//#endregion
|
|
69865
69937
|
//#region src/lib/orphan-sweep.ts
|
|
69866
69938
|
function createOrphanSweepPlan() {
|
|
69867
69939
|
const generatedPaths = /* @__PURE__ */ new Set();
|
|
@@ -70171,17 +70243,19 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
70171
70243
|
* based on whether rulesync files exist.
|
|
70172
70244
|
*/
|
|
70173
70245
|
async function processFeatureWithRulesyncFiles(params) {
|
|
70174
|
-
const { config, processor, rulesyncFiles, sweepPlan, skipFilePaths } = params;
|
|
70246
|
+
const { config, processor, rulesyncFiles, sweepPlan, skipFilePaths, onToolFiles } = params;
|
|
70175
70247
|
if (rulesyncFiles.length === 0) return processEmptyFeatureGeneration({
|
|
70176
70248
|
config,
|
|
70177
70249
|
processor,
|
|
70178
70250
|
sweepPlan,
|
|
70179
70251
|
skipFilePaths
|
|
70180
70252
|
});
|
|
70253
|
+
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
70254
|
+
onToolFiles?.(toolFiles);
|
|
70181
70255
|
return processFeatureGeneration({
|
|
70182
70256
|
config,
|
|
70183
70257
|
processor,
|
|
70184
|
-
toolFiles
|
|
70258
|
+
toolFiles,
|
|
70185
70259
|
sweepPlan,
|
|
70186
70260
|
skipFilePaths
|
|
70187
70261
|
});
|
|
@@ -70599,6 +70673,7 @@ async function generateRulesCore(params) {
|
|
|
70599
70673
|
featureName: "rules",
|
|
70600
70674
|
logger
|
|
70601
70675
|
});
|
|
70676
|
+
const foldRootOverwriteWatch = createFoldRootOverwriteWatch({ logger });
|
|
70602
70677
|
const isCheck = config.getCheck();
|
|
70603
70678
|
const rootFileOwner = isCheck ? computeRootFileOwnership({
|
|
70604
70679
|
targets: config.getConfigFileTargets(),
|
|
@@ -70635,13 +70710,18 @@ async function generateRulesCore(params) {
|
|
|
70635
70710
|
processor,
|
|
70636
70711
|
rulesyncFiles,
|
|
70637
70712
|
sweepPlan,
|
|
70638
|
-
skipFilePaths: skipFilePaths.size > 0 ? skipFilePaths : void 0
|
|
70713
|
+
skipFilePaths: skipFilePaths.size > 0 ? skipFilePaths : void 0,
|
|
70714
|
+
onToolFiles: (toolFiles) => foldRootOverwriteWatch.observe({
|
|
70715
|
+
toolTarget,
|
|
70716
|
+
toolFiles
|
|
70717
|
+
})
|
|
70639
70718
|
});
|
|
70640
70719
|
totalCount += result.count;
|
|
70641
70720
|
allPaths.push(...result.paths);
|
|
70642
70721
|
if (result.hasDiff) hasDiff = true;
|
|
70643
70722
|
if (result.sourceLoadFailed) sourceLoadFailed = true;
|
|
70644
70723
|
}
|
|
70724
|
+
foldRootOverwriteWatch.report();
|
|
70645
70725
|
return {
|
|
70646
70726
|
count: totalCount,
|
|
70647
70727
|
paths: allPaths,
|
|
@@ -71396,4 +71476,4 @@ async function importChecksCore(params) {
|
|
|
71396
71476
|
//#endregion
|
|
71397
71477
|
export { RulesyncCheck as $, ALL_TOOL_TARGETS as $t, CLAUDECODE_SKILLS_DIR_PATH as A, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH as An, ensureDir as At, RulesyncSkill as B, quoteForLog as Bn, pathEscapesRoot as Bt, ChecksProcessor as C, RULESYNC_PERMISSIONS_FILE_NAME as Cn, applyFileMode as Ct, CLAUDECODE_LOCAL_RULE_FILE_NAME as D, RULESYNC_RELATIVE_DIR_PATH as Dn, checkPathTraversal as Dt, CLAUDECODE_DIR as E, RULESYNC_PERMISSIONS_SCHEMA_URL as En, assertWritablePathInsideRoot as Et, AUGMENTCODE_DIR as F, DEPRECATED_FEATURE_REPLACEMENTS as Fn, isFileSystemError as Ft, RulesyncMcp as G, removeFile as Gt, RulesyncRule as H, stripControlCharactersKeepingLineFeeds as Hn, readFileContentOrNull as Ht, AUGMENTCODE_SETTINGS_LOCAL_FILE_NAME as I, formatError as In, isSymlink as It, getRulesyncSourceCandidates as J, resolvePath as Jt, RulesyncIgnore as K, removeFileStrict as Kt, getLocalSkillDirNames as L, truncateText as Ln, listDirectoryEntryNames as Lt, FACTORYDROID_SETTINGS_LOCAL_FILE_NAME as M, parseCommaSeparatedList as Mn, getFileSize as Mt, caseFoldIdentity as N, ALL_FEATURES as Nn, getHomeDirectory as Nt, CLAUDECODE_MEMORIES_DIR_NAME as O, RULESYNC_RULES_RELATIVE_DIR_PATH as On, createTempDirectory as Ot, groupSpellingsByCaseFoldedIdentity as P, ALL_FEATURES_WITH_WILDCARD as Pn, isFileNotFoundError as Pt, RulesyncCommandFrontmatterSchema as Q, writeFileContent as Qt, RulesyncSubagent as R, hasDeceptiveHiddenCharacters as Rn, listFilePathsRecursively as Rt, QWENCODE_LOCAL_RULE_FILE_NAME as S, RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH as Sn, ErrorCodes as St, CODEXCLI_DIR as T, RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH as Tn, assertTreeContainsNoSymlinks as Tt, RulesyncRuleFrontmatterSchema as U, stripHiddenCharacters as Un, removeDirectory as Ut, RulesyncSkillFrontmatterSchema as V, stripControlCharacters as Vn, readFileContent as Vt, RulesyncPermissions as W, removeDirectoryStrict as Wt, parseJsonc as X, toPosixPath as Xt, resolveRulesyncSourceWritePath as Y, runWithDirectoryRollback as Yt, RulesyncCommand as Z, writeFileBuffer as Zt, IgnoreProcessor as _, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH as _n, warnOnConflictingFlags as _t, getProcessorRegistryEntry as a, RULESYNC_AIIGNORE_FILE_NAME as an, ConfigResolver as at, CommandsProcessor as b, RULESYNC_MCP_RELATIVE_FILE_PATH as bn, withWarnOnceScope as bt, RulesProcessor as c, RULESYNC_COMMANDS_RELATIVE_DIR_PATH as cn, CONFLICTING_TARGET_PAIRS as ct, CODEBUDDY_DIR as d, RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH as dn, SourceEntrySchema as dt, ALL_TOOL_TARGETS_WITH_WILDCARD as en, RulesyncCheckFrontmatterSchema as et, CODEBUDDY_LOCAL_RULE_FILE_NAME as f, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH as fn, findControlCharacter as ft, McpProcessor as g, RULESYNC_IGNORE_RELATIVE_FILE_PATH as gn, fallbackLogger as gt, shortenToWidth as h, RULESYNC_HOOKS_RELATIVE_FILE_PATH as hn, WarningCollectingLogger as ht, inspectInputRoots as i, MAX_FILE_SIZE as in, SKILL_FILE_NAME as it, FACTORYDROID_DIR as j, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH as jn, fileExists as jt, CLAUDECODE_SETTINGS_LOCAL_FILE_NAME as k, RULESYNC_SKILLS_RELATIVE_DIR_PATH as kn, directoryExists as kt, SubagentsProcessor as l, RULESYNC_CONFIG_RELATIVE_FILE_PATH as ln, ConfigFileSchema as lt, displayWidthOf as m, RULESYNC_HOOKS_LEGACY_FILE_NAME as mn, JsonLogger as mt, formatSourceLoadFailure as n, ToolTargetSchema as nn, loadYaml as nt, convertFromTool as o, RULESYNC_AIIGNORE_RELATIVE_FILE_PATH as on, mergeInputRootConfigs as ot, ELLIPSIS_WIDTH as p, RULESYNC_HOOKS_FILE_NAME as pn, ConsoleLogger as pt, RulesyncHooks as q, removeTempDirectory as qt, generate as r, CURATED_RULES_FEATURE_SUBDIR as rn, SHARED_USER_MANAGED_CONFIG_PATHS as rt, isPackagingToolTarget as s, RULESYNC_CHECKS_RELATIVE_DIR_PATH as sn, resolveEffectiveInputRoots as st, importFromTool as t, PACKAGING_TOOL_TARGETS as tn, stringifyFrontmatter as tt, SkillsProcessor as u, RULESYNC_CONFIG_SCHEMA_URL as un, GITIGNORE_DESTINATION_KEY as ut, CRUSH_LOCAL_RULE_FILE_NAME as v, RULESYNC_MCP_FILE_NAME as vn, withFallbackLoggerTarget as vt, CODEXCLI_BASH_RULES_FILE_NAME as w, RULESYNC_PERMISSIONS_LEGACY_FILE_NAME as wn, assertDirectoryIfExists as wt, QWENCODE_DIR as x, RULESYNC_MCP_SCHEMA_URL as xn, CLIError as xt, HooksProcessor as y, RULESYNC_MCP_LEGACY_FILE_NAME as yn, resetRunWarningState as yt, RulesyncSubagentFrontmatterSchema as z, hasEnclosingMarkOutsideKeycap as zn, listSubdirectoryNames as zt };
|
|
71398
71478
|
|
|
71399
|
-
//# sourceMappingURL=import-
|
|
71479
|
+
//# sourceMappingURL=import-BknrMODR.js.map
|