Skip to content

Commit 889eafa

Browse files
committed
added CLAUDE.md
1 parent 3632f6c commit 889eafa

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed

CLAUDE.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the official documentation repository for the Nette PHP framework ecosystem. It contains technical documentation for 31 packages across 16+ languages, written in Texy markup format and published at nette.org, doc.nette.org, latte.nette.org, tester.nette.org, and tracy.nette.org.
8+
9+
## CRITICAL: Language Version Rules
10+
11+
**⚠️ MOST IMPORTANT: All edits and changes MUST ONLY be made to `/cs/` and `/en/` language versions!**
12+
13+
### Strict Synchronization Requirements
14+
15+
1. **Edit only `/cs/` and `/en/` versions** - Never directly edit other language variants (de, fr, es, ru, etc.)
16+
2. **Perfect line alignment** - `/cs/` and `/en/` must have identical line counts and structure
17+
- Same information must be on the same line number in both versions
18+
- Example: Line 14 in `application/en/presenters.texy` corresponds to line 14 in `application/cs/presenters.texy`
19+
- Both files must have exactly the same number of lines (e.g., both have 510 lines)
20+
3. **Same file sets** - `/cs/` and `/en/` must contain exactly the same `.texy` files
21+
4. **Automatic translation** - Other language variants (de, fr, es, etc.) are translated automatically from `/en/` or `/cs/` using DeepL
22+
5. **Verification** - Use `php verifyLineAlignment.php` to check line synchronization across language versions
23+
24+
### Why This Matters
25+
26+
The translation system relies on line-by-line correspondence between `/cs/` and `/en/`. When these versions are perfectly aligned:
27+
- Automated translation tools can map content accurately
28+
- Changes propagate correctly to all 16+ language variants
29+
- Documentation consistency is maintained across all languages
30+
31+
**Before any edit:**
32+
- Check that both `/cs/` and `/en/` files exist
33+
- Ensure line counts match: `wc -l package/en/file.texy package/cs/file.texy`
34+
- Make parallel changes to maintain synchronization
35+
36+
## Documentation Structure
37+
38+
Documentation is organized by package, language, and article:
39+
40+
```
41+
<package>/
42+
├── en/ # English version (primary language)
43+
├── cs/ # Czech version
44+
├── de/, fr/, ... # Other language variants
45+
├── files/ # Shared images and assets
46+
└── meta.json # Package metadata (version, repo, composer name)
47+
```
48+
49+
### Complete Package Inventory (31 packages, 233 files in /en)
50+
51+
**Core Framework (77 files):**
52+
- `application/` (14 files) - MVC framework, presenters, routing, components
53+
- `bootstrap/` (2 files) - Application initialization and configuration
54+
- `component-model/` (2 files) - Component system and lifecycle
55+
- `dependency-injection/` (14 files) - DI container, autowiring, services
56+
- `forms/` (9 files) - Form creation, validation, rendering
57+
- `http/` (8 files) - HTTP request/response, sessions, URLs
58+
- `security/` (7 files) - Authentication, authorization, passwords
59+
- `caching/` (2 files) - Caching mechanisms
60+
- `mail/` (2 files) - Email sending
61+
- `nette/` (9 files) - Main documentation hub, glossary, installation
62+
- `quickstart/` (9 files) - Getting started tutorial
63+
64+
**Templating & Content (44 files):**
65+
- `latte/` (33 files) - Templating engine v3.0+ with `/cookbook/` subdirectory (only package with nested structure)
66+
- `texy/` (11 files) - Texy markup language processor
67+
68+
**Database & Data (28 files):**
69+
- `database/` (13 files) - Database access layer, Explorer, transactions
70+
- `dibi/` (3 files) - Dibi database abstraction layer
71+
- `migrations/` (10 files) - Database migrations and version upgrades
72+
- `schema/` (2 files) - Schema validation and generation
73+
74+
**Utilities & Tools (47 files):**
75+
- `utils/` (23 files) - Arrays, strings, filesystem, validation, datetime
76+
- `tracy/` (11 files) - Debugger, dumper, extensions
77+
- `tester/` (12 files) - Testing framework with assertions and TestCase
78+
- `tokenizer/` (1 file) - PHP tokenizer
79+
80+
**Code Generation & Processing (5 files):**
81+
- `php-generator/` (2 files) - PHP code generation
82+
- `robot-loader/` (1 file) - Automatic class loader
83+
- `safe-stream/` (1 file) - Safe stream handling
84+
- `neon/` (3 files) - NEON format parser
85+
86+
**Supporting (20 files):**
87+
- `assets/` (5 files) - Asset management and Vite integration
88+
- `code-checker/` (1 file) - Code quality checker tool
89+
- `contributing/` (6 files) - Contribution guidelines and documentation standards
90+
- `best-practices/` (16 files) - Development patterns and recipes
91+
- `www/` (11 files) - Website content, logo, license, packages
92+
93+
**Structure notes:**
94+
- **30 packages** have flat structure (files directly in `/en/` directory)
95+
- **1 package** has nested structure: `latte/` with `/cookbook/` subdirectory containing 8 additional files
96+
- All packages include `@home.texy` (entry point) and `@meta.texy` (metadata)
97+
- Most packages include `@left-menu.texy` or `@menu.texy` for navigation
98+
99+
**Branch structure:**
100+
- `master` - Current documentation (latest versions)
101+
- `doc-3.x` - Version 3.x documentation
102+
- `doc-2.x` - Legacy 2.x documentation
103+
104+
## File Format
105+
106+
Documentation uses **Texy markup** (`.texy` files), a custom markup language for structured content. Files contain headings, paragraphs, and code blocks parsed by the utilities in the root directory.
107+
108+
## Documentation Guidelines
109+
110+
Follow Nette's documentation standards:
111+
- Start with simple concepts, progress to advanced topics
112+
- Test all code examples for accuracy
113+
- Use clear, concise language
114+
- Minimal use of highlighting and special formatting
115+
- Adhere to [Coding Standard] in code examples
116+
117+
English is the primary language. Use DeepL Translator for translations, which will be reviewed by contributors.
118+
119+
## Common Tasks
120+
121+
**Adding a new documentation page:**
122+
1. **CRITICAL:** Create `.texy` file in BOTH `/en/` AND `/cs/` directories
123+
2. Ensure both files have the same structure and line count
124+
3. Follow existing structure (headings, code blocks, paragraphs)
125+
4. Add code examples with proper syntax highlighting
126+
5. Verify line alignment: `wc -l package/en/file.texy package/cs/file.texy`
127+
8. Run code-checker before committing
128+
129+
**Editing existing documentation:**
130+
1. **CRITICAL:** Edit ONLY `/cs/` and `/en/` versions - never edit de, fr, es, ru, etc.
131+
2. Make parallel changes to both `/cs/` and `/en/` files
132+
3. Maintain identical line counts - add/remove lines in both files simultaneously
133+
4. Keep the same information on the same line numbers
134+
6. Other language variants will be updated automatically by the translation system
135+
136+
### Example: Correct Way to Edit Documentation
137+
138+
**❌ WRONG - Editing only one language:**
139+
```bash
140+
# Don't do this!
141+
vim application/en/presenters.texy
142+
# Edit only English version
143+
# Save and commit
144+
```
145+
146+
**✅ CORRECT - Editing both synchronized versions:**
147+
```bash
148+
# Check current line counts
149+
wc -l application/en/presenters.texy application/cs/presenters.texy
150+
# Output: 510 application/en/presenters.texy
151+
# 510 application/cs/presenters.texy
152+
153+
# Edit both files in parallel
154+
vim application/en/presenters.texy application/cs/presenters.texy
155+
156+
# After editing, verify line counts still match
157+
wc -l application/en/presenters.texy application/cs/presenters.texy
158+
# Output should still be: 510 510
159+
```
160+
161+
**Example of line-by-line correspondence:**
162+
```
163+
application/en/presenters.texy:
164+
Line 1: Presenters
165+
Line 14: [We already know...
166+
Line 510: (last line)
167+
168+
application/cs/presenters.texy:
169+
Line 1: Presentery
170+
Line 14: [Už víme...
171+
Line 510: (last line)
172+
```
173+
174+
Both files have identical structure, same number of lines, same information on corresponding lines - only the language differs.

0 commit comments

Comments
 (0)