Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export async function installCommand(options) {

// Update lock file with actually installed commands
if (lock.repositories[repoKey]) {
lock.repositories[repoKey].only = installedCommandNames;
lock.repositories[repoKey].only = installedCommandNames.map(name => ({
name: name,
path: `${name}.md`,
alias: null
}));
} else {
// This should not happen normally, but let's be safe
logWarning(`Lock file entry for ${repoKey} not found, skipping lock update`);
Expand Down
4 changes: 3 additions & 1 deletion src/commands/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ async function removeCommandFromLock(commandName, repoKey, lock) {

const repoLock = lock.repositories[repoKey];
if (repoLock.only && repoLock.only.length > 0) {
const commandIndex = repoLock.only.indexOf(commandName);
const commandIndex = repoLock.only.findIndex(item =>
typeof item === 'string' ? item === commandName : item.name === commandName
);
if (commandIndex !== -1) {
repoLock.only.splice(commandIndex, 1);

Expand Down
11 changes: 9 additions & 2 deletions src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ export async function addRepositoryToLock(user, repo, revision, commandPath = nu
// Add new command to "only" list if specified
if (commandPath) {
const commandName = commandPath.split('/').pop().replace('.md', '');
if (!repoEntry.only.includes(commandName)) {
repoEntry.only.push(commandName);
const commandExists = repoEntry.only.some(item =>
typeof item === 'string' ? item === commandName : item.name === commandName
);
if (!commandExists) {
repoEntry.only.push({
name: commandName,
path: commandPath,
alias: null
});
}
} else if (!existingRepo || !existingRepo.only || existingRepo.only.length === 0) {
// If no specific command and no existing "only" list, keep empty (all commands)
Expand Down
Loading