@layers/amba 0.1.1

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/dist/auth.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ export interface Credentials {
2
+ access_token: string;
3
+ refresh_token: string;
4
+ expires_at: string;
5
+ }
6
+ /**
7
+ * Personal Access Token prefix — `amb_dpat_` followed by 32 random
8
+ * characters. The CLI accepts a PAT via the `--token <pat>` flag or the
9
+ * `AMBA_PAT` env var as a stored-credentials replacement, enabling
10
+ * headless / CI / agent use without the browser flow.
11
+ */
12
+ export declare const PAT_PREFIX = "amb_dpat_";
13
+ /**
14
+ * Start a temporary local HTTP server, open the browser for OAuth,
15
+ * and wait for the redirect callback carrying the token.
16
+ */
17
+ export declare function browserAuthFlow(): Promise<Credentials>;
18
+ /**
19
+ * Store credentials to ~/.amba/credentials.json
20
+ */
21
+ export declare function storeCredentials(creds: Credentials): Promise<void>;
22
+ /**
23
+ * Load stored credentials. Throws if not found.
24
+ */
25
+ export declare function loadCredentials(): Promise<Credentials>;
26
+ /**
27
+ * Check if the access token is expired (with 60s buffer).
28
+ */
29
+ export declare function isTokenExpired(creds: Credentials): boolean;
30
+ /**
31
+ * Remove stored credentials.
32
+ */
33
+ export declare function clearCredentials(): Promise<void>;
34
+ /**
35
+ * Set the process-scoped bearer override. Called by the global
36
+ * `preAction` hook with the resolved value (flag → env → null).
37
+ * `null` clears any prior override.
38
+ */
39
+ export declare function setBearerOverride(token: string | null): void;
40
+ /** Test-only: reset the override between cases. */
41
+ export declare function __resetTokenOverride(): void;
42
+ /**
43
+ * Resolve the bearer token to send on the next admin API call.
44
+ *
45
+ * Returns the override (PAT or JWT supplied via flag/env) when set,
46
+ * otherwise loads + expiry-checks the stored access token. Throws
47
+ * with an actionable error message in either failure path.
48
+ */
49
+ export declare function resolveBearerToken(): Promise<string>;
50
+ /**
51
+ * Compute the bearer-override value the CLI should install for this
52
+ * invocation. Pure function — exported for testability. Caller wires
53
+ * the result into `setBearerOverride` (typically inside commander's
54
+ * `preAction` hook in `index.ts`).
55
+ *
56
+ * resolveTokenSource({ flagToken: '...', envToken: '...' })
57
+ * → flag wins
58
+ *
59
+ * resolveTokenSource({ envToken: '...' })
60
+ * → env used
61
+ *
62
+ * resolveTokenSource({})
63
+ * → null (CLI falls back to stored creds at request time)
64
+ */
65
+ export interface ResolveTokenSourceInput {
66
+ flagToken?: string | undefined;
67
+ envToken?: string | undefined;
68
+ }
69
+ export declare function resolveTokenSource(input: ResolveTokenSourceInput): string | null;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Customer-function bundling for `amba functions deploy`.
3
+ *
4
+ * Uses esbuild (the Workers ecosystem bundler-of-record). The shared
5
+ * runtime stdlib is marked `external` so customer bundles don't
6
+ * re-include megabytes of `@anthropic-ai/sdk`, `postgres`, `zod`, etc.;
7
+ * these resolve at dispatch time via platform-level bindings.
8
+ *
9
+ * Two checks gate the bundle before upload:
10
+ * 1. Pre-upload size check against `BUNDLE_MAX_SIZE_BYTES` (8 MB
11
+ * default — the platform's 10 MB compressed cap minus 2 MB
12
+ * headroom) with a clear error pointing at the externalization
13
+ * config.
14
+ * 2. Bundle-shape report — the CLI prints what's externalized vs
15
+ * bundled at deploy time so size issues are debuggable.
16
+ */
17
+ import { type BuildOptions } from 'esbuild';
18
+ /**
19
+ * Modules customer code MUST externalize. The runtime exposes these as
20
+ * platform-level bindings; bundling them per-script wastes hundreds of
21
+ * KB to MBs and quickly hits the script-size cap.
22
+ */
23
+ export declare const RUNTIME_STDLIB_EXTERNALS: readonly string[];
24
+ /**
25
+ * Default maximum bundle size — 8 MB compressed. CF's hard cap is 10 MB
26
+ * compressed (paid plan); we reject at 8 MB to leave headroom for the
27
+ * compression-ratio variance and for the dispatch-namespace metadata.
28
+ */
29
+ export declare const BUNDLE_MAX_SIZE_BYTES: number;
30
+ export declare class BundleSizeError extends Error {
31
+ readonly sizeBytes: number;
32
+ readonly maxBytes: number;
33
+ constructor(sizeBytes: number, maxBytes: number);
34
+ }
35
+ export interface BundleResult {
36
+ /** The bundled JS source (UTF-8). */
37
+ code: string;
38
+ /** SHA-256 hex of the bundle (used for `function_deployments.bundle_sha`). */
39
+ sha256: string;
40
+ /** Compressed size in bytes (gzipped — what CF measures against the cap). */
41
+ compressedSize: number;
42
+ /** Uncompressed size in bytes — for human-friendly CLI output. */
43
+ uncompressedSize: number;
44
+ /** What esbuild externalized vs bundled in this build (CLI display). */
45
+ externals: string[];
46
+ }
47
+ export interface BundleOptions {
48
+ /** Path to the customer's entry file, e.g. `./functions/scan-letter.ts`. */
49
+ entryPoint: string;
50
+ /** Override the max bundle size. */
51
+ maxSizeBytes?: number;
52
+ /** Additional externals beyond `RUNTIME_STDLIB_EXTERNALS`. */
53
+ extraExternals?: string[];
54
+ /** Source map handling. Default: inline. */
55
+ sourcemap?: BuildOptions['sourcemap'];
56
+ }
57
+ /**
58
+ * Bundle a customer function file for upload to a Workers dispatch
59
+ * namespace. Returns the bundled code + metadata; throws
60
+ * `BundleSizeError` when the compressed size exceeds the cap so the CLI
61
+ * can surface a clear error.
62
+ */
63
+ export declare function bundleFunction(options: BundleOptions): Promise<BundleResult>;
64
+ /**
65
+ * Print the bundle's externalization report to stdout. Intended to be
66
+ * called from `amba functions deploy` after bundling so customers can
67
+ * see what got externalized vs included at a glance.
68
+ */
69
+ export declare function printBundleReport(bundle: BundleResult): void;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `amba ai providers ...` — register / list / remove AI provider API keys.
3
+ *
4
+ * Wire path: CLI → platform admin API. Plaintext is stored canonically
5
+ * server-side; the CLI never echoes plaintext back. The API returns a
6
+ * `api_key_preview` (first-6 + last-4) for confirmation.
7
+ */
8
+ export interface AiProvidersAddOptions {
9
+ /** API key plaintext. Mutually exclusive with `--from-stdin`. */
10
+ key?: string;
11
+ /**
12
+ * When set, read the key from stdin instead of `--key`. Same shape as
13
+ * `amba secrets set --from-stdin` for keep-out-of-shell-history flows.
14
+ */
15
+ fromStdin?: boolean;
16
+ }
17
+ export declare function aiProvidersAddCommand(provider: string, options: AiProvidersAddOptions): Promise<void>;
18
+ export declare function aiProvidersListCommand(): Promise<void>;
19
+ export declare function aiProvidersDeleteCommand(provider: string): Promise<void>;
20
+ /**
21
+ * Read a secret value from CLI options. Shared by `amba ai providers
22
+ * add` and `amba secrets set` — either `--key`/`<value>` arg OR
23
+ * `--from-stdin` for shell-history-safe input.
24
+ *
25
+ * Resolution order:
26
+ * 1. `--from-stdin` → consume stdin to EOF, return trimmed value.
27
+ * Errors if stdin is a TTY (would hang waiting for input the
28
+ * caller can't see they need to type).
29
+ * 2. `--key` (or its inline equivalent) → return as-is.
30
+ * 3. Neither → throw with the actionable error message.
31
+ */
32
+ export declare function resolveSecretValue(opts: {
33
+ key?: string;
34
+ fromStdin?: boolean;
35
+ }): Promise<string>;
@@ -0,0 +1,14 @@
1
+ export type AnalyticsType = 'users' | 'events';
2
+ export type AnalyticsFormat = 'csv' | 'ndjson';
3
+ export interface AnalyticsExportOptions {
4
+ type: AnalyticsType;
5
+ project?: string;
6
+ since?: string;
7
+ until?: string;
8
+ out?: string;
9
+ limit?: number;
10
+ format?: AnalyticsFormat;
11
+ /** Test seam: cap the number of pages walked when paginating events. */
12
+ maxPages?: number;
13
+ }
14
+ export declare function analyticsExportCommand(opts: AnalyticsExportOptions): Promise<void>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `amba collections ...` — thin shells over the admin collection routes.
3
+ *
4
+ * Wire shapes:
5
+ *
6
+ * POST /admin/projects/:p/collections — create (full schema)
7
+ * GET /admin/projects/:p/collections — list
8
+ * PATCH /admin/projects/:p/collections/:name — single-op alter
9
+ * DELETE /admin/projects/:p/collections/:name — drop (requires ?confirm)
10
+ *
11
+ * The CLI's job is to:
12
+ * 1. Validate names / types client-side so an obviously-bad invocation
13
+ * doesn't round-trip.
14
+ * 2. Translate the user-friendly CLI flag shape (`--field name:type`,
15
+ * `--add-field`, `--drop-field`) into the wire shape (single op per
16
+ * PATCH).
17
+ * 3. Block until the server reports success.
18
+ * 4. Surface server errors with a sensible CLI message.
19
+ *
20
+ * Multi-op alters are issued sequentially so the operator audit trail
21
+ * stays one-to-one with developer actions.
22
+ */
23
+ export interface CollectionsCreateOptions {
24
+ /** Field specs in `name:type[:nullable]` form. May repeat. */
25
+ field: string[];
26
+ /** Index specs — one or more comma-separated `<col> [asc|desc]` entries. */
27
+ index: string[];
28
+ }
29
+ export declare function collectionsCreateCommand(name: string, options: CollectionsCreateOptions): Promise<void>;
30
+ export interface CollectionsAlterOptions {
31
+ /** Add columns (`name:type[:nullable]`). */
32
+ addField: string[];
33
+ /** Drop columns (by name). DROP COLUMN is destructive — confirm with --confirm. */
34
+ dropField: string[];
35
+ /** Add indexes (same spec syntax as create). */
36
+ addIndex: string[];
37
+ /**
38
+ * Per data's API: drop_column requires `?confirm=<column-name>`. The
39
+ * CLI surfaces this as a flag listing the columns the developer is
40
+ * confirming; we cross-check against `dropField` below.
41
+ */
42
+ confirm?: string[];
43
+ }
44
+ export declare function collectionsAlterCommand(name: string, options: CollectionsAlterOptions): Promise<void>;
45
+ export declare function collectionsListCommand(): Promise<void>;
46
+ export declare function collectionsDropCommand(name: string, options?: {
47
+ confirm?: string;
48
+ }): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function configListCommand(): Promise<void>;
2
+ export declare function configSetCommand(key: string, rawValue: string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ export interface DbMigrateOptions {
2
+ project?: string;
3
+ }
4
+ export declare function dbMigrateCommand(opts?: DbMigrateOptions): Promise<void>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `amba functions logs <name>` — read recent log events.
3
+ *
4
+ * Two modes:
5
+ * - One-shot (default): fetch events in `[since, until)` and exit.
6
+ * - `--tail`: print the last hour's events, then poll every 3s for
7
+ * new events past the highest seen `EventTimestampMs`. Ctrl+C to stop.
8
+ *
9
+ * Output formatting:
10
+ * - `--json`: NDJSON to stdout (one event per line) so `| jq` works.
11
+ * - default: human-readable lines:
12
+ * 2026-05-08T12:34:56.789Z scan-letter-v3 [info] "scanning"
13
+ * 2026-05-08T12:34:57.012Z scan-letter-v3 [exception] TypeError: …
14
+ *
15
+ * Server-side scoping is enforced — the API filters by ScriptName
16
+ * prefix so a developer can never read another tenant's logs.
17
+ */
18
+ export interface FunctionsLogsOptions {
19
+ /** ISO 8601 inclusive start. Defaults to 1 hour ago (or last-seen on tail). */
20
+ since?: string;
21
+ /** ISO 8601 exclusive end. Defaults to now. Ignored on tail. */
22
+ until?: string;
23
+ /** Max events per fetch. Default 100, max 1000. */
24
+ limit?: number;
25
+ /** Tail mode — poll every 3s. */
26
+ tail?: boolean;
27
+ /** NDJSON output. */
28
+ json?: boolean;
29
+ }
30
+ export declare function functionsLogsCommand(functionName: string, options?: FunctionsLogsOptions): Promise<void>;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * `amba functions ...` commands.
3
+ *
4
+ * `deploy` bundles the entry file with esbuild (externalizing the runtime
5
+ * stdlib + size-checking before upload), then POSTs the bundle to the
6
+ * platform API. The server resolves bindings, uploads the script, and
7
+ * records the deployment in a single round-trip. The other subcommands
8
+ * are thin shells over the admin API helpers in `api-client.ts`.
9
+ */
10
+ import { type RateLimitConfig } from '../_internal/shared.js';
11
+ export interface DeployOptions {
12
+ /** Override the function name. Default: filename without extension. */
13
+ name?: string;
14
+ /** Print bundle report but skip the CF API + DB write. Useful for size triage. */
15
+ dryRun?: boolean;
16
+ /**
17
+ * Optional declarative rate-limit config. All three sub-fields must be
18
+ * provided together; any one missing is a deploy error. Validated via
19
+ * `validateRateLimitConfig` before the API roundtrip so typos fail
20
+ * fast on the developer's machine. Persisted on the deployment row;
21
+ * the edge router enforces it pre-dispatch.
22
+ */
23
+ rateLimitWindow?: string;
24
+ rateLimitMax?: number;
25
+ rateLimitKey?: string;
26
+ }
27
+ export declare function functionsDeployCommand(entryPoint: string, options?: DeployOptions): Promise<void>;
28
+ export declare function functionsListCommand(): Promise<void>;
29
+ export declare function functionsDeleteCommand(name: string, options?: {
30
+ confirm?: string;
31
+ }): Promise<void>;
32
+ export declare function functionsScheduleCommand(name: string, cron: string, options?: {
33
+ tz?: string;
34
+ }): Promise<void>;
35
+ /**
36
+ * `amba functions dev` — not configured in this release. Use
37
+ * `amba functions deploy <file>` to deploy via the platform API.
38
+ */
39
+ export declare function functionsDevCommand(_entryPoint: string): Promise<void>;
40
+ /**
41
+ * `amba functions consume <queue> <function>` — bind a function as the
42
+ * consumer for a queue. Customers send to a queue with `ctx.queue.send`;
43
+ * the genericQueueJobWorkflow looks up the binding and invokes the
44
+ * bound function with the payload.
45
+ *
46
+ * Single binding per (project, queue). Re-running with a different
47
+ * function-name overwrites — same upsert semantics as `amba secrets set`.
48
+ */
49
+ export declare function functionsConsumeCommand(queueName: string, functionName: string, options?: {
50
+ paused?: boolean;
51
+ }): Promise<void>;
52
+ /**
53
+ * `amba functions consumers list` / `amba functions consumers unbind`
54
+ * sub-tree. Mirrors the `amba secrets list` shape so the CLI surface
55
+ * stays consistent.
56
+ */
57
+ export declare function functionsConsumersListCommand(): Promise<void>;
58
+ export declare function functionsConsumersUnbindCommand(queueName: string): Promise<void>;
59
+ /**
60
+ * Resolve the optional rate-limit config from CLI flags. Returns the
61
+ * validated config if all three sub-flags are set, `null` if all three
62
+ * are absent, or throws if a partial set was supplied.
63
+ *
64
+ * The "all-or-nothing" rule is intentional — defaulting any sub-flag
65
+ * is too easy to mis-set. A customer who types `--rate-limit-max 20`
66
+ * expecting "use a default 60s window with ip key" would silently get
67
+ * NO rate limit instead, which is the wrong default for a security-
68
+ * adjacent flag. Forcing all three to be explicit means the failure
69
+ * mode is "fail loud at deploy" not "silently no rate limit."
70
+ */
71
+ declare function parseRateLimitFlags(options: DeployOptions): RateLimitConfig | null;
72
+ /**
73
+ * Test-only re-export of internal helpers. Not a public API — anything
74
+ * here is unstable across patches.
75
+ */
76
+ export declare const __testHelpers: {
77
+ parseRateLimitFlags: typeof parseRateLimitFlags;
78
+ };
79
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface InitOptions {
2
+ withExample?: boolean;
3
+ /**
4
+ * The first `amba init` per developer mints a **personal dev** project
5
+ * (free tier, separate billing class). Default environment for `init`
6
+ * is therefore `'development'`. Pass `--env=production` to opt into a
7
+ * production project at init time (rare — most production projects are
8
+ * minted via `amba projects create --env production` by automation).
9
+ */
10
+ env?: 'development' | 'production';
11
+ }
12
+ export declare function initCommand(options?: InitOptions): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function loginCommand(): Promise<void>;
@@ -0,0 +1,16 @@
1
+ export interface LogsTailOptions {
2
+ project?: string;
3
+ follow?: boolean;
4
+ json?: boolean;
5
+ since?: string;
6
+ eventName?: string;
7
+ userId?: string;
8
+ limit?: number;
9
+ /** Polling interval in ms when --follow is set. Tests inject a small value. */
10
+ pollIntervalMs?: number;
11
+ /** Test seam: stop polling after N iterations. Production callers omit. */
12
+ maxFollowIterations?: number;
13
+ /** Test seam: AbortSignal to terminate the follow loop cleanly. */
14
+ signal?: AbortSignal;
15
+ }
16
+ export declare function logsTailCommand(opts?: LogsTailOptions): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export declare function projectsListCommand(): Promise<void>;
2
+ export declare function projectsCreateCommand(input: {
3
+ name: string;
4
+ env?: string;
5
+ bundleId?: string;
6
+ platform?: string;
7
+ }): Promise<void>;
8
+ export declare function projectsShowCommand(projectId: string): Promise<void>;
9
+ export declare function projectsDeleteCommand(projectId: string, opts?: {
10
+ yes?: boolean;
11
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function pushTestCommand(): Promise<void>;
@@ -0,0 +1,7 @@
1
+ export type SchemaFormat = 'json' | 'typescript';
2
+ export type SchemaDomain = 'all' | 'achievements' | 'streaks' | 'xp' | 'leaderboards' | 'challenges' | 'content' | 'segments' | 'push';
3
+ export interface SchemaExportOptions {
4
+ domain: SchemaDomain;
5
+ format?: SchemaFormat;
6
+ }
7
+ export declare function schemaExportCommand(opts: SchemaExportOptions): Promise<void>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `amba secrets ...` — write per-function secrets through the platform
3
+ * API. The CLI sends `{name, value, function}` to the admin endpoint;
4
+ * the server stores the value, validates reserved binding names, and
5
+ * propagates it to the deployed Worker's binding. Sync is eventual —
6
+ * `amba secrets list` shows progress.
7
+ */
8
+ export interface SecretsSetOptions {
9
+ /** Function name the secret binds to. Required — there are no project-wide secrets. */
10
+ function: string;
11
+ /**
12
+ * Environment selector. Currently informational: both `dev` and `prod`
13
+ * write to the same secret namespace per project. Workarounds:
14
+ * - Per-env naming convention: `STRIPE_KEY_DEV` vs `STRIPE_KEY_PROD`.
15
+ * - Two separate amba projects, one per env.
16
+ */
17
+ env?: 'dev' | 'prod';
18
+ /**
19
+ * Read the secret value from stdin instead of the positional `value`
20
+ * arg. Keeps the secret out of shell history. Mutually exclusive with
21
+ * a non-empty `value`.
22
+ */
23
+ fromStdin?: boolean;
24
+ }
25
+ export declare function secretsSetCommand(name: string, value: string | undefined, options: SecretsSetOptions): Promise<void>;
26
+ export declare function secretsListCommand(): Promise<void>;
27
+ export declare function secretsUnsetCommand(name: string, options: {
28
+ function: string;
29
+ }): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export type SeedPreset = 'starter' | 'gamification' | 'content';
2
+ export interface SeedOptions {
3
+ project?: string;
4
+ preset?: SeedPreset;
5
+ }
6
+ export declare function seedCommand(opts?: SeedOptions): Promise<void>;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `amba sites ...` commands.
3
+ *
4
+ * Static-site hosting. The CLI orchestrates two halves on every deploy:
5
+ *
6
+ * 1. Register the site row in the control plane via the admin API so
7
+ * domains can attach with a stable `cert_status` for polling.
8
+ * 2. Upload the pre-built static directory through the platform API,
9
+ * which proxies to the underlying CDN.
10
+ *
11
+ * This command does NOT build static files — accept a pre-built
12
+ * directory (mirrors `wrangler pages deploy ./out` semantics). Dynamic
13
+ * logic belongs in `amba functions deploy`, not in a site directory.
14
+ */
15
+ export interface SitesDeployOptions {
16
+ /** Site name. Defaults to the leaf directory name. */
17
+ name?: string;
18
+ /** Skip CF upload; just print what would happen. */
19
+ dryRun?: boolean;
20
+ }
21
+ export declare function sitesDeployCommand(inputDir: string, options?: SitesDeployOptions): Promise<void>;
22
+ export declare function sitesListCommand(): Promise<void>;
23
+ /**
24
+ * `amba sites logs <name>` — not yet available via the public API. Use
25
+ * the developer console for deployment history, or `amba sites describe`
26
+ * for the current cert / domain state.
27
+ */
28
+ export declare function sitesLogsCommand(name: string): Promise<void>;
29
+ export declare function sitesRollbackCommand(name: string, options?: {
30
+ to?: string;
31
+ }): Promise<void>;
32
+ export interface SitesDomainAddOptions {
33
+ /** Required — which site this domain points at. */
34
+ site: string;
35
+ /** Reserved for backwards compatibility; ignored. */
36
+ zoneId?: string;
37
+ /** Skip the cert poll loop. Caller will check status later. */
38
+ noWait?: boolean;
39
+ /** Max seconds to wait for cert_status='active' before bailing. Default 600. */
40
+ timeout?: number;
41
+ }
42
+ export declare function sitesDomainAddCommand(hostname: string, options: SitesDomainAddOptions): Promise<void>;
43
+ export declare function sitesDomainListCommand(siteName: string): Promise<void>;
44
+ export declare function sitesDomainRemoveCommand(hostname: string, options: {
45
+ site: string;
46
+ zoneId?: string;
47
+ }): Promise<void>;
48
+ export declare function sitesDisableCommand(name: string): Promise<void>;
49
+ export declare function sitesEnableCommand(name: string): Promise<void>;
50
+ export declare function sitesArchiveCommand(name: string, options?: {
51
+ confirm?: string;
52
+ }): Promise<void>;
53
+ interface SiteFile {
54
+ /** Path relative to the input dir, with forward slashes. */
55
+ relPath: string;
56
+ absPath: string;
57
+ size: number;
58
+ }
59
+ /**
60
+ * Recursively walk `dir` and return every file, skipping common build
61
+ * detritus (`.DS_Store`, `.git`). Dynamic-handler inputs (`_worker.*`,
62
+ * `functions/`, `_routes.json`, `_middleware.*`) are rejected.
63
+ */
64
+ declare function collectFiles(dir: string): Promise<SiteFile[]>;
65
+ /**
66
+ * Distinct error class so tests can assert on the specific Decision
67
+ * Log #10 rejection rather than string-matching the message. CLI's
68
+ * `runAction` wrapper renders Errors uniformly so users still see the
69
+ * full message.
70
+ */
71
+ export declare class SitesStaticOnlyError extends Error {
72
+ readonly code: "SITES_STATIC_ONLY";
73
+ }
74
+ /**
75
+ * Test-only re-export of internal helpers. Tests reach in via this
76
+ * namespace so the production module surface stays clean. Not a public
77
+ * API — anything here is unstable across patches.
78
+ */
79
+ export declare const __testHelpers: {
80
+ collectFiles: typeof collectFiles;
81
+ BLOCKED_FILE_NAMES: Set<string>;
82
+ BLOCKED_DIR_NAMES: Set<string>;
83
+ };
84
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface StatusOptions {
2
+ detailed?: boolean;
3
+ }
4
+ export declare function statusCommand(opts?: StatusOptions): Promise<void>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `amba types generate [--watch]` — emits `.amba/types.d.ts`.
3
+ *
4
+ * One-shot is the default (CI-friendly). `--watch` is opt-in; the
5
+ * engine emits deterministic output (no embedded timestamps unless we
6
+ * pass `bannerTimestamp`), so the CLI compares strings to decide
7
+ * whether to touch the file.
8
+ */
9
+ export interface TypesGenerateOptions {
10
+ /** Output path. Default: `.amba/types.d.ts` under the current working directory. */
11
+ out?: string;
12
+ watch?: boolean;
13
+ }
14
+ export declare function typesGenerateCommand(options?: TypesGenerateOptions): Promise<void>;
@@ -0,0 +1,12 @@
1
+ interface ContextFileOptions {
2
+ projectId: string;
3
+ projectName: string;
4
+ apiKey: string;
5
+ framework: 'expo' | 'react-native' | 'web' | 'unknown';
6
+ cwd: string;
7
+ }
8
+ /**
9
+ * Write both context files to the project directory.
10
+ */
11
+ export declare function generateContextFiles(opts: ContextFileOptions): Promise<string[]>;
12
+ export {};
package/dist/env.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Read `AMBA_PROJECT_ID` from `.env.local` / `.env` in the given directory.
3
+ * Returns null if not found.
4
+ */
5
+ export declare function getProjectIdFromEnv(cwd: string): Promise<string | null>;
6
+ /**
7
+ * Resolve a project id in priority order:
8
+ * 1. Explicit arg (e.g. `--project <id>`)
9
+ * 2. `.env.local` / `.env` in cwd
10
+ *
11
+ * Prints a helpful error message and exits 1 if no id is found.
12
+ */
13
+ export declare function requireProjectId(cwd: string, explicit?: string | null): Promise<string>;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};