@agentuity/cli 0.0.109 → 0.0.111

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 (253) hide show
  1. package/dist/build-report.d.ts +201 -0
  2. package/dist/build-report.d.ts.map +1 -0
  3. package/dist/build-report.js +335 -0
  4. package/dist/build-report.js.map +1 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +19 -4
  7. package/dist/cli.js.map +1 -1
  8. package/dist/cmd/build/entry-generator.d.ts.map +1 -1
  9. package/dist/cmd/build/entry-generator.js +3 -1
  10. package/dist/cmd/build/entry-generator.js.map +1 -1
  11. package/dist/cmd/build/index.d.ts.map +1 -1
  12. package/dist/cmd/build/index.js +44 -1
  13. package/dist/cmd/build/index.js.map +1 -1
  14. package/dist/cmd/build/typecheck.d.ts +7 -1
  15. package/dist/cmd/build/typecheck.d.ts.map +1 -1
  16. package/dist/cmd/build/typecheck.js +11 -1
  17. package/dist/cmd/build/typecheck.js.map +1 -1
  18. package/dist/cmd/build/vite/agent-discovery.d.ts +1 -1
  19. package/dist/cmd/build/vite/agent-discovery.d.ts.map +1 -1
  20. package/dist/cmd/build/vite/agent-discovery.js +3 -3
  21. package/dist/cmd/build/vite/agent-discovery.js.map +1 -1
  22. package/dist/cmd/build/vite/index.d.ts +2 -1
  23. package/dist/cmd/build/vite/index.d.ts.map +1 -1
  24. package/dist/cmd/build/vite/index.js +3 -2
  25. package/dist/cmd/build/vite/index.js.map +1 -1
  26. package/dist/cmd/build/vite/metadata-generator.d.ts.map +1 -1
  27. package/dist/cmd/build/vite/metadata-generator.js +3 -5
  28. package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
  29. package/dist/cmd/build/vite/registry-generator.d.ts +1 -1
  30. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  31. package/dist/cmd/build/vite/registry-generator.js +126 -41
  32. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  33. package/dist/cmd/build/vite/route-discovery.d.ts +6 -0
  34. package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -1
  35. package/dist/cmd/build/vite/route-discovery.js +19 -0
  36. package/dist/cmd/build/vite/route-discovery.js.map +1 -1
  37. package/dist/cmd/build/vite/vite-builder.d.ts +3 -0
  38. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  39. package/dist/cmd/build/vite/vite-builder.js +10 -2
  40. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  41. package/dist/cmd/build/vite-bundler.d.ts +3 -0
  42. package/dist/cmd/build/vite-bundler.d.ts.map +1 -1
  43. package/dist/cmd/build/vite-bundler.js +14 -5
  44. package/dist/cmd/build/vite-bundler.js.map +1 -1
  45. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  46. package/dist/cmd/cloud/deploy.js +149 -10
  47. package/dist/cmd/cloud/deploy.js.map +1 -1
  48. package/dist/cmd/cloud/deployment/show.d.ts.map +1 -1
  49. package/dist/cmd/cloud/deployment/show.js +0 -1
  50. package/dist/cmd/cloud/deployment/show.js.map +1 -1
  51. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
  52. package/dist/cmd/cloud/sandbox/create.js +18 -0
  53. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  54. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
  55. package/dist/cmd/cloud/sandbox/delete.js +2 -6
  56. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  57. package/dist/cmd/cloud/sandbox/download.d.ts +3 -0
  58. package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -0
  59. package/dist/cmd/cloud/sandbox/download.js +89 -0
  60. package/dist/cmd/cloud/sandbox/download.js.map +1 -0
  61. package/dist/cmd/cloud/sandbox/env.d.ts +3 -0
  62. package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -0
  63. package/dist/cmd/cloud/sandbox/env.js +90 -0
  64. package/dist/cmd/cloud/sandbox/env.js.map +1 -0
  65. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  66. package/dist/cmd/cloud/sandbox/get.js +5 -0
  67. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  68. package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
  69. package/dist/cmd/cloud/sandbox/index.js +14 -0
  70. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  71. package/dist/cmd/cloud/sandbox/ls.d.ts +3 -0
  72. package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -0
  73. package/dist/cmd/cloud/sandbox/ls.js +119 -0
  74. package/dist/cmd/cloud/sandbox/ls.js.map +1 -0
  75. package/dist/cmd/cloud/sandbox/mkdir.d.ts +3 -0
  76. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -0
  77. package/dist/cmd/cloud/sandbox/mkdir.js +59 -0
  78. package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -0
  79. package/dist/cmd/cloud/sandbox/rm.d.ts +3 -0
  80. package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -0
  81. package/dist/cmd/cloud/sandbox/rm.js +45 -0
  82. package/dist/cmd/cloud/sandbox/rm.js.map +1 -0
  83. package/dist/cmd/cloud/sandbox/rmdir.d.ts +3 -0
  84. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -0
  85. package/dist/cmd/cloud/sandbox/rmdir.js +59 -0
  86. package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -0
  87. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  88. package/dist/cmd/cloud/sandbox/snapshot/create.js +0 -2
  89. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  90. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  91. package/dist/cmd/cloud/sandbox/snapshot/get.js +0 -2
  92. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  93. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
  94. package/dist/cmd/cloud/sandbox/snapshot/list.js +0 -3
  95. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  96. package/dist/cmd/cloud/sandbox/upload.d.ts +3 -0
  97. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -0
  98. package/dist/cmd/cloud/sandbox/upload.js +77 -0
  99. package/dist/cmd/cloud/sandbox/upload.js.map +1 -0
  100. package/dist/cmd/dev/index.d.ts.map +1 -1
  101. package/dist/cmd/dev/index.js +126 -23
  102. package/dist/cmd/dev/index.js.map +1 -1
  103. package/dist/cmd/dev/sync.d.ts.map +1 -1
  104. package/dist/cmd/dev/sync.js +8 -14
  105. package/dist/cmd/dev/sync.js.map +1 -1
  106. package/dist/cmd/git/account/add.d.ts +17 -0
  107. package/dist/cmd/git/account/add.d.ts.map +1 -0
  108. package/dist/cmd/git/account/add.js +244 -0
  109. package/dist/cmd/git/account/add.js.map +1 -0
  110. package/dist/cmd/git/account/index.d.ts +3 -0
  111. package/dist/cmd/git/account/index.d.ts.map +1 -0
  112. package/dist/cmd/git/account/index.js +11 -0
  113. package/dist/cmd/git/account/index.js.map +1 -0
  114. package/dist/cmd/git/account/list.d.ts +2 -0
  115. package/dist/cmd/git/account/list.d.ts.map +1 -0
  116. package/dist/cmd/git/account/list.js +111 -0
  117. package/dist/cmd/git/account/list.js.map +1 -0
  118. package/dist/cmd/git/account/remove.d.ts +2 -0
  119. package/dist/cmd/git/account/remove.d.ts.map +1 -0
  120. package/dist/cmd/git/account/remove.js +171 -0
  121. package/dist/cmd/git/account/remove.js.map +1 -0
  122. package/dist/cmd/git/index.d.ts +3 -0
  123. package/dist/cmd/git/index.d.ts.map +1 -0
  124. package/dist/cmd/git/index.js +19 -0
  125. package/dist/cmd/git/index.js.map +1 -0
  126. package/dist/cmd/git/link.d.ts +32 -0
  127. package/dist/cmd/git/link.d.ts.map +1 -0
  128. package/dist/cmd/git/link.js +357 -0
  129. package/dist/cmd/git/link.js.map +1 -0
  130. package/dist/cmd/git/list.d.ts +2 -0
  131. package/dist/cmd/git/list.d.ts.map +1 -0
  132. package/dist/cmd/git/list.js +137 -0
  133. package/dist/cmd/git/list.js.map +1 -0
  134. package/dist/cmd/git/status.d.ts +2 -0
  135. package/dist/cmd/git/status.d.ts.map +1 -0
  136. package/dist/cmd/git/status.js +119 -0
  137. package/dist/cmd/git/status.js.map +1 -0
  138. package/dist/cmd/git/unlink.d.ts +2 -0
  139. package/dist/cmd/git/unlink.d.ts.map +1 -0
  140. package/dist/cmd/git/unlink.js +98 -0
  141. package/dist/cmd/git/unlink.js.map +1 -0
  142. package/dist/cmd/index.d.ts.map +1 -1
  143. package/dist/cmd/index.js +2 -0
  144. package/dist/cmd/index.js.map +1 -1
  145. package/dist/cmd/integration/api.d.ts +61 -0
  146. package/dist/cmd/integration/api.d.ts.map +1 -0
  147. package/dist/cmd/integration/api.js +176 -0
  148. package/dist/cmd/integration/api.js.map +1 -0
  149. package/dist/cmd/integration/github/connect.d.ts +2 -0
  150. package/dist/cmd/integration/github/connect.d.ts.map +1 -0
  151. package/dist/cmd/integration/github/connect.js +197 -0
  152. package/dist/cmd/integration/github/connect.js.map +1 -0
  153. package/dist/cmd/integration/github/disconnect.d.ts +2 -0
  154. package/dist/cmd/integration/github/disconnect.d.ts.map +1 -0
  155. package/dist/cmd/integration/github/disconnect.js +121 -0
  156. package/dist/cmd/integration/github/disconnect.js.map +1 -0
  157. package/dist/cmd/integration/github/index.d.ts +2 -0
  158. package/dist/cmd/integration/github/index.d.ts.map +1 -0
  159. package/dist/cmd/integration/github/index.js +21 -0
  160. package/dist/cmd/integration/github/index.js.map +1 -0
  161. package/dist/cmd/integration/index.d.ts +2 -0
  162. package/dist/cmd/integration/index.d.ts.map +1 -0
  163. package/dist/cmd/integration/index.js +16 -0
  164. package/dist/cmd/integration/index.js.map +1 -0
  165. package/dist/cmd/project/auth/generate.d.ts +5 -0
  166. package/dist/cmd/project/auth/generate.d.ts.map +1 -0
  167. package/dist/cmd/project/auth/generate.js +102 -0
  168. package/dist/cmd/project/auth/generate.js.map +1 -0
  169. package/dist/cmd/project/auth/index.d.ts +2 -0
  170. package/dist/cmd/project/auth/index.d.ts.map +1 -0
  171. package/dist/cmd/project/auth/index.js +21 -0
  172. package/dist/cmd/project/auth/index.js.map +1 -0
  173. package/dist/cmd/project/auth/init.d.ts +2 -0
  174. package/dist/cmd/project/auth/init.d.ts.map +1 -0
  175. package/dist/cmd/project/auth/init.js +220 -0
  176. package/dist/cmd/project/auth/init.js.map +1 -0
  177. package/dist/cmd/project/auth/shared.d.ts +88 -0
  178. package/dist/cmd/project/auth/shared.d.ts.map +1 -0
  179. package/dist/cmd/project/auth/shared.js +435 -0
  180. package/dist/cmd/project/auth/shared.js.map +1 -0
  181. package/dist/cmd/project/index.d.ts.map +1 -1
  182. package/dist/cmd/project/index.js +9 -1
  183. package/dist/cmd/project/index.js.map +1 -1
  184. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  185. package/dist/cmd/project/template-flow.js +106 -0
  186. package/dist/cmd/project/template-flow.js.map +1 -1
  187. package/dist/config.d.ts +2 -0
  188. package/dist/config.d.ts.map +1 -1
  189. package/dist/config.js +24 -0
  190. package/dist/config.js.map +1 -1
  191. package/dist/errors.d.ts +2 -1
  192. package/dist/errors.d.ts.map +1 -1
  193. package/dist/errors.js +5 -0
  194. package/dist/errors.js.map +1 -1
  195. package/dist/types.d.ts +3 -4
  196. package/dist/types.d.ts.map +1 -1
  197. package/dist/types.js +5 -2
  198. package/dist/types.js.map +1 -1
  199. package/package.json +6 -5
  200. package/src/build-report.ts +457 -0
  201. package/src/cli.ts +20 -4
  202. package/src/cmd/build/entry-generator.ts +3 -1
  203. package/src/cmd/build/index.ts +51 -1
  204. package/src/cmd/build/typecheck.ts +19 -1
  205. package/src/cmd/build/vite/agent-discovery.ts +4 -4
  206. package/src/cmd/build/vite/index.ts +5 -2
  207. package/src/cmd/build/vite/metadata-generator.ts +5 -7
  208. package/src/cmd/build/vite/registry-generator.ts +136 -43
  209. package/src/cmd/build/vite/route-discovery.ts +20 -0
  210. package/src/cmd/build/vite/vite-builder.ts +13 -2
  211. package/src/cmd/build/vite-bundler.ts +17 -4
  212. package/src/cmd/cloud/deploy.ts +183 -12
  213. package/src/cmd/cloud/deployment/show.ts +0 -1
  214. package/src/cmd/cloud/sandbox/create.ts +22 -0
  215. package/src/cmd/cloud/sandbox/delete.ts +2 -6
  216. package/src/cmd/cloud/sandbox/download.ts +96 -0
  217. package/src/cmd/cloud/sandbox/env.ts +104 -0
  218. package/src/cmd/cloud/sandbox/get.ts +5 -0
  219. package/src/cmd/cloud/sandbox/index.ts +14 -0
  220. package/src/cmd/cloud/sandbox/ls.ts +126 -0
  221. package/src/cmd/cloud/sandbox/mkdir.ts +65 -0
  222. package/src/cmd/cloud/sandbox/rm.ts +51 -0
  223. package/src/cmd/cloud/sandbox/rmdir.ts +65 -0
  224. package/src/cmd/cloud/sandbox/snapshot/create.ts +0 -2
  225. package/src/cmd/cloud/sandbox/snapshot/get.ts +0 -2
  226. package/src/cmd/cloud/sandbox/snapshot/list.ts +0 -3
  227. package/src/cmd/cloud/sandbox/upload.ts +83 -0
  228. package/src/cmd/dev/index.ts +147 -33
  229. package/src/cmd/dev/sync.ts +26 -30
  230. package/src/cmd/git/account/add.ts +317 -0
  231. package/src/cmd/git/account/index.ts +12 -0
  232. package/src/cmd/git/account/list.ts +139 -0
  233. package/src/cmd/git/account/remove.ts +212 -0
  234. package/src/cmd/git/index.ts +20 -0
  235. package/src/cmd/git/link.ts +468 -0
  236. package/src/cmd/git/list.ts +161 -0
  237. package/src/cmd/git/status.ts +144 -0
  238. package/src/cmd/git/unlink.ts +117 -0
  239. package/src/cmd/index.ts +2 -0
  240. package/src/cmd/integration/api.ts +379 -0
  241. package/src/cmd/integration/github/connect.ts +242 -0
  242. package/src/cmd/integration/github/disconnect.ts +149 -0
  243. package/src/cmd/integration/github/index.ts +21 -0
  244. package/src/cmd/integration/index.ts +16 -0
  245. package/src/cmd/project/auth/generate.ts +116 -0
  246. package/src/cmd/project/auth/index.ts +21 -0
  247. package/src/cmd/project/auth/init.ts +263 -0
  248. package/src/cmd/project/auth/shared.ts +534 -0
  249. package/src/cmd/project/index.ts +9 -1
  250. package/src/cmd/project/template-flow.ts +125 -0
  251. package/src/config.ts +34 -0
  252. package/src/errors.ts +7 -0
  253. package/src/types.ts +5 -2
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Build Report
3
+ *
4
+ * Structured error/warning collection and reporting for build and deploy commands.
5
+ * Outputs a JSON file with a strict schema for CI tooling integration.
6
+ */
7
+ import type { GrammarItem } from './tsc-output-parser';
8
+ /**
9
+ * Error codes for non-TypeScript errors.
10
+ * TypeScript errors use their native TS#### codes.
11
+ */
12
+ export declare const BuildErrorCodes: {
13
+ readonly AST001: "MetadataNameMissing";
14
+ readonly AST002: "DuplicateName";
15
+ readonly AST003: "InvalidExport";
16
+ readonly AST004: "InvalidCronExpression";
17
+ readonly AST005: "InvalidAgentConfig";
18
+ readonly BUILD001: "AppFileNotFound";
19
+ readonly BUILD002: "SourceDirNotFound";
20
+ readonly BUILD003: "DependencyUpgradeFailed";
21
+ readonly BUILD004: "BundleFailed";
22
+ readonly BUILD005: "EntryPointNotFound";
23
+ readonly BUILD006: "ViteBuildFailed";
24
+ readonly BUILD007: "RuntimePackageNotFound";
25
+ readonly BUILD008: "TypecheckToolFailed";
26
+ readonly VAL001: "AgentIdentifierCollision";
27
+ readonly VAL002: "InvalidRoutePath";
28
+ readonly VAL003: "InvalidRouteMethod";
29
+ readonly VAL004: "SchemaValidationFailed";
30
+ readonly DEPLOY001: "DeploymentCreationFailed";
31
+ readonly DEPLOY002: "UploadFailed";
32
+ readonly DEPLOY003: "DeploymentTimeout";
33
+ readonly DEPLOY004: "DeploymentFailed";
34
+ readonly DEPLOY005: "EncryptionFailed";
35
+ readonly DEPLOY006: "CDNUploadFailed";
36
+ };
37
+ export type BuildErrorCode = keyof typeof BuildErrorCodes;
38
+ /**
39
+ * Error scopes for categorizing errors
40
+ */
41
+ export type ErrorScope = 'typescript' | 'ast' | 'build' | 'bundler' | 'validation' | 'deploy';
42
+ /**
43
+ * File-specific error with location information
44
+ */
45
+ export interface FileError {
46
+ type: 'file';
47
+ scope: ErrorScope;
48
+ path: string;
49
+ line: number;
50
+ column: number;
51
+ message: string;
52
+ code?: string;
53
+ }
54
+ /**
55
+ * General error without file location
56
+ */
57
+ export interface GeneralError {
58
+ type: 'general';
59
+ scope: ErrorScope;
60
+ message: string;
61
+ code?: string;
62
+ }
63
+ /**
64
+ * Union type for all build errors
65
+ */
66
+ export type BuildError = FileError | GeneralError;
67
+ /**
68
+ * Union type for all build warnings (same structure as errors)
69
+ */
70
+ export type BuildWarning = FileError | GeneralError;
71
+ /**
72
+ * Diagnostic timing information for a build phase
73
+ */
74
+ export interface BuildDiagnostic {
75
+ name: string;
76
+ startedAt: string;
77
+ completedAt: string;
78
+ durationMs: number;
79
+ }
80
+ /**
81
+ * Complete build report structure
82
+ */
83
+ export interface BuildReport {
84
+ success: boolean;
85
+ errors: BuildError[];
86
+ warnings: BuildWarning[];
87
+ diagnostics: BuildDiagnostic[];
88
+ }
89
+ /**
90
+ * Diagnostic phases for timing
91
+ */
92
+ export declare const DiagnosticPhases: readonly ["typecheck", "client-build", "workbench-build", "server-build", "metadata-generation", "zip-package", "encrypt", "code-upload", "cdn-upload", "deployment-wait"];
93
+ export type DiagnosticPhase = (typeof DiagnosticPhases)[number];
94
+ /**
95
+ * Build Report Collector
96
+ *
97
+ * Collects errors, warnings, and diagnostic timing information throughout
98
+ * the build/deploy pipeline. Can be configured to automatically write
99
+ * the report on process exit.
100
+ */
101
+ export declare class BuildReportCollector {
102
+ private errors;
103
+ private warnings;
104
+ private diagnostics;
105
+ private activeDiagnostics;
106
+ private outputPath;
107
+ private autoWriteEnabled;
108
+ private written;
109
+ private beforeExitHandler;
110
+ private sigintHandler;
111
+ private sigtermHandler;
112
+ /**
113
+ * Set the output path for the report file
114
+ */
115
+ setOutputPath(path: string): void;
116
+ /**
117
+ * Enable automatic writing of the report on process exit.
118
+ * This ensures the report is written even if the process exits unexpectedly.
119
+ */
120
+ enableAutoWrite(): void;
121
+ /**
122
+ * Disable automatic writing and remove signal handlers.
123
+ * Call this when done with the collector to prevent handler conflicts.
124
+ */
125
+ disableAutoWrite(): void;
126
+ /**
127
+ * Add TypeScript errors from parsed tsc output
128
+ */
129
+ addTypeScriptErrors(items: GrammarItem[]): void;
130
+ /**
131
+ * Add a file-specific error
132
+ */
133
+ addFileError(scope: ErrorScope, path: string, line: number, column: number, message: string, code?: string): void;
134
+ /**
135
+ * Add a general error without file location
136
+ */
137
+ addGeneralError(scope: ErrorScope, message: string, code?: string): void;
138
+ /**
139
+ * Add a file-specific warning
140
+ */
141
+ addFileWarning(scope: ErrorScope, path: string, line: number, column: number, message: string, code?: string): void;
142
+ /**
143
+ * Add a general warning without file location
144
+ */
145
+ addGeneralWarning(scope: ErrorScope, message: string, code?: string): void;
146
+ /**
147
+ * Start timing a diagnostic phase
148
+ * @returns A function to call when the phase completes
149
+ */
150
+ startDiagnostic(name: string): () => void;
151
+ /**
152
+ * End a diagnostic phase
153
+ */
154
+ private endDiagnostic;
155
+ /**
156
+ * Check if there are any errors
157
+ */
158
+ hasErrors(): boolean;
159
+ /**
160
+ * Check if there are any warnings
161
+ */
162
+ hasWarnings(): boolean;
163
+ /**
164
+ * Get the error count
165
+ */
166
+ getErrorCount(): number;
167
+ /**
168
+ * Get the warning count
169
+ */
170
+ getWarningCount(): number;
171
+ /**
172
+ * Generate the complete build report
173
+ */
174
+ toReport(): BuildReport;
175
+ /**
176
+ * Write the report to the configured output path asynchronously
177
+ */
178
+ write(): Promise<void>;
179
+ /**
180
+ * Write the report synchronously (for exit handlers)
181
+ */
182
+ writeSync(): void;
183
+ /**
184
+ * Force write the report (bypasses the written flag)
185
+ * Use this when you want to update the report file mid-process
186
+ */
187
+ forceWrite(): Promise<void>;
188
+ }
189
+ /**
190
+ * Set the global collector instance
191
+ */
192
+ export declare function setGlobalCollector(collector: BuildReportCollector): void;
193
+ /**
194
+ * Get the global collector instance (may be null)
195
+ */
196
+ export declare function getGlobalCollector(): BuildReportCollector | null;
197
+ /**
198
+ * Clear the global collector instance and clean up its signal handlers
199
+ */
200
+ export declare function clearGlobalCollector(): void;
201
+ //# sourceMappingURL=build-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report.d.ts","sourceRoot":"","sources":["../src/build-report.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CA+BlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,eAAe,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM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AC,EAAE,MAAM,GAAG,IAAI;IASxE;;OAEG;IACH,cAAc,CACb,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACX,IAAI;IAYP;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAS1E;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,IAAI;IASzC;;OAEG;IACH,OAAO,CAAC,aAAa;IAiBrB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,QAAQ,IAAI,WAAW;IAgBvB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B;;OAEG;IACH,SAAS,IAAI,IAAI;IAQjB;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAQjC;AASD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAExE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,oBAAoB,GAAG,IAAI,CAEhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAK3C"}
@@ -0,0 +1,335 @@
1
+ /**
2
+ * Build Report
3
+ *
4
+ * Structured error/warning collection and reporting for build and deploy commands.
5
+ * Outputs a JSON file with a strict schema for CI tooling integration.
6
+ */
7
+ import { writeFileSync } from 'node:fs';
8
+ /**
9
+ * Error codes for non-TypeScript errors.
10
+ * TypeScript errors use their native TS#### codes.
11
+ */
12
+ export const BuildErrorCodes = {
13
+ // AST/Metadata errors (AST0xx)
14
+ AST001: 'MetadataNameMissing',
15
+ AST002: 'DuplicateName',
16
+ AST003: 'InvalidExport',
17
+ AST004: 'InvalidCronExpression',
18
+ AST005: 'InvalidAgentConfig',
19
+ // Build errors (BUILD0xx)
20
+ BUILD001: 'AppFileNotFound',
21
+ BUILD002: 'SourceDirNotFound',
22
+ BUILD003: 'DependencyUpgradeFailed',
23
+ BUILD004: 'BundleFailed',
24
+ BUILD005: 'EntryPointNotFound',
25
+ BUILD006: 'ViteBuildFailed',
26
+ BUILD007: 'RuntimePackageNotFound',
27
+ BUILD008: 'TypecheckToolFailed',
28
+ // Validation errors (VAL0xx)
29
+ VAL001: 'AgentIdentifierCollision',
30
+ VAL002: 'InvalidRoutePath',
31
+ VAL003: 'InvalidRouteMethod',
32
+ VAL004: 'SchemaValidationFailed',
33
+ // Deploy errors (DEPLOY0xx)
34
+ DEPLOY001: 'DeploymentCreationFailed',
35
+ DEPLOY002: 'UploadFailed',
36
+ DEPLOY003: 'DeploymentTimeout',
37
+ DEPLOY004: 'DeploymentFailed',
38
+ DEPLOY005: 'EncryptionFailed',
39
+ DEPLOY006: 'CDNUploadFailed',
40
+ };
41
+ /**
42
+ * Diagnostic phases for timing
43
+ */
44
+ export const DiagnosticPhases = [
45
+ 'typecheck',
46
+ 'client-build',
47
+ 'workbench-build',
48
+ 'server-build',
49
+ 'metadata-generation',
50
+ 'zip-package',
51
+ 'encrypt',
52
+ 'code-upload',
53
+ 'cdn-upload',
54
+ 'deployment-wait',
55
+ ];
56
+ /**
57
+ * Build Report Collector
58
+ *
59
+ * Collects errors, warnings, and diagnostic timing information throughout
60
+ * the build/deploy pipeline. Can be configured to automatically write
61
+ * the report on process exit.
62
+ */
63
+ export class BuildReportCollector {
64
+ errors = [];
65
+ warnings = [];
66
+ diagnostics = [];
67
+ activeDiagnostics = new Map();
68
+ outputPath = null;
69
+ autoWriteEnabled = false;
70
+ written = false;
71
+ beforeExitHandler = null;
72
+ sigintHandler = null;
73
+ sigtermHandler = null;
74
+ /**
75
+ * Set the output path for the report file
76
+ */
77
+ setOutputPath(path) {
78
+ this.outputPath = path;
79
+ }
80
+ /**
81
+ * Enable automatic writing of the report on process exit.
82
+ * This ensures the report is written even if the process exits unexpectedly.
83
+ */
84
+ enableAutoWrite() {
85
+ if (this.autoWriteEnabled || !this.outputPath)
86
+ return;
87
+ this.autoWriteEnabled = true;
88
+ // Use beforeExit for graceful exits
89
+ this.beforeExitHandler = () => {
90
+ this.writeSync();
91
+ };
92
+ process.once('beforeExit', this.beforeExitHandler);
93
+ // Handle SIGINT/SIGTERM with process.once to avoid stacking handlers
94
+ this.sigintHandler = () => {
95
+ this.writeSync();
96
+ process.exit(130);
97
+ };
98
+ this.sigtermHandler = () => {
99
+ this.writeSync();
100
+ process.exit(143);
101
+ };
102
+ process.once('SIGINT', this.sigintHandler);
103
+ process.once('SIGTERM', this.sigtermHandler);
104
+ }
105
+ /**
106
+ * Disable automatic writing and remove signal handlers.
107
+ * Call this when done with the collector to prevent handler conflicts.
108
+ */
109
+ disableAutoWrite() {
110
+ if (!this.autoWriteEnabled)
111
+ return;
112
+ this.autoWriteEnabled = false;
113
+ if (this.beforeExitHandler) {
114
+ process.removeListener('beforeExit', this.beforeExitHandler);
115
+ this.beforeExitHandler = null;
116
+ }
117
+ if (this.sigintHandler) {
118
+ process.removeListener('SIGINT', this.sigintHandler);
119
+ this.sigintHandler = null;
120
+ }
121
+ if (this.sigtermHandler) {
122
+ process.removeListener('SIGTERM', this.sigtermHandler);
123
+ this.sigtermHandler = null;
124
+ }
125
+ }
126
+ /**
127
+ * Add TypeScript errors from parsed tsc output
128
+ */
129
+ addTypeScriptErrors(items) {
130
+ for (const item of items) {
131
+ if (item.type !== 'Item' || !item.value)
132
+ continue;
133
+ const val = item.value;
134
+ const isError = val.tsError?.value?.type === 'error';
135
+ const isWarning = val.tsError?.value?.type === 'warning';
136
+ if (!isError && !isWarning)
137
+ continue;
138
+ const entry = {
139
+ type: 'file',
140
+ scope: 'typescript',
141
+ path: val.path?.value ?? 'unknown',
142
+ line: val.cursor?.value?.line ?? 0,
143
+ column: val.cursor?.value?.col ?? 0,
144
+ message: (val.message?.value ?? '').trim(),
145
+ code: val.tsError?.value?.errorString,
146
+ };
147
+ if (isError) {
148
+ this.errors.push(entry);
149
+ }
150
+ else {
151
+ this.warnings.push(entry);
152
+ }
153
+ }
154
+ }
155
+ /**
156
+ * Add a file-specific error
157
+ */
158
+ addFileError(scope, path, line, column, message, code) {
159
+ this.errors.push({
160
+ type: 'file',
161
+ scope,
162
+ path,
163
+ line,
164
+ column,
165
+ message,
166
+ code,
167
+ });
168
+ }
169
+ /**
170
+ * Add a general error without file location
171
+ */
172
+ addGeneralError(scope, message, code) {
173
+ this.errors.push({
174
+ type: 'general',
175
+ scope,
176
+ message,
177
+ code,
178
+ });
179
+ }
180
+ /**
181
+ * Add a file-specific warning
182
+ */
183
+ addFileWarning(scope, path, line, column, message, code) {
184
+ this.warnings.push({
185
+ type: 'file',
186
+ scope,
187
+ path,
188
+ line,
189
+ column,
190
+ message,
191
+ code,
192
+ });
193
+ }
194
+ /**
195
+ * Add a general warning without file location
196
+ */
197
+ addGeneralWarning(scope, message, code) {
198
+ this.warnings.push({
199
+ type: 'general',
200
+ scope,
201
+ message,
202
+ code,
203
+ });
204
+ }
205
+ /**
206
+ * Start timing a diagnostic phase
207
+ * @returns A function to call when the phase completes
208
+ */
209
+ startDiagnostic(name) {
210
+ const startedAt = new Date();
211
+ this.activeDiagnostics.set(name, { name, startedAt });
212
+ return () => {
213
+ this.endDiagnostic(name);
214
+ };
215
+ }
216
+ /**
217
+ * End a diagnostic phase
218
+ */
219
+ endDiagnostic(name) {
220
+ const active = this.activeDiagnostics.get(name);
221
+ if (!active)
222
+ return;
223
+ const completedAt = new Date();
224
+ const durationMs = completedAt.getTime() - active.startedAt.getTime();
225
+ this.diagnostics.push({
226
+ name,
227
+ startedAt: active.startedAt.toISOString(),
228
+ completedAt: completedAt.toISOString(),
229
+ durationMs,
230
+ });
231
+ this.activeDiagnostics.delete(name);
232
+ }
233
+ /**
234
+ * Check if there are any errors
235
+ */
236
+ hasErrors() {
237
+ return this.errors.length > 0;
238
+ }
239
+ /**
240
+ * Check if there are any warnings
241
+ */
242
+ hasWarnings() {
243
+ return this.warnings.length > 0;
244
+ }
245
+ /**
246
+ * Get the error count
247
+ */
248
+ getErrorCount() {
249
+ return this.errors.length;
250
+ }
251
+ /**
252
+ * Get the warning count
253
+ */
254
+ getWarningCount() {
255
+ return this.warnings.length;
256
+ }
257
+ /**
258
+ * Generate the complete build report
259
+ */
260
+ toReport() {
261
+ // Complete any active diagnostics - collect keys first to avoid
262
+ // iterating while modifying the map
263
+ const activeKeys = [...this.activeDiagnostics.keys()];
264
+ for (const name of activeKeys) {
265
+ this.endDiagnostic(name);
266
+ }
267
+ return {
268
+ success: this.errors.length === 0,
269
+ errors: [...this.errors],
270
+ warnings: [...this.warnings],
271
+ diagnostics: [...this.diagnostics],
272
+ };
273
+ }
274
+ /**
275
+ * Write the report to the configured output path asynchronously
276
+ */
277
+ async write() {
278
+ if (!this.outputPath || this.written)
279
+ return;
280
+ this.written = true;
281
+ const report = this.toReport();
282
+ const file = Bun.file(this.outputPath);
283
+ await file.write(JSON.stringify(report, null, '\t'));
284
+ }
285
+ /**
286
+ * Write the report synchronously (for exit handlers)
287
+ */
288
+ writeSync() {
289
+ if (!this.outputPath || this.written)
290
+ return;
291
+ this.written = true;
292
+ const report = this.toReport();
293
+ writeFileSync(this.outputPath, JSON.stringify(report, null, '\t'));
294
+ }
295
+ /**
296
+ * Force write the report (bypasses the written flag)
297
+ * Use this when you want to update the report file mid-process
298
+ */
299
+ async forceWrite() {
300
+ if (!this.outputPath)
301
+ return;
302
+ const report = this.toReport();
303
+ const file = Bun.file(this.outputPath);
304
+ await file.write(JSON.stringify(report, null, '\t'));
305
+ this.written = true;
306
+ }
307
+ }
308
+ /**
309
+ * Global collector instance for use across the build pipeline.
310
+ * Commands should create their own collector and pass it through,
311
+ * but this provides a fallback for error handling in deeply nested code.
312
+ */
313
+ let globalCollector = null;
314
+ /**
315
+ * Set the global collector instance
316
+ */
317
+ export function setGlobalCollector(collector) {
318
+ globalCollector = collector;
319
+ }
320
+ /**
321
+ * Get the global collector instance (may be null)
322
+ */
323
+ export function getGlobalCollector() {
324
+ return globalCollector;
325
+ }
326
+ /**
327
+ * Clear the global collector instance and clean up its signal handlers
328
+ */
329
+ export function clearGlobalCollector() {
330
+ if (globalCollector) {
331
+ globalCollector.disableAutoWrite();
332
+ }
333
+ globalCollector = null;
334
+ }
335
+ //# sourceMappingURL=build-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report.js","sourceRoot":"","sources":["../src/build-report.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,+BAA+B;IAC/B,MAAM,EAAE,qBAAqB;IAC7B,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,uBAAuB;IAC/B,MAAM,EAAE,oBAAoB;IAE5B,0BAA0B;IAC1B,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,yBAAyB;IACnC,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,oBAAoB;IAC9B,QAAQ,EAAE,iBAAiB;IAC3B,QAAQ,EAAE,wBAAwB;IAClC,QAAQ,EAAE,qBAAqB;IAE/B,6BAA6B;IAC7B,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,wBAAwB;IAEhC,4BAA4B;IAC5B,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAE,cAAc;IACzB,SAAS,EAAE,mBAAmB;IAC9B,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAA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@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EACX,iBAAiB,EAEjB,cAAc,EAQd,MAAM,SAAS,CAAC;AA8ajB,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA2MjE;AA82BD,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAgMf"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EACX,iBAAiB,EAEjB,cAAc,EAQd,MAAM,SAAS,CAAC;AA8bjB,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA2MjE;AA82BD,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAgMf"}
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
3
3
  import { Command } from 'commander';
