@intentic/state-resolver 1.309.0 → 1.311.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.
Files changed (2) hide show
  1. package/README.md +24 -19
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,27 +1,32 @@
1
- # @intentic/state-resolver
1
+ # state-resolver
2
2
 
3
- The **state resolver**: turns an `IntentSet` into the desired state, a `DesiredStateGraph`. It assigns each need its catalog option and compiles the emitted nodes into one graph. Depends on [`@intentic/graph`](../graph), [`@intentic/need-resolver`](../need-resolver) (needs), and [`@intentic/resources`](../resources) (the vocabulary it emits); consumed by [`@intentic/sdk`](../sdk).
3
+ Turns an intent into the desired-state graph: it derives the needs, fills each from a catalog of concrete tools, and emits every resource node the deployment requires.
4
4
 
5
- ## Responsibilities
5
+ ```mermaid
6
+ flowchart LR
7
+ intent["IntentSet"] --> needs["need-resolver<br/>resolveNeeds"]
8
+ needs --> state(["state-resolver<br/>resolveState"])
9
+ catalog["catalogFor<br/>Forgejo · GitHub · GitLab stack"] --> state
10
+ state -- "emit → ResolvedNode[]" --> compile["graph<br/>compile"]
11
+ compile --> artifact["DesiredStateGraph"]
12
+ ```
6
13
 
7
- - Resolve needs to concrete catalog options (Forgejo for git+registry, Komodo for control, Cloudflare for domain, GitHub/GHCR as the alternative stack).
8
- - Emit the `ResolvedNode`s for each assignment and `compile` them into a single dependency-ordered graph (`resolveState`).
9
- - Derive the control-plane platform and the application-plane support stack (repos, CI, deployments, tunnel, routes, workspace sandbox).
10
- - It does **not** talk to infra or reconcile: it only produces the serializable artifact.
14
+ - The catalog follows the intent: `i.have.github` selects the GitHub stack, `i.have.gitlab` the GitLab stack, otherwise self-hosted Forgejo. In all three, Komodo deploys and a Cloudflare tunnel exposes the apps.
15
+ - Each need must map to exactly one catalog option. Zero or several options throw; the resolver makes no choices.
16
+ - `src/resolvers` holds one resolver per concern: the control plane, apps, routes, backings with per-app bindings, catalog services, agent workspaces, users and teams, and scheduled backups.
17
+ - Every derived id and platform domain comes from `src/lib/ids.ts`. The SDK imports the same functions, so a handle's ids match the graph's.
18
+ - It is pure. The Cloudflare `zone` arrives as an argument; the CLI discovers it before calling.
11
19
 
12
20
  ## Key files
13
21
 
14
- - [src/state.ts](src/state.ts), `resolveState`: intent → `DesiredStateGraph`.
15
- - [src/lib/catalog.ts](src/lib/catalog.ts): `defaultCatalog`, `Catalog`/`Option` (what satisfies each capability).
16
- - [src/emit/emit.ts](src/emit/emit.ts): `emit` + `Assignment` (build the nodes for one assignment).
17
- - [src/resolvers](src/resolvers), per-area node derivation: `platform.ts`, `app.ts`, `route.ts`, `workspace.ts` (control plane, app plane, DNS routes, dev workspace sandbox).
18
- - [src/lib/ids.ts](src/lib/ids.ts) / [src/resolvers/identity.ts](src/resolvers/identity.ts): id helpers, `adminUsername`.
22
+ - [src/state.ts](src/state.ts) — `resolveState`: needs, catalog assignment, emit, compile.
23
+ - [src/emit/emit.ts](src/emit/emit.ts) — builds the nodes for one assignment, host by host.
24
+ - [src/lib/catalog.ts](src/lib/catalog.ts) — the three stacks and which capabilities each option provides.
25
+ - [src/lib/ids.ts](src/lib/ids.ts) — every derived resource id and platform domain.
26
+ - [src/resolvers/app.ts](src/resolvers/app.ts) — what one app becomes: repo, CI per environment, deployment, route.
19
27
 
20
- ## How it fits
28
+ ## Commands
21
29
 
22
- Stage 2 of the pipeline: `need-resolver` produces `Need`s, this maps each to an `Option` and emits `@intentic/resources` nodes, then `graph.compile` orders them. The `sdk`'s `defineStack` runs this end-to-end; `cli resolve` writes the result to `desired-state.json`.
23
-
24
- ## Conventions & gotchas
25
-
26
- - Adding a resource kind means emitting it here **and** registering its type/outputs in `resources` and a provider in `providers`.
27
- - Emitter changes are snapshot-tested ([src/emit/emit.test.ts](src/emit/emit.test.ts), [src/state.test.ts](src/state.test.ts)): update fixtures deliberately. See [ARCHITECTURE.md](../../ARCHITECTURE.md).
30
+ ```sh
31
+ pnpm --filter @intentic/state-resolver test
32
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/state-resolver",
3
- "version": "1.309.0",
3
+ "version": "1.311.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,10 +30,10 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@intentic/constants": "1.309.0",
34
- "@intentic/graph": "1.309.0",
35
- "@intentic/need-resolver": "1.309.0",
36
- "@intentic/resources": "1.309.0",
33
+ "@intentic/constants": "1.311.0",
34
+ "@intentic/graph": "1.311.0",
35
+ "@intentic/need-resolver": "1.311.0",
36
+ "@intentic/resources": "1.311.0",
37
37
  "tslib": "2.8.1"
38
38
  },
39
39
  "devDependencies": {