@creatorem/cli 0.0.1 โ†’ 1.0.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.
Files changed (42) hide show
  1. package/README.md +148 -0
  2. package/dist/cli.js +74992 -0
  3. package/dist/cli.js.map +1 -0
  4. package/package.json +26 -5
  5. package/src/cli.tsx +141 -0
  6. package/src/commands/create-dashboard.tsx +455 -0
  7. package/src/commands/create-mobile.tsx +555 -0
  8. package/src/commands/create.tsx +1119 -0
  9. package/src/commands/generate-migration.mjs +17 -66
  10. package/src/commands/generate-migration.tsx +46 -0
  11. package/src/commands/generate-schemas.mjs +2 -2
  12. package/src/commands/generate-schemas.tsx +36 -0
  13. package/src/dashboard-features/ai/index.ts +102 -0
  14. package/src/dashboard-features/analytics/index.ts +31 -0
  15. package/src/dashboard-features/billing/index.ts +349 -0
  16. package/src/dashboard-features/content-type/index.ts +64 -0
  17. package/src/dashboard-features/email-templates/index.ts +17 -0
  18. package/src/dashboard-features/emailer/index.ts +27 -0
  19. package/src/dashboard-features/index.ts +28 -0
  20. package/src/dashboard-features/keybindings/index.ts +52 -0
  21. package/src/dashboard-features/manager.ts +349 -0
  22. package/src/dashboard-features/monitoring/index.ts +16 -0
  23. package/src/dashboard-features/notification/index.ts +40 -0
  24. package/src/dashboard-features/onboarding/index.ts +65 -0
  25. package/src/dashboard-features/organization/index.ts +38 -0
  26. package/src/dashboard-features/types.ts +41 -0
  27. package/src/mobile-features/index.ts +12 -0
  28. package/src/mobile-features/manager.ts +1 -0
  29. package/src/mobile-features/notification/index.ts +41 -0
  30. package/src/mobile-features/onboarding/index.ts +35 -0
  31. package/src/mobile-features/organization/index.ts +38 -0
  32. package/src/mobile-features/types.ts +1 -0
  33. package/src/shims/signal-exit.js +32 -0
  34. package/src/ui/app.tsx +68 -0
  35. package/src/ui/multi-select.tsx +106 -0
  36. package/src/utils/ast.ts +422 -0
  37. package/src/utils/env-template.ts +635 -0
  38. package/tests/test-cli-features.sh +81 -0
  39. package/tests/test-cli-mobile.sh +65 -0
  40. package/tsconfig.json +15 -0
  41. package/tsup.config.ts +21 -0
  42. package/bin/cli.mjs +0 -40
