rulesync 7.18.2 → 7.20.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/index.cjs CHANGED
@@ -88,69 +88,71 @@ var import_node_path2 = require("path");
88
88
  var import_es_toolkit = require("es-toolkit");
89
89
  var import_globby = require("globby");
90
90
 
91
- // src/utils/logger.ts
92
- var import_consola = require("consola");
93
-
94
91
  // src/utils/vitest.ts
95
92
  function isEnvTest() {
96
93
  return process.env.NODE_ENV === "test";
97
94
  }
98
95
 
99
96
  // src/utils/logger.ts
100
- var Logger = class {
97
+ var BaseLogger = class {
101
98
  _verbose = false;
102
99
  _silent = false;
103
- console = import_consola.consola.withDefaults({
104
- tag: "rulesync"
105
- });
106
- /**
107
- * Configure logger with verbose and silent mode settings.
108
- * Handles conflicting flags where silent takes precedence.
109
- * @param verbose - Enable verbose logging
110
- * @param silent - Enable silent mode (suppresses all output except errors)
111
- */
100
+ get verbose() {
101
+ return this._verbose;
102
+ }
103
+ get silent() {
104
+ return this._silent;
105
+ }
112
106
  configure({ verbose, silent }) {
113
107
  if (verbose && silent) {
114
108
  this._silent = false;
115
- this.warn("Both --verbose and --silent specified; --silent takes precedence");
109
+ if (!isEnvTest()) {
110
+ console.warn("Both --verbose and --silent specified; --silent takes precedence");
111
+ }
116
112
  }
117
113
  this._silent = silent;
118
114
  this._verbose = verbose && !silent;
119
115
  }
120
- get verbose() {
121
- return this._verbose;
116
+ };
117
+ var ConsoleLogger = class extends BaseLogger {
118
+ isSuppressed() {
119
+ return isEnvTest() || this._silent;
122
120
  }
123
- get silent() {
124
- return this._silent;
121
+ get jsonMode() {
122
+ return false;
123
+ }
124
+ captureData(_key, _value) {
125
+ }
126
+ getJsonData() {
127
+ return {};
128
+ }
129
+ outputJson(_success, _error) {
125
130
  }
126
131
  info(message, ...args) {
127
- if (isEnvTest() || this._silent) return;
128
- this.console.info(message, ...args);
132
+ if (this.isSuppressed()) return;
133
+ console.log(message, ...args);
129
134
  }
130
- // Success (always shown unless silent)
131
135
  success(message, ...args) {
132
- if (isEnvTest() || this._silent) return;
133
- this.console.success(message, ...args);
136
+ if (this.isSuppressed()) return;
137
+ console.log(message, ...args);
134
138
  }
135
- // Warning (always shown unless silent)
136
139
  warn(message, ...args) {
137
- if (isEnvTest() || this._silent) return;
138
- this.console.warn(message, ...args);
140
+ if (this.isSuppressed()) return;
141
+ console.warn(message, ...args);
139
142
  }
140
- // Error (always shown, even in silent mode)
141
- error(message, ...args) {
143
+ error(message, _code, ...args) {
142
144
  if (isEnvTest()) return;
143
- this.console.error(message, ...args);
145
+ const errorMessage = message instanceof Error ? message.message : message;
146
+ console.error(errorMessage, ...args);
144
147
  }
145
- // Debug level (shown only in verbose mode)
146
148
  debug(message, ...args) {
147
- if (isEnvTest() || this._silent) return;
149
+ if (this.isSuppressed()) return;
148
150
  if (this._verbose) {
149
- this.console.info(message, ...args);
151
+ console.log(message, ...args);
150
152
  }
151
153
  }
152
154
  };
153
- var logger = new Logger();
155
+ var logger = new ConsoleLogger();
154
156
 
155
157
  // src/utils/file.ts
156
158
  async function ensureDir(dirPath) {
@@ -3312,7 +3314,9 @@ var CLAUDE_HOOK_EVENTS = [
3312
3314
  "preCompact",
3313
3315
  "permissionRequest",
3314
3316
  "notification",
3315
- "setup"
3317
+ "setup",
3318
+ "worktreeCreate",
3319
+ "worktreeRemove"
3316
3320
  ];
3317
3321
  var OPENCODE_HOOK_EVENTS = [
3318
3322
  "sessionStart",
@@ -3379,7 +3383,9 @@ var CANONICAL_TO_CLAUDE_EVENT_NAMES = {
3379
3383
  preCompact: "PreCompact",
3380
3384
  permissionRequest: "PermissionRequest",
3381
3385
  notification: "Notification",
3382
- setup: "Setup"
3386
+ setup: "Setup",
3387
+ worktreeCreate: "WorktreeCreate",
3388
+ worktreeRemove: "WorktreeRemove"
3383
3389
  };
3384
3390
  var CLAUDE_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
3385
3391
  Object.entries(CANONICAL_TO_CLAUDE_EVENT_NAMES).map(([k, v]) => [v, k])
@@ -3505,7 +3511,13 @@ function canonicalToToolHooks({
3505
3511
  else byMatcher.set(key, [def]);
3506
3512
  }
3507
3513
  const entries = [];
3514
+ const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
3508
3515
  for (const [matcherKey, defs] of byMatcher) {
3516
+ if (isNoMatcherEvent && matcherKey) {
3517
+ logger.warn(
3518
+ `matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
3519
+ );
3520
+ }
3509
3521
  const hooks = defs.map((def) => {
3510
3522
  const commandText = def.command;
3511
3523
  const trimmedCommand = typeof commandText === "string" ? commandText.trimStart() : void 0;
@@ -3518,7 +3530,8 @@ function canonicalToToolHooks({
3518
3530
  ...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt }
3519
3531
  };
3520
3532
  });
3521
- entries.push(matcherKey ? { matcher: matcherKey, hooks } : { hooks });
3533
+ const includeMatcher = matcherKey && !isNoMatcherEvent;
3534
+ entries.push(includeMatcher ? { matcher: matcherKey, hooks } : { hooks });
3522
3535
  }
3523
3536
  result[toolEventName] = entries;
3524
3537
  }
@@ -3656,12 +3669,14 @@ var ToolHooks = class extends ToolFile {
3656
3669
  };
3657
3670
 
3658
3671
  // src/features/hooks/claudecode-hooks.ts
3672
+ var CLAUDE_NO_MATCHER_EVENTS = /* @__PURE__ */ new Set(["worktreeCreate", "worktreeRemove"]);
3659
3673
  var CLAUDE_CONVERTER_CONFIG = {
3660
3674
  supportedEvents: CLAUDE_HOOK_EVENTS,
3661
3675
  canonicalToToolEventNames: CANONICAL_TO_CLAUDE_EVENT_NAMES,
3662
3676
  toolToCanonicalEventNames: CLAUDE_TO_CANONICAL_EVENT_NAMES,
3663
3677
  projectDirVar: "$CLAUDE_PROJECT_DIR",
3664
- prefixDotRelativeCommandsOnly: true
3678
+ prefixDotRelativeCommandsOnly: true,
3679
+ noMatcherEvents: CLAUDE_NO_MATCHER_EVENTS
3665
3680
  };
3666
3681
  var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
3667
3682
  constructor(params) {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  generate,
7
7
  importFromTool,
8
8
  logger
9
- } from "./chunk-JP3BFD7L.js";
9
+ } from "./chunk-5OPNV62F.js";
10
10
 
11
11
  // src/index.ts
12
12
  async function generate2(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "7.18.2",
3
+ "version": "7.20.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",
@@ -54,7 +54,6 @@
54
54
  "@toon-format/toon": "2.1.0",
55
55
  "@valibot/to-json-schema": "1.5.0",
56
56
  "commander": "14.0.3",
57
- "consola": "3.4.2",
58
57
  "effect": "3.19.19",
59
58
  "es-toolkit": "1.45.1",
60
59
  "fastmcp": "3.34.0",
@@ -115,7 +114,7 @@
115
114
  "dev": "tsx src/cli/index.ts",
116
115
  "docs:build": "vitepress build docs",
117
116
  "docs:dev": "vitepress dev docs",
118
- "docs:preview": "vitepress serve docs",
117
+ "docs:preview": "vitepress preview docs",
119
118
  "eslint": "eslint . --max-warnings 0 --cache",
120
119
  "eslint:fix": "eslint . --fix --max-warnings 0 --cache",
121
120
  "fix": "pnpm run fmt && pnpm run oxlint:fix && pnpm run eslint:fix",