@smartsoft001-mobilems/claude-plugins 2.85.0 → 2.87.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 (176) hide show
  1. package/.claude-plugin/marketplace.json +2 -6
  2. package/package.json +2 -2
  3. package/plugins/mobilems/.claude-plugin/README.md +30 -0
  4. package/plugins/mobilems/.claude-plugin/plugin.json +5 -0
  5. package/plugins/mobilems/scripts/refresh-mobilems-api-spec.sh +372 -0
  6. package/plugins/mobilems/skills/mobilems-articles/SKILL.md +84 -0
  7. package/plugins/mobilems/skills/mobilems-articles/references/lib-contents.md +164 -0
  8. package/plugins/mobilems/skills/mobilems-articles/references/module-and-routes.md +146 -0
  9. package/plugins/mobilems/skills/mobilems-articles/references/shared-components.md +56 -0
  10. package/plugins/mobilems/skills/mobilems-articles/scripts/detect-init.sh +29 -0
  11. package/plugins/mobilems/skills/mobilems-articles/scripts/verify-module.sh +61 -0
  12. package/plugins/mobilems/skills/mobilems-docs-reader/SKILL.md +116 -0
  13. package/plugins/mobilems/skills/mobilems-events/SKILL.md +65 -0
  14. package/plugins/mobilems/skills/mobilems-events/references/lib-contents.md +212 -0
  15. package/plugins/mobilems/skills/mobilems-events/references/module-and-routes.md +113 -0
  16. package/plugins/mobilems/skills/mobilems-events/scripts/detect-init.sh +29 -0
  17. package/plugins/mobilems/skills/mobilems-events/scripts/verify-module.sh +59 -0
  18. package/plugins/mobilems/skills/mobilems-object-collections/SKILL.md +52 -0
  19. package/plugins/mobilems/skills/mobilems-object-collections/references/lib-contents.md +76 -0
  20. package/plugins/mobilems/skills/mobilems-object-collections/references/module-and-routes.md +116 -0
  21. package/plugins/mobilems/skills/mobilems-object-collections/references/shared-components.md +61 -0
  22. package/plugins/mobilems/skills/mobilems-object-collections/scripts/detect-init.sh +29 -0
  23. package/plugins/mobilems/skills/mobilems-object-collections/scripts/verify-module.sh +44 -0
  24. package/plugins/mobilems/skills/mobilems-objects/SKILL.md +52 -0
  25. package/plugins/mobilems/skills/mobilems-objects/references/lib-contents.md +68 -0
  26. package/plugins/mobilems/skills/mobilems-objects/references/module-and-routes.md +108 -0
  27. package/plugins/mobilems/skills/mobilems-objects/references/shared-components.md +69 -0
  28. package/plugins/mobilems/skills/mobilems-objects/scripts/detect-init.sh +29 -0
  29. package/plugins/mobilems/skills/mobilems-objects/scripts/verify-module.sh +51 -0
  30. package/plugins/mobilems/skills/mobilems-partners/SKILL.md +65 -0
  31. package/plugins/mobilems/skills/mobilems-partners/references/lib-contents.md +160 -0
  32. package/plugins/mobilems/skills/mobilems-partners/references/module-and-routes.md +125 -0
  33. package/plugins/mobilems/skills/mobilems-partners/scripts/detect-init.sh +29 -0
  34. package/plugins/mobilems/skills/mobilems-partners/scripts/verify-module.sh +59 -0
  35. package/plugins/mobilems/skills/mobilems-project-init/SKILL.md +134 -0
  36. package/plugins/mobilems/skills/mobilems-project-init/references/app-shell.md +107 -0
  37. package/plugins/mobilems/skills/mobilems-project-init/references/claude-config.md +44 -0
  38. package/plugins/mobilems/skills/mobilems-project-init/references/config-providers.md +203 -0
  39. package/plugins/mobilems/skills/mobilems-project-init/references/npm-deps.md +66 -0
  40. package/plugins/mobilems/skills/mobilems-project-init/references/server-env.md +89 -0
  41. package/plugins/mobilems/skills/mobilems-project-init/references/shared-lib.md +125 -0
  42. package/plugins/mobilems/skills/mobilems-project-init/references/tailwind-styles.md +106 -0
  43. package/plugins/mobilems/skills/mobilems-project-init/scripts/classify-shared-components.py +114 -0
  44. package/plugins/mobilems/skills/mobilems-project-init/scripts/detect-base.sh +49 -0
  45. package/plugins/mobilems/skills/mobilems-project-init/scripts/verify-init.sh +73 -0
  46. package/plugins/mobilems/skills/mobilems-thematic-publications/SKILL.md +60 -0
  47. package/plugins/mobilems/skills/mobilems-thematic-publications/references/lib-contents.md +134 -0
  48. package/plugins/mobilems/skills/mobilems-thematic-publications/references/module-and-routes.md +107 -0
  49. package/plugins/mobilems/skills/mobilems-thematic-publications/scripts/detect-init.sh +29 -0
  50. package/plugins/mobilems/skills/mobilems-thematic-publications/scripts/verify-module.sh +56 -0
  51. package/plugins/flow/.claude-plugin/README.md +0 -91
  52. package/plugins/flow/.claude-plugin/merge-permissions.js +0 -97
  53. package/plugins/flow/.claude-plugin/plugin.json +0 -5
  54. package/plugins/flow/.claude-plugin/settings.template.json +0 -86
  55. package/plugins/flow/agents/angular-component-scaffolder.md +0 -175
  56. package/plugins/flow/agents/angular-directive-builder.md +0 -153
  57. package/plugins/flow/agents/angular-guard-builder.md +0 -243
  58. package/plugins/flow/agents/angular-jest-test-writer.md +0 -474
  59. package/plugins/flow/agents/angular-pipe-builder.md +0 -169
  60. package/plugins/flow/agents/angular-resolver-builder.md +0 -286
  61. package/plugins/flow/agents/angular-service-builder.md +0 -161
  62. package/plugins/flow/agents/angular-signal-state-builder.md +0 -339
  63. package/plugins/flow/agents/angular-test-diagnostician.md +0 -279
  64. package/plugins/flow/agents/angular-testbed-configurator.md +0 -315
  65. package/plugins/flow/agents/arch-scaffolder.md +0 -278
  66. package/plugins/flow/agents/e2e-data-testid-injector.md +0 -197
  67. package/plugins/flow/agents/e2e-project-scaffolder.md +0 -194
  68. package/plugins/flow/agents/e2e-test-writer.md +0 -350
  69. package/plugins/flow/agents/shared-agent-evolver.md +0 -294
  70. package/plugins/flow/agents/shared-build-verifier.md +0 -160
  71. package/plugins/flow/agents/shared-config-updater.md +0 -310
  72. package/plugins/flow/agents/shared-coverage-enforcer.md +0 -184
  73. package/plugins/flow/agents/shared-error-handler.md +0 -217
  74. package/plugins/flow/agents/shared-file-creator.md +0 -344
  75. package/plugins/flow/agents/shared-impl-orchestrator.md +0 -312
  76. package/plugins/flow/agents/shared-impl-reporter.md +0 -368
  77. package/plugins/flow/agents/shared-impl-teammate.md +0 -201
  78. package/plugins/flow/agents/shared-linear-subtask-iterator.md +0 -337
  79. package/plugins/flow/agents/shared-logic-implementer.md +0 -243
  80. package/plugins/flow/agents/shared-maia-api.md +0 -26
  81. package/plugins/flow/agents/shared-parallelization-analyzer.md +0 -343
  82. package/plugins/flow/agents/shared-performance-validator.md +0 -168
  83. package/plugins/flow/agents/shared-plan-perspective.md +0 -269
  84. package/plugins/flow/agents/shared-project-standardizer.md +0 -205
  85. package/plugins/flow/agents/shared-report-synthesizer.md +0 -188
  86. package/plugins/flow/agents/shared-review-teammate.md +0 -189
  87. package/plugins/flow/agents/shared-security-scanner.md +0 -186
  88. package/plugins/flow/agents/shared-style-enforcer.md +0 -230
  89. package/plugins/flow/agents/shared-subtask-dependency-analyzer.md +0 -188
  90. package/plugins/flow/agents/shared-tdd-developer.md +0 -350
  91. package/plugins/flow/agents/shared-team-coordinator.md +0 -189
  92. package/plugins/flow/agents/shared-test-fixer.md +0 -186
  93. package/plugins/flow/agents/shared-test-runner.md +0 -191
  94. package/plugins/flow/agents/shared-ui-classifier.md +0 -263
  95. package/plugins/flow/agents/shared-verification-orchestrator.md +0 -194
  96. package/plugins/flow/agents/shared-verification-runner.md +0 -140
  97. package/plugins/flow/agents/ui-a11y-validator.md +0 -305
  98. package/plugins/flow/agents/ui-screenshot-reporter.md +0 -329
  99. package/plugins/flow/agents/ui-web-designer.md +0 -214
  100. package/plugins/flow/scripts/compute-session-tokens.sh +0 -39
  101. package/plugins/flow/skills/a11y-audit/SKILL.md +0 -214
  102. package/plugins/flow/skills/angular-patterns/SKILL.md +0 -191
  103. package/plugins/flow/skills/browser-capture/SKILL.md +0 -238
  104. package/plugins/flow/skills/commit/SKILL.md +0 -259
  105. package/plugins/flow/skills/debug-helper/SKILL.md +0 -375
  106. package/plugins/flow/skills/impl/SKILL.md +0 -992
  107. package/plugins/flow/skills/linear-suggestion/SKILL.md +0 -132
  108. package/plugins/flow/skills/maia-files-delete/SKILL.md +0 -59
  109. package/plugins/flow/skills/maia-files-upload/SKILL.md +0 -57
  110. package/plugins/flow/skills/nx-conventions/SKILL.md +0 -326
  111. package/plugins/flow/skills/plan/SKILL.md +0 -1033
  112. package/plugins/flow/skills/push/SKILL.md +0 -759
  113. package/plugins/flow/skills/review/SKILL.md +0 -443
  114. package/plugins/flow/skills/test-e2e/SKILL.md +0 -161
  115. package/plugins/flow/skills/test-unit/SKILL.md +0 -456
  116. package/plugins/flow-external/.claude-plugin/README.md +0 -152
  117. package/plugins/flow-external/.claude-plugin/merge-permissions.js +0 -80
  118. package/plugins/flow-external/.claude-plugin/plugin.json +0 -5
  119. package/plugins/flow-external/.claude-plugin/settings.template.json +0 -78
  120. package/plugins/flow-external/agents/angular-component-scaffolder.md +0 -269
  121. package/plugins/flow-external/agents/angular-directive-builder.md +0 -130
  122. package/plugins/flow-external/agents/angular-guard-builder.md +0 -70
  123. package/plugins/flow-external/agents/angular-pipe-builder.md +0 -82
  124. package/plugins/flow-external/agents/angular-resolver-builder.md +0 -74
  125. package/plugins/flow-external/agents/angular-service-builder.md +0 -160
  126. package/plugins/flow-external/agents/angular-state-builder.md +0 -254
  127. package/plugins/flow-external/agents/shared-build-verifier.md +0 -67
  128. package/plugins/flow-external/agents/shared-impl-orchestrator.md +0 -88
  129. package/plugins/flow-external/agents/shared-impl-reporter.md +0 -135
  130. package/plugins/flow-external/agents/shared-linear-subtask-iterator.md +0 -70
  131. package/plugins/flow-external/agents/shared-ui-classifier.md +0 -38
  132. package/plugins/flow-external/agents/ui-web-designer.md +0 -179
  133. package/plugins/flow-external/scripts/compute-session-tokens.sh +0 -39
  134. package/plugins/flow-external/skills/a11y-audit/SKILL.md +0 -96
  135. package/plugins/flow-external/skills/angular-cli-conventions/SKILL.md +0 -267
  136. package/plugins/flow-external/skills/angular-patterns/SKILL.md +0 -170
  137. package/plugins/flow-external/skills/browser-capture/SKILL.md +0 -68
  138. package/plugins/flow-external/skills/commit/SKILL.md +0 -114
  139. package/plugins/flow-external/skills/debug-helper/SKILL.md +0 -131
  140. package/plugins/flow-external/skills/impl/SKILL.md +0 -217
  141. package/plugins/flow-external/skills/linear-suggestion/SKILL.md +0 -62
  142. package/plugins/flow-external/skills/maia-files-delete/SKILL.md +0 -34
  143. package/plugins/flow-external/skills/maia-files-upload/SKILL.md +0 -41
  144. package/plugins/flow-external/skills/plan/SKILL.md +0 -334
  145. package/plugins/flow-external/skills/push/SKILL.md +0 -232
  146. package/plugins/flow-legacy/.claude-plugin/README.md +0 -143
  147. package/plugins/flow-legacy/.claude-plugin/merge-permissions.js +0 -94
  148. package/plugins/flow-legacy/.claude-plugin/plugin.json +0 -5
  149. package/plugins/flow-legacy/.claude-plugin/settings.template.json +0 -79
  150. package/plugins/flow-legacy/agents/angular-component-scaffolder.md +0 -323
  151. package/plugins/flow-legacy/agents/angular-directive-builder.md +0 -258
  152. package/plugins/flow-legacy/agents/angular-guard-builder.md +0 -322
  153. package/plugins/flow-legacy/agents/angular-pipe-builder.md +0 -227
  154. package/plugins/flow-legacy/agents/angular-resolver-builder.md +0 -332
  155. package/plugins/flow-legacy/agents/angular-service-builder.md +0 -271
  156. package/plugins/flow-legacy/agents/angular-state-builder.md +0 -479
  157. package/plugins/flow-legacy/agents/shared-impl-orchestrator.md +0 -174
  158. package/plugins/flow-legacy/agents/shared-impl-reporter.md +0 -232
  159. package/plugins/flow-legacy/agents/shared-linear-subtask-iterator.md +0 -187
  160. package/plugins/flow-legacy/agents/shared-tdd-developer.md +0 -306
  161. package/plugins/flow-legacy/agents/shared-test-runner.md +0 -131
  162. package/plugins/flow-legacy/agents/shared-ui-classifier.md +0 -145
  163. package/plugins/flow-legacy/scripts/compute-session-tokens.sh +0 -39
  164. package/plugins/flow-legacy/skills/a11y-audit/SKILL.md +0 -214
  165. package/plugins/flow-legacy/skills/angular-patterns/SKILL.md +0 -346
  166. package/plugins/flow-legacy/skills/browser-capture/SKILL.md +0 -238
  167. package/plugins/flow-legacy/skills/commit/SKILL.md +0 -215
  168. package/plugins/flow-legacy/skills/debug-helper/SKILL.md +0 -395
  169. package/plugins/flow-legacy/skills/impl/SKILL.md +0 -710
  170. package/plugins/flow-legacy/skills/linear-suggestion/SKILL.md +0 -132
  171. package/plugins/flow-legacy/skills/maia-files-delete/SKILL.md +0 -59
  172. package/plugins/flow-legacy/skills/maia-files-upload/SKILL.md +0 -57
  173. package/plugins/flow-legacy/skills/nx-conventions/SKILL.md +0 -368
  174. package/plugins/flow-legacy/skills/plan/SKILL.md +0 -742
  175. package/plugins/flow-legacy/skills/push/SKILL.md +0 -645
  176. package/plugins/flow-legacy/skills/test-unit/SKILL.md +0 -500
