@allstak/wizard 0.1.3 → 0.1.4
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.
- package/CHANGELOG.md +14 -1
- package/README.md +296 -47
- package/dist/api/types.d.ts +3 -3
- package/dist/api/types.js +3 -3
- package/dist/util/wizard-version.d.ts +1 -1
- package/dist/util/wizard-version.js +1 -1
- package/docs/architecture/v02-java-host-fix-spec.md +4 -8
- package/docs/beta/README.md +17 -0
- package/docs/beta/ci.md +122 -0
- package/docs/beta/config.md +124 -0
- package/docs/beta/doctor.md +79 -0
- package/docs/beta/known-limitations.md +93 -0
- package/docs/beta/next.md +77 -0
- package/docs/beta/node.md +60 -0
- package/docs/beta/privacy.md +99 -0
- package/docs/beta/quickstart.md +89 -0
- package/docs/beta/react.md +83 -0
- package/docs/beta/restore.md +84 -0
- package/docs/beta/troubleshooting.md +133 -0
- package/docs/errors.md +88 -0
- package/package.json +14 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# `allstak.config.*`
|
|
2
|
+
|
|
3
|
+
Optional project-level config so you don't repeat `--org`, `--project`,
|
|
4
|
+
`--host`, etc. on every wizard invocation. Discovered from the project root
|
|
5
|
+
upward; the first matching file wins.
|
|
6
|
+
|
|
7
|
+
Loader order (first match wins):
|
|
8
|
+
|
|
9
|
+
1. `allstak.config.ts`
|
|
10
|
+
2. `allstak.config.mts`
|
|
11
|
+
3. `allstak.config.mjs`
|
|
12
|
+
4. `allstak.config.js`
|
|
13
|
+
5. `allstak.config.cjs`
|
|
14
|
+
6. `allstak.config.json`
|
|
15
|
+
|
|
16
|
+
`.ts` / `.mts` configs require running the wizard via a TypeScript-aware
|
|
17
|
+
launcher (`npx tsx`, `bun`, or `deno run`). Plain `.mjs` / `.json` work
|
|
18
|
+
without any toolchain.
|
|
19
|
+
|
|
20
|
+
## Schema
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { defineConfig } from '@allstak/wizard/config';
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
organization: 'my-org',
|
|
28
|
+
project: 'my-project',
|
|
29
|
+
environment: 'production',
|
|
30
|
+
release: process.env.GIT_SHA,
|
|
31
|
+
sourceMaps: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
ignore: ['node_modules'],
|
|
34
|
+
},
|
|
35
|
+
selfHosted: {
|
|
36
|
+
apiHost: 'https://api.allstak.example',
|
|
37
|
+
ingestHost: 'https://api.allstak.example',
|
|
38
|
+
dashboardHost: 'https://app.allstak.example',
|
|
39
|
+
},
|
|
40
|
+
snapshotKeep: 10,
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
All fields are optional. `defineConfig` is a typed-identity helper; at
|
|
45
|
+
runtime it just returns its input.
|
|
46
|
+
|
|
47
|
+
## Precedence
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
CLI flag > env var > config file > built-in default
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
|
|
55
|
+
| Setting | CLI | Env | Config | Default |
|
|
56
|
+
|---------|-----|-----|--------|---------|
|
|
57
|
+
| organization | `--org` | `ALLSTAK_ORG` | `organization` | — |
|
|
58
|
+
| project | `--project` | `ALLSTAK_PROJECT` | `project` | — |
|
|
59
|
+
| environment | `--environment` | `ALLSTAK_ENVIRONMENT` | `environment` | `production` |
|
|
60
|
+
| release | `--release` | `ALLSTAK_RELEASE` | `release` (string or function) | — |
|
|
61
|
+
| api host | `--host` | `ALLSTAK_HOST` | `selfHosted.apiHost` | `https://api.allstak.sa` |
|
|
62
|
+
| ingest host | `--ingest-host` | `ALLSTAK_INGEST_HOST` | `selfHosted.ingestHost` | matches api host |
|
|
63
|
+
| dashboard host | `--dashboard-host` | `ALLSTAK_DASHBOARD_HOST` | `selfHosted.dashboardHost` | derived from api |
|
|
64
|
+
| source-maps | `--skip-source-maps` | — | `sourceMaps.enabled` | `true` |
|
|
65
|
+
| snapshot-keep | `--snapshot-keep` | `ALLSTAK_SNAPSHOT_KEEP` | `snapshotKeep` | `10` |
|
|
66
|
+
|
|
67
|
+
## Validation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @allstak/wizard@beta config validate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Reports the discovered file path, the declared `schemaVersion`, and any
|
|
74
|
+
deprecation warnings.
|
|
75
|
+
|
|
76
|
+
## Migration
|
|
77
|
+
|
|
78
|
+
When the wizard ships a new schema, `allstak config migrate` upgrades your
|
|
79
|
+
config in place.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx @allstak/wizard@beta config migrate # rewrites .json files
|
|
83
|
+
npx @allstak/wizard@beta config migrate --dry-run # prints planned changes
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For `.ts` / `.mjs` configs the wizard prints the migrated shape and asks
|
|
87
|
+
you to apply it manually — we don't roundtrip TypeScript through an AST
|
|
88
|
+
serializer that would mangle your imports and comments.
|
|
89
|
+
|
|
90
|
+
The wizard treats a missing `schemaVersion` as `1`. Always declaring it
|
|
91
|
+
explicitly future-proofs your config.
|
|
92
|
+
|
|
93
|
+
## Self-hosted
|
|
94
|
+
|
|
95
|
+
Wizard never assumes `api.allstak.sa`. For a self-hosted deployment:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export default defineConfig({
|
|
99
|
+
schemaVersion: 1,
|
|
100
|
+
selfHosted: {
|
|
101
|
+
apiHost: 'https://api.allstak.acme.com',
|
|
102
|
+
ingestHost: 'https://api.allstak.acme.com',
|
|
103
|
+
dashboardHost: 'https://app.allstak.acme.com',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
CLI users can also pass `--host`, `--ingest-host`, `--dashboard-host`
|
|
109
|
+
directly. **Caveat:** the Java SDK currently hardcodes its host; the wizard
|
|
110
|
+
will warn when `-i java` runs against a non-default host until the SDK
|
|
111
|
+
ships a configurable host field.
|
|
112
|
+
|
|
113
|
+
## Release as a function
|
|
114
|
+
|
|
115
|
+
Useful for CI:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
release: process.env.GIT_SHA, // string at config-load time
|
|
119
|
+
release: () => process.env.GIT_SHA, // function evaluated each run
|
|
120
|
+
release: () => execSync('git rev-parse HEAD').toString().trim(),
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If the function returns `undefined`, the wizard falls through the precedence
|
|
124
|
+
chain (env, default).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# `allstak doctor`
|
|
2
|
+
|
|
3
|
+
Deterministic diagnostic with named stages. Read-only by default;
|
|
4
|
+
`--live-probe` adds a real test event roundtrip.
|
|
5
|
+
|
|
6
|
+
## Stages
|
|
7
|
+
|
|
8
|
+
The doctor runs all stages in this fixed order, even when an early stage
|
|
9
|
+
fails (so you see the whole picture):
|
|
10
|
+
|
|
11
|
+
| Stage | What it checks |
|
|
12
|
+
|-------|----------------|
|
|
13
|
+
| `auth` | Credentials present + accepted (`--api-key` or stored JWT). Auto-refreshes JWT if it expires soon. |
|
|
14
|
+
| `reachability` | Configured host responds (HTTP-level only — no `/health` exists, so it probes `/api/v1/auth/me` and treats `401` as "alive"). |
|
|
15
|
+
| `config` | `allstak.config.*` discovered (or absent — both fine). Reports the source path. |
|
|
16
|
+
| `integration` | Delegates to the integration's own doctor — env present? entry patched? imports wired? |
|
|
17
|
+
| `event-ingest` | (only with `--live-probe`) Sends a real event to `/ingest/v1/errors`, polls `/api/v1/errors` for ingestion. |
|
|
18
|
+
| `release-linkage` | Confirms the configured release is attached to the test event. |
|
|
19
|
+
| `source-maps` | Asks each registered source-map provider for its wired/drifted/missing state. |
|
|
20
|
+
|
|
21
|
+
## Output
|
|
22
|
+
|
|
23
|
+
Each stage emits exactly one line: `pass`, `warn`, `fail`, or `skip`, plus
|
|
24
|
+
a fix hint when applicable. `--json` produces a structured array under
|
|
25
|
+
`data.stages` for programmatic consumption.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @allstak/wizard@beta doctor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
» Doctor
|
|
33
|
+
✓ [auth] Authenticated as me@example.com.
|
|
34
|
+
✓ [reachability] Reached https://api.allstak.sa.
|
|
35
|
+
✓ [config] Loaded config from /repo/allstak.config.ts.
|
|
36
|
+
✓ [integration] react: ok (4 checks)
|
|
37
|
+
- [event-ingest] Skipped (pass --live-probe to enable).
|
|
38
|
+
- [release-linkage] Skipped: live probe required to verify release linkage end-to-end.
|
|
39
|
+
✓ [source-maps] Wired: vite
|
|
40
|
+
✓ Doctor: setup looks good.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Live probe
|
|
44
|
+
|
|
45
|
+
Requires both:
|
|
46
|
+
|
|
47
|
+
- `--api-key` (project-scoped — sends the test event),
|
|
48
|
+
- `--project-id <uuid>` (the project UUID, visible in the dashboard URL).
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx @allstak/wizard@beta doctor --live-probe \
|
|
52
|
+
--api-key ask_live_... \
|
|
53
|
+
--project-id 7e8e... \
|
|
54
|
+
--live-probe-timeout 60000
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Flow:
|
|
58
|
+
|
|
59
|
+
1. Wizard generates a random fingerprint (`wizard-probe-<6-hex>`).
|
|
60
|
+
2. POSTs an event to `/ingest/v1/errors` with that fingerprint in metadata.
|
|
61
|
+
3. Polls `/api/v1/errors?projectId=&from=&query=<fingerprint>` every 2.5s.
|
|
62
|
+
4. Reports the dashboard URL of the captured event when found.
|
|
63
|
+
|
|
64
|
+
If polling times out, the doctor returns `E_INGEST_VERIFY_FAILED` with the
|
|
65
|
+
event id you can hand to support.
|
|
66
|
+
|
|
67
|
+
## JSON mode
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @allstak/wizard@beta --json doctor | jq '.data.stages'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Each entry is `{ stage, status, detail, fix?, data? }`.
|
|
74
|
+
|
|
75
|
+
## When stages fail
|
|
76
|
+
|
|
77
|
+
The CLI exits non-zero (code 2) on any `fail`. `warn` and `skip` do not
|
|
78
|
+
change exit code. See [errors.md](../errors.md) for the canonical error
|
|
79
|
+
codes each stage can emit.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Known limitations (public beta)
|
|
2
|
+
|
|
3
|
+
This page is the **honest** list of what the wizard does and doesn't do
|
|
4
|
+
today. Read it before making the wizard part of a critical onboarding
|
|
5
|
+
path.
|
|
6
|
+
|
|
7
|
+
## Supported integrations
|
|
8
|
+
|
|
9
|
+
| Integration | Stability | Notes |
|
|
10
|
+
|-------------|-----------|-------|
|
|
11
|
+
| `react` (Vite or CRA) | ✅ stable | Validated end-to-end; dogfooded against `admin-web` and `web`. |
|
|
12
|
+
| `next` (13+, app + pages router) | 🟡 beta | Implementation complete; production-build validation in progress. |
|
|
13
|
+
| `js` (vanilla Node) | ✅ stable | Validated end-to-end. |
|
|
14
|
+
|
|
15
|
+
Everything else is `experimental` (refuses without `--experimental`) or
|
|
16
|
+
`unsupported` (refuses always).
|
|
17
|
+
|
|
18
|
+
## Explicitly NOT supported in beta
|
|
19
|
+
|
|
20
|
+
| Target | Why |
|
|
21
|
+
|--------|-----|
|
|
22
|
+
| **Astro** | The wizard's framework detector falls through to `js`, which writes env vars but does not wire Astro middleware. Real Astro support is on the v0.2 roadmap. Until then: do the setup manually following the SDK README. |
|
|
23
|
+
| **Bare React Native** | Podfile + Gradle patching cannot be validated without iOS sim + Android emulator builds. The wizard refuses with `E_UNSUPPORTED_FRAMEWORK`. Use the Expo path (config plugin) if you can; otherwise follow the manual setup. |
|
|
24
|
+
| **Flutter source maps** | The Flutter SDK itself does not yet ship source-map upload tooling. Wizard's Flutter integration is `experimental` and only writes env vars. |
|
|
25
|
+
| **Backend SDK auto-wiring** (NestJS, Fastify, OTel, Spring Boot, Django, Flask, Rails, .NET, Go, PHP) | Each is `experimental`. Install + env-var writing is supported under `--experimental`; framework wiring is NOT — too many entry-point shapes to AST-patch safely without per-framework fixture validation. v0.2 roadmap. |
|
|
26
|
+
|
|
27
|
+
## Java self-hosted: blocked by SDK
|
|
28
|
+
|
|
29
|
+
`allstak-java-sdk` currently hardcodes its host to `https://api.allstak.sa`.
|
|
30
|
+
Until the SDK adds a configurable `host` field on `AllStakConfig`, the
|
|
31
|
+
wizard's `--host` / `--ingest-host` flags are a **no-op for Java users**.
|
|
32
|
+
The wizard will warn when `-i java` runs against a non-default host.
|
|
33
|
+
|
|
34
|
+
Tracking spec: `docs/architecture/v02-java-host-fix-spec.md`.
|
|
35
|
+
|
|
36
|
+
## Auth specifics
|
|
37
|
+
|
|
38
|
+
- Login uses email-OTP (no OAuth device-flow). Rate-limited; 4–8 digit
|
|
39
|
+
codes valid for ~10 minutes.
|
|
40
|
+
- Two-factor (TOTP) is supported but not unit-tested end-to-end (the test
|
|
41
|
+
matrix doesn't include accounts with 2FA enabled).
|
|
42
|
+
- JWT refresh has a 60-second early-refresh window; the access token TTL
|
|
43
|
+
is 15 minutes, the refresh token rotates on each `/refresh` call.
|
|
44
|
+
|
|
45
|
+
## Source-maps
|
|
46
|
+
|
|
47
|
+
- **Vite**: AST-injects the plugin import + managed-block hint.
|
|
48
|
+
- **Next.js**: managed-block hint only (next.config shapes vary too much
|
|
49
|
+
for safe AST mutation).
|
|
50
|
+
- **Webpack**: managed-block hint only.
|
|
51
|
+
- **Metro / Hermes (RN)**: provider registered but inert in v0.1 — `detect()`
|
|
52
|
+
returns `false` and `wire()` is a no-op. Real validation needs device
|
|
53
|
+
builds.
|
|
54
|
+
- End-to-end **upload roundtrip** (POST `/api/v1/sourcemaps/upload` →
|
|
55
|
+
symbolicate) is NOT verified by `doctor` in v0.1.x. The wizard wires the
|
|
56
|
+
plugin; the upload + dashboard symbolication are the SDK + dashboard's
|
|
57
|
+
responsibility.
|
|
58
|
+
|
|
59
|
+
## Other gaps
|
|
60
|
+
|
|
61
|
+
- **Windows Credential Manager** is not yet a credential store backend on
|
|
62
|
+
Windows — Windows users get the AES-256-GCM encrypted-file fallback.
|
|
63
|
+
- **CRA + standalone Webpack** are detected but the wizard does not AST-mutate
|
|
64
|
+
Webpack configs.
|
|
65
|
+
- **Multi-package monorepos** are detected (pnpm/turbo/nx/lerna/npm-workspaces)
|
|
66
|
+
but the wizard operates on the cwd's nearest manifest. There is no
|
|
67
|
+
"which package?" prompt yet.
|
|
68
|
+
- **`allstak login`** is the only path to a user JWT in beta. There is no
|
|
69
|
+
PAT (personal access token) flow, because the backend doesn't expose one.
|
|
70
|
+
|
|
71
|
+
## What's safe to use in production
|
|
72
|
+
|
|
73
|
+
- React + Vite onboarding flows.
|
|
74
|
+
- React + CRA onboarding flows (without source-map upload — manual wiring).
|
|
75
|
+
- Vanilla Node entry-point patching.
|
|
76
|
+
- Next.js with manual `next.config.js` follow-up.
|
|
77
|
+
- All commands in their `--dry-run` form (no disk writes anywhere).
|
|
78
|
+
- `restore` / snapshot inspection (read-only ops).
|
|
79
|
+
|
|
80
|
+
## What to avoid
|
|
81
|
+
|
|
82
|
+
- Running `--experimental` integrations in CI without manual review.
|
|
83
|
+
- Deploying based on `doctor --live-probe` for Java integrations until the
|
|
84
|
+
host-config fix lands.
|
|
85
|
+
- Treating Astro / bare-RN as "the wizard handles it."
|
|
86
|
+
|
|
87
|
+
## Reporting an issue
|
|
88
|
+
|
|
89
|
+
Re-run with `--debug` and grab the canonical `errorCode` + `subcode` from
|
|
90
|
+
the output. Snapshot directory contents (under `.allstak-wizard/backups/`)
|
|
91
|
+
are useful for support. Do **not** paste your full env file or
|
|
92
|
+
`allstak.config.*` to a public issue — redact `apiKey` / DSN / refresh
|
|
93
|
+
token values first.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Next.js
|
|
2
|
+
|
|
3
|
+
**Stability:** `beta`. Implementation complete and unit-tested. The wizard
|
|
4
|
+
emits a one-line warning on use because end-to-end integration testing
|
|
5
|
+
against Next 13/14/15 production builds is still in progress.
|
|
6
|
+
|
|
7
|
+
## What you get
|
|
8
|
+
|
|
9
|
+
- `@allstak/next@beta` + `@allstak/js` installed.
|
|
10
|
+
- `.env.local` populated with **both** `ALLSTAK_API_KEY` and `ALLSTAK_DSN`
|
|
11
|
+
(the beta SDK still accepts `ALLSTAK_DSN` during the env-var transition).
|
|
12
|
+
- `instrumentation.ts` created at the project root if missing, otherwise a
|
|
13
|
+
managed-block hint appended to the existing one. The wizard does NOT
|
|
14
|
+
modify the body of an existing `register()` function.
|
|
15
|
+
- `next.config.{js,mjs,ts}` gains a managed-block hint reminding you to
|
|
16
|
+
wrap with `withAllStak` and enable `productionBrowserSourceMaps: true`.
|
|
17
|
+
|
|
18
|
+
## Run
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @allstak/wizard@beta -i next
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Compatibility
|
|
25
|
+
|
|
26
|
+
- `next >= 13`. Both app router and pages router supported.
|
|
27
|
+
- Older Next versions refused with `E_UNSUPPORTED_VERSION`.
|
|
28
|
+
|
|
29
|
+
## Wiring `register()`
|
|
30
|
+
|
|
31
|
+
Wizard creates this if `instrumentation.ts` did not exist:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { initAllStakNext } from '@allstak/next';
|
|
35
|
+
|
|
36
|
+
export function register() {
|
|
37
|
+
initAllStakNext({
|
|
38
|
+
dsn: process.env.ALLSTAK_DSN,
|
|
39
|
+
endpoint: process.env.ALLSTAK_HOST ?? 'https://api.allstak.sa',
|
|
40
|
+
release: process.env.ALLSTAK_RELEASE,
|
|
41
|
+
environment: process.env.ALLSTAK_ENVIRONMENT ?? 'production',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you already have `register()`, copy the body of `initAllStakNext({ ... })`
|
|
47
|
+
into it.
|
|
48
|
+
|
|
49
|
+
## Source maps
|
|
50
|
+
|
|
51
|
+
Wrap `next.config.*` with `withAllStak`:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const { withAllStak } = require('@allstak/js/next');
|
|
55
|
+
module.exports = withAllStak({
|
|
56
|
+
...nextConfig,
|
|
57
|
+
productionBrowserSourceMaps: true,
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The wizard does NOT auto-mutate `next.config.*` for you — Next configs use
|
|
62
|
+
many factory shapes (`module.exports = (phase, { defaultConfig }) => …`) and
|
|
63
|
+
auto-mutation has too high a blast-radius. Follow the managed-block hint.
|
|
64
|
+
|
|
65
|
+
## Known beta-tier limitations
|
|
66
|
+
|
|
67
|
+
- Live `doctor --live-probe` works for Next-emitted events only when your
|
|
68
|
+
Next app runs in a place the wizard can reach. (No magic — the SDK posts
|
|
69
|
+
to `/ingest/v1/errors` and the wizard polls `/api/v1/errors`.)
|
|
70
|
+
- Source-map upload roundtrip not yet validated end-to-end (wizard's job is
|
|
71
|
+
to wire the plugin; the SDK + dashboard own upload + symbolication).
|
|
72
|
+
|
|
73
|
+
## Verify
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx @allstak/wizard@beta doctor -i next
|
|
77
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Vanilla Node.js (`@allstak/js`)
|
|
2
|
+
|
|
3
|
+
**Stability:** `stable`. Validated against fixture and dogfooded.
|
|
4
|
+
|
|
5
|
+
## What you get
|
|
6
|
+
|
|
7
|
+
- `@allstak/js` SDK installed.
|
|
8
|
+
- `.env` populated with the standard `ALLSTAK_*` vars.
|
|
9
|
+
- AST-injected `import { AllStak } from '@allstak/js'` in your entry file.
|
|
10
|
+
- Managed-block call to `AllStak.init({...})` appended to the entry.
|
|
11
|
+
|
|
12
|
+
## Run
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @allstak/wizard@beta -i js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Entry detection
|
|
19
|
+
|
|
20
|
+
The wizard looks at `package.json:scripts.start` for a `node X.js` pattern,
|
|
21
|
+
then falls back to:
|
|
22
|
+
|
|
23
|
+
- `src/index.ts` / `src/index.js`
|
|
24
|
+
- `index.ts` / `index.js`
|
|
25
|
+
- `app.ts` / `app.js`
|
|
26
|
+
- `server.ts` / `server.js`
|
|
27
|
+
|
|
28
|
+
If none match, the wizard skips entry patching and reports
|
|
29
|
+
`config-only run` — env vars are still written; you need to call
|
|
30
|
+
`AllStak.init(...)` manually.
|
|
31
|
+
|
|
32
|
+
## What the patched entry looks like
|
|
33
|
+
|
|
34
|
+
After `init`, the bottom of your entry file gains:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// >>> allstak-wizard:v1 (do not edit) >>>
|
|
38
|
+
AllStak.init({
|
|
39
|
+
apiKey: process.env.ALLSTAK_API_KEY,
|
|
40
|
+
host: process.env.ALLSTAK_HOST ?? 'https://api.allstak.sa',
|
|
41
|
+
environment: process.env.ALLSTAK_ENVIRONMENT ?? 'production',
|
|
42
|
+
release: process.env.ALLSTAK_RELEASE,
|
|
43
|
+
});
|
|
44
|
+
// <<< allstak-wizard:v1 <<<
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Re-running the wizard replaces this block in place. `uninstall` removes it.
|
|
48
|
+
|
|
49
|
+
## Compatibility
|
|
50
|
+
|
|
51
|
+
- Node 18+ required by the wizard itself.
|
|
52
|
+
- The `@allstak/js` SDK supports Node 16+.
|
|
53
|
+
- Works with TypeScript entries via `tsx`/`bun`/`deno run` toolchains.
|
|
54
|
+
|
|
55
|
+
## What this integration does NOT do
|
|
56
|
+
|
|
57
|
+
- No bundler-level source-map wiring — Node is interpreted, not bundled.
|
|
58
|
+
- No express/fastify/hono middleware registration — those are framework-
|
|
59
|
+
specific and live in their own integrations (`fastify` is `experimental`
|
|
60
|
+
for now; nest/express integrations are deferred).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Privacy & telemetry
|
|
2
|
+
|
|
3
|
+
The wizard ships a minimal anonymous-usage telemetry channel. This page
|
|
4
|
+
documents **exactly** what is sent and how to disable it.
|
|
5
|
+
|
|
6
|
+
## What we send
|
|
7
|
+
|
|
8
|
+
| Field | Example | Why |
|
|
9
|
+
|-------|---------|-----|
|
|
10
|
+
| `schemaVersion` | `1` | Stable version of this payload shape. |
|
|
11
|
+
| `installId` | `b9c4...` | Anonymous v4 UUID stored at `~/.config/allstak/install-id`. Coalesces events for the same install. Rotate by deleting the file. |
|
|
12
|
+
| `wizardVersion` | `0.1.3` | The wizard's own version. |
|
|
13
|
+
| `command` | `init`, `doctor`, `restore-apply`, … | Which wizard command ran. |
|
|
14
|
+
| `integration` | `react`, `next`, `js`, `null` | Selected integration (`null` for commands that don't have one — `login`, `restore-list`, etc.). |
|
|
15
|
+
| `stability` | `stable`, `beta`, `experimental`, `unsupported`, `null` | Stability level of the active integration. |
|
|
16
|
+
| `os.family` | `darwin`, `linux`, `win32` | Node's `process.platform`. |
|
|
17
|
+
| `os.majorRelease` | `23`, `5`, `10` | Major version of the OS kernel. |
|
|
18
|
+
| `os.arch` | `x64`, `arm64` | Process architecture. |
|
|
19
|
+
| `node.major` | `20`, `22` | Major Node version. |
|
|
20
|
+
| `packageManager` | `npm`, `pnpm`, `yarn`, `yarn-berry`, `bun`, `null` | Detected package manager. |
|
|
21
|
+
| `outcome` | `success`, `failure`, `cancelled`, `noop` | Final state. |
|
|
22
|
+
| `stage` | `auth`, `patch`, `restore`, … | Stage at termination. |
|
|
23
|
+
| `errorCode` | `E_PATCH_FAILED`, `null` | Canonical error code; never message text. |
|
|
24
|
+
| `rollbackTriggered` | `true`/`false` | Did an in-process rollback fire? |
|
|
25
|
+
| `durationMs` | `4231` | Wall-clock duration. |
|
|
26
|
+
|
|
27
|
+
That's the entire payload. There are no opaque "metadata" or "extras"
|
|
28
|
+
fields.
|
|
29
|
+
|
|
30
|
+
## What we NEVER send
|
|
31
|
+
|
|
32
|
+
The TypeScript type in `src/telemetry/payload.ts` is the contract. The
|
|
33
|
+
wizard CANNOT send any of the following — there is no field for them:
|
|
34
|
+
|
|
35
|
+
- API keys, DSNs, OAuth tokens, refresh tokens.
|
|
36
|
+
- Org names, project names, project ids, org ids.
|
|
37
|
+
- File paths (absolute or relative).
|
|
38
|
+
- `process.env` values.
|
|
39
|
+
- Source code from your repo.
|
|
40
|
+
- Error message text or stack frames.
|
|
41
|
+
- Email addresses, IP addresses, hostnames.
|
|
42
|
+
|
|
43
|
+
The error code `E_PATCH_FAILED` reaches us; the patcher's stack trace and
|
|
44
|
+
the file path it failed on do not.
|
|
45
|
+
|
|
46
|
+
## How to disable
|
|
47
|
+
|
|
48
|
+
Three independent ways, any one of them is sufficient:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Per-run flag:
|
|
52
|
+
npx @allstak/wizard@beta --no-telemetry ...
|
|
53
|
+
|
|
54
|
+
# Process env:
|
|
55
|
+
ALLSTAK_WIZARD_TELEMETRY=0 npx @allstak/wizard@beta ...
|
|
56
|
+
|
|
57
|
+
# Globally for your shell:
|
|
58
|
+
export ALLSTAK_WIZARD_TELEMETRY=0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Disabling does NOT disable the wizard's local audit trail (snapshots in
|
|
62
|
+
`.allstak-wizard/backups/`). Those are local-only and never sent anywhere.
|
|
63
|
+
|
|
64
|
+
## How to inspect what would be sent
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @allstak/wizard@beta --telemetry-debug -i react --dry-run
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`--telemetry-debug` prints the would-be payload to stderr instead of
|
|
71
|
+
sending it, regardless of the gate state.
|
|
72
|
+
|
|
73
|
+
## Where the data goes
|
|
74
|
+
|
|
75
|
+
- **Default provider** is `noop` — the wizard does NOT phone home in beta.
|
|
76
|
+
`noopTelemetry` is selected unless an operator (or you) explicitly wires
|
|
77
|
+
in `httpTelemetry({ endpoint })`. This is a deliberate beta-period
|
|
78
|
+
posture: build the abstraction, don't quietly start collecting.
|
|
79
|
+
- When configured: HTTPS POST of the JSON payload with a 1.5s timeout,
|
|
80
|
+
failures swallowed.
|
|
81
|
+
|
|
82
|
+
## Credentials
|
|
83
|
+
|
|
84
|
+
`allstak login` stores your JWT pair in your OS keychain (macOS / libsecret)
|
|
85
|
+
or an AES-256-GCM encrypted file fallback. Never sent to telemetry. See
|
|
86
|
+
`src/credentials/` for the implementation.
|
|
87
|
+
|
|
88
|
+
## Anonymous install id
|
|
89
|
+
|
|
90
|
+
Stored at `~/.config/allstak/install-id` (or the platform equivalent).
|
|
91
|
+
Generated lazily on first telemetry-emitting run. Delete the file to
|
|
92
|
+
rotate. Telemetry-disabled runs do NOT generate or read it.
|
|
93
|
+
|
|
94
|
+
## Audit
|
|
95
|
+
|
|
96
|
+
The complete payload type is at `src/telemetry/payload.ts`. The unit-test
|
|
97
|
+
suite asserts that the runtime payload contains EXACTLY the documented
|
|
98
|
+
fields (no more, no fewer) — adding a field requires updating both the
|
|
99
|
+
type and this doc, and the test fails until you do.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Quickstart — `@allstak/wizard@beta`
|
|
2
|
+
|
|
3
|
+
> Status: **public beta**. The wizard is honest about what works and what
|
|
4
|
+
> doesn't — see [known limitations](./known-limitations.md) for the gaps you
|
|
5
|
+
> need to know about before adopting.
|
|
6
|
+
|
|
7
|
+
## Install + run in one command
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# React (Vite or CRA)
|
|
11
|
+
npx @allstak/wizard@beta -i react
|
|
12
|
+
|
|
13
|
+
# Next.js (app or pages router; 13+)
|
|
14
|
+
npx @allstak/wizard@beta -i next
|
|
15
|
+
|
|
16
|
+
# Vanilla Node
|
|
17
|
+
npx @allstak/wizard@beta -i js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The wizard auto-detects your framework if you omit `-i`.
|
|
21
|
+
|
|
22
|
+
## Five-minute first run
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 1. Authenticate against AllStak (email OTP).
|
|
26
|
+
npx @allstak/wizard@beta login
|
|
27
|
+
|
|
28
|
+
# 2. List your orgs and projects.
|
|
29
|
+
npx @allstak/wizard@beta orgs list
|
|
30
|
+
npx @allstak/wizard@beta projects list
|
|
31
|
+
|
|
32
|
+
# 3. Create a project + mint an API key in one go.
|
|
33
|
+
npx @allstak/wizard@beta projects create \
|
|
34
|
+
--name "My App" --slug my-app \
|
|
35
|
+
--with-api-key
|
|
36
|
+
|
|
37
|
+
# 4. Run the wizard against your project.
|
|
38
|
+
cd /path/to/my/app
|
|
39
|
+
npx @allstak/wizard@beta # auto-detect
|
|
40
|
+
# or:
|
|
41
|
+
npx @allstak/wizard@beta -i next
|
|
42
|
+
|
|
43
|
+
# 5. Verify the setup with a real test event.
|
|
44
|
+
npx @allstak/wizard@beta doctor --live-probe \
|
|
45
|
+
--api-key ask_live_... \
|
|
46
|
+
--project-id <project-uuid>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## What the wizard does (in order)
|
|
50
|
+
|
|
51
|
+
1. Detects your framework + package manager.
|
|
52
|
+
2. Loads `allstak.config.*` if present.
|
|
53
|
+
3. Verifies framework version compatibility.
|
|
54
|
+
4. **Asks for confirmation** before any disk write (skip with `-y`).
|
|
55
|
+
5. Installs the right `@allstak/*` package via your package manager.
|
|
56
|
+
6. Writes env vars to `.env.local` / `.env` — never overwrites your values.
|
|
57
|
+
7. Patches your entry file (AST-injects the import; appends a managed-block
|
|
58
|
+
hint).
|
|
59
|
+
8. Wires the source-map plugin into `vite.config.*` / `next.config.*`.
|
|
60
|
+
9. Snapshots every touched file to `.allstak-wizard/backups/<id>/`.
|
|
61
|
+
10. Runs a doctor pass and reports the result.
|
|
62
|
+
|
|
63
|
+
## Always reversible
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Roll back the latest snapshot.
|
|
67
|
+
npx @allstak/wizard@beta restore apply latest
|
|
68
|
+
|
|
69
|
+
# Or fully uninstall.
|
|
70
|
+
npx @allstak/wizard@beta uninstall -i react
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Dry-run before committing
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx @allstak/wizard@beta -i react --dry-run --json | jq '.diff'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The dry-run never touches disk.
|
|
80
|
+
|
|
81
|
+
## Next reads
|
|
82
|
+
|
|
83
|
+
- [`react.md`](./react.md), [`next.md`](./next.md), [`node.md`](./node.md) — per-integration guides.
|
|
84
|
+
- [`config.md`](./config.md) — `allstak.config.ts` precedence + migrations.
|
|
85
|
+
- [`doctor.md`](./doctor.md) — diagnosing a setup.
|
|
86
|
+
- [`restore.md`](./restore.md) — restoring snapshots.
|
|
87
|
+
- [`privacy.md`](./privacy.md) — telemetry contract.
|
|
88
|
+
- [`troubleshooting.md`](./troubleshooting.md) — common errors and fixes.
|
|
89
|
+
- [`known-limitations.md`](./known-limitations.md) — what's NOT supported in beta.
|