archal 0.9.14 → 0.9.16

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 (51) 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 +97983 -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 -87894
  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-KTMNDJFB.js → chunk-CJJ32YQF.js} +45272 -44436
  32. package/dist/vitest/chunk-FU2VLK75.js +29296 -0
  33. package/dist/vitest/index.cjs +56931 -32004
  34. package/dist/vitest/index.d.ts +62 -28
  35. package/dist/vitest/index.js +147 -1809
  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 +29 -25
  41. package/skills/onboard/SKILL.md +56 -41
  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/twin-assets/github/fidelity.json +0 -13
  48. package/twin-assets/linear/fidelity.json +0 -18
  49. package/twin-assets/slack/fidelity.json +0 -20
  50. package/twin-assets/stripe/fidelity.json +0 -22
  51. package/twin-assets/supabase/fidelity.json +0 -13
@@ -1,27 +1,27 @@
1
1
  ---
2
2
  name: vitest
3
- description: Wire `archal/vitest` into a user's existing Vitest suite so integration tests hit hosted twins instead of real SaaS. Use when the user asks to "add archal to vitest", "wire up vitest with twins", "test against twins in vitest", or when invoked from `archal-onboard` Option C.
3
+ description: Wire `archal/vitest` into a user's existing Vitest suite so integration tests hit hosted clones instead of real SaaS. Use when the user asks to "add archal to vitest", "wire up vitest with clones", "test against clones in vitest", or when invoked from `archal-onboard` Option C.
4
4
  user-invocable: true
5
5
  ---
6
6
 
7
7
  # Archal Vitest Integration
8
8
 
9
- Wire `archal/vitest` into the user's existing Vitest suite. Don't paste a canned config inspect what's already there, surface the right choices, and compose on top of it.
9
+ Wire `archal/vitest` into the user's existing Vitest suite. Don't paste a canned config - inspect what's already there, surface the right choices, and compose on top of it.
10
10
 
11
11
  ## What only you know
12
12
 
13
13
  Claude already knows what Vitest is and how a fetch interceptor works. These are the Archal-specific facts that determine your choices:
14
14
 
15
15
  - `archal/vitest` is a **subpath export of the `archal` npm package**. Users do `pnpm add -D archal`, not `@archal/vitest`.
16
- - Route mode installs a setup file that rewrites `fetch()` calls to hosted twins. **Test code stays unchanged** same SDKs, same URLs.
17
- - Twins are hosted on **ECS Fargate** in Archal's AWS. First run = ~30s cold start. Subsequent runs within the 30-min idle TTL = ~2s. Tell the user; they'll think it's hung otherwise.
16
+ - Route mode installs a setup file that rewrites `fetch()` calls to hosted clones. **Test code stays unchanged** - same SDKs, same URLs.
17
+ - Clones are hosted on **ECS Fargate** in Archal's AWS. First run = ~30s cold start. Subsequent runs within the 30-min idle TTL = ~2s. Tell the user; they'll think it's hung otherwise.
18
18
  - Session cache key = `(projectName, services, seeds)` hash. Change any of those and the cache misses.
19
- - **Seeds = starting state.** Omit to get the twin's default. Named seeds give fixtures (e.g. `small-project` for GitHub, `small-business` for Stripe). Never ask "what seed?" open-ended the user doesn't know the catalog.
20
- - Route-mode twins available: `discord`, `github`, `google-workspace`, `jira`, `linear`, `ramp`, `slack`, `stripe`, `supabase`. Not yet: `telegram`. (Source of truth: `SHARED_ROUTE_MANIFESTS` in `packages/route-runtime-core/src/manifests.ts` don't invent services that aren't in that array.)
19
+ - **Seeds = starting state.** Omit to get the clone's default. Named seeds give fixtures (e.g. `small-project` for GitHub, `small-business` for Stripe). Never ask "what seed?" open-ended - the user doesn't know the catalog.
20
+ - Route-mode clone availability is defined by `SHARED_ROUTE_MANIFESTS` in `packages/route-runtime-core/src/manifests.ts`; use `archal clone --json` / `archal seed list` before naming supported services.
21
21
 
22
22
  ## Discover before you ask
23
23
 
24
- 1. `package.json` deps infer likely twins (`@octokit/rest` github, `stripe` stripe, `@slack/web-api` slack, `@supabase/supabase-js` supabase, `googleapis` google-workspace, `jira.js` jira).
24
+ 1. `package.json` deps -> infer likely clones (`@octokit/rest` -> github, `stripe` -> stripe, `@slack/web-api` -> slack, `@supabase/supabase-js` -> supabase, `googleapis` -> google-workspace, `jira.js` -> jira).
25
25
  2. Read any existing `vitest.config.ts` / `vitest.config.js` / `vitest.workspace.ts`. Note `setupFiles`, `include`/`exclude`, `reporters`, `projects`.
26
26
  3. Grep test files (`__tests__/`, `tests/`, `*.test.ts`) for outbound calls: `fetch(`, `Octokit`, `new Stripe`, `WebClient`, `createClient`. These are the routing candidates.
27
27
  4. Auth: `archal usage` tells you if they're logged in. `archal login` or `ARCHAL_TOKEN` in CI.
@@ -31,19 +31,19 @@ Claude already knows what Vitest is and how a fetch interceptor works. These are
31
31
  Offer your inferred answer as the default.
32
32
 
33
33
  1. **Scope.** "I found these N test files making outbound HTTP calls: [list]. All of them? Or a specific subset (by folder, glob, or file list)?"
