@craft-ts/mcp 0.8.7 → 0.8.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craft-ts/mcp",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "MCP server, Agent Skills, and LLM files for coding agents using @craft-ts/core",
5
5
  "author": "Romain Geffrault",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "test": "vitest run --config vitest.config.mts"
36
36
  },
37
37
  "dependencies": {
38
- "@craft-ts/dev-tools": "^0.8.7",
38
+ "@craft-ts/dev-tools": "^0.8.8",
39
39
  "@modelcontextprotocol/sdk": "1.26.0",
40
40
  "zod": "4.3.6"
41
41
  },
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: translate-spec-to-craft-ts
3
- description: Translate functional specifications, user stories, page requirements, CRUD flows, list/detail screens, filters, pagination, bulk actions, optimistic updates, forms, and Angular feature-store architecture into @craft-ts/core primitives, insertions, store utilities, and source helpers. Use when a request asks which craft-ts utility to choose, or when wording such as "afficher", "liste", "detail", "supprimer", "selection multiple", "pagination", "filtre URL", "formulaire", "recharger en cas d'erreur", or "feature store" must be mapped to `query`, `mutation`, `state`, `queryParams`, `craft*`, form helpers, or entity helpers.
3
+ description: Translate functional specifications, user stories, page requirements, CRUD flows, list/detail screens, filters, pagination, bulk actions, optimistic updates, forms, and Angular feature architecture into @craft-ts/core primitives, insertions, services, and source helpers. Use when a request asks which craft-ts utility to choose, or when wording such as "afficher", "liste", "detail", "supprimer", "selection multiple", "pagination", "filtre URL", "formulaire", "recharger en cas d'erreur", or "feature" must be mapped to `query`, `mutation`, `state`, `queryParams`, `craftService`, form helpers, or entity helpers.
4
4
  ---
5
5
 
6
6
  # Translate Spec To Ng Craft
