@shrkcrft/presets 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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/apply/preview-apply.d.ts +52 -0
  4. package/dist/apply/preview-apply.d.ts.map +1 -0
  5. package/dist/apply/preview-apply.js +85 -0
  6. package/dist/builtin/builtin-presets.d.ts +3 -0
  7. package/dist/builtin/builtin-presets.d.ts.map +1 -0
  8. package/dist/builtin/builtin-presets.js +520 -0
  9. package/dist/builtin/r26-presets.d.ts +31 -0
  10. package/dist/builtin/r26-presets.d.ts.map +1 -0
  11. package/dist/builtin/r26-presets.js +458 -0
  12. package/dist/builtin/r26-snippets.d.ts +39 -0
  13. package/dist/builtin/r26-snippets.d.ts.map +1 -0
  14. package/dist/builtin/r26-snippets.js +257 -0
  15. package/dist/builtin/r45-presets.d.ts +7 -0
  16. package/dist/builtin/r45-presets.d.ts.map +1 -0
  17. package/dist/builtin/r45-presets.js +186 -0
  18. package/dist/builtin/r47-presets.d.ts +5 -0
  19. package/dist/builtin/r47-presets.d.ts.map +1 -0
  20. package/dist/builtin/r47-presets.js +65 -0
  21. package/dist/builtin/shared-snippets.d.ts +17 -0
  22. package/dist/builtin/shared-snippets.d.ts.map +1 -0
  23. package/dist/builtin/shared-snippets.js +264 -0
  24. package/dist/define/define-preset.d.ts +4 -0
  25. package/dist/define/define-preset.d.ts.map +1 -0
  26. package/dist/define/define-preset.js +4 -0
  27. package/dist/emit/synthesize-files.d.ts +26 -0
  28. package/dist/emit/synthesize-files.d.ts.map +1 -0
  29. package/dist/emit/synthesize-files.js +172 -0
  30. package/dist/index.d.ts +11 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +10 -0
  33. package/dist/model/preset.d.ts +83 -0
  34. package/dist/model/preset.d.ts.map +1 -0
  35. package/dist/model/preset.js +21 -0
  36. package/dist/registry/load-presets.d.ts +12 -0
  37. package/dist/registry/load-presets.d.ts.map +1 -0
  38. package/dist/registry/load-presets.js +33 -0
  39. package/dist/registry/preset-registry.d.ts +11 -0
  40. package/dist/registry/preset-registry.d.ts.map +1 -0
  41. package/dist/registry/preset-registry.js +22 -0
  42. package/dist/registry/recommend.d.ts +30 -0
  43. package/dist/registry/recommend.d.ts.map +1 -0
  44. package/dist/registry/recommend.js +59 -0
  45. package/dist/registry/resolve-preset.d.ts +75 -0
  46. package/dist/registry/resolve-preset.d.ts.map +1 -0
  47. package/dist/registry/resolve-preset.js +207 -0
  48. package/dist/registry/resolve-references.d.ts +49 -0
  49. package/dist/registry/resolve-references.d.ts.map +1 -0
  50. package/dist/registry/resolve-references.js +38 -0
  51. package/package.json +51 -0
