mirror of
https://github.com/sweetwisdom/everything-claude-code-zh.git
synced 2026-03-21 22:10:09 +00:00
chore: sync with upstream ae2c063 + update zh translations
This commit is contained in:
@@ -52,7 +52,7 @@ process.stdin.on('end', () => {
|
||||
if (hasConsole) {
|
||||
console.error('[Hook] Remove console.log statements before committing');
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
// Silently ignore errors (git might not be available, etc.)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ const {
|
||||
getTimeString,
|
||||
getSessionIdShort,
|
||||
ensureDir,
|
||||
readFile,
|
||||
writeFile,
|
||||
replaceInFile,
|
||||
log
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* files and notifies Claude of available context to load.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const {
|
||||
getSessionsDir,
|
||||
getLearnedSkillsDir,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const {
|
||||
getTempDir,
|
||||
readFile,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { commandExists, getClaudeDir, readFile, writeFile, log, runCommand } = require('./utils');
|
||||
const { commandExists, getClaudeDir, readFile, writeFile } = require('./utils');
|
||||
|
||||
// Package manager definitions
|
||||
const PACKAGE_MANAGERS = {
|
||||
|
||||
@@ -79,17 +79,34 @@ function getTimeString() {
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the git repository name
|
||||
*/
|
||||
function getGitRepoName() {
|
||||
const result = runCommand('git rev-parse --show-toplevel');
|
||||
if (!result.success) return null;
|
||||
return path.basename(result.output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project name from git repo or current directory
|
||||
*/
|
||||
function getProjectName() {
|
||||
const repoName = getGitRepoName();
|
||||
if (repoName) return repoName;
|
||||
return path.basename(process.cwd()) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get short session ID from CLAUDE_SESSION_ID environment variable
|
||||
* Returns the last 8 characters for uniqueness with brevity
|
||||
* @param {string} fallback - Fallback value if no session ID (default: 'default')
|
||||
* Returns last 8 characters, falls back to project name then 'default'
|
||||
*/
|
||||
function getSessionIdShort(fallback = 'default') {
|
||||
const sessionId = process.env.CLAUDE_SESSION_ID;
|
||||
if (!sessionId || sessionId.length === 0) {
|
||||
return fallback;
|
||||
if (sessionId && sessionId.length > 0) {
|
||||
return sessionId.slice(-8);
|
||||
}
|
||||
return sessionId.slice(-8);
|
||||
return getProjectName() || fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,7 +165,7 @@ function findFiles(dir, pattern, options = {}) {
|
||||
searchDir(fullPath);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
// Ignore permission errors
|
||||
}
|
||||
}
|
||||
@@ -373,7 +390,11 @@ module.exports = {
|
||||
getDateString,
|
||||
getTimeString,
|
||||
getDateTimeString,
|
||||
|
||||
// Session/Project
|
||||
getSessionIdShort,
|
||||
getGitRepoName,
|
||||
getProjectName,
|
||||
|
||||
// File operations
|
||||
findFiles,
|
||||
|
||||
@@ -19,10 +19,8 @@ const {
|
||||
setProjectPackageManager,
|
||||
getAvailablePackageManagers,
|
||||
detectFromLockFile,
|
||||
detectFromPackageJson,
|
||||
getSelectionPrompt
|
||||
detectFromPackageJson
|
||||
} = require('./lib/package-manager');
|
||||
const { log } = require('./lib/utils');
|
||||
|
||||
function showHelp() {
|
||||
console.log(`
|
||||
|
||||
Reference in New Issue
Block a user