shiplane 0.5.2 → 0.6.0-fix-shiplane-ship-node-cache.3dccda9

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +157 -312
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{readStatus-DypM0faL.js → compose-BTQXZqHM.js} +2758 -1448
  5. package/dist/compose-BTQXZqHM.js.map +1 -0
  6. package/dist/{budget-BTnKtGF6.js → display-CfV4G1TR.js} +155 -52
  7. package/dist/display-CfV4G1TR.js.map +1 -0
  8. package/dist/{static-hosting.port-B5i6W7eD.d.ts → index-B1Rd22nM.d.ts} +482 -21
  9. package/dist/index.d.ts +2 -3
  10. package/dist/index.js +3 -4
  11. package/dist/{issues-TcWtMTv5.js → issues-DCRpXUBW.js} +1 -1
  12. package/dist/{issues-TcWtMTv5.js.map → issues-DCRpXUBW.js.map} +1 -1
  13. package/dist/memory.d.ts +1 -1
  14. package/dist/memory.js +1 -1
  15. package/dist/{package-registry.fake-BLBdd7IQ.d.ts → package-registry.fake-CjoePEzE.d.ts} +53 -6
  16. package/dist/{package-registry.fake-CN6M1-Gi.js → package-registry.fake-ykiSBd8M.js} +58 -6
  17. package/dist/package-registry.fake-ykiSBd8M.js.map +1 -0
  18. package/dist/plugin-D-JQhwVd.d.ts +118 -0
  19. package/dist/plugin.d.ts +3 -23
  20. package/dist/plugin.js +84 -7
  21. package/dist/plugin.js.map +1 -0
  22. package/dist/shell-server-hosting.adapter-CvOcC6Wh.js +369 -0
  23. package/dist/shell-server-hosting.adapter-CvOcC6Wh.js.map +1 -0
  24. package/dist/{src-DO7WyrfV.js → src-8BbKTQBb.js} +2 -2
  25. package/dist/src-8BbKTQBb.js.map +1 -0
  26. package/dist/testing.d.ts +103 -18
  27. package/dist/testing.js +235 -22
  28. package/dist/testing.js.map +1 -1
  29. package/package.json +2 -1
  30. package/dist/budget-BTnKtGF6.js.map +0 -1
  31. package/dist/display-IqkJ6uCw.js +0 -96
  32. package/dist/display-IqkJ6uCw.js.map +0 -1
  33. package/dist/index-C_urG4yY.d.ts +0 -252
  34. package/dist/package-registry.fake-CN6M1-Gi.js.map +0 -1
  35. package/dist/readStatus-DypM0faL.js.map +0 -1
  36. package/dist/shell-server-hosting.adapter-C7_5MWrl.js +0 -50
  37. package/dist/shell-server-hosting.adapter-C7_5MWrl.js.map +0 -1
  38. package/dist/src-DO7WyrfV.js.map +0 -1
  39. package/dist/web-app.module-BB1fY1Kd.js +0 -125
  40. package/dist/web-app.module-BB1fY1Kd.js.map +0 -1
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["sleep"],"sources":["../src/adapters/terminal/terminal-progress.adapter.ts","../src/adapters/terminal/terminal.adapter.ts","../src/cli/plugins.ts","../src/cli/compose.ts","../src/cli/findRoot.ts","../src/cli/output.ts","../src/cli/pluginsCommand.ts","../src/cli/statusCommand.ts","../src/cli/main.ts","../src/cli.ts"],"sourcesContent":["import { styleText } from \"node:util\";\n\nimport type { Display, MascotDrawing, MascotMoment, Mood } from \"../../domain/display\";\nimport type { BatchPlace, Progress, StepPlace } from \"../../ports/terminal.port\";\nimport { progressBar } from \"../../domain/display\";\nimport { liveLine } from \"./live-line\";\n\n/**\n * The mascot in colour: red when worried, green when happy. The hedgehog is coloured part by part,\n * spines, face, then what he holds; any other mascot as a whole.\n */\nexport const paintMascot = (mascot: MascotDrawing, moment: MascotMoment) => {\n const { mood } = moment;\n const text = mascot.draw(moment);\n if (mood === \"worried\") return styleText(\"red\", text);\n if (!mascot.hedgehog) return mood === \"happy\" ? styleText(\"green\", text) : text;\n const frame = [...text];\n const face = frame.slice(5, 10).join(\"\");\n return `${styleText(\"yellow\", frame.slice(0, 5).join(\"\"))}${styleText(mood === \"happy\" ? [\"bold\", \"green\"] : \"bold\", face)}${styleText(\"cyan\", frame.slice(10).join(\"\"))}`;\n};\n\nconst elapsed = (since: number) => {\n const seconds = Math.round((Date.now() - since) / 1000);\n return seconds < 60\n ? `${seconds}s`\n : `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, \"0\")}s`;\n};\n\n/** Cuts `text` to what the terminal shows on one line, so redrawing it in place stays clean. */\nconst fit = (text: string, taken: number) => {\n const room = Math.max(20, (process.stdout.columns || 100) - taken);\n return text.length > room ? `${text.slice(0, room - 1)}…` : text;\n};\n\ntype Place = StepPlace | BatchPlace;\n\nconst counterOf = (step?: Place) =>\n step && \"index\" in step ? `${step.index + 1}/${step.total} ` : \"\";\n\nconst batchOf = (step?: Place) => (step && \"done\" in step ? step : null);\n\n/**\n * Progress in a terminal. Verbose: the journey bar, what it reads, each step redrawn in place with\n * its time, the mascot beside it. Not verbose: only each step's name, as before. A CI log or a pipe\n * gets plain lines, never a redraw.\n */\nexport const terminalProgress = (display: Display, inPlace: boolean): Progress => {\n const mascot = (mood: Mood, tick: number, label = \"\") =>\n display.mascot\n ? `${paintMascot(display.mascot, { mood, tick: display.motion ? tick : 0, label })} `\n : \"\";\n const taken = (step?: Place) =>\n 2 +\n (display.mascot ? display.mascot.width + 1 : 0) +\n counterOf(step).length +\n (batchOf(step) ? 8 : 0) +\n 8;\n\n const during = async <T>(\n label: string,\n mood: Mood,\n work: () => Promise<T>,\n step?: Place,\n ): Promise<T> => {\n const counter = styleText(\"dim\", counterOf(step));\n const batch = batchOf(step);\n if (!display.verbose) {\n if (step && !batch) {\n liveLine.above(\"\");\n liveLine.above(styleText([\"bold\", \"cyan\"], `▶ ${label}`));\n }\n return work();\n }\n const text = fit(label, taken(step));\n if (!inPlace || liveLine.busy) {\n liveLine.above(` ${mascot(mood, 0, label)}${counter}${text}`);\n return work();\n }\n const started = Date.now();\n const time = () =>\n styleText(\"dim\", `${batch ? `${batch.done()}/${batch.total} ` : \"\"}${elapsed(started)}`);\n const drawing = display.mascot;\n liveLine.show(\n {\n ...(drawing\n ? {\n frames: Array.from({ length: display.motion ? drawing.frames(mood) : 1 }, (_, tick) =>\n paintMascot(drawing, { mood, tick, label }),\n ),\n }\n : {}),\n text: `${counter}${text}`,\n suffix: time,\n },\n true,\n );\n try {\n const result = await work();\n liveLine.finish(` ${styleText(\"green\", \"✓\")}`, `${counter}${text} ${time()}`);\n return result;\n } catch (error) {\n liveLine.finish(` ${styleText(\"red\", \"✗\")}`, `${counter}${text} ${time()}`);\n throw error;\n }\n };\n\n return {\n stage: (stages, index) => {\n if (!display.verbose) return;\n const bar = styleText(\"green\", progressBar(index + 1, stages.length, 18));\n liveLine.above(\"\");\n liveLine.above(\n ` ${bar} ${styleText(\"dim\", `${index + 1}/${stages.length}`)} ${styleText(\"bold\", stages[index] ?? \"\")}`,\n );\n },\n during,\n say: (mood, text) =>\n liveLine.above(display.mascot ? ` ${mascot(mood, 0, text)}${text}` : text),\n };\n};\n","import { emitKeypressEvents } from \"node:readline\";\nimport { createInterface } from \"node:readline/promises\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport { styleText } from \"node:util\";\nimport type { CANCEL_SYMBOL, Option } from \"@clack/prompts\";\nimport { confirm, isCancel, multiselect, select, text } from \"@clack/prompts\";\n\nimport type { Display } from \"../../domain/display\";\nimport type { Choice, Clock, Output, Prompter } from \"../../ports/terminal.port\";\nimport { liveLine } from \"./live-line\";\nimport { paintMascot } from \"./terminal-progress.adapter\";\n\nexport const terminalOutput: Output = {\n line: (line = \"\") => liveLine.above(line),\n};\n\n/** Whether this process runs inside a GitHub Actions job. */\n\nexport const onGitHubActions = () => process.env.GITHUB_ACTIONS === \"true\";\n\nexport const systemClock: Clock = {\n now: () => new Date(),\n sleep: async (ms) => {\n await sleep(ms);\n },\n};\n\nconst FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\n/** A spinner, or the mascot waiting, on one line until a listed key is pressed or `ms` pass. Ctrl-C ends the process. */\nconst waitForKey = (display: Display, label: string, ms: number, keys: readonly string[]) =>\n new Promise<string | null>((resolve) => {\n const startedAt = Date.now();\n let frame = 0;\n const draw = () => {\n const seconds = Math.round((Date.now() - startedAt) / 1000);\n const tick = frame++;\n const glyph = display.mascot\n ? paintMascot(display.mascot, {\n mood: \"waiting\",\n tick: display.motion ? Math.floor(tick / 5) : 0,\n label,\n })\n : styleText(\"cyan\", FRAMES[tick % FRAMES.length] ?? \"\");\n process.stdout.write(`\\r ${glyph} ${label} ${styleText(\"dim\", `${seconds}s`)}`);\n };\n const timer = setInterval(draw, 80);\n const finish = (key: string | null) => {\n clearInterval(timer);\n clearTimeout(timeout);\n process.stdin.off(\"keypress\", onKey);\n process.stdin.setRawMode(false);\n process.stdin.pause();\n process.stdout.write(\"\\r\\u001B[2K\");\n resolve(key);\n };\n const onKey = (_text: string, key: { name?: string; ctrl?: boolean } | undefined) => {\n if (key?.ctrl && key.name === \"c\") {\n finish(null);\n process.stdout.write(\n `${styleText(\"dim\", \" Stopped waiting. release picks up right here.\")}\\n`,\n );\n process.exit(130);\n }\n if (key?.name && keys.includes(key.name)) finish(key.name);\n };\n const timeout = setTimeout(() => finish(null), ms);\n emitKeypressEvents(process.stdin);\n process.stdin.setRawMode(true);\n process.stdin.resume();\n process.stdin.on(\"keypress\", onKey);\n });\n\n// clack types an option per primitive value; a Choice has the same fields.\nconst asOptions = <Value extends string>(choices: Choice<Value>[]) =>\n choices as unknown as Option<Value>[];\n\nconst orNull = <Value>(answer: Value | typeof CANCEL_SYMBOL): Value | null =>\n isCancel(answer) ? null : answer;\n\nconst NO_MASCOT: Display = { verbose: false, mascot: null, motion: false };\n\n/** Questions through @clack/prompts, each owning the terminal; without one, every answer is no. */\nexport const terminalPrompter = (display: Display = NO_MASCOT): Prompter => {\n const interactive = Boolean(process.stdin.isTTY);\n const hold = <T>(work: () => Promise<T>) => liveLine.hold(work);\n return {\n interactive,\n confirm: (question, initial = false) =>\n hold(\n async () =>\n interactive &&\n orNull(await confirm({ message: question, initialValue: initial })) === true,\n ),\n typed: (question, word) =>\n hold(async () => {\n if (!interactive) return false;\n const prompt = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await prompt.question(`${styleText(\"bold\", question)} `);\n prompt.close();\n return answer.trim() === word;\n }),\n select: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(await select({ message, options: asOptions(choices), initialValue: initial }))\n : null,\n ),\n multiselect: (message, choices, initial) =>\n hold(async () =>\n interactive\n ? orNull(\n await multiselect({\n message,\n options: asOptions(choices),\n initialValues: initial,\n required: false,\n }),\n )\n : null,\n ),\n text: (message, initial) =>\n hold(async () =>\n interactive ? orNull(await text({ message, initialValue: initial })) : null,\n ),\n waitForKey: (label, ms, keys) =>\n hold(async () => {\n if (interactive) return waitForKey(display, label, ms, keys);\n await sleep(ms);\n return null;\n }),\n };\n};\n","import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { AnyDeliveryAdapter } from \"../modules/suggest\";\nimport { shellServerHosting } from \"../adapters/server-hosting/shell-server-hosting.adapter\";\n\n/** A plugin's own word on what init may offer: `\"shiplane\": { \"adapters\": [\"flyServerHosting\"] }`. */\ninterface PluginManifest {\n shiplane?: { adapters?: string[] };\n}\n\nconst readJson = (file: string): unknown => JSON.parse(fs.readFileSync(file, \"utf8\"));\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\n/**\n * The delivery adapters init can offer: the built-in shell adapter, then each one a plugin this\n * repository depends on names in its package.json. A plugin that does not load is skipped.\n */\nexport const installedAdapters = async (root: string): Promise<AnyDeliveryAdapter[]> => {\n const manifestFile = path.join(root, \"package.json\");\n if (!fs.existsSync(manifestFile)) return [shellServerHosting()];\n const manifest = readJson(manifestFile) as Record<string, Record<string, string> | undefined>;\n const names = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies });\n const require = createRequire(manifestFile);\n const found = await Promise.all(\n names.map(async (name): Promise<AnyDeliveryAdapter[]> => {\n try {\n const own = readJson(require.resolve(`${name}/package.json`)) as PluginManifest;\n const factories = own.shiplane?.adapters ?? [];\n if (factories.length === 0) return [];\n const loaded: unknown = await import(pathToFileURL(require.resolve(name)).href);\n if (!isRecord(loaded)) return [];\n return factories.flatMap((factory) => {\n const make = loaded[factory];\n return typeof make === \"function\" ? [make() as AnyDeliveryAdapter] : [];\n });\n } catch {\n return [];\n }\n }),\n );\n return [...found.flat(), shellServerHosting()];\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport type { ReleaseContext, Services } from \"../application/context\";\nimport type { SetupContext } from \"../application/setupContext\";\nimport type { DisplayChoice } from \"../domain/display\";\nimport type { Open } from \"../modules/module\";\nimport type { Shell } from \"../ports/shell.port\";\nimport type { Output, Progress, Prompter } from \"../ports/terminal.port\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { systemShell } from \"../adapters/shell/system-shell.adapter\";\nimport { terminalProgress } from \"../adapters/terminal/terminal-progress.adapter\";\nimport {\n onGitHubActions,\n systemClock,\n terminalOutput,\n terminalPrompter,\n} from \"../adapters/terminal/terminal.adapter\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { resolveDisplay } from \"../domain/display\";\nimport { installedAdapters } from \"./plugins\";\n\n/** Creates each port the flow runs on, for this repository. */\nexport const composeServices = (release: Release, open: Open): Services => ({\n sourceControl: open(release.flow.sourceControl),\n codeHost: open(release.flow.codeHost),\n ciPipeline: open(release.flow.ciPipeline),\n versioning: open(release.flow.versioning),\n});\n\n/** Ports created on demand, in this repository, through this shell. */\nexport const opener =\n (root: string, shell: Shell): Open =>\n (adapter) =>\n adapter.create({ root, shell });\n\n/** What a run may take instead of this machine's: a scripted person, a recorded terminal or shell. */\nexport interface ContextIo {\n prompter?: Prompter;\n output?: Output;\n progress?: Progress;\n shell?: Shell;\n /** Where `shiplane` resolves from inside the config. */\n aliases?: Record<string, string>;\n /** What setup runs on instead of this machine's: files, adapters, the release loader. */\n setup?: Partial<SetupContext>;\n}\n\n/** A context wired to this machine: its shell, its terminal, its clock, unless `io` says otherwise. */\nexport const composeContext = (\n release: Release,\n { yes, display: flags }: { yes: boolean; display: DisplayChoice },\n io: ContextIo = {},\n): ReleaseContext => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(release.display ?? {}, flags, {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n });\n const shell = io.shell ?? systemShell;\n const output = io.output ?? terminalOutput;\n const open = opener(release.root, shell);\n return {\n release,\n load: () => loadRelease(release.root, { aliases: io.aliases }),\n services: composeServices(release, open),\n open,\n prompter: io.prompter ?? terminalPrompter(display),\n output,\n progress: io.progress ?? terminalProgress(display, tty && !ci),\n clock: systemClock,\n shell,\n options: { yes, ci: onGitHubActions() },\n };\n};\n\n/** What init, add, doctor and the rest need: the repository on disk and the adapters installed. */\nexport const composeSetup = async (\n root: string,\n io: Partial<SetupContext> = {},\n): Promise<SetupContext> => {\n const ci = onGitHubActions() || systemShell.env(\"CI\") === \"true\";\n const tty = Boolean(process.stdout.isTTY);\n const display = resolveDisplay(\n {},\n { mascot: false },\n {\n tty,\n ci,\n noMotion: Boolean(systemShell.env(\"NO_MOTION\")),\n },\n );\n return {\n root,\n files: nodeFiles(root),\n shell: systemShell,\n prompter: terminalPrompter(),\n output: terminalOutput,\n adapters: io.adapters ?? (await installedAdapters(root)),\n load: () => loadRelease(root),\n progress: terminalProgress(display, tty && !ci),\n compose: (release) => composeContext(release, { yes: true, display: { mascot: false } }),\n ...io,\n };\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findConfig } from \"../application/config/loadRelease\";\n\n/** The nearest folder up from here with a release config, else the git root, else here. */\nexport const findRoot = (from: string): string => {\n const ancestors = (dir: string): string[] => {\n const parent = path.dirname(dir);\n return parent === dir ? [dir] : [dir, ...ancestors(parent)];\n };\n const chain = ancestors(path.resolve(from));\n return (\n chain.find((dir) => findConfig(dir)) ??\n chain.find((dir) => fs.existsSync(path.join(dir, \".git\"))) ??\n path.resolve(from)\n );\n};\n","import { styleText } from \"node:util\";\n\nimport type { ConfigProblem } from \"../application/config/problem\";\n\ntype Style = Parameters<typeof styleText>[0];\n\nexport const paint = (style: Style, text: string) => styleText(style, text);\n\nexport const out = (line = \"\") => process.stdout.write(`${line}\\n`);\n\n/** Problems as `file:line message`, each hint on the line below. */\nexport const printProblems = (problems: readonly ConfigProblem[]) => {\n problems.forEach(({ file, line, message, hint }) => {\n const where = line === undefined ? file : `${file}:${line}`;\n out(`${paint(\"red\", \"✗\")} ${paint(\"bold\", where)} ${message}`);\n if (hint) out(` ${paint(\"dim\", hint)}`);\n });\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport { keysAt } from \"../application/config/unitSchema\";\nimport { out, paint } from \"./output\";\n\n/** `shiplane plugins`: the flow's adapters, the modules in release order with their apps, the features. */\nexport const pluginsCommand = (release: Release, { json }: { json: boolean }) => {\n const { flow } = release;\n const ports = {\n sourceControl: flow.sourceControl.name,\n codeHost: flow.codeHost.name,\n ciPipeline: flow.ciPipeline.name,\n versioning: flow.versioning.name,\n };\n const modules = release.modules.map(({ name, kind, provider, settings }) => ({\n name,\n kind,\n provider,\n keys: keysAt(settings, []),\n apps: release.units.filter(({ module }) => module === name).map(({ name: app }) => app),\n }));\n const features = release.features.map(({ name, adapters }) => ({\n name,\n uses: adapters.map((adapter) => adapter.name),\n }));\n if (json) {\n out(JSON.stringify({ flow: ports, modules, features }, null, 2));\n return;\n }\n const width =\n Math.max(\n 14,\n ...modules.map(({ name }) => name.length),\n ...features.map(({ name }) => name.length),\n ) + 2;\n const section = (title: string) => {\n out();\n out(paint(\"bold\", title));\n out();\n };\n section(\"Flow in shiplane.config.ts\");\n Object.entries(ports).forEach(([port, name]) => out(` ${port.padEnd(width)}${name}`));\n section(\"Modules, in release order\");\n modules.forEach(({ name, provider, keys, apps }) => {\n const used = apps.length > 0 ? `used by ${apps.join(\", \")}` : paint(\"dim\", \"no app names it\");\n out(` ${name.padEnd(width)}${provider} ${paint(\"dim\", keys.join(\", \") || \"no options\")}`);\n out(` ${\" \".repeat(width)}${used}`);\n });\n section(\"Features, after the ship\");\n if (features.length === 0) out(` ${paint(\"dim\", \"none\")}`);\n features.forEach(({ name, uses }) =>\n out(` ${name.padEnd(width)}${paint(\"dim\", `uses ${uses.join(\", \")}`)}`),\n );\n out();\n};\n","import type { ReleaseContext } from \"../application/context\";\nimport type { Environment } from \"../domain/environment\";\nimport { readStatus } from \"../application/readStatus\";\nimport { environmentLabel } from \"../application/targets\";\nimport { out, paint } from \"./output\";\n\nconst NEXT: Record<string, string> = {\n \"release-pr\": \"open the release PR: shiplane\",\n \"wait-merge\": \"merge the release PR, then: shiplane\",\n ship: \"tag what was versioned and ship it: shiplane\",\n};\n\n/** The next step as a person reads it; a ship with nothing pending anywhere is nothing to do. */\nexport const nextLabel = (\n {\n next,\n units,\n untagged,\n }: {\n next: { step: string };\n units: readonly { pending: boolean }[];\n untagged: readonly unknown[];\n },\n nextChange: string,\n) =>\n next.step === \"ship\" && untagged.length === 0 && !units.some(({ pending }) => pending)\n ? `nothing to release: queue a change with ${nextChange}`\n : (NEXT[next.step] ?? \"\");\n\n/** `shiplane status`: where every unit stands on an environment, and what to run next. Reads only. */\nexport const statusCommand = async (\n context: ReleaseContext,\n { environment, json }: { environment: Environment; json: boolean },\n) => {\n const status = await readStatus(context, environment);\n if (json) {\n out(JSON.stringify(status, null, 2));\n return;\n }\n const dot = paint(\"dim\", \"·\");\n out();\n const label = environmentLabel(context, [], environment);\n out(` ${paint(\"bold\", \"Release status\")} ${dot} ${label}`);\n out();\n const width = Math.max(8, ...status.units.map(({ unit }) => unit.length)) + 2;\n out(\n paint(\n \"dim\",\n ` ${\"Unit\".padEnd(width)}${\"Version\".padEnd(12)}${\"Target\".padEnd(18)}Where it stands`,\n ),\n );\n status.units.forEach(({ unit, version, target, pending, hint }) => {\n const mark = pending ? paint(\"yellow\", \"↑\") : paint(\"dim\", \"·\");\n out(` ${unit.padEnd(width)}${version.padEnd(12)}${target.padEnd(18)}${mark} ${hint}`);\n });\n status.releasePrs.forEach(({ url }) => out(`\\n ${paint(\"cyan\", \"Release PR\")} ${url}`));\n if (status.untagged.length > 0) {\n out(` ${paint(\"yellow\", \"Untagged\")} ${status.untagged.map(({ tag }) => tag).join(\", \")}`);\n }\n out();\n out(\n `${paint([\"bold\", \"green\"], \"→ Next:\")} ${nextLabel(status, context.services.versioning.nextChange)}`,\n );\n out();\n};\n","import { parseArgs } from \"node:util\";\nimport { z } from \"zod\";\n\nimport type { ReleaseContext } from \"../application/context\";\nimport type { ContextIo } from \"./compose\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { addUnit, removeUnit } from \"../application/addUnit\";\nimport { loadRelease } from \"../application/config/loadRelease\";\nimport { docsFor } from \"../application/docsFor\";\nimport { doctor } from \"../application/doctor\";\nimport { initRelease } from \"../application/initRelease\";\nimport { newAdapter } from \"../application/newAdapter\";\nimport { openReleasePr } from \"../application/openReleasePr\";\nimport { pickScope } from \"../application/pickScope\";\nimport { planShips } from \"../application/planShips\";\nimport { prepareRelease } from \"../application/prepareRelease\";\nimport { promote } from \"../application/promote\";\nimport { releaseToPreview } from \"../application/releaseToPreview\";\nimport { setup } from \"../application/setup\";\nimport { CONFIG_FILE, refreshEditorSchema } from \"../application/setupFiles\";\nimport { shipTo } from \"../application/ship\";\nimport { missingTags, tagRelease } from \"../application/tagRelease\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { composeContext, composeSetup } from \"./compose\";\nimport { findRoot } from \"./findRoot\";\nimport { out, paint, printProblems } from \"./output\";\nimport { pluginsCommand } from \"./pluginsCommand\";\nimport { statusCommand } from \"./statusCommand\";\n\nconst HELP = `${paint(\"bold\", \"shiplane\")}: detect what changed, version it, trigger each app's deploy.\n\n shiplane the next step to preview: release PR, merge, tags, ship\n shiplane promote production, from what preview runs (--channel production too)\n shiplane status [--json] where every unit stands, and what to run next\n shiplane version open the release PR for what is pending\n shiplane tag tag merged versions and publish their release notes\n shiplane ship [unit...] trigger each tagged unit's deploy, then return\n shiplane plan every command a ship would run, run nothing\n shiplane plugins [--json] the flow, the modules in release order and who uses each, the features\n\n shiplane setup [--yes] set up or check releases: asks only what it can't tell, rehearses, then writes\n shiplane init [--yes|--blank] the older setup: a unit file per app, then doctor\n shiplane add <folder> init's questions for one folder\n shiplane remove <unit> stop shipping a unit; it stays versioned\n shiplane doctor check the config, tools and sign-ins, offer each fix\n shiplane adapter new <name> scaffold a server hosting adapter, its contract test and its module\n shiplane docs <name> every key a module's or an adapter's unit files take\n shiplane help this\n\n --channel preview|production where status reads (preview by default)\n --via github|local ship through GitHub Actions or this machine, without asking\n --yes answer yes to every question (never on production)\n --verbose / --no-verbose say each thing it reads and runs, with a progress bar (on by default)\n --mascot / --no-mascot the mascot beside it, still in CI or under NO_MOTION=1 (on by default)\n Both defaults live in shiplane.config.ts: display: { verbose, mascot }\n`;\n\n/** The CLI as a person runs it, from its arguments and folder; resolves to its exit code. */\nexport const runCli = async (argv: string[], cwd: string, io: ContextIo = {}): Promise<number> => {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n allowNegative: true,\n options: {\n verbose: { type: \"boolean\" },\n mascot: { type: \"boolean\" },\n json: { type: \"boolean\", default: false },\n yes: { type: \"boolean\", short: \"y\", default: false },\n channel: { type: \"string\", default: \"preview\" },\n via: { type: \"string\" },\n blank: { type: \"boolean\", default: false },\n },\n });\n\n const [command = \"next\", ...units] = positionals;\n const environment = z.enum(ENVIRONMENTS).parse(values.channel);\n const via = values.via === undefined ? undefined : z.enum([\"github\", \"local\"]).parse(values.via);\n\n const commands: Record<string, (context: ReleaseContext) => Promise<boolean | void>> = {\n next: (context) =>\n environment === \"preview\" ? releaseToPreview(context) : promote(context, via),\n promote: (context) => promote(context, via),\n status: (context) => statusCommand(context, { environment, json: values.json }),\n version: async (context) => {\n const picked = await pickScope(context, \"preview\");\n if (!picked || picked.scope.size === 0) return true;\n return (await openReleasePr(context, await prepareRelease(context, picked.scope))) !== null;\n },\n tag: async (context) => tagRelease(context, await missingTags(context)),\n ship: (context) =>\n shipTo(context, environment, { via, ...(units.length > 0 ? { scope: new Set(units) } : {}) }),\n plan: (context) => planShips(context, environment),\n plugins: (context) => Promise.resolve(pluginsCommand(context.release, { json: values.json })),\n };\n\n const [first = \"\"] = units;\n const setupCommands: Record<\n string,\n (context: Awaited<ReturnType<typeof composeSetup>>) => Promise<boolean>\n > = {\n setup: (context) => setup(context, { yes: values.yes }),\n init: (context) => {\n if (values.blank) return initRelease(context, { yes: values.yes, blank: true });\n out(paint(\"dim\", \"init is now shiplane setup\"));\n return setup(context, { yes: values.yes });\n },\n add: (context) => addUnit(context, first),\n remove: (context) => removeUnit(context, first),\n doctor: (context) => doctor(context),\n adapter: (context) => {\n if (first === \"new\" && units[1]) return newAdapter(context, units[1]);\n out(`${paint(\"red\", \"✗\")} shiplane adapter new <name>`);\n return Promise.resolve(false);\n },\n docs: (context) => docsFor(context, first),\n };\n\n const root = findRoot(cwd);\n const files = io.setup?.files ?? nodeFiles(root);\n const firstRun = command === \"next\" && !files.exists(CONFIG_FILE);\n const run = commands[command];\n const setUp = setupCommands[firstRun ? \"setup\" : command];\n if (setUp) return (await setUp(await composeSetup(root, io.setup))) ? 0 : 1;\n if (command === \"help\") {\n out(HELP);\n return 0;\n }\n if (!run) {\n out(`${paint(\"red\", \"✗\")} no command \"${command}\"`);\n out(HELP);\n return 1;\n }\n const release = await loadRelease(root, { aliases: io.aliases });\n if (release.problems.length > 0) {\n printProblems(release.problems);\n return 2;\n }\n (release.renames ?? []).forEach(({ from, to }) =>\n out(`${paint(\"yellow\", \"!\")} rename ${from} to ${to}: the old name still works for now`),\n );\n refreshEditorSchema(nodeFiles(release.root), release);\n const context = composeContext(\n release,\n { yes: values.yes, display: { verbose: values.verbose, mascot: values.mascot } },\n io,\n );\n return (await run(context)) === false ? 1 : 0;\n};\n","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D,QAAQ,MAAM,IALE,eACd,SACA;EAAE,KAAK,OAAO;EAAK,SAAS;GAAE,SAAS,OAAO;GAAS,QAAQ,OAAO;GAAQ;EAAE,EAChF,GAEuB,CAAC,KAAM,QAAQ,IAAI;;;;AC/I9C,QAAQ,WAAW,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE,EAAE,QAAQ,KAAK,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/application/doctorCi.ts","../src/cli/findRoot.ts","../src/cli/output.ts","../src/cli/pluginsCommand.ts","../src/cli/statusCommand.ts","../src/cli/main.ts","../src/cli.ts"],"sourcesContent":["import path from \"node:path\";\nimport { z } from \"zod\";\n\nimport type { Requirement } from \"../ports/delivery.port\";\nimport type { Release } from \"./config/loadRelease\";\nimport type { SetupContext } from \"./setupContext\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { checkStatus, requirementsOf, signInsOf } from \"./requirements\";\nimport { paint } from \"./say\";\nimport { commandLine } from \"./targets\";\n\n/** Where every check a runner makes is listed, with what it supports. */\nexport const WORKFLOW_DOCS =\n \"https://github.com/arnaud-zg/js-packages/blob/main/docs/shiplane/reference.md#github-actions-workflow\";\n\n/** The units a run names, each one the config's. */\nconst unitsSchema = (known: readonly string[]) =>\n z.array(z.string()).superRefine((names, context) => {\n const unknown = names.filter((name) => !known.includes(name));\n if (unknown.length > 0) {\n context.addIssue({\n code: \"custom\",\n message: `unknown units [${unknown.join(\", \")}]: known [${known.join(\", \")}]`,\n });\n }\n });\n\nconst environmentSchema = z.enum(ENVIRONMENTS, {\n error: ({ input }) => `unknown environment \"${String(input)}\": ${ENVIRONMENTS.join(\", \")}`,\n});\n\n/** The first problem a schema found, as said. */\nconst problemOf = (error: z.ZodError) => error.issues[0]?.message ?? \"invalid\";\n\n/** `$NAME` and `${NAME}` read from the environment, such as `$HOME/.fly/bin`. */\nconst expand = (context: SetupContext, text: string) =>\n text.replace(/\\$\\{?(\\w+)\\}?/g, (_, name: string) => context.shell.env(name) ?? \"\");\n\n/**\n * A missing tool installed, its folder put first on PATH for this run and, through `GITHUB_PATH`,\n * for the steps after it. The problem, or null once it answers.\n */\nconst install = async (context: SetupContext, requirement: Requirement) => {\n const { shell, files, root } = context;\n const { label, install: how } = requirement;\n if (!how) return `${label} missing and no install for linux`;\n const { command } = how;\n const status = await shell.attach(command.command, command.args, {\n cwd: path.join(root, command.cwd ?? \"\"),\n env: command.env,\n });\n if (status !== 0) return `${label} install failed: ${commandLine(command)} exited with ${status}`;\n if (how.path !== undefined) {\n const dir = expand(context, how.path);\n shell.prependPath?.(dir);\n const githubPath = shell.env(\"GITHUB_PATH\");\n if (githubPath) files.append(githubPath, `${dir}\\n`);\n }\n return (await checkStatus(shell, root, requirement)) === 127\n ? `${label} still missing after ${commandLine(command)}`\n : null;\n};\n\n/** Each secret a requirement names that this run does not hold, as said. */\nconst missing = (context: SetupContext, who: string, requirements: readonly Requirement[]) =>\n requirements.flatMap(({ label, secrets = [] }) =>\n secrets.filter((name) => !context.shell.env(name)).map((name) => ({ who, label, name })),\n );\n\n/** Every secret the picked units and the flow need that this run does not hold, in release order. */\nconst missingSecrets = (context: SetupContext, release: Release, picked: ReadonlySet<string>) => [\n ...release.units\n .filter(({ name }) => picked.has(name))\n .flatMap((unit) => {\n const provider = release.modules.find(({ name }) => name === unit.module)?.provider;\n return missing(\n context,\n `${unit.name} ships with ${provider ?? unit.module}`,\n signInsOf(release, new Set([unit.name])),\n );\n }),\n ...requirementsOf(release, new Set()).flatMap((requirement) =>\n missing(context, `shiplane needs ${requirement.label}`, [requirement]),\n ),\n];\n\n/**\n * `shiplane doctor --ci`: what a runner checks before it ships, in order, stopping at the first\n * problem: the units, the environment, each tool (installed when missing), each secret.\n */\nexport const doctorCi = async (\n context: SetupContext,\n { units, channel }: { units: readonly string[]; channel: string },\n): Promise<boolean> => {\n const { output, shell, root } = context;\n const passed = (check: string, detail: string) =>\n output.line(`${paint(\"green\", \"✓\")} ${check} ${paint(\"dim\", detail)}`);\n const stop = (problem: string) => {\n output.line(`${paint(\"red\", \"✗\")} ${problem}`);\n output.line(` ${paint(\"dim\", WORKFLOW_DOCS)}`);\n return false;\n };\n const release = await context.load();\n const [problem] = release.problems;\n if (problem) {\n return stop(\n `${problem.line === undefined ? problem.file : `${problem.file}:${problem.line}`}: ${problem.message}`,\n );\n }\n const known = release.units.map(({ name }) => name);\n const named = unitsSchema(known).safeParse(units.length > 0 ? units : known);\n if (!named.success) return stop(problemOf(named.error));\n passed(\"units\", named.data.join(\", \"));\n const environment = environmentSchema.safeParse(channel);\n if (!environment.success) return stop(problemOf(environment.error));\n passed(\"environment\", environment.data);\n const picked = new Set(named.data);\n for (const requirement of requirementsOf(release, picked)) {\n const found = (await checkStatus(shell, root, requirement)) !== 127;\n const problem = found ? null : await install(context, requirement);\n if (problem) return stop(problem);\n passed(requirement.label, found ? \"installed\" : \"installed now\");\n }\n const [absent] = missingSecrets(context, release, picked);\n if (absent) return stop(`${absent.who}: ${absent.name} missing in \"${environment.data}\"`);\n const secrets = requirementsOf(release, picked).flatMap(({ secrets = [] }) => secrets);\n passed(\"secrets\", secrets.length > 0 ? [...new Set(secrets)].join(\", \") : \"none needed\");\n return true;\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findConfig } from \"../application/config/loadRelease\";\n\n/** The nearest folder up from here with a release config, else the git root, else here. */\nexport const findRoot = (from: string): string => {\n const ancestors = (dir: string): string[] => {\n const parent = path.dirname(dir);\n return parent === dir ? [dir] : [dir, ...ancestors(parent)];\n };\n const chain = ancestors(path.resolve(from));\n return (\n chain.find((dir) => findConfig(dir)) ??\n chain.find((dir) => fs.existsSync(path.join(dir, \".git\"))) ??\n path.resolve(from)\n );\n};\n","import type { ConfigProblem } from \"../application/config/problem\";\nimport { paint } from \"../application/say\";\n\nexport const out = (line = \"\") => process.stdout.write(`${line}\\n`);\n\n/** Problems as `file:line message`, each hint on the line below. */\nexport const printProblems = (problems: readonly ConfigProblem[]) => {\n problems.forEach(({ file, line, message, hint }) => {\n const where = line === undefined ? file : `${file}:${line}`;\n out(`${paint(\"red\", \"✗\")} ${paint(\"bold\", where)} ${message}`);\n if (hint) out(` ${paint(\"dim\", hint)}`);\n });\n};\n","import type { Release } from \"../application/config/loadRelease\";\nimport { keysAt } from \"../application/config/unitSchema\";\nimport { paint } from \"../application/say\";\nimport { out } from \"./output\";\n\n/** `shiplane plugins`: the flow's adapters, the modules in release order with their apps, the features. */\nexport const pluginsCommand = (release: Release, { json }: { json: boolean }) => {\n const { flow } = release;\n const ports = {\n sourceControl: flow.sourceControl.name,\n codeHost: flow.codeHost.name,\n ciPipeline: flow.ciPipeline.name,\n versioning: flow.versioning.name,\n };\n const modules = release.modules.map(({ name, kind, provider, settings }) => ({\n name,\n kind,\n provider,\n keys: keysAt(settings, []),\n apps: release.units.filter(({ module }) => module === name).map(({ name: app }) => app),\n }));\n const features = release.features.map(({ name, adapters }) => ({\n name,\n uses: adapters.map((adapter) => adapter.name),\n }));\n if (json) {\n out(JSON.stringify({ flow: ports, modules, features }, null, 2));\n return;\n }\n const width =\n Math.max(\n 14,\n ...modules.map(({ name }) => name.length),\n ...features.map(({ name }) => name.length),\n ) + 2;\n const section = (title: string) => {\n out();\n out(paint(\"bold\", title));\n out();\n };\n section(\"Flow in shiplane.config.ts\");\n Object.entries(ports).forEach(([port, name]) => out(` ${port.padEnd(width)}${name}`));\n section(\"Modules, in release order\");\n modules.forEach(({ name, provider, keys, apps }) => {\n const used = apps.length > 0 ? `used by ${apps.join(\", \")}` : paint(\"dim\", \"no app names it\");\n out(` ${name.padEnd(width)}${provider} ${paint(\"dim\", keys.join(\", \") || \"no options\")}`);\n out(` ${\" \".repeat(width)}${used}`);\n });\n section(\"Features, after the ship\");\n if (features.length === 0) out(` ${paint(\"dim\", \"none\")}`);\n features.forEach(({ name, uses }) =>\n out(` ${name.padEnd(width)}${paint(\"dim\", `uses ${uses.join(\", \")}`)}`),\n );\n out();\n};\n","import type { ReleaseContext } from \"../application/context\";\nimport type { Environment } from \"../domain/environment\";\nimport { readStatus } from \"../application/readStatus\";\nimport { paint } from \"../application/say\";\nimport { environmentLabel } from \"../application/targets\";\nimport { out } from \"./output\";\n\nconst NEXT: Record<string, string> = {\n \"release-pr\": \"open the release PR: shiplane\",\n \"wait-merge\": \"merge the release PR, then: shiplane\",\n ship: \"tag what was versioned and ship it: shiplane\",\n};\n\n/** The next step as a person reads it; a ship with nothing pending anywhere is nothing to do. */\nexport const nextLabel = (\n {\n next,\n units,\n untagged,\n }: {\n next: { step: string };\n units: readonly { pending: boolean }[];\n untagged: readonly unknown[];\n },\n nextChange: string,\n) =>\n next.step === \"ship\" && untagged.length === 0 && !units.some(({ pending }) => pending)\n ? `nothing to release: queue a change with ${nextChange}`\n : (NEXT[next.step] ?? \"\");\n\n/** `shiplane status`: where every unit stands on an environment, and what to run next. Reads only. */\nexport const statusCommand = async (\n context: ReleaseContext,\n { environment, json }: { environment: Environment; json: boolean },\n) => {\n const status = await readStatus(context, environment);\n if (json) {\n out(JSON.stringify(status, null, 2));\n return;\n }\n const dot = paint(\"dim\", \"·\");\n out();\n const label = environmentLabel(context, [], environment);\n out(` ${paint(\"bold\", \"Release status\")} ${dot} ${label}`);\n out();\n const width = Math.max(8, ...status.units.map(({ unit }) => unit.length)) + 2;\n out(\n paint(\n \"dim\",\n ` ${\"Unit\".padEnd(width)}${\"Version\".padEnd(12)}${\"Target\".padEnd(18)}Where it stands`,\n ),\n );\n status.units.forEach(({ unit, version, target, pending, hint }) => {\n const mark = pending ? paint(\"yellow\", \"↑\") : paint(\"dim\", \"·\");\n out(` ${unit.padEnd(width)}${version.padEnd(12)}${target.padEnd(18)}${mark} ${hint}`);\n });\n status.releasePrs.forEach(({ url }) => out(`\\n ${paint(\"cyan\", \"Release PR\")} ${url}`));\n if (status.untagged.length > 0) {\n out(` ${paint(\"yellow\", \"Untagged\")} ${status.untagged.map(({ tag }) => tag).join(\", \")}`);\n }\n out();\n out(\n `${paint([\"bold\", \"green\"], \"→ Next:\")} ${nextLabel(status, context.services.versioning.nextChange)}`,\n );\n out();\n};\n","import { parseArgs } from \"node:util\";\nimport { z } from \"zod\";\n\nimport type { ReleaseContext } from \"../application/context\";\nimport type { ContextIo } from \"./compose\";\nimport { nodeFiles } from \"../adapters/files/node-files.adapter\";\nimport { addUnit, removeUnit } from \"../application/addUnit\";\nimport { branchRelease } from \"../application/branchRelease\";\nimport { docsFor } from \"../application/docsFor\";\nimport { doctor } from \"../application/doctor\";\nimport { doctorCi } from \"../application/doctorCi\";\nimport { initRelease } from \"../application/initRelease\";\nimport { newAdapter } from \"../application/newAdapter\";\nimport { openReleasePr } from \"../application/openReleasePr\";\nimport { pickScope } from \"../application/pickScope\";\nimport { planShips } from \"../application/planShips\";\nimport { prepareRelease } from \"../application/prepareRelease\";\nimport { promote } from \"../application/promote\";\nimport { paint } from \"../application/say\";\nimport { setup } from \"../application/setup\";\nimport { CONFIG_FILE, refreshEditorSchema } from \"../application/setupFiles\";\nimport { shipTo } from \"../application/ship\";\nimport { missingTags, tagRelease } from \"../application/tagRelease\";\nimport { ENVIRONMENTS } from \"../domain/environment\";\nimport { composeContext, composeSetup, loadReleaseOnDisk } from \"./compose\";\nimport { findRoot } from \"./findRoot\";\nimport { out, printProblems } from \"./output\";\nimport { pluginsCommand } from \"./pluginsCommand\";\nimport { statusCommand } from \"./statusCommand\";\n\n/** What `shiplane help` shows: the commands a person runs day to day, and where the rest are. */\nconst SHORT_HELP = `${paint(\"bold\", \"shiplane\")}: detect what changed, version it, trigger each app's deploy.\n\n shiplane the next step to preview: release PR, merge, tags, ship\n shiplane promote production, from what preview runs\n shiplane test-release [channel] publish what the changesets release for testers: a snapshot, or beta, nightly…\n shiplane status where every unit stands, and what to run next\n shiplane setup set up releases, or add an app\n shiplane doctor check the config, tools and sign-ins, offer each fix\n shiplane docs <name> every key a module's or an adapter's unit files take\n\n shiplane help all every command and flag: version, tag, ship, remove and the rest\n`;\n\nconst HELP = `${paint(\"bold\", \"shiplane\")}: detect what changed, version it, trigger each app's deploy.\n\n shiplane the next step to preview: release PR, merge, tags, ship\n (on a branch: a test release, asked first)\n shiplane test-release [channel] publish what the changesets release for testers, npm packages only:\n a snapshot (0.6.0-main.329aafb) or a numbered channel (0.6.0-beta.2)\n shiplane promote production, from what preview runs (--channel production too)\n shiplane status [--json] where every unit stands, and what to run next\n shiplane version open the release PR for what is pending\n shiplane tag tag merged versions and publish their release notes\n shiplane ship [unit...] trigger each tagged unit's deploy, then return\n shiplane plugins [--json] the flow, the modules in release order and who uses each, the features\n\n shiplane setup [--yes] set up, check, or add an app: asks only what it can't tell, rehearses, then writes\n (shiplane init and shiplane add are now setup; both still run for now)\n shiplane remove <unit> stop shipping a unit; it stays versioned\n shiplane doctor check the config, tools and sign-ins, offer each fix\n shiplane doctor --ci [unit...] on a runner: units, --channel, tools (installed when missing), secrets\n shiplane adapter new <name> scaffold a server hosting adapter, its contract test and its module\n shiplane docs <name> every key a module's or an adapter's unit files take\n shiplane help [all] the main commands; all: this, every command and flag\n\n --channel preview|production where status reads (preview by default)\n --via ci|local ship through the CI pipeline (such as GitHub Actions) or this machine, without asking\n --yes answer yes to every question (never on production)\n --dry-run with shiplane, ship or promote: every command it would run, run nothing;\n with test-release: each package's version and npm tag, publish nothing\n (shiplane plan before)\n --verbose / --no-verbose say each thing it reads and runs, with a progress bar (on by default)\n --mascot / --no-mascot the mascot beside it, still in CI or under NO_MOTION=1 (on by default)\n Both defaults live in shiplane.config.ts: display: { verbose, mascot }\n`;\n\n/** The commands `--dry-run` previews instead of running. */\nconst DRY_RUNS = new Set([\"next\", \"ship\", \"promote\"]);\n\n/** --via ci|local; the older --via github still means the CI pipeline, said once. */\nconst viaFlag = (value: string | undefined) => {\n if (value === undefined) return undefined;\n if (value === \"github\") {\n out(paint(\"dim\", \"--via github is now --via ci: the flow's CI pipeline\"));\n return \"ci\" as const;\n }\n return z.enum([\"ci\", \"local\"]).parse(value);\n};\n\n/** The CLI as a person runs it, from its arguments and folder; resolves to its exit code. */\nexport const runCli = async (argv: string[], cwd: string, io: ContextIo = {}): Promise<number> => {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n allowNegative: true,\n options: {\n verbose: { type: \"boolean\" },\n mascot: { type: \"boolean\" },\n \"dry-run\": { type: \"boolean\", default: false },\n json: { type: \"boolean\", default: false },\n yes: { type: \"boolean\", short: \"y\", default: false },\n channel: { type: \"string\", default: \"preview\" },\n via: { type: \"string\" },\n blank: { type: \"boolean\", default: false },\n ci: { type: \"boolean\", default: false },\n },\n });\n\n const [command = \"next\", ...units] = positionals;\n // doctor --ci says an unknown channel itself, with the environments it knows.\n const environment = command === \"doctor\" ? \"preview\" : z.enum(ENVIRONMENTS).parse(values.channel);\n const via = viaFlag(values.via);\n // shiplane test-release [channel] [--dry-run]\n const testRelease = {\n onDefault: \"publish\" as const,\n dryRun: values[\"dry-run\"],\n ...(units[0] === undefined ? {} : { channel: units[0] }),\n };\n\n const commands: Record<string, (context: ReleaseContext) => Promise<boolean | void>> = {\n next: (context) =>\n environment === \"preview\"\n ? branchRelease(context, { onDefault: \"release\" })\n : promote(context, via),\n \"test-release\": (context) => branchRelease(context, testRelease),\n // The command's first name, kept working, left out of the help.\n branch: (context) => branchRelease(context, testRelease),\n promote: (context) => promote(context, via),\n status: (context) => statusCommand(context, { environment, json: values.json }),\n version: async (context) => {\n const picked = await pickScope(context, \"preview\");\n if (!picked || picked.scope.size === 0) return true;\n return (await openReleasePr(context, await prepareRelease(context, picked.scope))) !== null;\n },\n tag: async (context) => tagRelease(context, await missingTags(context)),\n ship: (context) =>\n shipTo(context, environment, { via, ...(units.length > 0 ? { scope: new Set(units) } : {}) }),\n // Deprecated: --dry-run does it. Kept working, left out of the help.\n plan: (context) => {\n out(\n paint(\"dim\", \"plan is now --dry-run: shiplane ship --dry-run, shiplane promote --dry-run\"),\n );\n return planShips(context, environment);\n },\n plugins: (context) => Promise.resolve(pluginsCommand(context.release, { json: values.json })),\n };\n\n const [first = \"\"] = units;\n const setupCommands: Record<\n string,\n (context: Awaited<ReturnType<typeof composeSetup>>) => Promise<boolean>\n > = {\n setup: (context) => setup(context, { yes: values.yes }),\n init: (context) => {\n if (values.blank) return initRelease(context, { yes: values.yes, blank: true });\n out(paint(\"dim\", \"init is now shiplane setup\"));\n return setup(context, { yes: values.yes });\n },\n add: (context) => {\n out(paint(\"dim\", \"add is now shiplane setup: run it again to add an app\"));\n return addUnit(context, first);\n },\n remove: (context) => removeUnit(context, first),\n doctor: (context) =>\n values.ci\n ? doctorCi(context, { units, channel: values.channel })\n : doctor(context, { yes: values.yes }),\n adapter: (context) => {\n if (first === \"new\" && units[1]) return newAdapter(context, units[1]);\n out(`${paint(\"red\", \"✗\")} shiplane adapter new <name>`);\n return Promise.resolve(false);\n },\n docs: (context) => docsFor(context, first),\n };\n\n const root = findRoot(cwd);\n const files = io.setup?.files ?? nodeFiles(root);\n const firstRun = command === \"next\" && !files.exists(CONFIG_FILE);\n // A dry run prints every command a ship would run, the way it would go, and runs none.\n const run =\n values[\"dry-run\"] && DRY_RUNS.has(command)\n ? (context: ReleaseContext) =>\n planShips(context, command === \"promote\" ? \"production\" : environment)\n : commands[command];\n const setUp = setupCommands[firstRun ? \"setup\" : command];\n if (setUp) {\n const load = () => loadReleaseOnDisk(root, { aliases: io.aliases });\n return (await setUp(await composeSetup(root, { load, ...io.setup }))) ? 0 : 1;\n }\n if (command === \"help\") {\n out(first === \"all\" ? HELP : SHORT_HELP);\n return 0;\n }\n if (!run) {\n out(`${paint(\"red\", \"✗\")} no command \"${command}\"`);\n out(HELP);\n return 1;\n }\n const release = await loadReleaseOnDisk(root, { aliases: io.aliases });\n if (release.problems.length > 0) {\n printProblems(release.problems);\n return 2;\n }\n (release.renames ?? []).forEach(({ from, to }) =>\n out(`${paint(\"yellow\", \"!\")} rename ${from} to ${to}: the old name still works for now`),\n );\n refreshEditorSchema(nodeFiles(release.root), release);\n const context = composeContext(\n release,\n { yes: values.yes, display: { verbose: values.verbose, mascot: values.mascot } },\n io,\n );\n return (await run(context)) === false ? 1 : 0;\n};\n","#!/usr/bin/env node\nimport { runCli } from \"./cli/main\";\n\nprocess.exitCode = await runCli(process.argv.slice(2), process.cwd());\n"],"mappings":";;;;;;;;AAYA,MAAa,gBACX;;AAGF,MAAM,eAAe,UACnB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,aAAa,OAAO,YAAY;CAClD,MAAM,UAAU,MAAM,QAAQ,SAAS,CAAC,MAAM,SAAS,KAAK,CAAC;AAC7D,KAAI,QAAQ,SAAS,EACnB,SAAQ,SAAS;EACf,MAAM;EACN,SAAS,kBAAkB,QAAQ,KAAK,KAAK,CAAC,YAAY,MAAM,KAAK,KAAK,CAAC;EAC5E,CAAC;EAEJ;AAEJ,MAAM,oBAAoB,EAAE,KAAK,cAAc,EAC7C,QAAQ,EAAE,YAAY,wBAAwB,OAAO,MAAM,CAAC,KAAK,aAAa,KAAK,KAAK,IACzF,CAAC;;AAGF,MAAM,aAAa,UAAsB,MAAM,OAAO,IAAI,WAAW;;AAGrE,MAAM,UAAU,SAAuB,SACrC,KAAK,QAAQ,mBAAmB,GAAG,SAAiB,QAAQ,MAAM,IAAI,KAAK,IAAI,GAAG;;;;;AAMpF,MAAM,UAAU,OAAO,SAAuB,gBAA6B;CACzE,MAAM,EAAE,OAAO,OAAO,SAAS;CAC/B,MAAM,EAAE,OAAO,SAAS,QAAQ;AAChC,KAAI,CAAC,IAAK,QAAO,GAAG,MAAM;CAC1B,MAAM,EAAE,YAAY;CACpB,MAAM,SAAS,MAAM,MAAM,OAAO,QAAQ,SAAS,QAAQ,MAAM;EAC/D,KAAK,KAAK,KAAK,MAAM,QAAQ,OAAO,GAAG;EACvC,KAAK,QAAQ;EACd,CAAC;AACF,KAAI,WAAW,EAAG,QAAO,GAAG,MAAM,mBAAmB,YAAY,QAAQ,CAAC,eAAe;AACzF,KAAI,IAAI,SAAS,KAAA,GAAW;EAC1B,MAAM,MAAM,OAAO,SAAS,IAA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