Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

docs: add CLAUDE.md#13

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
docs/claude-md
May 26, 2026
Merged

docs: add CLAUDE.md#13
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
docs/claude-md

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add CLAUDE.md as the authoritative dev guide for this Claude-driven SPA: stack, dev loop, code style (no semicolons, .ts/.tsx import extensions, import type, path aliases), architecture rules (direct-to-Kubernetes, dynamic discovery from ApplicationDefinition, watch via useK8sList, tenant scoping, oauth2-proxy), the RJSF form pipeline in SchemaForm.tsx, project layout, testing setup, CI, and PR conventions.

Test plan

  • N/A — docs only

Summary by CodeRabbit

  • Documentation
    • Added internal development documentation outlining project conventions, architecture constraints, and development guidelines for contributors.

Note: This is an internal documentation update with no end-user-facing changes.

Review Change Stack

Add the authoritative dev guide for this Claude-driven SPA: stack, dev
loop, code style, architecture rules (direct-to-Kubernetes, dynamic
discovery from ApplicationDefinitions, watch via useK8sList, tenant
scoping, oauth2-proxy), the RJSF form pipeline, project layout,
testing, CI, and PR conventions.

Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Added CLAUDE.md to document Cozystack console's development model and project conventions. The guide covers development workflow, strict code style rules (no semicolons, explicit imports), Kubernetes-API-first architecture (direct API access, CRD runtime discovery, watch semantics, tenant scoping), RJSF form pipeline constraints, testing practices, and PR expectations.

Changes

Development Conventions and Architecture Documentation

Layer / File(s) Summary
Project conventions and architecture guide
CLAUDE.md
CLAUDE.md establishes development model including: stack/tooling, local dev/production routing (kubectl proxy/nginx), strict code style (no semicolons, explicit imports, type-only imports), Kubernetes API architecture (direct access, ApplicationDefinition CRDs, watch semantics, tenant scoping, oauth2-proxy auth), RJSF pipeline rules (schema sanitization, deterministic widget binding, default-state behavior, schema traversal testing), testing/CI practices, and PR scope rules.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A guide to code so neat and clean,
No semicolons in between,
Kubernetes API rules so strict and tight,
Forms sanitized, tests pinned just right.
With conventions clear, the path shines bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: add CLAUDE.md' is concise, clear, and directly describes the main change—adding a new documentation file to the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/claude-md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces CLAUDE.md, a comprehensive development guide for the cozystack-ui project that outlines the architecture, tech stack, and coding standards for AI-driven development. Review feedback identifies several documentation inaccuracies, including non-existent versions for Vite and TypeScript, inconsistencies in the form widget binding instructions compared to the current implementation, and a mismatch regarding missing patch support in the Kubernetes client hooks.

Comment thread CLAUDE.md
## Stack

- **pnpm workspace** — `apps/console` is the SPA; `packages/{k8s-client,ui,types}` are workspace deps.
- **React 19 + Vite 8 + TypeScript ~6.0** with `module: esnext`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The versions for Vite (8) and TypeScript (6.0) are incorrect as these versions have not been released. This may cause the LLM to assume the availability of non-existent features or APIs. Consider updating these to the actual versions used in the project (e.g., Vite 6 and TypeScript 5.x).

Comment thread CLAUDE.md
When you add a new widget binding:

- Add it to the chain in `SchemaForm.tsx` in a deterministic order.
- Walk `properties` *and* `items` for arrays. Do **not** walk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The guide states that widget binding logic should walk both properties and items for arrays. However, several helper functions in apps/console/src/components/SchemaForm.tsx (such as addStorageClassWidgets, addBackupClassWidgets, and addAdditionalPropertiesWidgets) currently only walk properties. This inconsistency should be resolved to ensure the guide accurately reflects the required implementation pattern.

