archal 0.9.13 → 0.9.15

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 (53) hide show
  1. package/README.md +81 -73
  2. package/bin/archal.cjs +1 -1
  3. package/clone-assets/apify/tools.json +668 -0
  4. package/{twin-assets → clone-assets}/discord/fidelity.json +1 -1
  5. package/{twin-assets → clone-assets}/discord/tools.json +510 -510
  6. package/clone-assets/github/fidelity.json +31 -0
  7. package/{twin-assets → clone-assets}/github/tools.json +113 -3
  8. package/{twin-assets → clone-assets}/google-workspace/fidelity.json +2 -2
  9. package/{twin-assets → clone-assets}/google-workspace/tools.json +10 -10
  10. package/{twin-assets → clone-assets}/jira/fidelity.json +44 -4
  11. package/{twin-assets → clone-assets}/jira/tools.json +1 -1
  12. package/clone-assets/linear/fidelity.json +36 -0
  13. package/{twin-assets → clone-assets}/linear/tools.json +1 -1
  14. package/{twin-assets → clone-assets}/ramp/fidelity.json +1 -1
  15. package/{twin-assets → clone-assets}/ramp/tools.json +1 -1
  16. package/clone-assets/slack/fidelity.json +38 -0
  17. package/{twin-assets → clone-assets}/slack/tools.json +1 -1
  18. package/clone-assets/stripe/fidelity.json +67 -0
  19. package/{twin-assets → clone-assets}/stripe/tools.json +42 -11
  20. package/clone-assets/supabase/fidelity.json +31 -0
  21. package/{twin-assets → clone-assets}/supabase/tools.json +1 -1
  22. package/clone-assets/tavily/tools.json +115 -0
  23. package/dist/cli.cjs +97917 -0
  24. package/dist/cli.d.cts +1 -0
  25. package/dist/harness.cjs +62 -0
  26. package/dist/harness.d.cts +20 -0
  27. package/dist/index.cjs +5 -87878
  28. package/dist/index.d.cts +3 -1
  29. package/dist/seed/dynamic-generator.cjs +8796 -9201
  30. package/dist/seed/dynamic-generator.d.cts +39 -0
  31. package/dist/vitest/chunk-2GY4SFKE.js +29279 -0
  32. package/dist/vitest/{chunk-KTMNDJFB.js → chunk-WVRVNHAX.js} +45255 -44440
  33. package/dist/vitest/index.cjs +56408 -31519
  34. package/dist/vitest/index.d.ts +61 -27
  35. package/dist/vitest/index.js +145 -1807
  36. package/dist/vitest/runtime/hosted-session-reaper.cjs +34766 -28922
  37. package/dist/vitest/runtime/hosted-session-reaper.js +1 -2
  38. package/dist/vitest/runtime/setup-files.js +2 -3
  39. package/package.json +19 -10
  40. package/skills/eval/SKILL.md +113 -0
  41. package/skills/onboard/SKILL.md +67 -36
  42. package/skills/scenario/SKILL.md +22 -20
  43. package/skills/vitest/SKILL.md +25 -24
  44. package/dist/vitest/chunk-L6HSMJ3F.js +0 -2216
  45. package/dist/vitest/chunk-YJICENME.js +0 -1230
  46. package/dist/vitest/src-JGHX6UKK.js +0 -94
  47. package/skills/audit/SKILL.md +0 -55
  48. package/skills/test/SKILL.md +0 -109
  49. package/twin-assets/github/fidelity.json +0 -13
  50. package/twin-assets/linear/fidelity.json +0 -18
  51. package/twin-assets/slack/fidelity.json +0 -20
  52. package/twin-assets/stripe/fidelity.json +0 -22
  53. package/twin-assets/supabase/fidelity.json +0 -13
@@ -1,4 +1,3 @@
1
- import { defineWorkspace } from 'vitest/config';
2
1
  import { Reporter } from 'vitest/reporters';
3
2
  import { Vitest } from 'vitest/node';
4
3
 
@@ -70,7 +69,7 @@ interface PublicSessionSnapshot {
70
69
  resolvedRuntime: ResolvedRuntime;
71
70
  }
