Skip to content

Conversation

@xl-openai
Copy link
Collaborator

@xl-openai xl-openai commented Dec 24, 2025

Use ConfigLayerStack to get all folders while loading skills.

@xl-openai xl-openai force-pushed the xl/skills branch 4 times, most recently from c31928f to fc55aa5 Compare December 24, 2025 02:32
outcome
.skills
.sort_by(|a, b| a.name.cmp(&b.name).then_with(|| a.path.cmp(&b.path)));
fn scope_rank(scope: SkillScope) -> u8 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this internal only, it's fine, but if you want some breathing room, consider at least i16?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set of scopes should be small and relatively stable.

outcome
}
outcome.skills.sort_by(|a, b| {
scope_rank(a.scope)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider defining PartialOrd or Ord on SkillMetadata?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ordering is only used locally in the loader to make the output deterministic, so keeping the scope_rank + sort_by here is the simplest and most straightforward approach.


let system_folder = tmp.path().join("etc/codex");
let user_folder = tmp.path().join("home/codex");
fs::create_dir_all(&system_folder).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to you, but you can change the return type to anyhow::Result<()> and then you can use ? instead of unwrap() throughout, but have to add Ok(() at the end.

async fn deduplicates_by_name_preferring_nearest_project_codex_dir() {
let codex_home = tempfile::tempdir().expect("tempdir");
let repo_dir = tempfile::tempdir().expect("tempdir");
let status = Command::new("git")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note you can use a marker file or just write .git with the contents "gitdir: fake" or something.

Comment on lines 969 to 977
assert!(
outcome.errors.is_empty(),
"unexpected errors: {:?}",
outcome.errors
);
assert_eq!(outcome.skills.len(), 1);
assert_eq!(outcome.skills[0].name, "dupe-skill");
assert_eq!(outcome.skills[0].description, "from nested");
assert_eq!(outcome.skills[0].scope, SkillScope::Repo);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer:

assert_eq!(
    vec!(
        SkillMetadata {
            // ...
        }
    ),
    outcome.skills,
)

test failures are far more informative when you do it this way.

@xl-openai xl-openai merged commit 58a91a0 into main Jan 5, 2026
26 checks passed
@xl-openai xl-openai deleted the xl/skills branch January 5, 2026 21:47
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants