You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update README, example config, CONTRIBUTING and improve test coverage (#152)
Rewrite README with all current features (YAML/API modes, templates, dry-run, etc.),
update example config with comprehensive options, fix CONTRIBUTING.md clone URL and
add dev commands, add 12 new tests for security/debug/error paths, and remove Phase
comments from source and test files.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@@ -26,10 +26,17 @@ We welcome contributions to this project.
26
26
27
27
## Developing
28
28
29
-
It uses [vitest](https://vitest.dev/) for testing.
29
+
It uses [vitest](https://vitest.dev/) for testing, [eslint](https://eslint.org/) for linting, and [prettier](https://prettier.io/) for formatting.
30
30
31
31
```sh
32
-
pnpm test
32
+
pnpm run test# run tests in watch mode
33
+
pnpm run test -- run # single test run (no watch)
34
+
pnpm run test:coverage # run tests with coverage report
35
+
pnpm run lint # check for lint errors
36
+
pnpm run lint:fix # auto-fix lint errors
37
+
pnpm run format:diff # check formatting
38
+
pnpm run format # auto-format files
39
+
pnpm run build # build with tsup (CJS + ESM + .d.ts)
33
40
```
34
41
35
42
You can link the project to your EventCatalog to test your generator.
@@ -44,7 +51,7 @@ After linking, then you can navigate to your EventCatalog directory and link bac
44
51
npm link @ismaelmartinez/generator-atlassian-compass-event-catalog
45
52
```
46
53
47
-
Then, in the this generator project, you can run the build command to build the project.
54
+
Then, in this generator project, you can run the build command to build the project.
48
55
49
56
```sh
50
57
pnpm run build
@@ -56,8 +63,6 @@ Finally, you can run the generate command in your EventCatalog project as you wi
56
63
npm run generate
57
64
```
58
65
59
-
You should be ready to start developing with the generator. Open and[issue](https://github.com/IsmaelMartinez/generator-atlassian-compass-event-catalog/issues) if you find any problems.
66
+
You should be ready to start developing with the generator. Open an[issue](https://github.com/IsmaelMartinez/generator-atlassian-compass-event-catalog/issues) if you find any problems.
60
67
61
-
EventCatalog uses [EventCatalog SDK](https://www.eventcatalog.dev/docs/sdk) to interact with the Catalog.
62
-
63
-
You can also explore the [get started building compass apps](https://developer.atlassian.com/cloud/compass/integrations/get-started-integrating-with-Compass/#get-started-building-compass-apps) to learn more about the Compass API. I haven't explore it yet.
68
+
EventCatalog uses the [EventCatalog SDK](https://www.eventcatalog.dev/docs/sdk) to interact with the Catalog. The generator also integrates with the [Compass GraphQL API](https://developer.atlassian.com/cloud/compass/integrations/get-started-integrating-with-Compass/) for API mode, fetching components, teams, and metadata directly from Compass.
This generator can be used to create services in Event Catalog from an [Atlassian Compass file].
3
+
An [EventCatalog](https://eventcatalog.dev/) generator plugin that creates services from [Atlassian Compass](https://developer.atlassian.com/cloud/compass/config-as-code/structure-and-contents-of-a-compass-yml-file/) components. It supports two modes: reading local `compass.yml` files (YAML mode) or fetching components directly from the Compass GraphQL API (API mode).
Add the generator to your `eventcatalog.config.js`. The plugin supports two mutually exclusive modes: YAML mode (local files) and API mode (Compass GraphQL API).
|`services`|`ServiceOptions[]`| - | YAML mode: array of local compass file paths |
66
+
|`api`|`ApiConfig`| - | API mode: Compass GraphQL API connection config |
67
+
|`compassUrl`|`string`| (required) | Base URL for Compass component links |
68
+
|`domain`|`{ id, name, version }`| - | Associate all services with a domain (created if it doesn't exist) |
69
+
|`typeFilter`|`string[]`| - | Only process components matching these type IDs |
70
+
|`overrideExisting`|`boolean`|`true`| Whether to update existing services or skip them |
71
+
|`debug`|`boolean`|`false`| Enable debug logging (credentials are redacted) |
72
+
|`format`|`'md' \| 'mdx'`|`'mdx'`| Output file format |
73
+
|`serviceIdStrategy`|`'name' \| 'compass-id' \| Function`|`'name'`| How service IDs are derived |
74
+
|`markdownTemplate`|`Function`| - | Custom function to generate service markdown content |
75
+
|`dryRun`|`boolean`|`false`| Log what would happen without writing any changes |
76
+
77
+
See the [example configuration](examples/eventcatalog.config.js) for a complete working setup.
4
78
5
-
#Getting started
79
+
## Features
6
80
7
-
##Installation and configuration
81
+
### Component type support
8
82
9
-
_Make sure you are on the latest version of EventCatalog_.
83
+
All Compass component types are supported: SERVICE, APPLICATION, LIBRARY, CAPABILITY, CLOUD_RESOURCE, DATA_PIPELINE, MACHINE_LEARNING_MODEL, UI_ELEMENT, WEBSITE, and OTHER. Each component is written as an EventCatalog service entry. Use `typeFilter` to restrict which types are processed.
`DEPENDS_ON` relationships defined in Compass are resolved to links between EventCatalog services. Dependencies are resolved across all services processed in the same generator run, and unresolvable ARNs are logged and skipped gracefully.
16
88
17
-
1. Configure your EventCatalog to use your generator
89
+
### Badge generation
18
90
19
-
Edit your `eventcatalog.config.js` file and add the generator
91
+
Services receive color-coded badges based on their Compass metadata: component type (e.g. SERVICE, APPLICATION), lifecycle stage (Active, Pre-release, Deprecated), tier level (1-4), labels, and scorecard scores (green/amber/red based on percentage). Scorecard badges show the score name and percentage.
When a component has an `ownerId`, the generator extracts the team UUID and creates an EventCatalog team entity. In API mode, the team's display name is fetched from Compass; in YAML mode the UUID is used as the name. Teams are deduplicated across services.
46
96
47
-
NOTE: If a domain is provided, the services will be added to it. If the domain does not exist, it will be created.
97
+
### OpenAPI and AsyncAPI spec detection
48
98
49
-
1. Generate your services
99
+
Links with names containing "openapi" or "swagger" are attached as OpenAPI specifications, and links with "asyncapi" are attached as AsyncAPI specifications. This allows EventCatalog to render API documentation alongside service pages.
50
100
51
-
On your EventCatalog project, run the generate command:
101
+
### Custom markdown templates
52
102
53
-
```sh
54
-
npm run generate
55
-
```
103
+
Provide a `markdownTemplate` function to fully control the markdown content generated for each service. The function receives the `CompassConfig` and resolved dependencies array:
Control how service IDs are derived with `serviceIdStrategy`:
114
+
115
+
-`'name'` (default): uses the component name from Compass
116
+
-`'compass-id'`: uses the Compass ARN (sanitized for filesystem safety)
117
+
- Custom function: `(config) => string` for full control
118
+
119
+
File-level `id` overrides in YAML mode always take precedence over the strategy.
120
+
121
+
### Dry-run mode
122
+
123
+
Set `dryRun: true` to see what the generator would do without writing any files. Services, teams, and domain associations are all logged but not persisted.
64
124
65
-
Currently, the generator only supports generating services from an [Atlassian Compass file].
125
+
### Error resilience
66
126
67
-
By design, the links with name 'null' are ignored. This is to allow having the links to EventCatalog in the Compass file without having to worry to show the link in the EventCatalog Service page.
127
+
The generator continues processing when individual services fail (e.g. malformed YAML, missing files). A summary at the end reports succeeded and failed counts with error details.
128
+
129
+
### Domain support
130
+
131
+
When a `domain` option is provided, all generated services are associated with that domain. The domain is created automatically if it doesn't exist, and versioned if the version changes between runs.
132
+
133
+
## Security
134
+
135
+
All user-controlled text is sanitized before embedding in markdown/MDX output. `sanitizeMarkdownText` escapes HTML special characters and markdown link syntax. `sanitizeUrl` only allows `http:` and `https:` protocols, preventing `javascript:` and `data:` URI injection. Service IDs are sanitized to prevent path traversal. In API mode, the `baseUrl` is validated to require HTTPS, and debug logging redacts API tokens and email addresses.
68
136
69
137
## Found a problem?
70
138
@@ -77,5 +145,3 @@ See [LICENSE](LICENSE).
77
145
## Contributing
78
146
79
147
See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.
0 commit comments