Skip to content

feat(rules): support installing rules from local files (closes #105)#107

Merged
Minitour merged 1 commit into
developfrom
feat/local-file-rules
Jun 10, 2026
Merged

feat(rules): support installing rules from local files (closes #105)#107
Minitour merged 1 commit into
developfrom
feat/local-file-rules

Conversation

@Minitour

Copy link
Copy Markdown
Collaborator

Closes #105.

What

Adds a local rule type so rule content can be managed in a separate file instead of inline YAML:

rules:
  - id: typescript-conventions
    type: local
    description: Team TypeScript conventions
    appliesTo:
      - "**/*.ts"
      - "**/*.tsx"
    path: rules/typescript.md

path is resolved relative to the directory containing the capabilities file — the same convention already used by local agents and hooks, so it's consistent across the config.

Note: the issue's snippet paired type: remote with path:. remote already means "fetch from a URL," so this implements the established type: local + path convention instead (matches skills/agents/hooks).

How

  • src/types/rules.ts — add 'local' to the Rule type union and a documented path field.
  • src/cli/commands/install-tasks/install-rules.ts — extract the per-rule body resolution into an exported, unit-testable resolveRuleBody() and add the local branch (reads the file off disk; throws a descriptive error if path is missing or the file doesn't exist). The writer (installRules) is content-agnostic and needed no change.
  • README.md — document the new type with an example in the rules block.

Tests

New install-rules.test.ts covers: local resolution, resolution relative to the capabilities file (not cwd), missing-path error, missing-file error, inline regression, and unknown-type error. Full suite: 1046 pass / 0 fail.

🤖 Generated with Claude Code

Adds a `local` rule type so rule content can live in a separate file instead
of inline YAML, e.g.:

    rules:
      - id: typescript-conventions
        type: local
        appliesTo: ["**/*.ts", "**/*.tsx"]
        path: rules/typescript.md

`path` is resolved relative to the directory containing the capabilities file,
matching the existing `local` convention for agents and hooks.

- Add 'local' to the Rule type union and a `path` field (src/types/rules.ts).
- Extract per-rule body resolution into an exported, testable resolveRuleBody()
  and add the `local` branch (reads the file, descriptive error if missing).
- Document the new type with an example in the README rules block.
- Add unit tests covering local resolution (incl. relative-to-capabilities-file
  resolution), missing path/file errors, inline regression, and unknown type.

Closes #105

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Minitour Minitour merged commit 5eb5b7d into develop Jun 10, 2026
10 of 11 checks passed
@Minitour Minitour deleted the feat/local-file-rules branch June 10, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant