@promus/cli 0.24.23 → 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.23",
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')