@jeremyy_prt/cc-config 1.0.3 → 1.1.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 +82 -0
- package/package.json +1 -1
- package/settings.json +2 -24
package/cli.js
CHANGED
|
@@ -88,6 +88,85 @@ function mergeSettings() {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
function installShellAliases() {
|
|
92
|
+
const isWindows = process.platform === 'win32';
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
console.log('🔧 Installation des alias shell...');
|
|
96
|
+
|
|
97
|
+
if (isWindows) {
|
|
98
|
+
// PowerShell profile - try both locations
|
|
99
|
+
const possiblePaths = [
|
|
100
|
+
path.join(process.env.USERPROFILE, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
|
|
101
|
+
path.join(process.env.USERPROFILE, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1')
|
|
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
|
+
}
|
|
112
|
+
|
|
113
|
+
const aliases = `
|
|
114
|
+
# Claude Code aliases
|
|
115
|
+
function cc { claude --dangerously-skip-permissions @args }
|
|
116
|
+
function ccc { claude --dangerously-skip-permissions -c @args }
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
// Check if aliases already exist
|
|
120
|
+
let content = '';
|
|
121
|
+
if (fs.existsSync(profilePath)) {
|
|
122
|
+
content = fs.readFileSync(profilePath, 'utf8');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!content.includes('Claude Code aliases')) {
|
|
126
|
+
fs.appendFileSync(profilePath, aliases);
|
|
127
|
+
console.log(` ✓ Alias PowerShell installés dans ${path.basename(profilePath)}`);
|
|
128
|
+
console.log(' → Redémarre PowerShell pour les activer');
|
|
129
|
+
} else {
|
|
130
|
+
console.log(` ✓ Alias déjà présents dans ${path.basename(profilePath)}`);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
// Unix-like (Mac/Linux)
|
|
134
|
+
const homeDir = os.homedir();
|
|
135
|
+
const shellFiles = [
|
|
136
|
+
path.join(homeDir, '.zshrc'),
|
|
137
|
+
path.join(homeDir, '.bashrc')
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const aliases = `
|
|
141
|
+
# Claude Code aliases
|
|
142
|
+
alias cc='claude --dangerously-skip-permissions'
|
|
143
|
+
alias ccc='claude --dangerously-skip-permissions -c'
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
let installed = false;
|
|
147
|
+
for (const shellFile of shellFiles) {
|
|
148
|
+
if (fs.existsSync(shellFile)) {
|
|
149
|
+
let content = fs.readFileSync(shellFile, 'utf8');
|
|
150
|
+
|
|
151
|
+
if (!content.includes('Claude Code aliases')) {
|
|
152
|
+
fs.appendFileSync(shellFile, aliases);
|
|
153
|
+
console.log(` ✓ Alias installés dans ${path.basename(shellFile)}`);
|
|
154
|
+
installed = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (installed) {
|
|
160
|
+
console.log(' → Redémarre ton terminal pour les activer');
|
|
161
|
+
} else {
|
|
162
|
+
console.log(' ✓ Alias déjà installés');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.log(' ⚠️ Impossible d\'installer les alias');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
91
170
|
function installStatuslineDeps() {
|
|
92
171
|
const statuslineDir = path.join(CLAUDE_DIR, 'scripts', 'statusline');
|
|
93
172
|
|
|
@@ -201,6 +280,9 @@ function setup() {
|
|
|
201
280
|
// Merger settings
|
|
202
281
|
mergeSettings();
|
|
203
282
|
|
|
283
|
+
// Installer alias shell
|
|
284
|
+
installShellAliases();
|
|
285
|
+
|
|
204
286
|
// Installer dépendances statusline
|
|
205
287
|
installStatuslineDeps();
|
|
206
288
|
|
package/package.json
CHANGED
package/settings.json
CHANGED
|
@@ -6,29 +6,7 @@
|
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
|
-
"command": "
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"Stop": [
|
|
15
|
-
{
|
|
16
|
-
"matcher": "",
|
|
17
|
-
"hooks": [
|
|
18
|
-
{
|
|
19
|
-
"type": "command",
|
|
20
|
-
"command": "afplay -v 0.1 /Users/jeremy/.claude/song/finish.mp3"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"Notification": [
|
|
26
|
-
{
|
|
27
|
-
"matcher": "",
|
|
28
|
-
"hooks": [
|
|
29
|
-
{
|
|
30
|
-
"type": "command",
|
|
31
|
-
"command": "afplay -v 0.1 /Users/jeremy/.claude/song/need-human.mp3"
|
|
9
|
+
"command": "node ${CLAUDE_CONFIG_DIR}/scripts/validate-command.js"
|
|
32
10
|
}
|
|
33
11
|
]
|
|
34
12
|
}
|
|
@@ -36,7 +14,7 @@
|
|
|
36
14
|
},
|
|
37
15
|
"statusLine": {
|
|
38
16
|
"type": "command",
|
|
39
|
-
"command": "
|
|
17
|
+
"command": "node ${CLAUDE_CONFIG_DIR}/scripts/statusline/src/index.ts",
|
|
40
18
|
"padding": 0
|
|
41
19
|
}
|
|
42
20
|
}
|