@chemx/starter-kit 26.9.16-668 → 26.9.17-309

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +4 -0
  2. package/assets/chemx-starter-kit-logo.gif +0 -0
  3. package/blueprints/_view-template.scss +24 -0
  4. package/blueprints/atoms/a-button.vue +43 -0
  5. package/blueprints/molecule-capsule/_m-sample-card.scss +75 -0
  6. package/blueprints/molecule-capsule/index.ts +2 -0
  7. package/blueprints/molecule-capsule/m-chemx-badge/_m-chemx-badge.scss +76 -0
  8. package/blueprints/molecule-capsule/m-chemx-badge/index.ts +3 -0
  9. package/blueprints/molecule-capsule/m-chemx-badge/m-chemx-badge.spec.ts +74 -0
  10. package/blueprints/molecule-capsule/m-chemx-badge/m-chemx-badge.tsx +39 -0
  11. package/blueprints/molecule-capsule/m-chemx-badge/m-chemx-badge.vue +42 -0
  12. package/blueprints/molecule-capsule/m-chemx-badge/types.d.ts +12 -0
  13. package/blueprints/molecule-capsule/m-sample-card.spec.ts +74 -0
  14. package/blueprints/molecule-capsule/m-sample-card.tsx +72 -0
  15. package/blueprints/molecule-capsule/m-tab-button/_m-tab-button.scss +49 -0
  16. package/blueprints/molecule-capsule/m-tab-button/index.ts +3 -0
  17. package/blueprints/molecule-capsule/m-tab-button/m-tab-button.controller.ts +43 -0
  18. package/blueprints/molecule-capsule/m-tab-button/m-tab-button.spec.ts +40 -0
  19. package/blueprints/molecule-capsule/m-tab-button/m-tab-button.vue +38 -0
  20. package/blueprints/molecule-capsule/m-tab-button/types.d.ts +14 -0
  21. package/blueprints/molecule-capsule/types.d.ts +12 -0
  22. package/blueprints/shims-vue.d.ts +4 -0
  23. package/blueprints/view-template.tsx +20 -0
  24. package/blueprints/workflows/chemx-audit.yml +79 -0
  25. package/cli/audit/autofix.js +4 -5
  26. package/cli/audit/pattern-detector.js +90 -3
  27. package/cli/audit/pattern-detector.spec.js +36 -1
  28. package/cli/audit/rules-predicates.js +3 -2
  29. package/cli/audit-preflight.spec.js +11 -0
  30. package/cli/generator-templates/controller.js +36 -0
  31. package/cli/generator-templates/hooks.js +60 -0
  32. package/cli/generator-templates/naming.js +14 -0
  33. package/cli/generator-templates/react.js +63 -0
  34. package/cli/generator-templates/specs.js +38 -0
  35. package/cli/generator-templates/styles.js +64 -0
  36. package/cli/generator-templates/svelte.js +66 -0
  37. package/cli/generator-templates/types.js +29 -0
  38. package/cli/generator-templates/views.js +76 -0
  39. package/cli/generator-templates/vue.js +62 -0
  40. package/cli/generator-templates.d.ts +35 -0
  41. package/cli/generator-templates.js +28 -480
  42. package/cli/generator-templates.spec.js +108 -0
  43. package/cli/generator.js +2 -2
  44. package/cli/generator.spec.js +61 -1
  45. package/cli/index.js +3 -0
  46. package/cli/installer-templates.js +29 -8
  47. package/cli/license.js +22 -1
  48. package/cli/mcp/installer.js +31 -21
  49. package/cli/mcp/resources.js +114 -7
  50. package/cli/mcp/server.spec.js +34 -0
  51. package/cli/mcp/tools.js +14 -4
  52. package/cli/postinstall.js +27 -0
  53. package/cli/project-detector.js +20 -2
  54. package/cli/project-detector.spec.js +19 -0
  55. package/cli/reader.js +18 -4
  56. package/cli/scaffold.js +19 -3
  57. package/cli/terminal.js +36 -1
  58. package/docs/CHANGELOG.md +10 -0
  59. package/package.json +8 -5
  60. package/scripts/postinstall.mjs +27 -0
  61. package/scripts/pre-commit.sh +135 -0
  62. package/scripts/publish-both.mjs +108 -0
