Skip to content

chore: add initial CLAUDE.md for AI assistants - #24

Merged
elisiondan merged 3 commits into
nextfrom
chore/add-claude-md
May 12, 2026
Merged

chore: add initial CLAUDE.md for AI assistants#24
elisiondan merged 3 commits into
nextfrom
chore/add-claude-md

Conversation

@elisiondan

Copy link
Copy Markdown
Member

Summary

Adds a top-level CLAUDE.md that captures conventions, architecture, and gotchas surfaced during PR 1 and PR 2 of the 2.0 stack-modernization. This is the codebase context file that Claude Code, Cursor, and similar AI assistants read on session startup.

It's a starting point, not a finished doc — expected to grow as more conventions become explicit during PR 3-7 and Stage 2.

What's in scope

  • Repo at a glance: two published extensions + one internal shared package consumed via relative imports.
  • Stack rules with the why: npm workspaces (not pnpm — localazy/release@v2 is npm-hardcoded), Node 22, ESLint 10 flat config, Prettier 3, vue-tsc for typechecking, no Docker.
  • Dev workflow including the dev.mjs symlink trick (why EXTENSIONS_PATH points at development/extensions/ and not extensions/) and the local credentials.
  • Branching model: main is frozen at 1.0.x, next is the 2.0 integration branch, PRs target next.
  • Stage 1 vs Stage 2 scope policy — explicit list of what's in bounds for tooling PRs.
  • Known type errors that are deferred and the reasons (e.g., @directus/types duplication clears with PR 4's SDK bump).
  • Gotchas list: don't add directus:extension to common, don't drop MARKETPLACE_TRUST from dev.mjs, don't bump Pinia major without thinking, etc.

What's deliberately out of scope right now

  • Stage 2 application-architecture details (sync flow internals, OAuth flow). Will be added when we plan Stage 2.
  • Test conventions — slot in PR 3 when Vitest lands.
  • Aggregate check script + husky — slot in PR 7.

Test plan

  • Reading the file end-to-end, would a fresh contributor (human or AI) avoid the major pitfalls we've each hit during PR 1/PR 2?
  • Anything inaccurate or contradicting current next state?
  • Anything important missing that you've personally tripped on?

🤖 Generated with Claude Code

elisiondan and others added 3 commits May 12, 2026 10:23
… assistants.

Captures what was rediscovered during PR 1 and PR 2 of the 2.0 stack-modernization so future Claude Code / Cursor sessions don't relearn it:

- Repo layout: two published extensions + one internal common package consumed via relative imports (no path aliasing).
- Stack rules: Node 22, npm workspaces (not pnpm — localazy/release@v2 is npm-hardcoded), ESLint 10 flat config, Prettier 3, vue-tsc for typecheck, no Docker.
- Dev workflow with the dev.mjs symlink trick and the SQLite credentials.
- Branching model during 2.0 work: main frozen, next is integration, PRs target next.
- Stage 1 vs Stage 2 scope policy — what's in bounds for tooling PRs and what's deferred to the app-logic refactor.
- Known type errors and the reasons they're deferred (e.g., @directus/types duplication clears with PR 4's SDK bump).
- Stage 2 hold list: sync service code, store internals, OAuth flow.

Expected to be updated as more conventions surface during PR 3-7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per follow-up feedback, the file should describe what the repo is, how it works, and what commands to run -- not transition state or warnings.

- Drop the "Branching model" and "Stage 1 vs Stage 2 scope" sections (specific to the in-flight 2.0 modernization, not future-contributor reference material).
- Drop the "Known type errors (deferred)" section (snapshot of in-flight state).
- Drop the "Gotchas" section (don't-do-X warnings rather than how-it-works content).
- Drop the "When in doubt" tail (pointed at conversation-only artifacts).

Remaining structure: what the repo is -> stack -> architecture -> local development -> commands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…own).

Short rule that's easy to ask reviewers to apply consistently and easy for an AI to honor while writing code in this repo. The double-cast `as unknown as T` is called out specifically because it's the standard escape hatch when a single `as T` doesn't satisfy the type system, and it almost always indicates the test (or call site) should use a narrower type instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
elisiondan added a commit that referenced this pull request May 12, 2026
…casts.

Inspired by the community test suite in #21 (DonkeyOatie). Adapted the test ideas, kept our own structure, and tightened typing so no test file uses `as unknown as` or `as any` (per the new CLAUDE.md coding-conventions rule on PR #24).

Changes:

- `localazy-payment-status.test.ts`: build full Project + Organization mocks via typed helpers using the actual `@localazy/api-client` types, no casts. Replace the `as unknown as Project` double-cast and the missing-organization edge case (`organization` is required by the Project type).
- `enabled-fields-service.test.ts`: fix the wrong fixture shape (the type is `{ fields: string[] }`, not `{ field: string }`). Add cases for empty JSON array, malformed JSON, empty string, plain-object input via a parametrised non-array table. Add the round-trip test (prepare -> parse) for data-integrity guarantee.
- `merge-with-arrays.test.ts`: add cases for null source, undefined source, empty target object, arrays of objects, deep nesting, and order preservation. Organise into `array values` / `object values` / `edge cases` describe blocks.
- `localazy-api-throttle-service.test.ts` (new): `vi.hoisted` + `vi.mock` for the underlying `@localazy/api-client` and the `sleep` utility, with each delegation method tested using its real request type (`ImportJsonRequest`, `FileListKeysRequest`, etc.) — no `as any` on the option arguments. Adds coverage for token refresh (a new client is constructed each call) and for queue ordering / per-call error isolation.

Total goes from 24 to 49 tests across 6 files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@elisiondan
elisiondan merged commit 4376473 into next May 12, 2026
1 check passed
@elisiondan
elisiondan deleted the chore/add-claude-md branch May 12, 2026 08:41
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