claude-init 1.0.23 → 1.0.25

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.
@@ -6,10 +6,12 @@
6
6
  "deny": [
7
7
  "Read(**/.env*)",
8
8
  "Edit(**/.env*)",
9
- "Write(**/.env*)",
10
- "Bash(*.env*)"
9
+ "Write(**/.env*)"
11
10
  ],
12
- "defaultMode": "acceptEdits"
11
+ "defaultMode": "acceptEdits",
12
+ "additionalDirectories": [
13
+ "/tmp"
14
+ ]
13
15
  },
14
16
  "statusLine": {
15
17
  "type": "command",
@@ -11,7 +11,6 @@
11
11
  "Bash(git add:*)"
12
12
  ],
13
13
  "deny": [],
14
- "ask": [],
15
14
  "additionalDirectories": [
16
15
  "/tmp"
17
16
  ]
package/CLAUDE.md CHANGED
@@ -1,4 +1 @@
1
- + During you interaction with the user, if you find anything reusable in this project (e.g. version of a library, model name), especially about a fix to a mistake you made or a correction you received, you should take note in the `Lessons` section in the `CLAUDE.md` file so you will not make the same mistake again.
2
- + You should also use the `CLAUDE.md` file as a scratchpad to organize your thoughts. Especially when you receive a new task, you should first review the content of the scratchpad, clear old different task but keep lessons learned, then explain the task, and plan the steps you need to take to complete the task. You can use todo markers to indicate the progress, e.g.
3
- [X] Task 1
4
- [ ] Task 2
1
+ + During you interaction with the user, if you find anything reusable in this project (e.g. version of a library, model name), especially about a fix to a mistake you made or a correction you received, you should take note in the `Lessons` section in the `CLAUDE.md` file so you will not make the same mistake again.
package/README.md CHANGED
@@ -57,7 +57,10 @@ Running `npx claude-init` sets up your current directory with:
57
57
 
58
58
  #### ⚙️ .claude/settings.json
59
59
  - **If missing**: Creates with default Claude settings
60
- - **If exists**: Skips to preserve your custom settings
60
+ - **If exists**: Prompts whether to overwrite with template version
61
+ - **Interactive prompt**: If the file exists, you'll be asked whether to overwrite it
62
+ - Answer **Yes** to replace with fresh template
63
+ - Answer **No** (default) to preserve your custom settings
61
64
 
62
65
  #### 📋 .claude/commands
63
66
  - **If missing**: Creates with all template files
@@ -75,19 +78,26 @@ Running `npx claude-init` sets up your current directory with:
75
78
 
76
79
  When running interactively (in a terminal), `claude-init` will ask you:
77
80
 
78
- 1. **Overwrite existing .claude/commands/\*.md?** (only if you have existing `.md` files that match templates)
81
+ 1. **Overwrite existing .claude/settings.json?** (only if the file already exists)
82
+ - Prompt: `Overwrite existing .claude/settings.json with template version? (y/N):`
83
+ - Default: **No** (preserves your custom settings)
84
+ - If **Yes**: Replaces your settings file with fresh template
85
+ - If **No**: Keeps your existing settings file
86
+
87
+ 2. **Overwrite existing .claude/commands/\*.md?** (only if you have existing `.md` files that match templates)
79
88
  - Prompt: `Overwrite existing .claude/commands/*.md with template versions? (y/N):`
80
89
  - Default: **No** (preserves your customizations)
81
90
  - If **Yes**: Replaces existing `.md` files with templates, still adds missing files
82
91
  - If **No**: Keeps your existing files, only adds missing files
83
92
 
84
- 2. **Install .claude/agents?**
93
+ 3. **Install .claude/agents?**
85
94
  - Prompt: `Install .claude/agents files? (Y/n):`
86
95
  - Default: **Yes** (installs agents)
87
96
  - If **Yes**: Installs/updates agents as normal
88
97
  - If **No**: Skips agents entirely (shown in summary)
89
98
 
90
99
  **Non-interactive mode (CI/scripts)**: When `process.stdin.isTTY` is false (e.g., in CI pipelines), prompts are skipped and defaults are used:
