Commit d76134d
fix(hooks): preserve dashed project names + route through normalize_wing_name (#10)
Two findings from Copilot review on #9 (already merged):
1. **Last-dash-token rule lost hyphenated project names.** A project
directory named ``realm-watch`` is encoded by Claude Code as
``-home-jp-Projects-realm-watch``, and the previous primary
regex's ``rsplit('-', 1)[-1]`` returned ``watch`` — collapsing
the project name. Reorder the resolution: try the explicit
``-Projects-<name>`` segment FIRST (preserves dashes), fall back
to the last-dash-token only when the path is in a non-Projects
layout (``~/dev/<parent>/<project>``).
2. **Inconsistent normalization vs operator mines.** Hook used
``.lower().replace(' ', '_')`` (no hyphen handling) while
``mempalace mine`` runs the dirname through
``normalize_wing_name`` (lowercases, dashes/spaces → underscores).
Same project mined two ways produced two different wings.
Route the hook through ``normalize_wing_name`` for parity.
Net behavior: ``-Projects-realm-watch`` → ``realm_watch`` (matches
operator-mine output). Existing tests for non-dashed projects still
pass; 4 new tests cover dashed-project + uppercase-mixed cases +
explicit operator-mine convergence assertion.
Tests: 1551 pass, 1 skipped. Ruff lint + format clean.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 86d4700 commit d76134d
2 files changed
Lines changed: 53 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
533 | 540 | | |
534 | | - | |
| 541 | + | |
| 542 | + | |
535 | 543 | | |
536 | | - | |
537 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
538 | 551 | | |
539 | 552 | | |
540 | 553 | | |
541 | 554 | | |
542 | 555 | | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
| 556 | + | |
549 | 557 | | |
550 | 558 | | |
551 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
350 | 378 | | |
351 | 379 | | |
352 | 380 | | |
| |||
0 commit comments