Skip to content

feat: validate slug format in axme_save_decision and axme_save_memory #65

@George-iam

Description

@George-iam

When saving decisions or memories, the slug parameter is used as part of the filename (e.g., D-042-my-decision-slug.md). Currently there is no validation that the slug conforms to a safe kebab-case format. Slugs with spaces, special characters, or uppercase letters could cause filesystem issues or dedup failures. Add a simple validation that rejects slugs not matching /^[a-z0-9][a-z0-9-]*$/ and returns a helpful error message.

Relevant files:

  • src/tools/decision-tools.ts — add slug validation in axme_save_decision handler
  • src/tools/memory-tools.ts — add slug validation in axme_save_memory handler
  • test/decisions.test.ts and test/memory.test.ts — add test cases for invalid slugs

Acceptance criteria:

  • Slugs not matching ^[a-z0-9][a-z0-9-]*$ are rejected with a clear error message
  • Error message suggests the correct format (lowercase, hyphens, no spaces)
  • At least 4 test cases: valid slug, slug with spaces, slug with uppercase, slug with special chars
  • npm test passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions