@agentuity/cli 0.0.43 → 0.0.44

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 (209) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/api.d.ts +3 -3
  4. package/dist/api.d.ts.map +1 -1
  5. package/dist/auth.d.ts +10 -2
  6. package/dist/auth.d.ts.map +1 -1
  7. package/dist/banner.d.ts.map +1 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cmd/auth/api.d.ts +4 -4
  10. package/dist/cmd/auth/api.d.ts.map +1 -1
  11. package/dist/cmd/auth/index.d.ts.map +1 -1
  12. package/dist/cmd/auth/login.d.ts.map +1 -1
  13. package/dist/cmd/auth/signup.d.ts.map +1 -1
  14. package/dist/cmd/auth/ssh/add.d.ts +2 -0
  15. package/dist/cmd/auth/ssh/add.d.ts.map +1 -0
  16. package/dist/cmd/auth/ssh/api.d.ts +16 -0
  17. package/dist/cmd/auth/ssh/api.d.ts.map +1 -0
  18. package/dist/cmd/auth/ssh/delete.d.ts +2 -0
  19. package/dist/cmd/auth/ssh/delete.d.ts.map +1 -0
  20. package/dist/cmd/auth/ssh/index.d.ts +3 -0
  21. package/dist/cmd/auth/ssh/index.d.ts.map +1 -0
  22. package/dist/cmd/auth/ssh/list.d.ts +2 -0
  23. package/dist/cmd/auth/ssh/list.d.ts.map +1 -0
  24. package/dist/cmd/auth/whoami.d.ts.map +1 -1
  25. package/dist/cmd/bundle/ast.d.ts +14 -3
  26. package/dist/cmd/bundle/ast.d.ts.map +1 -1
  27. package/dist/cmd/bundle/ast.test.d.ts +2 -0
  28. package/dist/cmd/bundle/ast.test.d.ts.map +1 -0
  29. package/dist/cmd/bundle/bundler.d.ts +6 -1
  30. package/dist/cmd/bundle/bundler.d.ts.map +1 -1
  31. package/dist/cmd/bundle/file.d.ts.map +1 -1
  32. package/dist/cmd/bundle/fix-duplicate-exports.d.ts +2 -0
  33. package/dist/cmd/bundle/fix-duplicate-exports.d.ts.map +1 -0
  34. package/dist/cmd/bundle/fix-duplicate-exports.test.d.ts +2 -0
  35. package/dist/cmd/bundle/fix-duplicate-exports.test.d.ts.map +1 -0
  36. package/dist/cmd/bundle/plugin.d.ts +2 -0
  37. package/dist/cmd/bundle/plugin.d.ts.map +1 -1
  38. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  39. package/dist/cmd/cloud/domain.d.ts +17 -0
  40. package/dist/cmd/cloud/domain.d.ts.map +1 -0
  41. package/dist/cmd/cloud/index.d.ts.map +1 -1
  42. package/dist/cmd/cloud/resource/add.d.ts +2 -0
  43. package/dist/cmd/cloud/resource/add.d.ts.map +1 -0
  44. package/dist/cmd/cloud/resource/delete.d.ts +2 -0
  45. package/dist/cmd/cloud/resource/delete.d.ts.map +1 -0
  46. package/dist/cmd/cloud/resource/index.d.ts +3 -0
  47. package/dist/cmd/cloud/resource/index.d.ts.map +1 -0
  48. package/dist/cmd/cloud/resource/list.d.ts +2 -0
  49. package/dist/cmd/cloud/resource/list.d.ts.map +1 -0
  50. package/dist/cmd/cloud/scp/download.d.ts +2 -0
  51. package/dist/cmd/cloud/scp/download.d.ts.map +1 -0
  52. package/dist/cmd/cloud/scp/index.d.ts +3 -0
  53. package/dist/cmd/cloud/scp/index.d.ts.map +1 -0
  54. package/dist/cmd/cloud/scp/upload.d.ts +2 -0
  55. package/dist/cmd/cloud/scp/upload.d.ts.map +1 -0
  56. package/dist/cmd/cloud/ssh.d.ts +2 -0
  57. package/dist/cmd/cloud/ssh.d.ts.map +1 -0
  58. package/dist/cmd/dev/api.d.ts +18 -0
  59. package/dist/cmd/dev/api.d.ts.map +1 -0
  60. package/dist/cmd/dev/download.d.ts +11 -0
  61. package/dist/cmd/dev/download.d.ts.map +1 -0
  62. package/dist/cmd/dev/index.d.ts.map +1 -1
  63. package/dist/cmd/dev/templates.d.ts +3 -0
  64. package/dist/cmd/dev/templates.d.ts.map +1 -0
  65. package/dist/cmd/env/delete.d.ts.map +1 -1
  66. package/dist/cmd/env/get.d.ts.map +1 -1
  67. package/dist/cmd/env/import.d.ts.map +1 -1
  68. package/dist/cmd/env/list.d.ts.map +1 -1
  69. package/dist/cmd/env/pull.d.ts.map +1 -1
  70. package/dist/cmd/env/push.d.ts.map +1 -1
  71. package/dist/cmd/env/set.d.ts.map +1 -1
  72. package/dist/cmd/profile/show.d.ts.map +1 -1
  73. package/dist/cmd/project/create.d.ts.map +1 -1
  74. package/dist/cmd/project/delete.d.ts.map +1 -1
  75. package/dist/cmd/project/list.d.ts.map +1 -1
  76. package/dist/cmd/project/show.d.ts.map +1 -1
  77. package/dist/cmd/project/template-flow.d.ts +4 -0
  78. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  79. package/dist/cmd/secret/delete.d.ts.map +1 -1
  80. package/dist/cmd/secret/get.d.ts.map +1 -1
  81. package/dist/cmd/secret/import.d.ts.map +1 -1
  82. package/dist/cmd/secret/list.d.ts.map +1 -1
  83. package/dist/cmd/secret/pull.d.ts.map +1 -1
  84. package/dist/cmd/secret/push.d.ts.map +1 -1
  85. package/dist/cmd/secret/set.d.ts.map +1 -1
  86. package/dist/config.d.ts +9 -3
  87. package/dist/config.d.ts.map +1 -1
  88. package/dist/crypto/box.d.ts +65 -0
  89. package/dist/crypto/box.d.ts.map +1 -0
  90. package/dist/crypto/box.test.d.ts +2 -0
  91. package/dist/crypto/box.test.d.ts.map +1 -0
  92. package/dist/download.d.ts.map +1 -1
  93. package/dist/steps.d.ts +4 -1
  94. package/dist/steps.d.ts.map +1 -1
  95. package/dist/terminal.d.ts.map +1 -1
  96. package/dist/tui.d.ts +31 -1
  97. package/dist/tui.d.ts.map +1 -1
  98. package/dist/types.d.ts +249 -126
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/utils/detectSubagent.d.ts +15 -0
  101. package/dist/utils/detectSubagent.d.ts.map +1 -0
  102. package/dist/utils/zip.d.ts +7 -0
  103. package/dist/utils/zip.d.ts.map +1 -0
  104. package/package.json +11 -3
  105. package/src/api-errors.md +2 -2
  106. package/src/api.ts +12 -7
  107. package/src/auth.ts +116 -7
  108. package/src/banner.ts +13 -6
  109. package/src/cli.ts +695 -63
  110. package/src/cmd/auth/api.ts +10 -16
  111. package/src/cmd/auth/index.ts +2 -1
  112. package/src/cmd/auth/login.ts +24 -8
  113. package/src/cmd/auth/signup.ts +15 -11
  114. package/src/cmd/auth/ssh/add.ts +263 -0
  115. package/src/cmd/auth/ssh/api.ts +94 -0
  116. package/src/cmd/auth/ssh/delete.ts +102 -0
  117. package/src/cmd/auth/ssh/index.ts +10 -0
  118. package/src/cmd/auth/ssh/list.ts +74 -0
  119. package/src/cmd/auth/whoami.ts +13 -13
  120. package/src/cmd/bundle/ast.test.ts +565 -0
  121. package/src/cmd/bundle/ast.ts +457 -44
  122. package/src/cmd/bundle/bundler.ts +255 -57
  123. package/src/cmd/bundle/file.ts +6 -12
  124. package/src/cmd/bundle/fix-duplicate-exports.test.ts +387 -0
  125. package/src/cmd/bundle/fix-duplicate-exports.ts +204 -0
  126. package/src/cmd/bundle/index.ts +9 -9
  127. package/src/cmd/bundle/patch/aisdk.ts +1 -1
  128. package/src/cmd/bundle/plugin.ts +373 -53
  129. package/src/cmd/cloud/deploy.ts +300 -93
  130. package/src/cmd/cloud/domain.ts +92 -0
  131. package/src/cmd/cloud/index.ts +4 -1
  132. package/src/cmd/cloud/resource/add.ts +56 -0
  133. package/src/cmd/cloud/resource/delete.ts +120 -0
  134. package/src/cmd/cloud/resource/index.ts +11 -0
  135. package/src/cmd/cloud/resource/list.ts +69 -0
  136. package/src/cmd/cloud/scp/download.ts +59 -0
  137. package/src/cmd/cloud/scp/index.ts +9 -0
  138. package/src/cmd/cloud/scp/upload.ts +62 -0
  139. package/src/cmd/cloud/ssh.ts +68 -0
  140. package/src/cmd/dev/api.ts +46 -0
  141. package/src/cmd/dev/download.ts +111 -0
  142. package/src/cmd/dev/index.ts +360 -34
  143. package/src/cmd/dev/templates.ts +84 -0
  144. package/src/cmd/env/delete.ts +5 -20
  145. package/src/cmd/env/get.ts +5 -18
  146. package/src/cmd/env/import.ts +5 -20
  147. package/src/cmd/env/list.ts +5 -18
  148. package/src/cmd/env/pull.ts +10 -23
  149. package/src/cmd/env/push.ts +5 -23
  150. package/src/cmd/env/set.ts +5 -20
  151. package/src/cmd/index.ts +2 -2
  152. package/src/cmd/profile/show.ts +15 -6
  153. package/src/cmd/project/create.ts +7 -2
  154. package/src/cmd/project/delete.ts +75 -18
  155. package/src/cmd/project/download.ts +2 -2
  156. package/src/cmd/project/list.ts +8 -8
  157. package/src/cmd/project/show.ts +3 -7
  158. package/src/cmd/project/template-flow.ts +170 -72
  159. package/src/cmd/secret/delete.ts +5 -20
  160. package/src/cmd/secret/get.ts +5 -18
  161. package/src/cmd/secret/import.ts +5 -20
  162. package/src/cmd/secret/list.ts +5 -18
  163. package/src/cmd/secret/pull.ts +10 -23
  164. package/src/cmd/secret/push.ts +5 -23
  165. package/src/cmd/secret/set.ts +5 -20
  166. package/src/config.ts +224 -24
  167. package/src/crypto/box.test.ts +431 -0
  168. package/src/crypto/box.ts +477 -0
  169. package/src/download.ts +1 -0
  170. package/src/env-util.test.ts +1 -1
  171. package/src/steps.ts +65 -6
  172. package/src/terminal.ts +24 -23
  173. package/src/tui.ts +192 -61
  174. package/src/types.ts +291 -201
  175. package/src/utils/detectSubagent.ts +31 -0
  176. package/src/utils/zip.ts +38 -0
  177. package/dist/cmd/example/create-user.d.ts +0 -2
  178. package/dist/cmd/example/create-user.d.ts.map +0 -1
  179. package/dist/cmd/example/create.d.ts +0 -2
  180. package/dist/cmd/example/create.d.ts.map +0 -1
  181. package/dist/cmd/example/deploy.d.ts +0 -2
  182. package/dist/cmd/example/deploy.d.ts.map +0 -1
  183. package/dist/cmd/example/index.d.ts +0 -2
  184. package/dist/cmd/example/index.d.ts.map +0 -1
  185. package/dist/cmd/example/list.d.ts +0 -2
  186. package/dist/cmd/example/list.d.ts.map +0 -1
  187. package/dist/cmd/example/optional-auth.d.ts +0 -3
  188. package/dist/cmd/example/optional-auth.d.ts.map +0 -1
  189. package/dist/cmd/example/run-command.d.ts +0 -2
  190. package/dist/cmd/example/run-command.d.ts.map +0 -1
  191. package/dist/cmd/example/sound.d.ts +0 -3
  192. package/dist/cmd/example/sound.d.ts.map +0 -1
  193. package/dist/cmd/example/spinner.d.ts +0 -2
  194. package/dist/cmd/example/spinner.d.ts.map +0 -1
  195. package/dist/cmd/example/steps.d.ts +0 -2
  196. package/dist/cmd/example/steps.d.ts.map +0 -1
  197. package/dist/cmd/example/version.d.ts +0 -2
  198. package/dist/cmd/example/version.d.ts.map +0 -1
  199. package/src/cmd/example/create-user.ts +0 -38
  200. package/src/cmd/example/create.ts +0 -31
  201. package/src/cmd/example/deploy.ts +0 -36
  202. package/src/cmd/example/index.ts +0 -29
  203. package/src/cmd/example/list.ts +0 -32
  204. package/src/cmd/example/optional-auth.ts +0 -38
  205. package/src/cmd/example/run-command.ts +0 -45
  206. package/src/cmd/example/sound.ts +0 -14
  207. package/src/cmd/example/spinner.ts +0 -44
  208. package/src/cmd/example/steps.ts +0 -66
  209. package/src/cmd/example/version.ts +0 -13
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,mCAgBlB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const listSubcommand: import("../..").SubcommandDefinition;
2
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/list.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,sCA4BzB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { SubcommandDefinition } from '../../types';
2
- export declare const optionalAuthSubcommand: SubcommandDefinition;
3
- //# sourceMappingURL=optional-auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optional-auth.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/optional-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA4B,MAAM,aAAa,CAAC;AAGlF,eAAO,MAAM,sBAAsB,EAAE,oBAkCpC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const runCommandSubcommand: import("../..").SubcommandDefinition;
2
- //# sourceMappingURL=run-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/run-command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,sCAyC/B,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { SubcommandDefinition } from '../../types';
2
- export declare const soundSubcommand: SubcommandDefinition;
3
- //# sourceMappingURL=sound.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export declare const spinnerSubcommand: import("../..").SubcommandDefinition;
2
- //# sourceMappingURL=spinner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/spinner.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,sCAwC5B,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const stepsSubcommand: import("../..").SubcommandDefinition;
2
- //# sourceMappingURL=steps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/steps.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,sCA8D1B,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const versionSubcommand: import("../..").SubcommandDefinition;
2
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/cmd/example/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,sCAU5B,CAAC"}
@@ -1,38 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import { z } from 'zod';
3
-
4
- export const createUserSubcommand = createSubcommand({
5
- name: 'create-user',
6
- description: 'Example: Create a user with validation (requires authentication)',
7
- requiresAuth: true,
8
- schema: {
9
- args: z.object({
10
- username: z.string().min(3).max(20).describe('Username for the new user'),
11
- }),
12
- options: z.object({
13
- email: z.string().email().optional().describe('Email address'),
14
- admin: z.boolean().optional().describe('Grant admin privileges'),
15
- age: z.number().int().positive().optional().describe('User age'),
16
- }),
17
- },
18
-
19
- async handler(ctx) {
20
- // ctx.args and ctx.opts are fully typed - NO CASTING NEEDED!
21
- const { logger, auth, args, opts } = ctx;
22
-
23
- logger.info(`Creating user: ${args.username}`);
24
- logger.debug(`Authenticated as: ${auth.userId}`);
25
-
26
- if (opts.email) {
27
- logger.info(`Email: ${opts.email}`);
28
- }
29
- if (opts.admin) {
30
- logger.info('Admin privileges: enabled');
31
- }
32
- if (opts.age) {
33
- logger.info(`Age: ${opts.age}`);
34
- }
35
-
36
- logger.info('User created successfully!');
37
- },
38
- });
@@ -1,31 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import { z } from 'zod';
3
-
4
- export const createCommand = createSubcommand({
5
- name: 'create',
6
- description: 'Create a new example',
7
- schema: {
8
- args: z.object({
9
- name: z.string().describe('Name of the example'),
10
- }),
11
- options: z.object({
12
- type: z.string().optional().describe('Example type'),
13
- force: z.boolean().optional().describe('Force creation'),
14
- }),
15
- },
16
-
17
- async handler(ctx) {
18
- const { logger, args, opts } = ctx;
19
-
20
- logger.trace('Starting create command...');
21
- logger.debug(`Type: ${opts.type || 'default'}`);
22
- logger.debug(`Force: ${opts.force || false}`);
23
- logger.info(`Creating example: ${args.name}`);
24
-
25
- if (opts.force) {
26
- logger.warn('Force mode enabled');
27
- }
28
-
29
- logger.info('Example created successfully!');
30
- },
31
- });
@@ -1,36 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import { z } from 'zod';
3
-
4
- export const deploySubcommand = createSubcommand({
5
- name: 'deploy',
6
- description: 'Example: Deploy to an environment (requires authentication)',
7
- requiresAuth: true,
8
- schema: {
9
- args: z.object({
10
- environment: z.string().describe('Target environment (dev/staging/prod)'),
11
- }),
12
- options: z.object({
13
- force: z.boolean().optional().describe('Force deployment without confirmation'),
14
- dryRun: z.boolean().optional().describe('Preview changes without deploying'),
15
- }),
16
- },
17
-
18
- async handler(ctx) {
19
- // ctx.args and ctx.opts are fully typed - NO CASTING NEEDED!
20
- const { logger, auth, args, opts } = ctx;
21
-
22
- logger.info(`Deploying to: ${args.environment}`);
23
- logger.debug(`Using API key: ${auth.apiKey.substring(0, 8)}...`);
24
-
25
- if (opts.dryRun) {
26
- logger.info('Dry run mode - no changes made');
27
- return;
28
- }
29
-
30
- if (opts.force) {
31
- logger.info('Force deployment enabled');
32
- }
33
-
34
- logger.info('Deployment complete');
35
- },
36
- });
@@ -1,29 +0,0 @@
1
- import { createCommand } from '../../types';
2
- import { createCommand as createSubCmd } from './create';
3
- import { listSubcommand } from './list';
4
- import { stepsSubcommand } from './steps';
5
- import { spinnerSubcommand } from './spinner';
6
- import { deploySubcommand } from './deploy';
7
- import { versionSubcommand } from './version';
8
- import { createUserSubcommand } from './create-user';
9
- import { runCommandSubcommand } from './run-command';
10
- import { soundSubcommand } from './sound';
11
- import { optionalAuthSubcommand } from './optional-auth';
12
-
13
- export const command = createCommand({
14
- name: 'example',
15
- description: 'Example command with subcommands',
16
- hidden: true,
17
- subcommands: [
18
- createSubCmd,
19
- listSubcommand,
20
- stepsSubcommand,
21
- spinnerSubcommand,
22
- deploySubcommand,
23
- versionSubcommand,
24
- createUserSubcommand,
25
- runCommandSubcommand,
26
- soundSubcommand,
27
- optionalAuthSubcommand,
28
- ],
29
- });
@@ -1,32 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import { z } from 'zod';
3
-
4
- export const listSubcommand = createSubcommand({
5
- name: 'list',
6
- description: 'List examples',
7
- schema: {
8
- options: z.object({
9
- all: z.boolean().optional().describe('Show all examples'),
10
- json: z.boolean().optional().describe('Output as JSON'),
11
- }),
12
- },
13
-
14
- async handler(ctx) {
15
- const { logger, opts } = ctx;
16
-
17
- logger.trace('Starting list command...');
18
- logger.debug(`All: ${opts.all || false}`);
19
- logger.debug(`JSON: ${opts.json || false}`);
20
-
21
- const examples = ['example1', 'example2', 'example3'];
22
-
23
- if (opts.json) {
24
- console.log(JSON.stringify(examples));
25
- } else {
26
- logger.info('Examples:');
27
- for (const example of examples) {
28
- logger.info(` - ${example}`);
29
- }
30
- }
31
- },
32
- });
@@ -1,38 +0,0 @@
1
- import type { SubcommandDefinition, CommandContext, AuthData } from '../../types';
2
- import * as tui from '../../tui';
3
-
4
- export const optionalAuthSubcommand: SubcommandDefinition = {
5
- name: 'optional-auth',
6
- description: 'Test optional authentication flow',
7
- optionalAuth: 'Continue with local features only',
8
- handler: async (ctx: CommandContext) => {
9
- tui.newline();
10
-
11
- // Type guard to check if auth is present
12
- const ctxWithAuth = ctx as CommandContext<true>;
13
- if (ctxWithAuth.auth) {
14
- const auth = ctxWithAuth.auth as AuthData;
15
- // User chose to authenticate
16
- tui.success('You are authenticated!');
17
- tui.info(`User ID: ${auth.userId}`);
18
- tui.info(`Session expires: ${auth.expires.toLocaleString()}`);
19
- tui.newline();
20
- tui.info('You can now access cloud features:');
21
- tui.bullet('Deploy to production');
22
- tui.bullet('Access remote resources');
23
- tui.bullet('View team analytics');
24
- } else {
25
- // User chose to continue without auth
26
- tui.info('Running in local mode (no authentication)');
27
- tui.newline();
28
- tui.info('Available local features:');
29
- tui.bullet('Local development');
30
- tui.bullet('Offline testing');
31
- tui.bullet('Build and bundle');
32
- tui.newline();
33
- tui.warning('Some cloud features are unavailable without authentication');
34
- }
35
-
36
- tui.newline();
37
- },
38
- };
@@ -1,45 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import * as tui from '../../tui';
3
-
4
- export const runCommandSubcommand = createSubcommand({
5
- name: 'run-command',
6
- description: 'Demo of runCommand TUI component',
7
-
8
- async handler() {
9
- tui.info('Example 1: Running a successful command\n');
10
- await tui.runCommand({
11
- command: 'echo "Hello, World!"',
12
- cmd: ['echo', 'Hello, World!'],
13
- });
14
-
15
- tui.newline();
16
- tui.info('Example 2: Command with multiple output lines\n');
17
- await tui.runCommand({
18
- command: 'ls -la',
19
- cmd: ['ls', '-la'],
20
- cwd: process.cwd(),
21
- });
22
-
23
- tui.newline();
24
- tui.info('Example 3: Long running command\n');
25
- await tui.runCommand({
26
- command: 'for i in {1..100}; do echo "Line $i"; sleep 0.01; done',
27
- cmd: ['sh', '-c', 'for i in {1..100}; do echo "Line $i"; sleep 0.01; done'],
28
- });
29
-
30
- tui.newline();
31
- tui.info('Example 4: Failing command\n');
32
- const exitCode = await tui.runCommand({
33
- command: 'exit 1',
34
- cmd: ['sh', '-c', 'echo "This will fail"; exit 1'],
35
- });
36
- tui.info(`Exit code: ${exitCode}`);
37
-
38
- tui.newline();
39
- tui.info('Example 5: Tree\n');
40
- await tui.runCommand({
41
- command: 'tree',
42
- cmd: ['tree'],
43
- });
44
- },
45
- });
@@ -1,14 +0,0 @@
1
- import type { SubcommandDefinition } from '../../types';
2
- import * as tui from '../../tui';
3
- import { playSound } from '../../sound';
4
-
5
- export const soundSubcommand: SubcommandDefinition = {
6
- name: 'sound',
7
- description: 'Test completion sound',
8
-
9
- handler() {
10
- tui.info('Playing completion sound...');
11
- playSound();
12
- tui.success('Sound played!');
13
- },
14
- };
@@ -1,44 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import * as tui from '../../tui';
3
-
4
- export const spinnerSubcommand = createSubcommand({
5
- name: 'spinner',
6
- description: 'Demo of spinner TUI component',
7
-
8
- async handler() {
9
- await tui.spinner('Loading configuration...', async () => {
10
- await Bun.sleep(2000);
11
- return { loaded: true };
12
- });
13
-
14
- await tui.spinner('Fetching data...', Bun.sleep(1500));
15
-
16
- const result = await tui.spinner('Processing...', async () => {
17
- await Bun.sleep(1000);
18
- return 42;
19
- });
20
-
21
- tui.info(`Result: ${result}`);
22
-
23
- // Spinner with progress tracking
24
- await tui.spinner({
25
- type: 'progress',
26
- message: 'Downloading file...',
27
- callback: async (progress) => {
28
- for (let i = 0; i <= 100; i += 5) {
29
- progress(i);
30
- await Bun.sleep(100);
31
- }
32
- },
33
- });
34
-
35
- try {
36
- await tui.spinner('This will fail...', async () => {
37
- await Bun.sleep(1000);
38
- throw new Error('Something went wrong!');
39
- });
40
- } catch (err) {
41
- tui.error(`Caught error: ${err instanceof Error ? err.message : String(err)}`);
42
- }
43
- },
44
- });
@@ -1,66 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
- import { runSteps, stepSuccess, stepSkipped, stepError } from '../../steps';
3
-
4
- export const stepsSubcommand = createSubcommand({
5
- name: 'steps',
6
- description: 'Demo of step progress UI component',
7
-
8
- async handler() {
9
- await runSteps([
10
- {
11
- label: 'Launching application...',
12
- run: async () => {
13
- await Bun.sleep(1500);
14
- return stepSuccess();
15
- },
16
- },
17
- {
18
- label: 'Installing dependencies...',
19
- run: async () => {
20
- await Bun.sleep(2000);
21
- return stepSuccess();
22
- },
23
- },
24
- {
25
- label: 'Checking for updates...',
26
- run: async () => {
27
- await Bun.sleep(800);
28
- return stepSkipped('already up to date');
29
- },
30
- },
31
- {
32
- label: 'Registering service...',
33
- run: async () => {
34
- await Bun.sleep(1200);
35
- return stepSuccess();
36
- },
37
- },
38
- {
39
- label: 'Building project...',
40
- run: async () => {
41
- await Bun.sleep(1800);
42
- return stepSuccess();
43
- },
44
- },
45
- {
46
- type: 'progress',
47
- label: 'Downloading packages...',
48
- run: async (progress) => {
49
- // Simulate download with progress updates
50
- for (let i = 0; i <= 100; i += 10) {
51
- progress(i);
52
- await Bun.sleep(200);
53
- }
54
- return stepSuccess();
55
- },
56
- },
57
- {
58
- label: 'Deploying the app ...',
59
- run: async () => {
60
- await Bun.sleep(1200);
61
- return stepError('something bad happened');
62
- },
63
- },
64
- ]);
65
- },
66
- });
@@ -1,13 +0,0 @@
1
- import { createSubcommand } from '../../types';
2
-
3
- export const versionSubcommand = createSubcommand({
4
- name: 'version',
5
- description: 'Example: Display version information (no auth required)',
6
-
7
- async handler(ctx) {
8
- const { logger } = ctx;
9
-
10
- logger.info('Version 1.0.0');
11
- logger.info('This command does not require authentication');
12
- },
13
- });