@@ -33,12 +33,12 @@ the published docs (MCP `search_documentation`, or https://ng-angular-stack.gith
33
33
  - Match generic asynchronous client tasks to `asyncProcess`.
34
34
  - Match local UI-only state to `state`.
35
35
  - Match URL-backed state to `queryParams`.
36
- - Match reusable, page-level, or global store requirements to `craft` plus `craft*` helpers.
36
+ - Match reusable, page-level, or global feature requirements to `craftService` plus the primitives it owns.
37
37
  - Match event buses, resets, refreshes, and hidden triggers to `source$` and `on$`.
38
38
  - Match list collection semantics to `insertEntities` and the entity helpers when the spec explicitly talks about add, remove, update, upsert, replace, or clear.
39
39
  - Match nested sub-state behavior to `insertSelect`.
40
40
  - Match forms to `insertForm`, `insertSelectFormTree`, `insertFormAttributes`, and `insertFormSubmit`.
41
- - Treat `computedSource`, `toSource`, `signalSource`, `linkedSource`, `resourceById`, `toInject`, and other infra helpers as advanced choices. Do not choose them first unless the spec is about plumbing.
41
+ - Treat `computedSource`, `toSource`, `signalSource`, `linkedSource`, `resourceById`, and other infra helpers as advanced choices. Do not choose them first unless the spec is about plumbing.
42
42
 
43
43
  ## Default Heuristics
44
44
 
@@ -49,8 +49,8 @@ the published docs (MCP `search_documentation`, or https://ng-angular-stack.gith
49
49
  - When optimistic deletion can empty the current page, consider a second `insertReactOnMutation(..., { reload: { onMutationResolved: true } })`.
50
50
  - When the spec mentions pagination or page transitions, consider `identifier` on the `query` and `insertPaginationPlaceholderData`.
51
51
  - When the spec mentions remembered filters, remembered results, refresh survival, or lightweight cache, consider `insertLocalStoragePersister`.
52
- - When the spec mentions parent-provided values or route or context values that are not URL query params, consider `craftInputs`.
53
- - When the spec mentions Angular services or a facade over a service, consider `craftInject` or `injectService`.
52
+ - When the spec mentions parent-provided values or route or context values that are not URL query params, consider `CraftServiceInput` in a `craftService` factory.
53
+ - When the spec mentions Angular services or a facade over a service, consider `craftService` and its generated dependency helpers.
54
54
 
55
55
  ## Output Contract
56
56
 
@@ -73,11 +73,11 @@ Spec: `Creer une page qui affiche une liste d'utilisateurs.`
73
73
  Mapping: `query` for remote list loading. Add `queryParams` only if pagination, filters, sort, or shareable URL state are part of the spec.
74
74
 
75
75
  Spec: `Creer une page qui affiche une liste d'utilisateurs. On peut supprimer un utilisateur via un bouton, ou en selectionner plusieurs pour en supprimer plusieurs.`
76
- Mapping: `query` for the list, one `mutation` for single delete, one `mutation` for bulk delete, one selection `state` or `craftState` for selected ids, and `insertReactOnMutation` on the `query` with optimistic removal plus `reload.onMutationError = true`. Use `removeOne` and `removeMany` for the optimistic transforms.
76
+ Mapping: `query` for the list, one `mutation` for single delete, one `mutation` for bulk delete, one selection `state` for selected ids, and `insertReactOnMutation` on the `query` with optimistic removal plus `reload.onMutationError = true`. Use `removeOne` and `removeMany` for the optimistic transforms.
77
77
  Baseline helper already covering this: `assertMutationHasReactOn` (and `assertHttpEndpointUnique` if the list HTTP is owned once). Do not add an architecture rule for the feature.
78
78
 
79
79
  Spec: `Creer une page de recherche avec filtres dans l'URL et pagination sans flicker.`
80
- Mapping: `queryParams` for filter and pagination state, `query` for results, `insertPaginationPlaceholderData` to keep previous page data visible during transitions, `craftSetAllQueriesParamsStandalone` if the page must generate URLs outside injection context.
80
+ Mapping: `queryParams` for filter and pagination state, `query` for results, and `insertPaginationPlaceholderData` to keep previous page data visible during transitions.
81
81
 
82
82
  ## References
83
83
 
@@ -10,124 +10,78 @@ Prefer the documented APIs first. Use the advanced exports only when the request
10
10
  ### `query`
11
11
 
12
12
  Match: `afficher`, `liste`, `tableau`, `detail`, `charger`, `recuperer`, `fetch`, `read`, `dashboard`, `feed`, `resultats`, `historique`, `stats`, `donnees serveur`, `recharger`, `rafraichir`.
13
- Pair with: `queryParams`, `insertReactOnMutation`, `insertPaginationPlaceholderData`, `insertLocalStoragePersister`, `craftQuery`.
13
+ Pair with: `queryParams`, `insertReactOnMutation`, `insertPaginationPlaceholderData`, `insertLocalStoragePersister`.
14
14
  Default: Use `params` for reactive inputs, `method` for explicit trigger flows, `identifier` for pagination or parallel instances, and `preservePreviousValue` or placeholder strategies when flicker matters.
15
15
 
16
16
  ### `mutation`
17
17
 
18
18
  Match: `creer`, `ajouter`, `enregistrer`, `modifier`, `mettre a jour`, `editer`, `patcher`, `supprimer`, `archiver`, `activer`, `desactiver`, `publier`, `bulk action`, `submit`, `confirmer`.
19
- Pair with: `insertReactOnMutation`, `insertFormSubmit`, `craftMutations`, `query`.
19
+ Pair with: `insertReactOnMutation`, `insertFormSubmit`, `query`.
20
20
  Default: Create one mutation per server intent. Add `identifier` when row-level actions need independent loading states or cancellation semantics.
21
21
 
22
22
  ### `asyncProcess`
23
23
 
24
24
  Match: `debounce`, `temporiser`, `retarder`, `valider en asynchrone`, `autosave`, `partager`, `clipboard`, `native API`, `background task`, `processus asynchrone`, `polling`.
25
- Pair with: `source$`, `afterRecomputation`, `craftAsyncProcesses`.
25
+ Pair with: `source$`, `afterRecomputation`.
26
26
  Default: Choose this when the flow is asynchronous but is not the canonical server read cache and is not a write that should drive query synchronization.
27
27
 
28
28
  ### `state`
29
29
 
30
30
  Match: `etat local`, `selection`, `toggle`, `ouvert`, `ferme`, `modal`, `onglet actif`, `draft`, `brouillon`, `checkbox`, `expanded`, `wizard step`, `current tab`, `UI state`.
31
- Pair with: `insertSelect`, `insertEntities`, `insertForm`, `craftState`.
31
+ Pair with: `insertSelect`, `insertEntities`, `insertForm`.
32
32
  Default: Keep the state granular. Use it for client-only state and view state that should not live in the URL.
33
33
 
34
34
  ### `queryParams`
35
35
 
36
36
  Match: `URL`, `query string`, `search params`, `filtre URL`, `pagination URL`, `tri dans l'URL`, `onglet partageable`, `deep link`, `etat partageable`, `back-forward`.
37
- Pair with: `query`, `craftQueryParams`, `craftQueryParams`, `craftSetAllQueriesParamsStandalone`.
37
+ Pair with: `query`.
38
38
  Default: Split URL concerns by group when useful. Put `page`, `pageSize`, `sort`, `search`, `filters`, `tab`, and similar shareable state here.
39
39
 
40
40
  ### `source$`
41
41
 
42
42
  Match: `trigger`, `refresh`, `reset`, `bus evenementiel`, `broadcast`, `declencher`, `signal d'action`, `event stream`, `cross feature trigger`.
43
- Pair with: `on$`, `afterRecomputation`, `craftSources`.
43
+ Pair with: `on$`, `afterRecomputation`.
44
44
  Default: Choose this when the spec describes an event, not a persistent state.
45
45
 
46
46
  ### `on$`
47
47
 
48
48
  Match: `quand X arrive alors`, `react to`, `reset on`, `sync on`, `internal reaction`, `hidden binding`, `do not expose this method`.
49
- Pair with: `source$`, `state`, `mutation`, `asyncProcess`, `injectService`.
49
+ Pair with: `source$`, `state`, `mutation`, `asyncProcess`, `craftService`.
50
50
  Default: Use this for hidden reactive wiring that should run from a source but should not become part of the public API.
51
51
 
52
- ### `injectService`
52
+ ### `craftService` facade
53
53
 
54
54
  Match: `facade`, `wrapper de service`, `exposer une petite API`, `renommer des methodes`, `derive from service signals`, `hide imperative router/service API`.
55
- Pair with: `on$`, `computed`, `craftInject`.
55
+ Pair with: `on$`, `craftComputed`, and generated service dependencies.
56
56
  Default: Choose this outside store composition when the user wants a smaller typed service-facing API.
57
57
 
58
- ## Store Composition
58
+ ## Feature composition
59
59
 
60
- ### `craft`
60
+ ### `craftService`
61
61
 
62
- Match: `feature store`, `page store`, `global store`, `store reutilisable`, `compose store`, `DI`, `providedIn`, `scope`, `reusable state module`.
63
- Pair with: `craftState`, `craftQuery`, `craftMutations`, `craftSources`, `craftInputs`, `craftQueryParams`, `craftQueryParams`, `craftInject`, `craftComputedStates`, `craftAsyncProcesses`.
64
- Default: Use `providedIn: 'feature'` for page or route scoped logic and `providedIn: 'root'` for global shared logic.
62
+ Match: `feature`, `page logic`, `reusable state module`, `providedIn`, `scope`,
63
+ `dependency injection`, or a domain facade shared by several components.
64
+ Pair with: `state`, `query`, `mutation`, `asyncProcess`, `queryParams`,
65
+ `source$`, and `craftYieldRecord`.
66
+ Default: use `craftService` as the named boundary and return the primitives or
67
+ facade methods that the feature actually exposes. Do not invent a separate
68
+ store wrapper around each primitive.
65
69
 
66
- ### `craftState`
70
+ ### `CraftServiceInput`
67
71
 
68
- Match: `etat local dans le store`, `selection store`, `modal store`, `draft store`, `store-owned UI state`.
69
- Pair with: `state`, `on$`.
70
- Default: Use when the state belongs inside a `craft` store and should be exposed as store entries and prefixed methods.
72
+ Match: `parent provides id`, `route provides id`, `component input`, `external
73
+ signal`, `context value`, or `page receives userId`.
74
+ Pair with: `craftService` and the primitive that consumes the value.
75
+ Default: declare changing service inputs as `CraftServiceInput<T>` and yield
76
+ `inputs.value()` inside the service factory. Use `queryParams` only when the
77
+ value belongs in the URL.
71
78
 
72
- ### `craftQuery`
79
+ ### Derived and injected service logic
73
80
 
74
- Match: `requete dans le store`, `server state in store`, `cached resource in feature store`, `page query`.
75
- Pair with: `query`, `craftInputs`, `craftInject`, `craftQueryParams`, `insertReactOnMutation`.
76
- Default: Use when a `query` belongs inside a composed store boundary.
77
-
78
- ### `craftMutations`
79
-
80
- Match: `actions serveur du store`, `store mutations`, `CRUD actions grouped in store`, `row actions in store`.
81
- Pair with: `mutation`, `craftQuery`, `insertReactOnMutation`.
82
- Default: Group server write actions here so the store gets prefixed trigger methods and typed state access.
83
-
84
- ### `craftAsyncProcesses`
85
-
86
- Match: `async workflow in store`, `debounced action in store`, `delayed delete`, `background task in store`.
87
- Pair with: `asyncProcess`, `craftSources`.
88
- Default: Use when async client tasks belong to a `craft` store but are not the primary server-read/write state.
89
-
90
- ### `craftSources`
91
-
92
- Match: `reset event`, `refresh event`, `select event`, `open modal event`, `trigger inside store`.
93
- Pair with: `source$`, `on$`, `afterRecomputation`.
94
- Default: Use this to define event channels inside a store and to auto-generate `emit*`, `set*`, or `next*` methods.
95
-
96
- ### `craftInputs`
97
-
98
- Match: `parent provides id`, `route provides id`, `component input`, `external signal`, `context value`, `page receives userId`.
99
- Pair with: `craftQuery`, `craftState`, `craftMutations`.
100
- Default: Use this instead of `queryParams` when the value does not belong in the URL.
101
-
102
- ### `craftQueryParams`
103
-
104
- Match: `one query param group in store`, `pagination in store`, `filters in store`, `search params in store`.
105
- Pair with: `queryParams`, `craftQuery`, `craftSetAllQueriesParamsStandalone`.
106
- Default: Use when one named query-params group should live inside a `craft` store.
107
-
108
- ### `craftQueryParams`
109
-
110
- Match: `several URL state groups`, `pagination + filters + active tab`, `multiple query param groups`.
111
- Pair with: `queryParams`, `craftSetAllQueriesParamsStandalone`.
112
- Default: Use when the store needs several named query-params groups.
113
-
114
- ### `craftComputedStates`
115
-
116
- Match: `derived store data`, `isAllSelected`, `count`, `filtered count`, `UI flags`, `aggregation`, `composed loading state`.
117
- Pair with: `computed`, `craftState`, `craftQuery`.
118
- Default: Use for derived store-level signals instead of duplicating state.
119
-
120
- ### `craftInject`
121
-
122
- Match: `inject ApiService`, `inject Router`, `inject HttpClient`, `inject token`, `service dependency in store`.
123
- Pair with: `craft`, `craftQuery`, `craftMutations`.
124
- Default: Use inside `craft` when store factories need Angular services or tokens.
125
-
126
- ### `craftSetAllQueriesParamsStandalone`
127
-
128
- Match: `generate URL`, `router navigate queryParams`, `shareable link`, `build full query string outside injection context`.
129
- Pair with: `craftQueryParams`, `craftQueryParams`.
130
- Default: Use when the spec mentions programmatic navigation or link generation from the current query-params model.
81
+ Match: `derived data`, `count`, `filtered count`, `UI flags`, or a service
82
+ dependency. Use `craftComputed` for derived values, and yield the generated
83
+ service dependency from a `craftService` generator. Use `on$` and `source$` for
84
+ internal event wiring rather than store-specific source helpers.
131
85
 
132
86
  ## Insertions
133
87
 
@@ -280,7 +234,7 @@ Default: Use when the spec is explicit about source transformation pipelines.
280
234
  ### `signalSource`
281
235
 
282
236
  Match: `source with signal shape`, `event source with set`, `lazy event signal`, `source semantics with preserveLastValue`.
283
- Pair with: `craftSources`, `afterRecomputation`, `linkedSource`.
237
+ Pair with: `source$`, `afterRecomputation`, `linkedSource`.
284
238
  Default: Choose this only when the implementation specifically wants signal-like source behavior rather than `source$`.
285
239
 
286
240
  ### `linkedSource`
@@ -314,9 +268,3 @@ Default: Prefer the insertion for product specs. Use this lower-level factory on
314
268
  Match: `low-level resource registry`, `resources keyed by identifier`, `manual per-id cache infrastructure`, `bind one resource-by-id to another`.
315
269
  Pair with: `query.identifier`, `mutation.identifier`.
316
270
  Default: Prefer ordinary `query` and `mutation` with `identifier` until the request explicitly asks for custom resource infrastructure.
317
-
318
- ### `toInject`
319
-
320
- Match: `bind external signals into service entries`, `service ...Entry wiring`, `service adapter for signals`.
321
- Pair with: Angular services exposing writable `...Entry` signals.
322
- Default: Use only when the service API already follows the `...Entry` convention and the request is about service binding infrastructure.
@@ -27,7 +27,7 @@ Use:
27
27
  - `query` for the entity detail.
28
28
  - `mutation` for update or delete intents.
29
29
  - `insertReactOnMutation` on the detail `query` when edits should be reflected immediately.
30
- - `craftInputs` when the entity id comes from component or route context but does not belong in query params.
30
+ - `CraftServiceInput` when the entity id comes from component or route context but does not belong in query params.
31
31
 
32
32
  Default policy:
33
33
  - Keep one detail `query` per detail intent.
@@ -39,7 +39,7 @@ Use:
39
39
  - one `query` for the list.
40
40
  - one `mutation` for single delete.
41
41
  - one `mutation` for bulk delete.
42
- - one selection `state` or `craftState` holding selected ids.
42
+ - one selection `state` holding selected ids.
43
43
  - `insertReactOnMutation` on the list `query` for each mutation.
44
44
 
45
45
  Default policy:
@@ -67,35 +67,35 @@ Default policy:
67
67
  ## Search Page With URL Filters
68
68
 
69
69
  Use:
70
- - `queryParams` or `craftQueryParams` for the filters.
70
+ - `queryParams` for the filters.
71
71
  - `query` for the result list.
72
- - `craftSetAllQueriesParamsStandalone` when links or router navigation must be generated outside injection context.
72
+ - the router service when links or navigation must be generated outside a component template.
73
73
 
74
74
  Default policy:
75
75
  - Reset `page` to `1` when a search term or filter changes.
76
76
  - Keep URL parsing and serialization explicit for each field.
77
- - Choose `craftQueryParams` when the page has several named query-params groups.
77
+ - Use separate named `queryParams` primitives when the page has several query-params groups.
78
78
 
79
- ## Feature Or Page Store
79
+ ## Feature Or Page Service
80
80
 
81
81
  Use:
82
- - `craft` as the boundary.
83
- - `craftInject` for services and tokens.
84
- - `craftInputs` for non-URL external values.
85
- - `craftQueryParams` or `craftQueryParams` for URL-backed state.
86
- - `craftSources` for reset, refresh, and cross-entry triggers.
87
- - `craftQuery`, `craftMutations`, `craftState`, and `craftComputedStates` for the actual feature logic.
82
+ - `craftService` as the boundary.
83
+ - generated service dependencies for services and tokens.
84
+ - `CraftServiceInput` for non-URL external values.
85
+ - `queryParams` for URL-backed state.
86
+ - `source$` and `on$` for reset, refresh, and cross-entry triggers.
87
+ - `query`, `mutation`, `state`, and `craftComputed` for the actual feature logic.
88
88
 
89
89
  Default policy:
90
- - Choose `providedIn: 'feature'` for page or route scoped stores.
91
- - Choose `providedIn: 'root'` for global shared stores.
92
- - Keep remote state in `craftQuery` and `craftMutations`, not in ad-hoc service fields.
90
+ - Choose a scoped `craftService` for page or route scoped logic.
91
+ - Choose `providedIn: 'root'` for globally shared services.
92
+ - Keep remote state in `query` and `mutation`, not in ad-hoc service fields.
93
93
 
94
94
  ## Smaller Facade Over An Angular Service
95
95
 
96
96
  Use:
97
- - `injectService` when no `craft` store is needed.
98
- - `craftInject` when the service participates in a store composition.
97
+ - `craftService` when the facade needs to own primitives or dependencies.
98
+ - a plain adapter when no reactive service boundary is needed.
99
99
 
100
100
  Default policy:
101
101
  - Expose only the service surface the feature actually needs.
@@ -48,5 +48,5 @@ MCP `find_examples` searches the same Learn + examples corpus.
48
48
  - Favor symbol names from the installed package over older or shorter doc titles.
49
49
  - The public insertion name is `insertLocalStoragePersister`.
50
50
  - Reach for advanced exports such as `toSource`, `computedSource`, `signalSource`,
51
- `linkedSource`, `resourceById`, and `toInject` only when the request is
51
+ `linkedSource`, and `resourceById` only when the request is
52
52
  explicitly about infrastructure or source plumbing.