Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.

feat(cli): --help 에서 deprecated 서브명령을 별도 구획으로 분리한다 - #373

Merged
ictechgy merged 2 commits into
mainfrom
feat/mark-deprecated-subcommands-in-help
Sep 6, 2026
Merged

ictechgy merged 2 commits into
mainfrom
feat/mark-deprecated-subcommands-in-help

Conversation

@ictechgy

@ictechgy ictechgy commented Sep 6, 2026

Copy link
Copy Markdown
Owner

문제

context-guard --help 는 새 사용자가 가장 먼저 읽는 표면인데, 27개 서브명령을 설명 없이 한 덩어리로 나열하면서 0.14.0 이 deprecated 로 표시한 다섯 헬퍼를 "Common subcommands" 안에 두고 있었다. help 출력 41줄에 deprecat 문자열이 한 번도 나오지 않았다.

왜 상수인가

각 헬퍼는 이미 자기 소스에 [deprecated] 표식을 갖고 있다(context_compress.py, context_filter.py, context_pack.py, tool_schema_pruner.py, statusline.sh, statusline_merged.sh). 그러나 디스패처는 헬퍼를 import 하지도 실행하지도 않고 명령 매니페스트를 데이터로만 읽는다. 이는 docs/safety-reference.md 가 명시한 신뢰 경계다. 따라서 목록은 상수일 수밖에 없고, 상수와 헬퍼가 갈라지는 것이 유일한 위험이라 그것만 정확히 막는 테스트를 함께 넣는다.

결과

Common subcommands:
  artifact / audit / bench / cache-score / cost / diet / doctor / failed-nudge
  guard-read / hooks / mcp / read-symbol / reference / rewrite-bash / sanitize
  sanitize-output / scan / setup / task-memory / trim / trim-output

Deprecated, still shipped (see docs/guide.md before using):
  compress / filter / pack / statusline / statusline-merged / tool-prune

모든 서브명령은 여전히 정확히 한 번 나온다(테스트로 고정).

드리프트 가드

tests/test_cli_deprecation_surface.py배포되는 plugins/context-guard/bin 사본을 읽어 [deprecated] 표식이 있는 헬퍼 집합과 상수가 정확히 일치하는지 검사한다. 매핑이 (helper, *고정인자) 형태인 doctor/reference/scan 은 첫 요소만 본다.

변이 4종이 모두 잡힌다.

변이 결과
집합에서 pack 제거 잡힘
비-deprecated 인 audit 추가 잡힘
help 를 한 덩어리로 되돌리기 잡힘
매니페스트에 없는 이름 추가 잡힘

의도적으로 하지 않은 것

context_pack.py:6343 의 "P3 live-evidence contract 가 핀해서 계속 배포한다" 는 문구는 고치지 않았다. 확인해 보니 허위가 아니라 불완전한 서술이다. P3 v4 가 canonical_packer 로 실제로 핀하는 것은 맞고, 동시에 Stage-2 protected-surface manifest 도 같은 파일을 lstat 으로 잡고 있어 P3 를 풀어도 삭제되지 않는다. 그 한 줄을 고치려면 보호 표면과 P3 두 캐스케이드를 모두 돌려야 해서 비용이 이득보다 크다.

검증

tests.test_cli_deprecation_surface + stage2   Ran 13 OK, exit 0
scripts/ci_test_gate.py fast                  Ran 76 OK, exit 0
실제 3.11 compileall                          exit 0
scripts/sync_plugin_copies.py --check         plugin copies synchronized
scripts/prepublish_check.py --skip-tests      prepublish check: OK, exit 0
scripts/release_preflight.py                  경고 없음, exit 0

조상 SHA 를 고정하지 않으므로 squash 로 병합해도 된다.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DE3AupXcyv64SEuQeTckSh

`context-guard --help` 는 새 사용자가 가장 먼저 읽는 표면인데, 27개 서브명령을
설명 없이 한 덩어리로 나열하면서 0.14.0 이 deprecated 로 표시한 다섯 헬퍼를
"Common subcommands" 안에 그대로 두고 있었다. help 출력에 "deprecat" 문자열이
한 번도 나오지 않았다.

각 헬퍼는 이미 자기 소스에 [deprecated] 표식을 갖고 있다. 그러나 디스패처는
헬퍼를 import 하지도 실행하지도 않고 명령 매니페스트를 데이터로만 읽으므로
(신뢰 경계상 의도된 설계다) 목록을 상수로 둘 수밖에 없다. 상수와 헬퍼가 갈라지는
것이 이 방식의 유일한 위험이라, 그것만 정확히 막는 테스트를 함께 넣는다.

