@meshstream/agent-skills 0.0.0-stage → 0.1.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 CHANGED
@@ -1,3 +1,28 @@
1
- # Temporary Holding Version
1
+ # MeshStream Agent Skills
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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 all
20
+ ```
21
+
22
+ 本地预览:
23
+
24
+ ```bash
25
+ node src/cli.mjs add --ide all --project /path/to/project
26
+ ```
27
+
28
+ 默认保留已有文件;只有显式传入 `--force` 才会替换已有的 MeshStream 指令文件。
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "@meshstream/agent-skills",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "description": "MeshStream AI Coding skills for SDK integration, troubleshooting, and P2P acceptance.",
6
+ "repository": { "type": "git", "url": "git+https://github.com/Mesh-Stream/meshstream-ai-tools.git", "directory": "packages/agent-skills" },
7
+ "homepage": "https://meshstream.net/docs/ai-coding",
8
+ "type": "module",
9
+ "publishConfig": { "access": "public" },
10
+ "files": ["src", "README.md"],
11
+ "bin": {
12
+ "meshstream-agent-skills": "src/cli.mjs"
13
+ },
14
+ "scripts": {
15
+ "test": "node --test test/*.test.mjs"
16
+ }
17
+ }
package/src/cli.mjs ADDED
@@ -0,0 +1,68 @@
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
+ };
12
+
13
+ function usage() {
14
+ return `MeshStream Agent Skills\n\nUsage:\n meshstream-agent-skills add --ide <codex|cursor|claude|all> [--project <path>] [--force]\n\nThe installer writes only the selected editor's project-local instructions. Existing files are preserved unless --force is supplied.`;
15
+ }
16
+
17
+ function parseArgs(argv) {
18
+ const [command, ...rest] = argv;
19
+ const options = { command, ide: undefined, project: process.cwd(), force: false };
20
+ for (let index = 0; index < rest.length; index += 1) {
21
+ const value = rest[index];
22
+ if (value === "--ide") options.ide = rest[++index];
23
+ else if (value === "--project") options.project = path.resolve(rest[++index]);
24
+ else if (value === "--force") options.force = true;
25
+ else if (value === "--help" || value === "-h") options.help = true;
26
+ else throw new Error(`Unknown option: ${value}`);
27
+ }
28
+ return options;
29
+ }
30
+
31
+ async function install(options) {
32
+ const requested = options.ide === "all" ? Object.keys(targets) : [options.ide];
33
+ if (!requested[0] || requested.some((ide) => !targets[ide])) {
34
+ throw new Error("--ide must be codex, cursor, claude, or all");
35
+ }
36
+ const written = [];
37
+ for (const ide of requested) {
38
+ for (const file of targets[ide]) {
39
+ const destination = path.join(options.project, file.path);
40
+ try {
41
+ await fs.access(destination);
42
+ if (!options.force) throw new Error(`already exists: ${file.path} (use --force to replace it)`);
43
+ } catch (error) {
44
+ if (error?.code !== "ENOENT" && !String(error.message).startsWith("already exists:")) throw error;
45
+ if (String(error.message).startsWith("already exists:") && !options.force) throw error;
46
+ }
47
+ await fs.mkdir(path.dirname(destination), { recursive: true });
48
+ await fs.writeFile(destination, file.body, "utf8");
49
+ written.push(path.relative(options.project, destination));
50
+ }
51
+ }
52
+ return written;
53
+ }
54
+
55
+ try {
56
+ const options = parseArgs(process.argv.slice(2));
57
+ if (options.help || options.command === "help" || options.command === undefined) {
58
+ console.log(usage());
59
+ process.exit(0);
60
+ }
61
+ if (options.command !== "add") throw new Error(`Unknown command: ${options.command}`);
62
+ const written = await install(options);
63
+ console.log(`Installed MeshStream AI Coding instructions:\n${written.map((file) => `- ${file}`).join("\n")}`);
64
+ } catch (error) {
65
+ console.error(`meshstream-agent-skills: ${error.message}`);
66
+ console.error(usage());
67
+ process.exit(1);
68
+ }
@@ -0,0 +1,74 @@
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
+ ## P2P acceptance requirements
32
+
33
+ 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:
34
+
35
+ - connected Peer count;
36
+ - receiver P2P download bytes;
37
+ - sender P2P upload bytes;
38
+ - CDN download bytes;
39
+ - rebuffer count;
40
+ - first Peer and first P2P byte latency.
41
+
42
+ 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.
43
+
44
+ ## Final response format
45
+
46
+ Report:
47
+
48
+ 1. changed files and exact dependency versions;
49
+ 2. build and test commands with results;
50
+ 3. CDN playback result;
51
+ 4. real P2P transfer evidence for both directions;
52
+ 5. fallback and dispose/release evidence;
53
+ 6. devices, networks, or production conditions that were not tested.
54
+ `;
55
+
56
+ export const cursorBody = `# MeshStream Web SDK integration
57
+
58
+ 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.
59
+
60
+ ## Workflow
61
+
62
+ 1. Identify the framework, player, protocol, and package manager.
63
+ 2. Read the MeshStream Web SDK setup and integration docs before editing.
64
+ 3. Keep existing player, CDN, origin authentication, DRM, and ABR behavior.
65
+ 4. Keep CDN fallback and release the session on source change, page hide, and player destruction.
66
+ 5. Run the existing build and tests.
67
+
68
+ Never put SDK keys, SecretKeys, signed media URLs, Authorization headers, Cookies, or production logs in source or chat.
69
+
70
+ 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.
71
+ `;
72
+
73
+ export const claudeBody = skillBody;
74
+