-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/rewrite again #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
232fbe2
version
ItsMeBrianD 4055f2d
feat: noise + noise block autocomplete
ItsMeBrianD 7047453
feat: proper snippet support
ItsMeBrianD 2fecfa3
fix: err == nil NOT err != nil
ItsMeBrianD 5e7b196
chore: interface splits, remove outdated tests, repomix configs
ItsMeBrianD acb9531
lsp checkpoint
ItsMeBrianD 8976584
feat: Noise density function completions feel perfect
ItsMeBrianD bab2835
commit before switch
ItsMeBrianD 668657d
chore: begin rewrite
ItsMeBrianD 6c0332a
chore: commit before refactor
ItsMeBrianD 4de4369
feat: noise parses and exports
ItsMeBrianD d84048a
feat: parse, export, and hover working
ItsMeBrianD 9e900c2
feat: autocomplete is mostly wired up
ItsMeBrianD 1ac188f
feat: surface rules should be working, missing vertical anchors
ItsMeBrianD acc6023
fixes
ItsMeBrianD e702f74
feat: prefiltering / autocomplete improvements
ItsMeBrianD 4fbcd78
feat: VERY simple implementation of conditionals for surface rules
ItsMeBrianD c840952
chore: trivial implementation of conditions and lists
ItsMeBrianD 4c75d7a
feat: enhance completions for ConditionSpec and ListSpec, add complet…
ItsMeBrianD 67a0df1
chore: delete unused test
ItsMeBrianD e887a5d
checkpoint
ItsMeBrianD e226b83
fix: conditional serialization
ItsMeBrianD 93e6f07
feat: surface rules is ready
ItsMeBrianD 3ce1ab5
fix: list / conditional completions
ItsMeBrianD 5c56460
feat: enhance density functions and surface rules
ItsMeBrianD 9e81d1e
feat: refactor and enhance density functions, completions, and serial…
ItsMeBrianD b3fa2a0
feat: refactor parsing and serialization, add tag support, and improv…
ItsMeBrianD bab26eb
chore: delete syntax highlighting
ItsMeBrianD d205dc5
chore: missed a spot
ItsMeBrianD aba73d5
feat: wire up build command
ItsMeBrianD 3bc8879
chore: remove copywrite notices
ItsMeBrianD 5cb16b7
chore: coderabbit reviews
ItsMeBrianD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [keys.normal] | ||
| C-space = "completion" | ||
| C-r = ":reload" | ||
| [keys.normal.l] | ||
| r = ":lsp-restart" | ||
| f = ":reload" | ||
| c = "completion" | ||
| l = [ ":vsplit", ":log-open" ] | ||
| o = [ ":sh echo \"\" > ~/.cache/helix/helix.log", ":reload" ] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Add patterns to ignore here, one per line | ||
| # Example: | ||
| # *.log | ||
| # tmp/ | ||
| lang/grammar | ||
| result | ||
| vendor | ||
| .junie | ||
| .helix | ||
| .github | ||
| wasm/mms.js |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Minecraft Metascript (MMS) — Workspace AI Rules | ||
|
|
||
| These are project-specific rules and context the AI must follow when working in this repository. | ||
|
|
||
| ## Project Context | ||
| - Language: Go (go 1.23) | ||
| - Module path: `github.com/minecraftmetascript/mms` | ||
| - Vendoring: `vendor/` is present; builds typically use vendored deps | ||
| - Parsing: ANTLR4 grammars in `grammar/*.g4` generate Go code into `lang/grammar/` | ||
| - CLI: Cobra-based entrypoint | ||
| - WASM: Browser-targeted build via [main_wasm.go](cci:7://file:///Users/brian/code/minecraftmetascript/mms/main_wasm.go:0:0-0:0) and `wasm/` | ||
| - Nix: Optional flake provides reproducible builds and ANTLR generation | ||
|
|
||
| ## Repository Layout (high-signal paths) | ||
| - `lang/`: Core API (Project, File, traversal, constructs, generated grammar package) | ||
| - `lang/grammar/`: GENERATED by ANTLR. Do not edit manually. | ||
| - `lang/constructs/...`: Construct registry and implementations (e.g., worldgen/surface_rules) | ||
| - `lang/traversal/...`: Parser traversal, construct registry, scopes | ||
| - `grammar/`: Handwritten ANTLR grammars | ||
| - `cmd/`: Cobra root command ([mms](cci:7://file:///Users/brian/code/minecraftmetascript/mms/test.mms:0:0-0:0)) | ||
| - `wasm/`: JS glue (`mms.js`), package.json, and wasm artifacts | ||
| - `examples/`: MMS examples (e.g., surface rules) for manual parsing checks | ||
|
|
||
| ## Absolute Rules (Do/Don’t) | ||
| - DO keep all imports at the top of files; never insert imports mid-file. | ||
| - DO run `gofmt`/`goimports` and `go vet` before committing or proposing changes. | ||
| - DO regenerate grammar output rather than editing anything under `lang/grammar/`. | ||
| - DO keep vendoring consistent. After editing [go.mod](cci:7://file:///Users/brian/code/minecraftmetascript/mms/go.mod:0:0-0:0)/[go.sum](cci:7://file:///Users/brian/code/minecraftmetascript/mms/go.sum:0:0-0:0): `go mod tidy` then `go mod vendor`. | ||
| - DO cite files/paths with backticks like `path/to/file.go` in explanations and PR notes. | ||
| - DON’T modify generated files under `lang/grammar/` directly. | ||
| - DON’T break build tags: | ||
| - [main.go](cci:7://file:///Users/brian/code/minecraftmetascript/mms/main.go:0:0-0:0): `//go:build !js && !wasm` | ||
| - [main_wasm.go](cci:7://file:///Users/brian/code/minecraftmetascript/mms/main_wasm.go:0:0-0:0): `//go:build js && wasm` | ||
|
|
||
| ## Builds & Tasks (Preferred Flows) | ||
| - Nix (recommended): | ||
| - Native CLI: `nix build` → produces `./result/bin/mms` (runs ANTLR generation first) | ||
| - WASM: `nix build ".#wasm"` → produces `./result/js/` with `dist/main.wasm` and assets | ||
| - Dev shell: `nix develop` (provides `antlr-build`) | ||
| - Regenerate grammar (Nix): `antlr-build` | ||
| - Non-Nix ANTLR regeneration (if `antlr4` is in PATH): | ||
| - Lexer: `antlr4 -Dlanguage=Go grammar/Main_Lexer.g4 -o lang -package grammar` | ||
| - Parser: `antlr4 -Dlanguage=Go grammar/Main_Parser.g4 -lib lang/grammar -o lang -package grammar` | ||
| - Vendoring: | ||
| - After dependency changes: `go mod tidy && go mod vendor` | ||
|
|
||
| ## WASM Notes | ||
| - [main_wasm.go](cci:7://file:///Users/brian/code/minecraftmetascript/mms/main_wasm.go:0:0-0:0) exports (js/wasm build tags): | ||
| - `updateFile(filename: string, content: string, cb: (serializedProject: string) => void)` | ||
| - `getFileDiag(filename: string, cb: (json: string) => void)` | ||
| - `wasm/package.json` exposes `./mms.js` and `./dist/main.wasm` for NPM packaging. | ||
|
|
||
| ## Testing Guidance | ||
| - Important API change: `Project.Diagnostics` is a METHOD now, not a field. | ||
| - Replace: `len(p.Diagnostics)` → `len(p.Diagnostics())` | ||
| - Replace: `for d := range p.Diagnostics { ... }` → range over `p.Diagnostics()` | ||
| - Running tests: | ||
| - Full (may fail due to legacy `test/` pkg): `go test ./...` | ||
| - Preferred during migration: `go test ./lang` | ||
| - Specific test: `go test ./lang -run TestName -v` | ||
| - Pattern for new tests: | ||
| - Create a `Project`, add a `File`, call `Parse()` | ||
| - Assert on `File.Diagnostics`, `Project.Diagnostics()` | ||
| - For exports, use `Project.BuildFsLike(root)` | ||
|
|
||
| ## Construct & Export Model | ||
| - New constructs register via `traversal.ConstructRegistry.Register(...)` | ||
| - `Project.BuildFsLike(root)` walks `GlobalScope` and calls `ExportSymbol` on constructs to build a directory-like export structure (used by WASM packaging) | ||
|
|
||
| ## Coding Style & Quality | ||
| - Follow idiomatic Go. Keep functions cohesive and small. | ||
| - Keep generated code in `lang/grammar/` untouched; regenerate via ANTLR on grammar changes. | ||
| - Prefer package-local tests near code under test. | ||
| - Keep explanations concise and always reference changed files and symbols with backticks. | ||
|
|
||
| ## Quick Commands Reference | ||
| - Native build: `nix build` | ||
| - WASM build: `nix build ".#wasm"` | ||
| - Dev shell (Nix): `nix develop` | ||
| - Regenerate grammar (Nix): `antlr-build` | ||
| - Regenerate grammar (manual): | ||
| - `antlr4 -Dlanguage=Go grammar/Main_Lexer.g4 -o lang -package grammar` | ||
| - `antlr4 -Dlanguage=Go grammar/Main_Parser.g4 -lib lang/grammar -o lang -package grammar` | ||
| - Core package tests: `go test ./lang -v` | ||
|
|
||
| ## AI Execution Preferences | ||
| - When asked to modify code: | ||
| - Respect vendoring and ANTLR regeneration steps. | ||
| - Never place imports mid-file—add at the top and adjust separately if needed. | ||
| - Avoid large monolithic diffs; break up edits logically. | ||
| - When suggesting commands, prefer Nix flows where available. | ||
| - If a change would touch `lang/grammar`, instruct to regenerate via ANTLR instead of manual edits. | ||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.