Repository navigation
feat(sync): add target_naming: prefixed for copy-mode targets - #502
Conversation
Prefixed target naming has to rewrite name: in each copied SKILL.md. ToggleFrontmatterFlag only adds or removes a boolean, so SetFrontmatterValue sets a plain scalar the same way: one line edited, key order, comments, CRLF and the body untouched. Both now share the delimiter scan.
Two tracked repos that ship a skill with the same name cannot both reach a tool today: standard drops both, flat keeps both folders but tools list skills by name:. Prefixed gives a skill inside a tracked repo the folder and name: <repo>-<name> in the copy, so both stay usable and the name shows where the skill came from. It is copy-only because a merge symlink points at the source, where name: must not change; config validation rejects it elsewhere, per target, like extension does. Switching naming used to know only the flat name as the old one, so standard <-> prefixed would orphan entries. The migration now checks the skill's name under every naming, and the copy manifest records the naming that produced each entry: a switch finds the exact old entry, and a renamed copy is re-copied so its name: matches even when the source is unchanged. Manifests without the record fall back to flat, standard, prefixed in turn. A rename is written to the manifest at once, so a later failure cannot leave the renamed folder looking user-owned.
The new naming has to be choosable wherever naming already is: target --target-naming, the target list TUI, the dashboard target page, shell completions and the config schemas. Each setter checks the copy-only rule before saving, for a naming change and for a mode change on a prefixed target, so an invalid pair never reaches the config file and only surfaces later as a failed sync.
Users need to know when prefixed helps (same-named skills from different tracked repos), what name it produces, that it is copy-only, and that switching between any two namings now renames managed entries in place. The translated pages follow, the ja and zh-Hans naming headings get an explicit target-naming id so the new links resolve, and the target_naming runbook gains steps for prefixed sync, flat -> prefixed -> standard migration and the merge-mode rejection.
The raw-write ratchet flags SetFrontmatterValue and the rename-back after a failed manifest write. Both only touch target entries (the copied SKILL.md and a just-renamed managed folder), never the skills source, so they are listed with the target reason.
The legacy lookup checks a skill's flat, standard and prefixed names. With a manifest that has no naming records yet, aaa/dev looked at "dev", found the top-level dev skill's managed copy and synced into it, because nothing said the entry belonged to someone else. A skill that already has its current entry now skips the lookup, and names other skills sync to in the same run are never treated as old names.
Project mode inherits target_naming from the project config through a separate path (defaultTargetNaming on ProjectTargetEntry), so it gets its own end-to-end check that two same-named tracked-repo skills both sync.
Targets that set prefixed naming but inherit the skills mode depend on the global mode staying copy. Changing it from the dashboard left those targets invalid until the next sync reported them; the global mode setter now runs the same copy-only check the per-target setters do.
The legacy lookup stat'ed the skill's current entry before looking for old names, adding syscalls to every flat sync; it now stats only the candidate names other than the current one (usually none exist) and checks the current entry only once an old managed entry is found. ReadManifest now always returns a Naming map, Manifest.Remove drops an entry's records in one place, copySkillToTarget takes the name to write instead of deciding it, and diff reads the manifest only for copy targets.
The dashboard saves projects: through ValidateProjects, which checked only the sync mode, so a project with prefixed naming and the merge default was accepted and failed later at sync. It now applies the same copy-only rule, with the project inheriting the global mode and naming like its targets do.
When the name: rewrite failed after the copy, the new folder stayed in the target with no manifest entry, so later syncs took it for a user's folder and never refreshed it. The copy helper now removes the folder it just made before returning the error; the next sync copies it again.
The sync command page said filters keep flat names only for standard naming; prefixed names target entries from SKILL.md as well, so the same caveat applies. Translations follow.
findLegacyTargetEntry returned the old entry's name and naming as two loose strings although namedTarget already pairs them; returning the struct keeps the pair together for both callers.
The naming picker's description map only knew flat and standard, so the new prefixed row showed a bare name with no hint that it needs copy mode. Add its description and a record-tui screen so the picker can be checked visually.
Hiding prefixed unless the draft mode was copy made the option hard to discover, and a user who left copy mode with prefixed drafted kept a naming the server would reject on save. Following the approved design, the naming control now always lists flat, standard and prefixed; prefixed is a disabled segment with a "Needs copy mode" tooltip and an info line saying why. Leaving copy mode resets a drafted prefixed back to the saved naming (or flat when prefixed was saved), and a pending tag marks an unsaved naming change. SegmentedControl gains a per-option disabled flag. Its title no longer replaces a text label's accessible name, so the disabled segment is still announced as "prefixed"; icon-only options keep title as name.
The aria-label branch special-cased string labels, but lucide icons are aria-hidden, so an icon-only button already takes its accessible name from title and a text label wins over it; the attribute was redundant. A disabled segment also still brightened on hover, so the hover rule now skips disabled segments. In TargetDetailPage the mode reset and the naming options move out of one-line expressions so they read at a glance.
…ixed-naming # Conflicts: # ui/src/i18n/locales/de.json # ui/src/i18n/locales/en.json # ui/src/i18n/locales/es.json # ui/src/i18n/locales/fa.json # ui/src/i18n/locales/fr.json # ui/src/i18n/locales/id.json # ui/src/i18n/locales/ja.json # ui/src/i18n/locales/ko.json # ui/src/i18n/locales/pt-BR.json # ui/src/i18n/locales/zh-CN.json # ui/src/i18n/locales/zh-TW.json # ui/src/pages/TargetDetailPage.test.tsx # ui/src/pages/TargetDetailPage.tsx
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73eb44ee36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lines := fm.lines | ||
| if i := fm.keyLine(key); i >= 0 { | ||
| lines[i] = line | ||
| } else { | ||
| lines = append(lines[:fm.end], append([]string{line}, lines[fm.end:]...)...) |
There was a problem hiding this comment.
Handle valid YAML forms before rewriting
name
When a tracked skill uses valid YAML such as "name": prototype, name : prototype, or a block scalar (name: >- followed by an indented value), the YAML parser used during resolution accepts the source, but this line-based lookup either misses the existing key or replaces only the scalar header. The prefixed copy then contains a duplicate name key or an orphaned continuation line and can be rejected by clients. Detect the semantic YAML key and replace its complete scalar span before writing the new value.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 330b345. SetFrontmatterValue now finds the top-level key through YAML, so "name":, name : and multi-line scalars are matched, and it replaces the key's whole span up to the next key, leaving blank and column-0 comment lines before that key intact. Unparseable frontmatter falls back to the old line match. Added the three cases to TestSetFrontmatterValue; make check passes.
The prefixed rename matched "name:" line by line, while resolution parses the frontmatter as YAML. A quoted key, "name :" or a multi-line scalar was accepted upstream but left a duplicate key or orphaned continuation lines in the copy. Locate the key through YAML and replace its full span.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 330b34510e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if err := TargetNamingModeError(sc.TargetNaming, sc.Mode); err != nil { | ||
| problems = append(problems, err.Error()) |
There was a problem hiding this comment.
Validate the inherited project naming mode
When a project config sets top-level target_naming: prefixed and a target inherits it while using the default merge mode, ValidateProjectConfigForSync receives a freshly unmarshaled config whose defaultTargetNaming fields have not been populated, so sc.TargetNaming is empty here and the invalid combination passes validation. This affects the dashboard's raw-config PUT flow, which validates before LoadProject assigns those defaults: it saves successfully, but subsequent syncs reject or skip the target. Resolve the target naming from cfg.TargetNaming during validation rather than relying on loader-only state.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0b496c9. ValidateProjectConfigForSync now seeds each target with cfg.TargetNaming before validating it, so an inherited prefixed with a non-copy mode is rejected even when the config has not been through LoadProject (the global validator already passed cfg.TargetNaming explicitly). Added TestValidateProjectConfigForSync_InheritedPrefixedNamingRequiresCopyMode; make check passes.
ValidateProjectConfigForSync read the target naming from loader-only state, so a raw project config (the dashboard's config save) with top-level target_naming: prefixed and a merge-mode target passed validation, then failed at sync. Seed the project default before validating each target, as the global validator already does.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b496c9de7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if mode == "copy" { | ||
| manifest, _ = sync.ReadManifest(sc.Path) | ||
| } | ||
| legacyNames := resolution.LegacyNames(mode, sc.Path, manifest) |
There was a problem hiding this comment.
Report managed naming migrations as renames
When a copy target already contains a managed flat or standard entry and target_naming changes, LegacyNames identifies that entry, but collectCopyDiff still checks the manifest and filesystem only under resolved.TargetName. For example, switching _repo__skills__foo to prefixed naming reports repo-foo as a new source-only addition while merely suppressing removal of the old entry, even though sync renames and refreshes it in place. The dashboard implementation in internal/server/handler_diff_stream.go has the same lookup pattern, so both diff surfaces misrepresent the documented migration; use the legacy mapping to resolve the active entry and report the rename/update.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0477f1e. Both diff surfaces now invert LegacyNames (new sync.RenamedFrom): when the new name is absent and a legacy managed entry will be moved into it, the CLI reports it under a new Renamed label (copy and merge) and the dashboard as update with reason renamed from <old> (target naming changed), instead of a source-only addition. Merge mode had the same lookup, so it is covered too. Added TestDiff_TargetNamingChange_ReportsRename (copy standard→prefixed, merge flat→standard) and TestComputeTargetDiff_NamingChangeReportsRename; documented the label in diff.md and its translations. make check passes.
After target_naming changes, sync renames the managed entry in place, but diff looked only under the new name, so the CLI and the dashboard showed the skill as new while hiding the old entry. Resolve the legacy entry and report it as a rename instead.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0477f1e837
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if newName == "" { | ||
| return nil | ||
| } | ||
| if err := utils.SetFrontmatterValue(filepath.Join(dst, "SKILL.md"), "name", newName); err != nil { |
There was a problem hiding this comment.
Preserve write access while rewriting copied frontmatter
When a prefixed skill's source SKILL.md is read-only (for example, mode 0444 from a read-only checkout), copyFile creates the destination with that same mode and this call reopens it for writing, so a non-privileged sync fails. The cleanup then removes the copied target; during a naming migration this happens after the old managed entry has been renamed and removed for refresh, leaving the target without the skill. Rewrite the temporary copy before applying the source permissions, or temporarily make this file writable and restore its mode afterward.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in c0d2d04. copySkillToTarget now lifts the owner write bit on the copied SKILL.md only for the name rewrite and restores the source's mode afterwards, so a read-only source no longer makes a non-root sync fail. Added TestCopySkillToTarget_RewritesReadOnlySkillFile (fails before the fix when run as a non-root user, checks the copy keeps 0444); make check passes.
| - Relative links to sibling skills (`../other-skill/`) are not rewritten, the same as `flat` in copy mode. | ||
| - The name becomes what the tool shows; in Claude Code it is the slash command, e.g. `/mattpocock-skills-prototype`. | ||
|
|
||
| `prefixed` needs copy mode because merge links point at the source, where `name:` cannot change. A target that resolves to `prefixed` in merge or symlink mode fails validation and is skipped by sync. |
There was a problem hiding this comment.
Qualify the symlink-mode naming statement
This newly documented behavior says that prefixed fails validation in symlink mode, but line 283 on the same page still states without qualification that target_naming is ignored in symlink mode. Users can therefore reasonably expect a prefixed symlink target to sync successfully even though validation rejects it; clarify that only flat and standard are ignored in symlink mode, or otherwise reconcile the two statements.
AGENTS.md reference: AGENTS.md:L13-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 16794ff. The symlink-mode note now says only flat and standard are ignored there and that prefixed fails validation, matching the section above; same change in the four translations.
A copy keeps the source file's mode, so a read-only SKILL.md (e.g. from a read-only checkout) could not be reopened for the name rewrite and a non-root sync failed, dropping the skill from the target mid-migration. Lift the write bit for the rewrite only and restore the mode afterwards.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ff8bdeb59
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if i, j := fm.keySpan(m, key); i >= 0 { | ||
| lines = append(lines[:i], append([]string{line}, lines[j:]...)...) | ||
| } else { | ||
| lines = append(lines[:fm.end], append([]string{line}, lines[fm.end:]...)...) |
There was a problem hiding this comment.
Insert inherited names before YAML document terminators
Fresh evidence after the merge-key parsing fix: when valid frontmatter inherits its name and uses an explicit YAML document terminator, such as defaults: &d {name: prototype}, <<: *d, then ..., no explicit name span is found and this branch appends the replacement after .... The prefixed copy therefore either has an invalid second document or leaves the inherited prototype effective while its folder is named with the prefix. Insert the new key before an in-frontmatter ... terminator, or rewrite the parsed mapping.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5cf18e2. When SetFrontmatterValue appends the key (no explicit one to replace), it now inserts it before a trailing ... document end marker inside the frontmatter instead of after it, so the explicit name lands in the mapping and overrides the merged one. Added the merge-key + ... case to TestSetFrontmatterValue (it produced the key after ... before the fix); make check passes.
When the name is inherited (a merge key) and the frontmatter ends with "...", the new name: was appended after the marker, outside the mapping, so the copy kept the old name or held an invalid second document. Insert the key before the marker.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cf18e2723
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| mapped := strings.Map(func(r rune) rune { | ||
| if r >= 'a' && r <= 'z' || r >= '0' && r <= '9' { | ||
| return r | ||
| } | ||
| return '-' |
There was a problem hiding this comment.
Preserve valid Unicode characters in repository prefixes
When a tracked checkout is given a non-ASCII name such as _技能 or _café, this mapper removes characters that skillpkg.ValidateName explicitly accepts as lowercase Unicode letters or numbers. _技能 therefore produces an empty prefix and syncs prototype without any repository prefix, while _café collapses to caf and can collide with a distinct _caf repository. Preserve Unicode letters and numbers—using the same normalization rules as the skill-name validator—so prefixed consistently produces a distinct valid <repo>-<name>.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7febeb9. normalizeSpecName now applies NFKC and lowercases, as skillpkg.ValidateName reads a name, and keeps every Unicode letter and number, turning only other characters into -. _技能 gives 技能-dev and _Café gives café-dev. Added both to TestPrefixedTargetName (_Café produced caf-dev before); updated the prefix description in sync-modes.md and translations. make check passes.
The prefix kept only [a-z0-9], while skill names allow lowercase letters and digits in any script after NFKC. A repo named _技能 got no prefix at all and _café collapsed to caf, which could collide with _caf. Normalize the repo name the way the name validator reads it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7febeb9007
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| at := fm.end | ||
| // A YAML document end marker (...) closes the mapping, so the key goes before it. | ||
| for i := fm.end - 1; i > fm.open; i-- { | ||
| if l := strings.TrimRight(lines[i], " \t\r"); l == "..." { |
There was a problem hiding this comment.
Recognize commented YAML document terminators
Fresh evidence after 5cf18e2: YAML permits a document terminator followed by a comment, such as ... # end, but this equality check recognizes only a bare .... When a valid frontmatter mapping inherits name through a merge key and ends with the commented form, SetFrontmatterValue appends the prefixed name after the document terminator; the copied file therefore either ignores the new name or becomes invalid YAML, leaving its frontmatter name inconsistent with its prefixed folder. Detect the marker before its optional YAML comment and insert the key ahead of it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 967e1fa. The end-marker search now accepts ... followed by whitespace and a comment (... # end), and skips comment lines as well as blank ones after the marker, so the key is inserted before it. Added that case to TestSetFrontmatterValue (the key landed after the marker before the fix); make check passes.
Only a bare "..." was taken for the end marker, so "... # end" (or comment lines after the marker) still got the inherited prefixed name appended outside the mapping. Accept a trailing comment on the marker and skip comment lines while looking for it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 967e1fad07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if i, j := fm.keySpan(m, key); i >= 0 { | ||
| lines = append(lines[:i], append([]string{line}, lines[j:]...)...) |
There was a problem hiding this comment.
Preserve YAML anchors when rewriting the name
When valid frontmatter defines an anchor on the name and reuses it elsewhere, such as name: &skill_name prototype followed by description: *skill_name, this replacement drops the anchor while retaining the alias. Unlike the previously fixed name: *anchor case, the name defines the anchor here; ParseSkillName accepts it, so a prefixed sync reaches this branch and reports success after writing frontmatter with an undefined alias that clients cannot parse. Preserve the value node's anchor when replacing it, including in the flow-mapping path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 183beeb. The replaced name value now keeps its anchor: the line rewrite writes name: &<anchor> <new> and setMappingScalar copies the anchor onto the new node for flow mappings, so aliases elsewhere still resolve (to the new name). Added block and flow cases to TestSetFrontmatterValue; make check passes.
A name that defines an anchor (name: &n prototype) lost it on rewrite while aliases to it (description: *n) stayed, so the copied frontmatter had an undefined alias. Keep the anchor on the new value, in both the line rewrite and the flow-mapping rewrite.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 183beeba54
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| line = strings.Replace(line, key+": ", key+": &"+anchor+" ", 1) | ||
| } | ||
| lines = append(lines[:i], append([]string{line}, lines[j:]...)...) |
There was a problem hiding this comment.
Preserve anchors attached to the name key
When block-style frontmatter anchors the key rather than its value, such as &field name: prototype followed by description: *field, this branch preserves only the value node's anchor and rewrites the first line as an unanchored name: key. The remaining alias is then undefined, so prefixed sync produces a copied SKILL.md that clients cannot parse. Preserve anchors from the key node as well when replacing the block-mapping span.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 666df43, generally rather than per form: the block rewrite now keeps the text before the value exactly as written (key, key anchor, quoting, name : spacing, indent, an explicit ? name line) using the value node's line and column, and replaces only the value span, re-adding the value's own anchor. So &f name: prototype becomes &f name: emil-design-prototype and description: *f still resolves. Added key-anchor and explicit-key cases to TestSetFrontmatterValue (quoted-key and spaced-colon cases now keep the key as written); make check passes.
Rewriting the whole name line dropped whatever sat on the key side: an anchor on the key (&f name:) left its aliases undefined, and quoting, "name :" spacing or an explicit "? name" key were rewritten. Keep the text before the value as written, located from the YAML node, and replace only the value span, keeping the value's own anchor.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 666df43edd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if m != nil && len(m.Content) > 0 { | ||
| line = strings.Repeat(" ", m.Content[0].Column-1) + line // a root mapping may be indented as a whole |
There was a problem hiding this comment.
Derive root indentation from the mapping syntax
Fresh evidence after adf375d: when an inherited name is reached through a mapping whose first key uses explicit-key syntax, such as ? defaults / : &d {name: prototype} followed by <<: *d, the first key node's column points after ? rather than at the root mapping indentation. This line therefore prefixes the inserted name with two spaces, placing it under the preceding root entry and producing invalid or incorrectly scoped YAML in the prefixed copy. Determine indentation from the key's source line rather than its node column.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4c43328, for both this and the sibling finding: when name is absent (e.g. inherited through <<), SetFrontmatterValue now inserts it before the first key of the root mapping, using that source line's own leading whitespace instead of the key node's column. That keeps it inside the mapping whatever follows (a ... marker, comments at any indent), so the end-marker scan is gone, and an explicit ? key first entry no longer shifts the indent. An explicit key overrides a merged one regardless of position. Added the explicit-first-key and indented-trailing-comment cases to TestSetFrontmatterValue and updated the append-position expectations; make check passes.
| } else if l != "" && !strings.HasPrefix(l, "#") { | ||
| break |
There was a problem hiding this comment.
Skip indented comments when locating the document end
Fresh evidence after 967e1fa: YAML comments following ... may be indented, but this condition recognizes only comments beginning in column zero. With inherited-name frontmatter ending in ... # end and then # trailing, the backward scan stops at the indented comment and appends the prefixed name after the document terminator, leaving it outside the mapping or making the copied YAML invalid. Trim leading whitespace before testing whether the line is a comment.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4c43328, for both this and the sibling finding: when name is absent (e.g. inherited through <<), SetFrontmatterValue now inserts it before the first key of the root mapping, using that source line's own leading whitespace instead of the key node's column. That keeps it inside the mapping whatever follows (a ... marker, comments at any indent), so the end-marker scan is gone, and an explicit ? key first entry no longer shifts the indent. An explicit key overrides a merged one regardless of position. Added the explicit-first-key and indented-trailing-comment cases to TestSetFrontmatterValue and updated the append-position expectations; make check passes.
Appending an inherited (merge-key) name at the end of the frontmatter kept running into what may follow the mapping: a "..." end marker, comments after it at any indent. Its indent also came from the first key node's column, which sits after "? " for an explicit key. Insert the key before the first key instead, with that line's own indent; an explicit key overrides a merged one wherever it stands.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c433281a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SkillName: skillName, | ||
| }) | ||
| collisionMap[skillName] = append(collisionMap[skillName], skill.RelPath) | ||
| collisionMap[entryName] = append(collisionMap[entryName], skill.RelPath) |
There was a problem hiding this comment.
Surface prefixed-only name collisions
When prefixing creates a collision between skills whose original names differ—for example repo _a containing b-c and a local skill named a-b-c—both candidates are excluded here, but cmd/skillshare/sync.go:747-750 returns from reportCollisions whenever the original-name collision list is empty. The normal sync output therefore provides only a generic collision count and never identifies the omitted skills or paths; make per-target collisions sufficient to render the detailed warning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 33892c2. reportCollisions now returns early only when there are neither global nor per-target collisions, so a collision only prefixed naming creates gets the detailed warning (names and the colliding folders). Added TestSync_TargetNamingPrefixed_ReportsCollisionsOnlyThePrefixCreates (_a/b-c vs local a-b-c), which showed only the generic count before; make check passes.
reportCollisions returned when no two skills shared a SKILL.md name, but prefixed naming can make distinct names collide (_a/b-c becomes a-b-c, a local skill's name). Sync then said only "1 name collision(s) excluded" without naming the skills. Report whenever a target has collisions.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33892c2f9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if m != nil && len(m.Content) > 0 { | ||
| // Before the first key, with that line's indent: inside the mapping whatever | ||
| // follows it (a "..." end marker, comments), and an explicit key still | ||
| // overrides one a merge key (<<) brings in, wherever it stands. | ||
| at := fm.open + m.Content[0].Line | ||
| indent := lines[at][:len(lines[at])-len(strings.TrimLeft(lines[at], " \t"))] | ||
| lines = append(lines[:at], append([]string{indent + line}, lines[at:]...)...) |
There was a problem hiding this comment.
Resolve aliased mapping keys before inserting name
When valid frontmatter supplies name through an aliased key (for example, field: &field name, followed by ? *field and : prototype), ParseSkillName decodes it as name: prototype, but the mapping node here exposes the alias name (field) rather than its resolved key (name). This branch therefore inserts a second literal name instead of replacing the aliased entry; the later alias can keep prototype effective or make the copied YAML fail on the duplicate key, so a prefixed copy can have a folder name that disagrees with its frontmatter. Resolve alias keys before deciding that the field is absent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not fixing this one, by choice. An aliased mapping key for name (field: &field name then ? *field / : prototype) is valid YAML but no real SKILL.md is written that way, and handling it would mean resolving alias keys throughout the line-preserving rewrite. The supported frontmatter for prefixed naming is a plain, quoted or explicit name key, plus the forms already covered (flow mappings, block scalars, anchors, merge keys). Leaving this thread open for the record.
Under prefixed naming, two same-named skills from different repos reach a target under distinct names, yet sync said they were isolated by target filters. The note now names both causes. The new test also covers the merge + flat to copy + prefixed switch a user plans to make.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e610006ba4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if body.Mode != nil || body.TargetNaming != nil || body.SkillsEnabled != nil && *body.SkillsEnabled { | ||
| if err := config.TargetNamingModeError(target.SkillsConfig().TargetNaming, cmp.Or(target.Skills.Mode, s.cfg.Mode)); err != nil { |
There was a problem hiding this comment.
Skip naming compatibility when this update disables skills
When a PATCH disables skills while also changing mode or target_naming—for example, { "skills_enabled": false, "mode": "merge" } on a prefixed copy target—this condition validates the new pair before applying SkillsEnabled and rejects the request. The resulting disabled configuration is valid (the config validator explicitly exempts disabled skills, and re-enabling has its own compatibility check), so validate against the prospective enabled state rather than the current one.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid: the PATCH validates the pair against the current skills_enabled instead of the requested one. #502 is already merged, so this goes into a follow-up PR together with the other prefixed-naming polish. Leaving this thread open until then.
Type
proposals/only — see CONTRIBUTING.md)Neither box fits exactly: this is a maintainer-implemented feature requested in #497 (no separate proposal, as agreed in the issue thread).
Linked Issue
Closes #497
What
Adds
target_naming: prefixedfor copy-mode targets. A skill installed from a tracked repo is written as<repo>-<name>(for examplemattpocock-skills-prototype), so same-named skills from different repos can coexist in one target. Local skills keep their standard name.name:in each copiedSKILL.mdis rewritten to match (Agent Skills requiresnameto equal the folder name, usinga-z0-9-). A line-based frontmatter string setter (internal/utils) does the rewrite without reformatting the file..skillshare-manifest.jsonrecords the naming each entry was written with, so switching betweenflat,standardandprefixedmigrates existing copies instead of leaving orphans, and never claims another skill's entry.prefixedis copy-only. Config load rejects it on non-copy targets (global and project), and the server refuses a global mode change that would break a target inheritingprefixed.target --target-naming prefixed, the TUI naming picker, and both JSON schemas.flat / standard / prefixed. Outside copy modeprefixedis disabled with a reason; a drafted naming change shows a pending tag; leaving copy mode resets a draftedprefixedto the saved naming (orflat).SegmentedControlgains a per-optiondisabledflag.prefixed, which the docs state.The branch merges main after #499. Conflict resolution in
TargetDetailPage.tsxkeeps both features; the shared-folder "Use like " button now goes through the same mode setter, so it also drops a draftedprefixed(covered by a new test).Checklist
make check) — for code changesChecks run
In the devcontainer image, on the merged head:
make buildandmake check(docs-check, fmt-check, lint, unit and integration tests): passvitest run(643 passed),eslint src(0 errors),pnpm build: passpython3 scripts/ai-context.py check: okNot run: the Docusaurus website build, and dark-mode / Clean-theme screenshots. The fa and id UI strings have not been reviewed by native speakers.