sunpeak 0.1.25 โ†’ 0.2.2

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 (44) hide show
  1. package/README.md +9 -76
  2. package/bin/sunpeak.js +87 -0
  3. package/dist/index.cjs +827 -1361
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +98 -589
  6. package/dist/index.d.ts +98 -589
  7. package/dist/index.js +795 -1337
  8. package/dist/index.js.map +1 -1
  9. package/dist/styles/chatgpt/index.css +146 -0
  10. package/dist/styles/globals.css +220 -0
  11. package/package.json +34 -36
  12. package/template/.prettierignore +4 -0
  13. package/template/.prettierrc +9 -0
  14. package/template/README.md +47 -0
  15. package/template/assets/favicon.ico +0 -0
  16. package/template/components.json +21 -0
  17. package/template/dev/main.tsx +65 -0
  18. package/template/dev/styles.css +5 -0
  19. package/template/eslint.config.cjs +49 -0
  20. package/template/index.html +13 -0
  21. package/template/package.json +56 -0
  22. package/template/src/App.tsx +45 -0
  23. package/template/src/components/index.ts +2 -0
  24. package/template/src/components/shadcn/button.tsx +60 -0
  25. package/template/src/components/shadcn/card.tsx +76 -0
  26. package/template/src/components/shadcn/carousel.tsx +260 -0
  27. package/template/src/components/shadcn/index.ts +5 -0
  28. package/template/src/components/shadcn/label.tsx +24 -0
  29. package/template/src/components/shadcn/select.tsx +157 -0
  30. package/template/src/components/sunpeak-card.test.tsx +76 -0
  31. package/template/src/components/sunpeak-card.tsx +140 -0
  32. package/template/src/components/sunpeak-carousel.test.tsx +42 -0
  33. package/template/src/components/sunpeak-carousel.tsx +126 -0
  34. package/template/src/index.ts +3 -0
  35. package/template/src/lib/index.ts +1 -0
  36. package/template/src/lib/utils.ts +6 -0
  37. package/template/src/styles/chatgpt.css +146 -0
  38. package/template/src/styles/globals.css +220 -0
  39. package/template/src/test/setup.ts +37 -0
  40. package/template/tsconfig.json +32 -0
  41. package/template/tsconfig.node.json +11 -0
  42. package/template/tsup.config.ts +23 -0
  43. package/template/vite.config.ts +35 -0
  44. package/template/vitest.config.ts +15 -0
