@mcp-abap-adt/compact 14.0.0 → 14.0.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 CHANGED
@@ -31,10 +31,17 @@ smaller install, and it is not a sandbox — code that deliberately reaches into
31
31
 
32
32
  ```bash
33
33
  npm install -g @mcp-abap-adt/compact
34
- mcp-abap-adt-compact # stdio, the 22 compact tools and nothing else
34
+ mcp-abap-adt-compact # stdio, all 22 compact tools
35
+ mcp-abap-adt-compact --exposition=ro # the 13 that change nothing
35
36
  mcp-abap-adt-compact --version
36
37
  ```
37
38
 
39
+ `--exposition` takes **`rw`** (the default — all 22 tools, every access, which is
40
+ what a local server gives) or **`ro`** (the 13 tools that change nothing: no create,
41
+ update, delete, activate, lock, unlock, unit-test run or profiler run is in the tool
42
+ list at all, so a client cannot call one). The object-oriented sets
43
+ `readonly`/`high`/`low` belong to `mcp-abap-adt` and are refused here by name.
44
+
38
45
  Configuration — connection, authentication, transports — is the same as
39
46
  `mcp-abap-adt`'s, because the launcher is the same one: this command passes its own
40
47
  tool list to `@mcp-abap-adt/core`'s launcher rather than reimplementing it. The
@@ -1,2 +1,19 @@
1
+ /** What `--exposition` means here. `rw` is the default: locally, every access. */
2
+ export type CompactExposition = 'ro' | 'rw';
3
+ /**
4
+ * Read `--exposition` from argv, in both spellings.
5
+ *
6
+ * `--exposition=ro` and `--exposition ro`; anything else is refused by name rather
7
+ * than falling back to a default, because starting with a different tool list than
8
+ * the one that was asked for is the failure this is meant to prevent.
9
+ *
10
+ * **The default belongs to an ABSENT flag, never to an empty value.** The first
11
+ * version treated the two alike, so `--exposition="$MODE"` with an unset variable
12
+ * opened all 22 tools — writes included — and `--exposition=ro --exposition=`
13
+ * overrode a deliberate `ro` the same way (found in review on PR #247). A flag that
14
+ * is present but says nothing is a caller who meant something and lost it in a
15
+ * shell; the only safe answer is to refuse.
16
+ */
17
+ export declare function parseCompactExposition(argv: readonly string[]): CompactExposition;
1
18
  export declare function main(): Promise<void>;
2
19
  //# sourceMappingURL=launcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAmBA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuB1C"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAyBA,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;AAsB5C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,iBAAiB,CA2BnB;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuC1C"}
package/dist/launcher.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCompactExposition = parseCompactExposition;
3
4
  exports.main = main;
4
5
  /**
5
6
  * The compact command: the same server, a different decomposition of its tool list.
@@ -7,18 +8,84 @@ exports.main = main;
7
8
  * `@mcp-abap-adt/core` owns the launcher — configuration, transports, auth, the
8
9
  * request context — and this command calls it with the compact groups instead of the
9
10
  * object-oriented ones. Nothing is copied: `main` takes `extraGroups`, an
10
- * `exposition` and `includeSearch`, which is all a second command needs.
11
+ * `exposition`, `includeSearch`, the command's `program` name and its own
12
+ * `helpExposition` section, which is all a second command needs.
11
13
  *
12
14
  * **Why a command at all**, rather than a flag on the first one: the host this is
13
15
  * for cannot build a retrieval pipeline and must be handed a tool list short by
14
- * construction. A flag can be forgotten or mistyped; a command whose default IS the
15
- * compact list cannot be. `core` refuses `--exposition=compact` now and says to
16
- * install this.
16
+ * construction. `core` refuses `--exposition=compact` now and says to install this.
17
17
  *
18
- * The list is exactly the 22 compact tools: no `readonly`/`high`/`low` set, and the
19
- * search tools left out too, because "a tool list of a known size" is the point.
18
+ * **And why this command has an exposition of its own.** The two halves of the
19
+ * facade are a real choice for whoever starts the server: `rw` serves all 22 tools,
20
+ * `ro` serves the 13 that change nothing — no create, update, delete, activate,
21
+ * lock, unlock, unit-test run or profiler run anywhere in the list. Locally the
22
+ * default gives every access (`rw`); `ro` is there for a host that means to hand out
23
+ * a surface which cannot change the system. The vocabulary is deliberately NOT
24
+ * `readonly/high/low`: those are sets of the object-oriented surface, which this
25
+ * command does not serve.
20
26
  */
27
+ const compact_readonly_1 = require("@mcp-abap-adt/compact-readonly");
21
28
  const group_1 = require("./group");
