Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bfda608
Add calculator example with channel-based state management
claude Nov 27, 2025
31015ce
Add support for arbitrary function calls via assignments
claude Nov 27, 2025
ac916dd
Distinguish components from functions via Component return type
claude Nov 27, 2025
bf6c272
Add comprehensive language features for calculator example
claude Nov 27, 2025
b912c99
Remove colon after parameter names to match Go syntax
claude Nov 27, 2025
4ed93ee
Fix counter example to use Component return type
claude Nov 27, 2025
9f1e9b2
Fix all unit tests for new language features
claude Nov 27, 2025
d59f96f
Add e2e tests for calculator using chromedp
claude Nov 27, 2025
e81026f
Add calculator e2e tests to CI/CD pipeline
claude Nov 27, 2025
9c0dc71
Fix calculator example build by removing obsolete files and adding co…
claude Nov 27, 2025
d066e0b
Add build tags to generated files to fix e2e test compilation
claude Nov 27, 2025
405fb82
Update CI workflow to include calculator codegen patching steps
claude Nov 27, 2025
8440aae
Add native codegen support for channel sends and build tags
claude Nov 27, 2025
563250f
Fix parameter references in closures - eliminate all sed patching
claude Nov 27, 2025
f99ba39
Fix channel send appearing in Render method
claude Nov 27, 2025
5bc5d7d
Track generated files in repository
claude Nov 27, 2025
46a588f
Add guix_helpers_gen.go to root directory
claude Nov 27, 2025
1e221b5
Add conditional verbose logging for debugging
claude Nov 27, 2025
eb91331
Fix e2e test build constraints to exclude WASM builds
claude Nov 27, 2025
72c2de6
Enable verbose logging in generated code and fix build constraints
claude Nov 27, 2025
866f9a5
Remove duplicate log/console definitions from main.go
claude Nov 27, 2025
3fc4dd6
Add Chrome no-sandbox flag for CI environment
claude Nov 27, 2025
bf416f1
Add chromedp logging and increase WASM load wait time
claude Nov 27, 2025
7219242
Replace chromedp tests with Playwright for calculator
claude Nov 27, 2025
9130a72
Add initial channel read to Calculator constructor
claude Nov 27, 2025
5866e28
Fix codegen to generate initial channel reads in constructor
claude Nov 27, 2025
d410f43
Add nil check to channel initialization in constructor
claude Nov 27, 2025
bee95df
Add debug logging to channel initialization in constructor
claude Nov 27, 2025
f223bc0
Fix codegen to generate nested if statements in helper functions
claude Nov 27, 2025
5e60532
Fix event handler state capture issue
claude Nov 27, 2025
4b7a1c7
Implement visitor pattern infrastructure (Phase 1 & 2)
claude Nov 27, 2025
db5f526
Make Generator implement Visitor interface (Phase 3 - Non-Breaking)
claude Nov 28, 2025
71603d4
Add comprehensive progress summary for visitor pattern refactoring
claude Nov 28, 2025
a0bf6e0
WIP: Phase 4 - ExpressionStmt grammar (partial implementation)
claude Nov 28, 2025
7327ce6
Complete Phase 4: Add CallStmt and AssignmentStmt support
claude Nov 28, 2025
b069ad2
Convert Generator to use visitor pattern
claude Nov 28, 2025
a2d26f0
Fix visitor pattern: handle AssignmentStmt in initialization
claude Nov 28, 2025
e1ff544
Update progress summary with AssignmentStmt bug fix details
claude Nov 28, 2025
76d40ae
Regenerate counter example with verbose logs
claude Nov 28, 2025
64d15f3
Fix sequential operations test to match calculator behavior
claude Nov 28, 2025
9088193
Change calculator to display full expression before calculation
claude Nov 28, 2025
b04efd8
Implement expression-based calculator with display-before-calculate b…
claude Nov 28, 2025
5978aa2
Implement slice support in Guix parser and code generator
claude Nov 28, 2025
101d6ad
Fix calculator display to show trailing space after operators
claude Nov 28, 2025
e45f441
Remove trailing space logic and update test expectation
claude Nov 28, 2025
e6bd496
Fix remaining test expectation for trailing space
claude Nov 28, 2025
d92d5fb
Run gofmt on Go files
claude Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Generate and build counter example
run: |
./guix generate -p examples/counter
./guix generate -p examples/counter --verbose-logs
cd examples/counter
# Copy wasm_exec.js from Go installation
GOROOT="$(go env GOROOT)"
Expand Down Expand Up @@ -65,3 +65,59 @@ jobs:
name: playwright-results
path: examples/counter/test-results/
retention-days: 7

calculator:
name: Calculator E2E Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Build CLI
run: go build -o guix ./cmd/guix

- name: Generate and build calculator example
run: |
./guix generate -p examples/calculator --verbose-logs
cd examples/calculator

