feat: SORT ON <field>[/D] TO <newtable> (#8) - #14
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Writes a sorted copy of the active table to a new table. /D sorts descending; the active SET FILTER is honoured. Errors when no table is in use, the field is unknown, or the target already exists. Thin alias over SQLite's CREATE TABLE AS SELECT ... ORDER BY — the new table is a plain snapshot (inferred affinities, no source PK/constraints). SORT is largely redundant given live indexes + ORDER BY; it exists for dBASE III dialect fidelity. Bumps version to 0.6.3; adds parser + integration tests, HELP text, and README/CLAUDE command-table rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 #8.
What
Adds the dBASE III
SORTcommand:/D→ descending (default ascending).SET FILTER.Approach — thin alias
After discussion,
SORTis authentic dBASE III but largely redundant in WebBase-III's SQLite model (live indexes +ORDER BYalready cover ordering). It's implemented thinly, overCREATE TABLE … AS SELECT … ORDER BY, rather than a faithful schema clone.Accepted trade-off: the new table is a plain snapshot — column affinities are inferred and the source PK/constraints are not carried over. Noted in CHANGELOG. Spec:
docs/superpowers/specs/2026-06-24-sort-to-design.md.Changes
src/interpreter/Lexer.ts—SORTkeywordsrc/interpreter/Parser.ts—parseSort()+SORTAST nodesrc/interpreter/Executor.ts—doSort()+ HELP linetests/Session.test.ts— 2 parser + 5 integration testsREADME.md,CLAUDE.md— command-table rowspackage.json0.6.2 → 0.6.3,CHANGELOG.mdVerification
npm test→ 172 passednpx tsc --noEmit→ clean🤖 Generated with Claude Code