sdx-cli 0.3.0 → 0.3.1
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.
- package/README.md +69 -2
- package/dist/commands/docs/readme.js +62 -0
- package/dist/lib/readme.js +1265 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
<a href="#install-from-npm">Install from npm</a> •
|
|
21
21
|
<a href="#one-command-setup">One-Command Setup</a> •
|
|
22
22
|
<a href="#architecture-pack-org--service-deep-dives">Architecture Pack</a> •
|
|
23
|
+
<a href="#canonical-root-readme-generation">Canonical README</a> •
|
|
23
24
|
<a href="#daily-workflow">Daily Workflow</a> •
|
|
24
25
|
<a href="#for-codex-agents">For Codex Agents</a> •
|
|
25
26
|
<a href="#release-process">Release Process</a>
|
|
@@ -133,6 +134,7 @@ From your SDX workspace root:
|
|
|
133
134
|
./scripts/sdx contracts extract --map platform-core
|
|
134
135
|
./scripts/sdx docs generate --map platform-core
|
|
135
136
|
./scripts/sdx architecture generate --map platform-core
|
|
137
|
+
./scripts/sdx docs readme --map platform-core
|
|
136
138
|
```
|
|
137
139
|
|
|
138
140
|
For planning and rollout:
|
|
@@ -175,6 +177,70 @@ Use overrides to:
|
|
|
175
177
|
- suppress incorrect inferred edges,
|
|
176
178
|
- attach service owner/criticality/business context metadata.
|
|
177
179
|
|
|
180
|
+
### Canonical Root README Generation
|
|
181
|
+
Generate a complete root `README.md` as the canonical onboarding and architecture overview for your org workspace.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# generate/update root README.md
|
|
185
|
+
./scripts/sdx docs readme --map platform-core
|
|
186
|
+
|
|
187
|
+
# write to a different output file
|
|
188
|
+
./scripts/sdx docs readme --map platform-core --output ARCHITECTURE.md
|
|
189
|
+
|
|
190
|
+
# check mode for CI (non-zero on stale sources, missing sources, or README drift)
|
|
191
|
+
./scripts/sdx docs readme --map platform-core --check
|
|
192
|
+
|
|
193
|
+
# dry-run preview with unified diff and freshness summary
|
|
194
|
+
./scripts/sdx docs readme --map platform-core --dry-run
|
|
195
|
+
|
|
196
|
+
# selective sections
|
|
197
|
+
./scripts/sdx docs readme --map platform-core \
|
|
198
|
+
--include what_is_this_system,architecture_glance,service_catalog \
|
|
199
|
+
--exclude glossary
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Supported section IDs (baseline order):
|
|
203
|
+
- `what_is_this_system`
|
|
204
|
+
- `architecture_glance`
|
|
205
|
+
- `service_catalog`
|
|
206
|
+
- `critical_flows`
|
|
207
|
+
- `event_async_topology`
|
|
208
|
+
- `contracts_index`
|
|
209
|
+
- `repository_index`
|
|
210
|
+
- `environments_deployment`
|
|
211
|
+
- `data_stores_boundaries`
|
|
212
|
+
- `security_compliance`
|
|
213
|
+
- `local_dev_contribution`
|
|
214
|
+
- `runbooks_escalation`
|
|
215
|
+
- `adr_index`
|
|
216
|
+
- `glossary`
|
|
217
|
+
- `changelog_metadata`
|
|
218
|
+
|
|
219
|
+
README config file support (first existing file wins):
|
|
220
|
+
- `.sdx/readme.config.json`
|
|
221
|
+
- `.sdx/readme.config.yaml`
|
|
222
|
+
- `.sdx/readme.config.yml`
|
|
223
|
+
|
|
224
|
+
Config capabilities:
|
|
225
|
+
- section toggles (`sections.include`, `sections.exclude`, `sections.enabled`)
|
|
226
|
+
- repo include/exclude filters (`repos.include`, `repos.exclude`)
|
|
227
|
+
- domain grouping (`domainGroups`)
|
|
228
|
+
- owner/team overrides (`ownerTeamOverrides`)
|
|
229
|
+
- diagram behavior (`diagram.autoGenerateMissing`, `diagram.includeC4Links`)
|
|
230
|
+
- custom intro text (`customIntro`)
|
|
231
|
+
- stale threshold override in hours (`staleThresholdHours`, default `72`)
|
|
232
|
+
|
|
233
|
+
Manual content preservation:
|
|
234
|
+
- generated wrappers: `<!-- SDX:SECTION:<id>:START --> ... <!-- SDX:SECTION:<id>:END -->`
|
|
235
|
+
- preserved manual blocks: `<!-- SDX:SECTION:<id>:MANUAL:START --> ... <!-- SDX:SECTION:<id>:MANUAL:END -->`
|
|
236
|
+
|
|
237
|
+
CI automation example:
|
|
238
|
+
- copy [`docs/examples/readme-refresh.yml`](./docs/examples/readme-refresh.yml) into your consumer workspace repo under `.github/workflows/`.
|
|
239
|
+
- set repo/org variables:
|
|
240
|
+
- `SDX_ORG` (required)
|
|
241
|
+
- `SDX_MAP` (optional, defaults to `all-services` in the workflow)
|
|
242
|
+
- the workflow runs `repo sync`, `map build`, `contracts extract`, `docs generate`, and `docs readme`, then opens a PR.
|
|
243
|
+
|
|
178
244
|
## Cross-Repo Tech-Lead PRs (Spec-System Native)
|
|
179
245
|
Use this flow when SDX should create real `CC-*` contract-change PRs in downstream repos that have spec-system initialized.
|
|
180
246
|
|
|
@@ -233,7 +299,8 @@ Use this minimal runbook when an agent needs architecture context quickly:
|
|
|
233
299
|
3. `./scripts/sdx map build <map-id>`
|
|
234
300
|
4. `./scripts/sdx contracts extract --map <map-id>`
|
|
235
301
|
5. `./scripts/sdx architecture generate --map <map-id>`
|
|
236
|
-
6. `./scripts/sdx
|
|
302
|
+
6. `./scripts/sdx docs readme --map <map-id>`
|
|
303
|
+
7. `./scripts/sdx codex run <task-type> --map <map-id> --input <file>`
|
|
237
304
|
|
|
238
305
|
Where outputs land:
|
|
239
306
|
- `maps/<map-id>/service-map.json|md|mmd`
|
|
@@ -260,7 +327,7 @@ sdx prompt
|
|
|
260
327
|
|
|
261
328
|
sdx architecture generate|validate
|
|
262
329
|
sdx contracts extract
|
|
263
|
-
sdx docs generate
|
|
330
|
+
sdx docs generate|readme
|
|
264
331
|
sdx plan review
|
|
265
332
|
sdx service propose
|
|
266
333
|
sdx handoff draft
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const readme_1 = require("../../lib/readme");
|
|
5
|
+
const project_1 = require("../../lib/project");
|
|
6
|
+
class DocsReadmeCommand extends core_1.Command {
|
|
7
|
+
static description = 'Generate or validate the canonical root README from SDX artifacts';
|
|
8
|
+
static flags = {
|
|
9
|
+
map: core_1.Flags.string({ required: true, description: 'Map identifier' }),
|
|
10
|
+
output: core_1.Flags.string({ required: false, default: 'README.md', description: 'README output path' }),
|
|
11
|
+
check: core_1.Flags.boolean({ required: false, default: false, description: 'Check mode (no writes, non-zero on stale/missing/diff)' }),
|
|
12
|
+
'dry-run': core_1.Flags.boolean({ required: false, default: false, description: 'Preview mode (no writes, print unified diff + summary)' }),
|
|
13
|
+
include: core_1.Flags.string({
|
|
14
|
+
required: false,
|
|
15
|
+
description: 'Comma-separated section IDs to include (baseline order preserved)',
|
|
16
|
+
}),
|
|
17
|
+
exclude: core_1.Flags.string({
|
|
18
|
+
required: false,
|
|
19
|
+
description: 'Comma-separated section IDs to exclude (applied after include; exclude wins)',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(DocsReadmeCommand);
|
|
24
|
+
const context = (0, project_1.loadProject)(process.cwd());
|
|
25
|
+
const includeSections = (0, readme_1.parseReadmeSectionList)(flags.include);
|
|
26
|
+
const excludeSections = (0, readme_1.parseReadmeSectionList)(flags.exclude);
|
|
27
|
+
const result = (0, readme_1.generateReadme)({
|
|
28
|
+
mapId: flags.map,
|
|
29
|
+
db: context.db,
|
|
30
|
+
cwd: context.cwd,
|
|
31
|
+
output: flags.output,
|
|
32
|
+
includeSections,
|
|
33
|
+
excludeSections,
|
|
34
|
+
check: flags.check,
|
|
35
|
+
dryRun: flags['dry-run'],
|
|
36
|
+
});
|
|
37
|
+
const status = result.checkPassed ? 'ok' : 'error';
|
|
38
|
+
(0, project_1.recordRun)(context.db, 'docs_readme', status, flags.map, {
|
|
39
|
+
outputPath: result.outputPath,
|
|
40
|
+
sections: result.sections,
|
|
41
|
+
changed: result.changed,
|
|
42
|
+
stale: result.stale,
|
|
43
|
+
staleSources: result.staleSources.map((source) => source.label),
|
|
44
|
+
missingSources: result.missingSources.map((source) => source.label),
|
|
45
|
+
dryRun: flags['dry-run'],
|
|
46
|
+
check: flags.check,
|
|
47
|
+
});
|
|
48
|
+
context.db.close();
|
|
49
|
+
this.log(result.summary);
|
|
50
|
+
if (result.diff && result.diff.trim().length > 0) {
|
|
51
|
+
this.log('');
|
|
52
|
+
this.log(result.diff.trimEnd());
|
|
53
|
+
}
|
|
54
|
+
if (flags.check && !result.checkPassed) {
|
|
55
|
+
this.error('README check failed: stale/missing sources or content drift detected.', { exit: 1 });
|
|
56
|
+
}
|
|
57
|
+
if (!flags.check && !flags['dry-run']) {
|
|
58
|
+
this.log(`Wrote README: ${result.outputPath}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = DocsReadmeCommand;
|