arc-1 0.2.0 → 0.4.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.
Files changed (159) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +77 -199
  3. package/dist/adt/btp.d.ts +2 -2
  4. package/dist/adt/btp.d.ts.map +1 -1
  5. package/dist/adt/btp.js +1 -1
  6. package/dist/adt/btp.js.map +1 -1
  7. package/dist/adt/client.d.ts +13 -1
  8. package/dist/adt/client.d.ts.map +1 -1
  9. package/dist/adt/client.js +40 -1
  10. package/dist/adt/client.js.map +1 -1
  11. package/dist/adt/codeintel.d.ts +41 -0
  12. package/dist/adt/codeintel.d.ts.map +1 -1
  13. package/dist/adt/codeintel.js +99 -27
  14. package/dist/adt/codeintel.js.map +1 -1
  15. package/dist/adt/config.d.ts +6 -0
  16. package/dist/adt/config.d.ts.map +1 -1
  17. package/dist/adt/config.js.map +1 -1
  18. package/dist/adt/cookies.d.ts.map +1 -1
  19. package/dist/adt/cookies.js.map +1 -1
  20. package/dist/adt/crud.d.ts.map +1 -1
  21. package/dist/adt/crud.js.map +1 -1
  22. package/dist/adt/devtools.d.ts +14 -0
  23. package/dist/adt/devtools.d.ts.map +1 -1
  24. package/dist/adt/devtools.js +28 -3
  25. package/dist/adt/devtools.js.map +1 -1
  26. package/dist/adt/diagnostics.d.ts +101 -0
  27. package/dist/adt/diagnostics.d.ts.map +1 -0
  28. package/dist/adt/diagnostics.js +349 -0
  29. package/dist/adt/diagnostics.js.map +1 -0
  30. package/dist/adt/errors.d.ts.map +1 -1
  31. package/dist/adt/errors.js.map +1 -1
  32. package/dist/adt/features.d.ts +11 -2
  33. package/dist/adt/features.d.ts.map +1 -1
  34. package/dist/adt/features.js +37 -12
  35. package/dist/adt/features.js.map +1 -1
  36. package/dist/adt/http.d.ts +33 -7
  37. package/dist/adt/http.d.ts.map +1 -1
  38. package/dist/adt/http.js +148 -84
  39. package/dist/adt/http.js.map +1 -1
  40. package/dist/adt/oauth.d.ts +120 -0
  41. package/dist/adt/oauth.d.ts.map +1 -0
  42. package/dist/adt/oauth.js +321 -0
  43. package/dist/adt/oauth.js.map +1 -0
  44. package/dist/adt/safety.d.ts.map +1 -1
  45. package/dist/adt/safety.js.map +1 -1
  46. package/dist/adt/transport.d.ts.map +1 -1
  47. package/dist/adt/transport.js.map +1 -1
  48. package/dist/adt/types.d.ts +143 -0
  49. package/dist/adt/types.d.ts.map +1 -1
  50. package/dist/adt/types.js.map +1 -1
  51. package/dist/adt/xml-parser.d.ts +37 -1
  52. package/dist/adt/xml-parser.d.ts.map +1 -1
  53. package/dist/adt/xml-parser.js +147 -0
  54. package/dist/adt/xml-parser.js.map +1 -1
  55. package/dist/cache/cache.d.ts +47 -4
  56. package/dist/cache/cache.d.ts.map +1 -1
  57. package/dist/cache/cache.js +16 -5
  58. package/dist/cache/cache.js.map +1 -1
  59. package/dist/cache/caching-layer.d.ts +82 -0
  60. package/dist/cache/caching-layer.d.ts.map +1 -0
  61. package/dist/cache/caching-layer.js +134 -0
  62. package/dist/cache/caching-layer.js.map +1 -0
  63. package/dist/cache/memory.d.ts +14 -2
  64. package/dist/cache/memory.d.ts.map +1 -1
  65. package/dist/cache/memory.js +72 -5
  66. package/dist/cache/memory.js.map +1 -1
  67. package/dist/cache/sqlite.d.ts +10 -1
  68. package/dist/cache/sqlite.d.ts.map +1 -1
  69. package/dist/cache/sqlite.js +90 -2
  70. package/dist/cache/sqlite.js.map +1 -1
  71. package/dist/cache/warmup.d.ts +41 -0
  72. package/dist/cache/warmup.d.ts.map +1 -0
  73. package/dist/cache/warmup.js +286 -0
  74. package/dist/cache/warmup.js.map +1 -0
  75. package/dist/cli.d.ts.map +1 -1
  76. package/dist/cli.js.map +1 -1
  77. package/dist/context/cds-deps.d.ts +35 -0
  78. package/dist/context/cds-deps.d.ts.map +1 -0
  79. package/dist/context/cds-deps.js +201 -0
  80. package/dist/context/cds-deps.js.map +1 -0
  81. package/dist/context/compressor.d.ts +20 -1
  82. package/dist/context/compressor.d.ts.map +1 -1
  83. package/dist/context/compressor.js +178 -17
  84. package/dist/context/compressor.js.map +1 -1
  85. package/dist/context/contract.d.ts.map +1 -1
  86. package/dist/context/contract.js.map +1 -1
  87. package/dist/context/deps.d.ts.map +1 -1
  88. package/dist/context/deps.js.map +1 -1
  89. package/dist/context/method-surgery.d.ts +91 -0
  90. package/dist/context/method-surgery.d.ts.map +1 -0
  91. package/dist/context/method-surgery.js +441 -0
  92. package/dist/context/method-surgery.js.map +1 -0
  93. package/dist/context/types.d.ts +7 -0
  94. package/dist/context/types.d.ts.map +1 -1
  95. package/dist/context/types.js.map +1 -1
  96. package/dist/handlers/hyperfocused.d.ts +35 -0
  97. package/dist/handlers/hyperfocused.d.ts.map +1 -0
  98. package/dist/handlers/hyperfocused.js +104 -0
  99. package/dist/handlers/hyperfocused.js.map +1 -0
  100. package/dist/handlers/intent.d.ts +5 -1
  101. package/dist/handlers/intent.d.ts.map +1 -1
  102. package/dist/handlers/intent.js +462 -44
  103. package/dist/handlers/intent.js.map +1 -1
  104. package/dist/handlers/tools.d.ts +5 -0
  105. package/dist/handlers/tools.d.ts.map +1 -1
  106. package/dist/handlers/tools.js +270 -87
  107. package/dist/handlers/tools.js.map +1 -1
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js.map +1 -1
  110. package/dist/lint/config-builder.d.ts +60 -0
  111. package/dist/lint/config-builder.d.ts.map +1 -0
  112. package/dist/lint/config-builder.js +187 -0
  113. package/dist/lint/config-builder.js.map +1 -0
  114. package/dist/lint/lint.d.ts +43 -0
  115. package/dist/lint/lint.d.ts.map +1 -1
  116. package/dist/lint/lint.js +77 -2
  117. package/dist/lint/lint.js.map +1 -1
  118. package/dist/lint/presets/cloud.d.ts +16 -0
  119. package/dist/lint/presets/cloud.d.ts.map +1 -0
  120. package/dist/lint/presets/cloud.js +111 -0
  121. package/dist/lint/presets/cloud.js.map +1 -0
  122. package/dist/lint/presets/onprem.d.ts +17 -0
  123. package/dist/lint/presets/onprem.d.ts.map +1 -0
  124. package/dist/lint/presets/onprem.js +82 -0
  125. package/dist/lint/presets/onprem.js.map +1 -0
  126. package/dist/server/audit.d.ts +1 -0
  127. package/dist/server/audit.d.ts.map +1 -1
  128. package/dist/server/audit.js.map +1 -1
  129. package/dist/server/config.d.ts.map +1 -1
  130. package/dist/server/config.js +20 -0
  131. package/dist/server/config.js.map +1 -1
  132. package/dist/server/context.d.ts.map +1 -1
  133. package/dist/server/context.js.map +1 -1
  134. package/dist/server/elicit.d.ts.map +1 -1
  135. package/dist/server/elicit.js.map +1 -1
  136. package/dist/server/http.d.ts.map +1 -1
  137. package/dist/server/http.js +4 -1
  138. package/dist/server/http.js.map +1 -1
  139. package/dist/server/logger.d.ts.map +1 -1
  140. package/dist/server/logger.js.map +1 -1
  141. package/dist/server/server.d.ts +4 -2
  142. package/dist/server/server.d.ts.map +1 -1
  143. package/dist/server/server.js +121 -8
  144. package/dist/server/server.js.map +1 -1
  145. package/dist/server/sinks/btp-auditlog.d.ts.map +1 -1
  146. package/dist/server/sinks/btp-auditlog.js.map +1 -1
  147. package/dist/server/sinks/file.d.ts.map +1 -1
  148. package/dist/server/sinks/file.js.map +1 -1
  149. package/dist/server/sinks/stderr.d.ts.map +1 -1
  150. package/dist/server/sinks/stderr.js.map +1 -1
  151. package/dist/server/sinks/types.d.ts.map +1 -1
  152. package/dist/server/sinks/types.js.map +1 -1
  153. package/dist/server/types.d.ts +19 -0
  154. package/dist/server/types.d.ts.map +1 -1
  155. package/dist/server/types.js +8 -0
  156. package/dist/server/types.js.map +1 -1
  157. package/dist/server/xsuaa.d.ts.map +1 -1
  158. package/dist/server/xsuaa.js.map +1 -1
  159. package/package.json +14 -6
