@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.
- package/cli.js +72 -54
- 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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
|