feat(storybook): mirror the complete feature-map index (#16052)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The feature map describes its user-facing capabilities and
verification recipes.
> - Storybook provides isolated UI examples for those capabilities.
> - The previous organization showed only features with primary story
suites.
> - This pull request derives the complete Storybook index from the
upstream map.
> - Readers can find the same features in both places and see related
examples or explicit gaps.

## Linked Issues or Issue Description

Refs #16046 and #16049.

**What existing behavior does this improve?**

Storybook navigation and the downstream feature catalog.

**Current behavior**

The sidebar has 28 primary feature homes. The feature map lists 35. The
main guide groups suites alphabetically by area slug. Related examples
can live under a different feature.

**Proposed behavior**

Use the feature map's eight sections and 35 features in the same order.
Give each feature an Overview page with all its capabilities, related
example links, and missing-example messages. Keep shared foundations
outside the product index. Preserve all existing stories and URLs.

**Reason and benefit**

Readers can move between the feature map and Storybook without learning
a second index. A feature without cataloged examples remains visible.

**Breaking changes**

None to existing story IDs or product behavior. Storybook start and
build now reject stale generated feature pages and ordering. Run the
catalog generator after upstream changes, inspect the output, and review
affected source fingerprints.

## What Changed

- Generate 35 feature Overview stories and capability data from the
upstream map. Generate the inline sidebar order required by Storybook.
- Replace the main guide with the full ordered feature index and search.
Link all related suites from feature pages, even across primary homes.
- Preserve all 223 authored files, 2,210 story IDs, and the existing
docs ID. Keep status, implementation, and fixture classifications
visible.
- Put the generated Markdown catalog in feature-map order. Keep
generated guides outside example counts.
- Update maintenance and review skills, documentation, and generator
tests. Keep the feature map independent of Storybook.

## Verification

- Passed: 16 catalog and generator tests; map checks; token gates; both
skill validators.
- Passed: `pnpm -r typecheck`, `pnpm build`, and the Storybook build.
- Built-index comparison preserved all 2,211 previous entries and added
only 35 feature overviews. Feature order matches the map.
- Browser: inspected the complete index and sidebar, searched for Goals,
opened its overview, and followed a related suite under Projects. The
original suite renders.
- Passed: all 8,170 UI tests in 728 files. Browser checks also covered
empty search, capability-ID search, missing-example pages, the original
editable-text bookmark, the CLI sidebar label, and searching/opening
shared foundations.
- The broad local `pnpm test:run` was stopped after a failure in the
unchanged GitHub chat test `authorizes description edits as the editor,
never inheriting the original author's access`. That exact test passed
alone without code or expectation changes. A complete local repository
suite pass is not established.
- Original revision CI passed after one runner retry. The merged
revision `5ca01c70716f23974680a8019ddc613035d11bc4` passed fresh CI.
Local UI typecheck, catalog checks, 16 generator tests, map checks and
token gates pass.
- Greptile: 5/5 on final commit
`5ca01c70716f23974680a8019ddc613035d11bc4`, with all findings resolved.
- Master merge: inspected source drift in 61 catalog entries and
regenerated INDEX, preserving upstream notes. Marked the sidebar suite
that mounts IssueDetail unreviewed for the new activity query; recorded
limits for composer and channel-default changes. No stories removed.
- Final Storybook build passed. Browser filename searches for
`new-task-composer` and `forms-editors` return the expected feature and
shared example.
- No visual-baseline or full production acceptance claim. The deeper
authored scenario groups remain intact.

## Risks

- The parser depends on the feature-map Markdown contract. It rejects
unknown index rows, omitted feature recipes, and unexpected generated
files.
- A suite can reference several capabilities. A link proves catalog
association, not complete behavior coverage or production parity.
- Storybook treats `/` as a folder separator. Sidebar labels use a comma
for that character; the guide and page headings retain the upstream
name.
- No database, API, authorization, or production component changes.

## Model Used

OpenAI Codex, GPT-6 family, with reasoning, code execution, and browser
inspection. The exact runtime model ID and context window are not
exposed in this session.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-10-13 07:01:29 -05:00
1 parent d67e3507b2
commit 9bd820e687
52 files changed
+2943 -782

No files matched your search

+14 -1
View File
@@ -58,6 +58,17 @@ groupings beneath that prefix. Put shared fixture modules in `ui/storybook/suppo
Keep the catalog's `stableId` equal to the explicit CSF meta ID even when the title
changes. Unmapped component examples belong under Foundations; the catalog guide
belongs under Overview. The checker verifies these conventions.
Keep the main guide and every feature Overview congruent with the upstream index:
same section/feature names and order, all capabilities in recipe order, related
suite links across primary homes, and explicit missing examples. Regenerate
`ui/storybook/generated/` and the preview config's inline `storySort.order` through
the catalog command; never hand-edit generated pages or ordering
or add generated guides to the authored catalog. Generated guides are not example
coverage. Preserve their `feature-map-<area>--overview` IDs. When an upstream area
is removed or renamed, inspect unexpected generated files and resolve them
explicitly; the generator will not silently delete them.
Keep review links and snapshot names working. Prefer classification/index fixes
before bulk directory moves. Record every directly rendered production subject in
the catalog's review sources, including relative imports and primitives when they
@@ -66,7 +77,9 @@ Update review fingerprints only after inspecting the changed source; do not refr
to silence drift checks.
Update the catalog and run `node scripts/storybook-catalog.mjs --write` to refresh
its generated index, then run the checker without flags. The script validates
its generated indexes and feature pages, then run the checker without flags and
`node --test scripts/storybook-catalog.test.mjs scripts/storybook-feature-index.test.mjs`.
The script validates
inventory/references/review fingerprints, not semantic parity or runtime health.
Use `review-storybook` for affected rendering and interactions. Reuse the existing
Storybook/Playwright tools; add no separate launcher, runtime, or baseline system.
+7
View File
@@ -17,6 +17,13 @@ variants where affected. Record chosen files/exports and omitted scope. For a
full source review, account for every file; do not describe sampling as full
render or interaction coverage.
When reviewing navigation/index changes, compare the guide and sidebar with the
feature-map README's full ordered index. Open a feature without examples and a
feature whose related suite lives elsewhere; check capability order, gap messages,
classifications, recipe links, and actual suite navigation. Compare built entry IDs
before/after so existing links survive. Generated Overview pages do not establish
new example coverage.
Use [the existing Storybook commands](../../../doc/DEVELOPING.md#storybook):
`pnpm build-storybook`, or an owned Storybook dev server on an available local
port. Use the built `ui/storybook-static/index.json` for actual story IDs and
+9
View File
@@ -129,6 +129,15 @@ the feature map's sections and feature names. Shared fixtures live in
`ui/storybook/support/`. Keep each suite's explicit meta `id` and catalog `stableId`
when changing titles or locations so existing review links remain valid.
Storybook's Overview mirrors every feature in the feature-map README, including
features without examples. Each feature's generated Overview lists its capabilities
in recipe order, related suites across primary homes, and missing examples.
`ui/storybook/generated/` holds the derived pages; the preview config's inline
`storySort.order` is generated too. Regenerate these outputs
with `node scripts/storybook-catalog.mjs --write`, not manual edits. Storybook
start/build rejects stale generated output. These guide pages are separate from
the authored story inventory and do not count as visual or behavioral coverage.
Start from the downstream [Storybook feature index](../maps/storybook-map/INDEX.md)
to find existing stories by capability. Its [contract](../maps/storybook-map/README.md)
separates production subjects, prototype implementations, simulated data, and
File diff suppressed because it is too large. Load diff
+22 -5
View File
@@ -17,8 +17,8 @@ maintainer; this catalog does not redefine product behavior or permissions.
## Catalog contract
`catalog.json` is the maintained inventory, with one entry per story file.
`INDEX.md` is generated from it and the installed Storybook CSF parser. Titles,
`catalog.json` is the maintained inventory, with one entry per authored story file.
`INDEX.md` is generated from it, the upstream feature map, and the installed Storybook CSF parser. Titles,
export filtering, story counts and IDs come from source, not filename guesses.
All examples are retained, including historical suites. A file's first capability
is its primary home; remaining capabilities are lookup references, not copies.
@@ -35,7 +35,21 @@ fixture modules and assets live in `ui/storybook/support/`; production wrappers
The sidebar follows the section and feature names in the feature-map README, then
retains each suite's useful scenario grouping. Foundations contains shared component
examples with no primary product capability. Overview contains the catalog guide.
Areas with no stories do not get empty sidebar folders.
Every indexed feature has an Overview page, even when it has no cataloged examples.
The main guide and these pages use the same section, feature, and capability order
as the upstream map. Related suite links cross primary homes without copying stories.
Sidebar labels replace `/` with `, ` because Storybook treats slashes as folders;
the index and page heading retain the original feature name.
Missing examples are explicit; historical examples and guides do not imply current
behavioral coverage.
`ui/storybook/generated/` contains the derived index and one CSF Overview per
feature. The inline `storySort.order` in the preview config is also generated:
Storybook's indexer requires a literal there. Regenerate these outputs with the catalog command; do not edit
them or add them to the authored inventory. Their stable IDs use
`feature-map-<area>--overview`. Generated pages are explanatory guides and do not
increase example-suite counts. Storybook start/build checks this output for drift.
The generator fails on unexpected files rather than silently deleting them.
Each suite declares an explicit CSF `id`, recorded as `stableId` in the catalog.
The `sidebarTitle` can change without changing that identity. Existing story and
@@ -76,14 +90,17 @@ After installing workspace dependencies:
```sh
node scripts/storybook-catalog.mjs
node scripts/storybook-catalog.mjs --write
node --test scripts/storybook-catalog.test.mjs
node --test scripts/storybook-catalog.test.mjs scripts/storybook-feature-index.test.mjs
```
The checker rejects unaccounted or deleted stories, invalid capability references,
duplicate entries/IDs, missing review sources, changed fingerprints and a stale
generated index. `--write` only regenerates the index; it never refreshes review
generated indexes and feature pages. `--write` only regenerates these outputs; it never refreshes review
fingerprints or blesses drift. Preserve IDs when changing titles or moving files;
compare the existing built Storybook index before and after such changes.
Feature outputs are regenerated before fingerprints are checked. If those writes
change a review source, the command fails with the affected review entries. Inspect
the generated change before updating those fingerprints and rerunning the command.
Use the existing [Storybook workflow](../../doc/DEVELOPING.md#storybook) for builds,
browser review, and visual tests. Report source inspection, rendering, `play`
+53
View File
@@ -136,6 +136,39 @@ sample of interactions and rendering, not execution of all 2,210 stories.
The fixture-server story and visual-baseline comparisons remain untested for the
reasons below. The owned static preview was left running for the requested test-drive.
## Complete feature index follow-up — 2026-10-12
Source baseline: `88bf4c6c1d222f818faa56257efe79207c892a6c` (merged PR #16049).
Storybook now derives all eight sections, 35 feature families, and 171 capabilities
from the feature map. Each feature has a generated Overview, including the seven
without primary suites. Related example links cross primary homes without copying
stories. Generated guides are separate from the authored catalog and example counts.
The upstream feature map remains unchanged. Deeper authored scenario groups remain
intact; this pass does not establish new production parity.
The built index preserved all 2,210 existing story IDs and the docs ID, adding only
35 feature overviews in map order. Catalog/generator tests (16), token gates, map
checks, both skill validators, workspace typecheck, workspace build, and Storybook
build passed. The UI project passed 8,170 tests in 728 files. The broad local test
run encountered a failure in the unchanged GitHub chat case `authorizes description
edits as the editor, never inheriting the original author's access`; that exact
case passed alone without changing code or expectations. A complete local repository
suite pass is not established. PR #16052 records the final CI result separately.
The local built Storybook passed browser checks for the complete index/sidebar,
capability-ID search, empty search, Goals cross-feature suite links, all five
Execution environments capability gaps, and the existing Questions suite links.
The original `composer-question-flow--editable-initial-text` bookmark still renders.
The CLI feature uses a comma in its sidebar label because Storybook treats `/` as
a folder separator; its guide heading retains the upstream name.
Review fixes retain matching shared foundations during search and validate review
fingerprints after generated files are written. Searching `Primitive Matrix` shows
and opens the existing foundation story. A regression test changes a capability
description and proves regeneration reports the resulting review drift without
updating fingerprints. These checks establish navigation and generation behavior,
not production acceptance or visual-baseline comparison.
## Remaining review work
1. Review the 188 unreviewed suites by capability and production subject. Compare
@@ -278,3 +311,23 @@ Source inspection only: no browser rendering, play, visual baseline, provider
run or live production acceptance was performed for this reconciliation. The
existing catalog checker must run on the actual merged tree after synchronization;
its result verifies structure and declared hashes, not these live journeys.
## 2026-10-13 master merge reconciliation
Reviewed the source delta from `4808adc34e` to merge `63b2e7b8ad`
(master parent `d67e3507b2`). The text conflict in INDEX retained the feature-map
ordering and upstream workspace review notes. Regenerated INDEX after reviewing
61 stale catalog entries against the changed declared sources.
The inspected changes add assignment-history recipient suggestions and preserve
manual selections, expand backend verification recipes, and add channel task
defaults and access avatars with matching fixture changes. Entries record those
limits. The sidebar suite that also mounts IssueDetail is now unreviewed because
its route fixture has not been exercised against the new activity query. Existing
composer examples omit the new optional suggested-assignee prop and retain their
previous scenarios; their classifications do not certify the new behavior.
All 223 authored suites and 2,210 authored story IDs remain. Generated feature
pages still cover 35 areas and 171 capabilities. Catalog/generator tests (16),
catalog validation, map checks and token gates pass. This is source reconciliation,
not a new visual or live production acceptance claim.
File diff suppressed because it is too large. Load diff
+31 -19
View File
@@ -4,6 +4,7 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { featureIndex, reconcileFeatureArtifacts, sidebarLabel } from "./storybook-feature-index.mjs";
const scriptPath = fileURLToPath(import.meta.url);
const defaultRoot = path.resolve(path.dirname(scriptPath), "..");
@@ -41,14 +42,7 @@ export function capabilities(root) {
}
export function featureNavigation(root) {
const navigation = new Map();
let section;
for (const line of readFileSync(path.join(root, "maps/feature-map/README.md"), "utf8").split("\n")) {
if (line.startsWith("### ")) section = line.slice(4);
const match = line.match(/^\| \[([^\]]+)\]\(\.\/([^.)]+)\.md\)/);
if (match && section) navigation.set(match[2], `${section}/${match[1]}`);
}
return navigation;
return new Map(featureIndex(root).sections.flatMap(section => section.features.map(feature => [feature.id, `${sidebarLabel(section.title)}/${sidebarLabel(feature.title)}`])));
}
export function scanStories(root = defaultRoot) {
@@ -99,14 +93,14 @@ export function validateCatalog(root, catalog, stories) {
review(label, entry.sources, entry.fingerprint);
}
for (const story of stories) if (!seen.has(story.file)) errors.push(`${story.file}: story missing from catalog`);
const ids = stories.flatMap(story => story.ids);
const ids = [...stories.flatMap(story => story.ids), ...featureIndex(root).sections.flatMap(section => section.features.map(feature => `feature-map-${feature.id}--overview`))];
if (ids.length !== new Set(ids).size) errors.push("Duplicate story IDs");
return errors;
}
function cell(value) { return String(value).replaceAll("|", "\\|").replaceAll("\n", " "); }
export function renderIndex(catalog, stories, refs) {
export function renderIndex(catalog, stories, index) {
const byFile = new Map(stories.map(story => [story.file, story]));
const groups = new Map();
for (const entry of catalog.entries) {
@@ -118,8 +112,19 @@ export function renderIndex(catalog, stories, refs) {
"[Contract and maintenance](README.md) · [Review findings](REVIEW.md)", "",
`${stories.length} story files; ${stories.reduce((n, story) => n + story.ids.length, 0)} indexed stories. Counts describe inventory, not passed tests or complete feature coverage.`, "",
"Status describes product alignment; implementation describes the rendered subject; boundary describes simulated data. Sources and limitations are in catalog.json. Related capabilities cross-list one canonical story file.", ""];
for (const [area, entries] of [...groups].sort(([a], [b]) => a.localeCompare(b))) {
lines.push(`## ${area}`, "", ...(area !== "foundations-and-guides" ? [`[Feature recipe](../feature-map/${area}.md)`, ""] : []),
const homes = index.sections.flatMap(section => section.features.map(feature => ({ ...feature, section: section.title })));
homes.push({ id: "foundations-and-guides", title: "Shared foundations and guides", section: "Foundations", description: "Shared components and contributor guidance outside the product feature index." });
let currentSection;
for (const feature of homes) {
const area = feature.id;
const entries = groups.get(area) ?? [];
if (feature.section !== currentSection) {
lines.push(`## ${feature.section}`, "");
currentSection = feature.section;
}
lines.push(`### ${feature.title}`, "", feature.description, "", ...(area !== "foundations-and-guides" ? [`[Feature recipe](../feature-map/${area}.md)`, ""] : []));
if (!entries.length) lines.push("No primary story suite. Check capability lookup below for related examples; this does not imply a missing product feature.", "");
else lines.push(
"| Story suite | Capabilities | Product / implementation / data | Stories / play functions | Review note |",
"| --- | --- | --- | --- | --- |");
for (const entry of entries.sort((a, b) => a.file.localeCompare(b.file))) {
@@ -129,24 +134,31 @@ export function renderIndex(catalog, stories, refs) {
lines.push("");
}
lines.push("## Capability lookup", "", "References are navigation links, not proof of parity. An absent link means no cataloged story, not a missing product feature. CLI/operator capabilities may need no Storybook example.", "");
for (const ref of refs.keys()) {
for (const ref of index.sections.flatMap(section => section.features.flatMap(feature => feature.capabilities.map(capability => capability.id)))) {
const entries = catalog.entries.filter(entry => entry.capabilities.includes(ref));
lines.push(`- \`${ref}\`: ${entries.length ? entries.map(entry => `[${cell(byFile.get(entry.file).title)}](../../${entry.file}) (${entry.status})`).join(", ") : "No cataloged story."}`);
}
return lines.join("\n") + "\n";
}
export function reconcileCatalog(root, catalog, stories, write = false) {
const index = featureIndex(root);
const errors = reconcileFeatureArtifacts(root, index, write);
errors.push(...validateCatalog(root, catalog, stories));
if (!errors.length) {
const generated = renderIndex(catalog, stories, index);
if (write) writeFileSync(path.join(root, indexPath), generated);
else if (!existsSync(path.join(root, indexPath)) || readFileSync(path.join(root, indexPath), "utf8") !== generated) errors.push("Generated INDEX.md is stale; run with --write after reviewing catalog changes");
}
return errors;
}
if (process.argv[1] && path.resolve(process.argv[1]) === scriptPath) {
const args = process.argv.slice(2);
if (args.some(arg => arg !== "--write")) throw new Error("Usage: node scripts/storybook-catalog.mjs [--write]");
const catalog = JSON.parse(readFileSync(path.join(defaultRoot, catalogPath), "utf8"));
const stories = scanStories();
const errors = validateCatalog(defaultRoot, catalog, stories);
if (!errors.length) {
const generated = renderIndex(catalog, stories, capabilities(defaultRoot));
if (args.includes("--write")) writeFileSync(path.join(defaultRoot, indexPath), generated);
else if (!existsSync(path.join(defaultRoot, indexPath)) || readFileSync(path.join(defaultRoot, indexPath), "utf8") !== generated) errors.push("Generated INDEX.md is stale; run with --write after reviewing catalog changes");
}
const errors = reconcileCatalog(defaultRoot, catalog, stories, args.includes("--write"));
if (errors.length) { errors.forEach(error => console.error(error)); process.exitCode = 1; }
else console.log(`Storybook catalog aligned: ${stories.length} files, ${stories.reduce((n, story) => n + story.ids.length, 0)} stories. Structure and review fingerprints only; no runtime proof.`);
}
+43 -2
View File
@@ -4,7 +4,8 @@ import os from "node:os";
import path from "node:path";
import { test } from "node:test";
import { fileURLToPath } from "node:url";
import { capabilities, fingerprint, renderIndex, scanStories, validateCatalog } from "./storybook-catalog.mjs";
import { fingerprint, reconcileCatalog, renderIndex, scanStories, validateCatalog } from "./storybook-catalog.mjs";
import { featureIndex, reconcileFeatureArtifacts } from "./storybook-feature-index.mjs";
function fixture(t) {
const root = mkdtempSync(path.join(os.tmpdir(), "storybook-catalog-"));
@@ -99,7 +100,7 @@ test("missing and escaping source references cannot certify a review", t => {
test("cross-capability lookup retains one canonical file and honest status", t => {
const f = fixture(t);
f.catalog.entries[0].status = "historical";
const index = renderIndex(f.catalog, f.stories, capabilities(f.root));
const index = renderIndex(f.catalog, f.stories, featureIndex(f.root));
assert.match(index, /tasks\/create.*\(historical\)/);
assert.match(index, /tasks\/discussion.*\(historical\)/);
assert.match(index, /1 story files; 1 indexed stories/);
@@ -112,6 +113,46 @@ test("duplicate story IDs cannot silently collapse distinct examples", t => {
assert.match(validateCatalog(f.root, f.catalog, f.stories).join("\n"), /Duplicate story IDs/);
});
test("feature index keeps empty homes and cross-feature references in map order", t => {
const f = fixture(t);
f.write("maps/feature-map/README.md", "### Work\n| [Goals](./goals.md) | Align work. |\n| [Tasks](./tasks.md) | Create work. |\n");
f.write("maps/feature-map/goals.md", "## Sub-features\n- `hierarchy`: Link goals.\n## Gotchas\n");
f.catalog.entries[0].capabilities.push("goals/hierarchy");
const index = renderIndex(f.catalog, f.stories, featureIndex(f.root));
assert.ok(index.indexOf("### Goals") < index.indexOf("### Tasks"));
assert.match(index, /### Goals[\s\S]*?No primary story suite/);
assert.match(index, /`goals\/hierarchy`: \[Tasks and conversations\/Tasks\/Create\]/);
});
test("authored stories cannot collide with generated overview IDs", t => {
const f = fixture(t);
f.stories[0].ids = ["feature-map-tasks--overview"];
assert.match(validateCatalog(f.root, f.catalog, f.stories).join("\n"), /Duplicate story IDs/);
});
test("regeneration reports review drift from its own writes without refreshing fingerprints", t => {
const f = fixture(t);
f.write("ui/storybook/.storybook/preview.tsx", "export default { parameters: { options: { storySort: { order: [],\n}, } } };\n");
reconcileFeatureArtifacts(f.root, featureIndex(f.root), true);
f.write("maps/storybook-map/INDEX.md", "");
const generatedSource = "ui/storybook/generated/feature-index.json";
f.catalog.sharedReview.sources.push(generatedSource);
f.catalog.entries[0].sources.push(generatedSource);
f.catalog.sharedReview.fingerprint = fingerprint(f.root, f.catalog.sharedReview.sources);
f.catalog.entries[0].fingerprint = fingerprint(f.root, f.catalog.entries[0].sources);
assert.deepEqual(reconcileCatalog(f.root, f.catalog, f.stories, true), []);
const reviewed = f.catalog.sharedReview.fingerprint;
f.write("maps/feature-map/tasks.md", "## Sub-features\n- `create`: Updated description.\n- `discussion`: discuss\n## Gotchas\n");
const errors = reconcileCatalog(f.root, f.catalog, f.stories, true);
assert.equal(errors.filter(error => error.includes("source changed; review")).length, 2);
assert.equal(f.catalog.sharedReview.fingerprint, reviewed);
assert.notEqual(fingerprint(f.root, f.catalog.sharedReview.sources), reviewed);
f.catalog.sharedReview.fingerprint = fingerprint(f.root, f.catalog.sharedReview.sources);
f.catalog.entries[0].fingerprint = fingerprint(f.root, f.catalog.entries[0].sources);
assert.deepEqual(reconcileCatalog(f.root, f.catalog, f.stories, true), []);
assert.deepEqual(reconcileCatalog(f.root, f.catalog, f.stories), []);
});
test("Storybook parser discovers nested files, filters helpers, preserves explicit IDs and counts play functions", t => {
const f = fixture(t);
f.write("ui/package.json", '{"type":"module"}');
+126
View File
@@ -0,0 +1,126 @@
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
export const generatedRoot = "ui/storybook/generated";
export const sidebarLabel = title => title.replaceAll("/", ", ");
export function featureIndex(root) {
const sections = [];
let section;
const seen = new Set();
const source = readFileSync(path.join(root, "maps/feature-map/README.md"), "utf8");
for (const line of source.split("\n")) {
if (line.startsWith("### ")) {
section = { title: line.slice(4), features: [] };
sections.push(section);
}
const match = line.match(/^\| \[([^\]]+)\]\(\.\/([a-z0-9-]+)\.md\) \| (.*) \|$/);
if (!match) {
if (line.startsWith("| [")) throw new Error(`Unrecognized feature-map row: ${line}`);
continue;
}
if (!section || seen.has(match[2])) throw new Error(`Invalid feature-map entry: ${line}`);
const [, title, id, description] = match;
seen.add(id);
const recipe = readFileSync(path.join(root, `maps/feature-map/${id}.md`), "utf8");
const body = recipe.split(/^## Sub-features\s*$/m)[1]?.split(/^## /m)[0];
if (!body) throw new Error(`Missing sub-features: ${id}`);
const capabilities = [];
for (const row of body.trim().split("\n")) {
const capability = row.match(/^- `([^`]+)`:\s*(.*)$/);
if (capability) {
const [, key, text] = capability;
capabilities.push({ id: `${id}/${key}`, label: key.replaceAll("-", " ").replace(/^./, letter => letter.toUpperCase()), description: text });
} else if (row.trim() && capabilities.length) {
capabilities.at(-1).description += ` ${row.trim()}`;
}
}
if (!capabilities.length || new Set(capabilities.map(item => item.id)).size !== capabilities.length) throw new Error(`Invalid sub-features: ${id}`);
section.features.push({ id, title, description, capabilities });
}
const populated = sections.filter(item => item.features.length);
if (!populated.length) throw new Error("Feature-map index has no feature families");
for (const file of readdirSync(path.join(root, "maps/feature-map"))) {
if (file.endsWith(".md") && file !== "README.md" && !seen.has(file.slice(0, -3))) throw new Error(`Feature recipe missing from index: ${file}`);
}
return { sections: populated };
}
export function featureOrder(index) {
return ["Overview", ...index.sections.flatMap(section => [sidebarLabel(section.title),
section.features.flatMap(feature => [sidebarLabel(feature.title), ["Overview", "*"]]),
]), "Foundations"];
}
export function featureArtifacts(index) {
const outputs = new Map([
[`${generatedRoot}/feature-index.json`, JSON.stringify(index, null, 2) + "\n"],
]);
for (const section of index.sections) {
for (const feature of section.features) {
outputs.set(`${generatedRoot}/features/${feature.id}.stories.tsx`, [
'import type { Meta, StoryObj } from "@storybook/react-vite";',
'import { FeatureOverview } from "../../support/feature-map/FeatureOverview";',
"",
"const meta = {",
` id: ${JSON.stringify(`feature-map-${feature.id}`)},`,
` title: ${JSON.stringify(`${sidebarLabel(section.title)}/${sidebarLabel(feature.title)}/Overview`)},`,
" component: FeatureOverview,",
` args: { area: ${JSON.stringify(feature.id)} },`,
' tags: ["!autodocs"],',
' parameters: { layout: "fullscreen" },',
"} satisfies Meta<typeof FeatureOverview>;",
"export default meta;",
"export const Overview: StoryObj<typeof meta> = {};",
"",
].join("\n"));
}
}
return outputs;
}
export function reconcileFeatureArtifacts(root, index, write = false) {
const outputs = featureArtifacts(index);
const errors = [];
function inspect(directory) {
if (!existsSync(path.join(root, directory))) return;
for (const entry of readdirSync(path.join(root, directory), { withFileTypes: true })) {
const file = `${directory}/${entry.name}`;
if (entry.isDirectory()) inspect(file);
else if (!outputs.has(file)) errors.push(`Unexpected generated feature file: ${file}`);
}
}
inspect(generatedRoot);
if (errors.length) return errors;
for (const [file, content] of outputs) {
const destination = path.join(root, file);
if (write) {
mkdirSync(path.dirname(destination), { recursive: true });
writeFileSync(destination, content);
} else if (!existsSync(destination) || readFileSync(destination, "utf8") !== content) {
errors.push(`${file}: generated feature index is stale; run storybook-catalog.mjs --write`);
}
}
const previewFile = "ui/storybook/.storybook/preview.tsx";
const previewPath = path.join(root, previewFile);
const preview = readFileSync(previewPath, "utf8");
const pattern = /(\bstorySort:\s*\{\s*order:\s*)([\s\S]*?)(,\s*\n\s*\},)/g;
if ([...preview.matchAll(pattern)].length !== 1) throw new Error("Expected one inline storySort.order in preview.tsx");
const order = JSON.stringify(featureOrder(index), null, 2)
.replace(/("[^"]+",)\n\s+\[\n\s+"Overview",\n\s+"\*"\n\s+\]/g, '$1 ["Overview", "*"]')
.replaceAll("\n", "\n ");
const updated = preview.replace(pattern, (_, before, value, after) => before + order + after);
if (write) writeFileSync(previewPath, updated);
else if (updated !== preview) errors.push(`${previewFile}: generated sidebar order is stale; run storybook-catalog.mjs --write`);
return errors;
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const root = fileURLToPath(new URL("..", import.meta.url));
const errors = reconcileFeatureArtifacts(root, featureIndex(root));
if (errors.length) {
errors.forEach(error => console.error(error));
process.exitCode = 1;
}
}
+73
View File
@@ -0,0 +1,73 @@
import assert from "node:assert/strict";
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { test } from "node:test";
import { featureArtifacts, featureIndex, featureOrder, reconcileFeatureArtifacts } from "./storybook-feature-index.mjs";
function fixture(t) {
const root = mkdtempSync(path.join(os.tmpdir(), "storybook-feature-index-"));
t.after(() => rmSync(root, { recursive: true, force: true }));
const write = (file, text) => {
mkdirSync(path.dirname(path.join(root, file)), { recursive: true });
writeFileSync(path.join(root, file), text);
};
write("maps/feature-map/README.md", "# Map\n### Work\n| [Tasks](./tasks.md) | Create and follow work. |\n| [Goals](./goals.md) | Align work. |\n### Connections\n| [Apps](./apps.md) | Connect tools. |\n");
write("maps/feature-map/tasks.md", "# Tasks\n## Sub-features\n- `create`: Create work;\n retain the initial description.\n- `review`: Review it.\n## How to get to it\nNot a capability.\n");
write("maps/feature-map/goals.md", "# Goals\n## Sub-features\n- `hierarchy`: Link goals.\n## Gotchas\n");
write("maps/feature-map/apps.md", "# Apps\n## Sub-features\n- `connect`: Connect an app.\n## Gotchas\n");
write("ui/storybook/.storybook/preview.tsx", "export default { parameters: { options: { storySort: { order: [],\n}, unrelated: true } } };\n");
return { root, write };
}
test("feature index preserves recipe names, map order, and multiline capability descriptions", t => {
const { root } = fixture(t);
const index = featureIndex(root);
assert.deepEqual(index.sections.map(section => section.title), ["Work", "Connections"]);
assert.deepEqual(index.sections.flatMap(section => section.features.map(feature => feature.id)), ["tasks", "goals", "apps"]);
assert.deepEqual(index.sections[0].features[0].capabilities, [
{ id: "tasks/create", label: "Create", description: "Create work; retain the initial description." },
{ id: "tasks/review", label: "Review", description: "Review it." },
]);
assert.deepEqual(featureOrder(index), ["Overview", "Work", ["Tasks", ["Overview", "*"], "Goals", ["Overview", "*"]], "Connections", ["Apps", ["Overview", "*"]], "Foundations"]);
});
test("every feature gets a stable overview, including features with no authored stories", t => {
const { root } = fixture(t);
const index = featureIndex(root);
const outputs = featureArtifacts(index);
const file = "ui/storybook/generated/features/goals.stories.tsx";
assert.match(outputs.get(file), /id: "feature-map-goals"/);
assert.match(outputs.get(file), /title: "Work\/Goals\/Overview"/);
index.sections[0].features[1].title = "Work alignment";
assert.match(featureArtifacts(index).get(file), /id: "feature-map-goals"/);
assert.match(featureArtifacts(index).get(file), /title: "Work\/Work alignment\/Overview"/);
index.sections[0].features[1].title = "CLI/API and local worktrees";
assert.match(featureArtifacts(index).get(file), /title: "Work\/CLI, API and local worktrees\/Overview"/);
assert.ok(featureOrder(index)[2].includes("CLI, API and local worktrees"));
});
test("generated guides detect upstream drift, local edits, missing files, and unknown files", t => {
const { root, write } = fixture(t);
const index = featureIndex(root);
assert.equal(reconcileFeatureArtifacts(root, index).length, 5);
assert.deepEqual(reconcileFeatureArtifacts(root, index, true), []);
assert.deepEqual(reconcileFeatureArtifacts(root, index), []);
write("ui/storybook/generated/features/goals.stories.tsx", "export default {};");
assert.match(reconcileFeatureArtifacts(root, index).join("\n"), /goals.stories.tsx: generated feature index is stale/);
reconcileFeatureArtifacts(root, index, true);
index.sections.reverse();
assert.match(reconcileFeatureArtifacts(root, index).join("\n"), /preview.tsx: generated sidebar order is stale/);
assert.match(readFileSync(path.join(root, "ui/storybook/.storybook/preview.tsx"), "utf8"), /unrelated: true/);
write("ui/storybook/generated/features/orphan.stories.tsx", "keep this visible");
assert.match(reconcileFeatureArtifacts(root, index, true).join("\n"), /Unexpected generated feature file/);
assert.equal(readFileSync(path.join(root, "ui/storybook/generated/features/orphan.stories.tsx"), "utf8"), "keep this visible");
});
test("malformed or omitted map entries fail instead of silently hiding a feature", t => {
const { root, write } = fixture(t);
write("maps/feature-map/README.md", "### Work\n| [Tasks](./tasks.md) | Tasks |\n");
assert.throws(() => featureIndex(root), /missing from index/);
write("maps/feature-map/README.md", "### Work\n| [Tasks](tasks.md) | Tasks |\n");
assert.throws(() => featureIndex(root), /Unrecognized feature-map row/);
});
+2 -2
View File
@@ -17,8 +17,8 @@
"dev": "vite",
"build": "vite build",
"build:preview": "vite build --config vite.preview.config.mjs",
"storybook": "storybook dev -p 6006 -c storybook/.storybook",
"build-storybook": "storybook build -c storybook/.storybook -o storybook-static",
"storybook": "node ../scripts/storybook-feature-index.mjs && storybook dev -p 6006 -c storybook/.storybook",
"build-storybook": "node ../scripts/storybook-feature-index.mjs && storybook build -c storybook/.storybook -o storybook-static",
"preview": "vite preview",
"typecheck": "tsc -b",
"clean": "rm -rf dist dist-preview storybook-static tsconfig.tsbuildinfo",
+1 -1
View File
@@ -16,7 +16,7 @@ const paperclipInstanceOrigin = (() => {
})();
const config: StorybookConfig = {
stories: ["../stories/**/*.stories.@(ts|tsx|mdx)"],
stories: ["../stories/**/*.stories.@(ts|tsx|mdx)", "../generated/features/*.stories.tsx"],
staticDirs: ["../../public", "../public"],
addons: ["@storybook/addon-docs", "@storybook/addon-a11y"],
framework: {
+35 -35
View File
@@ -856,62 +856,62 @@ const preview: Preview = {
"Overview",
"Getting started and access",
[
"Onboarding and first work",
"Login, invitations, and access",
"Companies and portability"
"Onboarding and first work", ["Overview", "*"],
"Login, invitations, and access", ["Overview", "*"],
"Companies and portability", ["Overview", "*"]
],
"Tasks and conversations",
[
"Task creation and lifecycle",
"Delegation, dependencies, and signoff",
"Inbox, decisions, and search",
"Agent conversations and project handoff",
"Questions and approvals",
"Steering and queued messages",
"Documents, attachments, and work products"
"Task creation and lifecycle", ["Overview", "*"],
"Delegation, dependencies, and signoff", ["Overview", "*"],
"Inbox, decisions, and search", ["Overview", "*"],
"Agent conversations and project handoff", ["Overview", "*"],
"Questions and approvals", ["Overview", "*"],
"Steering and queued messages", ["Overview", "*"],
"Documents, attachments, and work products", ["Overview", "*"]
],
"Agents and reusable capabilities",
[
"Hiring, configuration, and organization",
"Runs, harnesses, and model accounts",
"Skills and Skill Studio",
"Team packages and installation"
"Hiring, configuration, and organization", ["Overview", "*"],
"Runs, harnesses, and model accounts", ["Overview", "*"],
"Skills and Skill Studio", ["Overview", "*"],
"Team packages and installation", ["Overview", "*"]
],
"Projects and execution",
[
"Projects and repositories",
"Goals and work alignment",
"Workspaces, services, and files",
"Execution environments",
"Recovery"
"Projects and repositories", ["Overview", "*"],
"Goals and work alignment", ["Overview", "*"],
"Workspaces, services, and files", ["Overview", "*"],
"Execution environments", ["Overview", "*"],
"Recovery", ["Overview", "*"]
],
"Apps, channels, and extensions",
[
"Connection setup",
"App access and action permissions",
"External chat and email",
"Tool gateways and access profiles",
"Secrets and proposals",
"Plugins"
"Connection setup", ["Overview", "*"],
"App access and action permissions", ["Overview", "*"],
"External chat and email", ["Overview", "*"],
"Tool gateways and access profiles", ["Overview", "*"],
"Secrets and proposals", ["Overview", "*"],
"Plugins", ["Overview", "*"]
],
"Automation and structured work",
[
"Routines, schedules, and triggers",
"Pipelines, review queues, and learnings",
"Cases",
"Status cards"
"Routines, schedules, and triggers", ["Overview", "*"],
"Pipelines, review queues, and learnings", ["Overview", "*"],
"Cases", ["Overview", "*"],
"Status cards", ["Overview", "*"]
],
"Oversight and operation",
[
"Costs and budgets",
"Dashboards and audit trails",
"Navigation, profile, and announcements",
"Instance operations",
"CLI/API and local worktrees"
"Costs and budgets", ["Overview", "*"],
"Dashboards and audit trails", ["Overview", "*"],
"Navigation, profile, and announcements", ["Overview", "*"],
"Instance operations", ["Overview", "*"],
"CLI, API and local worktrees", ["Overview", "*"]
],
"Contributor surfaces",
[
"Developer previews and diagnostic labs"
"Developer previews and diagnostic labs", ["Overview", "*"]
],
"Foundations"
],
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-access",
title: "Getting started and access/Login, invitations, and access/Overview",
component: FeatureOverview,
args: { area: "access" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-activity",
title: "Oversight and operation/Dashboards and audit trails/Overview",
component: FeatureOverview,
args: { area: "activity" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-agent-chat",
title: "Tasks and conversations/Agent conversations and project handoff/Overview",
component: FeatureOverview,
args: { area: "agent-chat" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-agents",
title: "Agents and reusable capabilities/Hiring, configuration, and organization/Overview",
component: FeatureOverview,
args: { area: "agents" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-app-permissions",
title: "Apps, channels, and extensions/App access and action permissions/Overview",
component: FeatureOverview,
args: { area: "app-permissions" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-budgets-costs",
title: "Oversight and operation/Costs and budgets/Overview",
component: FeatureOverview,
args: { area: "budgets-costs" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-cases",
title: "Automation and structured work/Cases/Overview",
component: FeatureOverview,
args: { area: "cases" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-chat-channels",
title: "Apps, channels, and extensions/External chat and email/Overview",
component: FeatureOverview,
args: { area: "chat-channels" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-cli-operations",
title: "Oversight and operation/CLI, API and local worktrees/Overview",
component: FeatureOverview,
args: { area: "cli-operations" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-companies",
title: "Getting started and access/Companies and portability/Overview",
component: FeatureOverview,
args: { area: "companies" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-connection-setup",
title: "Apps, channels, and extensions/Connection setup/Overview",
component: FeatureOverview,
args: { area: "connection-setup" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-developer-labs",
title: "Contributor surfaces/Developer previews and diagnostic labs/Overview",
component: FeatureOverview,
args: { area: "developer-labs" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-documents-artifacts",
title: "Tasks and conversations/Documents, attachments, and work products/Overview",
component: FeatureOverview,
args: { area: "documents-artifacts" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-execution-environments",
title: "Projects and execution/Execution environments/Overview",
component: FeatureOverview,
args: { area: "execution-environments" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-gateways-profiles",
title: "Apps, channels, and extensions/Tool gateways and access profiles/Overview",
component: FeatureOverview,
args: { area: "gateways-profiles" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-goals",
title: "Projects and execution/Goals and work alignment/Overview",
component: FeatureOverview,
args: { area: "goals" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-inbox-search",
title: "Tasks and conversations/Inbox, decisions, and search/Overview",
component: FeatureOverview,
args: { area: "inbox-search" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-instance-operations",
title: "Oversight and operation/Instance operations/Overview",
component: FeatureOverview,
args: { area: "instance-operations" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-navigation-preferences",
title: "Oversight and operation/Navigation, profile, and announcements/Overview",
component: FeatureOverview,
args: { area: "navigation-preferences" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-onboarding",
title: "Getting started and access/Onboarding and first work/Overview",
component: FeatureOverview,
args: { area: "onboarding" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-pipelines",
title: "Automation and structured work/Pipelines, review queues, and learnings/Overview",
component: FeatureOverview,
args: { area: "pipelines" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-plugins",
title: "Apps, channels, and extensions/Plugins/Overview",
component: FeatureOverview,
args: { area: "plugins" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-projects",
title: "Projects and execution/Projects and repositories/Overview",
component: FeatureOverview,
args: { area: "projects" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-questions-and-approvals",
title: "Tasks and conversations/Questions and approvals/Overview",
component: FeatureOverview,
args: { area: "questions-and-approvals" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-recovery",
title: "Projects and execution/Recovery/Overview",
component: FeatureOverview,
args: { area: "recovery" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-routines",
title: "Automation and structured work/Routines, schedules, and triggers/Overview",
component: FeatureOverview,
args: { area: "routines" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-runs-adapters",
title: "Agents and reusable capabilities/Runs, harnesses, and model accounts/Overview",
component: FeatureOverview,
args: { area: "runs-adapters" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-secrets",
title: "Apps, channels, and extensions/Secrets and proposals/Overview",
component: FeatureOverview,
args: { area: "secrets" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-skills",
title: "Agents and reusable capabilities/Skills and Skill Studio/Overview",
component: FeatureOverview,
args: { area: "skills" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-status-cards",
title: "Automation and structured work/Status cards/Overview",
component: FeatureOverview,
args: { area: "status-cards" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-steering",
title: "Tasks and conversations/Steering and queued messages/Overview",
component: FeatureOverview,
args: { area: "steering" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-task-coordination",
title: "Tasks and conversations/Delegation, dependencies, and signoff/Overview",
component: FeatureOverview,
args: { area: "task-coordination" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-tasks",
title: "Tasks and conversations/Task creation and lifecycle/Overview",
component: FeatureOverview,
args: { area: "tasks" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-teams",
title: "Agents and reusable capabilities/Team packages and installation/Overview",
component: FeatureOverview,
args: { area: "teams" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FeatureOverview } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "feature-map-workspaces",
title: "Projects and execution/Workspaces, services, and files/Overview",
component: FeatureOverview,
args: { area: "workspaces" },
tags: ["!autodocs"],
parameters: { layout: "fullscreen" },
} satisfies Meta<typeof FeatureOverview>;
export default meta;
export const Overview: StoryObj<typeof meta> = {};
@@ -1,93 +1,12 @@
import { useEffect, useMemo, useState } from "react";
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
import catalog from "../../../../maps/storybook-map/catalog.json";
type IndexEntry = { id: string; type: string; importPath: string };
function StorybookGuide() {
const [query, setQuery] = useState("");
const [storyLinks, setStoryLinks] = useState<Record<string, string>>({});
const [indexError, setIndexError] = useState(false);
useEffect(() => {
const controller = new AbortController();
void fetch(new URL("index.json", window.location.href), { signal: controller.signal })
.then(response => {
if (!response.ok) throw new Error("Story index unavailable");
return response.json() as Promise<{ entries: Record<string, IndexEntry> }>;
})
.then(index => {
const links: Record<string, string> = {};
for (const entry of Object.values(index.entries)) {
if (entry.type !== "story") continue;
const file = `ui/${entry.importPath.replace(/^\.\//, "")}`;
links[file] ??= `./?path=/story/${entry.id}`;
}
setStoryLinks(links);
})
.catch(() => { if (!controller.signal.aborted) setIndexError(true); });
return () => controller.abort();
}, []);
const groups = useMemo(() => {
const result = new Map<string, typeof catalog.entries>();
const search = query.trim().toLowerCase();
for (const entry of catalog.entries) {
if (search && ![entry.purpose, entry.file, entry.status, entry.implementation, ...entry.capabilities].join(" ").toLowerCase().includes(search)) continue;
const area = entry.capabilities[0]?.split("/")[0] ?? "foundations-and-guides";
const entries = result.get(area) ?? [];
entries.push(entry);
result.set(area, entries);
}
return [...result].sort(([a], [b]) => a.localeCompare(b));
}, [query]);
return (
<main className="paperclip-story__inner space-y-6 p-6">
<header className="space-y-3">
<h1 className="text-2xl font-semibold">Storybook by feature</h1>
<p className="text-sm text-muted-foreground">
{catalog.entries.length} story suites organized by the feature map. Current means source-reviewed;
it does not mean every interaction or production journey passed. Production components can use simulated data.
</p>
<p className="text-sm text-muted-foreground">
Historical designs and proposals stay available. Unreviewed entries need deeper comparison with the current product.
The maintained contract and full source references are in maps/storybook-map/.
</p>
<Input aria-label="Find stories by feature, title, or status" placeholder="Find a feature, story, or status…" value={query} onChange={event => setQuery(event.target.value)} />
{indexError ? <p role="alert" className="text-sm text-destructive">Story links could not load. Reload this guide to try again.</p> : null}
</header>
{groups.length === 0 ? <p className="text-sm text-muted-foreground">No matching stories.</p> : null}
{groups.map(([area, entries]) => (
<section key={area} className="space-y-3">
<h2 className="text-lg font-semibold">{area}</h2>
<ul className="divide-y divide-border">
{entries.map(entry => (
<li key={entry.file} className="space-y-2 py-4">
<div className="flex flex-wrap items-center gap-2">
{storyLinks[entry.file]
? <a className="font-medium underline underline-offset-4" href={storyLinks[entry.file]} target="_top">{entry.purpose}</a>
: <span className="font-medium">{entry.purpose}</span>}
<Badge variant="outline">{entry.status}</Badge>
<Badge variant="outline">{entry.implementation}</Badge>
<Badge variant="outline">{entry.boundary}</Badge>
</div>
<p className="text-sm text-muted-foreground">{entry.notes}</p>
<p className="font-mono text-xs text-muted-foreground">{entry.capabilities.join(" · ") || "Shared foundations and contributor guidance"}</p>
</li>
))}
</ul>
</section>
))}
</main>
);
}
import { FeatureMapIndex } from "../../support/feature-map/FeatureOverview";
const meta = {
id: "overview-storybook-guide",
title: "Overview/Storybook Guide",
component: StorybookGuide,
component: FeatureMapIndex,
parameters: { docs: { description: { component: "Feature-based navigation from the downstream catalog, with separate product, component, and fixture classifications. Story links come from this build's index." } } },
} satisfies Meta<typeof StorybookGuide>;
} satisfies Meta<typeof FeatureMapIndex>;
export default meta;
type Story = StoryObj<typeof meta>;
export const CoverageGuide: Story = {};
@@ -0,0 +1,148 @@
import { useEffect, useMemo, useState } from "react";
import ReactMarkdown from "react-markdown";
import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
import catalog from "../../../../maps/storybook-map/catalog.json";
import featureIndex from "../../generated/feature-index.json";
type Entry = Omit<(typeof catalog.entries)[number], "capabilities"> & { capabilities: string[] };
const entries: Entry[] = catalog.entries;
type IndexEntry = { id: string; type: string; importPath: string };
const recipeRoot = "https://github.com/paperclipai/paperclip/blob/master/maps/feature-map/";
const allFeatures = featureIndex.sections.flatMap(section => section.features);
const examples = entries.filter(entry => entry.implementation !== "guide");
const featureHref = (id: string) => `./?path=/story/feature-map-${id}--overview`;
function useStoryLinks() {
const [links, setLinks] = useState<Record<string, string>>({});
const [error, setError] = useState(false);
useEffect(() => {
const controller = new AbortController();
void fetch(new URL("index.json", window.location.href), { signal: controller.signal })
.then(response => {
if (!response.ok) throw new Error("Story index unavailable");
return response.json() as Promise<{ entries: Record<string, IndexEntry> }>;
})
.then(index => {
const next: Record<string, string> = {};
for (const entry of Object.values(index.entries)) {
if (entry.type !== "story") continue;
const file = `ui/${entry.importPath.replace(/^\.\//, "")}`;
next[file] ??= `./?path=/story/${entry.id}`;
}
setLinks(next);
})
.catch(() => { if (!controller.signal.aborted) setError(true); });
return () => controller.abort();
}, []);
return { links, error };
}
function SuiteLink({ entry, links }: { entry: Entry; links: Record<string, string> }) {
return (
<li className="space-y-2 py-3">
<div className="flex flex-wrap items-center gap-2">
{links[entry.file]
? <a className="font-medium underline underline-offset-4" href={links[entry.file]} target="_top">{entry.purpose}</a>
: <span className="font-medium">{entry.purpose}</span>}
<Badge variant="outline">{entry.status}</Badge>
<Badge variant="outline">{entry.implementation}</Badge>
<Badge variant="outline">{entry.boundary}</Badge>
</div>
<p className="text-sm text-muted-foreground">{entry.notes}</p>
</li>
);
}
export function FeatureMapIndex() {
const [query, setQuery] = useState("");
const { links, error } = useStoryLinks();
const search = query.trim().toLowerCase();
const sections = useMemo(() => featureIndex.sections.map(section => ({
...section,
features: section.features.filter(feature => {
const related = entries.filter(entry => entry.capabilities.some(ref => ref.startsWith(`${feature.id}/`)));
return [section.title, feature.title, feature.id, feature.description,
...feature.capabilities.flatMap(capability => [capability.id, capability.label, capability.description]),
...related.flatMap(entry => [entry.file, entry.purpose, entry.status, entry.implementation]),
].join(" ").toLowerCase().includes(search);
}),
})).filter(section => section.features.length), [search]);
const foundations = examples.filter(entry => !entry.capabilities.length
&& ["Shared foundations", entry.file, entry.purpose, entry.status, entry.implementation, entry.boundary].join(" ").toLowerCase().includes(search));
return (
<main className="paperclip-story__inner space-y-6 p-6">
<header className="space-y-3">
<h1 className="text-2xl font-semibold">Paperclip feature map</h1>
<p className="text-sm text-muted-foreground">The same product index as the feature map, with Storybook examples alongside each capability.</p>
<p className="text-sm text-muted-foreground">{allFeatures.length} feature families · {allFeatures.reduce((count, feature) => count + feature.capabilities.length, 0)} capabilities. Examples are fixtures and references, not proof of production behavior.</p>
<a className="text-sm underline underline-offset-4" href={`${recipeRoot}README.md`} target="_blank" rel="noreferrer">Read the feature-map index</a>
<Input aria-label="Find a feature or capability" placeholder="Find a feature, capability, or example…" value={query} onChange={event => setQuery(event.target.value)} />
</header>
{sections.length === 0 && foundations.length === 0 ? <p>No matching features or examples.</p> : null}
{sections.map(section => (
<section key={section.title} className="space-y-3">
<h2 className="text-lg font-semibold">{section.title}</h2>
<ul className="divide-y divide-border">
{section.features.map(feature => {
const suites = examples.filter(entry => entry.capabilities.some(ref => ref.startsWith(`${feature.id}/`)));
return (
<li key={feature.id} className="space-y-2 py-3">
<div className="flex flex-wrap items-center gap-2">
<a className="font-medium underline underline-offset-4" href={featureHref(feature.id)} target="_top">{feature.title}</a>
<span className="text-sm text-muted-foreground">{suites.length ? `${suites.length} related example ${suites.length === 1 ? "suite" : "suites"}` : "No cataloged examples yet"}</span>
</div>
<p className="text-sm text-muted-foreground">{feature.description}</p>
</li>
);
})}
</ul>
</section>
))}
{foundations.length ? (
<section className="space-y-3">
<h2 className="text-lg font-semibold">Shared foundations</h2>
<p className="text-sm text-muted-foreground">Shared UI components sit outside the product feature index.</p>
{error ? <p role="alert">Example links could not load. Reload to try again.</p> : null}
<ul className="divide-y divide-border">{foundations.map(entry => <SuiteLink key={entry.file} entry={entry} links={links} />)}</ul>
</section>
) : null}
</main>
);
}
export function FeatureOverview({ area }: { area: string }) {
const feature = allFeatures.find(item => item.id === area);
const { links, error } = useStoryLinks();
if (!feature) return <p role="alert">This feature is not in the feature-map index.</p>;
const guides = entries.filter(entry => entry.implementation === "guide" && entry.capabilities.some(ref => ref.startsWith(`${area}/`)));
return (
<main className="paperclip-story__inner space-y-6 p-6">
<header className="space-y-3">
<a className="text-sm underline underline-offset-4" href="./?path=/story/overview-storybook-guide--coverage-guide" target="_top">All features</a>
<h1 className="text-2xl font-semibold">{feature.title}</h1>
<p className="text-muted-foreground">{feature.description}</p>
<a className="text-sm underline underline-offset-4" href={`${recipeRoot}${area}.md`} target="_blank" rel="noreferrer">Feature recipe and verification steps</a>
<p className="text-sm text-muted-foreground">Capabilities follow the feature recipe in the same order. Related suites may live under another feature. A suite link does not establish that every behavior has an example or passed a test.</p>
{error ? <p role="alert">Example links could not load. Reload to try again.</p> : null}
</header>
<nav aria-label="Capabilities" className="flex flex-wrap gap-3">
{feature.capabilities.map(capability => <a key={capability.id} className="text-sm underline underline-offset-4" href={`#${capability.id.split("/")[1]}`}>{capability.label}</a>)}
</nav>
{feature.capabilities.map(capability => {
const suites = examples.filter(entry => entry.capabilities.includes(capability.id));
return (
<section key={capability.id} id={capability.id.split("/")[1]} className="space-y-3">
<h2 className="text-lg font-semibold">{capability.label}</h2>
<code className="text-xs text-muted-foreground">{capability.id}</code>
<div className="text-sm text-muted-foreground"><ReactMarkdown>{capability.description}</ReactMarkdown></div>
{suites.length
? <ul className="divide-y divide-border">{suites.map(entry => <SuiteLink key={entry.file} entry={entry} links={links} />)}</ul>
: <p className="text-sm">No cataloged example yet. Use the feature recipe for entry points, verification steps, and known limits.</p>}
</section>
);
})}
{guides.length ? <section className="space-y-3"><h2 className="text-lg font-semibold">Related guides</h2><ul className="divide-y divide-border">{guides.map(entry => <SuiteLink key={entry.file} entry={entry} links={links} />)}</ul></section> : null}
</main>
);
}