Comment thread CLAUDE.md
hooks/
test/setup.ts # vitest + jest-dom + manual RTL cleanup
packages/
k8s-client/ # K8sClient (list/get/create/update/patch/delete/watch) + React Query hooks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description for packages/k8s-client/ mentions patch support, but the useK8sPatch hook is missing from packages/k8s-client/src/hooks.ts. If patching is a supported operation, the corresponding hook should be implemented or the documentation updated to reflect the available hooks.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLAUDE.md`:
- Around line 121-137: Add a language token to the fenced code block in
CLAUDE.md (the multi-line listing block that begins with ``` and shows the
apps/console/ structure) so markdownlint rule MD040 stops flagging it; change
the opening fence from ``` to ```text (or another appropriate language) and
leave the closing ``` unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cf75dcda-977e-49ae-adfd-23b8b4e5f01b

📥 Commits

Reviewing files that changed from the base of the PR and between 7c20a20 and c90aa71.

📒 Files selected for processing (1)
  • CLAUDE.md

Comment thread CLAUDE.md
Comment on lines +121 to +137
```
apps/console/
src/
App.tsx, main.tsx # entry + routing
routes/ # one file per top-level page
detail/ # ApplicationDetailPage + tabs (Overview, Workloads, …)
components/ # page-level components, form widgets, command palette
lib/ # app-definitions, tenant-context, sensitive-fields, …
hooks/
test/setup.ts # vitest + jest-dom + manual RTL cleanup
packages/
k8s-client/ # K8sClient (list/get/create/update/patch/delete/watch) + React Query hooks
ui/ # AppShell, Sidebar, Header, Button, StatusBadge, Spinner, Dropdown, Section
types/ # ApplicationDefinition, ApplicationInstance, Tenant, TenantNamespace, group/version constants
Containerfile # multi-stage build → nginx-unprivileged on :8080
.github/workflows/ # test.yaml (typecheck + vitest), build.yaml (multi-arch image to ghcr)
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language to the fenced code block to satisfy markdownlint.

Line 121 opens a fenced block without a language, which triggers MD040. Add a language token (for example text) to avoid lint noise/failures.

Proposed fix
-```
+```text
 apps/console/
   src/
     App.tsx, main.tsx              # entry + routing
@@
 .github/workflows/                  # test.yaml (typecheck + vitest), build.yaml (multi-arch image to ghcr)
-```
+```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
apps/console/
src/
App.tsx, main.tsx # entry + routing
routes/ # one file per top-level page
detail/ # ApplicationDetailPage + tabs (Overview, Workloads, …)
components/ # page-level components, form widgets, command palette
lib/ # app-definitions, tenant-context, sensitive-fields, …
hooks/
test/setup.ts # vitest + jest-dom + manual RTL cleanup
packages/
k8s-client/ # K8sClient (list/get/create/update/patch/delete/watch) + React Query hooks
ui/ # AppShell, Sidebar, Header, Button, StatusBadge, Spinner, Dropdown, Section
types/ # ApplicationDefinition, ApplicationInstance, Tenant, TenantNamespace, group/version constants
Containerfile # multi-stage build → nginx-unprivileged on :8080
.github/workflows/ # test.yaml (typecheck + vitest), build.yaml (multi-arch image to ghcr)
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 121-121: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CLAUDE.md` around lines 121 - 137, Add a language token to the fenced code
block in CLAUDE.md (the multi-line listing block that begins with ``` and shows
the apps/console/ structure) so markdownlint rule MD040 stops flagging it;
change the opening fence from ``` to ```text (or another appropriate language)
and leave the closing ``` unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — docs-only PR adding a CLAUDE.md that's accurate against the current codebase. Walked through every concrete claim and verified it. One minor wording suggestion and a markdownlint nit are below; not blockers.

Verified against current code:

  • pnpm workspace + workspace layout matches (apps/console, packages/{k8s-client,types,ui}).
  • TS compiler options exactly match (tsconfig.base.json: module: esnext, moduleResolution: bundler, verbatimModuleSyntax: true, allowImportingTsExtensions: true, erasableSyntaxOnly: true, noUnusedLocals: true, noUnusedParameters: true).
  • Path aliases match tsconfig.json: @/, @cozystack/{types,ui,k8s-client}.
  • Every widget the doc names exists as a separate file: apps/console/src/components/{StorageClassWidget,BackupClassWidget,VMDiskWidget,AdditionalPropertiesField,SensitiveStringWidget,SchemaForm}.tsx.
  • useK8sList/useK8sGet/useK8sCreate/useK8sUpdate/useK8sDelete all exported from packages/k8s-client/src/hooks.ts. K8sClient class in client.ts has list/get/create/update/patch/delete/watch methods — matches the doc.
  • useTenantContext exported from apps/console/src/lib/tenant-context.tsx:95.
  • /oauth2/userinfo is referenced in apps/console/src/lib/config.ts:35.
  • apps/console/test/setup.ts matches the description verbatim — explicit afterEach(cleanup) because vitest is not in globals: true mode.
  • Containerfile proxies /api, /apis, /k8s to https://kubernetes.default.svc:443; Vite dev server (apps/console/vite.config.ts) proxies the same paths to http://localhost:8001. Both match the doc.
  • CI workflows are exactly test.yaml (typecheck + vitest) and build.yaml. No others.
  • The no-semicolons rule is followed by every file I sampled (App.tsx, BackupClassWidget.tsx, …). BackupClassWidget.tsx opens with import type { WidgetProps } — matches the verbatimModuleSyntax claim.

Bot findings dismissed with evidence:

  1. Gemini P1 — "Vite 8 and TypeScript 6.0 versions have not been released": false positive. Both are actually installed (node_modules/.pnpm shows typescript@6.0.3 and vite@8.0.8), CI runs on a frozen lockfile, the Test job is green. Gemini's training data predates these releases.

  2. Gemini P3 — "useK8sPatch hook missing": false positive based on a misread. The doc says "K8sClient (list/get/create/update/patch/delete/watch) + React Query hooks" — K8sClient.patch IS implemented in packages/k8s-client/src/client.ts. The hook list isn't enumerated in the doc, and the absence of a useK8sPatch wrapper doesn't contradict anything written.

One real minor wording suggestion:

  1. Gemini P2 — "Walk properties and items for arrays" (line 113) is currently only true for addSensitiveStringWidgets (apps/console/src/lib/sensitive-fields.ts:91-93 walks both subtrees and has the "pin broken behaviour" test for the oneOf/anyOf/allOf gap). addStorageClassWidgets and addBackupClassWidgets in SchemaForm.tsx only walk properties. The doc reads as a description of current behavior; it's actually an instruction for future widgets to follow the addSensitiveStringWidgets shape. Worth a one-line clarification, e.g. "Walk properties and items for arrays — see addSensitiveStringWidgets as the reference shape; the older addStorageClassWidgets / addBackupClassWidgets only walk properties and should be aligned when next touched." Not a blocker; this is doc framing.

CodeRabbit nit:

  1. Fenced code block at line 121 has no language tag — triggers markdownlint MD040. Easy fix: ```text on line 121. Markdownlint isn't wired in CI for this repo (only test.yaml + build.yaml), so this is hygiene only.

None of the four findings rise to a blocker. The docs are accurate against the artifact they describe, which is what a CLAUDE.md is for.

@lexfrei Aleksei Sviridkin (lexfrei) merged commit 3732f7c into main May 26, 2026
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants