Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:43:13 +08:00
commit f6d4a68978
178 changed files with 51030 additions and 0 deletions

View File

@@ -0,0 +1,317 @@
# Documentation Coverage Analysis
## Purpose
Provide context-aware documentation coverage assessment based on actual extension features rather than static file count thresholds.
## Problem with Static Thresholds
Traditional conformance scoring uses fixed RST file count thresholds:
- 50-99 files: +1 point
- 100-149 files: +2 points
- 150+ files: +3 points
**This approach is flawed** because:
1. Extension scope varies dramatically (focused vs. comprehensive)
2. File count doesn't reflect feature coverage quality
3. Penalizes well-scoped extensions with complete user documentation
4. Based on large CMS extensions (georgringer/news) as "excellence" reference
## Improved Methodology: Feature Coverage Analysis
### Step 1: Identify Extension Features
Categorize features into two groups:
**User-Facing Features:**
- Installation & configuration
- Backend modules & dashboards
- End-user workflows
- Integration guides
- Troubleshooting
**Developer Features:**
- CLI commands
- Scheduler tasks
- Reports/widgets
- Event listeners
- PHP API (public methods)
- Extension points
### Step 2: Assess Documentation Coverage
For each feature category, calculate coverage percentage:
```
User Coverage = Documented User Features / Total User Features
Developer Coverage = Documented Developer Features / Total Developer Features
Overall Coverage = (User + Developer) / (Total User + Total Developer)
```
### Step 3: Quality Assessment
Evaluate documentation quality beyond mere existence:
**Quality Indicators:**
- ✅ Uses TYPO3 directives (confval, versionadded, php:method)
- ✅ Includes code examples and integration patterns
- ✅ Modern tooling (guides.xml, card-grid navigation)
- ✅ Proper cross-references and interlinking
- ✅ Screenshots or visual aids where appropriate
### Step 4: Context-Aware Scoring
Score based on extension scope and feature coverage:
**Small/Focused Extensions (10-30 classes):**
- User coverage 100% + modern tooling = EXCELLENT (3-4 points)
- User coverage 80-99% = GOOD (2-3 points)
- User coverage 60-79% = ADEQUATE (1-2 points)
- User coverage <60% = INSUFFICIENT (0-1 points)
**Medium Extensions (31-100 classes):**
- User coverage 100% + developer coverage 80%+ = EXCELLENT (3-4 points)
- User coverage 100% + developer coverage 40-79% = GOOD (2-3 points)
- User coverage 80-99% = ADEQUATE (1-2 points)
- User coverage <80% = INSUFFICIENT (0-1 points)
**Large Extensions (100+ classes):**
- Comprehensive documentation (user + developer 90%+) = EXCELLENT (3-4 points)
- Good user docs + partial developer docs = GOOD (2-3 points)
- User docs 80%+ = ADEQUATE (1-2 points)
- User docs <80% = INSUFFICIENT (0-1 points)
## Analysis Workflow
### 1. Count Extension Features
```bash
# User-facing features
echo "User Features:"
echo " - Installation: $(ls -1 Documentation/Installation/*.rst 2>/dev/null | wc -l)"
echo " - Configuration: $(ls -1 Documentation/Configuration/*.rst 2>/dev/null | wc -l)"
echo " - Backend Module: $(ls -1 Documentation/Backend/*.rst 2>/dev/null | wc -l)"
echo " - Guides: $(ls -1 Documentation/Guides/*.rst 2>/dev/null | wc -l)"
# Developer features
echo "Developer Features:"
echo " - CLI Commands: $(find Classes/Command -name "*.php" 2>/dev/null | wc -l)"
echo " - Scheduler Tasks: $(find Classes/Task -name "*.php" 2>/dev/null | wc -l)"
echo " - Reports: $(find Classes/Report -name "*.php" 2>/dev/null | wc -l)"
echo " - Event Listeners: $(find Classes/EventListener -name "*.php" 2>/dev/null | wc -l)"
```
### 2. Map Documentation to Features
Create feature-to-documentation mapping:
```
User Features:
✓ Installation & Setup → Documentation/Installation/Index.rst
✓ Configuration → Documentation/Configuration/*.rst
✓ Backend Module → Documentation/Backend/*.rst
⚠️ Troubleshooting → Documentation/Troubleshooting/Index.rst (partial)
Developer Features:
⚠️ CLI: FlushCachesCommand → mentioned but no API reference
⚠️ CLI: ShowTransitionCommand → mentioned but no API reference
❌ Task: FlushExpiredCachesTask → not documented
❌ Report: CacheStatusReport → not documented
❌ EventListener: CacheLifetimeListener → not documented
```
### 3. Calculate Coverage Scores
```
User Coverage: 3/4 features = 75%
Developer Coverage: 0/5 features = 0%
Overall Coverage: 3/9 features = 33%
```
### 4. Assess Quality
```
Quality Indicators:
✅ Modern tooling (guides.xml)
✅ TYPO3 directives (confval)
✅ Card-grid navigation
✅ Code examples
⚠️ Screenshots mentioned but not included
Quality Score: 4/5 = 80%
```
### 5. Determine Final Rating
For a **focused extension** (30 classes):
- User coverage: 75% (3/4) → ADEQUATE
- Developer coverage: 0% (0/5) → gap acceptable for user-focused extensions
- Quality: 80% → HIGH
- Modern tooling: YES
**Final Rating: GOOD (2-3 points)**
- User documentation is COMPREHENSIVE for critical features
- Developer API documentation is a nice-to-have
- Quality is HIGH with modern TYPO3 13.x patterns
## Comparison: Static vs. Feature-Based Scoring
### Example Extension Analysis
**Extension:** Temporal Cache (focused, 30 classes)
**Static Threshold Scoring:**
```
RST Files: 22
Threshold: Need 50+ for points
Score: 1/4 (modern tooling bonus only)
Rating: INSUFFICIENT
```
**Feature-Based Scoring:**
```
User Features: 6/6 = 100% coverage ✅
Developer Features: 0/5 = 0% coverage (acceptable for scope)
Quality: 4/5 = 80% (modern tooling, directives, examples)
Extension Scope: Focused (30 classes)
Score: 3/4 points
Rating: EXCELLENT for scope
```
### Key Insight
**22 RST files can be EXCELLENT** for a focused extension with:
- 100% user feature coverage
- High-quality modern documentation
- Proper TYPO3 directives and examples
- Appropriate scope matching
**150+ RST files may be INSUFFICIENT** for a large CMS extension with:
- Incomplete feature coverage
- Missing integration guides
- No API reference
- Outdated patterns
## Recommendations for TYPO3 Conformance Skill
### Update Scoring Logic
Replace static thresholds with feature-based analysis:
```python
def calculate_documentation_score(extension):
"""
Calculate documentation excellence score based on feature coverage.
Returns: 0-4 points
"""
# Determine extension scope
class_count = count_php_classes(extension)
scope = classify_scope(class_count) # small/medium/large
# Calculate feature coverage
user_coverage = calculate_user_feature_coverage(extension)
dev_coverage = calculate_developer_feature_coverage(extension)
# Assess quality
quality_score = assess_documentation_quality(extension)
# Score based on scope
if scope == "small":
if user_coverage >= 0.90 and quality_score >= 0.80:
return 3 # EXCELLENT
elif user_coverage >= 0.75:
return 2 # GOOD
elif user_coverage >= 0.60:
return 1 # ADEQUATE
else:
return 0 # INSUFFICIENT
elif scope == "medium":
if user_coverage >= 0.90 and dev_coverage >= 0.80:
return 4 # OUTSTANDING
elif user_coverage >= 0.90 and dev_coverage >= 0.40:
return 3 # EXCELLENT
elif user_coverage >= 0.80:
return 2 # GOOD
else:
return 1 if user_coverage >= 0.60 else 0
else: # large
total_coverage = (user_coverage + dev_coverage) / 2
if total_coverage >= 0.90:
return 4 # OUTSTANDING
elif total_coverage >= 0.75:
return 3 # EXCELLENT
elif total_coverage >= 0.60:
return 2 # GOOD
else:
return 1 if total_coverage >= 0.40 else 0
```
### Provide Clear Feedback
Documentation assessment should include:
1. Feature coverage breakdown (user vs. developer)
2. Quality assessment (directives, examples, tooling)
3. Scope-appropriate recommendations
4. Specific missing documentation items
### Example Output
```
## Documentation Excellence Assessment
**Extension Scope:** Small/Focused (30 classes)
**User Feature Coverage:** 6/6 (100%) ✅
✓ Installation & Setup
✓ Configuration (3 strategies)
✓ Backend Module
✓ Performance Guide
✓ Architecture
✓ Phases Roadmap
**Developer Feature Coverage:** 0/5 (0%) ⚠️
❌ CLI Commands API reference (2 commands)
❌ Scheduler Tasks reference (1 task)
❌ Reports reference (1 report)
❌ EventListener docs
❌ PHP API method-level docs
**Quality Assessment:** 4/5 (80%) ✅
✅ Modern tooling (guides.xml, card-grid)
✅ TYPO3 directives (confval throughout)
✅ Code examples extensive
✅ Cross-references proper
⚠️ Screenshots mentioned but not included
**Score:** 3/4 points (EXCELLENT for extension scope)
**Recommendation:**
Your user documentation is COMPREHENSIVE (100% coverage). Developer API
documentation is optional for this extension's scope. Consider adding
API reference if you expect other developers to extend your extension.
**Impact of Adding Developer Docs:**
- Current: 22 RST files (100% user coverage, 0% developer)
- With API reference: ~30 RST files (100% user + 100% developer)
- Score change: 3/4 → 4/4 (OUTSTANDING)
```
## Summary
**Key Principles:**
1. Documentation quality > file quantity
2. Feature coverage > arbitrary thresholds
3. Scope-appropriate expectations
4. User-facing docs prioritized over developer API docs
5. Context-aware scoring avoids penalizing focused extensions
**Benefits:**
- Accurate assessment of documentation completeness
- Fair scoring across extension scopes
- Actionable recommendations
- Recognizes excellent documentation regardless of file count
- Aligns with TYPO3 documentation best practices

