mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-18 23:03:06 +08:00
Adds `--locale <code>` support to the ECC installer so users can install localized reference docs (agents, commands, skills, rules) into `~/.claude/docs/<locale>/` alongside the existing English installation. Changes: - manifests/install-modules.json: add 8 locale doc modules (docs-ja-JP, docs-zh-CN, docs-ko-KR, docs-pt-BR, docs-ru, docs-tr, docs-vi-VN, docs-zh-TW), each with kind="docs" and defaultInstall=false - manifests/install-components.json: add 8 locale: components mapping to the new modules - scripts/lib/install-manifests.js: add locale: family prefix, SUPPORTED_LOCALES, LOCALE_ALIAS_TO_COMPONENT_ID (with aliases like ja=ja-JP, zh=zh-CN, ko=ko-KR), and listSupportedLocales() - scripts/lib/install/request.js: add --locale flag to parseInstallArgs(), resolve locale alias → component ID in normalizeInstallRequest(), throw on unsupported locale codes - scripts/lib/install-targets/claude-home.js: map docs/<locale>/ source paths to ~/.claude/docs/<locale>/ destination (side-by-side, no overwrite of English files) - scripts/install-apply.js: import listSupportedLocales, add --locale usage line and available locales list to --help output Usage examples: ./install.sh --locale ja # Japanese docs only ./install.sh --profile core --locale zh-CN # core profile + zh-CN docs ./install.sh typescript --locale ja # legacy + locale (errors)
92 lines
2.5 KiB
JavaScript
92 lines
2.5 KiB
JavaScript
const path = require('path');
|
|
|
|
const {
|
|
createInstallTargetAdapter,
|
|
createRemappedOperation,
|
|
isForeignPlatformPath,
|
|
normalizeRelativePath,
|
|
} = require('./helpers');
|
|
|
|
const CLAUDE_ECC_NAMESPACE = 'ecc';
|
|
|
|
function getClaudeManagedDestinationPath(adapter, sourceRelativePath, input) {
|
|
const normalizedSourcePath = normalizeRelativePath(sourceRelativePath);
|
|
const targetRoot = adapter.resolveRoot(input);
|
|
|
|
if (normalizedSourcePath === 'rules') {
|
|
return path.join(targetRoot, 'rules', CLAUDE_ECC_NAMESPACE);
|
|
}
|
|
|
|
if (normalizedSourcePath.startsWith('rules/')) {
|
|
return path.join(
|
|
targetRoot,
|
|
'rules',
|
|
CLAUDE_ECC_NAMESPACE,
|
|
normalizedSourcePath.slice('rules/'.length)
|
|
);
|
|
}
|
|
|
|
if (normalizedSourcePath === 'skills') {
|
|
return path.join(targetRoot, 'skills', CLAUDE_ECC_NAMESPACE);
|
|
}
|
|
|
|
if (normalizedSourcePath.startsWith('skills/')) {
|
|
return path.join(
|
|
targetRoot,
|
|
'skills',
|
|
CLAUDE_ECC_NAMESPACE,
|
|
normalizedSourcePath.slice('skills/'.length)
|
|
);
|
|
}
|
|
|
|
if (normalizedSourcePath === 'docs' || normalizedSourcePath.startsWith('docs/')) {
|
|
return path.join(targetRoot, normalizedSourcePath);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
module.exports = createInstallTargetAdapter({
|
|
id: 'claude-home',
|
|
target: 'claude',
|
|
kind: 'home',
|
|
rootSegments: ['.claude'],
|
|
installStatePathSegments: ['ecc', 'install-state.json'],
|
|
nativeRootRelativePath: '.claude-plugin',
|
|
planOperations(input, adapter) {
|
|
const modules = Array.isArray(input.modules)
|
|
? input.modules
|
|
: (input.module ? [input.module] : []);
|
|
const planningInput = {
|
|
repoRoot: input.repoRoot,
|
|
projectRoot: input.projectRoot,
|
|
homeDir: input.homeDir,
|
|
};
|
|
|
|
return modules.flatMap(module => {
|
|
const paths = Array.isArray(module.paths) ? module.paths : [];
|
|
return paths
|
|
.filter(p => !isForeignPlatformPath(p, adapter.target))
|
|
.map(sourceRelativePath => {
|
|
const managedDestinationPath = getClaudeManagedDestinationPath(
|
|
adapter,
|
|
sourceRelativePath,
|
|
planningInput
|
|
);
|
|
|
|
if (managedDestinationPath) {
|
|
return createRemappedOperation(
|
|
adapter,
|
|
module.id,
|
|
sourceRelativePath,
|
|
managedDestinationPath,
|
|
{ strategy: 'preserve-relative-path' }
|
|
);
|
|
}
|
|
|
|
return adapter.createScaffoldOperation(module.id, sourceRelativePath, planningInput);
|
|
});
|
|
});
|
|
},
|
|
});
|