mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-01 06:23:28 +08:00
fix: namespace claude managed install paths
This commit is contained in:
committed by
Affaan Mustafa
parent
08d6c82989
commit
e381c8d8a8
@@ -1,4 +1,46 @@
|
||||
const { createInstallTargetAdapter } = require('./helpers');
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = createInstallTargetAdapter({
|
||||
id: 'claude-home',
|
||||
@@ -7,4 +49,39 @@ module.exports = createInstallTargetAdapter({
|
||||
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);
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user