Identify the primary module or component affected by changes for commit scope
From git-commit-assistantnpx claudepluginhub dhofheinz/open-plugins --plugin git-commit-assistantcommit-analysis/Analyze git changes to determine the appropriate scope (module/component/area) for the conventional commit message.
No parameters required. Analyzes current changes.
git rev-parse --git-dir 2>/dev/null
git status --short
Execute scope identifier script:
git diff HEAD --name-only | .scripts/scope-identifier.sh
The script analyzes file paths to identify affected modules.
Directory-Based Scope:
src/auth/* → scope: auth
src/api/* → scope: api
src/components/* → scope: components (or specific component)
src/utils/* → scope: utils
src/database/* → scope: database
tests/* → scope: test (or module being tested)
docs/* → scope: docs
Component-Based Scope:
src/components/LoginForm.js → scope: login-form
src/components/UserProfile/* → scope: user-profile
src/api/users.js → scope: users or user-api
src/auth/oauth.js → scope: oauth or auth
Multiple Scopes: If multiple distinct scopes:
Primary: auth (5 files)
Secondary: api (2 files)
Recommendation: Split into separate commits or use broader scope
Specific Scope (preferred):
Broad Scope:
No Scope (optional):
SCOPE IDENTIFICATION
═══════════════════════════════════════════════
PRIMARY SCOPE: <scope-name>
CONFIDENCE: <High|Medium|Low>
REASONING:
───────────────────────────────────────────────
<explanation of scope selection>
AFFECTED AREAS:
───────────────────────────────────────────────
<scope>: X files
- path/to/file1.js
- path/to/file2.js
<other-scope>: X files (if applicable)
- path/to/file3.js
FILE PATH ANALYSIS:
───────────────────────────────────────────────
src/auth/*: 5 files → scope: auth
src/api/*: 2 files → scope: api
tests/*: 3 files → scope based on tested module
RECOMMENDATION:
───────────────────────────────────────────────
Use scope: "<recommended-scope>"
Alternative: <if multiple scopes>
- Split into commits: auth (5 files), api (2 files)
- Use broader scope: "backend"
- Use no scope (if too diverse)
═══════════════════════════════════════════════
Format:
Good Examples:
auth
user-api
login-form
payment-processing
database
ci-pipeline
docs
Bad Examples:
src/auth/oauth (too specific, includes path)
Authentication (not lowercase)
user_api (use hyphens, not underscores)
the-entire-authentication-module-system (too long)
auth, api, components, ui, pages, routing, state, utils, config, hooks
api, auth, database, middleware, routes, controllers, services, models, validation
core, utils, types, cli, docs, build, test
frontend, backend, api, database, auth, ci, docs
Case 1: Closely Related Scopes
Changes in: auth/oauth.js, auth/providers.js, auth/middleware.js
Recommendation: scope: "auth"
Case 2: Distinct Scopes
Changes in: auth/* (5 files), api/* (3 files)
Recommendation: Split commits
- Commit 1: feat(auth): implement OAuth
- Commit 2: feat(api): add user endpoints
Case 3: Very Broad Changes
Changes in: 15 different directories
Recommendation: Use broad scope or no scope
- feat(core): major refactoring
- feat: implement new architecture
Return:
No changes:
NO CHANGES
Cannot identify scope from empty diff.
Unclear scope:
SCOPE UNCLEAR
Changes span multiple unrelated areas.
Recommendations:
- Split into focused commits
- Use broader scope like "core" or "backend"
- Use no scope
The commit-assistant agent uses this operation to:
# Agent identifies scope automatically
# User: "commit my auth changes"
# Agent: Invokes identify-scope
# Operation: Returns "auth" with high confidence
# Agent: Uses in message "feat(auth): ..."