-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
1242 lines (1108 loc) · 44.6 KB
/
Copy pathTaskfile.yml
File metadata and controls
1242 lines (1108 loc) · 44.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: "3"
vars:
BINARY_NAME: forst
BUILD_DIR: cmd/forst
ROOT_DIR: ..
EXAMPLES_DIR: ../examples/in
OUTPUT_DIR: ../examples/out
NFPM_VERSION: "2.46.3"
tasks:
# Build tasks
build:
desc: Build the Forst compiler and official generate plugins
dir: forst
deps:
- build:plugins
cmds:
- go build -o ../bin/{{.BINARY_NAME}} ./{{.BUILD_DIR}}
sources:
- ./**/*.go
generates:
- ../bin/{{.BINARY_NAME}}
build:optimized:
desc: Build stripped local binary with PGO (if default.pgo exists) and version ldflags
dir: forst
cmds:
- mkdir -p ../bin
- |
set -euo pipefail
PGO_FLAG=""
if [ -f default.pgo ]; then PGO_FLAG="-pgo=default.pgo"; fi
COMMIT=$(git rev-parse HEAD)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS="-s -w -X main.Version=dev -X main.Commit=${COMMIT} -X main.Date=${DATE}"
go build ${PGO_FLAG} -ldflags="${LDFLAGS}" -o ../bin/{{.BINARY_NAME}} ./{{.BUILD_DIR}}
- ls -lh ../bin/{{.BINARY_NAME}}
- ../bin/{{.BINARY_NAME}} version
sources:
- ./**/*.go
generates:
- ../bin/{{.BINARY_NAME}}
build:cli:
desc: Build @forst/cli
dir: packages/cli
deps: [install:bun]
cmds:
- bun run build
sources:
- ./**/*.ts
generates:
- packages/cli/dist/index.js
- packages/cli/dist/index.d.ts
- packages/cli/dist/invoke.js
- packages/cli/dist/invoke.d.ts
build:errors:
desc: Build @forst/errors
dir: packages/errors
deps: [install:bun]
cmds:
- bun run build
sources:
- ./**/*.ts
generates:
- packages/errors/dist/index.js
- packages/errors/dist/index.d.ts
- packages/errors/dist/effect.js
- packages/errors/dist/effect.d.ts
test:errors:
desc: Run Bun tests for @forst/errors
dir: packages/errors
deps: [install:bun, build:errors]
cmds:
- bun run test
test:cli:
desc: Run Bun tests for @forst/cli
dir: packages/cli
deps: [install:bun, build:cli]
cmds:
- bun run test
test:cli:invoke-e2e:
desc: Opt-in real spawn of startForstInvokeServer against embedded-invoke
dir: packages/cli
deps: [build, build:cli]
env:
FORST_CLI_INVOKE_E2E: "1"
FORST_BINARY: '{{.TASKFILE_DIR}}/bin/forst'
cmds:
- bun test src/test-server.e2e.test.ts
build:sidecar:
desc: Build the Forst sidecar
dir: packages/sidecar
deps: [install:bun, build:cli]
cmds:
- bun run build
sources:
- ./**/*.ts
generates:
- packages/sidecar/dist/index.js
- packages/sidecar/dist/index.d.ts
test:sidecar:
desc: Run Bun tests for @forst/sidecar
dir: packages/sidecar
deps: [install:bun, build:cli]
cmds:
- bun run test
build:runtime:
desc: Build @forst/runtime
dir: packages/runtime
deps: [install:bun]
cmds:
- bun run build
sources:
- ./**/*.ts
generates:
- packages/runtime/dist/bootstrap.js
- packages/runtime/dist/index.js
test:runtime:
desc: Run Bun tests for @forst/runtime
dir: packages/runtime
deps: [install:bun]
cmds:
- bun run test
build:client:
desc: Build the Forst client
dir: packages/client
deps: [install:bun, build:sidecar]
cmds:
- bun run build
sources:
- ./**/*.ts
generates:
- packages/client/dist/index.js
- packages/client/dist/index.d.ts
build:plugins:
desc: Build forst generate semantic plugins to ../bin/
dir: forst
cmds:
- mkdir -p ../bin
- |
set -euo pipefail
go build -o ../bin/forst-gen-jsonschema ./plugins/forst-gen-jsonschema &
go build -o ../bin/forst-gen-orpc ./plugins/forst-gen-orpc &
go build -o ../bin/forst-gen-file-routes ./plugins/forst-gen-file-routes &
go build -o ../bin/forst-gen-react-router ./plugins/forst-gen-react-router &
go build -o ../bin/forst-gen-echo ./plugins/forst-gen-echo &
wait
sources:
- ./plugins/**/*.go
- ./internal/genplugin/**/*.go
- ./internal/semantic/**/*.go
generates:
- ../bin/forst-gen-jsonschema
- ../bin/forst-gen-orpc
- ../bin/forst-gen-file-routes
- ../bin/forst-gen-react-router
- ../bin/forst-gen-echo
test:plugins:
desc: Run Go tests for semantic plugins and genplugin
dir: forst
cmds:
- go test ./internal/genplugin/... ./plugins/...
- go test ./cmd/forst -run 'TestGenerate_plugins|TestRunSemanticPlugins'
build:vscode:
desc: Compile the VS Code extension (TypeScript)
dir: packages/vscode-forst
deps: [install:bun, build:cli]
cmds:
- bun run compile
- bun run test
sources:
- ./**/*.ts
- syntaxes/**
- test/**
generates:
- packages/vscode-forst/out/extension.js
- packages/vscode-forst/out/extension.js.map
sync:forst-grammar:
desc: Sync forst.tmLanguage.json to docs/languages/forst.json and build client highlighter
dir: packages/vscode-forst
cmds:
- bun run sync:grammar
sources:
- syntaxes/forst.tmLanguage.json
- scripts/forst-tokenize.mjs
- scripts/forst-highlight-detect.mjs
- scripts/forst-highlight-browser.mjs
- scripts/sync-forst-grammar.mjs
generates:
- docs/languages/forst.json
- docs/forst-highlight.js
install:
desc: Install the Forst compiler
dir: forst
cmds:
- go install ./{{.BUILD_DIR}}
clean:
desc: Clean build artifacts
dir: forst
cmds:
- rm -rf ../bin/
- go clean -cache
# Test tasks
test:
desc: Run all tests
dir: forst
deps: [build:runtime]
cmds:
- go test -v ./internal/...
- go test -v ./cmd/forst/...
test:unit:
desc: Run unit tests only
dir: forst
deps: [build:runtime]
cmds:
- go test -v ./internal/...
test:unit:parser:
desc: Run unit tests for parser
dir: forst
cmds:
- go test -v ./internal/parser/...
test:unit:typechecker:
desc: Run unit tests for typechecker
dir: forst
deps: [build:runtime]
cmds:
- go test -v ./internal/typechecker/...
test:unit:transformer:
desc: Run unit tests for transformer
dir: forst
cmds:
- go test -v ./internal/transformer/...
test:unit:lexer:
desc: Run unit tests for lexer
dir: forst
cmds:
- go test -v ./internal/lexer/...
test:unit:discovery:
desc: Run unit tests for discovery
dir: forst
cmds:
- go test -v ./internal/discovery/...
test:unit:executor:
desc: Run unit tests for executor
dir: forst
cmds:
- go test -v ./internal/executor/...
test:unit:ast:
desc: Run unit tests for AST
dir: forst
cmds:
- go test -v ./internal/ast/...
test:integration:
desc: Run integration tests (examples)
dir: forst
cmds:
- go test -v ./cmd/forst/...
test:scripts:
desc: Run shell script unit tests (port cleanup, etc.)
cmds:
- bash scripts/kill-forst-tcp-listeners_test.sh
test:coverage:
desc: Run tests with coverage
dir: forst
cmds:
- go test -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
generates:
- coverage.out
- coverage.html
# Example compilation tasks
#
# Multi-file merged package + TypeScript (examples/in/tictactoe):
# task example:tictactoe — run entry main/server.ft (forst run -root …/tictactoe)
# task example:tictactoe:generate — forst generate …/tictactoe (.forst/client dist/)
#
example:
desc: Compile a specific example file (use task example:tictactoe for merged-package demo)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.CLI_ARGS}}
vars:
CLI_ARGS: '{{.CLI_ARGS | default "../examples/in/basic.ft"}}'
example:basic:
desc: Compile basic example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/basic.ft
example:go-builtins:
desc: Compile go_builtins example (len/min/max on strings and slices)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/go_builtins.ft
example:slices:
desc: Compile slices example (subslice expressions xs[low:high], xs[low:], xs[:high])
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/slices.ft
example:go-interop:
desc: Run go_interop example (Go FFI + same-package hand-written Go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} generate {{.EXAMPLES_DIR}}/go_interop
- sh -c 'cd {{.EXAMPLES_DIR}}/go_interop && go run .'
test:errors-compat:
desc: Stdlib error interop tests + third-party errors-compat module compile check
dir: forst
cmds:
- go test ./internal/typechecker/... -run ErrorsCompat -count=1
- sh -c 'cd {{.EXAMPLES_DIR}}/go_interop/errors-compat && GOWORK=off go mod tidy && GOWORK=off go test ./... -count=1'
test:go-import-corpus:
desc: Typecheck manifest of Go import integration examples (requires go/packages)
dir: forst
cmds:
- go test ./internal/typechecker/... -run TestGoImportCorpus -count=1
example:generics:
desc: Compile generics example (built-in []T / *T, append/copy/cap/range; not user-defined type parameters)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generics.ft
example:generic-pointer:
desc: Compile user generic pointer example (golden examples/out/generic_pointer.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generic_pointer.ft
example:generic-map:
desc: Compile user generic map example (golden examples/out/generic_map.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generic_map.ft
example:generic-variadic:
desc: Compile user generic variadic example (golden examples/out/generic_variadic.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generic_variadic.ft
example:generic-shape:
desc: Compile user generic shape example (golden examples/out/generic_shape.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generic_shape.ft
example:generic-result:
desc: Compile user generic Result param example (golden examples/out/generic_result.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/generic_result.ft
example:function:
desc: Compile function example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/basic_function.ft
example:ensure:
desc: Compile ensure example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/ensure.ft
example:nominal-error:
desc: Compile nominal error example (error X { ... } nominal failure type, RFC 02)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/nominal_error.ft
example:union-error-types:
desc: Compile union of nominal errors typedef (ParseError | IoError → Go error / TS union)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/union_error_types.ft
example:union-error-narrowing:
desc: Compile union error narrowing example (golden examples/out/union_error_narrowing.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/union_error_narrowing.ft
example:map-catalog:
desc: Compile map catalog example (golden examples/out/map_catalog.go)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/map_catalog.ft
example:result-ensure:
desc: Compile Result + ensure Ok() example (golden examples/out/result_ensure/)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/result_ensure.ft
example:result-if:
desc: Compile Result + if x is Ok() example (golden examples/out/result_if/)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/result_if.ft
example:providers:
desc: Compile Providers showcase (use/with, golden examples/out/rfc/providers/)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} build -root {{.EXAMPLES_DIR}}/rfc/providers -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/rfc/providers/providers_demo/providers.ft
ensure:providers-gomod:
internal: true
dir: forst
cmds:
- |
MOD="{{.EXAMPLES_DIR}}/rfc/providers/go.mod"
if [ ! -f "$MOD" ]; then
printf '%s\n\n%s\n' 'module providers_demo' 'go 1.26' > "$MOD"
fi
test:providers:
desc: Run forst test on Providers golden package (providers.ft + providers_test.ft)
deps: [build, ensure:providers-gomod]
dir: forst
cmds:
- ../bin/{{.BINARY_NAME}} test {{.EXAMPLES_DIR}}/rfc/providers/providers_demo
test:providers-cross_pkg:
desc: Run cross-package Providers forst test (session sandbox under .forst/gen)
dir: forst
deps: [build]
cmds:
- go run ./{{.BUILD_DIR}} test -root {{.EXAMPLES_DIR}}/rfc/providers/cross_pkg ./api
test:multipackage-dev:
desc: Compile multi-package-dev example and run forst test parity gate
dir: forst
deps: [build]
cmds:
- task: example:multipackage-dev
- go test ./internal/project/... -run TestResolutionParity -count=1
- go test ./internal/testrunner/... -run TestRunWithProject_crossPkg_noZFilesInSourceTree -count=1
example:providers-cross_pkg:
desc: Compile cross-package Providers cookbook (alpha + beta emit)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} build -root {{.EXAMPLES_DIR}}/rfc/providers/cross_pkg/api -loglevel error -- {{.EXAMPLES_DIR}}/rfc/providers/cross_pkg/api/handle.ft
- go run ./{{.BUILD_DIR}} build -root {{.EXAMPLES_DIR}}/rfc/providers/cross_pkg/auth -loglevel error -- {{.EXAMPLES_DIR}}/rfc/providers/cross_pkg/auth/log.ft
test:forst:
desc: Alias for test:providers (forst test on Providers golden)
cmds:
- task: test:providers
example:requirements:
desc: Alias for example:providers (legacy task name)
dir: forst
cmds:
- task: example:providers
example:pointers:
desc: Compile pointers example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/pointers.ft
example:shape-guard:
desc: Compile shape guard example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/rfc/guard/shape_guard.ft
example:echo:
desc: Compile echo example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/echo.ft
examples:update-goldens:
desc: Regenerate all examples/out Go golden files (after compiler output changes)
dir: forst
cmds:
- UPDATE_EXAMPLES_GOLDENS=1 go test ./cmd/forst -run TestUpdateExamplesGoldens -count=1
- UPDATE_EXAMPLES_GOLDENS=1 go test ./internal/transformer/go -run TestWriteUnionErrorNarrowingGolden -count=1
- go test ./cmd/forst -run 'TestExamples$|TestExampleTictactoeMergedPackage|TestExampleProvidersMergedPackage|TestExampleProvidersCrossPkgGolden|TestExampleNodeInteropPackagesCompileGolden|TestGenerate_effectMode_matchesCommittedGoldens' -count=1
- go test ./internal/compiler -run TestCompileFile_map_catalog_golden -count=1
- git add -f ../examples/out/
example:loop:
desc: Compile for-loop / range example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/loop.ft
example:switch:
desc: Compile switch/case/default/fallthrough example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/switch/switch.ft
example:make-new-types:
desc: Compile make/new with Forst type syntax example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/make-new-types/make-new-types.ft
example:const-iota:
desc: Compile const/iota example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/const-iota/const-iota.ft
example:fixed-arrays:
desc: Compile fixed-size array example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/fixed-arrays/fixed-arrays.ft
example:struct-embedding:
desc: Compile struct embedding example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/struct-embedding/struct-embedding.ft
example:struct-tags:
desc: Compile struct tags example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/struct-tags/struct-tags.ft
example:closures:
desc: Compile function literals / closures example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/closures/closures.ft
example:goto-labels:
desc: Compile goto and labeled statements example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/goto-labels/goto-labels.ft
example:bitwise-ops:
desc: Compile bitwise operators and shift/xor compound assignment example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/bitwise-ops/bitwise-ops.ft
example:imports:
desc: Run single-file imports example (cli.ft); split fmt_only/greeting/main are for the LSP editor
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/imports/cli.ft
example:tictactoe:
desc: Run tic-tac-toe demo (merged package under examples/in/tictactoe; entry main/server.ft)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -root {{.EXAMPLES_DIR}}/tictactoe -- {{.EXAMPLES_DIR}}/tictactoe/main/server.ft
example:tictactoe:generate:
desc: Regenerate @forst/tictactoe client under .forst/client for tictactoe (forst generate)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} generate {{.EXAMPLES_DIR}}/tictactoe
example:generate-effect:generate:
desc: Regenerate @forst/generate-effect client (generate.effect true, Data.TaggedError errors)
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} generate {{.EXAMPLES_DIR}}/generate-effect
test:tictactoe:
desc: Generate TypeScript for tictactoe and run bun integration tests (startForstTestServer + client)
deps: [build, build:cli, build:client, build:errors, example:tictactoe:generate]
env:
FORST_BINARY: '{{.TASKFILE_DIR}}/bin/forst'
cmds:
- bun install
- bun test examples/in/tictactoe/tests/
example:basic-guard:
desc: Compile basic guard example
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} run -loglevel trace -report-phases -- {{.EXAMPLES_DIR}}/rfc/guard/basic_guard.ft
example:sidecar-local:
desc: Run sidecar example using local Forst binary
dir: examples/in/rfc/sidecar
deps: [build:sidecar, build]
cmds:
- bun run example:local
silent: false
example:sidecar-downloaded:
desc: Run sidecar example (FORST_BINARY defaults to repo bin/forst after task build; unset to exercise @forst/cli download)
dir: examples/in/rfc/sidecar
deps: [build:sidecar, build]
cmds:
- |
REPO_BIN="$(cd ../../../.. && pwd)/bin/forst"
export FORST_BINARY="${FORST_BINARY:-$REPO_BIN}"
bun run example:downloaded
silent: false
example:client:
desc: Run client example
dir: examples/in/rfc/sidecar
deps: [build, build:client, build:sidecar, install:bun]
cmds:
- bun run example:client
silent: false
test:bridge-interop:unit:
desc: Bridge interop unit tests (bridgeinterop, bridgert, typechecker, cmd/forst)
dir: forst
deps: [build:runtime]
cmds:
- go test ./internal/bridgeinterop/... -count=1
- go test ./bridgert/... -run 'TestCall|TestClient|TestRead|TestManifest|TestFixtures|TestResolve' -count=1 -p 1
- go test ./internal/typechecker/... -run 'NodeInterop|NodeImports' -count=1
- go test ./internal/compiler/... -run 'NodeInterop|RequireNoBridge|CompileNodeInterop' -count=1
- go test ./internal/transformer/go/... -run 'NodeBridge|TransformNode' -count=1
- go test ./cmd/forst/... -run 'NodeInterop' -count=1
test:bridge-interop:integration:
desc: Bridge interop integration tests (real bootstrap via bridgert)
dir: forst
deps: [build:runtime]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go test ./bridgert/... -run 'Integration' -count=1
test:bridge-host-e2e:
desc: Bootstrap E2E for Bun and Deno bridge hosts (Ping + CallSync)
dir: forst
deps: [build:runtime]
env:
FORST_REQUIRE_BRIDGE_HOST: "1"
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go test ./bridgert/ -run '^TestBridgeHost_' -count=1 -timeout=5m -v
test:bridge-interop:require-no-bridge:
desc: Verify -require-no-bridge allows basic.ft and rejects bridge-interop
dir: forst
cmds:
- go test ./cmd/forst/... -run 'TestNodeInterop_.*RequireNoBridge' -count=1
- go test ./internal/compiler/... -run 'RequireNoBridge' -count=1
bridge-interop:smoke:
desc: Bridge interop smoke (build runtime, Go contracts, Bun tests)
dir: forst
deps: [build:runtime, build]
cmds:
- task: test:bridge-interop:unit
- task: test:runtime
example:bridge-interop:
desc: Compile bridge-interop example (Phase 1 compile-only; import node + TS fixture)
dir: forst
deps: [build:runtime, build]
cmds:
- go run ./{{.BUILD_DIR}} build -root {{.EXAMPLES_DIR}}/rfc/bridge-interop -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/main.ft
example:multipackage-dev:
desc: Compile multi-package-dev example (main host + package auth)
dir: forst
deps: [build]
cmds:
- mkdir -p {{.OUTPUT_DIR}}/rfc/bridge-interop/multi-package-dev
- mkdir -p {{.EXAMPLES_DIR}}/rfc/bridge-interop/multi-package-dev/.forst/golden
- go run ./{{.BUILD_DIR}} generate --skip-client --go-entry={{.EXAMPLES_DIR}}/rfc/bridge-interop/multi-package-dev/main/main.ft --go-out=.forst/golden/main.go {{.EXAMPLES_DIR}}/rfc/bridge-interop/multi-package-dev
- cp -R {{.EXAMPLES_DIR}}/rfc/bridge-interop/multi-package-dev/.forst/golden/. {{.OUTPUT_DIR}}/rfc/bridge-interop/multi-package-dev/
example:multipackage-dev:run:
desc: Run multi-package-dev via forst dev (embedded invoke + hostMode)
dir: forst
deps: [build:runtime, build]
cmds:
- FORST_BINARY=../bin/forst ../bin/forst dev -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/multi-package-dev -entry main/main.ft -log-level error
example:multipackage-dev:reload-e2e:
desc: E2E — multipackage-dev forst dev reload keeps Node host pid alive
deps: [build:runtime, build]
cmds:
- bash scripts/multipackage-dev-reload-e2e.sh
example:embedded-invoke:
desc: Compile embedded-invoke example (embedded HTTP /invoke in compiled binary)
dir: forst
deps: [build]
cmds:
- mkdir -p {{.OUTPUT_DIR}}/rfc/embedded-invoke
- mkdir -p {{.EXAMPLES_DIR}}/rfc/embedded-invoke/.forst/golden
- go run ./{{.BUILD_DIR}} generate --skip-client --go-entry={{.EXAMPLES_DIR}}/rfc/embedded-invoke/main.ft --go-out=.forst/golden/main.go {{.EXAMPLES_DIR}}/rfc/embedded-invoke
- cp -R {{.EXAMPLES_DIR}}/rfc/embedded-invoke/.forst/golden/. {{.OUTPUT_DIR}}/rfc/embedded-invoke/
example:embedded-invoke:run:
desc: Run embedded-invoke binary and POST /invoke
dir: forst
deps: [build, example:embedded-invoke]
cmds:
- |
set -euo pipefail
bash ../scripts/kill-forst-tcp-listeners.sh 6321
FT_ROOT="{{.EXAMPLES_DIR}}/rfc/embedded-invoke"
FORST_INVOKE_TRANSPORT=tcp FORST_INVOKE_AUTH=off \
FORST_ROOT="$FT_ROOT" ../bin/forst run -export-struct-fields -root "$FT_ROOT" -- "$FT_ROOT/main.ft" &
PID=$!
trap 'kill -TERM $PID 2>/dev/null || true; bash ../scripts/kill-forst-tcp-listeners.sh 6321' EXIT
bash ../scripts/wait-for-url.sh http://127.0.0.1:6321/health invoke 30
curl -sf -X POST http://127.0.0.1:6321/invoke \
-H 'Content-Type: application/json' \
-d '{"package":"main","function":"Echo","args":[{"message":"hello"}]}'
example:bridge-interop-sync:
desc: Run bridge-interop sync example (Phase 2 sync RPC E2E)
dir: forst
deps: [build:runtime, build]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/sync -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/sync/main.ft
example:bridge-interop-promises:
desc: Run bridge-interop promises example (Phase 3 async RPC E2E)
dir: forst
deps: [build:runtime, build]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/promises -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/promises/main.ft
example:bridge-interop-generators:
desc: Run bridge-interop generators example (Phase 4 generator RPC E2E)
dir: forst
deps: [build:runtime, build]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/generators -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/generators/main.ft
example:bridge-interop-async:
desc: Run bridge-interop async example (multi-module blocking async + generators E2E)
dir: forst
deps: [build:runtime, build]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/async -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/async/main.ft
example:bridge-interop-host:
desc: Compile bridge-interop host example (host mode fixture; compile-only)
dir: forst
deps: [build:runtime, build]
cmds:
- go run ./{{.BUILD_DIR}} build -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/host -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/host/main.ft
example:bridge-interop-remix-serve:install:
desc: Install remix-serve example Node deps
dir: examples/in/rfc/bridge-interop/remix-serve
cmds:
- bun install
# Merged package main with descriptive stems (api.ft, types.ft); flag required — see examples/in/forst-generate-ts-examples.json
example:bridge-interop-remix-serve:generate:
desc: Generate TypeScript client for remix-serve example
dir: forst
deps: [build]
cmds:
- go run ./{{.BUILD_DIR}} generate {{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve
example:bridge-interop-remix-serve:build-remix:
desc: Build Remix app for remix-serve example (remix vite:build)
dir: examples/in/rfc/bridge-interop/remix-serve
deps: [build:client, build:errors, build:sidecar, example:bridge-interop-remix-serve:generate]
cmds:
- task: example:bridge-interop-remix-serve:install
- bun run build
example:bridge-interop-remix-serve:
desc: Compile bridge-interop remix-serve example (host mode + remix-serve + embedded invoke)
dir: forst
deps: [build:runtime, build, example:bridge-interop-remix-serve:build-remix]
cmds:
- go run ./{{.BUILD_DIR}} build -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve/main/main.ft
example:bridge-interop-remix-serve:run:
desc: Run remix-serve todo example (three-channel IPC; blocks on invoke server)
dir: forst
deps: [build:runtime, build, example:bridge-interop-remix-serve:build-remix]
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve/main/main.ft
example:bridge-interop-remix-serve:e2e:
desc: E2E — invoke :6321, Remix :6322, generated client
dir: forst
deps: [build:runtime, build, example:bridge-interop-remix-serve:build-remix]
cmds:
- |
FT_ROOT="{{.EXAMPLES_DIR}}/rfc/bridge-interop/remix-serve"
FORST_BIN="../bin/{{.BINARY_NAME}}"
export FT_ROOT FORST_BIN
bash -eo pipefail <<'EOS'
bash ../scripts/kill-forst-tcp-listeners.sh 6321
lsof -ti tcp:6322 2>/dev/null | xargs kill -9 2>/dev/null || true
pkill -f 'forst run.*bridge-interop/remix-serve' 2>/dev/null || true
pkill -f 'remix-serve build/server/index.js' 2>/dev/null || true
sleep 0.3
FORST_INVOKE_TRANSPORT=tcp FORST_ROOT="$FT_ROOT" "$FORST_BIN" run \
-export-struct-fields -root "$FT_ROOT" -- "$FT_ROOT/main/main.ft" &
FORST_PID=$!
cleanup() {
kill -TERM "$FORST_PID" 2>/dev/null || true
wait "$FORST_PID" 2>/dev/null || true
}
trap cleanup EXIT
trap cleanup INT
trap cleanup TERM
bash ../scripts/wait-for-url.sh http://127.0.0.1:6321/health "invoke :6321" 120
bash ../scripts/wait-for-url.sh http://127.0.0.1:6322/ "remix :6322" 120
curl -sf http://127.0.0.1:6322/ | grep -q 'Todos'
cd "$FT_ROOT" && FORST_BASE_URL=http://127.0.0.1:6321 bun test e2e/
EOS
example:bridge-interop-remix-serve:standalone-e2e:
desc: E2E — temp-dir remix-serve with local @forst/* file deps (no registry)
deps: [install:bun]
cmds:
- bash scripts/remix-serve-standalone-e2e.sh
example:bridge-interop-remix-serve:standalone-dev:
desc: Dev — temp-dir remix-serve; keeps running until Ctrl+C (cleans up after)
cmds:
- bash scripts/remix-serve-standalone-e2e.sh --dev
example:bridge-interop-modules:
desc: Run bridge-interop modules example (nested TS module resolution E2E)
dir: forst
deps: [build:runtime, build]
env:
FORST_BRIDGE_BOOTSTRAP: '{{.TASKFILE_DIR}}/packages/runtime/dist/bootstrap.js'
cmds:
- go run ./{{.BUILD_DIR}} run -export-struct-fields -root {{.EXAMPLES_DIR}}/rfc/bridge-interop/modules -- {{.EXAMPLES_DIR}}/rfc/bridge-interop/modules/main.ft
dump:
desc: Dump debug info for a specific example file
dir: forst
cmds:
- go run ./{{.BUILD_DIR}} dump --file={{.ROOT_DIR}}/{{.FILE}} -format={{.FORMAT}} --phase={{.PHASE}} --summary={{.SUMMARY}}
vars:
FILE: '{{.FILE | default "examples/in/basic.ft"}}'
FORMAT: '{{.FORMAT | default "json"}}'
PHASE: '{{.PHASE | default "all"}}'
SUMMARY: '{{.SUMMARY | default "false"}}'
# Development tasks
dev:watch:
desc: Watch for changes and run tests
cmds:
- watchexec -r "task test"
dev:lint:
desc: Run linters
dir: forst
cmds:
- golangci-lint run ./...
dev:format:
desc: Format code
dir: forst
cmds:
- go fmt ./...
dev:vet:
desc: Run go vet
dir: forst
cmds:
- go vet ./...
fix:check:
desc: Verify go fix modernizers produce no diff (Go 1.26)
dir: forst
cmds:
- go fix -diff ./...
profile:forst:
desc: Generate forst/default.pgo for release builds (re-run when typechecker/parser hot paths change)
dir: forst
cmds:
- |
set -euo pipefail
profiles=()
while IFS= read -r pkg; do
prof="$(mktemp -t forst-pgo-XXXX.pgo)"
profiles+=("$prof")
go test -bench=NONE -count=1 -timeout=30m -cpuprofile="$prof" "$pkg"
done < <(go list ./internal/typechecker/... ./internal/parser/... ./internal/transformer/... ./cmd/forst/...)
go tool pprof -proto -output=default.pgo "${profiles[@]}"
rm -f "${profiles[@]}"
# Documentation tasks
docs:generate:
desc: Generate documentation
dir: forst
cmds:
- godoc -http=:6060
# CI/CD tasks
check:coverage:
desc: Fail if merged statement coverage is below MIN_COVERAGE (default 72); uses profile.cov from last go test or runs tests
dir: forst
vars:
MIN_COVERAGE: '{{.MIN_COVERAGE | default "72"}}'
cmds:
- |
if [ ! -f profile.cov ]; then
PKGS=$(go list ./cmd/forst/... ./internal/... ./bridgert/... | paste -sd, -)
go test -coverprofile=profile.cov -coverpkg="$PKGS" ./cmd/forst/... ./internal/... ./bridgert/... -count=1
fi
- bash scripts/check_coverage_threshold.sh profile.cov {{.MIN_COVERAGE}}
test:go:short:
desc: Fast Go unit tests (skips -short gated integration tests)
dir: forst
cmds:
- go test -short -count=1 ./cmd/forst/... ./internal/...
ci:test:
desc: Run CI coverage suite (Go tests + Coveralls profile)
dir: forst
set: [errexit]
deps: [build:runtime]
cmds:
- task: build:vscode
- |
PKGS=$(go list ./cmd/forst/... ./internal/... ./bridgert/... | paste -sd, -)
go test -race -covermode atomic -coverpkg="$PKGS" -coverprofile=profile.cov -timeout=10m ./cmd/forst/... ./internal/... ./bridgert/...
ci:e2e:
desc: Run CI E2E suite (runtime examples, node interop, sidecar, providers)
set: [errexit]
deps: [build:runtime]
cmds:
- task: build
- task: test:cli
- task: test:cli:invoke-e2e
- task: test:sidecar
- task: bridge-interop:smoke
- task: test:bridge-host-e2e
- task: test:multipackage-dev
- task: example:embedded-invoke:run
- task: example:bridge-interop-sync
- task: example:bridge-interop-promises
- task: example:bridge-interop-generators
- task: example:bridge-interop-async
- task: example:bridge-interop-modules
- task: example:multipackage-dev:reload-e2e
- task example:sidecar-local
- task example:sidecar-downloaded
- task test:tictactoe