Loading repository data…
Loading repository data…
hitoriiiiiiii / repository
Teams-CLI is a TypeScript-based command-line tool for managing teams and GitHub repositories, with GitHub API integration, repository analytics, and Prisma-powered database support.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A comprehensive, production-ready CLI tool and REST API for managing GitHub teams, repositories, members, and analytics. Built with TypeScript, Express, Prisma, and Redis.
Author: hitoriiiiiiii | GitHub: Teams-Cli
npm install -g @prarthana25/teams-cli
teams login
npm install @prarthana25/teams-cli
npx @prarthana25/teams-cli login
npx @prarthana25/teams-cli team list
teams login
# Create a new team
teams team create "MyAwesomeTeam"
# List your teams
teams team list
# Get team details
teams team get 1
# Add a member to a team
teams member add --team-id 1 --username octocat
# List team members
teams member list --team-id 1
# Remove a member
teams member remove --team-id 1 --user-id 5
# Send an invite to a new user
teams invite send --team-id 1 --username newuser
# Accept an invite using code
teams invite accept --code ABC12345XYZ
# List pending invites
teams invite list --team-id 1
# Add a GitHub repository to a team
teams repo add --team-id 1 --url https://github.com/user/repo
# List repositories
teams repo list --team-id 1
# Get team activity summary
teams analytics summary --team-id 1
# View detailed analytics
teams analytics details --team-id 1
teams login # Authenticate with GitHub
teams logout # Sign out and clear tokens
teams whoami # Show current logged-in user
teams team list # List all teams
teams team create NAME # Create a new team
teams team get ID # Get team details
teams team delete ID # Delete a team
teams member list --team-id ID # List team members
teams member add --team-id ID --username USERNAME # Add a member
teams member remove --team-id ID --user-id USER_ID # Remove a member
teams repo list --team-id ID # List team repositories
teams repo add --team-id ID --url URL # Add a repository
teams repo remove --team-id ID --repo-id REPO_ID
teams invite list --team-id ID # List invites
teams invite send --team-id ID --username USERNAME # Send invite
teams invite accept --code CODE # Accept invite
teams analytics summary --team-id ID # Team activity summary
teams analytics commits --repo-id ID # Commit statistics
teams help # Show help information
teams version # Display version
Teams-CLI/
├── src/
│ ├── api/ # REST API server
│ │ ├── server.ts # Express server setup
│ │ ├── redis.ts # Redis client configuration
│ │ └── rateLimiter.ts # Rate limiting middleware
│ │
│ ├── cli/ # CLI command handlers
│ │ ├── command.ts # Command registration & routing
│ │ ├── auth.ts # Authentication commands
│ │ ├── team.ts # Team commands
│ │ ├── github.ts # GitHub integration
│ │ └── help.ts # Help documentation
│ │
│ ├── controllers/ # API request handlers
│ │ ├── team.controller.ts
│ │ ├── user.controller.ts
│ │ ├── repo.controller.ts
│ │ ├── commit.controller.ts
│ │ ├── invite.controller.ts
│ │ └── analytics.controller.ts
│ │
│ ├── services/ # Business logic layer
│ │ ├── github.services.ts # GitHub API interactions
│ │ ├── npm.services.ts # NPM operations
│ │ └── analytics.services.ts
│ │
│ ├── utils/ # Utility functions
│ │ ├── logger.ts # Logging utility
│ │ ├── spinner.ts # CLI spinner
│ │ ├── inquirer.ts # Interactive prompts
│ │ └── currentUser.ts
│ │
│ ├── config/ # Configuration
│ │ └── auth.config.ts # Auth configuration
│ │
│ ├── core/ # Core functionality
│ │ └── cron.analytics.ts # Scheduled analytics
│ │
│ ├── db/ # Database layer
│ │ └── prisma.ts # Prisma client initialization
│ │
│ ├── test/ # Test files
│ │ ├── teams.test.ts
│ │ ├── user.test.ts
│ │ ├── repo.test.ts
│ │ ├── commit.test.ts
│ │ └── invite.test.ts
│ │
│ ├── index.ts # CLI entry point
│ └── api.ts # API entry point
│
├── prisma/ # Database ORM
│ ├── schema.prisma # Database schema
│ └── migrations/ # Database migrations
│
├── scripts/ # Build & utility scripts
│ └── pre-publish-check.ts
│
├── docker-compose.yml # Docker services (PostgreSQL, Redis)
├── Dockerfile # Docker image
├── jest.config.ts # Jest testing configuration
├── tsconfig.json # TypeScript configuration
├── package.json # Dependencies
└── README.md # This file
18.0.0 or higher9.0.0 or higher12+ (for database)6+ (for caching & rate limiting)git clone https://github.com/hitoriiiiiiii/Teams-Cli.git
cd Teams-CLI
npm install
Create a .env file in the root directory:
# Database Configuration
DATABASE_URL="postgresql://user:password@localhost:5432/teams_db"
# Redis Configuration
REDIS_URL="redis://localhost:6379"
# GitHub OAuth
GITHUB_CLIENT_ID="your-github-oauth-client-id"
GITHUB_CLIENT_SECRET="your-github-oauth-client-secret"
GITHUB_TOKEN="your-github-personal-access-token"
# API Configuration
PORT=3000
NODE_ENV=development
How to Get GitHub OAuth Credentials:
http://localhost:3000/auth/github/callback.env# Run Prisma migrations
npx prisma migrate deploy
# Generate Prisma client
npx prisma generate
# (Optional) Seed test data
ts-node setup-test-user.ts
For CLI Development:
npm run dev
For REST API:
npm run api
For Production:
npm run build
npm start
Start the API server:
npm run api
The server will be available at http://localhost:3000
GET /health → Check API health
GET /api/teams → List all teams
POST /api/teams → Create new team
GET /api/teams/:id → Get team details
PUT /api/teams/:id → Update team
DELETE /api/teams/:id → Delete team
GET /api/teams/:id/members → List team members
GET /api/teams/:id/repos → List team repositories
GET /api/teams/:id/analytics → Get team analytics
GET /api/users → List all users
GET /api/users/:id → Get user details
GET /api/users/:id/teams → Get user's teams
GET /api/repos → List all repositories
POST /api/repos → Add repository
GET /api/repos/:id → Get repository details
DELETE /api/repos/:id → Delete repository
GET /api/repos/:id/commits → Get repository commits
GET /api/commits → List all commits
GET /api/commits/:id → Get commit details
GET /api/repos/:id/commits → List commits for a repository
GET /api/invites → List all invites
POST /api/invites → Create invite
POST /api/invites/:code/accept → Accept invite
DELETE /api/invites/:id → Cancel invite
GET /api/analytics/summary → Overall statistics
GET /api/analytics/teams/:id → Team analytics
GET /api/analytics/repos/:id → Repository analytics
All API requests (except health check and OAuth) require a Bearer token:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
http://localhost:3000/api/teams
Create a Team:
curl -X POST http://localhost:3000/api/teams \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Frontend Team",
"description": "Our awesome frontend team"
}'
Add Repository to Team:
curl -X POST http://localhost:3000/api/repos \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"teamId": 1,
"url": "https://github.com/user/repo-name"
}'
The API implements comprehensive rate limiting powered by Redis:
| Endpoint Category | Limit | Window |
|---|---|---|
| General Requests | 100 | 1 minute |
| Authentication | 10 | 15 minutes |
| Sensitive Operations | 5 | 1 minute |
| Public Endpoints | 200 | 1 hour |
See API_RATE_LIMITING.md for advanced configuration.
✅ GitHub OAuth 2.0 - Secure token-based authentication
✅ CORS Protection - Configured cross-origin access
✅ Input Validation - Comprehensive parameter validation
✅ Token Encryption - Secure token storage in database
✅ Rate Limiting - Prevent brute force and DDoS attacks
npm test
npm test -- --coverage
npm test -- teams.test.ts
npm test -- --watch