# Copy wasm_exec.js from Go installation
GOROOT="$(go env GOROOT)"
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
cp "$GOROOT/lib/wasm/wasm_exec.js" .
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
cp "$GOROOT/misc/wasm/wasm_exec.js" .
else
echo "wasm_exec.js not found in GOROOT, downloading from GitHub"
curl -o wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
fi
GOOS=js GOARCH=wasm go build -o main.wasm .
echo "Files after build:"
ls -lah *.{html,js,wasm} 2>/dev/null || ls -lah

- name: Install Playwright
working-directory: examples/calculator
run: |
npm install
npx playwright install --with-deps chromium

- name: Run Playwright tests
working-directory: examples/calculator
run: npx playwright test

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: calculator-playwright-results
path: examples/calculator/test-results/
retention-days: 7
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ go.work
wasm_exec.js
main.wasm

# Generated files
*_gen.go

# Cache
.guix/
*.cache
Expand Down
33 changes: 22 additions & 11 deletions cmd/guix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func main() {
Name: "verbose",
Usage: "Verbose output",
},
&cli.BoolFlag{
Name: "verbose-logs",
Usage: "Generate verbose logging statements in code (for debugging)",
},
},
Action: runGenerate,
},
Expand All @@ -77,7 +81,10 @@ func main() {
}

func generateHelpersFile(root string) error {
helpersContent := `// Code generated by guix. DO NOT EDIT.
helpersContent := `//go:build js && wasm
// +build js,wasm

// Code generated by guix. DO NOT EDIT.

package main

Expand Down Expand Up @@ -115,6 +122,7 @@ func runGenerate(c *cli.Context) error {
watchMode := c.Bool("watch")
lazy := c.Bool("lazy")
verbose := c.Bool("verbose")
verboseLogs := c.Bool("verbose-logs")

// Load or create cache
var genCache *cache.Cache
Expand All @@ -127,13 +135,15 @@ func runGenerate(c *cli.Context) error {
}
}

// Generate helpers file first
if err := generateHelpersFile(path); err != nil {
return fmt.Errorf("failed to generate helpers: %w", err)
// Generate helpers file first (only if verbose logs are enabled)
if verboseLogs {
if err := generateHelpersFile(path); err != nil {
return fmt.Errorf("failed to generate helpers: %w", err)
}
}

// Generate all files initially
if err := generateAll(path, genCache, verbose); err != nil {
if err := generateAll(path, genCache, verbose, verboseLogs); err != nil {
return err
}

Expand All @@ -146,13 +156,13 @@ func runGenerate(c *cli.Context) error {

// Watch mode
if watchMode {
return watchFiles(path, genCache, verbose, lazy)
return watchFiles(path, genCache, verbose, verboseLogs, lazy)
}

return nil
}

func generateAll(root string, genCache *cache.Cache, verbose bool) error {
func generateAll(root string, genCache *cache.Cache, verbose bool, verboseLogs bool) error {
p, err := parser.New()
if err != nil {
return fmt.Errorf("failed to create parser: %w", err)
Expand Down Expand Up @@ -191,7 +201,7 @@ func generateAll(root string, genCache *cache.Cache, verbose bool) error {
}
}

if err := generateFile(path, p, verbose); err != nil {
if err := generateFile(path, p, verbose, verboseLogs); err != nil {
return fmt.Errorf("failed to generate %s: %w", path, err)
}

Expand Down Expand Up @@ -231,7 +241,7 @@ func formatFile(path string) error {
return nil
}

func generateFile(srcPath string, p *parser.Parser, verbose bool) error {
func generateFile(srcPath string, p *parser.Parser, verbose bool, verboseLogs bool) error {
if verbose {
log.Printf("Generating %s", srcPath)
}
Expand All @@ -255,6 +265,7 @@ func generateFile(srcPath string, p *parser.Parser, verbose bool) error {

// Generate Go code
gen := codegen.New(file.Package)
gen.SetVerbose(verboseLogs)
output, err := gen.Generate(file)
if err != nil {
return err
Expand All @@ -278,7 +289,7 @@ func generateFile(srcPath string, p *parser.Parser, verbose bool) error {
return nil
}

func watchFiles(root string, genCache *cache.Cache, verbose bool, lazy bool) error {
func watchFiles(root string, genCache *cache.Cache, verbose bool, verboseLogs bool, lazy bool) error {
watcher, err := fsnotify.NewWatcher()
if err != nil {
return fmt.Errorf("failed to create watcher: %w", err)
Expand Down Expand Up @@ -346,7 +357,7 @@ func watchFiles(root string, genCache *cache.Cache, verbose bool, lazy bool) err

log.Printf("File changed: %s", event.Name)

if err := generateFile(event.Name, p, verbose); err != nil {
if err := generateFile(event.Name, p, verbose, verboseLogs); err != nil {
log.Printf("Error generating %s: %v", event.Name, err)
} else {
log.Printf("Successfully regenerated %s", event.Name)
Expand Down
Loading
Loading