claudeforge-cli 1.0.0

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +431 -0
  3. package/bin/cli.js +155 -0
  4. package/package.json +43 -0
  5. package/src/commands/add.js +205 -0
  6. package/src/commands/create.js +218 -0
  7. package/src/commands/github.js +479 -0
  8. package/src/commands/init.js +107 -0
  9. package/src/commands/project.js +123 -0
  10. package/src/commands/status.js +183 -0
  11. package/src/commands/upgrade.js +114 -0
  12. package/src/index.js +6 -0
  13. package/src/logger.js +90 -0
  14. package/src/scaffolder.js +45 -0
  15. package/src/stack-detector.js +62 -0
  16. package/templates/.env.example.tpl +21 -0
  17. package/templates/.gitignore.tpl +40 -0
  18. package/templates/CLAUDE.local.md.tpl +32 -0
  19. package/templates/CLAUDE.md.tpl +112 -0
  20. package/templates/claude/README.md.tpl +94 -0
  21. package/templates/claude/agents/code-reviewer.md.tpl +142 -0
  22. package/templates/claude/commands/commit.md.tpl +34 -0
  23. package/templates/claude/commands/explain-codebase.md.tpl +37 -0
  24. package/templates/claude/commands/fix-issue.md.tpl +43 -0
  25. package/templates/claude/commands/memory-sync.md.tpl +49 -0
  26. package/templates/claude/commands/project-health.md.tpl +70 -0
  27. package/templates/claude/commands/review-pr.md.tpl +43 -0
  28. package/templates/claude/commands/scaffold-structure.md.tpl +308 -0
  29. package/templates/claude/commands/setup-project.md.tpl +253 -0
  30. package/templates/claude/commands/standup.md.tpl +34 -0
  31. package/templates/claude/hooks/post-tool-use.sh.tpl +44 -0
  32. package/templates/claude/hooks/pre-tool-use.sh.tpl +64 -0
  33. package/templates/claude/rules/no-sensitive-files.md.tpl +29 -0
  34. package/templates/claude/settings.json.tpl +50 -0
  35. package/templates/claude/settings.local.json.tpl +4 -0
  36. package/templates/claude/skills/project-conventions/SKILL.md.tpl +39 -0
  37. package/templates/mcp.json.tpl +9 -0
  38. package/templates/memory/MEMORY.md.tpl +37 -0
  39. package/templates/memory/feedback_communication.md.tpl +29 -0
  40. package/templates/memory/project_ai_workflow.md.tpl +43 -0
  41. package/templates/memory/user_profile.md.tpl +30 -0
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bash
2
+ # ─────────────────────────────────────────────────────────────────────────────
3
+ # PreToolUse Hook
4
+ # Runs before every tool execution. Use this to block or warn on dangerous ops.
5
+ #
6
+ # Input: JSON on stdin — describes the tool call (tool_name, tool_input, ...)
7
+ # Output: JSON on stdout — {"decision": "block"|"warn", "reason": "..."} to
8
+ # intercept, or empty output to allow the call.
9
+ #
10
+ # Exit codes: 0 = allow (unless decision=block), non-zero = block
11
+ #
12
+ # Docs: https://docs.anthropic.com/en/docs/claude-code/hooks
13
+ # ─────────────────────────────────────────────────────────────────────────────
14
+
15
+ set -euo pipefail
16
+
17
+ INPUT=$(cat)
18
+
19
+ # ── Helper: extract JSON field via python3 (available on macOS/Linux) ─────────
20
+ json_get() {
21
+ python3 -c "
22
+ import sys, json
23
+ try:
24
+ d = json.loads(sys.stdin.read())
25
+ keys = '$1'.split('.')
26
+ v = d
27
+ for k in keys:
28
+ v = v[k] if isinstance(v, dict) else ''
29
+ print(v if v is not None else '')
30
+ except:
31
+ print('')
32
+ " <<< "$INPUT"
33
+ }
34
+
35
+ TOOL_NAME=$(json_get "tool_name")
36
+ COMMAND=$(json_get "tool_input.command")
37
+ FILE_PATH=$(json_get "tool_input.path")
38
+
39
+ # ── Rule 1: Block rm -rf on paths outside /tmp ────────────────────────────────
40
+ if [[ "$TOOL_NAME" == "Bash" ]]; then
41
+ if echo "$COMMAND" | grep -qE 'rm\s+-[rf]+\s+/' && ! echo "$COMMAND" | grep -qE 'rm\s+-[rf]+\s+/tmp'; then
42
+ echo '{"decision":"block","reason":"Blocked: rm -rf on an absolute path outside /tmp. Verify the target and use a safer, more targeted delete."}'
43
+ exit 0
44
+ fi
45
+ fi
46
+
47
+ # ── Rule 2: Warn on edits to sensitive files ──────────────────────────────────
48
+ if [[ "$TOOL_NAME" == "Edit" || "$TOOL_NAME" == "Write" || "$TOOL_NAME" == "MultiEdit" ]]; then
49
+ if echo "$FILE_PATH" | grep -qiE '\.env$|credentials|secrets|\.pem$|\.key$|id_rsa|\.p12$'; then
50
+ echo '{"decision":"warn","reason":"Warning: Editing a sensitive file. Ensure no secrets are hardcoded and this file is listed in .gitignore."}'
51
+ exit 0
52
+ fi
53
+ fi
54
+
55
+ # ── Rule 3: Block piped shell execution (curl | bash, wget | sh, etc.) ────────
56
+ if [[ "$TOOL_NAME" == "Bash" ]]; then
57
+ if echo "$COMMAND" | grep -qE '(curl|wget)\s+.*\|\s*(bash|sh|zsh)'; then
58
+ echo '{"decision":"block","reason":"Blocked: piped remote script execution (curl|bash pattern). Download the script first, inspect it, then run it explicitly."}'
59
+ exit 0
60
+ fi
61
+ fi
62
+
63
+ # ── Default: allow ────────────────────────────────────────────────────────────
64
+ exit 0
@@ -0,0 +1,29 @@
1
+ # Rule: No Sensitive Files
2
+
3
+ ## What This Rule Does
4
+
5
+ Prevents Claude from reading, writing, or referencing files that are likely
6
+ to contain credentials, private keys, or other sensitive data.
7
+
8
+ ## Sensitive File Patterns
9
+
10
+ Claude should decline to read or write files matching these patterns unless
11
+ the user has explicitly acknowledged the risk:
12
+
13
+ - `.env` and `.env.*` variants (`.env.local`, `.env.production`, etc.)
14
+ - `credentials`, `secrets`, `keystore` (any extension)
15
+ - `*.pem`, `*.key`, `*.p12`, `*.pfx` (cryptographic key material)
16
+ - `id_rsa`, `id_ed25519`, `id_ecdsa` (SSH private keys)
17
+ - `*.json` files inside `~/.aws/`, `~/.gcp/`, `~/.azure/`
18
+
19
+ ## What to Do Instead
20
+
21
+ - Store secrets in environment variables or a secrets manager
22
+ - Reference values via `process.env.SECRET_NAME` (Node) or `os.environ["SECRET"]` (Python)
23
+ - Use `.env.example` to document required variables without exposing values
24
+ - Never hardcode API keys, tokens, or passwords in source files
25
+
26
+ ## When It's OK
27
+
28
+ If the user explicitly says "yes, edit this file" after being warned, proceed.
29
+ Always verify the file will be covered by `.gitignore` before writing.
@@ -0,0 +1,50 @@
1
+ {
2
+ "model": "claude-sonnet-4-6",
3
+ "permissions": {
4
+ "allow": [
5
+ "Bash(git status:*)",
6
+ "Bash(git diff:*)",
7
+ "Bash(git log:*)",
8
+ "Bash(git add:*)",
9
+ "Bash(git commit:*)",
10
+ "Bash(git push:*)",
11
+ "Bash(git branch:*)",
12
+ "Bash(git checkout:*)",
13
+ "Bash(git stash:*)",
14
+ "Bash(npm run:*)",
15
+ "Bash(npm test:*)",
16
+ "Bash(npm install:*)",
17
+ "Bash(npx:*)"
18
+ ],
19
+ "deny": [
20
+ "Bash(rm -rf /:*)",
21
+ "Bash(curl * | bash:*)",
22
+ "Bash(wget * | bash:*)",
23
+ "Bash(sudo rm:*)"
24
+ ]
25
+ },
26
+ "hooks": {
27
+ "PreToolUse": [
28
+ {
29
+ "matcher": "Bash|Edit|Write|MultiEdit",
30
+ "hooks": [
31
+ {
32
+ "type": "command",
33
+ "command": "bash .claude/hooks/pre-tool-use.sh"
34
+ }
35
+ ]
36
+ }
37
+ ],
38
+ "PostToolUse": [
39
+ {
40
+ "matcher": "Edit|Write|MultiEdit",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "bash .claude/hooks/post-tool-use.sh"
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_comment": "Personal overrides — DO NOT commit this file (it is gitignored). Values here override .claude/settings.json for your local environment only.",
3
+ "model": "claude-opus-4-6"
4
+ }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: project-conventions
3
+ description: Apply the coding conventions and standards defined in CLAUDE.md for this project. Invoke this skill before writing new code, creating files, or refactoring — especially when the user hasn't specified a style preference. Claude-invocable only.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Project Conventions Skill
8
+
9
+ This skill reminds Claude to read and apply project-specific conventions before writing code.
10
+
11
+ ## What to Read First
12
+
13
+ Before writing any code, always read:
14
+
15
+ 1. **`CLAUDE.md`** — the authoritative source for this project's commands, architecture, and style
16
+ 2. **Neighboring files** — files in the same directory as the file being created/edited reveal local patterns
17
+ 3. **`memory/project_ai_workflow.md`** — AI-specific conventions for this project
18
+
19
+ ## Core Principles
20
+
21
+ - **Match the surrounding style exactly** — if the codebase uses tabs, use tabs; if it uses `const`, use `const`
22
+ - **Read before you write** — read at least 2 existing files in the relevant module before creating anything new
23
+ - **No debug artifacts** — never commit `console.log`, `print()`, `debugger`, or commented-out blocks
24
+ - **No silent failures** — always propagate or log errors; never swallow exceptions
25
+
26
+ ## Before Finishing Any Task
27
+
28
+ Run through this checklist mentally:
29
+
30
+ - [ ] Does the new code match the surrounding style?
31
+ - [ ] Are all variables and functions named consistently with the rest of the file?
32
+ - [ ] Is there any debug code or dead code to remove?
33
+ - [ ] Are there hardcoded values that should be constants or environment variables?
34
+ - [ ] Does this need a test? If yes, was one written or is one planned?
35
+
36
+ ## Customizing This Skill
37
+
38
+ Update the sections above to reflect your project's actual conventions.
39
+ The more specific you are, the less correction Claude will need.
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "context7": {
4
+ "command": "npx",
5
+ "args": ["-y", "@upstash/context7-mcp@latest"],
6
+ "env": {}
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,37 @@
1
+ # Project Memory Index
2
+
3
+ This file is an **index** of persistent memory files for this project.
4
+ It is always loaded into Claude's context at the start of every session.
5
+
6
+ > **Do NOT write memory content directly here.**
7
+ > Create individual files and add a one-line pointer below.
8
+ > Lines past ~200 are truncated — keep this index concise.
9
+
10
+ ---
11
+
12
+ ## Memory Files
13
+
14
+ <!-- Format: - [Title](./filename.md) — one-line description (≤120 chars) -->
15
+
16
+ - [user_profile.md](./user_profile.md) — Developer role, preferences, and working style
17
+ - [feedback_communication.md](./feedback_communication.md) — How Claude should communicate in this project
18
+ - [project_ai_workflow.md](./project_ai_workflow.md) — AI tools, agents, and workflow conventions
19
+
20
+ ---
21
+
22
+ ## How This System Works
23
+
24
+ 1. `MEMORY.md` (this file) is always loaded — keep it under 200 lines
25
+ 2. Individual memory files are read on-demand when relevant to the current task
26
+ 3. Claude updates memory files as it learns project context across sessions
27
+ 4. Tell Claude **"Remember that [fact]"** to persist something across sessions
28
+ 5. Tell Claude **"Forget that [fact]"** to remove a memory entry
29
+
30
+ ## Memory File Types
31
+
32
+ | Type | Purpose |
33
+ |------|---------|
34
+ | `user` | Who you are, your role, preferences, and expertise |
35
+ | `feedback` | How Claude should behave — corrections and confirmed approaches |
36
+ | `project` | Ongoing work, goals, decisions, deadlines |
37
+ | `reference` | Where to find things in external systems |
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: feedback-communication
3
+ description: Guidance on how Claude should communicate and behave in this project — corrections and confirmed approaches
4
+ type: feedback
5
+ ---
6
+
7
+ # Communication Feedback
8
+
9
+ > This file is populated as Claude learns your preferences.
10
+ > Corrections ("Don't do X") and confirmations ("Yes, keep doing Y") both belong here.
11
+
12
+ ## Rules
13
+
14
+ <!-- Add entries as Claude learns your preferences. Format:
15
+ - **Rule**: [the behavior rule]
16
+ **Why**: [reason the user gave]
17
+ **How to apply**: [when this kicks in]
18
+ -->
19
+
20
+ > No rules yet. Tell Claude what you like or dislike about its responses
21
+ > and it will record the preference here for future sessions.
22
+
23
+ ## Examples of What to Record
24
+
25
+ - "No trailing summaries after completing tasks — I can read the diff"
26
+ - "Always show the exact shell command before running it"
27
+ - "Prefer bullet lists over paragraphs for multi-step instructions"
28
+ - "Explain tradeoffs before making architectural decisions, don't just pick one"
29
+ - "Don't refactor surrounding code unless I ask — stay focused on the task"
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: project-ai-workflow
3
+ description: How AI tools are integrated into this project's development workflow — agents, commands, hooks, and MCP servers in use
4
+ type: project
5
+ ---
6
+
7
+ # Project AI Workflow
8
+
9
+ > Update this file as your team's AI workflow evolves.
10
+
11
+ ## Slash Commands
12
+
13
+ | Command | Purpose | When to Use |
14
+ |---------|---------|-------------|
15
+ | `/commit` | Stage and create a conventional commit | After completing a feature or fix |
16
+ | `/review-pr` | Review the current branch before opening a PR | Before `gh pr create` |
17
+
18
+ ## Agents
19
+
20
+ | Agent | When Claude Uses It |
21
+ |-------|---------------------|
22
+ | `code-reviewer` | Reviewing changed code for bugs, security, and style issues |
23
+
24
+ ## MCP Servers
25
+
26
+ | Server | Purpose |
27
+ |--------|---------|
28
+ | `context7` | Live documentation lookup for any library — use `use context7` in prompts |
29
+
30
+ ## Active Hooks
31
+
32
+ | Hook | Trigger | Effect |
33
+ |------|---------|--------|
34
+ | `pre-tool-use.sh` | Before any Bash/Edit/Write call | Blocks `rm -rf /`, warns on `.env` edits, blocks `curl\|bash` |
35
+ | `post-tool-use.sh` | After Edit/Write/MultiEdit | Reminds Claude to run tests after editing test files |
36
+
37
+ ## Project-Specific AI Context
38
+
39
+ > Add notes about what makes this project unique from an AI-assistance perspective.
40
+ > Examples:
41
+ > - "Always read `db/schema.ts` before writing any database queries"
42
+ > - "The API follows JSON:API spec — check `docs/api.md` when generating endpoints"
43
+ > - "We use a custom test helper in `tests/helpers.ts` — use it instead of raw assertions"
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: user-profile
3
+ description: Developer identity, role, technical background, and working preferences for this project
4
+ type: user
5
+ ---
6
+
7
+ # User Profile
8
+
9
+ > This file is **gitignored** — fill it in with your personal context.
10
+ > Tell Claude "Remember that I [preference]" and it will update this file.
11
+
12
+ ## Role & Background
13
+
14
+ - **Role**: [e.g., Full-stack engineer, Backend engineer, Data scientist]
15
+ - **Team**: [e.g., Platform team, Growth team]
16
+ - **Years of experience**: [e.g., 8 years]
17
+ - **Strong areas**: [e.g., Go, distributed systems, PostgreSQL]
18
+ - **Learning areas**: [e.g., New to React, first time with this codebase]
19
+
20
+ ## Communication Preferences
21
+
22
+ - [e.g., Terse responses — I can read the diff, no need to summarize]
23
+ - [e.g., Explain the *why* behind architectural decisions]
24
+ - [e.g., Show the full command before running it]
25
+
26
+ ## Working Style
27
+
28
+ - [e.g., I prefer small, atomic commits over large ones]
29
+ - [e.g., I review all diffs before approving — always show me what changed]
30
+ - [e.g., I like to understand the approach before you start implementing]