@shrkcrft/presets 0.1.0-alpha.2 → 0.1.0-alpha.5
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/dist/builtin/builtin-presets.d.ts.map +1 -1
- package/dist/builtin/builtin-presets.js +9 -9
- 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 +21 -3
- package/dist/builtin/shared-snippets.d.ts.map +1 -1
- package/dist/builtin/shared-snippets.js +216 -0
- package/dist/emit/synthesize-files.d.ts.map +1 -1
- package/dist/emit/synthesize-files.js +76 -17
- package/package.json +4 -4
|
@@ -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;AA2jBlD,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EA0B5C,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, } from "./shared-snippets.js";
|
|
3
|
+
import { ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES, 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, GO_PATH_CMD, GO_PATH_INTERNAL, GO_PATH_PKG, JAVA_MAVEN_PATH_MAIN, JAVA_MAVEN_PATH_TESTS, NX_PATH_APPS, NX_PATH_LIBS, OVERVIEW_DOC, PYTHON_PATH_SRC, PYTHON_PATH_TESTS, RUST_PATH_SRC, RUST_PATH_TESTS, } 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";
|
|
@@ -133,7 +133,7 @@ const ANGULAR_APP = definePreset({
|
|
|
133
133
|
includes: {
|
|
134
134
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
135
135
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_ONE_EXPORT],
|
|
136
|
-
paths: [
|
|
136
|
+
paths: [ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES],
|
|
137
137
|
templates: [COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
138
138
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV],
|
|
139
139
|
docs: {
|
|
@@ -177,11 +177,11 @@ const NX_MONOREPO = definePreset({
|
|
|
177
177
|
})`,
|
|
178
178
|
],
|
|
179
179
|
rules: [COMMON_SAFETY_RULE, COMMON_RULE_INTERFACE_PREFIX, COMMON_RULE_ONE_EXPORT],
|
|
180
|
-
paths: [
|
|
180
|
+
paths: [NX_PATH_LIBS, NX_PATH_APPS],
|
|
181
181
|
templates: [COMMON_TEMPLATE_SERVICE, COMMON_TEMPLATE_UTILITY, COMMON_TEMPLATE_TEST],
|
|
182
182
|
pipelines: [COMMON_PIPELINE_CONTEXT_ONLY, COMMON_PIPELINE_FEATURE_DEV, COMMON_PIPELINE_UNIT_TEST],
|
|
183
183
|
docs: {
|
|
184
|
-
'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. Code lives under libs/<area>/src/lib/; apps under apps/<app>/.'),
|
|
185
185
|
},
|
|
186
186
|
},
|
|
187
187
|
recommendedNextCommands: [
|
|
@@ -374,7 +374,7 @@ const JAVA_MAVEN_SERVICE = definePreset({
|
|
|
374
374
|
includes: {
|
|
375
375
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
376
376
|
rules: [COMMON_SAFETY_RULE],
|
|
377
|
-
paths: [],
|
|
377
|
+
paths: [JAVA_MAVEN_PATH_MAIN, JAVA_MAVEN_PATH_TESTS],
|
|
378
378
|
templates: [],
|
|
379
379
|
pipelines: [],
|
|
380
380
|
docs: {
|
|
@@ -392,7 +392,7 @@ const JAVA_GRADLE_SERVICE = definePreset({
|
|
|
392
392
|
includes: {
|
|
393
393
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
394
394
|
rules: [COMMON_SAFETY_RULE],
|
|
395
|
-
paths: [],
|
|
395
|
+
paths: [JAVA_MAVEN_PATH_MAIN, JAVA_MAVEN_PATH_TESTS],
|
|
396
396
|
templates: [],
|
|
397
397
|
pipelines: [],
|
|
398
398
|
docs: {
|
|
@@ -428,7 +428,7 @@ const PYTHON_SERVICE = definePreset({
|
|
|
428
428
|
includes: {
|
|
429
429
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
430
430
|
rules: [COMMON_SAFETY_RULE],
|
|
431
|
-
paths: [],
|
|
431
|
+
paths: [PYTHON_PATH_SRC, PYTHON_PATH_TESTS],
|
|
432
432
|
templates: [],
|
|
433
433
|
pipelines: [],
|
|
434
434
|
docs: {
|
|
@@ -446,7 +446,7 @@ const GO_MODULE = definePreset({
|
|
|
446
446
|
includes: {
|
|
447
447
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
448
448
|
rules: [COMMON_SAFETY_RULE],
|
|
449
|
-
paths: [],
|
|
449
|
+
paths: [GO_PATH_CMD, GO_PATH_PKG, GO_PATH_INTERNAL],
|
|
450
450
|
templates: [],
|
|
451
451
|
pipelines: [],
|
|
452
452
|
docs: {
|
|
@@ -464,7 +464,7 @@ const RUST_CRATE = definePreset({
|
|
|
464
464
|
includes: {
|
|
465
465
|
knowledge: [COMMON_AGENT_BRIEFING],
|
|
466
466
|
rules: [COMMON_SAFETY_RULE],
|
|
467
|
-
paths: [],
|
|
467
|
+
paths: [RUST_PATH_SRC, RUST_PATH_TESTS],
|
|
468
468
|
templates: [],
|
|
469
469
|
pipelines: [],
|
|
470
470
|
docs: {
|
|
@@ -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;AAoDlD,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 { 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";
|
|
3
|
+
import { ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES, 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, NEST_PATH_E2E, NEST_PATH_SRC, 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: [ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES],
|
|
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: [], templates: [], pipelines: [], docs: { 'overview.md': OVERVIEW_DOC('NestJS service', 'Validate DTOs at controllers. Keep services thin. Use modules to enforce layers.') } },
|
|
407
|
+
includes: { knowledge: [], rules: [TS_VALIDATE_BOUNDARY_INPUT], paths: [NEST_PATH_SRC, NEST_PATH_E2E], 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;AA0BlD,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, } from "./shared-snippets.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, WORKSPACE_PATH_APPS, WORKSPACE_PATH_PACKAGES, } 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: [WORKSPACE_PATH_APPS, WORKSPACE_PATH_PACKAGES],
|
|
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: [WORKSPACE_PATH_PACKAGES],
|
|
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;AAuBlD,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 { COMMON_AGENT_BRIEFING, COMMON_SAFETY_RULE, OVERVIEW_DOC } from "./shared-snippets.js";
|
|
3
|
+
import { ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES, COMMON_AGENT_BRIEFING, COMMON_SAFETY_RULE, NEST_PATH_E2E, NEST_PATH_SRC, 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: [NEST_PATH_SRC, NEST_PATH_E2E],
|
|
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: [ANGULAR_PATH_APP, ANGULAR_PATH_COMPONENTS, ANGULAR_PATH_SERVICES],
|
|
50
50
|
templates: [],
|
|
51
51
|
pipelines: [],
|
|
52
52
|
docs: {
|
|
@@ -7,9 +7,27 @@ 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 })";
|
|
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 metadata: { path: 'src/services' },\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 metadata: { path: 'src/utils' },\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 metadata: { path: 'tests' },\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 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 })";
|
|
21
|
+
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 })";
|
|
22
|
+
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 })";
|
|
23
|
+
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 })";
|
|
24
|
+
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 })";
|
|
25
|
+
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 })";
|
|
26
|
+
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 })";
|
|
27
|
+
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 })";
|
|
28
|
+
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 })";
|
|
29
|
+
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 })";
|
|
30
|
+
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 })";
|
|
13
31
|
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 })";
|
|
14
32
|
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 })";
|
|
15
33
|
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,sYAU5B,CAAC;AAEN,eAAO,MAAM,iBAAiB,mWASzB,CAAC;AAEN,eAAO,MAAM,iBAAiB,yVASzB,CAAC;AAaN,eAAO,MAAM,YAAY,sgBAUpB,CAAC;AAEN,eAAO,MAAM,YAAY,meAUpB,CAAC;AAIN,eAAO,MAAM,uBAAuB,6kBAU/B,CAAC;AAEN,eAAO,MAAM,mBAAmB,keAU3B,CAAC;AAGN,eAAO,MAAM,gBAAgB,2fAUxB,CAAC;AAEN,eAAO,MAAM,uBAAuB,qfAU/B,CAAC;AAEN,eAAO,MAAM,qBAAqB,2fAU7B,CAAC;AAGN,eAAO,MAAM,aAAa,gjBAUrB,CAAC;AAEN,eAAO,MAAM,aAAa,ubAUrB,CAAC;AAIN,eAAO,MAAM,oBAAoB,wdAU5B,CAAC;AAEN,eAAO,MAAM,qBAAqB,2ZAU7B,CAAC;AAEN,eAAO,MAAM,eAAe,4bAUvB,CAAC;AAEN,eAAO,MAAM,iBAAiB,uYAUzB,CAAC;AAEN,eAAO,MAAM,WAAW,4ZAUnB,CAAC;AAEN,eAAO,MAAM,WAAW,gZAUnB,CAAC;AAEN,eAAO,MAAM,gBAAgB,kbAUxB,CAAC;AAEN,eAAO,MAAM,aAAa,mcAUrB,CAAC;AAEN,eAAO,MAAM,eAAe,icAUvB,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,6 +210,7 @@ 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' },
|
|
213
214
|
})`;
|
|
214
215
|
export const COMMON_PATH_UTILS = `defineKnowledgeEntry({
|
|
215
216
|
id: 'paths.utils',
|
|
@@ -219,6 +220,7 @@ export const COMMON_PATH_UTILS = `defineKnowledgeEntry({
|
|
|
219
220
|
tags: ['paths', 'utils'],
|
|
220
221
|
appliesWhen: ['generate-utility'],
|
|
221
222
|
content: 'Pure helpers live in src/utils/. One function per file.',
|
|
223
|
+
metadata: { path: 'src/utils' },
|
|
222
224
|
})`;
|
|
223
225
|
export const COMMON_PATH_TESTS = `defineKnowledgeEntry({
|
|
224
226
|
id: 'paths.tests',
|
|
@@ -228,6 +230,220 @@ export const COMMON_PATH_TESTS = `defineKnowledgeEntry({
|
|
|
228
230
|
tags: ['paths', 'tests'],
|
|
229
231
|
appliesWhen: ['generate-test'],
|
|
230
232
|
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
|
+
// NestJS services — module-per-folder convention; e2e tests in `test/`.
|
|
326
|
+
export const NEST_PATH_SRC = `defineKnowledgeEntry({
|
|
327
|
+
id: 'paths.nest.src',
|
|
328
|
+
title: 'Nest module roots',
|
|
329
|
+
type: KnowledgeType.Path,
|
|
330
|
+
priority: KnowledgePriority.Critical,
|
|
331
|
+
tags: ['paths', 'nest', 'modules'],
|
|
332
|
+
scope: ['nestjs'],
|
|
333
|
+
appliesWhen: ['create-feature', 'generate-service', 'generate-code'],
|
|
334
|
+
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.',
|
|
335
|
+
metadata: { path: 'src' },
|
|
336
|
+
})`;
|
|
337
|
+
export const NEST_PATH_E2E = `defineKnowledgeEntry({
|
|
338
|
+
id: 'paths.nest.e2e',
|
|
339
|
+
title: 'Nest e2e tests',
|
|
340
|
+
type: KnowledgeType.Path,
|
|
341
|
+
priority: KnowledgePriority.Medium,
|
|
342
|
+
tags: ['paths', 'nest', 'testing'],
|
|
343
|
+
scope: ['nestjs'],
|
|
344
|
+
appliesWhen: ['generate-test'],
|
|
345
|
+
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.',
|
|
346
|
+
metadata: { path: 'test' },
|
|
347
|
+
})`;
|
|
348
|
+
// ─── Polyglot path snippets ──────────────────────────────────────────────
|
|
349
|
+
export const JAVA_MAVEN_PATH_MAIN = `defineKnowledgeEntry({
|
|
350
|
+
id: 'paths.java.maven.main',
|
|
351
|
+
title: 'Java Maven main source',
|
|
352
|
+
type: KnowledgeType.Path,
|
|
353
|
+
priority: KnowledgePriority.Critical,
|
|
354
|
+
tags: ['paths', 'java', 'maven'],
|
|
355
|
+
scope: ['java', 'maven'],
|
|
356
|
+
appliesWhen: ['generate-code'],
|
|
357
|
+
content: 'Main Java source lives under src/main/java/<package>/. Resources under src/main/resources/. Mirror tests under src/test/java/.',
|
|
358
|
+
metadata: { path: 'src/main/java' },
|
|
359
|
+
})`;
|
|
360
|
+
export const JAVA_MAVEN_PATH_TESTS = `defineKnowledgeEntry({
|
|
361
|
+
id: 'paths.java.maven.tests',
|
|
362
|
+
title: 'Java Maven tests',
|
|
363
|
+
type: KnowledgeType.Path,
|
|
364
|
+
priority: KnowledgePriority.High,
|
|
365
|
+
tags: ['paths', 'java', 'maven', 'tests'],
|
|
366
|
+
scope: ['java', 'maven'],
|
|
367
|
+
appliesWhen: ['generate-test'],
|
|
368
|
+
content: 'JUnit / Spring tests live under src/test/java/. Run via mvn test.',
|
|
369
|
+
metadata: { path: 'src/test/java' },
|
|
370
|
+
})`;
|
|
371
|
+
export const PYTHON_PATH_SRC = `defineKnowledgeEntry({
|
|
372
|
+
id: 'paths.python.src',
|
|
373
|
+
title: 'Python source root',
|
|
374
|
+
type: KnowledgeType.Path,
|
|
375
|
+
priority: KnowledgePriority.Critical,
|
|
376
|
+
tags: ['paths', 'python'],
|
|
377
|
+
scope: ['python'],
|
|
378
|
+
appliesWhen: ['generate-code'],
|
|
379
|
+
content: 'Source lives under src/<package>/ (PEP 517 src layout) or directly under <package>/ at the repo root. Pick one and stay consistent.',
|
|
380
|
+
metadata: { path: 'src' },
|
|
381
|
+
})`;
|
|
382
|
+
export const PYTHON_PATH_TESTS = `defineKnowledgeEntry({
|
|
383
|
+
id: 'paths.python.tests',
|
|
384
|
+
title: 'Python tests',
|
|
385
|
+
type: KnowledgeType.Path,
|
|
386
|
+
priority: KnowledgePriority.High,
|
|
387
|
+
tags: ['paths', 'python', 'tests'],
|
|
388
|
+
scope: ['python'],
|
|
389
|
+
appliesWhen: ['generate-test'],
|
|
390
|
+
content: 'Pytest tests live under tests/. Each test_*.py mirrors a module under src/.',
|
|
391
|
+
metadata: { path: 'tests' },
|
|
392
|
+
})`;
|
|
393
|
+
export const GO_PATH_CMD = `defineKnowledgeEntry({
|
|
394
|
+
id: 'paths.go.cmd',
|
|
395
|
+
title: 'Go entry points',
|
|
396
|
+
type: KnowledgeType.Path,
|
|
397
|
+
priority: KnowledgePriority.High,
|
|
398
|
+
tags: ['paths', 'go'],
|
|
399
|
+
scope: ['go'],
|
|
400
|
+
appliesWhen: ['create-app'],
|
|
401
|
+
content: 'Binary entry points live under cmd/<name>/main.go. Shared library code under pkg/ (public) or internal/ (module-private).',
|
|
402
|
+
metadata: { path: 'cmd' },
|
|
403
|
+
})`;
|
|
404
|
+
export const GO_PATH_PKG = `defineKnowledgeEntry({
|
|
405
|
+
id: 'paths.go.pkg',
|
|
406
|
+
title: 'Go shared packages',
|
|
407
|
+
type: KnowledgeType.Path,
|
|
408
|
+
priority: KnowledgePriority.Medium,
|
|
409
|
+
tags: ['paths', 'go'],
|
|
410
|
+
scope: ['go'],
|
|
411
|
+
appliesWhen: ['generate-code'],
|
|
412
|
+
content: 'Public packages live under pkg/<name>/. Tests are co-located as <name>_test.go. Run via go test ./...',
|
|
413
|
+
metadata: { path: 'pkg' },
|
|
414
|
+
})`;
|
|
415
|
+
export const GO_PATH_INTERNAL = `defineKnowledgeEntry({
|
|
416
|
+
id: 'paths.go.internal',
|
|
417
|
+
title: 'Go internal packages',
|
|
418
|
+
type: KnowledgeType.Path,
|
|
419
|
+
priority: KnowledgePriority.Medium,
|
|
420
|
+
tags: ['paths', 'go'],
|
|
421
|
+
scope: ['go'],
|
|
422
|
+
appliesWhen: ['generate-code'],
|
|
423
|
+
content: 'Module-private packages live under internal/<name>/. The Go compiler enforces that only the parent module can import these.',
|
|
424
|
+
metadata: { path: 'internal' },
|
|
425
|
+
})`;
|
|
426
|
+
export const RUST_PATH_SRC = `defineKnowledgeEntry({
|
|
427
|
+
id: 'paths.rust.src',
|
|
428
|
+
title: 'Rust crate source',
|
|
429
|
+
type: KnowledgeType.Path,
|
|
430
|
+
priority: KnowledgePriority.Critical,
|
|
431
|
+
tags: ['paths', 'rust'],
|
|
432
|
+
scope: ['rust'],
|
|
433
|
+
appliesWhen: ['generate-code'],
|
|
434
|
+
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.',
|
|
435
|
+
metadata: { path: 'src' },
|
|
436
|
+
})`;
|
|
437
|
+
export const RUST_PATH_TESTS = `defineKnowledgeEntry({
|
|
438
|
+
id: 'paths.rust.tests',
|
|
439
|
+
title: 'Rust integration tests',
|
|
440
|
+
type: KnowledgeType.Path,
|
|
441
|
+
priority: KnowledgePriority.Medium,
|
|
442
|
+
tags: ['paths', 'rust', 'tests'],
|
|
443
|
+
scope: ['rust'],
|
|
444
|
+
appliesWhen: ['generate-test'],
|
|
445
|
+
content: 'Integration tests live under tests/<name>.rs. Unit tests live inline with #[cfg(test)] modules inside src/. Run via cargo test.',
|
|
446
|
+
metadata: { path: 'tests' },
|
|
231
447
|
})`;
|
|
232
448
|
export const COMMON_RULE_INTERFACE_PREFIX = `defineKnowledgeEntry({
|
|
233
449
|
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;AAqMD;;;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"}
|
|
@@ -1,3 +1,62 @@
|
|
|
1
|
+
// Self-contained preambles for each emitted file kind. Generated files
|
|
2
|
+
// must work in a brand-new downstream repo where no `@shrkcrft/*`
|
|
3
|
+
// packages are installed. The loaders (knowledge / templates / pipelines)
|
|
4
|
+
// are shape-agnostic — they accept any object with the required string
|
|
5
|
+
// fields — so we just need helpers + enum-like constants the snippets
|
|
6
|
+
// reference. See `packages/knowledge/src/load/typescript-knowledge-loader.ts`
|
|
7
|
+
// for the loader contract.
|
|
8
|
+
const KNOWLEDGE_HELPERS = `// Local helpers — keep this file self-contained (no @shrkcrft/* imports).
|
|
9
|
+
const KnowledgePriority = {
|
|
10
|
+
Critical: 'critical',
|
|
11
|
+
High: 'high',
|
|
12
|
+
Medium: 'medium',
|
|
13
|
+
Low: 'low',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
const KnowledgeType = {
|
|
17
|
+
Rule: 'rule',
|
|
18
|
+
Path: 'path',
|
|
19
|
+
Template: 'template',
|
|
20
|
+
Architecture: 'architecture',
|
|
21
|
+
Technical: 'technical',
|
|
22
|
+
Business: 'business',
|
|
23
|
+
Command: 'command',
|
|
24
|
+
Environment: 'environment',
|
|
25
|
+
Dependency: 'dependency',
|
|
26
|
+
Feature: 'feature',
|
|
27
|
+
Task: 'task',
|
|
28
|
+
Warning: 'warning',
|
|
29
|
+
Decision: 'decision',
|
|
30
|
+
Convention: 'convention',
|
|
31
|
+
Workflow: 'workflow',
|
|
32
|
+
Testing: 'testing',
|
|
33
|
+
Security: 'security',
|
|
34
|
+
Deployment: 'deployment',
|
|
35
|
+
Integration: 'integration',
|
|
36
|
+
Custom: 'custom',
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
function defineKnowledgeEntry<T>(entry: T): T {
|
|
40
|
+
return entry;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const TEMPLATE_HELPERS = `// Local helpers — keep this file self-contained (no @shrkcrft/* imports).
|
|
44
|
+
function defineTemplate<T>(template: T): T {
|
|
45
|
+
return template;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function kebab(s: string): string {
|
|
49
|
+
return s
|
|
50
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
51
|
+
.replace(/[^A-Za-z0-9]+/g, '-')
|
|
52
|
+
.toLowerCase();
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const PIPELINE_HELPERS = `// Local helpers — keep this file self-contained (no @shrkcrft/* imports).
|
|
56
|
+
function definePipeline<T>(pipeline: T): T {
|
|
57
|
+
return pipeline;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
1
60
|
function recordToMap(v) {
|
|
2
61
|
if (!v)
|
|
3
62
|
return new Map();
|
|
@@ -11,48 +70,47 @@ function listBlock(items, indent = ' ') {
|
|
|
11
70
|
return items.map((expr) => indent + expr.replace(/\n/g, `\n${indent}`)).join(',\n') + ',\n';
|
|
12
71
|
}
|
|
13
72
|
function knowledgeFile(items) {
|
|
14
|
-
return (
|
|
15
|
-
'
|
|
73
|
+
return (KNOWLEDGE_HELPERS +
|
|
74
|
+
'\nconst knowledge = [\n' +
|
|
16
75
|
listBlock(items) +
|
|
17
76
|
'];\n\n' +
|
|
18
77
|
'export default knowledge;\n');
|
|
19
78
|
}
|
|
20
79
|
function rulesFile(items) {
|
|
21
|
-
return (
|
|
22
|
-
'
|
|
80
|
+
return (KNOWLEDGE_HELPERS +
|
|
81
|
+
'\nconst rules = [\n' +
|
|
23
82
|
listBlock(items) +
|
|
24
83
|
'];\n\n' +
|
|
25
84
|
'export default rules;\n');
|
|
26
85
|
}
|
|
27
86
|
function pathsFile(items) {
|
|
28
|
-
return (
|
|
29
|
-
'
|
|
87
|
+
return (KNOWLEDGE_HELPERS +
|
|
88
|
+
'\nconst paths = [\n' +
|
|
30
89
|
listBlock(items) +
|
|
31
90
|
'];\n\n' +
|
|
32
91
|
'export default paths;\n');
|
|
33
92
|
}
|
|
34
93
|
function templatesFile(items) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return ("import { defineTemplate } from '@shrkcrft/templates';\n\n" +
|
|
38
|
-
'function kebab(s: string): string {\n' +
|
|
39
|
-
" return s.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase();\n" +
|
|
40
|
-
'}\n\n' +
|
|
41
|
-
'const templates = [\n' +
|
|
94
|
+
return (TEMPLATE_HELPERS +
|
|
95
|
+
'\nconst templates = [\n' +
|
|
42
96
|
listBlock(items) +
|
|
43
97
|
'];\n\n' +
|
|
44
98
|
'export default templates;\n');
|
|
45
99
|
}
|
|
46
100
|
function pipelinesFile(items) {
|
|
47
|
-
return (
|
|
48
|
-
'
|
|
101
|
+
return (PIPELINE_HELPERS +
|
|
102
|
+
'\nconst pipelines = [\n' +
|
|
49
103
|
listBlock(items) +
|
|
50
104
|
'];\n\n' +
|
|
51
105
|
'export default pipelines;\n');
|
|
52
106
|
}
|
|
53
107
|
function configFile(preset) {
|
|
54
108
|
// Generic config that points at the standard knowledge/rules/paths/etc.
|
|
55
|
-
// files. Consumers can tailor it later.
|
|
109
|
+
// files. Consumers can tailor it later. Plain default-exported object —
|
|
110
|
+
// the config loader (packages/config/src/config-loader.ts) validates the
|
|
111
|
+
// shape via zod and accepts an object literal as well as a
|
|
112
|
+
// `defineSharkCraftConfig()`-wrapped value, so the generated file does
|
|
113
|
+
// not need to import anything from `@shrkcrft/*`.
|
|
56
114
|
const filesByKind = inferFiles(preset);
|
|
57
115
|
const knowledgeFiles = filesByKind.has('knowledge.ts') ? ['knowledge.ts'] : [];
|
|
58
116
|
const ruleFiles = filesByKind.has('rules.ts') ? ['rules.ts'] : [];
|
|
@@ -67,7 +125,8 @@ function configFile(preset) {
|
|
|
67
125
|
? ` surface: { profile: ${JSON.stringify(preset.surfaceProfile)} },\n`
|
|
68
126
|
: '';
|
|
69
127
|
return (`// Generated by \`shrk presets apply ${preset.id}\`.\n` +
|
|
70
|
-
'// Edit freely. SharkCraft does not regenerate this file.\n
|
|
128
|
+
'// Edit freely. SharkCraft does not regenerate this file.\n' +
|
|
129
|
+
'// Plain default export — no @shrkcrft/* import required.\n\n' +
|
|
71
130
|
'const config = {\n' +
|
|
72
131
|
` projectName: 'shrk-project',\n` +
|
|
73
132
|
` description: ${JSON.stringify(preset.description)},\n` +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/presets",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
4
|
"description": "SharkCraft presets: reusable project setups (knowledge/rules/paths/templates/pipelines/docs) that can be applied to a target repo through the CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
46
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
47
|
-
"@shrkcrft/workspace": "^0.1.0-alpha.
|
|
45
|
+
"@shrkcrft/core": "^0.1.0-alpha.5",
|
|
46
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.5",
|
|
47
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.5"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|