Refactor of guidelines keyword into mandate#34
Open
luca-anzalone wants to merge 3 commits into
Open
Conversation
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.
Description
Renames the NXS language keyword
guidelinestomandateacross the full stack (grammar, parser, AST nodes, runtime, internal prompts, tests, examples, and docs). The old keyword is kept as a deprecated alias for backward compatibility, which will be removed in a future version.Type of change
Solution
mandatebetter reflects the binding, authoritative nature of the block. The rename touches every layer:nxs_v2_grammar.lark): thedeliberaterule now accepts(mandate | guidelines)?; both terminals and rules are defined, withguidelinesannotated as deprecated. Using both in the same block is a grammar-level error.parser.py):guidelinesand__guidelinesare kept as reserved words and in the TOKEN_MAP. Theguidelines()transformer delegates tomandate()after emitting aDeprecationWarning: "The 'guidelines' keyword is deprecated; use 'mandate' instead.".node.py):Deliberate.guidelines→Deliberate.mandate;to_nxs()always serializes asmandate:/__mandate.executor.py,coder.py,script.py,expertise.py,prompt.py): all attribute accesses, local variables, string literals, and LLM prompt templates updated.test_guidelines_deprecated_alias) verifies that old scripts still parse correctly, populate.mandate, and raiseDeprecationWarning.guidelines:→mandate:,__guidelines→__mandate.Plugin changelogs were intentionally left unchanged as they are a historical record.
Testing
pytest)New test:
test/core/test_parser.py::test_guidelines_deprecated_alias— parses a deliberate using the oldguidelines:keyword and asserts:.mandateis populated correctly.DeprecationWarningmentioning bothguidelinesandmandateis emitted.Release Notes
The
guidelines:/__guidelineskeyword insidedeliberateblocks has been renamed tomandate:/__mandate. Existing scripts using the old keyword continue to work but will emit aDeprecationWarningat parse time. Migrate by doing a find-and-replace ofguidelines:→mandate:and__guidelines→__mandatein your.nxsfiles. The old keyword will be removed in a future release.