- context_guard_cli.py: DEPRECATED_SUBCOMMANDS 를 추가하고 print_help 가
  "Common subcommands" 와 "Deprecated, still shipped (see docs/guide.md before
  using)" 두 구획으로 나눠 출력한다. 모든 서브명령은 여전히 정확히 한 번 나온다.
- tests/test_cli_deprecation_surface.py: 배포되는 plugins/context-guard/bin 사본을
  읽어 [deprecated] 표식이 있는 헬퍼 집합과 상수가 정확히 일치하는지 검사한다.
  매핑이 (helper, *고정인자) 형태인 doctor/reference/scan 은 첫 요소만 본다.
- 새 테스트 파일을 PROVIDER_FREE_SUPPORT_PATHS 에 선언한다.

context_pack.py:6343 의 "P3 live-evidence contract 가 핀해서 계속 배포한다" 는
문구는 이번에 고치지 않았다. 확인해 보니 P3 v4 가 canonical_packer 로 실제로
핀하는 것은 맞고(허위가 아니라 불완전한 서술이다), Stage-2 protected-surface
manifest 도 같은 파일을 lstat 으로 잡고 있어 P3 를 풀어도 삭제되지 않는다.
그 한 줄을 고치려면 보호 표면과 P3 두 캐스케이드를 모두 돌려야 해서 비용이
이득보다 크다.

변이 4종이 모두 잡히는 것을 확인했다: 집합에서 pack 제거, 비-deprecated 인 audit
추가, help 를 한 덩어리로 되돌리기, 매니페스트에 없는 이름 추가.

검증: tests.test_cli_deprecation_surface + stage2 13건 OK, ci_test_gate fast 76건 OK,
실제 3.11 compileall exit 0, sync_plugin_copies --check 동기화 확인,
prepublish_check --skip-tests OK, release_preflight 경고 없음.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DE3AupXcyv64SEuQeTckSh
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: efa6efc4-efa6-4f83-a161-99b66e2981e2


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

GLM 리뷰의 지적 (2)가 타당했다. `"[deprecated]" in text` 는 파일 전체 부분문자열
검색이라 changelog 성 주석, docstring 의 언급, 로그 문자열만으로도 "이 헬퍼는
deprecated 를 선언했다" 로 오판한다. 더 나쁜 방향은 게이밍이다. 드리프트 테스트가
실패했을 때 무관한 위치에 문자열을 끼워 넣어 흡수하면 잘못된 의미론이 조용히
고정된다.

이제 헬퍼가 실제로 선언하는 두 자리에만 매치한다.
- 셸 진입점의 선행 주석: 들여쓰기 4칸 이내의 `# [deprecated]`
- 파이썬 진입점의 argparse: `description="[deprecated]` (괄호로 감싼 형태 포함)

`\[deprecated\]\b` 를 쓰지 않는다. `]` 가 비단어 문자라 뒤에 단어 문자가 와야만
경계가 생기는데 실제 선언은 `] ` 로 이어져서 아무것도 매치하지 않았다. 이 버그는
아래 표 케이스가 잡아냈다.

패턴 케이스 8종을 직접 확인했다. 셸 선행 주석·argparse 한 줄·argparse 괄호 분할은
탐지하고, docstring 언급·로그 문자열·깊게 들여쓴 주석·`help=` 인자·줄 중간 언급은
탐지하지 않는다. 배포 사본 전체에 돌리면 정확히 deprecated 헬퍼 6개만 나온다.

GLM 의 지적 (4)는 조치하지 않았다. kit 소스만 고치고 미러를 빠뜨리는 경로는 이
테스트가 아니라 `scripts/sync_plugin_copies.py --check` 가 잡고, 그 스텝은 fast-pr
에 이미 있다. 그 사실을 docstring 에 적어 두었다.

변이 4종이 모두 잡히는 것을 확인했다: 상수에서 pack 제거, 비-deprecated 인 audit
추가, 헬퍼가 선언을 잃는 경우, 그리고 무관한 헬퍼에 표식을 붙여 침묵시키려는 시도.

검증: tests.test_cli_deprecation_surface 4건 OK, ci_test_gate fast 76건 OK,
sync_plugin_copies --check 동기화 확인.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DE3AupXcyv64SEuQeTckSh
@ictechgy
ictechgy merged commit c374ff0 into main Sep 6, 2026
6 checks passed
@ictechgy
ictechgy deleted the feat/mark-deprecated-subcommands-in-help branch September 6, 2026 04:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant