@adobe/data-ai 0.10.32 → 0.10.33
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/.claude/rules/README.md +2 -2
- package/.claude/rules/data-modelling.md +1 -1
- package/.claude/rules/ecs.md +1 -1
- package/.claude/rules/features/data/values.md +2 -2
- package/.claude/rules/features/services/index.md +1 -1
- package/.claude/rules/features/services/main-service/core-database.md +2 -2
- package/.claude/rules/features/services/main-service/index.md +2 -2
- package/.claude/rules/global/{namespace.md → typespace.md} +18 -12
- package/.claude/rules/plugin-modelling.md +1 -1
- package/.claude/rules/service.md +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +3 -3
- package/skills/build-data/SKILL.md +2 -2
- package/skills/build-services/SKILL.md +1 -1
- package/skills/review/SKILL.md +1 -1
package/.claude/rules/README.md
CHANGED
|
@@ -13,13 +13,13 @@ holds just enough to understand that folder; each child gets its own file:
|
|
|
13
13
|
|
|
14
14
|
```
|
|
15
15
|
global/ # always-on conventions — deliberately repo-wide globs
|
|
16
|
-
|
|
16
|
+
typespace.md cohesion.md type-casts.md function-references.md react.md
|
|
17
17
|
features/
|
|
18
18
|
index.md # the layering as a whole: data → services → spec | ecs → ui → app
|
|
19
19
|
data/
|
|
20
20
|
index.md # pure Data declarations
|
|
21
21
|
values.md components.md resources.md entities.md
|
|
22
|
-
services/index.md # service
|
|
22
|
+
services/index.md # service TypeSpaces: interface, create, createFake
|
|
23
23
|
spec/index.md # the State spec: actions, derivations, cases (test tier)
|
|
24
24
|
ecs/
|
|
25
25
|
index.md # the layered database plugins + MainService
|
|
@@ -19,7 +19,7 @@ discriminated unions.
|
|
|
19
19
|
// types/http-method/http-method.ts — the hand-authored type owns the member identity
|
|
20
20
|
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
21
21
|
// (a schema.ts, if/when a runtime boundary needs one, is written to match this
|
|
22
|
-
// type and pinned to it — see global/
|
|
22
|
+
// type and pinned to it — see global/typespace.md and features/data/index.md)
|
|
23
23
|
|
|
24
24
|
// In an unrelated request-counter plugin:
|
|
25
25
|
|
package/.claude/rules/ecs.md
CHANGED
|
@@ -100,7 +100,7 @@ const particleDataPlugin = Database.Plugin.create({
|
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
- **Components**: per-entity data. Use schema imports (`Vec3`, `Vec4`, `F32` from `@adobe/data/math`) or
|
|
103
|
+
- **Components**: per-entity data. Use schema imports (`Vec3`, `Vec4`, `F32` from `@adobe/data/math`) or TypeSpaces for custom shapes.
|
|
104
104
|
- **Resources**: global state. Every resource carries a `default` (`{ ...Boolean.schema }`, or `{ default: 'dark' as ThemeColor }` to widen a literal).
|
|
105
105
|
- **Archetypes**: one per entity kind. List all components that kind requires.
|
|
106
106
|
|
|
@@ -5,7 +5,7 @@ paths:
|
|
|
5
5
|
|
|
6
6
|
# data/values/ — Data types and pure helpers
|
|
7
7
|
|
|
8
|
-
Each Data type is its own
|
|
8
|
+
Each Data type is its own TypeSpace folder (`global/typespace.md`): its hand-written
|
|
9
9
|
type, its schema pinned to it, and its pure synchronous helpers.
|
|
10
10
|
|
|
11
11
|
```
|
|
@@ -30,7 +30,7 @@ data/values/player-mark/
|
|
|
30
30
|
the wire. A type used only by the spec may have none.
|
|
31
31
|
- **Helpers are synchronous and pure**, each with a sibling `*.test.ts`. They are the
|
|
32
32
|
home for logic the spec and the ECS share.
|
|
33
|
-
- **A helper-only
|
|
33
|
+
- **A helper-only TypeSpace** (`motion`, `collision`) with no type of its own also
|
|
34
34
|
lives here.
|
|
35
35
|
- Objects of only 32-bit numeric values or sub-structs use
|
|
36
36
|
`Schema.fromStructProperties` (linear-memory storage).
|
|
@@ -8,7 +8,7 @@ paths:
|
|
|
8
8
|
> **Legacy feature** (has `data/state/` or `services/main-service/`)? Follow `services/main-service/` instead.
|
|
9
9
|
|
|
10
10
|
A service is the boundary between the feature and the outside world (generation,
|
|
11
|
-
analytics, networking). Each is a
|
|
11
|
+
analytics, networking). Each is a TypeSpace folder (`global/typespace.md`) holding its
|
|
12
12
|
interface, its implementation and a fake. Services depend only on `data/`.
|
|
13
13
|
|
|
14
14
|
```
|
|
@@ -9,8 +9,8 @@ paths:
|
|
|
9
9
|
|
|
10
10
|
A thin assembler: `Database.Plugin.create({ components?, resources?, archetypes? })`
|
|
11
11
|
over the facet files, exposed through the `CoreDatabase` namespace. This is the
|
|
12
|
-
single-file
|
|
13
|
-
see `global/
|
|
12
|
+
single-file TypeSpace form (one value export — `plugin` — everything else a type;
|
|
13
|
+
see `global/typespace.md`).
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Database, type Store } from "@adobe/data/ecs";
|
|
@@ -96,7 +96,7 @@ drift-guard (see `archetypes.md`).
|
|
|
96
96
|
## Layered composition (behaviour)
|
|
97
97
|
|
|
98
98
|
Above the schema, behaviour is a chain of `Database.Plugin`s, each its own
|
|
99
|
-
**
|
|
99
|
+
**TypeSpace folder** — `<layer>-database/` holding the eponymous
|
|
100
100
|
`<layer>-database.ts` (the plugin, which `extends` the previous layer) plus the
|
|
101
101
|
facet folder it adds. **Name each layer for the facet it adds — never for the
|
|
102
102
|
feature or app.** A feature creates only the layers it uses:
|
|
@@ -128,7 +128,7 @@ export namespace IndexDatabase {
|
|
|
128
128
|
computed / action / system). Consumers — `ui/`, the app entry, `services/main-service/conformance/`
|
|
129
129
|
— need the *whole* feature database but must not name that layer, or adding or
|
|
130
130
|
dropping a layer rewrites them all. Alias it once from the **folder-eponymous
|
|
131
|
-
`main-service.ts`** (per `global/
|
|
131
|
+
`main-service.ts`** (per `global/typespace.md`, a folder's primary export lives in
|
|
132
132
|
its same-named file), as a namespace so consumers reach `MainService.plugin` /
|
|
133
133
|
`MainService.Store`:
|
|
134
134
|
|
|
@@ -3,9 +3,13 @@ paths:
|
|
|
3
3
|
- '**/*.ts'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# TypeSpace pattern
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**TypeSpace** = a type plus its functions, schema and constants, exposed under one name. The type and the namespace-like value share
|
|
9
|
+
the name (`Point` is the type, `Point.add` is a function), implemented with `export * as <Name> from './public.js'`. It is **not** a
|
|
10
|
+
TypeScript `namespace` declaration, and not a generic grouping of code.
|
|
11
|
+
|
|
12
|
+
Single import surface per type: `<type-name>/<type-name>.ts`. Schema in `-schema.ts`, TypeSpace re-export from `public.js`. Types live in
|
|
9
13
|
the `types/` layer. **In a feature**, Data types live in `features/<name>/data/values/<type>/` with the schema in `schema.ts`
|
|
10
14
|
(`features/data/values.md`).
|
|
11
15
|
|
|
@@ -37,18 +41,18 @@ patterns (e.g., inline `export namespace` in shared files) that do not conform
|
|
|
37
41
|
`schema.ts` inside the folder), named `schema` (not `<type-name>Schema`), and is **written to match the hand-authored type and pinned
|
|
38
42
|
to it** with `Assert<Equal<Schema.ToType<typeof schema>, <TypeName>>>` — never the other way around. `Schema.ToType` appears only in
|
|
39
43
|
that assertion, never as the exported type.
|
|
40
|
-
- Export
|
|
44
|
+
- Export the TypeSpace: `export * as <type-name> from "./public.js"`
|
|
41
45
|
- In public.ts, re-export every public constant file
|
|
42
46
|
- Filenames map deterministically to single export:
|
|
43
47
|
- `foo.ts` → `export type Foo = ...`
|
|
44
48
|
- `do-bar.ts` → `export function doBar() { }`
|
|
45
49
|
- DO NOT append other suffixes like `-type` etc.
|
|
46
|
-
- Function files: name by purpose only (e.g., `add.ts`, `sub.ts`). **Do not prefix** with the type name — the folder provides the
|
|
50
|
+
- Function files: name by purpose only (e.g., `add.ts`, `sub.ts`). **Do not prefix** with the type name — the folder provides the TypeSpace
|
|
47
51
|
context.
|
|
48
52
|
|
|
49
53
|
## Constants file
|
|
50
54
|
|
|
51
|
-
Constants are the **one exception** to one-declaration-per-file. A
|
|
55
|
+
Constants are the **one exception** to one-declaration-per-file. A TypeSpace folder MAY have a single `constants.ts` exporting several
|
|
52
56
|
plain `const` literals (no functions, no types), re-exported through `public.ts` so callers reach them as `<TypeName>.<constant>`:
|
|
53
57
|
|
|
54
58
|
```ts
|
|
@@ -68,17 +72,19 @@ literal, it is a function and does not belong in `constants.ts`.
|
|
|
68
72
|
|
|
69
73
|
## Anti-patterns (do not copy)
|
|
70
74
|
|
|
71
|
-
- **`export namespace <TypeName> { ... }
|
|
75
|
+
- **`export namespace <TypeName> { ... }` containing values** — Use `export * as <TypeName> from "./public.js"` instead; the standard pattern keeps
|
|
76
|
+
every member tree-shakeable and an inline namespace does not. An inline namespace that contains **only types** is allowed (it has no runtime
|
|
77
|
+
existence).
|
|
72
78
|
- **Prefixing function files with the type name** (e.g., `vec2-add.ts`) — Use `add.ts`; the folder provides context.
|
|
73
79
|
- **Importing from `public.js` or `-schema.js`** outside the type folder — Consumers must import only from `<type-name>/<type-name>.ts`.
|
|
74
|
-
- **A generic `functions/` folder for helpers** — a helper lives on the
|
|
80
|
+
- **A generic `functions/` folder for helpers** — a helper lives on the TypeSpace of the type it most closely relates to (or, for a single caller, as a private declaration in that caller); never a typeless `functions/` bucket.
|
|
75
81
|
|
|
76
82
|
## Consumers
|
|
77
83
|
|
|
78
84
|
**Never:**
|
|
79
85
|
|
|
80
|
-
- Import from `public.js` outside the
|
|
81
|
-
- Import from `<type-name>-schema.js` outside the
|
|
86
|
+
- Import from `public.js` outside the TypeSpace folder
|
|
87
|
+
- Import from `<type-name>-schema.js` outside the TypeSpace folder
|
|
82
88
|
|
|
83
89
|
**Do:**
|
|
84
90
|
|
|
@@ -117,7 +123,7 @@ export const length = ({ x, y }: Point) => Math.hypot(x, y);
|
|
|
117
123
|
export const add = ({ x: x1, y: y1 }: Point, { x: x2, y: y2 }: Point): Point => ({ x: x1 + x2, y: y1 + y2 });
|
|
118
124
|
```
|
|
119
125
|
|
|
120
|
-
After applying the
|
|
126
|
+
After applying the TypeSpace pattern:
|
|
121
127
|
|
|
122
128
|
```ts
|
|
123
129
|
// src/types/point/point.ts
|
|
@@ -140,14 +146,14 @@ export const add = ({ x: x1, y: y1 }: Point, { x: x2, y: y2 }: Point): Point =>
|
|
|
140
146
|
1. **Follow this rule** — Do not copy patterns from existing code; apply this standard.
|
|
141
147
|
2. Identify constants in the current file.
|
|
142
148
|
3. Extract them into the standard pattern.
|
|
143
|
-
4. Identify all consumers of public
|
|
149
|
+
4. Identify all consumers of public TypeSpaces.
|
|
144
150
|
5. Check each consumer: ensure imports use `<type-name>.ts` only, never public.js or -schema.js.
|
|
145
151
|
6. Ensure unit tests exist per function file, splitting as needed.
|
|
146
152
|
|
|
147
153
|
## Single file pattern
|
|
148
154
|
|
|
149
155
|
This pattern is ONLY allowed if there is only a single value export and every other export is just a type.
|
|
150
|
-
As soon as there is more than one value type it MUST be promoted to the full
|
|
156
|
+
As soon as there is more than one value type it MUST be promoted to the full TypeSpace pattern.
|
|
151
157
|
|
|
152
158
|
Example — a type merged with one value export and any number of type-only members:
|
|
153
159
|
|
|
@@ -40,7 +40,7 @@ codebase grep, and "find all plugins" tooling match `**/*-plugin.ts`
|
|
|
40
40
|
without inspecting contents.
|
|
41
41
|
|
|
42
42
|
The exported constant's name depends on whether the folder also hosts a
|
|
43
|
-
|
|
43
|
+
TypeSpace:
|
|
44
44
|
|
|
45
45
|
- **Pure-plugin folder** (no owned type) → export the concept name
|
|
46
46
|
itself, lowercase. `node-plugin.ts` exports `node`. Import sites read
|
package/.claude/rules/service.md
CHANGED
|
@@ -8,7 +8,7 @@ paths:
|
|
|
8
8
|
|
|
9
9
|
> Inside a feature, `features/services/index.md` covers the service layer; database-bound factories in `ecs/services/` follow `features/ecs/services.md`.
|
|
10
10
|
|
|
11
|
-
Asynchronous data services. Live in the `services/` layer. Adhere to the
|
|
11
|
+
Asynchronous data services. Live in the `services/` layer. Adhere to the TypeSpace rule for type and function organization.
|
|
12
12
|
|
|
13
13
|
**Data** = readonly JSON values, `ReadonlySet`, `ReadonlyMap`, or Blobs.
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/data-ai",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.33",
|
|
4
4
|
"description": "Cross-agent architecture skills for @adobe/data — installable as a Claude Code plugin or copied into any Agent-Skills-compatible agent (Cursor, Codex).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"skills"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@adobe/data": "0.10.
|
|
32
|
+
"@adobe/data": "0.10.33"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^5.8.3",
|
|
36
36
|
"vitest": "^5.0.5",
|
|
37
37
|
"yaml": "^2.9.1",
|
|
38
|
-
"@adobe/data": "0.10.
|
|
38
|
+
"@adobe/data": "0.10.33"
|
|
39
39
|
},
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"scripts": {
|
|
@@ -10,7 +10,7 @@ Legacy feature (has `data/state/` or `services/main-service/`)? Extend it in pla
|
|
|
10
10
|
Create the feature's `data/` layer: pure Data declarations, depending only on
|
|
11
11
|
`@adobe/data` and the `data/` of features this one builds on.
|
|
12
12
|
|
|
13
|
-
- `values/<type>/` — one
|
|
13
|
+
- `values/<type>/` — one TypeSpace per Data type: a hand-written type, a schema pinned
|
|
14
14
|
to it (`type _Pin = Assert<Equal<Schema.ToType<typeof schema>, <Type>>>`) when
|
|
15
15
|
something needs one, and pure helpers, each with a test.
|
|
16
16
|
- `components/<name>.ts` — one schema per file, scope spread from `Scope`, plus an
|
|
@@ -22,4 +22,4 @@ Create the feature's `data/` layer: pure Data declarations, depending only on
|
|
|
22
22
|
Create only the folders the feature needs. Gate: it compiles and the helper tests
|
|
23
23
|
pass.
|
|
24
24
|
|
|
25
|
-
The how is in the auto-loading `features/data/` rules and `global/
|
|
25
|
+
The how is in the auto-loading `features/data/` rules and `global/typespace.md`.
|
|
@@ -9,7 +9,7 @@ Legacy feature (has `data/state/` or `services/main-service/`)? Extend it in pla
|
|
|
9
9
|
|
|
10
10
|
Skip if the feature talks to nothing outside itself.
|
|
11
11
|
|
|
12
|
-
Create one `services/<name>-service/`
|
|
12
|
+
Create one `services/<name>-service/` TypeSpace per service: the interface (an async
|
|
13
13
|
data service, validated with `AsyncDataService.IsValid`), `create` (the
|
|
14
14
|
implementation, or a factory that throws when the app must inject it),
|
|
15
15
|
`createFake`, and `public.ts`. Add `services/services.ts` with the `Services` map when
|
package/skills/review/SKILL.md
CHANGED
|
@@ -9,7 +9,7 @@ output: a review — OPTIMAL, or a list of issues each tagged code | skill | rul
|
|
|
9
9
|
Check a legacy feature (has `data/state/` or `services/main-service/`) against the legacy rules; don't flag the layout itself.
|
|
10
10
|
|
|
11
11
|
Read the files under the given path and assess them against the relevant `features/`
|
|
12
|
-
rules (each layer's rule and the cross-cutting rules — `
|
|
12
|
+
rules (each layer's rule and the cross-cutting rules — `typespace`, `data-modelling`,
|
|
13
13
|
`type-casts`, `cohesion`, …):
|
|
14
14
|
|
|
15
15
|
- **Correctness** — does it typecheck and follow the layer's required shape?
|