hphp/hack/src/.llms/rules/building.md
✅ Main build target:
buck build @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/src:hh_single_type_check
✅ Type check single file:
buck run @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/src:hh_single_type_check -- $THE_FILE
✅ View typed abstract syntax tree:
buck run @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/src:hh_single_type_check -- --tast $THE_FILE
✅ Run tests:
You can consult BUCK files and existing tests to find the best test target to run.
Examples:
buck test @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/test/typecheck:typecheck
buck test @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/test/nast/...
To update snapshots (.exp files):
buck test @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/test/ --config hack.update=always
❌ NEVER run all tests unless the user asks you to
❌ buck test @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/test/...
❌ NEVER use these (require approval):
buck clean - Buck's output is trustworthy, if the build is broken then fix it. If you doubt your changes are taking effect, just make a code change and observe the result.>, >>timeout command✅ GOOD - Building before making changes:
# Always build first to verify clean state
buck build @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/src:hh_single_type_check
# Make your changes
# Build again to verify
buck build @fbcode//mode/dev-nosan-lg fbcode//hphp/hack/src:hh_single_type_check
❌ BAD - Using prohibited commands:
# DON'T DO THIS
buck clean
buck build ... > build.log 2>&1
timeout 30 buck build ...
ocamlc ...
buck run✅ Build succeeds ✅ No unintended behavior changes ✅ Tests pass (with updated snapshots if needed)