rulesync 16.27.0 → 16.28.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.
@@ -22597,6 +22597,66 @@ const DEEPAGENTS_MCP_FILE_NAME = ".mcp.json";
22597
22597
  const DEEPAGENTS_CONFIG_FILE_NAME = "config.toml";
22598
22598
  const DEEPAGENTS_HOOKS_FILE_NAME = "hooks.json";
22599
22599
  //#endregion
22600
+ //#region src/utils/deepagents.ts
22601
+ const DEEPAGENTS_HOME_ENV = "DEEPAGENTS_HOME";
22602
+ /**
22603
+ * The profile root dcode reads when `DEEPAGENTS_HOME` is set, or `undefined`
22604
+ * when the default `~/.deepagents/` applies.
22605
+ *
22606
+ * Upstream captures the variable once at launch and accepts exactly two
22607
+ * spellings: an absolute path, or one beginning with `~/` (expanded against the
22608
+ * launch home). Anything else — a bare `~`, a `~user` form, a relative path —
22609
+ * makes dcode refuse to start, so the same value is rejected here rather than
22610
+ * resolved against the working directory: there is no location such a value
22611
+ * could name that dcode would read.
22612
+ *
22613
+ * @see https://github.com/langchain-ai/deepagents/blob/main/libs/code/deepagents_code/_paths.py
22614
+ */
22615
+ function getDeepagentsHome() {
22616
+ const configured = process.env[DEEPAGENTS_HOME_ENV]?.trim();
22617
+ if (!configured) return void 0;
22618
+ let root;
22619
+ if (configured.startsWith("~/")) root = (0, node_path.resolve)(getHomeDirectory(), configured.slice(2).replace(/^\/+/, ""));
22620
+ else if ((0, node_path.isAbsolute)(configured)) root = (0, node_path.resolve)(configured);
22621
+ else throw new Error(`Invalid ${DEEPAGENTS_HOME_ENV} ${JSON.stringify(configured)}: dcode accepts only an absolute path or a path beginning with "~/", so it would not start with this value. Unset it or point it at an absolute path.`);
22622
+ if (root === (0, node_path.resolve)(getHomeDirectory())) throw new Error(`Invalid ${DEEPAGENTS_HOME_ENV} ${JSON.stringify(configured)}: the home directory itself cannot be a profile, so dcode would not start with this value. Point it at a subdirectory such as "~/.deepagents".`);
22623
+ return root;
22624
+ }
22625
+ /**
22626
+ * Map a canonical `.deepagents/...` path constant onto the directory rulesync
22627
+ * actually writes in the requested scope.
22628
+ *
22629
+ * Project scope keeps the constant as-is (the project tree is `.deepagents/`
22630
+ * everywhere). Global scope without an override keeps it too, under the home
22631
+ * output root. When `DEEPAGENTS_HOME` is set, that directory *is* the profile
22632
+ * root, so the `.deepagents` prefix is stripped: `~/.deepagents/agent/skills`
22633
+ * becomes `$DEEPAGENTS_HOME/agent/skills`.
22634
+ */
22635
+ function getDeepagentsRelativeDirPath({ global, relativeDirPath }) {
22636
+ if (!global || !getDeepagentsHome()) return relativeDirPath;
22637
+ const relativePath = (0, node_path.relative)(DEEPAGENTS_DIR, relativeDirPath);
22638
+ try {
22639
+ checkPathTraversal({
22640
+ relativePath: relativeDirPath,
22641
+ intendedRootDir: "."
22642
+ });
22643
+ checkPathTraversal({
22644
+ relativePath,
22645
+ intendedRootDir: DEEPAGENTS_DIR
22646
+ });
22647
+ } catch {
22648
+ throw new Error(`deepagents global path must be within ${DEEPAGENTS_DIR}: ${relativeDirPath}`);
22649
+ }
22650
+ return relativePath || ".";
22651
+ }
22652
+ function getDeepagentsRulesyncOutputRoot({ nativeOutputRoot, global }) {
22653
+ return getToolRulesyncOutputRoot({
22654
+ nativeOutputRoot,
22655
+ global,
22656
+ toolHome: getDeepagentsHome
22657
+ });
22658
+ }
22659
+ //#endregion
22600
22660
  //#region src/features/hooks/deepagents-hooks.ts
