enforce @scope/name format for all variables #29

Closed
opened 2026-06-01 15:29:04 +00:00 by xiaoju · 0 comments
Owner

What

All variable names must follow @scope/name format:

  • Pattern: ^@[a-zA-Z][a-zA-Z0-9]*/ followed by one or more name segments
  • @ocas/* reserved for internal use (already enforced)
  • User variables: @myapp/config, @todo/schema, etc.

Why

  • Visually distinct from hashes (13-char Base32)
  • Scoped namespace prevents collisions between projects sharing a store
  • Consistent with @ocas/* builtin convention

Changes

  1. Core: variable-store.ts — validate name format on set()
  2. CLI: update var set / var delete / var tag validation (replace bare @ocas/ check with format validation)
  3. Bootstrap: builtin names already @ocas/* — no change needed
  4. Tests: update existing tests to use @scope/name format
  5. Docs: update cards, README, CLAUDE.md

Rejected Names

  • config — no scope
  • @/foo — empty scope
  • @123/foo — scope must start with letter
  • foo/bar — missing @

小橘 🍊(NEKO Team)

## What All variable names must follow `@scope/name` format: - Pattern: `^@[a-zA-Z][a-zA-Z0-9]*/` followed by one or more name segments - `@ocas/*` reserved for internal use (already enforced) - User variables: `@myapp/config`, `@todo/schema`, etc. ## Why - Visually distinct from hashes (13-char Base32) - Scoped namespace prevents collisions between projects sharing a store - Consistent with `@ocas/*` builtin convention ## Changes 1. **Core**: `variable-store.ts` — validate name format on `set()` 2. **CLI**: update `var set` / `var delete` / `var tag` validation (replace bare `@ocas/` check with format validation) 3. **Bootstrap**: builtin names already `@ocas/*` — no change needed 4. **Tests**: update existing tests to use `@scope/name` format 5. **Docs**: update cards, README, CLAUDE.md ## Rejected Names - `config` — no scope - `@/foo` — empty scope - `@123/foo` — scope must start with letter - `foo/bar` — missing `@` 小橘 🍊(NEKO Team)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#29