@chappibunny/repolens 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,265 @@
1
+ # RepoLens v1.0 Stability Contract
2
+
3
+ This document defines the **public API surface** of RepoLens v1.0. All interfaces described here are considered stable and will not change in backwards-incompatible ways until v2.0.
4
+
5
+ ## Semantic Versioning
6
+
7
+ RepoLens follows semantic versioning (semver):
8
+
9
+ - **MAJOR** (2.0, 3.0, ...): Breaking changes to CLI, config schema, or plugin interface
10
+ - **MINOR** (1.1, 1.2, ...): New features, new commands, new config fields (backwards-compatible)
11
+ - **PATCH** (1.0.1, 1.0.2, ...): Bug fixes, documentation, performance improvements
12
+
13
+ ## CLI Interface
14
+
15
+ ### Commands
16
+
17
+ | Command | Status | Description |
18
+ |---------|--------|-------------|
19
+ | `init` | Stable | Scaffold configuration and GitHub Actions workflow |
20
+ | `init --interactive` | Stable | Step-by-step configuration wizard |
21
+ | `doctor` | Stable | Validate repository setup |
22
+ | `publish` | Stable | Scan, generate, and publish documentation |
23
+ | `demo` | Stable | Generate local docs without API keys (quick preview) |
24
+ | `watch` | Stable | Watch for file changes and regenerate docs |
25
+ | `migrate` | Stable | Migrate legacy workflows to current format |
26
+ | `feedback` | Stable | Send feedback to the RepoLens team |
27
+ | `version` | Stable | Display version |
28
+ | `help` | Stable | Show usage information |
29
+
30
+ ### Global Options
31
+
32
+ | Option | Short | Status | Description |
33
+ |--------|-------|--------|-------------|
34
+ | `--config <path>` | — | Stable | Path to `.repolens.yml` |
35
+ | `--target <path>` | — | Stable | Target repository path (init, doctor, migrate) |
36
+ | `--interactive` | — | Stable | Interactive mode for init |
37
+ | `--dry-run` | — | Stable | Preview changes without applying (migrate) |
38
+ | `--force` | — | Stable | Skip confirmation prompts (migrate) |
39
+ | `--verbose` | — | Stable | Enable verbose logging |
40
+ | `--version` | `-v` | Stable | Print version |
41
+ | `--help` | `-h` | Stable | Show help |
42
+
43
+ ### Exit Codes
44
+
45
+ | Code | Meaning |
46
+ |------|---------|
47
+ | `0` | Success |
48
+ | `1` | Runtime error (scan failure, publish failure, etc.) |
49
+ | `2` | Validation error (invalid config, missing files, etc.) |
50
+
51
+ Unknown commands produce exit code `1`. Unknown flags produce exit code `1`.
52
+
53
+ ## Configuration Schema
54
+
55
+ ### Schema Version
56
+
57
+ The config schema is locked at **version 1** (`configVersion: 1`). This field is **required**.
58
+
59
+ Future schema changes:
60
+ - **Additive** (new optional fields): Minor version bump, no `configVersion` change
61
+ - **Breaking** (field rename, type change, removal): Major version bump, `configVersion` increment
62
+
63
+ ### Required Fields
64
+
65
+ ```yaml
66
+ configVersion: 1 # number, must be 1
67
+
68
+ project:
69
+ name: "My Project" # string, required
70
+
71
+ publishers: # string[], required, non-empty
72
+ - markdown
73
+
74
+ scan:
75
+ include: # string[], required, non-empty
76
+ - "src/**/*.{js,ts}"
77
+ ignore: # string[], required
78
+ - "node_modules"
79
+
80
+ outputs:
81
+ pages: # object[], required, non-empty
82
+ - key: system_overview # must be a supported page key
83
+ title: "System Overview"
84
+ ```
85
+
86
+ ### Optional Fields
87
+
88
+ | Field | Type | Description |
89
+ |-------|------|-------------|
90
+ | `project.docs_title_prefix` | string | Prefix for document titles |
91
+ | `plugins` | string[] | Plugin paths or package names |
92
+ | `module_roots` | string[] | Module root directories |
93
+ | `notion` | object | Notion publisher configuration |
94
+ | `notion.branches` | string[] | Branch filter for Notion publishing |
95
+ | `notion.includeBranchInTitle` | boolean | Include branch name in page titles |
96
+ | `confluence` | object | Confluence publisher configuration |
97
+ | `confluence.branches` | string[] | Branch filter for Confluence publishing |
98
+ | `github_wiki` | object | GitHub Wiki publisher configuration |
99
+ | `github_wiki.branches` | string[] | Branch filter for GitHub Wiki publishing |
100
+ | `github_wiki.sidebar` | boolean | Generate `_Sidebar.md` (default: `true`) |
101
+ | `github_wiki.footer` | boolean | Generate `_Footer.md` (default: `true`) |
102
+ | `discord` | object | Discord notification configuration |
103
+ | `discord.enabled` | boolean | Enable/disable Discord notifications |
104
+ | `discord.notifyOn` | string | `"always"`, `"significant"`, or `"never"` |
105
+ | `discord.significantThreshold` | number | 0–100, coverage threshold |
106
+ | `discord.branches` | string[] | Branch filter for Discord |
107
+ | `features` | object | Feature flags (boolean values) |
108
+ | `ai` | object | AI configuration |
109
+ | `ai.enabled` | boolean | Enable AI-powered documentation |
110
+ | `ai.mode` | string | `"hybrid"`, `"full"`, or `"off"` |
111
+ | `ai.temperature` | number | 0–2, generation temperature (model-dependent; gpt-5-mini ignores it) |
112
+ | `ai.max_tokens` | number | >0, max completion tokens per request |
113
+ | `documentation` | object | Documentation output settings |
114
+ | `documentation.output_dir` | string | Output directory (default: `.repolens`) |
115
+ | `documentation.include_artifacts` | boolean | Include AI context artifacts |
116
+ | `documentation.sections` | string[] | Section filter |
117
+ | `domains` | object | Business domain mapping |
118
+
119
+ ### Supported Page Keys
120
+
121
+ ```
122
+ system_overview, module_catalog, api_surface, arch_diff,
123
+ route_map, system_map, executive_summary, business_domains,
124
+ architecture_overview, data_flows, change_impact, developer_onboarding
125
+ ```
126
+
127
+ ### Domains Format
128
+
129
+ ```yaml
130
+ domains:
131
+ authentication:
132
+ match: ["auth", "login", "session"]
133
+ description: "User authentication and authorization"
134
+ payments:
135
+ match: ["payment", "billing", "stripe"]
136
+ description: "Payment processing"
137
+ ```
138
+
139
+ ## Plugin Interface
140
+
141
+ ### Contract
142
+
143
+ Plugins are ES modules that export a `register()` function:
144
+
145
+ ```javascript
146
+ export function register() {
147
+ return {
148
+ name: "my-plugin", // string, REQUIRED
149
+ version: "1.0.0", // string, optional (defaults to "0.0.0")
150
+ renderers: { ... }, // optional
151
+ publishers: { ... }, // optional
152
+ hooks: { ... }, // optional
153
+ };
154
+ }
155
+ ```
156
+
157
+ ### Renderers
158
+
159
+ ```javascript
160
+ renderers: {
161
+ my_document: {
162
+ render(context) { return "# Markdown content"; }, // REQUIRED
163
+ title: "My Document", // REQUIRED
164
+ }
165
+ }
166
+ ```
167
+
168
+ The `context` object contains: `scanResult`, `config`, `aiContext`, `moduleContext`, `flows`, `diffData`, `graphqlResult`, `tsResult`, `depGraph`, `driftResult`.
169
+
170
+ ### Publishers
171
+
172
+ ```javascript
173
+ publishers: {
174
+ my_target: {
175
+ publish(cfg, renderedPages) { /* ... */ }, // REQUIRED
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Hooks
181
+
182
+ ```javascript
183
+ hooks: {
184
+ afterScan(scanResult) { return modifiedScanResult; },
185
+ afterRender(documents) { return modifiedDocuments; },
186
+ afterPublish(result) { return modifiedResult; },
187
+ }
188
+ ```
189
+
190
+ **Hook behavior:**
191
+ - Hooks run **serially** in plugin load order
192
+ - If a hook returns a non-null/non-undefined value, it replaces the input for subsequent hooks
193
+ - If a hook returns `null` or `undefined`, the original value is preserved (no change)
194
+ - Hook errors are caught and logged — they do not crash the pipeline
195
+ - Renderer and publisher errors are caught and logged — they do not crash the pipeline
196
+
197
+ ### Failure Modes
198
+
199
+ | Scenario | Behavior |
200
+ |----------|----------|
201
+ | Plugin module not found | Warning logged, plugin skipped |
202
+ | No `register()` export | Warning logged, plugin skipped |
203
+ | Invalid descriptor | Warning logged, plugin skipped |
204
+ | `register()` throws | Warning logged, plugin skipped |
205
+ | Hook throws | Warning logged, continues to next hook |
206
+ | Renderer throws | Warning logged, document skipped |
207
+ | Publisher throws | Warning logged, publish continues |
208
+
209
+ ### Guaranteed Stability
210
+
211
+ - The `register()` return shape will not change in v1.x
212
+ - The `context` object passed to renderers will only gain new fields (never remove)
213
+ - Hook names (`afterScan`, `afterRender`, `afterPublish`) are frozen
214
+ - Plugin loading behavior (graceful skip on failure) is frozen
215
+
216
+ ## Environment Variables
217
+
218
+ ### Publishing
219
+
220
+ | Variable | Required For |
221
+ |----------|-------------|
222
+ | `NOTION_TOKEN` | Notion publishing |
223
+ | `NOTION_PARENT_PAGE_ID` | Notion publishing |
224
+ | `CONFLUENCE_URL` | Confluence publishing |
225
+ | `CONFLUENCE_EMAIL` | Confluence publishing |
226
+ | `CONFLUENCE_API_TOKEN` | Confluence publishing |
227
+ | `CONFLUENCE_SPACE_KEY` | Confluence publishing |
228
+ | `CONFLUENCE_PARENT_PAGE_ID` | Confluence publishing |
229
+ | `DISCORD_WEBHOOK_URL` | Discord notifications |
230
+
231
+ ### AI
232
+
233
+ | Variable | Description |
234
+ |----------|-------------|
235
+ | `REPOLENS_AI_ENABLED` | `"true"` to enable AI features |
236
+ | `REPOLENS_AI_API_KEY` | API key for AI provider |
237
+ | `REPOLENS_AI_BASE_URL` | API base URL |
238
+ | `REPOLENS_AI_MODEL` | Model name |
239
+ | `REPOLENS_AI_PROVIDER` | Provider type |
240
+ | `REPOLENS_AI_TIMEOUT_MS` | Request timeout |
241
+
242
+ AI settings can also be set in `.repolens.yml` under `ai.*`. Environment variables take precedence over config file values.
243
+
244
+ ### Telemetry
245
+
246
+ | Variable | Description |
247
+ |----------|-------------|
248
+ | `REPOLENS_TELEMETRY_ENABLED` | `"true"` to enable error tracking |
249
+ | `REPOLENS_SENTRY_DSN` | Custom Sentry DSN (optional) |
250
+ | `VERBOSE` | Enable verbose output (same as `--verbose` flag) |
251
+
252
+ ## Output Guarantees
253
+
254
+ ### Documentation Files
255
+
256
+ - `publish` always generates Markdown files in the output directory (default: `.repolens/`)
257
+ - Each enabled page key produces one `.md` file
258
+ - File format is standard Markdown with tables, headers, and code blocks
259
+ - Artifacts (if enabled) are written to `.repolens/artifacts/`
260
+
261
+ ### Backwards Compatibility
262
+
263
+ - New page keys may be added in minor versions
264
+ - Existing page keys will not be removed or renamed in v1.x
265
+ - Document content format may improve (better formatting, more detail) but structural changes (heading hierarchy, section names) are stable
@@ -0,0 +1,166 @@
1
+ # Telemetry & Observability
2
+
3
+ RepoLens includes **opt-in** error tracking and usage telemetry to help improve the tool and understand how teams use it.
4
+
5
+ ## What We Collect (When Enabled)
6
+
7
+ ### 1. Error Information (Phase 1)
8
+
9
+ **Error tracking:**
10
+ - Error messages and stack traces
11
+ - Command that failed (e.g., `publish`, `migrate`)
12
+ - RepoLens version
13
+ - Node.js version and platform (e.g., `darwin`, `linux`)
14
+
15
+ ### 2. Usage Metrics (Phase 2)
16
+
17
+ **Performance metrics:**
18
+ - Command execution times (scan, render, publish)
19
+ - Repository size (file count, module count)
20
+ - Document generation count
21
+
22
+ **Feature usage:**
23
+ - Commands run (init, doctor, migrate, publish)
24
+ - Publishers used (Notion, Markdown, Confluence)
25
+ - AI usage (enabled/disabled, provider)
26
+ - Success/failure rates
27
+
28
+ **Aggregate statistics:**
29
+ - Platform distribution (macOS, Linux, Windows)
30
+ - Node.js version distribution
31
+ - AI provider popularity
32
+
33
+ **What We DON'T Collect:**
34
+ - ❌ Your source code or file contents
35
+ - ❌ Notion tokens or API keys
36
+ - ❌ Personal information (usernames, emails, etc.)
37
+ - ❌ Repository names or paths (anonymized with hash)
38
+ - ❌ Environment variables
39
+ - ❌ HTTP headers or cookies
40
+ - ❌ File names or directory structures
41
+ - ❌ Notion page IDs or database IDs
42
+
43
+ ## Privacy Protections
44
+
45
+ 1. **Opt-in by default** - Telemetry is disabled unless you explicitly enable it
46
+ 2. **Anonymous** - No personally identifiable information is collected
47
+ 3. **Sanitized paths** - File paths are stripped to prevent leaking usernames
48
+ 4. **Sample rate** - Only 10% of errors are sent (reduces server load)
49
+ 5. **Local-first** - All failures are logged locally regardless of telemetry setting
50
+
51
+ ## How to Enable
52
+
53
+ Add to your `.env` file:
54
+
55
+ ```bash
56
+ REPOLENS_TELEMETRY_ENABLED=true
57
+ ```
58
+
59
+ Or set as an environment variable:
60
+
61
+ ```bash
62
+ export REPOLENS_TELEMETRY_ENABLED=true
63
+ ```
64
+
65
+ ## How to Disable
66
+
67
+ Telemetry is **disabled by default**. To explicitly disable:
68
+
69
+ ```bash
70
+ REPOLENS_TELEMETRY_ENABLED=false
71
+ ```
72
+
73
+ Or simply omit the variable entirely.
74
+
75
+ ## What Happens to Errors When Telemetry is Disabled?
76
+
77
+ When telemetry is disabled:
78
+ - Errors are logged to your console (as usual)
79
+ - Full stack traces available with `--verbose` flag
80
+ - No data sent to external services
81
+ - RepoLens continues to work normally
82
+
83
+ ## Why Enable Telemetry?
84
+
85
+ By enabling telemetry, you help us:
86
+
87
+ ### Error Tracking Benefits
88
+ - **Identify bugs faster** - See real-world issues before they're reported
89
+ - **Prioritize fixes** - Understand which errors affect the most users
90
+ - **Improve reliability** - Catch edge cases we missed in testing
91
+ - **Better support** - Diagnose issues without requiring detailed bug reports
92
+
93
+ ### Usage Tracking Benefits
94
+ - **Understand adoption patterns** - See which features teams actually use
95
+ - **Optimize performance** - Identify slow operations and bottlenecks
96
+ - **Guide roadmap** - Prioritize features that provide the most value
97
+ - **Improve documentation** - Focus on areas where users struggle
98
+ - **Platform support** - Know which platforms need the most attention
99
+
100
+ ### What This Means for You
101
+ - **Faster bug fixes** - Issues you encounter are fixed before you report them
102
+ - **Better features** - Development focused on real-world usage patterns
103
+ - **Improved performance** - Optimizations based on actual bottlenecks
104
+ - **Stronger ecosystem** - Data helps secure funding and maintainer time
105
+
106
+ ## Where Data is Sent
107
+
108
+ Errors and metrics are sent to [Sentry.io](https://sentry.io), a privacy-focused error tracking and performance monitoring service.
109
+
110
+ **Data retention:** 90 days
111
+ **Data location:** EU (Germany) - GDPR compliant
112
+ **Compliance:** GDPR, SOC 2 Type II, ISO 27001
113
+ **Encryption:** TLS 1.3 in transit, AES-256 at rest
114
+
115
+ ## Example Metrics Collected
116
+
117
+ Here are real examples of what we track (sanitized):
118
+
119
+ ### Error Event
120
+ ```json
121
+ {
122
+ "error": "ENOENT: no such file or directory",
123
+ "command": "publish",
124
+ "version": "1.5.0",
125
+ "platform": "darwin",
126
+ "nodeVersion": "v20.11.0"
127
+ }
128
+ ```
129
+
130
+ ### Usage Event
131
+ ```json
132
+ {
133
+ "command": "publish",
134
+ "status": "success",
135
+ "duration": 2341,
136
+ "fileCount": 234,
137
+ "moduleCount": 42,
138
+ "aiEnabled": true,
139
+ "aiProvider": "openai",
140
+ "publishers": ["notion", "markdown"],
141
+ "platform": "linux",
142
+ "nodeVersion": "v20.11.0"
143
+ }
144
+ ```
145
+
146
+ ### Performance Metric
147
+ ```json
148
+ {
149
+ "operation": "scan",
150
+ "duration": 1523,
151
+ "fileCount": 234
152
+ }
153
+ ```
154
+
155
+ **Note:** All events are anonymous. No repository names, file paths, or user identities are included.
156
+
157
+ ## Questions?
158
+
159
+ - Review our [Privacy Policy](https://github.com/CHAPIBUNNY/repolens#privacy)
160
+ - Open an [issue](https://github.com/CHAPIBUNNY/repolens/issues) with questions
161
+ - Email: trades@rabitaitrades.com
162
+
163
+ ---
164
+
165
+ **Last updated:** March 2026
166
+ **Applies to:** RepoLens v0.4.3+