Repository navigation
feat(profile): add profile new command with metadata inputs - #12
Merged
Merged
Conversation
Creates a profile directory under .agent-ctrl/profiles/<name>/ with scaffolded artifact subdirectories (rules, skills, agents, commands, mcps) kept in git via .gitkeep. Optional display metadata (name, description, tags) is written to profile.yaml; the first tag becomes the profile category. Supports --dry-run and interactive fallback prompts for missing metadata.
Address code review findings on the profile new command: - Thread errorId through toSystemError: writes now map to FILE_WRITE_FAILED, directory creation to DIRECTORY_CREATE_FAILED - Config-root access errors only surface as UserError for ENOENT; other codes become SystemError with DIRECTORY_ACCESS_FAILED - Clean up the partially scaffolded profile when creation fails mid-way - Source PROFILE_ARTIFACT_DIRECTORIES/PROFILE_GITKEEP_FILE from Profile.ts instead of re-declaring them - Hoist metadata + parseTagsInput in the CLI action instead of computing twice - Add SystemError mapping and partial-cleanup tests via IFileSystem stub
Improve code formatting in error handling and imports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Context
Adds a
profile newcommand to scaffold a named profile directory under.agent-ctrl/profiles/<name>/with its artifact subdirectories, matching theconvention established by
agent-ctrl init.The profile directory is created with
rules/,skills/,agents/,commands/, andmcps/subdirectories (each kept in git via.gitkeep), soa new profile is immediately usable with
profile applywithout manualfolder setup.
Optional display metadata (
--name,--description,--tags) is written toprofile.yaml; the first tag becomes the profile's category inprofile listgrouping. Missing metadata falls back to interactive prompts.
⚙️ Implementation Details
CreateProfileCommand(new): validates the profile name(
/^[a-zA-Z0-9_-]+$/), verifies the config root exists, rejects duplicates(
PROFILE_ALREADY_EXISTS), scaffolds the 5 artifact subdirectories with.gitkeep, and writesprofile.yamlonly when metadata is non-empty.IFileSystem-injected for testability, mirroringInitCommand.profile.ts): addsprofile new <name>with--name,--description,--tags,--path,--dry-runoptions andinteractive fallback via
PromptService.UserErrorfor invalid names / missing config root,ProfileErrorfor duplicates,SystemErrorwith code-specific messages forEACCES/ENOSPC/EROFS.ProfileMetadataReader, empty-metadata skip, scaffolding, error paths) + 4parseTagsInputtests.📋 Checklist for Reviewer
bun test: 967 pass / 2 skip / 0 fail).tsc --noEmitclean).