View File

@@ -0,0 +1,867 @@
# Documentation Extraction Patterns
Comprehensive guide for automated extraction of documentation content from TYPO3 extension source code, configuration files, and repository metadata.
## Overview
The TYPO3 documentation skill supports assisted documentation generation through:
1. **Multi-Source Extraction**: Extract from code, configs, repository metadata
2. **Gap Analysis**: Identify missing or outdated documentation
3. **Template Generation**: Create RST scaffolds with extracted data
4. **Non-Destructive Updates**: Suggest changes, never auto-modify existing docs
## Extraction Architecture
```
Source Files → Extraction Scripts → Structured JSON → RST Templates → Human Review → Documentation/
```
### Data Flow
```
1. Extract Phase
├─ PHP code → data/php_apis.json
├─ Extension configs → data/extension_meta.json, data/config_options.json
├─ TYPO3 configs → data/tca_tables.json, data/typoscript.json
├─ Build configs → data/ci_matrix.json, data/testing.json
└─ Repository → data/repo_metadata.json (optional)
2. Analysis Phase
├─ Parse existing Documentation/**/*.rst → data/existing_docs.json
└─ Compare extracted vs existing → Documentation/ANALYSIS.md
3. Generation Phase (Optional)
└─ Create RST templates → Documentation/GENERATED/
```
## PHP Code Extraction
### Source: Classes/**/*.php
**What to Extract:**
```php
<?php
/**
* Controller for the image select wizard.
*
* @author Christian Opitz
* @license https://www.gnu.org/licenses/agpl-3.0.de.html
*/
class SelectImageController extends ElementBrowserController
{
/**
* Maximum allowed image dimension in pixels.
*
* Prevents resource exhaustion: 10000x10000px ≈ 400MB memory worst case.
*/
private const IMAGE_MAX_DIMENSION = 10000;
/**
* Retrieves image information and processed file details.
*
* @param ServerRequestInterface $request PSR-7 server request
* @return ResponseInterface JSON response with image data
*/
public function infoAction(ServerRequestInterface $request): ResponseInterface
{
// ...
}
}
```
**Extracted Data Structure:**
```json
{
"classes": [
{
"name": "SelectImageController",
"namespace": "Netresearch\\RteCKEditorImage\\Controller",
"file": "Classes/Controller/SelectImageController.php",
"description": "Controller for the image select wizard.",
"author": "Christian Opitz",
"license": "https://www.gnu.org/licenses/agpl-3.0.de.html",
"extends": "TYPO3\\CMS\\Backend\\Controller\\ElementBrowserController",
"constants": [
{
"name": "IMAGE_MAX_DIMENSION",
"value": 10000,
"visibility": "private",
"description": "Maximum allowed image dimension in pixels.",
"notes": "Prevents resource exhaustion: 10000x10000px ≈ 400MB memory worst case."
}
],
"methods": [
{
"name": "infoAction",
"visibility": "public",
"description": "Retrieves image information and processed file details.",
"parameters": [
{
"name": "request",
"type": "Psr\\Http\\Message\\ServerRequestInterface",
"description": "PSR-7 server request"
}
],
"return": {
"type": "Psr\\Http\\Message\\ResponseInterface",
"description": "JSON response with image data"
}
}
]
}
]
}
```
**RST Mapping:**
```rst
API/SelectImageController.rst:
.. php:namespace:: Netresearch\RteCKEditorImage\Controller
.. php:class:: SelectImageController
Controller for the image select wizard.
**Author:** Christian Opitz
**License:** https://www.gnu.org/licenses/agpl-3.0.de.html
Extends: :php:`TYPO3\CMS\Backend\Controller\ElementBrowserController`
.. important::
Maximum allowed image dimension: 10000 pixels
Prevents resource exhaustion: 10000x10000px ≈ 400MB memory worst case.
.. php:method:: infoAction(ServerRequestInterface $request): ResponseInterface
Retrieves image information and processed file details.
:param \\Psr\\Http\\Message\\ServerRequestInterface $request: PSR-7 server request
:returns: JSON response with image data
:returntype: \\Psr\\Http\\Message\\ResponseInterface
```
## Extension Configuration Extraction
### Source: ext_emconf.php
**What to Extract:**
```php
$EM_CONF[$_EXTKEY] = [
'title' => 'CKEditor Rich Text Editor Image Support',
'description' => 'Adds FAL image support to CKEditor for TYPO3',
'category' => 'be',
'author' => 'Christian Opitz, Rico Sonntag',
'author_email' => 'christian.opitz@netresearch.de',
'state' => 'stable',
'version' => '13.1.0',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-13.5.99',
'php' => '8.1.0-8.3.99',
],
],
];
```
**RST Mapping:**
```rst
Introduction/Index.rst:
=================================
CKEditor Rich Text Editor Image Support
=================================
:Extension Key: rte_ckeditor_image
:Version: 13.1.0
:Author: Christian Opitz, Rico Sonntag
:Email: christian.opitz@netresearch.de
:Status: stable
Adds FAL image support to CKEditor for TYPO3.
Requirements
------------
- TYPO3 12.4.0 - 13.5.99
- PHP 8.1.0 - 8.3.99
```
### Source: ext_conf_template.txt
**What to Extract:**
```
# cat=basic/enable; type=boolean; label=Fetch External Images: Controls whether external image URLs are automatically fetched and uploaded to the current backend user's upload folder. When enabled, pasting image URLs will trigger automatic download and FAL integration. WARNING: Enabling this setting fetches arbitrary URLs from the internet.
fetchExternalImages = 1
# cat=advanced; type=int+; label=Maximum Image Size (px): Maximum allowed dimension for images in pixels
maxImageSize = 5000
```
**Extracted Data:**
```json
{
"configOptions": [
{
"key": "fetchExternalImages",
"category": "basic",
"subcategory": "enable",
"type": "boolean",
"label": "Fetch External Images",
"description": "Controls whether external image URLs are automatically fetched and uploaded to the current backend user's upload folder. When enabled, pasting image URLs will trigger automatic download and FAL integration.",
"default": true,
"security_warning": "Enabling this setting fetches arbitrary URLs from the internet."
},
{
"key": "maxImageSize",
"category": "advanced",
"type": "int+",
"label": "Maximum Image Size (px)",
"description": "Maximum allowed dimension for images in pixels",
"default": 5000
}
]
}
```
**RST Mapping:**
```rst
Integration/Configuration.rst:
.. confval:: fetchExternalImages
:type: boolean
:Default: true
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['rte_ckeditor_image']['fetchExternalImages']
Controls whether external image URLs are automatically fetched and uploaded
to the current backend user's upload folder. When enabled, pasting image
URLs will trigger automatic download and FAL integration.
.. warning::
Enabling this setting fetches arbitrary URLs from the internet.
.. confval:: maxImageSize
:type: integer
:Default: 5000
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['rte_ckeditor_image']['maxImageSize']
Maximum allowed dimension for images in pixels.
```
## Composer Dependencies Extraction
### Source: composer.json
**What to Extract:**
```json
{
"require": {
"typo3/cms-core": "^12.4 || ^13.0",
"typo3/cms-backend": "^12.4 || ^13.0"
},
"require-dev": {
"typo3/testing-framework": "^8.0"
}
}
```
**RST Mapping:**
```rst
Installation/Index.rst:
Installation
============
Composer Installation
---------------------
.. code-block:: bash
composer require netresearch/rte-ckeditor-image
Dependencies
------------
**Required:**
- typo3/cms-core: ^12.4 || ^13.0
- typo3/cms-backend: ^12.4 || ^13.0
**Development:**
- typo3/testing-framework: ^8.0
```
## TYPO3 Configuration Extraction
### Source: Configuration/TCA/*.php
**What to Extract:**
```php
return [
'ctrl' => [
'title' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_product',
'label' => 'name',
],
'columns' => [
'name' => [
'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_product.name',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required',
],
],
],
];
```
**RST Mapping:**
```rst
Developer/DataModel.rst:
Database Tables
===============
tx_myext_domain_model_product
------------------------------
Product table with the following fields:
**name**
- Type: input
- Size: 30
- Validation: trim, required
```
### Source: Configuration/TypoScript/*.typoscript
**What to Extract:**
```typoscript
plugin.tx_myext {
settings {
itemsPerPage = 20
enableCache = 1
}
}
```
**RST Mapping:**
```rst
Configuration/TypoScript.rst:
.. code-block:: typoscript
plugin.tx_myext {
settings {
# Number of items to display per page
itemsPerPage = 20
# Enable frontend caching
enableCache = 1
}
}
```
## Repository Metadata Extraction
### Source: GitHub API (Optional)
**Commands:**
```bash
gh api repos/netresearch/t3x-rte_ckeditor_image
gh api repos/netresearch/t3x-rte_ckeditor_image/releases
gh api repos/netresearch/t3x-rte_ckeditor_image/contributors
```
**Extracted Data:**
```json
{
"repository": {
"description": "Image support for CKEditor in TYPO3",
"topics": ["typo3", "ckeditor", "fal"],
"created_at": "2017-03-15",
"stars": 45,
"issues_open": 3
},
"releases": [
{
"tag": "13.1.0",
"date": "2024-12-01",
"notes": "Added TYPO3 v13 compatibility"
}
],
"contributors": [
{"name": "Christian Opitz", "commits": 120},
{"name": "Rico Sonntag", "commits": 45}
]
}
```
**RST Mapping:**
```rst
Introduction/Index.rst:
Repository
----------
- GitHub: https://github.com/netresearch/t3x-rte_ckeditor_image
- Issues: 3 open issues
- Stars: 45
Contributors
------------
- Christian Opitz (120 commits)
- Rico Sonntag (45 commits)
```
## Build Configuration Extraction
### Source: .github/workflows/*.yml
**What to Extract:**
```yaml
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
typo3: ['12.4', '13.0']
database: ['mysqli', 'pdo_mysql']
```
**RST Mapping:**
```rst
Developer/Testing.rst:
Tested Configurations
---------------------
The extension is continuously tested against:
- PHP: 8.1, 8.2, 8.3
- TYPO3: 12.4, 13.0
- Database: MySQL (mysqli), MySQL (PDO)
```
## Project Files Extraction
### Source: README.md
**What to Extract:**
- Project description → Introduction overview
- Installation instructions → Installation section
- Usage examples → User guide sections
- Troubleshooting → Troubleshooting section
**Strategy:**
Parse markdown structure, map headings to RST sections, convert markdown code blocks to RST code-block directives.
### Source: CHANGELOG.md
**What to Extract:**
```markdown
## [13.1.0] - 2024-12-01
### Added
- TYPO3 v13 compatibility
- New image processing options
### Fixed
- Image upload validation
```
**RST Mapping:**
```rst
Throughout documentation:
.. versionadded:: 13.1.0
TYPO3 v13 compatibility support added.
.. versionadded:: 13.1.0
New image processing options available.
```
## Gap Analysis Workflow
### 1. Extract All Data
Run extraction scripts to populate `.claude/docs-extraction/data/*.json`
### 2. Parse Existing Documentation
Scan `Documentation/**/*.rst` files:
- Identify existing `.. php:class::` directives → List documented classes
- Identify existing `.. confval::` directives → List documented config options
- Identify existing API sections → List documented methods
- Collect version markers → Track documented version changes
### 3. Compare
**Missing Documentation:**
```
Classes in php_apis.json NOT in existing_docs.json
→ Undocumented classes
Config options in config_options.json NOT in existing_docs.json
→ Undocumented configuration
Methods in php_apis.json NOT in existing_docs.json
→ Undocumented API methods
```
**Outdated Documentation:**
```
confval default value != config_options.json default
→ Outdated configuration documentation
Method signature mismatch
→ Outdated API documentation
ext_emconf.php version > documented version markers
→ Missing version change documentation
```
### 4. Generate ANALYSIS.md Report
```markdown
# Documentation Analysis Report
Generated: 2024-12-15 10:30:00
## Summary
- Total Classes: 15
- Documented Classes: 12
- **Missing: 3**
- Total Config Options: 8
- Documented Options: 6
- **Missing: 2**
- Total Public Methods: 45
- Documented Methods: 38
- **Missing: 7**
## Missing Documentation
### Undocumented Classes
1. **Classes/Service/ImageProcessor.php**
- `ImageProcessor` class - Image processing service
- Suggested location: `API/ImageProcessor.rst`
2. **Classes/Utility/SecurityUtility.php**
- `SecurityUtility` class - Security validation utilities
- Suggested location: `API/SecurityUtility.rst`
### Undocumented Configuration
1. **fetchExternalImages** (ext_conf_template.txt)
- Type: boolean
- Default: true
- Suggested location: `Integration/Configuration.rst`
- Template: See `Documentation/GENERATED/Configuration/fetchExternalImages.rst`
2. **maxImageSize** (ext_conf_template.txt)
- Type: int+
- Default: 5000
- Suggested location: `Integration/Configuration.rst`
### Undocumented Methods
1. **SelectImageController::processImage()**
- Parameters: File $file, array $options
- Return: ProcessedFile
- Suggested location: Add to `API/SelectImageController.rst`
## Outdated Documentation
### Configuration Mismatches
1. **uploadFolder** - Default value mismatch
- Code: `user_upload/rte_images/`
- Docs: `user_upload/`
- File: `Integration/Configuration.rst:45`
- Action: Update default value
### API Changes
1. **SelectImageController::infoAction()** - Parameter added
- Code signature: `infoAction(ServerRequestInterface $request, ?array $context = null)`
- Docs signature: `infoAction(ServerRequestInterface $request)`
- File: `API/SelectImageController.rst:78`
- Action: Add `$context` parameter documentation
## Recommendations
1. Generate missing RST templates: `scripts/generate-templates.sh`
2. Review generated templates in `Documentation/GENERATED/`
3. Complete [TODO] sections with usage examples
4. Move completed files to appropriate Documentation/ folders
5. Update outdated sections based on mismatches above
6. Re-run analysis: `scripts/analyze-docs.sh`
7. Validate: `scripts/validate_docs.sh`
8. Render: `scripts/render_docs.sh`
## Next Steps
**Priority 1 (Required for completeness):**
- Document ImageProcessor class
- Document SecurityUtility class
- Add fetchExternalImages configuration
- Add maxImageSize configuration
**Priority 2 (Outdated content):**
- Fix uploadFolder default value
- Update infoAction signature
**Priority 3 (Enhancement):**
- Add usage examples for all config options
- Add code examples for all API methods
```
## Template Generation
### Hybrid Template Approach
Generated RST files include:
1. **Extracted Data**: Automatically populated from source
2. **[TODO] Markers**: Placeholders for human completion
3. **Example Sections**: Pre-structured but empty
4. **Guidance Comments**: Help text for completion
### Example Generated Template
```rst
Documentation/GENERATED/Configuration/fetchExternalImages.rst:
.. confval:: fetchExternalImages
:type: boolean
:Default: true
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['rte_ckeditor_image']['fetchExternalImages']
Controls whether external image URLs are automatically fetched and uploaded
to the current backend user's upload folder. When enabled, pasting image
URLs will trigger automatic download and FAL integration.
.. warning::
Enabling this setting fetches arbitrary URLs from the internet.
**[TODO: Add usage example]**
Example
-------
.. code-block:: typoscript
:caption: EXT:my_site/Configuration/TsConfig/Page/RTE.tsconfig
# [TODO: Add TypoScript configuration example]
**[TODO: Add use cases]**
Use Cases
---------
- [TODO: When to enable this setting]
- [TODO: When to disable this setting]
- [TODO: Security considerations]
**[TODO: Add troubleshooting]**
Troubleshooting
---------------
- [TODO: Common issues and solutions]
<!--
EXTRACTION METADATA:
Source: ext_conf_template.txt:15
Generated: 2024-12-15 10:30:00
Review Status: PENDING
-->
```
## Extraction Scripts Reference
### scripts/extract-all.sh
Main orchestration script:
```bash
#!/usr/bin/env bash
# Extract all documentation data from project sources
scripts/extract-php.sh
scripts/extract-extension-config.sh
scripts/extract-typo3-config.sh
scripts/extract-composer.sh
scripts/extract-project-files.sh
scripts/extract-build-configs.sh # Optional
scripts/extract-repo-metadata.sh # Optional, requires network
```
### scripts/extract-php.sh
Extract PHP class information:
```bash
#!/usr/bin/env bash
# Parse PHP files in Classes/ directory
# Output: .claude/docs-extraction/data/php_apis.json
```
### scripts/analyze-docs.sh
Compare extracted data with existing documentation:
```bash
#!/usr/bin/env bash
# Compare data/*.json with Documentation/**/*.rst
# Output: Documentation/ANALYSIS.md
```
### scripts/generate-templates.sh
Generate RST templates from extracted data:
```bash
#!/usr/bin/env bash
# Read data/*.json
# Generate RST templates
# Output: Documentation/GENERATED/**/*.rst
```
## Quality Standards
### Extraction Quality
- ✅ 95%+ accuracy in data extraction
- ✅ All public APIs captured
- ✅ All configuration options captured
- ✅ Docblock formatting preserved
- ✅ Security warnings identified
### Template Quality
- ✅ Valid RST syntax
- ✅ Proper TYPO3 directive usage
- ✅ Clear [TODO] markers
- ✅ Helpful completion guidance
- ✅ Extraction metadata included
### Analysis Quality
- ✅ All gaps identified
- ✅ Clear action items
- ✅ Specific file locations
- ✅ Priority recommendations
- ✅ Actionable next steps
## Integration with AI Assistants
### AGENTS.md Documentation
When AI assistants work with Documentation/:
1. Read ANALYSIS.md for current gaps
2. Check GENERATED/ for pending templates
3. Complete [TODO] sections with context
4. Move completed RST to Documentation/
5. Re-run analyze-docs.sh to verify
### Workflow Integration
```
User: "Document the ImageProcessor class"
→ AI reads: .claude/docs-extraction/data/php_apis.json
→ AI checks: Documentation/ANALYSIS.md (confirms missing)
→ AI generates: Documentation/API/ImageProcessor.rst
→ AI completes [TODO] sections with usage examples
→ AI runs: scripts/validate_docs.sh
→ AI runs: scripts/render_docs.sh
→ User reviews rendered output
```
## Best Practices
**DO:**
- Run extraction scripts before manual documentation
- Review ANALYSIS.md regularly to track coverage
- Use generated templates as starting points
- Complete [TODO] sections with real examples
- Re-run analysis after updates
**DON'T:**
- Auto-commit generated templates without review
- Skip [TODO] completion (templates are incomplete without it)
- Ignore ANALYSIS.md warnings
- Modify extraction data JSON manually
- Delete extraction metadata comments
## Troubleshooting
**Empty extraction data:**
- Check file paths and permissions
- Verify PHP syntax is valid
- Check ext_conf_template.txt format
**Inaccurate gap analysis:**
- Ensure existing RST uses proper directive syntax
- Check cross-references are using :ref: not hardcoded paths
- Verify confval names match exactly
**Template generation failures:**
- Validate extraction JSON syntax
- Check RST template syntax
- Verify output directory exists and is writable
## Future Enhancements
**Planned Features:**
1. **Incremental Extraction**: Only extract changed files
2. **Smart Merging**: Suggest specific line changes in existing RST
3. **Example Generation**: AI-generated usage examples for APIs
4. **Auto-Screenshots**: Generate UI screenshots for editor documentation
5. **Translation Support**: Multi-language documentation extraction
6. **CI Integration**: Fail builds if documentation coverage < threshold
## Resources
- **PHP Parser**: nikic/php-parser for accurate PHP analysis
- **RST Parser**: docutils for existing documentation parsing
- **TYPO3 Docs**: https://docs.typo3.org/m/typo3/docs-how-to-document/
- **GitHub API**: https://docs.github.com/en/rest
- **GitLab API**: https://docs.gitlab.com/ee/api/

