@specferret/core 0.1.3 → 0.2.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/README.md +62 -62
- package/dist/context/index.d.ts +5 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +47 -1
- package/dist/context/index.js.map +1 -1
- package/dist/extractor/__fixtures__/typescript/generics.d.ts +6 -0
- package/dist/extractor/__fixtures__/typescript/generics.d.ts.map +1 -0
- package/dist/extractor/__fixtures__/typescript/generics.js +2 -0
- package/dist/extractor/__fixtures__/typescript/generics.js.map +1 -0
- package/dist/extractor/__fixtures__/typescript/intersections.d.ts +6 -0
- package/dist/extractor/__fixtures__/typescript/intersections.d.ts.map +1 -0
- package/dist/extractor/__fixtures__/typescript/intersections.js +2 -0
- package/dist/extractor/__fixtures__/typescript/intersections.js.map +1 -0
- package/dist/extractor/__fixtures__/typescript/optional-nested.d.ts +8 -0
- package/dist/extractor/__fixtures__/typescript/optional-nested.d.ts.map +1 -0
- package/dist/extractor/__fixtures__/typescript/optional-nested.js +2 -0
- package/dist/extractor/__fixtures__/typescript/optional-nested.js.map +1 -0
- package/dist/extractor/__fixtures__/typescript/unions.d.ts +5 -0
- package/dist/extractor/__fixtures__/typescript/unions.d.ts.map +1 -0
- package/dist/extractor/__fixtures__/typescript/unions.js +2 -0
- package/dist/extractor/__fixtures__/typescript/unions.js.map +1 -0
- package/dist/extractor/__fixtures__/typescript/unsupported-syntax.d.ts +7 -0
- package/dist/extractor/__fixtures__/typescript/unsupported-syntax.d.ts.map +1 -0
- package/dist/extractor/__fixtures__/typescript/unsupported-syntax.js +2 -0
- package/dist/extractor/__fixtures__/typescript/unsupported-syntax.js.map +1 -0
- package/dist/extractor/contract-types.d.ts +5 -0
- package/dist/extractor/contract-types.d.ts.map +1 -0
- package/dist/extractor/contract-types.js +8 -0
- package/dist/extractor/contract-types.js.map +1 -0
- package/dist/extractor/frontmatter.d.ts +6 -1
- package/dist/extractor/frontmatter.d.ts.map +1 -1
- package/dist/extractor/frontmatter.js +17 -6
- package/dist/extractor/frontmatter.js.map +1 -1
- package/dist/extractor/typescript.d.ts +6 -1
- package/dist/extractor/typescript.d.ts.map +1 -1
- package/dist/extractor/typescript.js +403 -185
- package/dist/extractor/typescript.js.map +1 -1
- package/dist/extractor/upward-classifier.d.ts +25 -0
- package/dist/extractor/upward-classifier.d.ts.map +1 -0
- package/dist/extractor/upward-classifier.js +48 -0
- package/dist/extractor/upward-classifier.js.map +1 -0
- package/dist/extractor/validator.d.ts +9 -0
- package/dist/extractor/validator.d.ts.map +1 -1
- package/dist/extractor/validator.js +28 -9
- package/dist/extractor/validator.js.map +1 -1
- package/dist/index.d.ts +14 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/dist/reconciler/index.d.ts +10 -0
- package/dist/reconciler/index.d.ts.map +1 -1
- package/dist/reconciler/index.js +76 -0
- package/dist/reconciler/index.js.map +1 -1
- package/dist/store/sqlite.d.ts +1 -1
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +106 -101
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/types.d.ts +6 -2
- package/dist/store/types.d.ts.map +1 -1
- package/package.json +47 -44
- package/src/config.ts +48 -0
- package/src/context/index.test.ts +274 -0
- package/src/context/index.ts +178 -0
- package/src/extractor/__fixtures__/typescript/generics.golden.json +36 -0
- package/src/extractor/__fixtures__/typescript/generics.ts +5 -0
- package/src/extractor/__fixtures__/typescript/intersections.golden.json +18 -0
- package/src/extractor/__fixtures__/typescript/intersections.ts +5 -0
- package/src/extractor/__fixtures__/typescript/optional-nested.golden.json +41 -0
- package/src/extractor/__fixtures__/typescript/optional-nested.ts +7 -0
- package/src/extractor/__fixtures__/typescript/unions.golden.json +30 -0
- package/src/extractor/__fixtures__/typescript/unions.ts +4 -0
- package/src/extractor/__fixtures__/typescript/unsupported-syntax.golden.json +20 -0
- package/src/extractor/__fixtures__/typescript/unsupported-syntax.ts +6 -0
- package/src/extractor/contract-types.ts +11 -0
- package/src/extractor/frontmatter.test.ts +291 -0
- package/src/extractor/frontmatter.ts +87 -0
- package/src/extractor/hash.ts +26 -0
- package/src/extractor/typescript.test.ts +339 -0
- package/src/extractor/typescript.ts +597 -0
- package/src/extractor/upward-classifier.test.ts +188 -0
- package/src/extractor/upward-classifier.ts +68 -0
- package/src/extractor/validator.test.ts +228 -0
- package/src/extractor/validator.ts +199 -0
- package/src/index.ts +17 -0
- package/src/reconciler/import-suggestions.test.ts +101 -0
- package/src/reconciler/import-suggestions.ts +157 -0
- package/src/reconciler/index.test.ts +248 -0
- package/src/reconciler/index.ts +445 -0
- package/src/store/factory.ts +54 -0
- package/src/store/postgres.ts +84 -0
- package/src/store/sqlite.test.ts +328 -0
- package/src/store/sqlite.ts +231 -0
- package/src/store/types.ts +101 -0
- package/src/utils/paths.ts +24 -0
package/README.md
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
# @specferret/core
|
|
2
|
-
|
|
3
|
-
Core engine for SpecFerret contract extraction, validation, graph reconciliation, and drift analysis.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@specferret/core)
|
|
6
|
-
[](../../LICENSE)
|
|
7
|
-
|
|
8
|
-
## What this package is for
|
|
9
|
-
|
|
10
|
-
`@specferret/core` is the runtime library behind the CLI. Use it when you want to embed SpecFerret behavior in scripts, custom tooling, or internal workflows.
|
|
11
|
-
|
|
12
|
-
It includes:
|
|
13
|
-
|
|
14
|
-
- Store implementations (`sqlite`, `postgres`)
|
|
15
|
-
- Frontmatter extraction and schema validation
|
|
16
|
-
- Reconciler logic for direct/transitive impact
|
|
17
|
-
- Context graph generation utilities
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm i @specferret/core
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Runtime requirements
|
|
26
|
-
|
|
27
|
-
- Bun 1.0+
|
|
28
|
-
|
|
29
|
-
SpecFerret core is Bun-first and uses Bun-compatible runtime behavior.
|
|
30
|
-
|
|
31
|
-
## Typical consumers
|
|
32
|
-
|
|
33
|
-
- Internal platform tooling that needs drift checks in-process
|
|
34
|
-
- CI wrappers that need machine-readable drift metadata
|
|
35
|
-
- Custom developer workflows on top of SpecFerret reconciliation data
|
|
36
|
-
|
|
37
|
-
## Validation status
|
|
38
|
-
|
|
39
|
-
Core behavior is validated through the Sprint 5 external branch-matrix harness (spec-kit + BMAD), including explicit assertions for:
|
|
40
|
-
|
|
41
|
-
- S40 transitive depth thresholds
|
|
42
|
-
- S41 review proof artifacts
|
|
43
|
-
- S42 extract determinism
|
|
44
|
-
|
|
45
|
-
Latest green runs:
|
|
46
|
-
|
|
47
|
-
- spec-kit: https://github.com/BenGardiner123/spec-ferret-validation-spec-kit/actions/runs/23962649755
|
|
48
|
-
- BMAD: https://github.com/BenGardiner123/specferret-validation-bmad/actions/runs/23962652352
|
|
49
|
-
|
|
50
|
-
## Looking for the CLI?
|
|
51
|
-
|
|
52
|
-
Install `@specferret/cli` if you want the end-user command interface:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
bun install -g @specferret/cli
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Links
|
|
59
|
-
|
|
60
|
-
- Source: https://github.com/BenGardiner123/spec-ferret
|
|
61
|
-
- Docs: https://specferret.dev
|
|
62
|
-
- CLI package: https://www.npmjs.com/package/@specferret/cli
|
|
1
|
+
# @specferret/core
|
|
2
|
+
|
|
3
|
+
Core engine for SpecFerret contract extraction, validation, graph reconciliation, and drift analysis.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@specferret/core)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
## What this package is for
|
|
9
|
+
|
|
10
|
+
`@specferret/core` is the runtime library behind the CLI. Use it when you want to embed SpecFerret behavior in scripts, custom tooling, or internal workflows.
|
|
11
|
+
|
|
12
|
+
It includes:
|
|
13
|
+
|
|
14
|
+
- Store implementations (`sqlite`, `postgres`)
|
|
15
|
+
- Frontmatter extraction and schema validation
|
|
16
|
+
- Reconciler logic for direct/transitive impact
|
|
17
|
+
- Context graph generation utilities
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm i @specferret/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Runtime requirements
|
|
26
|
+
|
|
27
|
+
- Bun 1.0+
|
|
28
|
+
|
|
29
|
+
SpecFerret core is Bun-first and uses Bun-compatible runtime behavior.
|
|
30
|
+
|
|
31
|
+
## Typical consumers
|
|
32
|
+
|
|
33
|
+
- Internal platform tooling that needs drift checks in-process
|
|
34
|
+
- CI wrappers that need machine-readable drift metadata
|
|
35
|
+
- Custom developer workflows on top of SpecFerret reconciliation data
|
|
36
|
+
|
|
37
|
+
## Validation status
|
|
38
|
+
|
|
39
|
+
Core behavior is validated through the Sprint 5 external branch-matrix harness (spec-kit + BMAD), including explicit assertions for:
|
|
40
|
+
|
|
41
|
+
- S40 transitive depth thresholds
|
|
42
|
+
- S41 review proof artifacts
|
|
43
|
+
- S42 extract determinism
|
|
44
|
+
|
|
45
|
+
Latest green runs:
|
|
46
|
+
|
|
47
|
+
- spec-kit: https://github.com/BenGardiner123/spec-ferret-validation-spec-kit/actions/runs/23962649755
|
|
48
|
+
- BMAD: https://github.com/BenGardiner123/specferret-validation-bmad/actions/runs/23962652352
|
|
49
|
+
|
|
50
|
+
## Looking for the CLI?
|
|
51
|
+
|
|
52
|
+
Install `@specferret/cli` if you want the end-user command interface:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bun install -g @specferret/cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Links
|
|
59
|
+
|
|
60
|
+
- Source: https://github.com/BenGardiner123/spec-ferret
|
|
61
|
+
- Docs: https://specferret.dev
|
|
62
|
+
- CLI package: https://www.npmjs.com/package/@specferret/cli
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DBStore } from "../store/types.js";
|
|
2
|
+
export declare const CONTEXT_VERSION: "2.0";
|
|
3
|
+
export declare const CONTEXT_SCHEMA_VERSION: "1.0.0";
|
|
2
4
|
export interface ContextContract {
|
|
3
5
|
id: string;
|
|
4
6
|
type: string;
|
|
@@ -12,12 +14,14 @@ export interface ContextEdge {
|
|
|
12
14
|
to: string;
|
|
13
15
|
}
|
|
14
16
|
export interface FerretContext {
|
|
15
|
-
version:
|
|
17
|
+
version: typeof CONTEXT_VERSION;
|
|
18
|
+
schemaVersion: typeof CONTEXT_SCHEMA_VERSION;
|
|
16
19
|
generated: string;
|
|
17
20
|
contracts: ContextContract[];
|
|
18
21
|
edges: ContextEdge[];
|
|
19
22
|
needsReview: string[];
|
|
20
23
|
}
|
|
24
|
+
export declare function readContextFile(contextPath: string): FerretContext;
|
|
21
25
|
/**
|
|
22
26
|
* Reads the full graph from the store and writes .ferret/context.json.
|
|
23
27
|
* Called automatically at the end of every ferret scan.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,eAAe,EAAG,KAAc,CAAC;AAC9C,eAAO,MAAM,sBAAsB,EAAG,OAAgB,CAAC;AAUvD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,eAAe,CAAC;IAChC,aAAa,EAAE,OAAO,sBAAsB,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAyCD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAalE;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CA6Ef"}
|
package/dist/context/index.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
export const CONTEXT_VERSION = "2.0";
|
|
4
|
+
export const CONTEXT_SCHEMA_VERSION = "1.0.0";
|
|
5
|
+
function normalizeContext(raw) {
|
|
6
|
+
if (!raw || typeof raw !== "object") {
|
|
7
|
+
throw new Error("ferret: invalid context.json format. Run 'ferret scan' to regenerate .ferret/context.json.");
|
|
8
|
+
}
|
|
9
|
+
const candidate = raw;
|
|
10
|
+
const contextVersion = candidate.version;
|
|
11
|
+
if (contextVersion !== CONTEXT_VERSION) {
|
|
12
|
+
throw new Error(`ferret: unsupported context.json version '${String(contextVersion)}'. Run 'ferret scan' with the current CLI to regenerate .ferret/context.json.`);
|
|
13
|
+
}
|
|
14
|
+
const schemaVersion = candidate.schemaVersion;
|
|
15
|
+
if (schemaVersion !== undefined && schemaVersion !== CONTEXT_SCHEMA_VERSION) {
|
|
16
|
+
throw new Error(`ferret: unsupported context schemaVersion '${String(schemaVersion)}'. Run 'ferret scan' with the current CLI to migrate .ferret/context.json.`);
|
|
17
|
+
}
|
|
18
|
+
// Known migration path: V2 payloads created before schemaVersion was introduced.
|
|
19
|
+
const legacy = candidate;
|
|
20
|
+
return {
|
|
21
|
+
version: CONTEXT_VERSION,
|
|
22
|
+
schemaVersion: CONTEXT_SCHEMA_VERSION,
|
|
23
|
+
generated: typeof legacy.generated === "string"
|
|
24
|
+
? legacy.generated
|
|
25
|
+
: new Date(0).toISOString(),
|
|
26
|
+
contracts: Array.isArray(legacy.contracts)
|
|
27
|
+
? legacy.contracts
|
|
28
|
+
: [],
|
|
29
|
+
edges: Array.isArray(legacy.edges) ? legacy.edges : [],
|
|
30
|
+
needsReview: Array.isArray(legacy.needsReview)
|
|
31
|
+
? legacy.needsReview
|
|
32
|
+
: [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function readContextFile(contextPath) {
|
|
36
|
+
try {
|
|
37
|
+
const raw = fs.readFileSync(contextPath, "utf-8");
|
|
38
|
+
return normalizeContext(JSON.parse(raw));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
42
|
+
if (message.startsWith("ferret:")) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
throw new Error(`ferret: unable to read .ferret/context.json (${message}). Run 'ferret scan' to regenerate it.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
3
48
|
/**
|
|
4
49
|
* Reads the full graph from the store and writes .ferret/context.json.
|
|
5
50
|
* Called automatically at the end of every ferret scan.
|
|
@@ -51,7 +96,8 @@ export async function writeContext(store, projectRoot) {
|
|
|
51
96
|
.filter((c) => needsReviewNodeIds.has(c.node_id) || c.status === "needs-review")
|
|
52
97
|
.map((c) => c.id);
|
|
53
98
|
const context = {
|
|
54
|
-
version:
|
|
99
|
+
version: CONTEXT_VERSION,
|
|
100
|
+
schemaVersion: CONTEXT_SCHEMA_VERSION,
|
|
55
101
|
generated: new Date().toISOString(),
|
|
56
102
|
contracts: contextContracts,
|
|
57
103
|
edges,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAc,CAAC;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAgB,CAAC;AAiCvD,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;IAChH,CAAC;IAED,MAAM,SAAS,GAAG,GAA8B,CAAC;IACjD,MAAM,cAAc,GAAG,SAAS,CAAC,OAAO,CAAC;IACzC,IAAI,cAAc,KAAK,eAAe,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,6CAA6C,MAAM,CAAC,cAAc,C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AAE,CAAC,CAAC;IAEpB,MAAM,OAAO,GAAkB;QAC7B,OAAO,EAAE,eAAe;QACxB,aAAa,EAAE,sBAAsB;QACrC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,SAAS,EAAE,gBAAgB;QAC3B,KAAK;QACL,WAAW;KACZ,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAEzD,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,IAAI,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics.d.ts","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/generics.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics.js","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/generics.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersections.d.ts","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/intersections.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersections.js","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/intersections.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-nested.d.ts","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/optional-nested.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-nested.js","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/optional-nested.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unions.d.ts","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/unions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unions.js","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/unions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsupported-syntax.d.ts","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/unsupported-syntax.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI;KACtC,CAAC,IAAI,CAAC,GAAG;QACR,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsupported-syntax.js","sourceRoot":"","sources":["../../../../src/extractor/__fixtures__/typescript/unsupported-syntax.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CONTRACT_TYPES: readonly ["api", "table", "type", "event", "flow", "config"];
|
|
2
|
+
export type ContractType = (typeof CONTRACT_TYPES)[number];
|
|
3
|
+
export declare function isContractType(value: unknown): value is ContractType;
|
|
4
|
+
export declare function formatAllowedContractTypes(): string;
|
|
5
|
+
//# sourceMappingURL=contract-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../src/extractor/contract-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,8DAA+D,CAAC;AAE3F,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const CONTRACT_TYPES = ['api', 'table', 'type', 'event', 'flow', 'config'];
|
|
2
|
+
export function isContractType(value) {
|
|
3
|
+
return typeof value === 'string' && CONTRACT_TYPES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function formatAllowedContractTypes() {
|
|
6
|
+
return CONTRACT_TYPES.join(', ');
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=contract-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-types.js","sourceRoot":"","sources":["../../src/extractor/contract-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAI3F,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import type { ContractType } from './contract-types.js';
|
|
1
2
|
export interface ExtractionResult {
|
|
2
3
|
filePath: string;
|
|
3
4
|
fileType: 'spec' | 'code';
|
|
4
5
|
contracts: Array<{
|
|
5
6
|
id: string;
|
|
6
|
-
type:
|
|
7
|
+
type: ContractType;
|
|
7
8
|
shape: object;
|
|
8
9
|
shape_hash: string;
|
|
9
10
|
imports: string[];
|
|
11
|
+
/** Path to the TypeScript source file (code-first contracts only). */
|
|
12
|
+
sourceFile?: string;
|
|
13
|
+
/** TypeScript symbol name (code-first contracts only). */
|
|
14
|
+
sourceSymbol?: string;
|
|
10
15
|
}>;
|
|
11
16
|
extractedBy: 'gray-matter' | 'tree-sitter';
|
|
12
17
|
extractedAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/extractor/frontmatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/extractor/frontmatter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,SAAS,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,YAAY,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,sEAAsE;QACtE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,0DAA0D;QAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,WAAW,EAAE,aAAa,GAAG,aAAa,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAkD3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Synchronous only. No async. No await. Anywhere in this file.
|
|
2
2
|
// Extractor layer — turns a spec file into an ExtractionResult using gray-matter.
|
|
3
3
|
import matter from 'gray-matter';
|
|
4
|
-
import { validateFerretSchema } from './validator.js';
|
|
4
|
+
import { validateContractType, validateFerretSchema } from './validator.js';
|
|
5
5
|
import { hashSchema } from './hash.js';
|
|
6
6
|
/**
|
|
7
7
|
* Extracts a FerretContract from a spec file's YAML frontmatter.
|
|
@@ -25,23 +25,34 @@ export function extractFromSpecFile(filePath, fileContent) {
|
|
|
25
25
|
warning: 'no-frontmatter',
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
const missingFields = ['id', 'type', 'shape'].filter(f => !ferret[f]);
|
|
28
|
+
const missingFields = ['id', 'type', 'shape'].filter((f) => !ferret[f]);
|
|
29
29
|
if (missingFields.length > 0) {
|
|
30
30
|
throw new Error(`Missing required frontmatter fields in ${filePath}: ${missingFields.join(', ')}`);
|
|
31
31
|
}
|
|
32
|
+
const typeValidation = validateContractType(ferret.type, filePath);
|
|
33
|
+
if (!typeValidation.valid) {
|
|
34
|
+
throw new Error(typeValidation.error);
|
|
35
|
+
}
|
|
32
36
|
// validateFerretSchema never throws — only warns on unsupported keywords
|
|
33
37
|
const validation = validateFerretSchema(ferret.shape, filePath);
|
|
34
|
-
validation.warnings.forEach(w => process.stderr.write(w + '\n'));
|
|
38
|
+
validation.warnings.forEach((w) => process.stderr.write(w + '\n'));
|
|
39
|
+
const source = ferret.source;
|
|
40
|
+
const sourceFile = typeof source?.file === 'string' ? source.file : undefined;
|
|
41
|
+
const sourceSymbol = typeof source?.symbol === 'string' ? source.symbol : undefined;
|
|
35
42
|
return {
|
|
36
43
|
filePath,
|
|
37
44
|
fileType: 'spec',
|
|
38
|
-
contracts: [
|
|
45
|
+
contracts: [
|
|
46
|
+
{
|
|
39
47
|
id: ferret.id,
|
|
40
|
-
type:
|
|
48
|
+
type: typeValidation.value,
|
|
41
49
|
shape: ferret.shape,
|
|
42
50
|
shape_hash: hashSchema(ferret.shape),
|
|
43
51
|
imports: Array.isArray(ferret.imports) ? ferret.imports : [],
|
|
44
|
-
|
|
52
|
+
...(sourceFile !== undefined && { sourceFile }),
|
|
53
|
+
...(sourceSymbol !== undefined && { sourceSymbol }),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
45
56
|
extractedBy: 'gray-matter',
|
|
46
57
|
extractedAt: Date.now(),
|
|
47
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/extractor/frontmatter.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kFAAkF;AAElF,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/extractor/frontmatter.ts"],"names":[],"mappings":"AAAA,+DAA+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AAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAEnE,MAAM,MAAM,GAAG,MAAM,CAAC,MAA0D,CAAC;IACjF,MAAM,UAAU,GAAG,OAAO,MAAM,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,MAAM,YAAY,GAAG,OAAO,MAAM,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpF,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,MAAM,CAAC,EAAY;gBACvB,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,KAAK,EAAE,MAAM,CAAC,KAAe;gBAC7B,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC;gBACpC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,OAAoB,CAAC,CAAC,CAAC,EAAE;gBAC1E,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC;gBAC/C,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;aACpD;SACF;QACD,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ContractType } from './contract-types.js';
|
|
2
|
+
export type { ContractType } from './contract-types.js';
|
|
2
3
|
export interface ExtractedCodeContract {
|
|
3
4
|
id: string;
|
|
4
5
|
type: ContractType;
|
|
5
6
|
shape: Record<string, unknown>;
|
|
6
7
|
sourceSymbol: string;
|
|
7
8
|
filePath: string;
|
|
9
|
+
idSource?: 'inferred' | 'annotated';
|
|
8
10
|
}
|
|
9
11
|
export interface TypeScriptExtractionResult {
|
|
10
12
|
contracts: ExtractedCodeContract[];
|
|
13
|
+
/** Hard failures — annotation parse errors, unmatched annotations, tree-sitter parse failures. */
|
|
14
|
+
errors: string[];
|
|
15
|
+
/** Soft warnings — unsupported type fallbacks, partial extractions. Detection succeeded but schema is approximate. */
|
|
11
16
|
diagnostics: string[];
|
|
12
17
|
}
|
|
13
18
|
export declare function extractContractsFromTypeScript(filePath: string, content: string): TypeScriptExtractionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/extractor/typescript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/extractor/typescript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACrC;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,kGAAkG;IAClG,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sHAAsH;IACtH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAggBD,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,0BAA0B,CA+D5G"}
|