create-atsdc-stack 1.1.0 → 1.2.0

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 (48) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/CLAUDE.md +236 -215
  3. package/CONTRIBUTING.md +342 -342
  4. package/INSTALLATION.md +359 -359
  5. package/LICENSE +201 -201
  6. package/README.md +405 -405
  7. package/app/.env.example +17 -17
  8. package/app/.github/labeler.yml +61 -0
  9. package/app/.github/workflows/browser-tests.yml +101 -0
  10. package/app/.github/workflows/check.yml +24 -0
  11. package/app/.github/workflows/greetings.yml +16 -0
  12. package/app/.github/workflows/label.yml +22 -0
  13. package/app/.github/workflows/stale.yml +27 -0
  14. package/app/.github/workflows/summary.yml +34 -0
  15. package/app/.stylelintrc.json +8 -0
  16. package/app/README.md +251 -251
  17. package/app/astro.config.mjs +83 -83
  18. package/app/drizzle.config.ts +16 -16
  19. package/app/package.json +66 -52
  20. package/app/playwright.config.ts +27 -0
  21. package/app/public/manifest.webmanifest +36 -36
  22. package/app/pwa-assets.config.ts +8 -0
  23. package/app/src/components/Card.astro +36 -36
  24. package/app/src/db/initialize.ts +107 -107
  25. package/app/src/db/schema.ts +72 -72
  26. package/app/src/db/validations.ts +158 -158
  27. package/app/src/layouts/Layout.astro +63 -63
  28. package/app/src/lib/config.ts +36 -36
  29. package/app/src/lib/content-converter.ts +141 -141
  30. package/app/src/lib/dom-utils.ts +230 -230
  31. package/app/src/lib/exa-search.ts +269 -269
  32. package/app/src/pages/api/chat.ts +91 -91
  33. package/app/src/pages/api/posts.ts +350 -350
  34. package/app/src/pages/index.astro +87 -87
  35. package/app/src/styles/components/button.scss +152 -152
  36. package/app/src/styles/components/card.scss +180 -180
  37. package/app/src/styles/components/form.scss +240 -240
  38. package/app/src/styles/global.scss +141 -141
  39. package/app/src/styles/pages/index.scss +80 -80
  40. package/app/src/styles/reset.scss +83 -83
  41. package/app/src/styles/variables/globals.scss +96 -96
  42. package/app/src/styles/variables/mixins.scss +238 -238
  43. package/app/tests/browser.test.nopause.ts +10 -0
  44. package/app/tests/browser.test.ts +13 -0
  45. package/bin/cli.js +1151 -1151
  46. package/package.json +8 -6
  47. package/app/.astro/settings.json +0 -5
  48. package/app/.astro/types.d.ts +0 -1
@@ -1,91 +1,91 @@
1
- import type { APIRoute } from 'astro';
2
- import { streamText } from 'ai';
3
- import { z } from 'zod';
4
-
5
- /**
6
- * Vercel AI SDK Chat API Route
7
- * Uses AI Gateway pattern - no provider-specific packages needed!
8
- * Just pass model strings like 'openai/gpt-4o' or 'anthropic/claude-3-5-sonnet-20241022'
9
- *
10
- * Environment variables required:
11
- * - OPENAI_API_KEY: Your OpenAI API key (or other provider keys)
12
- */
13
-
14
- // Validate request schema
15
- const requestSchema = z.object({
16
- messages: z.array(
17
- z.object({
18
- role: z.enum(['user', 'assistant', 'system']),
19
- content: z.string(),
20
- })
21
- ),
22
- model: z.string().optional().default('openai/gpt-4o'),
23
- temperature: z.number().min(0).max(2).optional().default(0.7),
24
- maxTokens: z.number().positive().optional().default(1000),
25
- });
26
-
27
- export const POST: APIRoute = async ({ request }) => {
28
- try {
29
- // Validate API key
30
- if (!import.meta.env.OPENAI_API_KEY && !process.env.OPENAI_API_KEY) {
31
- return new Response(
32
- JSON.stringify({
33
- error: 'OPENAI_API_KEY is not configured',
34
- }),
35
- {
36
- status: 500,
37
- headers: {
38
- 'Content-Type': 'application/json',
39
- },
40
- }
41
- );
42
- }
43
-
44
- // Parse and validate request body
45
- const body = await request.json();
46
- const validatedData = requestSchema.parse(body);
47
-
48
- // Stream the response using Vercel AI SDK with AI Gateway
49
- const result = streamText({
50
- model: validatedData.model, // Use model string directly (e.g., 'openai/gpt-4o')
51
- messages: validatedData.messages,
52
- temperature: validatedData.temperature,
53
- maxTokens: validatedData.maxTokens,
54
- apiKey: import.meta.env.OPENAI_API_KEY || process.env.OPENAI_API_KEY,
55
- });
56
-
57
- // Return the stream response
58
- return result.toDataStreamResponse();
59
- } catch (error) {
60
- // Handle Zod validation errors
61
- if (error instanceof z.ZodError) {
62
- return new Response(
63
- JSON.stringify({
64
- error: 'Validation error',
65
- details: error.errors,
66
- }),
67
- {
68
- status: 400,
69
- headers: {
70
- 'Content-Type': 'application/json',
71
- },
72
- }
73
- );
74
- }
75
-
76
- // Handle other errors
77
- console.error('Chat API error:', error);
78
- return new Response(
79
- JSON.stringify({
80
- error: 'Internal server error',
81
- message: error instanceof Error ? error.message : 'Unknown error',
82
- }),
83
- {
84
- status: 500,
85
- headers: {
86
- 'Content-Type': 'application/json',
87
- },
88
- }
89
- );
90
- }
91
- };
1
+ import type { APIRoute } from 'astro';
2
+ import { streamText } from 'ai';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Vercel AI SDK Chat API Route
7
+ * Uses AI Gateway pattern - no provider-specific packages needed!
8
+ * Just pass model strings like 'openai/gpt-4o' or 'anthropic/claude-3-5-sonnet-20241022'
9
+ *
10
+ * Environment variables required:
11
+ * - OPENAI_API_KEY: Your OpenAI API key (or other provider keys)
12
+ */
13
+
14
+ // Validate request schema
15
+ const requestSchema = z.object({
16
+ messages: z.array(
17
+ z.object({
18
+ role: z.enum(['user', 'assistant', 'system']),
19
+ content: z.string(),
20
+ })
21
+ ),
22
+ model: z.string().optional().default('openai/gpt-4o'),
23
+ temperature: z.number().min(0).max(2).optional().default(0.7),
24
+ maxTokens: z.number().positive().optional().default(1000),
25
+ });
26
+
27
+ export const POST: APIRoute = async ({ request }) => {
28
+ try {
29
+ // Validate API key
30
+ if (!import.meta.env.OPENAI_API_KEY && !process.env.OPENAI_API_KEY) {
31
+ return new Response(
32
+ JSON.stringify({
33
+ error: 'OPENAI_API_KEY is not configured',
34
+ }),
35
+ {
36
+ status: 500,
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ },
40
+ }
41
+ );
42
+ }
43
+
44
+ // Parse and validate request body
45
+ const body = await request.json();
46
+ const validatedData = requestSchema.parse(body);
47
+
48
+ // Stream the response using Vercel AI SDK with AI Gateway
49
+ const result = streamText({
50
+ model: validatedData.model, // Use model string directly (e.g., 'openai/gpt-4o')
51
+ messages: validatedData.messages,
52
+ temperature: validatedData.temperature,
53
+ maxTokens: validatedData.maxTokens,
54
+ apiKey: import.meta.env.OPENAI_API_KEY || process.env.OPENAI_API_KEY,
55
+ });
56
+
57
+ // Return the stream response
58
+ return result.toDataStreamResponse();
59
+ } catch (error) {
60
+ // Handle Zod validation errors
61
+ if (error instanceof z.ZodError) {
62
+ return new Response(
63
+ JSON.stringify({
64
+ error: 'Validation error',
65
+ details: error.errors,
66
+ }),
67
+ {
68
+ status: 400,
69
+ headers: {
70
+ 'Content-Type': 'application/json',
71
+ },
72
+ }
73
+ );
74
+ }
75
+
76
+ // Handle other errors
77
+ console.error('Chat API error:', error);
78
+ return new Response(
79
+ JSON.stringify({
80
+ error: 'Internal server error',
81
+ message: error instanceof Error ? error.message : 'Unknown error',
82
+ }),
83
+ {
84
+ status: 500,
85
+ headers: {
86
+ 'Content-Type': 'application/json',
87
+ },
88
+ }
89
+ );
90
+ }
91
+ };