cc-discipline 2.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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/README.zh-CN.md +207 -0
  4. package/bin/cli.sh +96 -0
  5. package/global/CLAUDE.md +43 -0
  6. package/init.sh +486 -0
  7. package/lib/doctor.sh +145 -0
  8. package/lib/stack-remove.sh +68 -0
  9. package/lib/status.sh +95 -0
  10. package/package.json +34 -0
  11. package/templates/.claude/agents/investigator.md +44 -0
  12. package/templates/.claude/agents/reviewer.md +46 -0
  13. package/templates/.claude/hooks/action-counter.sh +28 -0
  14. package/templates/.claude/hooks/phase-gate.sh +10 -0
  15. package/templates/.claude/hooks/post-error-remind.sh +109 -0
  16. package/templates/.claude/hooks/pre-edit-guard.sh +79 -0
  17. package/templates/.claude/hooks/session-start.sh +43 -0
  18. package/templates/.claude/hooks/streak-breaker.sh +111 -0
  19. package/templates/.claude/rules/00-core-principles.md +12 -0
  20. package/templates/.claude/rules/01-debugging.md +22 -0
  21. package/templates/.claude/rules/02-before-edit.md +11 -0
  22. package/templates/.claude/rules/03-context-mgmt.md +19 -0
  23. package/templates/.claude/rules/04-no-mole-whacking.md +26 -0
  24. package/templates/.claude/rules/05-phase-discipline.md +13 -0
  25. package/templates/.claude/rules/06-multi-task.md +11 -0
  26. package/templates/.claude/rules/07-integrity.md +81 -0
  27. package/templates/.claude/rules/stacks/embedded.md +24 -0
  28. package/templates/.claude/rules/stacks/js-ts.md +21 -0
  29. package/templates/.claude/rules/stacks/mobile.md +16 -0
  30. package/templates/.claude/rules/stacks/python.md +20 -0
  31. package/templates/.claude/rules/stacks/rtl.md +24 -0
  32. package/templates/.claude/settings.json +75 -0
  33. package/templates/.claude/skills/commit/SKILL.md +40 -0
  34. package/templates/.claude/skills/evaluate/SKILL.md +57 -0
  35. package/templates/.claude/skills/self-check/SKILL.md +62 -0
  36. package/templates/CLAUDE.md +80 -0
  37. package/templates/docs/debug-log.md +48 -0
  38. package/templates/docs/progress.md +29 -0
  39. package/templates/memory/MEMORY.md +23 -0
@@ -0,0 +1,48 @@
1
+ # Debug Log
2
+
3
+ > Maintained by Claude Code during debugging sessions.
4
+ > Prevents repeated dead ends after compact. Prevents mole-whacking.
5
+ > Do not edit this file manually — let Claude maintain it.
6
+
7
+ ---
8
+
9
+ ## Active Debug Sessions
10
+
11
+ <!-- Claude: create a new entry below when starting a debug session -->
12
+
13
+ ---
14
+
15
+ ## Debug Entry Template
16
+
17
+ <!--
18
+ Copy the template below to create a new debug entry:
19
+
20
+ ### [date] — [one-line problem description]
21
+
22
+ **Symptoms**: [specific error messages or abnormal behavior]
23
+
24
+ **Reproduction conditions**: [how to trigger the problem]
25
+
26
+ **Hypothesis list**:
27
+ | # | Hypothesis | Supporting evidence | Contradicting evidence | Status |
28
+ |---|-----------|-------------------|----------------------|--------|
29
+ | 1 | | | | [status] |
30
+ | 2 | | | | [status] |
31
+ | 3 | | | | [status] |
32
+
33
+ Status values: pending → eliminated / confirmed
34
+
35
+ **Root cause**: [fill in after confirmed]
36
+
37
+ **Fix**: [describe the fix and how it addresses the root cause]
38
+
39
+ **Verification**: [results after fixing]
40
+
41
+ **Lessons learned**: [what was learned; should CLAUDE.md "Known Pitfalls" be updated?]
42
+ -->
43
+
44
+ ---
45
+
46
+ ## Closed Debug Sessions
47
+
48
+ <!-- Claude: move completed entries here -->
@@ -0,0 +1,29 @@
1
+ # Progress & Decision Log
2
+
3
+ > Maintained by Claude Code during work sessions. Read this file after compact to restore context.
4
+ > Do not edit this file manually — let Claude maintain it.
5
+
6
+ ---
7
+
8
+ ## Current Status
9
+
10
+ - **In progress**: [none]
11
+ - **Last updated**: [none]
12
+ - **Next steps**: [none]
13
+ - **Modified files**: [none]
14
+
15
+ ---
16
+
17
+ ## Milestones
18
+
19
+ <!-- Claude: append a record below after completing each milestone -->
20
+
21
+ ---
22
+
23
+ ## Key Decisions
24
+
25
+ <!-- Claude: record decisions and reasoning below when making architectural/design decisions -->
26
+
27
+ | # | Decision | Reason | Impact Scope | Date |
28
+ |---|----------|--------|-------------|------|
29
+ | | | | | |
@@ -0,0 +1,23 @@
1
+ # Project Discipline (cc-discipline framework)
2
+
3
+ This project has cc-discipline installed. Note the following at the start of each new conversation.
4
+
5
+ ## Three Lines of Defense
6
+ 1. **Rules** (`.claude/rules/`) — Auto-injected by file path; editing source code triggers checklists
7
+ 2. **Hooks** (`.claude/hooks/`) — Run automatically before/after edits; can block operations (exit 2)
8
+ 3. **Agents** (`.claude/agents/`) — Reviewer audits proposals; investigator performs isolated research
9
+
10
+ ## Hook Behavior
11
+ - `pre-edit-guard.sh` — **Blocks source code edits** when there are unverified hypotheses; update docs/debug-log.md first
12
+ - `streak-breaker.sh` — Warns at >=3 edits to the same file, **hard stop** at >=5
13
+ - `post-error-remind.sh` — Injects debugging process reminder when errors are detected (via exit 2 feedback)
14
+
15
+ ## Key Files
16
+ - `docs/progress.md` — Progress log, updated at each milestone; first thing to read after compact
17
+ - `docs/debug-log.md` — Debug log, hypotheses marked "pending"/"confirmed"; affects pre-edit-guard
18
+
19
+ ## Core Discipline
20
+ - Understand before acting; don't lock onto first explanation (>=2 alternative hypotheses)
21
+ - 3 consecutive failures → stop and report
22
+ - Don't mole-whack — repeated edits to the same file means root cause not found
23
+ - Four debugging phases: gather → hypothesize → verify → fix; no skipping steps