@purview-dev/pm-docs-site 0.0.0-stage → 0.1.0-pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +219 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +90 -0
  5. package/dist/index.d.ts +7 -0
  6. package/dist/index.js +118 -0
  7. package/dist/options.d.ts +5 -0
  8. package/dist/options.js +46 -0
  9. package/dist/repo-docs.d.ts +33 -0
  10. package/dist/repo-docs.js +94 -0
  11. package/dist/schema-version.d.ts +10 -0
  12. package/dist/schema-version.js +19 -0
  13. package/dist/sidebar.d.ts +10 -0
  14. package/dist/sidebar.js +30 -0
  15. package/dist/site-options.d.ts +9 -0
  16. package/dist/site-options.js +39 -0
  17. package/dist/types.d.ts +47 -0
  18. package/dist/types.js +4 -0
  19. package/lib/repo-docs.ts +124 -0
  20. package/lib/schema-version.ts +24 -0
  21. package/package.json +68 -5
  22. package/src/components/ExportStamp.astro +29 -0
  23. package/src/components/FeatureSummary.astro +160 -0
  24. package/src/components/FeatureTable.astro +64 -0
  25. package/src/components/ItemDetail.astro +16 -0
  26. package/src/components/ItemDialog.astro +16 -0
  27. package/src/components/LinkedFrom.astro +33 -0
  28. package/src/components/LinkedText.astro +12 -0
  29. package/src/components/PlanInteractions.astro +30 -0
  30. package/src/components/RefLink.astro +18 -0
  31. package/src/components/StateBadge.astro +15 -0
  32. package/src/components/board/Board.tsx +244 -0
  33. package/src/components/board/KanbanItemCard.tsx +129 -0
  34. package/src/components/board/LinkRuns.tsx +21 -0
  35. package/src/components/board/TaskKanbanCard.tsx +81 -0
  36. package/src/components/board/useBoardUrlState.ts +41 -0
  37. package/src/components/lib/KanbanItemCard.astro +264 -0
  38. package/src/components/lib/StatusTimelineFeed.astro +194 -0
  39. package/src/components/lib/TaskKanbanCard.astro +215 -0
  40. package/src/components/timeline/Timeline.tsx +159 -0
  41. package/src/components/timeline/useTimelineLayout.ts +39 -0
  42. package/src/content.config.ts +16 -0
  43. package/src/env.d.ts +7 -0
  44. package/src/lib/board-data.ts +84 -0
  45. package/src/lib/board.ts +209 -0
  46. package/src/lib/planning-types.ts +207 -0
  47. package/src/lib/planning.ts +415 -0
  48. package/src/lib/references.ts +360 -0
  49. package/src/lib/timeline.ts +156 -0
  50. package/src/loaders/repo-docs.ts +69 -0
  51. package/src/pages/index.astro +158 -0
  52. package/src/pages/plan/board.astro +41 -0
  53. package/src/pages/plan/log.astro +83 -0
  54. package/src/pages/plan/risks/[id].astro +72 -0
  55. package/src/pages/plan/risks.astro +263 -0
  56. package/src/pages/plan/roadmap.astro +108 -0
  57. package/src/routes/plan/briefs.astro +66 -0
  58. package/src/routes/plan/features/[id].astro +113 -0
  59. package/src/routes/plan/features/index.astro +29 -0
  60. package/src/routes/plan/inbox.astro +78 -0
  61. package/src/routes/plan/milestones/[milestone].astro +113 -0
  62. package/src/routes/plan/milestones/index.astro +56 -0
  63. package/src/routes/plan/now.astro +135 -0
  64. package/src/routes/plan/strategy.astro +194 -0
  65. package/src/scripts/plan.ts +40 -0
  66. package/src/styles/components.css +491 -0
  67. package/src/styles/kanban.css +277 -0
  68. package/src/styles/timeline.css +210 -0
  69. package/src/styles/width.css +4 -0
