Skip to content

list_rules should reject an unknown projectPath like analyze does #33

Description

@Arthurvdv

Problem

Since #32, analyze validates an explicit projectPath against the projects the server was started with and returns { error: "UnknownProject", message: "... not one of the AL projects this server was started with: <list> ..." } for anything else. list_rules still does projectPath ??= workspaceResolver.Config.PrimaryProject (src/ALCops.Mcp/Tools/ListRulesTool.cs:24) and resolves analyzers against whatever path it is given, so a mistyped project silently produces a (possibly empty or wrong) rule list instead of an error.

Two native tools sharing the same project-scoping concept should behave the same.

Proposed

  • Extract the project validation from AnalyzeTool into a shared helper (e.g. on WorkspaceStartupResolver or a small ProjectScope service) and use it in list_rules as well. get_fixes / apply_fix / apply_fix_all take a required projectPath and load it through ProjectSessionManager; decide whether they should validate too or keep accepting any folder with app.json.
  • While there: when Config.ProjectDirectories is empty the UnknownProject message renders as ...started with: . Pass one of those... (src/ALCops.Mcp/Tools/AnalyzeTool.cs:56-61). Print (none) or fall through to the NoProject error instead.

Found in the review rounds of #32.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions