8000 feat(profile): add profile new command with metadata inputs by ahmet-cetinkaya · Pull Request #12 · ahmet-cetinkaya/agent-ctrl · GitHub
[go: up one dir, main page]

Skip to content

feat(profile): add profile new command with metadata inputs - #12

Merged
ahmet-cetinkaya merged 3 commits into
mainfrom
feat/profile-new-command
Aug 8, 2026
Merged

ahmet-cetinkaya merged 3 commits into
mainfrom
feat/profile-new-command

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

🚀 Context

Adds a profile new command to scaffold a named profile directory under
.agent-ctrl/profiles/<name>/ with its artifact subdirectories, matching the
convention established by agent-ctrl init.

The profile directory is created with rules/, skills/, agents/,
commands/, and mcps/ subdirectories (each kept in git via .gitkeep), so
a new profile is immediately usable with profile apply without manual
folder setup.

Optional display metadata (--name, --description, --tags) is written to
profile.yaml; the first tag becomes the profile's category in profile list
grouping. 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 writes profile.yaml only when metadata is non-empty.
    IFileSystem-injected for testability, mirroring InitCommand.
  • CLI wiring (profile.ts): adds profile new <name> with
    --name, --description, --tags, --path, --dry-run options and
    interactive fallback via PromptService.
  • Errors: UserError for invalid names / missing config root,
    ProfileError for duplicates, SystemError with code-specific messages for
    EACCES/ENOSPC/EROFS.
  • Tests: 6 unit tests for the command (round-trip through
    ProfileMetadataReader, empty-metadata skip, scaffolding, error paths) + 4
    parseTagsInput tests.
  • Docs: README command reference updated.

📋 Checklist for Reviewer

  • Tests passed locally (bun test: 967 pass / 2 skip / 0 fail).
  • Commit history is clean and descriptive.
  • Documentation updated (if applicable).
  • Code quality standards met (e.g., linter passed, tsc --noEmit clean).

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.
@ahmet-cetinkaya ahmet-cetinkaya added the enhancement New feature or request label Aug 8, 2026
@ahmet-cetinkaya ahmet-cetinkaya self-assigned this Aug 8, 2026
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
@ahmet-cetinkaya
ahmet-cetinkaya marked this pull request as ready for review August 8, 2026 09:33
@ahmet-cetinkaya
ahmet-cetinkaya merged commit 2373739 into main Aug 8, 2026
@ahmet-cetinkaya
ahmet-cetinkaya deleted the feat/profile-new-command branch October 30, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0