Community plugin manifests can only copy individual files, not directories
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go
- Domain
- cli, developer-experience
Research direction
Start with internal/plugin/local.go, especially localManifest, validate, and Files, then trace how installed files are recorded in .grit/plugins.lock.json and replayed by grit plugin remove. Check the grit plugin new skeleton for its file entries. Done when directory entries install their files recursively, directory sources in files produce a clear validation error, and removal still works from the per-file lock entries.
Written by the indexing model from the issue text.
Description
A community plugin manifest lists every file it installs one by one. There is no way to map a directory, so a plugin that installs several files under the same destination has to repeat the same to prefix and the same when clause for every file.
Where this comes from
internal/plugin/local.go:
type localManifest struct {
Files []localFile `json:"files"`
// ...
}
type localFile struct {
From string `json:"from"` // relative to the plugin directory
To string `json:"to"` // relative to the project root
When whenClause `json:"when"`
}
validate calls os.Stat on from, and the Files function calls os.ReadFile. A directory passes the stat but fails the read, and the file is silently skipped. So files/components as a from value installs nothing and reports success.
Why it matters
I am writing grit-calendar as a community plugin. Its source is grouped as files/config, files/components, files/pages and files/tests, but plugin.json still needs nine files entries, each with its own from, to and when. Adding a new component means editing both the tree and the manifest, and the two can drift. The grit plugin new skeleton has the same shape: one entry per file.
Proposal
An optional directories array alongside files, for example:
"directories": [
{
"from": "files/components",
"to": "apps/admin/components/calendar",
"when": { "architecture": ["triple"], "frontend": ["next"] }
}
]
Install walks it recursively. Each written file still goes into .grit/plugins.lock.json as its own entry, so grit plugin remove keeps replaying the install exactly and needs no second list. Explicit files entries would cover exceptions and single files.
Two small things would come with it:
validateshould reject a directory infiles[].fromwith a clear message instead of skipping it at install time.- The
grit plugin newskeleton could use a directory entry forfiles/apiandfiles/admin, which would make generated plugins much shorter.
This is an enhancement, not a blocker. The current file-level mechanism works and removal is correct.
- Dominant language
- Go
- Stars
- 152
- Forks
- 20
- Avg merge
- 1d 49m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MUKE-coder/grit
-
[Plugin] calendarOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MUKE-coder/grit#228 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 18/100
MUKE-coder/grit#224 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
MUKE-coder/grit#199 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
MUKE-coder/grit#179 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
MUKE-coder/grit#92 · 3 comments ·
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
Chemaclass/agnostic-ai#3681 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
OSS TEST
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
seaweedfs/seaweed-block#268 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day