feat(skill): add atomic skill folder import - #126
Closed
ObsisMc wants to merge 1 commit into
Closed
Conversation
Add POST /api/skills/import to upload a local skill folder as one multipart request and commit it atomically across the filesystem and the database. Files stream into an `atoms/skills/<uuid>.tmp` staging directory, the staged SKILL.md front matter resolves the skill name and description, then a unit of work inserts the row, renames staging to the committed `<name>` directory, and commits together — so a failure at any point leaves neither a row nor a promoted directory. Startup reconciliation discards `*.tmp` staging and any committed directory not backed by a visible skill row, and skill deletion now removes its committed folder. Keep the orchestration hexagonal: a SkillPackageStore port with a local filesystem adapter, a SkillImportUnitOfWork closure port whose SQLite adapter holds the transaction open across the directory promote, and folder/manifest validation, all under crates/application/src/skill. Guard uploads with a 50MB body limit, a 1000-file cap, safe-name and safe-path checks, and empty/duplicate-path rejection, mapping failures to 422/409/413 responses.
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.
Add POST /api/skills/import to upload a local skill folder as one multipart request and commit it atomically across the filesystem and the database.
Files stream into an
atoms/skills/<uuid>.tmpstaging directory, the staged SKILL.md front matter resolves the skill name and description, then a unit of work inserts the row, renames staging to the committed<name>directory, and commits together — so a failure at any point leaves neither a row nor a promoted directory. Startup reconciliation discards*.tmpstaging and any committed directory not backed by a visible skill row, and skill deletion now removes its committed folder.Keep the orchestration hexagonal: a SkillPackageStore port with a local filesystem adapter, a SkillImportUnitOfWork closure port whose SQLite adapter holds the transaction open across the directory promote, and folder/manifest validation, all under crates/application/src/skill. Guard uploads with a 50MB body limit, a 1000-file cap, safe-name and safe-path checks, and empty/duplicate-path rejection, mapping failures to 422/409/413 responses.