100
+ - `.claude/settings.json` is **not** overwritten (preserves custom settings)
91
101
  - `.claude/commands/*.md` files are **not** overwritten (preserves customizations)
92
102
  - `.claude/agents` **is** installed (matches current behavior)
93
103
 
@@ -122,6 +132,7 @@ Initializing in: /path/to/your/project
122
132
 
123
133
  Overwrite existing .claude/commands/*.md with template versions? (y/N): n
124
134
  Install .claude/agents files? (Y/n): n
135
+ Overwrite existing .claude/settings.json with template version? (y/N): n
125
136
 
126
137
  - CLAUDE.md already contains template content
127
138
  - Directory .devcontainer already exists
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-init",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Initialize Claude development environment with configurations and templates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,12 @@
17
17
  "scripts": {
18
18
  "test": "node --test test/*.test.js",
19
19
  "dev": "node bin/index.js",
20
- "prepublishOnly": "npm test"
20
+ "prepublishOnly": "npm test",
21
+ "version": "git add package.json",
22
+ "postversion": "git push && git push --tags && npm publish",
23
+ "release:patch": "npm version patch",
24
+ "release:minor": "npm version minor",
25
+ "release:major": "npm version major"
21
26
  },
22
27
  "keywords": [
23
28
  "claude",
package/src/cli.js CHANGED
@@ -52,6 +52,16 @@ export async function cli() {
52
52
  console.log(chalk.gray(`Initializing in: ${targetDir}`));
53
53
  console.log();
54
54
 
55
+ // Determine if we should overwrite .claude/settings.json
56
+ let overwriteSettings = false;
57
+ const settingsPath = path.join(targetDir, '.claude/settings.json');
58
+ if (await fs.pathExists(settingsPath)) {
59
+ overwriteSettings = await promptYesNo(
60
+ 'Overwrite existing .claude/settings.json with template version?',
61
+ false
62
+ );
63
+ }
64
+
55
65
  // Determine if we should prompt for overwriting .claude/commands/*.md
56
66
  let overwriteCommandsMd = false;
57
67
  const commandsTargetPath = path.join(targetDir, '.claude/commands');
@@ -90,7 +100,7 @@ export async function cli() {
90
100
  },
91
101
  {
92
102
  name: '.claude/settings.json',
93
- handler: () => handleSingleFile(targetDir, '.claude/settings.json')
103
+ handler: () => handleSingleFile(targetDir, '.claude/settings.json', { overwrite: overwriteSettings })
94
104
  },
95
105
  {
96
106
  name: '.claude/commands',
@@ -151,19 +151,30 @@ export async function handleSelectiveFileCopy(targetDir, relativePath, options =
151
151
  }
152
152
 
153
153
  /**
154
- * Handle single file copying (create if not exists, skip if exists)
154
+ * Handle single file copying (create if not exists, skip if exists, optionally overwrite)
155
+ * @param {string} targetDir - The target directory
156
+ * @param {string} relativePath - The relative path of the file to copy
157
+ * @param {Object} options - Options for the copy operation
158
+ * @param {boolean} options.overwrite - Whether to overwrite existing file (default: false)
155
159
  */
156
- export async function handleSingleFile(targetDir, relativePath) {
160
+ export async function handleSingleFile(targetDir, relativePath, options = {}) {
161
+ const { overwrite = false } = options;
157
162
  const targetPath = path.join(targetDir, relativePath);
158
163
  const templatePath = path.join(getTemplatesPath(), relativePath);
159
-
164
+
160
165
  if (await fs.pathExists(targetPath)) {
161
- return { action: 'skipped', details: `File ${relativePath} already exists` };
166
+ if (!overwrite) {
167
+ return { action: 'skipped', details: `File ${relativePath} already exists` };
168
+ }
169
+
170
+ // Overwrite existing file
171
+ await fs.copy(templatePath, targetPath);
172
+ return { action: 'updated', details: `Overwrote ${relativePath} with template` };
162
173
  }
163
-
174
+
164
175
  // Ensure target directory exists
165
176
  await fs.ensureDir(path.dirname(targetPath));
166
177
  await fs.copy(templatePath, targetPath);
167
-
178
+
168
179
  return { action: 'created', details: `Created ${relativePath}` };
169
180
  }