@meshstream/agent-skills 0.0.0-stage → 0.2.0
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 +28 -2
- package/package.json +24 -4
- package/src/cli.mjs +69 -0
- package/src/skill-content.mjs +86 -0
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MeshStream Agent Skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
这是 MeshStream AI Coding Skill 的本地预览包。它把接入、排错和 P2P 验收规则安装到项目目录,不读取或上传客户代码,也不会写入凭据。
|
|
4
|
+
|
|
5
|
+
## 本地测试
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm test
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
包公开发布后,客户可以在项目根目录执行:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @meshstream/agent-skills add --ide codex
|
|
17
|
+
npx @meshstream/agent-skills add --ide cursor
|
|
18
|
+
npx @meshstream/agent-skills add --ide claude
|
|
19
|
+
npx @meshstream/agent-skills add --ide codebuddy
|
|
20
|
+
npx @meshstream/agent-skills add --ide all
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
本地预览:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
node src/cli.mjs add --ide all --project /path/to/project
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
默认保留已有文件;只有显式传入 `--force` 才会替换已有的 MeshStream 指令文件。
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshstream/agent-skills",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "MeshStream AI Coding skills for SDK integration, troubleshooting, and P2P acceptance.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Mesh-Stream/meshstream-ai-tools.git",
|
|
9
|
+
"directory": "packages/agent-skills"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://meshstream.net/docs/ai-coding",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"meshstream-agent-skills": "src/cli.mjs"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "node --test test/*.test.mjs"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/cli.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { claudeBody, cursorBody, skillBody } from "./skill-content.mjs";
|
|
6
|
+
|
|
7
|
+
const targets = {
|
|
8
|
+
codex: [{ path: ".codex/skills/meshstream-web-integration/SKILL.md", body: skillBody }],
|
|
9
|
+
cursor: [{ path: ".cursor/rules/meshstream-web-integration.mdc", body: cursorBody }],
|
|
10
|
+
claude: [{ path: ".claude/skills/meshstream-web-integration/SKILL.md", body: claudeBody }],
|
|
11
|
+
codebuddy: [{ path: ".codebuddy/skills/meshstream-web-integration/SKILL.md", body: skillBody }],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function usage() {
|
|
15
|
+
return `MeshStream Agent Skills\n\nUsage:\n meshstream-agent-skills add --ide <codex|cursor|claude|codebuddy|all> [--project <path>] [--force]\n\nThe installer writes only the selected editor's project-local instructions. Existing files are preserved unless --force is supplied.`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function parseArgs(argv) {
|
|
19
|
+
const [command, ...rest] = argv;
|
|
20
|
+
const options = { command, ide: undefined, project: process.cwd(), force: false };
|
|
21
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
22
|
+
const value = rest[index];
|
|
23
|
+
if (value === "--ide") options.ide = rest[++index];
|
|
24
|
+
else if (value === "--project") options.project = path.resolve(rest[++index]);
|
|
25
|
+
else if (value === "--force") options.force = true;
|
|
26
|
+
else if (value === "--help" || value === "-h") options.help = true;
|
|
27
|
+
else throw new Error(`Unknown option: ${value}`);
|
|
28
|
+
}
|
|
29
|
+
return options;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function install(options) {
|
|
33
|
+
const requested = options.ide === "all" ? Object.keys(targets) : [options.ide];
|
|
34
|
+
if (!requested[0] || requested.some((ide) => !targets[ide])) {
|
|
35
|
+
throw new Error("--ide must be codex, cursor, claude, codebuddy, or all");
|
|
36
|
+
}
|
|
37
|
+
const written = [];
|
|
38
|
+
for (const ide of requested) {
|
|
39
|
+
for (const file of targets[ide]) {
|
|
40
|
+
const destination = path.join(options.project, file.path);
|
|
41
|
+
try {
|
|
42
|
+
await fs.access(destination);
|
|
43
|
+
if (!options.force) throw new Error(`already exists: ${file.path} (use --force to replace it)`);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (error?.code !== "ENOENT" && !String(error.message).startsWith("already exists:")) throw error;
|
|
46
|
+
if (String(error.message).startsWith("already exists:") && !options.force) throw error;
|
|
47
|
+
}
|
|
48
|
+
await fs.mkdir(path.dirname(destination), { recursive: true });
|
|
49
|
+
await fs.writeFile(destination, file.body, "utf8");
|
|
50
|
+
written.push(path.relative(options.project, destination));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return written;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const options = parseArgs(process.argv.slice(2));
|
|
58
|
+
if (options.help || options.command === "help" || options.command === undefined) {
|
|
59
|
+
console.log(usage());
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
if (options.command !== "add") throw new Error(`Unknown command: ${options.command}`);
|
|
63
|
+
const written = await install(options);
|
|
64
|
+
console.log(`Installed MeshStream AI Coding instructions:\n${written.map((file) => `- ${file}`).join("\n")}`);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error(`meshstream-agent-skills: ${error.message}`);
|
|
67
|
+
console.error(usage());
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const skillBody = `---
|
|
2
|
+
name: meshstream-web-integration
|
|
3
|
+
description: Integrate, troubleshoot, and verify MeshStream Web SDK in an existing playback project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MeshStream Web SDK integration
|
|
7
|
+
|
|
8
|
+
Use the official MeshStream developer documentation as the source of truth:
|
|
9
|
+
|
|
10
|
+
- https://meshstream.net/docs/ai-coding
|
|
11
|
+
- https://meshstream.net/docs/sdk/overview
|
|
12
|
+
- https://meshstream.net/docs/sdk/web-setup
|
|
13
|
+
- https://meshstream.net/docs/sdk/web
|
|
14
|
+
- https://meshstream.net/docs/sdk/web-advanced
|
|
15
|
+
- https://meshstream.net/docs/concepts/statistics
|
|
16
|
+
- https://meshstream.net/docs/troubleshooting
|
|
17
|
+
|
|
18
|
+
If the meshstream-docs-mcp server is configured, prefer these read-only tools before writing code:
|
|
19
|
+
search_docs, get_sdk_release, get_integration_guide, and get_troubleshooting_guide.
|
|
20
|
+
|
|
21
|
+
## Required workflow
|
|
22
|
+
|
|
23
|
+
1. Identify the framework, player, media protocol, package manager, and existing playback lifecycle.
|
|
24
|
+
2. Use an exact SDK version listed in the official public release table. Do not invent APIs or versions.
|
|
25
|
+
3. Read SDK keys from environment variables or restricted runtime configuration. Never write keys, SecretKeys, signed URLs, Authorization headers, or Cookies into source, logs, or chat.
|
|
26
|
+
4. Reuse the existing player, origin, CDN, DRM, ABR, and authentication behavior.
|
|
27
|
+
5. Keep CDN fallback when bootstrap, Tracker, WebRTC, ICE, or P2P segment transfer is unavailable.
|
|
28
|
+
6. Release the MeshStream session on source change, playback end, page hide, and player destruction.
|
|
29
|
+
7. Run the existing build and test commands after making the smallest necessary change.
|
|
30
|
+
|
|
31
|
+
## Supported task modes
|
|
32
|
+
|
|
33
|
+
Choose the smallest mode that matches the request:
|
|
34
|
+
|
|
35
|
+
- **from-zero integration:** inspect the project, select the platform SDK and existing player, then produce the smallest working change;
|
|
36
|
+
- **demo run:** find the repository's public example or demo, configure only local environment variables, run it, and report the actual result;
|
|
37
|
+
- **troubleshooting:** collect the concrete error, SDK status, bootstrap/Tracker/ICE evidence, and CDN fallback result before proposing a fix;
|
|
38
|
+
- **feature extension:** preserve the current integration and add one requested capability with focused tests and lifecycle cleanup;
|
|
39
|
+
- **documentation lookup:** use the read-only MeshStream docs MCP and include source URLs in the answer.
|
|
40
|
+
|
|
41
|
+
For Android, iOS, macOS, Windows, Flutter, React Native, and Uniapp, use the matching official setup and advanced guides. Do not silently downgrade a real-device or cross-network check to a simulator or build-only result.
|
|
42
|
+
|
|
43
|
+
## P2P acceptance requirements
|
|
44
|
+
|
|
45
|
+
Peer count or a WebSocket connection alone is not proof of P2P delivery. Use two clients with the same content identity and record timestamped values for:
|
|
46
|
+
|
|
47
|
+
- connected Peer count;
|
|
48
|
+
- receiver P2P download bytes;
|
|
49
|
+
- sender P2P upload bytes;
|
|
50
|
+
- CDN download bytes;
|
|
51
|
+
- rebuffer count;
|
|
52
|
+
- first Peer and first P2P byte latency.
|
|
53
|
+
|
|
54
|
+
Report real transfer as passed only when receiver download bytes and sender upload bytes both increase for the same test. Test CDN fallback after P2P is stopped or blocked. Separate passed, failed, blocked, and unexecuted checks.
|
|
55
|
+
|
|
56
|
+
## Final response format
|
|
57
|
+
|
|
58
|
+
Report:
|
|
59
|
+
|
|
60
|
+
1. changed files and exact dependency versions;
|
|
61
|
+
2. build and test commands with results;
|
|
62
|
+
3. CDN playback result;
|
|
63
|
+
4. real P2P transfer evidence for both directions;
|
|
64
|
+
5. fallback and dispose/release evidence;
|
|
65
|
+
6. devices, networks, or production conditions that were not tested.
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
export const cursorBody = `# MeshStream Web SDK integration
|
|
69
|
+
|
|
70
|
+
Use this rule when working on MeshStream playback integration. Follow the official docs at https://meshstream.net/docs/ai-coding and use an exact public SDK version.
|
|
71
|
+
|
|
72
|
+
## Workflow
|
|
73
|
+
|
|
74
|
+
1. Identify the framework, player, protocol, and package manager.
|
|
75
|
+
2. Read the MeshStream Web SDK setup and integration docs before editing.
|
|
76
|
+
3. Keep existing player, CDN, origin authentication, DRM, and ABR behavior.
|
|
77
|
+
4. Keep CDN fallback and release the session on source change, page hide, and player destruction.
|
|
78
|
+
5. Run the existing build and tests.
|
|
79
|
+
|
|
80
|
+
Never put SDK keys, SecretKeys, signed media URLs, Authorization headers, Cookies, or production logs in source or chat.
|
|
81
|
+
|
|
82
|
+
For P2P acceptance, require both receiver P2P download bytes and sender P2P upload bytes to increase. Peer count alone is not a transfer result. Report CDN fallback and dispose/release separately.
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
export const claudeBody = skillBody;
|
|
86
|
+
|