Split into a CLIManagerKit library + unify the skill/command/dotfile models - #2
Open
molayab wants to merge 2 commits into
Open
Split into a CLIManagerKit library + unify the skill/command/dotfile models#2molayab wants to merge 2 commits into
molayab wants to merge 2 commits into
Conversation
β¦models Restructures the package so the model layer can be linked as a library by an embedding app (an upcoming Grove integration), and collapses SkillModel, CommandModel, DotfileModel, and UserCommandModel into one generic ManagedItem/AgentDescriptor pair instead of three near-duplicate families. - New CLIManagerKit library target/product: ManagedItem (+ ManagedItemKind), AgentDescriptor, and the pure file/frontmatter/git helpers. cli-manager is now a thin ArgumentParser executable depending on it. - Fixes a latent bug found while consolidating the agent registry: "opencode" was listed twice with two different skill paths. - CLI surface, flags, and output are unchanged β this is an internal restructuring, not a behavior change. - Tests updated to match (35 passing); swift build/test/swiftlint all clean.
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.
Why
This repo has so far only ever been consumed as a compiled CLI binary. An embedding macOS app
(Grove) wants to manage skills/commands/dotfiles from a native UI, which means linking this
package's model layer directly instead of shelling out and parsing text. That wasn't possible
before this PR β everything lived in one
executableTarget.Two changes, together:
CLIManagerKitlibrary (the model/file/git layer) and thecli-managerexecutable (ArgumentParser commands only), soCLIManagerKitcan be added as anormal SPM dependency by anything that wants programmatic access.
SkillModel,CommandModel,DotfileModel, andUserCommandModelbecome oneManagedItem(+ManagedItemKind) and oneAgentDescriptor,instead of three near-duplicate families. A consumer now has one type to work with, not three.
The CLI itself doesn't change. Every subcommand, flag, and message is the same β this is an
internal restructuring, not a UX change.
swift build,swift test(35 tests), andswiftlint lintall pass clean.Architecture
flowchart TD subgraph exe["cli-manager (executable target)"] CLI["ArgumentParser commands<br/>skill / command / dotfile / sync / repo / push / pull / clean"] Term["Terminal.swift<br/>prompts, colored output"] end subgraph lib["CLIManagerKit (library target, new)"] MI["ManagedItem<br/>ManagedItemKind: skill / command / dotfile"] AD["AgentDescriptor<br/>allAgentDescriptors"] FS["FileManager+Helpers<br/>Frontmatter, GitRunner"] end CLI --> MI CLI --> AD CLI --> Term MI --> FS AD --> FS Grove["Grove (future)"] -.->|links CLIManagerKit directly, no shell-out| MI Grove -.-> ADclassDiagram class ManagedItemKind { <<enumeration>> skill command dotfile } class ManagedItem { +ManagedItemKind kind +String id +String name +String description +String body +Bool isPrivate +URL location +String dotfileLink +String dotfileFileName +load(kind) +resolve(filter, from) } class AgentDescriptor { +String id +String name +URL skillsPath +URL commandsPath +CommandFormat commandFormat +path(kind) +detected(kind) +resolve(ids, kind) } ManagedItem --> ManagedItemKind AgentDescriptor --> ManagedItemKindManagedItemreplaces the three old models β a skill and a dotfile are both a directory(
SKILL.md/DOTFILE.mdinside), a command is a single file;dotfileLink/dotfileFileNamearethe only kind-specific fields, populated only for
.dotfile.AgentDescriptorreplaces the oldAgentarray (skills) andCommandModel.allCommandAgentsarray (commands) with one canonical7-agent registry β which also fixes a real bug:
"opencode"was listed twice, at twodifferent skill paths (
.config/opencode/skillsand a stray.agents/skills), a copy-pasteleftover from when the list grew. It's one entry now, matching the README's own agent table.
How to use
The CLI is unchanged:
cli-manager skill activate cli-manager command activate --agent gemini-cli cli-manager dotfile linkNew: any Swift package can now depend on the model layer directly β
ManagedItem.loadnever prints β it returnsdiagnostics: [String]for anything it skipped(e.g. a dotfile missing its
link:field) so an embedding app can surface them however it wants,instead of inheriting the CLI's own colored console output.
Testing
swift buildβ cleanswift testβ 35/35 passing (ManagedItemTestsandAgentDescriptorTestsare new; the oldper-model test files were folded into them)
swiftlint lintβ clean except two pre-existing warnings in unchanged, moved-as-is codeskill new/list,command new/list,dotfile status,skill activate,command activate(including the Gemini TOML path), andclean --dry-runagainst a scratchrepo/home to confirm output is byte-for-byte the same as before the refactor