Fix claude-project target for legacy language installs (#2147)

This commit is contained in:
Adilan Akhramovich
2026-06-07 10:26:11 +05:00
committed by GitHub
parent 0cb8907e14
commit 53d4b7d664
2 changed files with 27 additions and 13 deletions

View File

@@ -262,18 +262,16 @@ function isDirectoryNonEmpty(dirPath) {
return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory() && fs.readdirSync(dirPath).length > 0;
}
function planClaudeLegacyInstall(context) {
const adapter = getInstallTargetAdapter('claude');
const targetRoot = adapter.resolveRoot({ homeDir: context.homeDir });
const rulesDir = context.claudeRulesDir || path.join(targetRoot, 'rules', CLAUDE_ECC_NAMESPACE);
const installStatePath = adapter.getInstallStatePath({ homeDir: context.homeDir });
function planClaudeStyleLegacyInstall(context, { adapterId, adapterRootInput, rulesDir: rulesDirOverride }) {
const adapter = getInstallTargetAdapter(adapterId);
const targetRoot = adapter.resolveRoot(adapterRootInput);
const rulesDir = rulesDirOverride || path.join(targetRoot, 'rules', CLAUDE_ECC_NAMESPACE);
const installStatePath = adapter.getInstallStatePath(adapterRootInput);
const operations = [];
const warnings = [];
if (isDirectoryNonEmpty(rulesDir)) {
warnings.push(
`Destination ${rulesDir}/ already exists and files may be overwritten`
);
warnings.push(`Destination ${rulesDir}/ already exists and files may be overwritten`);
}
addRecursiveCopyOperations(operations, {
@@ -285,9 +283,7 @@ function planClaudeLegacyInstall(context) {
for (const language of context.languages) {
if (!LANGUAGE_NAME_PATTERN.test(language)) {
warnings.push(
`Invalid language name '${language}'. Only alphanumeric, dash, and underscore are allowed`
);
warnings.push(`Invalid language name '${language}'. Only alphanumeric, dash, and underscore are allowed`);
continue;
}
@@ -308,7 +304,7 @@ function planClaudeLegacyInstall(context) {
return {
mode: 'legacy',
adapter,
target: 'claude',
target: adapterId,
targetRoot,
installRoot: rulesDir,
installStatePath,
@@ -318,6 +314,22 @@ function planClaudeLegacyInstall(context) {
};
}
function planClaudeLegacyInstall(context) {
return planClaudeStyleLegacyInstall(context, {
adapterId: 'claude',
adapterRootInput: { homeDir: context.homeDir },
rulesDir: context.claudeRulesDir || null,
});
}
function planClaudeProjectLegacyInstall(context) {
return planClaudeStyleLegacyInstall(context, {
adapterId: 'claude-project',
adapterRootInput: { repoRoot: context.projectRoot },
rulesDir: null,
});
}
function planCursorLegacyInstall(context) {
const adapter = getInstallTargetAdapter('cursor');
const targetRoot = adapter.resolveRoot({ repoRoot: context.projectRoot });
@@ -503,6 +515,8 @@ function createLegacyInstallPlan(options = {}) {
let plan;
if (target === 'claude') {
plan = planClaudeLegacyInstall(context);
} else if (target === 'claude-project') {
plan = planClaudeProjectLegacyInstall(context);
} else if (target === 'cursor') {
plan = planCursorLegacyInstall(context);
} else {

View File

@@ -2,7 +2,7 @@
const { validateInstallModuleIds, LOCALE_ALIAS_TO_COMPONENT_ID, listSupportedLocales } = require('../install-manifests');
const LEGACY_INSTALL_TARGETS = ['claude', 'cursor', 'antigravity'];
const LEGACY_INSTALL_TARGETS = ['claude', 'claude-project', 'cursor', 'antigravity'];
function dedupeStrings(values) {
return [...new Set((Array.isArray(values) ? values : []).map(value => String(value).trim()).filter(Boolean))];