@@ -0,0 +1,458 @@
1
+ import { WorkspaceProfile } from '@shrkcrft/workspace';
2
+ import { definePreset } from "../define/define-preset.js";
3
+ import { COMMON_AGENT_BRIEFING, COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST, COMMON_RULE_INTERFACE_PREFIX, COMMON_RULE_NO_LOGIC_CONSTRUCTORS, COMMON_RULE_ONE_EXPORT, COMMON_SAFETY_RULE, OVERVIEW_DOC, } from "./shared-snippets.js";
4
+ import { NG_ACCESSIBLE, NG_AVOID_BYPASS_SECURITY, NG_DOMAIN_NO_UI_IMPORTS, NG_FEATURE_FOLDERS, NG_GUARDS_SMALL, NG_LAZY_ROUTES, NG_LIFECYCLE_SAFE_CLEANUP, NG_NO_BUSINESS_LOGIC_IN_TEMPLATE, NG_NO_DEEP_LIB_IMPORTS, NG_NO_GOD_SERVICES, NG_ON_PUSH, NG_PLUGIN_NO_DEEP_IMPORTS, NG_PLUGIN_STABLE_CONTRACT, NG_RXJS_NO_NESTED_SUBSCRIBE, NG_SIGNALS_FIRST, NG_STANDALONE_COMPONENTS, NG_TRACK_BY, NG_TYPED_REACTIVE_FORMS, TS_AGENT_SMALL_DIFFS, TS_BRANDED_IDS, TS_DISCRIMINATED_UNIONS, TS_ERROR_HANDLING, TS_NO_ANY, TS_NO_CIRCULAR_IMPORTS, TS_NO_DEEP_IMPORTS, TS_NO_FLOATING_PROMISES, TS_PREFER_SATISFIES, TS_PUBLIC_RETURN_TYPES, TS_READONLY_DEFAULT, TS_VALIDATE_BOUNDARY_INPUT, } from "./r26-snippets.js";
5
+ // ─── Core ──────────────────────────────────────────────────────────────────
6
+ export const GENERIC_SAFE_REPO = definePreset({
7
+ id: 'generic-safe-repo',
8
+ title: 'Generic safe repository baseline',
9
+ description: 'Safety + dry-run defaults that apply to any repo regardless of language. Composed by most other presets.',
10
+ tags: ['core', 'safety', 'generic'],
11
+ weight: 6,
12
+ includes: {
13
+ knowledge: [COMMON_AGENT_BRIEFING],
14
+ rules: [COMMON_SAFETY_RULE, TS_AGENT_SMALL_DIFFS],
15
+ paths: [],
16
+ templates: [],
17
+ pipelines: [COMMON_PIPELINE_CONTEXT_ONLY],
18
+ docs: { 'overview.md': OVERVIEW_DOC('Generic safe repo', 'Dry-run by default; CLI is the only write path; MCP never writes.') },
19
+ },
20
+ recommendedNextCommands: ['shrk doctor', 'shrk context --task "<task>"'],
21
+ });
22
+ export const AI_AGENT_SAFE_DEVELOPMENT = definePreset({
23
+ id: 'ai-agent-safe-development',
24
+ title: 'AI-agent-safe development',
25
+ description: 'Agent guardrails: small diffs, contract-driven changes, never apply without a review.',
26
+ tags: ['agent', 'safety'],
27
+ weight: 7,
28
+ composes: ['generic-safe-repo'],
29
+ includes: {
30
+ knowledge: [],
31
+ rules: [COMMON_SAFETY_RULE, TS_AGENT_SMALL_DIFFS],
32
+ paths: [],
33
+ templates: [],
34
+ pipelines: [COMMON_PIPELINE_FEATURE_DEV],
35
+ docs: { 'overview.md': OVERVIEW_DOC('AI-agent safe development', 'Agents must inspect existing patterns, prefer minimal diffs, surface uncertainty, and never apply plans without a review.') },
36
+ },
37
+ recommendedNextCommands: ['shrk contract template render generic-change --task "<task>"', 'shrk plan review <plan.json>'],
38
+ });
39
+ export const ENTERPRISE_REVIEW_GATED = definePreset({
40
+ id: 'enterprise-review-gated',
41
+ title: 'Enterprise review-gated workflow',
42
+ description: 'Contract approval + plan signing + boundary enforcement before any apply. Suited to large org repositories.',
43
+ tags: ['enterprise', 'governance'],
44
+ weight: 6,
45
+ composes: ['ai-agent-safe-development'],
46
+ includes: {
47
+ knowledge: [],
48
+ rules: [COMMON_SAFETY_RULE, TS_NO_DEEP_IMPORTS, TS_NO_CIRCULAR_IMPORTS],
49
+ paths: [],
50
+ templates: [],
51
+ pipelines: [COMMON_PIPELINE_FEATURE_DEV],
52
+ docs: { 'overview.md': OVERVIEW_DOC('Enterprise review-gated', 'Every plan goes through contract approval + signed plan + boundary check before apply.') },
53
+ },
54
+ recommendedNextCommands: [
55
+ 'shrk contract create --task "<task>" --save',
56
+ 'shrk plan review <plan.json>',
57
+ 'shrk apply <plan.json> --verify-signature --validate',
58
+ ],
59
+ });
60
+ // ─── TypeScript ────────────────────────────────────────────────────────────
61
+ export const STRICT_TYPESCRIPT = definePreset({
62
+ id: 'strict-typescript',
63
+ title: 'Strict TypeScript',
64
+ description: 'Strict-mode TypeScript rule library: no any, satisfies-first, no floating promises, no deep imports, no circular imports, branded ids.',
65
+ tags: ['typescript', 'strict'],
66
+ appliesTo: [WorkspaceProfile.HasTypeScript],
67
+ weight: 8,
68
+ composes: ['generic-safe-repo'],
69
+ includes: {
70
+ knowledge: [],
71
+ rules: [
72
+ TS_NO_ANY,
73
+ TS_PREFER_SATISFIES,
74
+ TS_DISCRIMINATED_UNIONS,
75
+ TS_READONLY_DEFAULT,
76
+ TS_PUBLIC_RETURN_TYPES,
77
+ TS_NO_FLOATING_PROMISES,
78
+ TS_ERROR_HANDLING,
79
+ TS_NO_DEEP_IMPORTS,
80
+ TS_NO_CIRCULAR_IMPORTS,
81
+ TS_VALIDATE_BOUNDARY_INPUT,
82
+ TS_BRANDED_IDS,
83
+ COMMON_RULE_INTERFACE_PREFIX,
84
+ COMMON_RULE_ONE_EXPORT,
85
+ COMMON_RULE_NO_LOGIC_CONSTRUCTORS,
86
+ ],
87
+ paths: [],
88
+ templates: [],
89
+ pipelines: [COMMON_PIPELINE_UNIT_TEST],
90
+ docs: { 'overview.md': OVERVIEW_DOC('Strict TypeScript', 'A starter rule pack for projects committed to strict TypeScript. Pair with the boundary-rules from `node-service` / `mcp-server` / `nx-monorepo` as appropriate.') },
91
+ },
92
+ recommendedNextCommands: ['bun x tsc --noEmit', 'shrk check boundaries'],
93
+ });
94
+ export const NODE_SERVICE = definePreset({
95
+ id: 'node-service',
96
+ title: 'Node.js service (TypeScript)',
97
+ description: 'TypeScript Node.js service: strict rules + service template + HTTP/CLI pipeline.',
98
+ tags: ['typescript', 'node', 'service'],
99
+ appliesTo: [WorkspaceProfile.HasTypeScript, WorkspaceProfile.IsService],
100
+ weight: 7,
101
+ composes: ['strict-typescript'],
102
+ includes: {
103
+ knowledge: [],
104
+ rules: [TS_NO_FLOATING_PROMISES, TS_VALIDATE_BOUNDARY_INPUT],
105
+ paths: [],
106
+ templates: [],
107
+ pipelines: [COMMON_PIPELINE_FEATURE_DEV],
108
+ docs: { 'overview.md': OVERVIEW_DOC('Node service', 'Validate external input at handler boundaries; prefer typed errors; keep handlers thin.') },
109
+ },
110
+ recommendedNextCommands: ['bun test', 'shrk doctor'],
111
+ });
112
+ export const NPM_PACKAGE = definePreset({
113
+ id: 'npm-package',
114
+ title: 'npm package',
115
+ description: 'Publishable TypeScript package: strict rules + public-API discipline + barrel hygiene.',
116
+ tags: ['typescript', 'library', 'npm'],
117
+ appliesTo: [WorkspaceProfile.HasTypeScript, WorkspaceProfile.IsLibrary],
118
+ weight: 7,
119
+ composes: ['strict-typescript'],
120
+ includes: {
121
+ knowledge: [],
122
+ rules: [TS_NO_DEEP_IMPORTS, TS_PUBLIC_RETURN_TYPES],
123
+ paths: [],
124
+ templates: [],
125
+ pipelines: [],
126
+ docs: { 'overview.md': OVERVIEW_DOC('npm package', 'Re-export through `src/index.ts`. Avoid leaking internals. Keep the public surface intentional.') },
127
+ },
128
+ recommendedNextCommands: ['shrk api report', 'bun x tsc -p . --noEmit'],
129
+ });
130
+ // ─── Modern Angular family ─────────────────────────────────────────────────
131
+ export const MODERN_ANGULAR = definePreset({
132
+ id: 'modern-angular',
133
+ title: 'Modern Angular',
134
+ description: 'Modern Angular (signals-aware, standalone-first, OnPush, RxJS-disciplined). Composes the angular sub-presets.',
135
+ tags: ['angular', 'modern'],
136
+ appliesTo: [WorkspaceProfile.HasAngular],
137
+ weight: 9,
138
+ composes: ['strict-typescript', 'generic-safe-repo'],
139
+ includes: {
140
+ knowledge: [],
141
+ rules: [
142
+ NG_STANDALONE_COMPONENTS,
143
+ NG_ON_PUSH,
144
+ NG_SIGNALS_FIRST,
145
+ NG_RXJS_NO_NESTED_SUBSCRIBE,
146
+ NG_LIFECYCLE_SAFE_CLEANUP,
147
+ NG_TRACK_BY,
148
+ NG_NO_BUSINESS_LOGIC_IN_TEMPLATE,
149
+ NG_TYPED_REACTIVE_FORMS,
150
+ NG_LAZY_ROUTES,
151
+ NG_GUARDS_SMALL,
152
+ NG_NO_DEEP_LIB_IMPORTS,
153
+ NG_FEATURE_FOLDERS,
154
+ NG_NO_GOD_SERVICES,
155
+ NG_DOMAIN_NO_UI_IMPORTS,
156
+ NG_ACCESSIBLE,
157
+ NG_AVOID_BYPASS_SECURITY,
158
+ ],
159
+ paths: [],
160
+ templates: [],
161
+ pipelines: [COMMON_PIPELINE_FEATURE_DEV],
162
+ docs: { 'overview.md': OVERVIEW_DOC('Modern Angular', 'Signals-first reactivity, RxJS used deliberately, standalone components, OnPush CD, lazy routes, typed forms, Nx-style boundaries.') },
163
+ tasks: { 'angular-modes.md': '# Angular adoption modes\n\n- **strict** — apply every rule.\n- **gradual** — adopt boundaries + signals discipline first.\n- **migration** — code transformation toward modern Angular.\n- **greenfield** — new project starts strict.\n' },
164
+ },
165
+ recommendedNextCommands: ['shrk presets get modern-angular', 'shrk ingest repository --preset modern-angular --write-drafts'],
166
+ });
167
+ export const ANGULAR_SIGNALS_FIRST = definePreset({
168
+ id: 'angular-signals-first',
169
+ title: 'Angular — signals-first',
170
+ description: 'Reactivity rules for signal-heavy Angular apps.',
171
+ tags: ['angular', 'signals'],
172
+ appliesTo: [WorkspaceProfile.HasAngular],
173
+ weight: 6,
174
+ includes: {
175
+ knowledge: [],
176
+ rules: [NG_SIGNALS_FIRST, NG_ON_PUSH],
177
+ paths: [],
178
+ templates: [],
179
+ pipelines: [],
180
+ docs: { 'overview.md': OVERVIEW_DOC('Angular signals-first', '`signal()` for local state, `computed()` for derived, `effect()` only for side effects.') },
181
+ },
182
+ });
183
+ export const ANGULAR_RXJS_DISCIPLINED = definePreset({
184
+ id: 'angular-rxjs-disciplined',
185
+ title: 'Angular — RxJS disciplined',
186
+ description: 'No nested subscribe, lifecycle-safe cleanup, deliberate operator choice.',
187
+ tags: ['angular', 'rxjs'],
188
+ appliesTo: [WorkspaceProfile.HasAngular],
189
+ weight: 6,
190
+ includes: {
191
+ knowledge: [],
192
+ rules: [NG_RXJS_NO_NESTED_SUBSCRIBE, NG_LIFECYCLE_SAFE_CLEANUP],
193
+ paths: [],
194
+ templates: [],
195
+ pipelines: [],
196
+ docs: { 'overview.md': OVERVIEW_DOC('Angular RxJS disciplined', 'Use switchMap/concatMap/exhaustMap deliberately. Always wire subscriptions through takeUntilDestroyed.') },
197
+ },
198
+ });
199
+ export const ANGULAR_STANDALONE_COMPONENTS = definePreset({
200
+ id: 'angular-standalone-components',
201
+ title: 'Angular — standalone components',
202
+ description: 'Prefer standalone components/directives/pipes over NgModules.',
203
+ tags: ['angular', 'standalone'],
204
+ appliesTo: [WorkspaceProfile.HasAngular],
205
+ weight: 6,
206
+ includes: {
207
+ knowledge: [],
208
+ rules: [NG_STANDALONE_COMPONENTS],
209
+ paths: [],
210
+ templates: [],
211
+ pipelines: [],
212
+ docs: { 'overview.md': OVERVIEW_DOC('Angular standalone components', 'New constructs default to standalone unless an existing NgModule contract requires otherwise.') },
213
+ },
214
+ });
215
+ export const ANGULAR_ENTERPRISE_ARCHITECTURE = definePreset({
216
+ id: 'angular-enterprise-architecture',
217
+ title: 'Angular — enterprise architecture',
218
+ description: 'Library boundaries, public APIs, no deep imports, Nx tags.',
219
+ tags: ['angular', 'enterprise', 'architecture'],
220
+ appliesTo: [WorkspaceProfile.HasAngular],
221
+ weight: 6,
222
+ includes: {
223
+ knowledge: [],
224
+ rules: [NG_NO_DEEP_LIB_IMPORTS, NG_FEATURE_FOLDERS, NG_DOMAIN_NO_UI_IMPORTS, TS_NO_CIRCULAR_IMPORTS],
225
+ paths: [],
226
+ templates: [],
227
+ pipelines: [],
228
+ docs: { 'overview.md': OVERVIEW_DOC('Angular enterprise architecture', 'Public APIs go through index.ts barrels. Deep imports forbidden. Domain services do not import UI.') },
229
+ },
230
+ });
231
+ export const ANGULAR_PERFORMANCE = definePreset({
232
+ id: 'angular-performance',
233
+ title: 'Angular — performance',
234
+ description: 'OnPush CD, trackBy, lazy routes, deferred heavy components.',
235
+ tags: ['angular', 'performance'],
236
+ appliesTo: [WorkspaceProfile.HasAngular],
237
+ weight: 5,
238
+ includes: {
239
+ knowledge: [],
240
+ rules: [NG_ON_PUSH, NG_TRACK_BY, NG_LAZY_ROUTES],
241
+ paths: [],
242
+ templates: [],
243
+ pipelines: [],
244
+ docs: { 'overview.md': OVERVIEW_DOC('Angular performance', 'Avoid unnecessary CD, track list rendering, lazy-load expensive features.') },
245
+ },
246
+ });
247
+ export const ANGULAR_TESTING = definePreset({
248
+ id: 'angular-testing',
249
+ title: 'Angular — testing',
250
+ description: 'Behavior over implementation, harnesses for complex UIs, deterministic async.',
251
+ tags: ['angular', 'testing'],
252
+ appliesTo: [WorkspaceProfile.HasAngular],
253
+ weight: 5,
254
+ includes: {
255
+ knowledge: [],
256
+ rules: [],
257
+ paths: [],
258
+ templates: [],
259
+ pipelines: [COMMON_PIPELINE_UNIT_TEST],
260
+ docs: { 'overview.md': OVERVIEW_DOC('Angular testing', 'Prefer harness/page-object patterns for complex UIs. Test signal/observable behavior deterministically. E2E only for critical flows.') },
261
+ },
262
+ });
263
+ export const ANGULAR_ACCESSIBILITY = definePreset({
264
+ id: 'angular-accessibility',
265
+ title: 'Angular — accessibility',
266
+ description: 'Semantic HTML, keyboard navigation, focus management, ARIA only where needed.',
267
+ tags: ['angular', 'a11y'],
268
+ appliesTo: [WorkspaceProfile.HasAngular],
269
+ weight: 5,
270
+ includes: {
271
+ knowledge: [],
272
+ rules: [NG_ACCESSIBLE],
273
+ paths: [],
274
+ templates: [],
275
+ pipelines: [],
276
+ docs: { 'overview.md': OVERVIEW_DOC('Angular accessibility', 'Interactive elements must be keyboard reachable, focus-visible, and use semantic HTML.') },
277
+ },
278
+ });
279
+ export const ANGULAR_SECURITY = definePreset({
280
+ id: 'angular-security',
281
+ title: 'Angular — security',
282
+ description: 'No bypassSecurityTrust*, sanitize user HTML, validate route params, CSP-friendly.',
283
+ tags: ['angular', 'security'],
284
+ appliesTo: [WorkspaceProfile.HasAngular],
285
+ weight: 6,
286
+ includes: {
287
+ knowledge: [],
288
+ rules: [NG_AVOID_BYPASS_SECURITY, TS_VALIDATE_BOUNDARY_INPUT],
289
+ paths: [],
290
+ templates: [],
291
+ pipelines: [],
292
+ docs: { 'overview.md': OVERVIEW_DOC('Angular security', 'Avoid bypassSecurityTrust*. Sanitize user HTML. Validate route params.') },
293
+ },
294
+ });
295
+ export const ANGULAR_PLUGIN_PLATFORM = definePreset({
296
+ id: 'angular-plugin-platform',
297
+ title: 'Angular — plugin platform',
298
+ description: 'Plugin contracts, lifecycle, capability tokens, isolation.',
299
+ tags: ['angular', 'plugins'],
300
+ appliesTo: [WorkspaceProfile.HasAngular],
301
+ weight: 5,
302
+ includes: {
303
+ knowledge: [],
304
+ rules: [NG_PLUGIN_STABLE_CONTRACT, NG_PLUGIN_NO_DEEP_IMPORTS],
305
+ paths: [],
306
+ templates: [],
307
+ pipelines: [],
308
+ docs: { 'overview.md': OVERVIEW_DOC('Angular plugin platform', 'Plugin contracts are stable. No plugin-to-plugin deep imports. Lifecycle is deterministic.') },
309
+ },
310
+ });
311
+ export const ANGULAR_ENTERPRISE_APP = definePreset({
312
+ id: 'angular-enterprise-app',
313
+ title: 'Angular enterprise app',
314
+ description: 'Production-grade Angular monorepo app with strict TypeScript + signals + RxJS discipline + Nx boundaries.',
315
+ tags: ['angular', 'enterprise', 'app'],
316
+ appliesTo: [WorkspaceProfile.HasAngular, WorkspaceProfile.IsMonorepo],
317
+ weight: 7,
318
+ composes: ['modern-angular', 'angular-enterprise-architecture', 'strict-typescript'],
319
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: {} },
320
+ });
321
+ export const ANGULAR_LIBRARY = definePreset({
322
+ id: 'angular-library',
323
+ title: 'Angular library',
324
+ description: 'Publishable Angular library: stable public API, no deep imports, peerDependency hygiene.',
325
+ tags: ['angular', 'library'],
326
+ appliesTo: [WorkspaceProfile.HasAngular, WorkspaceProfile.IsLibrary],
327
+ weight: 6,
328
+ composes: ['modern-angular', 'npm-package'],
329
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: {} },
330
+ });
331
+ export const ANGULAR_SMART_UI_PLATFORM = definePreset({
332
+ id: 'angular-smart-ui-platform',
333
+ title: 'Angular smart UI platform',
334
+ description: 'Smart/dumb component split, deliberate state ownership, large-app organisation.',
335
+ tags: ['angular', 'ui-platform'],
336
+ appliesTo: [WorkspaceProfile.HasAngular],
337
+ weight: 6,
338
+ composes: ['modern-angular'],
339
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: {} },
340
+ });
341
+ // ─── Testing presets ───────────────────────────────────────────────────────
342
+ export const VITEST_FOCUSED = definePreset({
343
+ id: 'vitest-focused',
344
+ title: 'Vitest-focused testing',
345
+ description: 'Vitest-driven test discipline; deterministic timers; behavior over implementation.',
346
+ tags: ['testing', 'vitest'],
347
+ appliesTo: [WorkspaceProfile.HasVitest],
348
+ weight: 5,
349
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [COMMON_PIPELINE_UNIT_TEST], docs: { 'overview.md': OVERVIEW_DOC('Vitest-focused', 'Behavior tests. Deterministic timers. Use `vi.useFakeTimers()` rather than wall-clock.') } },
350
+ });
351
+ export const JEST_FOCUSED = definePreset({
352
+ id: 'jest-focused',
353
+ title: 'Jest-focused testing',
354
+ description: 'Jest-driven test discipline; deterministic; focused unit tests over snapshot-only.',
355
+ tags: ['testing', 'jest'],
356
+ appliesTo: [WorkspaceProfile.HasJest],
357
+ weight: 5,
358
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [COMMON_PIPELINE_UNIT_TEST], docs: { 'overview.md': OVERVIEW_DOC('Jest-focused', 'Avoid brittle snapshot-only suites. Use jest.useFakeTimers() for async.') } },
359
+ });
360
+ export const PLAYWRIGHT_FOCUSED = definePreset({
361
+ id: 'playwright-focused',
362
+ title: 'Playwright-focused E2E',
363
+ description: 'Playwright e2e: page-object/harness patterns, deterministic auth, critical-flows only.',
364
+ tags: ['testing', 'playwright', 'e2e'],
365
+ weight: 5,
366
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('Playwright-focused', 'Use page objects / harnesses; cover the critical flow not every screen; deterministic auth setup.') } },
367
+ });
368
+ // ─── Frontend ──────────────────────────────────────────────────────────────
369
+ export const REACT_APP_PRESET = definePreset({
370
+ id: 'react-app',
371
+ title: 'React app',
372
+ description: 'React app baseline (strict TS, no deep imports, error boundaries).',
373
+ tags: ['react', 'frontend'],
374
+ appliesTo: [WorkspaceProfile.HasReact, WorkspaceProfile.IsFrontend],
375
+ weight: 6,
376
+ composes: ['strict-typescript'],
377
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('React app', 'Components are pure where possible. Side effects belong in hooks. Avoid deep imports between feature folders.') } },
378
+ });
379
+ export const VUE_APP_PRESET = definePreset({
380
+ id: 'vue-app',
381
+ title: 'Vue app',
382
+ description: 'Vue 3 app baseline (composition API, typed props, scoped styles).',
383
+ tags: ['vue', 'frontend'],
384
+ appliesTo: [WorkspaceProfile.HasVue, WorkspaceProfile.IsFrontend],
385
+ weight: 6,
386
+ composes: ['strict-typescript'],
387
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('Vue app', 'Composition API + typed props. Scoped styles for component CSS. Pinia for state when needed.') } },
388
+ });
389
+ export const WEB_COMPONENT_LIBRARY = definePreset({
390
+ id: 'web-component-library',
391
+ title: 'Web Component library',
392
+ description: 'Framework-agnostic web components (lit/stencil/etc): explicit lifecycle, slotting, encapsulation.',
393
+ tags: ['web-components', 'library'],
394
+ weight: 5,
395
+ composes: ['strict-typescript', 'npm-package'],
396
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('Web Component library', 'Shadow DOM by default. Slot for composition. Keep public attributes stable.') } },
397
+ });
398
+ // ─── Backend ───────────────────────────────────────────────────────────────
399
+ export const NESTJS_SERVICE = definePreset({
400
+ id: 'nestjs-service',
401
+ title: 'NestJS service',
402
+ description: 'NestJS service: typed DTOs at boundaries, no logic in controllers, layered modules.',
403
+ tags: ['nestjs', 'backend'],
404
+ appliesTo: [WorkspaceProfile.HasNestJS, WorkspaceProfile.IsBackend],
405
+ weight: 7,
406
+ composes: ['node-service'],
407
+ includes: { knowledge: [], rules: [TS_VALIDATE_BOUNDARY_INPUT], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('NestJS service', 'Validate DTOs at controllers. Keep services thin. Use modules to enforce layers.') } },
408
+ });
409
+ export const EXPRESS_SERVICE = definePreset({
410
+ id: 'express-service',
411
+ title: 'Express service',
412
+ description: 'Express HTTP service: explicit error middleware, typed request handlers, no router-in-handler.',
413
+ tags: ['express', 'backend'],
414
+ appliesTo: [WorkspaceProfile.IsBackend],
415
+ weight: 5,
416
+ composes: ['node-service'],
417
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('Express service', 'Centralised error middleware. Strict request typing. Avoid spawning routes from inside handlers.') } },
418
+ });
419
+ export const FASTIFY_SERVICE = definePreset({
420
+ id: 'fastify-service',
421
+ title: 'Fastify service',
422
+ description: 'Fastify service: schema-validated routes, plugin encapsulation, deterministic startup.',
423
+ tags: ['fastify', 'backend'],
424
+ appliesTo: [WorkspaceProfile.IsBackend],
425
+ weight: 5,
426
+ composes: ['node-service'],
427
+ includes: { knowledge: [], rules: [], paths: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('Fastify service', 'Schema-validate routes. Encapsulate features as plugins. Keep startup ordering deterministic.') } },
428
+ });
429
+ export const R26_PRESETS = Object.freeze([
430
+ GENERIC_SAFE_REPO,
431
+ AI_AGENT_SAFE_DEVELOPMENT,
432
+ ENTERPRISE_REVIEW_GATED,
433
+ STRICT_TYPESCRIPT,
434
+ NODE_SERVICE,
435
+ NPM_PACKAGE,
436
+ MODERN_ANGULAR,
437
+ ANGULAR_SIGNALS_FIRST,
438
+ ANGULAR_RXJS_DISCIPLINED,
439
+ ANGULAR_STANDALONE_COMPONENTS,
440
+ ANGULAR_ENTERPRISE_ARCHITECTURE,
441
+ ANGULAR_PERFORMANCE,
442
+ ANGULAR_TESTING,
443
+ ANGULAR_ACCESSIBILITY,
444
+ ANGULAR_SECURITY,
445
+ ANGULAR_PLUGIN_PLATFORM,
446
+ ANGULAR_ENTERPRISE_APP,
447
+ ANGULAR_LIBRARY,
448
+ ANGULAR_SMART_UI_PLATFORM,
449
+ VITEST_FOCUSED,
450
+ JEST_FOCUSED,
451
+ PLAYWRIGHT_FOCUSED,
452
+ REACT_APP_PRESET,
453
+ VUE_APP_PRESET,
454
+ WEB_COMPONENT_LIBRARY,
455
+ NESTJS_SERVICE,
456
+ EXPRESS_SERVICE,
457
+ FASTIFY_SERVICE,
458
+ ]);
@@ -0,0 +1,39 @@
1
+ export declare function ruleSnippet(opts: {
2
+ id: string;
3
+ title: string;
4
+ priority: 'critical' | 'high' | 'medium' | 'low';
5
+ tags: readonly string[];
6
+ appliesWhen: readonly string[];
7
+ content: string;
8
+ }): string;
9
+ export declare const TS_NO_ANY: string;
10
+ export declare const TS_PREFER_SATISFIES: string;
11
+ export declare const TS_DISCRIMINATED_UNIONS: string;
12
+ export declare const TS_READONLY_DEFAULT: string;
13
+ export declare const TS_PUBLIC_RETURN_TYPES: string;
14
+ export declare const TS_NO_FLOATING_PROMISES: string;
15
+ export declare const TS_ERROR_HANDLING: string;
16
+ export declare const TS_NO_DEEP_IMPORTS: string;
17
+ export declare const TS_VALIDATE_BOUNDARY_INPUT: string;
18
+ export declare const TS_BRANDED_IDS: string;
19
+ export declare const TS_NO_CIRCULAR_IMPORTS: string;
20
+ export declare const TS_AGENT_SMALL_DIFFS: string;
21
+ export declare const NG_STANDALONE_COMPONENTS: string;
22
+ export declare const NG_ON_PUSH: string;
23
+ export declare const NG_SIGNALS_FIRST: string;
24
+ export declare const NG_RXJS_NO_NESTED_SUBSCRIBE: string;
25
+ export declare const NG_LIFECYCLE_SAFE_CLEANUP: string;
26
+ export declare const NG_TRACK_BY: string;
27
+ export declare const NG_NO_BUSINESS_LOGIC_IN_TEMPLATE: string;
28
+ export declare const NG_TYPED_REACTIVE_FORMS: string;
29
+ export declare const NG_LAZY_ROUTES: string;
30
+ export declare const NG_GUARDS_SMALL: string;
31
+ export declare const NG_NO_DEEP_LIB_IMPORTS: string;
32
+ export declare const NG_FEATURE_FOLDERS: string;
33
+ export declare const NG_NO_GOD_SERVICES: string;
34
+ export declare const NG_DOMAIN_NO_UI_IMPORTS: string;
35
+ export declare const NG_ACCESSIBLE: string;
36
+ export declare const NG_AVOID_BYPASS_SECURITY: string;
37
+ export declare const NG_PLUGIN_STABLE_CONTRACT: string;
38
+ export declare const NG_PLUGIN_NO_DEEP_IMPORTS: string;
39
+ //# sourceMappingURL=r26-snippets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"r26-snippets.d.ts","sourceRoot":"","sources":["../../src/builtin/r26-snippets.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAWT;AAID,eAAO,MAAM,SAAS,QAOpB,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAO9B,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAOlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAO9B,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAOjC,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAOlC,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAO5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,QAO7B,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAOrC,CAAC;AAEH,eAAO,MAAM,cAAc,QAOzB,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAOjC,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAO/B,CAAC;AAIH,eAAO,MAAM,wBAAwB,QAOnC,CAAC;AAEH,eAAO,MAAM,UAAU,QAOrB,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAO3B,CAAC;AAEH,eAAO,MAAM,2BAA2B,QAOtC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAOpC,CAAC;AAEH,eAAO,MAAM,WAAW,QAOtB,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAO3C,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAOlC,CAAC;AAEH,eAAO,MAAM,cAAc,QAOzB,CAAC;AAEH,eAAO,MAAM,eAAe,QAO1B,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAOjC,CAAC;AAEH,eAAO,MAAM,kBAAkB,QAO7B,CAAC;AAEH,eAAO,MAAM,kBAAkB,QAO7B,CAAC;AAEH,eAAO,MAAM,uBAAuB,QAOlC,CAAC;AAEH,eAAO,MAAM,aAAa,QAOxB,CAAC;AAEH,eAAO,MAAM,wBAAwB,QAOnC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAOpC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAOpC,CAAC"}