@agent-teams/feature-module-standard 0.0.0 → 0.1.1
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/CHANGELOG.md +44 -0
- package/README.md +47 -3
- package/dist/features/node-runner/application/run-feature-module-check.d.ts +109 -0
- package/dist/features/node-runner/application/run-feature-module-check.d.ts.map +1 -0
- package/dist/features/node-runner/application/run-feature-module-check.js +76 -0
- package/dist/features/node-runner/application/run-feature-module-check.js.map +1 -0
- package/dist/features/node-runner/composition/check-feature-module-on-disk.d.ts +4 -0
- package/dist/features/node-runner/composition/check-feature-module-on-disk.d.ts.map +1 -0
- package/dist/features/node-runner/composition/check-feature-module-on-disk.js +16 -0
- package/dist/features/node-runner/composition/check-feature-module-on-disk.js.map +1 -0
- package/dist/node.d.ts +4 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/package.json +18 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#410](https://github.com/agent-teams-ai/engineering-foundation/pull/410) [`0ab3744`](https://github.com/agent-teams-ai/engineering-foundation/commit/0ab37446fe3716eba25eebde73af32393a756fc5) Thanks [@777genius](https://github.com/777genius)! - Add the Bun default repository runtime profile, closed Bun package-script
|
|
8
|
+
adapter, deterministic workspace projection and explicit clean Node/pnpm
|
|
9
|
+
rollback while preserving supported public Node 24/26 and Node-owned test,
|
|
10
|
+
coverage, package-manager and release lanes.
|
|
11
|
+
|
|
12
|
+
Publish repository-agent-workflow policy schema v2 with an explicit Bun or pnpm
|
|
13
|
+
manager. Version 1 remains pnpm-only. The repository adopts v2; its clean Node
|
|
14
|
+
projection records and verifies the corresponding pnpm policy bytes.
|
|
15
|
+
|
|
16
|
+
Republish Feature Module Standard with the updated Foundation peer range and
|
|
17
|
+
exact development dependency produced by its workspace manifest projection.
|
|
18
|
+
|
|
19
|
+
Publish workspace-dependency-declarations policy schema v2 with an explicit Bun
|
|
20
|
+
or pnpm manager and the existing pnpm-workspace.yaml catalog authority. Version 1
|
|
21
|
+
remains pnpm-only. The Node projection records and verifies both dependency
|
|
22
|
+
policy digests alongside its root manifest and workflow policy evidence.
|
|
23
|
+
|
|
24
|
+
Observe the pinned pnpm version without triggering installation when the
|
|
25
|
+
read-only qualification observer runs from a Bun-managed workspace.
|
|
26
|
+
|
|
27
|
+
Resolve built-in source imports through the runtime's `node:module.isBuiltin`
|
|
28
|
+
contract, including prefix-only `node:test` under Bun. Bare `test` retains normal
|
|
29
|
+
package declaration checks, and unknown `node:` imports remain unsupported.
|
|
30
|
+
|
|
31
|
+
## 0.1.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [#398](https://github.com/agent-teams-ai/engineering-foundation/pull/398) [`5805cbc`](https://github.com/agent-teams-ai/engineering-foundation/commit/5805cbc31ce0fc63f39d3cf3e18a9c6b6c98cde6) Thanks [@777genius](https://github.com/777genius)! - Add the opt-in Feature Module Standard package: a pure kernel that checks the
|
|
36
|
+
declared structure of one production module (feature tree and sub-features,
|
|
37
|
+
visibility, edge classes, composition contracts, republication, layer direction,
|
|
38
|
+
cycles, test ownership and growth metrics) and the shared conformance fixtures
|
|
39
|
+
that every adopting checker runs. A `./node` runner reads the declared roots
|
|
40
|
+
through the Foundation source graph and reports growth budget warnings; Foundation
|
|
41
|
+
`^1.8.0` is an optional peer dependency. Repository policy stays input; the kernel
|
|
42
|
+
reads no files and widens no rule.
|
|
43
|
+
|
|
44
|
+
The runner retains unresolved literal and computed references and rejects an
|
|
45
|
+
incomplete source graph instead of reporting a successful architecture check.
|
|
46
|
+
|
|
3
47
|
Release version and notes are generated by Changesets; the source manifest uses
|
|
4
48
|
`0.0.0` until the first publication.
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ a `features` directory inside a feature keeps its v1 meaning.
|
|
|
46
46
|
| Test ownership: a test belongs to the deepest feature, sub-feature tests live in the mirrored test root, and a test uses another visible feature only through public, internal API and testing surfaces | `test-unowned`, `test-misplaced` (warnings: the standard says SHOULD), `not-visible`, `deep-import` |
|
|
47
47
|
| Visibility and curated surfaces: a sub-feature is visible to its parent and the parent's descendants; no deep imports | `not-visible`, `deep-import`, `surface-unowned` |
|
|
48
48
|
| Layer direction (v1): domain and application never import contracts; adapters reach siblings through the application core | `layer-direction` |
|
|
49
|
-
| Composition contracts (module-level composition is named by `moduleComposition
|
|
49
|
+
| Composition contracts (module-level composition is named by `moduleComposition`): they are composition code, only composition code depends on them, visible features only | `composition-contract-misplaced`, `composition-contract-layer`, `not-visible` |
|
|
50
50
|
| Assembly: only a parent's composition wires its direct sub-feature, and it wires every one that exposes a composition surface | `assembly-misplaced`, `assembly-missing` |
|
|
51
51
|
| Republication: declared, from a direct sub-feature, one level at a time | `republication-undeclared`, `republication-skips-level`, `republication-invalid`, `republication-mismatch`, `republication-not-sub-feature` |
|
|
52
52
|
| Declared use edges, when the consumer has a profile | `use-undeclared`, `use-edge-invalid` |
|
|
@@ -73,9 +73,53 @@ composition-contract cases as complete module descriptions with their expected
|
|
|
73
73
|
diagnostic codes. The kernel tests, and every adopting checker as its
|
|
74
74
|
conformance test, run the same data.
|
|
75
75
|
|
|
76
|
-
##
|
|
76
|
+
## Runner
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
`@agent-teams/feature-module-standard/node` checks a module on disk. It reads the declared roots through
|
|
79
|
+
`@agent-teams/engineering-foundation/source-graph`, runs the kernel and compares the per-feature metrics with
|
|
80
|
+
growth budgets from `@agent-teams/engineering-foundation/ratchet` (warnings only). Engineering Foundation `^1.8.0` is an
|
|
81
|
+
optional peer dependency: users of `.` and `./fixtures` do not need it.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { checkFeatureModuleOnDisk, formatNodeReport } from '@agent-teams/feature-module-standard/node';
|
|
85
|
+
|
|
86
|
+
const report = await checkFeatureModuleOnDisk({
|
|
87
|
+
consumerRoot: process.cwd(),
|
|
88
|
+
sourceRoots: ['src'],
|
|
89
|
+
testRoots: ['tests/features'],
|
|
90
|
+
testFeaturesRoot: 'tests/features',
|
|
91
|
+
structure: { featuresRoot: 'src/features', roleDirectories: { domain: 'domain', application: 'application' } },
|
|
92
|
+
surfaces: { public: ['src/features/orders/contracts/public.ts'] },
|
|
93
|
+
budgets: [{ metric: 'sourceFiles', max: 40 }],
|
|
94
|
+
});
|
|
95
|
+
process.stdout.write(formatNodeReport(report));
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The configuration is data. `structure` is either the default layout (`featuresRoot`, `roleDirectories`, declared
|
|
99
|
+
`subFeatureRoots`) or the profile's own mapping (`featureRoots`, `roleRoots`). Metrics available to budgets are `depth`,
|
|
100
|
+
`subFeatures`, `sourceFiles`, `testFiles` and every name of `fileGroups` (regular expression sources). A file the parser
|
|
101
|
+
cannot read fails the run, because its imports would be missing from the check. A bare specifier is not an edge: the
|
|
102
|
+
file graph reports packages and aliases as external, so a tsconfig alias that points into a feature is not seen.
|
|
103
|
+
`moduleComposition` names the module-level files permitted to use composition contracts or wire feature surfaces;
|
|
104
|
+
omitting it or supplying an empty list declares no module-level composition. Runtime and type-only export-from
|
|
105
|
+
references retain their republication provenance when passed to the kernel.
|
|
106
|
+
Unresolved literal targets and computed runtime references remain in `unresolved` and
|
|
107
|
+
`unresolvedRuntimeReferences`; either makes `ok` false. `formatNodeReport` prints these source-coverage errors
|
|
108
|
+
separately from the kernel's architecture diagnostics. Bare external package imports remain outside the internal
|
|
109
|
+
feature graph and need the consumer's dependency policy.
|
|
110
|
+
|
|
111
|
+
`testRoots` selects entire directories whose files are treated as tests, not production. A selected test file must
|
|
112
|
+
be inside a declared or inferred feature root (a colocated test directory), or below the explicit `testFeaturesRoot`
|
|
113
|
+
that mirrors feature ownership. The runner rejects files outside both mappings instead of silently skipping their
|
|
114
|
+
ownership, metrics and import checks. `mappedFiles` names files directly below a feature root; it does not map an
|
|
115
|
+
external test tree to feature owners. Use dedicated colocated test directories rather than mixed production
|
|
116
|
+
directories. Module-level packaged-artifact and black-box tests outside feature ownership need their own consumer
|
|
117
|
+
checks and are not selected by this example.
|
|
118
|
+
|
|
119
|
+
The runner observes files, not empty directories, so it cannot by itself qualify empty-role or empty-container
|
|
120
|
+
rules. It supplies resolved references marked `runtime` as the kernel's load graph; that conservative graph is
|
|
121
|
+
not proof of when a dynamic import or CommonJS load executes. Consumers retain their selected syntax profile
|
|
122
|
+
and complementary source checks instead of treating `ok` as complete language or standard conformance.
|
|
79
123
|
|
|
80
124
|
## Stability
|
|
81
125
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ERROR_CODES, WARNING_CODES } from '../../feature-model/domain/model.js';
|
|
2
|
+
import type { Diagnostic, DiagnosticCode, FeatureMetric, FeatureNode, LayerRole, Republication, RepublishedSurface, RoleRoot, Severity, SurfaceMap, UseEdge } from '../../feature-model/domain/model.js';
|
|
3
|
+
export { ERROR_CODES, WARNING_CODES };
|
|
4
|
+
export type { Diagnostic, DiagnosticCode, FeatureMetric, FeatureNode, LayerRole, Republication, RepublishedSurface, RoleRoot, Severity, SurfaceMap, UseEdge, };
|
|
5
|
+
/** A resolved import between two files, as a source graph reports it. */
|
|
6
|
+
export type GraphEdge = Readonly<{
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
mode: 'runtime' | 'type-only';
|
|
10
|
+
line: number;
|
|
11
|
+
reexport?: true;
|
|
12
|
+
}>;
|
|
13
|
+
/** A literal reference whose target could not be established by the source producer. */
|
|
14
|
+
export type GraphUnresolved = Readonly<{
|
|
15
|
+
from: string;
|
|
16
|
+
specifier: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
mode: 'runtime' | 'type-only';
|
|
19
|
+
line: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** A computed loader whose target is unavailable to the source producer. */
|
|
22
|
+
export type GraphRuntimeReference = Readonly<{
|
|
23
|
+
from: string;
|
|
24
|
+
kind: string;
|
|
25
|
+
line: number;
|
|
26
|
+
}>;
|
|
27
|
+
export type ObservedGraph = Readonly<{
|
|
28
|
+
files: readonly string[];
|
|
29
|
+
edges: readonly GraphEdge[];
|
|
30
|
+
parseFailures: readonly string[];
|
|
31
|
+
unresolved: readonly GraphUnresolved[];
|
|
32
|
+
unresolvedRuntimeReferences: readonly GraphRuntimeReference[];
|
|
33
|
+
}>;
|
|
34
|
+
export type BudgetMeasurement = Readonly<{
|
|
35
|
+
subject: string;
|
|
36
|
+
metric: string;
|
|
37
|
+
value: number;
|
|
38
|
+
}>;
|
|
39
|
+
/** A ceiling for a metric; a threshold with a `subject` replaces the general one for that feature. */
|
|
40
|
+
export type BudgetThreshold = Readonly<{
|
|
41
|
+
metric: string;
|
|
42
|
+
max: number;
|
|
43
|
+
subject?: string;
|
|
44
|
+
}>;
|
|
45
|
+
export type BudgetWarning = BudgetMeasurement & Readonly<{
|
|
46
|
+
max: number;
|
|
47
|
+
}>;
|
|
48
|
+
/** What the runner needs from the outside: a file graph and the growth budget comparison. */
|
|
49
|
+
export type NodeRunnerPorts = Readonly<{
|
|
50
|
+
observe: (roots: readonly string[]) => Promise<ObservedGraph>;
|
|
51
|
+
checkBudgets: (input: Readonly<{
|
|
52
|
+
measurements: readonly BudgetMeasurement[];
|
|
53
|
+
thresholds: readonly BudgetThreshold[];
|
|
54
|
+
}>) => readonly BudgetWarning[];
|
|
55
|
+
}>;
|
|
56
|
+
/** The default layout: `<features root>/<feature>/<role directory>`. */
|
|
57
|
+
export type DirectoryStructure = Readonly<{
|
|
58
|
+
featuresRoot: string;
|
|
59
|
+
roleDirectories: Readonly<Record<string, LayerRole>>;
|
|
60
|
+
/** Declared sub-feature roots. Without them only the top-level features exist. */
|
|
61
|
+
subFeatureRoots?: readonly string[];
|
|
62
|
+
}>;
|
|
63
|
+
/** The profile's own mapping, for a tree that does not follow the default layout. */
|
|
64
|
+
export type DeclaredStructure = Readonly<{
|
|
65
|
+
featureRoots: readonly string[];
|
|
66
|
+
roleRoots: readonly RoleRoot[];
|
|
67
|
+
featuresRoots?: readonly string[];
|
|
68
|
+
}>;
|
|
69
|
+
/** Data only: every fact is declared, nothing is discovered beyond the files and their imports. */
|
|
70
|
+
export type NodeCheckConfig = Readonly<{
|
|
71
|
+
consumerRoot: string;
|
|
72
|
+
/** Repository-relative production roots. */
|
|
73
|
+
sourceRoots: readonly string[];
|
|
74
|
+
/** Repository-relative test roots; their files are the module's tests. */
|
|
75
|
+
testRoots?: readonly string[];
|
|
76
|
+
structure: DirectoryStructure | DeclaredStructure;
|
|
77
|
+
mappedFiles?: readonly string[];
|
|
78
|
+
testFeaturesRoot?: string;
|
|
79
|
+
surfaces?: SurfaceMap;
|
|
80
|
+
/** Module-level source files that the profile declares as composition. */
|
|
81
|
+
moduleComposition?: readonly string[];
|
|
82
|
+
republications?: readonly Republication[];
|
|
83
|
+
useEdges?: readonly UseEdge[];
|
|
84
|
+
depthWarning?: number;
|
|
85
|
+
/** Named file groups to count per feature, as regular expression sources matched against the repository path. */
|
|
86
|
+
fileGroups?: Readonly<Record<string, string>>;
|
|
87
|
+
budgets?: readonly BudgetThreshold[];
|
|
88
|
+
}>;
|
|
89
|
+
export type NodeReport = Readonly<{
|
|
90
|
+
ok: boolean;
|
|
91
|
+
features: readonly FeatureNode[];
|
|
92
|
+
diagnostics: readonly Diagnostic[];
|
|
93
|
+
metrics: readonly FeatureMetric[];
|
|
94
|
+
/** Files the parser could not read; their imports are missing from the check, so the run fails. */
|
|
95
|
+
parseFailures: readonly string[];
|
|
96
|
+
/** Missing or unsupported literal references keep source coverage incomplete. */
|
|
97
|
+
unresolved: readonly GraphUnresolved[];
|
|
98
|
+
/** Computed references cannot establish a complete architecture graph. */
|
|
99
|
+
unresolvedRuntimeReferences: readonly GraphRuntimeReference[];
|
|
100
|
+
budgetWarnings: readonly BudgetWarning[];
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Reads the declared roots through the file graph, runs the kernel over the module they hold and compares its per-feature
|
|
104
|
+
* metrics with the declared growth budgets. Budgets only warn; every other result comes from the kernel unchanged.
|
|
105
|
+
*/
|
|
106
|
+
export declare function runFeatureModuleCheck(config: NodeCheckConfig, ports: NodeRunnerPorts): Promise<NodeReport>;
|
|
107
|
+
/** One line per finding: `error code path:line message`, then unreadable files and budget warnings. */
|
|
108
|
+
export declare function formatNodeReport(report: NodeReport): string;
|
|
109
|
+
//# sourceMappingURL=run-feature-module-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-feature-module-check.d.ts","sourceRoot":"","sources":["../../../../src/features/node-runner/application/run-feature-module-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAA4B,MAAM,qCAAqC,CAAC;AAC3G,OAAO,KAAK,EACV,UAAU,EAAE,cAAc,EAAE,aAAa,EAAsB,WAAW,EAAgB,SAAS,EAAE,aAAa,EAAE,kBAAkB,EACtI,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EACxC,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AACtC,YAAY,EACV,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,GAC9I,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAC7H,wFAAwF;AACxF,MAAM,MAAM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AC,EAAE,MAAM,CAAC;IACtB,iHAAiH;IACjH,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IACjC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IACnC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,mGAAmG;IACnG,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iFAAiF;IACjF,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;IACvC,0EAA0E;IAC1E,2BAA2B,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC9D,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C,CAAC,CAAC;AAsBH;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAqChH;AAED,uGAAuG;AACvG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAU3D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { inferDirectoryLayout } from '../../feature-layout/application/infer-directory-layout.js';
|
|
2
|
+
import { checkFeatureModule } from '../../module-check/application/check-feature-module.js';
|
|
3
|
+
import { ERROR_CODES, WARNING_CODES, isPortablePath, isWithin } from '../../feature-model/domain/model.js';
|
|
4
|
+
// The report and the configuration name kernel types and the closed code lists; the runner entry point republishes them.
|
|
5
|
+
export { ERROR_CODES, WARNING_CODES };
|
|
6
|
+
const inRoots = (path, roots) => roots.some((root) => isWithin(path, root));
|
|
7
|
+
function structureOf(config, files) {
|
|
8
|
+
const { structure } = config;
|
|
9
|
+
if ('featureRoots' in structure) {
|
|
10
|
+
return { featureRoots: structure.featureRoots, roleRoots: structure.roleRoots, ...(structure.featuresRoots === undefined ? {} : { featuresRoots: structure.featuresRoots }) };
|
|
11
|
+
}
|
|
12
|
+
return inferDirectoryLayout({ ...structure, files });
|
|
13
|
+
}
|
|
14
|
+
function measurementsOf(metrics) {
|
|
15
|
+
return metrics.flatMap((metric) => [
|
|
16
|
+
{ subject: metric.id, metric: 'depth', value: metric.depth },
|
|
17
|
+
{ subject: metric.id, metric: 'subFeatures', value: metric.subFeatures },
|
|
18
|
+
{ subject: metric.id, metric: 'sourceFiles', value: metric.sourceFiles },
|
|
19
|
+
{ subject: metric.id, metric: 'testFiles', value: metric.testFiles },
|
|
20
|
+
...Object.entries(metric.groups).map(([name, value]) => ({ subject: metric.id, metric: name, value })),
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reads the declared roots through the file graph, runs the kernel over the module they hold and compares its per-feature
|
|
25
|
+
* metrics with the declared growth budgets. Budgets only warn; every other result comes from the kernel unchanged.
|
|
26
|
+
*/
|
|
27
|
+
export async function runFeatureModuleCheck(config, ports) {
|
|
28
|
+
const testRoots = config.testRoots ?? [];
|
|
29
|
+
const graph = await ports.observe([...config.sourceRoots, ...testRoots]);
|
|
30
|
+
const testFiles = graph.files.filter((file) => inRoots(file, testRoots));
|
|
31
|
+
const files = graph.files.filter((file) => !inRoots(file, testRoots));
|
|
32
|
+
const known = new Set(graph.files);
|
|
33
|
+
const imports = graph.edges
|
|
34
|
+
.filter((edge) => known.has(edge.from) && known.has(edge.to))
|
|
35
|
+
.map((edge) => ({ from: edge.from, to: edge.to, mode: edge.mode, line: edge.line, ...(edge.reexport === true ? { reexport: true } : {}) }));
|
|
36
|
+
const groups = Object.entries(config.fileGroups ?? {}).map(([name, source]) => [name, new RegExp(source, 'u')]);
|
|
37
|
+
const structure = structureOf(config, files);
|
|
38
|
+
const report = checkFeatureModule({
|
|
39
|
+
...structure,
|
|
40
|
+
files, imports,
|
|
41
|
+
...(testFiles.length === 0 ? {} : { testFiles }),
|
|
42
|
+
...(config.testFeaturesRoot === undefined ? {} : { testFeaturesRoot: config.testFeaturesRoot }),
|
|
43
|
+
...(config.mappedFiles === undefined ? {} : { mappedFiles: config.mappedFiles }),
|
|
44
|
+
...(config.surfaces === undefined ? {} : { surfaces: config.surfaces }),
|
|
45
|
+
...(config.moduleComposition === undefined ? {} : { moduleComposition: config.moduleComposition }),
|
|
46
|
+
...(config.republications === undefined ? {} : { republications: config.republications }),
|
|
47
|
+
...(config.useEdges === undefined ? {} : { useEdges: config.useEdges }),
|
|
48
|
+
...(config.depthWarning === undefined ? {} : { depthWarning: config.depthWarning }),
|
|
49
|
+
...(groups.length === 0 ? {} : { fileGroups: Object.fromEntries(groups.map(([name, pattern]) => [name, (path) => pattern.test(path)])) }),
|
|
50
|
+
});
|
|
51
|
+
const unmappedTests = testFiles.filter((file) => isPortablePath(file) &&
|
|
52
|
+
!structure.featureRoots.some((root) => isWithin(file, root)) &&
|
|
53
|
+
!(config.testFeaturesRoot !== undefined && file.startsWith(`${config.testFeaturesRoot}/`)));
|
|
54
|
+
if (unmappedTests.length > 0 && !report.diagnostics.some(({ code }) => code === 'invalid-path')) {
|
|
55
|
+
throw new Error(`Test files require a feature root or testFeaturesRoot mapping: ${unmappedTests.join(', ')}.`);
|
|
56
|
+
}
|
|
57
|
+
const budgetWarnings = ports.checkBudgets({ measurements: measurementsOf(report.metrics), thresholds: config.budgets ?? [] });
|
|
58
|
+
return {
|
|
59
|
+
ok: report.ok && graph.parseFailures.length === 0 && graph.unresolved.length === 0 && graph.unresolvedRuntimeReferences.length === 0,
|
|
60
|
+
features: report.features, diagnostics: report.diagnostics, metrics: report.metrics,
|
|
61
|
+
parseFailures: graph.parseFailures, unresolved: graph.unresolved,
|
|
62
|
+
unresolvedRuntimeReferences: graph.unresolvedRuntimeReferences, budgetWarnings,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** One line per finding: `error code path:line message`, then unreadable files and budget warnings. */
|
|
66
|
+
export function formatNodeReport(report) {
|
|
67
|
+
const lines = [
|
|
68
|
+
...report.diagnostics.map(({ severity, code, path, line, message }) => `${severity} ${code} ${path === undefined ? '' : `${path}${line === undefined ? '' : `:${String(line)}`} `}${message}`),
|
|
69
|
+
...report.parseFailures.map((path) => `error unreadable-file ${path}`),
|
|
70
|
+
...report.unresolved.map(({ from, line, specifier }) => `error unresolved-reference ${from}:${String(line)} ${specifier}`),
|
|
71
|
+
...report.unresolvedRuntimeReferences.map(({ from, line, kind }) => `error unresolved-runtime-reference ${from}:${String(line)} ${kind}`),
|
|
72
|
+
...report.budgetWarnings.map(({ subject, metric, value, max }) => `warning budget ${subject}: ${metric} is ${String(value)}, budget ${String(max)}`),
|
|
73
|
+
];
|
|
74
|
+
return lines.length === 0 ? '' : `${lines.join('\n')}\n`;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=run-feature-module-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-feature-module-check.js","sourceRoot":"","sources":["../../../../src/features/node-runner/application/run-feature-module-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAM3G,yHAAyH;AACzH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AA4EtC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,KAAwB,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEhH,SAAS,WAAW,CAAC,MAAuB,EAAE,KAAwB;IACpE,MAAM,EA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AI,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1H,GAAG,MAAM,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,sCAAsC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACzI,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,kBAAkB,OAAO,KAAK,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;KACrJ,CAAC;IACF,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeCheckConfig, NodeReport } from '../application/run-feature-module-check.js';
|
|
2
|
+
/** Checks one production module on disk: the file graph of Engineering Foundation, the kernel and the growth budgets. */
|
|
3
|
+
export declare const checkFeatureModuleOnDisk: (config: NodeCheckConfig) => Promise<NodeReport>;
|
|
4
|
+
//# sourceMappingURL=check-feature-module-on-disk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-feature-module-on-disk.d.ts","sourceRoot":"","sources":["../../../../src/features/node-runner/composition/check-feature-module-on-disk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,4CAA4C,CAAC;AAa7G,yHAAyH;AACzH,eAAO,MAAM,wBAAwB,WAAY,eAAe,KAAG,OAAO,CAAC,UAAU,CACW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { checkBudgets } from '@agent-teams/engineering-foundation/ratchet';
|
|
2
|
+
import { observeSourceGraph } from '@agent-teams/engineering-foundation/source-graph';
|
|
3
|
+
import { runFeatureModuleCheck } from '../application/run-feature-module-check.js';
|
|
4
|
+
// The file graph of the given repository-relative roots, read with the parser and resolver of Engineering Foundation.
|
|
5
|
+
const observeFromDisk = (consumerRoot) => async (roots) => {
|
|
6
|
+
const { files, edges, parseFailures, unresolved, unresolvedRuntimeReferences } = await observeSourceGraph({ consumerRoot, roots });
|
|
7
|
+
return {
|
|
8
|
+
files, parseFailures, unresolved, unresolvedRuntimeReferences,
|
|
9
|
+
edges: edges.map(({ from, to, mode, line, kind }) => ({
|
|
10
|
+
from, to, mode, line, ...(kind === 'export' || kind === 'export-type' ? { reexport: true } : {}),
|
|
11
|
+
})),
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** Checks one production module on disk: the file graph of Engineering Foundation, the kernel and the growth budgets. */
|
|
15
|
+
export const checkFeatureModuleOnDisk = (config) => runFeatureModuleCheck(config, { observe: observeFromDisk(config.consumerRoot), checkBudgets });
|
|
16
|
+
//# sourceMappingURL=check-feature-module-on-disk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-feature-module-on-disk.js","sourceRoot":"","sources":["../../../../src/features/node-runner/composition/check-feature-module-on-disk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGnF,sHAAsH;AACtH,MAAM,eAAe,GAAG,CAAC,YAAoB,EAAE,EAAE,CAAC,KAAK,EAAE,KAAwB,EAA0B,EAAE;IAC3G,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,2BAA2B,EAAE,GAAG,MAAM,kBAAkB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IACnI,OAAO;QACL,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,2BAA2B;QAC7D,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1G,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC;AAEF,yHAAyH;AACzH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAuB,EAAuB,EAAE,CACvF,qBAAqB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { checkFeatureModuleOnDisk } from './features/node-runner/composition/check-feature-module-on-disk.js';
|
|
2
|
+
export { ERROR_CODES, WARNING_CODES, formatNodeReport } from './features/node-runner/application/run-feature-module-check.js';
|
|
3
|
+
export type { BudgetMeasurement, BudgetThreshold, BudgetWarning, DeclaredStructure, Diagnostic, DiagnosticCode, DirectoryStructure, FeatureMetric, FeatureNode, GraphEdge, GraphRuntimeReference, GraphUnresolved, LayerRole, NodeCheckConfig, NodeReport, ObservedGraph, Republication, RepublishedSurface, RoleRoot, Severity, SurfaceMap, UseEdge, } from './features/node-runner/application/run-feature-module-check.js';
|
|
4
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oEAAoE,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gEAAgE,CAAC;AAC9H,YAAY,EACV,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EACnI,WAAW,EAAE,SAAS,EAAE,qBAAqB,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAC5K,UAAU,EAAE,OAAO,GACpB,MAAM,gEAAgE,CAAC"}
|
package/dist/node.js
ADDED
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oEAAoE,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gEAAgE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "
|
|
2
|
+
"description": "Opt-in checks for the Feature Module Standard: a pure kernel, shared fixtures and a Node runner over the Foundation file graph.",
|
|
3
3
|
"devDependencies": {
|
|
4
|
+
"@agent-teams/engineering-foundation": "1.10.0",
|
|
4
5
|
"typescript": "7.0.2"
|
|
5
6
|
},
|
|
6
7
|
"engines": {
|
|
@@ -16,6 +17,10 @@
|
|
|
16
17
|
"types": "./dist/fixtures.d.ts",
|
|
17
18
|
"import": "./dist/fixtures.js"
|
|
18
19
|
},
|
|
20
|
+
"./node": {
|
|
21
|
+
"types": "./dist/node.d.ts",
|
|
22
|
+
"import": "./dist/node.js"
|
|
23
|
+
},
|
|
19
24
|
"./package.json": "./package.json"
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
@@ -26,6 +31,14 @@
|
|
|
26
31
|
],
|
|
27
32
|
"license": "Apache-2.0",
|
|
28
33
|
"name": "@agent-teams/feature-module-standard",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@agent-teams/engineering-foundation": "^1.10.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@agent-teams/engineering-foundation": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
29
42
|
"publishConfig": {
|
|
30
43
|
"access": "public",
|
|
31
44
|
"provenance": true,
|
|
@@ -36,10 +49,10 @@
|
|
|
36
49
|
"url": "git+https://github.com/agent-teams-ai/engineering-foundation.git",
|
|
37
50
|
"directory": "packages/feature-module-standard"
|
|
38
51
|
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "tsc --build tsconfig.json --pretty false"
|
|
41
|
-
},
|
|
42
52
|
"sideEffects": false,
|
|
43
53
|
"type": "module",
|
|
44
|
-
"version": "0.
|
|
54
|
+
"version": "0.1.1",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc --build tsconfig.json --pretty false"
|
|
57
|
+
}
|
|
45
58
|
}
|