@mvarble/mesearch-workflow 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +109 -2
- package/agents/reference/authoring.md +127 -0
- package/agents/reference/workflow.md +106 -0
- package/agents/skills/wf-abandon/SKILL.md +16 -0
- package/agents/skills/wf-approve/SKILL.md +23 -0
- package/agents/skills/wf-build/SKILL.md +41 -0
- package/agents/skills/wf-plan/SKILL.md +47 -0
- package/agents/skills/wf-publish/SKILL.md +41 -0
- package/agents/skills/wf-reopen/SKILL.md +20 -0
- package/agents/skills/wf-resume/SKILL.md +16 -0
- package/agents/skills/wf-start/SKILL.md +25 -0
- package/agents/skills/wf-status/SKILL.md +12 -0
- package/agents/skills/wf-writeup/SKILL.md +58 -0
- package/app/ambient.d.ts +71 -0
- package/app/lib/components/CopyCode.svelte +24 -0
- package/app/lib/components/DocumentMap.svelte +38 -0
- package/app/lib/components/DocumentPage.svelte +184 -0
- package/app/lib/components/Icon.svelte +35 -0
- package/app/lib/components/ImageFigure.svelte +213 -0
- package/app/lib/components/LinkList.svelte +46 -0
- package/app/lib/components/ModelGraph.svelte +169 -0
- package/app/lib/components/OpenEntry.svelte +35 -0
- package/app/lib/components/PageList.svelte +35 -0
- package/app/lib/components/PrevNext.svelte +24 -0
- package/app/lib/components/Proof.svelte +12 -0
- package/app/lib/components/Shell.svelte +55 -0
- package/app/lib/components/Sidebar.svelte +77 -0
- package/app/lib/components/StageRail.svelte +30 -0
- package/app/lib/components/Statement.svelte +41 -0
- package/app/lib/components/Tex.svelte +25 -0
- package/app/lib/components/ThemeToggle.svelte +17 -0
- package/app/lib/components/Timeline.svelte +31 -0
- package/app/lib/components/Toc.svelte +41 -0
- package/app/lib/components/TopBar.svelte +55 -0
- package/app/lib/components/TrackCard.svelte +20 -0
- package/app/lib/documents.ts +52 -0
- package/app/lib/graph/describe.ts +29 -0
- package/app/lib/graph/geometry.ts +296 -0
- package/app/lib/graph/spec.ts +158 -0
- package/app/lib/kit.ts +11 -0
- package/app/lib/load.ts +12 -0
- package/app/lib/map.ts +6 -0
- package/app/lib/nav.ts +91 -0
- package/app/lib/questions.ts +33 -0
- package/app/lib/server/document.ts +117 -0
- package/app/lib/server/map.ts +41 -0
- package/app/lib/server/markdown.ts +134 -0
- package/app/lib/server/open.ts +35 -0
- package/app/lib/server/repo.ts +6 -0
- package/app/lib/server/specs.ts +26 -0
- package/app/lib/server/title.ts +9 -0
- package/app/lib/state/persisted.svelte.ts +40 -0
- package/app/lib/state/theme.svelte.ts +24 -0
- package/app/lib/tex.ts +99 -0
- package/app/params/slug.ts +5 -0
- package/app/params/track.ts +5 -0
- package/app/routes/+layout.ts +2 -0
- package/app/routes/[...key].md/+server.ts +19 -0
- package/app/routes/[track=track]/+page.server.ts +14 -0
- package/app/routes/[track=track]/+page.svelte +24 -0
- package/app/routes/[track=track]/[slug=slug]/+page.server.ts +9 -0
- package/app/routes/[track=track]/[slug=slug]/+page.svelte +7 -0
- package/app/routes/[track=track]/[slug=slug]/+page.ts +4 -0
- package/app/routes/archive/+page.server.ts +18 -0
- package/app/routes/archive/+page.svelte +44 -0
- package/app/routes/archive/[entry=slug]/+page.server.ts +9 -0
- package/app/routes/archive/[entry=slug]/+page.svelte +7 -0
- package/app/routes/archive/[entry=slug]/+page.ts +4 -0
- package/app/routes/archive/[entry=slug]/[name=slug]/+page.server.ts +14 -0
- package/app/routes/archive/[entry=slug]/[name=slug]/+page.svelte +7 -0
- package/app/routes/archive/[entry=slug]/[name=slug]/+page.ts +4 -0
- package/app/routes/llms-full.txt/+server.ts +17 -0
- package/app/routes/llms.txt/+server.ts +50 -0
- package/app/routes/math/+page.server.ts +21 -0
- package/app/routes/math/+page.svelte +56 -0
- package/app/routes/math/[slug=slug]/+page.server.ts +8 -0
- package/app/routes/math/[slug=slug]/+page.svelte +7 -0
- package/app/routes/math/[slug=slug]/+page.ts +4 -0
- package/app/styles/base.css +98 -0
- package/app/styles/code.css +83 -0
- package/app/styles/index.css +17 -0
- package/app/styles/katex.css +14 -0
- package/app/styles/layout.css +545 -0
- package/app/styles/text.css +96 -0
- package/app/styles/tokens/dimensions.css +31 -0
- package/app/styles/tokens/typography.css +33 -0
- package/app/styles/tokens.css +2 -0
- package/app/styles/utils/archive.css +339 -0
- package/app/styles/utils/buttons.css +28 -0
- package/app/styles/utils/callouts.css +41 -0
- package/app/styles/utils/cards.css +95 -0
- package/app/styles/utils/graph.css +186 -0
- package/app/styles/utils/map.css +45 -0
- package/app/styles/utils/tables.css +25 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +88 -0
- package/dist/cli.js.map +1 -0
- package/dist/engine/cli.d.ts +12 -0
- package/dist/engine/cli.js +744 -0
- package/dist/engine/cli.js.map +1 -0
- package/dist/engine/config.d.ts +40 -0
- package/dist/engine/config.js +16 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/lib.d.ts +108 -0
- package/dist/engine/lib.js +375 -0
- package/dist/engine/lib.js.map +1 -0
- package/dist/engine/main.d.ts +1 -0
- package/dist/engine/main.js +45 -0
- package/dist/engine/main.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/site/hooks.d.ts +27 -0
- package/dist/site/hooks.js +2 -0
- package/dist/site/hooks.js.map +1 -0
- package/dist/site/index.d.ts +1 -0
- package/dist/site/index.js +2 -0
- package/dist/site/index.js.map +1 -0
- package/dist/site/preset/index.d.ts +15 -0
- package/dist/site/preset/index.js +556 -0
- package/dist/site/preset/index.js.map +1 -0
- package/dist/site/preset/runtime.d.ts +42 -0
- package/dist/site/preset/runtime.js +99 -0
- package/dist/site/preset/runtime.js.map +1 -0
- package/dist/site/preset/types.d.ts +87 -0
- package/dist/site/preset/types.js +2 -0
- package/dist/site/preset/types.js.map +1 -0
- package/dist/site/vite.d.ts +14 -0
- package/dist/site/vite.js +202 -0
- package/dist/site/vite.js.map +1 -0
- package/dist/sync/index.d.ts +17 -0
- package/dist/sync/index.js +175 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/init.d.ts +7 -0
- package/dist/sync/init.js +62 -0
- package/dist/sync/init.js.map +1 -0
- package/dist/sync/render.d.ts +3 -0
- package/dist/sync/render.js +118 -0
- package/dist/sync/render.js.map +1 -0
- package/dist/sync/site.d.ts +3 -0
- package/dist/sync/site.js +58 -0
- package/dist/sync/site.js.map +1 -0
- package/package.json +78 -3
- package/templates/.agents/reference/authoring.md +11 -0
- package/templates/.agents/reference/stages/README.md +4 -0
- package/templates/AGENTS.md +36 -0
- package/templates/site/content/landing.md +5 -0
- package/templates/site/katex.config.ts +5 -0
- package/templates/site/package.json +22 -0
- package/templates/site/src/app.d.ts +8 -0
- package/templates/site/src/app.html +23 -0
- package/templates/site/src/lib/components/Logo.svelte +12 -0
- package/templates/site/src/lib/site.ts +39 -0
- package/templates/site/src/routes/+layout.server.ts +3 -0
- package/templates/site/src/routes/+layout.svelte +11 -0
- package/templates/site/src/routes/+page.server.ts +3 -0
- package/templates/site/src/routes/+page.svelte +34 -0
- package/templates/site/src/routes/+page.ts +7 -0
- package/templates/site/src/styles/index.css +4 -0
- package/templates/site/src/styles/tokens/colors.css +107 -0
- package/templates/site/static/favicon.svg +1 -0
- package/templates/site/tsconfig.json +20 -0
- package/templates/site/vite.config.ts +4 -0
- package/templates/workflow.config.ts +40 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// `mesearch-wf init`: sets a repository up for documented development. What is the project's own
|
|
2
|
+
// (its workflow config, AGENTS.md, its conventions, its site's structure and pages) is written only
|
|
3
|
+
// where nothing is already; then `sync` writes what is the package's.
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { listFiles } from '@mvarble/mesearch-cms/agents';
|
|
7
|
+
import { packageDir } from "./site.js";
|
|
8
|
+
import { sync, version } from "./index.js";
|
|
9
|
+
const templatesDir = path.join(packageDir, 'templates');
|
|
10
|
+
// The guard every edit in Claude Code goes through.
|
|
11
|
+
const GUARD = {
|
|
12
|
+
matcher: 'Edit|MultiEdit|Write|NotebookEdit',
|
|
13
|
+
hooks: [{ type: 'command', command: '"$CLAUDE_PROJECT_DIR"/bin/wf guard' }],
|
|
14
|
+
};
|
|
15
|
+
export async function init(root, options = {}) {
|
|
16
|
+
const name = path.basename(path.resolve(root));
|
|
17
|
+
const slug = name
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
20
|
+
.replace(/^-+|-+$/g, '');
|
|
21
|
+
const fill = (text) => text
|
|
22
|
+
.replaceAll('{{name}}', name)
|
|
23
|
+
.replaceAll('{{slug}}', slug)
|
|
24
|
+
.replaceAll('{{version}}', version());
|
|
25
|
+
const written = [];
|
|
26
|
+
const skipped = [];
|
|
27
|
+
// A site is the template's only where there is none: one that exists is the project's.
|
|
28
|
+
const site = fs.existsSync(path.join(root, 'site'));
|
|
29
|
+
for (const rel of listFiles(templatesDir)) {
|
|
30
|
+
if (site && rel.startsWith('site/') && !options.force)
|
|
31
|
+
continue;
|
|
32
|
+
const file = path.join(root, rel);
|
|
33
|
+
if (fs.existsSync(file) && !options.force) {
|
|
34
|
+
skipped.push(rel);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
38
|
+
fs.writeFileSync(file, fill(fs.readFileSync(path.join(templatesDir, rel), 'utf8')));
|
|
39
|
+
written.push(rel);
|
|
40
|
+
}
|
|
41
|
+
if (addGuard(root))
|
|
42
|
+
written.push('.claude/settings.json');
|
|
43
|
+
const report = await sync(root);
|
|
44
|
+
return { ...report, written: [...written, ...report.written], skipped };
|
|
45
|
+
}
|
|
46
|
+
// Adds the guard to `.claude/settings.json`, keeping whatever else it holds. Returns whether it
|
|
47
|
+
// was added.
|
|
48
|
+
function addGuard(root) {
|
|
49
|
+
const file = path.join(root, '.claude/settings.json');
|
|
50
|
+
const settings = fs.existsSync(file)
|
|
51
|
+
? JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
52
|
+
: {};
|
|
53
|
+
const before = settings.hooks?.PreToolUse ?? [];
|
|
54
|
+
if (before.some((entry) => entry.hooks?.some((hook) => hook.command?.includes('bin/wf guard')))) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
settings.hooks = { ...settings.hooks, PreToolUse: [...before, GUARD] };
|
|
58
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
59
|
+
fs.writeFileSync(file, JSON.stringify(settings, null, 4) + '\n');
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/sync/init.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,oGAAoG;AACpG,sEAAsE;AACtE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAmB,MAAM,YAAY,CAAC;AAE5D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAExD,oDAAoD;AACpD,MAAM,KAAK,GAAG;IACV,OAAO,EAAE,mCAAmC;IAC5C,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC;CAC9E,CAAC;AAMF,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAY,EAAE,UAA+B,EAAE;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C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aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACjE,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const CONTENT = (config) => config.content ?? 'site/content';
|
|
2
|
+
const code = (text) => `\`${text}\``;
|
|
3
|
+
const article = (word) => (/^[aeiou]/.test(word) ? `an ${word}` : `a ${word}`);
|
|
4
|
+
// "a, b or c".
|
|
5
|
+
function either(items) {
|
|
6
|
+
return items.length < 2
|
|
7
|
+
? (items[0] ?? '')
|
|
8
|
+
: `${items.slice(0, -1).join(', ')} or ${items.at(-1)}`;
|
|
9
|
+
}
|
|
10
|
+
// A Markdown table with its columns padded, as Prettier writes one.
|
|
11
|
+
function table(head, rows) {
|
|
12
|
+
const widths = head.map((cell, i) => Math.max(cell.length, ...rows.map((row) => row[i].length)));
|
|
13
|
+
const line = (cells) => `| ${cells.map((cell, i) => cell.padEnd(widths[i])).join(' | ')} |`;
|
|
14
|
+
return [
|
|
15
|
+
line(head),
|
|
16
|
+
`| ${widths.map((w) => '-'.repeat(w)).join(' | ')} |`,
|
|
17
|
+
...rows.map(line),
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
|
20
|
+
const stagesOf = (config) => Object.keys(config.stages);
|
|
21
|
+
// What the stages the engine knows by name produce, where the config does not say.
|
|
22
|
+
const DEFAULTS = {
|
|
23
|
+
build: "the code, committed as the plan's boxes are ticked",
|
|
24
|
+
publish: "the pages that say what now _is_, and the entry's `index.md`, linked to them",
|
|
25
|
+
};
|
|
26
|
+
const skillOf = (config, stage) => config.stages[stage]?.skill ?? `/wf-${stage}`;
|
|
27
|
+
const openers = (config, area) => stagesOf(config).filter((stage) => config.stages[stage].unlocks?.includes(area));
|
|
28
|
+
// "`math` (or `writeup`)".
|
|
29
|
+
function openedAt(stages) {
|
|
30
|
+
const [first, ...rest] = stages.map(code);
|
|
31
|
+
return rest.length ? `${first} (or ${either(rest)})` : (first ?? '');
|
|
32
|
+
}
|
|
33
|
+
function fill(text, values) {
|
|
34
|
+
return text.replace(/\{\{([a-z-]+)\}\}/g, (whole, name) => values[name] ?? whole);
|
|
35
|
+
}
|
|
36
|
+
function common(config) {
|
|
37
|
+
const kinds = Object.keys(config.kinds);
|
|
38
|
+
return {
|
|
39
|
+
project: config.project,
|
|
40
|
+
content: CONTENT(config),
|
|
41
|
+
kinds: kinds.join('|'),
|
|
42
|
+
'kinds-list': either(kinds.map(article)),
|
|
43
|
+
'kinds-describe': Object.entries(config.kinds)
|
|
44
|
+
.map(([kind, { stages, describe }]) => ` - **${kind}** (${stages.map(code).join(' → ')}): ${describe}`)
|
|
45
|
+
.join('\n'),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function renderSkill(text, config) {
|
|
49
|
+
return fill(text, common(config));
|
|
50
|
+
}
|
|
51
|
+
export function renderWorkflow(text, config) {
|
|
52
|
+
const content = CONTENT(config);
|
|
53
|
+
const math = config.math === false ? undefined : `${content}/${config.math ?? 'math'}/`;
|
|
54
|
+
const stages = stagesOf(config);
|
|
55
|
+
const documents = stages.filter((stage) => config.stages[stage].document);
|
|
56
|
+
const areas = [];
|
|
57
|
+
const mathAt = openers(config, 'math');
|
|
58
|
+
if (math && mathAt.length)
|
|
59
|
+
areas.push(`The math notes (${code(math)}) open at ${openedAt(mathAt)}`);
|
|
60
|
+
const codeAt = openers(config, 'code');
|
|
61
|
+
if (codeAt.length) {
|
|
62
|
+
const what = config.describe?.code ? ` (${config.describe.code})` : '';
|
|
63
|
+
areas.push(`the code${what} at ${openedAt(codeAt)}`);
|
|
64
|
+
}
|
|
65
|
+
const pagesAt = openers(config, 'pages');
|
|
66
|
+
if (pagesAt.length) {
|
|
67
|
+
areas.push(`the pages (the rest of ${code(`${content}/`)}) at ${openedAt(pagesAt)}`);
|
|
68
|
+
}
|
|
69
|
+
// One sentence to a line, at the indent of the list item the template puts them in.
|
|
70
|
+
const capitalized = (text) => text.slice(0, 1).toUpperCase() + text.slice(1);
|
|
71
|
+
const areaSentences = [
|
|
72
|
+
`${capitalized(areas.join('; '))}.`,
|
|
73
|
+
'Without an active entry, code is closed and the rest is open for housekeeping.',
|
|
74
|
+
];
|
|
75
|
+
if (config.free?.length) {
|
|
76
|
+
const free = config.describe?.free ?? config.free.map(code).join(', ');
|
|
77
|
+
areaSentences.push(`${capitalized(free)} ${config.free.length > 1 ? 'are' : 'is'} always open, so that a ` +
|
|
78
|
+
'fact can be recorded the moment it is known.');
|
|
79
|
+
}
|
|
80
|
+
const areaText = areaSentences.join('\n ');
|
|
81
|
+
const gates = ['a document that is uncommitted, empty, or still has a `> [!TODO]`'];
|
|
82
|
+
for (const stage of stages) {
|
|
83
|
+
const { sections = [], checklist } = config.stages[stage];
|
|
84
|
+
for (const section of sections) {
|
|
85
|
+
gates.push(`${article(code(stage))} document without a \`## ${section}\` section`);
|
|
86
|
+
}
|
|
87
|
+
if (checklist)
|
|
88
|
+
gates.push(`${article(code(stage))} document without a checklist`);
|
|
89
|
+
}
|
|
90
|
+
if (stages.includes('build'))
|
|
91
|
+
gates.push('a build with unticked boxes or uncommitted work');
|
|
92
|
+
gates.push("a publish whose changed pages are not listed in the entry's `pages`, or whose changes to " +
|
|
93
|
+
'done entries are not listed in its `amends`');
|
|
94
|
+
const checked = Object.keys(config.checks ?? {});
|
|
95
|
+
if (checked.length) {
|
|
96
|
+
gates.push(`and, at ${either(checked.map(code))}, whatever the project's own checks in ` +
|
|
97
|
+
'`workflow.config.ts` find');
|
|
98
|
+
}
|
|
99
|
+
const kinds = table(['kind', 'stages', 'for'], Object.entries(config.kinds).map(([kind, { stages, describe }]) => [
|
|
100
|
+
code(kind),
|
|
101
|
+
stages.map(code).join(' → '),
|
|
102
|
+
describe,
|
|
103
|
+
]));
|
|
104
|
+
const stageRows = table(['stage', 'skill', 'produces'], stages.map((stage) => {
|
|
105
|
+
const { document, describe } = config.stages[stage];
|
|
106
|
+
const produces = describe ?? (document ? code(`${stage}.md`) : (DEFAULTS[stage] ?? '—'));
|
|
107
|
+
return [code(stage), code(skillOf(config, stage)), produces];
|
|
108
|
+
}));
|
|
109
|
+
return fill(text, {
|
|
110
|
+
...common(config),
|
|
111
|
+
'kinds-table': kinds,
|
|
112
|
+
'stages-table': stageRows,
|
|
113
|
+
areas: areaText,
|
|
114
|
+
gates: `${gates.join('; ')}.`,
|
|
115
|
+
documents: documents.map(code).join(', '),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/sync/render.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,GAAG,CAAC,MAAsB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC;AAC7E,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC;AAC7C,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AAEvF,eAAe;AACf,SAAS,MAAM,CAAC,KAAe;IAC3B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;QACnB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC;AAED,oEAAoE;AACpE,SAAS,KAAK,CAAC,IAAc,EAAE,IAAgB;IAC3C,MAAM,MAAM,GAAG,IA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B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC;QACrD,MAAM,QAAQ,GACV,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC,CAAC,CACL,CAAC;IAEF,OAAO,IAAI,CAAC,IAAI,EAAE;QACd,GAAG,MAAM,CAAC,MAAM,CAAC;QACjB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,SAAS;QACzB,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAC7B,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KAC5C,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The files a documentation site holds that are this package's: a route for every page the app
|
|
2
|
+
// ships, and the components and modules its documents import by their `$lib` paths. Each is a
|
|
3
|
+
// wrapper of a few lines around what the package ships, so that it changes only when the set of
|
|
4
|
+
// pages does, and is written by `mesearch-wf sync`.
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { listFiles } from '@mvarble/mesearch-cms/agents';
|
|
9
|
+
const PACKAGE = '@mvarble/mesearch-workflow';
|
|
10
|
+
// `dist/sync/site.js` (or `src/sync/site.ts`) sits two directories below the package root.
|
|
11
|
+
export const packageDir = path.resolve(fileURLToPath(new URL('.', import.meta.url)), '../..');
|
|
12
|
+
export const appDir = path.join(packageDir, 'app');
|
|
13
|
+
// What a site's documents import from `$lib`, by path within `src/lib`: the components a
|
|
14
|
+
// document shows, and the spec types its figures are written in.
|
|
15
|
+
const DOCUMENT_COMPONENTS = ['Statement', 'Proof', 'ModelGraph', 'ImageFigure', 'TrackCard'];
|
|
16
|
+
const DOCUMENT_MODULES = ['graph/spec.ts'];
|
|
17
|
+
const HEADER = 'Managed by @mvarble/mesearch-workflow, which `mesearch-wf sync` writes it from.';
|
|
18
|
+
const svelteWrapper = (from, props, use) => [
|
|
19
|
+
`<!-- ${HEADER} -->`,
|
|
20
|
+
'<script lang="ts">',
|
|
21
|
+
` import Component from '${from}';`,
|
|
22
|
+
'',
|
|
23
|
+
` let ${props} = $props();`,
|
|
24
|
+
'</script>',
|
|
25
|
+
'',
|
|
26
|
+
use,
|
|
27
|
+
'',
|
|
28
|
+
].join('\n');
|
|
29
|
+
const moduleWrapper = (from) => `// ${HEADER}\nexport * from '${from}';\n`;
|
|
30
|
+
// The site's managed files, by path from the repository root (the site is in `site/`).
|
|
31
|
+
export function siteFiles() {
|
|
32
|
+
const files = new Map();
|
|
33
|
+
const routes = path.join(appDir, 'routes');
|
|
34
|
+
for (const rel of listFiles(routes)) {
|
|
35
|
+
const from = `${PACKAGE}/app/routes/${rel}`;
|
|
36
|
+
const target = `site/src/routes/${rel}`;
|
|
37
|
+
if (rel.endsWith('.svelte')) {
|
|
38
|
+
files.set(target, svelteWrapper(from, '{ data }', '<Component {data} />'));
|
|
39
|
+
}
|
|
40
|
+
else if (rel.endsWith('.ts')) {
|
|
41
|
+
files.set(target, moduleWrapper(from));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const rel of listFiles(path.join(appDir, 'params'))) {
|
|
45
|
+
files.set(`site/src/params/${rel}`, moduleWrapper(`${PACKAGE}/app/params/${rel}`));
|
|
46
|
+
}
|
|
47
|
+
for (const name of DOCUMENT_COMPONENTS) {
|
|
48
|
+
const from = `${PACKAGE}/app/lib/components/${name}.svelte`;
|
|
49
|
+
if (!fs.existsSync(path.join(appDir, 'lib/components', `${name}.svelte`)))
|
|
50
|
+
continue;
|
|
51
|
+
files.set(`site/src/lib/components/${name}.svelte`, svelteWrapper(from, 'props', '<Component {...props} />'));
|
|
52
|
+
}
|
|
53
|
+
for (const rel of DOCUMENT_MODULES) {
|
|
54
|
+
files.set(`site/src/lib/${rel}`, moduleWrapper(`${PACKAGE}/app/lib/${rel}`));
|
|
55
|
+
}
|
|
56
|
+
return files;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.js","sourceRoot":"","sources":["../../src/sync/site.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,8FAA8F;AAC9F,gGAAgG;AAChG,oDAAoD;AACpD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,MAAM,OAAO,GAAG,4BAA4B,CAAC;AAE7C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9F,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAEnD,yFAAyF;AACzF,iEAAiE;AACjE,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;AAC7F,MAAM,gBAAgB,GAAG,CAAC,eAAe,CAAC,CAAC;AAE3C,MAAM,MAAM,GA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AAE,aAAa,CAAC,GAAG,OAAO,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC;IACvF,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,mBAAmB,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,OAAO,uBAAuB,IAAI,SAAS,CAAC;QAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC;YAAE,SAAS;QACpF,KAAK,CAAC,GAAG,CACL,2BAA2B,IAAI,SAAS,EACxC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAC3D,CAAC;IACN,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACjC,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,EAAE,EAAE,aAAa,CAAC,GAAG,OAAO,YAAY,GAAG,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mvarble/mesearch-workflow",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Documented development: the workflow engine a project's entries go through, the skills that drive it, and the documentation site its records are published on.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Matthew Varble <matthew@rodent.club>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mvarble/mesearch.git",
|
|
10
|
+
"directory": "packages/workflow"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"mesearch-wf": "./dist/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./site": {
|
|
25
|
+
"types": "./dist/site/index.d.ts",
|
|
26
|
+
"import": "./dist/site/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./preset": {
|
|
29
|
+
"types": "./dist/site/preset/index.d.ts",
|
|
30
|
+
"import": "./dist/site/preset/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./ambient": {
|
|
33
|
+
"types": "./app/ambient.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./app/*": {
|
|
36
|
+
"svelte": "./app/*",
|
|
37
|
+
"default": "./app/*"
|
|
38
|
+
},
|
|
39
|
+
"./styles/*": "./app/styles/*",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"app",
|
|
45
|
+
"agents",
|
|
46
|
+
"templates"
|
|
47
|
+
],
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22.18"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@fontsource-variable/inter": "^5.2.5",
|
|
53
|
+
"@fontsource/jetbrains-mono": "^5.2.5",
|
|
54
|
+
"@mvarble/mesearch-cms": "^0.4.1",
|
|
55
|
+
"@mvarble/mesearch-markdown": "^0.2.0",
|
|
56
|
+
"@mvarble/mesearch-ui": "^0.2.0",
|
|
57
|
+
"katex": "^0.18.4",
|
|
58
|
+
"mdsvex": "^0.12.7",
|
|
59
|
+
"remark-math": "3.0.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
63
|
+
"@sveltejs/kit": "^2.63.0",
|
|
64
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
65
|
+
"@types/node": "^22.14.0",
|
|
66
|
+
"svelte": "^5.57.1",
|
|
67
|
+
"typescript": "^6.0.3",
|
|
68
|
+
"vite": "^8.0.16"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
72
|
+
"@sveltejs/kit": "^2.63.0",
|
|
73
|
+
"svelte": "^5.56.1",
|
|
74
|
+
"vite": "^8.0.16"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsc -p tsconfig.json",
|
|
78
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
79
|
+
"test": "node --test 'test/engine/*.test.ts' 'test/preset/*.test.ts' 'test/sync/*.test.*'"
|
|
80
|
+
}
|
|
6
81
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Writing {{name}}'s documents
|
|
2
|
+
|
|
3
|
+
This project's own conventions, over `.agents/reference/mesearch/authoring.md` and `markup.md`, which win where nothing here says otherwise.
|
|
4
|
+
|
|
5
|
+
## What the site is for
|
|
6
|
+
|
|
7
|
+
> [!TODO] Who reads the site, and what it promises them.
|
|
8
|
+
|
|
9
|
+
## Where things go
|
|
10
|
+
|
|
11
|
+
The tracks (`TRACKS` in `site/src/lib/site.ts`), and what each holds.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# This project's stages
|
|
2
|
+
|
|
3
|
+
A file here named after a stage (`plan.md`, `build.md`, `publish.md`, `writeup.md`) says what that stage asks of this project beyond what its skill says: what to read first, the template a document follows, how a task is checked, which pages a publish changes.
|
|
4
|
+
The skill reads it when it is there.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
## How to work here
|
|
4
|
+
|
|
5
|
+
**Conversation is the default.**
|
|
6
|
+
Answer questions, explain things and sketch ideas in the reply: none of that needs a workflow, and none of it should start one.
|
|
7
|
+
|
|
8
|
+
**The development workflow runs only when the user invokes it**, through the `/wf-*` commands (`.agents/skills/wf-*`).
|
|
9
|
+
Every change to the code goes through an entry.
|
|
10
|
+
The procedure is in `.agents/reference/mesearch/workflow.md`, and `bin/wf kinds` lists the kinds of entry.
|
|
11
|
+
|
|
12
|
+
Rules that hold whether or not a command was invoked:
|
|
13
|
+
|
|
14
|
+
- Never start, approve, reopen, abandon or resume an entry on your own judgment, and never run `bin/wf start|approve|reopen|abandon|resume` except inside the skill the user invoked for it.
|
|
15
|
+
- Never do a stage's work outside its skill.
|
|
16
|
+
Asked to write code with no entry at the build stage, say so and point to the command that would get there.
|
|
17
|
+
- `bin/wf guard` runs before every edit in Claude Code (`.claude/settings.json`) and refuses one the stage does not allow.
|
|
18
|
+
Do not work around a refusal; it is telling you which command the user would need to give.
|
|
19
|
+
- When work at one stage shows an earlier stage wrong, stop and say so; the user may reopen it.
|
|
20
|
+
|
|
21
|
+
## Managed files
|
|
22
|
+
|
|
23
|
+
`@mvarble/mesearch-workflow` owns the files `.workflow/managed.json` lists: `bin/wf` and `.workflow/engine/`, the `wf-*` skills it ships, `.agents/reference/mesearch/`, and the site's shared routes and components.
|
|
24
|
+
`bin/wf guard` refuses an edit to one; a change to one is made in that package, and `pnpm exec mesearch-wf sync` in `site/` brings it here.
|
|
25
|
+
What this project does differently goes in this file, in `.agents/reference/authoring.md`, in `.agents/reference/stages/<stage>.md`, and in skills of its own beside the managed ones.
|
|
26
|
+
|
|
27
|
+
## Writing documents
|
|
28
|
+
|
|
29
|
+
Everything in `site/content/` is written as `.agents/reference/mesearch/authoring.md` and `markup.md` say, with this project's own conventions in `.agents/reference/authoring.md`.
|
|
30
|
+
|
|
31
|
+
## Checks
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bin/wf check
|
|
35
|
+
cd site && pnpm exec mesearch-wf diff && pnpm check && pnpm build
|
|
36
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{slug}}-site",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite dev",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
9
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@mvarble/mesearch-workflow": "^{{version}}",
|
|
13
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
14
|
+
"@sveltejs/kit": "^2.63.0",
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
16
|
+
"katex": "^0.18.4",
|
|
17
|
+
"svelte": "^5.57.1",
|
|
18
|
+
"svelte-check": "^4.7.6",
|
|
19
|
+
"typescript": "^6.0.3",
|
|
20
|
+
"vite": "^8.0.16"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
|
|
7
|
+
<script>
|
|
8
|
+
// Apply the theme before first paint, so a dark-mode reader never sees a white flash.
|
|
9
|
+
// The key matches `THEME_KEY` of `$site`, the site's name followed by `:theme`.
|
|
10
|
+
try {
|
|
11
|
+
const stored = localStorage.getItem('{{slug}}:theme');
|
|
12
|
+
const dark =
|
|
13
|
+
stored === 'dark' ||
|
|
14
|
+
(stored !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches);
|
|
15
|
+
if (dark) document.documentElement.classList.add('dark');
|
|
16
|
+
} catch {}
|
|
17
|
+
</script>
|
|
18
|
+
%sveltekit.head%
|
|
19
|
+
</head>
|
|
20
|
+
<body data-sveltekit-preload-data="hover">
|
|
21
|
+
<div style="display: contents">%sveltekit.body%</div>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The site's logo, inlined so that its ink follows the theme (`.logo` in the shared styles).
|
|
3
|
+
import icon from '../../../static/favicon.svg?raw';
|
|
4
|
+
import { SITE } from '$lib/site';
|
|
5
|
+
|
|
6
|
+
let { variant }: { variant: 'icon' | 'lockup' } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<span class="logo logo-{variant}" aria-hidden="true">
|
|
10
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- a file in this repository -->
|
|
11
|
+
{@html icon}{#if variant === 'lockup'}<span>{SITE.name}</span>{/if}
|
|
12
|
+
</span>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The site's structure: `docsSite()` reads it to lay out the content, and the app to build the
|
|
2
|
+
// navigation. `$site` in the app is this module, with defaults for what it leaves out.
|
|
3
|
+
|
|
4
|
+
export const SITE = {
|
|
5
|
+
name: '{{name}}',
|
|
6
|
+
tagline: 'What {{name}} is, in a sentence.',
|
|
7
|
+
description: 'What {{name}} is, in a paragraph.',
|
|
8
|
+
repo: 'https://github.com/<owner>/<repo>',
|
|
9
|
+
branch: 'main',
|
|
10
|
+
version: '0.0.0',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
// The tracks of pages, in reading order: a page belongs to the track named by its folder under
|
|
14
|
+
// `content/`, and is placed within it by its `order`.
|
|
15
|
+
export const TRACKS = [
|
|
16
|
+
{ id: 'start', title: 'Start here', short: 'Start', blurb: 'What {{name}} is.' },
|
|
17
|
+
{ id: 'reference', title: 'Reference', short: 'Reference', blurb: 'What to look up.' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export const MATH = {
|
|
21
|
+
id: 'math',
|
|
22
|
+
title: 'Mathematics',
|
|
23
|
+
short: 'Math',
|
|
24
|
+
blurb: 'The mathematics {{name}} rests on, one idea to a note.',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const ARCHIVE = {
|
|
28
|
+
id: 'archive',
|
|
29
|
+
title: 'Archive',
|
|
30
|
+
short: 'Archive',
|
|
31
|
+
blurb: 'How each part came to be, kept as it was approved.',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// The documents an archive entry may hold, in the order they are written: one per stage that
|
|
35
|
+
// writes one in `workflow.config.ts`.
|
|
36
|
+
export const DOCUMENTS = [
|
|
37
|
+
{ name: 'writeup', title: 'Writeup' },
|
|
38
|
+
{ name: 'plan', title: 'Plan' },
|
|
39
|
+
] as const;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Logo from '$lib/components/Logo.svelte';
|
|
3
|
+
import TrackCard from '$lib/components/TrackCard.svelte';
|
|
4
|
+
import { ARCHIVE, MATH, SITE, TRACKS } from '$lib/site';
|
|
5
|
+
|
|
6
|
+
let { data } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<svelte:head>
|
|
10
|
+
<title>{SITE.name}: {SITE.tagline}</title>
|
|
11
|
+
<meta name="description" content={SITE.description} />
|
|
12
|
+
</svelte:head>
|
|
13
|
+
|
|
14
|
+
<section class="hero">
|
|
15
|
+
<h1><Logo variant="lockup" /></h1>
|
|
16
|
+
<p class="hero-tagline">{SITE.tagline}</p>
|
|
17
|
+
</section>
|
|
18
|
+
|
|
19
|
+
{#if data.component}
|
|
20
|
+
<section class="landing-body prose">
|
|
21
|
+
<data.component />
|
|
22
|
+
</section>
|
|
23
|
+
{/if}
|
|
24
|
+
|
|
25
|
+
<section class="landing-tracks">
|
|
26
|
+
<h2>Where things are</h2>
|
|
27
|
+
<div class="card-grid">
|
|
28
|
+
{#each TRACKS as track (track.id)}
|
|
29
|
+
<TrackCard id={track.id} blurb={track.blurb} />
|
|
30
|
+
{/each}
|
|
31
|
+
<TrackCard id="math" blurb={MATH.blurb} />
|
|
32
|
+
<TrackCard id="archive" blurb={ARCHIVE.blurb} />
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import loaders from '$cms/loaders';
|
|
2
|
+
|
|
3
|
+
// The landing prose is a document like any other, attached as a component.
|
|
4
|
+
export const load = async ({ data }: { data: { landing?: string } }) => ({
|
|
5
|
+
...data,
|
|
6
|
+
component: data.landing ? (await loaders[data.landing]!()).default : undefined,
|
|
7
|
+
});
|