@jeremyy_prt/cc-config 1.1.9 → 1.2.1

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/cli.js CHANGED
@@ -76,16 +76,13 @@ function mergeSettings() {
76
76
 
77
77
  console.log('⚙️ Configuration des settings...');
78
78
 
79
- // Lire et adapter le settings.json selon la plateforme
79
+ // Lire le settings.json et remplacer les variables
80
80
  let settingsContent = fs.readFileSync(srcSettings, 'utf-8');
81
81
 
82
- // Remplacer le wrapper selon la plateforme
83
- const isWindows = process.platform === 'win32';
84
- const wrapperFile = isWindows ? 'statusline-wrapper.cmd' : 'statusline-wrapper.sh';
85
- settingsContent = settingsContent.replace(
86
- /statusline-wrapper\.(cmd|sh)/g,
87
- wrapperFile
88
- );
82
+ // Remplacer ${CLAUDE_CONFIG_DIR} par le chemin absolu
83
+ // Utiliser des forward slashes (compatible Windows et Unix)
84
+ const claudeDir = CLAUDE_DIR.replace(/\\/g, '/');
85
+ settingsContent = settingsContent.replace(/\$\{CLAUDE_CONFIG_DIR\}/g, claudeDir);
89
86
 
90
87
  if (fs.existsSync(destSettings)) {
91
88
  console.log(' ⚠️ settings.json existe déjà');
@@ -14,13 +14,13 @@ Tu es un assistant qui liste les commandes et agents disponibles avec leurs exem
14
14
  - Mode exemples: liste + exemples d'utilisation
15
15
 
16
16
  2. **LISTER LES COMMANDES** :
17
- - Utiliser `Glob` avec le pattern `*.md` dans `/Users/jeremy/.claude/commands/`
17
+ - Utiliser `Glob` avec le pattern `*.md` dans `~/.claude/commands/`
18
18
  - Pour chaque fichier, utiliser `Read` pour lire le frontmatter YAML et le contenu
19
19
  - Extraire la description entre les `---`
20
20
  - Si mode exemples: extraire aussi les exemples du contenu
21
21
 
22
22
  3. **LISTER LES AGENTS** :
23
- - Utiliser `Glob` avec le pattern `*.md` dans `/Users/jeremy/.claude/agents/`
23
+ - Utiliser `Glob` avec le pattern `*.md` dans `~/.claude/agents/`
24
24
  - Pour chaque fichier, utiliser `Read` pour lire le frontmatter YAML et le contenu
25
25
  - Extraire le `name` et `description` entre les `---`
26
26
  - Si mode exemples: créer des exemples basés sur la description
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeremyy_prt/cc-config",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "description": "Configuration personnalisée pour Claude Code avec commandes et agents en français",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -71,7 +71,7 @@ Update your `~/.claude/settings.json`:
71
71
  {
72
72
  "statusLine": {
73
73
  "type": "command",
74
- "command": "bun /Users/melvynx/.claude/scripts/statusline/src/index.ts",
74
+ "command": "${CLAUDE_CONFIG_DIR}/scripts/statusline-wrapper.sh",
75
75
  "padding": 0
76
76
  }
77
77
  }
@@ -1,3 +1,3 @@
1
1
  Important :
2
2
 
3
- This folder only include command that we can run using `/Users/melvynx/.claude/scripts/statusline/package.json` commands. Please don't write anything else here.
3
+ This folder only includes commands that can be run using `~/.claude/scripts/statusline/package.json` commands. Please don't write anything else here.
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { formatCost, formatDuration } from "../lib/formatters";
4
4
  import {
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
 
3
3
  import { formatCost, formatDuration } from "../lib/formatters";
4
4
  import {
@@ -1,4 +1,8 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
2
6
 
3
7
  /**
4
8
  * Claude Code "Before Tools" Hook - Command Validation Script
@@ -7,7 +11,7 @@
7
11
  * It receives command data via stdin and returns exit code 0 (allow) or 1 (block).
8
12
  *
9
13
  * Usage: Called automatically by Claude Code PreToolUse hook
10
- * Manual test: echo '{"tool_name":"Bash","tool_input":{"command":"rm -rf /"}}' | bun validate-command.js
14
+ * Manual test: echo '{"tool_name":"Bash","tool_input":{"command":"rm -rf /"}}' | node validate-command.js
11
15
  */
12
16
 
13
17
  // Comprehensive dangerous command patterns database
@@ -161,10 +165,10 @@ const SECURITY_RULES = {
161
165
 
162
166
  // Safe paths where rm -rf is allowed
163
167
  SAFE_RM_PATHS: [
164
- "/Users/melvynx/Developer/",
165
168
  "/tmp/",
166
169
  "/var/tmp/",
167
170
  process.cwd() + "/", // Current working directory
171
+ // User's home directory subdirectories are checked dynamically
168
172
  ],
169
173
  };
170
174
 
@@ -205,7 +209,8 @@ const SAFE_COMMANDS = [
205
209
 
206
210
  class CommandValidator {
207
211
  constructor() {
208
- this.logFile = "/Users/melvynx/.claude/security.log";
212
+ const homeDir = os.homedir();
213
+ this.logFile = path.join(homeDir, '.claude', 'security.log');
209
214
  }
210
215
 
211
216
  /**
@@ -533,7 +538,7 @@ class CommandValidator {
533
538
  /**
534
539
  * Log security events
535
540
  */
536
- async logSecurityEvent(command, toolName, result, sessionId = null) {
541
+ logSecurityEvent(command, toolName, result, sessionId = null) {
537
542
  const timestamp = new Date().toISOString();
538
543
  const logEntry = {
539
544
  timestamp,
@@ -549,7 +554,15 @@ class CommandValidator {
549
554
  try {
550
555
  // Write to log file
551
556
  const logLine = JSON.stringify(logEntry) + "\n";
552
- await Bun.write(this.logFile, logLine, { createPath: true, flag: "a" });
557
+
558
+ // Create directory if it doesn't exist
559
+ const logDir = path.dirname(this.logFile);
560
+ if (!fs.existsSync(logDir)) {
561
+ fs.mkdirSync(logDir, { recursive: true });
562
+ }
563
+
564
+ // Append to log file
565
+ fs.appendFileSync(this.logFile, logLine, 'utf8');
553
566
 
554
567
  // Also output to stderr for immediate visibility
555
568
  console.error(
@@ -668,7 +681,7 @@ async function main() {
668
681
  const result = validator.validate(command, toolName);
669
682
 
670
683
  // Log the security event
671
- await validator.logSecurityEvent(command, toolName, result, sessionId);
684
+ validator.logSecurityEvent(command, toolName, result, sessionId);
672
685
 
673
686
  // Output result and exit with appropriate code
674
687
  if (result.isValid) {
@@ -60,7 +60,7 @@ The system is already installed and active in your Claude Code configuration:
60
60
  "hooks": [
61
61
  {
62
62
  "type": "command",
63
- "command": "bun /Users/melvynx/.claude/validate-command.js"
63
+ "command": "node ${CLAUDE_CONFIG_DIR}/scripts/validate-command.js"
64
64
  }
65
65
  ]
66
66
  }
package/settings.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "statusLine": {
16
16
  "type": "command",
17
- "command": "${CLAUDE_CONFIG_DIR}/scripts/statusline-wrapper.cmd",
17
+ "command": "npx tsx ${CLAUDE_CONFIG_DIR}/scripts/statusline/src/index.ts",
18
18
  "padding": 0
19
19
  }
20
20
  }