Skip to content

Add local tokenwar scan - #17

Merged
ousamabenyounes merged 1 commit into
mainfrom
feat/tokenwar-scan
Aug 31, 2026
Merged

ousamabenyounes merged 1 commit into
mainfrom
feat/tokenwar-scan

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add tokenwar scan, a local-only log scanner that estimates which TokenWar tools would have helped most
  • add an English tool map covering the core stack, strengths, weaknesses, and context-mode alternatives
  • document and test the new dispatcher subcommand
  • update the complementary-check fixture so it reflects the current six-tool stack (ponytail and pxpipe included)

Test verification (RED -> GREEN)

RED on origin/main with the new dispatcher test applied:

not ok 4 help lists the commands
# `[[ "$output" == *"scan"* ]]` failed

GREEN on this branch, targeted scope plus the fixed check fixture:

$ docker run --rm -v "$PWD:/repo" -w /repo node:20-bookworm bash -lc 'apt-get update >/dev/null && apt-get install -y --no-install-recommends bats shellcheck >/dev/null && shellcheck -S warning scripts/*.sh scripts/lib/*.sh && chmod +x scripts/*.sh && bats tests/check.bats tests/scan.bats tests/dispatcher.bats'
1..12
ok 1 R1 PASS
ok 2 R1 WARN
ok 3 R1 FAIL
ok 4 R2 PASS
ok 5 R3 always PASS
ok 6 Verdict COMPLEMENTARY when all PASS
ok 7 scan recommends shell, context, memory, and code tools from local logs
ok 8 scan json mode emits clients and recommendations
ok 9 dispatcher routes scan subcommand
ok 10 help lists the commands
ok 11 unknown command exits 2 with usage
ok 12 check subcommand runs the checker

Additional validation:

$ bash -n scripts/scan.sh scripts/tokenwar.sh tests/scan.bats tests/dispatcher.bats
$ git diff --check
$ TOKENWAR_SCAN_MAX_FILES=50 TOKENWAR_SCAN_MAX_BYTES_PER_FILE=65536 bash scripts/tokenwar.sh scan --all

Note: a full local Docker bats tests/ run in node:20-bookworm still fails in tests/statusline.bats, but the prior GitHub Actions run on this PR passed those statusline cases. The branch CI is the source of truth for that environment.

@ousamabenyounes
ousamabenyounes merged commit da52365 into main Aug 31, 2026
1 check passed
@ousamabenyounes
ousamabenyounes deleted the feat/tokenwar-scan branch August 31, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant