@genui-a3/create 0.1.5 → 0.1.7
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/README.md +24 -5
- package/dist/index.js +22 -37
- package/package.json +1 -1
- package/template/app/api/agui/route.ts +1 -1
- package/template/app/api/chat/route.ts +1 -1
- package/template/app/api/stream/route.ts +1 -1
- package/template/app/lib/providers/anthropic.ts +12 -0
- package/template/app/lib/providers/bedrock.ts +12 -0
- package/template/app/lib/providers/openai.ts +10 -0
- package/template/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,14 +5,16 @@ Scaffold a new [A3](https://www.npmjs.com/package/@genui-a3/core) agentic app in
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx @genui-a3/create@latest
|
|
8
|
+
npx @genui-a3/create@latest
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
This will:
|
|
11
|
+
This starts an **interactive session** that will:
|
|
12
12
|
|
|
13
|
-
1.
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
1. Prompt for your project name and directory
|
|
14
|
+
2. Let you select and configure LLM providers (OpenAI, Anthropic, Bedrock)
|
|
15
|
+
3. Generate a production-ready Next.js template
|
|
16
|
+
4. Automatically create your `.env` with the provided credentials
|
|
17
|
+
5. Install all dependencies
|
|
16
18
|
|
|
17
19
|
Then start developing:
|
|
18
20
|
|
|
@@ -34,6 +36,23 @@ A fully configured Next.js application with:
|
|
|
34
36
|
- **Material UI** — pre-configured theming with MUI components
|
|
35
37
|
- **TypeScript** — strict type-checking out of the box
|
|
36
38
|
|
|
39
|
+
## Configuration & Providers
|
|
40
|
+
|
|
41
|
+
The CLI guides you through setting up your LLM providers and authentication during scaffolding.
|
|
42
|
+
|
|
43
|
+
### Supported Providers
|
|
44
|
+
|
|
45
|
+
| Provider | Authentication | Auto-Generated Config |
|
|
46
|
+
|----------|---------------|------------------------|
|
|
47
|
+
| **OpenAI** | API Key | `OPENAI_API_KEY` |
|
|
48
|
+
| **Anthropic** | API Key | `ANTHROPIC_API_KEY` |
|
|
49
|
+
| **AWS Bedrock** | AWS Profile or Access Keys | `AWS_REGION`, `AWS_ACCESS_KEY_ID`, etc. |
|
|
50
|
+
|
|
51
|
+
### Automatic Setup
|
|
52
|
+
|
|
53
|
+
- **Environment Variables**: A `.env` file is generated with your keys so you can run the app immediately.
|
|
54
|
+
- **Provider Registry**: The CLI generates `app/lib/provider.ts`, pre-configuring the A3 `Provider` factory with your primary model selection.
|
|
55
|
+
|
|
37
56
|
## Usage
|
|
38
57
|
|
|
39
58
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -14,45 +14,30 @@ import fs from "fs-extra";
|
|
|
14
14
|
|
|
15
15
|
// src/utils/providers.ts
|
|
16
16
|
var PROVIDER_META = {
|
|
17
|
-
openai: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
factory: "createOpenAIProvider",
|
|
21
|
-
models: ["gpt-4o", "gpt-4o-mini"]
|
|
22
|
-
},
|
|
23
|
-
bedrock: {
|
|
24
|
-
label: "AWS Bedrock",
|
|
25
|
-
importPath: "@genui-a3/providers/bedrock",
|
|
26
|
-
factory: "createBedrockProvider",
|
|
27
|
-
models: ["us.anthropic.claude-sonnet-4-5-20250929-v1:0", "us.anthropic.claude-haiku-4-5-20251001-v1:0"]
|
|
28
|
-
},
|
|
29
|
-
anthropic: {
|
|
30
|
-
label: "Anthropic",
|
|
31
|
-
importPath: "@genui-a3/providers/anthropic",
|
|
32
|
-
factory: "createAnthropicProvider",
|
|
33
|
-
models: ["claude-sonnet-4-5-20250929", "claude-haiku-4-5-20251001"]
|
|
34
|
-
}
|
|
17
|
+
openai: { label: "OpenAI", exportName: "getOpenAIProvider", file: "openai.ts" },
|
|
18
|
+
bedrock: { label: "AWS Bedrock", exportName: "getBedrockProvider", file: "bedrock.ts" },
|
|
19
|
+
anthropic: { label: "Anthropic", exportName: "getAnthropicProvider", file: "anthropic.ts" }
|
|
35
20
|
};
|
|
36
21
|
|
|
37
22
|
// src/utils/generators.ts
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export function getProvider(): Provider {
|
|
47
|
-
if (!_provider) {
|
|
48
|
-
_provider = ${factory}({
|
|
49
|
-
models: [${modelsLiteral}],
|
|
50
|
-
})
|
|
23
|
+
function generateProviderFiles(targetDir, config) {
|
|
24
|
+
const providersDir = path.join(targetDir, "app", "lib", "providers");
|
|
25
|
+
for (const [key, meta] of Object.entries(PROVIDER_META)) {
|
|
26
|
+
if (!config.providers.includes(key)) {
|
|
27
|
+
const filePath = path.join(providersDir, meta.file);
|
|
28
|
+
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
29
|
+
}
|
|
51
30
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
const primaryMeta = PROVIDER_META[config.primaryProvider];
|
|
32
|
+
const lines = [];
|
|
33
|
+
for (const provKey of config.providers) {
|
|
34
|
+
const meta = PROVIDER_META[provKey];
|
|
35
|
+
const baseName = meta.file.replace(".ts", "");
|
|
36
|
+
lines.push(`export { ${meta.exportName} } from './${baseName}'`);
|
|
37
|
+
}
|
|
38
|
+
lines.push(`export { ${primaryMeta.exportName} as getProvider } from './${primaryMeta.file.replace(".ts", "")}'`);
|
|
39
|
+
lines.push("");
|
|
40
|
+
fs.outputFileSync(path.join(providersDir, "index.ts"), lines.join("\n"));
|
|
56
41
|
}
|
|
57
42
|
function generateEnvFile(targetDir, config) {
|
|
58
43
|
const lines = ["# Generated by create-genui-a3", "# This file is git-ignored. Do not commit credentials.", ""];
|
|
@@ -384,8 +369,8 @@ async function main() {
|
|
|
384
369
|
const spin = p2.spinner();
|
|
385
370
|
spin.start("Scaffolding project files");
|
|
386
371
|
scaffoldProject(templateDir, targetDir, projectName);
|
|
387
|
-
spin.message("Configuring
|
|
388
|
-
|
|
372
|
+
spin.message("Configuring providers");
|
|
373
|
+
generateProviderFiles(targetDir, providerConfig);
|
|
389
374
|
spin.message("Generating .env file");
|
|
390
375
|
generateEnvFile(targetDir, providerConfig);
|
|
391
376
|
spin.stop("Project scaffolded");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { NextRequest } from 'next/server'
|
|
|
2
2
|
import { EventType, type RunAgentInput } from '@ag-ui/client'
|
|
3
3
|
import { EventEncoder } from '@ag-ui/encoder'
|
|
4
4
|
import { AgentRegistry, ChatSession, MemorySessionStore, AGUIAgent } from '@genui-a3/core'
|
|
5
|
-
import { getProvider } from '../../lib/
|
|
5
|
+
import { getProvider } from '../../lib/providers'
|
|
6
6
|
import { greetingAgent, State } from '../../agents/greeting'
|
|
7
7
|
import { ageAgent } from '../../agents/age'
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NextRequest, NextResponse } from 'next/server'
|
|
7
7
|
import { AgentRegistry, ChatSession, MemorySessionStore } from '@genui-a3/core'
|
|
8
|
-
import { getProvider } from '../../lib/
|
|
8
|
+
import { getProvider } from '../../lib/providers'
|
|
9
9
|
import { greetingAgent, State } from '../../agents/greeting'
|
|
10
10
|
import { ageAgent } from '../../agents/age'
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server'
|
|
2
2
|
import { AgentRegistry, ChatSession, MemorySessionStore } from '@genui-a3/core'
|
|
3
|
-
import { getProvider } from '../../lib/
|
|
3
|
+
import { getProvider } from '../../lib/providers'
|
|
4
4
|
import { greetingAgent, State } from '../../agents/greeting'
|
|
5
5
|
import { ageAgent } from '../../agents/age'
|
|
6
6
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAnthropicProvider } from '@genui-a3/providers/anthropic'
|
|
2
|
+
|
|
3
|
+
let _instance: ReturnType<typeof createAnthropicProvider> | null = null
|
|
4
|
+
|
|
5
|
+
export function getAnthropicProvider() {
|
|
6
|
+
if (!_instance) {
|
|
7
|
+
_instance = createAnthropicProvider({
|
|
8
|
+
models: ['claude-sonnet-4-5-20250929', 'claude-haiku-4-5-20251001'],
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
return _instance
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createBedrockProvider } from '@genui-a3/providers/bedrock'
|
|
2
|
+
|
|
3
|
+
let _instance: ReturnType<typeof createBedrockProvider> | null = null
|
|
4
|
+
|
|
5
|
+
export function getBedrockProvider() {
|
|
6
|
+
if (!_instance) {
|
|
7
|
+
_instance = createBedrockProvider({
|
|
8
|
+
models: ['us.anthropic.claude-sonnet-4-5-20250929-v1:0', 'us.anthropic.claude-haiku-4-5-20251001-v1:0'],
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
return _instance
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createOpenAIProvider } from '@genui-a3/providers/openai'
|
|
2
|
+
|
|
3
|
+
let _instance: ReturnType<typeof createOpenAIProvider> | null = null
|
|
4
|
+
|
|
5
|
+
export function getOpenAIProvider() {
|
|
6
|
+
if (!_instance) {
|
|
7
|
+
_instance = createOpenAIProvider({ models: ['gpt-4o', 'gpt-4o-mini'] })
|
|
8
|
+
}
|
|
9
|
+
return _instance
|
|
10
|
+
}
|
package/template/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"@ag-ui/encoder": "0.0.45",
|
|
12
12
|
"@emotion/react": "11.14.0",
|
|
13
13
|
"@emotion/styled": "11.14.1",
|
|
14
|
-
"@genui-a3/core": "^0.1.
|
|
15
|
-
"@genui-a3/providers": "^0.0.
|
|
14
|
+
"@genui-a3/core": "^0.1.10",
|
|
15
|
+
"@genui-a3/providers": "^0.0.2",
|
|
16
16
|
"@mui/icons-material": "7.3.7",
|
|
17
17
|
"@mui/material": "7.3.7",
|
|
18
18
|
"next": "16.1.6",
|