| 1 | import * as Alchemy from "alchemy"; |
| 2 | import { Interaction } from "alchemy/Interaction"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as Layer from "effect/Layer"; |
| 5 | |
| 6 | export default Alchemy.Stack( |
| 7 | "CliPackageCanary", |
| 8 | { providers: Layer.empty, state: Alchemy.localState() }, |
| 9 | Effect.gen(function* () { |
| 10 | const interaction = yield* Interaction; |
| 11 | yield* interaction.task({ label: "Packed CLI progress" }, Effect.void); |
| 12 | yield* Effect.sync(() => { |
| 13 | process.stdout.write( |
| 14 | `CLI_PACKAGE_PROBE=${JSON.stringify({ |
| 15 | runtime: process.versions.bun ? "bun" : "node", |
| 16 | nodeEnv: process.env.NODE_ENV, |
| 17 | home: process.env.HOME, |
| 18 | credentialVariables: Object.keys(process.env).filter((name) => |
| 19 | /TOKEN|SECRET|PASSWORD|CREDENTIAL|API_KEY|ACCESS_KEY|AWS_PROFILE/i.test( |
| 20 | name, |
| 21 | ), |
| 22 | ), |
| 23 | cwd: process.cwd(), |
| 24 | entry: process.argv[1], |
| 25 | alchemy: import.meta.resolve("alchemy"), |
| 26 | args: process.argv.slice(2), |
| 27 | })}\n`, |
| 28 | ); |
| 29 | }); |
| 30 | return { message: "Packed CLI deployment complete" }; |
| 31 | }), |
| 32 | ); |