0101-agents 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.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/bin/cli.js +50 -7
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # 0101-agents
2
+
3
+ CLI to install, update, and run 0101 Claude Code agents.
4
+
5
+ ```bash
6
+ npm i -g 0101-agents
7
+ 0101-agents login <key>
8
+ 0101-agents install <agent>
9
+ 0101-agents start <agent>
10
+ ```
11
+
12
+ See https://0101.fyi
package/bin/cli.js CHANGED
@@ -254,13 +254,16 @@ async function cmdInstall(args) {
254
254
  mkdirSync(installDir, { recursive: true })
255
255
  unzipInto(zipPath, installDir)
256
256
  rmSync(zipPath, { force: true })
257
- runPostInstall(agent, readManifest(agent))
257
+ const localManifest = readManifest(agent)
258
+ runPostInstall(agent, localManifest)
258
259
  writeInstalledVersion(agent, manifest.latest)
259
260
 
260
261
  console.log('')
261
262
  ok(`Installed ${bold(agent)} ${manifest.latest} → ${installDir}`)
262
263
  info(`Start: 0101-agents start ${agent}`)
263
- info(` or: cd ${installDir} && claude`)
264
+ // The "open in Claude" hint only applies to agent folders. Artifacts with a
265
+ // custom launch (manifest.start, e.g. the runner) aren't opened in Claude.
266
+ if (!localManifest.start) info(` or: cd ${installDir} && claude`)
264
267
  }
265
268
 
266
269
  async function cmdUpdate(args) {
@@ -350,9 +353,46 @@ async function cmdStart(args) {
350
353
  // Artifacts can declare how `start` launches via manifest.start. The runner
351
354
  // sets "npm start"; agents leave it unset and fall through to launching
352
355
  // Claude Code below.
356
+ //
357
+ // For the runner specifically we accept an optional `[slug] [cli]` so
358
+ // power users can run multiple bots in parallel terminals without touching
359
+ // .env. The runner derives STATE_DIR from AGENT_DIR, so per-agent state is
360
+ // automatic — we only need to override AGENT_DIR here.
361
+ //
362
+ // start runner → npm start (Telegram, AGENT_DIR from .env)
363
+ // start runner cli → npm start -- --cli (CLI, AGENT_DIR from .env)
364
+ // start runner marketer → npm start (Telegram, AGENT_DIR=~/0101/marketer)
365
+ // start runner marketer cli → npm start -- --cli (CLI, AGENT_DIR=~/0101/marketer)
366
+ // start runner --cli → same as `start runner cli` (long-form flag)
367
+ // start runner -- --cli → same (explicit separator)
353
368
  const startCmd = readManifest(agent).start
354
369
  if (startCmd) {
355
- const child = spawn(startCmd, { cwd: dir, stdio: 'inherit', shell: true })
370
+ let extra = args.slice(1)
371
+ if (extra[0] === '--') extra = extra.slice(1)
372
+
373
+ // Optional [slug] [mode] positionals — `cli` is a reserved mode keyword
374
+ // (no real agent will ever be named "cli"). Anything else that doesn't
375
+ // start with `-` is treated as a slug. Verified installed before we spawn.
376
+ let slug = null
377
+ if (extra[0] && extra[0] !== 'cli' && !extra[0].startsWith('-')) {
378
+ slug = extra.shift()
379
+ if (!existsSync(agentInstallDir(slug))) {
380
+ die(`${slug} is not installed. Try: 0101-agents install ${slug}`)
381
+ }
382
+ }
383
+ extra = extra.map(a => (a === 'cli' ? '--cli' : a))
384
+
385
+ // Override AGENT_DIR per invocation when a slug is given. The runner's
386
+ // config.ts derives STATE_DIR from basename(AGENT_DIR), so the per-agent
387
+ // state/lockfile/incoming dirs follow automatically.
388
+ const childEnv = { ...process.env }
389
+ if (slug) {
390
+ childEnv.AGENT_DIR = agentInstallDir(slug)
391
+ info(`runner: agent=${slug}`)
392
+ }
393
+
394
+ const full = extra.length > 0 ? `${startCmd} -- ${extra.join(' ')}` : startCmd
395
+ const child = spawn(full, { cwd: dir, stdio: 'inherit', shell: true, env: childEnv })
356
396
  child.on('error', (e) => die(`Failed to start: ${e.message}`))
357
397
  child.on('exit', (code) => process.exit(code ?? 0))
358
398
  return
@@ -407,10 +447,13 @@ Commands:
407
447
  ${bold('help')} Show this message
408
448
 
409
449
  Examples:
410
- 0101-agents start marketer
411
- 0101-agents start marketer --tg
412
- 0101-agents start marketer --resume
413
- 0101-agents start marketer -- -p "audit https://example.com"
450
+ 0101-agents start marketer Open in Claude Code
451
+ 0101-agents start marketer --tg Run as a Telegram channel bot via Claude Code
452
+ 0101-agents start marketer --resume Resume the last Claude Code session
453
+ 0101-agents start runner Telegram bot via 0101-runner (uses .env)
454
+ 0101-agents start runner cli Chat with the agent in this terminal
455
+ 0101-agents start runner marketer Run a Telegram bot for marketer (multi-bot)
456
+ 0101-agents start runner marketer cli Terminal chat for marketer
414
457
 
415
458
  Install dir: ${INSTALL_ROOT}
416
459
  Config: ${CONFIG_PATH}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0101-agents",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "0101-agents": "./bin/cli.js"