@sixbell-telco/sdk-tools 0.1.3 → 0.1.4
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/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/cli.mjs +2 -2
- package/src/mcp/server.mjs +3 -0
- package/src/mcp/usage.mjs +37 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.4] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **mcp**: a server stopped while `check_usage` lints a snippet no longer leaves a `.sdk-tools-snippet-*` folder in the app, and a later snippet check removes folders a killed server left more than 10 minutes ago
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **mcp**: the README and `mcp --help` start a component root's server with `node` and the app's installed sdk-tools (about 35 ms) instead of `npx --prefix`
|
|
19
|
+
|
|
10
20
|
## [0.1.3] - 2026-11-19
|
|
11
21
|
|
|
12
22
|
### Changed
|
package/README.md
CHANGED
|
@@ -120,10 +120,10 @@ Add it to the app's `.mcp.json`:
|
|
|
120
120
|
{ "mcpServers": { "SixbellSdk": { "command": "npx", "args": ["@sixbell-telco/sdk-tools", "mcp"] } } }
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
A component repo set (the `.mcp.json` at the component root, the app in `mfe/`) runs the `sdk-tools` the app already has as a devDependency
|
|
123
|
+
A component repo set (the `.mcp.json` at the component root, the app in `mfe/`) runs the `sdk-tools` the app already has as a devDependency with `node`. It answers in about 35 ms and never downloads the package; on a cold npx cache, `npx -y` can pass an agent host's start limit (Claude Code gives up after 30 seconds). The path is relative to the folder the session opens in:
|
|
124
124
|
|
|
125
125
|
```json
|
|
126
|
-
{ "mcpServers": { "SixbellSdk": { "command": "
|
|
126
|
+
{ "mcpServers": { "SixbellSdk": { "command": "node", "args": ["mfe/node_modules/@sixbell-telco/sdk-tools/src/cli.mjs", "mcp", "--cwd", "mfe"] } } }
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
| Tool | Returns |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixbell-telco/sdk-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "CLI and MCP server for apps built with @sixbell-telco/sdk: check templates, imports and types against the installed SDK, and create or upgrade MFEs from their template repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/cli.mjs
CHANGED
|
@@ -133,8 +133,8 @@ const VERBS = {
|
|
|
133
133
|
'Example (.mcp.json of an app):',
|
|
134
134
|
' { "mcpServers": { "SixbellSdk": { "command": "npx", "args": ["@sixbell-telco/sdk-tools", "mcp"] } } }',
|
|
135
135
|
"Example (.mcp.json of a component root, app in mfe/; runs the app's installed sdk-tools):",
|
|
136
|
-
' { "mcpServers": { "SixbellSdk": { "command": "
|
|
137
|
-
' "args": ["
|
|
136
|
+
' { "mcpServers": { "SixbellSdk": { "command": "node",',
|
|
137
|
+
' "args": ["mfe/node_modules/@sixbell-telco/sdk-tools/src/cli.mjs", "mcp", "--cwd", "mfe"] } } }',
|
|
138
138
|
].join('\n'),
|
|
139
139
|
options: {
|
|
140
140
|
cwd: { type: 'string' },
|
package/src/mcp/server.mjs
CHANGED
|
@@ -243,5 +243,8 @@ function createServer({ cwd: start, explicit = false, manifestPath }) {
|
|
|
243
243
|
*/
|
|
244
244
|
export async function serve(options) {
|
|
245
245
|
console.log = console.info = console.debug = console.error;
|
|
246
|
+
// A host stops the server with a signal; exiting normally runs the exit handlers, which remove a
|
|
247
|
+
// snippet folder check_usage is still linting.
|
|
248
|
+
for (const signal of /** @type {const} */ (['SIGTERM', 'SIGINT', 'SIGHUP'])) process.once(signal, () => process.exit(0));
|
|
246
249
|
await createServer(options).serve(process.stdin, process.stdout);
|
|
247
250
|
}
|
package/src/mcp/usage.mjs
CHANGED
|
@@ -4,12 +4,44 @@
|
|
|
4
4
|
* engine (ESLint only lints files under the app's folder, and the design rules need the app's
|
|
5
5
|
* Tailwind entry), and removed, so its findings equal `sdk-tools check <file> --no-typecheck`.
|
|
6
6
|
*/
|
|
7
|
-
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { mkdtempSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
8
8
|
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
9
9
|
import { check } from '../check.mjs';
|
|
10
10
|
|
|
11
11
|
/** @typedef {import('../types.js').CheckResult} CheckResult */
|
|
12
12
|
|
|
13
|
+
const SNIPPET_PREFIX = '.sdk-tools-snippet-';
|
|
14
|
+
/** A snippet folder older than this was left by a server that was killed mid-check. */
|
|
15
|
+
const STALE_MS = 10 * 60 * 1000;
|
|
16
|
+
|
|
17
|
+
/** Snippet folders being linted now; removed on exit if the check never got to its finally. */
|
|
18
|
+
const live = new Set();
|
|
19
|
+
process.once('exit', () => {
|
|
20
|
+
for (const dir of live) rmSync(dir, { recursive: true, force: true });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Removes snippet folders in `cwd` that a killed server left behind (SIGKILL, a crash). Only old
|
|
25
|
+
* ones: a newer folder may belong to another server checking right now.
|
|
26
|
+
* @param {string} cwd
|
|
27
|
+
*/
|
|
28
|
+
function sweepStale(cwd) {
|
|
29
|
+
let names;
|
|
30
|
+
try {
|
|
31
|
+
names = readdirSync(cwd).filter((name) => name.startsWith(SNIPPET_PREFIX));
|
|
32
|
+
} catch {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
for (const name of names) {
|
|
36
|
+
const dir = join(cwd, name);
|
|
37
|
+
try {
|
|
38
|
+
if (Date.now() - statSync(dir).mtimeMs > STALE_MS) rmSync(dir, { recursive: true, force: true });
|
|
39
|
+
} catch {
|
|
40
|
+
// gone already
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
13
45
|
/**
|
|
14
46
|
* `ts` for a component file (a `@Component(` decorator or an import), `html` otherwise.
|
|
15
47
|
* @param {string} snippet
|
|
@@ -33,7 +65,9 @@ export async function checkUsage({ cwd, manifestPath, file, snippet, language })
|
|
|
33
65
|
return { checked: rel, ...result };
|
|
34
66
|
}
|
|
35
67
|
const name = `snippet.component.${language ?? snippetLanguage(snippet ?? '')}`;
|
|
36
|
-
|
|
68
|
+
sweepStale(cwd);
|
|
69
|
+
const dir = mkdtempSync(join(cwd, SNIPPET_PREFIX));
|
|
70
|
+
live.add(dir);
|
|
37
71
|
try {
|
|
38
72
|
writeFileSync(join(dir, name), snippet ?? '');
|
|
39
73
|
const result = await check({ cwd, paths: [relative(cwd, dir)], typecheck: false, manifestPath });
|
|
@@ -44,5 +78,6 @@ export async function checkUsage({ cwd, manifestPath, file, snippet, language })
|
|
|
44
78
|
};
|
|
45
79
|
} finally {
|
|
46
80
|
rmSync(dir, { recursive: true, force: true });
|
|
81
|
+
live.delete(dir);
|
|
47
82
|
}
|
|
48
83
|
}
|