shiplane 0.4.0 → 0.4.2

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 (36) hide show
  1. package/README.md +9 -0
  2. package/dist/{budget-CTjB1v-Z.js → budget-BTnKtGF6.js} +9 -28
  3. package/dist/budget-BTnKtGF6.js.map +1 -0
  4. package/dist/cli.js +6 -5
  5. package/dist/cli.js.map +1 -1
  6. package/dist/{index-Cb8R0RIA.d.ts → index-CpQPaO28.d.ts} +4 -7
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +5 -5
  9. package/dist/memory.d.ts +1 -1
  10. package/dist/memory.js +1 -1
  11. package/dist/{package-registry.fake-Ciqc4ujx.js → package-registry.fake-BuiTldHL.js} +7 -7
  12. package/dist/package-registry.fake-BuiTldHL.js.map +1 -0
  13. package/dist/{package-registry.fake-CC37ptzf.d.ts → package-registry.fake-CPAwyGn_.d.ts} +8 -9
  14. package/dist/{perEnv-B7AiYnW_.js → perEnv-n2qFRplP.js} +1 -1
  15. package/dist/{perEnv-B7AiYnW_.js.map → perEnv-n2qFRplP.js.map} +1 -1
  16. package/dist/plugin.d.ts +3 -3
  17. package/dist/plugin.js +6 -6
  18. package/dist/{readStatus-DmT61axf.js → readStatus-BnEVjKc8.js} +490 -111
  19. package/dist/readStatus-BnEVjKc8.js.map +1 -0
  20. package/dist/{shell-server-hosting.adapter-DobfDqFm.js → shell-server-hosting.adapter-C7_5MWrl.js} +4 -3
  21. package/dist/shell-server-hosting.adapter-C7_5MWrl.js.map +1 -0
  22. package/dist/{src-Dqo5lgrW.js → src-DO7WyrfV.js} +3 -3
  23. package/dist/src-DO7WyrfV.js.map +1 -0
  24. package/dist/{static-hosting.port-mknLsxwR.d.ts → static-hosting.port-pfDvRESk.d.ts} +55 -15
  25. package/dist/testing.d.ts +24 -16
  26. package/dist/testing.js +16 -17
  27. package/dist/testing.js.map +1 -1
  28. package/dist/{web-app.module-6KrXIU7j.js → web-app.module-Cg3SYqSo.js} +47 -2
  29. package/dist/web-app.module-Cg3SYqSo.js.map +1 -0
  30. package/package.json +1 -1
  31. package/dist/budget-CTjB1v-Z.js.map +0 -1
  32. package/dist/package-registry.fake-Ciqc4ujx.js.map +0 -1
  33. package/dist/readStatus-DmT61axf.js.map +0 -1
  34. package/dist/shell-server-hosting.adapter-DobfDqFm.js.map +0 -1
  35. package/dist/src-Dqo5lgrW.js.map +0 -1
  36. package/dist/web-app.module-6KrXIU7j.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { t as perEnv } from "./perEnv-B7AiYnW_.js";
1
+ import { t as perEnv } from "./perEnv-n2qFRplP.js";
2
2
  import { z } from "zod";
3
3
  //#region src/adapters/defineDelivery.ts
4
4
  const widen = (port) => port;
