@patimweb/pi-abap-fs 1.2.0 → 1.2.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.
- package/docs/architecture.md +101 -0
- package/graph-out/GRAPH_REPORT.md +61 -0
- package/graph-out/cache/cache.json +3250 -0
- package/graph-out/graph.html +131 -0
- package/graph-out/graph.json +1638 -0
- package/package.json +7 -4
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
The extension bridges two worlds: the agent speaks tool calls, SAP speaks
|
|
4
|
+
ADT-REST. In between lie four layers with clear responsibilities.
|
|
5
|
+
|
|
6
|
+
## Layers
|
|
7
|
+
|
|
8
|
+
```mermaid
|
|
9
|
+
flowchart TB
|
|
10
|
+
agent["pi coding agent<br/><small>LLM · tool runtime</small>"]
|
|
11
|
+
index["index.ts<br/><small>loadConfig() + 27 × registerTool</small>"]
|
|
12
|
+
tools["src/tools/*.ts<br/><small>27 modules: typebox schema + execute()</small>"]
|
|
13
|
+
client["src/client.ts<br/><small>withClient() · resolveObject() · toError()</small>"]
|
|
14
|
+
api["abap-adt-api<br/><small>ADTClient, stateless/stateful</small>"]
|
|
15
|
+
sap[("SAP S/4HANA<br/><small>/sap/bc/adt/…</small>")]
|
|
16
|
+
|
|
17
|
+
config["src/config.ts<br/><small>profiles + active profile</small>"]
|
|
18
|
+
file[/"~/.pi/abap-config.json<br/><small>0600 · atomic rename</small>"/]
|
|
19
|
+
fmt["src/formatting/formatters.ts<br/><small>pure: data → text</small>"]
|
|
20
|
+
|
|
21
|
+
agent -->|"loads extension at startup"| index
|
|
22
|
+
index -->|"registerTool × 27"| tools
|
|
23
|
+
tools -->|"withClient(profile, fn)"| client
|
|
24
|
+
client -->|"login → operation → dropSession"| api
|
|
25
|
+
api -->|"HTTP(S), Basic Auth, client + language"| sap
|
|
26
|
+
sap -.->|"response (XML/JSON)"| client
|
|
27
|
+
|
|
28
|
+
config -->|"resolveConfig(profile)"| tools
|
|
29
|
+
config <-->|"load / persist"| file
|
|
30
|
+
client -->|"raw data"| fmt
|
|
31
|
+
fmt -.->|"formatted text"| tools
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The downward path is the call path; the dashed edges are the return path: raw
|
|
35
|
+
ADT responses pass through the pure formatters and leave the tool as text plus a
|
|
36
|
+
structured `details` object. `src/types.ts` deliberately sits beside the flow,
|
|
37
|
+
which is why it is absent from the diagram — it holds only data shapes and error
|
|
38
|
+
classes, no behavior.
|
|
39
|
+
|
|
40
|
+
## Flow of a write operation (`abap_write`)
|
|
41
|
+
|
|
42
|
+
Writing requires a lock, and the lock only holds within *one* stateful session.
|
|
43
|
+
Hence `stateful: true`, and hence `unLock` sits in a `finally`.
|
|
44
|
+
|
|
45
|
+
```mermaid
|
|
46
|
+
sequenceDiagram
|
|
47
|
+
autonumber
|
|
48
|
+
participant A as Agent
|
|
49
|
+
participant T as abap_write
|
|
50
|
+
participant C as client.ts
|
|
51
|
+
participant S as SAP · ADT
|
|
52
|
+
|
|
53
|
+
A->>T: abap_write(name, source, transport?)
|
|
54
|
+
T->>T: resolveConfig(profile)
|
|
55
|
+
T->>C: withClient(fn, { stateful: true })
|
|
56
|
+
|
|
57
|
+
rect rgba(13,108,118,0.08)
|
|
58
|
+
note over C,S: one session
|
|
59
|
+
C->>S: login()
|
|
60
|
+
C->>S: searchObject → objectStructure
|
|
61
|
+
note right of C: resolveObject: best name match, mainInclude
|
|
62
|
+
C->>S: lock(objectUrl, "MODIFY")
|
|
63
|
+
S-->>C: LOCK_HANDLE
|
|
64
|
+
C->>S: setObjectSource(mainInclude, source, handle, transport?)
|
|
65
|
+
C->>S: unLock() «finally»
|
|
66
|
+
C->>S: dropSession()
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
T-->>A: "Source written …" + details
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If a `lockHandle` from an earlier `abap_lock` is supplied, `lock` and `unLock`
|
|
73
|
+
are skipped — the lock then belongs to the caller and stays in place. Activation
|
|
74
|
+
is never automatic: `abap_activate` is a separate call.
|
|
75
|
+
|
|
76
|
+
## Tools by task
|
|
77
|
+
|
|
78
|
+
| Group | Tools |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Connection | `abap_setup`, `abap_status`, `abap_profile`, `abap_test_connection` |
|
|
81
|
+
| Search & read | `abap_search`, `abap_object_types`, `abap_node_contents`, `abap_object_structure`, `abap_read`, `abap_where_used`, `abap_text_elements` |
|
|
82
|
+
| Modify | `abap_lock`, `abap_unlock`, `abap_write`, `abap_activate`, `abap_create_object`, `abap_set_text_elements` |
|
|
83
|
+
| Check & test | `abap_syntax_check`, `abap_unit_test`, `abap_atc` |
|
|
84
|
+
| Data | `abap_query`, `abap_table` |
|
|
85
|
+
| Operations & transport | `abap_transports`, `abap_transport_details`, `abap_dumps`, `abap_traces`, `abap_trace_hitlist` |
|
|
86
|
+
|
|
87
|
+
## Decisions
|
|
88
|
+
|
|
89
|
+
- **Session per call** (`withClient`) — fresh client, login, `dropSession` in the
|
|
90
|
+
`finally`. No shared connection state between tools.
|
|
91
|
+
- **stateless as the default** — only locking operations run `stateful`.
|
|
92
|
+
- **Errors are normalized** (`toError`) — the model sees the SAP message
|
|
93
|
+
directly; dedicated error classes say what to do next (e.g. "run `abap_setup`
|
|
94
|
+
first").
|
|
95
|
+
- **Profile file written atomically** — temp file with `0600` and `rename`,
|
|
96
|
+
because `writeFileSync` with `mode` does not change the permissions of an
|
|
97
|
+
existing file.
|
|
98
|
+
- **Side-effect-free formatters** — data in, string out; which is why most of
|
|
99
|
+
the code is testable without an SAP system.
|
|
100
|
+
- **No build step** — pi loads `index.ts` via jiti; `tsc` only runs as a
|
|
101
|
+
`--noEmit` typecheck.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Mind Place Report
|
|
2
|
+
|
|
3
|
+
Generated from `/Users/patrickweppelmann/Documents/Workspaces/pi-abap-fs`
|
|
4
|
+
|
|
5
|
+
## Corpus
|
|
6
|
+
|
|
7
|
+
- **Files scanned:** 39
|
|
8
|
+
- **Languages:** 35 .ts, 3 .json, 1 .cjs
|
|
9
|
+
|
|
10
|
+
## Graph Statistics
|
|
11
|
+
|
|
12
|
+
| Metric | Value |
|
|
13
|
+
|--------|-------|
|
|
14
|
+
| Nodes | 107 |
|
|
15
|
+
| Edges | 118 |
|
|
16
|
+
| Communities | 9 |
|
|
17
|
+
| Avg. Degree | 2.2 |
|
|
18
|
+
|
|
19
|
+
## God Nodes
|
|
20
|
+
|
|
21
|
+
The most-connected entities - these are the architectural pillars:
|
|
22
|
+
|
|
23
|
+
| # | Node | Type | Connections | File |
|
|
24
|
+
|---|------|------|-------------|------|
|
|
25
|
+
| 1 | **index.ts** | file | 28 | `index.ts` |
|
|
26
|
+
| 2 | **src/formatting/formatters.ts** | file | 20 | `src/formatting/formatters.ts` |
|
|
27
|
+
| 3 | **package.json** | file | 15 | `package.json` |
|
|
28
|
+
| 4 | **src/config.ts** | file | 15 | `src/config.ts` |
|
|
29
|
+
| 5 | **src/client.ts** | file | 10 | `src/client.ts` |
|
|
30
|
+
|
|
31
|
+
## Communities
|
|
32
|
+
|
|
33
|
+
The graph was partitioned into these subsystems:
|
|
34
|
+
|
|
35
|
+
| Community | Size | Key Members |
|
|
36
|
+
|-----------|------|-------------|
|
|
37
|
+
| **AbapProfileNotFoundError.constructor** | 63 | index.ts, src/client.ts, createClient |
|
|
38
|
+
| **formatTextElements** | 20 | src/formatting/formatters.ts, formatSearchResults, formatObjectStructure |
|
|
39
|
+
| **devDependencies** | 16 | package.json, name, version |
|
|
40
|
+
| **include** | 3 | tsconfig.json, compilerOptions, include |
|
|
41
|
+
| **release.config.cjs** | 1 | release.config.cjs |
|
|
42
|
+
| **isClassStructure** | 1 | isClassStructure |
|
|
43
|
+
| **tests/config.test.ts** | 1 | tests/config.test.ts |
|
|
44
|
+
| **tests/formatters.test.ts** | 1 | tests/formatters.test.ts |
|
|
45
|
+
| **tests/smoke.test.ts** | 1 | tests/smoke.test.ts |
|
|
46
|
+
|
|
47
|
+
## Surprising Connections
|
|
48
|
+
|
|
49
|
+
- **src/formatting/formatters.ts** → `contains` → **isClassStructure**: Cross-community bridge between "src/formatting/formatters.ts" and "isClassStructure"
|
|
50
|
+
|
|
51
|
+
## Suggested Questions
|
|
52
|
+
|
|
53
|
+
- How does **index.ts** connect to **src/formatting/formatters.ts**?
|
|
54
|
+
- What calls **index.ts** and what does it depend on?
|
|
55
|
+
- Trace the data flow between **index.ts** and **src/formatting/formatters.ts**
|
|
56
|
+
- Which modules have the most dependencies?
|
|
57
|
+
- Show me the architecture of the `index.ts` subsystem
|
|
58
|
+
- What is the most heavily connected module in the codebase?
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
_Report generated by pi-mindplace · Use `mindplace_query` to explore the graph_
|