@wayai/cli 0.3.40 → 0.3.42

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 (166) hide show
  1. package/dist/index.js +16920 -310
  2. package/dist/index.js.map +1 -1
  3. package/package.json +6 -4
  4. package/dist/commands/admin.d.ts +0 -1
  5. package/dist/commands/admin.js +0 -913
  6. package/dist/commands/admin.js.map +0 -1
  7. package/dist/commands/analytics.d.ts +0 -34
  8. package/dist/commands/analytics.js +0 -605
  9. package/dist/commands/analytics.js.map +0 -1
  10. package/dist/commands/conversations.d.ts +0 -14
  11. package/dist/commands/conversations.js +0 -292
  12. package/dist/commands/conversations.js.map +0 -1
  13. package/dist/commands/create-credential.d.ts +0 -20
  14. package/dist/commands/create-credential.js +0 -146
  15. package/dist/commands/create-credential.js.map +0 -1
  16. package/dist/commands/delete-history.d.ts +0 -15
  17. package/dist/commands/delete-history.js +0 -56
  18. package/dist/commands/delete-history.js.map +0 -1
  19. package/dist/commands/eval-capture.d.ts +0 -1
  20. package/dist/commands/eval-capture.js +0 -135
  21. package/dist/commands/eval-capture.js.map +0 -1
  22. package/dist/commands/eval-results.d.ts +0 -10
  23. package/dist/commands/eval-results.js +0 -168
  24. package/dist/commands/eval-results.js.map +0 -1
  25. package/dist/commands/eval.d.ts +0 -1
  26. package/dist/commands/eval.js +0 -49
  27. package/dist/commands/eval.js.map +0 -1
  28. package/dist/commands/evals.d.ts +0 -21
  29. package/dist/commands/evals.js +0 -120
  30. package/dist/commands/evals.js.map +0 -1
  31. package/dist/commands/init.d.ts +0 -16
  32. package/dist/commands/init.js +0 -191
  33. package/dist/commands/init.js.map +0 -1
  34. package/dist/commands/list.d.ts +0 -13
  35. package/dist/commands/list.js +0 -70
  36. package/dist/commands/list.js.map +0 -1
  37. package/dist/commands/login.d.ts +0 -8
  38. package/dist/commands/login.js +0 -145
  39. package/dist/commands/login.js.map +0 -1
  40. package/dist/commands/logout.d.ts +0 -1
  41. package/dist/commands/logout.js +0 -19
  42. package/dist/commands/logout.js.map +0 -1
  43. package/dist/commands/migrate.d.ts +0 -12
  44. package/dist/commands/migrate.js +0 -106
  45. package/dist/commands/migrate.js.map +0 -1
  46. package/dist/commands/observability.d.ts +0 -14
  47. package/dist/commands/observability.js +0 -124
  48. package/dist/commands/observability.js.map +0 -1
  49. package/dist/commands/org.d.ts +0 -19
  50. package/dist/commands/org.js +0 -186
  51. package/dist/commands/org.js.map +0 -1
  52. package/dist/commands/pull.d.ts +0 -31
  53. package/dist/commands/pull.js +0 -210
  54. package/dist/commands/pull.js.map +0 -1
  55. package/dist/commands/push.d.ts +0 -25
  56. package/dist/commands/push.js +0 -472
  57. package/dist/commands/push.js.map +0 -1
  58. package/dist/commands/report-create.d.ts +0 -18
  59. package/dist/commands/report-create.js +0 -143
  60. package/dist/commands/report-create.js.map +0 -1
  61. package/dist/commands/report.d.ts +0 -16
  62. package/dist/commands/report.js +0 -252
  63. package/dist/commands/report.js.map +0 -1
  64. package/dist/commands/run-eval.d.ts +0 -15
  65. package/dist/commands/run-eval.js +0 -187
  66. package/dist/commands/run-eval.js.map +0 -1
  67. package/dist/commands/send-message.d.ts +0 -11
  68. package/dist/commands/send-message.js +0 -63
  69. package/dist/commands/send-message.js.map +0 -1
  70. package/dist/commands/status.d.ts +0 -17
  71. package/dist/commands/status.js +0 -205
  72. package/dist/commands/status.js.map +0 -1
  73. package/dist/commands/sync-mcp.d.ts +0 -16
  74. package/dist/commands/sync-mcp.js +0 -51
  75. package/dist/commands/sync-mcp.js.map +0 -1
  76. package/dist/commands/sync-skills.d.ts +0 -10
  77. package/dist/commands/sync-skills.js +0 -49
  78. package/dist/commands/sync-skills.js.map +0 -1
  79. package/dist/commands/unlock.d.ts +0 -1
  80. package/dist/commands/unlock.js +0 -13
  81. package/dist/commands/unlock.js.map +0 -1
  82. package/dist/commands/update-credential.d.ts +0 -29
  83. package/dist/commands/update-credential.js +0 -156
  84. package/dist/commands/update-credential.js.map +0 -1
  85. package/dist/commands/update.d.ts +0 -6
  86. package/dist/commands/update.js +0 -36
  87. package/dist/commands/update.js.map +0 -1
  88. package/dist/commands/use.d.ts +0 -1
  89. package/dist/commands/use.js +0 -56
  90. package/dist/commands/use.js.map +0 -1
  91. package/dist/commands/whoami.d.ts +0 -11
  92. package/dist/commands/whoami.js +0 -30
  93. package/dist/commands/whoami.js.map +0 -1
  94. package/dist/index.d.ts +0 -28
  95. package/dist/lib/analytics-constants.d.ts +0 -6
  96. package/dist/lib/analytics-constants.js +0 -14
  97. package/dist/lib/analytics-constants.js.map +0 -1
  98. package/dist/lib/api-client.d.ts +0 -568
  99. package/dist/lib/api-client.js +0 -445
  100. package/dist/lib/api-client.js.map +0 -1
  101. package/dist/lib/auth.d.ts +0 -50
  102. package/dist/lib/auth.js +0 -230
  103. package/dist/lib/auth.js.map +0 -1
  104. package/dist/lib/config.d.ts +0 -34
  105. package/dist/lib/config.js +0 -69
  106. package/dist/lib/config.js.map +0 -1
  107. package/dist/lib/credential-utils.d.ts +0 -36
  108. package/dist/lib/credential-utils.js +0 -88
  109. package/dist/lib/credential-utils.js.map +0 -1
  110. package/dist/lib/diff-display.d.ts +0 -8
  111. package/dist/lib/diff-display.js +0 -37
  112. package/dist/lib/diff-display.js.map +0 -1
  113. package/dist/lib/eval-format.d.ts +0 -29
  114. package/dist/lib/eval-format.js +0 -44
  115. package/dist/lib/eval-format.js.map +0 -1
  116. package/dist/lib/hub-lock.d.ts +0 -7
  117. package/dist/lib/hub-lock.js +0 -116
  118. package/dist/lib/hub-lock.js.map +0 -1
  119. package/dist/lib/layout.d.ts +0 -79
  120. package/dist/lib/layout.js +0 -133
  121. package/dist/lib/layout.js.map +0 -1
  122. package/dist/lib/org-workspace.d.ts +0 -22
  123. package/dist/lib/org-workspace.js +0 -106
  124. package/dist/lib/org-workspace.js.map +0 -1
  125. package/dist/lib/parser.d.ts +0 -16
  126. package/dist/lib/parser.js +0 -306
  127. package/dist/lib/parser.js.map +0 -1
  128. package/dist/lib/repo-config.d.ts +0 -23
  129. package/dist/lib/repo-config.js +0 -91
  130. package/dist/lib/repo-config.js.map +0 -1
  131. package/dist/lib/report-edit-args.d.ts +0 -27
  132. package/dist/lib/report-edit-args.js +0 -56
  133. package/dist/lib/report-edit-args.js.map +0 -1
  134. package/dist/lib/report-inbox.d.ts +0 -19
  135. package/dist/lib/report-inbox.js +0 -73
  136. package/dist/lib/report-inbox.js.map +0 -1
  137. package/dist/lib/resource-files.d.ts +0 -29
  138. package/dist/lib/resource-files.js +0 -156
  139. package/dist/lib/resource-files.js.map +0 -1
  140. package/dist/lib/sentry.d.ts +0 -38
  141. package/dist/lib/sentry.js +0 -168
  142. package/dist/lib/sentry.js.map +0 -1
  143. package/dist/lib/skill-version.d.ts +0 -9
  144. package/dist/lib/skill-version.js +0 -53
  145. package/dist/lib/skill-version.js.map +0 -1
  146. package/dist/lib/sql-output.d.ts +0 -17
  147. package/dist/lib/sql-output.js +0 -48
  148. package/dist/lib/sql-output.js.map +0 -1
  149. package/dist/lib/token-store.d.ts +0 -37
  150. package/dist/lib/token-store.js +0 -354
  151. package/dist/lib/token-store.js.map +0 -1
  152. package/dist/lib/types.d.ts +0 -18
  153. package/dist/lib/types.js +0 -5
  154. package/dist/lib/types.js.map +0 -1
  155. package/dist/lib/utils.d.ts +0 -97
  156. package/dist/lib/utils.js +0 -288
  157. package/dist/lib/utils.js.map +0 -1
  158. package/dist/lib/version-cache.d.ts +0 -10
  159. package/dist/lib/version-cache.js +0 -34
  160. package/dist/lib/version-cache.js.map +0 -1
  161. package/dist/lib/workspace.d.ts +0 -112
  162. package/dist/lib/workspace.js +0 -387
  163. package/dist/lib/workspace.js.map +0 -1
  164. package/dist/lib/yaml-writer.d.ts +0 -18
  165. package/dist/lib/yaml-writer.js +0 -283
  166. package/dist/lib/yaml-writer.js.map +0 -1
