@clossys/launcher 0.3.1 → 0.4.0
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 +1324 -60
- package/contracts/conversation-contract.md +2 -2
- package/contracts/product-ci-workflow.yml +74 -0
- package/contracts/repository-inventory.json +53 -0
- package/dist/admission-fixture.d.ts +168 -0
- package/dist/admission-fixture.d.ts.map +1 -0
- package/dist/admission-fixture.js +453 -0
- package/dist/admission-fixture.js.map +1 -0
- package/dist/admission.d.ts +124 -0
- package/dist/admission.d.ts.map +1 -0
- package/dist/admission.js +799 -0
- package/dist/admission.js.map +1 -0
- package/dist/agents-guide.d.ts +9 -0
- package/dist/agents-guide.d.ts.map +1 -0
- package/dist/agents-guide.js +26 -0
- package/dist/agents-guide.js.map +1 -0
- package/dist/apply-command-options.check.d.ts +12 -0
- package/dist/apply-command-options.check.d.ts.map +1 -0
- package/dist/apply-command-options.check.js +20 -0
- package/dist/apply-command-options.check.js.map +1 -0
- package/dist/apply-plan-cli.d.ts +39 -1
- package/dist/apply-plan-cli.d.ts.map +1 -1
- package/dist/apply-plan-cli.js +432 -15
- package/dist/apply-plan-cli.js.map +1 -1
- package/dist/apply-plan.d.ts +46 -59
- package/dist/apply-plan.d.ts.map +1 -1
- package/dist/apply-plan.js +112 -97
- package/dist/apply-plan.js.map +1 -1
- package/dist/apply-step-fixture.d.ts +87 -0
- package/dist/apply-step-fixture.d.ts.map +1 -0
- package/dist/apply-step-fixture.js +199 -0
- package/dist/apply-step-fixture.js.map +1 -0
- package/dist/apply-store.d.ts +93 -0
- package/dist/apply-store.d.ts.map +1 -0
- package/dist/apply-store.js +625 -0
- package/dist/apply-store.js.map +1 -0
- package/dist/approval-sheet.d.ts +21 -0
- package/dist/approval-sheet.d.ts.map +1 -0
- package/dist/approval-sheet.js +157 -0
- package/dist/approval-sheet.js.map +1 -0
- package/dist/body-command.d.ts +42 -0
- package/dist/body-command.d.ts.map +1 -0
- package/dist/body-command.js +143 -0
- package/dist/body-command.js.map +1 -0
- package/dist/change-set-contract.d.ts +381 -0
- package/dist/change-set-contract.d.ts.map +1 -0
- package/dist/change-set-contract.js +738 -0
- package/dist/change-set-contract.js.map +1 -0
- package/dist/change-set-digest.d.ts +28 -0
- package/dist/change-set-digest.d.ts.map +1 -0
- package/dist/change-set-digest.js +65 -0
- package/dist/change-set-digest.js.map +1 -0
- package/dist/check-cli.d.ts.map +1 -1
- package/dist/check-cli.js +14 -3
- package/dist/check-cli.js.map +1 -1
- package/dist/cli.d.ts +17 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +84 -23
- package/dist/cli.js.map +1 -1
- package/dist/core.d.ts +79 -22
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +843 -268
- package/dist/core.js.map +1 -1
- package/dist/dry-materialize.d.ts +63 -0
- package/dist/dry-materialize.d.ts.map +1 -0
- package/dist/dry-materialize.js +330 -0
- package/dist/dry-materialize.js.map +1 -0
- package/dist/generated/contract-schema.generated.d.ts +97 -0
- package/dist/generated/contract-schema.generated.d.ts.map +1 -0
- package/dist/generated/contract-schema.generated.js +496 -0
- package/dist/generated/contract-schema.generated.js.map +1 -0
- package/dist/generated/package-scope.generated.d.ts +6 -0
- package/dist/generated/package-scope.generated.d.ts.map +1 -0
- package/dist/generated/package-scope.generated.js +10 -0
- package/dist/generated/package-scope.generated.js.map +1 -0
- package/dist/generated/plan-contracts.generated.d.ts +3 -0
- package/dist/generated/plan-contracts.generated.d.ts.map +1 -0
- package/dist/generated/plan-contracts.generated.js +2840 -0
- package/dist/generated/plan-contracts.generated.js.map +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +11 -0
- package/dist/host.js.map +1 -1
- package/dist/identity.d.ts +15 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +48 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +34 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/inventory-adoption.d.ts +24 -5
- package/dist/inventory-adoption.d.ts.map +1 -1
- package/dist/inventory-adoption.js +70 -25
- package/dist/inventory-adoption.js.map +1 -1
- package/dist/inventory-choice.d.ts +40 -0
- package/dist/inventory-choice.d.ts.map +1 -0
- package/dist/inventory-choice.js +156 -0
- package/dist/inventory-choice.js.map +1 -0
- package/dist/inventory-contract.d.ts +89 -0
- package/dist/inventory-contract.d.ts.map +1 -0
- package/dist/inventory-contract.js +121 -0
- package/dist/inventory-contract.js.map +1 -0
- package/dist/key-editor.d.ts +30 -0
- package/dist/key-editor.d.ts.map +1 -0
- package/dist/key-editor.js +445 -0
- package/dist/key-editor.js.map +1 -0
- package/dist/ledger-contract.d.ts +187 -0
- package/dist/ledger-contract.d.ts.map +1 -0
- package/dist/ledger-contract.js +532 -0
- package/dist/ledger-contract.js.map +1 -0
- package/dist/ledger-trust.d.ts +90 -0
- package/dist/ledger-trust.d.ts.map +1 -0
- package/dist/ledger-trust.js +198 -0
- package/dist/ledger-trust.js.map +1 -0
- package/dist/lockfile-invariants.d.ts +48 -0
- package/dist/lockfile-invariants.d.ts.map +1 -0
- package/dist/lockfile-invariants.js +375 -0
- package/dist/lockfile-invariants.js.map +1 -0
- package/dist/lockfile-readers.d.ts +72 -0
- package/dist/lockfile-readers.d.ts.map +1 -0
- package/dist/lockfile-readers.js +713 -0
- package/dist/lockfile-readers.js.map +1 -0
- package/dist/lockfile-regen.d.ts +106 -0
- package/dist/lockfile-regen.d.ts.map +1 -0
- package/dist/lockfile-regen.js +760 -0
- package/dist/lockfile-regen.js.map +1 -0
- package/dist/lockfile-tool-env.d.ts +29 -0
- package/dist/lockfile-tool-env.d.ts.map +1 -0
- package/dist/lockfile-tool-env.js +111 -0
- package/dist/lockfile-tool-env.js.map +1 -0
- package/dist/materialize.d.ts +113 -0
- package/dist/materialize.d.ts.map +1 -0
- package/dist/materialize.js +840 -0
- package/dist/materialize.js.map +1 -0
- package/dist/observe-repository.d.ts +90 -0
- package/dist/observe-repository.d.ts.map +1 -0
- package/dist/observe-repository.js +1367 -0
- package/dist/observe-repository.js.map +1 -0
- package/dist/plan-bundle-setup-fixture.d.ts +68 -0
- package/dist/plan-bundle-setup-fixture.d.ts.map +1 -0
- package/dist/plan-bundle-setup-fixture.js +167 -0
- package/dist/plan-bundle-setup-fixture.js.map +1 -0
- package/dist/plan-bundle.d.ts +250 -0
- package/dist/plan-bundle.d.ts.map +1 -0
- package/dist/plan-bundle.js +827 -0
- package/dist/plan-bundle.js.map +1 -0
- package/dist/plan-command.d.ts +29 -0
- package/dist/plan-command.d.ts.map +1 -0
- package/dist/plan-command.js +493 -0
- package/dist/plan-command.js.map +1 -0
- package/dist/plan-contract.d.ts +153 -0
- package/dist/plan-contract.d.ts.map +1 -0
- package/dist/plan-contract.js +61 -0
- package/dist/plan-contract.js.map +1 -0
- package/dist/plan-digest.d.ts +25 -0
- package/dist/plan-digest.d.ts.map +1 -0
- package/dist/plan-digest.js +106 -0
- package/dist/plan-digest.js.map +1 -0
- package/dist/plan-rules.d.ts +23 -0
- package/dist/plan-rules.d.ts.map +1 -0
- package/dist/plan-rules.js +177 -0
- package/dist/plan-rules.js.map +1 -0
- package/dist/planned-bundle.d.ts +20 -0
- package/dist/planned-bundle.d.ts.map +1 -0
- package/dist/planned-bundle.js +191 -0
- package/dist/planned-bundle.js.map +1 -0
- package/dist/product-repository.d.ts +4 -0
- package/dist/product-repository.d.ts.map +1 -1
- package/dist/product-repository.js +9 -1
- package/dist/product-repository.js.map +1 -1
- package/dist/provenance-gate.d.ts +48 -0
- package/dist/provenance-gate.d.ts.map +1 -0
- package/dist/provenance-gate.js +324 -0
- package/dist/provenance-gate.js.map +1 -0
- package/dist/pull-request-body.d.ts +45 -0
- package/dist/pull-request-body.d.ts.map +1 -0
- package/dist/pull-request-body.js +232 -0
- package/dist/pull-request-body.js.map +1 -0
- package/dist/registry-snapshot.d.ts +141 -0
- package/dist/registry-snapshot.d.ts.map +1 -0
- package/dist/registry-snapshot.js +483 -0
- package/dist/registry-snapshot.js.map +1 -0
- package/dist/release-age-edit.d.ts +52 -0
- package/dist/release-age-edit.d.ts.map +1 -0
- package/dist/release-age-edit.js +413 -0
- package/dist/release-age-edit.js.map +1 -0
- package/dist/root-entries.d.ts +36 -0
- package/dist/root-entries.d.ts.map +1 -0
- package/dist/root-entries.js +80 -0
- package/dist/root-entries.js.map +1 -0
- package/dist/setup-template-scripts.d.ts +34 -0
- package/dist/setup-template-scripts.d.ts.map +1 -0
- package/dist/setup-template-scripts.js +557 -0
- package/dist/setup-template-scripts.js.map +1 -0
- package/dist/setup-templates.d.ts +54 -0
- package/dist/setup-templates.d.ts.map +1 -0
- package/dist/setup-templates.js +427 -0
- package/dist/setup-templates.js.map +1 -0
- package/dist/skills.d.ts +34 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +129 -17
- package/dist/skills.js.map +1 -1
- package/dist/status.d.ts +63 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +539 -0
- package/dist/status.js.map +1 -0
- package/dist/types.d.ts +151 -13
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/skeleton/README.md +14 -9
- package/skeleton/package.json +2 -1
- package/skill/SKILL.md +23 -7
- package/skill-catalogue/advisor/SKILL.md +59 -6
- package/skill-catalogue/architect/SKILL.md +2 -2
- package/skill-catalogue/bouncer/SKILL.md +2 -2
- package/skill-catalogue/builder/SKILL.md +2 -2
- package/skill-catalogue/butler/SKILL.md +2 -2
- package/skill-catalogue/controller/SKILL.md +2 -2
- package/skill-catalogue/customer/SKILL.md +2 -2
- package/skill-catalogue/designer/SKILL.md +4 -2
- package/skill-catalogue/giver/SKILL.md +2 -2
- package/skill-catalogue/influencer/SKILL.md +2 -2
- package/skill-catalogue/inspector/SKILL.md +2 -2
- package/skill-catalogue/integrator/SKILL.md +2 -2
- package/skill-catalogue/keeper/SKILL.md +2 -2
- package/skill-catalogue/launcher/SKILL.md +23 -7
- package/skill-catalogue/locksmith/SKILL.md +2 -2
- package/skill-catalogue/messenger/SKILL.md +2 -2
- package/skill-catalogue/observer/SKILL.md +2 -2
- package/skill-catalogue/publisher/SKILL.md +2 -2
- package/skill-catalogue/starter/SKILL.md +3 -2
- package/skill-catalogue/strategist/SKILL.md +12 -4
- package/skill-catalogue/writer/SKILL.md +2 -2
- package/src/admission-fixture.ts +572 -0
- package/src/admission.ts +816 -0
- package/src/agents-guide.ts +29 -0
- package/src/apply-command-options.check.ts +27 -0
- package/src/apply-plan-cli.ts +454 -14
- package/src/apply-plan.ts +112 -124
- package/src/apply-step-fixture.ts +236 -0
- package/src/apply-store.ts +584 -0
- package/src/approval-sheet.ts +164 -0
- package/src/body-command.ts +162 -0
- package/src/change-set-contract.ts +937 -0
- package/src/change-set-digest.ts +70 -0
- package/src/check-cli.ts +14 -3
- package/src/cli.ts +90 -22
- package/src/core.ts +973 -275
- package/src/dry-materialize.ts +353 -0
- package/src/generated/contract-schema.generated.ts +520 -0
- package/src/generated/package-scope.generated.ts +10 -0
- package/src/generated/plan-contracts.generated.ts +2840 -0
- package/src/host.ts +10 -0
- package/src/identity.ts +51 -0
- package/src/index.ts +72 -3
- package/src/inventory-adoption.ts +107 -29
- package/src/inventory-choice.ts +172 -0
- package/src/inventory-contract.ts +166 -0
- package/src/key-editor.ts +446 -0
- package/src/ledger-contract.ts +637 -0
- package/src/ledger-trust.ts +267 -0
- package/src/lockfile-invariants.ts +421 -0
- package/src/lockfile-readers.ts +749 -0
- package/src/lockfile-regen.ts +851 -0
- package/src/lockfile-tool-env.ts +131 -0
- package/src/materialize.ts +886 -0
- package/src/observe-repository.ts +1365 -0
- package/src/plan-bundle-setup-fixture.ts +200 -0
- package/src/plan-bundle.ts +964 -0
- package/src/plan-command.ts +509 -0
- package/src/plan-contract.ts +179 -0
- package/src/plan-digest.ts +102 -0
- package/src/plan-rules.ts +188 -0
- package/src/planned-bundle.ts +211 -0
- package/src/product-repository.ts +10 -1
- package/src/provenance-gate.ts +352 -0
- package/src/pull-request-body.ts +261 -0
- package/src/registry-snapshot.ts +534 -0
- package/src/release-age-edit.ts +430 -0
- package/src/root-entries.ts +81 -0
- package/src/setup-template-scripts.ts +571 -0
- package/src/setup-templates.ts +471 -0
- package/src/skills.ts +161 -18
- package/src/status.ts +557 -0
- package/src/types.ts +148 -13
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Test support for the setup-set planner tests (issue #1178): builders for a
|
|
2
|
+
// plan that pins Starter and defers one install, an observation of a
|
|
3
|
+
// repository still in the setup phase, and the inputs planApplyBundle() takes.
|
|
4
|
+
// Additive: the planner's other tests keep their own fixtures, untouched.
|
|
5
|
+
// Nothing here is imported by the shipped code; every name, id and digest is
|
|
6
|
+
// an example value.
|
|
7
|
+
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { SITE_ID as MATERIALIZED_SITE_ID, approvedPlan, basePlan, bundleOf, committedPlanPackages, reseal } from "./admission-fixture.js";
|
|
11
|
+
import { AGENTS_GUIDE_PATH, AGENTS_GUIDE_TEXT } from "./agents-guide.js";
|
|
12
|
+
import { buildMaterializedFixture } from "./apply-step-fixture.js";
|
|
13
|
+
import { CANONICAL_KEYS, canonicalOrder, contentDigest } from "./change-set-contract.js";
|
|
14
|
+
import type { ApplyBundle, ChangeSetItem, RepositoryChangeSet } from "./change-set-contract.js";
|
|
15
|
+
import type { RepositoryObservation, PlanApplyBundleInputs } from "./plan-bundle.js";
|
|
16
|
+
import type { AdvisorPlan, EngagementBrief } from "./plan-contract.js";
|
|
17
|
+
import { planDigest } from "./plan-digest.js";
|
|
18
|
+
|
|
19
|
+
export type Loose = Record<string, any>;
|
|
20
|
+
|
|
21
|
+
const REPO = new URL("../../../", import.meta.url);
|
|
22
|
+
const read = (path: string): string => readFileSync(new URL(path, REPO), "utf8");
|
|
23
|
+
|
|
24
|
+
export const clone = <T>(value: T): T => structuredClone(value);
|
|
25
|
+
export const sha = (data: string | Uint8Array): string => `sha256:${createHash("sha256").update(typeof data === "string" ? Buffer.from(data, "utf8") : data).digest("hex")}`;
|
|
26
|
+
|
|
27
|
+
export const SITE_ID = "example-owner/site";
|
|
28
|
+
export const SITE_NODE_ID = "R_exampleSite1";
|
|
29
|
+
export const STARTER_NAME = "@clossys/starter";
|
|
30
|
+
export const WRITER_NAME = "@clossys/writer";
|
|
31
|
+
export const STARTER_PLAN_ITEM = `${SITE_ID}:${STARTER_NAME}`;
|
|
32
|
+
export const WRITER_PLAN_ITEM = `${SITE_ID}:${WRITER_NAME}`;
|
|
33
|
+
|
|
34
|
+
const CORPUS_PLAN = (JSON.parse(read("docs/contracts/advisor-plan-digest.fixture.json")) as { plans: { name: string; plan: AdvisorPlan }[] }).plans.find(
|
|
35
|
+
(entry) => entry.name === "staffed-with-packages",
|
|
36
|
+
)!.plan;
|
|
37
|
+
const CORPUS_STARTER = CORPUS_PLAN.packages!.find((act) => act.act === "pin-starter")!;
|
|
38
|
+
const CORPUS_WRITER = CORPUS_PLAN.packages!.find((act) => act.name === "@example/writer")!;
|
|
39
|
+
|
|
40
|
+
export const STARTER_INTEGRITY = CORPUS_STARTER.integrity;
|
|
41
|
+
export const WRITER_INTEGRITY = CORPUS_WRITER.integrity;
|
|
42
|
+
export const STARTER_VERSION = "0.2.0";
|
|
43
|
+
export const WRITER_VERSION = "0.7.0";
|
|
44
|
+
|
|
45
|
+
export interface SetupPlanOptions {
|
|
46
|
+
readonly starterVersion?: string;
|
|
47
|
+
readonly starterName?: string;
|
|
48
|
+
/** Leave the Starter pin out of the plan's packages. */
|
|
49
|
+
readonly withoutStarter?: boolean;
|
|
50
|
+
/** Leave the install out of the plan's packages. */
|
|
51
|
+
readonly withoutInstall?: boolean;
|
|
52
|
+
readonly repository?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A plan that staffs one repository, pins Starter in it and installs one more package there. */
|
|
56
|
+
export function setupPlan(options: SetupPlanOptions = {}): AdvisorPlan {
|
|
57
|
+
const repository = options.repository ?? SITE_ID;
|
|
58
|
+
const starterName = options.starterName ?? STARTER_NAME;
|
|
59
|
+
const packages: Loose[] = [];
|
|
60
|
+
if (options.withoutStarter !== true) {
|
|
61
|
+
packages.push({
|
|
62
|
+
planItem: `${repository}:${starterName}`,
|
|
63
|
+
repository,
|
|
64
|
+
act: "pin-starter",
|
|
65
|
+
name: starterName,
|
|
66
|
+
version: options.starterVersion ?? STARTER_VERSION,
|
|
67
|
+
integrity: STARTER_INTEGRITY,
|
|
68
|
+
placement: "devDependencies",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (options.withoutInstall !== true) {
|
|
72
|
+
packages.push({
|
|
73
|
+
planItem: `${repository}:${WRITER_NAME}`,
|
|
74
|
+
repository,
|
|
75
|
+
act: "install",
|
|
76
|
+
name: WRITER_NAME,
|
|
77
|
+
version: WRITER_VERSION,
|
|
78
|
+
integrity: WRITER_INTEGRITY,
|
|
79
|
+
placement: "devDependencies",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const plan = clone(CORPUS_PLAN) as unknown as Loose;
|
|
83
|
+
plan.staffing = [{ repository, roles: ["strategist", "writer"] }];
|
|
84
|
+
plan.packages = packages;
|
|
85
|
+
return plan as AdvisorPlan;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const HUB_BRIEF: EngagementBrief = {
|
|
89
|
+
schemaVersion: 1,
|
|
90
|
+
problem: "Our site doesn't explain what we do.",
|
|
91
|
+
roles: [
|
|
92
|
+
{ role: "strategist", why: "Sets the direction.", goal: { metric: "direction-clarity", direction: "increase" }, inputsFrom: [], outputsTo: ["writer"] },
|
|
93
|
+
{ role: "writer", why: "Writes the pages.", goal: { metric: "pages-published", direction: "increase" }, inputsFrom: ["strategist"], outputsTo: [] },
|
|
94
|
+
],
|
|
95
|
+
sequence: ["strategist", "writer"],
|
|
96
|
+
deliverables: ["A direction.", "The pages."],
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const SKILLS = [
|
|
100
|
+
{ role: "advisor", content: "# Advisor\n" },
|
|
101
|
+
{ role: "strategist", content: "# Strategist\n" },
|
|
102
|
+
{ role: "writer", content: "# Writer\n" },
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
export const NPM_LOCK_TEXT = `${JSON.stringify({ name: "site", version: "1.0.0", lockfileVersion: 3, requires: true, packages: { "": { name: "site", version: "1.0.0" } } }, null, 2)}\n`;
|
|
106
|
+
|
|
107
|
+
/** An observation of a repository with no Clossys file in it yet: the setup phase, npm, a lockfile and no Starter. */
|
|
108
|
+
export function setupObservation(patch: Partial<RepositoryObservation> = {}): RepositoryObservation {
|
|
109
|
+
return {
|
|
110
|
+
id: SITE_ID,
|
|
111
|
+
nodeId: SITE_NODE_ID,
|
|
112
|
+
visibility: "private",
|
|
113
|
+
defaultBranch: "main",
|
|
114
|
+
baseCommit: "a".repeat(40),
|
|
115
|
+
phase: "setup",
|
|
116
|
+
packageManager: "npm",
|
|
117
|
+
lockfile: "package-lock.json",
|
|
118
|
+
releaseAgeSurfaces: [],
|
|
119
|
+
consumerCi: false,
|
|
120
|
+
symlinkedSkillRoots: [],
|
|
121
|
+
repositoryProfile: null,
|
|
122
|
+
linkedAgentsPaths: [],
|
|
123
|
+
files: [{ path: "package-lock.json", sha256: sha(NPM_LOCK_TEXT) }],
|
|
124
|
+
manifestEntries: [],
|
|
125
|
+
lockedPackages: [],
|
|
126
|
+
ledger: null,
|
|
127
|
+
skillsManifest: null,
|
|
128
|
+
...patch,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const PNPM_LOCK_TEXT = "lockfileVersion: '9.0'\n\nimporters:\n\n .: {}\n\npackages: {}\n\nsnapshots: {}\n";
|
|
133
|
+
|
|
134
|
+
/** A pnpm repository still in the setup phase; `surface` is the text of pnpm-workspace.yaml (null: absent). */
|
|
135
|
+
export function pnpmSetupObservation(surface: string | null, patch: Partial<RepositoryObservation> = {}): RepositoryObservation {
|
|
136
|
+
return setupObservation({
|
|
137
|
+
packageManager: "pnpm",
|
|
138
|
+
lockfile: "pnpm-lock.yaml",
|
|
139
|
+
releaseAgeSurfaces: surface === null ? [] : [{ surface: "pnpm-workspace", path: "pnpm-workspace.yaml" }],
|
|
140
|
+
files: [
|
|
141
|
+
{ path: "pnpm-lock.yaml", sha256: sha(PNPM_LOCK_TEXT) },
|
|
142
|
+
...(surface === null ? [] : [{ path: "pnpm-workspace.yaml", sha256: sha(surface) }]),
|
|
143
|
+
],
|
|
144
|
+
...(surface === null ? {} : { pnpmWorkspaceText: surface }),
|
|
145
|
+
...patch,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function setupInputs(observation: RepositoryObservation | null, plan: AdvisorPlan = setupPlan(), patch: Partial<PlanApplyBundleInputs> = {}): PlanApplyBundleInputs {
|
|
150
|
+
return {
|
|
151
|
+
plan,
|
|
152
|
+
hubBrief: HUB_BRIEF,
|
|
153
|
+
repositories: observation === null ? [] : [observation],
|
|
154
|
+
skills: SKILLS,
|
|
155
|
+
producer: { name: "@clossys/launcher", version: "0.4.0" },
|
|
156
|
+
engine: { name: "@clossys/advisor", version: "0.8.0", integrity: STARTER_INTEGRITY },
|
|
157
|
+
integrator: { name: "@clossys/integrator", version: "0.6.0", integrity: WRITER_INTEGRITY },
|
|
158
|
+
planCommitted: true,
|
|
159
|
+
authorization: { planDigest: planDigest(plan), expiresAt: "2999-01-01T00:00:00Z" },
|
|
160
|
+
computedAt: "2026-09-24T12:00:00Z",
|
|
161
|
+
heldChangeSets: [],
|
|
162
|
+
...patch,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The materialized fixture of apply-step-fixture.ts, its set extended with the `agents-guide` item and the whole file
|
|
168
|
+
* the guide file at AGENTS_GUIDE_PATH (the constant text, or `guideText` to put other bytes in the set), resealed, and bundled, approved and stored in the hub over the extended set. The clone
|
|
169
|
+
* is on the default branch with nothing written: materialize writes the guide from `texts`.
|
|
170
|
+
*/
|
|
171
|
+
export function buildGuideFixture(roots: string[], guideText: string = AGENTS_GUIDE_TEXT) {
|
|
172
|
+
let extended: { set: RepositoryChangeSet; plan: AdvisorPlan; bundle: ApplyBundle } | null = null;
|
|
173
|
+
const fixture = buildMaterializedFixture(roots, {
|
|
174
|
+
hub: ({ set }) => {
|
|
175
|
+
const loose = clone(set) as unknown as Loose;
|
|
176
|
+
loose.items = canonicalOrder([...(loose.items as ChangeSetItem[]), { id: "agents-guide", act: "write-record", source: "agents-guide" } as ChangeSetItem], CANONICAL_KEYS.item);
|
|
177
|
+
loose.files = canonicalOrder(
|
|
178
|
+
[...(loose.files as RepositoryChangeSet["files"][number][]), { path: AGENTS_GUIDE_PATH, mode: "100644", before: null, after: contentDigest(guideText), item: "agents-guide" } as RepositoryChangeSet["files"][number]],
|
|
179
|
+
CANONICAL_KEYS.file,
|
|
180
|
+
);
|
|
181
|
+
const sealed = reseal(loose);
|
|
182
|
+
const plan0 = basePlan() as unknown as AdvisorPlan;
|
|
183
|
+
const bundle = bundleOf(plan0, [{ id: MATERIALIZED_SITE_ID, set: sealed }]);
|
|
184
|
+
const plan = approvedPlan(bundle.bundleDigest, plan0);
|
|
185
|
+
extended = { set: { ...sealed, bundle: bundle.bundleDigest } as RepositoryChangeSet, plan, bundle };
|
|
186
|
+
return { plans: [plan], bundles: [bundle] };
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
if (extended === null) throw new Error("the fixture did not build its hub");
|
|
190
|
+
const { set, plan, bundle } = extended as { set: RepositoryChangeSet; plan: AdvisorPlan; bundle: ApplyBundle };
|
|
191
|
+
return {
|
|
192
|
+
...fixture,
|
|
193
|
+
set,
|
|
194
|
+
plan,
|
|
195
|
+
bundle,
|
|
196
|
+
binding: { kind: "approved" as const, subjectDigest: bundle.bundleDigest },
|
|
197
|
+
planPackages: committedPlanPackages(plan, MATERIALIZED_SITE_ID),
|
|
198
|
+
texts: { ...fixture.texts, [AGENTS_GUIDE_PATH]: guideText },
|
|
199
|
+
};
|
|
200
|
+
}
|