29
+ const HELP_EXPOSITION = `
30
+ HANDLER EXPOSITION:
31
+ --exposition=<set> Which half of the compact facade to serve
32
+ Options: ro, rw
33
+ Default: rw
34
+
35
+ - rw: all 22 tools — HandlerGet, HandlerCreate,
36
+ HandlerUpdate, HandlerDelete,
37
+ HandlerActivate, HandlerLock, ...
38
+ - ro: the 13 that change nothing. No create,
39
+ update, delete, activate, lock, unlock,
40
+ unit-test run or profiler run is in the
41
+ list at all, so a client cannot call one.
42
+
43
+ The object-oriented sets (readonly, high, low)
44
+ belong to \`mcp-abap-adt\`; this command serves the
45
+ compact facade only, where the OPERATION is the
46
+ tool and the object goes in \`object_type\`.
47
+ `;
48
+ /**
49
+ * Read `--exposition` from argv, in both spellings.
50
+ *
51
+ * `--exposition=ro` and `--exposition ro`; anything else is refused by name rather
52
+ * than falling back to a default, because starting with a different tool list than
53
+ * the one that was asked for is the failure this is meant to prevent.
54
+ *
55
+ * **The default belongs to an ABSENT flag, never to an empty value.** The first
56
+ * version treated the two alike, so `--exposition="$MODE"` with an unset variable
57
+ * opened all 22 tools — writes included — and `--exposition=ro --exposition=`
58
+ * overrode a deliberate `ro` the same way (found in review on PR #247). A flag that
59
+ * is present but says nothing is a caller who meant something and lost it in a
60
+ * shell; the only safe answer is to refuse.
61
+ */
62
+ function parseCompactExposition(argv) {
63
+ let seen = false;
64
+ let value;
65
+ for (let index = 0; index < argv.length; index += 1) {
66
+ const arg = argv[index];
67
+ if (arg === '--exposition') {
68
+ seen = true;
69
+ const next = argv[index + 1];
70
+ // `--exposition --transport=stdio` gives the flag no value of its own.
71
+ value = next !== undefined && !next.startsWith('-') ? next : undefined;
72
+ }
73
+ else if (arg.startsWith('--exposition=')) {
74
+ seen = true;
75
+ value = arg.slice('--exposition='.length);
76
+ }
77
+ }
78
+ // The default belongs to an ABSENT flag, never to an empty value.
79
+ if (!seen)
80
+ return 'rw';
81
+ const wanted = (value ?? '').trim().toLowerCase();
82
+ if (wanted === 'ro' || wanted === 'rw')
83
+ return wanted;
84
+ if (wanted === '') {
85
+ throw new Error("--exposition was given no value. This command takes 'ro' (the 13 tools that change nothing) or 'rw' (all 22). An empty value is refused rather than defaulted: an unset shell variable must not silently open the write tools.");
86
+ }
87
+ throw new Error(`--exposition=${value} is not a compact set. This command takes 'ro' (the 13 tools that change nothing) or 'rw' (all 22, the default). The sets readonly/high/low belong to \`mcp-abap-adt\`.`);
88
+ }
22
89
  async function main() {
23
90
  // `--version` answers THIS package's version, not core's. The launcher core owns
24
91
  // would print its own manifest, which is the defect 13.0.0 shipped in the other
@@ -28,11 +95,24 @@ async function main() {
28
95
  console.log(manifest.version);
29
96
  return;
30
97
  }
98
+ const exposition = parseCompactExposition(process.argv.slice(2));
31
99
  const { main: launch } = require('@mcp-abap-adt/core/launcher');
32
100
  await launch({
101
+ program: 'mcp-abap-adt-compact',
102
+ helpExposition: HELP_EXPOSITION,
33
103
  exposition: [],
34
104
  includeSearch: false,
35
- extraGroups: (context) => [new group_1.CompactHandlersGroup(context)],
105
+ // Both branches build a real group, never an object literal wrapping the
106
+ // entries: the launcher sets the per-request context on the group that owns an
107
+ // entry, and only a `BaseHandlerGroup` reads `this.context` when the handler
108
+ // runs. A literal closing over the startup context is exactly the defect review
109
+ // caught on PR #240 — a server running every call against the connection it had
110
+ // before it connected.
111
+ extraGroups: (context) => [
112
+ exposition === 'ro'
113
+ ? new compact_readonly_1.CompactReadOnlyHandlersGroup(context)
114
+ : new group_1.CompactHandlersGroup(context),
115
+ ],
36
116
  });
37
117
  }
38
118
  if (require.main === module) {
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";;AAmBA,oBAuBC;AA1CD;;;;;;;;;;;;;;;;GAgBG;AACH,mCAA+C;AAExC,KAAK,UAAU,IAAI;IACxB,iFAAiF;IACjF,gFAAgF;IAChF,+EAA+E;IAC/E,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAM7D,CAAC;IAEF,MAAM,MAAM,CAAC;QACX,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,4BAAoB,CAAC,OAAO,CAAC,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CACX,gCAAgC,EAChC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src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AK,CACX,gCAAgC,EAChC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/compact",
3
- "version": "14.0.0",
3
+ "version": "14.0.1",
4
4
  "description": "The compact MCP server for SAP ABAP ADT: one tool per operation with the object in the arguments \u2014 22 tools instead of 370, for a host that cannot build a retrieval pipeline of its own.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Oleksii Kyslytsia <oleksij.kyslytsja@gmail.com>",
@@ -57,10 +57,10 @@
57
57
  "docs:tools": "node ./tools/generate-docs.js"
58
58
  },
59
59
  "dependencies": {
60
- "@mcp-abap-adt/compact-modify": "^14.0.0",
61
- "@mcp-abap-adt/compact-readonly": "^14.0.0",
62
- "@mcp-abap-adt/core": "^14.0.0",
63
- "@mcp-abap-adt/lib": "^14.0.0"
60
+ "@mcp-abap-adt/compact-modify": "^14.0.1",
61
+ "@mcp-abap-adt/compact-readonly": "^14.0.1",
62
+ "@mcp-abap-adt/core": "^14.0.1",
63
+ "@mcp-abap-adt/lib": "^14.0.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "typescript": "^6.0.2",