package/README.md CHANGED
@@ -15,71 +15,26 @@
15
15
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
16
16
  [![React](https://img.shields.io/badge/React-18%20%7C%2019-blue?style=flat-square&logo=react)](https://reactjs.org/)
17
17
 
18
- React library for ChatGPT Apps. Build and test ChatGPT Apps locally with approved components.
18
+ The ChatGPT Apps UI SDK. Build and test your ChatGPT App UI locally with approved shadcn React components.
19
19
 
20
20
  ![ChatGPT Simulator](https://sunpeak.ai/images/chatgpt-simulator.png)
21
21
 
22
22
  **Key Features:**
23
23
  - ๐Ÿ“บ ChatGPT simulator for rapid UI component development.
24
- - ๐Ÿ“ฑ Interface for cross-platform custom components.
25
- - ๐Ÿค [Material UI](https://mui.com/material-ui/)-based components compliant with the OpenAI design system.
26
- - ๐Ÿ“š Library of approved Apps.
27
- - ๐Ÿงช Testing framework that replicates advanced platform behavior locally.
24
+ - ๐Ÿ“š React component library built with [shadcn/ui](https://ui.shadcn.com/) and [Tailwind](https://tailwindcss.com/).
25
+ - ๐Ÿ“ฑ Interface for custom components that work across genAI platforms.
26
+ - ๐Ÿค Styles that fit the [OpenAI design system](https://developers.openai.com/apps-sdk/build/chatgpt-ui).
27
+ - ๐Ÿงช Testing framework that replicates advanced ChatGPT behavior locally.
28
28
 
29
29
  ## Quickstart
30
30
 
31
31
  Requirements: Node (20+), pnpm (10+)
32
32
 
33
- Use our `create-sunpeak` utility to scaffold your own sunpeak app:
34
-
35
33
  ```bash
36
- pnpm dlx create-sunpeak my-app
34
+ pnpm dlx sunpeak init my-app
37
35
  cd my-app && pnpm dev
38
36
  ```
39
37
 
40
- ## Building Apps
41
-
42
- ### Use library components
43
-
44
- ```tsx
45
- import { GenAI, Carousel, Card } from 'sunpeak';
46
-
47
- export const MyCarousel = GenAI(() => (
48
- <Carousel>
49
- <Card
50
- image="https://sunpeak.ai/images/sun.svg"
51
- imageAlt="Sunpeak logo"
52
- imageMaxWidth={400}
53
- imageMaxHeight={400}
54
- header="Card Title"
55
- >
56
- Card content
57
- </Card>
58
- </Carousel>
59
- ));
60
- ```
61
-
62
- ### Create a custom App
63
-
64
- ```tsx
65
- import { GenAI } from 'sunpeak';
66
- import { Box, Typography } from '@mui/material';
67
-
68
- export const MyApp = GenAI(({ maxHeight, colorScheme }) => (
69
- <Box sx={{ p: 3 }}>
70
- <Typography variant="h5" gutterBottom>
71
- Hello GenAI!
72
- </Typography>
73
- <Typography variant="body1" color="text.secondary">
74
- Theme: {colorScheme}
75
- </Typography>
76
- <Typography variant="body2">
77
- Max height: {maxHeight}px
78
- </Typography>
79
- </Box>
80
- ));
81
- ```
82
-
83
38
  ## Supported Platforms
84
39
 
85
40
  - โœ… **OpenAI ChatGPT** - Fully supported ([design guidelines](https://developers.openai.com/apps-sdk/concepts/design-guidelines))
@@ -87,29 +42,6 @@ export const MyApp = GenAI(({ maxHeight, colorScheme }) => (
87
42
  - ๐Ÿ”„ **Anthropic Claude** - Design system available (SDK support coming soon)
88
43
  - ๐Ÿ”ง **Custom platforms** - Implement your own platform adapter
89
44
 
90
- ## What's Included
91
-
92
- ### Components
93
- - **GenAI** - Single interface for building Apps, all Apps must use this wrapper
94
- - Automatic MUI theming (light/dark mode)
95
- - Platform constraints (maxHeight)
96
- - **Card** - Responsive card component
97
- - **Carousel** - Horizontal scrolling carousel
98
- - **ChatGPTSimulator** - Local development & testing environment
99
-
100
- ### Hooks
101
- - **usePlatformGlobal** - Platform-agnostic global state access
102
- - **useDisplayMode** - Get current display mode
103
- - **useRequestDisplayMode** - Request a specific display mode (e.g., fullscreen)
104
- - **useWidgetProps** - Access tool output data
105
- - **useWidgetState** - Manage persistent widget state
106
- - **useMaxHeight** - Get height constraints
107
- - **useColorScheme** - Get current color scheme (light/dark)
108
-
109
- ### Design Systems
110
- - **ChatGPT** - MUI theme following OpenAI Apps SDK guidelines
111
- - **Custom** - Build your own MUI theme
112
-
113
45
  ## Contributing
114
46
 
115
47
  We welcome your contributions!
@@ -118,5 +50,6 @@ For development quickstart on this package, see [DEVELOPMENT.md](./DEVELOPMENT.m
118
50
 
119
51
  ## Resources
120
52
 
121
- - [OpenAI ChatGPT Apps SDK Design Guidelines](https://developers.openai.com/apps-sdk/concepts/design-guidelines)
122
- - [OpenAI ChatGPT Apps SDK Examples](https://github.com/openai/openai-apps-sdk-examples)
53
+ - [ChatGPT Apps SDK Design Guidelines](https://developers.openai.com/apps-sdk/concepts/design-guidelines)
54
+ - [ChatGPT Apps SDK UI Documentation](https://developers.openai.com/apps-sdk/build/chatgpt-ui)
55
+ - [ChatGPT Apps SDK Examples](https://github.com/openai/openai-apps-sdk-examples)
package/bin/sunpeak.js ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync } from 'fs';
4
+ import { join, dirname, basename } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { createInterface } from 'readline';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+
10
+ function prompt(question) {
11
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
12
+ return new Promise((resolve) => {
13
+ rl.question(question, (answer) => {
14
+ rl.close();
15
+ resolve(answer.trim());
16
+ });
17
+ });
18
+ }
19
+
20
+ async function init(projectName) {
21
+ if (!projectName) {
22
+ projectName = await prompt('โ˜€๏ธ ๐Ÿ”๏ธ Project name [my-app]: ');
23
+ if (!projectName) {
24
+ projectName = 'my-app'
25
+ }
26
+ }
27
+
28
+ const targetDir = join(process.cwd(), projectName);
29
+
30
+ if (existsSync(targetDir)) {
31
+ console.error(`Error: Directory "${projectName}" already exists`);
32
+ process.exit(1);
33
+ }
34
+
35
+ const templateDir = join(__dirname, '..', 'template');
36
+
37
+ console.log(`โ˜€๏ธ ๐Ÿ”๏ธ Creating ${projectName}...`);
38
+
39
+ mkdirSync(targetDir, { recursive: true });
40
+
41
+ cpSync(templateDir, targetDir, {
42
+ recursive: true,
43
+ filter: (src) => {
44
+ const name = basename(src);
45
+ return name !== 'node_modules' && name !== 'pnpm-lock.yaml';
46
+ }
47
+ });
48
+
49
+ // Read sunpeak version from root package.json
50
+ const rootPkgPath = join(__dirname, '..', 'package.json');
51
+ const rootPkg = JSON.parse(readFileSync(rootPkgPath, 'utf-8'));
52
+ const sunpeakVersion = `^${rootPkg.version}`;
53
+
54
+ // Update project package.json
55
+ const pkgPath = join(targetDir, 'package.json');
56
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
57
+ pkg.name = projectName;
58
+
59
+ // Replace workspace:* with actual version
60
+ if (pkg.dependencies?.sunpeak === 'workspace:*') {
61
+ pkg.dependencies.sunpeak = sunpeakVersion;
62
+ }
63
+
64
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
65
+
66
+ console.log(`
67
+ Done! To get started:
68
+
69
+ cd ${projectName}
70
+ pnpm install && pnpm dev
71
+
72
+ See README.md for more details.
73
+ `);
74
+ }
75
+
76
+ const [,, command, ...args] = process.argv;
77
+
78
+ if (command === 'init') {
79
+ init(args[0]);
80
+ } else {
81
+ console.log(`
82
+ sunpeak - ChatGPT Apps UI SDK
83
+
84
+ Commands:
85
+ init [name] Create a new project from template
86
+ `);
87
+ }