@@ -0,0 +1,64 @@
1
+ export const buildScss = (name) => `.${name} {
2
+ display: flex;
3
+ flex-direction: column;
4
+ padding: 16px;
5
+ background: rgba(19, 30, 58, 0.7);
6
+ backdrop-filter: blur(12px);
7
+ border: 1px solid rgba(98, 201, 255, 0.15);
8
+ border-radius: 8px;
9
+
10
+ &__header {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ align-items: center;
14
+ }
15
+
16
+ &__title {
17
+ margin: 0;
18
+ font-size: 16px;
19
+ color: #ffffff;
20
+ }
21
+
22
+ &__subtitle {
23
+ margin: 4px 0 0;
24
+ font-size: 12px;
25
+ color: #94a3b8;
26
+ }
27
+
28
+ &__badge {
29
+ font-size: 11px;
30
+ padding: 2px 8px;
31
+ border-radius: 4px;
32
+ background: #0b1329;
33
+
34
+ &--ready { color: #62c9ff; }
35
+ &--active { color: #4ade80; }
36
+ &--pending { color: #facc15; }
37
+ }
38
+
39
+ &__body {
40
+ margin-top: 14px;
41
+ display: flex;
42
+ justify-content: flex-end;
43
+ }
44
+
45
+ &__action {
46
+ padding: 6px 14px;
47
+ border-radius: 4px;
48
+ background: #1e293b;
49
+ border: 1px solid #334155;
50
+ color: #ffffff;
51
+ cursor: pointer;
52
+
53
+ &:hover:not(:disabled) {
54
+ background: #334155;
55
+ border-color: #62c9ff;
56
+ }
57
+
58
+ &:disabled {
59
+ opacity: 0.5;
60
+ cursor: not-allowed;
61
+ }
62
+ }
63
+ }
64
+ `;
@@ -0,0 +1,66 @@
1
+ export const buildSvelteComponent = (name, pascalName, options = {}) => {
2
+ const atomsPackage = options.atomsPackage || null;
3
+ const hasController = options.hasController !== false;
4
+ const atomImport = atomsPackage ? `import { AtomButton } from '${atomsPackage}';\n` : '';
5
+ const actionButton = atomsPackage
6
+ ? ` <AtomButton
7
+ disabled={!controller.canProceed}
8
+ onclick={controller.handleAction}
9
+ >
10
+ {variant}
11
+ </AtomButton>`
12
+ : ` <button
13
+ type="button"
14
+ class="${name}__action"
15
+ disabled={!controller.canProceed}
16
+ onclick={controller.handleAction}
17
+ >
18
+ {variant}
19
+ </button>`;
20
+
21
+ const controllerImport = hasController
22
+ ? `import { create${pascalName}Controller } from './${name}.controller';\n`
23
+ : '';
24
+
25
+ const controllerLogic = hasController
26
+ ? `const controller = create${pascalName}Controller({
27
+ initialState: { status: 'idle' },
28
+ onAction
29
+ });`
30
+ : `const controller = {
31
+ canProceed: true,
32
+ descriptor: { text: 'Ready', className: '${name}__badge ${name}__badge--ready' },
33
+ handleAction: () => onAction?.()
34
+ };`;
35
+
36
+ return `<script lang="ts">
37
+ import type { ${pascalName}Props } from './types';
38
+ ${atomImport}${controllerImport}
39
+ const {
40
+ title,
41
+ subtitle = '',
42
+ variant = 'standard',
43
+ onAction
44
+ }: ${pascalName}Props = $props();
45
+
46
+ ${controllerLogic}
47
+ </script>
48
+
49
+ <div class="${name}">
50
+ <div class="${name}__header">
51
+ <h3 class="${name}__title">{title}</h3>
52
+ {#if subtitle}
53
+ <p class="${name}__subtitle">{subtitle}</p>
54
+ {/if}
55
+ <span class={controller.descriptor.className}>{controller.descriptor.text}</span>
56
+ </div>
57
+ <div class="${name}__body">
58
+ ${actionButton}
59
+ </div>
60
+ </div>
61
+
62
+ <style lang="scss">
63
+ @use './_${name}.scss';
64
+ </style>
65
+ `;
66
+ };
@@ -0,0 +1,29 @@
1
+ export const buildPropsType = (name, pascalName) => `export interface ${pascalName}Props {
2
+ readonly title: string;
3
+ readonly subtitle?: string;
4
+ readonly variant?: 'standard' | 'highlight';
5
+ readonly onAction?: () => void;
6
+ }
7
+
8
+ export interface ${pascalName}Emits {
9
+ (e: 'action', title: string): void;
10
+ }
11
+ `;
12
+
13
+ export const buildStateType = (name, pascalName) => `export type ${pascalName}State =
14
+ | { readonly status: 'idle' }
15
+ | { readonly status: 'loading'; readonly progress: number }
16
+ | { readonly status: 'active'; readonly activeId: string }
17
+ | { readonly status: 'fault'; readonly faultMessage: string };
18
+
19
+ export interface ${pascalName}Descriptor {
20
+ readonly text: string;
21
+ readonly className: string;
22
+ }
23
+ `;
24
+
25
+ export const buildTypesIndex = (fileNames = ['props', 'state']) =>
26
+ fileNames.map((f) => `export type * from './${f}.d.ts';`).join('\n') + '\n';
27
+
28
+ export const buildTypes = (name, pascalName) => `${buildStateType(name, pascalName)}
29
+ ${buildPropsType(name, pascalName)}`;
@@ -0,0 +1,76 @@
1
+ export const buildReactView = (name, pascalName) => `import React from 'react';
2
+ import type { ${pascalName}ViewParams } from './types';
3
+
4
+ export const ${pascalName}View: React.FC<${pascalName}ViewParams> = ({
5
+ HeaderMolecule,
6
+ MainOrganism,
7
+ FooterMolecule
8
+ }) => (
9
+ <main className="${name}">
10
+ {HeaderMolecule}
11
+ {MainOrganism}
12
+ {FooterMolecule}
13
+ </main>
14
+ );
15
+
16
+ export default ${pascalName}View;
17
+ `;
18
+
19
+ export const buildVueView = (name, pascalName) => `<script setup lang="ts">
20
+ import type { ${pascalName}ViewParams } from './types';
21
+
22
+ defineProps<${pascalName}ViewParams>();
23
+ </script>
24
+
25
+ <template>
26
+ <main class="${name}">
27
+ <component :is="HeaderMolecule" />
28
+ <component :is="MainOrganism" />
29
+ <component :is="FooterMolecule" />
30
+ </main>
31
+ </template>
32
+ `;
33
+
34
+ export const buildSvelteView = (name, pascalName) => `<script lang="ts">
35
+ import type { ${pascalName}ViewParams } from './types';
36
+
37
+ const {
38
+ HeaderMolecule,
39
+ MainOrganism,
40
+ FooterMolecule
41
+ }: ${pascalName}ViewParams = $props();
42
+ </script>
43
+
44
+ <main class="${name}">
45
+ {@render HeaderMolecule?.()}
46
+ {@render MainOrganism?.()}
47
+ {@render FooterMolecule?.()}
48
+ </main>
49
+ `;
50
+
51
+ export const buildViewParamsType = (pascalName) => `export interface ${pascalName}ViewParams {
52
+ readonly HeaderMolecule?: unknown;
53
+ readonly MainOrganism?: unknown;
54
+ readonly FooterMolecule?: unknown;
55
+ }
56
+ `;
57
+
58
+ export const buildViewIndex = (name, pascalName, ext) => {
59
+ const compExport = ext === 'vue' || ext === 'svelte'
60
+ ? `export { default as ${pascalName}View } from './${name}.${ext}';`
61
+ : `export { ${pascalName}View } from './${name}';`;
62
+
63
+ return `${compExport}
64
+ export type * from './types';
65
+ `;
66
+ };
67
+
68
+ export const buildViewSpec = (name, pascalName) => `import { describe, it } from 'node:test';
69
+ import assert from 'node:assert/strict';
70
+
71
+ describe('${pascalName}View Table of Contents', () => {
72
+ it('defines pure declarative blueprint layout', () => {
73
+ assert.ok(true);
74
+ });
75
+ });
76
+ `;
@@ -0,0 +1,62 @@
1
+ export const buildVueComponent = (name, pascalName, options = {}) => {
2
+ const atomsPackage = options.atomsPackage || null;
3
+ const hasController = options.hasController !== false;
4
+ const actionButton = atomsPackage
5
+ ? ` <a-button
6
+ :disabled="!canProceed"
7
+ @click="handleAction"
8
+ >
9
+ {{ variant }}
10
+ </a-button>`
11
+ : ` <button
12
+ type="button"
13
+ class="${name}__action"
14
+ :disabled="!canProceed"
15
+ @click="handleAction"
16
+ >
17
+ {{ variant }}
18
+ </button>`;
19
+
20
+ const controllerImport = hasController
21
+ ? `import { use${pascalName}Controller } from './${name}.controller';\n`
22
+ : '';
23
+
24
+ const controllerLogic = hasController
25
+ ? `const { state, canProceed, descriptor, handleAction } = use${pascalName}Controller({
26
+ initialState: { status: 'idle' },
27
+ onAction: () => emit('action', props.title)
28
+ });`
29
+ : `const canProceed = true;
30
+ const descriptor = { text: 'Ready', className: '${name}__badge ${name}__badge--ready' };
31
+ const handleAction = () => emit('action', props.title);`;
32
+
33
+ return `<script setup lang="ts">
34
+ import type { ${pascalName}Props, ${pascalName}Emits } from './types';
35
+ ${controllerImport}
36
+ const props = withDefaults(defineProps<${pascalName}Props>(), {
37
+ variant: 'standard'
38
+ });
39
+
40
+ const emit = defineEmits<${pascalName}Emits>();
41
+
42
+ ${controllerLogic}
43
+ </script>
44
+
45
+ <template>
46
+ <div class="${name}">
47
+ <div class="${name}__header">
48
+ <h3 class="${name}__title">{{ title }}</h3>
49
+ <p v-if="subtitle" class="${name}__subtitle">{{ subtitle }}</p>
50
+ <span :class="descriptor.className">{{ descriptor.text }}</span>
51
+ </div>
52
+ <div class="${name}__body">
53
+ ${actionButton}
54
+ </div>
55
+ </div>
56
+ </template>
57
+
58
+ <style lang="scss" scoped>
59
+ @use './_${name}.scss';
60
+ </style>
61
+ `;
62
+ };
@@ -0,0 +1,35 @@
1
+ export interface TemplateOptions {
2
+ readonly atomsPackage?: string | null;
3
+ readonly hasController?: boolean;
4
+ }
5
+
6
+ export declare function toPascalCase(str: string): string;
7
+ export declare function toCamelCase(str: string): string;
8
+
9
+ export declare function buildReactComponent(name: string, pascalName: string, options?: TemplateOptions): string;
10
+ export declare function buildVueComponent(name: string, pascalName: string, options?: TemplateOptions): string;
11
+ export declare function buildSvelteComponent(name: string, pascalName: string, options?: TemplateOptions): string;
12
+
13
+ export declare function buildController(name: string, pascalName: string): string;
14
+ export declare function buildComponentSpec(name: string, pascalName: string, hasController?: boolean): string;
15
+ export declare function buildIndex(name: string, pascalName: string, ext: string, hasController?: boolean): string;
16
+
17
+ export declare function buildPropsType(name: string, pascalName: string): string;
18
+ export declare function buildStateType(name: string, pascalName: string): string;
19
+ export declare function buildTypesIndex(fileNames?: string[]): string;
20
+ export declare function buildTypes(name: string, pascalName: string): string;
21
+
22
+ export declare function buildScss(name: string): string;
23
+
24
+ export declare function buildHook(name: string, camelName: string, pascalName: string): string;
25
+ export declare function buildHookOptionsType(pascalName: string): string;
26
+ export declare function buildHookReturnType(pascalName: string): string;
27
+ export declare function buildHookIndex(name: string, camelName: string): string;
28
+ export declare function buildHookSpec(name: string, camelName: string): string;
29
+
30
+ export declare function buildReactView(name: string, pascalName: string): string;
31
+ export declare function buildVueView(name: string, pascalName: string): string;
32
+ export declare function buildSvelteView(name: string, pascalName: string): string;
33
+ export declare function buildViewParamsType(pascalName: string): string;
34
+ export declare function buildViewIndex(name: string, pascalName: string, ext: string): string;
35
+ export declare function buildViewSpec(name: string, pascalName: string): string;