bc-atlas 0.5.0

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,242 @@
1
+ # BC Atlas CLI reference
2
+
3
+ This document lists every command and command-line option exposed by
4
+ `bca`. Command-line values override values loaded from a configuration
5
+ file.
6
+
7
+ ## Command overview
8
+
9
+ ```text
10
+ bca [graph] [options] <file-or-directory>
11
+ bca inspect [options] <file-or-directory>
12
+ bca watch [options] <directory>
13
+ bca docs generate [options] <ui-test.al>
14
+ ```
15
+
16
+ | Command | Purpose |
17
+ | --- | --- |
18
+ | `graph` | Analyze AL source and write a diagram. This is the default command when no command is specified. |
19
+ | `inspect` | Analyze AL source and emit the selected graph as JSON. Without `--output`, JSON is written to standard output. |
20
+ | `watch` | Generate a graph, watch an AL project, and rebuild after relevant source or configuration changes. |
21
+ | `docs generate` | Generate Markdown documentation from one `[Test]` procedure in an AL UI-test file. |
22
+
23
+ Use `bca --help`, `bca --version`, or
24
+ `bca docs --help` for the built-in summaries.
25
+
26
+ ## Architecture commands
27
+
28
+ The `graph`, `inspect`, and `watch` commands share the following options.
29
+
30
+ | Option | Value | Description |
31
+ | --- | --- | --- |
32
+ | `-o`, `--output` | path | Output path. The graph default is `bc-atlas.d2`; `inspect` writes JSON to standard output when omitted. |
33
+ | `-f`, `--format` | format | `d2`, `json`, `svg`, `png`, or `pdf`. The output extension is used when the option is omitted. |
34
+ | `--view` | view | Selects `project`, `module`, `object`, `data`, `call`, `boundary`, `contracts`, `events`, `ui`, or `workflow`. Default: `project`. |
35
+ | `--object` | selector | Required by the `object` view. Accepts an object name, ID, key, or typed selector such as `codeunit:50100`. |
36
+ | `--scope` | selector | Boundary scope. Accepts `namespace:`, `folder:`, `app:`, or `object:` selectors. Repeatable. |
37
+ | `--focus` | text | Restricts the `contracts`, `events`, or `ui` view to matching names. |
38
+ | `--entry` | selector | Workflow entry procedure, trigger, action, or event publisher. Repeatable. |
39
+ | `--workflow-depth` | positive integer | Maximum workflow traversal depth. Default: `8`. |
40
+ | `--workflow-max-nodes` | positive integer | Maximum number of workflow nodes. Default: `100`. |
41
+ | `--workflow-edge-types` | comma-separated types | Workflow edge types: `calls`, `events`, `writes`, and/or `reads`. Default: `calls,events,writes`. |
42
+ | `--namespace` | glob | Includes matching namespaces. Repeatable. |
43
+ | `--type` | types | Includes object types. Comma-separated and repeatable. |
44
+ | `--include` | glob | Includes matching normalized file paths or object selectors. Repeatable. |
45
+ | `--exclude` | glob | Excludes matching normalized file paths or object selectors. Repeatable. |
46
+ | `--group-by` | mode | Groups by `namespace`, `folder`, `type`, or `role`. Project view defaults to `role`; other views default to `namespace`. |
47
+ | `--module-depth` | positive integer or `auto` | Namespace segments retained by the module view. Default: `auto`. |
48
+ | `--folder-depth` | positive integer | Folder segments retained by a folder-grouped module view. Default: `1`. |
49
+ | `--include-unresolved-calls` | flag | Includes unresolved calls and isolated procedures in the `call` view. |
50
+ | `--max-edges` | positive integer | Caps diagram edges. Default: `500`. For workflows this also caps projected workflow edges unless a nested workflow value is configured. |
51
+ | `--direction` | value | Diagram direction: `right`, `down`, `left`, or `up`. Default: `right`. |
52
+ | `--title` | text | Diagram title. |
53
+ | `--source-url` | template | Adds node links. Supports `{file}` and `{line}` placeholders. |
54
+ | `--details` | flag | Shows available member counts and focused-object member summaries. |
55
+ | `--no-external` | flag | Hides external and unresolved target nodes in rendered diagrams. Unresolved edges remain available in JSON. |
56
+ | `--config` | path | Explicit JSON configuration path. Without it, `<input-root>/.bca.json` is loaded when present. |
57
+ | `--strict` | flag | Fails when analysis contains warning or error diagnostics. |
58
+ | `--debounce` | positive integer | Watch rebuild debounce in milliseconds. Default: `250`. |
59
+ | `-h`, `--help` | flag | Shows command help. |
60
+ | `-V`, `--version` | flag | Shows the installed version. |
61
+
62
+ Options described as repeatable can be supplied more than once:
63
+
64
+ ```text
65
+ bca graph src \
66
+ --namespace "Contoso.Sales.**" \
67
+ --type table,codeunit \
68
+ --type page \
69
+ --exclude "**/test/**"
70
+ ```
71
+
72
+ ### Formats and output paths
73
+
74
+ - D2, JSON, and SVG output use bundled functionality.
75
+ - PNG and PDF require the `d2` executable on `PATH`.
76
+ - If `--format` conflicts with the requested extension, the format wins.
77
+ For example, `-o calls.d2 --format svg` writes `calls.svg` and keeps the
78
+ intermediate D2 source at `calls.d2`.
79
+ - Non-D2 rendering retains the generated `.d2` source next to the final output.
80
+
81
+ ## Views
82
+
83
+ | View | Contents | View-specific selection |
84
+ | --- | --- | --- |
85
+ | `project` | AL objects and resolved or unresolved architectural relations. | General filters and grouping options. |
86
+ | `module` | Aggregated namespace or folder dependencies. | `--group-by namespace\|folder`, `--module-depth`, and `--folder-depth`. |
87
+ | `object` | One object and its incoming and outgoing neighbors. | Requires `--object`. |
88
+ | `data` | Tables and table-oriented reads, writes, relations, and extensions. | General filters. |
89
+ | `call` | Procedures, triggers, resolved calls, and event subscriptions. | `--include-unresolved-calls`. |
90
+ | `boundary` | Dependencies crossing one or more selected boundaries. | Requires repeatable `--scope`. |
91
+ | `contracts` | Interfaces, direct implementations, and enum-mediated implementations. | Optional `--focus`. |
92
+ | `events` | Event publishers and subscriber procedures. | Optional `--focus`. |
93
+ | `ui` | Pages, source tables, parts, actions, and navigation targets. | Optional `--focus`. |
94
+ | `workflow` | Trace-oriented calls, events, data mutations, cycles, and unresolved branches. | `--entry` and workflow limits, or workflow configuration. |
95
+
96
+ ## Workflow selectors and configuration
97
+
98
+ Workflow entry, phase, stop, and collapse selectors accept:
99
+
100
+ - an exact member name such as `ProcessDocument`;
101
+ - an owner-qualified name such as `Posting.ProcessDocument`;
102
+ - `*` and `?` globs;
103
+ - an optional `procedure:`, `trigger:`, `action:`, or `event:` prefix.
104
+
105
+ With no explicit entries, workflow roots are inferred from actions, triggers,
106
+ event publishers, and procedures without inbound calls. Direct call and
107
+ mutation order is labelled `definite`. Event dispatch and paths created by
108
+ collapsing utility nodes are labelled `inferred`. Cycles, shared convergence
109
+ nodes, unresolved branches, and limit truncation are annotated in D2 and JSON.
110
+
111
+ The configuration file can define workflow behavior that has no dedicated CLI
112
+ switch:
113
+
114
+ ```json
115
+ {
116
+ "view": "workflow",
117
+ "workflow": {
118
+ "entries": ["ProcessDocument", "action:Release"],
119
+ "depth": 8,
120
+ "maxNodes": 100,
121
+ "maxEdges": 250,
122
+ "edgeTypes": ["calls", "events", "writes"],
123
+ "phases": {
124
+ "Validation": ["Validate*", "*.Check*"],
125
+ "Posting": ["Post*", "Finalize*"]
126
+ },
127
+ "stop": ["FinalizeDocument", "event:OnCompleted"],
128
+ "collapse": ["*Telemetry*", "*FeatureFlag*"]
129
+ }
130
+ }
131
+ ```
132
+
133
+ | Workflow property | Description |
134
+ | --- | --- |
135
+ | `entries` | Entry selectors. `entry` is also accepted for one or more selectors. |
136
+ | `depth` | Maximum traversal depth. |
137
+ | `maxNodes` | Maximum projected nodes. |
138
+ | `maxEdges` | Maximum projected edges. |
139
+ | `edgeTypes` | Allowed `calls`, `events`, `writes`, and `reads` edges. |
140
+ | `phases` | Maps phase labels to selectors. Matching nodes are grouped under that label. |
141
+ | `stop` | Selectors that remain visible but are not expanded. `stopConditions` is also accepted. |
142
+ | `collapse` | Utility selectors to remove and bypass with explicitly inferred edges. `collapseUtilities` is also accepted. |
143
+
144
+ Repeated infrastructure nodes are represented once. A node reached by multiple
145
+ branches is annotated with its inbound branch count.
146
+
147
+ ## Configuration file
148
+
149
+ Use `.bca.json` at the input root or pass another file explicitly:
150
+
151
+ ```text
152
+ bca graph src --config bca.workflow.json
153
+ ```
154
+
155
+ The configuration root accepts the long-form equivalents of the architecture
156
+ options, normally in camel case: `view`, `output`, `format`, `object`, `scope`,
157
+ `focus`, `namespaces`, `types`, `include`, `exclude`, `groupBy`,
158
+ `moduleDepth`, `folderDepth`, `includeUnresolvedCalls`, `maxEdges`,
159
+ `direction`, `title`, `sourceUrl`, `details`, `noExternal`, `strict`, and
160
+ `debounce`.
161
+
162
+ These renderer and policy settings are configuration-only:
163
+
164
+ | Property | Description |
165
+ | --- | --- |
166
+ | `layout` | D2 layout engine passed to the external renderer for PNG or PDF. |
167
+ | `theme` | D2 theme passed to the external renderer for PNG or PDF. |
168
+ | `forbiddenDependencies` | Dependency policy rules evaluated during analysis. |
169
+ | `workflow` | Nested workflow configuration described above. |
170
+
171
+ See [`.bca.example.json`](../.bca.example.json) for a complete
172
+ configuration example.
173
+
174
+ ## `graph`
175
+
176
+ ```text
177
+ bca graph [options] <file-or-directory>
178
+ bca [options] <file-or-directory>
179
+ ```
180
+
181
+ Analyzes the input and writes the requested diagram or JSON. Omitting `graph`
182
+ uses this command automatically.
183
+
184
+ Examples:
185
+
186
+ ```text
187
+ bca graph src --view project -o architecture.d2
188
+ bca graph src --view workflow --entry ProcessDocument -o workflow.svg
189
+ bca src --view data --format json -o data.json
190
+ ```
191
+
192
+ ## `inspect`
193
+
194
+ ```text
195
+ bca inspect [options] <file-or-directory>
196
+ ```
197
+
198
+ Runs the same analysis, filtering, and view projection as `graph`. The default
199
+ format is JSON, and output is written to standard output when `--output` is
200
+ omitted.
201
+
202
+ ```text
203
+ bca inspect src --view workflow --entry ProcessDocument
204
+ bca inspect src --strict -o model.json
205
+ ```
206
+
207
+ ## `watch`
208
+
209
+ ```text
210
+ bca watch [options] <directory>
211
+ ```
212
+
213
+ Builds once, then watches recursively for AL files, `app.json`, and
214
+ `.bca.json`. Relevant changes trigger another build after the configured
215
+ debounce interval.
216
+
217
+ ```text
218
+ bca watch src --view module --debounce 500 -o modules.svg
219
+ ```
220
+
221
+ ## `docs generate`
222
+
223
+ ```text
224
+ bca docs generate [options] <ui-test.al>
225
+ ```
226
+
227
+ Generates Markdown directly from a selected AL `[Test]` procedure.
228
+ `[WHEN]` comments become numbered phases. Reachable local helpers containing
229
+ `TestPage` operations are expanded with cycle and depth protection; repeated
230
+ and conditional UI work is summarized as user-facing instructions.
231
+
232
+ | Option | Value | Description |
233
+ | --- | --- | --- |
234
+ | `--procedure` | name | Selects the `[Test]` procedure to document. Required when the file contains multiple test procedures. |
235
+ | `--output-dir` | path | Markdown output directory. Default: `docs/generated`. |
236
+ | `-h`, `--help` | flag | Shows docs command help. |
237
+
238
+ ```text
239
+ bca docs generate test/PartnerUITest.Codeunit.al \
240
+ --procedure PartnersList_NewPartner_PersistsGeneralFields \
241
+ --output-dir docs/generated
242
+ ```
@@ -0,0 +1,32 @@
1
+ # BC Atlas examples
2
+
3
+ `warehouse-app` is a small, standalone AL project designed to exercise BC
4
+ Atlas without customer code. It contains namespaces, tables, pages, a page
5
+ extension, an interface implementation, enum-based dispatch, procedure calls,
6
+ an integration event and subscriber, record writes, and a permission set.
7
+
8
+ Generate every checked-in example from the repository root:
9
+
10
+ ```sh
11
+ npm ci
12
+ npm run examples
13
+ ```
14
+
15
+ The command writes matching D2 source and SVG files to `examples/output`:
16
+
17
+ - `project` shows the complete role-oriented architecture;
18
+ - `workflow` traces request processing through calls, writes, and events;
19
+ - `ui` focuses on pages, actions, extensions, and source tables.
20
+
21
+ You can also explore other views:
22
+
23
+ ```sh
24
+ node src/cli.js graph examples/warehouse-app --view contracts -o contracts.svg
25
+ node src/cli.js graph examples/warehouse-app --view events -o events.svg
26
+ node src/cli.js graph examples/warehouse-app --view data -o data.svg
27
+ node src/cli.js inspect examples/warehouse-app -o model.json
28
+ ```
29
+
30
+ The PNG images in `docs/generated/images` are browser captures of these SVG
31
+ outputs at a consistent viewport. Regenerate the SVG files first whenever view
32
+ rendering changes.
@@ -0,0 +1,86 @@
1
+ direction: right
2
+ title: "Warehouse architecture" {
3
+ shape: text
4
+ near: top-center
5
+ style.font-size: 28
6
+ }
7
+
8
+ g0: "Contracts" {
9
+ style.stroke-dash: 3
10
+ n2: "interface\nHandles Warehouse Activity" {
11
+ shape: rectangle
12
+ tooltip: "Inventory.al:3"
13
+ style.fill: "#FFF8C9"
14
+ style.stroke: "#8B7400"
15
+ }
16
+ n5: "enum 50102\nWarehouse Handler" {
17
+ shape: rectangle
18
+ tooltip: "Inventory.al:40"
19
+ style.fill: "#EEEEEE"
20
+ style.stroke: "#555555"
21
+ }
22
+ }
23
+
24
+ g1: "Data" {
25
+ style.stroke-dash: 3
26
+ n3: "table 50100\nWarehouse Request" {
27
+ shape: rectangle
28
+ tooltip: "Inventory.al:8"
29
+ style.fill: "#DCEBFF"
30
+ style.stroke: "#2362A2"
31
+ }
32
+ }
33
+
34
+ g2: "Security" {
35
+ style.stroke-dash: 3
36
+ n1: "permissionset 50121\nWAREHOUSE PROCESS" {
37
+ shape: rectangle
38
+ tooltip: "Automation.al:18"
39
+ style.fill: "#F5F5F5"
40
+ style.stroke: "#666666"
41
+ }
42
+ }
43
+
44
+ g3: "Services" {
45
+ style.stroke-dash: 3
46
+ n0: "codeunit 50120\nWarehouse Notifications" {
47
+ shape: rectangle
48
+ tooltip: "Automation.al:5"
49
+ style.fill: "#FFF0D6"
50
+ style.stroke: "#A96300"
51
+ }
52
+ n4: "codeunit 50101\nWarehouse Processor" {
53
+ shape: rectangle
54
+ tooltip: "Inventory.al:18"
55
+ style.fill: "#FFF0D6"
56
+ style.stroke: "#A96300"
57
+ }
58
+ }
59
+
60
+ g4: "UI" {
61
+ style.stroke-dash: 3
62
+ n7: "pageextension 50111\nWarehouse Request Ext." {
63
+ shape: rectangle
64
+ tooltip: "WarehouseUI.al:27"
65
+ style.fill: "#E5F6E8"
66
+ style.stroke: "#31783B"
67
+ style.stroke-dash: 4
68
+ }
69
+ n6: "page 50110\nWarehouse Requests" {
70
+ shape: rectangle
71
+ tooltip: "WarehouseUI.al:5"
72
+ style.fill: "#E5F6E8"
73
+ style.stroke: "#31783B"
74
+ }
75
+ }
76
+
77
+ g3.n0 -> g3.n4: "reads" {style.stroke: "#0072B2"}
78
+ g2.n1 -> g1.n3: "permits [RIMD]" {style.stroke: "#7C3AED"}
79
+ g3.n4 --> g0.n2: "implements" {style.stroke: "#E69F00"}
80
+ g3.n4 -> g1.n3: "uses" {style.stroke: "#6B7280"; style.stroke-dash: 3}
81
+ g3.n4 -> g1.n3: "writes" {style.stroke: "#D55E00"}
82
+ g0.n5 --> g0.n2: "implements" {style.stroke: "#E69F00"}
83
+ g0.n5 -> g3.n4: "selects" {style.stroke: "#EA580C"}
84
+ g4.n6 -> g1.n3: "reads" {style.stroke: "#0072B2"}
85
+ g4.n6 -> g3.n4: "uses" {style.stroke: "#6B7280"; style.stroke-dash: 3}
86
+ g4.n7 --> g4.n6: "extends" {style.stroke: "#CC79A7"}