@agentuity/cli 0.0.6

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 (158) hide show
  1. package/AGENTS.md +139 -0
  2. package/README.md +239 -0
  3. package/bin/cli.ts +71 -0
  4. package/dist/api.d.ts +25 -0
  5. package/dist/api.d.ts.map +1 -0
  6. package/dist/auth.d.ts +7 -0
  7. package/dist/auth.d.ts.map +1 -0
  8. package/dist/banner.d.ts +2 -0
  9. package/dist/banner.d.ts.map +1 -0
  10. package/dist/cli.d.ts +5 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cmd/auth/api.d.ts +9 -0
  13. package/dist/cmd/auth/api.d.ts.map +1 -0
  14. package/dist/cmd/auth/index.d.ts +2 -0
  15. package/dist/cmd/auth/index.d.ts.map +1 -0
  16. package/dist/cmd/auth/login.d.ts +3 -0
  17. package/dist/cmd/auth/login.d.ts.map +1 -0
  18. package/dist/cmd/auth/logout.d.ts +3 -0
  19. package/dist/cmd/auth/logout.d.ts.map +1 -0
  20. package/dist/cmd/bundle/ast.d.ts +2 -0
  21. package/dist/cmd/bundle/ast.d.ts.map +1 -0
  22. package/dist/cmd/bundle/bundler.d.ts +6 -0
  23. package/dist/cmd/bundle/bundler.d.ts.map +1 -0
  24. package/dist/cmd/bundle/file.d.ts +2 -0
  25. package/dist/cmd/bundle/file.d.ts.map +1 -0
  26. package/dist/cmd/bundle/index.d.ts +2 -0
  27. package/dist/cmd/bundle/index.d.ts.map +1 -0
  28. package/dist/cmd/bundle/plugin.d.ts +4 -0
  29. package/dist/cmd/bundle/plugin.d.ts.map +1 -0
  30. package/dist/cmd/dev/index.d.ts +2 -0
  31. package/dist/cmd/dev/index.d.ts.map +1 -0
  32. package/dist/cmd/example/create-user.d.ts +2 -0
  33. package/dist/cmd/example/create-user.d.ts.map +1 -0
  34. package/dist/cmd/example/create.d.ts +2 -0
  35. package/dist/cmd/example/create.d.ts.map +1 -0
  36. package/dist/cmd/example/deploy.d.ts +2 -0
  37. package/dist/cmd/example/deploy.d.ts.map +1 -0
  38. package/dist/cmd/example/index.d.ts +2 -0
  39. package/dist/cmd/example/index.d.ts.map +1 -0
  40. package/dist/cmd/example/list.d.ts +2 -0
  41. package/dist/cmd/example/list.d.ts.map +1 -0
  42. package/dist/cmd/example/run-command.d.ts +2 -0
  43. package/dist/cmd/example/run-command.d.ts.map +1 -0
  44. package/dist/cmd/example/sound.d.ts +3 -0
  45. package/dist/cmd/example/sound.d.ts.map +1 -0
  46. package/dist/cmd/example/spinner.d.ts +2 -0
  47. package/dist/cmd/example/spinner.d.ts.map +1 -0
  48. package/dist/cmd/example/steps.d.ts +2 -0
  49. package/dist/cmd/example/steps.d.ts.map +1 -0
  50. package/dist/cmd/example/version.d.ts +2 -0
  51. package/dist/cmd/example/version.d.ts.map +1 -0
  52. package/dist/cmd/index.d.ts +3 -0
  53. package/dist/cmd/index.d.ts.map +1 -0
  54. package/dist/cmd/profile/create.d.ts +2 -0
  55. package/dist/cmd/profile/create.d.ts.map +1 -0
  56. package/dist/cmd/profile/delete.d.ts +2 -0
  57. package/dist/cmd/profile/delete.d.ts.map +1 -0
  58. package/dist/cmd/profile/index.d.ts +2 -0
  59. package/dist/cmd/profile/index.d.ts.map +1 -0
  60. package/dist/cmd/profile/list.d.ts +3 -0
  61. package/dist/cmd/profile/list.d.ts.map +1 -0
  62. package/dist/cmd/profile/show.d.ts +2 -0
  63. package/dist/cmd/profile/show.d.ts.map +1 -0
  64. package/dist/cmd/profile/use.d.ts +2 -0
  65. package/dist/cmd/profile/use.d.ts.map +1 -0
  66. package/dist/cmd/project/create.d.ts +2 -0
  67. package/dist/cmd/project/create.d.ts.map +1 -0
  68. package/dist/cmd/project/delete.d.ts +2 -0
  69. package/dist/cmd/project/delete.d.ts.map +1 -0
  70. package/dist/cmd/project/index.d.ts +2 -0
  71. package/dist/cmd/project/index.d.ts.map +1 -0
  72. package/dist/cmd/project/list.d.ts +2 -0
  73. package/dist/cmd/project/list.d.ts.map +1 -0
  74. package/dist/cmd/project/show.d.ts +2 -0
  75. package/dist/cmd/project/show.d.ts.map +1 -0
  76. package/dist/cmd/version/index.d.ts +2 -0
  77. package/dist/cmd/version/index.d.ts.map +1 -0
  78. package/dist/command-prefix.d.ts +11 -0
  79. package/dist/command-prefix.d.ts.map +1 -0
  80. package/dist/config.d.ts +16 -0
  81. package/dist/config.d.ts.map +1 -0
  82. package/dist/index.d.ts +18 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/legacy-check.d.ts +6 -0
  85. package/dist/legacy-check.d.ts.map +1 -0
  86. package/dist/logger.d.ts +24 -0
  87. package/dist/logger.d.ts.map +1 -0
  88. package/dist/runtime.d.ts +3 -0
  89. package/dist/runtime.d.ts.map +1 -0
  90. package/dist/schema-parser.d.ts +24 -0
  91. package/dist/schema-parser.d.ts.map +1 -0
  92. package/dist/sound.d.ts +2 -0
  93. package/dist/sound.d.ts.map +1 -0
  94. package/dist/steps.d.ts +59 -0
  95. package/dist/steps.d.ts.map +1 -0
  96. package/dist/terminal.d.ts +3 -0
  97. package/dist/terminal.d.ts.map +1 -0
  98. package/dist/tui.d.ts +156 -0
  99. package/dist/tui.d.ts.map +1 -0
  100. package/dist/types.d.ts +164 -0
  101. package/dist/types.d.ts.map +1 -0
  102. package/dist/version.d.ts +10 -0
  103. package/dist/version.d.ts.map +1 -0
  104. package/package.json +46 -0
  105. package/src/api-errors.md +115 -0
  106. package/src/api.ts +186 -0
  107. package/src/auth.ts +91 -0
  108. package/src/banner.ts +23 -0
  109. package/src/cli.ts +198 -0
  110. package/src/cmd/auth/README.md +95 -0
  111. package/src/cmd/auth/api.ts +71 -0
  112. package/src/cmd/auth/index.ts +9 -0
  113. package/src/cmd/auth/login.ts +76 -0
  114. package/src/cmd/auth/logout.ts +14 -0
  115. package/src/cmd/bundle/ast.ts +228 -0
  116. package/src/cmd/bundle/bundler.ts +88 -0
  117. package/src/cmd/bundle/file.ts +16 -0
  118. package/src/cmd/bundle/index.ts +38 -0
  119. package/src/cmd/bundle/plugin.ts +259 -0
  120. package/src/cmd/dev/index.ts +83 -0
  121. package/src/cmd/example/create-user.ts +38 -0
  122. package/src/cmd/example/create.ts +31 -0
  123. package/src/cmd/example/deploy.ts +36 -0
  124. package/src/cmd/example/index.ts +27 -0
  125. package/src/cmd/example/list.ts +32 -0
  126. package/src/cmd/example/run-command.ts +45 -0
  127. package/src/cmd/example/sound.ts +14 -0
  128. package/src/cmd/example/spinner.ts +44 -0
  129. package/src/cmd/example/steps.ts +66 -0
  130. package/src/cmd/example/version.ts +13 -0
  131. package/src/cmd/index.ts +46 -0
  132. package/src/cmd/profile/README.md +80 -0
  133. package/src/cmd/profile/create.ts +57 -0
  134. package/src/cmd/profile/delete.ts +52 -0
  135. package/src/cmd/profile/index.ts +12 -0
  136. package/src/cmd/profile/list.ts +27 -0
  137. package/src/cmd/profile/show.ts +54 -0
  138. package/src/cmd/profile/use.ts +30 -0
  139. package/src/cmd/project/create.ts +247 -0
  140. package/src/cmd/project/delete.ts +13 -0
  141. package/src/cmd/project/index.ts +11 -0
  142. package/src/cmd/project/list.ts +13 -0
  143. package/src/cmd/project/show.ts +12 -0
  144. package/src/cmd/version/index.ts +16 -0
  145. package/src/command-prefix.ts +43 -0
  146. package/src/config.ts +304 -0
  147. package/src/index.ts +40 -0
  148. package/src/legacy-check.ts +127 -0
  149. package/src/logger.ts +235 -0
  150. package/src/runtime.ts +22 -0
  151. package/src/schema-parser.ts +213 -0
  152. package/src/sound.ts +25 -0
  153. package/src/steps.ts +245 -0
  154. package/src/terminal.ts +151 -0
  155. package/src/tui.md +254 -0
  156. package/src/tui.ts +838 -0
  157. package/src/types.ts +243 -0
  158. package/src/version.ts +29 -0
