@brunosouzas/stackledger 0.0.0-stage → 0.5.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/LICENSE +202 -0
- package/README.md +261 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/control.d.ts +2 -0
- package/dist/control.js +22 -0
- package/dist/control.js.map +1 -0
- package/dist/discover-command.d.ts +7 -0
- package/dist/discover-command.js +60 -0
- package/dist/discover-command.js.map +1 -0
- package/dist/discovery/annotations.d.ts +24 -0
- package/dist/discovery/annotations.js +37 -0
- package/dist/discovery/annotations.js.map +1 -0
- package/dist/discovery/host.d.ts +47 -0
- package/dist/discovery/host.js +56 -0
- package/dist/discovery/host.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.js +30 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/machine.d.ts +14 -0
- package/dist/discovery/machine.js +17 -0
- package/dist/discovery/machine.js.map +1 -0
- package/dist/discovery/run.d.ts +39 -0
- package/dist/discovery/run.js +130 -0
- package/dist/discovery/run.js.map +1 -0
- package/dist/discovery/snapshot.d.ts +60 -0
- package/dist/discovery/snapshot.js +161 -0
- package/dist/discovery/snapshot.js.map +1 -0
- package/dist/discovery/sources/apps.d.ts +3 -0
- package/dist/discovery/sources/apps.js +136 -0
- package/dist/discovery/sources/apps.js.map +1 -0
- package/dist/discovery/sources/brew.d.ts +15 -0
- package/dist/discovery/sources/brew.js +69 -0
- package/dist/discovery/sources/brew.js.map +1 -0
- package/dist/discovery/sources/common.d.ts +39 -0
- package/dist/discovery/sources/common.js +70 -0
- package/dist/discovery/sources/common.js.map +1 -0
- package/dist/discovery/sources/index.d.ts +8 -0
- package/dist/discovery/sources/index.js +12 -0
- package/dist/discovery/sources/index.js.map +1 -0
- package/dist/discovery/sources/launchd.d.ts +3 -0
- package/dist/discovery/sources/launchd.js +65 -0
- package/dist/discovery/sources/launchd.js.map +1 -0
- package/dist/discovery/sources/mas.d.ts +9 -0
- package/dist/discovery/sources/mas.js +25 -0
- package/dist/discovery/sources/mas.js.map +1 -0
- package/dist/discovery/sources/mise.d.ts +5 -0
- package/dist/discovery/sources/mise.js +64 -0
- package/dist/discovery/sources/mise.js.map +1 -0
- package/dist/discovery/sources/npm.d.ts +12 -0
- package/dist/discovery/sources/npm.js +34 -0
- package/dist/discovery/sources/npm.js.map +1 -0
- package/dist/discovery/sources/pipx.d.ts +4 -0
- package/dist/discovery/sources/pipx.js +82 -0
- package/dist/discovery/sources/pipx.js.map +1 -0
- package/dist/discovery/types.d.ts +73 -0
- package/dist/discovery/types.js +10 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/write.d.ts +50 -0
- package/dist/discovery/write.js +196 -0
- package/dist/discovery/write.js.map +1 -0
- package/dist/drift-command.d.ts +62 -0
- package/dist/drift-command.js +375 -0
- package/dist/drift-command.js.map +1 -0
- package/dist/drift-formats.d.ts +3 -0
- package/dist/drift-formats.js +54 -0
- package/dist/drift-formats.js.map +1 -0
- package/dist/drift.d.ts +95 -0
- package/dist/drift.js +206 -0
- package/dist/drift.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph.d.ts +103 -0
- package/dist/graph.js +181 -0
- package/dist/graph.js.map +1 -0
- package/dist/ics.d.ts +18 -0
- package/dist/ics.js +103 -0
- package/dist/ics.js.map +1 -0
- package/dist/identity.d.ts +18 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/map/badges.d.ts +20 -0
- package/dist/map/badges.js +95 -0
- package/dist/map/badges.js.map +1 -0
- package/dist/map/command.d.ts +8 -0
- package/dist/map/command.js +86 -0
- package/dist/map/command.js.map +1 -0
- package/dist/map/heap.d.ts +15 -0
- package/dist/map/heap.js +57 -0
- package/dist/map/heap.js.map +1 -0
- package/dist/map/ink.d.ts +11 -0
- package/dist/map/ink.js +10 -0
- package/dist/map/ink.js.map +1 -0
- package/dist/map/labels.d.ts +43 -0
- package/dist/map/labels.js +172 -0
- package/dist/map/labels.js.map +1 -0
- package/dist/map/layout.d.ts +64 -0
- package/dist/map/layout.js +228 -0
- package/dist/map/layout.js.map +1 -0
- package/dist/map/model.d.ts +46 -0
- package/dist/map/model.js +84 -0
- package/dist/map/model.js.map +1 -0
- package/dist/map/neighbourhood.d.ts +18 -0
- package/dist/map/neighbourhood.js +137 -0
- package/dist/map/neighbourhood.js.map +1 -0
- package/dist/map/parallel.d.ts +35 -0
- package/dist/map/parallel.js +261 -0
- package/dist/map/parallel.js.map +1 -0
- package/dist/map/pieces.d.ts +12 -0
- package/dist/map/pieces.js +15 -0
- package/dist/map/pieces.js.map +1 -0
- package/dist/map/relations.d.ts +39 -0
- package/dist/map/relations.js +122 -0
- package/dist/map/relations.js.map +1 -0
- package/dist/map/route.d.ts +25 -0
- package/dist/map/route.js +165 -0
- package/dist/map/route.js.map +1 -0
- package/dist/map/strip.d.ts +29 -0
- package/dist/map/strip.js +120 -0
- package/dist/map/strip.js.map +1 -0
- package/dist/map/suggest.d.ts +21 -0
- package/dist/map/suggest.js +97 -0
- package/dist/map/suggest.js.map +1 -0
- package/dist/map/svg.d.ts +29 -0
- package/dist/map/svg.js +203 -0
- package/dist/map/svg.js.map +1 -0
- package/dist/map/themes.d.ts +64 -0
- package/dist/map/themes.js +94 -0
- package/dist/map/themes.js.map +1 -0
- package/dist/map/xml.d.ts +6 -0
- package/dist/map/xml.js +57 -0
- package/dist/map/xml.js.map +1 -0
- package/dist/map/zones.d.ts +19 -0
- package/dist/map/zones.js +46 -0
- package/dist/map/zones.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +145 -0
- package/dist/mcp.js.map +1 -0
- package/dist/money.d.ts +32 -0
- package/dist/money.js +91 -0
- package/dist/money.js.map +1 -0
- package/dist/report-command.d.ts +3 -0
- package/dist/report-command.js +85 -0
- package/dist/report-command.js.map +1 -0
- package/dist/report-formats.d.ts +11 -0
- package/dist/report-formats.js +157 -0
- package/dist/report-formats.js.map +1 -0
- package/dist/reports.d.ts +105 -0
- package/dist/reports.js +247 -0
- package/dist/reports.js.map +1 -0
- package/dist/scaffold.d.ts +30 -0
- package/dist/scaffold.js +140 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +345 -0
- package/dist/schema.js +120 -0
- package/dist/schema.js.map +1 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +68 -0
- package/dist/secrets.js.map +1 -0
- package/dist/site/build.d.ts +22 -0
- package/dist/site/build.js +198 -0
- package/dist/site/build.js.map +1 -0
- package/dist/site/command.d.ts +2 -0
- package/dist/site/command.js +221 -0
- package/dist/site/command.js.map +1 -0
- package/dist/site/data.d.ts +225 -0
- package/dist/site/data.js +243 -0
- package/dist/site/data.js.map +1 -0
- package/dist/site/fs-ops.d.ts +35 -0
- package/dist/site/fs-ops.js +26 -0
- package/dist/site/fs-ops.js.map +1 -0
- package/dist/site/owners.d.ts +5 -0
- package/dist/site/owners.js +50 -0
- package/dist/site/owners.js.map +1 -0
- package/dist/site/paths.d.ts +34 -0
- package/dist/site/paths.js +48 -0
- package/dist/site/paths.js.map +1 -0
- package/dist/site/policy.d.ts +17 -0
- package/dist/site/policy.js +26 -0
- package/dist/site/policy.js.map +1 -0
- package/dist/site/publish.d.ts +14 -0
- package/dist/site/publish.js +90 -0
- package/dist/site/publish.js.map +1 -0
- package/dist/site/relative.d.ts +14 -0
- package/dist/site/relative.js +265 -0
- package/dist/site/relative.js.map +1 -0
- package/dist/site/skills-build.d.ts +22 -0
- package/dist/site/skills-build.js +126 -0
- package/dist/site/skills-build.js.map +1 -0
- package/dist/site/skills-data.d.ts +89 -0
- package/dist/site/skills-data.js +94 -0
- package/dist/site/skills-data.js.map +1 -0
- package/dist/site/staging.d.ts +19 -0
- package/dist/site/staging.js +76 -0
- package/dist/site/staging.js.map +1 -0
- package/dist/site/ui-icons.d.ts +4 -0
- package/dist/site/ui-icons.js +19 -0
- package/dist/site/ui-icons.js.map +1 -0
- package/dist/skills/command.d.ts +8 -0
- package/dist/skills/command.js +64 -0
- package/dist/skills/command.js.map +1 -0
- package/dist/skills/frontmatter.d.ts +37 -0
- package/dist/skills/frontmatter.js +219 -0
- package/dist/skills/frontmatter.js.map +1 -0
- package/dist/skills/graph.d.ts +39 -0
- package/dist/skills/graph.js +100 -0
- package/dist/skills/graph.js.map +1 -0
- package/dist/skills/ignore.d.ts +34 -0
- package/dist/skills/ignore.js +138 -0
- package/dist/skills/ignore.js.map +1 -0
- package/dist/skills/lines.d.ts +53 -0
- package/dist/skills/lines.js +221 -0
- package/dist/skills/lines.js.map +1 -0
- package/dist/skills/map-command.d.ts +28 -0
- package/dist/skills/map-command.js +533 -0
- package/dist/skills/map-command.js.map +1 -0
- package/dist/skills/mermaid.d.ts +29 -0
- package/dist/skills/mermaid.js +261 -0
- package/dist/skills/mermaid.js.map +1 -0
- package/dist/skills/metro.d.ts +8 -0
- package/dist/skills/metro.js +93 -0
- package/dist/skills/metro.js.map +1 -0
- package/dist/skills/read.d.ts +17 -0
- package/dist/skills/read.js +54 -0
- package/dist/skills/read.js.map +1 -0
- package/dist/skills/rules.d.ts +28 -0
- package/dist/skills/rules.js +57 -0
- package/dist/skills/rules.js.map +1 -0
- package/dist/skills/source.d.ts +66 -0
- package/dist/skills/source.js +281 -0
- package/dist/skills/source.js.map +1 -0
- package/dist/skills/walk.d.ts +64 -0
- package/dist/skills/walk.js +281 -0
- package/dist/skills/walk.js.map +1 -0
- package/dist/source.d.ts +40 -0
- package/dist/source.js +199 -0
- package/dist/source.js.map +1 -0
- package/dist/stdout.d.ts +2 -0
- package/dist/stdout.js +24 -0
- package/dist/stdout.js.map +1 -0
- package/dist/validate.d.ts +45 -0
- package/dist/validate.js +321 -0
- package/dist/validate.js.map +1 -0
- package/dist/views.d.ts +25 -0
- package/dist/views.js +58 -0
- package/dist/views.js.map +1 -0
- package/examples/catalogue-repository/.github/workflows/stackledger.yml +122 -0
- package/examples/catalogue-repository/README.md +96 -0
- package/examples/catalogue-repository/catalog/catalog-info.yaml +12 -0
- package/examples/hosting/Caddyfile +69 -0
- package/examples/northwind/catalog-info.yaml +680 -0
- package/examples/northwind/stackledger.yaml +16 -0
- package/examples/northwind-machine/snapshot.json +309 -0
- package/examples/northwind-skills/agents/builder.md +10 -0
- package/examples/northwind-skills/agents/reviewer.md +10 -0
- package/examples/northwind-skills/designer/SKILL.md +8 -0
- package/examples/northwind-skills/editor/SKILL.md +8 -0
- package/examples/northwind-skills/engineering/SKILL.md +12 -0
- package/examples/northwind-skills/linter/SKILL.md +8 -0
- package/examples/northwind-skills/linter/rules.md +5 -0
- package/examples/northwind-skills/publishing/SKILL.md +12 -0
- package/examples/northwind-skills/publishing/rules.md +5 -0
- package/examples/northwind-skills/spec-writer/SKILL.md +8 -0
- package/examples/northwind-skills/stackledger-skills.yaml +51 -0
- package/examples/northwind-skills/tester/SKILL.md +10 -0
- package/examples/northwind-skills/writer/SKILL.md +8 -0
- package/examples/northwind-skills/writer/rules.md +6 -0
- package/npm-shrinkwrap.json +5016 -0
- package/package.json +52 -4
- package/site/LICENSE-astroplate +21 -0
- package/site/README.md +18 -0
- package/site/package.json +6 -0
- package/site/public/brand-mark-dark.svg +7 -0
- package/site/public/favicon.svg +6 -0
- package/site/public/home-banner.svg +93 -0
- package/site/public/link-icons/email-dark.svg +7 -0
- package/site/public/link-icons/email-light.svg +6 -0
- package/site/public/link-icons/github-dark.svg +8 -0
- package/site/public/link-icons/github-light.svg +7 -0
- package/site/public/link-icons/linkedin-dark.svg +8 -0
- package/site/public/link-icons/linkedin-light.svg +7 -0
- package/site/public/link-icons/website-dark.svg +8 -0
- package/site/public/link-icons/website-light.svg +7 -0
- package/site/src/components/Footer.astro +25 -0
- package/site/src/components/Header.astro +35 -0
- package/site/src/components/Impact.astro +55 -0
- package/site/src/components/LinkOrText.astro +12 -0
- package/site/src/components/SkillItem.astro +141 -0
- package/site/src/components/SubNav.astro +40 -0
- package/site/src/components/ThemeSwitch.astro +13 -0
- package/site/src/components/Themed.astro +15 -0
- package/site/src/layouts/Base.astro +52 -0
- package/site/src/lib/site.ts +25 -0
- package/site/src/pages/[reports].astro +222 -0
- package/site/src/pages/agents/[file].astro +14 -0
- package/site/src/pages/index.astro +72 -0
- package/site/src/pages/journeys/[name].astro +50 -0
- package/site/src/pages/journeys/index.astro +37 -0
- package/site/src/pages/licences/[name].astro +56 -0
- package/site/src/pages/map/index.astro +78 -0
- package/site/src/pages/playbooks/[file].astro +14 -0
- package/site/src/pages/rules/[...rules].astro +61 -0
- package/site/src/pages/skill-map/[...map].astro +101 -0
- package/site/src/pages/skills/[...list].astro +75 -0
- package/site/src/pages/skills/[file].astro +14 -0
- package/site/src/pages/software/[name].astro +155 -0
- package/site/src/pages/software/index.astro +71 -0
- package/site/src/scripts/diagram.ts +8 -0
- package/site/src/scripts/links.ts +31 -0
- package/site/src/scripts/map.ts +133 -0
- package/site/src/scripts/software.ts +32 -0
- package/site/src/scripts/theme.ts +52 -0
- package/site/src/styles/base.css +481 -0
- package/site/src/styles/fonts.css +60 -0
- package/site/src/styles/override.css +1 -0
- package/site/src/styles/pages.css +315 -0
- package/site/src/styles/tokens.css +87 -0
- package/skills/stackledger/SKILL.md +155 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/** Build both sites of a catalogue into a staging folder: the internal building block of
|
|
2
|
+
* `stackledger build` (design D1, D2, D8).
|
|
3
|
+
*
|
|
4
|
+
* What: prepareBuild(folder or loaded folder, staging, date) validates the catalogue, builds the staff site and then
|
|
5
|
+
* the full site, each from its own SiteData, working copy and caches, and writes the root files:
|
|
6
|
+
* <staging>/site-staff/ <staging>/site-full/ <staging>/root/{_headers, robots.txt, _redirects, .stackledger-build}
|
|
7
|
+
* In the personal mode (Settings spec.sites: [full]) there is no site-staff; the empty file
|
|
8
|
+
* <staging>/full-only says so to the publication and to the manual restore.
|
|
9
|
+
* Each site also holds `_headers` and `robots.txt`; the full site also holds `renewals.ics`.
|
|
10
|
+
* Nothing is written outside `staging`.
|
|
11
|
+
*
|
|
12
|
+
* The command (src/site/command.ts) checks the options and the output folder, creates `staging` as
|
|
13
|
+
* `<out>/.stackledger-tmp-*`, publishes the entries (src/site/publish.ts) and writes the report;
|
|
14
|
+
* PreparedBuild carries the catalogue counts, the page counts and the full map's diagnostic lines.
|
|
15
|
+
*
|
|
16
|
+
* How Astro runs (proven by docs/spikes/2026-10-20-astro-build/): from a writable copy of the shipped
|
|
17
|
+
* `site/` folder with the current directory set to it, `outDir` inside it, every dependency bundled
|
|
18
|
+
* into the render step, packages resolved from this package through a Vite plugin, caches in staging
|
|
19
|
+
* and telemetry off. process.chdir makes this one build at a time per process.
|
|
20
|
+
*
|
|
21
|
+
* What can go wrong: an Astro or Vite upgrade that emits a URL form relative.ts does not handle, or
|
|
22
|
+
* inline code, fails the scan and throws before anything is published.
|
|
23
|
+
*/
|
|
24
|
+
import { chmodSync, cpSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, writeFileSync } from 'node:fs';
|
|
25
|
+
import { createRequire } from 'node:module';
|
|
26
|
+
import { basename, join } from 'node:path';
|
|
27
|
+
import { fileURLToPath } from 'node:url';
|
|
28
|
+
import { loadFolder } from '../source.js';
|
|
29
|
+
import { validateLoaded } from '../validate.js';
|
|
30
|
+
import { resolveSites } from '../views.js';
|
|
31
|
+
import { siteColorNames } from '../schema.js';
|
|
32
|
+
import { mapNotes } from '../map/command.js';
|
|
33
|
+
import { buildSiteData, CALENDAR_FILE } from './data.js';
|
|
34
|
+
import { ownerNames } from './owners.js';
|
|
35
|
+
import { HEADERS, MARKER, MARKER_NAME, POLICY, redirects, ROBOTS } from './policy.js';
|
|
36
|
+
import { FULL_ONLY } from './staging.js';
|
|
37
|
+
import { listFiles, relativise, scan } from './relative.js';
|
|
38
|
+
import { buildSkillsData } from './skills-data.js';
|
|
39
|
+
import { skillsReport } from './skills-build.js';
|
|
40
|
+
const require = createRequire(import.meta.url);
|
|
41
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
42
|
+
const packageRoot = fileURLToPath(new URL('../../', import.meta.url));
|
|
43
|
+
const siteSource = join(packageRoot, 'site');
|
|
44
|
+
/** Font files copied from the @fontsource packages: Heebo for text, Signika for headings and Lato for
|
|
45
|
+
* the map and diagrams (as brunosouzas.com and its illustrations). */
|
|
46
|
+
const FONT_FILES = [
|
|
47
|
+
['@fontsource/heebo', 'heebo-latin-400-normal.woff2'],
|
|
48
|
+
['@fontsource/heebo', 'heebo-latin-600-normal.woff2'],
|
|
49
|
+
['@fontsource/signika', 'signika-latin-500-normal.woff2'],
|
|
50
|
+
['@fontsource/signika', 'signika-latin-700-normal.woff2'],
|
|
51
|
+
['@fontsource/lato', 'lato-latin-400-normal.woff2'],
|
|
52
|
+
['@fontsource/lato', 'lato-latin-700-normal.woff2'],
|
|
53
|
+
['@fontsource/lato', 'lato-latin-900-normal.woff2'],
|
|
54
|
+
];
|
|
55
|
+
const HEX_COLOUR = /^#[0-9a-fA-F]{6}$/;
|
|
56
|
+
/** Every Astro preference a build reads, answered in the working copy (see prepareWorkingCopy). */
|
|
57
|
+
const ASTRO_PREFERENCES = { devToolbar: { enabled: false } };
|
|
58
|
+
export function packageVersion() {
|
|
59
|
+
return JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8')).version;
|
|
60
|
+
}
|
|
61
|
+
/** The light-theme overrides from spec.site.colors; only #RRGGBB values reach the stylesheet. */
|
|
62
|
+
export function overrideCss(colors) {
|
|
63
|
+
const lines = siteColorNames.flatMap(name => {
|
|
64
|
+
const value = colors[name];
|
|
65
|
+
if (value === undefined)
|
|
66
|
+
return [];
|
|
67
|
+
if (!HEX_COLOUR.test(value))
|
|
68
|
+
throw new Error('Site colours must be #RRGGBB');
|
|
69
|
+
return [` --color-${name}: ${value};`];
|
|
70
|
+
});
|
|
71
|
+
const header = '/* Generated by stackledger from spec.site.colors: light theme only. */\n';
|
|
72
|
+
return lines.length ? `${header}:root {\n${lines.join('\n')}\n}\n` : header;
|
|
73
|
+
}
|
|
74
|
+
/** cpSync keeps the modes of a read-only install; Astro must write .astro/ and staging must be removable. */
|
|
75
|
+
function makeWritable(dir) {
|
|
76
|
+
chmodSync(dir, 0o755);
|
|
77
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
78
|
+
const full = join(dir, entry.name);
|
|
79
|
+
if (entry.isDirectory())
|
|
80
|
+
makeWritable(full);
|
|
81
|
+
else if (entry.isFile())
|
|
82
|
+
chmodSync(full, 0o644);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function prepareWorkingCopy(staging, view, data) {
|
|
86
|
+
const work = join(staging, `work-${view}`);
|
|
87
|
+
cpSync(siteSource, work, { recursive: true });
|
|
88
|
+
makeWritable(work);
|
|
89
|
+
mkdirSync(join(work, 'src', 'data'), { recursive: true });
|
|
90
|
+
writeFileSync(join(work, 'src', 'data', 'site.json'), JSON.stringify(data) + '\n');
|
|
91
|
+
writeFileSync(join(work, 'src', 'data', 'policy.json'), JSON.stringify(POLICY) + '\n');
|
|
92
|
+
writeFileSync(join(work, 'src', 'styles', 'override.css'), overrideCss(data.colors));
|
|
93
|
+
// Astro reads its preferences from the project's .astro/settings.json before the user's home
|
|
94
|
+
// folder; answering here keeps the build from touching $HOME (refused under the permission model).
|
|
95
|
+
mkdirSync(join(work, '.astro'), { recursive: true });
|
|
96
|
+
writeFileSync(join(work, '.astro', 'settings.json'), JSON.stringify(ASTRO_PREFERENCES) + '\n');
|
|
97
|
+
mkdirSync(join(work, 'src', 'fonts'), { recursive: true });
|
|
98
|
+
for (const [pkg, file] of FONT_FILES)
|
|
99
|
+
cpSync(require.resolve(`${pkg}/files/${file}`), join(work, 'src', 'fonts', file));
|
|
100
|
+
// The design system's variables (--ds-*), read by tokens.css.
|
|
101
|
+
cpSync(require.resolve('@brunosouzas/design-system/tokens.css'), join(work, 'src', 'styles', 'ds-tokens.css'));
|
|
102
|
+
return work;
|
|
103
|
+
}
|
|
104
|
+
/** Resolve a bare import that fails from the working copy as if this module imported it (no node_modules link). */
|
|
105
|
+
function packageResolver() {
|
|
106
|
+
return {
|
|
107
|
+
name: 'stackledger:package-resolver',
|
|
108
|
+
enforce: 'pre',
|
|
109
|
+
async resolveId(source, importer, options) {
|
|
110
|
+
if (source.startsWith('.') || source.startsWith('/') || source.startsWith('\0') || source.includes(':'))
|
|
111
|
+
return null;
|
|
112
|
+
const own = await this.resolve(source, importer, { ...options, skipSelf: true });
|
|
113
|
+
return own ?? this.resolve(source, thisFile, { ...options, skipSelf: true });
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function astroConfig(staging, view, work) {
|
|
118
|
+
return {
|
|
119
|
+
root: work,
|
|
120
|
+
configFile: false,
|
|
121
|
+
mode: 'production',
|
|
122
|
+
logLevel: 'error',
|
|
123
|
+
output: 'static',
|
|
124
|
+
trailingSlash: 'always',
|
|
125
|
+
outDir: join(work, 'dist'),
|
|
126
|
+
cacheDir: join(staging, `cache-${view}`, 'astro'),
|
|
127
|
+
integrations: [],
|
|
128
|
+
devToolbar: { enabled: false },
|
|
129
|
+
prefetch: false,
|
|
130
|
+
build: { format: 'directory', inlineStylesheets: 'never' },
|
|
131
|
+
vite: {
|
|
132
|
+
cacheDir: join(staging, `cache-${view}`, 'vite'),
|
|
133
|
+
build: { assetsInlineLimit: 0, modulePreload: false },
|
|
134
|
+
// Bundle every dependency into the render step, so a package of the same name hoisted
|
|
135
|
+
// elsewhere in the tree (cookie 0.7 from the MCP SDK) is never picked up instead of Astro's.
|
|
136
|
+
ssr: { noExternal: true },
|
|
137
|
+
environments: { prerender: { resolve: { noExternal: true } } },
|
|
138
|
+
plugins: [packageResolver()],
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** Build one site; `calendar` (full site only) is written as renewals.ics before the scan, so it is
|
|
143
|
+
* checked and published with the pages. */
|
|
144
|
+
async function buildView(staging, view, data, calendar) {
|
|
145
|
+
const work = prepareWorkingCopy(staging, view, data);
|
|
146
|
+
// Telemetry must be off before Astro is first loaded.
|
|
147
|
+
process.env.ASTRO_TELEMETRY_DISABLED = '1';
|
|
148
|
+
const { build } = await import('astro');
|
|
149
|
+
// Astro writes its prerender bundle inside outDir only when outDir is inside the current directory.
|
|
150
|
+
const previous = process.cwd();
|
|
151
|
+
process.chdir(work);
|
|
152
|
+
try {
|
|
153
|
+
await build(astroConfig(staging, view, work));
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
process.chdir(previous);
|
|
157
|
+
}
|
|
158
|
+
const dir = join(staging, `site-${view}`);
|
|
159
|
+
renameSync(join(work, 'dist'), dir);
|
|
160
|
+
if (calendar !== undefined)
|
|
161
|
+
writeFileSync(join(dir, CALENDAR_FILE), calendar);
|
|
162
|
+
relativise(dir);
|
|
163
|
+
// The staging folder's absolute path and random name, and the working copy, must not leak into a file.
|
|
164
|
+
const problems = scan(dir, [staging, work, basename(staging)], data.home.links.map(link => link.url));
|
|
165
|
+
if (problems.length)
|
|
166
|
+
throw new Error(`The ${view} site has URL forms or inline code the build does not allow: ${problems.join('; ')}`);
|
|
167
|
+
writeFileSync(join(dir, '_headers'), HEADERS);
|
|
168
|
+
writeFileSync(join(dir, 'robots.txt'), ROBOTS);
|
|
169
|
+
return { dir, pages: listFiles(dir).filter(file => file.endsWith('.html')).length };
|
|
170
|
+
}
|
|
171
|
+
/** Build both sites and the root files into `staging`, which must exist and be empty. */
|
|
172
|
+
export async function prepareBuild(folder, stagingPath, date, version = packageVersion(), skillSet) {
|
|
173
|
+
// Astro compares module paths with process.cwd(), which is always the real path (on macOS the
|
|
174
|
+
// temporary folder /var is a link to /private/var), so the working copies use the real path too.
|
|
175
|
+
const staging = realpathSync(stagingPath);
|
|
176
|
+
const loaded = typeof folder === 'string' ? await loadFolder(folder) : folder;
|
|
177
|
+
const catalogue = validateLoaded(loaded);
|
|
178
|
+
// The staff site is built first, before the full data exists anywhere (site-security, One view per site).
|
|
179
|
+
const owners = ownerNames(loaded.sources);
|
|
180
|
+
const sites = resolveSites(catalogue);
|
|
181
|
+
// One Skills section for every site (skills-site, Same skills in every site): built once, copied into each.
|
|
182
|
+
const skills = skillSet ? buildSkillsData(skillSet) : undefined;
|
|
183
|
+
const withSkills = (data) => (skills ? { ...data, skills: skills.data } : data);
|
|
184
|
+
const staff = sites.includes('staff') ? await buildView(staging, 'staff', withSkills(buildSiteData(catalogue, 'staff', version, undefined, owners).data)) : undefined;
|
|
185
|
+
if (!staff)
|
|
186
|
+
writeFileSync(join(staging, FULL_ONLY), '');
|
|
187
|
+
const fullData = buildSiteData(catalogue, 'full', version, date, owners);
|
|
188
|
+
const full = await buildView(staging, 'full', withSkills(fullData.data), fullData.calendar);
|
|
189
|
+
const root = join(staging, 'root');
|
|
190
|
+
mkdirSync(root);
|
|
191
|
+
writeFileSync(join(root, '_headers'), HEADERS);
|
|
192
|
+
writeFileSync(join(root, 'robots.txt'), ROBOTS);
|
|
193
|
+
writeFileSync(join(root, '_redirects'), redirects(sites));
|
|
194
|
+
writeFileSync(join(root, MARKER_NAME), MARKER);
|
|
195
|
+
const notes = [...mapNotes(loaded, catalogue, fullData.geometry), ...(skills && skillSet ? skillsReport(skillSet, skills.geometry) : [])];
|
|
196
|
+
return { ...(staff ? { staff } : {}), catalogue, full, root, notes };
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/site/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAA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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1I,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/** `stackledger build <folder> --out <dir> [--date YYYY-MM-DD]` (build-command spec). Called by
|
|
2
|
+
* src/cli.ts; run node dist/cli.js build examples/northwind --out ./public.
|
|
3
|
+
*
|
|
4
|
+
* Order, so that a refusal never creates or changes anything: parse the options, load the catalogue
|
|
5
|
+
* folder, check the output folder (after resolving symbolic links: not the catalogue, not inside it,
|
|
6
|
+
* not containing it; no staging folder holding `old/` and no `.stackledger-tmp-*` link or file
|
|
7
|
+
* (staging.ts); then empty or marked by an earlier build with a regular marker file holding the
|
|
8
|
+
* marker text, and no published entry that is a symbolic link). Only then is the output folder
|
|
9
|
+
* created, stale staging folders removed, a new staging folder made, both sites prepared in it
|
|
10
|
+
* (build.ts) and published by renames (publish.ts).
|
|
11
|
+
*
|
|
12
|
+
* The output folder's real path, device and inode are recorded when it is checked (or created) and
|
|
13
|
+
* compared again immediately before every change (paths.ts); a mismatch stops with exit 1.
|
|
14
|
+
*
|
|
15
|
+
* Exit codes: usage and folder errors throw a plain Error (exit 2, with usage, from src/cli.ts). A
|
|
16
|
+
* failure while building or publishing throws InternalError (exit 1) after the output folder is
|
|
17
|
+
* restored and the staging folder removed. A failed undo, a staging folder left with `old/` and a
|
|
18
|
+
* moved output folder are exit 1 too, and the staging folder is kept. After the commit, a failure to
|
|
19
|
+
* remove the staging folder is a warning, with exit 0. stderr holds the build report only.
|
|
20
|
+
*
|
|
21
|
+
* Every filesystem call on the output folder goes through `ops` (fs-ops.ts). src/cli.ts passes none,
|
|
22
|
+
* so the CLI uses node:fs; tests pass a wrapper that fails or swaps the folder at a chosen call.
|
|
23
|
+
*/
|
|
24
|
+
import { randomBytes } from 'node:crypto';
|
|
25
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
26
|
+
import { parseArgs } from 'node:util';
|
|
27
|
+
import { isDate, localDate } from '../graph.js';
|
|
28
|
+
import { LAST_WINDOW_DATE, windowFits } from '../reports.js';
|
|
29
|
+
import { REPORT_DAYS } from './data.js';
|
|
30
|
+
import { loadFolder } from '../source.js';
|
|
31
|
+
import { internal } from '../errors.js';
|
|
32
|
+
import { problemCounts } from '../map/command.js';
|
|
33
|
+
import { prepareBuild, packageVersion } from './build.js';
|
|
34
|
+
import { validateLoaded } from '../validate.js';
|
|
35
|
+
import { refuseSkillsOutput, skillsInUse, skillsStops } from './skills-build.js';
|
|
36
|
+
import { NODE_FS } from './fs-ops.js';
|
|
37
|
+
import { MARKER, MARKER_NAME } from './policy.js';
|
|
38
|
+
import { assertSameFolder, FolderChanged, folderIdentity, lstatOrUndefined, within } from './paths.js';
|
|
39
|
+
import { ENTRIES, publish, UndoFailed } from './publish.js';
|
|
40
|
+
import { OLD_NAME, removeStaging, STAGING_PREFIX, staleStaging } from './staging.js';
|
|
41
|
+
const PROXY_REMINDER = 'Serve both folders only behind an identity-aware proxy: full/ for the people allowed to see costs, staff/ for everyone else.';
|
|
42
|
+
const PERSONAL_PROXY_REMINDER = 'Serve full/ only behind an identity-aware proxy, for the people allowed to see costs.';
|
|
43
|
+
/** The real path of `path`, or of its nearest existing ancestor joined with the missing rest. */
|
|
44
|
+
function realTarget(path, ops) {
|
|
45
|
+
const missing = [];
|
|
46
|
+
let current = path;
|
|
47
|
+
for (;;) {
|
|
48
|
+
try {
|
|
49
|
+
return join(ops.realpath(current), ...missing.reverse());
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error.code !== 'ENOENT')
|
|
53
|
+
throw new Error(`Output folder cannot be read: ${current}`);
|
|
54
|
+
// A dangling symbolic link exists but cannot be resolved: refuse it rather than write through it.
|
|
55
|
+
if (lstatOrUndefined(current, ops))
|
|
56
|
+
throw new Error('Output folder is a broken symbolic link');
|
|
57
|
+
const parent = dirname(current);
|
|
58
|
+
if (parent === current)
|
|
59
|
+
throw new Error('Output folder cannot be resolved');
|
|
60
|
+
missing.push(basename(current));
|
|
61
|
+
current = parent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** The output folder's own status and entries, or undefined when it does not exist yet. */
|
|
66
|
+
function readOutput(target, ops) {
|
|
67
|
+
try {
|
|
68
|
+
const stats = ops.lstat(target);
|
|
69
|
+
if (!stats.isDirectory())
|
|
70
|
+
throw new Error('Output path is not a folder');
|
|
71
|
+
return { stats, entries: ops.readdir(target) };
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
const code = error.code;
|
|
75
|
+
if (code === 'ENOENT')
|
|
76
|
+
return undefined;
|
|
77
|
+
if (code === undefined)
|
|
78
|
+
throw error;
|
|
79
|
+
throw new Error('Output folder cannot be read');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Check the output folder; throws a usage error (exit 2) or InternalError (exit 1) to refuse it. */
|
|
83
|
+
function checkOutput(out, catalogue, ops) {
|
|
84
|
+
const target = realTarget(out, ops);
|
|
85
|
+
if (within(target, catalogue))
|
|
86
|
+
throw new Error('Output folder must not be the catalogue folder or inside it');
|
|
87
|
+
if (within(catalogue, target))
|
|
88
|
+
throw new Error('Output folder must not contain the catalogue folder');
|
|
89
|
+
const existing = readOutput(target, ops);
|
|
90
|
+
if (!existing)
|
|
91
|
+
return { target, identity: undefined, stale: [] };
|
|
92
|
+
// Staging folders first: one left with old/ needs the manual restore, whatever else is there.
|
|
93
|
+
const stale = staleStaging(target, existing.entries, ops);
|
|
94
|
+
const others = existing.entries.filter(name => !name.startsWith(STAGING_PREFIX));
|
|
95
|
+
if (others.length && !isMarker(join(target, MARKER_NAME), ops)) {
|
|
96
|
+
throw new Error(`Output folder is not empty and was not written by stackledger build (no ${MARKER_NAME} file with the marker text)`);
|
|
97
|
+
}
|
|
98
|
+
// A rename or removal through a link would act outside the output folder: refuse it up front.
|
|
99
|
+
const linked = ENTRIES.find(entry => lstatOrUndefined(join(target, entry.name), ops)?.isSymbolicLink());
|
|
100
|
+
if (linked)
|
|
101
|
+
throw new Error(`Output folder entry ${linked.name} is a symbolic link; stackledger build does not replace links`);
|
|
102
|
+
const identity = { path: target, real: target, dev: existing.stats.dev, ino: existing.stats.ino };
|
|
103
|
+
return { target, identity, stale };
|
|
104
|
+
}
|
|
105
|
+
/** True when `path` is a regular file (not a link, not a folder) holding exactly the marker text. */
|
|
106
|
+
function isMarker(path, ops) {
|
|
107
|
+
const stats = lstatOrUndefined(path, ops);
|
|
108
|
+
if (!stats?.isFile() || stats.size !== Buffer.byteLength(MARKER))
|
|
109
|
+
return false;
|
|
110
|
+
return ops.readFile(path) === MARKER;
|
|
111
|
+
}
|
|
112
|
+
/** Create the missing output folder and record its identity. */
|
|
113
|
+
function createOutput(target, ops) {
|
|
114
|
+
ops.mkdir(target, { recursive: true });
|
|
115
|
+
return folderIdentity(target, ops);
|
|
116
|
+
}
|
|
117
|
+
/** The error to throw for a failure before the commit. The staging folder is removed, unless the
|
|
118
|
+
* output folder moved (nothing may change) or the undo failed (it holds the previous entries). */
|
|
119
|
+
function failedBuild(error, staging, identity, ops) {
|
|
120
|
+
if (error instanceof FolderChanged || error instanceof UndoFailed)
|
|
121
|
+
return error;
|
|
122
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
123
|
+
assertSameFolder(identity, ops);
|
|
124
|
+
try {
|
|
125
|
+
ops.rm(staging);
|
|
126
|
+
}
|
|
127
|
+
catch (cleanupError) {
|
|
128
|
+
return internal('build', `${reason}; the staging folder ${staging} could not be removed (${cleanupError.message})`);
|
|
129
|
+
}
|
|
130
|
+
return internal('build', error);
|
|
131
|
+
}
|
|
132
|
+
/** After the commit: remove `old/` (the replaced build), then the staging folder. A failure is a
|
|
133
|
+
* warning line; a moved output folder still throws (exit 1, nothing removed). */
|
|
134
|
+
function cleanUp(staging, identity, ops) {
|
|
135
|
+
const steps = [
|
|
136
|
+
[join(staging, OLD_NAME), `it holds only the entries this build replaced: remove it by hand (until then stackledger build refuses this output folder)`],
|
|
137
|
+
[staging, 'the next build removes it'],
|
|
138
|
+
];
|
|
139
|
+
for (const [path, advice] of steps) {
|
|
140
|
+
assertSameFolder(identity, ops);
|
|
141
|
+
try {
|
|
142
|
+
ops.rm(path);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return [`Warning: the build is published, but ${staging} could not be removed (${error.message}); ${advice}`];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
const plural = (count, word) => `${count} ${count === 1 ? word : `${word}s`}`;
|
|
151
|
+
function report(prepared, out, warnings) {
|
|
152
|
+
const lines = [
|
|
153
|
+
...problemCounts('build', prepared.catalogue),
|
|
154
|
+
...prepared.notes,
|
|
155
|
+
...warnings,
|
|
156
|
+
...(prepared.staff ? [`Built the staff site in ${join(out, 'staff')} (${plural(prepared.staff.pages, 'page')})`] : []),
|
|
157
|
+
`Built the full site in ${join(out, 'full')} (${plural(prepared.full.pages, 'page')})`,
|
|
158
|
+
prepared.staff ? PROXY_REMINDER : PERSONAL_PROXY_REMINDER,
|
|
159
|
+
];
|
|
160
|
+
return lines.join('\n') + '\n';
|
|
161
|
+
}
|
|
162
|
+
/** Parse the command's arguments; throws a usage error for anything the spec refuses. */
|
|
163
|
+
function parseBuildArgs(args) {
|
|
164
|
+
const { values, positionals } = parseArgs({
|
|
165
|
+
args,
|
|
166
|
+
strict: true,
|
|
167
|
+
allowPositionals: true,
|
|
168
|
+
options: { out: { type: 'string' }, date: { type: 'string' }, skills: { type: 'string', multiple: true } },
|
|
169
|
+
});
|
|
170
|
+
const [, folder, ...extra] = positionals;
|
|
171
|
+
if (!folder)
|
|
172
|
+
throw new Error('A catalogue folder is required');
|
|
173
|
+
if (extra.length)
|
|
174
|
+
throw new Error('Only one folder is accepted');
|
|
175
|
+
if (values.out === undefined || values.out === '')
|
|
176
|
+
throw new Error('--out is required');
|
|
177
|
+
const skills = values.skills ?? [];
|
|
178
|
+
if (skills.some(value => value === ''))
|
|
179
|
+
throw new Error('--skills needs a folder');
|
|
180
|
+
const date = values.date ?? localDate();
|
|
181
|
+
if (!isDate(date))
|
|
182
|
+
throw new Error('Map date must be a real YYYY-MM-DD date');
|
|
183
|
+
if (!windowFits(date, REPORT_DAYS))
|
|
184
|
+
throw new Error(`--date plus the ${REPORT_DAYS}-day report window must be no later than ${LAST_WINDOW_DATE}`);
|
|
185
|
+
return { folder, out: values.out, date, skills };
|
|
186
|
+
}
|
|
187
|
+
export async function buildCommand(args, ops = NODE_FS) {
|
|
188
|
+
const options = parseBuildArgs(args);
|
|
189
|
+
// Usage checks first: loading the folder throws a usage error for a missing or unreadable folder.
|
|
190
|
+
const loaded = await loadFolder(resolve(options.folder));
|
|
191
|
+
const catalogue = ops.realpath(resolve(options.folder));
|
|
192
|
+
const out = resolve(options.out);
|
|
193
|
+
// The skill set (exit 2 for a folder that cannot be read), then the output folder against both inputs.
|
|
194
|
+
const validated = validateLoaded(loaded);
|
|
195
|
+
// Configured folders are relative to the catalogue folder as given, links in it not followed first.
|
|
196
|
+
const skills = await skillsInUse(options.skills, loaded, validated, resolve(options.folder), ops);
|
|
197
|
+
// The skill-set refusals (exit 2) come first: checkOutput can stop with exit 1 on a staging folder left with old/.
|
|
198
|
+
refuseSkillsOutput(realTarget(out, ops), skills, ops);
|
|
199
|
+
const checked = checkOutput(out, catalogue, ops);
|
|
200
|
+
const { target } = checked;
|
|
201
|
+
// Exit-1 stops come after every exit-2 check and before anything is created.
|
|
202
|
+
skillsStops(skills);
|
|
203
|
+
// From here on, every change first checks that the output folder is still the validated one.
|
|
204
|
+
const identity = checked.identity ?? createOutput(target, ops);
|
|
205
|
+
removeStaging(checked.stale, identity, ops);
|
|
206
|
+
const staging = join(target, `${STAGING_PREFIX}${randomBytes(8).toString('hex')}`);
|
|
207
|
+
assertSameFolder(identity, ops);
|
|
208
|
+
ops.mkdir(staging);
|
|
209
|
+
let prepared;
|
|
210
|
+
try {
|
|
211
|
+
prepared = await prepareBuild(loaded, staging, options.date, packageVersion(), skills.set);
|
|
212
|
+
publish(target, staging, identity, ops);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
throw failedBuild(error, staging, identity, ops);
|
|
216
|
+
}
|
|
217
|
+
// Committed: the new sites are in place. Removing the replaced entries is best effort.
|
|
218
|
+
const warnings = cleanUp(staging, identity, ops);
|
|
219
|
+
process.stderr.write(report(prepared, out, [...skills.notes, ...warnings]));
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/site/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OA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