.TH HH_SERVER 1 .SH NAME hh_server \- Hack language typechecker daemon .SH SYNOPSIS .B hh_server .RI [ \-\-check\ [ \-\-json ]] .I DIRECTORY .SH DESCRIPTION .BR hh_server (1) is the actual typechecker that enforces the Hack type system. It is typically accessed via .BR hh_client (1); see the documentation for that tool for more information on the Hack type system and how to interface with .BR hh_server (1). Directly invoking .BR hh_server (1) is of minimal use, since .BR hh_client (1) will start and stop it as needed. The only widely useful manual invocation is .IR --check mode. With no options, .BR hh_server (1) will start up, do an initial typecheck of .IR DIRECTORY , and continue running, waiting for connections from .BR hh_client (1). Again, this is not the normal way the server should be invoked -- just running .BR hh_client (1) and ignoring the existence of this server binary is sufficient for common use. .SH OPTIONS .TP .B \-\-check Start up, check the .IR DIRECTORY , print type errors in a human-readable format, and then exit. This "batch mode" might be useful in cases where a single check is needed and so starting a long-running daemon is not appropriate, such as in a pre-commit hook. The output is intended for human consumption, not tools; for tool consumption, see .B \-\-json below. .TP .B \-\-json If .B \-\-check is specified, generate machine-readable JSON output instead of the human-readable output generated by default. .TP .BI \-\-check " TARGET" Start up and check .I DIRECTORY in the same manner as .B \-\-check mode. Then, re-check .I TARGET and attempt to add type annotations to locations in those files that are missing. The analysis process is slow and imperfect, but often useful. This process can change the code in ways that fail at runtime; see .I http://docs.hhvm.com/hack/tools/introduction for detailed information on how to combine this mode with .BR hackificator (1) and .BR hack_remove_soft_types (1) to do a full and safe conversion from PHP to Hack. .SH EXIT STATUS If .B \-\-check is specified, exits with 0 if there are no type errors, nonzero otherwise. Other exit values are undefined. .SH ENVIRONMENT and FILES Uses the same scheme for constructing a path to a socket for client/server communication that .BR hh_client (1) uses. See its documentation for a description. .SH EXAMPLE It might be useful to have a pre-commit hook to make sure that type errors don't sneak into trunk. A hook might want to directly invoke .BR hh_server (1) so that it doesn't need a running daemon. That can be done with something like .nf .RS hh_server \-\-check /var/www .RE .fi and, if that fails, printing its output and rejecting the commit. For tool usage, something like .nf .RS hh_server \-\-check \-\-json /var/www .RE .fi might be more appropriate; the JSON output can be passed up to a code review tool and displayed there. This is only for cases where having a long-running daemon is inappropriate. For normal development usage, invoking .BR hh_client (1) and allowing it to use the server itself will be much faster to check code and return type errors. .SH BUGS The Hack language is part of the HHVM project. Known bugs can be found at that tracker, and new ones should be reported there as well: .I https://github.com/facebook/hhvm/issues .SH SEE ALSO .BR hh_client (1), \ hackificator (1), \ hack_remove_soft_types (1). .br .I http://docs.hhvm.com/hack/typechecker/setup .br .I http://www.hacklang.org/