4
4
  import { showBanner, generateBanner } from './banner';
5
5
  import { requireAuth, optionalAuth, requireOrg, optionalOrg as selectOptionalOrg } from './auth';
6
- import { listRegions } from '@agentuity/server';
6
+ import { listRegions, ValidationOutputError } from '@agentuity/server';
7
7
  import enquirer from 'enquirer';
8
8
  import * as tui from './tui';
9
9
  import { parseArgsSchema, parseOptionsSchema, buildValidationInput } from './schema-parser';
@@ -13,6 +13,21 @@ import { ErrorCode, ExitCode, createError, exitWithError } from './errors';
13
13
  import { getCommand } from './command-prefix';
14
14
  import { isValidateMode, outputValidation } from './output';
15
15
  import { StructuredError } from '@agentuity/core';
16
+ /**
17
+ * Check if an error is a CLI input validation error (Zod error from schema parsing),
18
+ * and not an API response validation error (ValidationOutputError).
19
+ */
20
+ function isCLIValidationError(error) {
21
+ if (!error || typeof error !== 'object' || !('issues' in error)) {
22
+ return false;
23
+ }
24
+ // ValidationOutputError from API responses should NOT be treated as CLI validation errors
25
+ if (error instanceof ValidationOutputError) {
26
+ return false;
27
+ }
28
+ // Check for Zod error structure (has name 'ZodError' or is from SchemaValidationError)
29
+ return true;
30
+ }
16
31
  const APIClientConfigError = StructuredError('APIClientConfigError');