@@ -0,0 +1,10 @@
1
+ import type { ResolvedOptions } from './types.js';
2
+ export type SidebarItem = string | {
3
+ label: string;
4
+ link: string;
5
+ } | {
6
+ label: string;
7
+ items: SidebarItem[];
8
+ collapsed?: boolean;
9
+ };
10
+ export declare function buildSidebar(options: ResolvedOptions): SidebarItem[];
@@ -0,0 +1,30 @@
1
+ // The Starlight sidebar: the plan, its optional views switched on in the
2
+ // options, then one group per docs source that has pages.
3
+ import { pagesOf } from "./repo-docs.js";
4
+ export function buildSidebar(options) {
5
+ const { views, docs } = options;
6
+ const plan = [
7
+ views.now && { label: 'Now', link: '/plan/now/' },
8
+ { label: 'Board', link: '/plan/board/' },
9
+ { label: 'Roadmap', link: '/plan/roadmap/' },
10
+ views.milestones && { label: 'Milestones', link: '/plan/milestones/' },
11
+ views.features && { label: 'Features', link: '/plan/features/' },
12
+ { label: 'Log', link: '/plan/log/' },
13
+ { label: 'Risks', link: '/plan/risks/' },
14
+ views.inbox && { label: 'Inbox', link: '/plan/inbox/' },
15
+ views.briefs && { label: 'Briefs', link: '/plan/briefs/' },
16
+ views.strategy && { label: 'Strategy', link: '/plan/strategy/' },
17
+ ];
18
+ const groups = docs
19
+ ? docs.sources
20
+ .filter((source) => !source.hidden)
21
+ .map((source) => ({
22
+ label: source.label,
23
+ collapsed: source.collapsed ?? false,
24
+ items: pagesOf(source, docs.root).map((page) => page.id),
25
+ }))
26
+ // Starlight rejects an empty group.
27
+ .filter((group) => group.items.length > 0)
28
+ : [];
29
+ return [{ label: 'Plan', items: plan.filter((item) => item !== false) }, ...groups];
30
+ }
@@ -0,0 +1,9 @@
1
+ import type { PmDocsSiteOptions } from './types.js';
2
+ /** @param siteDir absolute */
3
+ export declare function loadSiteOptions(siteDir: string, flags: {
4
+ title?: string;
5
+ planning?: string;
6
+ }): Promise<{
7
+ options: PmDocsSiteOptions;
8
+ configFile: string | null;
9
+ }>;
@@ -0,0 +1,39 @@
1
+ // The options a site gives the integration, read the way the CLI needs them:
2
+ // from its astro.config file when it has one, else from command-line flags.
3
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
4
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
5
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
6
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
7
+ });
8
+ }
9
+ return path;
10
+ };
11
+ import { existsSync } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+ const CONFIG_FILES = ['astro.config.mjs', 'astro.config.js', 'astro.config.ts', 'astro.config.mts'];
15
+ /** @param siteDir absolute */
16
+ export async function loadSiteOptions(siteDir, flags) {
17
+ const configFile = CONFIG_FILES.map((name) => join(siteDir, name)).find((file) => existsSync(file)) ?? null;
18
+ if (!configFile) {
19
+ return {
20
+ options: { title: flags.title ?? 'Project plan', ...(flags.planning ? { planning: flags.planning } : {}) },
21
+ configFile: null,
22
+ };
23
+ }
24
+ // Plain Node loads the config, so a TypeScript config may only use what Node
25
+ // strips: erasable syntax and relative imports that name their file.
26
+ let config;
27
+ try {
28
+ config = (await import(__rewriteRelativeImportExtension(pathToFileURL(configFile).href))).default ?? {};
29
+ }
30
+ catch (error) {
31
+ throw new Error(`pm-docs-site: could not load ${configFile} under Node (${error.message.trim()}). ` +
32
+ 'Keep astro.config.ts to erasable TypeScript, with explicit .ts extensions on relative imports.');
33
+ }
34
+ const integrations = (Array.isArray(config.integrations) ? config.integrations : []).flat(Infinity);
35
+ const ours = integrations.find((entry) => entry?.name === 'pm-docs-site');
36
+ if (!ours?.pmDocsSiteOptions)
37
+ throw new Error(`pm-docs-site: no pm-docs-site integration in ${configFile}`);
38
+ return { options: ours.pmDocsSiteOptions, configFile };
39
+ }
@@ -0,0 +1,47 @@
1
+ /** An optional plan view. Home, Board, Roadmap, Log and Risks are always on. */
2
+ export type ViewName = 'now' | 'milestones' | 'features' | 'inbox' | 'briefs' | 'strategy';
3
+ /** One folder of repository Markdown, shown as one sidebar group. */
4
+ export interface DocsSource {
5
+ /** The sidebar group for this source's pages. */
6
+ label: string;
7
+ /** The folder to read, relative to the docs root (`.` for the root). */
8
+ base: string;
9
+ /** Files to read, as globs relative to `base` (`*` within a folder, `**` across folders). */
10
+ include: string[];
11
+ /** Prepended to each page's path to make its URL. Default: none. */
12
+ prefix?: string;
13
+ /** A file name that stands for its folder, such as `SKILL.md` or `README.md`. */
14
+ indexFile?: string;
15
+ /** Sidebar order by page path. Default: `asc`. */
16
+ order?: 'asc' | 'desc';
17
+ collapsed?: boolean;
18
+ /** Load the pages without listing them in the sidebar. */
19
+ hidden?: boolean;
20
+ }
21
+ export interface PmDocsSiteOptions {
22
+ /** The site title. */
23
+ title: string;
24
+ description?: string;
25
+ /** The pm-export file, relative to the site root. Default: `../planning/planning.json`. */
26
+ planning?: string;
27
+ /** Repository Markdown to render as pages; `root` is relative to the site root. Default: none. */
28
+ docs?: {
29
+ root: string;
30
+ sources: DocsSource[];
31
+ };
32
+ /** The optional views to render. Default: all six. */
33
+ views?: ViewName[];
34
+ }
35
+ /** The options with defaults applied and every path absolute. */
36
+ export interface ResolvedOptions {
37
+ title: string;
38
+ description: string | null;
39
+ planning: string;
40
+ /** The export path as the options wrote it, `/`-separated: shown on pages instead of the machine path. */
41
+ planningLabel: string;
42
+ docs: {
43
+ root: string;
44
+ sources: DocsSource[];
45
+ } | null;
46
+ views: Record<ViewName, boolean>;
47
+ }
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ // The integration's option types, re-exported by index.ts. A separate module
2
+ // so the other lib/ modules and src/ can import them without importing the
3
+ // integration itself.
4
+ export {};
@@ -0,0 +1,124 @@
1
+ // Repository Markdown as pages: which files a docs source matches, their page
2
+ // IDs, and each page's title and body. Node-loadable (no Astro or Vite import)
3
+ // because the sidebar is built from it while astro.config loads; the Astro
4
+ // loader in src/loaders/repo-docs.ts uses the same functions.
5
+ //
6
+ // Starlight requires a `title` in every page's frontmatter; repository Markdown
7
+ // rarely has one. The title is frontmatter `title`, else the first `# Title`
8
+ // heading (dropped from the body, so it is not shown twice), else frontmatter
9
+ // `name`, else the file name, so the files stay exactly as their authors write them.
10
+
11
+ import { existsSync, readdirSync } from 'node:fs';
12
+ import { basename, dirname, join, resolve, sep } from 'node:path';
13
+
14
+ import type { DocsSource } from './types.ts';
15
+
16
+ export interface DocsPage {
17
+ id: string;
18
+ file: string;
19
+ }
20
+
21
+ /** A glob as a regular expression over `/`-separated paths. */
22
+ export function globToRegExp(glob: string): RegExp {
23
+ const pattern = glob
24
+ .split(/(\*\*\/|\*\*|\*)/)
25
+ .map((part) =>
26
+ part === '**/' ? '(?:.*/)?' : part === '**' ? '.*' : part === '*' ? '[^/]*' : part.replace(/[.+?^${}()|[\]\\]/g, '\\$&'),
27
+ )
28
+ .join('');
29
+
30
+ return new RegExp(`^${pattern}$`, 'i');
31
+ }
32
+
33
+ /** The page ID (and URL path) for a file: prefix, path without `.md`, lower case. */
34
+ export function pageId(source: DocsSource, path: string): string {
35
+ let page = path.replace(/\.md$/i, '');
36
+
37
+ if (source.indexFile && basename(path).toLowerCase() === source.indexFile.toLowerCase()) {
38
+ page = dirname(path) === '.' ? 'index' : dirname(path);
39
+ }
40
+
41
+ return `${source.prefix ?? ''}${page}`.toLowerCase();
42
+ }
43
+
44
+ /** Every file a source matches, as page IDs in its sidebar order. */
45
+ export function pagesOf(source: DocsSource, repoRoot: string): DocsPage[] {
46
+ const base = resolve(repoRoot, source.base);
47
+
48
+ if (!existsSync(base)) return [];
49
+
50
+ const patterns = source.include.map(globToRegExp);
51
+ const pages = (readdirSync(base, { recursive: true }) as string[])
52
+ .map((file) => file.split(sep).join('/'))
53
+ .filter((file) => !file.split('/').includes('node_modules') && patterns.some((pattern) => pattern.test(file)))
54
+ .map((file) => ({ id: pageId(source, file), file: join(base, file) }))
55
+ .sort((a, b) => a.id.localeCompare(b.id));
56
+
57
+ return source.order === 'desc' ? pages.reverse() : pages;
58
+ }
59
+
60
+ /** Simple `key: value` frontmatter (one line per key) and the body after it. */
61
+ export function splitFrontmatter(markdown: string): { data: Record<string, string>; body: string } {
62
+ const match = /^---\n([\s\S]*?)\n---\n?/.exec(markdown);
63
+
64
+ if (!match) return { data: {}, body: markdown };
65
+
66
+ const data: Record<string, string> = {};
67
+
68
+ for (const line of (match[1] ?? '').split('\n')) {
69
+ const pair = /^([\w-]+):\s*(.*?)\s*$/.exec(line);
70
+
71
+ if (pair && pair[1] && pair[2]) data[pair[1]] = pair[2].replace(/^(['"])(.*)\1$/, '$2');
72
+ }
73
+
74
+ return { data, body: markdown.slice(match[0].length) };
75
+ }
76
+
77
+ /**
78
+ * The page title and the body without it.
79
+ *
80
+ * The title is the first `# ` heading when nothing but blank lines and HTML
81
+ * comments come before it; otherwise the fallback is the title and the body is
82
+ * kept whole.
83
+ */
84
+ export function splitTitle(markdown: string, fallback: string): { title: string; body: string } {
85
+ const lines = markdown.split('\n');
86
+ let index = 0;
87
+ let inComment = false;
88
+
89
+ for (; index < lines.length; index++) {
90
+ const line = (lines[index] ?? '').trim();
91
+
92
+ if (inComment) {
93
+ if (line.includes('-->')) inComment = false;
94
+ continue;
95
+ }
96
+
97
+ if (line === '') continue;
98
+
99
+ if (line.startsWith('<!--')) {
100
+ inComment = !line.includes('-->');
101
+ continue;
102
+ }
103
+
104
+ break;
105
+ }
106
+
107
+ const heading = /^#\s+(.+?)\s*#*\s*$/.exec(lines[index] ?? '');
108
+
109
+ if (!heading || !heading[1]) return { title: fallback, body: markdown };
110
+
111
+ let start = index + 1;
112
+ while (start < lines.length && (lines[start] ?? '').trim() === '') start++;
113
+
114
+ return { title: heading[1], body: lines.slice(start).join('\n') };
115
+ }
116
+
117
+ /** Title, description, and body for one page. */
118
+ export function readPage(markdown: string, file: string): { title: string; description?: string; body: string } {
119
+ const { data, body } = splitFrontmatter(markdown);
120
+ const fallback = data.name ?? basename(file, '.md');
121
+ const split = data.title ? { title: data.title, body } : splitTitle(body, fallback);
122
+
123
+ return { title: split.title, ...(data.description ? { description: data.description } : {}), body: split.body };
124
+ }
@@ -0,0 +1,24 @@
1
+ // The pm-export schemaVersions this package reads, declared once. A new export
2
+ // format is supported by adding its version here, with the page changes it needs.
3
+
4
+ export const SUPPORTED_SCHEMA_VERSIONS: readonly number[] = Object.freeze([3]);
5
+
6
+ /** The plan export is missing, unreadable, or in a format this package does not read. */
7
+ export class PlanningExportError extends Error {
8
+ constructor(message: string) {
9
+ super(`${message} Run the pm-export skill to write planning.json.`);
10
+ this.name = 'PlanningExportError';
11
+ }
12
+ }
13
+
14
+ /**
15
+ * Throw unless the export's schemaVersion is one this package reads.
16
+ * @param path the export's path, for the message
17
+ */
18
+ export function checkSchemaVersion(version: unknown, path: string): void {
19
+ if (typeof version === 'number' && SUPPORTED_SCHEMA_VERSIONS.includes(version)) return;
20
+
21
+ throw new PlanningExportError(
22
+ `${path} has schemaVersion ${String(version)}; this site reads schemaVersion ${SUPPORTED_SCHEMA_VERSIONS.join(', ')}.`,
23
+ );
24
+ }
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
- "name": "@purview-dev/pm-docs-site",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@purview-dev/pm-docs-site",
3
+ "version": "0.1.0-pre.2",
4
+ "type": "module",
5
+ "description": "A local, searchable project site for pm-skills: the board, roadmap, milestones, features, log, and risks from pm-export's planning.json, with the repository's Markdown, as an Astro and Starlight integration.",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "Kieron Lanning",
9
+ "url": "https://kieronlanning.dev/"
10
+ },
11
+ "homepage": "https://purview.dev/projects/pm-skills/",
12
+ "bugs": {
13
+ "url": "https://github.com/purview-dev/pm-skills/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/purview-dev/pm-skills.git",
18
+ "directory": "packages/pm-docs-site"
19
+ },
20
+ "keywords": [
21
+ "pm-skills",
22
+ "project-management",
23
+ "roadmap",
24
+ "kanban",
25
+ "documentation",
26
+ "astro",
27
+ "astro-integration",
28
+ "withastro",
29
+ "starlight"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "engines": {
35
+ "node": ">=24"
36
+ },
37
+ "bin": {
38
+ "pm-docs-site": "./dist/cli.js"
39
+ },
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "default": "./dist/index.js"
44
+ }
45
+ },
46
+ "files": ["dist", "src", "lib/repo-docs.ts", "lib/schema-version.ts", "README.md", "LICENSE.md"],
47
+ "scripts": {
48
+ "build": "node scripts/build.ts",
49
+ "prepack": "node scripts/build.ts && node scripts/check-exports.ts",
50
+ "test": "bun test",
51
+ "check": "astro-check --root .",
52
+ "test:browser": "playwright test"
53
+ },
54
+ "dependencies": {
55
+ "@astrojs/react": "7.1.9",
56
+ "@astrojs/starlight": "0.42.10",
57
+ "astro": "7.4.8",
58
+ "react": "19.3.1",
59
+ "react-dom": "19.3.1"
60
+ },
61
+ "devDependencies": {
62
+ "@astrojs/check": "0.9.12",
63
+ "@playwright/test": "1.65.1",
64
+ "@types/bun": "1.4.4",
65
+ "@types/react": "19.3.0",
66
+ "@types/react-dom": "19.3.0",
67
+ "typescript": "6.0.3"
68
+ }
69
+ }
@@ -0,0 +1,29 @@
1
+ ---
2
+ // When the plan on this page was exported, and from which commit, so a stale
3
+ // planning.json is visible. Run the pm-export skill to refresh it.
4
+ //
5
+ // It also labels the page for search: Pagefind reads the hidden filter spans
6
+ // (Kind, and for an item its State and Milestone) and offers them as filters.
7
+ import config from 'virtual:pm-docs-site/config';
8
+
9
+ import { loadPlanning } from '../lib/planning';
10
+
11
+ interface Props {
12
+ /** The search filter `Kind`: `Plan` for a plan page, `Feature` or `Milestone` for an item's or a milestone's page. */
13
+ kind?: string;
14
+ state?: string;
15
+ milestone?: string;
16
+ }
17
+
18
+ const { kind = 'Plan', state, milestone } = Astro.props;
19
+ const planning = loadPlanning();
20
+ const exported = planning.generatedAt.replace('T', ' ').slice(0, 16);
21
+ const head = planning.source.head?.slice(0, 7) ?? 'unknown';
22
+ ---
23
+
24
+ <p class="export-stamp" data-pagefind-ignore>
25
+ Plan exported {exported} from {planning.source.branch ?? 'a detached HEAD'} at <code>{head}</code> ({config.planningLabel}).
26
+ </p>
27
+ <span hidden data-pagefind-filter={`Kind:${kind}`}></span>
28
+ {state && <span hidden data-pagefind-filter={`State:${state}`}></span>}
29
+ {milestone && <span hidden data-pagefind-filter={`Milestone:${milestone}`}></span>}
@@ -0,0 +1,160 @@
1
+ ---
2
+ // One item's summary: state, milestone, facts, Done when, related items, brief
3
+ // and risks. The feature page shows it, and so does the item popup on the
4
+ // Board and Roadmap, so the two never drift.
5
+ import { briefOf, dependents, features, loadPlanning, planProgress } from '../lib/planning';
6
+ import LinkedText from './LinkedText.astro';
7
+ import RefLink from './RefLink.astro';
8
+ import StateBadge from './StateBadge.astro';
9
+
10
+ interface Props {
11
+ id: string;
12
+ }
13
+
14
+ const planning = loadPlanning();
15
+ const all = features(planning);
16
+ const feature = all.find((candidate) => candidate.id === Astro.props.id)!;
17
+ const byId = new Map(all.map((candidate) => [candidate.id, candidate]));
18
+ const brief = briefOf(planning, feature);
19
+ const blocks = dependents(all, feature.id);
20
+ const revisedBy = all.filter((candidate) => candidate.revisits === feature.id);
21
+ const risks = [...planning.risks.open, ...planning.risks.closed].filter((risk) => risk.affects === feature.id);
22
+ const plan = feature.state === 'now' ? planning.plan : null;
23
+
24
+ const facts: { label: string; value: string }[] = [
25
+ { label: 'Owner', value: feature.owner ?? '–' },
26
+ { label: 'Size', value: feature.size ?? '–' },
27
+ ...(feature.state === 'next' || feature.state === 'later' ? [{ label: 'Position', value: `${feature.state === 'next' ? 'Next' : 'Later'} ${feature.position}` }] : []),
28
+ ...(feature.status
29
+ ? [{ label: 'Status', value: [feature.status.value, feature.status.reason, feature.status.since && `since ${feature.status.since}`].filter(Boolean).join(', ') }]
30
+ : []),
31
+ ...(feature.stage ? [{ label: 'Stage', value: feature.stage }] : []),
32
+ ...(feature.started ? [{ label: 'Started', value: feature.started }] : []),
33
+ ...(plan ? [{ label: 'Plan steps', value: `${plan.checked} of ${plan.total} (${planProgress(plan)}%)` }] : []),
34
+ ...(feature.date ? [{ label: feature.state === 'done' ? 'Done' : 'Dropped', value: feature.date }] : []),
35
+ ];
36
+ ---
37
+
38
+ <p>
39
+ <StateBadge state={feature.state} />
40
+ {
41
+ (feature.label === 'blocked' || feature.label === 'waiting') && (
42
+ <>
43
+ {' '}
44
+ <StateBadge label={feature.label} />
45
+ </>
46
+ )
47
+ }
48
+ {' '}
49
+ <RefLink ref={feature.milestone ?? 'none'} />
50
+ </p>
51
+
52
+ <dl class="plan-facts">
53
+ {
54
+ facts.map((fact) => (
55
+ <div>
56
+ <dt>{fact.label}</dt>
57
+ <dd>
58
+ <LinkedText text={fact.value} />
59
+ </dd>
60
+ </div>
61
+ ))
62
+ }
63
+ </dl>
64
+
65
+ {
66
+ feature.doneWhen.length > 0 && (
67
+ <section>
68
+ <h2>Done when</h2>
69
+ <ul>
70
+ {feature.doneWhen.map((check) => (
71
+ <li>
72
+ <LinkedText text={check} />
73
+ </li>
74
+ ))}
75
+ </ul>
76
+ </section>
77
+ )
78
+ }
79
+
80
+ {
81
+ (feature.dependsOn.length > 0 || blocks.length > 0 || feature.revisits || revisedBy.length > 0) && (
82
+ <section>
83
+ <h2>Related items</h2>
84
+ <ul>
85
+ {feature.dependsOn.map((dep) => (
86
+ <li>
87
+ Depends on <RefLink ref={dep} /> {byId.get(dep) && <StateBadge state={byId.get(dep)!.state} />}
88
+ </li>
89
+ ))}
90
+ {blocks.map((other) => (
91
+ <li>
92
+ Needed by <RefLink ref={other.id} /> <StateBadge state={other.state} />
93
+ </li>
94
+ ))}
95
+ {feature.revisits && (
96
+ <li>
97
+ Revisits <RefLink ref={feature.revisits} />
98
+ </li>
99
+ )}
100
+ {revisedBy.map((other) => (
101
+ <li>
102
+ Revised by <RefLink ref={other.id} />
103
+ </li>
104
+ ))}
105
+ </ul>
106
+ </section>
107
+ )
108
+ }
109
+
110
+ {
111
+ (brief || feature.brief) && (
112
+ <section>
113
+ <h2>Brief</h2>
114
+ {brief ? (
115
+ <>
116
+ <p>
117
+ <strong>{brief.title}</strong> — {brief.status ? <LinkedText text={brief.status} /> : 'no status'}
118
+ {brief.updated && <>, updated {brief.updated}</>}
119
+ </p>
120
+ {brief.problem && (
121
+ <p>
122
+ Problem: <LinkedText text={brief.problem} />
123
+ </p>
124
+ )}
125
+ {brief.decision && (
126
+ <p>
127
+ Decision: <LinkedText text={brief.decision} />
128
+ </p>
129
+ )}
130
+ <p>
131
+ <RefLink ref={brief.path} label="id" />
132
+ </p>
133
+ </>
134
+ ) : (
135
+ <p>
136
+ <code>{feature.brief}</code>
137
+ </p>
138
+ )}
139
+ </section>
140
+ )
141
+ }
142
+
143
+ {
144
+ risks.length > 0 && (
145
+ <section>
146
+ <h2>Risks</h2>
147
+ <ul>
148
+ {risks.map((risk) => (
149
+ <li>
150
+ <span class={`rag rag--${risk.rag}`}>{risk.rag}</span>{' '}
151
+ <strong>
152
+ <RefLink ref={risk.id} label="id" />
153
+ </strong>{' '}
154
+ <LinkedText text={risk.title} /> — {risk.status}
155
+ </li>
156
+ ))}
157
+ </ul>
158
+ </section>
159
+ )
160
+ }
@@ -0,0 +1,64 @@
1
+ ---
2
+ // A table of roadmap items of one state: each row links to the item's page,
3
+ // with its milestone, owner, size, and what decides it (Done when, Result, or Reason).
4
+ import type { Feature, FeatureState } from '../lib/planning';
5
+ import type { Milestone } from '../lib/planning-types';
6
+ import LinkedText from './LinkedText.astro';
7
+ import RefLink from './RefLink.astro';
8
+ import StateBadge from './StateBadge.astro';
9
+
10
+ interface Props {
11
+ state: FeatureState;
12
+ items: Feature[];
13
+ milestones: Milestone[];
14
+ /** Leave the Milestone column out (on a milestone's own page). */
15
+ hideMilestone?: boolean;
16
+ }
17
+
18
+ const { state, items, hideMilestone = false } = Astro.props;
19
+ const decision = (feature: Feature) => (state === 'done' ? feature.result : state === 'dropped' ? feature.reason : feature.doneWhen.join(' ')) || null;
20
+ const decides = state === 'done' ? 'Result' : state === 'dropped' ? 'Reason' : 'Done when';
21
+ const when = (feature: Feature) => (state === 'done' || state === 'dropped' ? feature.date : state === 'now' ? feature.stage : `${state === 'next' ? 'Next' : 'Later'} ${feature.position}`);
22
+ ---
23
+
24
+ {items.length === 0 && <p class="plan-empty">Nothing here</p>}
25
+ {
26
+ items.length > 0 && (
27
+ <table class="plan-table">
28
+ <thead>
29
+ <tr>
30
+ <th scope="col">Item</th>
31
+ <th scope="col">{state === 'done' || state === 'dropped' ? 'Date' : state === 'now' ? 'Stage' : 'Position'}</th>
32
+ {!hideMilestone && <th scope="col">Milestone</th>}
33
+ <th scope="col">Owner</th>
34
+ <th scope="col">Size</th>
35
+ <th scope="col">{decides}</th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ {items.map((feature) => (
40
+ <tr id={feature.id.toLowerCase()}>
41
+ <td>
42
+ <RefLink ref={feature.id} />
43
+ {(feature.label === 'blocked' || feature.label === 'waiting') && (
44
+ <>
45
+ {' '}
46
+ <StateBadge label={feature.label} />
47
+ </>
48
+ )}
49
+ </td>
50
+ <td class="plan-nowrap">{when(feature) ?? '–'}</td>
51
+ {!hideMilestone && (
52
+ <td>
53
+ <RefLink ref={feature.milestone ?? 'none'} />
54
+ </td>
55
+ )}
56
+ <td>{feature.owner ?? '–'}</td>
57
+ <td>{feature.size ?? '–'}</td>
58
+ <td>{decision(feature) ? <LinkedText text={decision(feature)} /> : '–'}</td>
59
+ </tr>
60
+ ))}
61
+ </tbody>
62
+ </table>
63
+ )
64
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ // The popup content for one item, kept inert in a <template> until a plain
3
+ // click on its card opens the item dialog. Search ignores it: the item's own
4
+ // page holds the same summary.
5
+ import FeatureSummary from './FeatureSummary.astro';
6
+
7
+ interface Props {
8
+ id: string;
9
+ }
10
+
11
+ const { id } = Astro.props;
12
+ ---
13
+
14
+ <template data-item-detail={id} data-pagefind-ignore>
15
+ <FeatureSummary id={id} />
16
+ </template>
@@ -0,0 +1,16 @@
1
+ ---
2
+ // The one item dialog on the Board and Roadmap. src/scripts/plan.ts fills it
3
+ // from a card's <template> and opens it on a plain click; without JavaScript
4
+ // the card link goes to the item's page instead.
5
+ ---
6
+
7
+ <dialog class="plan-dialog" data-item-dialog aria-labelledby="plan-dialog-title" data-pagefind-ignore>
8
+ <div class="plan-dialog__head">
9
+ <h2 id="plan-dialog-title"></h2>
10
+ <button type="button" class="plan-dialog__close" data-item-dialog-close aria-label="Close">×</button>
11
+ </div>
12
+ <div class="plan-dialog__body" data-item-dialog-body></div>
13
+ <p class="plan-dialog__foot">
14
+ <a data-item-dialog-open href="">Open page</a>
15
+ </p>
16
+ </dialog>