claude-git-hooks 2.30.1 → 2.30.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ Todos los cambios notables en este proyecto se documentarán en este archivo.
5
5
  El formato está basado en [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.30.2] - 2026-03-18
9
+
10
+ ### 🔧 Changed
11
+ - Authorization now uses GitHub's `role_name` field instead of legacy `permission` field for more accurate role mapping
12
+ - Improved authorization error messages to show the actual GitHub permission that failed to map
13
+
14
+ ### 🐛 Fixed
15
+ - Fixed role mapping to use `write` instead of `push` to match GitHub's current API role names
16
+
17
+
8
18
  ## [2.30.1] - 2026-03-17
9
19
 
10
20
  ### ✨ Added
package/bin/claude-hooks CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  import { error } from '../lib/commands/helpers.js';
12
12
  import { buildCommandMap } from '../lib/cli-metadata.js';
13
+ import logger from '../lib/utils/logger.js';
14
+ import { getConfig } from '../lib/config.js';
13
15
 
14
16
  /**
15
17
  * Main CLI router
@@ -18,6 +20,16 @@ async function main() {
18
20
  const args = process.argv.slice(2);
19
21
  const command = args[0];
20
22
 
23
+ // Activate debug mode early so authorization logging is visible
24
+ try {
25
+ const config = await getConfig();
26
+ if (config.system?.debug) {
27
+ logger.setDebugMode(true);
28
+ }
29
+ } catch {
30
+ // Config load failure is non-fatal for debug activation
31
+ }
32
+
21
33
  const commandMap = buildCommandMap();
22
34
  const entry = commandMap.get(command);
23
35
 
@@ -92,8 +104,8 @@ async function main() {
92
104
  break;
93
105
  case 'permission_unmapped':
94
106
  error(
95
- '⛔ Authorization failed: your GitHub permission level is not mapped to any role.\n' +
96
- ` Contact your Tech Lead to update ${PERMISSIONS_SOURCE}`
107
+ `⛔ Authorization failed: your GitHub permission '${err.githubPermission}' is not mapped to any role.\n` +
108
+ ` Contact your Tech Lead to update roleMapping in ${PERMISSIONS_SOURCE}`
97
109
  );
98
110
  break;
99
111
  case 'insufficient_role': {
@@ -1046,7 +1046,7 @@ export const checkOrgMembership = async (username, org) => {
1046
1046
  * @param {string} owner - Repository owner
1047
1047
  * @param {string} repo - Repository name
1048
1048
  * @param {string} username - GitHub username
1049
- * @returns {Promise<string>} Permission level: 'admin', 'maintain', 'push', 'triage', 'read', 'none'
1049
+ * @returns {Promise<string>} Role name: 'admin', 'maintain', 'write', 'triage', 'read', 'none'
1050
1050
  * @throws {GitHubAPIError} On API failure (fail-closed — caller should block on error)
1051
1051
  */
1052
1052
  export const getCollaboratorPermission = async (owner, repo, username) => {
@@ -1065,17 +1065,17 @@ export const getCollaboratorPermission = async (owner, repo, username) => {
1065
1065
  username
1066
1066
  });
1067
1067
 
1068
- const permission = data.permission;
1068
+ const roleName = data.role_name;
1069
1069
 
1070
1070
  logger.debug('github-api - getCollaboratorPermission', 'Permission resolved', {
1071
1071
  owner,
1072
1072
  repo,
1073
1073
  username,
1074
- permission,
1075
- roleNameFromApi: data.role_name
1074
+ roleName,
1075
+ legacyPermission: data.permission
1076
1076
  });
1077
1077
 
1078
- return permission;
1078
+ return roleName;
1079
1079
  } catch (error) {
1080
1080
  const statusCode = error.status || error.response?.status;
1081
1081
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-git-hooks",
3
- "version": "2.30.1",
3
+ "version": "2.30.2",
4
4
  "description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
5
5
  "type": "module",
6
6
  "bin": {