@sixbell-telco/sdk-tools 0.1.3 → 0.1.5
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 +16 -0
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/cli.mjs +2 -2
- package/src/mcp/catalog.mjs +12 -0
- package/src/mcp/server.mjs +3 -0
- package/src/mcp/usage.mjs +37 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.5] - 2026-12-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **mcp**: `get_tokens` returns `radiusUsage`, the radius-by-role rule, and names `rounded-inner` when the installed SDK has it
|
|
15
|
+
|
|
16
|
+
## [0.1.4] - 2026-11-19
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **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
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **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`
|
|
25
|
+
|
|
10
26
|
## [0.1.3] - 2026-11-19
|
|
11
27
|
|
|
12
28
|
### 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 |
|
|
@@ -131,7 +131,7 @@ A component repo set (the `.mcp.json` at the component root, the app in `mfe/`)
|
|
|
131
131
|
| `list_components` | Every component, directive and pipe: selector, class, kind, entry point, one-line description (`kind` filters) |
|
|
132
132
|
| `search_components` | The best matches for a need in a few words (`"confirm dialog"`) |
|
|
133
133
|
| `get_component` | One component: inputs with allowed values and defaults, outputs, slots, import line, a starting template, related components, stories, do and don't |
|
|
134
|
-
| `get_tokens` | Theme tokens by group (color, radius, shadow, ease, animate, font, text)
|
|
134
|
+
| `get_tokens` | Theme tokens by group (color, radius, shadow, ease, animate, font, text), the deprecated ones with their replacements and radius by role (`rounded-inner` in a card) |
|
|
135
135
|
| `check_usage` | `check`'s lint findings (kit API and design rules) for a `file` in the app or a `snippet` (template or component source). No type check |
|
|
136
136
|
| `get_recipe` | A step-by-step recipe; with no `id`, the list: `custom-component` (a local kit candidate) and the `add` recipes with the `files` they write |
|
|
137
137
|
| `get_upgrade_guide` | For `from` and `to` (at most the installed version; `3.x` works): the migrations that would run, the steps no migration applies and the changelog consumer-upgrade steps |
|
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.5",
|
|
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/catalog.mjs
CHANGED
|
@@ -223,6 +223,17 @@ export function getComponent(manifest, query) {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Radius by role, naming only the utilities the installed SDK has (`rounded-inner` arrived later).
|
|
228
|
+
* @param {string[]} utilities
|
|
229
|
+
*/
|
|
230
|
+
function radiusUsage(utilities) {
|
|
231
|
+
const inner = utilities.includes('rounded-inner')
|
|
232
|
+
? ' A surface with its own background inside a card (image, iframe, chart, nested panel in st-card-body) takes rounded-inner: concentric, card radius minus card padding, never below rounded-selector.'
|
|
233
|
+
: '';
|
|
234
|
+
return `Radius by role: rounded-box for surfaces (card, panel, dialog, popover), rounded-field for controls (button, input, select, tab), rounded-selector for compact status (badge, chip, checkbox).${inner} Never override the --radius-* tokens in the app.`;
|
|
235
|
+
}
|
|
236
|
+
|
|
226
237
|
/**
|
|
227
238
|
* The theme tokens, by group, with their Tailwind utilities and the deprecated aliases.
|
|
228
239
|
* @param {Manifest} manifest
|
|
@@ -242,6 +253,7 @@ export function getTokens(manifest, { group } = {}) {
|
|
|
242
253
|
colorUsage: `Color tokens go after a color utility prefix: ${(manifest.colorUtilities ?? ['bg', 'text', 'border']).join(', ')}. Example: bg-base-200 text-base-content border-base-300. Status text uses the -strong tokens (text-error-strong).`,
|
|
243
254
|
}
|
|
244
255
|
: {}),
|
|
256
|
+
...(byGroup.radius ? { radiusUsage: radiusUsage(byGroup.radius) } : {}),
|
|
245
257
|
groups: byGroup,
|
|
246
258
|
deprecated: selected.filter((t) => t.deprecated).map((t) => ({ token: t.name, replacement: t.deprecated?.replacement })),
|
|
247
259
|
};
|
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
|
}
|