@@ -0,0 +1,81 @@
1
+ #!/bin/bash
2
+ # cli/tests/test-cli-features.sh
3
+ # Tests the create-dashboard CLI across different feature combinations in a sandbox.
4
+
5
+ set -e # Exit immediately if a command exits with a non-zero status
6
+
7
+ # Ensure we are executing from the monorepo root
8
+ cd "$(dirname "$0")/../.."
9
+
10
+ echo "Testing CLI Feature Combinations in Sandbox..."
11
+
12
+ # Clean up sandbox immediately in case a previous run crashed
13
+ echo "๐Ÿงน Initializing clean sandbox..."
14
+ rm -rf sandbox
15
+
16
+ # Build the CLI
17
+ echo "๐Ÿ”จ Building CLI..."
18
+ pnpm --filter @creatorem/cli run build
19
+
20
+ TEST_CASES=(
21
+ "" # No features (tests removal of everything)
22
+ "organization,keybindings,analytics,monitoring,ai,notification,content-type" # All features (template baseline)
23
+ "organization,ai" # Mixed subset 1
24
+ "keybindings,analytics,monitoring,notification,content-type" # Mixed subset 2
25
+ )
26
+
27
+ for features in "${TEST_CASES[@]}"; do
28
+ echo ""
29
+ echo "=================================================="
30
+ if [ -z "$features" ]; then
31
+ echo "โ–ถ๏ธ Running test: NO features included"
32
+ else
33
+ echo "โ–ถ๏ธ Running test: Features [$features] included"
34
+ fi
35
+ echo "=================================================="
36
+
37
+ # Clean up previous sandbox
38
+ rm -rf sandbox
39
+ mkdir -p sandbox
40
+
41
+ # 1. Run the CLI
42
+ echo "๐Ÿ“ฆ Creating test-dashboard in sandbox..."
43
+ node cli/dist/cli.js create-dashboard sandbox/test-dashboard --features="$features"
44
+
45
+ # 2. Install dependencies (workspace root linking)
46
+ echo "๐Ÿ“ฅ Installing dependencies..."
47
+ pnpm install
48
+
49
+ # 3. Go into the generated app
50
+ cd sandbox/test-dashboard
51
+
52
+ echo "โœ… Running typecheck to verify codebase integrity..."
53
+ pnpm typecheck
54
+
55
+ # 4. Try to start the dev server briefly
56
+ echo "๐Ÿš€ Starting dev server..."
57
+ # Start next dev in the background
58
+ pnpm dev > /dev/null 2>&1 &
59
+ DEV_PID=$!
60
+
61
+ # Wait 10 seconds for it to start and potentially crash
62
+ sleep 10
63
+
64
+ if kill -0 $DEV_PID 2>/dev/null; then
65
+ echo "โœ… Dev server started and remained stable."
66
+ kill $DEV_PID
67
+ else
68
+ echo "โŒ Dev server crashed during startup!"
69
+ cd ../..
70
+ exit 1
71
+ fi
72
+
73
+ cd ../..
74
+ done
75
+
76
+ # Final cleanup
77
+ echo "๐Ÿงน Cleaning up sandbox..."
78
+ rm -rf sandbox
79
+
80
+ echo ""
81
+ echo "๐ŸŽ‰ All CLI feature combination tests passed successfully!"
@@ -0,0 +1,65 @@
1
+ #!/bin/bash
2
+ # cli/tests/test-cli-mobile.sh
3
+ # Tests the create-mobile CLI across different feature combinations in a sandbox.
4
+
5
+ set -e # Exit immediately if a command exits with a non-zero status
6
+
7
+ # Ensure we are executing from the monorepo root
8
+ cd "$(dirname "$0")/../.."
9
+
10
+ echo "Testing Mobile CLI Feature Combinations in Sandbox..."
11
+
12
+ # Clean up sandbox immediately in case a previous run crashed
13
+ echo "๐Ÿงน Initializing clean sandbox..."
14
+ rm -rf sandbox
15
+
16
+ # Build the CLI
17
+ echo "๐Ÿ”จ Building CLI..."
18
+ pnpm --filter @creatorem/cli run build
19
+
20
+ TEST_CASES=(
21
+ "" # No features (tests removal of everything)
22
+ "organization,keybindings,analytics,monitoring,ai,notification" # All features (template baseline)
23
+ "organization,ai" # Mixed subset 1
24
+ "keybindings,analytics,monitoring,notification" # Mixed subset 2
25
+ )
26
+
27
+ for features in "${TEST_CASES[@]}"; do
28
+ echo ""
29
+ echo "=================================================="
30
+ if [ -z "$features" ]; then
31
+ echo "โ–ถ๏ธ Running test: NO features included"
32
+ else
33
+ echo "โ–ถ๏ธ Running test: Features [$features] included"
34
+ fi
35
+ echo "=================================================="
36
+
37
+ # Clean up previous sandbox
38
+ rm -rf sandbox
39
+ mkdir -p sandbox
40
+
41
+ # 1. Run the CLI
42
+ echo "๐Ÿ“ฆ Creating test-mobile in sandbox..."
43
+ node cli/dist/cli.js create-mobile sandbox/test-mobile --features="$features"
44
+
45
+ # 2. Install dependencies (workspace root linking)
46
+ echo "๐Ÿ“ฅ Installing dependencies..."
47
+ pnpm install
48
+
49
+ # 3. Go into the generated app
50
+ cd sandbox/test-mobile
51
+
52
+ echo "โœ… Running typecheck to verify codebase integrity..."
53
+ pnpm typecheck
54
+
55
+ # Expo dev server is interactive, so we rely on TS typecheck for CI reliability
56
+
57
+ cd ../..
58
+ done
59
+
60
+ # Final cleanup
61
+ echo "๐Ÿงน Cleaning up sandbox..."
62
+ rm -rf sandbox
63
+
64
+ echo ""
65
+ echo "๐ŸŽ‰ All CLI feature combination tests passed successfully!"
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "@kit/tsconfig/base.json",
3
+ "compilerOptions": {
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "target": "ESNext",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "noEmit": true
13
+ },
14
+ "include": ["src/**/*"]
15
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'tsup';
2
+ import path from 'path';
3
+
4
+ export default defineConfig({
5
+ entry: ['src/cli.tsx'],
6
+ format: ['esm'],
7
+ clean: true,
8
+ target: 'node18',
9
+ noExternal: [/^(?!ts-morph|@ts-morph|react|react-dom|react\/jsx-runtime).*$/],
10
+ splitting: false,
11
+ sourcemap: true,
12
+ banner: {
13
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`,
14
+ },
15
+ esbuildOptions(options) {
16
+ options.alias = {
17
+ 'signal-exit': path.resolve(__dirname, './src/shims/signal-exit.js'),
18
+ };
19
+ },
20
+ onSuccess: 'chmod +x dist/cli.js',
21
+ });
package/bin/cli.mjs DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Creatorem CLI
5
- */
6
-
7
- import { runGenerateSchemas } from '../src/commands/generate-schemas.mjs';
8
- import { runGenerateMigration } from '../src/commands/generate-migration.mjs';
9
- import { showHelp } from '../src/commands/help.mjs';
10
-
11
- function main() {
12
- const args = process.argv.slice(2);
13
-
14
- if (args.length === 0) {
15
- showHelp();
16
- process.exit(1);
17
- }
18
-
19
- const command = args[0];
20
-
21
- switch (command) {
22
- case 'generate-schemas':
23
- runGenerateSchemas(args.slice(1));
24
- break;
25
- case 'generate-migration':
26
- runGenerateMigration(args.slice(1));
27
- break;
28
- case 'help':
29
- case '-h':
30
- case '--help':
31
- showHelp();
32
- break;
33
- default:
34
- console.error(`Unknown command: ${command}`);
35
- showHelp();
36
- process.exit(1);
37
- }
38
- }
39
-
40
- main();