package/dist/lib/utils.js DELETED
@@ -1,288 +0,0 @@
1
- /**
2
- * Shared utility functions
3
- */
4
- import * as fs from 'node:fs';
5
- import * as path from 'node:path';
6
- import * as readline from 'node:readline';
7
- export const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8
- /**
9
- * Prompt the user for free-text input.
10
- */
11
- export function prompt(question) {
12
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
13
- return new Promise((resolve) => {
14
- rl.question(question, (answer) => {
15
- rl.close();
16
- resolve(answer.trim());
17
- });
18
- });
19
- }
20
- /**
21
- * Prompt the user for yes/no confirmation. Returns true if they answer 'y'.
22
- */
23
- export function confirm(question) {
24
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
25
- return new Promise((resolve) => {
26
- rl.question(`${question} [y/N]: `, (answer) => {
27
- rl.close();
28
- resolve(answer.trim().toLowerCase() === 'y');
29
- });
30
- });
31
- }
32
- /** Prompt for a secret, masking typed characters with `*`. */
33
- export function promptSecret(question) {
34
- return new Promise((resolve) => {
35
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
36
- // Mute output by replacing _writeToOutput
37
- const originalWrite = rl._writeToOutput;
38
- let firstWrite = true;
39
- rl._writeToOutput = function (s) {
40
- if (firstWrite) {
41
- // Let the prompt question through
42
- originalWrite.call(rl, s);
43
- firstWrite = false;
44
- }
45
- else {
46
- // Replace typed characters with *
47
- originalWrite.call(rl, '*'.repeat(s.replace(/[\r\n]/g, '').length));
48
- }
49
- };
50
- rl.question(question, (answer) => {
51
- // Restore and print newline
52
- rl._writeToOutput = originalWrite;
53
- process.stdout.write('\n');
54
- rl.close();
55
- resolve(answer);
56
- });
57
- });
58
- }
59
- /** Read all of stdin as a single trimmed string (for piped input). */
60
- export function readStdin() {
61
- return new Promise((resolve, reject) => {
62
- let data = '';
63
- process.stdin.setEncoding('utf-8');
64
- process.stdin.on('data', (chunk) => { data += chunk; });
65
- process.stdin.on('end', () => resolve(data.trim()));
66
- process.stdin.on('error', reject);
67
- });
68
- }
69
- /**
70
- * Kebab-case slug for hub folders and skill names.
71
- *
72
- * MIRROR of the canonical `@wayai/shared` `slugifyKebab(input, 64)`. The CLI
73
- * can't import the shared runtime (it's never published — see the drift-guard
74
- * test no-shared-runtime-import.test.ts), so this is duplicated and pinned by
75
- * that test against `slugifySkillName`. Uses NFKD (not NFD) so ligatures and
76
- * full-width chars fold toward ASCII identically to the platform — keep these
77
- * exact steps in lockstep with slugifyKebab or pushed slugs diverge from the UI.
78
- */
79
- export function slugify(input) {
80
- return input
81
- .normalize('NFKD')
82
- .replace(/[\u0300-\u036f]/g, '') // strip diacritics (combining marks)
83
- .toLowerCase()
84
- .replace(/[^a-z0-9]+/g, '-') // non-alphanumeric → hyphens
85
- .replace(/-+/g, '-') // collapse consecutive
86
- .slice(0, 64) // limit length
87
- .replace(/^-|-$/g, ''); // trim AFTER slicing — a mid-separator cut must not leave an edge hyphen
88
- }
89
- /**
90
- * Resolve the hub YAML path in a folder: tries hub.yaml first, falls back to wayai.yaml.
91
- * Returns the full path if found, null otherwise.
92
- */
93
- export function resolveHubYamlPath(hubFolder) {
94
- for (const filename of ['hub.yaml', 'wayai.yaml']) {
95
- const yamlPath = path.join(hubFolder, filename);
96
- if (fs.existsSync(yamlPath))
97
- return yamlPath;
98
- }
99
- return null;
100
- }
101
- /**
102
- * Try to detect hub_id from hub.yaml (or wayai.yaml) in the current working directory.
103
- * Returns null if no config file exists or it lacks hub_id.
104
- */
105
- export async function detectHubFromCwd() {
106
- const yaml = await import('js-yaml');
107
- const cwd = process.cwd();
108
- const yamlPath = resolveHubYamlPath(cwd);
109
- if (!yamlPath)
110
- return null;
111
- const content = fs.readFileSync(yamlPath, 'utf-8');
112
- const config = yaml.load(content);
113
- if (config?.hub_id && typeof config.hub_id === 'string') {
114
- return { hubId: config.hub_id, hubFolder: cwd };
115
- }
116
- return null;
117
- }
118
- /**
119
- * Parse a shorthand period string (e.g. "7d", "4w", "3m", "1y") into
120
- * { start, end, periodicity } for analytics queries.
121
- */
122
- export function parsePeriod(period) {
123
- const match = period.match(/^(\d+)([hdwmy])$/);
124
- if (!match) {
125
- throw new Error(`Invalid period "${period}". Use format like 24h, 7d, 4w, 3m, 1y.`);
126
- }
127
- const amount = parseInt(match[1], 10);
128
- const unit = match[2];
129
- if (amount <= 0) {
130
- throw new Error(`Invalid period "${period}". Amount must be greater than 0.`);
131
- }
132
- const now = new Date();
133
- const start = new Date(now);
134
- switch (unit) {
135
- case 'h':
136
- start.setHours(start.getHours() - amount);
137
- break;
138
- case 'd':
139
- start.setDate(start.getDate() - amount);
140
- break;
141
- case 'w':
142
- start.setDate(start.getDate() - amount * 7);
143
- break;
144
- case 'm':
145
- start.setMonth(start.getMonth() - amount);
146
- break;
147
- case 'y':
148
- start.setFullYear(start.getFullYear() - amount);
149
- break;
150
- }
151
- const periodicityMap = {
152
- h: 'daily',
153
- d: 'daily',
154
- w: 'weekly',
155
- m: 'monthly',
156
- y: 'yearly',
157
- };
158
- return {
159
- start: start.toISOString(),
160
- end: now.toISOString(),
161
- periodicity: periodicityMap[unit],
162
- };
163
- }
164
- /**
165
- * Parse --from/--to date strings into ISO format.
166
- * Accepts YYYY-MM-DD or full ISO datetime. Appends time suffix if needed.
167
- */
168
- export function parseDateArg(date, position) {
169
- if (date.includes('T')) {
170
- if (!/^\d{4}-\d{2}-\d{2}T/.test(date) || isNaN(new Date(date).getTime())) {
171
- throw new Error(`Invalid date format "${date}". Use YYYY-MM-DD or full ISO datetime.`);
172
- }
173
- // Verify the date portion doesn't overflow (e.g., Feb 31 → Mar 3)
174
- const datePart = date.slice(0, 10);
175
- const [year, month, day] = datePart.split('-').map(Number);
176
- const parsed = new Date(Date.UTC(year, month - 1, day));
177
- if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) {
178
- throw new Error(`Invalid date "${date}". Not a valid calendar date.`);
179
- }
180
- return date;
181
- }
182
- if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
183
- throw new Error(`Invalid date format "${date}". Use YYYY-MM-DD (e.g., 2026-01-01).`);
184
- }
185
- // Verify the date components are valid (JS Date silently overflows, e.g., Feb 31 → Mar 3)
186
- const [year, month, day] = date.split('-').map(Number);
187
- const parsed = new Date(Date.UTC(year, month - 1, day));
188
- if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) {
189
- throw new Error(`Invalid date "${date}". Not a valid calendar date.`);
190
- }
191
- return position === 'from' ? `${date}T00:00:00Z` : `${date}T23:59:59Z`;
192
- }
193
- /**
194
- * Resolve organization_id from: --org flag → .wayai.yaml → single-org auto-select.
195
- * Returns { organizationId, organizationName } or exits with an error.
196
- */
197
- export async function resolveOrganizationId(client, orgIdFlag) {
198
- if (orgIdFlag) {
199
- if (!UUID_RE.test(orgIdFlag)) {
200
- console.error('Invalid --org value. Expected a UUID.');
201
- process.exit(1);
202
- }
203
- return { organizationId: orgIdFlag };
204
- }
205
- // Try .wayai.yaml
206
- // Lazy import to avoid circular dependency
207
- const { readRepoConfig } = await import('./repo-config.js');
208
- const repoConfig = readRepoConfig();
209
- if (repoConfig) {
210
- return { organizationId: repoConfig.organization_id, organizationName: repoConfig.organization_name };
211
- }
212
- // Fetch orgs and auto-select if single
213
- const { organizations } = await client.organizations();
214
- if (organizations.length === 0) {
215
- console.error('No organizations found. Create one in the WayAI platform first.');
216
- process.exit(1);
217
- }
218
- if (organizations.length === 1) {
219
- console.log(`Organization: ${organizations[0].name}`);
220
- return { organizationId: organizations[0].id, organizationName: organizations[0].name };
221
- }
222
- console.error('Multiple organizations found. Specify one with --org <uuid>:');
223
- for (const org of organizations) {
224
- console.error(` ${org.id} ${org.name}`);
225
- }
226
- process.exit(1);
227
- }
228
- export function parsePositiveIntFlag(name, raw) {
229
- if (raw === undefined) {
230
- console.error(`${name} requires a value`);
231
- process.exit(1);
232
- }
233
- const n = Number(raw);
234
- if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
235
- console.error(`${name} must be a positive integer.`);
236
- process.exit(1);
237
- }
238
- return n;
239
- }
240
- /**
241
- * Low-level predicate: true when `--help`/`-h` appears anywhere in args.
242
- *
243
- * The match is deliberately broad (and so fail-safe — printing help is
244
- * non-destructive). The one realistic command that takes a free-text value that
245
- * could *equal* `--help` is `report` (`report create --description "--help"`),
246
- * and that command owns its help handling so it's excluded from interception by
247
- * `shouldInterceptHelp` — its own parser sees the value verbatim. Used both to
248
- * gate that interception and to skip the update check on any help invocation.
249
- */
250
- export function wantsHelp(args) {
251
- return args.includes('--help') || args.includes('-h');
252
- }
253
- /**
254
- * Whether the top-level entry should short-circuit to the GLOBAL help BEFORE
255
- * dispatching `command`. This stops side-effecting subcommands (e.g.
256
- * `run-eval`, which would otherwise create + run a billable eval session) from
257
- * executing on a `--help`/`-h` request.
258
- *
259
- * Returns false — i.e. falls through to the command's own handler — for:
260
- * - the top-level `help` slot (handled by the dispatch switch itself),
261
- * - an absent command, and
262
- * - commands in `ownHelpCommands` (e.g. `eval`, `admin`, `report`), which
263
- * render their own richer command-specific help; intercepting them here would
264
- * downgrade that to the global help.
265
- */
266
- export function shouldInterceptHelp(command, args, ownHelpCommands) {
267
- if (!command || command === 'help')
268
- return false;
269
- if (ownHelpCommands.has(command))
270
- return false;
271
- return wantsHelp(args);
272
- }
273
- /** Returns true if `latest` is a newer semver than `current` */
274
- export function isNewerVersion(latest, current) {
275
- const strip = (v) => v.replace(/[-+].*$/, '');
276
- const l = strip(latest).split('.').map(Number);
277
- const c = strip(current).split('.').map(Number);
278
- for (let i = 0; i < Math.max(l.length, c.length); i++) {
279
- const lv = l[i] ?? 0;
280
- const cv = c[i] ?? 0;
281
- if (lv > cv)
282
- return true;
283
- if (lv < cv)
284
- return false;
285
- }
286
- return false;
287
- }
288
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC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AAU,cAAc,CAAC,MAAc,EAAE,OAAe;IAC5D,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtD,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,IAAI,CAAC;QACzB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,10 +0,0 @@
1
- export declare const MAX_AGE_24H_MS: number;
2
- export declare const CLI_CACHE_FILE = "update-check.json";
3
- export declare const SKILL_CACHE_FILE = "skill-update-check.json";
4
- export interface VersionCache {
5
- lastCheck: number;
6
- latest: string | null;
7
- }
8
- export declare function getVersionCachePath(filename?: string): string;
9
- export declare function readVersionCache(filename?: string): VersionCache | null;
10
- export declare function readCachedLatest(filename?: string, maxAgeMs?: number): string | null;
@@ -1,34 +0,0 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { homedir } from 'node:os';
4
- export const MAX_AGE_24H_MS = 24 * 60 * 60 * 1000;
5
- export const CLI_CACHE_FILE = 'update-check.json';
6
- export const SKILL_CACHE_FILE = 'skill-update-check.json';
7
- export function getVersionCachePath(filename = CLI_CACHE_FILE) {
8
- return join(homedir(), '.wayai', filename);
9
- }
10
- export function readVersionCache(filename = CLI_CACHE_FILE) {
11
- try {
12
- const path = getVersionCachePath(filename);
13
- if (!existsSync(path))
14
- return null;
15
- const parsed = JSON.parse(readFileSync(path, 'utf-8'));
16
- if (typeof parsed.lastCheck !== 'number')
17
- return null;
18
- if (parsed.latest !== null && typeof parsed.latest !== 'string')
19
- return null;
20
- return parsed;
21
- }
22
- catch {
23
- return null;
24
- }
25
- }
26
- export function readCachedLatest(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_MS) {
27
- const cache = readVersionCache(filename);
28
- if (!cache?.latest)
29
- return null;
30
- if (Date.now() - cache.lastCheck > maxAgeMs)
31
- return null;
32
- return cache.latest;
33
- }
34
- //# sourceMappingURL=version-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version-cache.js","sourceRoot":"","sources":["../../src/lib/version-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAO1D,MAAM,UAAU,mBAAmB,CAAC,WAAmB,cAAc;IACnE,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAmB,cAAc;IAChE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAiB,CAAC;QACvE,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACtD,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC7E,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,WAAmB,cAAc,EACjC,WAAmB,cAAc;IAEjC,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC"}
@@ -1,112 +0,0 @@
1
- /**
2
- * Workspace detection and hub resolution for workspace-aware CLI commands.
3
- *
4
- * Hub folders live directly under the resolved "hubs dir" — `wayai-ws/hubs/`
5
- * on the current layout, or the legacy `workspace/` for un-migrated repos (see
6
- * `layout.ts` / `resolveLayout`). Each hub folder has a `hub.yaml` (or legacy
7
- * `wayai.yaml`) file. `WorkspaceInfo.workspaceDir` IS that hubs dir.
8
- */
9
- export interface HubLocation {
10
- hubFolder: string;
11
- hubId: string;
12
- hubEnvironment: string;
13
- }
14
- /** A hub folder where hub.yaml exists but has no hub_id yet (not created on platform). */
15
- export interface NewHubLocation {
16
- hubFolder: string;
17
- hubName: string;
18
- hubType?: string;
19
- }
20
- export interface WorkspaceInfo {
21
- gitRoot: string;
22
- workspaceDir: string;
23
- }
24
- /**
25
- * Find the git repository root. Returns null if not inside a git repo.
26
- */
27
- export declare function findGitRoot(): string | null;
28
- /**
29
- * Detect the hubs directory for the active layout (`wayai-ws/hubs/`, or the
30
- * legacy `workspace/`). Returns null if not in a git repo or the dir doesn't
31
- * exist yet (fresh repo before the first pull/init).
32
- */
33
- export declare function detectWorkspace(): WorkspaceInfo | null;
34
- /** Scan `workspace/<hub>/hub.yaml` for hubs already created on the platform. */
35
- export declare function scanWorkspaceHubs(workspaceDir: string): HubLocation[];
36
- /** Scan `workspace/<hub>/hub.yaml` for hubs not yet created on the platform (no `hub_id`). */
37
- export declare function scanNewHubs(workspaceDir: string): NewHubLocation[];
38
- /**
39
- * Compute the hub folder slug with preview disambiguation.
40
- * Production: slugify(hubName)
41
- * Preview: slugify(hubName) + "-" + slugify(previewLabel || branchName || hubId[0:8])
42
- *
43
- * IMPORTANT: This must produce identical output to the backend's computeHubSlug
44
- * (workers/backend/src/routes/api/ci/lookup.ts) and getHubFolderSlug
45
- * (routes/api/files/index.ts). All three delegate to the canonical kebab slug
46
- * with a 64-char cap (CLI mirrors it via `slugify`; backend imports
47
- * `slugifyKebab`). Keep the cap in lockstep or folder resolution diverges.
48
- */
49
- export declare function getHubFolderSlug(hubName: string, hubEnvironment: string, hubId: string, previewLabel?: string | null, branchName?: string | null): string;
50
- /**
51
- * Resolve a hub folder in the workspace by hub_id match (handles folder renames),
52
- * falling back to a flat slugified hub path with preview disambiguation.
53
- */
54
- export declare function resolveHubFolder(workspaceDir: string, hubId: string | undefined, hubName: string, hubEnvironment: string, previewLabel?: string | null, branchName?: string | null): string;
55
- /**
56
- * Resolve the on-disk folder for a known hub_id by scanning the workspace.
57
- * Returns null when no workspace exists or the hub isn't materialized locally.
58
- */
59
- export declare function findLocalHubFolder(hubId: string): string | null;
60
- /**
61
- * Get hub folders with uncommitted changes via `git status`.
62
- * Filters to hub.yaml, wayai.yaml, and agents/*.yaml/md files under workspace/.
63
- * Unlike the GitHub Action, does NOT filter by hub_environment.
64
- */
65
- export declare function getChangedHubs(workspaceDir: string): HubLocation[];
66
- export interface ResolvedHubPath {
67
- hubId: string;
68
- hubFolder: string;
69
- hubEnvironment: string;
70
- }
71
- export interface UnresolvedSegments {
72
- orgPrefix?: string;
73
- hub: string;
74
- }
75
- /**
76
- * Parse a hub path (hub, or org/hub), resolve it locally if possible, and
77
- * return the parsed segments for API fallback if local resolution fails.
78
- *
79
- * Returns `{ resolved }` if found locally, or `{ segments }` for API lookup.
80
- */
81
- export declare function resolveExplicitHubPath(hubPath: string): {
82
- resolved: ResolvedHubPath;
83
- } | {
84
- segments: UnresolvedSegments;
85
- };
86
- /** Find a hub in `workspace/<hub>/` whose folder basename matches the given name. */
87
- export declare function findHubByFolderName(workspaceDir: string, hubFolderName: string): HubLocation | null;
88
- /**
89
- * Auto-rename a hub folder when the hub name has changed.
90
- * Compares current folder name against the expected slug and renames if different.
91
- * Returns the new folder path (or same path if no rename occurred).
92
- */
93
- export declare function autoRenameHubFolder(currentFolder: string, hubName: string, hubEnvironment: string, hubId: string, previewLabel?: string | null, branchName?: string | null): string;
94
- /**
95
- * Walk from `process.cwd()` up to (and including) `workspaceDir`, returning
96
- * the first directory whose `hub.yaml` (or legacy `wayai.yaml`) carries a
97
- * valid `hub_id`/`hub_environment`. Returns null if no enclosing hub folder
98
- * is found before reaching the workspace root.
99
- */
100
- export declare function findEnclosingHubFolder(workspaceDir: string): HubLocation | null;
101
- /**
102
- * Resolve the active hub for a workspace-scoped command.
103
- *
104
- * Resolution order:
105
- * 1. `--hub <uuid|folder-name>` flag in args (and consumed from args[])
106
- * 2. cwd is inside a hub folder
107
- * 3. exactly one hub in workspace/
108
- * 4. otherwise: error and exit
109
- *
110
- * Returns the hub's `hub_id`. Mutates `args` to remove the consumed `--hub` pair.
111
- */
112
- export declare function resolveActiveHubId(args: string[]): string;