forgeos 0.1.0-alpha.0 → 0.1.0-alpha.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/.npmignore +9 -1
- package/AGENTS.md +6 -1
- package/CHANGELOG.md +15 -0
- package/CONTRIBUTING.md +22 -1
- package/README.md +12 -1
- package/package.json +3 -1
- package/packages/eslint-plugin-forge/index.ts +15 -15
- package/packages/eslint-plugin-forge/package.json +10 -10
- package/packages/eslint-plugin-forge/src/check-source.ts +95 -95
- package/packages/eslint-plugin-forge/src/load-artifacts.ts +24 -24
- package/packages/eslint-plugin-forge/src/rule-no-forge-guard-violation.ts +93 -93
- package/src/forge/_generated/actionSubscriptions.json +2 -2
- package/src/forge/_generated/actionSubscriptions.ts +3 -3
- package/src/forge/_generated/agentAdapterManifest.json +2 -2
- package/src/forge/_generated/agentAdapterManifest.ts +3 -3
- package/src/forge/_generated/agentContract.json +2 -2
- package/src/forge/_generated/agentContract.ts +6786 -2
- package/src/forge/_generated/agentQuickstart.md +1 -1
- package/src/forge/_generated/aiContext.ts +1 -1
- package/src/forge/_generated/aiModels.json +1 -1
- package/src/forge/_generated/aiModels.ts +1 -1
- package/src/forge/_generated/aiProviders.json +1 -1
- package/src/forge/_generated/aiProviders.ts +1 -1
- package/src/forge/_generated/aiRegistry.json +2 -2
- package/src/forge/_generated/aiRegistry.ts +3 -3
- package/src/forge/_generated/api.json +2 -2
- package/src/forge/_generated/api.ts +1 -1
- package/src/forge/_generated/appGraph.json +2 -2
- package/src/forge/_generated/appGraph.ts +1112 -956
- package/src/forge/_generated/appMap.md +1 -1
- package/src/forge/_generated/artifactManifest.json +2 -2
- package/src/forge/_generated/artifactManifest.ts +2 -2
- package/src/forge/_generated/authClaims.json +1 -1
- package/src/forge/_generated/authClaims.ts +1 -1
- package/src/forge/_generated/authConfig.json +1 -1
- package/src/forge/_generated/authConfig.ts +1 -1
- package/src/forge/_generated/authContext.ts +1 -1
- package/src/forge/_generated/authRegistry.json +1 -1
- package/src/forge/_generated/authRegistry.ts +1 -1
- package/src/forge/_generated/buildInfo.json +2 -2
- package/src/forge/_generated/buildInfo.ts +4 -4
- package/src/forge/_generated/capabilityMap.json +2 -2
- package/src/forge/_generated/capabilityMap.md +1 -1
- package/src/forge/_generated/capabilityMap.ts +2 -2
- package/src/forge/_generated/client.ts +1 -1
- package/src/forge/_generated/clientApi.ts +1 -1
- package/src/forge/_generated/clientManifest.json +2 -2
- package/src/forge/_generated/clientManifest.ts +3 -3
- package/src/forge/_generated/clientTypes.ts +1 -1
- package/src/forge/_generated/configRegistry.json +1 -1
- package/src/forge/_generated/configRegistry.ts +1 -1
- package/src/forge/_generated/dataGraph.json +2 -2
- package/src/forge/_generated/dataGraph.ts +3 -3
- package/src/forge/_generated/db.json +1 -1
- package/src/forge/_generated/db.ts +1 -1
- package/src/forge/_generated/dbSecurityManifest.json +1 -1
- package/src/forge/_generated/dbSecurityManifest.ts +1 -1
- package/src/forge/_generated/dbSessionContext.json +1 -1
- package/src/forge/_generated/dbSessionContext.ts +1 -1
- package/src/forge/_generated/deployManifest.json +2 -2
- package/src/forge/_generated/deployManifest.ts +7 -7
- package/src/forge/_generated/devManifest.json +2 -2
- package/src/forge/_generated/devManifest.ts +3 -3
- package/src/forge/_generated/envSchema.json +1 -1
- package/src/forge/_generated/envSchema.ts +1 -1
- package/src/forge/_generated/frontendGraph.json +1 -1
- package/src/forge/_generated/frontendGraph.ts +1 -1
- package/src/forge/_generated/importGuards.json +2 -2
- package/src/forge/_generated/importGuards.ts +35 -1
- package/src/forge/_generated/index.ts +1 -1
- package/src/forge/_generated/liveProductionManifest.json +1 -1
- package/src/forge/_generated/liveProductionManifest.ts +1 -1
- package/src/forge/_generated/liveProtocol.json +1 -1
- package/src/forge/_generated/liveProtocol.ts +1 -1
- package/src/forge/_generated/liveQueryRegistry.json +2 -2
- package/src/forge/_generated/liveQueryRegistry.ts +3 -3
- package/src/forge/_generated/liveTransportConfig.json +1 -1
- package/src/forge/_generated/liveTransportConfig.ts +1 -1
- package/src/forge/_generated/makeRegistry.json +2 -2
- package/src/forge/_generated/makeRegistry.ts +2 -2
- package/src/forge/_generated/makeTemplates.json +1 -1
- package/src/forge/_generated/makeTemplates.ts +1 -1
- package/src/forge/_generated/mockMap.json +1 -1
- package/src/forge/_generated/mockMap.ts +1 -1
- package/src/forge/_generated/operationPlaybooks.md +7 -5
- package/src/forge/_generated/packageGraph.json +2 -2
- package/src/forge/_generated/packageGraph.ts +90964 -14284
- package/src/forge/_generated/packageUpgradeRegistry.json +2 -2
- package/src/forge/_generated/packageUpgradeRegistry.ts +2 -2
- package/src/forge/_generated/permissionMatrix.json +2 -2
- package/src/forge/_generated/permissionMatrix.ts +3 -3
- package/src/forge/_generated/policyRegistry.json +2 -2
- package/src/forge/_generated/policyRegistry.ts +3 -3
- package/src/forge/_generated/queryRegistry.json +2 -2
- package/src/forge/_generated/queryRegistry.ts +3 -3
- package/src/forge/_generated/react.d.ts +1 -1
- package/src/forge/_generated/react.ts +1 -1
- package/src/forge/_generated/reactManifest.json +2 -2
- package/src/forge/_generated/reactManifest.ts +3 -3
- package/src/forge/_generated/releaseManifest.json +2 -2
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/_generated/rlsPolicies.json +1 -1
- package/src/forge/_generated/rlsPolicies.sql +1 -1
- package/src/forge/_generated/rlsPolicies.ts +1 -1
- package/src/forge/_generated/runtimeGraph.json +2 -2
- package/src/forge/_generated/runtimeGraph.ts +3 -3
- package/src/forge/_generated/runtimeMatrix.json +2 -2
- package/src/forge/_generated/runtimeMatrix.ts +106177 -7917
- package/src/forge/_generated/runtimeRegistry.ts +1 -1
- package/src/forge/_generated/runtimeRules.md +1 -1
- package/src/forge/_generated/secretRegistry.json +1 -1
- package/src/forge/_generated/secretRegistry.ts +1 -1
- package/src/forge/_generated/secretsContext.ts +1 -1
- package/src/forge/_generated/serverApi.ts +1 -1
- package/src/forge/_generated/sourceMapManifest.json +2 -2
- package/src/forge/_generated/sourceMapManifest.ts +2 -2
- package/src/forge/_generated/sqlPlan.json +1 -1
- package/src/forge/_generated/sqlPlan.ts +1 -1
- package/src/forge/_generated/subscriptionManifest.json +2 -2
- package/src/forge/_generated/subscriptionManifest.ts +3 -3
- package/src/forge/_generated/symbolicationManifest.json +2 -2
- package/src/forge/_generated/symbolicationManifest.ts +2 -2
- package/src/forge/_generated/telemetryRegistry.json +2 -2
- package/src/forge/_generated/telemetryRegistry.ts +3 -3
- package/src/forge/_generated/telemetrySinks.json +2 -2
- package/src/forge/_generated/telemetrySinks.ts +2 -2
- package/src/forge/_generated/tenantScope.json +2 -2
- package/src/forge/_generated/tenantScope.ts +3 -3
- package/src/forge/_generated/testGraph.json +2 -2
- package/src/forge/_generated/testGraph.ts +75 -75
- package/src/forge/_generated/testPlanRegistry.json +2 -2
- package/src/forge/_generated/testPlanRegistry.ts +2 -2
- package/src/forge/_generated/uiRoutes.json +1 -1
- package/src/forge/_generated/uiRoutes.ts +1 -1
- package/src/forge/_generated/uiScenarios.json +1 -1
- package/src/forge/_generated/uiScenarios.ts +1 -1
- package/src/forge/_generated/uiTestManifest.json +2 -2
- package/src/forge/_generated/uiTestManifest.ts +2 -2
- package/src/forge/_generated/workflowRegistry.json +2 -2
- package/src/forge/_generated/workflowRegistry.ts +3 -3
- package/src/forge/_generated/workflowSubscriptions.json +2 -2
- package/src/forge/_generated/workflowSubscriptions.ts +3 -3
- package/src/forge/cli/commands.ts +861 -861
- package/src/forge/cli/deps.ts +178 -11
- package/src/forge/cli/index.ts +7 -7
- package/src/forge/cli/main.ts +54 -54
- package/src/forge/cli/output.ts +97 -97
- package/src/forge/cli/parse.ts +679 -673
- package/src/forge/cli/version.ts +1 -1
- package/src/forge/compiler/agent-contract/build.ts +28 -0
- package/src/forge/compiler/agent-contract/types.ts +16 -0
- package/src/forge/compiler/app-graph/build.ts +112 -112
- package/src/forge/compiler/app-graph/classify.ts +10 -10
- package/src/forge/compiler/app-graph/dup-symbol.ts +29 -29
- package/src/forge/compiler/app-graph/extract.ts +123 -123
- package/src/forge/compiler/app-graph/forge-apis.ts +29 -29
- package/src/forge/compiler/app-graph/index.ts +11 -11
- package/src/forge/compiler/app-graph/module-graph.ts +316 -316
- package/src/forge/compiler/app-graph/parser.ts +119 -119
- package/src/forge/compiler/app-graph/symbols.ts +48 -48
- package/src/forge/compiler/app-graph/tsconfig-hash.ts +62 -62
- package/src/forge/compiler/app-graph/types.ts +43 -43
- package/src/forge/compiler/app-graph/versions.ts +14 -14
- package/src/forge/compiler/cache/index.ts +17 -17
- package/src/forge/compiler/cache/key.ts +46 -46
- package/src/forge/compiler/cache/scheduler.ts +72 -72
- package/src/forge/compiler/cache/store.ts +78 -78
- package/src/forge/compiler/classifier/capabilities.ts +78 -78
- package/src/forge/compiler/classifier/classify.ts +113 -113
- package/src/forge/compiler/classifier/contexts.ts +188 -188
- package/src/forge/compiler/classifier/index.ts +18 -18
- package/src/forge/compiler/classifier/runtime-matrix.ts +45 -45
- package/src/forge/compiler/classifier/secrets.ts +41 -41
- package/src/forge/compiler/classifier/signals.ts +129 -129
- package/src/forge/compiler/diagnostics/codes.ts +125 -120
- package/src/forge/compiler/diagnostics/create.ts +87 -87
- package/src/forge/compiler/diagnostics/index.ts +41 -41
- package/src/forge/compiler/emitter/artifact-kind.ts +14 -14
- package/src/forge/compiler/emitter/barrel.ts +38 -38
- package/src/forge/compiler/emitter/constants.ts +7 -7
- package/src/forge/compiler/emitter/emit.ts +234 -237
- package/src/forge/compiler/emitter/index.ts +24 -24
- package/src/forge/compiler/emitter/lock.ts +61 -61
- package/src/forge/compiler/emitter/render.ts +73 -73
- package/src/forge/compiler/guards/artifacts.ts +96 -96
- package/src/forge/compiler/guards/check-import-guards.ts +106 -106
- package/src/forge/compiler/guards/index.ts +11 -11
- package/src/forge/compiler/guards/propagate-contexts.ts +57 -57
- package/src/forge/compiler/index.ts +17 -17
- package/src/forge/compiler/integration/add.ts +493 -493
- package/src/forge/compiler/integration/index.ts +17 -17
- package/src/forge/compiler/integration/plan.ts +279 -279
- package/src/forge/compiler/integration/render.ts +189 -189
- package/src/forge/compiler/integration/snapshot.ts +52 -52
- package/src/forge/compiler/orchestrator/discover.ts +214 -214
- package/src/forge/compiler/orchestrator/guards.ts +5 -5
- package/src/forge/compiler/orchestrator/index.ts +27 -27
- package/src/forge/compiler/orchestrator/manifest.ts +69 -69
- package/src/forge/compiler/orchestrator/orphans.ts +51 -51
- package/src/forge/compiler/orchestrator/plan.ts +804 -804
- package/src/forge/compiler/orchestrator/run.ts +178 -178
- package/src/forge/compiler/orchestrator/serialize.ts +859 -859
- package/src/forge/compiler/orchestrator/types.ts +23 -23
- package/src/forge/compiler/orchestrator/verify.ts +35 -35
- package/src/forge/compiler/package-graph/capabilities-stub.ts +33 -33
- package/src/forge/compiler/package-graph/checksum.ts +107 -97
- package/src/forge/compiler/package-graph/compiler.ts +444 -363
- package/src/forge/compiler/package-graph/constants.ts +4 -4
- package/src/forge/compiler/package-graph/exports-discovery.ts +91 -84
- package/src/forge/compiler/package-graph/extract-dts.ts +32 -32
- package/src/forge/compiler/package-graph/index.ts +24 -24
- package/src/forge/compiler/package-graph/jsdoc.ts +50 -50
- package/src/forge/compiler/package-graph/oracle.ts +326 -0
- package/src/forge/compiler/package-graph/read-file.ts +21 -21
- package/src/forge/compiler/package-graph/resolve.ts +131 -127
- package/src/forge/compiler/package-manager/adapter.ts +232 -232
- package/src/forge/compiler/package-manager/commands.ts +47 -47
- package/src/forge/compiler/package-manager/detect.ts +65 -65
- package/src/forge/compiler/package-manager/executor.ts +29 -29
- package/src/forge/compiler/package-manager/index.ts +22 -22
- package/src/forge/compiler/package-manager/parse-spec.ts +16 -16
- package/src/forge/compiler/package-manager/version.ts +20 -20
- package/src/forge/compiler/primitives/compare.ts +26 -26
- package/src/forge/compiler/primitives/hash.ts +42 -33
- package/src/forge/compiler/primitives/header.ts +43 -43
- package/src/forge/compiler/primitives/index.ts +45 -45
- package/src/forge/compiler/primitives/paths.ts +24 -24
- package/src/forge/compiler/primitives/serialize.ts +66 -66
- package/src/forge/compiler/primitives/sort.ts +87 -87
- package/src/forge/compiler/recipes/definitions.ts +269 -269
- package/src/forge/compiler/recipes/helpers.ts +37 -37
- package/src/forge/compiler/recipes/index.ts +21 -21
- package/src/forge/compiler/recipes/registry.ts +87 -87
- package/src/forge/compiler/sandbox/artifact-sanitize.ts +26 -26
- package/src/forge/compiler/sandbox/backends/child.ts +123 -123
- package/src/forge/compiler/sandbox/backends/docker.ts +173 -173
- package/src/forge/compiler/sandbox/index.ts +51 -51
- package/src/forge/compiler/sandbox/inspect.ts +143 -143
- package/src/forge/compiler/sandbox/inspector-entry.ts +115 -115
- package/src/forge/compiler/sandbox/limits.ts +31 -31
- package/src/forge/compiler/sandbox/scrub-env.ts +60 -60
- package/src/forge/compiler/sandbox/secret-scan.ts +54 -54
- package/src/forge/compiler/sandbox/serialize.ts +106 -106
- package/src/forge/compiler/sandbox/types.ts +7 -7
- package/src/forge/compiler/types/app-graph.ts +71 -71
- package/src/forge/compiler/types/capability.ts +29 -29
- package/src/forge/compiler/types/classification.ts +9 -9
- package/src/forge/compiler/types/cli.ts +85 -85
- package/src/forge/compiler/types/diagnostic.ts +2 -2
- package/src/forge/compiler/types/emit.ts +25 -25
- package/src/forge/compiler/types/import-guards.ts +19 -19
- package/src/forge/compiler/types/index.ts +98 -98
- package/src/forge/compiler/types/integration.ts +25 -25
- package/src/forge/compiler/types/json.ts +3 -3
- package/src/forge/compiler/types/lock.ts +37 -37
- package/src/forge/compiler/types/package-graph.ts +122 -77
- package/src/forge/compiler/types/runtime-matrix.ts +16 -16
- package/src/forge/compiler/types/runtime.ts +30 -30
- package/src/forge/compiler/types/sandbox.ts +24 -24
- package/src/forge/refactor/index.ts +10 -2
- package/src/forge/refactor/runtime-rename.ts +598 -0
- package/src/forge/version.ts +3 -0
package/.npmignore
CHANGED
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @forge-generated generator=0.0.
|
|
1
|
+
// @forge-generated generator=0.1.0-alpha.1 input=d50515ea2f22c012d06e8794c2031206c9478d732b15ce6592aa8bf74bdaa665 content=e0bf36433d915daf5ad06ac6265b3ac6f2cd1706269c69618bbbc1cb1f44e465
|
|
2
2
|
# AGENTS.md
|
|
3
3
|
|
|
4
4
|
<!-- forge-generated:start -->
|
|
@@ -69,6 +69,9 @@ forge inspect app --json
|
|
|
69
69
|
forge inspect all --json
|
|
70
70
|
forge inspect frontend --json
|
|
71
71
|
forge inspect capabilities --json
|
|
72
|
+
forge deps inspect <package> --json
|
|
73
|
+
forge deps api <package> <symbol> --json
|
|
74
|
+
forge deps trace <package> --json
|
|
72
75
|
forge auth check --json
|
|
73
76
|
forge inspect runtime-matrix --json
|
|
74
77
|
forge inspect policies --json
|
|
@@ -250,6 +253,8 @@ Use:
|
|
|
250
253
|
|
|
251
254
|
```bash
|
|
252
255
|
forge deps upgrade-plan <package> --to latest
|
|
256
|
+
forge deps inspect <package> --json
|
|
257
|
+
forge deps api <package> <symbol> --json
|
|
253
258
|
forge deps upgrade-apply <plan>
|
|
254
259
|
forge verify --strict
|
|
255
260
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
# forgeos
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.1
|
|
4
|
+
|
|
5
|
+
Republish alpha with the dependency/API oracle improvements:
|
|
6
|
+
|
|
7
|
+
- Added dependency API inspection commands for agents:
|
|
8
|
+
`forge deps api`, `forge deps trace`, and `forge deps runtime-compat`.
|
|
9
|
+
- Added dependency API summaries to `agentContract.json`.
|
|
10
|
+
- Added package resolution traces, runtime compatibility metadata, and
|
|
11
|
+
runtime/type mismatch diagnostics to `packageGraph`.
|
|
12
|
+
- Reduced package graph warning noise for `package.json` metadata exports,
|
|
13
|
+
declaration-file subpaths, and pattern exports.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.0
|
|
4
16
|
|
|
5
17
|
Initial alpha packaging baseline for ForgeOS.
|
|
6
18
|
|
|
7
19
|
This release line is intended to validate npm installation, the `forge` CLI binary,
|
|
8
20
|
template creation, generated contracts, and the agent-native local development loop.
|
|
21
|
+
|
|
22
|
+
Added ReadTheDocs-ready public documentation, generator/package version alignment
|
|
23
|
+
checks, and a broad generated-app field-test harness for release hardening.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -9,8 +9,29 @@ bun run typecheck
|
|
|
9
9
|
bun test --timeout 120000
|
|
10
10
|
node ./bin/forge.mjs verify --standard --script-timeout-ms 120000
|
|
11
11
|
npm run release:smoke
|
|
12
|
+
npm run field:test -- --dry-run --json
|
|
12
13
|
```
|
|
13
14
|
|
|
15
|
+
Run a real external-app smoke before release candidates:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run field:test -- --package-managers npm --templates minimal-web --forge-spec "file:." --install --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use the GitHub Actions `Field Tests` workflow for the broader OS, Node, package-manager matrix.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Public docs are built with MkDocs on ReadTheDocs. The configuration lives in:
|
|
26
|
+
|
|
27
|
+
```txt
|
|
28
|
+
.readthedocs.yaml
|
|
29
|
+
mkdocs.yml
|
|
30
|
+
docs/**
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Keep `docs/getting-started.md`, `docs/cli.md`, and `docs/field-testing.md` current when changing install, template, or verification behavior.
|
|
34
|
+
|
|
14
35
|
## Changesets
|
|
15
36
|
|
|
16
37
|
For changes that should be published, add a changeset:
|
|
@@ -36,7 +57,7 @@ Configure the npm package `forgeos` with:
|
|
|
36
57
|
| Environment | blank |
|
|
37
58
|
| Allowed action | `npm publish` |
|
|
38
59
|
|
|
39
|
-
Do not configure `NPM_TOKEN` for normal releases. The publish workflow uses GitHub OIDC with `id-token: write`, Node 24, npm 11+, and provenance.
|
|
60
|
+
Do not configure `NPM_TOKEN` for normal releases. The publish workflow uses GitHub OIDC with `id-token: write`, Node 24, npm 11+, and provenance. In npm package settings, prefer "Require two-factor authentication and disallow tokens"; Trusted Publishers continue to work with that stricter token setting.
|
|
40
61
|
|
|
41
62
|
## Manual Publish
|
|
42
63
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Agent-native application framework and compiler for building Forge apps without a mandatory dashboard. ForgeOS turns application source into deterministic runtime contracts, generated clients, safety checks, and machine-readable context that humans and AI coding agents can use safely.
|
|
4
4
|
|
|
5
|
-
**Status:** private MVP, implemented through H42. The core compiler, local runtime, frontend SDK, production auth, RLS compiler, repair/review loops, UI test bridge, guided intent router, full-stack capability map, clean templates, faster generated checks, showcase app, Windows-safe Bun resolution, native Windows diagnostics/setup, Node-compatible CLI/runtime paths, observable verify timeouts, multi-OS Node CI smoke, release packaging smoke, AST-aware codemods for `extract-action`, `rename field`, and `rename table`, and quieter template workspaces are present. Public release still
|
|
5
|
+
**Status:** private/public alpha MVP, implemented through H42. The core compiler, local runtime, frontend SDK, production auth, RLS compiler, repair/review loops, UI test bridge, guided intent router, full-stack capability map, clean templates, faster generated checks, showcase app, Windows-safe Bun resolution, native Windows diagnostics/setup, Node-compatible CLI/runtime paths, observable verify timeouts, multi-OS Node CI smoke, release packaging smoke, npm alpha publishing, Trusted Publisher/OIDC release wiring, ReadTheDocs-ready public docs, package/version-aligned generator metadata, AST-aware codemods for `extract-action`, `rename field`, and `rename table`, broader field-test automation, and quieter template workspaces are present. Public release hardening is still focused on deeper semantic codemods and more real-project field reports.
|
|
6
|
+
|
|
7
|
+
Public docs are configured for ReadTheDocs with `.readthedocs.yaml` and `mkdocs.yml`. The local docs entrypoint is `docs/index.md`.
|
|
6
8
|
|
|
7
9
|
## Agent-First Quickstart
|
|
8
10
|
|
|
@@ -62,6 +64,15 @@ forge new local-app --template minimal-web --package-manager npm --local-forge
|
|
|
62
64
|
|
|
63
65
|
`--forge-spec` writes that dependency spec into the generated app, while `--local-forge` keeps the monorepo/local package workflow. The npm package is published as `forgeos`, but generated apps keep the dependency key, CLI binary, and import surface as `forge` (`forge`, `forge/server`, `forge/react`) by using npm alias specs such as `"forge": "npm:forgeos@^0.1.0-alpha.0"`. CI uses both `--forge-spec "file:$GITHUB_WORKSPACE"` and a packed tarball smoke to prove freshly created apps can install ForgeOS and run outside the framework workspace.
|
|
64
66
|
|
|
67
|
+
For broader field testing:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run field:test -- --dry-run --json
|
|
71
|
+
npm run field:test -- --package-managers npm --templates minimal-web --forge-spec "file:." --install --json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The scheduled/manual `Field Tests` workflow expands that coverage across Linux, macOS, Windows, Node 22, Node 24, and npm/pnpm/yarn/bun.
|
|
75
|
+
|
|
65
76
|
## What ForgeOS Generates
|
|
66
77
|
|
|
67
78
|
```txt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forgeos",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"description": "Agent-native application framework and compiler for building Forge apps without a mandatory dashboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"release:pack": "npm pack --dry-run",
|
|
38
38
|
"release:smoke": "node scripts/smoke-packed-package.mjs",
|
|
39
39
|
"release:publish-local-alpha": "node scripts/publish-local-alpha.mjs",
|
|
40
|
+
"field:test": "node scripts/field-test-forgeos.mjs",
|
|
40
41
|
"forge": "node ./bin/forge.mjs",
|
|
41
42
|
"forge:node": "node ./bin/forge.mjs",
|
|
42
43
|
"forge:bun": "node ./bin/forge-bun.mjs src/forge/cli/main.ts",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"@changesets/changelog-github": "^0.7.0",
|
|
89
90
|
"@changesets/cli": "^2.31.0",
|
|
90
91
|
"@types/bun": "1.3.14",
|
|
92
|
+
"@types/node": "^24.0.0",
|
|
91
93
|
"@types/react": "^19.2.17",
|
|
92
94
|
"@types/react-test-renderer": "^19.1.0",
|
|
93
95
|
"fast-check": "^3.23.2",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
loadForgeGuardArtifacts,
|
|
3
|
-
type ForgeGuardArtifacts,
|
|
4
|
-
} from "./src/load-artifacts.ts";
|
|
5
|
-
export {
|
|
6
|
-
checkSourceForgeGuards,
|
|
7
|
-
type ForgeGuardSourceViolation,
|
|
8
|
-
} from "./src/check-source.ts";
|
|
9
|
-
export {
|
|
10
|
-
runForgeGuardRule,
|
|
11
|
-
forgeGuardRuleDefinition,
|
|
12
|
-
formatViolationMessage,
|
|
13
|
-
type ForgeEslintContext,
|
|
14
|
-
type ForgeEslintSettings,
|
|
15
|
-
} from "./src/rule-no-forge-guard-violation.ts";
|
|
1
|
+
export {
|
|
2
|
+
loadForgeGuardArtifacts,
|
|
3
|
+
type ForgeGuardArtifacts,
|
|
4
|
+
} from "./src/load-artifacts.ts";
|
|
5
|
+
export {
|
|
6
|
+
checkSourceForgeGuards,
|
|
7
|
+
type ForgeGuardSourceViolation,
|
|
8
|
+
} from "./src/check-source.ts";
|
|
9
|
+
export {
|
|
10
|
+
runForgeGuardRule,
|
|
11
|
+
forgeGuardRuleDefinition,
|
|
12
|
+
formatViolationMessage,
|
|
13
|
+
type ForgeEslintContext,
|
|
14
|
+
type ForgeEslintSettings,
|
|
15
|
+
} from "./src/rule-no-forge-guard-violation.ts";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint-plugin-forge",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./index.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./index.ts"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-forge",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.ts"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { lookupMatrixEntry } from "../../../src/forge/compiler/classifier/runtime-matrix.ts";
|
|
2
|
-
import type { ImportGuardsArtifact } from "../../../src/forge/compiler/types/import-guards.ts";
|
|
3
|
-
import type { RuntimeContext } from "../../../src/forge/compiler/types/runtime.ts";
|
|
4
|
-
import type { RuntimeMatrix } from "../../../src/forge/compiler/types/runtime-matrix.ts";
|
|
5
|
-
import { parsePackageSpecifier } from "../../../src/forge/compiler/app-graph/module-graph.ts";
|
|
6
|
-
|
|
7
|
-
export interface ForgeGuardSourceViolation {
|
|
8
|
-
packageName: string;
|
|
9
|
-
context: RuntimeContext;
|
|
10
|
-
rationale: string;
|
|
11
|
-
line: number;
|
|
12
|
-
column: number;
|
|
13
|
-
endColumn: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const IMPORT_PATTERN =
|
|
17
|
-
/(?:import\s+(?:type\s+)?(?:[\w*{}\s,]+from\s+)?|export\s+(?:type\s+)?(?:[\w*{}\s,]+from\s+)?)['"]([^'"]+)['"]|require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
18
|
-
|
|
19
|
-
function lineColumnAtOffset(
|
|
20
|
-
source: string,
|
|
21
|
-
offset: number,
|
|
22
|
-
): { line: number; column: number } {
|
|
23
|
-
const before = source.slice(0, offset);
|
|
24
|
-
const lines = before.split("\n");
|
|
25
|
-
return {
|
|
26
|
-
line: lines.length,
|
|
27
|
-
column: (lines.at(-1)?.length ?? 0) + 1,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function effectiveContextsForFile(
|
|
32
|
-
file: string,
|
|
33
|
-
guards: ImportGuardsArtifact,
|
|
34
|
-
): RuntimeContext[] {
|
|
35
|
-
const normalized = file.replace(/\\/g, "/");
|
|
36
|
-
const entry = guards.moduleContexts.find(
|
|
37
|
-
(module) =>
|
|
38
|
-
module.file === normalized ||
|
|
39
|
-
normalized.endsWith(`/${module.file}`) ||
|
|
40
|
-
module.file.endsWith(normalized),
|
|
41
|
-
);
|
|
42
|
-
return entry?.effectiveContexts ?? [];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function checkSourceForgeGuards(
|
|
46
|
-
filePath: string,
|
|
47
|
-
source: string,
|
|
48
|
-
importGuards: ImportGuardsArtifact,
|
|
49
|
-
runtimeMatrix: RuntimeMatrix,
|
|
50
|
-
): ForgeGuardSourceViolation[] {
|
|
51
|
-
const effectiveContexts = effectiveContextsForFile(filePath, importGuards);
|
|
52
|
-
if (effectiveContexts.length === 0) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const violations: ForgeGuardSourceViolation[] = [];
|
|
57
|
-
|
|
58
|
-
for (const match of source.matchAll(IMPORT_PATTERN)) {
|
|
59
|
-
const specifier = match[1] ?? match[2];
|
|
60
|
-
if (!specifier) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const parsed = parsePackageSpecifier(specifier);
|
|
65
|
-
if (!parsed) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const matrixEntry = lookupMatrixEntry(runtimeMatrix, parsed.packageName);
|
|
70
|
-
if (matrixEntry == null) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const offset = match.index ?? 0;
|
|
75
|
-
const start = lineColumnAtOffset(source, offset);
|
|
76
|
-
const endColumn = start.column + match[0].length;
|
|
77
|
-
|
|
78
|
-
for (const context of effectiveContexts) {
|
|
79
|
-
if (!matrixEntry.compatible.includes(context)) {
|
|
80
|
-
violations.push({
|
|
81
|
-
packageName: parsed.packageName,
|
|
82
|
-
context,
|
|
83
|
-
rationale:
|
|
84
|
-
matrixEntry.rationale[context] ??
|
|
85
|
-
"package is incompatible with this runtime context",
|
|
86
|
-
line: start.line,
|
|
87
|
-
column: start.column,
|
|
88
|
-
endColumn,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return violations;
|
|
95
|
-
}
|
|
1
|
+
import { lookupMatrixEntry } from "../../../src/forge/compiler/classifier/runtime-matrix.ts";
|
|
2
|
+
import type { ImportGuardsArtifact } from "../../../src/forge/compiler/types/import-guards.ts";
|
|
3
|
+
import type { RuntimeContext } from "../../../src/forge/compiler/types/runtime.ts";
|
|
4
|
+
import type { RuntimeMatrix } from "../../../src/forge/compiler/types/runtime-matrix.ts";
|
|
5
|
+
import { parsePackageSpecifier } from "../../../src/forge/compiler/app-graph/module-graph.ts";
|
|
6
|
+
|
|
7
|
+
export interface ForgeGuardSourceViolation {
|
|
8
|
+
packageName: string;
|
|
9
|
+
context: RuntimeContext;
|
|
10
|
+
rationale: string;
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
endColumn: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const IMPORT_PATTERN =
|
|
17
|
+
/(?:import\s+(?:type\s+)?(?:[\w*{}\s,]+from\s+)?|export\s+(?:type\s+)?(?:[\w*{}\s,]+from\s+)?)['"]([^'"]+)['"]|require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
18
|
+
|
|
19
|
+
function lineColumnAtOffset(
|
|
20
|
+
source: string,
|
|
21
|
+
offset: number,
|
|
22
|
+
): { line: number; column: number } {
|
|
23
|
+
const before = source.slice(0, offset);
|
|
24
|
+
const lines = before.split("\n");
|
|
25
|
+
return {
|
|
26
|
+
line: lines.length,
|
|
27
|
+
column: (lines.at(-1)?.length ?? 0) + 1,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function effectiveContextsForFile(
|
|
32
|
+
file: string,
|
|
33
|
+
guards: ImportGuardsArtifact,
|
|
34
|
+
): RuntimeContext[] {
|
|
35
|
+
const normalized = file.replace(/\\/g, "/");
|
|
36
|
+
const entry = guards.moduleContexts.find(
|
|
37
|
+
(module) =>
|
|
38
|
+
module.file === normalized ||
|
|
39
|
+
normalized.endsWith(`/${module.file}`) ||
|
|
40
|
+
module.file.endsWith(normalized),
|
|
41
|
+
);
|
|
42
|
+
return entry?.effectiveContexts ?? [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function checkSourceForgeGuards(
|
|
46
|
+
filePath: string,
|
|
47
|
+
source: string,
|
|
48
|
+
importGuards: ImportGuardsArtifact,
|
|
49
|
+
runtimeMatrix: RuntimeMatrix,
|
|
50
|
+
): ForgeGuardSourceViolation[] {
|
|
51
|
+
const effectiveContexts = effectiveContextsForFile(filePath, importGuards);
|
|
52
|
+
if (effectiveContexts.length === 0) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const violations: ForgeGuardSourceViolation[] = [];
|
|
57
|
+
|
|
58
|
+
for (const match of source.matchAll(IMPORT_PATTERN)) {
|
|
59
|
+
const specifier = match[1] ?? match[2];
|
|
60
|
+
if (!specifier) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const parsed = parsePackageSpecifier(specifier);
|
|
65
|
+
if (!parsed) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const matrixEntry = lookupMatrixEntry(runtimeMatrix, parsed.packageName);
|
|
70
|
+
if (matrixEntry == null) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const offset = match.index ?? 0;
|
|
75
|
+
const start = lineColumnAtOffset(source, offset);
|
|
76
|
+
const endColumn = start.column + match[0].length;
|
|
77
|
+
|
|
78
|
+
for (const context of effectiveContexts) {
|
|
79
|
+
if (!matrixEntry.compatible.includes(context)) {
|
|
80
|
+
violations.push({
|
|
81
|
+
packageName: parsed.packageName,
|
|
82
|
+
context,
|
|
83
|
+
rationale:
|
|
84
|
+
matrixEntry.rationale[context] ??
|
|
85
|
+
"package is incompatible with this runtime context",
|
|
86
|
+
line: start.line,
|
|
87
|
+
column: start.column,
|
|
88
|
+
endColumn,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return violations;
|
|
95
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { stripDeterministicHeader } from "../../../src/forge/compiler/primitives/header.ts";
|
|
3
|
-
import type { ImportGuardsArtifact } from "../../../src/forge/compiler/types/import-guards.ts";
|
|
4
|
-
import type { RuntimeMatrix } from "../../../src/forge/compiler/types/runtime-matrix.ts";
|
|
5
|
-
|
|
6
|
-
export interface ForgeGuardArtifacts {
|
|
7
|
-
importGuards: ImportGuardsArtifact;
|
|
8
|
-
runtimeMatrix: RuntimeMatrix;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function parseGeneratedJson<T>(path: string): T {
|
|
12
|
-
const raw = stripDeterministicHeader(readFileSync(path, "utf8"));
|
|
13
|
-
return JSON.parse(raw) as T;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function loadForgeGuardArtifacts(
|
|
17
|
-
importGuardsPath: string,
|
|
18
|
-
runtimeMatrixPath: string,
|
|
19
|
-
): ForgeGuardArtifacts {
|
|
20
|
-
const importGuards = parseGeneratedJson<ImportGuardsArtifact>(importGuardsPath);
|
|
21
|
-
const runtimeMatrix = parseGeneratedJson<RuntimeMatrix>(runtimeMatrixPath);
|
|
22
|
-
|
|
23
|
-
return { importGuards, runtimeMatrix };
|
|
24
|
-
}
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { stripDeterministicHeader } from "../../../src/forge/compiler/primitives/header.ts";
|
|
3
|
+
import type { ImportGuardsArtifact } from "../../../src/forge/compiler/types/import-guards.ts";
|
|
4
|
+
import type { RuntimeMatrix } from "../../../src/forge/compiler/types/runtime-matrix.ts";
|
|
5
|
+
|
|
6
|
+
export interface ForgeGuardArtifacts {
|
|
7
|
+
importGuards: ImportGuardsArtifact;
|
|
8
|
+
runtimeMatrix: RuntimeMatrix;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function parseGeneratedJson<T>(path: string): T {
|
|
12
|
+
const raw = stripDeterministicHeader(readFileSync(path, "utf8"));
|
|
13
|
+
return JSON.parse(raw) as T;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function loadForgeGuardArtifacts(
|
|
17
|
+
importGuardsPath: string,
|
|
18
|
+
runtimeMatrixPath: string,
|
|
19
|
+
): ForgeGuardArtifacts {
|
|
20
|
+
const importGuards = parseGeneratedJson<ImportGuardsArtifact>(importGuardsPath);
|
|
21
|
+
const runtimeMatrix = parseGeneratedJson<RuntimeMatrix>(runtimeMatrixPath);
|
|
22
|
+
|
|
23
|
+
return { importGuards, runtimeMatrix };
|
|
24
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import type { ForgeGuardArtifacts } from "./load-artifacts.ts";
|
|
2
|
-
import { loadForgeGuardArtifacts } from "./load-artifacts.ts";
|
|
3
|
-
import {
|
|
4
|
-
checkSourceForgeGuards,
|
|
5
|
-
type ForgeGuardSourceViolation,
|
|
6
|
-
} from "./check-source.ts";
|
|
7
|
-
|
|
8
|
-
export interface ForgeEslintSettings {
|
|
9
|
-
importGuardsPath?: string;
|
|
10
|
-
runtimeMatrixPath?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ForgeEslintContext {
|
|
14
|
-
filename: string;
|
|
15
|
-
sourceCode: string;
|
|
16
|
-
settings?: { forge?: ForgeEslintSettings };
|
|
17
|
-
report: (descriptor: {
|
|
18
|
-
message: string;
|
|
19
|
-
line: number;
|
|
20
|
-
column: number;
|
|
21
|
-
endColumn: number;
|
|
22
|
-
}) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let cachedArtifacts: ForgeGuardArtifacts | null = null;
|
|
26
|
-
let cachedKey = "";
|
|
27
|
-
|
|
28
|
-
function resolveArtifacts(context: ForgeEslintContext): ForgeGuardArtifacts | null {
|
|
29
|
-
const forgeSettings = context.settings?.forge;
|
|
30
|
-
const importGuardsPath = forgeSettings?.importGuardsPath;
|
|
31
|
-
const runtimeMatrixPath = forgeSettings?.runtimeMatrixPath;
|
|
32
|
-
|
|
33
|
-
if (!importGuardsPath || !runtimeMatrixPath) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const key = `${importGuardsPath}|${runtimeMatrixPath}`;
|
|
38
|
-
if (cachedArtifacts && cachedKey === key) {
|
|
39
|
-
return cachedArtifacts;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
cachedArtifacts = loadForgeGuardArtifacts(importGuardsPath, runtimeMatrixPath);
|
|
43
|
-
cachedKey = key;
|
|
44
|
-
return cachedArtifacts;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function runForgeGuardRule(context: ForgeEslintContext): void {
|
|
48
|
-
const artifacts = resolveArtifacts(context);
|
|
49
|
-
if (!artifacts) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const violations = checkSourceForgeGuards(
|
|
54
|
-
context.filename,
|
|
55
|
-
context.sourceCode,
|
|
56
|
-
artifacts.importGuards,
|
|
57
|
-
artifacts.runtimeMatrix,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
for (const violation of violations) {
|
|
61
|
-
context.report({
|
|
62
|
-
message: `'${violation.packageName}' is not allowed in '${violation.context}' context: ${violation.rationale}`,
|
|
63
|
-
line: violation.line,
|
|
64
|
-
column: violation.column,
|
|
65
|
-
endColumn: violation.endColumn,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function formatViolationMessage(violation: ForgeGuardSourceViolation): string {
|
|
71
|
-
return `'${violation.packageName}' is not allowed in '${violation.context}' context: ${violation.rationale}`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const forgeGuardRuleDefinition = {
|
|
75
|
-
meta: {
|
|
76
|
-
type: "problem" as const,
|
|
77
|
-
docs: {
|
|
78
|
-
description:
|
|
79
|
-
"Disallow package imports incompatible with Forge effective runtime contexts",
|
|
80
|
-
},
|
|
81
|
-
schema: [],
|
|
82
|
-
messages: {
|
|
83
|
-
violation: "{{message}}",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
create(context: ForgeEslintContext) {
|
|
87
|
-
return {
|
|
88
|
-
Program() {
|
|
89
|
-
runForgeGuardRule(context);
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
};
|
|
1
|
+
import type { ForgeGuardArtifacts } from "./load-artifacts.ts";
|
|
2
|
+
import { loadForgeGuardArtifacts } from "./load-artifacts.ts";
|
|
3
|
+
import {
|
|
4
|
+
checkSourceForgeGuards,
|
|
5
|
+
type ForgeGuardSourceViolation,
|
|
6
|
+
} from "./check-source.ts";
|
|
7
|
+
|
|
8
|
+
export interface ForgeEslintSettings {
|
|
9
|
+
importGuardsPath?: string;
|
|
10
|
+
runtimeMatrixPath?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ForgeEslintContext {
|
|
14
|
+
filename: string;
|
|
15
|
+
sourceCode: string;
|
|
16
|
+
settings?: { forge?: ForgeEslintSettings };
|
|
17
|
+
report: (descriptor: {
|
|
18
|
+
message: string;
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
endColumn: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let cachedArtifacts: ForgeGuardArtifacts | null = null;
|
|
26
|
+
let cachedKey = "";
|
|
27
|
+
|
|
28
|
+
function resolveArtifacts(context: ForgeEslintContext): ForgeGuardArtifacts | null {
|
|
29
|
+
const forgeSettings = context.settings?.forge;
|
|
30
|
+
const importGuardsPath = forgeSettings?.importGuardsPath;
|
|
31
|
+
const runtimeMatrixPath = forgeSettings?.runtimeMatrixPath;
|
|
32
|
+
|
|
33
|
+
if (!importGuardsPath || !runtimeMatrixPath) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const key = `${importGuardsPath}|${runtimeMatrixPath}`;
|
|
38
|
+
if (cachedArtifacts && cachedKey === key) {
|
|
39
|
+
return cachedArtifacts;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
cachedArtifacts = loadForgeGuardArtifacts(importGuardsPath, runtimeMatrixPath);
|
|
43
|
+
cachedKey = key;
|
|
44
|
+
return cachedArtifacts;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function runForgeGuardRule(context: ForgeEslintContext): void {
|
|
48
|
+
const artifacts = resolveArtifacts(context);
|
|
49
|
+
if (!artifacts) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const violations = checkSourceForgeGuards(
|
|
54
|
+
context.filename,
|
|
55
|
+
context.sourceCode,
|
|
56
|
+
artifacts.importGuards,
|
|
57
|
+
artifacts.runtimeMatrix,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
for (const violation of violations) {
|
|
61
|
+
context.report({
|
|
62
|
+
message: `'${violation.packageName}' is not allowed in '${violation.context}' context: ${violation.rationale}`,
|
|
63
|
+
line: violation.line,
|
|
64
|
+
column: violation.column,
|
|
65
|
+
endColumn: violation.endColumn,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function formatViolationMessage(violation: ForgeGuardSourceViolation): string {
|
|
71
|
+
return `'${violation.packageName}' is not allowed in '${violation.context}' context: ${violation.rationale}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const forgeGuardRuleDefinition = {
|
|
75
|
+
meta: {
|
|
76
|
+
type: "problem" as const,
|
|
77
|
+
docs: {
|
|
78
|
+
description:
|
|
79
|
+
"Disallow package imports incompatible with Forge effective runtime contexts",
|
|
80
|
+
},
|
|
81
|
+
schema: [],
|
|
82
|
+
messages: {
|
|
83
|
+
violation: "{{message}}",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
create(context: ForgeEslintContext) {
|
|
87
|
+
return {
|
|
88
|
+
Program() {
|
|
89
|
+
runForgeGuardRule(context);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @forge-generated generator=0.0.
|
|
2
|
-
{"analyzerVersion":"0.1.0","byEvent":{},"diagnostics":[],"generatorVersion":"0.0.
|
|
1
|
+
// @forge-generated generator=0.1.0-alpha.1 input=d50515ea2f22c012d06e8794c2031206c9478d732b15ce6592aa8bf74bdaa665 content=8f488b6c983f10308f100f4cf8180d2d1d35bc3c6f4cc1ef07e601718c7919df
|
|
2
|
+
{"analyzerVersion":"0.1.0","byEvent":{},"diagnostics":[],"generatorVersion":"0.1.0-alpha.1","inputHash":"a07f627a67301f9fec75b77a777eaa16189a423dea394ddca4a2a04e4f4df32a","schemaVersion":"0.1.0","subscriptions":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @forge-generated generator=0.0.
|
|
1
|
+
// @forge-generated generator=0.1.0-alpha.1 input=d50515ea2f22c012d06e8794c2031206c9478d732b15ce6592aa8bf74bdaa665 content=40b73d563f42e079c6094c5ee02cb6a9cfee3d83e73a7e8780303f9ceb6955f9
|
|
2
2
|
export const actionSubscriptions = {
|
|
3
3
|
"analyzerVersion": "0.1.0",
|
|
4
4
|
"byEvent": {},
|
|
5
5
|
"diagnostics": [],
|
|
6
|
-
"generatorVersion": "0.0.
|
|
7
|
-
"inputHash": "
|
|
6
|
+
"generatorVersion": "0.1.0-alpha.1",
|
|
7
|
+
"inputHash": "a07f627a67301f9fec75b77a777eaa16189a423dea394ddca4a2a04e4f4df32a",
|
|
8
8
|
"schemaVersion": "0.1.0",
|
|
9
9
|
"subscriptions": []
|
|
10
10
|
} as const;
|