@viasat/beam-react-claude-plugin 2.46.0 → 2.47.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/.claude-plugin/hooks/check-version.mjs +49 -0
- package/.claude-plugin/plugin.json +14 -2
- package/README.md +32 -36
- package/package.json +1 -1
- package/skills/beam-update/SKILL.md +102 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { existsSync, writeFileSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
// Fires once per day (lock file) to avoid an npm registry call on every prompt.
|
|
7
|
+
const stamp = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
|
8
|
+
const cache = join(tmpdir(), `beam-version-check-${stamp}.lock`);
|
|
9
|
+
if (existsSync(cache)) process.exit(0);
|
|
10
|
+
|
|
11
|
+
// Write the lock before the network call so a failure still throttles to
|
|
12
|
+
// once/day instead of re-hitting npm on every prompt (worst-latency case).
|
|
13
|
+
writeFileSync(cache, '');
|
|
14
|
+
|
|
15
|
+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
16
|
+
let installed, latest;
|
|
17
|
+
try {
|
|
18
|
+
const pkgPath = join(
|
|
19
|
+
process.env.CLAUDE_PROJECT_DIR ?? process.cwd(),
|
|
20
|
+
'node_modules/@viasat/beam-react/package.json',
|
|
21
|
+
);
|
|
22
|
+
installed = JSON.parse(readFileSync(pkgPath, 'utf8')).version;
|
|
23
|
+
latest = execFileSync(
|
|
24
|
+
npm,
|
|
25
|
+
[
|
|
26
|
+
'view',
|
|
27
|
+
'@viasat/beam-react',
|
|
28
|
+
'version',
|
|
29
|
+
'--@viasat:registry=https://registry.npmjs.org',
|
|
30
|
+
'--fetch-timeout=3000',
|
|
31
|
+
'--fetch-retries=0',
|
|
32
|
+
],
|
|
33
|
+
{ encoding: 'utf8' },
|
|
34
|
+
).trim();
|
|
35
|
+
} catch {
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (installed !== latest) {
|
|
40
|
+
process.stdout.write(
|
|
41
|
+
JSON.stringify({
|
|
42
|
+
systemMessage: `⚠️ beam-react ${installed} installed, ${latest} available. Run /beam-update to upgrade.`,
|
|
43
|
+
hookSpecificOutput: {
|
|
44
|
+
hookEventName: 'UserPromptSubmit',
|
|
45
|
+
additionalContext: `@viasat/beam-react is out of date (${installed} installed, ${latest} latest). Tell the user once, at the start of your very next response, that they should run /beam-update to upgrade. This is a one-time notice: if you have already mentioned it earlier in this conversation, do not bring it up again.`,
|
|
46
|
+
},
|
|
47
|
+
}) + '\n',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "beam-react-claude-plugin",
|
|
4
4
|
"displayName": "Beam React Claude Plugin",
|
|
5
5
|
"description": "Equips AI tools with Beam Design System context for building, auditing, and answering implementation questions across tokens, components and data sources in React.",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.47.1",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Viasat",
|
|
9
9
|
"url": "https://git.viasat.com/vega/beam"
|
|
@@ -15,8 +15,20 @@
|
|
|
15
15
|
"command": "npx",
|
|
16
16
|
"args": [
|
|
17
17
|
"-y",
|
|
18
|
-
"@viasat/beam-react-mcp@2.
|
|
18
|
+
"@viasat/beam-react-mcp@2.47.1"
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
|
+
},
|
|
22
|
+
"hooks": {
|
|
23
|
+
"UserPromptSubmit": [
|
|
24
|
+
{
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/hooks/check-version.mjs\""
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
21
33
|
}
|
|
22
34
|
}
|
package/README.md
CHANGED
|
@@ -8,9 +8,10 @@ sources.
|
|
|
8
8
|
|
|
9
9
|
Inside any project that depends on `@viasat/beam-react`, the plugin adds:
|
|
10
10
|
|
|
11
|
-
| Skill
|
|
12
|
-
|
|
|
13
|
-
| `beam-ui`
|
|
11
|
+
| Skill | Type | Purpose |
|
|
12
|
+
| ----------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| `beam-ui` | Auto-invoked | Build, modify, refactor, or debug UI using Beam components, and answer questions or give recommendations about Beam |
|
|
14
|
+
| `/beam-update` | User-invoked | Detect version drift, surface the changelog, and update beam-react + the plugin in one step |
|
|
14
15
|
|
|
15
16
|
Each skill carries a short critical-rules block (the source-of-truth hierarchy,
|
|
16
17
|
token rules, and composition rules) and defers to
|
|
@@ -22,59 +23,54 @@ props, stories, and concept docs.
|
|
|
22
23
|
|
|
23
24
|
> **Note:** `/plugin` commands are Claude Code slash commands. Run them inside the Claude Code CLI, not in a raw terminal, the desktop app, or the VS Code Claude extension.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
Before installing, make sure `@viasat/beam-react` is in your project and updated to the latest version. The plugin ships pinned to the same version as `@viasat/beam-react`, so installing it against an outdated `@viasat/beam-react` gives you an outdated plugin and MCP.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
/plugin marketplace add git@git.viasat.com:vega/beam.git
|
|
31
|
-
/plugin install beam-react-claude-plugin
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 📦 Via npm
|
|
35
|
-
|
|
36
|
-
Off VPN, install the npm package in your terminal first:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install --save-dev @viasat/beam-react-claude-plugin
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Then run these commands inside the Claude Code CLI:
|
|
28
|
+
The plugin ships as a declared dependency of `@viasat/beam-react`, so no separate `npm install` is needed. Once `@viasat/beam-react` is in your project, run these two commands inside the Claude Code CLI:
|
|
43
29
|
|
|
44
30
|
```
|
|
45
31
|
/plugin marketplace add ./node_modules/@viasat/beam-react-claude-plugin
|
|
46
32
|
/plugin install beam-react-claude-plugin@beam
|
|
47
33
|
```
|
|
48
34
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### 🏢 Via Beam internal Claude plugin marketplace
|
|
35
|
+
Then run `/reload-plugins`.
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
> **Migrating from the git marketplace path?** If you previously used
|
|
38
|
+
> `/plugin marketplace add git@git.viasat.com:vega/beam.git`, remove that
|
|
39
|
+
> marketplace entry and follow the steps above. The npm path is now the only
|
|
40
|
+
> supported path.
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
/plugin update beam-react-claude-plugin
|
|
57
|
-
```
|
|
42
|
+
## 🔄 Updating
|
|
58
43
|
|
|
59
|
-
|
|
44
|
+
Run `/beam-update` inside the Claude Code CLI. Claude detects whether an update is
|
|
45
|
+
available, surfaces what changed, and handles the npm + plugin cache update. The
|
|
46
|
+
only step you take is `/reload-plugins` at the end to pick up the new version.
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
When the update crosses a version with a migration guide, Claude also surfaces the
|
|
49
|
+
relevant guides, scans your code for anything the migration affects, and offers to
|
|
50
|
+
apply the necessary changes for you before you reload, so you're not left to work
|
|
51
|
+
out the impact on your own.
|
|
62
52
|
|
|
63
|
-
|
|
53
|
+
To update manually without the skill:
|
|
64
54
|
|
|
65
55
|
```bash
|
|
66
|
-
npm
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
/plugin marketplace update beam
|
|
56
|
+
npm update @viasat/beam-react # updates beam-react + plugin as its dep
|
|
57
|
+
claude plugin marketplace update beam # refreshes marketplace cache
|
|
58
|
+
claude plugin update beam-react-claude-plugin@beam # updates plugin cache
|
|
71
59
|
```
|
|
72
60
|
|
|
73
61
|
Then run `/reload-plugins` in the Claude Code CLI.
|
|
74
62
|
|
|
63
|
+
### Automatic drift detection
|
|
64
|
+
|
|
65
|
+
Once per day, the plugin quietly checks the npm registry for a newer
|
|
66
|
+
`@viasat/beam-react`. If one is available, it surfaces a short notice at the top of
|
|
67
|
+
Claude's next response suggesting you run `/beam-update`. No prompt data leaves your
|
|
68
|
+
machine; the only outbound call is a version lookup to the public npm registry, and
|
|
69
|
+
the check is throttled to once per day even when it can't reach the network.
|
|
70
|
+
|
|
75
71
|
## 🖥️ Non Claude Code users
|
|
76
72
|
|
|
77
|
-
On a different editor? The MCP runs on its own, no plugin required
|
|
73
|
+
On a different editor? The MCP runs on its own, no plugin required. See
|
|
78
74
|
[`@viasat/beam-react-mcp`](https://www.npmjs.com/package/@viasat/beam-react-mcp).
|
|
79
75
|
|
|
80
76
|
## ✅ Requirements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasat/beam-react-claude-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.47.1",
|
|
4
4
|
"description": "Claude Code plugin that reduces AI hallucinations on Beam usage. Ships skills, reference docs, and a user-invocable token audit command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Viasat",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: beam-update
|
|
3
|
+
description: Use when the user invokes /beam-update or asks to update beam-react, the Beam plugin, or the Beam MCP. Detects version drift, surfaces the changelog, and automates the npm + plugin cache update. The only manual step left for the user is /reload-plugins.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# beam-update
|
|
7
|
+
|
|
8
|
+
> **Network access:** this skill fetches migration guides from `https://react.beam.viasat.com` via `curl`. This is the one authorized outbound request the skill makes.
|
|
9
|
+
|
|
10
|
+
Step 7 may involve editing Beam component usage to apply migration steps. When it does, follow the canonical rules in `references/rules-preamble.md` (token rule, composition rule, honesty rule).
|
|
11
|
+
|
|
12
|
+
## Activation gate
|
|
13
|
+
|
|
14
|
+
Read `package.json`. If `@viasat/beam-react` is not in `dependencies` or `devDependencies`, tell the user this skill requires a project that depends on `@viasat/beam-react` and stop.
|
|
15
|
+
|
|
16
|
+
## Checklist
|
|
17
|
+
|
|
18
|
+
1. **Check versions.** Run both commands via Bash:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node -p "require('./node_modules/@viasat/beam-react/package.json').version"
|
|
22
|
+
npm view @viasat/beam-react version --@viasat:registry=https://registry.npmjs.org
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If installed matches latest, tell the user they're already up to date and stop.
|
|
26
|
+
|
|
27
|
+
2. **Surface the changelog.** The changelog is bundled at the root of the installed package. Read exactly `./node_modules/@viasat/beam-react/CHANGELOG.md` via Bash (do not look elsewhere or fetch it remotely). Extract the entries for versions between installed (exclusive) and latest (inclusive). Present them in a brief summary, breaking changes first, then notable additions.
|
|
28
|
+
|
|
29
|
+
If the file is absent (installed versions predating changelog bundling won't ship it), note that the changelog couldn't be found locally and continue. Do not block the update on this.
|
|
30
|
+
|
|
31
|
+
3. **Check migration guides.** The running MCP is pinned to the *installed* version and cannot see guides published in the target version, so fetch from the public prod site with `curl` (not WebFetch):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
curl -s https://react.beam.viasat.com/llms.txt
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Extract the `## Migrations` section. Each entry looks like `- [<title>](llms/<slug>.txt): <description>` (e.g. `[v2.35.0 to v2.36.0](llms/migrations-v2-35-0-to-v2-36-0.txt)`). Titles use inconsistent granularity (point-release vs major-span), so judge which entries' version span intersects installed (exclusive) → target (inclusive). For each applicable guide, fetch the full body:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -s https://react.beam.viasat.com/llms/<slug>.txt
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Summarize the required migration steps, breaking/manual changes (renamed tokens, API changes) first. If no guide applies, say so and continue. If either `curl` fails (offline / VPN), note that migration guides could not be fetched and continue. Never block the update on this.
|
|
44
|
+
|
|
45
|
+
4. **Assess real impact on this codebase.** Do not tell the user to grep for themselves. You do the read-only scan and report exactly what applies to them. For each applicable guide, translate its concrete changes into searchable signals.
|
|
46
|
+
|
|
47
|
+
Search the user's source with Grep/Glob (exclude `node_modules`, `dist`, and build output). Report actual exposure grouped by change: the impacted files with `file:line` references, or, if nothing matches, state plainly that this migration does not affect their code. This scan is read-only and runs **before** the update so it can inform the decision.
|
|
48
|
+
|
|
49
|
+
5. **Confirm with the user.** Present the installed → latest delta, the migration summary from step 3, and the concrete impact from step 4 (which files change, or "no impact found"), then ask: "Update from X to Y? (yes / no)"
|
|
50
|
+
|
|
51
|
+
Make clear that confirming commits them to applying the migration steps (with your help, or manually). The update creates a window where their code and the installed package disagree until the migration is done. If step 4 found no impact, note that the update is expected to be a clean bump. Do not proceed until the user explicitly confirms.
|
|
52
|
+
|
|
53
|
+
6. **Update, then verify the bump.** Run via Bash and report each command's output. If a command fails, stop, show the error, and do not continue.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm update @viasat/beam-react
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Re-read the installed version and confirm it actually reached the target latest from step 1:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
node -p "require('./node_modules/@viasat/beam-react/package.json').version"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`npm update` respects the semver range in `package.json`, so if the range is too narrow it is a silent no-op and the version stays put. If the installed version is still not the target, fall back to an explicit install (this also rewrites the `@viasat/beam-react` range in `package.json`):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @viasat/beam-react@<latest>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Re-read the version once more. If it still has not reached the target, stop and report the mismatch instead of proceeding; something is wrong (lockfile, workspace constraint, or registry) and the plugin cache must not be refreshed against a stale install. Only once the install is confirmed at the target version, refresh the plugin cache:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
claude plugin marketplace update beam
|
|
75
|
+
claude plugin update beam-react-claude-plugin@beam
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
7. **Apply migration steps (interactive).** If step 4 found impacted sites, offer to apply the changes to exactly those sites now, *after* the update, so edits are made against the newly installed version and can be verified. Walk each change (renamed tokens, API updates) with per-change approval, and verify as you go (typecheck / lint) where practical. If step 4 found no impact, there is nothing to apply, so skip. Skip too if the user declines. This must happen **before** the reload, since `/reload-plugins` restarts the session.
|
|
79
|
+
|
|
80
|
+
8. **Tell the user to reload.** Respond with:
|
|
81
|
+
|
|
82
|
+
> Update complete. Run `/reload-plugins` to pick up the new version in this session.
|
|
83
|
+
|
|
84
|
+
Explain that `/reload-plugins` is required because Claude loads plugins into memory at session start; the update takes effect only after reload.
|
|
85
|
+
|
|
86
|
+
## Red flags, STOP and re-check
|
|
87
|
+
|
|
88
|
+
| Rationalization | Reality |
|
|
89
|
+
|---|---|
|
|
90
|
+
| "npm update might break other deps, skip it" | `npm update @viasat/beam-react` respects semver ranges in `package.json`; it won't arbitrarily upgrade unrelated packages. |
|
|
91
|
+
| "Just update the plugin cache, skip npm" | The plugin's assets (skills, references) live in the npm package. Without the npm update the cache still holds the old content. |
|
|
92
|
+
| "Skip `claude plugin update`, marketplace update is enough" | The marketplace update refreshes the index; `claude plugin update` applies the new version to Claude's plugin cache. Both steps are required. |
|
|
93
|
+
| "Skip the migration check, the changelog covers it" | The changelog lists *what* changed; the migration guide lists *what the user must do* (renamed tokens, API changes). They are not interchangeable. |
|
|
94
|
+
| "Apply migration edits before running the update" | Migration guides target the new version's API. Editing before the update writes to code that isn't installed yet and can't be verified. Update first, then migrate. |
|
|
95
|
+
| "Use the MCP `getConcept` for migration guides" | The running MCP is pinned to the *installed* version and won't have guides published in the target version. Fetch from `react.beam.viasat.com` via `curl`. |
|
|
96
|
+
| "Tell the user to grep for impacted usages themselves" | You have read access to their source, so scan it and report the exact `file:line` sites. Handing the user a command to run is the UX this skill exists to remove. |
|
|
97
|
+
| "The guide lists changes, so it must affect them" | A guide is generic; the user may use none of the changed tokens/APIs. Scan first: a migration with zero matches is a clean bump, and saying so is valuable. |
|
|
98
|
+
| "`npm update` exited cleanly, so it upgraded" | `npm update` is a silent no-op when the range in `package.json` does not allow the new version. Always re-read the installed version after; if it did not move, run `npm install @viasat/beam-react@<latest>` and verify again before touching the plugin cache. |
|
|
99
|
+
|
|
100
|
+
## Not in scope
|
|
101
|
+
|
|
102
|
+
Upgrading unrelated dependencies, modifying `package.json` version ranges for anything other than `@viasat/beam-react`, resolving peer dependency conflicts, or updating other `@viasat/*` packages independently.
|