Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/leeyudok/agents-scaffold/sonargit clone --depth 1 https://github.com/LeeYudok/agents-scaffoldWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/leeyudok/agents-scaffold/sonar)<a href="https://agentmods.dev/commands/leeyudok/agents-scaffold/sonar"><img src="https://agentmods.dev/badge/commands/leeyudok/agents-scaffold/sonar.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00035 | $0.01446 |
| Opus 5 | $0.00017 | $0.00723 |
| Sonnet 5 | $0.00007 | $0.00289 |
| Haiku 4.5 | $0.00003 | $0.00145 |
Grade C, and why
sonar scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Downloads and executes remote codehighSupply chain
curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.
status=$(curl -s -u "$token:" "http://localhost:9000/api/ce/task?id=$ceTaskId" | python3 -c "import sys,json; print(json.load(sys.stdin)['task']['status'])") Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
- **host 사전 리브니스 체크**: `curl -s -o /dev/null -w "%{http_code}" $host/api/system/status` → 200 아니면 properties 의 URL 이 죽은 주소(예: 방치된 `localhost:9000`)일 수 있음. 실제 서버 확인 후 `-Dsonar.host.url` 로 override. How it starts
The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SonarQube 정적분석을 실행하고 결과를 요약한다.
인자 파싱
$ARGUMENTS 첫 단어가 서브커맨드. 없으면 현재 지표 요약.
| 서브커맨드 | 동작 |
|---|---|
| (없음) | 캐시된 현 지표 요약 |
rescan |
스캐너 실행 + CE task 폴링 + 결과 요약 |
hotspots |
TO_REVIEW 보안 핫스팟 조회 |
coverage |
커버리지 분석 |
qg |
Quality Gate 조건 breakdown |
<path> |
해당 경로 CRITICAL 이슈만 필터 |
API 접속
sonar-project.properties에서sonar.projectKey와sonar.host.url읽기- 토큰은 환경변수 우선 —
SONAR_TOKEN(또는 프로젝트.env).sonar-project.properties에 토큰 저장 금지: 커밋되는 파일이라 git 히스토리로 유출된다.sonar.token라인이 이미 있으면 rotate + env 이관 권고. - host 사전 리브니스 체크:
curl -s -o /dev/null -w "%{http_code}" $host/api/system/status→ 200 아니면 properties 의 URL 이 죽은 주소(예: 방치된localhost:9000)일 수 있음. 실제 서버 확인 후-Dsonar.host.url로 override. - 인증:
curl -u "$SONAR_TOKEN:" ...또는curl -H "Authorization: Bearer $SONAR_TOKEN" ...
토큰 2종 구분:
sqp_Project Analysis Token →sonar-scanner실행, 일반 조회squ_User Token → hotspot 상태 변경 등 관리 API (403 나면 이쪽으로)
서브커맨드 상세
기본 — 현 지표 요약
token="${SONAR_TOKEN:?SONAR_TOKEN 설정 필요 (sonar-project.properties 에서 읽지 말 것)}"
key=$(grep 'sonar.projectKey' sonar-project.properties | cut -d= -f2-)
curl -s -u "$token:" \
"http://localhost:9000/api/measures/component?component=$key&metricKeys=bugs,vulnerabilities,code_smells,coverage,security_hotspots,duplicated_lines_density,ncloc"
표 형태로 출력: bugs / vulnerabilities / security_hotspots / code_smells / coverage / ncloc
rescan — 재스캔 + delta
- 서버 리브니스 체크 (API 접속 섹션 참조) — 스캐너 30초 hang 대신 조기 중단
- 현 수치
/tmp/sonar-before.json저장 - 스캐너는 명시 override 로 실행 (낡은 properties 값이 스캔을 납치하지 못하게):
sonar-scanner -Dsonar.host.url="$host" -Dsonar.token="$SONAR_TOKEN" - CE task 폴링 (최대 90초, 2초 간격):
for i in $(seq 1 45); do status=$(curl -s -u "$token:" "http://localhost:9000/api/ce/task?id=$ceTaskId" | python3 -c "import sys,json; print(json.load(sys.stdin)['task']['status'])") [ "$status" = "SUCCESS" ] && break [ "$status" = "FAILED" ] && { echo "task FAILED" >&2; break; } sleep 2 done - 분석 경고 확인 — CE task 응답의
warnings(대시보드 경고 배너와 동일). 인코딩 깨짐,sonar.python.version미지정 등은 이슈 목록엔 절대 안 나오고 여기만 나온다. 인코딩 경고 시 오염 파일 탐지:grep -rlI $'\xef\xbf\xbd' <source-dirs> # U+FFFD 치환문자 포함 파일 - 전/후 수치 delta 표시
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 100 lines · 35 tokens per session scan C b2504a8b1cad
sonar is a command published in the GitHub repository LeeYudok/agents-scaffold (25 stars, last pushed 6d ago), licensed MIT. It adds 35 tokens to every session and 1,446 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
refactor
Safely refactor code with test verification.
docs
Generate or update documentation for code.
fix-bugs
Detect and fix common bugs, anti-patterns, and code issues.
monitor
Monitor repository health, track issues, and identify maintenance tasks.
detailed-review
Structured code review with checklist and severity ratings.
security-check
Scan for security vulnerabilities in code and dependencies.