@@ -10,44 +10,174 @@
10
10
  * instead of 200+ individual tools (one per object type per operation),
11
11
  * we group by *intent* with a `type` parameter for routing.
12
12
  * This keeps the LLM's tool selection simple and the context window small.
13
+ *
14
+ * Tool definitions adapt based on system type (BTP vs on-premise):
15
+ * - BTP ABAP Environment: removes unavailable types (PROG, INCL, VIEW,
16
+ * TEXT_ELEMENTS, VARIANTS), adjusts descriptions for restricted features
17
+ * - On-premise: full tool set with all types and descriptions
13
18
  */
19
+ import { getHyperfocusedToolDefinition } from './hyperfocused.js';
20
+ /** Check if tools should use BTP-adapted definitions */
21
+ function isBtpMode(config) {
22
+ return config.systemType === 'btp';
23
+ }
24
+ // ─── SAPRead Types ──────────────────────────────────────────────────
25
+ /** All SAPRead types available on on-premise */
26
+ const SAPREAD_TYPES_ONPREM = [
27
+ 'PROG',
28
+ 'CLAS',
29
+ 'INTF',
30
+ 'FUNC',
31
+ 'FUGR',
32
+ 'INCL',
33
+ 'DDLS',
34
+ 'DDLX',
35
+ 'BDEF',
36
+ 'SRVD',
37
+ 'SRVB',
38
+ 'TABL',
39
+ 'VIEW',
40
+ 'STRU',
41
+ 'DOMA',
42
+ 'DTEL',
43
+ 'TRAN',
44
+ 'TABLE_CONTENTS',
45
+ 'DEVC',
46
+ 'SOBJ',
47
+ 'SYSTEM',
48
+ 'COMPONENTS',
49
+ 'MESSAGES',
50
+ 'TEXT_ELEMENTS',
51
+ 'VARIANTS',
52
+ ];
53
+ /** SAPRead types available on BTP ABAP Environment (no PROG, INCL, VIEW, TEXT_ELEMENTS, VARIANTS) */
54
+ const SAPREAD_TYPES_BTP = [
55
+ 'CLAS',
56
+ 'INTF',
57
+ 'FUNC',
58
+ 'FUGR',
59
+ 'DDLS',
60
+ 'DDLX',
61
+ 'BDEF',
62
+ 'SRVD',
63
+ 'SRVB',
64
+ 'TABL',
65
+ 'STRU',
66
+ 'DOMA',
67
+ 'DTEL',
68
+ 'TABLE_CONTENTS',
69
+ 'DEVC',
70
+ 'SYSTEM',
71
+ 'COMPONENTS',
72
+ 'MESSAGES',
73
+ ];
74
+ const SAPREAD_DESC_ONPREM = 'Read SAP ABAP objects. Types: PROG, CLAS, INTF, FUNC, FUGR (use expand_includes=true to get all include sources), INCL, DDLS, DDLX (CDS metadata extensions — UI annotations), BDEF, SRVD, SRVB (service bindings — returns structured binding info: OData version, publish status, service definition ref), TABL, VIEW, STRU (DDIC structures like BAPIRET2 — returns CDS-like source), DOMA (DDIC domains — returns type info, value table, fixed values), DTEL (data elements — returns domain, labels, search help), TRAN (transaction codes — returns description, program, package), TABLE_CONTENTS, DEVC, SOBJ (BOR business objects — returns method catalog or full implementation), SYSTEM, COMPONENTS, MESSAGES, TEXT_ELEMENTS, VARIANTS. For CLAS: omit include to get the full class source (definition + implementation combined). The include param is optional — use it only to read class-local sections: definitions (local types), implementations (local helper classes), macros, testclasses (ABAP Unit). For CLAS with method param: use method="*" to list all methods with signatures and visibility, or method="method_name" to read a single method implementation (95% fewer tokens than full source). For SOBJ: returns BOR method catalog; use method param to read a specific method implementation.';
75
+ const SAPREAD_DESC_BTP = 'Read SAP ABAP objects (BTP ABAP Environment). Types: CLAS, INTF, FUNC (released/custom only), FUGR (released/custom only), DDLS (CDS views — primary data model on BTP), DDLX (CDS metadata extensions — UI annotations for Fiori Elements), BDEF (RAP behavior definitions), SRVD (service definitions), SRVB (service bindings — returns structured binding info: OData version, publish status, service definition ref), TABL (custom tables only), STRU (DDIC structures — returns CDS-like source), DOMA (DDIC domains — type info, value table, fixed values), DTEL (data elements — domain, labels, search help), TABLE_CONTENTS (custom tables and released CDS only — SAP standard tables are blocked), DEVC, SYSTEM, COMPONENTS, MESSAGES (custom message classes only). For CLAS: omit include to get the full class source. The include param reads class-local sections: definitions, implementations, macros, testclasses. For CLAS with method param: use method="*" to list all methods with signatures and visibility, or method="method_name" to read a single method (95% fewer tokens). Note: PROG, INCL, VIEW, TRAN, TEXT_ELEMENTS, VARIANTS are not available on BTP — use CLAS with IF_OO_ADT_CLASSRUN for console applications, and DDLS for data models instead of classic views.';
76
+ // ─── SAPWrite Types ─────────────────────────────────────────────────
77
+ const SAPWRITE_TYPES_ONPREM = ['PROG', 'CLAS', 'INTF', 'FUNC', 'INCL', 'DDLS', 'DDLX', 'BDEF', 'SRVD'];
78
+ const SAPWRITE_TYPES_BTP = ['CLAS', 'INTF', 'DDLS', 'DDLX', 'BDEF', 'SRVD'];
79
+ const SAPWRITE_DESC_ONPREM = 'Create or update ABAP source code. Handles lock/modify/unlock automatically. Supports PROG, CLAS, INTF, FUNC, INCL, DDLS, DDLX, BDEF, SRVD. ' +
80
+ 'For edit_method: surgically replace a single method body in a CLAS without sending the full class source. ' +
81
+ 'Provide just the new method implementation code in "source" — 95% fewer tokens than full-class updates.';
82
+ const SAPWRITE_DESC_BTP = 'Create or update ABAP source code (BTP ABAP Environment). Handles lock/modify/unlock automatically. Supports CLAS, INTF, DDLS, DDLX, BDEF, SRVD. ' +
83
+ 'Must use ABAP Cloud language version (no classic statements). Only Z*/Y* namespace allowed on BTP. ' +
84
+ 'For edit_method: surgically replace a single method body in a CLAS without sending the full class source.';
85
+ // ─── SAPContext Types ───────────────────────────────────────────────
86
+ const SAPCONTEXT_TYPES_ONPREM = ['CLAS', 'INTF', 'PROG', 'FUNC', 'DDLS'];
87
+ const SAPCONTEXT_TYPES_BTP = ['CLAS', 'INTF', 'DDLS'];
88
+ const SAPCONTEXT_DESC_ONPREM = 'Get compressed dependency context for an ABAP object or CDS entity. Returns only the public API contracts ' +
89
+ '(method signatures, interface definitions, type declarations) of all objects that the target depends on — ' +
90
+ 'NOT the full source code. This is the most token-efficient way to understand dependencies. ' +
91
+ 'Instead of N separate SAPRead calls returning full source (~200 lines each), SAPContext returns ONE response ' +
92
+ 'with compressed contracts (~15-30 lines each). Typical compression: 7-30x fewer tokens.\n\n' +
93
+ 'What gets extracted per dependency:\n' +
94
+ '- Classes: CLASS DEFINITION with PUBLIC SECTION only (methods, types, constants). PROTECTED, PRIVATE and IMPLEMENTATION stripped.\n' +
95
+ '- Interfaces: Full interface definition (interfaces are already public contracts).\n' +
96
+ '- Function modules: FUNCTION signature block only (IMPORTING/EXPORTING parameters).\n' +
97
+ '- CDS views (DDLS): All data sources (tables, other CDS views), association targets, and compositions. ' +
98
+ "Each dependency's full source is included (table definitions, CDS DDL). Essential for CDS unit test generation — " +
99
+ 'provides the dependency graph and field catalogs needed for cl_cds_test_environment doubles.\n\n' +
100
+ 'Filtering: SAP standard objects (CL_ABAP_*, IF_ABAP_*, CX_SY_*) are excluded — the LLM already knows standard SAP APIs. ' +
101
+ 'Custom objects (Z*, Y*) are prioritized.\n\n' +
102
+ 'Use SAPContext BEFORE writing code that modifies or extends existing objects. ' +
103
+ 'Use SAPRead to get the full source of the target object, then SAPContext to understand its dependencies.';
104
+ const SAPCONTEXT_DESC_BTP = 'Get compressed dependency context for an ABAP object or CDS entity (BTP ABAP Environment). Returns only the public API contracts ' +
105
+ '(method signatures, interface definitions, type declarations) of all objects that the target depends on — ' +
106
+ 'NOT the full source code. This is the most token-efficient way to understand dependencies.\n\n' +
107
+ 'What gets extracted per dependency:\n' +
108
+ '- Classes: CLASS DEFINITION with PUBLIC SECTION only (methods, types, constants).\n' +
109
+ '- Interfaces: Full interface definition (interfaces are already public contracts).\n' +
110
+ '- CDS views (DDLS): All data sources (tables, other CDS views), association targets, and compositions. ' +
111
+ "Each dependency's full source is included. Essential for CDS unit test generation.\n\n" +
112
+ 'On BTP: released SAP objects (CL_ABAP_*, IF_ABAP_*) are included since they form the primary development API surface. ' +
113
+ 'Custom objects (Z*, Y*) are also included.\n\n' +
114
+ 'Use SAPContext BEFORE writing code that modifies or extends existing objects.';
115
+ // ─── SAPQuery ───────────────────────────────────────────────────────
116
+ const SAPQUERY_DESC_ONPREM = 'Execute ABAP SQL queries against SAP tables. Returns structured data with column names and rows. ' +
117
+ 'Powerful for reverse-engineering: query metadata tables like DD02L (table catalog), DD03L (field catalog), ' +
118
+ 'SWOTLV (BOR method implementations), TADIR (object directory), TFDIR (function modules). ' +
119
+ 'If a table is not found, similar table names will be suggested automatically.';
120
+ const SAPQUERY_DESC_BTP = 'Execute ABAP SQL queries (BTP ABAP Environment). Returns structured data with column names and rows. ' +
121
+ 'IMPORTANT: On BTP, only custom Z/Y tables and released CDS entities can be queried. ' +
122
+ 'SAP standard tables (MARA, VBAK, DD02L, DD03L, TADIR, etc.) are blocked. ' +
123
+ 'Use released CDS views instead: I_LANGUAGE, I_COUNTRY, I_CURRENCY, I_UnitOfMeasure, etc. ' +
124
+ 'If a table is not found, similar table names will be suggested automatically.';
125
+ // ─── SAPSearch ──────────────────────────────────────────────────────
126
+ const SAPSEARCH_DESC_ONPREM = 'Search for ABAP objects or search within source code. Two modes:\n' +
127
+ '1. Object search (default): Search by name pattern with wildcards (* for any characters). Returns object type, name, package, description, and ADT URI. Use this to find classes, programs, function modules, tables, etc.\n' +
128
+ '2. Source code search (searchType="source_code"): Full-text search within ABAP source code across the system. Use this to find all objects containing a specific string (e.g., a method call, variable name, or class reference). Requires SAP_BASIS >= 7.51.\n\n' +
129
+ 'Tips: BOR business objects appear as SOBJ type in results. The uri field from results can be used directly with SAPNavigate for references.';
130
+ const SAPSEARCH_DESC_BTP = 'Search for ABAP objects or search within source code (BTP ABAP Environment). Two modes:\n' +
131
+ '1. Object search (default): Search by name pattern with wildcards. Returns released SAP objects and custom Z/Y objects. Classic programs, includes, and DDIC views are not searchable on BTP.\n' +
132
+ '2. Source code search (searchType="source_code"): Full-text search within ABAP source code.\n\n' +
133
+ 'Tips: On BTP, focus on classes (CL_*), interfaces (IF_*), CDS views (I_*), and custom Z/Y objects.';
134
+ // ─── SAPTransport ───────────────────────────────────────────────────
135
+ const SAPTRANSPORT_DESC_ONPREM = 'Manage CTS transport requests: list, get details, create, and release.';
136
+ const SAPTRANSPORT_DESC_BTP = 'Manage transport requests (BTP ABAP Environment): list, get details, create, and release. ' +
137
+ 'On BTP, transport release triggers a gCTS push to the software component Git repository. ' +
138
+ 'Import into target systems is done via the Manage Software Components app or Cloud Transport Management Service (cTMS), not via this tool.';
139
+ // ─── SAPManage ──────────────────────────────────────────────────────
140
+ const SAPMANAGE_DESC_ONPREM = 'Probe and report SAP system capabilities. Use this BEFORE attempting operations that depend on optional ' +
141
+ 'features (abapGit, RAP/CDS, AMDP, HANA, UI5/Fiori, CTS transports).\n\n' +
142
+ 'Actions:\n' +
143
+ '- "features": Get cached feature status from last probe (fast, no SAP round-trip). ' +
144
+ 'Returns which features are available, their mode (auto/on/off), and when they were last probed.\n' +
145
+ '- "probe": Re-probe the SAP system now (makes 6 parallel HEAD requests, ~1-2s). ' +
146
+ 'Use this on first use or if you suspect feature availability has changed.\n\n' +
147
+ 'Returns JSON with 6 features, each having: id, available (bool), mode, message, and probedAt timestamp. ' +
148
+ 'Also returns systemType ("btp" or "onprem") for understanding available capabilities. ' +
149
+ '"available: false" means do NOT attempt operations that depend on it.';
150
+ const SAPMANAGE_DESC_BTP = 'Probe and report SAP system capabilities (BTP ABAP Environment). ' +
151
+ 'Returns feature status and system type.\n\n' +
152
+ 'Actions:\n' +
153
+ '- "features": Get cached feature status from last probe.\n' +
154
+ '- "probe": Re-probe the SAP system now.\n\n' +
155
+ 'Returns JSON with features and systemType="btp". On BTP, RAP/CDS and transports are always available. ' +
156
+ 'abapGit, AMDP, UI5/BSP may not be available depending on the BTP ABAP configuration.';
157
+ // ─── Main Tool Definitions ──────────────────────────────────────────
14
158
  export function getToolDefinitions(config) {
159
+ // Hyperfocused mode: single universal SAP tool (~200 tokens)
160
+ if (config.toolMode === 'hyperfocused') {
161
+ return [getHyperfocusedToolDefinition(config)];
162
+ }
163
+ const btp = isBtpMode(config);
15
164
  const tools = [
16
165
  {
17
166
  name: 'SAPRead',
18
- description: 'Read SAP ABAP objects. Types: PROG, CLAS, INTF, FUNC, FUGR (use expand_includes=true to get all include sources), INCL, DDLS, BDEF, SRVD, TABL, VIEW, TABLE_CONTENTS, DEVC, SOBJ (BOR business objects — returns method catalog or full implementation), SYSTEM, COMPONENTS, MESSAGES, TEXT_ELEMENTS, VARIANTS. For CLAS: omit include to get the full class source (definition + implementation combined). The include param is optional — use it only to read class-local sections: definitions (local types), implementations (local helper classes), macros, testclasses (ABAP Unit). For SOBJ: returns BOR method catalog; use method param to read a specific method implementation.',
167
+ description: btp ? SAPREAD_DESC_BTP : SAPREAD_DESC_ONPREM,
19
168
  inputSchema: {
20
169
  type: 'object',
21
170
  properties: {
22
171
  type: {
23
172
  type: 'string',
24
- enum: [
25
- 'PROG',
26
- 'CLAS',
27
- 'INTF',
28
- 'FUNC',
29
- 'FUGR',
30
- 'INCL',
31
- 'DDLS',
32
- 'BDEF',
33
- 'SRVD',
34
- 'TABL',
35
- 'VIEW',
36
- 'TABLE_CONTENTS',
37
- 'DEVC',
38
- 'SOBJ',
39
- 'SYSTEM',
40
- 'COMPONENTS',
41
- 'MESSAGES',
42
- 'TEXT_ELEMENTS',
43
- 'VARIANTS',
44
- ],
173
+ enum: btp ? SAPREAD_TYPES_BTP : SAPREAD_TYPES_ONPREM,
45
174
  description: 'Object type to read',
46
175
  },
47
176
  name: { type: 'string', description: 'Object name (e.g., ZTEST_PROGRAM, ZCL_ORDER, MARA)' },
48
177
  include: {
49
178
  type: 'string',
50
- description: 'For CLAS only. DO NOT use this to read the main class — omit include entirely to get the full class source (CLASS DEFINITION + CLASS IMPLEMENTATION). This parameter reads class-LOCAL auxiliary files only: definitions (local type definitions, NOT the main class definition), implementations (local helper class implementations), macros, testclasses (ABAP Unit). Comma-separated. Not all classes have these sections — missing ones return a note instead of an error.',
179
+ description: 'For CLAS: DO NOT use this to read the main class — omit include entirely to get the full class source (CLASS DEFINITION + CLASS IMPLEMENTATION). This parameter reads class-LOCAL auxiliary files only: definitions (local type definitions, NOT the main class definition), implementations (local helper class implementations), macros, testclasses (ABAP Unit). Comma-separated. Not all classes have these sections — missing ones return a note instead of an error. ' +
180
+ 'For DDLS: use include="elements" to get a structured field list extracted from the CDS DDL source — shows key fields, aliases, associations, and expression types (calculated, case, cast). Useful for understanding CDS entity structure without parsing raw DDL.',
51
181
  },
52
182
  group: {
53
183
  type: 'string',
@@ -55,12 +185,19 @@ export function getToolDefinitions(config) {
55
185
  },
56
186
  method: {
57
187
  type: 'string',
58
- description: 'For SOBJ type only. BOR method name to read. If omitted, returns the full method catalog for the BOR object.',
59
- },
60
- expand_includes: {
61
- type: 'boolean',
62
- description: 'For FUGR type only. When true, expands all INCLUDE statements and returns the full source of each include inline.',
188
+ description: 'For CLAS: method name to read a single method implementation (e.g., "get_name", "zif_order~process"). ' +
189
+ 'Use "*" to list all methods with signatures and visibility. ' +
190
+ (btp ? '' : 'For SOBJ: BOR method name to read. If omitted, returns the full BOR method catalog. ') +
191
+ 'Not used with other types.',
63
192
  },
193
+ ...(btp
194
+ ? {}
195
+ : {
196
+ expand_includes: {
197
+ type: 'boolean',
198
+ description: 'For FUGR type only. When true, expands all INCLUDE statements and returns the full source of each include inline.',
199
+ },
200
+ }),
64
201
  maxRows: { type: 'number', description: 'For TABLE_CONTENTS: max rows to return (default 100)' },
65
202
  sqlFilter: { type: 'string', description: 'For TABLE_CONTENTS: SQL WHERE clause filter' },
66
203
  },
@@ -69,10 +206,7 @@ export function getToolDefinitions(config) {
69
206
  },
70
207
  {
71
208
  name: 'SAPSearch',
72
- description: 'Search for ABAP objects or search within source code. Two modes:\n' +
73
- '1. Object search (default): Search by name pattern with wildcards (* for any characters). Returns object type, name, package, description, and ADT URI. Use this to find classes, programs, function modules, tables, etc.\n' +
74
- '2. Source code search (searchType="source_code"): Full-text search within ABAP source code across the system. Use this to find all objects containing a specific string (e.g., a method call, variable name, or class reference). Requires SAP_BASIS ≥ 7.51.\n\n' +
75
- 'Tips: BOR business objects appear as SOBJ type in results. The uri field from results can be used directly with SAPNavigate for references.',
209
+ description: btp ? SAPSEARCH_DESC_BTP : SAPSEARCH_DESC_ONPREM,
76
210
  inputSchema: {
77
211
  type: 'object',
78
212
  properties: {
@@ -100,14 +234,26 @@ export function getToolDefinitions(config) {
100
234
  if (!config.readOnly) {
101
235
  tools.push({
102
236
  name: 'SAPWrite',
103
- description: 'Create or update ABAP source code. Handles lock/modify/unlock automatically. Supports PROG, CLAS, INTF, FUNC, INCL.',
237
+ description: btp ? SAPWRITE_DESC_BTP : SAPWRITE_DESC_ONPREM,
104
238
  inputSchema: {
105
239
  type: 'object',
106
240
  properties: {
107
- action: { type: 'string', enum: ['create', 'update', 'delete'], description: 'Write action' },
108
- type: { type: 'string', enum: ['PROG', 'CLAS', 'INTF', 'FUNC', 'INCL'], description: 'Object type' },
241
+ action: {
242
+ type: 'string',
243
+ enum: ['create', 'update', 'delete', 'edit_method'],
244
+ description: 'Write action. edit_method: surgically replace a single method body (requires type=CLAS, method, and source params)',
245
+ },
246
+ type: {
247
+ type: 'string',
248
+ enum: btp ? SAPWRITE_TYPES_BTP : SAPWRITE_TYPES_ONPREM,
249
+ description: 'Object type',
250
+ },
109
251
  name: { type: 'string', description: 'Object name' },
110
- source: { type: 'string', description: 'ABAP source code (for create/update)' },
252
+ source: { type: 'string', description: 'ABAP source code (for create/update/edit_method)' },
253
+ method: {
254
+ type: 'string',
255
+ description: 'For edit_method action: method name to replace (e.g., "get_name", "zif_order~process")',
256
+ },
111
257
  package: { type: 'string', description: 'Package for new objects (default $TMP)' },
112
258
  transport: { type: 'string', description: 'Transport request number (for transportable packages)' },
113
259
  },
@@ -116,20 +262,36 @@ export function getToolDefinitions(config) {
116
262
  });
117
263
  tools.push({
118
264
  name: 'SAPActivate',
119
- description: 'Activate (publish) ABAP objects. Activates the object and reports any activation errors.',
265
+ description: 'Activate (publish) ABAP objects. Supports single object or batch activation.\n' +
266
+ 'For batch: pass "objects" array with {type, name} entries to activate multiple objects in one call. ' +
267
+ 'Essential for RAP stacks where DDLS, BDEF, SRVD, DDLX, and SRVB depend on each other and must be activated together.',
120
268
  inputSchema: {
121
269
  type: 'object',
122
270
  properties: {
123
- name: { type: 'string', description: 'Object name to activate' },
124
- type: { type: 'string', description: 'Object type (PROG, CLAS, etc.)' },
271
+ name: { type: 'string', description: 'Object name (for single activation)' },
272
+ type: { type: 'string', description: 'Object type (PROG, CLAS, DDLS, DDLX, BDEF, SRVD, SRVB, etc.)' },
273
+ objects: {
274
+ type: 'array',
275
+ items: {
276
+ type: 'object',
277
+ properties: {
278
+ type: { type: 'string', description: 'Object type' },
279
+ name: { type: 'string', description: 'Object name' },
280
+ },
281
+ required: ['type', 'name'],
282
+ },
283
+ description: 'For batch activation: array of objects to activate together. ' +
284
+ 'Use for RAP stacks: [{type:"DDLS",name:"ZI_TRAVEL"},{type:"BDEF",name:"ZI_TRAVEL"},{type:"SRVD",name:"ZSD_TRAVEL"}]',
285
+ },
125
286
  },
126
- required: ['name', 'type'],
127
287
  },
128
288
  });
129
289
  }
130
290
  tools.push({
131
291
  name: 'SAPNavigate',
132
- description: 'Navigate code: find definitions, references, and code completion. Use for "go to definition", "where is this used?", and auto-complete. For references: you can use type+name instead of uri (e.g., type="CLAS", name="ZCL_ORDER") for a where-used list without needing the full ADT URI.',
292
+ description: btp
293
+ ? 'Navigate code (BTP ABAP Environment): find definitions, references (where-used), and code completion. Use for "go to definition", "where is this used?", and auto-complete. For references: uses the full scope-based Where-Used API returning detailed results with line numbers, snippets, and package info. Optional objectType filter narrows results to a specific ADT type in slash format (e.g., CLAS/OC, PROG/P). On BTP, navigation scope is limited to released SAP objects and custom Z/Y objects.'
294
+ : 'Navigate code: find definitions, references (where-used), and code completion. Use for "go to definition", "where is this used?", and auto-complete. For references: uses the full scope-based Where-Used API returning detailed results with line numbers, snippets, and package info. Optional objectType filter narrows results to a specific ADT type in slash format (e.g., CLAS/OC, PROG/P). You can use type+name instead of uri (e.g., type="CLAS", name="ZCL_ORDER") for a where-used list without needing the full ADT URI.',
133
295
  inputSchema: {
134
296
  type: 'object',
135
297
  properties: {
@@ -147,6 +309,10 @@ export function getToolDefinitions(config) {
147
309
  description: 'Object type (PROG, CLAS, INTF, FUNC, etc.) — alternative to uri for references.',
148
310
  },
149
311
  name: { type: 'string', description: 'Object name — alternative to uri for references.' },
312
+ objectType: {
313
+ type: 'string',
314
+ description: 'For references action: filter where-used results by ADT object type in slash format (e.g., PROG/P, CLAS/OC, FUNC/FM, INTF/OI). On systems supporting the scope endpoint, only returns references from objects of the specified type. On older systems, the filter is ignored and all references are returned with a note.',
315
+ },
150
316
  line: { type: 'number', description: 'Line number (1-based)' },
151
317
  column: { type: 'number', description: 'Column number (1-based)' },
152
318
  source: { type: 'string', description: 'Current source code (for definition/completion)' },
@@ -155,10 +321,7 @@ export function getToolDefinitions(config) {
155
321
  },
156
322
  }, {
157
323
  name: 'SAPQuery',
158
- description: 'Execute ABAP SQL queries against SAP tables. Returns structured data with column names and rows. ' +
159
- 'Powerful for reverse-engineering: query metadata tables like DD02L (table catalog), DD03L (field catalog), ' +
160
- 'SWOTLV (BOR method implementations), TADIR (object directory), TFDIR (function modules). ' +
161
- 'If a table is not found, similar table names will be suggested automatically.',
324
+ description: btp ? SAPQUERY_DESC_BTP : SAPQUERY_DESC_ONPREM,
162
325
  inputSchema: {
163
326
  type: 'object',
164
327
  properties: {
@@ -169,58 +332,82 @@ export function getToolDefinitions(config) {
169
332
  },
170
333
  }, {
171
334
  name: 'SAPLint',
172
- description: 'Check ABAP code quality. Runs abaplint rules locally and/or ATC checks on the SAP system.',
335
+ description: 'Run local abaplint rules on ABAP source code. System-aware: auto-selects cloud or on-prem rules based on detected system type.\n\n' +
336
+ 'Actions:\n' +
337
+ '- "lint": Check ABAP source for issues. Returns errors and warnings.\n' +
338
+ '- "lint_and_fix": Lint + auto-fix all fixable issues (keyword case, obsolete statements, etc.). Returns fixed source.\n' +
339
+ '- "list_rules": List all available rules with current config. No source needed.\n\n' +
340
+ 'For server-side checks (ATC, syntax check, unit tests), use SAPDiagnose instead.',
173
341
  inputSchema: {
174
342
  type: 'object',
175
343
  properties: {
176
- action: { type: 'string', enum: ['lint', 'atc', 'syntax'], description: 'Check type' },
177
- source: { type: 'string', description: 'ABAP source code (for lint)' },
178
- name: { type: 'string', description: 'Object name (for atc/syntax)' },
179
- type: { type: 'string', description: 'Object type (for atc/syntax)' },
344
+ action: {
345
+ type: 'string',
346
+ enum: ['lint', 'lint_and_fix', 'list_rules'],
347
+ description: 'Check type',
348
+ },
349
+ source: { type: 'string', description: 'ABAP source code to lint (not needed for list_rules)' },
350
+ name: { type: 'string', description: 'Object name (used for filename detection)' },
351
+ rules: {
352
+ type: 'object',
353
+ description: 'Rule overrides: { "rule_name": false } to disable, { "rule_name": { "severity": "Warning" } } to configure. Overrides system defaults.',
354
+ },
180
355
  },
181
356
  required: ['action'],
182
357
  },
183
358
  }, {
184
359
  name: 'SAPDiagnose',
185
- description: 'Run diagnostics on ABAP objects: syntax check, ABAP unit tests, and ATC (ABAP Test Cockpit) code quality checks.',
360
+ description: 'Run diagnostics on ABAP objects and analyze runtime errors.\n\n' +
361
+ 'Actions:\n' +
362
+ '- "syntax": Syntax check an ABAP object. Requires name + type.\n' +
363
+ '- "unittest": Run ABAP unit tests. Requires name + type.\n' +
364
+ '- "atc": Run ATC code quality checks. Requires name + type. Optional: variant.\n' +
365
+ '- "dumps": List or read ABAP short dumps (ST22). Without id: lists recent dumps (filter by user, maxResults). With id: returns full dump detail including formatted text, error analysis, source code extract, and call stack.\n' +
366
+ '- "traces": List or analyze ABAP profiler traces. Without id: lists trace files. With id + analysis: returns trace analysis (hitlist = hot spots, statements = call tree, dbAccesses = database access statistics).',
186
367
  inputSchema: {
187
368
  type: 'object',
188
369
  properties: {
189
370
  action: {
190
371
  type: 'string',
191
- enum: ['syntax', 'unittest', 'atc'],
372
+ enum: ['syntax', 'unittest', 'atc', 'dumps', 'traces'],
192
373
  description: 'Diagnostic action',
193
374
  },
194
- name: { type: 'string', description: 'Object name' },
195
- type: { type: 'string', description: 'Object type (PROG, CLAS, etc.)' },
375
+ name: { type: 'string', description: 'Object name (for syntax/unittest/atc)' },
376
+ type: { type: 'string', description: 'Object type (PROG, CLAS, etc.) (for syntax/unittest/atc)' },
196
377
  variant: { type: 'string', description: 'ATC check variant (for atc action)' },
378
+ id: {
379
+ type: 'string',
380
+ description: 'Dump or trace ID (for dumps/traces actions). Omit to list, provide to get details.',
381
+ },
382
+ user: { type: 'string', description: 'Filter dumps by SAP user (for dumps action)' },
383
+ maxResults: { type: 'number', description: 'Maximum results to return (for dumps action, default 50)' },
384
+ analysis: {
385
+ type: 'string',
386
+ enum: ['hitlist', 'statements', 'dbAccesses'],
387
+ description: 'Trace analysis type (for traces action with id). hitlist = execution hot spots, statements = call tree, dbAccesses = database access stats.',
388
+ },
197
389
  },
198
- required: ['action', 'name', 'type'],
390
+ required: ['action'],
199
391
  },
200
392
  });
201
393
  // SAPContext — always available (read-only tool)
202
394
  tools.push({
203
395
  name: 'SAPContext',
204
- description: 'Get compressed dependency context for an ABAP object. Returns only the public API contracts ' +
205
- '(method signatures, interface definitions, type declarations) of all objects that the target depends on — ' +
206
- 'NOT the full source code. This is the most token-efficient way to understand dependencies. ' +
207
- 'Instead of N separate SAPRead calls returning full source (~200 lines each), SAPContext returns ONE response ' +
208
- 'with compressed contracts (~15-30 lines each). Typical compression: 7-30x fewer tokens.\n\n' +
209
- 'What gets extracted per dependency:\n' +
210
- '- Classes: CLASS DEFINITION with PUBLIC SECTION only (methods, types, constants). PROTECTED, PRIVATE and IMPLEMENTATION stripped.\n' +
211
- '- Interfaces: Full interface definition (interfaces are already public contracts).\n' +
212
- '- Function modules: FUNCTION signature block only (IMPORTING/EXPORTING parameters).\n\n' +
213
- 'Filtering: SAP standard objects (CL_ABAP_*, IF_ABAP_*, CX_SY_*) are excluded — the LLM already knows standard SAP APIs. ' +
214
- 'Custom objects (Z*, Y*) are prioritized.\n\n' +
215
- 'Use SAPContext BEFORE writing code that modifies or extends existing objects. ' +
216
- 'Use SAPRead to get the full source of the target object, then SAPContext to understand its dependencies.',
396
+ description: btp ? SAPCONTEXT_DESC_BTP : SAPCONTEXT_DESC_ONPREM,
217
397
  inputSchema: {
218
398
  type: 'object',
219
399
  properties: {
400
+ action: {
401
+ type: 'string',
402
+ enum: ['deps', 'usages'],
403
+ description: 'Action: "deps" (default, can be omitted) = get dependency context. ' +
404
+ '"usages" = reverse dependency lookup — find all objects that depend on the given name. ' +
405
+ 'Requires cache warmup (--cache-warmup). Only "name" is needed for usages.',
406
+ },
220
407
  type: {
221
408
  type: 'string',
222
- enum: ['CLAS', 'INTF', 'PROG', 'FUNC'],
223
- description: 'Object type',
409
+ enum: btp ? SAPCONTEXT_TYPES_BTP : SAPCONTEXT_TYPES_ONPREM,
410
+ description: 'Object type (required for deps action)',
224
411
  },
225
412
  name: {
226
413
  type: 'string',
@@ -231,10 +418,14 @@ export function getToolDefinitions(config) {
231
418
  description: 'Optional: provide source directly instead of fetching from SAP. ' +
232
419
  'Saves one round-trip if you already have the source from SAPRead.',
233
420
  },
234
- group: {
235
- type: 'string',
236
- description: 'Required for FUNC type. The function group containing the function module.',
237
- },
421
+ ...(btp
422
+ ? {}
423
+ : {
424
+ group: {
425
+ type: 'string',
426
+ description: 'Required for FUNC type. The function group containing the function module.',
427
+ },
428
+ }),
238
429
  maxDeps: {
239
430
  type: 'number',
240
431
  description: 'Maximum dependencies to resolve (default 20). Lower = faster + fewer tokens.',
@@ -245,29 +436,21 @@ export function getToolDefinitions(config) {
245
436
  'Higher depth = more context but more SAP calls.',
246
437
  },
247
438
  },
248
- required: ['type', 'name'],
439
+ required: ['name'],
249
440
  },
250
441
  });
251
442
  // SAPManage — registered when not in read-only mode
252
443
  if (!config.readOnly) {
253
444
  tools.push({
254
445
  name: 'SAPManage',
255
- description: 'Probe and report SAP system capabilities. Use this BEFORE attempting operations that depend on optional ' +
256
- 'features (abapGit, RAP/CDS, AMDP, HANA, UI5/Fiori, CTS transports).\n\n' +
257
- 'Actions:\n' +
258
- '- "features": Get cached feature status from last probe (fast, no SAP round-trip). ' +
259
- 'Returns which features are available, their mode (auto/on/off), and when they were last probed.\n' +
260
- '- "probe": Re-probe the SAP system now (makes 6 parallel HEAD requests, ~1-2s). ' +
261
- 'Use this on first use or if you suspect feature availability has changed.\n\n' +
262
- 'Returns JSON with 6 features, each having: id, available (bool), mode, message, and probedAt timestamp. ' +
263
- '"available: false" means do NOT attempt operations that depend on it.',
446
+ description: btp ? SAPMANAGE_DESC_BTP : SAPMANAGE_DESC_ONPREM,
264
447
  inputSchema: {
265
448
  type: 'object',
266
449
  properties: {
267
450
  action: {
268
451
  type: 'string',
269
- enum: ['features', 'probe'],
270
- description: 'Action: "features" for cached status, "probe" to re-check SAP system',
452
+ enum: ['features', 'probe', 'cache_stats'],
453
+ description: 'Action: "features" for cached status, "probe" to re-check SAP system, "cache_stats" for object cache statistics',
271
454
  },
272
455
  },
273
456
  required: ['action'],
@@ -278,7 +461,7 @@ export function getToolDefinitions(config) {
278
461
  if (config.enableTransports || !config.readOnly) {
279
462
  tools.push({
280
463
  name: 'SAPTransport',
281
- description: 'Manage CTS transport requests: list, get details, create, and release.',
464
+ description: btp ? SAPTRANSPORT_DESC_BTP : SAPTRANSPORT_DESC_ONPREM,
282
465
  inputSchema: {
283
466
  type: 'object',
284
467
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../ts-src/handlers/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,MAAM,KAAK,GAAqB;QAC9B;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EACT,4pBAA4pB;YAC9pB,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE;4BACJ,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,MAAM;4BACN,gBAAgB;4BAChB,MAAM;4BACN,MAAM;4BACN,QAAQ;4BACR,YAAY;4BACZ,UAAU;4BACV,eAAe;4BACf,UAAU;yBACX;wBACD,WAAW,EAAE,qBAAqB;qBACnC;oBACD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oDAAoD,EAAE;oBAC3F,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AI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE;oBACvG,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;oBAC7E,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;oBACxE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;iBACnE;gBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts-src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts-src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,mDAAmD;AACnD,MAAM,EAAE,CAAC;AAET,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,mDAAmD;AACnD,MAAM,EAAE,CAAC;AAET,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,oBAAoB,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * abaplint configuration builder for ARC-1.
3
+ *
4
+ * Builds an @abaplint/core Config by layering:
5
+ * 1. Base: Default config for the detected ABAP version
6
+ * 2. Preset: Cloud or on-prem rule overrides (disable noisy rules, set severities)
7
+ * 3. User: Custom rule overrides from config file or tool args
8
+ *
9
+ * This replaces the hardcoded `Config.getDefault(Version.v702)` with
10
+ * a system-aware, customizable configuration.
11
+ *
12
+ * Architecture note: We start from abaplint's full default config (181 rules)
13
+ * and selectively disable/adjust rules rather than building from scratch.
14
+ * This ensures we benefit from new rules added in abaplint updates while
15
+ * keeping our curated severity levels and disabled-rule list.
16
+ *
17
+ * The cloud vs on-prem distinction is primarily about:
18
+ * - syntax.version: Cloud vs v702-v758 (controls which ABAP syntax is valid)
19
+ * - cloud_types rule: blocks PROG/FORM/etc. that don't exist in BTP
20
+ * - strict_sql rule: enforces strict Open SQL (cloud requirement)
21
+ * - obsolete_statement severity: Error on cloud (won't compile), Warning on-prem (advisory)
22
+ */
23
+ import { Config } from '@abaplint/core';
24
+ import type { SystemType } from '../adt/types.js';
25
+ /** Rule override: true to enable with defaults, false to disable, or object with config */
26
+ export type RuleOverrides = Record<string, boolean | Record<string, unknown>>;
27
+ /** Options for building an abaplint config */
28
+ export interface LintConfigOptions {
29
+ /** SAP system type: 'btp' or 'onprem' */
30
+ systemType?: SystemType;
31
+ /** SAP_BASIS release string (e.g., "757") */
32
+ abapRelease?: string;
33
+ /** Path to custom abaplint.jsonc config file */
34
+ configFile?: string;
35
+ /** Inline rule overrides (from tool call args) */
36
+ ruleOverrides?: RuleOverrides;
37
+ }
38
+ /**
39
+ * Build an abaplint Config from system metadata and user overrides.
40
+ *
41
+ * Resolution order (each layer overrides the previous):
42
+ * 1. Default config for the ABAP version
43
+ * 2. System preset (cloud or on-prem) — disables noisy rules, sets severities
44
+ * 3. User config file (if provided)
45
+ * 4. Inline rule overrides (if provided)
46
+ */
47
+ export declare function buildLintConfig(options?: LintConfigOptions): Config;
48
+ /**
49
+ * Build a "pre-write" config — a strict subset of rules that should
50
+ * block writes when they fail. Only includes correctness rules,
51
+ * not style/formatting.
52
+ */
53
+ export declare function buildPreWriteConfig(options?: LintConfigOptions): Config;
54
+ /** List all available rules with their current config from a Config object */
55
+ export declare function listRulesFromConfig(config: Config): Array<{
56
+ rule: string;
57
+ enabled: boolean;
58
+ severity?: string;
59
+ }>;
60
+ //# sourceMappingURL=config-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-builder.d.ts","sourceRoot":"","sources":["../../src/lint/config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,MAAM,EAAW,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,2FAA2F;AAC3F,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9E,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAoBvE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAoD3E;AA4ED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAUhH"}