cc-discipline 2.10.1 → 2.10.3

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 (43) hide show
  1. package/README.md +236 -153
  2. package/README.zh-CN.md +299 -207
  3. package/bin/cli.sh +96 -96
  4. package/global/CLAUDE.md +45 -45
  5. package/init.sh +594 -594
  6. package/lib/doctor.sh +145 -145
  7. package/lib/stack-remove.sh +68 -68
  8. package/lib/status.sh +100 -100
  9. package/package.json +34 -34
  10. package/templates/.claude/agents/investigator.md +44 -44
  11. package/templates/.claude/agents/reviewer.md +46 -46
  12. package/templates/.claude/hooks/action-counter.sh +58 -58
  13. package/templates/.claude/hooks/git-guard.sh +62 -62
  14. package/templates/.claude/hooks/phase-gate.sh +10 -10
  15. package/templates/.claude/hooks/post-error-remind.sh +114 -114
  16. package/templates/.claude/hooks/pre-edit-guard.sh +100 -100
  17. package/templates/.claude/hooks/session-start.sh +44 -44
  18. package/templates/.claude/hooks/streak-breaker.sh +111 -111
  19. package/templates/.claude/rules/00-core-principles.md +16 -16
  20. package/templates/.claude/rules/01-debugging.md +32 -32
  21. package/templates/.claude/rules/02-before-edit.md +22 -22
  22. package/templates/.claude/rules/03-context-mgmt.md +44 -44
  23. package/templates/.claude/rules/04-no-mole-whacking.md +26 -26
  24. package/templates/.claude/rules/05-phase-discipline.md +15 -15
  25. package/templates/.claude/rules/06-multi-task.md +12 -12
  26. package/templates/.claude/rules/07-integrity.md +92 -92
  27. package/templates/.claude/rules/stacks/embedded.md +24 -24
  28. package/templates/.claude/rules/stacks/js-ts.md +21 -21
  29. package/templates/.claude/rules/stacks/mobile.md +16 -16
  30. package/templates/.claude/rules/stacks/python.md +20 -20
  31. package/templates/.claude/rules/stacks/rtl.md +24 -24
  32. package/templates/.claude/settings.json +84 -84
  33. package/templates/.claude/skills/commit/SKILL.md +40 -40
  34. package/templates/.claude/skills/evaluate/SKILL.md +57 -57
  35. package/templates/.claude/skills/investigate/SKILL.md +192 -192
  36. package/templates/.claude/skills/retro/SKILL.md +40 -40
  37. package/templates/.claude/skills/self-check/SKILL.md +112 -87
  38. package/templates/.claude/skills/summary/SKILL.md +48 -48
  39. package/templates/.claude/skills/think/SKILL.md +108 -108
  40. package/templates/CLAUDE.md +96 -96
  41. package/templates/docs/debug-log.md +48 -48
  42. package/templates/docs/progress.md +72 -72
  43. package/templates/memory/MEMORY.md +23 -23
