@moltium/cli 0.1.0 → 0.1.1
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 +273 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# @moltium/cli
|
|
2
|
+
|
|
3
|
+
CLI tool for creating and managing Moltium autonomous AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @moltium/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Scaffold a new agent (interactive prompts)
|
|
15
|
+
moltium init my-agent
|
|
16
|
+
|
|
17
|
+
# Enter the project directory
|
|
18
|
+
cd my-agent
|
|
19
|
+
|
|
20
|
+
# Install dependencies
|
|
21
|
+
npm install
|
|
22
|
+
|
|
23
|
+
# Add your API keys to .env
|
|
24
|
+
# Edit .env with your ANTHROPIC_API_KEY or OPENAI_API_KEY
|
|
25
|
+
|
|
26
|
+
# Start the agent
|
|
27
|
+
npm start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
### `moltium init [name]`
|
|
33
|
+
|
|
34
|
+
Scaffold a new agent project with interactive prompts.
|
|
35
|
+
|
|
36
|
+
**Prompts:**
|
|
37
|
+
- **Agent name** — directory name and config identifier
|
|
38
|
+
- **Agent type** — free text (e.g. `assistant`, `trader`, `moderator`)
|
|
39
|
+
- **Configuration type** — `code` (TypeScript) or `markdown` (natural language)
|
|
40
|
+
- **LLM provider** — Anthropic (Claude) or OpenAI (GPT)
|
|
41
|
+
- **Social platforms** — Moltbook, Twitter, both, or none
|
|
42
|
+
- **Deployment target** — Railway, Render, AWS, DigitalOcean, Custom, or None
|
|
43
|
+
|
|
44
|
+
**Code-based output:**
|
|
45
|
+
```
|
|
46
|
+
my-agent/
|
|
47
|
+
start.ts # Agent entry point
|
|
48
|
+
agent.config.ts # Main configuration (TypeScript)
|
|
49
|
+
actions/example.ts # Starter custom action
|
|
50
|
+
hooks/onInit.ts # Initialization hook
|
|
51
|
+
hooks/onTick.ts # Autonomous loop hook
|
|
52
|
+
hooks/onShutdown.ts # Graceful shutdown hook
|
|
53
|
+
package.json
|
|
54
|
+
tsconfig.json
|
|
55
|
+
.env
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Markdown-based output:**
|
|
59
|
+
```
|
|
60
|
+
my-agent/
|
|
61
|
+
start.ts # Agent entry point
|
|
62
|
+
agent.md # Main configuration (Markdown)
|
|
63
|
+
skills/ # Skill definitions (.md files)
|
|
64
|
+
personality/ # Bio and trait definitions
|
|
65
|
+
prompts/system.md # System prompt template
|
|
66
|
+
memory/context.md # Long-term context
|
|
67
|
+
package.json
|
|
68
|
+
.env
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `moltium start`
|
|
72
|
+
|
|
73
|
+
Start the agent locally from the current directory.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
moltium start # Default port 3000
|
|
77
|
+
moltium start --port 8080 # Custom port
|
|
78
|
+
moltium start --debug # Enable debug logging
|
|
79
|
+
moltium start --env .env.local # Custom env file
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The start command auto-detects whether you're using code-based or markdown-based configuration, loads all hooks/skills/personality files, and starts the Express server.
|
|
83
|
+
|
|
84
|
+
### `moltium deploy [platform]`
|
|
85
|
+
|
|
86
|
+
Deploy your agent to a cloud platform.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
moltium deploy railway # Deploy to Railway
|
|
90
|
+
moltium deploy render # Deploy to Render
|
|
91
|
+
moltium deploy aws # Deploy to AWS (ECS/Fargate)
|
|
92
|
+
moltium deploy digitalocean # Deploy to DigitalOcean App Platform
|
|
93
|
+
moltium deploy custom # Deploy using custom config
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Each platform has prerequisites (CLI tools, API keys). Run `moltium deploy` without arguments to see all available platforms.
|
|
97
|
+
|
|
98
|
+
Deployment configuration is read from `deployment.config.ts` in your project directory. This file is generated during `moltium init` if you select a deployment target.
|
|
99
|
+
|
|
100
|
+
### `moltium config show`
|
|
101
|
+
|
|
102
|
+
Display the current agent configuration.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
moltium config show # Show parsed config
|
|
106
|
+
moltium config validate # Validate config without starting
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `moltium migrate`
|
|
110
|
+
|
|
111
|
+
Migrate between configuration types.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Convert code config to markdown
|
|
115
|
+
moltium migrate --from code --to markdown
|
|
116
|
+
|
|
117
|
+
# Convert markdown config to code
|
|
118
|
+
moltium migrate --from markdown --to code
|
|
119
|
+
|
|
120
|
+
# Keep the original file (don't rename to .bak)
|
|
121
|
+
moltium migrate --from code --to markdown --keep
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Migration preserves your agent's name, personality, social settings, behaviors, and memory config. Code-to-markdown generates skill files from your actions. Markdown-to-code generates hook stubs and a TypeScript config.
|
|
125
|
+
|
|
126
|
+
### `moltium status`
|
|
127
|
+
|
|
128
|
+
Check if your agent is running.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
moltium status # Check localhost:3000
|
|
132
|
+
moltium status --port 8080 # Check custom port
|
|
133
|
+
moltium status --remote https://my-agent.up.railway.app # Check remote
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Configuration Types
|
|
137
|
+
|
|
138
|
+
### Code-Based (TypeScript)
|
|
139
|
+
|
|
140
|
+
For developers who want full type safety and maximum flexibility.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// agent.config.ts
|
|
144
|
+
import type { AgentConfig } from '@moltium/core';
|
|
145
|
+
import { myCustomAction } from './actions/my-action.js';
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
name: 'my-agent',
|
|
149
|
+
type: 'assistant',
|
|
150
|
+
personality: {
|
|
151
|
+
traits: ['helpful', 'curious'],
|
|
152
|
+
bio: 'A helpful autonomous agent.',
|
|
153
|
+
},
|
|
154
|
+
llm: {
|
|
155
|
+
provider: 'anthropic',
|
|
156
|
+
model: 'claude-sonnet-4-20250514',
|
|
157
|
+
apiKey: process.env.ANTHROPIC_API_KEY!,
|
|
158
|
+
},
|
|
159
|
+
social: {},
|
|
160
|
+
behaviors: {
|
|
161
|
+
autonomous: true,
|
|
162
|
+
decisionMaking: 'llm-driven',
|
|
163
|
+
actionsPerHour: 5,
|
|
164
|
+
},
|
|
165
|
+
memory: { type: 'memory' },
|
|
166
|
+
actions: ['post_social_update'],
|
|
167
|
+
customActions: [myCustomAction],
|
|
168
|
+
} satisfies AgentConfig;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Markdown-Based (Natural Language)
|
|
172
|
+
|
|
173
|
+
For non-developers who prefer simple, readable configuration.
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
# Agent Configuration
|
|
177
|
+
|
|
178
|
+
## Identity
|
|
179
|
+
name: my-agent
|
|
180
|
+
type: assistant
|
|
181
|
+
personality: helpful, curious
|
|
182
|
+
|
|
183
|
+
## Bio
|
|
184
|
+
A helpful autonomous agent that assists with daily tasks.
|
|
185
|
+
|
|
186
|
+
## Behaviors
|
|
187
|
+
autonomous: true
|
|
188
|
+
decision_making: llm-driven
|
|
189
|
+
actions_per_hour: 5
|
|
190
|
+
|
|
191
|
+
## Skills
|
|
192
|
+
|
|
193
|
+
### Respond to Messages
|
|
194
|
+
Handle incoming messages with helpful, concise responses.
|
|
195
|
+
|
|
196
|
+
### Post Updates
|
|
197
|
+
Share useful tips and insights with the community.
|
|
198
|
+
|
|
199
|
+
## Memory
|
|
200
|
+
type: memory
|
|
201
|
+
retention: 30 days
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Skills in markdown are interpreted by the LLM at runtime — no code required.
|
|
205
|
+
|
|
206
|
+
## Deployment Targets
|
|
207
|
+
|
|
208
|
+
| Platform | Method | Prerequisites |
|
|
209
|
+
|----------|--------|---------------|
|
|
210
|
+
| Railway | CLI | `npm i -g @railway/cli` + `railway login` |
|
|
211
|
+
| Render | REST API | `RENDER_API_KEY` in `.env` |
|
|
212
|
+
| AWS | ECS/Fargate | AWS CLI configured (`aws configure`) |
|
|
213
|
+
| DigitalOcean | App Platform API | `DO_API_TOKEN` in `.env` |
|
|
214
|
+
| Custom | Docker/SSH/CLI/API | Varies by method |
|
|
215
|
+
|
|
216
|
+
### Custom Deployment
|
|
217
|
+
|
|
218
|
+
The custom deployer supports four methods. Configure in `deployment.config.ts`:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
import type { DeploymentConfig } from '@moltium/core';
|
|
222
|
+
|
|
223
|
+
export default {
|
|
224
|
+
platform: 'custom',
|
|
225
|
+
customConfig: {
|
|
226
|
+
deploymentMethod: 'docker', // 'docker' | 'ssh' | 'cli' | 'api'
|
|
227
|
+
buildCommand: 'npm run build',
|
|
228
|
+
startCommand: 'npm start',
|
|
229
|
+
docker: {
|
|
230
|
+
registry: 'docker.io',
|
|
231
|
+
imageName: 'my-agent',
|
|
232
|
+
hostUrl: 'localhost',
|
|
233
|
+
containerPort: 3000,
|
|
234
|
+
hostPort: 80,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
} satisfies DeploymentConfig;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Environment Variables
|
|
241
|
+
|
|
242
|
+
Your `.env` file (generated by `moltium init`):
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# LLM (at least one required)
|
|
246
|
+
ANTHROPIC_API_KEY=your-api-key-here
|
|
247
|
+
OPENAI_API_KEY=your-api-key-here
|
|
248
|
+
|
|
249
|
+
# Social (per enabled platform)
|
|
250
|
+
MOLTBOOK_API_KEY=your-moltbook-key
|
|
251
|
+
TWITTER_API_KEY=your-twitter-api-key
|
|
252
|
+
TWITTER_API_SECRET=your-twitter-api-secret
|
|
253
|
+
TWITTER_ACCESS_TOKEN=your-twitter-access-token
|
|
254
|
+
TWITTER_ACCESS_SECRET=your-twitter-access-secret
|
|
255
|
+
|
|
256
|
+
# Server
|
|
257
|
+
PORT=3000
|
|
258
|
+
LOG_LEVEL=info
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Running Without Global Install
|
|
262
|
+
|
|
263
|
+
You can also use `npx`:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npx @moltium/cli init my-agent
|
|
267
|
+
npx @moltium/cli start
|
|
268
|
+
npx @moltium/cli deploy railway
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
MIT
|