72
71
 
73
- declare function resetArchalTwins(): Promise<void>;
72
+ declare function resetArchalClones(): Promise<void>;
74
73
  declare function bootstrapArchalVitestRouting(): Promise<ArchalRuntime>;
75
74
  declare function getInstalledArchalVitestRuntime(): ArchalRuntime | undefined;
76
75
  declare function getInstalledArchalVitestSession(): PublicSessionSnapshot | undefined;
@@ -91,24 +90,24 @@ type SeedClassification = {
91
90
  declare function classifySeed(value: string): SeedClassification;
92
91
 
93
92
  /**
94
- * A webhook delivery that the twin has queued but has NOT POSTed to the
95
- * developer's endpoint. The hosted twin runs in AWS ECS and can't reach
96
- * the developer's localhost, so tests pull queued deliveries from the twin
93
+ * A webhook delivery that the clone has queued but has NOT POSTed to the
94
+ * developer's endpoint. The hosted clone runs in AWS ECS and can't reach
95
+ * the developer's localhost, so tests pull queued deliveries from the clone
97
96
  * and invoke the user's handler directly with the payload.
98
97
  */
99
98
  interface ArchalWebhookDelivery {
100
99
  /** The Archal service that queued the delivery — `'stripe'`, `'github'`, etc. */
101
100
  service: string;
102
- /** The event type as emitted by the twin (e.g. `"customer.subscription.created"`). */
101
+ /** The event type as emitted by the clone (e.g. `"customer.subscription.created"`). */
103
102
  eventType: string;
104
103
  /** The parsed webhook payload. Shape matches the real service (Stripe Event, GitHub hook payload, etc.). */
105
104
  payload: unknown;
106
- /** The serialized JSON body the twin would have POSTed. Use this for signature verification —
105
+ /** The serialized JSON body the clone would have POSTed. Use this for signature verification —
107
106
  * re-serializing `payload` can produce different byte order and break HMAC checks. */
108
107
  body: string;
109
- /** Headers the twin would have POSTed with includes the signature header (e.g. `Stripe-Signature`). */
108
+ /** Headers the clone would have POSTed with - includes the signature header (e.g. `Stripe-Signature`). */
110
109
  headers: Record<string, string>;
111
- /** The endpoint URL as registered by the user in the twin's state. */
110
+ /** The endpoint URL as registered by the user in the clone's state. */
112
111
  url: string;
113
112
  /** Epoch milliseconds when the delivery was queued. */
114
113
  queuedAt: number;
@@ -143,24 +142,24 @@ interface WaitForWebhookOptions {
143
142
  consume?: boolean;
144
143
  }
145
144
  /**
146
- * Return the current pending webhook deliveries queued by the named twin.
145
+ * Return the current pending webhook deliveries queued by the named clone.
147
146
  *
148
- * Each twin's `WebhookDeliveryEngine` appends a delivery whenever an event
149
- * matches a webhook endpoint the user has registered. The hosted twin
147
+ * Each clone's `WebhookDeliveryEngine` appends a delivery whenever an event
148
+ * matches a webhook endpoint the user has registered. The hosted clone
150
149
  * never POSTs these out in route-mode (it can't reach the user's
151
150
  * localhost), so this helper is the way tests observe them.
152
151
  */
153
152
  declare function listArchalWebhooks(serviceName: string): Promise<ArchalWebhookDelivery[]>;
154
153
  /**
155
- * Drop all pending webhook deliveries queued by the named twin.
154
+ * Drop all pending webhook deliveries queued by the named clone.
156
155
  *
157
- * Called automatically by `resetArchalTwins()` so each test starts with
156
+ * Called automatically by `resetArchalClones()` so each test starts with
158
157
  * an empty queue, and invoked internally by `waitForArchalWebhook()` when
159
158
  * `consume: true`.
160
159
  */
161
160
  declare function clearArchalWebhooks(serviceName: string): Promise<void>;
162
161
  /**
163
- * Poll the named twin's pending-webhook queue until a matching delivery
162
+ * Poll the named clone's pending-webhook queue until a matching delivery
164
163
  * appears or the timeout elapses. Returns the first match.
165
164
  *
166
165
  * ```ts
@@ -170,7 +169,7 @@ declare function clearArchalWebhooks(serviceName: string): Promise<void>;
170
169
  * ```
171
170
  *
172
171
  * **Parallel-worker caveat**: this helper consumes pending deliveries
173
- * from a shared twin queue. When vitest runs test files in parallel
172
+ * from a shared clone queue. When vitest runs test files in parallel
174
173
  * (the default) across workers, worker A can consume worker B's
175
174
  * deliveries. Use `testIsolation: 'serial'` in `withArchal` or
176
175
  * `archalVitestProject` if your tests depend on webhook events.
@@ -194,7 +193,26 @@ declare class ArchalReporter implements Reporter {
194
193
  private lifecycleMarkerPath;
195
194
  private workspaceReporterMarkerPath;
196
195
  private projects;
196
+ /**
197
+ * In-flight upload promise for the current run. Vitest v3+ fires both
198
+ * `onFinished` and `onTestRunEnd` in parallel via `Promise.all` (see
199
+ * vitest@3.x packages/vitest/src/node/test-run.ts), so without this guard
200
+ * the reporter uploads results twice and the dashboard shows duplicate
201
+ * rows. Reset at the start of each run (onTestRunStart / onWatcherRerun)
202
+ * so watch-mode reruns still upload.
203
+ */
204
+ private activeUpload;
197
205
  onInit(ctx: Vitest): void;
206
+ /**
207
+ * v3+ canonical start-of-run hook. Resetting the upload guard here lets
208
+ * watch-mode reruns upload their own results.
209
+ */
210
+ onTestRunStart(_specifications?: unknown[]): void;
211
+ /**
212
+ * v2 watch-mode start-of-rerun hook. Same purpose as onTestRunStart for
213
+ * v3+. Vitest v2 has no onTestRunStart, so we reset here instead.
214
+ */
215
+ onWatcherRerun(_files?: string[], _trigger?: string): void;
198
216
  private decodeConfig;
199
217
  private buildProjectContext;
200
218
  private resolveProjects;
@@ -205,10 +223,21 @@ declare class ArchalReporter implements Reporter {
205
223
  */
206
224
  onFinished(files?: unknown[], _errors?: unknown[]): Promise<void>;
207
225
  /**
208
- * vitest v4 calls onTestRunEnd (not onFinished) for custom reporters.
209
- * The argument is an array of test modules, each with nested children.
226
+ * vitest v3+ calls onTestRunEnd alongside onFinished (in parallel via
227
+ * Promise.all). v4 drops onFinished entirely. The argument is an array of
228
+ * test modules, each with nested children.
210
229
  */
211
230
  onTestRunEnd(testModules?: unknown[]): Promise<void>;
231
+ /**
232
+ * Dedupe upload work when Vitest fires multiple end-of-run hooks. In
233
+ * Vitest v3+ both `onFinished` and `onTestRunEnd` fire from the same
234
+ * `Promise.all` in TestRun.end(); the first hook to enter wins and the
235
+ * second awaits the same in-flight upload instead of POSTing a duplicate
236
+ * row to /api/test-results. The resolved promise is kept on the instance
237
+ * so any late hook still no-ops — the guard is only cleared at the start
238
+ * of a new run (onTestRunStart / onWatcherRerun).
239
+ */
240
+ private runUploadOnce;
212
241
  private collectAndReport;
213
242
  /**
214
243
  * vitest v2: File extends Suite { tasks: Task[] }.
@@ -230,7 +259,7 @@ interface ArchalVitestProjectOptions {
230
259
  name?: string;
231
260
  services: Record<string, ServiceConfig>;
232
261
  /**
233
- * Controls how twin state is isolated across vitest workers.
262
+ * Controls how clone state is isolated across vitest workers.
234
263
  *
235
264
  * - `'shared'` (default): one hosted session is shared across all workers.
236
265
  * Cheapest and fastest, but state from one test is visible to tests in
@@ -270,12 +299,18 @@ interface ArchalVitestBuiltTestConfig {
270
299
  fileParallelism?: boolean;
271
300
  }
272
301
  interface ArchalVitestWorkspaceProjectConfig {
273
- test?: ArchalVitestBuiltTestConfig;
302
+ test?: Record<string, unknown> & {
303
+ env?: Record<string, string>;
304
+ fileParallelism?: boolean;
305
+ maxWorkers?: number | string;
306
+ name?: string;
307
+ };
274
308
  [key: string]: unknown;
275
309
  }
276
- type ArchalVitestWorkspaceProject = string | ArchalVitestWorkspaceProjectConfig;
310
+ type ArchalVitestWorkspaceProject = string | ArchalVitestWorkspaceProjectConfig | (() => ArchalVitestWorkspaceProjectConfig | Promise<ArchalVitestWorkspaceProjectConfig>);
311
+ type ArchalVitestWorkspaceInput = readonly ArchalVitestWorkspaceProject[];
277
312
  /**
278
- * Create a vitest workspace project that routes requests to Archal hosted twins.
313
+ * Create a vitest workspace project that routes requests to Archal hosted clones.
279
314
  *
280
315
  * Use this from `vitest.workspace.ts`:
281
316
  * ```ts
@@ -323,13 +358,13 @@ declare function archalVitestRootConfig(): {
323
358
  };
324
359
  };
325
360
  /**
326
- * Compose Archal's hosted-twin routing into a user's existing vitest `test`
361
+ * Compose Archal's hosted-clone routing into a user's existing vitest `test`
327
362
  * config, preserving every field they set (including ones Archal's options
328
363
  * surface doesn't cover — `coverage`, `alias`, `globalSetup`, `poolOptions`,
329
364
  * custom `reporters`, etc.).
330
365
  *
331
366
  * Use this when the project already has a `vitest.config.ts` and the user
332
- * wants every test in it to route to twins:
367
+ * wants every test in it to route to clones:
333
368
  *
334
369
  * ```ts
335
370
  * import { defineConfig } from 'vitest/config';
@@ -388,11 +423,10 @@ declare function withArchal<T extends Record<string, unknown>>(existingTest: T,
388
423
  * ]);
389
424
  * ```
390
425
  *
391
- * Accepts anything `defineWorkspace` accepts archal-project results, plain
426
+ * Accepts Vitest workspace entries: archal-project results, plain
392
427
  * `defineProject({...})` configs, glob-pattern strings, or function-based
393
428
  * project factories.
394
429
  */
395
- type ArchalVitestWorkspaceInput = Parameters<typeof defineWorkspace>[0];
396
430
  declare function archalVitestWorkspace<T extends ArchalVitestWorkspaceInput>(projects: T): T;
397
431
 
398
- export { ArchalReporter, type ArchalVitestBuiltTestConfig, type ArchalVitestProjectOptions, type ArchalVitestProjectTestOptions, type PublicSessionSnapshot as ArchalVitestPublicSessionSnapshot, type ArchalVitestWorkspaceProject, type ArchalVitestWorkspaceProjectConfig, type ArchalWebhookDelivery, type WaitForWebhookOptions, archalVitestConfig, archalVitestProject, archalVitestRootConfig, archalVitestWorkspace, bootstrapArchalVitestRouting, classifySeed, clearArchalWebhooks, getInstalledArchalVitestRuntime, getInstalledArchalVitestSession, listArchalWebhooks, resetArchalTwins, waitForArchalWebhook, withArchal };
432
+ export { ArchalReporter, type ArchalVitestBuiltTestConfig, type ArchalVitestProjectOptions, type ArchalVitestProjectTestOptions, type PublicSessionSnapshot as ArchalVitestPublicSessionSnapshot, type ArchalVitestWorkspaceInput, type ArchalVitestWorkspaceProject, type ArchalVitestWorkspaceProjectConfig, type ArchalWebhookDelivery, type WaitForWebhookOptions, archalVitestConfig, archalVitestProject, archalVitestRootConfig, archalVitestWorkspace, bootstrapArchalVitestRouting, classifySeed, clearArchalWebhooks, getInstalledArchalVitestRuntime, getInstalledArchalVitestSession, listArchalWebhooks, resetArchalClones, waitForArchalWebhook, withArchal };