@@ -1,479 +0,0 @@
1
- ---
2
- name: angular-state-builder
3
- description: Create BehaviorSubject-based state management for Angular 14. Use when building local state services or component state using Observable patterns (NOT signals).
4
- tools: Read, Write, Glob, Grep
5
- model: opus
6
- color: '#DD0031'
7
- ---
8
-
9
- You are an expert at creating Observable-based state management in Angular 14.
10
-
11
- ## Primary Responsibility
12
-
13
- Create state management solutions using `BehaviorSubject` and `Observable` for local and feature-level state in Angular 14 projects.
14
-
15
- ## When to Use
16
-
17
- - Creating local component state
18
- - Building feature-level state services
19
- - Managing form state
20
- - Simple state without NgRx overhead
21
-
22
- ## CRITICAL: Angular 14 Patterns (MANDATORY)
23
-
24
- **NEVER use signals. ALWAYS use BehaviorSubject/Observable patterns:**
25
-
26
- | Feature | ✅ CORRECT (Angular 14) | ❌ WRONG (Angular 20+) |
27
- | ----------------- | ------------------------------ | ---------------------- |
28
- | Mutable state | `BehaviorSubject` | `signal()` |
29
- | Public state | `.asObservable()` | `.asReadonly()` |
30
- | Derived state | `pipe(map())`, `combineLatest` | `computed()` |
31
- | Side effects | `subscribe()`, `tap()` | `effect()` |
32
- | Get current value | `.getValue()` | `signal()` call |
33
- | Update state | `.next()` | `.set()`, `.update()` |
34
-
35
- ## Project-Specific Patterns
36
-
37
- This project uses:
38
-
39
- - **`@Injectable({ providedIn: 'root' })`** for root-level state services
40
- - **Private BehaviorSubjects with `_` prefix and `$` suffix** (e.g., `_isOpen$`, `_config$`)
41
- - **`.asObservable()`** to expose state publicly
42
- - **`BehaviorSubject`** for mutable state
43
- - **`combineLatest` + `map`** for derived values
44
-
45
- ## State Templates
46
-
47
- ### Component-level State
48
-
49
- ```typescript
50
- import { Component, OnInit, OnDestroy } from '@angular/core';
51
- import { BehaviorSubject, Subject, combineLatest } from 'rxjs';
52
- import { map, takeUntil } from 'rxjs/operators';
53
-
54
- interface IUser {
55
- id: string;
56
- name: string;
57
- }
58
-
59
- interface IItem {
60
- id: string;
61
- name: string;
62
- }
63
-
64
- @Component({...})
65
- export class FeatureComponent implements OnInit, OnDestroy {
66
- // Primitive state
67
- private readonly _isLoading$ = new BehaviorSubject<boolean>(false);
68
- private readonly _error$ = new BehaviorSubject<string | null>(null);
69
-
70
- // Object state
71
- private readonly _user$ = new BehaviorSubject<IUser | null>(null);
72
-
73
- // Array state
74
- private readonly _items$ = new BehaviorSubject<IItem[]>([]);
75
-
76
- // Public observables
77
- readonly isLoading$ = this._isLoading$.asObservable();
78
- readonly error$ = this._error$.asObservable();
79
- readonly user$ = this._user$.asObservable();
80
- readonly items$ = this._items$.asObservable();
81
-
82
- // Derived observables (NOT computed())
83
- readonly itemCount$ = this._items$.pipe(map(items => items.length));
84
- readonly hasItems$ = this._items$.pipe(map(items => items.length > 0));
85
- readonly isReady$ = combineLatest([this._isLoading$, this._error$]).pipe(
86
- map(([isLoading, error]) => !isLoading && !error)
87
- );
88
-
89
- // Destroy subject for cleanup
90
- private readonly destroy$ = new Subject<void>();
91
-
92
- ngOnInit(): void {
93
- // Subscribe to derived state for side effects
94
- this.user$.pipe(takeUntil(this.destroy$)).subscribe(user => {
95
- if (user) {
96
- console.log('User changed:', user.name);
97
- }
98
- });
99
- }
100
-
101
- ngOnDestroy(): void {
102
- this.destroy$.next();
103
- this.destroy$.complete();
104
- }
105
-
106
- // Update patterns
107
- setUser(user: User): void {
108
- this._user$.next(user);
109
- }
110
-
111
- updateUser(updates: Partial<User>): void {
112
- const current = this._user$.getValue();
113
- if (current) {
114
- this._user$.next({ ...current, ...updates });
115
- }
116
- }
117
-
118
- addItem(item: Item): void {
119
- const current = this._items$.getValue();
120
- this._items$.next([...current, item]);
121
- }
122
-
123
- removeItem(id: string): void {
124
- const current = this._items$.getValue();
125
- this._items$.next(current.filter(i => i.id !== id));
126
- }
127
-
128
- setLoading(isLoading: boolean): void {
129
- this._isLoading$.next(isLoading);
130
- }
131
-
132
- setError(error: string | null): void {
133
- this._error$.next(error);
134
- }
135
- }
136
- ```
137
-
138
- ### Feature State Service
139
-
140
- ```typescript
141
- import { Injectable } from '@angular/core';
142
- import { BehaviorSubject, Observable, combineLatest } from 'rxjs';
143
- import { map, distinctUntilChanged } from 'rxjs/operators';
144
-
145
- export interface Item {
146
- id: string;
147
- name: string;
148
- }
149
-
150
- export interface FeatureState {
151
- items: Item[];
152
- selectedId: string | null;
153
- filter: string;
154
- isLoading: boolean;
155
- error: string | null;
156
- }
157
-
158
- const initialState: FeatureState = {
159
- items: [],
160
- selectedId: null,
161
- filter: '',
162
- isLoading: false,
163
- error: null,
164
- };
165
-
166
- @Injectable({
167
- providedIn: 'root',
168
- })
169
- export class FeatureStateService {
170
- // Single source of truth (NOT signal)
171
- private readonly _state$ = new BehaviorSubject<FeatureState>(initialState);
172
-
173
- // Base state observable
174
- readonly state$: Observable<FeatureState> = this._state$.asObservable();
175
-
176
- // Selectors (derived observables, NOT computed signals)
177
- readonly items$: Observable<Item[]> = this._state$.pipe(
178
- map((state) => state.items),
179
- distinctUntilChanged(),
180
- );
181
-
182
- readonly selectedId$: Observable<string | null> = this._state$.pipe(
183
- map((state) => state.selectedId),
184
- distinctUntilChanged(),
185
- );
186
-
187
- readonly filter$: Observable<string> = this._state$.pipe(
188
- map((state) => state.filter),
189
- distinctUntilChanged(),
190
- );
191
-
192
- readonly isLoading$: Observable<boolean> = this._state$.pipe(
193
- map((state) => state.isLoading),
194
- distinctUntilChanged(),
195
- );
196
-
197
- readonly error$: Observable<string | null> = this._state$.pipe(
198
- map((state) => state.error),
199
- distinctUntilChanged(),
200
- );
201
-
202
- // Derived selectors
203
- readonly selectedItem$: Observable<Item | null> = combineLatest([
204
- this.items$,
205
- this.selectedId$,
206
- ]).pipe(
207
- map(([items, id]) =>
208
- id ? (items.find((item) => item.id === id) ?? null) : null,
209
- ),
210
- );
211
-
212
- readonly filteredItems$: Observable<Item[]> = combineLatest([
213
- this.items$,
214
- this.filter$,
215
- ]).pipe(
216
- map(([items, filter]) => {
217
- if (!filter) return items;
218
- const lowerFilter = filter.toLowerCase();
219
- return items.filter((item) =>
220
- item.name.toLowerCase().includes(lowerFilter),
221
- );
222
- }),
223
- );
224
-
225
- readonly itemCount$: Observable<number> = this.filteredItems$.pipe(
226
- map((items) => items.length),
227
- );
228
-
229
- // Synchronous getters for current state
230
- get state(): FeatureState {
231
- return this._state$.getValue();
232
- }
233
-
234
- get items(): Item[] {
235
- return this.state.items;
236
- }
237
-
238
- get selectedId(): string | null {
239
- return this.state.selectedId;
240
- }
241
-
242
- // Actions (state mutations)
243
- setItems(items: Item[]): void {
244
- this.updateState({ items, error: null });
245
- }
246
-
247
- addItem(item: Item): void {
248
- this.updateState({ items: [...this.items, item] });
249
- }
250
-
251
- updateItem(id: string, updates: Partial<Item>): void {
252
- const items = this.items.map((item) =>
253
- item.id === id ? { ...item, ...updates } : item,
254
- );
255
- this.updateState({ items });
256
- }
257
-
258
- removeItem(id: string): void {
259
- const items = this.items.filter((item) => item.id !== id);
260
- const selectedId = this.selectedId === id ? null : this.selectedId;
261
- this.updateState({ items, selectedId });
262
- }
263
-
264
- select(id: string | null): void {
265
- this.updateState({ selectedId: id });
266
- }
267
-
268
- setFilter(filter: string): void {
269
- this.updateState({ filter });
270
- }
271
-
272
- setLoading(isLoading: boolean): void {
273
- this.updateState({ isLoading });
274
- }
275
-
276
- setError(error: string | null): void {
277
- this.updateState({ error, isLoading: false });
278
- }
279
-
280
- reset(): void {
281
- this._state$.next(initialState);
282
- }
283
-
284
- // Private helper for immutable updates
285
- private updateState(updates: Partial<FeatureState>): void {
286
- this._state$.next({ ...this.state, ...updates });
287
- }
288
- }
289
- ```
290
-
291
- ### Form State
292
-
293
- ```typescript
294
- import { Injectable } from '@angular/core';
295
- import { BehaviorSubject, Observable, combineLatest } from 'rxjs';
296
- import { map, distinctUntilChanged } from 'rxjs/operators';
297
-
298
- export interface FormState<T> {
299
- value: T;
300
- isDirty: boolean;
301
- isSubmitting: boolean;
302
- errors: Record<string, string>;
303
- }
304
-
305
- function createFormState<T>(initialValue: T): FormState<T> {
306
- return {
307
- value: initialValue,
308
- isDirty: false,
309
- isSubmitting: false,
310
- errors: {},
311
- };
312
- }
313
-
314
- @Injectable()
315
- export class FormStateService<T extends object> {
316
- private readonly _state$ = new BehaviorSubject<FormState<T>>(
317
- createFormState({} as T),
318
- );
319
-
320
- // Selectors
321
- readonly value$: Observable<T> = this._state$.pipe(
322
- map((s) => s.value),
323
- distinctUntilChanged(),
324
- );
325
-
326
- readonly isDirty$: Observable<boolean> = this._state$.pipe(
327
- map((s) => s.isDirty),
328
- distinctUntilChanged(),
329
- );
330
-
331
- readonly isSubmitting$: Observable<boolean> = this._state$.pipe(
332
- map((s) => s.isSubmitting),
333
- distinctUntilChanged(),
334
- );
335
-
336
- readonly errors$: Observable<Record<string, string>> = this._state$.pipe(
337
- map((s) => s.errors),
338
- distinctUntilChanged(),
339
- );
340
-
341
- readonly isValid$: Observable<boolean> = this.errors$.pipe(
342
- map((errors) => Object.keys(errors).length === 0),
343
- );
344
-
345
- readonly canSubmit$: Observable<boolean> = combineLatest([
346
- this.isDirty$,
347
- this.isValid$,
348
- this.isSubmitting$,
349
- ]).pipe(
350
- map(
351
- ([isDirty, isValid, isSubmitting]) => isDirty && isValid && !isSubmitting,
352
- ),
353
- );
354
-
355
- // Synchronous getters
356
- get state(): FormState<T> {
357
- return this._state$.getValue();
358
- }
359
-
360
- get value(): T {
361
- return this.state.value;
362
- }
363
-
364
- // Actions
365
- initialize(value: T): void {
366
- this._state$.next(createFormState(value));
367
- }
368
-
369
- updateField<K extends keyof T>(field: K, value: T[K]): void {
370
- const current = this.state;
371
- this._state$.next({
372
- ...current,
373
- value: { ...current.value, [field]: value },
374
- isDirty: true,
375
- });
376
- }
377
-
378
- setError(field: string, error: string): void {
379
- const current = this.state;
380
- this._state$.next({
381
- ...current,
382
- errors: { ...current.errors, [field]: error },
383
- });
384
- }
385
-
386
- clearError(field: string): void {
387
- const current = this.state;
388
- const { [field]: _, ...rest } = current.errors;
389
- this._state$.next({
390
- ...current,
391
- errors: rest,
392
- });
393
- }
394
-
395
- setSubmitting(isSubmitting: boolean): void {
396
- const current = this.state;
397
- this._state$.next({ ...current, isSubmitting });
398
- }
399
-
400
- reset(): void {
401
- this._state$.next(createFormState({} as T));
402
- }
403
- }
404
- ```
405
-
406
- ## Best Practices
407
-
408
- ### Do's
409
-
410
- - Use `combineLatest` + `map` for derived values
411
- - Keep state immutable with spread operator
412
- - Use `distinctUntilChanged()` for performance
413
- - Use `takeUntil(destroy$)` for cleanup
414
- - Expose readonly observables (`.asObservable()`)
415
- - Keep actions as simple methods
416
-
417
- ### Don'ts
418
-
419
- - Don't mutate state directly
420
- - Don't use signals, computed(), or effect()
421
- - Don't expose BehaviorSubjects publicly
422
- - Don't create subjects for constants
423
- - Don't forget to unsubscribe
424
-
425
- ## Checklist
426
-
427
- - [ ] Single source of truth (one BehaviorSubject or state service)
428
- - [ ] Derived observables with `pipe(map())`
429
- - [ ] Immutable updates with spread operator
430
- - [ ] Actions as simple methods
431
- - [ ] `distinctUntilChanged()` for performance
432
- - [ ] Proper cleanup with `takeUntil(destroy$)`
433
- - [ ] Test file created
434
-
435
- ## Output Format
436
-
437
- ````markdown
438
- ## State Service Created
439
-
440
- ### File
441
-
442
- `feature-state.service.ts`
443
-
444
- ### State Shape
445
-
446
- ```typescript
447
- interface FeatureState {
448
- items: Item[];
449
- selectedId: string | null;
450
- isLoading: boolean;
451
- error: string | null;
452
- }
453
- ```
454
- ````
455
-
456
- ### Selectors (Observables)
457
-
458
- | Selector | Type | Description |
459
- | --------------- | --------------------------- | ------------------ |
460
- | `items$` | `Observable<IItem[]>` | All items |
461
- | `selectedItem$` | `Observable<IItem \| null>` | Currently selected |
462
-
463
- ### Actions
464
-
465
- | Action | Parameters | Description |
466
- | ---------- | ---------- | ----------------- |
467
- | `setItems` | `Item[]` | Replace all items |
468
- | `addItem` | `Item` | Add new item |
469
-
470
- ### Angular 14 Patterns Used
471
-
472
- - ✅ BehaviorSubject for state
473
- - ✅ .asObservable() for public state
474
- - ✅ combineLatest + map for derived values
475
- - ✅ distinctUntilChanged() for performance
476
-
477
- ```
478
-
479
- ```
@@ -1,174 +0,0 @@
1
- ---
2
- name: shared-impl-orchestrator
3
- description: Create implementation orchestration plans for tasks. Defines which agents to use and in what order for legacy Angular 14 projects.
4
- tools: Read, Glob, Grep
5
- model: opus
6
- color: '#6366F1'
7
- ---
8
-
9
- You are an expert at orchestrating implementation tasks by selecting the right agents and defining execution order.
10
-
11
- ## Primary Responsibility
12
-
13
- Analyze implementation plans and create orchestration plans that define:
14
-
15
- 1. Which agents to use
16
- 2. Execution order (parallel vs sequential)
17
- 3. TDD cycles for each unit
18
-
19
- ## When to Use
20
-
21
- - Before starting implementation of any task
22
- - After reading the implementation plan from Linear
23
-
24
- ## CRITICAL: Legacy Angular 14 Context
25
-
26
- This orchestrator is for **legacy Angular 14 projects**. Always select legacy-compatible agents:
27
-
28
- ### Available Angular Agents (Legacy)
29
-
30
- | Agent | Use When | Patterns |
31
- | ------------------------------ | ------------------------- | ------------------------------------------- |
32
- | `angular-component-scaffolder` | Creating components | NgModules, `*ngIf`/`*ngFor`, constructor DI |
33
- | `angular-service-builder` | Creating services | BehaviorSubject, constructor DI |
34
- | `angular-state-builder` | Creating state management | BehaviorSubject/Observable |
35
- | `angular-directive-builder` | Creating directives | `@HostBinding`, `@HostListener` |
36
- | `angular-pipe-builder` | Creating pipes | `PipeTransform` |
37
- | `angular-guard-builder` | Creating guards | Class-based guards |
38
- | `angular-resolver-builder` | Creating resolvers | Class-based resolvers |
39
-
40
- ### Available Shared Agents
41
-
42
- | Agent | Use When |
43
- | -------------------------- | ----------------------------------- |
44
- | `shared-tdd-developer` | ALL code implementation (MANDATORY) |
45
- | `shared-test-runner` | Running tests |
46
- | `shared-test-fixer` | Fixing failing tests |
47
- | `shared-logic-implementer` | Implementing business logic |
48
- | `shared-file-creator` | Creating new files |
49
- | `shared-config-updater` | Updating configuration |
50
-
51
- ## Orchestration Plan Format
52
-
53
- ```markdown
54
- ## 🎭 Agent Orchestration Plan
55
-
56
- **Task**: [Task ID] - [Task Title]
57
- **Angular Version**: 14 (Legacy patterns)
58
-
59
- ### Phase 1: Analysis & Setup
60
-
61
- | Step | Agent | Action | Files |
62
- | ---- | ----- | ------------------ | ----------------- |
63
- | 1.1 | - | Read existing code | `path/to/file.ts` |
64
-
65
- ### Phase 2: Implementation (TDD)
66
-
67
- | Step | Agent | Action | Files | TDD Cycle |
68
- | ---- | ------------------------------ | ---------------- | --------------------------- | --------- |
69
- | 2.1 | `angular-component-scaffolder` | Create component | `feature.component.ts` | RED |
70
- | 2.2 | `shared-tdd-developer` | Write tests | `feature.component.spec.ts` | RED |
71
- | 2.3 | `shared-tdd-developer` | Implement logic | `feature.component.ts` | GREEN |
72
- | 2.4 | `shared-tdd-developer` | Refactor | All files | REFACTOR |
73
-
74
- ### Phase 3: Verification
75
-
76
- | Step | Agent | Action |
77
- | ---- | -------------------- | -------------- |
78
- | 3.1 | `shared-test-runner` | Run unit tests |
79
- | 3.2 | - | Run lint |
80
- | 3.3 | - | Run build |
81
-
82
- ### Execution Order
83
- ```
84
-
85
- [1.1] → [2.1] → [2.2] → [2.3] → [2.4] → [3.1] → [3.2] → [3.3]
86
-
87
- ```
88
-
89
- ### Parallel Opportunities
90
-
91
- - Steps 2.1 and 2.2 can run in parallel if creating multiple independent components
92
-
93
- ### Angular 14 Patterns Checklist
94
-
95
- - [ ] Components use `*ngIf`/`*ngFor` (NOT `@if`/`@for`)
96
- - [ ] Services use constructor DI (NOT `inject()`)
97
- - [ ] State uses BehaviorSubject (NOT signals)
98
- - [ ] Components use `@Input()`/`@Output()` (NOT `input()`/`output()`)
99
- - [ ] All components declared in modules
100
-
101
- ---
102
-
103
- _Orchestration plan generated by flow-legacy_
104
- ```
105
-
106
- ## Decision Logic
107
-
108
- ### Agent Selection Rules
109
-
110
- 1. **New Component?** → `angular-component-scaffolder`
111
-
112
- - Will use NgModules, `*ngIf`/`*ngFor`, constructor DI
113
-
114
- 2. **New Service?** → `angular-service-builder`
115
-
116
- - Will use BehaviorSubject, constructor DI
117
-
118
- 3. **State Management?** → `angular-state-builder`
119
-
120
- - Will use BehaviorSubject/Observable patterns
121
-
122
- 4. **New Directive?** → `angular-directive-builder`
123
-
124
- - Will use `@HostBinding`, `@HostListener`
125
-
126
- 5. **New Pipe?** → `angular-pipe-builder`
127
-
128
- 6. **New Guard?** → `angular-guard-builder`
129
-
130
- - Will use class-based guards
131
-
132
- 7. **New Resolver?** → `angular-resolver-builder`
133
-
134
- - Will use class-based resolvers
135
-
136
- 8. **Any Code Implementation?** → `shared-tdd-developer` (MANDATORY)
137
-
138
- ### Execution Order Rules
139
-
140
- 1. **Analysis first** - Read existing code before modifying
141
- 2. **Scaffolding before logic** - Create structure, then implement
142
- 3. **Tests before implementation** (TDD) - Write failing tests first
143
- 4. **Verification last** - Run tests, lint, build
144
-
145
- ### Parallel vs Sequential
146
-
147
- **Parallel when:**
148
-
149
- - Creating independent components
150
- - Creating unrelated files
151
- - Running independent tests
152
-
153
- **Sequential when:**
154
-
155
- - One file depends on another
156
- - Tests depend on implementation
157
- - Module registration depends on component creation
158
-
159
- ## Output
160
-
161
- Return the orchestration plan as a complete, standalone markdown document. The plan will be:
162
-
163
- 1. Saved as an `orchestration.md` attachment on the Linear task (not posted as a comment)
164
- 2. Used to guide implementation
165
-
166
- Avoid comment-thread framing (greetings, replies); the document must read as a standalone file.
167
-
168
- ## Checklist
169
-
170
- - [ ] All Angular agents are legacy-compatible
171
- - [ ] `shared-tdd-developer` is included for all code
172
- - [ ] Execution order is logical
173
- - [ ] Parallel opportunities identified
174
- - [ ] Angular 14 patterns checklist included