package/bin/cli.sh CHANGED
@@ -1,96 +1,96 @@
1
- #!/usr/bin/env bash
2
- # cc-discipline CLI entry point
3
- # Resolves symlinks (npm bin creates symlinks) to find the real package directory
4
-
5
- set -e
6
-
7
- # Resolve the real path of this script (works through npm symlinks)
8
- SOURCE="${BASH_SOURCE[0]}"
9
- while [ -L "$SOURCE" ]; do
10
- DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
11
- SOURCE="$(readlink "$SOURCE")"
12
- # If SOURCE is relative, resolve it relative to DIR
13
- [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
14
- done
15
- BIN_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
16
- PKG_DIR="$(cd "$BIN_DIR/.." && pwd)"
17
-
18
- export CC_DISCIPLINE_PKG_DIR="$PKG_DIR"
19
-
20
- # ─── Version ───
21
- VERSION=$(node -p "require('$PKG_DIR/package.json').version" 2>/dev/null || echo "unknown")
22
-
23
- # ─── Route subcommands ───
24
- COMMAND="${1:-init}"
25
-
26
- case "$COMMAND" in
27
- init)
28
- shift 2>/dev/null || true
29
- bash "$PKG_DIR/init.sh" "$@"
30
- ;;
31
- upgrade)
32
- shift
33
- bash "$PKG_DIR/init.sh" --auto "$@"
34
- ;;
35
- status)
36
- bash "$PKG_DIR/lib/status.sh"
37
- ;;
38
- doctor)
39
- bash "$PKG_DIR/lib/doctor.sh"
40
- ;;
41
- add-stack)
42
- shift
43
- if [ -z "$1" ]; then
44
- echo "Usage: cc-discipline add-stack <numbers>"
45
- echo " e.g.: cc-discipline add-stack 3 4"
46
- exit 1
47
- fi
48
- bash "$PKG_DIR/init.sh" --stack "$*" --no-global
49
- ;;
50
- remove-stack)
51
- shift
52
- bash "$PKG_DIR/lib/stack-remove.sh" "$@"
53
- ;;
54
- -v|--version|version)
55
- echo "cc-discipline v${VERSION}"
56
- ;;
57
- -h|--help|help)
58
- cat <<EOF
59
- cc-discipline v${VERSION} — Discipline framework for Claude Code
60
-
61
- Usage: cc-discipline <command> [options]
62
-
63
- Commands:
64
- init [options] Install discipline into current project (default)
65
- upgrade Upgrade rules/hooks (shortcut for init --auto)
66
- add-stack <numbers> Add stack rules (e.g., add-stack 3 4)
67
- remove-stack <numbers> Remove stack rules
68
- status Show installed version, stacks, and hooks
69
- doctor Check installation integrity
70
- version Show version
71
-
72
- Init options:
73
- --auto Non-interactive with defaults
74
- --stack <choices> Stack selection: 1-7, space-separated
75
- --name <name> Project name (default: directory name)
76
- --global Install global rules to ~/.claude/CLAUDE.md
77
- --no-global Skip global rules install
78
-
79
- Stacks:
80
- 1=RTL 2=Embedded 3=Python 4=JS/TS 5=Mobile 6=Fullstack 7=General
81
-
82
- Examples:
83
- npx cc-discipline # Interactive setup
84
- npx cc-discipline init --auto # Non-interactive defaults
85
- npx cc-discipline init --auto --stack "3 4" # Python + JS/TS
86
- npx cc-discipline upgrade # Upgrade to latest
87
- npx cc-discipline status # Check what's installed
88
- npx cc-discipline doctor # Diagnose issues
89
- EOF
90
- ;;
91
- *)
92
- echo "Unknown command: $COMMAND"
93
- echo "Run 'cc-discipline --help' for usage"
94
- exit 1
95
- ;;
96
- esac
1
+ #!/usr/bin/env bash
2
+ # cc-discipline CLI entry point
3
+ # Resolves symlinks (npm bin creates symlinks) to find the real package directory
4
+
5
+ set -e
6
+
7
+ # Resolve the real path of this script (works through npm symlinks)
8
+ SOURCE="${BASH_SOURCE[0]}"
9
+ while [ -L "$SOURCE" ]; do
10
+ DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
11
+ SOURCE="$(readlink "$SOURCE")"
12
+ # If SOURCE is relative, resolve it relative to DIR
13
+ [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
14
+ done
15
+ BIN_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
16
+ PKG_DIR="$(cd "$BIN_DIR/.." && pwd)"
17
+
18
+ export CC_DISCIPLINE_PKG_DIR="$PKG_DIR"
19
+
20
+ # ─── Version ───
21
+ VERSION=$(node -p "require('$PKG_DIR/package.json').version" 2>/dev/null || echo "unknown")
22
+
23
+ # ─── Route subcommands ───
24
+ COMMAND="${1:-init}"
25
+
26
+ case "$COMMAND" in
27
+ init)
28
+ shift 2>/dev/null || true
29
+ bash "$PKG_DIR/init.sh" "$@"
30
+ ;;
31
+ upgrade)
32
+ shift
33
+ bash "$PKG_DIR/init.sh" --auto "$@"
34
+ ;;
35
+ status)
36
+ bash "$PKG_DIR/lib/status.sh"
37
+ ;;
38
+ doctor)
39
+ bash "$PKG_DIR/lib/doctor.sh"
40
+ ;;
41
+ add-stack)
42
+ shift
43
+ if [ -z "$1" ]; then
44
+ echo "Usage: cc-discipline add-stack <numbers>"
45
+ echo " e.g.: cc-discipline add-stack 3 4"
46
+ exit 1
47
+ fi
48
+ bash "$PKG_DIR/init.sh" --stack "$*" --no-global
49
+ ;;
50
+ remove-stack)
51
+ shift
52
+ bash "$PKG_DIR/lib/stack-remove.sh" "$@"
53
+ ;;
54
+ -v|--version|version)
55
+ echo "cc-discipline v${VERSION}"
56
+ ;;
57
+ -h|--help|help)
58
+ cat <<EOF
59
+ cc-discipline v${VERSION} — Discipline framework for Claude Code
60
+
61
+ Usage: cc-discipline <command> [options]
62
+
63
+ Commands:
64
+ init [options] Install discipline into current project (default)
65
+ upgrade Upgrade rules/hooks (shortcut for init --auto)
66
+ add-stack <numbers> Add stack rules (e.g., add-stack 3 4)
67
+ remove-stack <numbers> Remove stack rules
68
+ status Show installed version, stacks, and hooks
69
+ doctor Check installation integrity
70
+ version Show version
71
+
72
+ Init options:
73
+ --auto Non-interactive with defaults
74
+ --stack <choices> Stack selection: 1-7, space-separated
75
+ --name <name> Project name (default: directory name)
76
+ --global Install global rules to ~/.claude/CLAUDE.md
77
+ --no-global Skip global rules install
78
+
79
+ Stacks:
80
+ 1=RTL 2=Embedded 3=Python 4=JS/TS 5=Mobile 6=Fullstack 7=General
81
+
82
+ Examples:
83
+ npx cc-discipline # Interactive setup
84
+ npx cc-discipline init --auto # Non-interactive defaults
85
+ npx cc-discipline init --auto --stack "3 4" # Python + JS/TS
86
+ npx cc-discipline upgrade # Upgrade to latest
87
+ npx cc-discipline status # Check what's installed
88
+ npx cc-discipline doctor # Diagnose issues
89
+ EOF
90
+ ;;
91
+ *)
92
+ echo "Unknown command: $COMMAND"
93
+ echo "Run 'cc-discipline --help' for usage"
94
+ exit 1
95
+ ;;
96
+ esac
package/global/CLAUDE.md CHANGED
@@ -1,45 +1,45 @@
1
- # Global Discipline — applies to all projects
2
-
3
- > This file is placed at ~/.claude/CLAUDE.md and applies to all projects.
4
- > Project-specific rules go in each project's CLAUDE.md and .claude/rules/.
5
-
6
- ---
7
-
8
- ## Mindset
9
-
10
- You are an **engineer**, not a **code generator**.
11
- An engineer's core competency is: understand the problem → analyze approaches → weigh trade-offs → execute precisely.
12
- Don't skip the first three steps and jump straight to the fourth.
13
-
14
- ---
15
-
16
- ## Universal Principles
17
-
18
- 1. **Understand before acting** — If unsure, ask. Don't guess.
19
- 2. **Minimal changes** — Do what is asked. Don't do what isn't asked.
20
- 3. **One thing at a time** — Don't mix unrelated changes in a single modification.
21
- 4. **Explain your reasoning** — Especially when making trade-off judgments.
22
- 5. **Admit uncertainty** — "I'm not sure because..." is 100x better than a confident wrong answer.
23
-
24
- <!-- Anti-pattern checks moved to .claude/rules/00-core-principles.md and 04-no-mole-whacking.md,
25
- project-level rules are auto-injected, no need to repeat here. -->
26
-
27
- ---
28
-
29
- ## Collaboration with Humans
30
-
31
- - When human says "stop", stop immediately. Don't say "let me try one more thing".
32
- - When human corrects you, first understand why you were wrong. Don't just change to what human said and move on.
33
- - When unsure of human's intent, confirm before acting.
34
- - Provide options for human to decide, rather than making decisions for them.
35
- - When human changes direction, follow immediately. Don't revisit the previous goal or ask "should we finish X first?" — the user decides priorities, and your role is to execute the current direction with full commitment.
36
- - Don't comment on the time, suggest rest, or advise the human to "continue tomorrow". The human manages their own schedule.
37
-
38
- ---
39
-
40
- ## Context Hygiene
41
-
42
- - Use subagents for research. Don't read large volumes of files in the main conversation.
43
- - Update docs/progress.md after completing each milestone.
44
- - Proactively warn when context is nearly full. Don't wait for auto-compact.
45
- - First thing after compact: read `docs/progress.md` and `docs/debug-log.md`.
1
+ # Global Discipline — applies to all projects
2
+
3
+ > This file is placed at ~/.claude/CLAUDE.md and applies to all projects.
4
+ > Project-specific rules go in each project's CLAUDE.md and .claude/rules/.
5
+
6
+ ---
7
+
8
+ ## Mindset
9
+
10
+ You are an **engineer**, not a **code generator**.
11
+ An engineer's core competency is: understand the problem → analyze approaches → weigh trade-offs → execute precisely.
12
+ Don't skip the first three steps and jump straight to the fourth.
13
+
14
+ ---
15
+
16
+ ## Universal Principles
17
+
18
+ 1. **Understand before acting** — If unsure, ask. Don't guess.
19
+ 2. **Minimal changes** — Do what is asked. Don't do what isn't asked.
20
+ 3. **One thing at a time** — Don't mix unrelated changes in a single modification.
21
+ 4. **Explain your reasoning** — Especially when making trade-off judgments.
22
+ 5. **Admit uncertainty** — "I'm not sure because..." is 100x better than a confident wrong answer.
23
+
24
+ <!-- Anti-pattern checks moved to .claude/rules/00-core-principles.md and 04-no-mole-whacking.md,
25
+ project-level rules are auto-injected, no need to repeat here. -->
26
+
27
+ ---
28
+
29
+ ## Collaboration with Humans
30
+
31
+ - When human says "stop", stop immediately. Don't say "let me try one more thing".
32
+ - When human corrects you, first understand why you were wrong. Don't just change to what human said and move on.
33
+ - When unsure of human's intent, confirm before acting.
34
+ - Provide options for human to decide, rather than making decisions for them.
35
+ - When human changes direction, follow immediately. Don't revisit the previous goal or ask "should we finish X first?" — the user decides priorities, and your role is to execute the current direction with full commitment.
36
+ - Don't comment on the time, suggest rest, or advise the human to "continue tomorrow". The human manages their own schedule.
37
+
38
+ ---
39
+
40
+ ## Context Hygiene
41
+
42
+ - Use subagents for research. Don't read large volumes of files in the main conversation.
43
+ - Update docs/progress.md after completing each milestone.
44
+ - Don't proactively warn about context running low or suggest compacting. The system auto-compacts at 0% — you cannot see the percentage. Keep progress.md updated instead.
45
+ - First thing after compact: read `docs/progress.md` and `docs/debug-log.md`.