refactor: stop hand-typing core's datamachine namespace in AgentsMdSections.php; reflect DMC's own commands#735
Merged
Merged
Conversation
…d section DMC's AgentsMdSections.php hand-typed core's entire `datamachine` command surface as a static heredoc, a layer inversion: core now registers its own reflected AGENTS.md section (data-machine#2640), and the hand-copy had already drifted (the `datamachine analytics|logs` line was wrong — analytics moved to data-machine-business). - Remove the hand-typed core `datamachine ...` narration (Memory/Automation/ Communication/Content-ops/System bullets). Core owns that section. - Rename the section to `datamachine-code` and keep only the workspace/worktree/ github guidance DMC rightfully owns. - Reflect the `worktree` operation list from its dispatch `match` arms via a new CommandIntrospector::match_arm_pipe_list() helper, mirroring how workspace/ github are already reflected. No hand-typed DMC command lists remain; the reflected list also recovers operations the literal omitted. Refs #734
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #734.
Layer-inversion fix
inc/Runtime/AgentsMdSections.phphand-typed core's entiredatamachinecommand surface as a static heredoc (Memory & Agents / Automation / Communication / Content ops / System bullets). That is a layer inversion: DMC was narrating core's namespace from a hand-copy that silently drifts. Core is taking over its own reflecteddatamachineAGENTS.md section (data-machine#2640), so this PR:datamachine ...narration block entirely.datamachine→datamachine-codeand keeps only the workspace / worktree / github guidance DMC rightfully owns. A short pointer tells readers core's operating layer lives in its own section (datamachine --help).worktreeoperation list (previously a hand-typed pipe-list at the old:148) the same wayworkspace/githubalready are. No hand-typed DMC command lines remain.The now-wrong analytics line
The removed block contained
- Analytics & logs: datamachine analytics|logs. That line was actively wrong:datamachine analyticswas removed from core and moved to data-machine-business. DMC was shipping false guidance. Deleting the hand-copy fixes this and prevents the class of drift entirely.How the worktree list is reflected
worktree's operations (add|list|remove|…) are not separate@subcommandmethods — they're dispatched through an internalmatch ( $operation ) { … }inside the singleworktree()method. So the existingCommandIntrospector::subcommands()(which reflects@subcommandannotations) can't see them.This PR adds
CommandIntrospector::match_arm_pipe_list()/match_arm_keys(), which read the method's source range via reflection and extract the string-literalmatcharm keys in source order, de-duplicated, ignoringdefault. Context-safe (only runs whenWP_CLI_Commandis loaded; never constructs command instances), with a hand-typed fallback only used if reflection is unavailable.Bonus: the reflected list is more accurate than the old literal — it recovers operations the hand-typed list omitted (
bounded-cleanup-eligible-apply,emergency-cleanup,active-no-signal-*).Merge ORDER (critical — do not merge out of order)
datamachinesection) MUST merge BEFORE this removal. If this merges first,wp datamachine memory compose AGENTS.mdproduces nodatamachinesection (core's operating layer would vanish from AGENTS.md until #2640 lands).Introspector delegation note
The issue notes that once data-machine#2639 (shared
__invoke-awareCliCommandIntrospector) lands, DMC should prefer the shared helper viaclass_existsguard. As of this PR #2639 is still open, so per the issue's instruction the localCommandIntrospectorstays. Migrating to the shared helper is left as follow-up once #2639 merges.Verification
datamachine(core) command lines remain inAgentsMdSections.php; no hand-typed DMC command lists remain.php -lclean on both files. (This component ships no phpcs harness/config;php -lis the lint surface.)WorkspaceCommand::worktree()body — extracts all 17 match-arm operations correctly.Refs the #2613 (data-machine) AGENTS.md dynamic-CLI fleet.