Skip to content

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Sep 10, 2025

Description

Add support for having local uses block in config.yaml defined with file://path/to/file

resolves CON-3869
closes #5943
closes #6107

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-general-review or @continue-detailed-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

feat.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Support local file includes in config.yaml via file:// uses blocks, so assistants can load models, MCP servers, prompts, and rules from nearby files. Addresses CON-3869; closes #5943 and #6107.

  • New Features
    • Unrolls file:// uses in models, mcpServers, prompts, and rules during config load, including overrideConfigYaml.
    • Resolves local URIs with localPathOrUriToPath and derives registry root from the config file directory.
    • Adds a test that loads a rule from a local block to verify end-to-end resolution.

@uinstinct uinstinct requested review from a team as code owners September 10, 2025 12:42
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 10, 2025
@uinstinct
Copy link
Contributor Author

@RomneyDa currently this implementation makes all uses blocks in the config relative when a uses: file://path/to/file is present. Do we want to support a combination of uses: package-name/block-name and uses: file://path/to/file?
In that case, we might need to change how slugs currently work

@RomneyDa
Copy link
Collaborator

@uinstinct yes, it should support both

@ShaunaGordon
Copy link

What I'd personally really love is slugified local references (like uses: models/model.yml), that automatically pulls from the relevant folder within ~/.continue (that's honestly what I'd thought it'd do when I was first learning about how to import stuff in Continue), but that's at best a ways off, with the current global import nature of those folders, unless we can add a folder like "imports" or something that doesn't get auto-imported and use that as the import root, but that feels a little clunky.

Alternatively, relative paths with ~/.continue as the root would be super nice, too, which would allow users to create our own "imports" folder or something (assuming the global import mechanism limits its scope to the specific folders) and sort of simulate the slugification, just with an extra segment, and if a structure is defined, could be easy enough to separate from Hub slugs, by virtue of having three segments instead of two (e.g. uses: local/models/model.yml), or, absent a defined structure, a quick look in the local ~/.continue/workspace/.continue for the presence of the top level segment and fall back to Hub in its absence.

(It's possible the above is out of scope, and if so, the current behavior in this PR can be worked into something similar, albeit a bit clunkier and more fragile, but it's definitely a solid start. 👍🏼 )

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

@uinstinct let's find an approach that allows using hub slugs in the same assistant. I think you can handle it at the registry level

const sections = ["models", "mcpServers", "prompts", "rules"] as const;
return sections.some(
(section) =>
Array.isArray(assistant[section]) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe all this type checking should be unnecessary since we use zod to load the YAML. Might requires some nullable checks but otherwise should be typesafe

if (maybeHasLocalUsesBlocks(config)) {
const registryClient = await getRegistryClient();
const unrolled = await unrollBlocks(
config as any,
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove any type casting


// If overrideConfigYaml still contains any local uses blocks, unroll them here
type MinimalAssistantSections = {
models?: any[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

no any types needed

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Sep 10, 2025
@RomneyDa
Copy link
Collaborator

@ShaunaGordon I think we could easily add the relative path from ~/.continue relative folder if ends in .yml/.yaml!

@RomneyDa
Copy link
Collaborator

Closing in favor of #7723

@RomneyDa RomneyDa closed this Sep 17, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Sep 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2025
@uinstinct uinstinct deleted the local-uses-blocks branch September 17, 2025 17:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Can't reference local block inside ~/.continue folder using relative filepath config.yaml: uses: with relative path doesn't work
3 participants