package/AGENTS.md ADDED
@@ -0,0 +1,139 @@
1
+ # Agent Guidelines for @agentuity/cli
2
+
3
+ ## Package Overview
4
+
5
+ Bun-native CLI framework for Agentuity applications. Provides command structure, auto-discovery, configuration management, and type-safe command options.
6
+
7
+ ## Commands
8
+
9
+ - **Build**: `bun run build` (generates type declarations only)
10
+ - **Typecheck**: `bun run typecheck` (runs TypeScript type checking)
11
+ - **Clean**: `bun run clean` (removes dist/)
12
+ - **Test CLI**: `bun bin/cli.ts` (run CLI directly during development)
13
+
14
+ ## Architecture
15
+
16
+ - **Runtime**: Bun 1.3+ (required for YAML support)
17
+ - **CLI Framework**: commander.js for command parsing and routing
18
+ - **Build target**: Distributes TypeScript source (no bundling needed)
19
+ - **Config**: YAML files loaded from `~/.config/agentuity/config.yaml`
20
+ - **Commands**: Auto-discovered from `src/cmd/` directories
21
+
22
+ ## Structure
23
+
24
+ ```text
25
+ src/
26
+ ├── index.ts # Public API exports
27
+ ├── cli.ts # CLI framework setup
28
+ ├── runtime.ts # Bun runtime validation
29
+ ├── config.ts # YAML config loader
30
+ ├── logger.ts # Structured logger with log levels
31
+ ├── banner.ts # Startup banner display
32
+ ├── types.ts # TypeScript type definitions
33
+ └── cmd/
34
+ ├── index.ts # Command auto-discovery
35
+ └── example/ # Example command with subcommands
36
+ ├── index.ts
37
+ ├── create.ts
38
+ └── list.ts
39
+ bin/
40
+ └── cli.ts # CLI entry point
41
+ ```
42
+
43
+ ## Code Style
44
+
45
+ - **Bun-specific** - Uses Bun 1.3+ features (YAML, semver, colors)
46
+ - **TypeScript** - All code is TypeScript with strict mode
47
+ - **Type-safe options** - Always define interfaces for command options
48
+ - **Commander.js patterns** - Follow commander.js best practices
49
+ - **Async/await** - All I/O operations are async
50
+ - **Path aliases** - Use `@/` prefix for imports (e.g., `import { tui } from '@/tui'` instead of `../../tui`)
51
+
52
+ ## Important Conventions
53
+
54
+ - **Command structure** - Each command is a directory in `src/cmd/` with index.ts
55
+ - **Subcommands** - Define in separate files, export as `SubcommandDefinition`
56
+ - **Type safety** - Always create interfaces for command options (never use `any`)
57
+ - **TUI Output** - Use `tui.*` helpers for formatted output without log prefixes:
58
+ - `tui.success()`, `tui.error()`, `tui.warning()`, `tui.info()` for semantic messages
59
+ - `tui.bold()`, `tui.muted()`, `tui.link()` for text formatting
60
+ - See [src/tui.md](src/tui.md) for full documentation
61
+ - **Logging** - Use `ctx.logger` for standard logging (includes prefixes like `[INFO]`):
62
+ - `logger.fatal(message)` - Log error and exit with code 1 (returns `never`)
63
+ - Use `logger.fatal()` instead of `logger.error()` + `process.exit(1)`
64
+ - **Config** - Commands validate their own config requirements
65
+ - **Bun** - Always use Bun provided APIs vs legacy Node.JS APIs. For example use `Bun.file(f).exists()` instead of `existsSync(f)`
66
+
67
+ ## Creating New Commands
68
+
69
+ 1. Create directory in `src/cmd/`, e.g., `src/cmd/deploy/`
70
+ 2. Create `index.ts` with `CommandDefinition`
71
+ 3. For subcommands, create separate files with `SubcommandDefinition`
72
+ 4. Export default from index.ts
73
+ 5. Command is auto-discovered on next run
74
+
75
+ Example:
76
+
77
+ ```typescript
78
+ // src/cmd/deploy/index.ts
79
+ import type { CommandDefinition, CommandContext } from '../../types';
80
+ import { Command } from 'commander';
81
+
82
+ interface DeployOptions {
83
+ force: boolean;
84
+ dryRun: boolean;
85
+ }
86
+
87
+ export const deployCommand: CommandDefinition = {
88
+ name: 'deploy',
89
+ description: 'Deploy to an environment',
90
+
91
+ register(program: Command, ctx: CommandContext) {
92
+ program
93
+ .command('deploy <environment>')
94
+ .description('Deploy to an environment')
95
+ .option('-f, --force', 'Force deployment', false)
96
+ .option('--dry-run', 'Dry run mode', false)
97
+ .action(async (environment: string, options: DeployOptions) => {
98
+ const { logger, config } = ctx;
99
+
100
+ logger.info(`Deploying to: ${environment}`);
101
+
102
+ if (options.dryRun) {
103
+ logger.info('Dry run mode - no changes made');
104
+ return;
105
+ }
106
+
107
+ // Implementation here
108
+ });
109
+ },
110
+ };
111
+
112
+ export default deployCommand;
113
+ ```
114
+
115
+ ## Testing
116
+
117
+ - Test by running: `bun bin/cli.ts [command]`
118
+ - Test with log levels: `bun bin/cli.ts --log-level=debug [command]`
119
+ - Test with custom config: `bun bin/cli.ts --config=/path/to/config.yaml [command]`
120
+ - Debug mode: `DEBUG=1 bun bin/cli.ts [command]` (shows API request/response details)
121
+
122
+ ### Version Check Bypass (Development Only)
123
+
124
+ For local development, version checks can be bypassed (in priority order):
125
+
126
+ 1. **CLI flag** (highest): `--skip-version-check`
127
+ 2. **Environment variable**: `AGENTUITY_SKIP_VERSION_CHECK=1`
128
+ 3. **Config override**: Add `skip_version_check: true` to profile's `overrides` section
129
+ 4. **Auto-detection** (lowest): Versions `0.0.x` or `dev` are automatically skipped
130
+
131
+ See `.dev-notes.md` for more development tips.
132
+
133
+ ## Publishing Checklist
134
+
135
+ 1. Run `bun run build` to generate type declarations
136
+ 2. Test CLI with `bun bin/cli.ts`
137
+ 3. Verify banner displays correctly with no args
138
+ 4. Test example commands work
139
+ 5. Depends on `@agentuity/core` and `commander` (published separately)
package/README.md ADDED
@@ -0,0 +1,239 @@
1
+ # @agentuity/cli
2
+
3
+ Bun-native CLI framework for Agentuity applications.
4
+
5
+ ## Requirements
6
+
7
+ - Bun 1.3.0 or higher
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ # Global installation
13
+ bun install -g @agentuity/cli
14
+
15
+ # Local installation
16
+ bun add -d @agentuity/cli
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```bash
22
+ # Show banner and help
23
+ agentuity
24
+
25
+ # Run example commands
26
+ agentuity example create my-app
27
+ agentuity example create my-app --type=advanced --force
28
+ agentuity example list
29
+ agentuity example list --json
30
+
31
+ # Global options
32
+ agentuity --log-level=debug example create test
33
+ agentuity --config=/custom/path/config.yaml example list
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ The CLI loads configuration from `~/.config/agentuity/config.yaml` by default.
39
+
40
+ Example config:
41
+
42
+ ```yaml
43
+ # ~/.config/agentuity/config.yaml
44
+ api:
45
+ endpoint: https://api.agentuity.com
46
+ token: your-token-here
47
+
48
+ defaults:
49
+ environment: development
50
+ region: us-west-2
51
+ ```
52
+
53
+ You can override the config path with `--config`:
54
+
55
+ ```bash
56
+ agentuity --config=/path/to/config.yaml [command]
57
+ ```
58
+
59
+ ## Log Levels
60
+
61
+ Control output verbosity with `--log-level`:
62
+
63
+ ```bash
64
+ # Available levels: debug, trace, info, warn, error
65
+ agentuity --log-level=debug example create test
66
+ agentuity --log-level=error example list
67
+ ```
68
+
69
+ ## Creating Commands
70
+
71
+ Commands are auto-discovered from the `src/cmd/` directory. Each command is a directory with an `index.ts` file.
72
+
73
+ ### Simple Command
74
+
75
+ ```typescript
76
+ // src/cmd/version/index.ts
77
+ import type { CommandDefinition, CommandContext } from '@agentuity/cli';
78
+ import { Command } from 'commander';
79
+
80
+ export const versionCommand: CommandDefinition = {
81
+ name: 'version',
82
+ description: 'Display version information',
83
+
84
+ register(program: Command, ctx: CommandContext) {
85
+ program
86
+ .command('version')
87
+ .description('Display version information')
88
+ .action(() => {
89
+ console.log('v1.0.0');
90
+ });
91
+ },
92
+ };
93
+
94
+ export default versionCommand;
95
+ ```
96
+
97
+ ### Command with Options
98
+
99
+ ```typescript
100
+ // src/cmd/deploy/index.ts
101
+ import type { CommandDefinition, CommandContext } from '@agentuity/cli';
102
+ import { Command } from 'commander';
103
+
104
+ interface DeployOptions {
105
+ force: boolean;
106
+ dryRun: boolean;
107
+ }
108
+
109
+ export const deployCommand: CommandDefinition = {
110
+ name: 'deploy',
111
+ description: 'Deploy application',
112
+
113
+ register(program: Command, ctx: CommandContext) {
114
+ program
115
+ .command('deploy <environment>')
116
+ .description('Deploy to an environment')
117
+ .option('-f, --force', 'Force deployment', false)
118
+ .option('--dry-run', 'Dry run mode', false)
119
+ .action(async (environment: string, options: DeployOptions) => {
120
+ const { logger, config } = ctx;
121
+
122
+ logger.info(`Deploying to: ${environment}`);
123
+
124
+ if (options.dryRun) {
125
+ logger.info('Dry run - no changes made');
126
+ return;
127
+ }
128
+
129
+ // Deployment logic here
130
+ });
131
+ },
132
+ };
133
+
134
+ export default deployCommand;
135
+ ```
136
+
137
+ ### Command with Subcommands
138
+
139
+ ```typescript
140
+ // src/cmd/project/index.ts
141
+ import type { CommandDefinition, CommandContext } from '@agentuity/cli';
142
+ import { Command } from 'commander';
143
+ import { createSubcommand } from './create';
144
+ import { listSubcommand } from './list';
145
+
146
+ export const projectCommand: CommandDefinition = {
147
+ name: 'project',
148
+ description: 'Manage projects',
149
+ subcommands: [createSubcommand, listSubcommand],
150
+
151
+ register(program: Command, ctx: CommandContext) {
152
+ const cmd = program.command('project').description('Manage projects');
153
+
154
+ if (this.subcommands) {
155
+ for (const sub of this.subcommands) {
156
+ sub.register(cmd, ctx);
157
+ }
158
+ }
159
+
160
+ cmd.action(() => cmd.help());
161
+ },
162
+ };
163
+
164
+ export default projectCommand;
165
+ ```
166
+
167
+ ```typescript
168
+ // src/cmd/project/create.ts
169
+ import type { SubcommandDefinition, CommandContext } from '@agentuity/cli';
170
+ import { Command } from 'commander';
171
+
172
+ interface CreateOptions {
173
+ template: string;
174
+ }
175
+
176
+ export const createSubcommand: SubcommandDefinition = {
177
+ name: 'create',
178
+ description: 'Create a new project',
179
+
180
+ register(parent: Command, ctx: CommandContext) {
181
+ parent
182
+ .command('create <name>')
183
+ .description('Create a new project')
184
+ .option('-t, --template <template>', 'Project template', 'default')
185
+ .action(async (name: string, options: CreateOptions) => {
186
+ const { logger } = ctx;
187
+ logger.info(`Creating project: ${name}`);
188
+ // Implementation here
189
+ });
190
+ },
191
+ };
192
+ ```
193
+
194
+ ## Command Context
195
+
196
+ Every command receives a `CommandContext` with:
197
+
198
+ - `config`: Loaded YAML configuration
199
+ - `logger`: Structured logger (respects --log-level)
200
+ - `options`: Global CLI options
201
+
202
+ ```typescript
203
+ .action(async (args, options) => {
204
+ const { logger, config } = ctx;
205
+
206
+ // Use logger for output
207
+ logger.info('Starting...');
208
+ logger.debug('Debug info');
209
+ logger.warn('Warning');
210
+ logger.error('Error occurred');
211
+
212
+ // Access config
213
+ const apiToken = config.api?.token;
214
+ });
215
+ ```
216
+
217
+ ## API
218
+
219
+ ### Types
220
+
221
+ - `CommandDefinition` - Main command definition
222
+ - `SubcommandDefinition` - Subcommand definition
223
+ - `CommandContext` - Context passed to commands
224
+ - `Config` - Configuration object (`Record<string, unknown>`)
225
+ - `LogLevel` - Log level type (`'debug' | 'trace' | 'info' | 'warn' | 'error'`)
226
+ - `GlobalOptions` - Global CLI options
227
+
228
+ ### Functions
229
+
230
+ - `createCLI(version: string)` - Create CLI program
231
+ - `registerCommands(program, commands, ctx)` - Register commands
232
+ - `discoverCommands()` - Auto-discover commands from src/cmd/
233
+ - `loadConfig(path?)` - Load YAML config
234
+ - `validateRuntime()` - Validate Bun runtime
235
+ - `showBanner(version)` - Show startup banner
236
+
237
+ ## License
238
+
239
+ MIT
package/bin/cli.ts ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env bun
2
+ import { createCLI, registerCommands } from '../src/cli';
3
+ import { validateRuntime } from '../src/runtime';
4
+ import { loadConfig } from '../src/config';
5
+ import { discoverCommands } from '../src/cmd';
6
+ import { logger } from '../src/logger';
7
+ import { detectColorScheme } from '../src/terminal';
8
+ import { setColorScheme } from '../src/tui';
9
+ import { getVersion } from '../src/version';
10
+ import { checkLegacyCLI } from '../src/legacy-check';
11
+ import type { LogLevel } from '../src/types';
12
+
13
+ validateRuntime();
14
+
15
+ // Check for legacy CLI and warn user (skip if --skip-legacy-check flag is present)
16
+ const skipLegacyCheck = process.argv.includes('--skip-legacy-check');
17
+ if (!skipLegacyCheck) {
18
+ await checkLegacyCLI();
19
+ }
20
+
21
+ const version = getVersion();
22
+
23
+ const program = await createCLI(version);
24
+
25
+ // Parse options early to check for color scheme override
26
+ program.parseOptions(process.argv);
27
+ const earlyOpts = program.opts();
28
+
29
+ // Detect or override terminal color scheme
30
+ let colorScheme = await detectColorScheme();
31
+ if (earlyOpts.colorScheme === 'light' || earlyOpts.colorScheme === 'dark') {
32
+ colorScheme = earlyOpts.colorScheme;
33
+ if (process.env.DEBUG_COLORS) {
34
+ console.log(`[DEBUG] Using --color-scheme=${colorScheme} flag`);
35
+ }
36
+ }
37
+ logger.setColorScheme(colorScheme);
38
+ setColorScheme(colorScheme);
39
+
40
+ // Debug: show detected color scheme
41
+ if (process.env.DEBUG_COLORS) {
42
+ console.log(`[DEBUG] Color scheme: ${colorScheme}`);
43
+ }
44
+
45
+ // Configure logger with global options
46
+ logger.setLevel((earlyOpts.logLevel as LogLevel) || 'info');
47
+ logger.setTimestamp(earlyOpts.logTimestamp || false);
48
+ logger.setShowPrefix(earlyOpts.logPrefix !== false);
49
+
50
+ // Set version check skip flag from CLI option
51
+ if (earlyOpts.skipVersionCheck) {
52
+ process.env.AGENTUITY_SKIP_VERSION_CHECK = '1';
53
+ }
54
+
55
+ const config = await loadConfig(earlyOpts.config);
56
+
57
+ const ctx = {
58
+ config,
59
+ logger,
60
+ options: earlyOpts,
61
+ };
62
+
63
+ const commands = await discoverCommands();
64
+ await registerCommands(program, commands, ctx);
65
+
66
+ try {
67
+ await program.parseAsync(process.argv);
68
+ } catch (error) {
69
+ logger.error('CLI error:', error);
70
+ process.exit(1);
71
+ }
package/dist/api.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * API Client for Agentuity Platform
3
+ *
4
+ * Handles HTTP requests to the API with automatic error parsing and User-Agent headers.
5
+ *
6
+ * Error handling:
7
+ * - UPGRADE_REQUIRED (409): Throws UpgradeRequiredError
8
+ * - Other errors: Throws Error with API message or status text
9
+ *
10
+ * See api-errors.md for full documentation.
11
+ */
12
+ import type { Config } from './types';
13
+ export declare class UpgradeRequiredError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ export declare class APIClient {
17
+ private baseUrl;
18
+ private apiKey?;
19
+ private config?;
20
+ constructor(baseUrl: string, apiKey?: string | undefined, config?: (Config | null) | undefined);
21
+ request<T>(method: string, endpoint: string, body?: unknown): Promise<T>;
22
+ }
23
+ export declare function getAPIBaseURL(config?: Config | null): string;
24
+ export declare function getAppBaseURL(config?: Config | null): string;
25
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAmDtC,qBAAa,oBAAqB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI3B;AAED,qBAAa,SAAS;IAEpB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,MAAM,CAAC;gBAFP,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,MAAM,CAAC,GAAE,MAAM,GAAG,IAAI,aAAA;IAGzB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAkF9E;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAW5D;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAW5D"}
package/dist/auth.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { CommandContext, AuthData } from './types';
2
+ export declare function isTTY(): boolean;
3
+ export declare function hasLoggedInBefore(): boolean;
4
+ export declare function isAuthenticated(): Promise<boolean>;
5
+ export declare function requireAuth(ctx: CommandContext<false>): Promise<AuthData>;
6
+ export declare function withAuth<TArgs extends unknown[]>(ctx: CommandContext<false>, handler: (ctx: CommandContext<true>, ...args: TArgs) => Promise<void> | void): (...args: TArgs) => Promise<void>;
7
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxD,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAMxD;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqD/E;AAED,wBAAgB,QAAQ,CAAC,KAAK,SAAS,OAAO,EAAE,EAC/C,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAC1B,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAC1E,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CASnC"}
@@ -0,0 +1,2 @@
1
+ export declare function showBanner(version: string): void;
2
+ //# sourceMappingURL=banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../src/banner.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAsBhD"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ import type { CommandDefinition, CommandContext } from './types';
3
+ export declare function createCLI(version: string): Promise<Command>;
4
+ export declare function registerCommands(program: Command, commands: CommandDefinition[], baseCtx: CommandContext): Promise<void>;
5
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAwB,cAAc,EAAE,MAAM,SAAS,CAAC;AAKvF,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6BjE;AAyHD,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAqCf"}
@@ -0,0 +1,9 @@
1
+ import type { Config } from '@/types';
2
+ export interface LoginResult {
3
+ apiKey: string;
4
+ userId: string;
5
+ expires: Date;
6
+ }
7
+ export declare function generateLoginOTP(apiUrl: string, config?: Config | null): Promise<string>;
8
+ export declare function pollForLoginCompletion(apiUrl: string, otp: string, config?: Config | null, timeoutMs?: number): Promise<LoginResult>;
9
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/cmd/auth/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAkBtC,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;CACd;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9F;AAED,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EACtB,SAAS,SAAQ,GACf,OAAO,CAAC,WAAW,CAAC,CAyBtB"}
@@ -0,0 +1,2 @@
1
+ export declare const command: import("@/types").CommandDefinition;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/auth/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,qCAIlB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SubcommandDefinition } from '@/types';
2
+ export declare const loginCommand: SubcommandDefinition;
3
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cmd/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAMpD,eAAO,MAAM,YAAY,EAAE,oBAqE1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SubcommandDefinition } from '@/types';
2
+ export declare const logoutCommand: SubcommandDefinition;
3
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/cmd/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAIpD,eAAO,MAAM,aAAa,EAAE,oBAS3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function parseAgentMetadata(rootDir: string, filename: string, contents: string): [string, Map<string, string>];
2
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/cmd/bundle/ast.ts"],"names":[],"mappings":"AAqJA,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACd,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA0E/B"}
@@ -0,0 +1,6 @@
1
+ export interface BundleOptions {
2
+ rootDir: string;
3
+ dev?: boolean;
4
+ }
5
+ export declare function bundle({ dev, rootDir }: BundleOptions): Promise<void>;
6
+ //# sourceMappingURL=bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../src/cmd/bundle/bundler.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED,wBAAsB,MAAM,CAAC,EAAE,GAAW,EAAE,OAAO,EAAE,EAAE,aAAa,iBA4EnE"}
@@ -0,0 +1,2 @@
1
+ export declare function getFilesRecursively(dir: string): Promise<string[]>;
2
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/cmd/bundle/file.ts"],"names":[],"mappings":"AAMA,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASxE"}
@@ -0,0 +1,2 @@
1
+ export declare const command: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/bundle/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,wCAgClB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BunPlugin } from 'bun';
2
+ declare const AgentuityBundler: BunPlugin;
3
+ export default AgentuityBundler;
4
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/cmd/bundle/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAwGrC,QAAA,MAAM,gBAAgB,EAAE,SAwJvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const command: import("@/types").CommandDefinition;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/dev/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,qCA2ElB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const createUserSubcommand: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=create-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-user.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/create-user.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,wCAkC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const createCommand: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/create.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,wCA2BxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const deploySubcommand: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/deploy.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,wCAgC3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const command: import("@/types").CommandDefinition;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO,qCAelB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const listSubcommand: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/list.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,wCA4BzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const runCommandSubcommand: import("@/types").SubcommandDefinition;
2
+ //# sourceMappingURL=run-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/run-command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,wCAyC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SubcommandDefinition } from '../../types';
2
+ export declare const soundSubcommand: SubcommandDefinition;
3
+ //# sourceMappingURL=sound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/sound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD,eAAO,MAAM,eAAe,EAAE,oBAS7B,CAAC"}