17
32
  function createAPIClient(baseCtx, config) {
18
33
  try {
@@ -892,7 +907,7 @@ async function registerSubcommand(parent, subcommand, baseCtx, hidden) {
892
907
  await executeOrValidate(ctx, getFullCommandPath(cmd), subcommand.handler, !!subcommand.schema?.response, subcommand.webUrl);
893
908
  }
894
909
  catch (error) {
895
- if (error && typeof error === 'object' && 'issues' in error) {
910
+ if (isCLIValidationError(error)) {
896
911
  handleValidationError(error, getFullCommandPath(cmd), baseCtx);
897
912
  }
898
913
  handleProjectConfigError(error, normalized.requiresProject, baseCtx.logger, baseCtx.options.errorFormat);
@@ -1032,7 +1047,7 @@ async function registerSubcommand(parent, subcommand, baseCtx, hidden) {
1032
1047
  await executeOrValidate(ctx, getFullCommandPath(cmd), subcommand.handler, !!subcommand.schema?.response, subcommand.webUrl);
1033
1048
  }
1034
1049
  catch (error) {
1035
- if (error && typeof error === 'object' && 'issues' in error) {
1050
+ if (isCLIValidationError(error)) {
1036
1051
  handleValidationError(error, getFullCommandPath(cmd), baseCtx);
1037
1052
  }
1038
1053
  handleProjectConfigError(error, normalized.requiresProject, baseCtx.logger, baseCtx.options.errorFormat);
@@ -1133,7 +1148,7 @@ async function registerSubcommand(parent, subcommand, baseCtx, hidden) {
1133
1148
  await executeOrValidate(ctx, getFullCommandPath(cmd), subcommand.handler, !!subcommand.schema?.response, subcommand.webUrl);
1134
1149
  }
1135
1150
  catch (error) {
1136
- if (error && typeof error === 'object' && 'issues' in error) {
1151
+ if (isCLIValidationError(error)) {
1137
1152
  handleValidationError(error, getFullCommandPath(cmd), baseCtx);
1138
1153
  }
1139
1154
  handleProjectConfigError(error, normalized.requiresProject, baseCtx.logger, baseCtx.options.errorFormat);