> ## Documentation Index
> Fetch the complete documentation index at: https://evalgate.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript quick start

> Run a credential-free local gate, break one reviewed case, and inspect the blocking result.

# Your first local gate

Start with one behavior in the repository you change. The local gate runs your
checks against a reviewed baseline. No EvalGate account, API key, GitHub
connection or model call is needed for this deterministic example. The local
CLI gate is **Experimental**; [feature status](https://evalgate.com/docs/platform/feature-status.md) records
its package and acceptance boundaries.

## Install and preview

```bash theme={null}
npm install --save-dev @evalgate/sdk
npx @evalgate/sdk init --local --format json
npx @evalgate/sdk init --local --apply --format json
```

The first init writes nothing. Review its proposed files before explicit
`--apply`. Use the scoped `npx @evalgate/sdk`: the unscoped `evalgate` npm
package belongs to someone else. Package installation needs network access;
the deterministic scaffold and gate make no requests to EvalGate.

## Replace the placeholder with a real check

Create `src/refund-policy.cjs`:

```js theme={null}
exports.decideRefund = ({ daysSincePurchase }) =>
  daysSincePurchase > 30 ? "deny" : "review";
```

For the generic Node scaffold, replace the contents of
`evals/smart-init/generic-node.eval.cjs` in place. Do not leave an untouched
placeholder beside a new spec: baseline acceptance refuses it. If your init
plan selects another framework, use that plan's generated spec path and adjust
the relative import below.

```js theme={null}
const { createResult, defineEval } = require("@evalgate/sdk");
const { decideRefund } = require("../../src/refund-policy.cjs");

defineEval("day 30 stays inside the review window", async () => {
  const output = decideRefund({ daysSincePurchase: 30 });
  const pass = output === "review";
  return createResult({ pass, score: pass ? 100 : 0, output });
});
```

This fictional policy illustrates a boundary check; it is not a production
refund rule. Substitute your reviewed requirements. Spec names are literal
strings so discovery can inspect them without executing application code.

## Review and accept the baseline

```bash theme={null}
npx @evalgate/sdk discover --manifest
git diff
git status --short
git add package.json package-lock.json .gitignore .agents evalgate.project.json evalgate.config.json evalgate.md evals src/refund-policy.cjs .github/workflows/evalgate-gate.yml
git commit -m "add reviewed refund boundary check"
npx @evalgate/sdk baseline update
git add evals/baseline.json
git commit -m "accept passing baseline"
npx @evalgate/sdk gate --format json
```

Accept only a non-empty passing run. Never accept the untouched scaffold or
update a baseline merely to turn a regression green. Review every proposed
scaffold file and the staged changes before committing; keep unrelated work
out of the baseline commit.

## Break it, read it, fix it

Change `> 30` to `>= 30`, then run the same command:

```bash theme={null}
npx @evalgate/sdk gate --format json
```

The gate blocks with exit `2`: the day-30 case now returns `deny`. Inspect
`evals/regression-report.json` and `.evalgate/last-report.json`. Fix the
comparison and rerun; it should pass against the original baseline. A pass
supports only the checks and evidence required by this gate, not universal
safety or permission to deploy. Other nonzero exits can mean invalid evidence,
configuration or infrastructure failure; see the [exit contract](https://evalgate.com/docs/sdk/cli.md).

## Know the files

| File | Created by | Remember it as |
| - | - | - |
| `evalgate.project.json` | `init --local --apply` | Local execution target and baseline lineage |
| `evalgate.config.json` | `init --local --apply` | How to run and gate your checks |
| `evals/baseline.json` | Init creates pending; `baseline update` accepts | Reviewed comparison evidence |
| `.github/workflows/evalgate-gate.yml` | `init --local --apply` | The same gate in GitHub Actions |

Two optional files are **not** local-init output: `.evalgate/project.json` is
hosted organization/repository/root linkage, written by `link` after `login`;
`evalgate.product.json` is product intent, written only by the Experimental
`understand --apply` workflow. Local project = execution; dot-directory project
\= hosted linkage. Neither optional workflow belongs in this first gate.

Continue with [the same gate in CI](https://evalgate.com/docs/guides/cicd-integration.md). Later, use
[hosted setup](https://evalgate.com/docs/quickstart.md#optional-hosted-setup) for shared evidence or
[migration guidance](https://evalgate.com/docs/guides/migrate-to-evalgate.md) to bring existing cases.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.