@nifrajs/cli 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check.d.ts +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +28 -2
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +17 -4
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +27 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +158 -15
- package/dist/doctor.js.map +1 -1
- package/dist/learn.d.ts +32 -0
- package/dist/learn.d.ts.map +1 -0
- package/dist/learn.js +127 -0
- package/dist/learn.js.map +1 -0
- package/dist/mcp-app-tool.d.ts +14 -0
- package/dist/mcp-app-tool.d.ts.map +1 -0
- package/dist/mcp-app-tool.js +80 -0
- package/dist/mcp-app-tool.js.map +1 -0
- package/dist/mcp-docs-tools.d.ts +1 -1
- package/dist/mcp-docs-tools.d.ts.map +1 -1
- package/dist/mcp-docs-tools.js +17 -1
- package/dist/mcp-docs-tools.js.map +1 -1
- package/dist/mcp-http.d.ts +10 -6
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +30 -12
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp.d.ts +14 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +188 -0
- package/dist/mcp.js.map +1 -1
- package/dist/upgrade.d.ts +13 -2
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +105 -7
- package/dist/upgrade.js.map +1 -1
- package/docs/llms-full.txt +104 -2
- package/docs/types.json +202 -26
- package/package.json +9 -9
- package/src/check.ts +30 -2
- package/src/cli.ts +21 -4
- package/src/doctor.ts +186 -3
- package/src/learn.ts +152 -0
- package/src/mcp-app-tool.ts +86 -0
- package/src/mcp-docs-tools.ts +18 -1
- package/src/mcp-http.ts +32 -14
- package/src/mcp.ts +237 -0
- package/src/upgrade.ts +125 -7
package/docs/llms-full.txt
CHANGED
|
@@ -3535,6 +3535,34 @@ to an agent than its own memory of the framework.
|
|
|
3535
3535
|
`nifra_types` also follows each package's `exports` map rather than
|
|
3536
3536
|
scanning the build output, so it will not offer a type that is real but unimportable.
|
|
3537
3537
|
|
|
3538
|
+
### From any assistant, hosted
|
|
3539
|
+
|
|
3540
|
+
The teaching tools - `nifra_docs`, `nifra_example`,
|
|
3541
|
+
`nifra_types`, `nifra_learn` - are also served, project-independent, at
|
|
3542
|
+
`mcp.nifra.dev`. Add that one URL to any assistant and it learns Nifra from the same
|
|
3543
|
+
verified corpora, with no local checkout. It is read-only and needs no key. The project tools
|
|
3544
|
+
above still come from `nifra mcp` in your own repo, where they can see your routes.
|
|
3545
|
+
|
|
3546
|
+
```ts
|
|
3547
|
+
# Claude Code
|
|
3548
|
+
claude mcp add --transport http nifra-docs https://mcp.nifra.dev
|
|
3549
|
+
|
|
3550
|
+
# Claude.ai (web or desktop): Settings -> Connectors -> Add custom connector -> https://mcp.nifra.dev
|
|
3551
|
+
# ChatGPT (developer mode): Settings -> Connectors -> add the same URL
|
|
3552
|
+
|
|
3553
|
+
# Cursor - .cursor/mcp.json
|
|
3554
|
+
# { "mcpServers": { "nifra-docs": { "url": "https://mcp.nifra.dev" } } }
|
|
3555
|
+
|
|
3556
|
+
# VS Code - .vscode/mcp.json
|
|
3557
|
+
# { "servers": { "nifra-docs": { "type": "http", "url": "https://mcp.nifra.dev" } } }
|
|
3558
|
+
```
|
|
3559
|
+
|
|
3560
|
+
Cursor reads it in one click:
|
|
3561
|
+
[
|
|
3562
|
+
add Nifra docs to Cursor
|
|
3563
|
+
](cursor://anysphere.cursor-deeplink/mcp/install?name=nifra-docs&config=eyJ1cmwiOiJodHRwczovL21jcC5uaWZyYS5kZXYifQ==)
|
|
3564
|
+
.
|
|
3565
|
+
|
|
3538
3566
|
### The gate to write against
|
|
3539
3567
|
|
|
3540
3568
|
`nifra_check` is the one an agent should loop on. It returns structured
|
|
@@ -7484,6 +7512,16 @@ The mock server matches reflected routes and synthesizes values from supported J
|
|
|
7484
7512
|
Unsupported or unsatisfiable schemas fail explicitly instead of returning known-invalid data. Use a
|
|
7485
7513
|
fixed seed when responses must be replayable across local development and CI.
|
|
7486
7514
|
|
|
7515
|
+
Routes whose response validator exposes no JSON Schema (zod, valibot, arktype) mock as `{}` by default.
|
|
7516
|
+
Pass `reflectJsonSchema` to derive a schema from such a validator so those routes mock real data; for zod,
|
|
7517
|
+
use the bridge shipped as `@nifrajs/testing/zod`:
|
|
7518
|
+
|
|
7519
|
+
```ts
|
|
7520
|
+
import { zodJsonSchema } from "@nifrajs/testing/zod"
|
|
7521
|
+
|
|
7522
|
+
const mock = createMockServer(app, { reflectJsonSchema: zodJsonSchema })
|
|
7523
|
+
```
|
|
7524
|
+
|
|
7487
7525
|
## For AI agents
|
|
7488
7526
|
|
|
7489
7527
|
Start with [`LLM.md`](./LLM.md) - this package's contract card (the exports you call + its footguns),
|
|
@@ -7941,6 +7979,32 @@ const report = await assertAdversarialContract(app, {
|
|
|
7941
7979
|
request for each declared response schema, so use an isolated test app/database-never point the
|
|
7942
7980
|
laboratory at production.
|
|
7943
7981
|
|
|
7982
|
+
### Opaque validators (zod / valibot / arktype)
|
|
7983
|
+
|
|
7984
|
+
A `t` schema exposes JSON Schema, so witnesses and constraint-driven mutations are synthesized
|
|
7985
|
+
automatically. A Standard Schema validator that carries no JSON Schema (zod, valibot, arktype) validates
|
|
7986
|
+
requests fine, but the laboratory can't inspect it - those routes report `NO_WITNESS` and get only
|
|
7987
|
+
type-confusion mutations. Pass `reflectJsonSchema` to convert such a validator; for zod, use the shipped
|
|
7988
|
+
bridge:
|
|
7989
|
+
|
|
7990
|
+
```ts
|
|
7991
|
+
import { zodJsonSchema } from "@nifrajs/testing/zod"
|
|
7992
|
+
|
|
7993
|
+
await assertAdversarialContract(app, { reflectJsonSchema: zodJsonSchema })
|
|
7994
|
+
```
|
|
7995
|
+
|
|
7996
|
+
This turns on witness synthesis and constraint-driven mutations (min/max, length, pattern, enum, format)
|
|
7997
|
+
for zod routes. `createMockServer` from `@nifrajs/mock` accepts the same hook. `zod` is an optional peer -
|
|
7998
|
+
only projects that import `@nifrajs/testing/zod` need it installed.
|
|
7999
|
+
|
|
8000
|
+
### Response conformance needs a declared contract
|
|
8001
|
+
|
|
8002
|
+
Response conformance only runs for routes that declare a `response` schema. A response type inferred from a
|
|
8003
|
+
handler's return is a client-side contract the laboratory cannot see, so an app that declares none checks
|
|
8004
|
+
zero response targets even with `validateResponses` on - the report surfaces this in `advisories`. Declare
|
|
8005
|
+
`response:` on the routes you want verified. (Runtime response validation in the server itself is a
|
|
8006
|
+
separate opt-in, installed by the `responseContract()` plugin.)
|
|
8007
|
+
|
|
7944
8008
|
`nifra levels` L4 uses this same deep engine through the explicitly configured isolated executor;
|
|
7945
8009
|
the older core invariant runner remains only as a compatibility export.
|
|
7946
8010
|
|
|
@@ -8048,6 +8112,40 @@ one cheap read instead of the whole corpus. For the wider framework: the repo's
|
|
|
8048
8112
|
[`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus. Run `nifra check` as the
|
|
8049
8113
|
done-gate, or `nifra mcp` to give the agent live project tools.
|
|
8050
8114
|
|
|
8115
|
+
## @nifrajs/ts-plugin
|
|
8116
|
+
|
|
8117
|
+
A TypeScript language-service plugin for [nifra](https://github.com/nifrajs/nifra). It adds go-to-definition on route-path string literals: put your cursor on `"/orders"` in `navigate({ to: "/orders" })`, `<Link to="/orders">`, or `href="/orders"`, and jump straight to the `routes/` file that serves it.
|
|
8118
|
+
|
|
8119
|
+
The routing rules are nifra's own - it discovers routes with `@nifrajs/web` and matches them with `@nifrajs/core`'s pattern matcher - so a path resolves to exactly the file it would serve at runtime, dynamic segments included (`/users/42` → `routes/users/[id].tsx`).
|
|
8120
|
+
|
|
8121
|
+
## Install
|
|
8122
|
+
|
|
8123
|
+
```sh
|
|
8124
|
+
npm install -D @nifrajs/ts-plugin
|
|
8125
|
+
```
|
|
8126
|
+
|
|
8127
|
+
## Enable
|
|
8128
|
+
|
|
8129
|
+
Add it to your `tsconfig.json`:
|
|
8130
|
+
|
|
8131
|
+
```json
|
|
8132
|
+
{
|
|
8133
|
+
"compilerOptions": {
|
|
8134
|
+
"plugins": [{ "name": "@nifrajs/ts-plugin" }]
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
```
|
|
8138
|
+
|
|
8139
|
+
In VS Code, run "TypeScript: Select TypeScript Version" from the Command Palette and choose "Use Workspace Version" so the editor loads the plugin from your project.
|
|
8140
|
+
|
|
8141
|
+
## For agents
|
|
8142
|
+
|
|
8143
|
+
Start with [`LLM.md`](./LLM.md) - this package's contract card (the exports it ships and how it wires in). [`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus for the whole framework.
|
|
8144
|
+
|
|
8145
|
+
## License
|
|
8146
|
+
|
|
8147
|
+
MIT
|
|
8148
|
+
|
|
8051
8149
|
## @nifrajs/uploads
|
|
8052
8150
|
|
|
8053
8151
|
File-upload hardening for nifra - magic-byte MIME detection, size + type validation, short-TTL signed download URLs, and EXIF/metadata stripping. Dependency-free, edge-safe.
|
|
@@ -8410,7 +8508,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
8410
8508
|
|
|
8411
8509
|
## @nifrajs/devtools
|
|
8412
8510
|
|
|
8413
|
-
`devtools`, `DevToolsClientOptions`, `devtoolsClientScript`, `DevToolsEvent`, `DevToolsOptions`
|
|
8511
|
+
`devtools`, `DevToolsClientOptions`, `devtoolsClientScript`, `DevToolsEvent`, `DevToolsOptions`, `DevToolsQuery`, `filterDevToolsEvents`
|
|
8414
8512
|
|
|
8415
8513
|
## @nifrajs/env
|
|
8416
8514
|
|
|
@@ -8450,7 +8548,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
8450
8548
|
|
|
8451
8549
|
## @nifrajs/mock
|
|
8452
8550
|
|
|
8453
|
-
`createMockServer`, `generateMockValue`, `MockableApp`, `MockableRoute`, `MockServer`, `MockServerOptions`, `UnsupportedMockSchemaError`
|
|
8551
|
+
`autoReflectJsonSchema`, `createMockServer`, `generateMockValue`, `MockableApp`, `MockableRoute`, `MockServer`, `MockServerOptions`, `UnsupportedMockSchemaError`
|
|
8454
8552
|
|
|
8455
8553
|
## @nifrajs/node
|
|
8456
8554
|
|
|
@@ -8480,6 +8578,10 @@ done-gate, or `nifra mcp` to give the agent live project tools.
|
|
|
8480
8578
|
|
|
8481
8579
|
`AdapterCertificationError`, `AdapterCertificationProfile`, `AdapterCertificationReport`, `AdversarialContractError`, `AdversarialContractOptions`, `AdversarialContractReport`, `AdversarialContractResult`, `AppLike`, `assertAdapterCertification`, `assertAdversarialContract`, `assertIncidentReplays`, `cacheStoreCertificationProfile`, `CapturedRequest`, `CapturedRequestInput`, `captureIncident`, `CaptureIncidentOptions`, `CertifiableCacheEntry`, `CertifiableCacheStore`, `CertifiableDomainEvent`, `CertifiableEventDeliveryAdapter`, `CertifiableEventRecord`, `CertifiableJobStore`, `CertifiableRuntimeAdapter`, `CertifiableRuntimeServer`, `CertifiableStorageAdapter`, `CertificationCapabilityEvidence`, `CertificationCheck`, `CertificationCheckEvidence`, `certifyAdapter`, `ContractCaseContext`, `ContractCaseKind`, `ContractCoverageGap`, `ContractCoverageGapCode`, `ContractReplay`, `ContractRuntime`, `ContractTarget`, `ContractTestApp`, `ContractWitness`, `cookieJar`, `CookieJar`, `createFailureLab`, `defineCertificationProfile`, `eventDeliveryCertificationProfile`, `FailureDirective`, `FailureEvidence`, `FailureInjectedError`, `FailureKind`, `FailureLab`, `FailureLabOptions`, `FailureReplay`, `FailureScenario`, `FailureScenarioReport`, `generateRegressionTest`, `GenerateRegressionTestOptions`, `IncidentCapsule`, `IncidentReplayError`, `IncidentReplayResult`, `jobStoreCertificationProfile`, `redactForEmission`, `replayIncident`, `ReplayIncidentOptions`, `runAdversarialContract`, `runFailureScenario`, `runtimeAdapterCertificationProfile`, `shapeOf`, `storageAdapterCertificationProfile`, `testSession`, `TestSession`, `TestSessionOptions`, `verifyAdapterCertification`
|
|
8482
8580
|
|
|
8581
|
+
## @nifrajs/ts-plugin
|
|
8582
|
+
|
|
8583
|
+
`findRoutePathLiteral`, `findRoutesDir`
|
|
8584
|
+
|
|
8483
8585
|
## @nifrajs/uploads
|
|
8484
8586
|
|
|
8485
8587
|
`detectFileType`, `FileType`, `ImageReencoder`, `signDownloadUrl`, `SignDownloadUrlOptions`, `stripImageMetadata`, `StripImageMetadataOptions`, `UploadResult`, `validateUpload`, `ValidateUploadOptions`, `verifyDownloadUrl`
|