Organization Commands
Overview
Organization commands provide team-based repository management capabilities including organization creation, member management with role-based access control, and repository association. Organizations enable collaborative workflows with proper access control and visibility management.
Table of Contents
cpm org create
Description
Create a new organization for grouping repositories and managing team access. Organizations provide namespace isolation and centralized access control.
Syntax
cpm org create <name> [flags]
Arguments
| Argument |
Required |
Description |
name |
Yes |
Organization name (alphanumeric with hyphens/underscores) |
Flags
| Flag |
Type |
Description |
--description <text> |
string |
Organization description |
Examples
# Create basic organization
cpm org create engineering
# Output:
# Organization 'engineering' created successfully
# ID: 1
# Created: 2024-01-15 10:30:00
# Create with description
cpm org create data-science --description "Data science and ML projects"
# Output:
# Organization 'data-science' created successfully
# ID: 2
# Description: Data science and ML projects
# Created: 2024-01-15 10:35:00
Database Effects
Creates record in organizations table:
INSERT INTO organizations (name, description, created_at)
VALUES ('engineering', 'Engineering team repositories', CURRENT_TIMESTAMP);
Common Errors
| Error |
Cause |
Solution |
organization already exists |
Name collision |
Choose different name |
invalid name |
Contains invalid characters |
Use alphanumeric, hyphens, underscores only |
cpm org list
Description
List all organizations with their metadata including member count and repository count.
Syntax
cpm org list [flags]
Flags
| Flag |
Type |
Description |
--format <type> |
string |
Output format: table, json, yaml |
--sort <field> |
string |
Sort by: name, created, members, repos |
Examples
cpm org list
# Output:
# ORGANIZATIONS
#
# Name Description Members Repos Created
# ------------ ------------------------------ ------- ----- -------------------
# engineering Engineering team repositories 12 8 2024-01-15 10:30:00
# data-science Data science and ML projects 5 3 2024-01-15 10:35:00
# devops Infrastructure and deployment 8 12 2024-01-16 09:00:00
#
# Total: 3 organizations
# JSON output
cpm org list --format json
# Output:
# [
# {
# "id": 1,
# "name": "engineering",
# "description": "Engineering team repositories",
# "members": 12,
# "repositories": 8,
# "created_at": "2024-01-15T10:30:00Z"
# }
# ]
cpm org show
Description
Display detailed information about an organization including all members with roles and all associated repositories.
Syntax
cpm org show <name>
Arguments
| Argument |
Required |
Description |
name |
Yes |
Organization name |
Examples
cpm org show engineering
# Output:
# ORGANIZATION: engineering
# ID: 1
# Description: Engineering team repositories
# Created: 2024-01-15 10:30:00
#
# MEMBERS (12)
#
# Username Role Joined
# ---------- -------- -------------------
# alice owner 2024-01-15 10:30:00
# bob admin 2024-01-15 11:00:00
# charlie admin 2024-01-16 09:30:00
# david member 2024-01-16 10:00:00
# eve member 2024-01-16 11:30:00
# ... (7 more)
#
# REPOSITORIES (8)
#
# Name Path Added
# ----------- ----------------------------------- -------------------
# webapp /home/user/.cpm/data/webapp.git 2024-01-15 12:00:00
# api-server /home/user/.cpm/data/api-server.git 2024-01-16 08:30:00
# mobile-app /home/user/.cpm/data/mobile-app.git 2024-01-16 14:00:00
# ... (5 more)
#
# ROLES:
# owner - Full control including organization deletion
# admin - Manage members and repositories
# member - Read access to repositories
cpm org delete
Description
Delete an organization and remove all member and repository associations. Repositories themselves are not deleted, only their organization association.
Syntax
cpm org delete <name>
Arguments
| Argument |
Required |
Description |
name |
Yes |
Organization name to delete |
Behavior
- Prompts for confirmation
- Removes all organization memberships
- Removes all repository associations (repositories remain)
- Deletes organization record from database
- Cannot be undone
Examples
cpm org delete old-project
# Prompt:
# WARNING: This will delete organization 'old-project'
# All members will be removed from the organization
# All repositories will be disassociated (but not deleted)
# This action cannot be undone.
#
# Type the organization name to confirm: old-project
# Output:
# Removing 5 members...
# Disassociating 3 repositories...
# Deleting organization 'old-project'...
#
# Organization 'old-project' deleted successfully
cpm org add-member
Description
Add a user to an organization with specified role. Supports three roles: owner, admin, and member.
Syntax
cpm org add-member <org> <user> [flags]
Arguments
| Argument |
Required |
Description |
org |
Yes |
Organization name |
user |
Yes |
Username to add |
Flags
| Flag |
Type |
Default |
Description |
--role <role> |
string |
member |
Role: owner, admin, or member |
Role Permissions
| Role |
Permissions |
owner |
Full control: delete org, manage all members and repos |
admin |
Manage members and repositories, cannot delete org |
member |
Read access to organization repositories |
Examples
# Add member with default role
cpm org add-member engineering alice
# Output:
# User 'alice' added to organization 'engineering' as member
# Add admin
cpm org add-member engineering bob --role admin
# Output:
# User 'bob' added to organization 'engineering' as admin
# Add owner
cpm org add-member engineering charlie --role owner
# Output:
# User 'charlie' added to organization 'engineering' as owner
Common Errors
| Error |
Cause |
Solution |
organization not found |
Org doesn't exist |
Create org first |
user not found |
User doesn't exist |
Add user with cpm user add |
user already member |
User already in org |
Update role instead |
invalid role |
Invalid role specified |
Use: owner, admin, or member |
cpm org remove-member
Description
Remove a user from an organization. Revokes all organization-based repository access.
Syntax
cpm org remove-member <org> <user>
Arguments
| Argument |
Required |
Description |
org |
Yes |
Organization name |
user |
Yes |
Username to remove |
Examples
cpm org remove-member engineering alice
# Prompt:
# Remove user 'alice' from organization 'engineering'?
# This will revoke organization-based repository access. (y/N): y
# Output:
# User 'alice' removed from organization 'engineering'
# Organization repository access revoked
cpm org add-repo
Description
Associate an existing repository with an organization. Repository must already exist.
Syntax
cpm org add-repo <org> <repo>
Arguments
| Argument |
Required |
Description |
org |
Yes |
Organization name |
repo |
Yes |
Repository name |
Examples
cpm org add-repo engineering webapp
# Output:
# Repository 'webapp' added to organization 'engineering'
# Organization members now have access based on their roles
# Add newly created repository
cpm init new-project
cpm org add-repo engineering new-project
# Output:
# Repository 'new-project' added to organization 'engineering'
Common Errors
| Error |
Cause |
Solution |
repository not found |
Repo doesn't exist |
Initialize repo first |
repository already in org |
Repo already associated |
Repository can only belong to one org |
organization not found |
Org doesn't exist |
Create org first |
cpm org remove-repo
Description
Remove repository association from organization. Repository itself is not deleted, only the organizational link.
Syntax
cpm org remove-repo <org> <repo>
Arguments
| Argument |
Required |
Description |
org |
Yes |
Organization name |
repo |
Yes |
Repository name |
Examples
cpm org remove-repo engineering old-project
# Prompt:
# Remove repository 'old-project' from organization 'engineering'?
# The repository will not be deleted. (y/N): y
# Output:
# Repository 'old-project' removed from organization 'engineering'
# Repository still exists at: /home/user/.cpm/data/old-project.git
Organization Workflow Examples
Create Organization Structure
# Create organization
cpm org create platform --description "Platform engineering team"
# Add members with roles
cpm org add-member platform alice --role owner
cpm org add-member platform bob --role admin
cpm org add-member platform charlie --role member
cpm org add-member platform david --role member
# Create and add repositories
cpm init core-api --org platform
cpm init web-frontend --org platform
cpm init mobile-app --org platform
# Verify structure
cpm org show platform
Reorganize Repositories
# Move repository to different org
cpm org remove-repo old-team myproject
cpm org add-repo new-team myproject
# Split organization
cpm org create frontend-team
cpm org create backend-team
# Reassign repositories
cpm org remove-repo engineering web-ui
cpm org add-repo frontend-team web-ui
cpm org remove-repo engineering api-server
cpm org add-repo backend-team api-server
Member Management
# Promote member to admin
cpm org remove-member engineering alice
cpm org add-member engineering alice --role admin
# Transfer ownership
cpm org add-member engineering newowner --role owner
cpm org remove-member engineering oldowner
# Bulk add members (using script)
for user in alice bob charlie david; do
cpm org add-member engineering $user
done
Best Practices
Organization Naming
- Use descriptive, team-based names:
frontend-team, data-engineering
- Keep names lowercase with hyphens
- Avoid abbreviations unless widely understood
- Use consistent naming across your infrastructure
Role Assignment
- Owner: 1-2 people with ultimate responsibility
- Admin: Team leads who manage day-to-day operations
- Member: Individual contributors with read access
- Always have at least one owner
- Document role responsibilities in organization description
Repository Organization
- Group repositories by team ownership, not technology
- Keep organizations focused (5-15 repos ideal)
- Create separate organizations for different products
- Use consistent repository naming within organization
Access Control Strategy
- Start with least privilege (member role)
- Promote to admin only when needed
- Regular audits of organization membership
- Remove inactive members promptly
- Document access requirements
See Also