rulesync 16.39.1 → 17.0.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.
@@ -44294,14 +44294,10 @@ function convertRulesyncToCodexProfile({ config, logger }) {
44294
44294
  }
44295
44295
  logger?.warn(`Codex CLI permissions support only read/edit/write/webfetch categories. Skipping: ${toolName}`);
44296
44296
  }
44297
- for (const [pattern, access] of mergeFilesystemCategoryRules({
44297
+ addCodexFilesystemRules({
44298
44298
  categoryRules: filesystemCategoryRules,
44299
- logger
44300
- })) addFilesystemRule({
44301
44299
  filesystem,
44302
44300
  workspaceRootFilesystem,
44303
- pattern,
44304
- access,
44305
44301
  logger
44306
44302
  });
44307
44303
  applyDefaultGitWriteRules({
@@ -44326,6 +44322,29 @@ function convertRulesyncToCodexProfile({ config, logger }) {
44326
44322
  ...network ? { network } : {}
44327
44323
  };
44328
44324
  }
44325
+ function addCodexFilesystemRules({ categoryRules, filesystem, workspaceRootFilesystem, logger }) {
44326
+ for (const rule of mergeFilesystemCategoryRules({
44327
+ categoryRules,
44328
+ logger
44329
+ })) {
44330
+ const access = normalizeCodexFilesystemAccess({
44331
+ pattern: rule.pattern,
44332
+ access: rule.access,
44333
+ writeRestriction: rule.writeRestriction,
44334
+ logger
44335
+ });
44336
+ if (access === void 0) continue;
44337
+ if (access === "read" && rule.writeRestriction === "ask") logger?.warn(`Codex CLI cannot express "ask" for filesystem write permissions: pattern "${rule.pattern}" will be emitted as read-only.`);
44338
+ if (access === "read" && rule.writeRestriction === "deny") logger?.warn(`Codex CLI maps a write-side deny to read-only access: pattern "${rule.pattern}" will be emitted as "read". A broader read deny may be overridden by this more-specific path.`);
44339
+ addFilesystemRule({
44340
+ filesystem,
44341
+ workspaceRootFilesystem,
44342
+ pattern: rule.pattern,
44343
+ access,
44344
+ logger
44345
+ });
44346
+ }
44347
+ }
44329
44348
  function applyDefaultGitWriteRules({ config, filesystem, workspaceRootFilesystem }) {
44330
44349
  if (config.codexcli?.git_write_rules === false) return;
44331
44350
  if (config.codexcli?.base_permission_profile === CODEX_READ_ONLY_BASELINE) return;
@@ -44475,6 +44494,23 @@ function addFilesystemRule({ filesystem, workspaceRootFilesystem, pattern, acces
44475
44494
  }
44476
44495
  workspaceRootFilesystem[pattern] = access;
44477
44496
  }
44497
+ function normalizeCodexFilesystemAccess({ pattern, access, writeRestriction, logger }) {
44498
+ if ((access === "read" || access === "write") && hasUnsupportedCodexFilesystemGlob(pattern)) {
44499
+ if (writeRestriction !== void 0) {
44500
+ logger?.warn(`Codex CLI only supports deny access for non-trailing filesystem globs: pattern "${pattern}" will be emitted as "deny" because its write-side ${writeRestriction} restriction cannot be represented as read-only access. Use an exact path or trailing "/**" for read/write access.`);
44501
+ return "deny";
44502
+ }
44503
+ logger?.warn(`Skipping unsupported Codex CLI ${access} filesystem glob "${pattern}"; the base permission profile remains in effect. Use an exact path or trailing "/**" for read/write access.`);
44504
+ return;
44505
+ }
44506
+ return access;
44507
+ }
44508
+ function hasCodexFilesystemGlob(pattern) {
44509
+ return pattern.includes("*") || pattern.includes("?") || pattern.includes("[") || pattern.includes("]");
44510
+ }
44511
+ function hasUnsupportedCodexFilesystemGlob(pattern) {
44512
+ return hasCodexFilesystemGlob(pattern.endsWith("/**") ? pattern.slice(0, -3) : pattern);
44513
+ }
44478
44514
  function canBeCodexFilesystemRoot(pattern) {
44479
44515
  return isAbsolute(pattern) || /^[A-Za-z]:[\\/]/.test(pattern) || pattern.startsWith("~/") || pattern === "~" || pattern.startsWith(":");
44480
44516
  }
@@ -44611,30 +44647,8 @@ function mapReadAction(action) {
44611
44647
  return action === "allow" ? "read" : "deny";
44612
44648
  }
44613
44649
  function mapWriteAction(action) {
44614
- return action === "allow" ? "write" : "deny";
44615
- }
44616
- /**
44617
- * Merge the canonical read/edit/write category rules into one Codex access
44618
- * level per path pattern (Codex models a single `deny` < `read` < `write`
44619
- * level, with no `ask`).
44620
- *
44621
- * - `edit` and `write` collapse onto Codex's write side; when both carry the
44622
- * same pattern, the more restrictive action wins (`deny` > `ask` > `allow`).
44623
- * - `read: allow` + write-side `allow` → `"write"`.
44624
- * - `read: allow` + write-side non-allow → `"read"` (readable but not
44625
- * writable — exactly what Codex's `"read"` level expresses).
44626
- * - `read` non-allow → `"deny"` regardless of the write side; a contradictory
44627
- * write-side `allow` (unreadable but writable is not expressible in Codex)
44628
- * is warned about.
44629
- * - Single-category patterns keep the existing mapReadAction/mapWriteAction
44630
- * mappings.
44631
- *
44632
- * Iteration order is read → edit → write with first-seen pattern order, so
44633
- * the emitted table is stable regardless of the authored category order.
44634
- * Note the merge is one-way: `"{path}" = "read"` imports back as
44635
- * `read: allow` only (the explicit write-side deny is implied by Codex's
44636
- * access level and not re-materialized).
44637
- */
44650
+ return action === "allow" ? "write" : "read";
44651
+ }
44638
44652
  function mergeFilesystemCategoryRules({ categoryRules, logger }) {
44639
44653
  const readRules = categoryRules.read ?? {};
44640
44654
  const writeSideRestrictiveness = {
@@ -44658,19 +44672,33 @@ function mergeFilesystemCategoryRules({ categoryRules, logger }) {
44658
44672
  const readAction = readRules[pattern];
44659
44673
  const writeAction = writeSideRules[pattern];
44660
44674
  if (readAction === void 0) {
44661
- merged.push([pattern, mapWriteAction(writeAction)]);
44675
+ merged.push({
44676
+ pattern,
44677
+ access: mapWriteAction(writeAction),
44678
+ ...writeAction === "ask" || writeAction === "deny" ? { writeRestriction: writeAction } : {}
44679
+ });
44662
44680
  continue;
44663
44681
  }
44664
44682
  if (writeAction === void 0) {
44665
- merged.push([pattern, mapReadAction(readAction)]);
44683
+ merged.push({
44684
+ pattern,
44685
+ access: mapReadAction(readAction)
44686
+ });
44666
44687
  continue;
44667
44688
  }
44668
44689
  if (readAction === "allow") {
44669
- merged.push([pattern, writeAction === "allow" ? "write" : "read"]);
44690
+ merged.push({
44691
+ pattern,
44692
+ access: writeAction === "allow" ? "write" : "read",
44693
+ ...writeAction === "ask" || writeAction === "deny" ? { writeRestriction: writeAction } : {}
44694
+ });
44670
44695
  continue;
44671
44696
  }
44672
44697
  if (writeAction === "allow") logger?.warn(`Codex CLI cannot express "writable but not readable": pattern "${pattern}" has read: ${readAction} and a write-side allow. Emitting "deny".`);
44673
- merged.push([pattern, "deny"]);
44698
+ merged.push({
44699
+ pattern,
44700
+ access: "deny"
44701
+ });
44674
44702
  }
44675
44703
  return merged;
44676
44704
  }
@@ -82224,4 +82252,4 @@ async function importChecksCore(params) {
82224
82252
  //#endregion
82225
82253
  export { RulesyncCommand as $, toPosixPath as $t, CLAUDECODE_MEMORIES_DIR_NAME as A, RULESYNC_XDG_CONFIG_HOME_DEFAULT_DIR_NAME as An, checkPathTraversal as At, RulesyncSubagent as B, stripControlCharacters as Bn, listDirectoryEntryNames as Bt, COMMANDCODE_DIR as C, RULESYNC_PERMISSIONS_SCHEMA_URL as Cn, withWarnOnceScope as Ct, CODEXCLI_DIR as D, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH as Dn, assertDirectoryIfExists as Dt, CODEXCLI_BASH_RULES_FILE_NAME as E, RULESYNC_SKILLS_RELATIVE_DIR_PATH as En, applyFileMode as Et, caseFoldIdentity as F, formatError as Fn, getFileSize as Ft, RulesyncRuleFrontmatterSchema as G, readFileContentOrNull as Gt, RulesyncSkill as H, stripHiddenCharacters as Hn, listSubdirectoryNames as Ht, groupSpellingsByCaseFoldedIdentity as I, truncateText as In, getHomeDirectory as It, RulesyncIgnore as J, removeFile as Jt, RulesyncPermissions as K, removeDirectory as Kt, AUGMENTCODE_DIR as L, hasDeceptiveHiddenCharacters as Ln, isFileNotFoundError as Lt, CLAUDECODE_SKILLS_DIR_PATH as M, ALL_FEATURES as Mn, directoryExists as Mt, FACTORYDROID_DIR as N, ALL_FEATURES_WITH_WILDCARD as Nn, ensureDir as Nt, CLAUDECODE_DIR as O, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH as On, assertTreeContainsNoSymlinks as Ot, FACTORYDROID_SETTINGS_LOCAL_FILE_NAME as P, DEPRECATED_FEATURE_REPLACEMENTS as Pn, fileExists as Pt, parseJsonc as Q, runWithDirectoryRollback as Qt, AUGMENTCODE_SETTINGS_LOCAL_FILE_NAME as R, hasEnclosingMarkOutsideKeycap as Rn, isFileSystemError as Rt, QWENCODE_LOCAL_RULE_FILE_NAME as S, RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH as Sn, resetRunWarningState as St, ChecksProcessor as T, RULESYNC_RULES_RELATIVE_DIR_PATH as Tn, ErrorCodes as Tt, RulesyncSkillFrontmatterSchema as U, pathEscapesRoot as Ut, RulesyncSubagentFrontmatterSchema as V, stripControlCharactersKeepingLineFeeds as Vn, listFilePathsRecursively as Vt, RulesyncRule as W, readFileContent as Wt, getRulesyncSourceCandidates as X, removeTempDirectory as Xt, RulesyncHooks as Y, removeFileStrict as Yt, resolveRulesyncSourceWritePath as Z, resolvePath as Zt, IgnoreProcessor as _, RULESYNC_IGNORE_RELATIVE_FILE_PATH as _n, JsonLogger as _t, getProcessorRegistryEntry as a, ToolTargetSchema as an, SHARED_USER_MANAGED_CONFIG_PATHS as at, CommandsProcessor as b, RULESYNC_MCP_SCHEMA_URL as bn, warnOnConflictingFlags as bt, RulesProcessor as c, MAX_FILE_SIZE as cn, mergeInputRootConfigs as ct, CODEBUDDY_DIR as d, RULESYNC_COMMANDS_RELATIVE_DIR_PATH as dn, ConfigFileSchema as dt, writeFileBuffer as en, RulesyncCommandFrontmatterSchema as et, CODEBUDDY_LOCAL_RULE_FILE_NAME as f, RULESYNC_CONFIG_RELATIVE_FILE_PATH as fn, GITIGNORE_DESTINATION_KEY as ft, McpProcessor as g, RULESYNC_HOOKS_RELATIVE_FILE_PATH as gn, ConsoleLogger as gt, shortenToWidth as h, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH as hn, findControlCharacter as ht, inspectInputRoots as i, PACKAGING_TOOL_TARGETS as in, loadYaml as it, CLAUDECODE_SETTINGS_LOCAL_FILE_NAME as j, parseCommaSeparatedList as jn, createTempDirectory as jt, CLAUDECODE_LOCAL_RULE_FILE_NAME as k, RULESYNC_USER_CONFIG_DIR_NAME as kn, assertWritablePathInsideRoot as kt, SubagentsProcessor as l, RULESYNC_AIIGNORE_RELATIVE_FILE_PATH as ln, resolveEffectiveInputRoots as lt, displayWidthOf as m, RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH as mn, assertTargetsFeaturesExclusive as mt, formatSourceLoadFailure as n, ALL_TOOL_TARGETS as nn, RulesyncCheckFrontmatterSchema as nt, convertFromTool as o, CURATED_RULES_FEATURE_SUBDIR as on, SKILL_FILE_NAME as ot, ELLIPSIS_WIDTH as p, RULESYNC_CONFIG_SCHEMA_URL as pn, SourceEntrySchema as pt, RulesyncMcp as q, removeDirectoryStrict as qt, generate as r, ALL_TOOL_TARGETS_WITH_WILDCARD as rn, stringifyFrontmatter as rt, isPackagingToolTarget as s, FEATURE_SOURCE_TREE_ENTRIES as sn, ConfigResolver as st, importFromTool as t, writeFileContent as tn, RulesyncCheck as tt, SkillsProcessor as u, RULESYNC_CHECKS_RELATIVE_DIR_PATH as un, CONFLICTING_TARGET_PAIRS as ut, HooksProcessor as v, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH as vn, WarningCollectingLogger as vt, COMMANDCODE_SETTINGS_LOCAL_FILE_NAME as w, RULESYNC_RELATIVE_DIR_PATH as wn, CLIError as wt, QWENCODE_DIR as x, RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH as xn, withFallbackLoggerTarget as xt, CRUSH_LOCAL_RULE_FILE_NAME as y, RULESYNC_MCP_RELATIVE_FILE_PATH as yn, fallbackLogger as yt, getLocalSkillDirNames as z, quoteForLog as zn, isSymlink as zt };
82226
82254
 
82227
- //# sourceMappingURL=import-B2ANxi1V.js.map
82255
+ //# sourceMappingURL=import-CEgvxK12.js.map