@odla-ai/cli 0.4.0 → 0.6.0
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/README.md +126 -31
- package/REQUIREMENTS.md +18 -3
- package/dist/bin.cjs +1340 -436
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/chunk-OERLHVLH.js +2107 -0
- package/dist/chunk-OERLHVLH.js.map +1 -0
- package/dist/index.cjs +1353 -435
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +314 -21
- package/dist/index.d.ts +314 -21
- package/dist/index.js +15 -1
- package/llms.txt +442 -54
- package/package.json +15 -6
- package/skills/odla/SKILL.md +43 -12
- package/skills/odla/references/build.md +65 -17
- package/skills/odla/references/sdks.md +36 -3
- package/skills/odla-migrate/SKILL.md +38 -13
- package/skills/odla-migrate/references/phase-0-preflight.md +0 -2
- package/skills/odla-migrate/references/phase-1-static.md +2 -4
- package/skills/odla-migrate/references/phase-2-db.md +25 -17
- package/skills/odla-migrate/references/phase-3-auth.md +106 -20
- package/skills/odla-migrate/references/phase-3b-user-sync.md +57 -0
- package/skills/odla-migrate/references/phase-4-ai.md +6 -5
- package/skills/odla-migrate/references/phase-5-cutover.md +47 -16
- package/skills/odla-migrate/references/secrets-map.md +26 -11
- package/skills/odla-migrate/references/troubleshooting.md +27 -13
- package/skills/odla-o11y-debug/SKILL.md +93 -0
- package/dist/chunk-UWT7C6VT.js +0 -1187
- package/dist/chunk-UWT7C6VT.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,117 @@
|
|
|
1
|
+
import { SecurityReport, PlatformSecurityRun } from '@odla-ai/security';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse CLI arguments and dispatch to the matching command — the entry point
|
|
5
|
+
* `bin.ts` invokes. `argv` defaults to `process.argv.slice(2)`; the first
|
|
6
|
+
* positional selects the command and the rest are parsed into flags (supporting
|
|
7
|
+
* `--flag value`, `--flag=value`, boolean `--flag`, `--no-flag`, and repeated
|
|
8
|
+
* flags collected into arrays).
|
|
9
|
+
*
|
|
10
|
+
* Recognized commands: `version`/`-v`/`--version` and `help`/`-h`/`--help` print
|
|
11
|
+
* and return; `init` scaffolds a project (requires `--app-id` and `--name`);
|
|
12
|
+
* `doctor` validates config offline; `capabilities` prints the responsibility
|
|
13
|
+
* boundary; `admin ai` reads/updates purpose-specific platform AI policies and
|
|
14
|
+
* write-only credentials through a short-lived exact-scope device grant;
|
|
15
|
+
* `security run` performs an explicitly acknowledged, app-attributed hosted
|
|
16
|
+
* reasoning pass; `provision` runs the full provision (including optional secret
|
|
17
|
+
* rotation, local vars, and deployed secret push); `smoke` checks a live env;
|
|
18
|
+
* `setup` and `skill install` install the bundled offline runbooks for Claude
|
|
19
|
+
* Code, Codex, Cursor, Copilot, Gemini, and `AGENTS.md`-aware agents; and
|
|
20
|
+
* `secrets push` pipes the env's configured db/o11y secrets into the Worker via
|
|
21
|
+
* Wrangler (requires `--env`). Throws on an unknown command/subcommand, unsupported option, extra
|
|
22
|
+
* positional argument, missing required value, or a dispatched command error.
|
|
23
|
+
*
|
|
24
|
+
* @param argv Argument vector without the node/script prefix (default
|
|
25
|
+
* `process.argv.slice(2)`).
|
|
26
|
+
*/
|
|
1
27
|
declare function runCli(argv?: string[]): Promise<void>;
|
|
2
28
|
|
|
29
|
+
/** Hosted platform purposes whose provider, model, and budgets an admin may route. */
|
|
30
|
+
declare const SYSTEM_AI_PURPOSES: readonly ["o11y.triage", "security.discovery", "security.validation"];
|
|
31
|
+
/** One catalog-validated, platform-funded System AI purpose. */
|
|
32
|
+
type SystemAiPurpose = (typeof SYSTEM_AI_PURPOSES)[number];
|
|
33
|
+
/** Inputs for one System AI read, policy update, credential-status read, or
|
|
34
|
+
* write-only credential transfer. Provider values may come only from a named
|
|
35
|
+
* environment variable or stdin. */
|
|
36
|
+
interface AdminAiOptions {
|
|
37
|
+
action: "show" | "set" | "credentials" | "credential-set";
|
|
38
|
+
purpose?: string;
|
|
39
|
+
provider?: string;
|
|
40
|
+
model?: string;
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
maxInputBytes?: number;
|
|
43
|
+
maxOutputTokens?: number;
|
|
44
|
+
maxCallsPerRun?: number;
|
|
45
|
+
platform?: string;
|
|
46
|
+
token?: string;
|
|
47
|
+
json?: boolean;
|
|
48
|
+
open?: boolean;
|
|
49
|
+
fetch?: typeof fetch;
|
|
50
|
+
stdout?: Pick<typeof console, "log">;
|
|
51
|
+
openApprovalUrl?: (url: string) => Promise<void>;
|
|
52
|
+
credentialProvider?: string;
|
|
53
|
+
fromEnv?: string;
|
|
54
|
+
stdin?: boolean;
|
|
55
|
+
readStdin?: () => Promise<string>;
|
|
56
|
+
/** Separate short-lived admin-token cache; never reuses the app developer-token file. */
|
|
57
|
+
tokenFile?: string;
|
|
58
|
+
}
|
|
59
|
+
/** Inputs for obtaining one short-lived, exact-scope platform device grant. */
|
|
60
|
+
interface ScopedPlatformTokenOptions {
|
|
61
|
+
platform: string;
|
|
62
|
+
scope: "platform:ai:read" | "platform:ai:write" | "platform:security:self";
|
|
63
|
+
open?: boolean;
|
|
64
|
+
fetch?: typeof fetch;
|
|
65
|
+
stdout?: Pick<typeof console, "log">;
|
|
66
|
+
openApprovalUrl?: (url: string) => Promise<void>;
|
|
67
|
+
tokenFile?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Obtain/cache one exact platform scope without granting ambient admin. */
|
|
70
|
+
declare function getScopedPlatformToken(options: ScopedPlatformTokenOptions): Promise<string>;
|
|
71
|
+
/** Read or update platform-funded AI routing. Authentication is a short-lived,
|
|
72
|
+
* explicitly scoped device grant; ordinary app developer tokens never become
|
|
73
|
+
* platform admins. Credential writes accept values only from a named env var
|
|
74
|
+
* or stdin, transfer them once, and never place them in argv, output, or the
|
|
75
|
+
* scoped-token cache. */
|
|
76
|
+
declare function adminAi(options: AdminAiOptions): Promise<void>;
|
|
77
|
+
|
|
78
|
+
/** Stable, machine-readable division of work between the CLI, coding agent,
|
|
79
|
+
* human operator, and Studio. Printed by `odla-ai capabilities --json`. */
|
|
80
|
+
declare const CAPABILITIES: {
|
|
81
|
+
readonly cli: readonly ["register the app and enable configured services per environment", "issue, persist, and explicitly rotate configured service credentials", "write local Worker values and push deployed Worker secrets through Wrangler stdin", "push db schema/rules and configure platform AI, auth, and deployment links", "validate config offline and smoke-test a provisioned db environment", "run app-attributed hosted security discovery and independent validation without provider keys", "let admins manage system AI routes/credentials through short-lived exact-scope approval"];
|
|
82
|
+
readonly agent: readonly ["install and import the selected odla SDKs", "wrap the Worker with withObservability and choose useful telemetry", "make application-specific schema, rules, auth, UI, and migration decisions"];
|
|
83
|
+
readonly human: readonly ["approve the odla device code and one-off third-party logins", "consent to production changes with --yes", "request destructive credential rotation explicitly", "review application semantics, security findings, releases, and merges", "approve redacted-source disclosure before hosted security reasoning"];
|
|
84
|
+
readonly studio: readonly ["view telemetry and environment state", "perform manual credential recovery when the CLI's local shown-once copy is unavailable", "configure system AI purposes and view app/environment/run-attributed usage"];
|
|
85
|
+
};
|
|
86
|
+
type Output = Pick<typeof console, "log">;
|
|
87
|
+
/** Print the stable responsibility boundary for humans or agent tooling. */
|
|
88
|
+
declare function printCapabilities(json?: boolean, out?: Output): void;
|
|
89
|
+
|
|
3
90
|
interface DoctorOptions {
|
|
4
91
|
configPath: string;
|
|
5
92
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
6
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Validate and summarize an odla project config entirely offline — no network
|
|
96
|
+
* calls and no file writes. Loads `configPath`, builds the provision plan, and
|
|
97
|
+
* resolves the schema and rules (synthesizing deny-all rules from the schema
|
|
98
|
+
* when `db.rules` is omitted and `db.defaultRules` isn't `false`), then prints a
|
|
99
|
+
* summary line for the app, envs, services, schema entity count, rules namespace
|
|
100
|
+
* count, and AI provider.
|
|
101
|
+
*
|
|
102
|
+
* It then collects warnings for the mistakes provision can't fix silently: a
|
|
103
|
+
* schema with no entities, a rules namespace with no matching entity, the `ai`
|
|
104
|
+
* service enabled without an `ai.provider`, `auth.clerk` entries that reference
|
|
105
|
+
* an unset env var (`$FOO`), an `ai.keyEnv` that isn't set (provider key upload
|
|
106
|
+
* will be skipped), and — when `o11y` is enabled — any env whose local
|
|
107
|
+
* credentials lack an ingest token. It also folds in the shared rule linter,
|
|
108
|
+
* git-tracked secret-shaped files, and wrangler config warnings. Prints `ok`
|
|
109
|
+
* when clean, otherwise the warning list. Purely advisory: never throws on
|
|
110
|
+
* warnings and never mutates anything.
|
|
111
|
+
*
|
|
112
|
+
* @param options.configPath Path to the `odla.config.mjs` to inspect.
|
|
113
|
+
* @param options.stdout Optional console-like sink (defaults to `console`).
|
|
114
|
+
*/
|
|
7
115
|
declare function doctor(options: DoctorOptions): Promise<void>;
|
|
8
116
|
|
|
9
117
|
interface InitOptions {
|
|
@@ -17,8 +125,44 @@ interface InitOptions {
|
|
|
17
125
|
force?: boolean;
|
|
18
126
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
19
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Scaffold a new odla project into `rootDir` (default: cwd). Writes an
|
|
130
|
+
* `odla.config.mjs` (default name, overridable via `configPath`) plus starter
|
|
131
|
+
* `src/odla/schema.mjs` (a single `notes` entity) and `src/odla/rules.mjs`
|
|
132
|
+
* (deny-all), and creates the `src/odla` and `.odla` directories. Also runs
|
|
133
|
+
* `ensureGitignore` so the local token/credentials paths are ignored.
|
|
134
|
+
*
|
|
135
|
+
* Fully local and synchronous — no network calls. The config file is only
|
|
136
|
+
* written when it doesn't already exist unless `force` is set (otherwise it
|
|
137
|
+
* throws); the schema/rules files are written only when missing (never
|
|
138
|
+
* overwritten, even with `force`). `appId` must match `^[a-z0-9][a-z0-9-]*$` or
|
|
139
|
+
* it throws. Defaults: `envs` → `["dev"]`, `services` → `["db","ai"]`,
|
|
140
|
+
* `aiProvider` → `"anthropic"` (which also picks the `keyEnv`, e.g.
|
|
141
|
+
* `ANTHROPIC_API_KEY`/`OPENAI_API_KEY`/`GOOGLE_API_KEY`).
|
|
142
|
+
*
|
|
143
|
+
* @param options.appId Slug for the app (lowercase alphanumerics and hyphens).
|
|
144
|
+
* @param options.name Human-readable app name embedded in the config.
|
|
145
|
+
* @param options.rootDir Project root (defaults to `process.cwd()`).
|
|
146
|
+
* @param options.configPath Config filename relative to root (default `odla.config.mjs`).
|
|
147
|
+
* @param options.envs Environment names (default `["dev"]`; production is an explicit opt-in).
|
|
148
|
+
* @param options.services Enabled services (default `["db","ai"]`).
|
|
149
|
+
* @param options.aiProvider AI provider slug (default `"anthropic"`).
|
|
150
|
+
* @param options.force Overwrite an existing config file instead of throwing.
|
|
151
|
+
* @param options.stdout Optional console-like sink (defaults to `console`).
|
|
152
|
+
*/
|
|
20
153
|
declare function initProject(options: InitOptions): void;
|
|
21
154
|
|
|
155
|
+
interface RunResult {
|
|
156
|
+
code: number;
|
|
157
|
+
stdout: string;
|
|
158
|
+
stderr: string;
|
|
159
|
+
}
|
|
160
|
+
/** Subprocess seam: injectable in tests, `defaultRunner` in production. */
|
|
161
|
+
type CommandRunner = (cmd: string, args: string[], opts?: {
|
|
162
|
+
input?: string;
|
|
163
|
+
cwd?: string;
|
|
164
|
+
}) => Promise<RunResult>;
|
|
165
|
+
|
|
22
166
|
type OdlaEnvName = string;
|
|
23
167
|
type AppRules = Record<string, {
|
|
24
168
|
view?: string;
|
|
@@ -31,6 +175,7 @@ interface ClerkAuthConfig {
|
|
|
31
175
|
audience?: string;
|
|
32
176
|
mode?: "client" | "full";
|
|
33
177
|
}
|
|
178
|
+
/** Authored `odla.config.mjs` contract consumed by doctor and provision. */
|
|
34
179
|
interface OdlaProjectConfig {
|
|
35
180
|
platformUrl?: string;
|
|
36
181
|
dbEndpoint?: string;
|
|
@@ -77,6 +222,7 @@ interface OdlaProjectConfig {
|
|
|
77
222
|
gitignore?: boolean;
|
|
78
223
|
};
|
|
79
224
|
}
|
|
225
|
+
/** Normalized project config with resolved paths, endpoints, envs, and services. */
|
|
80
226
|
interface LoadedProjectConfig extends OdlaProjectConfig {
|
|
81
227
|
configPath: string;
|
|
82
228
|
rootDir: string;
|
|
@@ -91,6 +237,7 @@ interface LoadedProjectConfig extends OdlaProjectConfig {
|
|
|
91
237
|
gitignore: boolean;
|
|
92
238
|
};
|
|
93
239
|
}
|
|
240
|
+
/** Private mode-0600 local state written by provision and never committed. */
|
|
94
241
|
interface LocalCredentials {
|
|
95
242
|
appId: string;
|
|
96
243
|
platformUrl: string;
|
|
@@ -102,10 +249,15 @@ interface LocalCredentials {
|
|
|
102
249
|
o11yToken?: string;
|
|
103
250
|
}>;
|
|
104
251
|
}
|
|
252
|
+
/** Controls one dev-first provisioning run; production mutation requires `yes`. */
|
|
105
253
|
interface ProvisionOptions {
|
|
106
254
|
configPath: string;
|
|
107
255
|
dryRun?: boolean;
|
|
108
256
|
rotateKeys?: boolean;
|
|
257
|
+
/** Rotate only the o11y ingest token; leaves db keys unchanged. */
|
|
258
|
+
rotateO11yToken?: boolean;
|
|
259
|
+
/** Push configured Worker secrets to every configured env after provisioning. */
|
|
260
|
+
pushSecrets?: boolean;
|
|
109
261
|
writeCredentials?: boolean;
|
|
110
262
|
writeDevVars?: string | boolean;
|
|
111
263
|
token?: string;
|
|
@@ -115,10 +267,14 @@ interface ProvisionOptions {
|
|
|
115
267
|
interactive?: boolean;
|
|
116
268
|
/** Test/embedding override for opening the approval URL. Defaults to the OS browser opener. */
|
|
117
269
|
openApprovalUrl?: (url: string) => Promise<void>;
|
|
270
|
+
/** Explicit consent for a non-dry-run plan containing `prod` or `production`. */
|
|
118
271
|
yes?: boolean;
|
|
119
272
|
fetch?: typeof fetch;
|
|
273
|
+
/** Test/embedding override for Wrangler subprocesses used by `pushSecrets`. */
|
|
274
|
+
secretRunner?: CommandRunner;
|
|
120
275
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
121
276
|
}
|
|
277
|
+
/** Human-reviewable, secret-free plan printed by `provision({ dryRun: true })`. */
|
|
122
278
|
interface ProvisionPlan {
|
|
123
279
|
appId: string;
|
|
124
280
|
appName: string;
|
|
@@ -130,6 +286,7 @@ interface ProvisionPlan {
|
|
|
130
286
|
hasRules: boolean;
|
|
131
287
|
aiProvider?: string;
|
|
132
288
|
}
|
|
289
|
+
/** Inputs for a read-only live environment smoke check. */
|
|
133
290
|
interface SmokeOptions {
|
|
134
291
|
configPath: string;
|
|
135
292
|
env?: string;
|
|
@@ -137,21 +294,50 @@ interface SmokeOptions {
|
|
|
137
294
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
138
295
|
}
|
|
139
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Provision an app end-to-end from its config — the primary deploy path, and
|
|
299
|
+
* (apart from key rotation) idempotent, so re-running is safe. Obtains a
|
|
300
|
+
* developer token, creates the registry app when absent, enables each service
|
|
301
|
+
* per env (AI also gets `setAi` with the configured provider/model), configures
|
|
302
|
+
* Clerk auth and links, then per env mints or reuses credentials only for the
|
|
303
|
+
* configured services, pushes the schema with the db key and the
|
|
304
|
+
* rules with the developer token, and stores the provider key in the tenant
|
|
305
|
+
* vault when `ai.keyEnv` is set and present. Finally writes the credentials file
|
|
306
|
+
* (mode 0600, gitignored) and, when requested, `.dev.vars`.
|
|
307
|
+
*
|
|
308
|
+
* The developer token comes from (in order) `options.token`, `$ODLA_DEV_TOKEN`,
|
|
309
|
+
* the cached `.odla` token, or a fresh device handshake — which prints a user
|
|
310
|
+
* code + approval URL and, in interactive terminals, auto-opens the browser
|
|
311
|
+
* (`open: true`/`false` forces/suppresses it). Network error bodies pass through
|
|
312
|
+
* `redactSecrets` before display.
|
|
313
|
+
*
|
|
314
|
+
* @param options.dryRun Print the resolved plan and return before any network call/write.
|
|
315
|
+
* @param options.rotateKeys Rotate db keys and o11y tokens.
|
|
316
|
+
* @param options.rotateO11yToken Rotate only the o11y token.
|
|
317
|
+
* @param options.pushSecrets Preflight Wrangler, then push each env's configured
|
|
318
|
+
* Worker secrets immediately after credential provisioning.
|
|
319
|
+
* @param options.writeDevVars `true`/a path writes `.dev.vars`; `writeCredentials: false` skips the creds file.
|
|
320
|
+
* @param options.yes Required for a non-dry-run plan containing `prod` or
|
|
321
|
+
* `production`; callers must show and review `dryRun` output first.
|
|
322
|
+
* @throws When a production plan is executed without `yes`, configuration is
|
|
323
|
+
* invalid, authorization fails, or a provisioning operation fails.
|
|
324
|
+
*/
|
|
140
325
|
declare function provision(options: ProvisionOptions): Promise<void>;
|
|
141
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Return `value` with every secret-shaped substring replaced by a `[redacted]`
|
|
329
|
+
* placeholder that keeps the identifying prefix (e.g. `sk_live_[redacted]`).
|
|
330
|
+
* Matches odla db keys (`odla_sk_`/`odla_dev_`), Clerk secret keys
|
|
331
|
+
* (`sk_live_`/`sk_test_`), OpenAI keys (`sk-`), webhook signing secrets
|
|
332
|
+
* (`whsec_`), o11y tokens (`o11y_`), GitHub tokens (`ghp_`/`gho_`/`github_pat_`),
|
|
333
|
+
* and AWS access-key ids (`AKIA…`). Clerk publishable keys (`pk_test_`/
|
|
334
|
+
* `pk_live_`) are public by design and intentionally left untouched. Used to
|
|
335
|
+
* sanitize anything the CLI echoes (notably network error bodies) before it
|
|
336
|
+
* reaches stdout/stderr. Non-matching input is returned unchanged.
|
|
337
|
+
*/
|
|
142
338
|
declare function redactSecrets(value: string): string;
|
|
143
339
|
|
|
144
|
-
|
|
145
|
-
code: number;
|
|
146
|
-
stdout: string;
|
|
147
|
-
stderr: string;
|
|
148
|
-
}
|
|
149
|
-
/** Subprocess seam: injectable in tests, `defaultRunner` in production. */
|
|
150
|
-
type CommandRunner = (cmd: string, args: string[], opts?: {
|
|
151
|
-
input?: string;
|
|
152
|
-
cwd?: string;
|
|
153
|
-
}) => Promise<RunResult>;
|
|
154
|
-
|
|
340
|
+
/** Moves locally stored configured service credentials to one Wrangler environment over stdin. */
|
|
155
341
|
interface SecretsPushOptions {
|
|
156
342
|
configPath: string;
|
|
157
343
|
env: string;
|
|
@@ -162,37 +348,144 @@ interface SecretsPushOptions {
|
|
|
162
348
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
163
349
|
}
|
|
164
350
|
/**
|
|
165
|
-
* Moves the env's
|
|
166
|
-
*
|
|
167
|
-
*
|
|
351
|
+
* Moves the env's configured db and/or o11y credentials from the private local
|
|
352
|
+
* credentials file into the Worker, piping values over stdin so they never
|
|
353
|
+
* appear on argv, in output, or in the conversation transcript.
|
|
168
354
|
*/
|
|
169
355
|
declare function secretsPush(options: SecretsPushOptions): Promise<void>;
|
|
170
356
|
|
|
357
|
+
/** Built-in security coverage profile selected for a hosted reasoning run. */
|
|
358
|
+
type HostedSecurityProfile = "odla" | "cloudflare-app" | "generic";
|
|
359
|
+
/** Exact attribution and authorization need supplied to a lazy token callback. */
|
|
360
|
+
interface HostedSecurityTokenRequest {
|
|
361
|
+
platform: string;
|
|
362
|
+
appId: string;
|
|
363
|
+
env: string;
|
|
364
|
+
selfAudit: boolean;
|
|
365
|
+
/** Self-audit asks the caller for an explicitly scoped platform credential. */
|
|
366
|
+
/** Ordinary app runs use owner authority and therefore request no platform scope. */
|
|
367
|
+
scope: "platform:security:self" | null;
|
|
368
|
+
}
|
|
369
|
+
/** Local snapshot/orchestration controls for an app-attributed hosted security
|
|
370
|
+
* run. The platform supplies model routes and provider credentials. */
|
|
371
|
+
interface RunHostedSecurityOptions {
|
|
372
|
+
/** Project config; loaded for customer-app runs and ignored for self-audit. */
|
|
373
|
+
configPath?: string;
|
|
374
|
+
/** Scan odla itself under the protected odla-ai/prod identity. */
|
|
375
|
+
selfAudit?: boolean;
|
|
376
|
+
/** Repository directory to snapshot. Defaults to the config root or cwd for self-audit. */
|
|
377
|
+
target?: string;
|
|
378
|
+
/** Private artifact directory. Defaults to `<target>/.odla/security/hosted`. */
|
|
379
|
+
out?: string;
|
|
380
|
+
/** Customer environment. Must be declared in config. Self-audit always uses prod. */
|
|
381
|
+
env?: string;
|
|
382
|
+
profile?: HostedSecurityProfile;
|
|
383
|
+
maxHuntTasks?: number;
|
|
384
|
+
/** Exact acknowledgement required before any source capture or network call. */
|
|
385
|
+
sourceDisclosureAck?: "redacted";
|
|
386
|
+
/** Optional client correlation id; the platform returns the authoritative run id. */
|
|
387
|
+
runId?: string;
|
|
388
|
+
/** Platform override. Customer runs otherwise use config.platformUrl. */
|
|
389
|
+
platform?: string;
|
|
390
|
+
/** Injected app credential; for self-audit this must be explicitly scoped by the caller. */
|
|
391
|
+
token?: string;
|
|
392
|
+
/** Lazy token acquisition. Receives the exact app/env and required scope. */
|
|
393
|
+
getToken?: (request: HostedSecurityTokenRequest) => string | Promise<string>;
|
|
394
|
+
fetch?: typeof fetch;
|
|
395
|
+
signal?: AbortSignal;
|
|
396
|
+
stdout?: Pick<typeof console, "log" | "error">;
|
|
397
|
+
}
|
|
398
|
+
/** Completed local report, public platform run metadata, and private artifact path. */
|
|
399
|
+
interface HostedSecurityResult {
|
|
400
|
+
report: SecurityReport;
|
|
401
|
+
run: Readonly<PlatformSecurityRun>;
|
|
402
|
+
output: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Run the hosted, redacted-source security harness for an odla app or odla's
|
|
406
|
+
* protected self-audit identity. Provider/model selection and provider secrets
|
|
407
|
+
* remain platform-owned; this function accepts only an app/scoped bearer and
|
|
408
|
+
* the opaque role grants remain inside @odla-ai/security's reasoner closures.
|
|
409
|
+
*/
|
|
410
|
+
declare function runHostedSecurity(options: RunHostedSecurityOptions): Promise<HostedSecurityResult>;
|
|
411
|
+
|
|
412
|
+
/** Agent harnesses with a first-class local adapter. */
|
|
413
|
+
declare const AGENT_HARNESSES: readonly ["claude", "codex", "cursor", "copilot", "gemini", "agents"];
|
|
414
|
+
/** A supported coding-agent harness. `agents` is the portable `AGENTS.md` adapter. */
|
|
415
|
+
type AgentHarness = (typeof AGENT_HARNESSES)[number];
|
|
416
|
+
/** A harness name accepted by setup; `all` expands to every project-local adapter. */
|
|
417
|
+
type AgentHarnessSelector = AgentHarness | "all";
|
|
418
|
+
/** Controls project-local or global installation of the bundled agent runbooks. */
|
|
171
419
|
interface SkillInstallOptions {
|
|
172
|
-
/** Project directory receiving
|
|
420
|
+
/** Project directory receiving the shared runbooks and harness adapters. Defaults to cwd. */
|
|
173
421
|
dir?: string;
|
|
174
|
-
/** Install
|
|
422
|
+
/** Install user-wide Claude and/or Codex skills instead of project adapters. */
|
|
175
423
|
global?: boolean;
|
|
176
|
-
/**
|
|
424
|
+
/** Harnesses to install. The programmatic compatibility default is `claude`; the CLI passes `all`. */
|
|
425
|
+
harnesses?: AgentHarnessSelector[];
|
|
426
|
+
/** Overwrite locally modified odla-managed files or managed instruction sections. */
|
|
177
427
|
force?: boolean;
|
|
178
428
|
/** Test/embedding override for the home directory. */
|
|
179
429
|
homeDir?: string;
|
|
430
|
+
/** Test/embedding override for `$CODEX_HOME`. */
|
|
431
|
+
codexHomeDir?: string;
|
|
180
432
|
/** Test/embedding override for the bundled skills directory. */
|
|
181
433
|
sourceDir?: string;
|
|
182
434
|
stdout?: Pick<typeof console, "log" | "error">;
|
|
183
435
|
}
|
|
436
|
+
/** One harness adapter and the directories or files through which it discovers odla. */
|
|
437
|
+
interface HarnessInstallResult {
|
|
438
|
+
harness: AgentHarness;
|
|
439
|
+
targets: string[];
|
|
440
|
+
}
|
|
441
|
+
/** Files written or left unchanged by an idempotent agent-runbook installation. */
|
|
184
442
|
interface SkillInstallResult {
|
|
443
|
+
/** Primary native skill directory, retained for compatibility with earlier callers. */
|
|
185
444
|
targetDir: string;
|
|
445
|
+
/** Files changed directly under `targetDir`, relative to that directory. */
|
|
186
446
|
written: string[];
|
|
447
|
+
/** Files already current directly under `targetDir`, relative to that directory. */
|
|
187
448
|
unchanged: string[];
|
|
449
|
+
/** Absolute paths of every changed shared-runbook or adapter file. */
|
|
450
|
+
writtenPaths: string[];
|
|
451
|
+
/** Absolute paths of every already-current shared-runbook or adapter file. */
|
|
452
|
+
unchangedPaths: string[];
|
|
453
|
+
harnesses: HarnessInstallResult[];
|
|
188
454
|
}
|
|
189
455
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
456
|
+
* Installs one shared offline runbook tree plus thin native adapters for the
|
|
457
|
+
* selected coding-agent harnesses. Project installs use `.agents/skills/` as
|
|
458
|
+
* the canonical bundle; Claude Code, Cursor, Copilot, Gemini, and generic
|
|
459
|
+
* `AGENTS.md` adapters point to it. Global installs support the native Claude
|
|
460
|
+
* and Codex skill roots only.
|
|
461
|
+
*
|
|
462
|
+
* Installation is idempotent and planned before any write: an odla-managed
|
|
463
|
+
* file changed by the user aborts the whole operation unless `force` is set.
|
|
464
|
+
* Existing `AGENTS.md`, `GEMINI.md`, and Copilot instructions are preserved;
|
|
465
|
+
* only the bounded odla-managed section is appended or replaced.
|
|
193
466
|
*/
|
|
194
467
|
declare function installSkill(options?: SkillInstallOptions): SkillInstallResult;
|
|
195
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Verify a live, already-provisioned environment end-to-end. Resolves the target
|
|
471
|
+
* env (`options.env`, else `dev`, else the first declared env) and requires it to
|
|
472
|
+
* be declared in the config. Reads the local credentials file and checks that it
|
|
473
|
+
* belongs to this app and holds a `tenantId` + `dbKey` for the env — otherwise it
|
|
474
|
+
* throws pointing the user at `odla-ai provision --write-dev-vars`.
|
|
475
|
+
*
|
|
476
|
+
* It then makes real network calls: fetches the registry public-config (and, when
|
|
477
|
+
* `ai.provider` is configured, asserts the live provider matches), fetches the
|
|
478
|
+
* live db schema with the db key and asserts every entity from the local schema
|
|
479
|
+
* is present, and runs a `count` aggregate against the first entity to confirm
|
|
480
|
+
* the db answers queries. Progress lines are printed and it ends with `ok`.
|
|
481
|
+
* Read-only — it writes nothing and throws on the first mismatch or failed
|
|
482
|
+
* request.
|
|
483
|
+
*
|
|
484
|
+
* @param options.configPath Path to the `odla.config.mjs`.
|
|
485
|
+
* @param options.env Env to check (default `dev`, else the first declared env).
|
|
486
|
+
* @param options.fetch Injectable `fetch` (for tests/embedding).
|
|
487
|
+
* @param options.stdout Optional console-like sink (defaults to `console`).
|
|
488
|
+
*/
|
|
196
489
|
declare function smoke(options: SmokeOptions): Promise<void>;
|
|
197
490
|
|
|
198
|
-
export { type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, doctor, initProject, installSkill, provision, redactSecrets, runCli, secretsPush, smoke };
|
|
491
|
+
export { AGENT_HARNESSES, type AdminAiOptions, type AgentHarness, type AgentHarnessSelector, CAPABILITIES, type HarnessInstallResult, type HostedSecurityProfile, type HostedSecurityResult, type HostedSecurityTokenRequest, type LoadedProjectConfig, type LocalCredentials, type OdlaProjectConfig, type ProvisionOptions, type ProvisionPlan, type RunHostedSecurityOptions, SYSTEM_AI_PURPOSES, type ScopedPlatformTokenOptions, type SecretsPushOptions, type SkillInstallOptions, type SkillInstallResult, type SmokeOptions, type SystemAiPurpose, adminAi, doctor, getScopedPlatformToken, initProject, installSkill, printCapabilities, provision, redactSecrets, runCli, runHostedSecurity, secretsPush, smoke };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
AGENT_HARNESSES,
|
|
4
|
+
CAPABILITIES,
|
|
5
|
+
SYSTEM_AI_PURPOSES,
|
|
6
|
+
adminAi,
|
|
3
7
|
doctor,
|
|
8
|
+
getScopedPlatformToken,
|
|
4
9
|
initProject,
|
|
5
10
|
installSkill,
|
|
11
|
+
printCapabilities,
|
|
6
12
|
provision,
|
|
7
13
|
redactSecrets,
|
|
8
14
|
runCli,
|
|
15
|
+
runHostedSecurity,
|
|
9
16
|
secretsPush,
|
|
10
17
|
smoke
|
|
11
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OERLHVLH.js";
|
|
12
19
|
export {
|
|
20
|
+
AGENT_HARNESSES,
|
|
21
|
+
CAPABILITIES,
|
|
22
|
+
SYSTEM_AI_PURPOSES,
|
|
23
|
+
adminAi,
|
|
13
24
|
doctor,
|
|
25
|
+
getScopedPlatformToken,
|
|
14
26
|
initProject,
|
|
15
27
|
installSkill,
|
|
28
|
+
printCapabilities,
|
|
16
29
|
provision,
|
|
17
30
|
redactSecrets,
|
|
18
31
|
runCli,
|
|
32
|
+
runHostedSecurity,
|
|
19
33
|
secretsPush,
|
|
20
34
|
smoke
|
|
21
35
|
};
|