5
- const recipe = ({ name, settings, typicalMinutes, decidedBy, detect, questions, requirements, ...port }, capability) => ({
5
+ const recipe = ({ name, settings, typicalMinutes, decidedBy, detect, questions, requirements, env, ...port }, capability) => ({
6
6
  name,
7
7
  capability,
8
8
  settings,
@@ -11,6 +11,7 @@ const recipe = ({ name, settings, typicalMinutes, decidedBy, detect, questions,
11
11
  detect,
12
12
  questions,
13
13
  requirements,
14
+ ...env ? { env } : {},
14
15
  create: () => widen({
15
16
  ...port,
16
17
  capability
@@ -46,4 +47,4 @@ const shellServerHosting = () => defineServerHosting({
46
47
  //#endregion
47
48
  export { defineStaticHosting as a, defineServerHosting as i, defineMobileDistribution as n, definePackageRegistry as r, shellServerHosting as t };
48
49
 
49
- //# sourceMappingURL=shell-server-hosting.adapter-DobfDqFm.js.map
50
+ //# sourceMappingURL=shell-server-hosting.adapter-C7_5MWrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-server-hosting.adapter-C7_5MWrl.js","names":[],"sources":["../src/adapters/defineDelivery.ts","../src/adapters/server-hosting/shell-server-hosting.adapter.ts"],"sourcesContent":["import type { z } from \"zod\";\n\nimport type { DeliveryAdapter } from \"../ports/adapter.port\";\nimport type { Resolved } from \"../ports/delivery.port\";\nimport type { MobileDistributionPort } from \"../ports/mobile-distribution.port\";\nimport type { PackageRegistryPort } from \"../ports/package-registry.port\";\nimport type { ServerHostingPort } from \"../ports/server-hosting.port\";\nimport type { StaticHostingPort } from \"../ports/static-hosting.port\";\n\n/**\n * What an adapter author writes in one object: the recipe's static parts (name, settings, what init\n * and doctor ask) and the port's members, which read the settings typed.\n */\ntype Authored<Port extends { capability: string }, Schema extends z.ZodObject> = Omit<\n Port,\n \"capability\"\n> &\n Omit<DeliveryAdapter<Port>, \"create\" | \"settings\" | \"capability\"> & {\n readonly settings: Schema;\n };\n\ntype Typed<Schema extends z.ZodObject> = Resolved<z.output<Schema>>;\n\n// Its members take the settings its schema parses; the release flow only ever passes those.\nconst widen = <Port>(port: object): Port => port as Port;\n\nconst recipe = <Port extends { capability: string }>(\n {\n name,\n settings,\n typicalMinutes,\n decidedBy,\n detect,\n questions,\n requirements,\n env,\n ...port\n }: Omit<DeliveryAdapter<Port>, \"create\" | \"capability\">,\n capability: Port[\"capability\"],\n): DeliveryAdapter<Port> => ({\n name,\n capability,\n settings,\n typicalMinutes,\n decidedBy,\n detect,\n questions,\n requirements,\n ...(env ? { env } : {}),\n create: () => widen({ ...port, capability }),\n});\n\nexport const defineServerHosting = <const Schema extends z.ZodObject>(\n adapter: Authored<ServerHostingPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<ServerHostingPort> => recipe<ServerHostingPort>(adapter, \"server-hosting\");\n\nexport const defineStaticHosting = <const Schema extends z.ZodObject>(\n adapter: Authored<StaticHostingPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<StaticHostingPort> => recipe<StaticHostingPort>(adapter, \"static-hosting\");\n\nexport const defineMobileDistribution = <const Schema extends z.ZodObject>(\n adapter: Authored<MobileDistributionPort<Typed<Schema>>, Schema> &\n Required<Pick<DeliveryAdapter<MobileDistributionPort>, \"decidedBy\">>,\n): DeliveryAdapter<MobileDistributionPort> =>\n recipe<MobileDistributionPort>(adapter, \"mobile-distribution\");\n\nexport const definePackageRegistry = <const Schema extends z.ZodObject>(\n adapter: Authored<PackageRegistryPort<Typed<Schema>>, Schema>,\n): DeliveryAdapter<PackageRegistryPort> => recipe<PackageRegistryPort>(adapter, \"package-registry\");\n","import { z } from \"zod\";\n\nimport type { DeliveryAdapter } from \"../../ports/adapter.port\";\nimport type { ServerHostingPort } from \"../../ports/server-hosting.port\";\nimport { perEnv } from \"../../application/config/perEnv\";\nimport { defineServerHosting } from \"../defineDelivery\";\n\nconst ShellOptions = z.object({\n deploy: perEnv(z.array(z.string()).min(1)).describe(\n \"The command that ships it, run from the root, as a list: [npx, my-tool, deploy]\",\n ),\n url: perEnv(z.string()).optional().describe(\"Where it answers, for other units to read\"),\n});\n\n/** Anything a command ships: the escape hatch until a host has its own adapter. */\nexport type ShellServerHostingAdapter = DeliveryAdapter<ServerHostingPort>;\n\nexport const shellServerHosting = (): ShellServerHostingAdapter =>\n defineServerHosting({\n name: \"shell\",\n settings: ShellOptions,\n describe: ({ options }) => options.deploy.join(\" \"),\n jobs: ({ tag, environment, options }) => {\n const [command = \"true\", ...args] = options.deploy;\n return [\n {\n label: `ship ${tag}: ${options.deploy.join(\" \")}`,\n local: [{ command, args }],\n ci: { ref: tag },\n record: true,\n },\n ];\n },\n });\n"],"mappings":";;;AAwBA,MAAM,SAAe,SAAuB;AAE5C,MAAM,UACJ,EACE,MACA,UACA,gBACA,WACA,QACA,WACA,cACA,KACA,GAAG,QAEL,gBAC2B;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAI,MAAM,EAAE,KAAK,GAAG,EAAE;CACtB,cAAc,MAAM;EAAE,GAAG;EAAM;EAAY,CAAC;CAC7C;AAED,MAAa,uBACX,YACuC,OAA0B,SAAS,iBAAiB;AAE7F,MAAa,uBACX,YACuC,OAA0B,SAAS,iBAAiB;AAE7F,MAAa,4BACX,YAGA,OAA+B,SAAS,sBAAsB;AAEhE,MAAa,yBACX,YACyC,OAA4B,SAAS,mBAAmB;;;AC7DnG,MAAM,eAAe,EAAE,OAAO;CAC5B,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SACzC,kFACD;CACD,KAAK,OAAO,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,SAAS,4CAA4C;CACzF,CAAC;AAKF,MAAa,2BACX,oBAAoB;CAClB,MAAM;CACN,UAAU;CACV,WAAW,EAAE,cAAc,QAAQ,OAAO,KAAK,IAAI;CACnD,OAAO,EAAE,KAAK,aAAa,cAAc;EACvC,MAAM,CAAC,UAAU,QAAQ,GAAG,QAAQ,QAAQ;AAC5C,SAAO,CACL;GACE,OAAO,QAAQ,IAAI,IAAI,QAAQ,OAAO,KAAK,IAAI;GAC/C,OAAO,CAAC;IAAE;IAAS;IAAM,CAAC;GAC1B,IAAI,EAAE,KAAK,KAAK;GAChB,QAAQ;GACT,CACF;;CAEJ,CAAC"}
@@ -1,5 +1,5 @@
1
- import "./perEnv-B7AiYnW_.js";
2
- import "./shell-server-hosting.adapter-DobfDqFm.js";
1
+ import "./perEnv-n2qFRplP.js";
2
+ import "./shell-server-hosting.adapter-C7_5MWrl.js";
3
3
  import { z, z as z$1 } from "zod";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
@@ -111,4 +111,4 @@ const internalTool = ({ name = "internal-tool" } = {}) => ({
111
111
  //#endregion
112
112
  export { defineRelease as i, internalTool as n, agentPlugin as r, z$1 as t };
113
113
 
114
- //# sourceMappingURL=src-Dqo5lgrW.js.map
114
+ //# sourceMappingURL=src-DO7WyrfV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-DO7WyrfV.js","names":[],"sources":["../src/application/config/defineRelease.ts","../src/modules/agent-plugin/agent-plugin.module.ts","../src/modules/internal-tool/internal-tool.module.ts"],"sourcesContent":["import type { DisplayChoice } from \"../../domain/display\";\nimport type { TagFormatName } from \"../../domain/tags\";\nimport type { Feature, ReleaseFlow, ReleaseModule } from \"../../modules/module\";\n\n/** How a repository releases: the flow, what gets released in order, and what happens around it. */\nexport interface ReleaseConfig {\n /** Folders to look in, `dir/*` or exact. Without it, the workspace file decides. */\n units?: string[];\n /** How the release itself runs: an adapter per port, each from its plugin. */\n flow: ReleaseFlow;\n /** What gets released, in this order. The first app is the repository's Latest release. */\n modules: ReleaseModule[];\n /** What happens around a release, after the ship, in this order. */\n features?: Feature[];\n /**\n * How a tag names a version: `\"package\"` (`{name}@{version}`, the default), `\"plugin\"` (`{name}--v{version}`), `\"single\"` (`v{version}`, one unit only), `\"module\"` (`{name}/v{version}`), or a format of your own.\n */\n tag?: TagFormatName | (string & {});\n /** How much the release says while it runs; `--verbose` and `--mascot` (or `--no-…`) override. */\n display?: DisplayChoice;\n}\n\nexport const defineRelease = (config: ReleaseConfig): ReleaseConfig => config;\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\n\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\n\n/**\n * Where each agent reads a plugin's version, relative to the plugin's folder: Claude Code and\n * Copilot CLI, Codex, Cursor, then Gemini CLI.\n */\nexport const AGENT_MANIFESTS = [\n \".claude-plugin/plugin.json\",\n \".codex-plugin/plugin.json\",\n \".cursor-plugin/plugin.json\",\n \"gemini-extension.json\",\n] as const;\n\nconst Versioned = z.object({ version: z.string() });\n\n/** A manifest's version, or null when the file is missing or holds no top-level version. */\nconst versionIn = (file: string) => {\n if (!fs.existsSync(file)) return null;\n const parsed = Versioned.safeParse(JSON.parse(fs.readFileSync(file, \"utf8\")));\n return parsed.success ? parsed.data.version : null;\n};\n\nconst literal = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/** Moves only the version's value, so the release PR shows one changed line per manifest. */\nconst setVersion = (file: string, from: string, to: string) => {\n const text = fs.readFileSync(file, \"utf8\");\n const moved = text.replace(\n new RegExp(`(\"version\"\\\\s*:\\\\s*)\"${literal(from)}\"`),\n `$1${JSON.stringify(to)}`,\n );\n // The first such value may sit under another key: then the file is written whole instead.\n const top = Versioned.safeParse(JSON.parse(moved));\n const json = JSON.parse(text) as Record<string, unknown>;\n fs.writeFileSync(\n file,\n top.success && top.data.version === to\n ? moved\n : `${JSON.stringify({ ...json, version: to }, null, 2)}\\n`,\n );\n};\n\n/**\n * A plugin for coding agents, such as a Claude Code, Codex or Cursor plugin: a release versions it,\n * writes the version into each agent's manifest in the release PR, tags it and publishes its notes.\n * Nothing deploys it: agents install it from the repository, so merging the release PR ships it.\n */\nexport const agentPlugin = ({ name = \"agent-plugin\" }: Named = {}): ReleaseModule => ({\n type: \"module\",\n name,\n kind: \"agent-plugin\",\n provider: \"marketplace\",\n settings: z.object({}),\n adapters: [],\n releaseOnly: true,\n version: ({ root }, { unit, bump }) => {\n if (!bump) return Promise.resolve({ added: [], writes: [], summary: [], onMerge: \"\" });\n const manifests = AGENT_MANIFESTS.map((file) => path.posix.join(unit.dir, file)).flatMap(\n (file) => {\n const from = versionIn(path.join(root, file));\n return from === null ? [] : [{ file, from }];\n },\n );\n return Promise.resolve({\n added: [],\n writes: manifests.map(({ file, from }) => ({\n label: `${file} → ${bump.to}`,\n run: () => {\n setVersion(path.join(root, file), from, bump.to);\n return Promise.resolve();\n },\n })),\n summary: [],\n onMerge: \"Agents update to it: merging ships it\",\n });\n },\n ship: () => ({\n where: \"its tag and release notes; agents install it from the repository\",\n jobs: [],\n }),\n decide: () =>\n Promise.resolve({ action: \"none\", status: \"released, agents install it from the repository\" }),\n});\n","import { z } from \"zod\";\n\nimport type { Named } from \"../deliveryModule\";\nimport type { ReleaseModule } from \"../module\";\n\n/**\n * An app nothing deploys, such as a CLI run from the repository: a release versions it, tags it and\n * publishes its notes, and every environment counts it as shipped once tagged.\n */\nexport const internalTool = ({ name = \"internal-tool\" }: Named = {}): ReleaseModule => ({\n type: \"module\",\n name,\n kind: \"internal-tool\",\n // What output named it before modules: the release PR and status keep saying it.\n provider: \"release-only\",\n settings: z.object({}),\n adapters: [],\n releaseOnly: true,\n ship: () => ({ where: \"its tag and release notes, nothing deploys it\", jobs: [] }),\n decide: () => Promise.resolve({ action: \"none\", status: \"released, nothing deploys it\" }),\n});\n"],"mappings":";;;;;;AAsBA,MAAa,iBAAiB,WAAyC;;;;;;;ACXvE,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACD;AAED,MAAM,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;;AAGnD,MAAM,aAAa,SAAiB;AAClC,KAAI,CAAC,GAAG,WAAW,KAAK,CAAE,QAAO;CACjC,MAAM,SAAS,UAAU,UAAU,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAC,CAAC;AAC7E,QAAO,OAAO,UAAU,OAAO,KAAK,UAAU;;AAGhD,MAAM,WAAW,SAAiB,KAAK,QAAQ,uBAAuB,OAAO;;AAG7E,MAAM,cAAc,MAAc,MAAc,OAAe;CAC7D,MAAM,OAAO,GAAG,aAAa,MAAM,OAAO;CAC1C,MAAM,QAAQ,KAAK,QACjB,IAAI,OAAO,wBAAwB,QAAQ,KAAK,CAAC,GAAG,EACpD,KAAK,KAAK,UAAU,GAAG,GACxB;CAED,MAAM,MAAM,UAAU,UAAU,KAAK,MAAM,MAAM,CAAC;CAClD,MAAM,OAAO,KAAK,MAAM,KAAK;AAC7B,IAAG,cACD,MACA,IAAI,WAAW,IAAI,KAAK,YAAY,KAChC,QACA,GAAG,KAAK,UAAU;EAAE,GAAG;EAAM,SAAS;EAAI,EAAE,MAAM,EAAE,CAAC,IAC1D;;;;;;;AAQH,MAAa,eAAe,EAAE,OAAO,mBAA0B,EAAE,MAAqB;CACpF,MAAM;CACN;CACA,MAAM;CACN,UAAU;CACV,UAAU,EAAE,OAAO,EAAE,CAAC;CACtB,UAAU,EAAE;CACZ,aAAa;CACb,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW;AACrC,MAAI,CAAC,KAAM,QAAO,QAAQ,QAAQ;GAAE,OAAO,EAAE;GAAE,QAAQ,EAAE;GAAE,SAAS,EAAE;GAAE,SAAS;GAAI,CAAC;EACtF,MAAM,YAAY,gBAAgB,KAAK,SAAS,KAAK,MAAM,KAAK,KAAK,KAAK,KAAK,CAAC,CAAC,SAC9E,SAAS;GACR,MAAM,OAAO,UAAU,KAAK,KAAK,MAAM,KAAK,CAAC;AAC7C,UAAO,SAAS,OAAO,EAAE,GAAG,CAAC;IAAE;IAAM;IAAM,CAAC;IAE/C;AACD,SAAO,QAAQ,QAAQ;GACrB,OAAO,EAAE;GACT,QAAQ,UAAU,KAAK,EAAE,MAAM,YAAY;IACzC,OAAO,GAAG,KAAK,KAAK,KAAK;IACzB,WAAW;AACT,gBAAW,KAAK,KAAK,MAAM,KAAK,EAAE,MAAM,KAAK,GAAG;AAChD,YAAO,QAAQ,SAAS;;IAE3B,EAAE;GACH,SAAS,EAAE;GACX,SAAS;GACV,CAAC;;CAEJ,aAAa;EACX,OAAO;EACP,MAAM,EAAE;EACT;CACD,cACE,QAAQ,QAAQ;EAAE,QAAQ;EAAQ,QAAQ;EAAmD,CAAC;CACjG;;;;;;;AC9ED,MAAa,gBAAgB,EAAE,OAAO,oBAA2B,EAAE,MAAqB;CACtF,MAAM;CACN;CACA,MAAM;CAEN,UAAU;CACV,UAAU,EAAE,OAAO,EAAE,CAAC;CACtB,UAAU,EAAE;CACZ,aAAa;CACb,aAAa;EAAE,OAAO;EAAiD,MAAM,EAAE;EAAE;CACjF,cAAc,QAAQ,QAAQ;EAAE,QAAQ;EAAQ,QAAQ;EAAgC,CAAC;CAC1F"}
@@ -33,6 +33,26 @@ interface DisplayChoice {
33
33
  mascot?: boolean | Mascot;
34
34
  }
35
35
  //#endregion
36
+ //#region src/domain/checkEnvBeforeDeploy.d.ts
37
+ /** A name an app reads from its environment, as platforms store it: `SENTRY_DSN`. */
38
+ type EnvVarName = string & {
39
+ readonly brand: "EnvVarName";
40
+ };
41
+ declare const isEnvVarName: (text: string) => text is EnvVarName;
42
+ /** As a unit file writes it: one list for every environment, or `all` plus a list per environment. */
43
+ type EnvToCheckInput = readonly EnvVarName[] | ({
44
+ all?: readonly EnvVarName[];
45
+ } & Partial<Record<Environment, readonly EnvVarName[]>>);
46
+ /** The names a deploy checks on the platform before it ships, per environment. */
47
+ declare class EnvToCheck {
48
+ #private;
49
+ constructor(input: EnvToCheckInput);
50
+ /** `all`, then that environment's own names. */
51
+ for(environment: Environment): ReadonlySet<EnvVarName>;
52
+ /** Names in `all` that an environment lists again. */
53
+ listedTwice(): EnvVarName[];
54
+ }
55
+ //#endregion
36
56
  //#region src/domain/unit.d.ts
37
57
  /** Something with a version that ships somewhere: an app, a published package, this CLI. */
38
58
  interface ReleaseUnit {
@@ -48,12 +68,32 @@ interface ReleaseUnit {
48
68
  module: string;
49
69
  /** Its `buildCommand:`, when its unit file says one; else its package.json "build" script. */
50
70
  buildCommand?: string;
71
+ /** Its `checkEnvBeforeDeploy:`, when its unit file lists one. */
72
+ checkEnvBeforeDeploy?: EnvToCheck;
51
73
  /** As written: per-environment maps and references are resolved by `optionsFor`. */
52
74
  options: Record<string, unknown>;
53
75
  /** Units whose values it reads: they are dispatched before it. */
54
76
  after: string[];
55
77
  }
56
78
  //#endregion
79
+ //#region src/ports/platform-env.port.d.ts
80
+ /** Where an app's env lives on its platform, read by name only: values are never read or written. */
81
+ interface PlatformEnvPort {
82
+ /** Every env var name the platform holds for this app on this environment. */
83
+ listNames: (input: {
84
+ unit: ReleaseUnit;
85
+ environment: Environment; /** The unit's settings for that environment, as its jobs receive them. */
86
+ options: Record<string, unknown>;
87
+ }) => Promise<ReadonlySet<EnvVarName>>;
88
+ /** The command a person runs to set these names, with `...` where each value goes. */
89
+ setCommand: (input: {
90
+ unit: ReleaseUnit;
91
+ environment: Environment;
92
+ options: Record<string, unknown>;
93
+ names: readonly EnvVarName[];
94
+ }) => string;
95
+ }
96
+ //#endregion
57
97
  //#region src/domain/changes.d.ts
58
98
  /** A unit as changesets know it: its name here, its package name there. */
59
99
  interface UnitRef {
@@ -61,6 +101,8 @@ interface UnitRef {
61
101
  packageName: string;
62
102
  }
63
103
  type BumpType = "major" | "minor" | "patch" | "none";
104
+ /** A bump that moves a version. */
105
+ type BumpLevel = Exclude<BumpType, "none">;
64
106
  /** One changeset, as `changeset status --output` lists it. */
65
107
  interface PlannedChangeset {
66
108
  id: string;
@@ -106,13 +148,6 @@ declare const splitChangesets: (changesets: PlannedChangeset[], held: readonly s
106
148
  ships: PlannedChangeset[];
107
149
  waits: PlannedChangeset[];
108
150
  };
109
- interface UnreleasedApp {
110
- /** The unit's name. */
111
- app: string;
112
- version: string;
113
- /** Subjects of the commits that touched it since its current version, newest first. */
114
- commits: string[];
115
- }
116
151
  //#endregion
117
152
  //#region src/domain/releasePr.d.ts
118
153
  interface OpenPr {
@@ -310,8 +345,6 @@ interface SourceControlPort {
310
345
  sha: string;
311
346
  subject: string;
312
347
  } | null>;
313
- /** Subjects of the commits that touched a folder since a commit, newest first, `ignore` aside. */
314
- subjectsSince: (sha: string, dir: string, ignore?: readonly string[]) => Promise<string[]>;
315
348
  /** The commits after `from` up to `to`, newest first: each subject and the files it touched. */
316
349
  commitsBetween: (from: string, to: string) => Promise<{
317
350
  subject: string;
@@ -607,20 +640,27 @@ interface DeliveryAdapter<Port extends {
607
640
  readonly questions?: (folder: FolderView, found: Record<string, unknown>, repository: string) => Question[];
608
641
  /** Tools and sign-ins it needs for an app. */
609
642
  readonly requirements?: (unit: ReleaseUnit) => Requirement[];
643
+ /** Lists the env var names its platform holds, for `checkEnvBeforeDeploy`. */
644
+ readonly env?: (context: AdapterContext) => PlatformEnvPort;
610
645
  }
611
646
  //#endregion
612
647
  //#region src/ports/versioning.port.d.ts
613
648
  /** The intent to release: changesets today. */
614
649
  interface VersioningPort {
650
+ /** What a person does to queue a release, as they read it: "pnpm changeset". */
651
+ readonly nextChange: string;
615
652
  /** Pending change files, by id, with their raw text. */
616
653
  pending: () => Promise<{
617
654
  id: string;
618
655
  text: string;
619
656
  }[]>;
620
- /** What versioning would move, with these added and the `waits` held back, writing nothing. */
621
- plan: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<StatusPlan>;
622
- /** Writes `added`, versions everything but `held`, and leaves `held` pending. */
623
- apply: (added: PlannedChangeset[], held: PlannedChangeset[]) => Promise<void>;
657
+ /**
658
+ * What versioning would move, with these added and the `waits` held back, writing nothing. With
659
+ * a `ceiling`, nothing moves by more than that level, whatever a change says.
660
+ */
661
+ plan: (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => Promise<StatusPlan>;
662
+ /** Writes `added`, versions everything but `held` up to `ceiling`, and leaves `held` pending. */
663
+ apply: (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => Promise<void>;
624
664
  /** Adds one pending changeset, as a person would with `pnpm changeset`. */
625
665
  write: (changeset: PlannedChangeset) => Promise<void>;
626
666
  /** Each workspace package's runtime workspace dependencies, by package name. */
@@ -680,5 +720,5 @@ interface StaticHostingPort<Options = Record<string, unknown>> extends Delivery<
680
720
  readonly capability: "static-hosting";
681
721
  }
682
722
  //#endregion
683
- export { OpenPr as $, releaseSource as A, LinkedPr as B, Clock as C, StepPlace as D, Prompter as E, ShellResult as F, DeployPath as G, ActionsMinutes as H, CiPipelinePort as I, onlyVersionFiles as J, deployRunTitle as K, CodeHostPort as L, CommandFailed as M, RunOptions as N, SourceControlPort as O, Shell as P, MergeMethods as Q, Deploy as R, Choice as S, Progress as T, actionsMinutes as U, issueName as V, billedMinutes as W, Approval as X, DecidedBy as Y, MergeMethod as Z, Refusal as _, VersioningPort as a, UnreleasedApp as at, VersionChoice as b, DeliveryAdapter as c, ReleaseUnit as ct, DecideContext as d, MascotMoment as dt, ReleaseStep as et, Decision as f, Mood as ft, JobInput as g, Job as h, MobileDistributionPort as i, UnitRef as it, yesAllowed as j, GitPosition as k, ServiceAdapter as l, DisplayChoice as lt, Health as m, Environment as mt, ServerHostingPort as n, PlannedChangeset as nt, Adapter as o, appBumps as ot, Delivery as p, progressBar as pt, deployState as q, PackageRegistryPort as r, StatusPlan as rt, AdapterContext as s, splitChangesets as st, StaticHostingPort as t, AppBump as tt, Command as u, Mascot as ut, Requirement as v, Output as w, VersionContribution as x, Resolved as y, IssueRef as z };
684
- //# sourceMappingURL=static-hosting.port-mknLsxwR.d.ts.map
723
+ export { OpenPr as $, releaseSource as A, LinkedPr as B, Clock as C, StepPlace as D, Prompter as E, ShellResult as F, DeployPath as G, ActionsMinutes as H, CiPipelinePort as I, onlyVersionFiles as J, deployRunTitle as K, CodeHostPort as L, CommandFailed as M, RunOptions as N, SourceControlPort as O, Shell as P, MergeMethods as Q, Deploy as R, Choice as S, Progress as T, actionsMinutes as U, issueName as V, billedMinutes as W, Approval as X, DecidedBy as Y, MergeMethod as Z, Refusal as _, Environment as _t, VersioningPort as a, UnitRef as at, VersionChoice as b, DeliveryAdapter as c, PlatformEnvPort as ct, DecideContext as d, isEnvVarName as dt, ReleaseStep as et, Decision as f, DisplayChoice as ft, JobInput as g, progressBar as gt, Job as h, Mood as ht, MobileDistributionPort as i, StatusPlan as it, yesAllowed as j, GitPosition as k, ServiceAdapter as l, ReleaseUnit as lt, Health as m, MascotMoment as mt, ServerHostingPort as n, BumpLevel as nt, Adapter as o, appBumps as ot, Delivery as p, Mascot as pt, deployState as q, PackageRegistryPort as r, PlannedChangeset as rt, AdapterContext as s, splitChangesets as st, StaticHostingPort as t, AppBump as tt, Command as u, EnvVarName as ut, Requirement as v, Output as w, VersionContribution as x, Resolved as y, IssueRef as z };
724
+ //# sourceMappingURL=static-hosting.port-pfDvRESk.d.ts.map
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as OpenPr, C as Clock, D as StepPlace, E as Prompter, F as ShellResult, G as DeployPath, I as CiPipelinePort, L as CodeHostPort, N as RunOptions, O as SourceControlPort, P as Shell, S as Choice, T as Progress, X as Approval, a as VersioningPort, at as UnreleasedApp, c as DeliveryAdapter, ct as ReleaseUnit, et as ReleaseStep, ft as Mood, i as MobileDistributionPort, it as UnitRef, l as ServiceAdapter, lt as DisplayChoice, mt as Environment, n as ServerHostingPort, nt as PlannedChangeset, p as Delivery, r as PackageRegistryPort, rt as StatusPlan, st as splitChangesets, t as StaticHostingPort, tt as AppBump, w as Output, x as VersionContribution, z as IssueRef } from "./static-hosting.port-mknLsxwR.js";
2
- import { _ as Feature, b as ReleaseFlow, w as ReleaseTag, x as ReleaseModule, y as Open } from "./index-Cb8R0RIA.js";
3
- import { a as VersioningFake, c as ciPipelineFake, d as codeHostFake, f as SourceControlFake, i as serverHostingFake, l as CodeHostFake, n as mobileDistributionFake, o as versioningFake, p as sourceControlFake, r as staticHostingFake, s as CiPipelineFake, t as packageRegistryFake, u as HostEvent } from "./package-registry.fake-CC37ptzf.js";
1
+ import { $ as OpenPr, C as Clock, D as StepPlace, E as Prompter, F as ShellResult, G as DeployPath, I as CiPipelinePort, L as CodeHostPort, N as RunOptions, O as SourceControlPort, P as Shell, S as Choice, T as Progress, X as Approval, _t as Environment, a as VersioningPort, at as UnitRef, c as DeliveryAdapter, et as ReleaseStep, ft as DisplayChoice, ht as Mood, i as MobileDistributionPort, it as StatusPlan, l as ServiceAdapter, lt as ReleaseUnit, n as ServerHostingPort, nt as BumpLevel, p as Delivery, r as PackageRegistryPort, rt as PlannedChangeset, st as splitChangesets, t as StaticHostingPort, tt as AppBump, w as Output, x as VersionContribution, z as IssueRef } from "./static-hosting.port-pfDvRESk.js";
2
+ import { _ as Feature, b as ReleaseFlow, w as ReleaseTag, x as ReleaseModule, y as Open } from "./index-CpQPaO28.js";
3
+ import { a as VersioningFake, c as ciPipelineFake, d as codeHostFake, f as SourceControlFake, i as serverHostingFake, l as CodeHostFake, n as mobileDistributionFake, o as versioningFake, p as sourceControlFake, r as staticHostingFake, s as CiPipelineFake, t as packageRegistryFake, u as HostEvent } from "./package-registry.fake-CPAwyGn_.js";
4
4
  import { z } from "zod";
5
5
  import * as _$vitest from "vitest";
6
6
 
@@ -195,8 +195,6 @@ interface Release {
195
195
  problems: ConfigProblem[];
196
196
  /** How a tag names a version, such as `{name}@{version}`. */
197
197
  tagFormat: string;
198
- /** Commits no changeset names release their unit, with a changelog from them. */
199
- releasesCommits?: boolean;
200
198
  /** How much the release says while it runs, as the config asks. */
201
199
  display?: DisplayChoice;
202
200
  /** Files still under their name from before shiplane. */
@@ -315,15 +313,26 @@ interface Companion {
315
313
  why: string;
316
314
  }
317
315
  //#endregion
316
+ //#region src/domain/versionChoice.d.ts
317
+ /** A version a person chose over the computed one. */
318
+ interface ForcedVersion {
319
+ /** Nothing in the release ships above it. */
320
+ level: BumpLevel;
321
+ /** Moves the release up to that level, and carries why into its notes. */
322
+ changeset: PlannedChangeset;
323
+ }
324
+ //#endregion
318
325
  //#region src/application/prepareRelease.d.ts
319
326
  type Split = ReturnType<typeof splitChangesets>;
320
327
  interface Prepared {
328
+ /** The units the person picked. */
329
+ scope: ReadonlySet<string>;
330
+ /** The version the person chose over the computed one, when they did. */
331
+ forced?: ForcedVersion;
321
332
  /** Changesets this release ships, the ones it writes included. */
322
333
  pending: number;
323
334
  /** Units the person left out: their changesets stay pending. */
324
335
  held: string[];
325
- /** Changed units the person left out: no changeset ships them. */
326
- unreleased: UnreleasedApp[];
327
336
  split: Split;
328
337
  bumps: AppBump[];
329
338
  /** Units the person did not pick that move anyway, with the package that drags each. */
@@ -338,7 +347,7 @@ interface Prepared {
338
347
  contributions: Record<string, VersionContribution>;
339
348
  }
340
349
  /** What a release PR covering `scope` would version, computed without writing anything. */
341
- declare const prepareRelease: (context: ReleaseContext, scope: ReadonlySet<string>, known?: Readonly<Record<string, VersionContribution>>) => Promise<Prepared>;
350
+ declare const prepareRelease: (context: ReleaseContext, scope: ReadonlySet<string>, known?: Readonly<Record<string, VersionContribution>>, forced?: ForcedVersion) => Promise<Prepared>;
342
351
  //#endregion
343
352
  //#region src/application/openReleasePr.d.ts
344
353
  /**
@@ -369,7 +378,6 @@ interface UnitStatus {
369
378
  tag: string;
370
379
  tagged: boolean;
371
380
  changesets: number;
372
- commits: number;
373
381
  /** Something to release to this environment. */
374
382
  pending: boolean;
375
383
  hint: string;
@@ -421,10 +429,12 @@ declare const refreshEditorSchema: (files: Files, release: Release) => boolean;
421
429
  */
422
430
  declare const shipTo: (context: ReleaseContext, environment: Environment, {
423
431
  scope,
424
- via
432
+ via,
433
+ envChecked
425
434
  }: {
426
435
  scope?: ReadonlySet<string>;
427
- via?: DeployPath;
436
+ via?: DeployPath; /** Units whose env this run already checked on this environment. */
437
+ envChecked?: ReadonlySet<string>;
428
438
  }) => Promise<boolean>;
429
439
  //#endregion
430
440
  //#region src/testing/sample.d.ts
@@ -447,9 +457,9 @@ declare const inSandbox: (args: string[]) => string;
447
457
  //#region src/testing/plans.d.ts
448
458
  /**
449
459
  * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus
450
- * the lines it holds back: every named package moves once, by its biggest bump.
460
+ * the lines it holds back: every named package moves once, by its biggest bump, up to `ceiling`.
451
461
  */
452
- declare const planFrom: (pending: PlannedChangeset[], versions: Record<string, string>) => (added: PlannedChangeset[], held: PlannedChangeset[]) => StatusPlan;
462
+ declare const planFrom: (pending: PlannedChangeset[], versions: Record<string, string>) => (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => StatusPlan;
453
463
  //#endregion
454
464
  //#region src/adapters/terminal/__fakes__/progress.fake.d.ts
455
465
  interface ProgressEvent {
@@ -489,7 +499,6 @@ declare const testContext: ({
489
499
  interactive,
490
500
  root,
491
501
  tagFormat,
492
- commitsWithoutChangeset,
493
502
  approval
494
503
  }: {
495
504
  units: ReleaseUnit[];
@@ -498,8 +507,7 @@ declare const testContext: ({
498
507
  yes?: boolean;
499
508
  interactive?: boolean;
500
509
  root?: string;
501
- tagFormat?: string; /** A release skips commits no changeset names; the config default ignores them. */
502
- commitsWithoutChangeset?: "release" | "ignore"; /** Whether someone else approves the release PR; the config default when absent. */
510
+ tagFormat?: string; /** Whether someone else approves the release PR; the config default when absent. */
503
511
  approval?: Approval;
504
512
  }) => {
505
513
  context: ReleaseContext;
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as releaseFlow } from "./web-app.module-6KrXIU7j.js";
2
- import { C as refreshEditorSchema, D as nodeFiles, T as ENVIRONMENTS, _ as loadRelease, a as releaseToPreview, b as initRelease, c as promote, f as openReleasePr, h as docsFor, i as setup, l as shipTo, m as newAdapter, n as systemShell, p as prepareRelease, t as readStatus, u as planShips, v as addUnit, w as optionsFor, x as doctor, y as removeUnit } from "./readStatus-DmT61axf.js";
3
- import { v as nextPatch, x as DEFAULT_TAG_FORMAT } from "./budget-CTjB1v-Z.js";
4
- import { a as versioningFake, c as sourceControlFake, i as serverHostingFake, n as mobileDistributionFake, o as ciPipelineFake, r as staticHostingFake, s as codeHostFake, t as packageRegistryFake } from "./package-registry.fake-Ciqc4ujx.js";
1
+ import { a as releaseFlow } from "./web-app.module-Cg3SYqSo.js";
2
+ import { C as refreshEditorSchema, E as ENVIRONMENTS, O as nodeFiles, T as optionsFor, _ as loadRelease, a as releaseToPreview, b as initRelease, c as promote, f as openReleasePr, h as docsFor, i as setup, l as shipTo, m as newAdapter, n as systemShell, p as prepareRelease, t as readStatus, u as planShips, v as addUnit, x as doctor, y as removeUnit } from "./readStatus-BnEVjKc8.js";
3
+ import { _ as nextVersion, b as DEFAULT_TAG_FORMAT } from "./budget-BTnKtGF6.js";
4
+ import { a as versioningFake, c as sourceControlFake, i as serverHostingFake, n as mobileDistributionFake, o as ciPipelineFake, r as staticHostingFake, s as codeHostFake, t as packageRegistryFake } from "./package-registry.fake-BuiTldHL.js";
5
5
  import { z } from "zod";
6
6
  import fs from "node:fs";
7
7
  import path from "node:path";
@@ -172,7 +172,7 @@ const testUnit = (name, overrides = {}) => ({
172
172
  * A release over a Fake of every port the flow runs on, answered by a scripted person. The apps are
173
173
  * in release order as given: the first is the Latest release.
174
174
  */
175
- const testContext = ({ units, modules = [], features = [], yes = false, interactive = true, root = "/repo", tagFormat = DEFAULT_TAG_FORMAT, commitsWithoutChangeset = "release", approval }) => {
175
+ const testContext = ({ units, modules = [], features = [], yes = false, interactive = true, root = "/repo", tagFormat = DEFAULT_TAG_FORMAT, approval }) => {
176
176
  const sourceControl = sourceControlFake();
177
177
  const codeHost = codeHostFake();
178
178
  const ciPipeline = ciPipelineFake();
@@ -197,8 +197,7 @@ const testContext = ({ units, modules = [], features = [], yes = false, interact
197
197
  features: typeof features === "function" ? features(fakes) : features,
198
198
  units,
199
199
  problems: [],
200
- tagFormat,
201
- releasesCommits: commitsWithoutChangeset === "release"
200
+ tagFormat
202
201
  };
203
202
  return {
204
203
  context: {
@@ -467,6 +466,10 @@ const versioningContract = (name, subject) => describe(`${name}, as versioning`,
467
466
  expect(pending.map(({ id }) => id)).toContain("contract-change");
468
467
  expect(pending.find(({ id }) => id === "contract-change")?.text).toContain(`"${workspace.name}": minor`);
469
468
  });
469
+ it("given a person with nothing queued, when they are told what to do, then the port says it", async () => {
470
+ const { port } = await subject();
471
+ expect(port.nextChange).not.toBe("");
472
+ });
470
473
  it("given a workspace package, when the folders are read, then it is found in its folder", async () => {
471
474
  const { port, workspace } = await subject();
472
475
  expect(await port.folders()).toMatchObject({ [workspace.name]: workspace.folder });
@@ -511,17 +514,11 @@ const inSandbox = (args) => execFileSync("git", args, {
511
514
  }).trim();
512
515
  //#endregion
513
516
  //#region src/testing/plans.ts
514
- const bump = (version, type) => {
515
- const [major = 0, minor = 0] = version.split(".").map(Number);
516
- if (type === "major") return `${major + 1}.0.0`;
517
- if (type === "minor") return `${major}.${minor + 1}.0`;
518
- return nextPatch(version);
519
- };
520
517
  /**
521
518
  * What `changeset status` answers for these pending changesets, plus the ones a release adds, minus
522
- * the lines it holds back: every named package moves once, by its biggest bump.
519
+ * the lines it holds back: every named package moves once, by its biggest bump, up to `ceiling`.
523
520
  */
524
- const planFrom = (pending, versions) => (added, held) => {
521
+ const planFrom = (pending, versions) => (added, held, ceiling) => {
525
522
  const heldLines = new Set(held.flatMap(({ id, releases }) => releases.map(({ name }) => `${id}:${name}`)));
526
523
  const changesets = [...pending, ...added].map((changeset) => ({
527
524
  ...changeset,
@@ -532,17 +529,19 @@ const planFrom = (pending, versions) => (added, held) => {
532
529
  "minor",
533
530
  "patch"
534
531
  ];
532
+ const capped = ceiling ? order.slice(order.indexOf(ceiling)) : order;
535
533
  return {
536
534
  changesets,
537
535
  releases: [...new Set(changesets.flatMap(({ releases }) => releases.map(({ name }) => name)))].map((name) => {
538
536
  const lines = changesets.filter(({ releases }) => releases.some((line) => line.name === name));
539
- const type = order.find((candidate) => lines.some(({ releases }) => releases.some((line) => line.name === name && line.type === candidate))) ?? "patch";
537
+ const named = order.find((candidate) => lines.some(({ releases }) => releases.some((line) => line.name === name && line.type === candidate))) ?? "patch";
538
+ const type = capped.includes(named) ? named : ceiling ?? named;
540
539
  const oldVersion = versions[name] ?? "0.1.0";
541
540
  return {
542
541
  name,
543
542
  type,
544
543
  oldVersion,
545
- newVersion: bump(oldVersion, type),
544
+ newVersion: nextVersion(oldVersion, type),
546
545
  changesets: lines.map(({ id }) => id)
547
546
  };
548
547
  })