22601
22661
  function isRecord(value) {
22602
22662
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -22711,9 +22771,12 @@ var DeepagentsHooks = class DeepagentsHooks extends ToolHooks {
22711
22771
  isDeletable() {
22712
22772
  return true;
22713
22773
  }
22714
- static getSettablePaths(_options = {}) {
22774
+ static getSettablePaths({ global = false } = {}) {
22715
22775
  return {
22716
- relativeDirPath: DEEPAGENTS_DIR,
22776
+ relativeDirPath: getDeepagentsRelativeDirPath({
22777
+ global,
22778
+ relativeDirPath: DEEPAGENTS_DIR
22779
+ }),
22717
22780
  relativeFilePath: DEEPAGENTS_HOOKS_FILE_NAME
22718
22781
  };
22719
22782
  }
@@ -22725,7 +22788,8 @@ var DeepagentsHooks = class DeepagentsHooks extends ToolHooks {
22725
22788
  relativeDirPath: paths.relativeDirPath,
22726
22789
  relativeFilePath: paths.relativeFilePath,
22727
22790
  fileContent,
22728
- validate
22791
+ validate,
22792
+ global
22729
22793
  });
22730
22794
  }
22731
22795
  static fromRulesyncHooks({ outputRoot = process.cwd(), rulesyncHooks, validate = true, global = false }) {
@@ -22749,10 +22813,16 @@ var DeepagentsHooks = class DeepagentsHooks extends ToolHooks {
22749
22813
  }
22750
22814
  const rawHooks = isRecord(parsed) ? parsed.hooks : void 0;
22751
22815
  const hooks = Array.isArray(rawHooks) ? deepagentsLegacyToCanonicalHooks(rawHooks) : isRecord(rawHooks) ? deepagentsToCanonicalHooks(rawHooks) : {};
22752
- return this.toRulesyncHooksDefault({ fileContent: JSON.stringify(buildImportedHooksConfig({
22753
- hooks,
22754
- overrideKey: "deepagents"
22755
- }), null, 2) });
22816
+ return this.toRulesyncHooksDefault({
22817
+ outputRoot: getDeepagentsRulesyncOutputRoot({
22818
+ nativeOutputRoot: this.outputRoot,
22819
+ global: this.global
22820
+ }),
22821
+ fileContent: JSON.stringify(buildImportedHooksConfig({
22822
+ hooks,
22823
+ overrideKey: "deepagents"
22824
+ }), null, 2)
22825
+ });
22756
22826
  }
22757
22827
  validate() {
22758
22828
  return {
@@ -30100,9 +30170,12 @@ var DeepagentsMcp = class DeepagentsMcp extends ToolMcp {
30100
30170
  isDeletable() {
30101
30171
  return !this.global;
30102
30172
  }
30103
- static getSettablePaths(_options = {}) {
30173
+ static getSettablePaths({ global = false } = {}) {
30104
30174
  return {
30105
- relativeDirPath: DEEPAGENTS_DIR,
30175
+ relativeDirPath: getDeepagentsRelativeDirPath({
30176
+ global,
30177
+ relativeDirPath: DEEPAGENTS_DIR
30178
+ }),
30106
30179
  relativeFilePath: DEEPAGENTS_MCP_FILE_NAME
30107
30180
  };
30108
30181
  }
@@ -30119,7 +30192,8 @@ var DeepagentsMcp = class DeepagentsMcp extends ToolMcp {
30119
30192
  relativeDirPath: paths.relativeDirPath,
30120
30193
  relativeFilePath: paths.relativeFilePath,
30121
30194
  fileContent: JSON.stringify(newJson, null, 2),
30122
- validate
30195
+ validate,
30196
+ global
30123
30197
  });
30124
30198
  }
30125
30199
  static async fromRulesyncMcp({ outputRoot = process.cwd(), rulesyncMcp, validate = true, global = false, logger }) {
@@ -30150,7 +30224,13 @@ var DeepagentsMcp = class DeepagentsMcp extends ToolMcp {
30150
30224
  toRulesyncMcp() {
30151
30225
  const servers = isRecord$1(this.json.mcpServers) ? this.json.mcpServers : {};
30152
30226
  const mcpServers = Object.fromEntries(Object.entries(servers).map(([name, server]) => [name, isRecord$1(server) ? toRulesyncServer(server) : server]));
30153
- return this.toRulesyncMcpDefault({ fileContent: JSON.stringify({ mcpServers }, null, 2) });
30227
+ return this.toRulesyncMcpDefault({
30228
+ outputRoot: getDeepagentsRulesyncOutputRoot({
30229
+ nativeOutputRoot: this.outputRoot,
30230
+ global: this.global
30231
+ }),
30232
+ fileContent: JSON.stringify({ mcpServers }, null, 2)
30233
+ });
30154
30234
  }
30155
30235
  validate() {
30156
30236
  return {
@@ -39979,9 +40059,12 @@ var DeepagentsPermissions = class DeepagentsPermissions extends ToolPermissions
39979
40059
  shouldSkipCreationWhenPayloadEmpty() {
39980
40060
  return true;
39981
40061
  }
39982
- static getSettablePaths(_options) {
40062
+ static getSettablePaths({ global = false } = {}) {
39983
40063
  return {
39984
- relativeDirPath: DEEPAGENTS_DIR,
40064
+ relativeDirPath: getDeepagentsRelativeDirPath({
40065
+ global,
40066
+ relativeDirPath: DEEPAGENTS_DIR
40067
+ }),
39985
40068
  relativeFilePath: DEEPAGENTS_CONFIG_FILE_NAME
39986
40069
  };
39987
40070
  }
@@ -40080,7 +40163,14 @@ var DeepagentsPermissions = class DeepagentsPermissions extends ToolPermissions
40080
40163
  if (Object.keys(startupOverride).length > 0) deepagents.startup = startupOverride;
40081
40164
  if (Object.keys(extensionsOverride).length > 0) deepagents.extensions = extensionsOverride;
40082
40165
  if (Object.keys(deepagents).length > 0) result.deepagents = deepagents;
40083
- return this.toRulesyncPermissionsDefault({ fileContent: JSON.stringify(result, null, 2) });
40166
+ return RulesyncPermissions.fromImportedFileContent({
40167
+ outputRoot: getDeepagentsRulesyncOutputRoot({
40168
+ nativeOutputRoot: this.outputRoot,
40169
+ global: this.global
40170
+ }),
40171
+ sourcePath: this.getRelativePathFromCwd(),
40172
+ fileContent: JSON.stringify(result, null, 2)
40173
+ });
40084
40174
  }
40085
40175
  validate() {
40086
40176
  return {
@@ -51807,7 +51897,10 @@ var DeepagentsSkill = class DeepagentsSkill extends ToolSkill {
51807
51897
  }
51808
51898
  }
51809
51899
  static getSettablePaths({ global = false } = {}) {
51810
- return { relativeDirPath: global ? DEEPAGENTS_GLOBAL_SKILLS_DIR_PATH : DEEPAGENTS_SKILLS_DIR_PATH };
51900
+ return { relativeDirPath: getDeepagentsRelativeDirPath({
51901
+ global,
51902
+ relativeDirPath: global ? DEEPAGENTS_GLOBAL_SKILLS_DIR_PATH : DEEPAGENTS_SKILLS_DIR_PATH
51903
+ }) };
51811
51904
  }
51812
51905
  getFrontmatter() {
51813
51906
  return DeepagentsSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
@@ -51847,7 +51940,10 @@ var DeepagentsSkill = class DeepagentsSkill extends ToolSkill {
51847
51940
  ...Object.keys(deepagentsBlock).length > 0 && { deepagents: deepagentsBlock }
51848
51941
  };
51849
51942
  return new RulesyncSkill({
51850
- outputRoot: this.outputRoot,
51943
+ outputRoot: getDeepagentsRulesyncOutputRoot({
51944
+ nativeOutputRoot: this.outputRoot,
51945
+ global: this.global
51946
+ }),
51851
51947
  relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
51852
51948
  dirName: this.getDirName(),
51853
51949
  frontmatter: rulesyncFrontmatter,
@@ -57942,7 +58038,10 @@ var DeepagentsSubagent = class DeepagentsSubagent extends ToolSubagent {
57942
58038
  this.body = body;
57943
58039
  }
57944
58040
  static getSettablePaths({ global = false } = {}) {
57945
- return { relativeDirPath: global ? DEEPAGENTS_GLOBAL_AGENTS_DIR_PATH : DEEPAGENTS_AGENTS_DIR_PATH };
58041
+ return { relativeDirPath: getDeepagentsRelativeDirPath({
58042
+ global,
58043
+ relativeDirPath: global ? DEEPAGENTS_GLOBAL_AGENTS_DIR_PATH : DEEPAGENTS_AGENTS_DIR_PATH
58044
+ }) };
57946
58045
  }
57947
58046
  getFrontmatter() {
57948
58047
  return this.frontmatter;
@@ -57961,7 +58060,10 @@ var DeepagentsSubagent = class DeepagentsSubagent extends ToolSubagent {
57961
58060
  ...Object.keys(deepagentsSection).length > 0 && { deepagents: deepagentsSection }
57962
58061
  };
57963
58062
  return new RulesyncSubagent({
57964
- outputRoot: this.getOutputRoot(),
58063
+ outputRoot: getDeepagentsRulesyncOutputRoot({
58064
+ nativeOutputRoot: this.getOutputRoot(),
58065
+ global: this.global
58066
+ }),
57965
58067
  frontmatter: rulesyncFrontmatter,
57966
58068
  body: this.body,
57967
58069
  relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
@@ -58004,7 +58106,8 @@ var DeepagentsSubagent = class DeepagentsSubagent extends ToolSubagent {
58004
58106
  relativeDirPath: paths.relativeDirPath,
58005
58107
  relativeFilePath: (0, node_path.join)(subagentName, DEEPAGENTS_SUBAGENT_FILE_NAME),
58006
58108
  fileContent,
58007
- validate
58109
+ validate,
58110
+ global
58008
58111
  });
58009
58112
  }
58010
58113
  validate() {
@@ -58042,7 +58145,8 @@ var DeepagentsSubagent = class DeepagentsSubagent extends ToolSubagent {
58042
58145
  frontmatter: result.data,
58043
58146
  body: content.trim(),
58044
58147
  fileContent,
58045
- validate
58148
+ validate,
58149
+ global
58046
58150
  });
58047
58151
  }
58048
58152
  static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath }) {
@@ -64048,7 +64152,10 @@ var DeepagentsRule = class DeepagentsRule extends ToolRule {
64048
64152
  }
64049
64153
  static getSettablePaths({ global = false } = {}) {
64050
64154
  return { root: {
64051
- relativeDirPath: global ? DEEPAGENTS_GLOBAL_DIR : DEEPAGENTS_DIR,
64155
+ relativeDirPath: getDeepagentsRelativeDirPath({
64156
+ global,
64157
+ relativeDirPath: global ? DEEPAGENTS_GLOBAL_DIR : DEEPAGENTS_DIR
64158
+ }),
64052
64159
  relativeFilePath: DEEPAGENTS_RULE_FILE_NAME
64053
64160
  } };
64054
64161
  }
@@ -64062,17 +64169,19 @@ var DeepagentsRule = class DeepagentsRule extends ToolRule {
64062
64169
  relativeFilePath: settablePaths.root.relativeFilePath,
64063
64170
  fileContent,
64064
64171
  validate,
64065
- root: true
64172
+ root: true,
64173
+ global
64066
64174
  });
64067
64175
  }
64068
- static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath }) {
64176
+ static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath, global = false }) {
64177
+ const isRoot = relativeFilePath === "AGENTS.md" && relativeDirPath === this.getSettablePaths({ global }).root.relativeDirPath;
64069
64178
  return new DeepagentsRule({
64070
64179
  outputRoot,
64071
64180
  relativeDirPath,
64072
64181
  relativeFilePath,
64073
64182
  fileContent: "",
64074
64183
  validate: false,
64075
- root: relativeFilePath === "AGENTS.md" && (relativeDirPath === ".deepagents" || relativeDirPath === DEEPAGENTS_GLOBAL_DIR)
64184
+ root: isRoot
64076
64185
  });
64077
64186
  }
64078
64187
  static fromRulesyncRule({ outputRoot = process.cwd(), rulesyncRule, validate = true, global = false }) {
@@ -68649,12 +68758,13 @@ async function assertPluginRootSafe(params) {
68649
68758
  //#region src/utils/tool-output-root.ts
68650
68759
  /** The environment variable each tool reads for its profile root. */
68651
68760
  const TOOL_HOME_ENV_VARS = {
68761
+ deepagents: "DEEPAGENTS_HOME",
68652
68762
  hermesagent: "HERMES_HOME",
68653
68763
  "kimi-code": "KIMI_CODE_HOME"
68654
68764
  };
68655
68765
  /**
68656
- * Substitute a tool's home override (`HERMES_HOME`, `KIMI_CODE_HOME`) for the
68657
- * output root in global scope.
68766
+ * Substitute a tool's home override (`DEEPAGENTS_HOME`, `HERMES_HOME`,
68767
+ * `KIMI_CODE_HOME`) for the output root in global scope.
68658
68768
  *
68659
68769
  * The override wins over `--output-roots`: it names where the tool itself reads
68660
68770
  * its profile, so writing anywhere else would produce files the tool ignores.
@@ -68669,7 +68779,7 @@ function resolveToolOutputRoot({ outputRoot, toolTarget, global }) {
68669
68779
  const resolved = toolTarget === "hermesagent" ? resolveHermesagentOutputRoot({
68670
68780
  outputRoot,
68671
68781
  global
68672
- }) : toolTarget === "kimi-code" ? getKimiCodeHome() ?? outputRoot : outputRoot;
68782
+ }) : toolTarget === "kimi-code" ? getKimiCodeHome() ?? outputRoot : toolTarget === "deepagents" ? getDeepagentsHome() ?? outputRoot : outputRoot;
68673
68783
  if (resolved === outputRoot) return resolved;
68674
68784
  try {
68675
68785
  validateOutputRoot(resolved);
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_import = require("./import-Bbf86XlG.cjs");
2
+ const require_import = require("./import-hiWvR9cE.cjs");
3
3
  //#region src/index.ts
4
4
  async function generate(options = {}) {
5
5
  const { silent = true, verbose = false, ...rest } = options;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $t as ALL_TOOL_TARGETS, Nn as ALL_FEATURES, at as ConfigResolver, i as inspectInputRoots, o as convertFromTool$1, pt as ConsoleLogger, r as generate$1, t as importFromTool$1 } from "./import-B4xSMKr-.js";
1
+ import { $t as ALL_TOOL_TARGETS, Nn as ALL_FEATURES, at as ConfigResolver, i as inspectInputRoots, o as convertFromTool$1, pt as ConsoleLogger, r as generate$1, t as importFromTool$1 } from "./import-CwS7XtJP.js";
2
2
  //#region src/index.ts
3
3
  async function generate(options = {}) {
4
4
  const { silent = true, verbose = false, ...rest } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "16.27.0",
3
+ "version": "16.28.0",
4
4
  "description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
5
5
  "keywords": [
6
6
  "ai",
@@ -48,16 +48,16 @@
48
48
  "pre-commit": "pnpm exec lint-staged"
49
49
  },
50
50
  "dependencies": {
51
- "@inquirer/checkbox": "5.2.4",
51
+ "@inquirer/checkbox": "5.2.5",
52
52
  "@modelcontextprotocol/sdk": "1.30.0",
53
53
  "@octokit/request-error": "7.1.2",
54
54
  "@octokit/rest": "22.0.1",
55
55
  "@toon-format/toon": "4.1.1",
56
56
  "@valibot/to-json-schema": "1.7.1",
57
57
  "commander": "15.0.0",
58
- "effect": "3.22.1",
58
+ "effect": "3.22.2",
59
59
  "es-toolkit": "1.52.0",
60
- "fastmcp": "4.20.0",
60
+ "fastmcp": "4.20.9",
61
61
  "globby": "16.2.4",
62
62
  "gray-matter": "4.0.3",
63
63
  "js-yaml": "5.4.1",
@@ -65,23 +65,23 @@
65
65
  "minisearch": "7.2.0",
66
66
  "smol-toml": "1.8.0",
67
67
  "sury": "10.0.4",
68
- "zod": "4.5.4"
68
+ "zod": "4.6.1"
69
69
  },
70
70
  "devDependencies": {
71
- "@anthropic-ai/claude-agent-sdk": "0.3.260",
72
- "@openrouter/sdk": "1.2.103",
71
+ "@anthropic-ai/claude-agent-sdk": "0.3.267",
72
+ "@openrouter/sdk": "1.2.116",
73
73
  "@secretlint/secretlint-rule-preset-recommend": "13.0.5",
74
74
  "@tsconfig/node24": "24.0.5",
75
- "@types/node": "26.4.1",
75
+ "@types/node": "26.5.1",
76
76
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
77
77
  "@vitest/coverage-v8": "5.0.0",
78
- "cspell": "10.2.1",
79
- "knip": "6.34.0",
80
- "lint-staged": "17.4.1",
81
- "oxfmt": "0.66.0",
82
- "oxlint": "1.81.0",
78
+ "cspell": "10.3.0",
79
+ "knip": "6.35.1",
80
+ "lint-staged": "17.5.0",
81
+ "oxfmt": "0.67.0",
82
+ "oxlint": "1.82.0",
83
83
  "repomix": "1.18.0",
84
- "resend": "6.26.0",
84
+ "resend": "6.27.0",
85
85
  "secretlint": "13.0.5",
86
86
  "simple-git": "3.36.0",
87
87
  "simple-git-hooks": "2.14.0",