@jeremyy_prt/cc-config 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/cli.js +72 -54
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -91,78 +91,96 @@ function mergeSettings() {
91
91
  function installShellAliases() {
92
92
  const isWindows = process.platform === 'win32';
93
93
 
94
- try {
95
- console.log('🔧 Installation des alias shell...');
96
-
97
- if (isWindows) {
98
- // PowerShell profile
99
- const profilePath = path.join(
100
- process.env.USERPROFILE,
101
- 'Documents',
102
- 'PowerShell',
103
- 'Microsoft.PowerShell_profile.ps1'
104
- );
105
-
106
- // Create profile directory if it doesn't exist
107
- const profileDir = path.dirname(profilePath);
108
- if (!fs.existsSync(profileDir)) {
109
- fs.mkdirSync(profileDir, { recursive: true });
110
- }
94
+ console.log('🔧 Installation des alias shell...');
95
+
96
+ if (isWindows) {
97
+ // PowerShell profiles - install in both locations
98
+ const profilePaths = [
99
+ path.join(process.env.USERPROFILE, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'), // PowerShell 5.1
100
+ path.join(process.env.USERPROFILE, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1') // PowerShell 7+
101
+ ];
111
102
 
112
- const aliases = `
103
+ const aliases = `
113
104
  # Claude Code aliases
114
105
  function cc { claude --dangerously-skip-permissions @args }
115
106
  function ccc { claude --dangerously-skip-permissions -c @args }
116
107
  `;
117
108
 
118
- // Check if aliases already exist
119
- let content = '';
120
- if (fs.existsSync(profilePath)) {
121
- content = fs.readFileSync(profilePath, 'utf8');
122
- }
109
+ let installed = false;
110
+ let alreadyExists = false;
111
+
112
+ for (const profilePath of profilePaths) {
113
+ try {
114
+ const profileDir = path.dirname(profilePath);
115
+ const profileName = path.basename(path.dirname(profilePath));
116
+
117
+ // Create profile directory if it doesn't exist
118
+ if (!fs.existsSync(profileDir)) {
119
+ fs.mkdirSync(profileDir, { recursive: true });
120
+ console.log(` 📁 Dossier créé: ${profileName}`);
121
+ }
122
+
123
+ // Check if aliases already exist
124
+ let content = '';
125
+ if (fs.existsSync(profilePath)) {
126
+ content = fs.readFileSync(profilePath, 'utf8');
127
+ }
123
128
 
124
- if (!content.includes('Claude Code aliases')) {
125
- fs.appendFileSync(profilePath, aliases);
126
- console.log(' ✓ Alias PowerShell installés (cc, ccc)');
127
- console.log(' → Redémarre PowerShell pour les activer');
128
- } else {
129
- console.log(' ✓ Alias déjà installés');
129
+ if (!content.includes('Claude Code aliases')) {
130
+ fs.appendFileSync(profilePath, aliases);
131
+
132
+ // Verify it was written
133
+ if (fs.existsSync(profilePath)) {
134
+ console.log(` ✓ Alias installés dans ${profileName}`);
135
+ installed = true;
136
+ } else {
137
+ console.log(` ⚠️ Échec création profil ${profileName}`);
138
+ }
139
+ } else {
140
+ alreadyExists = true;
141
+ }
142
+ } catch (error) {
143
+ console.log(` ⚠️ Erreur ${path.basename(path.dirname(profilePath))}: ${error.message}`);
130
144
  }
131
- } else {
132
- // Unix-like (Mac/Linux)
133
- const homeDir = os.homedir();
134
- const shellFiles = [
135
- path.join(homeDir, '.zshrc'),
136
- path.join(homeDir, '.bashrc')
137
- ];
138
-
139
- const aliases = `
145
+ }
146
+
147
+ if (installed) {
148
+ console.log(' → Redémarre PowerShell pour les activer');
149
+ } else if (alreadyExists) {
150
+ console.log(' ✓ Alias déjà présents');
151
+ }
152
+ } else {
153
+ // Unix-like (Mac/Linux)
154
+ const homeDir = os.homedir();
155
+ const shellFiles = [
156
+ path.join(homeDir, '.zshrc'),
157
+ path.join(homeDir, '.bashrc')
158
+ ];
159
+
160
+ const aliases = `
140
161
  # Claude Code aliases
141
162
  alias cc='claude --dangerously-skip-permissions'
142
163
  alias ccc='claude --dangerously-skip-permissions -c'
143
164
  `;
144
165
 
145
- let installed = false;
146
- for (const shellFile of shellFiles) {
147
- if (fs.existsSync(shellFile)) {
148
- let content = fs.readFileSync(shellFile, 'utf8');
166
+ let installed = false;
167
+ for (const shellFile of shellFiles) {
168
+ if (fs.existsSync(shellFile)) {
169
+ let content = fs.readFileSync(shellFile, 'utf8');
149
170
 
150
- if (!content.includes('Claude Code aliases')) {
151
- fs.appendFileSync(shellFile, aliases);
152
- console.log(` ✓ Alias installés dans ${path.basename(shellFile)}`);
153
- installed = true;
154
- }
171
+ if (!content.includes('Claude Code aliases')) {
172
+ fs.appendFileSync(shellFile, aliases);
173
+ console.log(` ✓ Alias installés dans ${path.basename(shellFile)}`);
174
+ installed = true;
155
175
  }
156
176
  }
177
+ }
157
178
 
158
- if (installed) {
159
- console.log(' → Redémarre ton terminal pour les activer');
160
- } else {
161
- console.log(' ✓ Alias déjà installés');
162
- }
179
+ if (installed) {
180
+ console.log(' → Redémarre ton terminal pour les activer');
181
+ } else {
182
+ console.log(' ✓ Alias déjà installés');
163
183
  }
164
- } catch (error) {
165
- console.log(' ⚠️ Impossible d\'installer les alias');
166
184
  }
167
185
  }
168
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeremyy_prt/cc-config",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Configuration personnalisée pour Claude Code avec commandes et agents en français",
5
5
  "main": "index.js",
6
6
  "bin": {