cc-discipline 2.15.1 → 2.16.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-discipline",
3
- "version": "2.15.1",
3
+ "version": "2.16.0",
4
4
  "description": "Discipline framework for Claude Code — rules, hooks, and agents that keep AI on track",
5
5
  "bin": {
6
6
  "cc-discipline": "bin/cli.js"
@@ -643,7 +643,12 @@ AWK
643
643
  if [ ${#INPUT} -gt 65536 ]; then
644
644
  VERDICT=TOOLONG
645
645
  else
646
- VERDICT=$(awk "$PROG" <<<"$INPUT" 2>/dev/null)
646
+ # awk runs with LC_ALL=C: byte semantics everywhere, which is how this code is
647
+ # written. Under a UTF-8 locale, macOS's awk is still byte-based for substr()
648
+ # and length(), but a regex match against half a multi-byte character is
649
+ # fatal ("towc: multibyte conversion failure"). 2.15.1 died that way on
650
+ # "## 2026-08-04(三)" and fell back to the file's tail (2026-09-25).
651
+ VERDICT=$(LC_ALL=C awk "$PROG" <<<"$INPUT" 2>/dev/null)
647
652
  fi
648
653
  TAB=$'\t'
649
654
  NOTE="" # never inherited from the environment
@@ -43,6 +43,11 @@ fi
43
43
  # condition" is only said when every item actually has one.
44
44
  # Comment state is tracked on every line, before any heading test, so a heading
45
45
  # written inside <!-- ... --> neither opens nor closes a section.
46
+ # awk runs with LC_ALL=C: byte semantics everywhere, which is how this code is
47
+ # written. Under a UTF-8 locale, macOS's awk is still byte-based for substr()
48
+ # and length(), but a regex match against half a multi-byte character is
49
+ # fatal ("towc: multibyte conversion failure"). 2.15.1 died that way on
50
+ # "## 2026-08-04(三)" and fell back to the file's tail (2026-09-25).
46
51
  # Every fork costs tens of milliseconds on Windows Git Bash, so awk strips the
47
52
  # CRs itself and its output is parsed with bash builtins: this runs at the
48
53
  # start of every session.
@@ -83,7 +88,7 @@ function skip() {
83
88
  STATUS=""; STATUS_NOTE=""
84
89
  if [ -f "docs/progress.md" ]; then
85
90
  # One pass. Emits "@key=value" lines, then the capped body as "|line".
86
- PROGRESS=$(awk "$AWK_LIB"'
91
+ PROGRESS=$(LC_ALL=C awk "$AWK_LIB"'
87
92
  BEGIN { lines = 15 }
88
93
  { sub(/\r$/, "") }
89
94
  /<!--[ \t]*cc-discipline:[ \t]*status-lines=/ {
@@ -152,7 +157,7 @@ if [ -f "docs/todo.md" ]; then
152
157
  # One pass: the Now body (capped at 20), and Later's top-level items. An open
153
158
  # item is a top-level bullet that isn't ticked ("- [ ] x" or "- x", not
154
159
  # "- [x] x"); indented lines belong to the item above them.
155
- TODO=$(awk "$AWK_LIB"'
160
+ TODO=$(LC_ALL=C awk "$AWK_LIB"'
156
161
  function close_item() { if (item && !cond) nocond++; item = 0 }
157
162
  { sub(/\r$/, "") }
158
163
  { k = skip() }
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: ask-me
3
+ description: Put a decision to the user so they can answer in one step — a few lines of background, then a single- or multi-select question with the recommended option first.
4
+ when_to_use: When the user types /ask-me or says "带着背景和选项问我" / "带着选项问我" / "ask me with options". On your own, only when you are blocked on something that is the user's call (scope, approach, a trade-off, anything irreversible or outward-facing) or on intent or environment that no file or command can tell you. Not for what the code, the docs or a conventional default settles.
5
+ ---
6
+
7
+ Ask the user a question they can answer in one step.
8
+
9
+ This replaces two failures. One is a wall of text with the real question buried at the end. The other is a bare open question the user cannot answer, because the context needed to answer it is in your head, not theirs.
10
+
11
+ ## 1. Decide what actually needs asking
12
+
13
+ - **Topic.** If the user gave arguments, that is the topic. Otherwise it is whatever decision is pending in the conversation: the thing you would otherwise ask in prose, or quietly guess.
14
+ - **Settle what you can first.** Read the file, run the command, check `docs/progress.md` and `docs/todo.md`. Ask only what is left, which should be the user's preferences and direction, or facts only they know. A question whose answer is in the repo wastes the user's turn.
15
+ - **Nothing pending?** If nothing is actually open, say so in one line and stop. Do not invent a question so that the skill has something to do.
16
+
17
+ ## 2. Background first, in plain text, briefly
18
+
19
+ Write three to six lines before the question, covering only what the user needs in order to choose:
20
+
21
+ - what is already settled;
22
+ - where things are stuck, and why it is the user's call: a trade-off, a preference, a risk;
23
+ - anything you checked that changes the options, with `file:line` when it helps.
24
+
25
+ Save the analysis of each option for that option's description. If the background runs past about six lines, you are explaining too much or asking too early.
26
+
27
+ ## 3. Ask with AskUserQuestion
28
+
29
+ - **Questions.** Ask one to four per call, and only ones whose answer changes what you do next. Put related questions in the same call rather than drip-feeding them. Write them in the user's language.
30
+ - **Options.**
31
+ - Give two to four per question, and make them genuinely different.
32
+ - Do not add an "Other" option; the tool provides one.
33
+ - Put your recommendation first and mark it in the user's language, "(推荐)" or "(Recommended)". Its description says why in one sentence.
34
+ - If you have no basis for recommending one, say that in the background rather than marking one at random.
35
+ - **Descriptions.** Each option's description says what happens if it is chosen and what that costs. Do not restate the label.
36
+ - **Header.** At most 12 characters.
37
+ - **multiSelect.** Use it only when the choices combine, for example which items to include. An empty multi-select answer is ambiguous: ask again rather than assume.
38
+ - **preview.** Use it when the user needs to compare concrete artifacts: code, configuration, layouts. It works for single-select questions only.
39
+
40
+ ## 4. After the answer
41
+
42
+ - **Act on what was answered, and only that.** An answer to "which approach" chooses the approach. It is not approval for irreversible or outward-facing steps, such as publishing, pushing or deleting; those still get their own confirmation.
43
+ - **"Other" with free text.** Treat it as the user's own words. If it changes the premise, re-plan instead of squeezing it into one of your options.
44
+ - **Question rejected or interrupted.** Stop and wait: the user is about to tell you something. Do not re-ask the same questions. When they reply, work out which of your assumptions their correction overturns.
45
+
46
+ ## When the tool is unavailable
47
+
48
+ Some contexts block the question tool: `/self-check` lists it under `disallowed-tools`, and non-interactive runs have no UI. Fall back to text:
49
+
50
+ 1. Give the same background.
51
+ 2. Number the questions and letter the options, recommendation first and marked, so the user can reply "1A 2B".
52
+
53
+ Keep it as short as the tool version would be.
@@ -28,15 +28,14 @@ State your assessment: "This looks [small/medium/large] because [reason]."
28
28
 
29
29
  ## Step 2: Understand
30
30
 
31
- Ask 2-3 clarifying questions about the task. Focus on:
31
+ Ask only what Step 0 could not settle. After the research, what is left should be preference and direction, not facts you could have read. A question asked before looking is one the user should never have had to answer. Focus on:
32
32
  - What exactly should change? (scope)
33
33
  - What should NOT change? (boundaries)
34
34
  - How will we know it's done? (success criteria)
35
35
 
36
36
  Rules:
37
- - One message, all questions at once (don't drip-feed)
38
- - Prefer multiple-choice over open-ended when possible
39
- - Reference what you learned in Step 0 — ask about gaps in your understanding, not things you can read yourself
37
+ - Ask them the `/ask-me` way: a few lines of background from Step 0, then the question tool, with your recommendation first
38
+ - As many questions as the task needs, up to four per call, all at once rather than drip-fed
40
39
  - If the task is already crystal clear from Step 0, say so and skip to Step 3
41
40
 
42
41
  ## Step 3: Propose
@@ -91,6 +90,8 @@ If self-review reveals issues, revise your proposals before presenting. Don't sh
91
90
 
92
91
  **Stop here. Do not proceed until the user picks an approach or gives a green light.**
93
92
 
93
+ Ask for the pick the `/ask-me` way: one question, the approaches from Step 3 as its options, your recommendation first. The write-up from Step 3 is the background. If `/coplan` is stacked, it writes the plan and offers the review first, and the pick comes after.
94
+
94
95
  Do not:
95
96
  - Start coding "while waiting"
96
97
  - Create files or scaffolding — **except** writing the plan itself to disk, which is not implementation. `/coplan` does exactly that and is designed to stack here.