mirror of
https://github.com/ultraworkers/claw-code.git
synced 2026-04-26 06:14:22 +08:00
Cycle #28 closes the low-hanging metadata protocol gap identified in #180. ## The Gap Pinpoint #180 (filed cycle #24) documented a metadata protocol gap: - `--help` works (argparse default) - `--version` does NOT exist The ROADMAP entry deferred implementation pending demand. Cycle #28 dogfood probe found this during routine invariant audit (attempt to call `--version` as part of comprehensive CLI surface coverage). This is concrete evidence of real friction, not speculative gap-filling. ## Implementation Added `--version` flag to argparse in `build_parser()`: ```python parser.add_argument('--version', action='version', version='claw-code 1.0.0 (Python harness)') ``` Simple one-liner. Follows Python argparse conventions (built-in action='version'). ## Tests Added (3) TestMetadataFlags in test_exec_route_bootstrap_output_format.py: 1. test_version_flag_returns_version_text — `claw --version` prints version 2. test_help_flag_returns_help_text — `claw --help` still works 3. test_help_still_works_after_version_added — Both -h and --help work Regression guard on the original help surface. ## Test Status - 214 → 217 tests passing (+3) - Zero regressions - Full suite green ## Discipline This cycle exemplifies the cycle #24 calibration: - #180 was filed as 'deferred pending demand' - Cycle #28 dogfood found actual friction (proactive test coverage gap) - Evidence = concrete ('--version not found during invariant audit') - Action = minimal implementation + regression tests - No speculation, no feature creep, no implementation before evidence Not 'we imagined someone might want this.' Instead: 'we tried to call it during routine maintenance, got ENOENT, fixed it.' ## Related - #180 (cycle #24): Metadata protocol gap filed - Cycle #27: Cross-channel consistency audit established framework - Cycle #28 invariant audit: Discovered actual friction, triggered fix --- Classification (per cycle #24 calibration): - Red-state bug? ✗ (not a malfunction, just an absence) - Real friction? ✓ (audit probe could not call the flag, had to special-case) - Evidence-backed? ✓ (proactive test coverage revealed the gap) Source: Jobdori cycle #28 dogfood — invariant audit attempting comprehensive CLI surface coverage found that --version was unsupported.
This commit is contained in:
parent
fef249d9e7
commit
af306d489e
@ -41,6 +41,8 @@ def wrap_json_envelope(data: dict, command: str, exit_code: int = 0) -> dict:
|
|||||||
|
|
||||||
def build_parser() -> argparse.ArgumentParser:
|
def build_parser() -> argparse.ArgumentParser:
|
||||||
parser = argparse.ArgumentParser(description='Python porting workspace for the Claude Code rewrite effort')
|
parser = argparse.ArgumentParser(description='Python porting workspace for the Claude Code rewrite effort')
|
||||||
|
# #180: Add --version flag to match canonical CLI contract
|
||||||
|
parser.add_argument('--version', action='version', version='claw-code 1.0.0 (Python harness)')
|
||||||
subparsers = parser.add_subparsers(dest='command', required=True)
|
subparsers = parser.add_subparsers(dest='command', required=True)
|
||||||
subparsers.add_parser('summary', help='render a Markdown summary of the Python porting workspace')
|
subparsers.add_parser('summary', help='render a Markdown summary of the Python porting workspace')
|
||||||
subparsers.add_parser('manifest', help='print the current Python workspace manifest')
|
subparsers.add_parser('manifest', help='print the current Python workspace manifest')
|
||||||
|
|||||||
@ -277,3 +277,30 @@ class TestEnvelopeExitCodeMatchesProcessExit:
|
|||||||
'Envelope exit_code must match process exit code:\n' +
|
'Envelope exit_code must match process exit code:\n' +
|
||||||
'\n'.join(mismatches)
|
'\n'.join(mismatches)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TestMetadataFlags:
|
||||||
|
"""Cycle #28: --version flag implementation (#180 gap closure)."""
|
||||||
|
|
||||||
|
def test_version_flag_returns_version_text(self) -> None:
|
||||||
|
"""--version returns version string and exits successfully."""
|
||||||
|
result = _run(['--version'])
|
||||||
|
assert result.returncode == 0
|
||||||
|
assert 'claw-code' in result.stdout
|
||||||
|
assert '1.0.0' in result.stdout
|
||||||
|
|
||||||
|
def test_help_flag_returns_help_text(self) -> None:
|
||||||
|
"""--help returns help text and exits successfully."""
|
||||||
|
result = _run(['--help'])
|
||||||
|
assert result.returncode == 0
|
||||||
|
assert 'usage:' in result.stdout
|
||||||
|
assert 'Python porting workspace' in result.stdout
|
||||||
|
|
||||||
|
def test_help_still_works_after_version_added(self) -> None:
|
||||||
|
"""Verify -h and --help both work (no regression)."""
|
||||||
|
result_short = _run(['-h'])
|
||||||
|
result_long = _run(['--help'])
|
||||||
|
assert result_short.returncode == 0
|
||||||
|
assert result_long.returncode == 0
|
||||||
|
assert 'usage:' in result_short.stdout
|
||||||
|
assert 'usage:' in result_long.stdout
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user