{"id":51820509,"url":"https://github.com/anrouxel/storybook-addon-angular-manifest","last_synced_at":"2026-07-24T14:00:36.936Z","repository":{"id":364872962,"uuid":"1269542777","full_name":"anrouxel/storybook-addon-angular-manifest","owner":"anrouxel","description":null,"archived":false,"fork":false,"pushed_at":"2026-07-10T12:17:50.000Z","size":203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-10T13:10:27.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anrouxel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-14T20:58:10.000Z","updated_at":"2026-07-10T12:18:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/anrouxel/storybook-addon-angular-manifest","commit_stats":null,"previous_names":["anrouxel/storybook-addon-angular-manifest"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/anrouxel/storybook-addon-angular-manifest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrouxel%2Fstorybook-addon-angular-manifest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrouxel%2Fstorybook-addon-angular-manifest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrouxel%2Fstorybook-addon-angular-manifest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrouxel%2Fstorybook-addon-angular-manifest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anrouxel","download_url":"https://codeload.github.com/anrouxel/storybook-addon-angular-manifest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anrouxel%2Fstorybook-addon-angular-manifest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35844578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-24T02:00:07.870Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-22T05:00:25.532Z","updated_at":"2026-07-24T14:00:36.929Z","avatar_url":"https://github.com/anrouxel.png","language":"TypeScript","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Documentation Tools"],"readme":"# Storybook Addon Angular Manifest\n\n[![npm version](https://img.shields.io/npm/v/@anrouxel/storybook-addon-angular-manifest.svg)](https://www.npmjs.com/package/@anrouxel/storybook-addon-angular-manifest)\n[![license](https://img.shields.io/npm/l/@anrouxel/storybook-addon-angular-manifest.svg)](./LICENSE.md)\n\nA Storybook addon that builds an **Angular component manifest** from your stories and [Compodoc](https://compodoc.app/) documentation. It plugs into Storybook's `experimental_manifests` API so tools like AI assistants and the [MCP](https://modelcontextprotocol.io/) server can understand your Angular component library: inputs, outputs, selectors, descriptions and ready-to-use template snippets.\n\n## Features\n\n- **Compodoc integration** — reads `documentation.json` and matches each story's component to its Compodoc entry to extract inputs, outputs, selector, standalone flag and change detection strategy.\n- **Angular template snippets** — generates a `\u003ccomponent ...\u003e` snippet per story from the component's selector and args. When the selector has multiple comma-separated variants (e.g. `button[lib-btn], a[lib-btn]`), the first variant is used.\n- **JSDoc tags** — parses `@summary`, `@describe`/`@desc` and other JSDoc tags from the story's `meta` or the story export itself.\n- **`@useTemplate` opt-in** — use the story's `parameters.docs.source.code` (the same code Storybook's Docs \"Show code\" panel displays) as the snippet instead of the generated one, falling back to the story's `render` template if no `docs.source.code` is set.\n- **Import statement resolution** — infers the import specifier for each component, preferring the nearest `package.json` name when the component belongs to a published package.\n- **Works with `@storybook/angular` and `@storybook/angular-vite`.**\n\n## Requirements\n\n- Storybook `10.5.0` or later, with `experimental_manifests` support.\n- [Compodoc](https://compodoc.app/) documentation generated for your Angular project. The easiest way is to enable it in your `angular.json` build target:\n\n  ```json\n  {\n    \"options\": {\n      \"compodoc\": true\n    }\n  }\n  ```\n\n  This produces a `documentation.json` file that the addon looks for at `documentation.json` or `.compodoc/documentation.json` relative to your Storybook working directory before Storybook starts.\n\n  Alternatively, generate it manually:\n\n  ```bash\n  npx compodoc -p tsconfig.json\n  ```\n\n## Installation\n\n```bash\nnpm install --save-dev @anrouxel/storybook-addon-angular-manifest\n# or\npnpm add -D @anrouxel/storybook-addon-angular-manifest\n# or\nyarn add -D @anrouxel/storybook-addon-angular-manifest\n```\n\nThen register it in `.storybook/main.ts`, and enable Storybook's `componentsManifest` feature flag so the manifest is actually written out:\n\n```ts\nimport type { StorybookConfig } from '@storybook/angular-vite';\n\nconst config: StorybookConfig = {\n  framework: '@storybook/angular-vite',\n  addons: ['@anrouxel/storybook-addon-angular-manifest'],\n  features: {\n    componentsManifest: true,\n  },\n  // ...\n};\n\nexport default config;\n```\n\nRunning `storybook build` then writes the manifest to `storybook-static/manifests/components.json`.\n\n## How it works\n\nFor every story indexed by Storybook, the addon:\n\n1. Resolves the story's `meta.component` and its import declaration to find the Angular component/directive class.\n2. Looks it up in the Compodoc `documentation.json` (components, directives, pipes, injectables and classes are all searched).\n3. Builds an Angular template snippet from the component's selector, its `inputsClass`/`outputsClass`, and the story's `args` — statically extracted from the story file's AST.\n4. Extracts JSDoc metadata (`description`, `summary`, custom tags) from the story or component comment.\n5. Assembles everything into a manifest entry served through Storybook's `experimental_manifests` mechanism.\n\nWhen a component can't be resolved or isn't found in the Compodoc output, the entry still appears in the manifest with an `error` field explaining why (e.g. missing `meta.component`, or the class not covered by your `tsconfig.json`).\n\n### Example output\n\nGiven this component and story:\n\n```ts\n@Component({\n  selector: 'app-button',\n  standalone: true,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  template: '\u003cbutton [disabled]=\"disabled\"\u003e{{ label }}\u003c/button\u003e',\n})\nexport class ButtonComponent {\n  /** Text displayed inside the button. */\n  @Input() label = 'Click me';\n  /** When true the button is non-interactive. */\n  @Input() disabled = false;\n  /** Emitted when the user clicks the button. */\n  @Output() clicked = new EventEmitter\u003cvoid\u003e();\n}\n```\n\n```ts\nexport const Primary: StoryObj\u003cButtonComponent\u003e = {\n  args: { label: 'Click me', disabled: false },\n};\n```\n\nthe addon generates a manifest entry like this (real output, generated by building this repo's own test Storybook against the snippet above):\n\n```json\n{\n  \"id\": \"components-button\",\n  \"name\": \"ButtonComponent\",\n  \"path\": \"./src/button/button.stories.ts\",\n  \"stories\": [\n    {\n      \"id\": \"components-button--primary\",\n      \"name\": \"Primary\",\n      \"snippet\": \"\u003capp-button label=\\\"Click me\\\" [disabled]=\\\"false\\\"\u003e\u003c/app-button\u003e\"\n    }\n  ],\n  \"import\": \"import { ButtonComponent } from \\\"@my-org/my-lib\\\";\",\n  \"jsDocTags\": {},\n  \"description\": \"Primary UI component for user interaction.\",\n  \"compodoc\": {\n    \"name\": \"ButtonComponent\",\n    \"type\": \"component\",\n    \"selector\": \"app-button\",\n    \"standalone\": true,\n    \"changeDetection\": \"ChangeDetectionStrategy.OnPush\",\n    \"inputs\": [\n      { \"name\": \"label\", \"type\": \"string\", \"optional\": true, \"defaultValue\": \"'Click me'\", \"description\": \"Text displayed inside the button.\" },\n      { \"name\": \"disabled\", \"type\": \"boolean\", \"optional\": true, \"defaultValue\": \"false\", \"description\": \"When true the button is non-interactive.\" }\n    ],\n    \"outputs\": [\n      { \"name\": \"clicked\", \"type\": \"EventEmitter\u003cvoid\u003e\", \"description\": \"Emitted when the user clicks the button.\" }\n    ],\n    \"description\": \"Primary UI component for user interaction.\"\n  },\n  \"standalone\": true,\n  \"changeDetection\": \"ChangeDetectionStrategy.OnPush\",\n  \"selector\": \"app-button\"\n}\n```\n\n### Opting out of generated snippets\n\nIf a story already has the exact template you want exposed, tag it with `@useTemplate` and the addon will use that instead of generating one from the selector. It prefers `parameters.docs.source.code` — the same code Storybook's Docs \"Show code\" panel displays — and falls back to the story's `render` template when `docs.source.code` isn't set:\n\n```ts\n/**\n * Uses the Docs \"Show code\" template instead of the Compodoc snippet.\n * @useTemplate\n */\nexport const CustomTemplate: StoryObj\u003cButtonComponent\u003e = {\n  render: (_args) =\u003e ({\n    template: `\u003capp-button label=\"custom template\"\u003e\u003c/app-button\u003e`,\n  }),\n  parameters: {\n    docs: {\n      source: {\n        code: `\u003capp-button label=\"custom template\"\u003e\u003c/app-button\u003e`,\n      },\n    },\n  },\n};\n```\n\n## API\n\nThe package also exposes its manifest type for consumers building on top of it:\n\n```ts\nimport type { AngularComponentManifest } from '@anrouxel/storybook-addon-angular-manifest';\n```\n\n## Troubleshooting\n\n**\"No Compodoc documentation.json found\"** — enable `compodoc: true` in your `angular.json` build options, or run `npx compodoc -p tsconfig.json` before starting Storybook.\n\n**\"We could not detect the component from your story file\"** — make sure your story's default export sets `component` (e.g. `meta.component = ButtonComponent`).\n\n**\"\\\u003cComponent\\\u003e was not found in the Compodoc documentation\"** — check that the component's source file is included in the `tsconfig.json` used to generate Compodoc's documentation.\n\n## Contributing\n\n```bash\npnpm install\npnpm build       # build the addon\npnpm test        # run the test suite\npnpm check       # lint with Biome\n```\n\n## License\n\n[MIT](./LICENSE.md) © [Antonin Rouxel](https://github.com/anrouxel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanrouxel%2Fstorybook-addon-angular-manifest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanrouxel%2Fstorybook-addon-angular-manifest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanrouxel%2Fstorybook-addon-angular-manifest/lists"}