@jeremyy_prt/cc-config 1.1.1 → 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.
- package/cli.js +72 -55
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -91,79 +91,96 @@ function mergeSettings() {
|
|
|
91
91
|
function installShellAliases() {
|
|
92
92
|
const isWindows = process.platform === 'win32';
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
// Find existing profile or use first path
|
|
105
|
-
let profilePath = possiblePaths.find(p => fs.existsSync(p)) || possiblePaths[0];
|
|
106
|
-
|
|
107
|
-
// Create profile directory if it doesn't exist
|
|
108
|
-
const profileDir = path.dirname(profilePath);
|
|
109
|
-
if (!fs.existsSync(profileDir)) {
|
|
110
|
-
fs.mkdirSync(profileDir, { recursive: true });
|
|
111
|
-
}
|
|
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
|
+
];
|
|
112
102
|
|
|
113
|
-
|
|
103
|
+
const aliases = `
|
|
114
104
|
# Claude Code aliases
|
|
115
105
|
function cc { claude --dangerously-skip-permissions @args }
|
|
116
106
|
function ccc { claude --dangerously-skip-permissions -c @args }
|
|
117
107
|
`;
|
|
118
108
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
+
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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}`);
|
|
131
144
|
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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 = `
|
|
141
161
|
# Claude Code aliases
|
|
142
162
|
alias cc='claude --dangerously-skip-permissions'
|
|
143
163
|
alias ccc='claude --dangerously-skip-permissions -c'
|
|
144
164
|
`;
|
|
145
165
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
166
|
+
let installed = false;
|
|
167
|
+
for (const shellFile of shellFiles) {
|
|
168
|
+
if (fs.existsSync(shellFile)) {
|
|
169
|
+
let content = fs.readFileSync(shellFile, 'utf8');
|
|
150
170
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
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;
|
|
156
175
|
}
|
|
157
176
|
}
|
|
177
|
+
}
|
|
158
178
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
179
|
+
if (installed) {
|
|
180
|
+
console.log(' → Redémarre ton terminal pour les activer');
|
|
181
|
+
} else {
|
|
182
|
+
console.log(' ✓ Alias déjà installés');
|
|
164
183
|
}
|
|
165
|
-
} catch (error) {
|
|
166
|
-
console.log(' ⚠️ Impossible d\'installer les alias');
|
|
167
184
|
}
|
|
168
185
|
}
|
|
169
186
|
|