@hopla/claude-setup 1.0.6 → 1.0.8
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 +53 -0
- package/package.json +1 -1
- package/files/commands/hopla-lang.md +0 -35
package/cli.js
CHANGED
|
@@ -100,6 +100,7 @@ const LEGACY_FILES = [
|
|
|
100
100
|
"plan-feature.md",
|
|
101
101
|
"prime.md",
|
|
102
102
|
"system-review.md",
|
|
103
|
+
"hopla-lang.md",
|
|
103
104
|
];
|
|
104
105
|
|
|
105
106
|
function removeLegacyFiles() {
|
|
@@ -153,6 +154,58 @@ async function install() {
|
|
|
153
154
|
log(` ${CYAN}/${name}${RESET}`);
|
|
154
155
|
}
|
|
155
156
|
log(`\nRun with ${BOLD}--force${RESET} to overwrite all files without prompting.\n`);
|
|
157
|
+
|
|
158
|
+
await setupPermissions();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const HOPLA_PERMISSIONS = [
|
|
162
|
+
"Bash(git *)",
|
|
163
|
+
"Bash(ls *)",
|
|
164
|
+
"Bash(find *)",
|
|
165
|
+
"Bash(cat *)",
|
|
166
|
+
"Bash(head *)",
|
|
167
|
+
"Bash(tail *)",
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
async function setupPermissions() {
|
|
171
|
+
const settingsPath = path.join(CLAUDE_DIR, "settings.json");
|
|
172
|
+
|
|
173
|
+
// Read existing settings
|
|
174
|
+
let settings = { permissions: { allow: [] } };
|
|
175
|
+
if (fs.existsSync(settingsPath)) {
|
|
176
|
+
try {
|
|
177
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
|
|
178
|
+
} catch {
|
|
179
|
+
// If parsing fails, keep defaults
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!settings.permissions) settings.permissions = {};
|
|
183
|
+
if (!settings.permissions.allow) settings.permissions.allow = [];
|
|
184
|
+
|
|
185
|
+
// Find permissions not yet added
|
|
186
|
+
const existing = new Set(settings.permissions.allow);
|
|
187
|
+
const toAdd = HOPLA_PERMISSIONS.filter((p) => !existing.has(p));
|
|
188
|
+
|
|
189
|
+
if (toAdd.length === 0) {
|
|
190
|
+
log(`${GREEN}✓${RESET} Permissions already configured.\n`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
log(`${CYAN}Configuring permissions...${RESET}`);
|
|
195
|
+
log(` The following will be added to ~/.claude/settings.json:\n`);
|
|
196
|
+
for (const p of toAdd) {
|
|
197
|
+
log(` ${CYAN}+${RESET} ${p}`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const ok = await confirm(`\n Add these permissions? (y/N) `);
|
|
201
|
+
if (!ok) {
|
|
202
|
+
log(` ${YELLOW}↷${RESET} Skipped — you can add them manually to ~/.claude/settings.json\n`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
settings.permissions.allow = [...settings.permissions.allow, ...toAdd];
|
|
207
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
208
|
+
log(` ${GREEN}✓${RESET} Permissions added.\n`);
|
|
156
209
|
}
|
|
157
210
|
|
|
158
211
|
const run = UNINSTALL ? uninstall : install;
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Set the preferred response language for all Claude Code sessions
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
Set the language Claude should always respond in, regardless of the language the user writes in.
|
|
6
|
-
|
|
7
|
-
## Step 1: Ask for Language Preference
|
|
8
|
-
|
|
9
|
-
Ask the user:
|
|
10
|
-
> "What language should I always respond in? (e.g. Spanish, English, French, Portuguese)"
|
|
11
|
-
|
|
12
|
-
Wait for the answer.
|
|
13
|
-
|
|
14
|
-
## Step 2: Update CLAUDE.md
|
|
15
|
-
|
|
16
|
-
Read `~/.claude/CLAUDE.md` and find the communication language rule. Replace it with a fixed language preference.
|
|
17
|
-
|
|
18
|
-
Find the line that says something like:
|
|
19
|
-
```
|
|
20
|
-
Always respond in the same language the user writes in
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Replace it with:
|
|
24
|
-
```
|
|
25
|
-
Always respond in [chosen language], regardless of the language the user writes in.
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Make sure to preserve all other rules in the file — only change the language line.
|
|
29
|
-
|
|
30
|
-
## Step 3: Confirm
|
|
31
|
-
|
|
32
|
-
Tell the user:
|
|
33
|
-
> "Done. I'll always respond in [chosen language] from now on, even if you write in a different language."
|
|
34
|
-
|
|
35
|
-
If the user ever wants to revert to auto-detection, they can run `/hopla-lang` again and choose "auto" or "match the user's language".
|