@wabot-dev/create 0.0.2 → 0.0.4
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 +189 -0
- package/bin/create-wabot.mjs +7 -100
- package/lib/cli.mjs +50 -0
- package/lib/create-project.mjs +386 -0
- package/lib/i18n.mjs +167 -0
- package/lib/skills/install.mjs +238 -0
- package/lib/skills/registry.mjs +64 -0
- package/package.json +4 -5
- package/skills/wabot-async/SKILL.md +139 -0
- package/skills/wabot-auth/SKILL.md +149 -0
- package/skills/wabot-chat/SKILL.md +136 -0
- package/skills/wabot-di-config/SKILL.md +117 -0
- package/skills/wabot-framework/SKILL.md +79 -0
- package/skills/wabot-framework/references/quickstart.md +85 -0
- package/skills/wabot-mindset/SKILL.md +155 -0
- package/skills/wabot-ops/SKILL.md +151 -0
- package/skills/wabot-persistence/SKILL.md +155 -0
- package/skills/wabot-rest-socket/SKILL.md +163 -0
- package/skills/wabot-validation/SKILL.md +104 -0
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# `@wabot-dev/create`
|
|
2
|
+
|
|
3
|
+
CLI para:
|
|
4
|
+
|
|
5
|
+
- crear un nuevo proyecto Wabot desde el template oficial
|
|
6
|
+
- instalar skills empaquetadas en distintos homes o targets de agentes
|
|
7
|
+
|
|
8
|
+
## Instalación
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Para probar el binario local:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node ./bin/create-wabot.mjs --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Comando principal
|
|
21
|
+
|
|
22
|
+
Crear un proyecto nuevo:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
create-wabot <project-directory>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Ejemplo:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
create-wabot my-wabot-app
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Variaciones:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
create-wabot my-wabot-app --db-url "postgres://localhost:5432/wabot"
|
|
38
|
+
create-wabot my-wabot-app --llm-url "http://localhost:3000"
|
|
39
|
+
create-wabot my-wabot-app --api-key "my-api-key"
|
|
40
|
+
create-wabot my-wabot-app --db-url "postgres://localhost:5432/wabot" --llm-url "http://localhost:3000" --api-key "my-api-key"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Si no pasás `project-directory`, el CLI pregunta el nombre del proyecto en modo interactivo.
|
|
44
|
+
|
|
45
|
+
## Comando de skills
|
|
46
|
+
|
|
47
|
+
Instalar una skill empaquetada:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
create-wabot skill add <skill-name>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Skill disponible actualmente:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
create-wabot skill add wabot-framework
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Variaciones de `skill add`
|
|
60
|
+
|
|
61
|
+
### 1. Instalación global por defecto
|
|
62
|
+
|
|
63
|
+
Usa el home del sistema y, si no se indica target, instala para `codex`.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
create-wabot skill add wabot-framework
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Resultado esperado:
|
|
70
|
+
|
|
71
|
+
- `<os.homedir()>/.codex/skills/wabot-framework`
|
|
72
|
+
|
|
73
|
+
### 2. Instalación local al proyecto
|
|
74
|
+
|
|
75
|
+
Instala en el workspace actual:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
create-wabot skill add wabot-framework --local
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Resultado esperado:
|
|
82
|
+
|
|
83
|
+
- `./.agents/skills/wabot-framework`
|
|
84
|
+
|
|
85
|
+
### 3. Instalación global con home explícito
|
|
86
|
+
|
|
87
|
+
Instala usando un home root manual:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
create-wabot skill add wabot-framework --global --home "/Users/demo"
|
|
91
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\demo"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 4. Instalación global para un target único
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
create-wabot skill add wabot-framework --global --target codex
|
|
98
|
+
create-wabot skill add wabot-framework --global --target claude
|
|
99
|
+
create-wabot skill add wabot-framework --global --target agents
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Con `--home`:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\demo" --target codex
|
|
106
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\demo" --target claude
|
|
107
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\demo" --target agents
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Rutas esperadas:
|
|
111
|
+
|
|
112
|
+
- `codex` -> `<home>/.codex/skills/wabot-framework`
|
|
113
|
+
- `claude` -> `<home>/.claude/skills/wabot-framework`
|
|
114
|
+
- `agents` -> `<home>/.agents/skills/wabot-framework`
|
|
115
|
+
|
|
116
|
+
### 5. Instalación global para múltiples targets
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
create-wabot skill add wabot-framework --global --targets codex,claude
|
|
120
|
+
create-wabot skill add wabot-framework --global --targets agents,codex,claude
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Con `--home`:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\demo" --targets agents,codex,claude
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Esto instala la misma skill en múltiples destinos dentro del mismo home root.
|
|
130
|
+
|
|
131
|
+
## Reglas útiles
|
|
132
|
+
|
|
133
|
+
- `--local` y `--global` son excluyentes.
|
|
134
|
+
- `--home`, `--target` y `--targets` aplican solo con `--global`.
|
|
135
|
+
- Si no se pasa `--target` ni `--targets`, el default es `codex`.
|
|
136
|
+
- Si el destino ya existe, el comando falla y no sobreescribe.
|
|
137
|
+
- Si el target no existe en la lista soportada, el comando falla.
|
|
138
|
+
|
|
139
|
+
## Targets soportados
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
agents
|
|
143
|
+
codex
|
|
144
|
+
claude
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Ejemplos completos
|
|
148
|
+
|
|
149
|
+
Crear un proyecto:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
create-wabot my-bot
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Crear un proyecto con variables iniciales:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
create-wabot my-bot \
|
|
159
|
+
--db-url "postgres://localhost:5432/mybot" \
|
|
160
|
+
--llm-url "http://localhost:3000" \
|
|
161
|
+
--api-key "secret"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Instalar la skill local al repo:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
create-wabot skill add wabot-framework --local
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Instalar la skill para Claude en otro home:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\another-user" --target claude
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Instalar la skill para varios agentes en el mismo home:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
create-wabot skill add wabot-framework --global --home "C:\\Users\\another-user" --targets agents,codex,claude
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Desarrollo
|
|
183
|
+
|
|
184
|
+
Mostrar ayuda:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
node ./bin/create-wabot.mjs --help
|
|
188
|
+
node ./bin/create-wabot.mjs skill add --help
|
|
189
|
+
```
|
package/bin/create-wabot.mjs
CHANGED
|
@@ -1,106 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { program } from 'commander'
|
|
4
3
|
import chalk from 'chalk'
|
|
5
|
-
import
|
|
6
|
-
import prompts from 'prompts'
|
|
7
|
-
import path from 'path'
|
|
8
|
-
import fs from 'fs/promises'
|
|
4
|
+
import { buildProgram } from '../lib/cli.mjs'
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
// Get the absolute path for the project
|
|
13
|
-
const targetDir = path.resolve(process.cwd(), projectName)
|
|
6
|
+
const program = buildProgram()
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} catch {
|
|
21
|
-
// Directory doesn't exist, we can proceed
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Clone the template repository
|
|
25
|
-
console.log(chalk.blue(`Creating a new Wabot project in ${chalk.green(targetDir)}`))
|
|
26
|
-
|
|
27
|
-
const emitter = degit('wabot-dev/wabot-template', {
|
|
28
|
-
cache: false,
|
|
29
|
-
force: true,
|
|
30
|
-
verbose: true,
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
await emitter.clone(targetDir)
|
|
34
|
-
|
|
35
|
-
// Read the template's package.json
|
|
36
|
-
const packageJsonPath = path.join(targetDir, 'package.json')
|
|
37
|
-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'))
|
|
38
|
-
|
|
39
|
-
// Update package.json with the new project name
|
|
40
|
-
packageJson.name = projectName
|
|
41
|
-
|
|
42
|
-
// Write the updated package.json
|
|
43
|
-
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
44
|
-
|
|
45
|
-
// Create .env file
|
|
46
|
-
await createEnvFile(targetDir, options.dbUrl, options.llmUrl, options.apiKey)
|
|
47
|
-
|
|
48
|
-
console.log(chalk.green('\nSuccess! 🎉 Created', projectName))
|
|
49
|
-
console.log(chalk.yellow('\n .env file add DATABASE_URL, WABOT_LLM_URL, WABOT_API_KEY'))
|
|
50
|
-
console.log('\nInside that directory, you can run several commands:')
|
|
51
|
-
console.log(chalk.cyan('\n npm install'))
|
|
52
|
-
console.log(' Install the project dependencies')
|
|
53
|
-
console.log(chalk.cyan('\n npm start'))
|
|
54
|
-
console.log(' Starts the development server')
|
|
55
|
-
console.log('\nWe suggest that you begin by typing:')
|
|
56
|
-
console.log(chalk.cyan(`\n cd ${projectName}`))
|
|
57
|
-
console.log(chalk.cyan(' npm install'))
|
|
58
|
-
console.log(chalk.cyan(' npm start'))
|
|
59
|
-
console.log('\nHappy hacking! 🚀\n')
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error(chalk.red('Error:'), error)
|
|
62
|
-
process.exit(1)
|
|
63
|
-
}
|
|
8
|
+
try {
|
|
9
|
+
await program.parseAsync(process.argv)
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(chalk.red('Error:'), error.message)
|
|
12
|
+
process.exit(1)
|
|
64
13
|
}
|
|
65
|
-
|
|
66
|
-
async function createEnvFile(targetDir, dbUrl, llmUrl, apiKey) {
|
|
67
|
-
const envContent = `
|
|
68
|
-
DATABASE_URL=${dbUrl}
|
|
69
|
-
WABOT_LLM_URL=${llmUrl}
|
|
70
|
-
WABOT_API_KEY=${apiKey}
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
await fs.writeFile(path.join(targetDir, '.env'), envContent.trim())
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Set up the CLI
|
|
77
|
-
program
|
|
78
|
-
.name('create-wabot')
|
|
79
|
-
.description('Create a new Wabot project')
|
|
80
|
-
.argument('[project-directory]', 'project name')
|
|
81
|
-
.option('--db-url <dbUrl>', 'database url')
|
|
82
|
-
.option('--llm-url <llmUrl>', 'llm url')
|
|
83
|
-
.option('--api-key <key>', 'api key')
|
|
84
|
-
.action(async (projectDirectory, options) => {
|
|
85
|
-
let projectName = projectDirectory
|
|
86
|
-
|
|
87
|
-
if (!projectName) {
|
|
88
|
-
const response = await prompts({
|
|
89
|
-
type: 'text',
|
|
90
|
-
name: 'projectName',
|
|
91
|
-
message: 'What is your project named?',
|
|
92
|
-
initial: 'my-wabot-app',
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
if (!response.projectName) {
|
|
96
|
-
console.log(chalk.red('Project name is required'))
|
|
97
|
-
process.exit(1)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
projectName = response.projectName
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
await createProject(projectName, options)
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
program.parse()
|
package/lib/cli.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
import chalk from 'chalk'
|
|
3
|
+
|
|
4
|
+
import { runCreateProjectCommand } from './create-project.mjs'
|
|
5
|
+
import { installSkill } from './skills/install.mjs'
|
|
6
|
+
|
|
7
|
+
export function buildProgram() {
|
|
8
|
+
const program = new Command()
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.name('create-wabot')
|
|
12
|
+
.description('Create a new Wabot project and install packaged Wabot skills')
|
|
13
|
+
.argument('[project-directory]', 'project name')
|
|
14
|
+
.option('--db-url <dbUrl>', 'postgres connection string (used as default when prompting)')
|
|
15
|
+
.option('--lang <code>', 'language for wizard messages (en, es)', 'en')
|
|
16
|
+
.action(async (projectDirectory, options) => {
|
|
17
|
+
await runCreateProjectCommand(projectDirectory, options)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const skillCommand = program.command('skill').description('Manage packaged Wabot skills')
|
|
21
|
+
|
|
22
|
+
skillCommand
|
|
23
|
+
.command('add <skill-name>')
|
|
24
|
+
.description('Install a packaged Wabot skill')
|
|
25
|
+
.option('--local', 'install into ./.agents/skills/<skill-name>')
|
|
26
|
+
.option('--global', 'install into one or more agent homes under the selected home root')
|
|
27
|
+
.option('--home <path>', 'global home root; defaults to $HOME')
|
|
28
|
+
.option('--target <name>', 'single global target (codex, claude, agents)')
|
|
29
|
+
.option('--targets <names>', 'comma-separated global targets (codex, claude, agents)')
|
|
30
|
+
.action(async (skillName, options) => {
|
|
31
|
+
const result = await installSkill(skillName, options)
|
|
32
|
+
|
|
33
|
+
if (result.mode === 'global') {
|
|
34
|
+
console.log(chalk.blue(`Home root: ${result.homeRoot}`))
|
|
35
|
+
} else {
|
|
36
|
+
console.log(chalk.blue('Agent target: local workspace (.agents/skills)'))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (const installation of result.installations) {
|
|
40
|
+
console.log(
|
|
41
|
+
chalk.green(
|
|
42
|
+
`Installed ${result.skill.name} to ${chalk.cyan(installation.installDir)}`,
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
console.log(chalk.blue(`Target: ${installation.agent}`))
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return program
|
|
50
|
+
}
|