@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 57 lines 1.74 KB
Raw
1 import type { AppSecrets, ListSecretsError } from "@distilled.cloud/fly-io/machines";
2 import * as Binding from "alchemy/Binding";
3 import type { RuntimeContext } from "alchemy/RuntimeContext";
4 import type * as Effect from "effect/Effect";
5 import type { App } from "./App.ts";
6
7 /**
8 * List Fly.io App secrets. Scoped to an {@link App}. Fly's list API
9 * is `GET /apps/{app}/secrets`, not a single Secret.
10 *
11 *
12 * ### List this App
13 * The App is fixed by `ListSecrets(app)`. Calls take no `app_name`.
14 * Provide {@link ListSecretsHttp}.
15 *
16 * Plaintext is only returned from inside a Machine in the same App.
17 * From a deploy-time Action you get metadata (name, digest,
18 * timestamps).
19 *
20 * **Example:** ListSecrets
21 * ```typescript
22 * const list = yield* Fly.ListSecrets(Site);
23 * const { secrets } = yield* list();
24 * ```
25 *
26 * ### List another App
27 * From an Action, the org `FLY_API_TOKEN` can list any App in the
28 * org. `ListSecrets(other)` is how you reach across Apps.
29 *
30 * From a Machine, deploy tokens are per-App. Mixing Apps on one host
31 * shares one `FLY_API_TOKEN` and is not supported.
32 *
33 * **Example:** Cross-app from an Action
34 * ```typescript
35 * const Seed = Alchemy.Action(
36 * "Seed",
37 * Effect.gen(function* () {
38 * const list = yield* Fly.ListSecrets(Other);
39 *
40 * return Effect.fn(function* () {
41 * const { secrets } = yield* list();
42 * return secrets;
43 * });
44 * }).pipe(Effect.provide(Fly.ListSecretsHttp)),
45 * );
46 * ```
47 *
48 * @binding
49 * @product Secret
50 */
51 export interface ListSecrets extends Binding.Service<
52 ListSecrets,
53 "Fly.ListSecrets",
54 (app: App) => Effect.Effect<() => Effect.Effect<AppSecrets, ListSecretsError, RuntimeContext>>
55 > {}
56
57 export const ListSecrets = Binding.Service<ListSecrets>("Fly.ListSecrets");