claudeforge-cli 1.0.5 → 1.0.7

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/README.md CHANGED
@@ -61,6 +61,7 @@ node --version # should print v18 or higher
61
61
  - [github](#github--cicd--devcontainer)
62
62
  - [status](#status--show-whats-configured)
63
63
  - [upgrade](#upgrade--update-built-in-templates)
64
+ - [clear](#clear--remove-all-claudeforge-files)
64
65
  - [Slash Commands (in IDE chat)](#slash-commands-in-ide-chat)
65
66
  - [What Gets Scaffolded](#what-gets-scaffolded)
66
67
  - [How It Works](#how-it-works)
@@ -337,6 +338,29 @@ By default, only **infrastructure files** are updated (hook scripts, rules, buil
337
338
 
338
339
  ---
339
340
 
341
+ ### `clear` — Remove all claudeforge files
342
+
343
+ ```bash
344
+ claudeforge clear # interactive confirmation
345
+ claudeforge clear --dry-run # preview what would be deleted
346
+ claudeforge clear --force # skip confirmation prompt
347
+ ```
348
+
349
+ Wipes everything claudeforge created so you can start fresh:
350
+
351
+ | Removed | Kept |
352
+ |---------|------|
353
+ | `.claude/` (agents, commands, hooks, rules, skills) | Your source code |
354
+ | `memory/` | Git history |
355
+ | `CLAUDE.md`, `CLAUDE.local.md` | `.github/` CI/CD files |
356
+ | `.mcp.json`, `SETUP_CONTEXT.md` | All other project files |
357
+
358
+ Requires typing `yes` to confirm unless `--force` is passed.
359
+
360
+ After clearing, run `claudeforge init` to scaffold fresh or `claudeforge create` to start over with the wizard.
361
+
362
+ ---
363
+
340
364
  ## Slash Commands (in IDE chat)
341
365
 
342
366
  Run these in the Claude Code chat window in VS Code, JetBrains, or any Claude Code IDE. Works with any Claude model — no separate API key.
package/bin/cli.js CHANGED
@@ -10,6 +10,7 @@ const statusCommand = require('../src/commands/status');
10
10
  const upgradeCommand = require('../src/commands/upgrade');
11
11
  const createCommand = require('../src/commands/create');
12
12
  const githubCommand = require('../src/commands/github');
13
+ const clearCommand = require('../src/commands/clear');
13
14
 
14
15
  program
15
16
  .name('claudeforge')
@@ -152,4 +153,28 @@ Examples:
152
153
  `)
153
154
  .action(githubCommand);
154
155
 
156
+ // ── clear ─────────────────────────────────────────────────────────────────────
157
+ program
158
+ .command('clear')
159
+ .description('Remove all claudeforge-generated files and start fresh (.claude/, memory/, CLAUDE.md, etc.)')
160
+ .option('-d, --dir <path>', 'Target directory (defaults to current directory)')
161
+ .option('-n, --dry-run', 'Preview what would be deleted without removing anything')
162
+ .option('-f, --force', 'Skip confirmation prompt')
163
+ .addHelpText('after', `
164
+ Removes everything claudeforge created:
165
+ .claude/ — settings, agents, commands, hooks, rules, skills
166
+ memory/ — all memory files
167
+ CLAUDE.md — project context file
168
+ CLAUDE.local.md — personal context file
169
+ .mcp.json — MCP server config
170
+
171
+ Your source code, git history, and other project files are never touched.
172
+
173
+ Examples:
174
+ $ claudeforge clear # interactive confirmation
175
+ $ claudeforge clear --dry-run # preview what would be deleted
176
+ $ claudeforge clear --force # skip confirmation prompt
177
+ `)
178
+ .action(clearCommand);
179
+
155
180
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudeforge-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Forge production-ready AI agent projects — agents, slash commands, memory, CI/CD, and devcontainers in one command",
5
5
  "bin": {
6
6
  "claudeforge": "bin/cli.js"
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const chalk = require('chalk');
5
+ const fs = require('fs-extra');
6
+ const readline = require('readline');
7
+
8
+ // Everything claudeforge creates — safe to wipe
9
+ const CLAUDEFORGE_PATHS = [
10
+ '.claude',
11
+ 'memory',
12
+ 'CLAUDE.md',
13
+ 'CLAUDE.local.md',
14
+ '.mcp.json',
15
+ 'SETUP_CONTEXT.md',
16
+ 'SETUP_SUMMARY.md',
17
+ ];
18
+
19
+ async function clear(options) {
20
+ const targetDir = path.resolve(options.dir || process.cwd());
21
+ const dryRun = options.dryRun || false;
22
+ const force = options.force || false;
23
+
24
+ console.log('');
25
+ console.log(chalk.bold.cyan(' claudeforge') + chalk.dim(' — Clear Project Structure'));
26
+ console.log(chalk.dim(' ─────────────────────────────────────────'));
27
+ if (dryRun) console.log(chalk.bold.yellow(' [DRY RUN] No files will be deleted'));
28
+ console.log('');
29
+
30
+ // Check which paths actually exist
31
+ const existing = [];
32
+ for (const p of CLAUDEFORGE_PATHS) {
33
+ const abs = path.join(targetDir, p);
34
+ if (await fs.pathExists(abs)) existing.push(p);
35
+ }
36
+
37
+ if (existing.length === 0) {
38
+ console.log(chalk.dim(' Nothing to clear — no claudeforge files found.'));
39
+ console.log('');
40
+ return;
41
+ }
42
+
43
+ // Show what will be removed
44
+ console.log(chalk.bold(' The following will be permanently deleted:'));
45
+ console.log('');
46
+ for (const p of existing) {
47
+ const abs = path.join(targetDir, p);
48
+ const stat = await fs.stat(abs);
49
+ const label = stat.isDirectory() ? chalk.yellow(p + '/') : chalk.yellow(p);
50
+ console.log(` ${chalk.red('✗')} ${label}`);
51
+ }
52
+ console.log('');
53
+
54
+ if (dryRun) {
55
+ console.log(chalk.cyan(` Dry run: ${existing.length} item(s) would be deleted.`));
56
+ console.log(chalk.dim(' Run without --dry-run to actually delete them.'));
57
+ console.log('');
58
+ return;
59
+ }
60
+
61
+ // Confirm unless --force
62
+ if (!force) {
63
+ const answer = await prompt(
64
+ chalk.red(' ⚠ This cannot be undone. Type ') +
65
+ chalk.bold.red('yes') +
66
+ chalk.red(' to confirm: ')
67
+ );
68
+ console.log('');
69
+ if (answer.trim().toLowerCase() !== 'yes') {
70
+ console.log(chalk.dim(' Aborted — nothing was deleted.'));
71
+ console.log('');
72
+ return;
73
+ }
74
+ }
75
+
76
+ // Delete
77
+ for (const p of existing) {
78
+ const abs = path.join(targetDir, p);
79
+ await fs.remove(abs);
80
+ console.log(` ${chalk.red('✗')} ${chalk.dim(p)} ${chalk.red('deleted')}`);
81
+ }
82
+
83
+ console.log('');
84
+ console.log(chalk.dim(' ─────────────────────────────────────────'));
85
+ console.log(chalk.green(` ✓ ${existing.length} item(s) removed.`));
86
+ console.log('');
87
+ console.log(chalk.bold(' Start fresh:'));
88
+ console.log('');
89
+ console.log(` ${chalk.dim('›')} ${chalk.cyan('claudeforge init')} ${chalk.dim('re-scaffold the full structure')}`);
90
+ console.log(` ${chalk.dim('›')} ${chalk.cyan('claudeforge create')} ${chalk.dim('start a new project from scratch with the wizard')}`);
91
+ console.log('');
92
+ }
93
+
94
+ function prompt(question) {
95
+ return new Promise(resolve => {
96
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
97
+ rl.question(question, answer => {
98
+ rl.close();
99
+ resolve(answer);
100
+ });
101
+ });
102
+ }
103
+
104
+ module.exports = clear;
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Analyze an existing codebase and auto-generate the full Claude Code setup — CLAUDE.md, skills, agents, commands, and memory — by reading actual code, patterns, and conventions already in the project. No description required.
3
- allowed-tools: Read, Write, Edit, MultiEdit, Bash(git log:*), Bash(git diff:*), Bash(ls:*), Bash(find:*), Bash(cat:*), Bash(wc:*)
3
+ allowed-tools: Read, Write, Edit, MultiEdit, Bash(git log:*), Bash(git diff:*), Bash(ls:*), Bash(find:*), Bash(cat:*), Bash(wc:*), Bash(head:*), Bash(sort:*), Bash(uniq:*), Bash(xargs:*), Bash(test:*)
4
4
  ---
5
5
 
6
6
  ## Step 1 — Deep Codebase Scan
@@ -10,17 +10,21 @@ Do not ask the user for a description. Read the codebase directly to infer every
10
10
  ### 1a. Project identity
11
11
 
12
12
  !`ls -la`
13
- !`test -f package.json && cat package.json || test -f pyproject.toml && cat pyproject.toml || test -f go.mod && cat go.mod || test -f Cargo.toml && cat Cargo.toml || echo "(no manifest found)"`
14
- !`test -f README.md && head -60 README.md || echo "(no README)"`
13
+ !`git log --oneline -20`
15
14
 
16
15
  ### 1b. Full dependency map
17
16
 
18
- !`test -f package.json && cat package.json || echo "(no package.json)"`
19
- !`test -f requirements.txt && cat requirements.txt || test -f pyproject.toml && cat pyproject.toml || echo "(no python deps)"`
20
- !`test -f go.mod && cat go.mod || echo "(no go.mod)"`
21
- !`test -f Cargo.toml && cat Cargo.toml || echo "(no Cargo.toml)"`
22
- !`test -f pom.xml && head -80 pom.xml || echo "(no pom.xml)"`
23
- !`test -f Gemfile && cat Gemfile || echo "(no Gemfile)"`
17
+ Use the Read tool to attempt reading each of these files. Skip silently if a file doesn't exist — do not error:
18
+
19
+ - `package.json`
20
+ - `requirements.txt`
21
+ - `pyproject.toml`
22
+ - `go.mod`
23
+ - `Cargo.toml`
24
+ - `pom.xml`
25
+ - `Gemfile`
26
+ - `composer.json`
27
+ - `README.md`
24
28
 
25
29
  ### 1c. Project structure
26
30
 
@@ -29,36 +33,32 @@ Do not ask the user for a description. Read the codebase directly to infer every
29
33
 
30
34
  ### 1d. Read actual source code — infer real patterns
31
35
 
32
- Read the most representative files in each layer of the project. For each category below, find and read 2–3 real files:
36
+ Use the Read tool to open the most representative files in each layer. Try each location skip if it doesn't exist:
33
37
 
34
- - **Entry points**: `main.py`, `index.ts`, `main.go`, `app.py`, `server.js`, etc.
35
- - **Route/controller layer**: files in `routes/`, `controllers/`, `handlers/`, `api/`, `pages/api/`
36
- - **Service/business logic layer**: files in `services/`, `lib/`, `internal/`, `core/`
37
- - **Data/database layer**: files in `models/`, `db/`, `prisma/`, `migrations/`, `schema/`
38
- - **UI components** (if frontend): files in `components/`, `pages/`, `views/`, `screens/`
39
- - **Tests**: files in `tests/`, `__tests__/`, `spec/`, `test/`
40
- - **Config**: `tsconfig.json`, `eslint.config.*`, `.prettierrc`, `pytest.ini`, `ruff.toml`, etc.
38
+ - **Entry points**: `main.py`, `index.ts`, `main.go`, `app.py`, `server.js`, `app.js`
39
+ - **Routes/controllers**: look inside `routes/`, `controllers/`, `handlers/`, `api/`, `pages/api/`
40
+ - **Services/business logic**: look inside `services/`, `lib/`, `internal/`, `core/`
41
+ - **Data/database**: look inside `models/`, `db/`, `prisma/schema.prisma`, `migrations/`
42
+ - **UI components**: look inside `components/`, `pages/`, `views/`, `screens/`
43
+ - **Tests**: look inside `tests/`, `__tests__/`, `spec/`, `test/`
44
+ - **Config files**: `tsconfig.json`, `.eslintrc*`, `.prettierrc`, `pytest.ini`, `ruff.toml`
41
45
 
42
- Read enough code to answer:
43
- - What frameworks and libraries are actually used (not just listed in deps)?
46
+ Read enough real code to answer:
47
+ - What frameworks and libraries are actually used?
44
48
  - How are files structured and named?
45
- - What patterns repeat across files (error handling, auth checks, response format, logging)?
46
- - What conventions are enforced (naming, imports, exports)?
49
+ - What patterns repeat across files (error handling, auth, response format, logging)?
47
50
  - How are tests written?
48
51
 
49
- ### 1e. Git history — understand how the project evolved
50
-
51
- !`git log --oneline -20 || echo "(no git history)"`
52
- !`git log --pretty=format:"%s" -50 | sort | uniq -c | sort -rn | head -20 || echo "(no commits)"`
53
-
54
- What do the commit messages reveal about the team's workflow and focus areas?
52
+ ### 1e. CI/CD and infrastructure
55
53
 
56
- ### 1f. Existing CI/CD and infrastructure
54
+ Use the Read tool to attempt reading each — skip silently if missing:
57
55
 
58
- !`test -d .github/workflows && find .github/workflows -name "*.yml" | head -5 | xargs head -100 || echo "(no GitHub Actions)"`
59
- !`test -f Dockerfile && head -40 Dockerfile || echo "(no Dockerfile)"`
60
- !`test -f docker-compose.yml && cat docker-compose.yml || echo "(no docker-compose)"`
61
- !`test -f .env.example && cat .env.example || test -f .env.sample && cat .env.sample || echo "(no .env.example)"`
56
+ - `.github/workflows/` use find to list yml files then read them
57
+ - `Dockerfile`
58
+ - `docker-compose.yml`
59
+ - `.env.example`
60
+ - `.env.sample`
61
+ - `Makefile`
62
62
 
63
63
  ---
64
64