@promus/cli 0.24.22 → 0.24.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promus/cli",
3
- "version": "0.24.22",
3
+ "version": "0.24.24",
4
4
  "type": "module",
5
5
  "description": "Promus CLI: sovereign agent gateway on Arbitrum. Runs `promus init` to mint an iNFT and bring up your agent",
6
6
  "license": "MIT",
@@ -48,7 +48,20 @@ import { pickOperatorSigner } from './init/operator-picker'
48
48
  import { initialWizardState, updateWizardState, writeWizardState } from './init/wizard-state'
49
49
 
50
50
  export async function runInit(opts?: { cwd?: string; resume?: boolean }): Promise<void> {
51
- const configPath = agentPaths.config
51
+ const globalConfig = agentPaths.config
52
+ const localConfig = join(process.cwd(), 'promus.config.ts')
53
+ // Use local config if it exists, else global, else create in cwd
54
+ const configPath = existsSync(localConfig)
55
+ ? localConfig
56
+ : existsSync(globalConfig)
57
+ ? globalConfig
58
+ : localConfig
59
+
60
+ // When init creates a config in cwd, set PROMUS_ROOT so agent data
61
+ // (keystore, sessions, etc.) also lives in cwd.
62
+ if (configPath === localConfig && !process.env.PROMUS_ROOT) {
63
+ process.env.PROMUS_ROOT = process.cwd()
64
+ }
52
65
 
53
66
  intro('promus init')
54
67
 
@@ -13,6 +13,15 @@ import { type PromusConfig, agentPaths } from '@promus/core'
13
13
  export async function findAndLoadConfig(
14
14
  startDir: string = process.cwd(),
15
15
  ): Promise<{ config: PromusConfig; path: string } | null> {
16
+ // 1. Check cwd first (project-local config)
17
+ const localCandidate = resolve(startDir, 'promus.config.ts')
18
+ if (existsSync(localCandidate)) {
19
+ const mod = (await import(localCandidate)) as { default: PromusConfig }
20
+ if (!mod.default) throw new Error(`promus.config.ts at ${localCandidate} has no default export`)
21
+ return { config: mod.default, path: localCandidate }
22
+ }
23
+
24
+ // 2. Fall back to global ~/.promus/config.ts
16
25
  const canonical = agentPaths.config
17
26
  if (existsSync(canonical)) {
18
27
  const mod = (await import(canonical)) as { default: PromusConfig }
@@ -20,6 +29,7 @@ export async function findAndLoadConfig(
20
29
  return { config: mod.default, path: canonical }
21
30
  }
22
31
 
32
+ // 3. Walk upward from cwd (legacy v0.5.0 pattern)
23
33
  let dir = resolve(startDir)
24
34
  while (true) {
25
35
  const candidate = resolve(dir, 'promus.config.ts')
package/src/index.ts CHANGED
@@ -4,6 +4,20 @@
4
4
  */
5
5
 
6
6
  const argv = process.argv.slice(2)
7
+
8
+ // --root <dir> override PROMUS_ROOT so each agent gets its own config + data.
9
+ // Must be parsed before any subcommand to affect agentPaths / config loading.
10
+ const rootIdx = argv.indexOf('--root')
11
+ if (rootIdx >= 0) {
12
+ const root = argv[rootIdx + 1]
13
+ if (!root) {
14
+ console.error('promus --root requires a directory path')
15
+ process.exit(1)
16
+ }
17
+ process.env.PROMUS_ROOT = root
18
+ argv.splice(rootIdx, 2) // remove --root <dir> from argv
19
+ }
20
+
7
21
  // First arg starting with `--` means the user invoked the default subcommand
8
22
  // (chat) with flags, e.g. `promus --yolo`. Treat it as if `chat` were implicit.
9
23
  // Exception: `--help` and `--version` are top-level commands, not chat flags.
@@ -330,6 +344,10 @@ function printHelp(): void {
330
344
  [
331
345
  'promus: sovereign agent harness CLI',
332
346
  '',
347
+ 'Global flags:',
348
+ ' --root <dir> use a separate agent root (config, keystore, sessions)',
349
+ ' enables running multiple agents on the same machine',
350
+ '',
333
351
  'Commands:',
334
352
  ' promus init bootstrap a new agent identity + keystore',
335
353
  ' promus [--yolo] interactive chat with your agent (default; --yolo skips approvals)',