{"owner":"illuspas","repo":"Node-Media-Server","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# Agent Guidelines for Node-Media-Server\n\nThis document provides guidelines for agentic coding agents operating in this repository.\n\n## Build/Lint/Test Commands\n\n### Available Scripts\n```bash\n# Development mode - runs eslint and starts server\nnpm run dev\n\n# Production start\nnpm start\n\n# Test (currently just exits 0 - no tests implemented)\nnpm test\n```\n\n### Linting\n```bash\n# Run eslint on all files\nnpx eslint\n\n# Fix auto-fixable eslint issues\nnpx eslint --fix\n\n# Check specific file\nnpx eslint src/index.js\n```\n\n### Single File Analysis\n```bash\n# Check a single file with eslint\nnpx eslint --no-eslintrc --config ../eslint.config.js file.js\n\n# Analyze TypeScript-style checking\nnpx eslint --ext .js src/ --rule '@typescript-eslint/no-unused-vars: error'\n```\n\n### Manual Testing\nSince there are no automated tests, manual testing approaches:\n\n1. **RTMP Stream Testing**:\n   ```bash\n   # Start server\n   npm start\n   \n   # Test with ffmpeg\n   ffmpeg -i input.mp4 -c:v libx264 -f flv rtmp://localhost:1935/live/stream\n   ffmpeg -i rtmp://localhost:1935/live/stream -c copy output.mp4\n   ```\n\n2. **HTTP-FLV Testing**:\n   ```bash\n   # Play stream in browser\n   http://localhost:8000/live/stream.flv\n   ```\n\n3. **API Testing**:\n   ```bash\n   # Health check\n   curl http://localhost:8001/health\n   \n   # Login\n   curl -X POST http://localhost:8001/api/v1/login \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"username\":\"admin\",\"password\":\"your_password\"}'\n   ```\n\n## Code Style Guidelines\n\n### File Headers\nAll files must include copyright header:\n```javascript\n// @ts-check\n//\n//  Created by Chen Mingliang on 24/11/28.\n//  illuspas@msn.com\n//  Copyright (c) 2024 NodeMedia. All rights reserved.\n//\n```\n\n### TypeScript Checking\n- Use `// @ts-check` at the top of all JavaScript files\n- Add JSDoc comments for function parameters and return types\n- Use JSDoc types: `{string}`, `{number}`, `{boolean}`, `{object}`, `{Array<string>}`\n\n### Code Formatting\n- Use **double quotes** for strings\n- Use **semicolons** at end of statements\n- Use **2 spaces** for indentation\n- Use **camelCase** for variables and functions\n- Use **PascalCase** for classes\n\n### Import/Require Guidelines\n```javascript\n// Node.js modules\nconst fs = require(\"fs\");\nconst net = require(\"net\");\n\n// Relative imports (use .js extension)\nconst logger = require(\"./core/logger.js\");\nconst Context = require(\"../core/context.js\");\nconst BaseSession = require(\"./base_session.js\");\n\n// Express and web modules\nconst express = require(\"express\");\nconst cors = require(\"cors\");\n```\n\n### Function Documentation\n```javascript\n/**\n * Brief description of function\n * @param {string} paramName - Description of parameter\n * @param {number} paramName2 - Description of parameter\n * @returns {boolean} Description of return value\n */\nfunction exampleFunction(paramName, paramName2) {\n  return true;\n}\n\n/**\n * @class\n * @augments BaseClass\n */\nclass ExampleClass extends BaseClass {\n  /**\n   * @param {net.Socket} socket - The socket connection\n   */\n  constructor(socket) {\n    super();\n    this.socket = socket;\n  }\n}\n```\n\n### Variable Naming Conventions\n- **Constants**: `UPPER_SNAKE_CASE`\n- **Classes**: `PascalCase`\n- **Functions/Variables**: `camelCase`\n- **Private properties**: `_prefixWithUnderscore`\n\n```javascript\n// Constants\nconst MAX_BUFFER_SIZE = 1024 * 1024;\nconst DEFAULT_TIMEOUT = 5000;\n\n// Classes\nclass RtmpSession extends BaseSession {\n  constructor(socket) {\n    super();\n    this._privateProperty = value;\n    this.publicProperty = value;\n  }\n}\n```\n\n### Error Handling\n```javascript\n// Use try-catch for async operations\ntry {\n  const result = await someAsyncOperation();\n  res.json({ success: true, data: result });\n} catch (error) {\n  logger.error(`Operation failed: ${error.message}`);\n  res.status(500).json({\n    success: false,\n    error: \"Internal server error\"\n  });\n}\n\n// Use logger for different log levels\nlogger.trace(\"Detailed trace message\");\nlogger.debug(\"Debug information\");\nlogger.info(\"General information\");\nlogger.warn(\"Warning message\");\nlogger.error(\"Error message\");\n```\n\n### Protocol and Session Patterns\n- Each protocol extends `BaseSession`\n- Use composition over inheritance for protocol-specific features\n- Follow established patterns in existing session classes\n\n### JWT and Authentication\n- Use the middleware pattern for authentication\n- Handle JWT errors with proper error handling middleware\n- Always validate token expiration and validity\n\n### Configuration Management\n- Access configuration through `Context.config`\n- Use optional chaining for safe property access\n- Provide sensible defaults for missing configuration\n\n### Security Considerations\n- Never log sensitive information (passwords, tokens)\n- Use MD5 hashing for password storage in API\n- Validate all input parameters\n- Use CORS appropriately for cross-origin requests\n\n### Performance Guidelines\n- Use Maps for session management (not arrays)\n- Implement proper cleanup in close/error handlers\n- Minimize blocking operations in event handlers\n- Use efficient data structures for broadcast management\n\n### API Design\n- Follow REST conventions for API endpoints\n- Use consistent response format:\n  ```javascript\n  {\n    success: true|false,\n    data: {},\n    message: \"Optional message\",\n    error: \"Error details if success=false\"\n  }\n  ```\n- Implement proper HTTP status codes\n- Add comprehensive error handling\n\n### File Organization\n- Keep related functionality in same directory\n- Use clear, descriptive file names\n- Group API handlers by functionality\n- Separate protocol implementations\n\nThis codebase follows a professional Node.js server architecture with emphasis on performance, security, and maintainability. Always test thoroughly after making changes."},"files":{"AGENTS.md":"# Agent Guidelines for Node-Media-Server\n\nThis document provides guidelines for agentic coding agents operating in this repository.\n\n## Build/Lint/Test Commands\n\n### Available Scripts\n```bash\n# Development mode - runs eslint and starts server\nnpm run dev\n\n# Production start\nnpm start\n\n# Test (currently just exits 0 - no tests implemented)\nnpm test\n```\n\n### Linting\n```bash\n# Run eslint on all files\nnpx eslint\n\n# Fix auto-fixable eslint issues\nnpx eslint --fix\n\n# Check specific file\nnpx eslint src/index.js\n```\n\n### Single File Analysis\n```bash\n# Check a single file with eslint\nnpx eslint --no-eslintrc --config ../eslint.config.js file.js\n\n# Analyze TypeScript-style checking\nnpx eslint --ext .js src/ --rule '@typescript-eslint/no-unused-vars: error'\n```\n\n### Manual Testing\nSince there are no automated tests, manual testing approaches:\n\n1. **RTMP Stream Testing**:\n   ```bash\n   # Start server\n   npm start\n   \n   # Test with ffmpeg\n   ffmpeg -i input.mp4 -c:v libx264 -f flv rtmp://localhost:1935/live/stream\n   ffmpeg -i rtmp://localhost:1935/live/stream -c copy output.mp4\n   ```\n\n2. **HTTP-FLV Testing**:\n   ```bash\n   # Play stream in browser\n   http://localhost:8000/live/stream.flv\n   ```\n\n3. **API Testing**:\n   ```bash\n   # Health check\n   curl http://localhost:8001/health\n   \n   # Login\n   curl -X POST http://localhost:8001/api/v1/login \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"username\":\"admin\",\"password\":\"your_password\"}'\n   ```\n\n## Code Style Guidelines\n\n### File Headers\nAll files must include copyright header:\n```javascript\n// @ts-check\n//\n//  Created by Chen Mingliang on 24/11/28.\n//  illuspas@msn.com\n//  Copyright (c) 2024 NodeMedia. All rights reserved.\n//\n```\n\n### TypeScript Checking\n- Use `// @ts-check` at the top of all JavaScript files\n- Add JSDoc comments for function parameters and return types\n- Use JSDoc types: `{string}`, `{number}`, `{boolean}`, `{object}`, `{Array<string>}`\n\n### Code Formatting\n- Use **double quotes** for strings\n- Use **semicolons** at end of statements\n- Use **2 spaces** for indentation\n- Use **camelCase** for variables and functions\n- Use **PascalCase** for classes\n\n### Import/Require Guidelines\n```javascript\n// Node.js modules\nconst fs = require(\"fs\");\nconst net = require(\"net\");\n\n// Relative imports (use .js extension)\nconst logger = require(\"./core/logger.js\");\nconst Context = require(\"../core/context.js\");\nconst BaseSession = require(\"./base_session.js\");\n\n// Express and web modules\nconst express = require(\"express\");\nconst cors = require(\"cors\");\n```\n\n### Function Documentation\n```javascript\n/**\n * Brief description of function\n * @param {string} paramName - Description of parameter\n * @param {number} paramName2 - Description of parameter\n * @returns {boolean} Description of return value\n */\nfunction exampleFunction(paramName, paramName2) {\n  return true;\n}\n\n/**\n * @class\n * @augments BaseClass\n */\nclass ExampleClass extends BaseClass {\n  /**\n   * @param {net.Socket} socket - The socket connection\n   */\n  constructor(socket) {\n    super();\n    this.socket = socket;\n  }\n}\n```\n\n### Variable Naming Conventions\n- **Constants**: `UPPER_SNAKE_CASE`\n- **Classes**: `PascalCase`\n- **Functions/Variables**: `camelCase`\n- **Private properties**: `_prefixWithUnderscore`\n\n```javascript\n// Constants\nconst MAX_BUFFER_SIZE = 1024 * 1024;\nconst DEFAULT_TIMEOUT = 5000;\n\n// Classes\nclass RtmpSession extends BaseSession {\n  constructor(socket) {\n    super();\n    this._privateProperty = value;\n    this.publicProperty = value;\n  }\n}\n```\n\n### Error Handling\n```javascript\n// Use try-catch for async operations\ntry {\n  const result = await someAsyncOperation();\n  res.json({ success: true, data: result });\n} catch (error) {\n  logger.error(`Operation failed: ${error.message}`);\n  res.status(500).json({\n    success: false,\n    error: \"Internal server error\"\n  });\n}\n\n// Use logger for different log levels\nlogger.trace(\"Detailed trace message\");\nlogger.debug(\"Debug information\");\nlogger.info(\"General information\");\nlogger.warn(\"Warning message\");\nlogger.error(\"Error message\");\n```\n\n### Protocol and Session Patterns\n- Each protocol extends `BaseSession`\n- Use composition over inheritance for protocol-specific features\n- Follow established patterns in existing session classes\n\n### JWT and Authentication\n- Use the middleware pattern for authentication\n- Handle JWT errors with proper error handling middleware\n- Always validate token expiration and validity\n\n### Configuration Management\n- Access configuration through `Context.config`\n- Use optional chaining for safe property access\n- Provide sensible defaults for missing configuration\n\n### Security Considerations\n- Never log sensitive information (passwords, tokens)\n- Use MD5 hashing for password storage in API\n- Validate all input parameters\n- Use CORS appropriately for cross-origin requests\n\n### Performance Guidelines\n- Use Maps for session management (not arrays)\n- Implement proper cleanup in close/error handlers\n- Minimize blocking operations in event handlers\n- Use efficient data structures for broadcast management\n\n### API Design\n- Follow REST conventions for API endpoints\n- Use consistent response format:\n  ```javascript\n  {\n    success: true|false,\n    data: {},\n    message: \"Optional message\",\n    error: \"Error details if success=false\"\n  }\n  ```\n- Implement proper HTTP status codes\n- Add comprehensive error handling\n\n### File Organization\n- Keep related functionality in same directory\n- Use clear, descriptive file names\n- Group API handlers by functionality\n- Separate protocol implementations\n\nThis codebase follows a professional Node.js server architecture with emphasis on performance, security, and maintainability. Always test thoroughly after making changes."},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# Agent Guidelines for Node-Media-Server\n\nThis document provides guidelines for agentic coding agents operating in this repository.\n\n## Build/Lint/Test Commands\n\n### Available Scripts\n```bash\n# Development mode - runs eslint and starts server\nnpm run dev\n\n# Production start\nnpm start\n\n# Test (currently just exits 0 - no tests implemented)\nnpm test\n```\n\n### Linting\n```bash\n# Run eslint on all files\nnpx eslint\n\n# Fix auto-fixable eslint issues\nnpx eslint --fix\n\n# Check specific file\nnpx eslint src/index.js\n```\n\n### Single File Analysis\n```bash\n# Check a single file with eslint\nnpx eslint --no-eslintrc --config ../eslint.config.js file.js\n\n# Analyze TypeScript-style checking\nnpx eslint --ext .js src/ --rule '@typescript-eslint/no-unused-vars: error'\n```\n\n### Manual Testing\nSince there are no automated tests, manual testing approaches:\n\n1. **RTMP Stream Testing**:\n   ```bash\n   # Start server\n   npm start\n   \n   # Test with ffmpeg\n   ffmpeg -i input.mp4 -c:v libx264 -f flv rtmp://localhost:1935/live/stream\n   ffmpeg -i rtmp://localhost:1935/live/stream -c copy output.mp4\n   ```\n\n2. **HTTP-FLV Testing**:\n   ```bash\n   # Play stream in browser\n   http://localhost:8000/live/stream.flv\n   ```\n\n3. **API Testing**:\n   ```bash\n   # Health check\n   curl http://localhost:8001/health\n   \n   # Login\n   curl -X POST http://localhost:8001/api/v1/login \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"username\":\"admin\",\"password\":\"your_password\"}'\n   ```\n\n## Code Style Guidelines\n\n### File Headers\nAll files must include copyright header:\n```javascript\n// @ts-check\n//\n//  Created by Chen Mingliang on 24/11/28.\n//  illuspas@msn.com\n//  Copyright (c) 2024 NodeMedia. All rights reserved.\n//\n```\n\n### TypeScript Checking\n- Use `// @ts-check` at the top of all JavaScript files\n- Add JSDoc comments for function parameters and return types\n- Use JSDoc types: `{string}`, `{number}`, `{boolean}`, `{object}`, `{Array<string>}`\n\n### Code Formatting\n- Use **double quotes** for strings\n- Use **semicolons** at end of statements\n- Use **2 spaces** for indentation\n- Use **camelCase** for variables and functions\n- Use **PascalCase** for classes\n\n### Import/Require Guidelines\n```javascript\n// Node.js modules\nconst fs = require(\"fs\");\nconst net = require(\"net\");\n\n// Relative imports (use .js extension)\nconst logger = require(\"./core/logger.js\");\nconst Context = require(\"../core/context.js\");\nconst BaseSession = require(\"./base_session.js\");\n\n// Express and web modules\nconst express = require(\"express\");\nconst cors = require(\"cors\");\n```\n\n### Function Documentation\n```javascript\n/**\n * Brief description of function\n * @param {string} paramName - Description of parameter\n * @param {number} paramName2 - Description of parameter\n * @returns {boolean} Description of return value\n */\nfunction exampleFunction(paramName, paramName2) {\n  return true;\n}\n\n/**\n * @class\n * @augments BaseClass\n */\nclass ExampleClass extends BaseClass {\n  /**\n   * @param {net.Socket} socket - The socket connection\n   */\n  constructor(socket) {\n    super();\n    this.socket = socket;\n  }\n}\n```\n\n### Variable Naming Conventions\n- **Constants**: `UPPER_SNAKE_CASE`\n- **Classes**: `PascalCase`\n- **Functions/Variables**: `camelCase`\n- **Private properties**: `_prefixWithUnderscore`\n\n```javascript\n// Constants\nconst MAX_BUFFER_SIZE = 1024 * 1024;\nconst DEFAULT_TIMEOUT = 5000;\n\n// Classes\nclass RtmpSession extends BaseSession {\n  constructor(socket) {\n    super();\n    this._privateProperty = value;\n    this.publicProperty = value;\n  }\n}\n```\n\n### Error Handling\n```javascript\n// Use try-catch for async operations\ntry {\n  const result = await someAsyncOperation();\n  res.json({ success: true, data: result });\n} catch (error) {\n  logger.error(`Operation failed: ${error.message}`);\n  res.status(500).json({\n    success: false,\n    error: \"Internal server error\"\n  });\n}\n\n// Use logger for different log levels\nlogger.trace(\"Detailed trace message\");\nlogger.debug(\"Debug information\");\nlogger.info(\"General information\");\nlogger.warn(\"Warning message\");\nlogger.error(\"Error message\");\n```\n\n### Protocol and Session Patterns\n- Each protocol extends `BaseSession`\n- Use composition over inheritance for protocol-specific features\n- Follow established patterns in existing session classes\n\n### JWT and Authentication\n- Use the middleware pattern for authentication\n- Handle JWT errors with proper error handling middleware\n- Always validate token expiration and validity\n\n### Configuration Management\n- Access configuration through `Context.config`\n- Use optional chaining for safe property access\n- Provide sensible defaults for missing configuration\n\n### Security Considerations\n- Never log sensitive information (passwords, tokens)\n- Use MD5 hashing for password storage in API\n- Validate all input parameters\n- Use CORS appropriately for cross-origin requests\n\n### Performance Guidelines\n- Use Maps for session management (not arrays)\n- Implement proper cleanup in close/error handlers\n- Minimize blocking operations in event handlers\n- Use efficient data structures for broadcast management\n\n### API Design\n- Follow REST conventions for API endpoints\n- Use consistent response format:\n  ```javascript\n  {\n    success: true|false,\n    data: {},\n    message: \"Optional message\",\n    error: \"Error details if success=false\"\n  }\n  ```\n- Implement proper HTTP status codes\n- Add comprehensive error handling\n\n### File Organization\n- Keep related functionality in same directory\n- Use clear, descriptive file names\n- Group API handlers by functionality\n- Separate protocol implementations\n\nThis codebase follows a professional Node.js server architecture with emphasis on performance, security, and maintainability. Always test thoroughly after making changes.","category":"root","tokens":1437}]}