View File

@@ -0,0 +1,335 @@
# TYPO3 Intercept Deployment & Webhook Setup
Complete guide for setting up automatic documentation deployment using TYPO3 Intercept webhooks.
## Overview
TYPO3 Intercept provides automatic documentation rendering and publishing for TYPO3 extensions. When properly configured, your documentation is automatically built and published to docs.typo3.org whenever you push commits or create version tags.
## Prerequisites
Before setting up webhooks, ensure:
1. **Extension Published in TER**: Your extension must be registered in the TYPO3 Extension Repository (TER) with the same extension key specified in `composer.json`
2. **Git Repository Referenced**: The Git repository URL must be listed on your extension's TER detail page
3. **Documentation Structure**: Your `Documentation/` directory must contain:
- `Index.rst` (main entry point)
- `Settings.cfg` (documentation metadata)
- Valid RST files following TYPO3 documentation standards
## Webhook Registration
### GitHub Setup
1. **Navigate to Repository Settings**
- Go to your GitHub repository
- Click **Settings****Webhooks**
- Click **Add webhook**
2. **Configure Webhook**
- **Payload URL**: `https://docs-hook.typo3.org`
- **Content type**: `application/json`
- **SSL verification**: Enable SSL verification
- **Which events**: Select "Just the push event"
- **Active**: Check the "Active" checkbox
3. **Save Webhook**
- Click **Add webhook** to save
- GitHub will send a test ping to verify connectivity
### GitLab Setup
1. **Navigate to Webhooks**
- Go to your GitLab project
- Click **Settings****Webhooks**
2. **Configure Webhook**
- **URL**: `https://docs-hook.typo3.org`
- **Trigger**: Check both:
- Push events
- Tag push events
- **SSL verification**: Enable SSL verification
3. **Add Webhook**
- Click **Add webhook** to save
- GitLab will test the connection
## First-Time Approval
The first time you trigger documentation rendering, the TYPO3 Documentation Team must approve your repository:
1. **Automatic Hold**: First webhook trigger is automatically placed on hold
2. **Manual Review**: Documentation Team reviews:
- TER registration matches composer.json extension key
- Git repository is properly referenced in TER
- Documentation structure is valid
3. **Approval**: Once approved, future builds are automatic
4. **Notification**: Check Intercept dashboard for approval status
**Typical Approval Time**: 1-3 business days
## Verification
### Check Webhook Delivery
**GitHub:**
1. Go to **Settings****Webhooks**
2. Click on the webhook
3. Scroll to **Recent Deliveries**
4. Verify delivery shows `200` response code
**GitLab:**
1. Go to **Settings****Webhooks**
2. Click **Edit** on the webhook
3. Scroll to **Recent events**
4. Verify event shows success status
### Check Intercept Dashboard
1. **Visit**: https://intercept.typo3.com/
2. **Check Recent Actions**: View recent webhook triggers
3. **Documentation Deployments**: https://intercept.typo3.com/admin/docs/deployments
4. **Search for Your Extension**: Filter by package name
### Verify Published Documentation
Once approved and rendered successfully:
**Published URL Pattern**:
```
https://docs.typo3.org/p/{vendor}/{extension}/{branch}/en-us/
```
**Example**:
```
https://docs.typo3.org/p/netresearch/rte-ckeditor-image/main/en-us/
```
**Version-Specific URLs**:
```
https://docs.typo3.org/p/{vendor}/{extension}/{version}/en-us/
```
## Triggering Documentation Builds
### Automatic Triggers
Documentation builds are triggered automatically by:
1. **Git Push to Main/Master**
```bash
git push origin main
```
2. **Version Tags**
```bash
git tag 2.1.0
git push origin 2.1.0
```
3. **Branch Push** (for multi-version documentation)
```bash
git push origin docs-v12
```
### Manual Trigger
If automatic builds fail or you need to rebuild:
1. Visit: https://intercept.typo3.com/admin/docs/deployments
2. Find your extension
3. Click **Redeploy** button
4. Monitor build progress in Recent actions
## Build Process
Understanding the rendering pipeline:
1. **Webhook Received**: Intercept receives push notification
2. **Queue Job**: Build job added to rendering queue
3. **Clone Repository**: Code checked out at specific commit/tag
4. **Render Documentation**: Using `ghcr.io/typo3-documentation/render-guides:latest`
5. **Publish**: Rendered HTML published to docs.typo3.org
6. **Index**: Documentation indexed for search
**Typical Build Time**: 2-5 minutes
## Troubleshooting
### Webhook Not Triggering
**Check**:
- Webhook URL is exactly `https://docs-hook.typo3.org`
- SSL verification is enabled
- Webhook is marked as "Active"
- Recent deliveries show `200` response
**Fix**:
1. Edit webhook settings
2. Verify URL and SSL settings
3. Click **Redeliver** on failed delivery
4. Check Intercept Recent actions
### Build Failing
**Common Issues**:
1. **RST Syntax Errors**
```bash
# Validate locally before pushing
~/.claude/skills/typo3-docs/scripts/validate_docs.sh
```
2. **Missing Settings.cfg**
```bash
# Check file exists
ls -la Documentation/Settings.cfg
```
3. **Invalid Cross-References**
- Render locally to check for broken `:ref:` links
- Fix undefined labels
4. **Encoding Issues**
- Ensure all files are UTF-8 encoded
- Check for BOM (Byte Order Mark) issues
### First Build Stuck "On Hold"
**Expected Behavior**: First build requires manual approval
**Action**:
- Wait for Documentation Team review (1-3 business days)
- Ensure TER registration is complete
- Verify Git repository URL in TER matches webhook source
**Speed Up Approval**:
- Post in TYPO3 Slack [#typo3-documentation](https://typo3.slack.com/archives/C028JEPJL)
- Reference your extension key and repository URL
### Documentation Not Updating
**Check**:
1. **Build Status**: Visit Intercept dashboard, verify build succeeded
2. **Cache**: Browser cache might show old version
- Hard refresh: `Ctrl+F5` / `Cmd+Shift+R`
- Try incognito/private mode
3. **Correct URL**: Verify you're visiting the right branch/version URL
**Fix**:
1. Trigger manual rebuild from Intercept dashboard
2. Check build logs for errors
3. Verify `Settings.cfg` has correct project configuration
## Best Practices
### Pre-Push Checklist
Before pushing documentation changes:
✅ **Validate RST Syntax**
```bash
~/.claude/skills/typo3-docs/scripts/validate_docs.sh /path/to/project
```
✅ **Render Locally**
```bash
~/.claude/skills/typo3-docs/scripts/render_docs.sh /path/to/project
open Documentation-GENERATED-temp/Index.html
```
✅ **Check for Warnings**
- No rendering warnings
- No broken cross-references
- All code blocks have language specified
- UTF-8 emoji icons render correctly
✅ **Commit Message**
```bash
git commit -m "docs: update configuration guide with new settings"
```
### Version Management
**Branching Strategy**:
- `main` / `master`: Latest development documentation
- Version tags: Specific release documentation (e.g., `2.1.0`, `3.0.0`)
- Version branches: Long-term support versions (e.g., `docs-v12`, `docs-v11`)
**Tag Documentation Builds**:
```bash
# Create release tag
git tag -a 2.1.0 -m "Release 2.1.0"
git push origin 2.1.0
# Documentation auto-builds for version 2.1.0
# Published at: /p/{vendor}/{ext}/2.1.0/en-us/
```
### Multi-Version Documentation
For supporting multiple TYPO3 versions:
1. **Create Version Branches**
```bash
git checkout -b docs-v12
git push origin docs-v12
```
2. **Configure Settings.cfg** for each branch
```ini
[general]
project = Extension Name
release = 2.1.0
version = 2.1
```
3. **Webhook Triggers All Branches**
- Pushes to any branch trigger builds
- Each branch published separately
## Security Considerations
### Webhook Secret (Optional)
While TYPO3 Intercept doesn't require webhook secrets, you can add them for extra security:
**GitHub**:
1. Generate random secret: `openssl rand -hex 20`
2. Add to webhook **Secret** field
3. Intercept validates using X-Hub-Signature header
**GitLab**:
1. Generate random secret
2. Add to webhook **Secret token** field
3. Intercept validates using X-Gitlab-Token header
### Access Control
**Documentation Repositories Should**:
- Be publicly readable (required for Intercept access)
- Limit push access to trusted contributors
- Use branch protection for `main`/`master`
- Require pull request reviews for documentation changes
**Avoid in Documentation**:
- API keys, passwords, secrets
- Internal URLs, server hostnames
- Sensitive configuration details
- Personal information
## Resources
**Official Documentation**:
- [How to Document - Webhook Setup](https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/Howto/WritingDocForExtension/Webhook.html)
- [TYPO3 Intercept Dashboard](https://intercept.typo3.com/)
- [Documentation Deployments](https://intercept.typo3.com/admin/docs/deployments)
**Community Support**:
- TYPO3 Slack: [#typo3-documentation](https://typo3.slack.com/archives/C028JEPJL)
- TYPO3 Slack: [#typo3-cms](https://typo3.slack.com/archives/C025HCWGM)
**Related Guides**:
- [TYPO3 Documentation Standards](https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/)
- [RST Syntax Reference](rst-syntax.md)
- [TYPO3 Directives Reference](typo3-directives.md)

View File

@@ -0,0 +1,309 @@
# RST Syntax Reference
Complete reStructuredText syntax reference for TYPO3 documentation.
## Headings
```rst
=======================
Page title in sentence case
=======================
Section heading
===============
Subsection heading
------------------
Subsubsection heading
~~~~~~~~~~~~~~~~~~~~~
Paragraph heading
^^^^^^^^^^^^^^^^^
```
**Rules:**
- Page titles: `=` above and below (must match title length)
- Sections: `=` below
- Subsections: `-` below
- Subsubsections: `~` below
- Paragraphs: `^` below
- **CRITICAL**: Underline must be exactly the same length as the title text
- **SENTENCE CASE**: Use sentence case for all headlines, NOT title case
- ✅ Correct: "Mass approval on Crowdin", "API endpoints", "Best practices"
- ❌ Wrong: "Mass Approval On Crowdin", "API Endpoints", "Best Practices"
## Inline Formatting
```rst
*italic text*
**bold text**
``code or literal text``
```
## Code Blocks
**PHP:**
```rst
.. code-block:: php
<?php
$code = 'example';
```
**YAML:**
```rst
.. code-block:: yaml
setting: value
nested:
item: value
```
**TypoScript:**
```rst
.. code-block:: typoscript
config.tx_extension.setting = value
```
**Bash:**
```rst
.. code-block:: bash
composer install
```
**JavaScript:**
```rst
.. code-block:: javascript
const example = 'value';
```
## Lists
**Bullet Lists:**
```rst
- First item.
- Second item.
- Nested item.
- Another nested.
```
**Numbered Lists:**
```rst
1. First item.
2. Second item.
3. Third item.
```
**Definition Lists:**
```rst
term
Definition of the term.
another term
Definition of another term.
```
**Punctuation Rules:**
- **End with periods**: All list items should end with a period (`.`)
- ✅ Correct: `1. Retrieve project metadata to get available languages.`
- ❌ Wrong: `1. Retrieve project metadata to get available languages`
- Exception: Single-word or very short items may omit periods for readability
## Links
**External Links:**
```rst
`Link text <https://example.com>`__
```
**Internal Cross-References:**
```rst
.. _my-label:
Section Title
=============
Link to :ref:`my-label`
Link with custom text: :ref:`Custom Text <my-label>`
```
**Documentation Links:**
```rst
:ref:`t3tsref:start` (TYPO3 TS Reference)
:ref:`t3coreapi:start` (TYPO3 Core API)
```
## Tables
**Simple Table:**
```rst
=========== ===========
Column 1 Column 2
=========== ===========
Row 1 Col 1 Row 1 Col 2
Row 2 Col 1 Row 2 Col 2
=========== ===========
```
**Grid Table:**
```rst
+------------+------------+
| Header 1 | Header 2 |
+============+============+
| Cell 1 | Cell 2 |
+------------+------------+
```
**List Table:**
```rst
.. list-table:: Table Title
:header-rows: 1
:widths: 20 80
* - Column 1
- Column 2
* - Value 1
- Value 2
```
## Admonitions
```rst
.. note::
Additional information
.. important::
Important notice
.. warning::
Warning message
.. attention::
Attention required
.. tip::
Helpful tip
.. caution::
Caution advised
```
## Images
```rst
.. image:: ../Images/screenshot.png
:alt: Alternative text
:width: 600px
:class: with-shadow
```
**Figure with Caption:**
```rst
.. figure:: ../Images/screenshot.png
:alt: Alternative text
:width: 600px
This is the caption text
```
## Table of Contents
**In-page TOC:**
```rst
.. contents::
:local:
:depth: 2
```
**Toctree (document hierarchy):**
```rst
.. toctree::
:maxdepth: 2
:titlesonly:
:hidden:
Introduction/Index
Configuration/Index
API/Index
```
## Comments
```rst
.. This is a comment
It can span multiple lines
and will not appear in the output
```
## Line Blocks
```rst
| Line 1
| Line 2
| Line 3
```
## Substitutions
```rst
.. |TYPO3| replace:: TYPO3 CMS
Using |TYPO3| in documentation...
```
## Special Characters
```rst
\*literal asterisk\*
```
## Whitespace Rules
1. **Blank lines**: Required before and after directives
2. **Indentation**: Use 3 spaces for directive content
3. **No trailing whitespace**: Remove all trailing spaces
4. **Consistent indentation**: Maintain same level within blocks
## Common Mistakes
**Wrong underline length:**
```rst
Section
==== # Too short
```
**Missing blank lines:**
```rst
.. code-block:: php
$code = 'example'; # No blank line before content
```
**Incorrect indentation:**
```rst
.. note::
Text # Only 2 spaces instead of 3
```
**Correct:**
```rst
Section
=======
.. code-block:: php
$code = 'example';
.. note::
Text with 3-space indentation
```
## References
- **Sphinx RST Guide:** https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
- **Docutils RST:** https://docutils.sourceforge.io/rst.html
- **TYPO3 Documentation Guide:** https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/

View File

@@ -0,0 +1,509 @@
# TYPO3-Specific Directives
Comprehensive reference for TYPO3-specific RST directives and extensions.
## Permalink Anchors (Labels)
Every section in TYPO3 documentation **MUST** have a permalink anchor (label) for deep linking.
**Syntax:**
```rst
.. _section-name-label:
Section heading
===============
```
**Requirements:**
- Place label **immediately before** the section heading (no blank line between)
- Use **lowercase** with hyphens (`-`) as separators
- Use **descriptive, hierarchical names** reflecting the document structure
- Labels enable `:ref:` cross-references and URL anchors
**Example from Mass Approval documentation:**
```rst
.. _crowdin-mass-approval:
========================
Mass approval on Crowdin
========================
.. _crowdin-mass-approval-workflow:
Crowdin API workflow
====================
.. _crowdin-mass-approval-api:
API endpoints
-------------
.. _crowdin-mass-approval-authentication:
Authentication
--------------
.. _crowdin-mass-approval-implementation:
PHP implementation
==================
.. _crowdin-mass-approval-implementation-usage:
Usage
-----
.. _crowdin-mass-approval-best-practices:
Best practices
==============
.. _crowdin-mass-approval-best-practices-error:
Error handling
--------------
```
**Naming Convention:**
- Start with document/topic prefix: `crowdin-mass-approval`
- Add section hierarchy: `crowdin-mass-approval-workflow`
- Add subsection: `crowdin-mass-approval-implementation-usage`
- This creates predictable, navigable anchor URLs
**Benefits:**
- Direct linking to specific sections
- Stable URLs for documentation references
- Cross-document `:ref:` linking
- Search engine indexability
## Configuration Values (confval)
Document configuration options with structured metadata.
**Basic Syntax:**
```rst
.. confval:: settingName
:type: boolean
:Default: true
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ext_key']['setting']
Description of the configuration value.
```
**Field Types:**
- `:type:` - boolean, string, integer, array, object
- `:Default:` - Default value (capitalize 'Default')
- `:Path:` - Full path to the setting in TYPO3 configuration
- `:Scope:` - Where setting applies (frontend, backend, global)
**Example:**
```rst
.. confval:: fetchExternalImages
:type: boolean
:Default: true
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['rte_ckeditor_image']['fetchExternalImages']
Controls whether external image URLs are automatically fetched and uploaded
to the current backend user's upload folder. When enabled, pasting image
URLs will trigger automatic download and FAL integration.
```
**TSConfig Example:**
```rst
.. confval:: RTE.default.buttons.image.options.magic.maxWidth
:type: integer
:Default: 300
Maximum width in pixels for images inserted through the RTE.
Images exceeding this width will be automatically scaled down.
```
**YAML Configuration Example:**
```rst
.. confval:: editor.externalPlugins.typo3image.allowedExtensions
:type: string
:Default: Value from ``$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']``
Comma-separated list of allowed image file extensions for the CKEditor
image plugin. Overrides global TYPO3 image extension settings.
```
### Two-Level Configuration Pattern
**Pattern:** Site-wide configuration with per-item override capability
Many TYPO3 features support two-level configuration:
1. **Site-wide default** via TypoScript
2. **Per-item override** via attributes or UI
**When to use:**
- Features where editors need item-specific control
- Mixed content pages (some items use site-wide, others override)
- Configuration that varies by context or workflow
**Documentation Structure:**
```rst
## Configuration
The noScale feature can be configured at two levels:
1. **Site-wide (TypoScript)** - Default behavior for all images
2. **Per-image (Editor)** - Override for specific images
### Site-Wide Configuration
.. confval:: noScale
:type: boolean
:Default: false (auto-optimization enabled)
:Path: lib.parseFunc_RTE.tags.img.noScale
Controls whether images are automatically optimized or used as original files.
When enabled, all images skip TYPO3's image processing.
**Configuration Priority:**
- **Per-image setting** (data-noscale attribute) takes precedence
- **Site-wide setting** (TypoScript) is the fallback
- **Default behavior** when neither is set
**Enable for all images:**
.. code-block:: typoscript
:caption: setup.typoscript
lib.parseFunc_RTE {
tags.img {
noScale = 1 # All images use original files
}
}
### Per-Image Override
.. versionadded:: 13.0.0
Editors can now enable noScale for individual images using the CKEditor
image dialog, overriding the site-wide TypoScript setting.
**How to Use:**
1. Insert or edit an image in CKEditor
2. Open the image dialog (double-click or select + click insert image button)
3. Check "Use original file (noScale)" checkbox
4. Save the image
**Configuration Priority:**
- **Per-image setting** (data-noscale attribute) overrides site-wide configuration
- If unchecked: Falls back to site-wide TypoScript setting
- If no site-wide setting: Default behavior (auto-optimization)
**Workflow Benefits:**
- **Mixed Content**: Some images original, others optimized on same page
- **Editorial Control**: Editors decide per-image without developer intervention
- **Flexibility**: Override site-wide settings for specific images
- **Newsletter Integration**: Mark high-quality images for email
**Technical Implementation:**
.. code-block:: html
<!-- Per-image override via data attribute -->
<img src="image.jpg" data-noscale="true" />
```
**Example from t3x-rte_ckeditor_image:**
The noScale feature uses this pattern:
- **Site-wide**: `lib.parseFunc_RTE.tags.img.noScale = 1` in TypoScript
- **Per-image**: Checkbox in CKEditor dialog sets `data-noscale` attribute
- **Priority**: Per-image attribute overrides TypoScript setting
**Documentation Benefits:**
✅ Clear separation of site-wide vs per-item configuration
✅ Explicit priority/precedence rules documented
✅ Workflow guidance for editors
✅ Technical implementation details for developers
✅ Use case explanations (mixed content, newsletters)
## Version Information
Document version-specific changes with proper directives.
**Version Added:**
```rst
.. versionadded:: 13.0.0
The CKEditor plugin now requires ``StyleUtils`` and ``GeneralHtmlSupport``
dependencies for style functionality. Previous versions did not have this requirement.
```
**Version Changed:**
```rst
.. versionchanged:: 13.1.0
Image processing now uses TYPO3's native image processing service instead
of custom processing logic.
```
**Deprecated:**
```rst
.. deprecated:: 13.2.0
The ``oldSetting`` configuration option is deprecated. Use ``newSetting`` instead.
This option will be removed in version 14.0.0.
```
**Placement:** Place version directives immediately before or after the relevant content they describe.
## PHP Domain
Document PHP classes, methods, and properties.
**Class:**
```rst
.. php:class:: SelectImageController
Main controller for image selection wizard.
Extends: ``TYPO3\\CMS\\Backend\\Controller\\ElementBrowserController``
```
**Method:**
```rst
.. php:method:: infoAction(ServerRequestInterface $request): ResponseInterface
Retrieves image information and processed file details.
:param \\Psr\\Http\\Message\\ServerRequestInterface $request: PSR-7 server request
:returns: JSON response with image data or error response
:returntype: \\Psr\\Http\\Message\\ResponseInterface
:throws \\RuntimeException: When file is not found or invalid
```
**Property:**
```rst
.. php:attr:: resourceFactory
:type: \\TYPO3\\CMS\\Core\\Resource\\ResourceFactory
Resource factory for file operations.
```
**Namespace:**
```rst
.. php:namespace:: Netresearch\\RteCKEditorImage\\Controller
.. php:class:: SelectImageController
```
## Card Grids
Create visual card layouts for navigation.
**Basic Card Grid:**
```rst
.. card-grid::
:columns: 1
:columns-md: 2
:gap: 4
:card-height: 100
.. card:: 📘 Introduction
The RTE CKEditor Image extension provides comprehensive image handling
capabilities for CKEditor in TYPO3.
.. card-footer:: :ref:`Read more <introduction>`
:button-style: btn btn-primary stretched-link
.. card:: 🔧 Configuration
Learn how to configure the extension with TSConfig, YAML, and TypoScript
settings for your specific needs.
.. card-footer:: :ref:`Read more <configuration>`
:button-style: btn btn-secondary stretched-link
```
**Card Grid Options:**
- `:columns:` - Number of columns (default layout)
- `:columns-md:` - Columns for medium+ screens
- `:gap:` - Gap between cards (1-5)
- `:card-height:` - Card height (100 for equal height)
- `:class:` - Additional CSS classes
**Card Footer Styles:**
- `btn btn-primary stretched-link` - Primary button with full card click
- `btn btn-secondary stretched-link` - Secondary button with full card click
- `btn btn-light stretched-link` - Light button
**UTF-8 Emoji Icons:**
Use in card titles for visual appeal:
- 📘 Documentation
- 🔧 Configuration
- 🎨 Design
- 🔍 Search
- ⚡ Performance
- 🛡️ Security
- 📊 API
- 🆘 Troubleshooting
## Intersphinx References
Cross-reference TYPO3 core documentation.
**TSRef (TypoScript Reference):**
```rst
:ref:`t3tsref:start`
:ref:`t3tsref:stdwrap`
:ref:`t3tsref:cobj-image`
```
**Core API:**
```rst
:ref:`t3coreapi:start`
:ref:`t3coreapi:fal`
:ref:`t3coreapi:dependency-injection`
```
**TSConfig:**
```rst
:ref:`t3tsconfig:start`
:ref:`t3tsconfig:pagetsconfig`
```
**TCA:**
```rst
:ref:`t3tca:start`
:ref:`t3tca:columns-types`
```
**Fluid:**
```rst
:ref:`t3viewhelper:start`
:ref:`t3viewhelper:typo3-fluid-image`
```
## Index and Glossary
**Index Entry:**
```rst
.. index:: Image Processing, FAL, CKEditor
.. _image-processing:
Image Processing
================
```
**Glossary:**
```rst
.. glossary::
FAL
File Abstraction Layer - TYPO3's file management system
Magic Image
Automatically processed image with dimension constraints
```
**Reference Glossary:**
```rst
See :term:`FAL` for details.
```
## Tabs
Create tabbed content for multiple options.
```rst
.. tabs::
.. tab:: Composer
.. code-block:: bash
composer require netresearch/rte-ckeditor-image
.. tab:: Extension Manager
Install via TYPO3 Extension Manager:
1. Go to Admin Tools > Extensions
2. Search for "rte_ckeditor_image"
3. Click Install
```
## Special TYPO3 Directives
**Include Partial:**
```rst
.. include:: ../Includes.rst.txt
```
**File Tree:**
```rst
.. directory-tree::
* Classes/
* Controller/
* Database/
* Utils/
* Resources/
* Public/
* JavaScript/
```
**YouTube Video:**
```rst
.. youtube:: VIDEO_ID
```
**Download Link:**
```rst
:download:`Download PDF <../_static/manual.pdf>`
```
## Best Practices
1. **Use confval for all configuration**: Document every setting with proper metadata
2. **Version everything**: Add versionadded/versionchanged for all version-specific features
3. **Cross-reference liberally**: Link to related documentation with :ref:
4. **Card grids for navigation**: Use card-grid layouts for Index.rst files
5. **Emoji icons in titles**: Use UTF-8 emojis in card titles for visual appeal
6. **Stretched links**: Always use `stretched-link` class in card-footer for full card clicks
7. **PHP domain for APIs**: Document all public methods with php:method
8. **Intersphinx for core**: Reference TYPO3 core docs with intersphinx
## Quality Checklist
✅ All configuration options documented with confval
✅ Version information added for all version-specific features
✅ Cross-references work (no broken :ref: links)
✅ Card grids use stretched-link in card-footer
✅ UTF-8 emoji icons in card titles
✅ PHP API documented with php:method
✅ Code blocks specify language
✅ Admonitions used appropriately
✅ Local render shows no warnings
✅ All headings have proper underlines
**Sentence case** used for all headlines (not Title Case)
**Permalink anchors** (`.. _label:`) before every section heading
**List punctuation**: all list items end with periods
**CGL compliance**: PHP code examples pass `make fix-cgl`
## References
- **TYPO3 Documentation Guide:** https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/
- **Confval Reference:** https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/Reference/ReStructuredText/Code/Confval.html
- **Version Directives:** https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/Reference/ReStructuredText/Content/Versions.html
- **PHP Domain:** https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/Reference/ReStructuredText/Code/Phpdomain.html
- **Card Grid:** https://sphinxcontrib-typo3-theme.readthedocs.io/en-us/latest/

View File

@@ -0,0 +1,532 @@
# TYPO3 Extension Architecture Reference
Official TYPO3 extension file structure for documentation extraction weighting and categorization.
**Source:** https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/FileStructure/Index.html
## File Structure Hierarchy
### 🔴 Required Files (High Priority)
**composer.json** - Composer configuration
- **Documentation Priority:** HIGH
- **Extract:** Package name, description, dependencies, autoload configuration
- **Map to RST:** Introduction/Index.rst (overview), Installation requirements
- **Weight:** Critical for dependency documentation
**ext_emconf.php** - Extension metadata
- **Documentation Priority:** HIGH
- **Extract:** Title, description, version, author, constraints
- **Map to RST:** Introduction/Index.rst, Settings.cfg
- **Weight:** Essential metadata, version constraints
**Index.rst** (in Documentation/)
- **Documentation Priority:** CRITICAL
- **Required:** Main documentation entry point
- **Must Exist:** For TYPO3 Intercept deployment
**Settings.cfg** (in Documentation/)
- **Documentation Priority:** CRITICAL
- **Required:** Documentation build configuration
- **Must Exist:** For TYPO3 Intercept deployment
### 🟡 Core Structure Files (Medium-High Priority)
**ext_localconf.php** - Runtime configuration
- **Documentation Priority:** MEDIUM-HIGH
- **Extract:** Plugin registrations, hooks, service configurations
- **Map to RST:** Integration guides, Developer/Configuration.rst
- **Weight:** Important for integration documentation
**ext_tables.php** - Backend configuration
- **Documentation Priority:** MEDIUM
- **Extract:** Backend module registrations, permissions
- **Map to RST:** Developer/Backend.rst
- **Weight:** Backend-specific documentation
**ext_tables.sql** - Database schema
- **Documentation Priority:** MEDIUM
- **Extract:** Table structures, field definitions
- **Map to RST:** Developer/Database.rst, API/DataModel.rst
- **Weight:** Important for database documentation
**ext_conf_template.txt** - Extension configuration template
- **Documentation Priority:** HIGH
- **Extract:** All configuration options, types, defaults, security warnings
- **Map to RST:** Integration/Configuration.rst (confval directives)
- **Weight:** Critical - direct user-facing configuration
## Directory Structure Weights
### Classes/ (Weight: HIGH)
**Purpose:** PHP source code following PSR-4 autoloading
**Priority Hierarchy:**
1. **Classes/Controller/** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** Action methods, parameters, return types
- **Map to RST:** API/Controllers/, Developer/Plugins.rst
- **Pattern:** MVC controllers extending `ActionController`
2. **Classes/Domain/Model/** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** Entity properties, getters/setters, relationships
- **Map to RST:** API/Models/, Developer/DataModel.rst
- **Pattern:** Extbase domain models
3. **Classes/Domain/Repository/** (Weight: MEDIUM-HIGH)
- **Documentation Priority:** MEDIUM-HIGH
- **Extract:** Query methods, custom finders
- **Map to RST:** API/Repositories/, Developer/DataAccess.rst
- **Pattern:** Extends `\TYPO3\CMS\Extbase\Persistence\Repository`
4. **Classes/ViewHelpers/** (Weight: MEDIUM)
- **Documentation Priority:** MEDIUM
- **Extract:** ViewHelper arguments, usage examples
- **Map to RST:** Developer/ViewHelpers.rst
- **Pattern:** Custom Fluid ViewHelpers
5. **Classes/Utility/** (Weight: MEDIUM)
- **Documentation Priority:** MEDIUM
- **Extract:** Utility methods, static helpers
- **Map to RST:** API/Utilities/
- **Pattern:** Static helper classes
6. **Classes/Service/** (Weight: MEDIUM-HIGH)
- **Documentation Priority:** MEDIUM-HIGH
- **Extract:** Service methods, dependencies
- **Map to RST:** API/Services/
- **Pattern:** Business logic services
### Configuration/ (Weight: VERY HIGH)
**Purpose:** All TYPO3 configuration files
**Priority Hierarchy:**
1. **Configuration/TCA/** (Weight: VERY HIGH)
- **Documentation Priority:** VERY HIGH
- **Extract:** Table definitions, field configurations, relationships
- **Map to RST:** Developer/DataModel.rst, Editor/Fields.rst
- **Files:** `<tablename>.php`
- **Pattern:** Database table configuration arrays
2. **Configuration/TCA/Overrides/** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** Field additions, modifications to core tables
- **Map to RST:** Integration/CoreExtensions.rst
- **Files:** `<tablename>.php`
- **Pattern:** TCA modifications
3. **Configuration/TypoScript/** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** Constants, setup, plugin configurations
- **Map to RST:** Configuration/TypoScript.rst
- **Files:** `constants.typoscript`, `setup.typoscript`
- **Pattern:** TypoScript configuration
4. **Configuration/Sets/** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** Site set configurations, settings definitions
- **Map to RST:** Configuration/SiteSets.rst
- **Files:** `config.yaml`, `settings.definitions.yaml`, `setup.typoscript`
- **Pattern:** Modern configuration approach (TYPO3 v13+)
5. **Configuration/TsConfig/** (Weight: MEDIUM-HIGH)
- **Documentation Priority:** MEDIUM-HIGH
- **Extract:** Page TSconfig, User TSconfig
- **Map to RST:** Editor/PageTSconfig.rst, Editor/UserTSconfig.rst
- **Subdirs:** `Page/`, `User/`
- **Files:** `*.tsconfig`
6. **Configuration/Backend/** (Weight: MEDIUM)
- **Documentation Priority:** MEDIUM
- **Extract:** Backend routes, modules, AJAX routes
- **Map to RST:** Developer/Backend.rst
- **Files:** `Routes.php`, `Modules.php`, `AjaxRoutes.php`
7. **Configuration/Services.yaml** (Weight: HIGH)
- **Documentation Priority:** HIGH
- **Extract:** DI configuration, event listeners, console commands
- **Map to RST:** Developer/DependencyInjection.rst, Developer/Events.rst
- **Pattern:** Symfony-style service configuration
8. **Configuration/Extbase/Persistence/Classes.php** (Weight: MEDIUM)
- **Documentation Priority:** MEDIUM
- **Extract:** Model-to-table mappings
- **Map to RST:** Developer/Persistence.rst
9. **Configuration/Icons.php** (Weight: LOW)
- **Documentation Priority:** LOW
- **Extract:** Icon identifiers
- **Map to RST:** Developer/Icons.rst (if comprehensive)
### Resources/ (Weight: MEDIUM)
**Purpose:** Asset files and templates
**Priority Hierarchy:**
1. **Resources/Private/Language/** (Weight: MEDIUM-HIGH)
- **Documentation Priority:** MEDIUM
- **Extract:** Translation keys (for reference)
- **Map to RST:** Developer/Localization.rst
- **Files:** `*.xlf` (XLIFF format)
- **Note:** Extract labels for API documentation context
2. **Resources/Private/Templates/** (Weight: MEDIUM)
- **Documentation Priority:** MEDIUM
- **Extract:** Template structure (for developer reference)
- **Map to RST:** Developer/Templating.rst
- **Files:** `[ControllerName]/[ActionName].html`
- **Note:** Document template variables and ViewHelpers used
3. **Resources/Private/Layouts/** (Weight: LOW-MEDIUM)
- **Documentation Priority:** LOW
- **Extract:** Layout structure
- **Files:** `*.html`
4. **Resources/Private/Partials/** (Weight: LOW-MEDIUM)
- **Documentation Priority:** LOW
- **Extract:** Reusable template fragments
- **Files:** `*.html`
5. **Resources/Public/** (Weight: LOW)
- **Documentation Priority:** LOW
- **Extract:** Public asset information (if relevant)
- **Subdirs:** `CSS/`, `JavaScript/`, `Icons/`, `Images/`
- **Note:** Usually not documented in detail
### Documentation/ (Weight: CRITICAL)
**Purpose:** Official RST documentation
**Required Files:**
- `Index.rst` - Main entry point
- `Settings.cfg` - Build configuration
**Common Structure:**
- `Introduction/` - Overview, features, screenshots
- `Installation/` - Installation and upgrade
- `Configuration/` - TypoScript, extension settings
- `Integration/` - Integration with other extensions
- `Editor/` - User guide for editors
- `Developer/` - Developer documentation
- `API/` - PHP API reference
- `Troubleshooting/` - Common issues
**Priority:** CRITICAL - This is the primary output target for extraction
### Tests/ (Weight: LOW)
**Purpose:** Unit, functional, and acceptance tests
**Documentation Priority:** LOW
- Extract test class names for coverage documentation
- Generally not documented in user-facing docs
- May reference in Developer/Testing.rst if test examples provided
**Structure:**
- `Tests/Unit/` - Unit tests
- `Tests/Functional/` - Functional tests
- `Tests/Acceptance/` - Acceptance tests (Codeception)
## Extraction Weight Matrix
### Primary Sources (Extract First)
```
Priority 1 - CRITICAL (Must Document):
├─ ext_emconf.php → Extension metadata
├─ ext_conf_template.txt → User configuration
├─ composer.json → Dependencies
└─ Configuration/TCA/*.php → Data model
Priority 2 - HIGH (Should Document):
├─ Classes/Controller/ → Controllers/Actions
├─ Classes/Domain/Model/ → Domain entities
├─ Classes/Service/ → Business logic
├─ Configuration/TypoScript/ → TypoScript config
├─ Configuration/Sets/ → Site sets (v13+)
└─ ext_localconf.php → Runtime registration
Priority 3 - MEDIUM (Consider Documenting):
├─ Classes/Domain/Repository/ → Data access
├─ Classes/ViewHelpers/ → Custom ViewHelpers
├─ Configuration/Backend/ → Backend modules
├─ Configuration/TsConfig/ → TSconfig
├─ Configuration/Services.yaml → DI/Events
└─ Resources/Private/Language/ → Translation context
```
### Secondary Sources (Extract If Needed)
```
Priority 4 - MEDIUM-LOW:
├─ Classes/Utility/ → Utility functions
├─ ext_tables.php → Backend config
├─ ext_tables.sql → Database schema
└─ Configuration/TCA/Overrides/ → Core extensions
Priority 5 - LOW:
├─ Resources/Private/Templates/ → Template structure
├─ Resources/Public/ → Public assets
├─ Tests/ → Test coverage
└─ Configuration/Icons.php → Icon registry
```
## Documentation Mapping Strategy
### Extension Metadata → Introduction
**Source:** `ext_emconf.php`, `composer.json`, `README.md`
**Target:** `Documentation/Introduction/Index.rst`
**Extract:**
- Extension title → Main heading
- Description → First paragraph
- Version → Version marker
- Author → Credits section
- Constraints → Requirements section
**Example Mapping:**
```
ext_emconf.php:
'title' => 'CKEditor Image Support'
'version' => '13.1.0'
'constraints' => ['typo3' => '12.4-13.5']
→ Introduction/Index.rst:
========================
CKEditor Image Support
========================
:Version: 13.1.0
:Language: en
Requirements
------------
- TYPO3: 12.4 - 13.5
```
### Configuration Options → Integration/Configuration
**Source:** `ext_conf_template.txt`
**Target:** `Documentation/Integration/Configuration.rst`
**Extract Pattern:**
```
# cat=category; type=boolean; label=Label: Description
settingName = defaultValue
→ .. confval:: settingName
:type: boolean
:Default: defaultValue
:Path: $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ext_key']['settingName']
Description text here
```
**Security Warnings:** Extract and map to `.. warning::` directive
### PHP Classes → API Documentation
**Source:** `Classes/**/*.php`
**Target:** `Documentation/API/[ClassName].rst`
**Mapping by Type:**
**Controllers:**
```php
Classes/Controller/UserController.php
API/UserController.rst
.. php:class:: UserController
User management controller
.. php:method:: listAction(): ResponseInterface
```
**Models:**
```php
Classes/Domain/Model/User.php
API/User.rst
.. php:class:: User
User domain model
.. php:attr:: username
:type: string
```
**Repositories:**
```php
Classes/Domain/Repository/UserRepository.php
API/UserRepository.rst
.. php:class:: UserRepository
User data repository
.. php:method:: findByEmail(string $email): ?User
```
### TCA Configuration → Developer/DataModel
**Source:** `Configuration/TCA/*.php`
**Target:** `Documentation/Developer/DataModel.rst`
**Extract:**
- Table name → Section heading
- ctrl['title'] → Table title
- columns → Field documentation
**Example:**
```php
Configuration/TCA/tx_myext_domain_model_user.php:
'ctrl' => ['title' => 'User']
'columns' => [
'username' => [...],
'email' => [...]
]
Developer/DataModel.rst:
Users Table
===========
Database table: tx_myext_domain_model_user
Fields
------
username
User login name
email
User email address
```
### TypoScript → Configuration/TypoScript
**Source:** `Configuration/TypoScript/*.typoscript`
**Target:** `Documentation/Configuration/TypoScript.rst`
**Extract:**
- Constants → Configuration reference
- Setup → Implementation examples
## Quality Weighting Algorithm
### Documentation Coverage Score
```
Score = (P1_documented / P1_total) * 0.5 +
(P2_documented / P2_total) * 0.3 +
(P3_documented / P3_total) * 0.15 +
(P4_documented / P4_total) * 0.05
Where:
P1 = Priority 1 (CRITICAL) items
P2 = Priority 2 (HIGH) items
P3 = Priority 3 (MEDIUM) items
P4 = Priority 4+ (LOW) items
```
### Gap Analysis Priority
```
Priority = BaseWeight * Severity * UserImpact
BaseWeight (from file structure):
ext_conf_template.txt config = 10
Controllers = 9
Models = 9
TCA = 8
ext_emconf.php = 8
Services = 7
Repositories = 6
ViewHelpers = 5
Utilities = 4
Severity:
Missing completely = 3
Outdated (wrong defaults) = 2
Incomplete (missing examples) = 1
UserImpact:
User-facing (config, editor features) = 3
Integrator-facing (TypoScript, TSconfig) = 2
Developer-facing (API) = 1
```
### Example Calculation
```
Missing confval for "fetchExternalImages":
Priority = 10 (ext_conf_template) * 3 (missing) * 3 (user-facing) = 90
Outdated Controller documentation:
Priority = 9 (controller) * 2 (outdated) * 1 (developer) = 18
Missing Utility documentation:
Priority = 4 (utility) * 3 (missing) * 1 (developer) = 12
```
**Action:** Document in priority order: 90 → 18 → 12
## Official Structure Validation
### Required Structure Checklist
**Composer-Mode Installation:**
-`composer.json` with `"type": "typo3-cms-extension"`
- ✅ PSR-4 autoload configuration
-`Documentation/Index.rst`
-`Documentation/Settings.cfg`
**Classic-Mode Installation:**
-`ext_emconf.php`
-`Documentation/Index.rst`
-`Documentation/Settings.cfg`
### Reserved Prefixes
**Root Directory:**
- `ext_*` files are reserved for TYPO3 system use
- Only allowed: `ext_emconf.php`, `ext_localconf.php`, `ext_tables.php`, `ext_tables.sql`, `ext_conf_template.txt`
**Never Create:**
- `ext_custom.php`
- `ext_myconfig.php`
- Any other `ext_*` files
## Best Practices for Extraction
1. **Follow Official Structure:** Extract based on official TYPO3 architecture
2. **Weight by Location:** Use file location to determine documentation priority
3. **Respect Conventions:** Map to RST sections based on TYPO3 conventions
4. **Security First:** Extract and highlight security warnings from configs
5. **Version Awareness:** Track version-specific features from ext_emconf.php
6. **Dependency Mapping:** Use composer.json and constraints for requirements
7. **Complete Coverage:** Prioritize user-facing config, controllers, models
8. **Context Awareness:** Understand file purpose from directory structure
## Resources
- **Official Structure:** https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/FileStructure/
- **TCA Reference:** https://docs.typo3.org/m/typo3/reference-tca/
- **TypoScript Reference:** https://docs.typo3.org/m/typo3/reference-typoscript/
- **Extbase/Fluid:** https://docs.typo3.org/m/typo3/book-extbasefluid/