34
- 2. **Twin set.** "From deps I see `[github, stripe]`. Complete, or am I missing/over-including?"
35
- 3. **Seeds (per twin, with inline catalog).** For each twin, present three choices:
36
- > "For `github`: (a) default empty twin, (b) `small-project` seed (one repo, few issues/PRs good starting point), (c) custom seed name. Which?"
34
+ 2. **Clone set.** "From deps I see `[github, stripe]`. Complete, or am I missing/over-including?"
35
+ 3. **Seeds (per clone, with inline catalog).** For each clone, present three choices:
36
+ > "For `github`: (a) default empty clone, (b) `small-project` seed (one repo, few issues/PRs - good starting point), (c) custom seed name. Which?"
37
37
 
38
38
  ## Pick a config pattern
39
39
 
40
40
  Three patterns. The right one depends on what you saw in discovery.
41
41
 
42
- ### Pattern A wrap existing `vitest.config.ts` with `withArchal` (all tests hit twins)
42
+ ### Pattern A - wrap existing `vitest.config.ts` with `withArchal` (all tests hit clones)
43
43
 
44
44
  For dedicated integration-test packages where every test should route. `withArchal` is a merge helper: it preserves everything in the existing `test` block (`coverage`, `alias`, `globalSetup`, `poolOptions`, custom reporters, etc.) and additively composes Archal's setup file, reporter, and session env on top.
45
45
 
46
- Edit their existing file in place the change is one line on the `test:` value:
46
+ Edit their existing file in place - the change is one line on the `test:` value:
47
47
 
48
48
  ```ts
49
49
  import { defineConfig } from 'vitest/config';
@@ -71,9 +71,9 @@ Merge behavior: `setupFiles` and `reporters` are concatenated, `env` is merged (
71
71
 
72
72
  If the user is starting from scratch (no existing `test` block), pass `{}` as the first argument: `withArchal({}, { services })`.
73
73
 
74
- ### Pattern B workspace with a separate Archal project (subset of tests hit twins)
74
+ ### Pattern B - workspace with a separate Archal project (subset of tests hit clones)
75
75
 
76
- Most common shape. Unit tests stay fast; only the routed subset provisions twins.
76
+ Most common shape. Unit tests stay fast; only the routed subset provisions clones.
77
77
 
78
78
  ```ts
79
79
  import { archalVitestProject } from 'archal/vitest';
@@ -82,7 +82,7 @@ export default [
82
82
  './vitest.config.ts', // their existing unit project untouched
83
83
  archalVitestProject(
84
84
  {
85
- name: 'hosted-twins',
85
+ name: 'hosted-clones',
86
86
  services: {
87
87
  github: { mode: 'route', seed: 'small-project' },
88
88
  stripe: { mode: 'route' },
@@ -93,11 +93,11 @@ export default [
93
93
  ];
94
94
  ```
95
95
 
96
- ### Pattern C separate config + npm script (strict isolation)
96
+ ### Pattern C - separate config + npm script (strict isolation)
97
97
 
98
98
  `vitest.integration.config.ts` using Pattern A, plus `"test:integration": "vitest -c vitest.integration.config.ts"`. Use when `pnpm test` must stay unit-only.
99
99
 
100
- ## Apply verify
100
+ ## Apply -> verify
101
101
 
102
102
  1. Install `archal` if missing.
103
103
  2. Write/edit the config.
@@ -105,6 +105,7 @@ export default [
105
105
  4. Run one routed test: `pnpm vitest run <path>`.
106
106
 
107
107
  If confirming routing is live from inside a test:
108
+
108
109
  ```ts
109
110
  import { getInstalledArchalVitestSession } from 'archal/vitest';
110
111
  console.log(getInstalledArchalVitestSession()?.resolvedRuntime.resolvedServices);
@@ -112,18 +113,18 @@ console.log(getInstalledArchalVitestSession()?.resolvedRuntime.resolvedServices)
112
113
 
113
114
  ## Failure modes
114
115
 
115
- - **Real API response instead of twin response** test file isn't in the routed project's `include` glob.
116
- - **401/auth at setup** `ARCHAL_TOKEN` unset or `archal login` not run.
117
- - **First run takes 30+ seconds** ECS cold-start, expected. Warn the user up front.
118
- - **Seed state unexpected** inspect via `getInstalledArchalVitestSession()`; confirm resolved seed matches intent.
119
- - **`resetArchalTwins()` not restoring** call in `beforeEach`, not `beforeAll`.
120
- - **CI credential race** (parallel jobs corrupting `~/.archal/credentials.json`) export `ARCHAL_TOKEN` directly; don't rely on the credential file.
116
+ - **Real API response instead of clone response** - test file isn't in the routed project's `include` glob.
117
+ - **401/auth at setup** - `ARCHAL_TOKEN` unset or `archal login` not run.
118
+ - **First run takes 30+ seconds** - ECS cold-start, expected. Warn the user up front.
119
+ - **Seed state unexpected** - inspect via `getInstalledArchalVitestSession()`; confirm resolved seed matches intent.
120
+ - **`resetArchalClones()` not restoring** - call in `beforeEach`, not `beforeAll`.
121
+ - **CI credential race** (parallel jobs corrupting `~/.archal/credentials.json`) - export `ARCHAL_TOKEN` directly; don't rely on the credential file.
121
122
 
122
123
  ## Anti-patterns
123
124
 
124
125
  - Don't route `localhost` or the user's own backend. Route mode is for external SaaS.
125
126
  - Don't set `testIsolation: 'serial'` preemptively. Only when you've observed cross-test state leaks.
126
- - Don't add route mode to tests that don't make outbound HTTP calls the interceptor install has overhead.
127
+ - Don't add route mode to tests that don't make outbound HTTP calls - the interceptor install has overhead.
127
128
  - Don't drive vitest through `.archal.json`. That file is for the CLI `archal run` flow; the vitest integration is self-contained.
128
129
  - Don't paste a canonical config without reading what's already in the repo.
129
130