shiplane 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/{budget-CTjB1v-Z.js → budget-BTnKtGF6.js} +9 -28
- package/dist/budget-BTnKtGF6.js.map +1 -0
- package/dist/cli.js +6 -5
- package/dist/cli.js.map +1 -1
- package/dist/{index-oKnmZ8qV.d.ts → index-CxyLUqKJ.d.ts} +14 -9
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/dist/{package-registry.fake-Ciqc4ujx.js → package-registry.fake-D6e0c_iA.js} +6 -6
- package/dist/package-registry.fake-D6e0c_iA.js.map +1 -0
- package/dist/{package-registry.fake-CC37ptzf.d.ts → package-registry.fake-DOI4N4yu.d.ts} +8 -9
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.js +3 -3
- package/dist/{readStatus-Bo7hpUT3.js → readStatus-Dd_pBt-6.js} +255 -95
- package/dist/readStatus-Dd_pBt-6.js.map +1 -0
- package/dist/src-Dqo5lgrW.js +114 -0
- package/dist/src-Dqo5lgrW.js.map +1 -0
- package/dist/{static-hosting.port-mknLsxwR.d.ts → static-hosting.port-DaIJfr1x.d.ts} +13 -15
- package/dist/testing.d.ts +20 -14
- package/dist/testing.js +15 -16
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/budget-CTjB1v-Z.js.map +0 -1
- package/dist/package-registry.fake-Ciqc4ujx.js.map +0 -1
- package/dist/readStatus-Bo7hpUT3.js.map +0 -1
- package/dist/src-CGASfBy2.js +0 -32
- package/dist/src-CGASfBy2.js.map +0 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import "./perEnv-B7AiYnW_.js";
|
|
2
|
+
import "./shell-server-hosting.adapter-DobfDqFm.js";
|
|
3
|
+
import { z, z as z$1 } from "zod";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
//#region src/application/config/defineRelease.ts
|
|
7
|
+
const defineRelease = (config) => config;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/modules/agent-plugin/agent-plugin.module.ts
|
|
10
|
+
/**
|
|
11
|
+
* Where each agent reads a plugin's version, relative to the plugin's folder: Claude Code and
|
|
12
|
+
* Copilot CLI, Codex, Cursor, then Gemini CLI.
|
|
13
|
+
*/
|
|
14
|
+
const AGENT_MANIFESTS = [
|
|
15
|
+
".claude-plugin/plugin.json",
|
|
16
|
+
".codex-plugin/plugin.json",
|
|
17
|
+
".cursor-plugin/plugin.json",
|
|
18
|
+
"gemini-extension.json"
|
|
19
|
+
];
|
|
20
|
+
const Versioned = z.object({ version: z.string() });
|
|
21
|
+
/** A manifest's version, or null when the file is missing or holds no top-level version. */
|
|
22
|
+
const versionIn = (file) => {
|
|
23
|
+
if (!fs.existsSync(file)) return null;
|
|
24
|
+
const parsed = Versioned.safeParse(JSON.parse(fs.readFileSync(file, "utf8")));
|
|
25
|
+
return parsed.success ? parsed.data.version : null;
|
|
26
|
+
};
|
|
27
|
+
const literal = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
28
|
+
/** Moves only the version's value, so the release PR shows one changed line per manifest. */
|
|
29
|
+
const setVersion = (file, from, to) => {
|
|
30
|
+
const text = fs.readFileSync(file, "utf8");
|
|
31
|
+
const moved = text.replace(new RegExp(`("version"\\s*:\\s*)"${literal(from)}"`), `$1${JSON.stringify(to)}`);
|
|
32
|
+
const top = Versioned.safeParse(JSON.parse(moved));
|
|
33
|
+
const json = JSON.parse(text);
|
|
34
|
+
fs.writeFileSync(file, top.success && top.data.version === to ? moved : `${JSON.stringify({
|
|
35
|
+
...json,
|
|
36
|
+
version: to
|
|
37
|
+
}, null, 2)}\n`);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A plugin for coding agents, such as a Claude Code, Codex or Cursor plugin: a release versions it,
|
|
41
|
+
* writes the version into each agent's manifest in the release PR, tags it and publishes its notes.
|
|
42
|
+
* Nothing deploys it: agents install it from the repository, so merging the release PR ships it.
|
|
43
|
+
*/
|
|
44
|
+
const agentPlugin = ({ name = "agent-plugin" } = {}) => ({
|
|
45
|
+
type: "module",
|
|
46
|
+
name,
|
|
47
|
+
kind: "agent-plugin",
|
|
48
|
+
provider: "marketplace",
|
|
49
|
+
settings: z.object({}),
|
|
50
|
+
adapters: [],
|
|
51
|
+
releaseOnly: true,
|
|
52
|
+
version: ({ root }, { unit, bump }) => {
|
|
53
|
+
if (!bump) return Promise.resolve({
|
|
54
|
+
added: [],
|
|
55
|
+
writes: [],
|
|
56
|
+
summary: [],
|
|
57
|
+
onMerge: ""
|
|
58
|
+
});
|
|
59
|
+
const manifests = AGENT_MANIFESTS.map((file) => path.posix.join(unit.dir, file)).flatMap((file) => {
|
|
60
|
+
const from = versionIn(path.join(root, file));
|
|
61
|
+
return from === null ? [] : [{
|
|
62
|
+
file,
|
|
63
|
+
from
|
|
64
|
+
}];
|
|
65
|
+
});
|
|
66
|
+
return Promise.resolve({
|
|
67
|
+
added: [],
|
|
68
|
+
writes: manifests.map(({ file, from }) => ({
|
|
69
|
+
label: `${file} → ${bump.to}`,
|
|
70
|
+
run: () => {
|
|
71
|
+
setVersion(path.join(root, file), from, bump.to);
|
|
72
|
+
return Promise.resolve();
|
|
73
|
+
}
|
|
74
|
+
})),
|
|
75
|
+
summary: [],
|
|
76
|
+
onMerge: "Agents update to it: merging ships it"
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
ship: () => ({
|
|
80
|
+
where: "its tag and release notes; agents install it from the repository",
|
|
81
|
+
jobs: []
|
|
82
|
+
}),
|
|
83
|
+
decide: () => Promise.resolve({
|
|
84
|
+
action: "none",
|
|
85
|
+
status: "released, agents install it from the repository"
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/modules/internal-tool/internal-tool.module.ts
|
|
90
|
+
/**
|
|
91
|
+
* An app nothing deploys, such as a CLI run from the repository: a release versions it, tags it and
|
|
92
|
+
* publishes its notes, and every environment counts it as shipped once tagged.
|
|
93
|
+
*/
|
|
94
|
+
const internalTool = ({ name = "internal-tool" } = {}) => ({
|
|
95
|
+
type: "module",
|
|
96
|
+
name,
|
|
97
|
+
kind: "internal-tool",
|
|
98
|
+
provider: "release-only",
|
|
99
|
+
settings: z.object({}),
|
|
100
|
+
adapters: [],
|
|
101
|
+
releaseOnly: true,
|
|
102
|
+
ship: () => ({
|
|
103
|
+
where: "its tag and release notes, nothing deploys it",
|
|
104
|
+
jobs: []
|
|
105
|
+
}),
|
|
106
|
+
decide: () => Promise.resolve({
|
|
107
|
+
action: "none",
|
|
108
|
+
status: "released, nothing deploys it"
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
//#endregion
|
|
112
|
+
export { defineRelease as i, internalTool as n, agentPlugin as r, z$1 as t };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=src-Dqo5lgrW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-Dqo5lgrW.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"}
|
|
@@ -61,6 +61,8 @@ interface UnitRef {
|
|
|
61
61
|
packageName: string;
|
|
62
62
|
}
|
|
63
63
|
type BumpType = "major" | "minor" | "patch" | "none";
|
|
64
|
+
/** A bump that moves a version. */
|
|
65
|
+
type BumpLevel = Exclude<BumpType, "none">;
|
|
64
66
|
/** One changeset, as `changeset status --output` lists it. */
|
|
65
67
|
interface PlannedChangeset {
|
|
66
68
|
id: string;
|
|
@@ -106,13 +108,6 @@ declare const splitChangesets: (changesets: PlannedChangeset[], held: readonly s
|
|
|
106
108
|
ships: PlannedChangeset[];
|
|
107
109
|
waits: PlannedChangeset[];
|
|
108
110
|
};
|
|
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
111
|
//#endregion
|
|
117
112
|
//#region src/domain/releasePr.d.ts
|
|
118
113
|
interface OpenPr {
|
|
@@ -310,8 +305,6 @@ interface SourceControlPort {
|
|
|
310
305
|
sha: string;
|
|
311
306
|
subject: string;
|
|
312
307
|
} | 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
308
|
/** The commits after `from` up to `to`, newest first: each subject and the files it touched. */
|
|
316
309
|
commitsBetween: (from: string, to: string) => Promise<{
|
|
317
310
|
subject: string;
|
|
@@ -612,15 +605,20 @@ interface DeliveryAdapter<Port extends {
|
|
|
612
605
|
//#region src/ports/versioning.port.d.ts
|
|
613
606
|
/** The intent to release: changesets today. */
|
|
614
607
|
interface VersioningPort {
|
|
608
|
+
/** What a person does to queue a release, as they read it: "pnpm changeset". */
|
|
609
|
+
readonly nextChange: string;
|
|
615
610
|
/** Pending change files, by id, with their raw text. */
|
|
616
611
|
pending: () => Promise<{
|
|
617
612
|
id: string;
|
|
618
613
|
text: string;
|
|
619
614
|
}[]>;
|
|
620
|
-
/**
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
615
|
+
/**
|
|
616
|
+
* What versioning would move, with these added and the `waits` held back, writing nothing. With
|
|
617
|
+
* a `ceiling`, nothing moves by more than that level, whatever a change says.
|
|
618
|
+
*/
|
|
619
|
+
plan: (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => Promise<StatusPlan>;
|
|
620
|
+
/** Writes `added`, versions everything but `held` up to `ceiling`, and leaves `held` pending. */
|
|
621
|
+
apply: (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => Promise<void>;
|
|
624
622
|
/** Adds one pending changeset, as a person would with `pnpm changeset`. */
|
|
625
623
|
write: (changeset: PlannedChangeset) => Promise<void>;
|
|
626
624
|
/** Each workspace package's runtime workspace dependencies, by package name. */
|
|
@@ -680,5 +678,5 @@ interface StaticHostingPort<Options = Record<string, unknown>> extends Delivery<
|
|
|
680
678
|
readonly capability: "static-hosting";
|
|
681
679
|
}
|
|
682
680
|
//#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,
|
|
684
|
-
//# sourceMappingURL=static-hosting.port-
|
|
681
|
+
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, UnitRef 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, StatusPlan as it, yesAllowed as j, GitPosition as k, ServiceAdapter as l, DisplayChoice as lt, Health as m, Environment as mt, ServerHostingPort as n, BumpLevel as nt, Adapter as o, appBumps as ot, Delivery as p, progressBar 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, Mascot as ut, Requirement as v, Output as w, VersionContribution as x, Resolved as y, IssueRef as z };
|
|
682
|
+
//# sourceMappingURL=static-hosting.port-DaIJfr1x.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
|
|
2
|
-
import {
|
|
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-
|
|
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 UnitRef, c as DeliveryAdapter, ct as ReleaseUnit, et as ReleaseStep, ft as Mood, i as MobileDistributionPort, it as StatusPlan, l as ServiceAdapter, lt as DisplayChoice, mt as Environment, 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-DaIJfr1x.js";
|
|
2
|
+
import { _ as Feature, b as ReleaseFlow, w as ReleaseTag, x as ReleaseModule, y as Open } from "./index-CxyLUqKJ.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-DOI4N4yu.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
|
|
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;
|
|
@@ -447,9 +455,9 @@ declare const inSandbox: (args: string[]) => string;
|
|
|
447
455
|
//#region src/testing/plans.d.ts
|
|
448
456
|
/**
|
|
449
457
|
* 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
|
|
458
|
+
* the lines it holds back: every named package moves once, by its biggest bump, up to `ceiling`.
|
|
451
459
|
*/
|
|
452
|
-
declare const planFrom: (pending: PlannedChangeset[], versions: Record<string, string>) => (added: PlannedChangeset[], held: PlannedChangeset[]) => StatusPlan;
|
|
460
|
+
declare const planFrom: (pending: PlannedChangeset[], versions: Record<string, string>) => (added: PlannedChangeset[], held: PlannedChangeset[], ceiling?: BumpLevel) => StatusPlan;
|
|
453
461
|
//#endregion
|
|
454
462
|
//#region src/adapters/terminal/__fakes__/progress.fake.d.ts
|
|
455
463
|
interface ProgressEvent {
|
|
@@ -489,7 +497,6 @@ declare const testContext: ({
|
|
|
489
497
|
interactive,
|
|
490
498
|
root,
|
|
491
499
|
tagFormat,
|
|
492
|
-
commitsWithoutChangeset,
|
|
493
500
|
approval
|
|
494
501
|
}: {
|
|
495
502
|
units: ReleaseUnit[];
|
|
@@ -498,8 +505,7 @@ declare const testContext: ({
|
|
|
498
505
|
yes?: boolean;
|
|
499
506
|
interactive?: boolean;
|
|
500
507
|
root?: string;
|
|
501
|
-
tagFormat?: string; /**
|
|
502
|
-
commitsWithoutChangeset?: "release" | "ignore"; /** Whether someone else approves the release PR; the config default when absent. */
|
|
508
|
+
tagFormat?: string; /** Whether someone else approves the release PR; the config default when absent. */
|
|
503
509
|
approval?: Approval;
|
|
504
510
|
}) => {
|
|
505
511
|
context: ReleaseContext;
|
package/dist/testing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as releaseFlow } from "./web-app.module-6KrXIU7j.js";
|
|
2
|
-
import { C as refreshEditorSchema,
|
|
3
|
-
import {
|
|
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-
|
|
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-Dd_pBt-6.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-D6e0c_iA.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,
|
|
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
|
|
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:
|
|
544
|
+
newVersion: nextVersion(oldVersion, type),
|
|
546
545
|
changesets: lines.map(({ id }) => id)
|
|
547
546
|
};
|
|
548
547
|
})
|