@shrkcrft/presets 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +1 -1
- package/dist/builtin/builtin-presets.d.ts.map +1 -1
- package/dist/builtin/builtin-presets.js +9 -30
- package/dist/builtin/r26-presets.d.ts.map +1 -1
- package/dist/builtin/r26-presets.js +3 -3
- package/dist/builtin/r45-presets.d.ts.map +1 -1
- package/dist/builtin/r45-presets.js +3 -3
- package/dist/builtin/r47-presets.d.ts.map +1 -1
- package/dist/builtin/r47-presets.js +3 -3
- package/dist/builtin/shared-snippets.d.ts +3 -25
- package/dist/builtin/shared-snippets.d.ts.map +1 -1
- package/dist/builtin/shared-snippets.js +0 -265
- package/dist/emit/synthesize-files.d.ts.map +1 -1
- package/dist/emit/synthesize-files.js +17 -76
- package/package.json +8 -9
- package/dist/builtin/angular21-presets.d.ts +0 -9
- package/dist/builtin/angular21-presets.d.ts.map +0 -1
- package/dist/builtin/angular21-presets.js +0 -218
- package/dist/builtin/angular21-snippets.d.ts +0 -28
- package/dist/builtin/angular21-snippets.d.ts.map +0 -1
- package/dist/builtin/angular21-snippets.js +0 -243
- package/dist/builtin/nest11-presets.d.ts +0 -11
- package/dist/builtin/nest11-presets.d.ts.map +0 -1
- package/dist/builtin/nest11-presets.js +0 -257
- package/dist/builtin/nest11-snippets.d.ts +0 -32
- package/dist/builtin/nest11-snippets.d.ts.map +0 -1
- package/dist/builtin/nest11-snippets.js +0 -270
- package/dist/builtin/react19-presets.d.ts +0 -12
- package/dist/builtin/react19-presets.d.ts.map +0 -1
- package/dist/builtin/react19-presets.js +0 -299
- package/dist/builtin/react19-snippets.d.ts +0 -43
- package/dist/builtin/react19-snippets.d.ts.map +0 -1
- package/dist/builtin/react19-snippets.js +0 -363
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SharkCraft presets: reusable project setups (knowledge/rules/paths/templates/pipelines/docs) that can be applied to a target repo through the CLI.
|
|
4
4
|
|
|
5
|
-
Part of [SharkCraft](https://github.com/
|
|
5
|
+
Part of [SharkCraft](https://github.com/sharkcraft/sharkcraft) — a deterministic, local-first toolkit that gives AI coding agents durable project context. See the main repo for documentation, examples, and the `shrk` CLI.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/builtin-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/builtin-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA6iBlD,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EA0B5C,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { WorkspaceProfile } from '@shrkcrft/workspace';
|
|
2
2
|
import { definePreset } from "../define/define-preset.js";
|
|
3
|
-
import {
|
|
3
|
+
import { COMMON_AGENT_BRIEFING, COMMON_PATH_SERVICES, COMMON_PATH_TESTS, COMMON_PATH_UTILS, 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, COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_TEST, COMMON_TEMPLATE_UTILITY, OVERVIEW_DOC, } from "./shared-snippets.js";
|
|
4
4
|
import { R26_PRESETS } from "./r26-presets.js";
|
|
5
5
|
import { R45_PRESETS } from "./r45-presets.js";
|
|
6
6
|
import { R47_PRESETS } from "./r47-presets.js";
|
|
7
|
-
import { ANGULAR_21_PRESETS } from "./angular21-presets.js";
|
|
8
|
-
import { NEST_11_PRESETS } from "./nest11-presets.js";
|
|
9
|
-
import { REACT_19_PRESETS } from "./react19-presets.js";
|
|
10
7
|
const GENERIC = definePreset({
|
|
11
8
|
id: 'generic',
|
|
12
9
|
title: 'Generic SharkCraft setup',
|
|
@@ -136,7 +133,7 @@ const ANGULAR_APP = definePreset({
|
|
|
136
133
|
includes: {
|
|
137
134
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
138
135
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_ONE_EXPORT],
|
|
139
|
-
paths: [
|
|
136
|
+
paths: [COMMON_PATH_UTILS, COMMON_PATH_TESTS],
|
|
140
137
|
templates: [COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
141
138
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
142
139
|
docs: {
|
|
@@ -180,11 +177,11 @@ const NX_MONOREPO = definePreset({
|
|
|
180
177
|
})`,
|
|
181
178
|
],
|
|
182
179
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_INTERFACE_PREFIX, COMMON_RULE_ONE_EXPORT],
|
|
183
|
-
paths: [
|
|
180
|
+
paths: [COMMON_PATH_SERVICES, COMMON_PATH_UTILS, COMMON_PATH_TESTS],
|
|
184
181
|
templates: [COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
185
182
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST],
|
|
186
183
|
docs: {
|
|
187
|
-
'overview.md': OVERVIEW_DOC('Nx monorepo', 'Many libraries. Layer order is enforced.
|
|
184
|
+
'overview.md': OVERVIEW_DOC('Nx monorepo', 'Many libraries. Layer order is enforced.'),
|
|
188
185
|
},
|
|
189
186
|
},
|
|
190
187
|
recommendedNextCommands: [
|
|
@@ -377,7 +374,7 @@ const JAVA_MAVEN_SERVICE = definePreset({
|
|
|
377
374
|
includes: {
|
|
378
375
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
379
376
|
rules: [COMMON_SAFETY_RULE],
|
|
380
|
-
paths: [
|
|
377
|
+
paths: [],
|
|
381
378
|
templates: [],
|
|
382
379
|
pipelines: [],
|
|
383
380
|
docs: {
|
|
@@ -395,7 +392,7 @@ const JAVA_GRADLE_SERVICE = definePreset({
|
|
|
395
392
|
includes: {
|
|
396
393
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
397
394
|
rules: [COMMON_SAFETY_RULE],
|
|
398
|
-
paths: [
|
|
395
|
+
paths: [],
|
|
399
396
|
templates: [],
|
|
400
397
|
pipelines: [],
|
|
401
398
|
docs: {
|
|
@@ -431,7 +428,7 @@ const PYTHON_SERVICE = definePreset({
|
|
|
431
428
|
includes: {
|
|
432
429
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
433
430
|
rules: [COMMON_SAFETY_RULE],
|
|
434
|
-
paths: [
|
|
431
|
+
paths: [],
|
|
435
432
|
templates: [],
|
|
436
433
|
pipelines: [],
|
|
437
434
|
docs: {
|
|
@@ -449,7 +446,7 @@ const GO_MODULE = definePreset({
|
|
|
449
446
|
includes: {
|
|
450
447
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
451
448
|
rules: [COMMON_SAFETY_RULE],
|
|
452
|
-
paths: [
|
|
449
|
+
paths: [],
|
|
453
450
|
templates: [],
|
|
454
451
|
pipelines: [],
|
|
455
452
|
docs: {
|
|
@@ -467,7 +464,7 @@ const RUST_CRATE = definePreset({
|
|
|
467
464
|
includes: {
|
|
468
465
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
469
466
|
rules: [COMMON_SAFETY_RULE],
|
|
470
|
-
paths: [
|
|
467
|
+
paths: [],
|
|
471
468
|
templates: [],
|
|
472
469
|
pipelines: [],
|
|
473
470
|
docs: {
|
|
@@ -520,22 +517,4 @@ export const BUILTIN_PRESETS = Object.freeze([
|
|
|
520
517
|
...R45_PRESETS,
|
|
521
518
|
// Universal adoption top-5: nest-service, angular-app canonical aliases
|
|
522
519
|
...R47_PRESETS,
|
|
523
|
-
// Angular 18 / 19 / 20 / 21 — signal queries, signal I/O, zoneless,
|
|
524
|
-
// @if/@for/@defer/@let, resource() / httpResource(), inject(), no
|
|
525
|
-
// NgModules. Weight 11-12 so the recommender prefers these over
|
|
526
|
-
// R26 `modern-angular` (weight 9) when the workspace is Angular.
|
|
527
|
-
...ANGULAR_21_PRESETS,
|
|
528
|
-
// NestJS 11+ — thin controllers, global ValidationPipe + class-validator,
|
|
529
|
-
// async lifecycle, Fastify + cache + throttler, helmet + JWT guards,
|
|
530
|
-
// structured logging + terminus health, TestingModule + supertest e2e.
|
|
531
|
-
// Weight 11-12 so the recommender prefers these over R26 `nestjs-service`
|
|
532
|
-
// (weight 7) and R47 `nest-service` (weight 9) when the workspace is Nest.
|
|
533
|
-
...NEST_11_PRESETS,
|
|
534
|
-
// React 19+ — function components + ref-as-prop, hooks discipline,
|
|
535
|
-
// Actions / useActionState / useOptimistic, TanStack Query for server
|
|
536
|
-
// state, React Compiler + lazy + virtualization, useTransition /
|
|
537
|
-
// Suspense, Vitest + RTL + userEvent + MSW, RSC + 'use client' +
|
|
538
|
-
// Server Actions. Weight 11-12 so the recommender prefers these over
|
|
539
|
-
// the legacy `frontend-app` (weight 6) when the workspace is React.
|
|
540
|
-
...REACT_19_PRESETS,
|
|
541
520
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r26-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r26-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"r26-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r26-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA+ClD,eAAO,MAAM,iBAAiB,EAAE,OAe9B,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,OAgBtC,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,OAoBpC,CAAC;AAIH,eAAO,MAAM,iBAAiB,EAAE,OAgC9B,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,OAiBzB,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,OAiBxB,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,OAmC3B,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,OAelC,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,OAerC,CAAC;AAEH,eAAO,MAAM,6BAA6B,EAAE,OAe1C,CAAC;AAEH,eAAO,MAAM,+BAA+B,EAAE,OAe5C,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,OAehC,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,OAe5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,OAelC,CAAC;AAEH,eAAO,MAAM,gBAAgB,EAAE,OAe7B,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,OAepC,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,OASnC,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,OAS5B,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,OAStC,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,OAQ3B,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,OAQzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,OAO/B,CAAC;AAIH,eAAO,MAAM,gBAAgB,EAAE,OAS7B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,OAS3B,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,OAQlC,CAAC;AAIH,eAAO,MAAM,cAAc,EAAE,OAS3B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,OAS5B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,OAS5B,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EA6BxC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkspaceProfile } from '@shrkcrft/workspace';
|
|
2
2
|
import { definePreset } from "../define/define-preset.js";
|
|
3
|
-
import {
|
|
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
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
5
|
// ─── Core ──────────────────────────────────────────────────────────────────
|
|
6
6
|
export const GENERIC_SAFE_REPO = definePreset({
|
|
@@ -156,7 +156,7 @@ export const MODERN_ANGULAR = definePreset({
|
|
|
156
156
|
NG_ACCESSIBLE,
|
|
157
157
|
NG_AVOID_BYPASS_SECURITY,
|
|
158
158
|
],
|
|
159
|
-
paths: [
|
|
159
|
+
paths: [],
|
|
160
160
|
templates: [],
|
|
161
161
|
pipelines: [COMMON_PIPELINE_FEATURE_DEV],
|
|
162
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.') },
|
|
@@ -404,7 +404,7 @@ export const NESTJS_SERVICE = definePreset({
|
|
|
404
404
|
appliesTo: [WorkspaceProfile.HasNestJS, WorkspaceProfile.IsBackend],
|
|
405
405
|
weight: 7,
|
|
406
406
|
composes: ['node-service'],
|
|
407
|
-
includes: { knowledge: [], rules: [TS_VALIDATE_BOUNDARY_INPUT], paths: [
|
|
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
408
|
});
|
|
409
409
|
export const EXPRESS_SERVICE = definePreset({
|
|
410
410
|
id: 'express-service',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r45-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r45-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"r45-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r45-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAwBlD,eAAO,MAAM,eAAe,EAAE,OA+C5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,EAAE,OA+C7B,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,OAuCrC,CAAC;AAEH,eAAO,MAAM,4BAA4B,EAAE,OAoDzC,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EAKxC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkspaceProfile } from '@shrkcrft/workspace';
|
|
2
2
|
import { definePreset } from "../define/define-preset.js";
|
|
3
|
-
import { COMMON_AGENT_BRIEFING, COMMON_PATH_SERVICES, COMMON_PATH_TESTS, COMMON_PATH_UTILS, 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, COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_TEST, COMMON_TEMPLATE_UTILITY, OVERVIEW_DOC,
|
|
3
|
+
import { COMMON_AGENT_BRIEFING, COMMON_PATH_SERVICES, COMMON_PATH_TESTS, COMMON_PATH_UTILS, 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, COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_TEST, COMMON_TEMPLATE_UTILITY, OVERVIEW_DOC, } from "./shared-snippets.js";
|
|
4
4
|
// Universal adoption — fills four Phase-1 preset gaps:
|
|
5
5
|
// next-app, turborepo, package-workspace, clean-architecture-ts.
|
|
6
6
|
// Each preset is generic — no project-specific anchors, no per-stack jargon
|
|
@@ -80,7 +80,7 @@ export const TURBOREPO_PRESET = definePreset({
|
|
|
80
80
|
})`,
|
|
81
81
|
],
|
|
82
82
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_INTERFACE_PREFIX, COMMON_RULE_ONE_EXPORT],
|
|
83
|
-
paths: [
|
|
83
|
+
paths: [COMMON_PATH_SERVICES, COMMON_PATH_UTILS, COMMON_PATH_TESTS],
|
|
84
84
|
templates: [COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
85
85
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST],
|
|
86
86
|
docs: {
|
|
@@ -116,7 +116,7 @@ export const PACKAGE_WORKSPACE_PRESET = definePreset({
|
|
|
116
116
|
})`,
|
|
117
117
|
],
|
|
118
118
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_INTERFACE_PREFIX, COMMON_RULE_ONE_EXPORT],
|
|
119
|
-
paths: [
|
|
119
|
+
paths: [COMMON_PATH_SERVICES, COMMON_PATH_UTILS, COMMON_PATH_TESTS],
|
|
120
120
|
templates: [COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
121
121
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST],
|
|
122
122
|
docs: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r47-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r47-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"r47-presets.d.ts","sourceRoot":"","sources":["../../src/builtin/r47-presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAclD,eAAO,MAAM,mBAAmB,EAAE,OA2BhC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,OA2B/B,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EAGxC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkspaceProfile } from '@shrkcrft/workspace';
|
|
2
2
|
import { definePreset } from "../define/define-preset.js";
|
|
3
|
-
import {
|
|
3
|
+
import { COMMON_AGENT_BRIEFING, COMMON_SAFETY_RULE, OVERVIEW_DOC } from "./shared-snippets.js";
|
|
4
4
|
// Universal adoption (top 5) — canonical-id aliases.
|
|
5
5
|
//
|
|
6
6
|
// Why: canonical preset ids are `nest-service` and `angular-app`. The
|
|
@@ -22,7 +22,7 @@ export const NEST_SERVICE_PRESET = definePreset({
|
|
|
22
22
|
includes: {
|
|
23
23
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
24
24
|
rules: [COMMON_SAFETY_RULE],
|
|
25
|
-
paths: [
|
|
25
|
+
paths: [],
|
|
26
26
|
templates: [],
|
|
27
27
|
pipelines: [],
|
|
28
28
|
docs: {
|
|
@@ -46,7 +46,7 @@ export const ANGULAR_APP_PRESET = definePreset({
|
|
|
46
46
|
includes: {
|
|
47
47
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
48
48
|
rules: [COMMON_SAFETY_RULE],
|
|
49
|
-
paths: [
|
|
49
|
+
paths: [],
|
|
50
50
|
templates: [],
|
|
51
51
|
pipelines: [],
|
|
52
52
|
docs: {
|
|
@@ -7,31 +7,9 @@ export declare const COMMON_TEMPLATE_SERVICE = "defineTemplate({\n id: 'types
|
|
|
7
7
|
export declare const COMMON_TEMPLATE_UTILITY = "defineTemplate({\n id: 'typescript.utility',\n name: 'typescript-utility',\n description: 'A pure utility module (one exported function per file).',\n tags: ['typescript', 'utility'],\n scope: ['app'],\n appliesWhen: ['generate-utility'],\n variables: [\n {\n name: 'functionName',\n required: true,\n description: 'camelCase function name (e.g. formatDate).',\n pattern: /^[a-z][A-Za-z0-9]+$/,\n },\n ],\n targetPath: (v) => `src/utils/${v.functionName}.ts`,\n content: (v) => `export function ${v.functionName}(): void {\\n // TODO\\n}\\n`,\n })";
|
|
8
8
|
export declare const COMMON_TEMPLATE_TEST = "defineTemplate({\n id: 'typescript.unit-test',\n name: 'typescript-unit-test',\n description: 'A bun:test unit-test skeleton for an existing module.',\n tags: ['typescript', 'testing'],\n scope: ['app'],\n appliesWhen: ['generate-test'],\n variables: [\n {\n name: 'subject',\n required: true,\n description: 'Subject name (used in describe + filename).',\n pattern: /^[A-Za-z][A-Za-z0-9]+$/,\n },\n ],\n targetPath: (v) => `tests/${v.subject}.spec.ts`,\n content: (v) =>\n `import { describe, expect, test } from 'bun:test';\\n\\ndescribe('${v.subject}', () => {\\n test('placeholder', () => {\\n expect(true).toBe(true);\\n });\\n});\\n`,\n })";
|
|
9
9
|
export declare const TEMPLATE_HELPERS = "function kebab(s: string): string {\n return s\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/[^A-Za-z0-9]+/g, '-')\n .toLowerCase();\n}";
|
|
10
|
-
export declare const COMMON_PATH_SERVICES = "defineKnowledgeEntry({\n id: 'paths.services',\n title: 'Services live in src/services/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'services'],\n scope: ['app'],\n appliesWhen: ['generate-service'],\n content: 'Service classes live in src/services/. One service per file.',\n
|
|
11
|
-
export declare const COMMON_PATH_UTILS = "defineKnowledgeEntry({\n id: 'paths.utils',\n title: 'Utilities live in src/utils/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'utils'],\n appliesWhen: ['generate-utility'],\n content: 'Pure helpers live in src/utils/. One function per file.',\n
|
|
12
|
-
export declare const COMMON_PATH_TESTS = "defineKnowledgeEntry({\n id: 'paths.tests',\n title: 'Tests live in tests/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'tests'],\n appliesWhen: ['generate-test'],\n content: 'Unit tests live under tests/, mirroring src/. Use *.spec.ts.',\n
|
|
13
|
-
export declare const NX_PATH_LIBS = "defineKnowledgeEntry({\n id: 'paths.nx.libs',\n title: 'Nx libs root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'nx', 'libs'],\n scope: ['nx', 'monorepo'],\n appliesWhen: ['generate-service', 'generate-utility', 'create-feature'],\n content: 'Shared library code lives under libs/<area>/src/lib/. Each lib has a public index.ts; cross-lib imports go through the package name, never relative paths into src/.',\n metadata: { path: 'libs' },\n })";
|
|
14
|
-
export declare const NX_PATH_APPS = "defineKnowledgeEntry({\n id: 'paths.nx.apps',\n title: 'Nx apps root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'nx', 'apps'],\n scope: ['nx', 'monorepo'],\n appliesWhen: ['create-feature', 'create-app'],\n content: 'Applications live under apps/<app>/. Frontends use apps/<app>/src/app/; backends use apps/<app>/src/. Keep app-specific code here and shared code in libs/.',\n metadata: { path: 'apps' },\n })";
|
|
15
|
-
export declare const WORKSPACE_PATH_PACKAGES = "defineKnowledgeEntry({\n id: 'paths.workspace.packages',\n title: 'Workspace packages root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'workspaces', 'monorepo'],\n scope: ['monorepo', 'turborepo', 'workspaces'],\n appliesWhen: ['generate-code', 'create-feature'],\n content: 'Shared packages live under packages/<name>/. Each package exposes a stable public entry (package.json main/exports); cross-package imports go through the package name, never relative paths into src/.',\n metadata: { path: 'packages' },\n })";
|
|
16
|
-
export declare const WORKSPACE_PATH_APPS = "defineKnowledgeEntry({\n id: 'paths.workspace.apps',\n title: 'Workspace apps root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'workspaces', 'monorepo'],\n scope: ['monorepo', 'turborepo', 'workspaces'],\n appliesWhen: ['create-feature', 'create-app'],\n content: 'Applications live under apps/<app>/. Each app has its own src/ root and depends on shared packages by name.',\n metadata: { path: 'apps' },\n })";
|
|
17
|
-
export declare const ANGULAR_PATH_APP = "defineKnowledgeEntry({\n id: 'paths.angular.app',\n title: 'Angular app root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Critical,\n tags: ['paths', 'angular', 'app'],\n scope: ['angular'],\n appliesWhen: ['create-feature', 'generate-code'],\n content: 'Angular workspace source lives under src/app/. Components, services, pipes and modules sit under here. Tests are co-located as *.spec.ts beside the unit under test.',\n metadata: { path: 'src/app' },\n })";
|
|
18
|
-
export declare const ANGULAR_PATH_COMPONENTS = "defineKnowledgeEntry({\n id: 'paths.angular.components',\n title: 'Angular components',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'angular', 'components'],\n scope: ['angular'],\n appliesWhen: ['generate-component'],\n content: 'Components live under src/app/components/ or src/app/<feature>/. Use the .component.ts suffix. Pair each component with a co-located *.spec.ts test.',\n metadata: { path: 'src/app/components' },\n })";
|
|
19
|
-
export declare const ANGULAR_PATH_SERVICES = "defineKnowledgeEntry({\n id: 'paths.angular.services',\n title: 'Angular services',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'angular', 'services'],\n scope: ['angular'],\n appliesWhen: ['generate-service'],\n content: 'Injectable services live under src/app/services/ (or alongside their feature folder). Use the .service.ts suffix. Provide via providedIn root unless feature-scoped.',\n metadata: { path: 'src/app/services' },\n })";
|
|
20
|
-
export declare const REACT_PATH_COMPONENTS = "defineKnowledgeEntry({\n id: 'paths.react.components',\n title: 'React components',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'react', 'components'],\n scope: ['react'],\n appliesWhen: ['generate-component'],\n content: 'Components live under src/components/ (cross-feature shared) or under their feature folder. Keep each component in its own file; pair with a co-located *.test.tsx beside it.',\n metadata: { path: 'src/components' },\n })";
|
|
21
|
-
export declare const REACT_PATH_HOOKS = "defineKnowledgeEntry({\n id: 'paths.react.hooks',\n title: 'React custom hooks',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'react', 'hooks'],\n scope: ['react'],\n appliesWhen: ['generate-hook'],\n content: 'Custom hooks live under src/hooks/ (cross-feature) or under their feature folder. File and exported function are both named useX. Co-locate the test as useX.test.ts beside the hook.',\n metadata: { path: 'src/hooks' },\n })";
|
|
22
|
-
export declare const REACT_PATH_PAGES = "defineKnowledgeEntry({\n id: 'paths.react.pages',\n title: 'React route / page components',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'react', 'pages', 'routing'],\n scope: ['react'],\n appliesWhen: ['create-feature', 'add-route'],\n content: 'Top-level route components live under src/pages/ (React Router / TanStack Router convention) or under src/routes/. For Next.js app router, see src/app/<segment>/page.tsx instead \u2014 adjust this entry if your project uses that layout.',\n metadata: { path: 'src/pages' },\n })";
|
|
23
|
-
export declare const REACT_PATH_LIB = "defineKnowledgeEntry({\n id: 'paths.react.lib',\n title: 'React app utilities + clients',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'react', 'lib'],\n scope: ['react'],\n appliesWhen: ['generate-utility', 'generate-code'],\n content: 'Framework-agnostic helpers (formatters, validators, API clients) live under src/lib/. Keep them pure \u2014 no React imports unless the helper is a hook (in which case it belongs under src/hooks/).',\n metadata: { path: 'src/lib' },\n })";
|
|
24
|
-
export declare const NEST_PATH_SRC = "defineKnowledgeEntry({\n id: 'paths.nest.src',\n title: 'Nest module roots',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Critical,\n tags: ['paths', 'nest', 'modules'],\n scope: ['nestjs'],\n appliesWhen: ['create-feature', 'generate-service', 'generate-code'],\n content: 'Nest source lives under src/. Each feature gets a folder src/<feature>/ containing controller, service, module, and DTOs (one construct per file). Controllers stay thin; business logic lives in services.',\n metadata: { path: 'src' },\n })";
|
|
25
|
-
export declare const NEST_PATH_E2E = "defineKnowledgeEntry({\n id: 'paths.nest.e2e',\n title: 'Nest e2e tests',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'nest', 'testing'],\n scope: ['nestjs'],\n appliesWhen: ['generate-test'],\n content: 'End-to-end tests live under test/ (Nest convention, not tests/). Unit tests can be co-located as *.spec.ts next to the unit.',\n metadata: { path: 'test' },\n })";
|
|
26
|
-
export declare const JAVA_MAVEN_PATH_MAIN = "defineKnowledgeEntry({\n id: 'paths.java.maven.main',\n title: 'Java Maven main source',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Critical,\n tags: ['paths', 'java', 'maven'],\n scope: ['java', 'maven'],\n appliesWhen: ['generate-code'],\n content: 'Main Java source lives under src/main/java/<package>/. Resources under src/main/resources/. Mirror tests under src/test/java/.',\n metadata: { path: 'src/main/java' },\n })";
|
|
27
|
-
export declare const JAVA_MAVEN_PATH_TESTS = "defineKnowledgeEntry({\n id: 'paths.java.maven.tests',\n title: 'Java Maven tests',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'java', 'maven', 'tests'],\n scope: ['java', 'maven'],\n appliesWhen: ['generate-test'],\n content: 'JUnit / Spring tests live under src/test/java/. Run via mvn test.',\n metadata: { path: 'src/test/java' },\n })";
|
|
28
|
-
export declare const PYTHON_PATH_SRC = "defineKnowledgeEntry({\n id: 'paths.python.src',\n title: 'Python source root',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Critical,\n tags: ['paths', 'python'],\n scope: ['python'],\n appliesWhen: ['generate-code'],\n content: 'Source lives under src/<package>/ (PEP 517 src layout) or directly under <package>/ at the repo root. Pick one and stay consistent.',\n metadata: { path: 'src' },\n })";
|
|
29
|
-
export declare const PYTHON_PATH_TESTS = "defineKnowledgeEntry({\n id: 'paths.python.tests',\n title: 'Python tests',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'python', 'tests'],\n scope: ['python'],\n appliesWhen: ['generate-test'],\n content: 'Pytest tests live under tests/. Each test_*.py mirrors a module under src/.',\n metadata: { path: 'tests' },\n })";
|
|
30
|
-
export declare const GO_PATH_CMD = "defineKnowledgeEntry({\n id: 'paths.go.cmd',\n title: 'Go entry points',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'go'],\n scope: ['go'],\n appliesWhen: ['create-app'],\n content: 'Binary entry points live under cmd/<name>/main.go. Shared library code under pkg/ (public) or internal/ (module-private).',\n metadata: { path: 'cmd' },\n })";
|
|
31
|
-
export declare const GO_PATH_PKG = "defineKnowledgeEntry({\n id: 'paths.go.pkg',\n title: 'Go shared packages',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'go'],\n scope: ['go'],\n appliesWhen: ['generate-code'],\n content: 'Public packages live under pkg/<name>/. Tests are co-located as <name>_test.go. Run via go test ./...',\n metadata: { path: 'pkg' },\n })";
|
|
32
|
-
export declare const GO_PATH_INTERNAL = "defineKnowledgeEntry({\n id: 'paths.go.internal',\n title: 'Go internal packages',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'go'],\n scope: ['go'],\n appliesWhen: ['generate-code'],\n content: 'Module-private packages live under internal/<name>/. The Go compiler enforces that only the parent module can import these.',\n metadata: { path: 'internal' },\n })";
|
|
33
|
-
export declare const RUST_PATH_SRC = "defineKnowledgeEntry({\n id: 'paths.rust.src',\n title: 'Rust crate source',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Critical,\n tags: ['paths', 'rust'],\n scope: ['rust'],\n appliesWhen: ['generate-code'],\n content: 'Crate source lives under src/. The entry point is src/lib.rs (library) or src/main.rs (binary). Modules nest as src/<mod>/mod.rs or src/<mod>.rs.',\n metadata: { path: 'src' },\n })";
|
|
34
|
-
export declare const RUST_PATH_TESTS = "defineKnowledgeEntry({\n id: 'paths.rust.tests',\n title: 'Rust integration tests',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'rust', 'tests'],\n scope: ['rust'],\n appliesWhen: ['generate-test'],\n content: 'Integration tests live under tests/<name>.rs. Unit tests live inline with #[cfg(test)] modules inside src/. Run via cargo test.',\n metadata: { path: 'tests' },\n })";
|
|
10
|
+
export declare const COMMON_PATH_SERVICES = "defineKnowledgeEntry({\n id: 'paths.services',\n title: 'Services live in src/services/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.High,\n tags: ['paths', 'services'],\n scope: ['app'],\n appliesWhen: ['generate-service'],\n content: 'Service classes live in src/services/. One service per file.',\n })";
|
|
11
|
+
export declare const COMMON_PATH_UTILS = "defineKnowledgeEntry({\n id: 'paths.utils',\n title: 'Utilities live in src/utils/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'utils'],\n appliesWhen: ['generate-utility'],\n content: 'Pure helpers live in src/utils/. One function per file.',\n })";
|
|
12
|
+
export declare const COMMON_PATH_TESTS = "defineKnowledgeEntry({\n id: 'paths.tests',\n title: 'Tests live in tests/',\n type: KnowledgeType.Path,\n priority: KnowledgePriority.Medium,\n tags: ['paths', 'tests'],\n appliesWhen: ['generate-test'],\n content: 'Unit tests live under tests/, mirroring src/. Use *.spec.ts.',\n })";
|
|
35
13
|
export declare const COMMON_RULE_INTERFACE_PREFIX = "defineKnowledgeEntry({\n id: 'typescript.interfaces.i-prefix',\n title: 'Prefix interfaces with I',\n type: KnowledgeType.Rule,\n priority: KnowledgePriority.High,\n tags: ['typescript', 'naming'],\n appliesWhen: ['generate-code', 'refactor'],\n content: 'Interfaces use an I-prefix (IUser, IConfig). Enums are preferred over unions for closed sets.',\n })";
|
|
36
14
|
export declare const COMMON_RULE_ONE_EXPORT = "defineKnowledgeEntry({\n id: 'typescript.files.one-export',\n title: 'One exported construct per file',\n type: KnowledgeType.Rule,\n priority: KnowledgePriority.High,\n tags: ['typescript', 'structure'],\n appliesWhen: ['generate-code'],\n content: 'Each TypeScript file exports exactly one top-level construct. Helpers live in their own file.',\n })";
|
|
37
15
|
export declare const COMMON_RULE_NO_LOGIC_CONSTRUCTORS = "defineKnowledgeEntry({\n id: 'typescript.constructors.no-logic',\n title: 'No business logic in constructors',\n type: KnowledgeType.Rule,\n priority: KnowledgePriority.High,\n tags: ['typescript'],\n appliesWhen: ['generate-code'],\n content: 'Constructors wire dependencies only. Initialization belongs in init().',\n })";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-snippets.d.ts","sourceRoot":"","sources":["../../src/builtin/shared-snippets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,m9BAuB7B,CAAC;AAEN,eAAO,MAAM,kBAAkB,45BAoB1B,CAAC;AAEN,eAAO,MAAM,2BAA2B,s9CA6CnC,CAAC;AAEN,eAAO,MAAM,4BAA4B,s5BA6BpC,CAAC;AAEN,eAAO,MAAM,yBAAyB,yVAajC,CAAC;AAEN,eAAO,MAAM,uBAAuB,mtBAkB/B,CAAC;AAEN,eAAO,MAAM,uBAAuB,8mBAiB/B,CAAC;AAEN,eAAO,MAAM,oBAAoB,ytBAkB5B,CAAC;AAKN,eAAO,MAAM,gBAAgB,8JAK3B,CAAC;AAEH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"shared-snippets.d.ts","sourceRoot":"","sources":["../../src/builtin/shared-snippets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,m9BAuB7B,CAAC;AAEN,eAAO,MAAM,kBAAkB,45BAoB1B,CAAC;AAEN,eAAO,MAAM,2BAA2B,s9CA6CnC,CAAC;AAEN,eAAO,MAAM,4BAA4B,s5BA6BpC,CAAC;AAEN,eAAO,MAAM,yBAAyB,yVAajC,CAAC;AAEN,eAAO,MAAM,uBAAuB,mtBAkB/B,CAAC;AAEN,eAAO,MAAM,uBAAuB,8mBAiB/B,CAAC;AAEN,eAAO,MAAM,oBAAoB,ytBAkB5B,CAAC;AAKN,eAAO,MAAM,gBAAgB,8JAK3B,CAAC;AAEH,eAAO,MAAM,oBAAoB,6VAS5B,CAAC;AAEN,eAAO,MAAM,iBAAiB,6TAQzB,CAAC;AAEN,eAAO,MAAM,iBAAiB,uTAQzB,CAAC;AAEN,eAAO,MAAM,4BAA4B,+XAQpC,CAAC;AAEN,eAAO,MAAM,sBAAsB,0XAQ9B,CAAC;AAEN,eAAO,MAAM,iCAAiC,6VAQzC,CAAC;AAEN,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,KAAG,MAK1D,CAAC"}
|
|
@@ -210,7 +210,6 @@ export const COMMON_PATH_SERVICES = `defineKnowledgeEntry({
|
|
|
210
210
|
scope: ['app'],
|
|
211
211
|
appliesWhen: ['generate-service'],
|
|
212
212
|
content: 'Service classes live in src/services/. One service per file.',
|
|
213
|
-
metadata: { path: 'src/services' },
|
|
214
213
|
})`;
|
|
215
214
|
export const COMMON_PATH_UTILS = `defineKnowledgeEntry({
|
|
216
215
|
id: 'paths.utils',
|
|
@@ -220,7 +219,6 @@ export const COMMON_PATH_UTILS = `defineKnowledgeEntry({
|
|
|
220
219
|
tags: ['paths', 'utils'],
|
|
221
220
|
appliesWhen: ['generate-utility'],
|
|
222
221
|
content: 'Pure helpers live in src/utils/. One function per file.',
|
|
223
|
-
metadata: { path: 'src/utils' },
|
|
224
222
|
})`;
|
|
225
223
|
export const COMMON_PATH_TESTS = `defineKnowledgeEntry({
|
|
226
224
|
id: 'paths.tests',
|
|
@@ -230,269 +228,6 @@ export const COMMON_PATH_TESTS = `defineKnowledgeEntry({
|
|
|
230
228
|
tags: ['paths', 'tests'],
|
|
231
229
|
appliesWhen: ['generate-test'],
|
|
232
230
|
content: 'Unit tests live under tests/, mirroring src/. Use *.spec.ts.',
|
|
233
|
-
metadata: { path: 'tests' },
|
|
234
|
-
})`;
|
|
235
|
-
// ─── Framework-specific path snippets ─────────────────────────────────────
|
|
236
|
-
//
|
|
237
|
-
// Each snippet uses the structured `metadata: { path: '<x>' }` field so
|
|
238
|
-
// the init paths-advisory annotator can verify the path against the live
|
|
239
|
-
// workspace. When an entry is emitted into a fresh repo whose layout
|
|
240
|
-
// doesn't match, the user sees a `⚠️ Workspace-shape advisory` block
|
|
241
|
-
// listing the absent paths.
|
|
242
|
-
// Nx workspaces — `libs/<area>/src/lib/<feature>.service.ts`,
|
|
243
|
-
// `apps/<app>/src/app/`. The exact lib/app folder names are
|
|
244
|
-
// project-specific; we point at the roots.
|
|
245
|
-
export const NX_PATH_LIBS = `defineKnowledgeEntry({
|
|
246
|
-
id: 'paths.nx.libs',
|
|
247
|
-
title: 'Nx libs root',
|
|
248
|
-
type: KnowledgeType.Path,
|
|
249
|
-
priority: KnowledgePriority.High,
|
|
250
|
-
tags: ['paths', 'nx', 'libs'],
|
|
251
|
-
scope: ['nx', 'monorepo'],
|
|
252
|
-
appliesWhen: ['generate-service', 'generate-utility', 'create-feature'],
|
|
253
|
-
content: 'Shared library code lives under libs/<area>/src/lib/. Each lib has a public index.ts; cross-lib imports go through the package name, never relative paths into src/.',
|
|
254
|
-
metadata: { path: 'libs' },
|
|
255
|
-
})`;
|
|
256
|
-
export const NX_PATH_APPS = `defineKnowledgeEntry({
|
|
257
|
-
id: 'paths.nx.apps',
|
|
258
|
-
title: 'Nx apps root',
|
|
259
|
-
type: KnowledgeType.Path,
|
|
260
|
-
priority: KnowledgePriority.High,
|
|
261
|
-
tags: ['paths', 'nx', 'apps'],
|
|
262
|
-
scope: ['nx', 'monorepo'],
|
|
263
|
-
appliesWhen: ['create-feature', 'create-app'],
|
|
264
|
-
content: 'Applications live under apps/<app>/. Frontends use apps/<app>/src/app/; backends use apps/<app>/src/. Keep app-specific code here and shared code in libs/.',
|
|
265
|
-
metadata: { path: 'apps' },
|
|
266
|
-
})`;
|
|
267
|
-
// Generic workspace monorepo (Turborepo, pnpm/yarn/npm workspaces): the
|
|
268
|
-
// idiomatic layout is `apps/` + `packages/` rather than Nx's `libs/`.
|
|
269
|
-
export const WORKSPACE_PATH_PACKAGES = `defineKnowledgeEntry({
|
|
270
|
-
id: 'paths.workspace.packages',
|
|
271
|
-
title: 'Workspace packages root',
|
|
272
|
-
type: KnowledgeType.Path,
|
|
273
|
-
priority: KnowledgePriority.High,
|
|
274
|
-
tags: ['paths', 'workspaces', 'monorepo'],
|
|
275
|
-
scope: ['monorepo', 'turborepo', 'workspaces'],
|
|
276
|
-
appliesWhen: ['generate-code', 'create-feature'],
|
|
277
|
-
content: 'Shared packages live under packages/<name>/. Each package exposes a stable public entry (package.json main/exports); cross-package imports go through the package name, never relative paths into src/.',
|
|
278
|
-
metadata: { path: 'packages' },
|
|
279
|
-
})`;
|
|
280
|
-
export const WORKSPACE_PATH_APPS = `defineKnowledgeEntry({
|
|
281
|
-
id: 'paths.workspace.apps',
|
|
282
|
-
title: 'Workspace apps root',
|
|
283
|
-
type: KnowledgeType.Path,
|
|
284
|
-
priority: KnowledgePriority.High,
|
|
285
|
-
tags: ['paths', 'workspaces', 'monorepo'],
|
|
286
|
-
scope: ['monorepo', 'turborepo', 'workspaces'],
|
|
287
|
-
appliesWhen: ['create-feature', 'create-app'],
|
|
288
|
-
content: 'Applications live under apps/<app>/. Each app has its own src/ root and depends on shared packages by name.',
|
|
289
|
-
metadata: { path: 'apps' },
|
|
290
|
-
})`;
|
|
291
|
-
// Single-app Angular workspaces — angular.json + src/app convention.
|
|
292
|
-
export const ANGULAR_PATH_APP = `defineKnowledgeEntry({
|
|
293
|
-
id: 'paths.angular.app',
|
|
294
|
-
title: 'Angular app root',
|
|
295
|
-
type: KnowledgeType.Path,
|
|
296
|
-
priority: KnowledgePriority.Critical,
|
|
297
|
-
tags: ['paths', 'angular', 'app'],
|
|
298
|
-
scope: ['angular'],
|
|
299
|
-
appliesWhen: ['create-feature', 'generate-code'],
|
|
300
|
-
content: 'Angular workspace source lives under src/app/. Components, services, pipes and modules sit under here. Tests are co-located as *.spec.ts beside the unit under test.',
|
|
301
|
-
metadata: { path: 'src/app' },
|
|
302
|
-
})`;
|
|
303
|
-
export const ANGULAR_PATH_COMPONENTS = `defineKnowledgeEntry({
|
|
304
|
-
id: 'paths.angular.components',
|
|
305
|
-
title: 'Angular components',
|
|
306
|
-
type: KnowledgeType.Path,
|
|
307
|
-
priority: KnowledgePriority.High,
|
|
308
|
-
tags: ['paths', 'angular', 'components'],
|
|
309
|
-
scope: ['angular'],
|
|
310
|
-
appliesWhen: ['generate-component'],
|
|
311
|
-
content: 'Components live under src/app/components/ or src/app/<feature>/. Use the .component.ts suffix. Pair each component with a co-located *.spec.ts test.',
|
|
312
|
-
metadata: { path: 'src/app/components' },
|
|
313
|
-
})`;
|
|
314
|
-
export const ANGULAR_PATH_SERVICES = `defineKnowledgeEntry({
|
|
315
|
-
id: 'paths.angular.services',
|
|
316
|
-
title: 'Angular services',
|
|
317
|
-
type: KnowledgeType.Path,
|
|
318
|
-
priority: KnowledgePriority.High,
|
|
319
|
-
tags: ['paths', 'angular', 'services'],
|
|
320
|
-
scope: ['angular'],
|
|
321
|
-
appliesWhen: ['generate-service'],
|
|
322
|
-
content: 'Injectable services live under src/app/services/ (or alongside their feature folder). Use the .service.ts suffix. Provide via providedIn root unless feature-scoped.',
|
|
323
|
-
metadata: { path: 'src/app/services' },
|
|
324
|
-
})`;
|
|
325
|
-
// React workspaces — many flavors (Vite SPA, Next.js, Remix). The
|
|
326
|
-
// snippets below cover the most common SPA layout (src/components,
|
|
327
|
-
// src/hooks, src/pages, src/lib). Frameworks that follow a different
|
|
328
|
-
// convention (e.g. Next.js app router under app/) will trigger the
|
|
329
|
-
// init paths-advisory; the user is expected to swap them at that point.
|
|
330
|
-
export const REACT_PATH_COMPONENTS = `defineKnowledgeEntry({
|
|
331
|
-
id: 'paths.react.components',
|
|
332
|
-
title: 'React components',
|
|
333
|
-
type: KnowledgeType.Path,
|
|
334
|
-
priority: KnowledgePriority.High,
|
|
335
|
-
tags: ['paths', 'react', 'components'],
|
|
336
|
-
scope: ['react'],
|
|
337
|
-
appliesWhen: ['generate-component'],
|
|
338
|
-
content: 'Components live under src/components/ (cross-feature shared) or under their feature folder. Keep each component in its own file; pair with a co-located *.test.tsx beside it.',
|
|
339
|
-
metadata: { path: 'src/components' },
|
|
340
|
-
})`;
|
|
341
|
-
export const REACT_PATH_HOOKS = `defineKnowledgeEntry({
|
|
342
|
-
id: 'paths.react.hooks',
|
|
343
|
-
title: 'React custom hooks',
|
|
344
|
-
type: KnowledgeType.Path,
|
|
345
|
-
priority: KnowledgePriority.High,
|
|
346
|
-
tags: ['paths', 'react', 'hooks'],
|
|
347
|
-
scope: ['react'],
|
|
348
|
-
appliesWhen: ['generate-hook'],
|
|
349
|
-
content: 'Custom hooks live under src/hooks/ (cross-feature) or under their feature folder. File and exported function are both named useX. Co-locate the test as useX.test.ts beside the hook.',
|
|
350
|
-
metadata: { path: 'src/hooks' },
|
|
351
|
-
})`;
|
|
352
|
-
export const REACT_PATH_PAGES = `defineKnowledgeEntry({
|
|
353
|
-
id: 'paths.react.pages',
|
|
354
|
-
title: 'React route / page components',
|
|
355
|
-
type: KnowledgeType.Path,
|
|
356
|
-
priority: KnowledgePriority.Medium,
|
|
357
|
-
tags: ['paths', 'react', 'pages', 'routing'],
|
|
358
|
-
scope: ['react'],
|
|
359
|
-
appliesWhen: ['create-feature', 'add-route'],
|
|
360
|
-
content: 'Top-level route components live under src/pages/ (React Router / TanStack Router convention) or under src/routes/. For Next.js app router, see src/app/<segment>/page.tsx instead — adjust this entry if your project uses that layout.',
|
|
361
|
-
metadata: { path: 'src/pages' },
|
|
362
|
-
})`;
|
|
363
|
-
export const REACT_PATH_LIB = `defineKnowledgeEntry({
|
|
364
|
-
id: 'paths.react.lib',
|
|
365
|
-
title: 'React app utilities + clients',
|
|
366
|
-
type: KnowledgeType.Path,
|
|
367
|
-
priority: KnowledgePriority.Medium,
|
|
368
|
-
tags: ['paths', 'react', 'lib'],
|
|
369
|
-
scope: ['react'],
|
|
370
|
-
appliesWhen: ['generate-utility', 'generate-code'],
|
|
371
|
-
content: 'Framework-agnostic helpers (formatters, validators, API clients) live under src/lib/. Keep them pure — no React imports unless the helper is a hook (in which case it belongs under src/hooks/).',
|
|
372
|
-
metadata: { path: 'src/lib' },
|
|
373
|
-
})`;
|
|
374
|
-
// NestJS services — module-per-folder convention; e2e tests in `test/`.
|
|
375
|
-
export const NEST_PATH_SRC = `defineKnowledgeEntry({
|
|
376
|
-
id: 'paths.nest.src',
|
|
377
|
-
title: 'Nest module roots',
|
|
378
|
-
type: KnowledgeType.Path,
|
|
379
|
-
priority: KnowledgePriority.Critical,
|
|
380
|
-
tags: ['paths', 'nest', 'modules'],
|
|
381
|
-
scope: ['nestjs'],
|
|
382
|
-
appliesWhen: ['create-feature', 'generate-service', 'generate-code'],
|
|
383
|
-
content: 'Nest source lives under src/. Each feature gets a folder src/<feature>/ containing controller, service, module, and DTOs (one construct per file). Controllers stay thin; business logic lives in services.',
|
|
384
|
-
metadata: { path: 'src' },
|
|
385
|
-
})`;
|
|
386
|
-
export const NEST_PATH_E2E = `defineKnowledgeEntry({
|
|
387
|
-
id: 'paths.nest.e2e',
|
|
388
|
-
title: 'Nest e2e tests',
|
|
389
|
-
type: KnowledgeType.Path,
|
|
390
|
-
priority: KnowledgePriority.Medium,
|
|
391
|
-
tags: ['paths', 'nest', 'testing'],
|
|
392
|
-
scope: ['nestjs'],
|
|
393
|
-
appliesWhen: ['generate-test'],
|
|
394
|
-
content: 'End-to-end tests live under test/ (Nest convention, not tests/). Unit tests can be co-located as *.spec.ts next to the unit.',
|
|
395
|
-
metadata: { path: 'test' },
|
|
396
|
-
})`;
|
|
397
|
-
// ─── Polyglot path snippets ──────────────────────────────────────────────
|
|
398
|
-
export const JAVA_MAVEN_PATH_MAIN = `defineKnowledgeEntry({
|
|
399
|
-
id: 'paths.java.maven.main',
|
|
400
|
-
title: 'Java Maven main source',
|
|
401
|
-
type: KnowledgeType.Path,
|
|
402
|
-
priority: KnowledgePriority.Critical,
|
|
403
|
-
tags: ['paths', 'java', 'maven'],
|
|
404
|
-
scope: ['java', 'maven'],
|
|
405
|
-
appliesWhen: ['generate-code'],
|
|
406
|
-
content: 'Main Java source lives under src/main/java/<package>/. Resources under src/main/resources/. Mirror tests under src/test/java/.',
|
|
407
|
-
metadata: { path: 'src/main/java' },
|
|
408
|
-
})`;
|
|
409
|
-
export const JAVA_MAVEN_PATH_TESTS = `defineKnowledgeEntry({
|
|
410
|
-
id: 'paths.java.maven.tests',
|
|
411
|
-
title: 'Java Maven tests',
|
|
412
|
-
type: KnowledgeType.Path,
|
|
413
|
-
priority: KnowledgePriority.High,
|
|
414
|
-
tags: ['paths', 'java', 'maven', 'tests'],
|
|
415
|
-
scope: ['java', 'maven'],
|
|
416
|
-
appliesWhen: ['generate-test'],
|
|
417
|
-
content: 'JUnit / Spring tests live under src/test/java/. Run via mvn test.',
|
|
418
|
-
metadata: { path: 'src/test/java' },
|
|
419
|
-
})`;
|
|
420
|
-
export const PYTHON_PATH_SRC = `defineKnowledgeEntry({
|
|
421
|
-
id: 'paths.python.src',
|
|
422
|
-
title: 'Python source root',
|
|
423
|
-
type: KnowledgeType.Path,
|
|
424
|
-
priority: KnowledgePriority.Critical,
|
|
425
|
-
tags: ['paths', 'python'],
|
|
426
|
-
scope: ['python'],
|
|
427
|
-
appliesWhen: ['generate-code'],
|
|
428
|
-
content: 'Source lives under src/<package>/ (PEP 517 src layout) or directly under <package>/ at the repo root. Pick one and stay consistent.',
|
|
429
|
-
metadata: { path: 'src' },
|
|
430
|
-
})`;
|
|
431
|
-
export const PYTHON_PATH_TESTS = `defineKnowledgeEntry({
|
|
432
|
-
id: 'paths.python.tests',
|
|
433
|
-
title: 'Python tests',
|
|
434
|
-
type: KnowledgeType.Path,
|
|
435
|
-
priority: KnowledgePriority.High,
|
|
436
|
-
tags: ['paths', 'python', 'tests'],
|
|
437
|
-
scope: ['python'],
|
|
438
|
-
appliesWhen: ['generate-test'],
|
|
439
|
-
content: 'Pytest tests live under tests/. Each test_*.py mirrors a module under src/.',
|
|
440
|
-
metadata: { path: 'tests' },
|
|
441
|
-
})`;
|
|
442
|
-
export const GO_PATH_CMD = `defineKnowledgeEntry({
|
|
443
|
-
id: 'paths.go.cmd',
|
|
444
|
-
title: 'Go entry points',
|
|
445
|
-
type: KnowledgeType.Path,
|
|
446
|
-
priority: KnowledgePriority.High,
|
|
447
|
-
tags: ['paths', 'go'],
|
|
448
|
-
scope: ['go'],
|
|
449
|
-
appliesWhen: ['create-app'],
|
|
450
|
-
content: 'Binary entry points live under cmd/<name>/main.go. Shared library code under pkg/ (public) or internal/ (module-private).',
|
|
451
|
-
metadata: { path: 'cmd' },
|
|
452
|
-
})`;
|
|
453
|
-
export const GO_PATH_PKG = `defineKnowledgeEntry({
|
|
454
|
-
id: 'paths.go.pkg',
|
|
455
|
-
title: 'Go shared packages',
|
|
456
|
-
type: KnowledgeType.Path,
|
|
457
|
-
priority: KnowledgePriority.Medium,
|
|
458
|
-
tags: ['paths', 'go'],
|
|
459
|
-
scope: ['go'],
|
|
460
|
-
appliesWhen: ['generate-code'],
|
|
461
|
-
content: 'Public packages live under pkg/<name>/. Tests are co-located as <name>_test.go. Run via go test ./...',
|
|
462
|
-
metadata: { path: 'pkg' },
|
|
463
|
-
})`;
|
|
464
|
-
export const GO_PATH_INTERNAL = `defineKnowledgeEntry({
|
|
465
|
-
id: 'paths.go.internal',
|
|
466
|
-
title: 'Go internal packages',
|
|
467
|
-
type: KnowledgeType.Path,
|
|
468
|
-
priority: KnowledgePriority.Medium,
|
|
469
|
-
tags: ['paths', 'go'],
|
|
470
|
-
scope: ['go'],
|
|
471
|
-
appliesWhen: ['generate-code'],
|
|
472
|
-
content: 'Module-private packages live under internal/<name>/. The Go compiler enforces that only the parent module can import these.',
|
|
473
|
-
metadata: { path: 'internal' },
|
|
474
|
-
})`;
|
|
475
|
-
export const RUST_PATH_SRC = `defineKnowledgeEntry({
|
|
476
|
-
id: 'paths.rust.src',
|
|
477
|
-
title: 'Rust crate source',
|
|
478
|
-
type: KnowledgeType.Path,
|
|
479
|
-
priority: KnowledgePriority.Critical,
|
|
480
|
-
tags: ['paths', 'rust'],
|
|
481
|
-
scope: ['rust'],
|
|
482
|
-
appliesWhen: ['generate-code'],
|
|
483
|
-
content: 'Crate source lives under src/. The entry point is src/lib.rs (library) or src/main.rs (binary). Modules nest as src/<mod>/mod.rs or src/<mod>.rs.',
|
|
484
|
-
metadata: { path: 'src' },
|
|
485
|
-
})`;
|
|
486
|
-
export const RUST_PATH_TESTS = `defineKnowledgeEntry({
|
|
487
|
-
id: 'paths.rust.tests',
|
|
488
|
-
title: 'Rust integration tests',
|
|
489
|
-
type: KnowledgeType.Path,
|
|
490
|
-
priority: KnowledgePriority.Medium,
|
|
491
|
-
tags: ['paths', 'rust', 'tests'],
|
|
492
|
-
scope: ['rust'],
|
|
493
|
-
appliesWhen: ['generate-test'],
|
|
494
|
-
content: 'Integration tests live under tests/<name>.rs. Unit tests live inline with #[cfg(test)] modules inside src/. Run via cargo test.',
|
|
495
|
-
metadata: { path: 'tests' },
|
|
496
231
|
})`;
|
|
497
232
|
export const COMMON_RULE_INTERFACE_PREFIX = `defineKnowledgeEntry({
|
|
498
233
|
id: 'typescript.interfaces.i-prefix',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-files.d.ts","sourceRoot":"","sources":["../../src/emit/synthesize-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,IAAI,EACA,QAAQ,GACR,WAAW,GACX,OAAO,GACP,OAAO,GACP,WAAW,GACX,WAAW,GACX,MAAM,GACN,OAAO,GACP,cAAc,GACd,SAAS,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"synthesize-files.d.ts","sourceRoot":"","sources":["../../src/emit/synthesize-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,IAAI,EACA,QAAQ,GACR,WAAW,GACX,OAAO,GACP,OAAO,GACP,WAAW,GACX,WAAW,GACX,MAAM,GACN,OAAO,GACP,cAAc,GACd,SAAS,CAAC;CACf;AAsID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAEzE;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC7D,GAAG,gBAAgB,EAAE,CAErB"}
|