You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "Kaap10 (via GitHub)" <gi...@apache.org> on 2026/10/12 05:09:55 UTC
[PR] feat(setup): add zero-token /magpie-status Claude Code mod command (part of #1497) [magpie]
Kaap10 opened a new pull request, #1601:
URL: https://github.com/apache/magpie/pull/1601
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
## Summary
<!--
1-3 bullets: what changed and why. The "why" is what reviewers care
about most — a one-line summary of the motivation beats a paragraph
restating the diff.
-->
- **Zero-token status command (Pilot 2 of #1497):** Implemented `/magpie-status` in `plugins/magpie-setup` using Claude Code's mod system (`$.command.register` and `command.run`), rendering the adoption and health dashboard instantly with zero LLM turns and zero tokens consumed.
- **Deterministic collector parity & vendor neutrality:** Mod executes the canonical `collect_status.py` via `$.process.run` (supporting `--format md` default and `--format json` / `--format=json` / `--json` overrides, with automatic `python3` -> `python` fallback). This avoids duplicating 770+ lines of Python adoption logic in TypeScript while keeping the universal `/magpie-setup status` skill 100% operational for non-Claude harnesses.
- **Cross-platform robustness:** Defensively ensured UTF-8 stdout reconfiguration in `collect_status.py` against Windows console `cp1252` encoding errors, and normalized path separators in `drift-check.test.ts` for cross-platform mock matching.
## Type of change
<!-- Tick all that apply. -->
- [ ] Skill change (`.claude/skills/<name>/`) — eval fixtures updated below
- [ ] Tool / bridge contract (`tools/<system>/*.md`)
- [ ] Python package (`tools/*/` with `pyproject.toml`)
- [ ] Groovy reference impl
- [ ] Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
- [x] Documentation (`docs/`, `README.md`, `CONTRIBUTING.md`)
- [ ] Project template (`projects/_template/`)
- [ ] CI / dev loop (`prek`, workflows, validators)
- [x] Other: Claude Code mod / plugin command (`plugins/magpie-setup/hooks/`)
## Test plan
<!--
How you verified the change. Be specific. The reviewer reads this to
decide what to spot-check vs trust. Empty "ran the tests" doesn't help.
-->
- [x] `check-claude-mods` script (`tools/dev/check-claude-mods.sh`) passes:
- `claude plugin validate --strict plugins/magpie-setup` passes with zero errors.
- `claude plugin test plugins/magpie-setup` passes all 19 tests across 2 files (9 in `drift-check.test.ts`, 10 in `status-command.test.ts`).
- [x] For Python packages touched:
- `uv run pytest plugins/magpie-setup/skills/status/tests/` passes all 18 tests (100%).
- `uv run ruff check plugins/magpie-setup/skills/status/scripts/collect_status.py` passes with zero violations.
- `uv run ruff format --check plugins/magpie-setup/skills/status/scripts/collect_status.py` passes (already formatted).
- [x] Git hygiene:
- `git diff --check` passes with zero whitespace or line-ending warnings.
- End-to-end CLI tested: verified both `collect_status.py --format md --repo .` and `--format json --pretty --repo .` execute cleanly.
## RFC-AI-0004 compliance
<!--
Tick the principles the change touches. Skip rows that don't apply.
RFC-AI-0004 is the framework's constitution — see
docs/rfcs/RFC-AI-0004.md.
-->
- [x] **HITL** — `/magpie-status` is strictly read-only; mutation remains gated via the `setup` skill.
- [x] **Sandbox** — No unsandboxed background daemons, no network requests; subprocess executes an argument array directly without a shell.
- [x] **Vendor neutrality** — The universal Markdown workflow (`/magpie-setup status`) remains completely functional for non-Claude harnesses (Gemini CLI, Codex, Cursor).
- [ ] **Conversational + correctable** — agentic-override path documented if behaviour is adopter-tunable
- [x] **Write-access discipline** — Read-only telemetry; no autonomous outbound messages or file mutations.
- [x] **Privacy LLM** — Pure local deterministic execution; no data sent to external models.
## Linked issues
<!-- e.g. Closes #NNN, Refs #NNN. List every related issue. -->
Refs #1497 (Pilot 2)
## Notes for reviewers (optional)
<!--
Anything specific you want the reviewer to look at. Areas of uncertainty.
Trade-offs you considered and rejected. Decisions that the agent and you
disagreed on during the authoring loop.
-->
- **Single Source of Truth:** Rather than reimplementing adoption and symlink parsing logic in TypeScript, the mod executes `collect_status.py` deterministically via `$.process.run`.
- **Static AST Analysis Constraint:** Claude Code's static analyzer prohibits passing `$` across imported module boundaries. Hook registration (`session.start` and `command.run`) lives directly in `drift-check.ts` (keeping `hooks/hooks.json` to a single module entrypoint), while execution logic is delegated to the pure, testable `executeMagpieStatus` helper in `status-command.ts`.
- **Path Normalization in Tests:** `drift-check.test.ts` was updated to normalize Windows backslashes (`\`) to `/` in mock path endsWith checks so that the plugin test suite passes locally on Windows as well as in CI.
- **Defensive Unicode Handling:** `collect_status.py` now defensively reconfigures stdout encoding to UTF-8 (`try...except`) to prevent `charmap` encode exceptions on Windows `cp1252` terminals when rendering status indicator emojis.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(setup): add zero-token /magpie-status Claude Code mod command (part of #1497) [magpie]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #1601:
URL: https://github.com/apache/magpie/pull/1601#discussion_r4244898569
##########
plugins/magpie-setup/skills/status/scripts/collect_status.py:
##########
@@ -758,6 +758,12 @@
"gitignore": gitignore_coverage(root, targets),
}
+ try:
+ if getattr(sys.stdout, "reconfigure", None):
+ sys.stdout.reconfigure(encoding="utf-8")
+ except Exception:
Review Comment:
## CodeQL / Empty except
'except' clause does nothing but pass and there is no explanatory comment.
[Show more details](https://github.com/apache/magpie/security/code-scanning/120)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(setup): add zero-token /magpie-status Claude Code mod command (part of #1497) [magpie]
Posted by "Kaap10 (via GitHub)" <gi...@apache.org>.
Kaap10 commented on PR #1601:
URL: https://github.com/apache/magpie/pull/1601#issuecomment-6118432808
Ready for review!
Implemented Pilot 2 zero-token /magpie-status mod with test coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(setup): add zero-token /magpie-status Claude Code mod command (part of #1497) [magpie]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #1601:
URL: https://github.com/apache/magpie/pull/1601
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org