Skip to content

Commit 16fe4c2

Browse files
committed
init agents
1 parent 9248012 commit 16fe4c2

File tree

6 files changed

+158
-10
lines changed

6 files changed

+158
-10
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,12 @@ testbench.yaml
1313
vendor
1414
.php_cs
1515
.phpunit.cache
16+
17+
.claude
18+
.codex
19+
.agents
20+
.junie
21+
.mcp.json
22+
.ai-factory*
1623
bun.lock
1724
package-lock.json

AGENTS.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# AGENTS.md
2+
3+
> Project map for AI agents. Keep this file up-to-date as the project evolves.
4+
5+
## Project Overview
6+
Filament v4 plugin for Laravel that provides a `JsonColumn` table column for displaying JSON data as tree or table views in drawers, modals, or inline containers.
7+
8+
## Tech Stack
9+
- **Language:** PHP 8.2+
10+
- **Framework:** Laravel (package via spatie/laravel-package-tools)
11+
- **UI Framework:** Filament v4
12+
- **DTO Base:** pepperfm/ssd-for-laravel
13+
- **Testing:** Pest v3 with Livewire plugin, Orchestra Testbench
14+
- **Static Analysis:** PHPStan / Larastan
15+
- **Code Style:** Laravel Pint + PHP CS Fixer
16+
17+
## Project Structure
18+
```
19+
src/
20+
Columns/
21+
JsonColumn.php # Main column component (extends Filament Column)
22+
Commands/
23+
FilamentJsonCommand.php # Artisan command
24+
Concerns/
25+
HasContainerPresentation.php # Trait: modal/drawer/inline container logic
26+
HasRenderMode.php # Trait: tree/table render mode logic
27+
Dto/
28+
ButtonConfigDto.php # Button appearance config (extends ssd BaseDto)
29+
ModalConfigDto.php # Modal behavior config (extends ssd BaseDto)
30+
Enums/
31+
ContainerModeEnum.php # inline | modal | drawer
32+
RenderModeEnum.php # table | tree
33+
Facades/
34+
FilamentJson.php # Laravel facade
35+
Testing/
36+
TestsFilamentJson.php # Testing helpers trait
37+
FilamentJson.php # Core service class
38+
FilamentJsonPlugin.php # Filament panel plugin registration
39+
FilamentJsonServiceProvider.php # Package bootstrap
40+
config/
41+
json.php # Publishable configuration
42+
resources/
43+
css/ # Source CSS (filament-json.css, index.css)
44+
dist/ # Compiled CSS assets
45+
lang/en/ # English translations
46+
views/
47+
json.blade.php # Main column view
48+
_partials/
49+
tree.blade.php # Recursive tree rendering
50+
nested.blade.php # Nested node rendering
51+
tests/
52+
src/
53+
ColumnTest.php # JsonColumn feature tests
54+
Fixtures/ # Test fixtures (BaseTable, ListUsers, etc.)
55+
Models/
56+
User.php # Test model
57+
database/
58+
factories/ # Test factories
59+
migrations/ # Test migrations
60+
resources/views/ # Test blade fixtures
61+
ArchTest.php # Architecture constraint tests
62+
Pest.php # Pest configuration
63+
TestCase.php # Base test case (Orchestra Testbench)
64+
```
65+
66+
## Key Entry Points
67+
| File | Purpose |
68+
|------|---------|
69+
| `src/Columns/JsonColumn.php` | Main component — the plugin's primary feature |
70+
| `src/FilamentJsonServiceProvider.php` | Package boot — registers views, config, assets |
71+
| `src/FilamentJsonPlugin.php` | Filament panel plugin registration |
72+
| `config/json.php` | Package configuration defaults |
73+
| `composer.json` | Package metadata, dependencies, scripts |
74+
75+
## Scripts
76+
| Command | Purpose |
77+
|---------|---------|
78+
| `composer test` | Run Pest tests |
79+
| `composer analyse` | Run PHPStan static analysis |
80+
| `composer lint` | Check code style (Pint + CS Fixer) |
81+
| `composer lint-hard` | Fix code style |
82+
83+
## AI Context Files
84+
| File | Purpose |
85+
|------|---------|
86+
| AGENTS.md | This file — project structure map |
87+
| .ai-factory/DESCRIPTION.md | Project specification and tech stack |
88+
| .ai-factory/ARCHITECTURE.md | Architecture decisions and guidelines |
89+
90+
## Agent Rules
91+
- Never combine shell commands with `&&`, `||`, or `;` — execute each command as a separate Bash tool call. This applies even when a skill, plan, or instruction provides a combined command — always decompose it into individual calls.

CLAUDE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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
6+
7+
Filament v4 plugin (Laravel/Composer package) that provides `JsonColumn` — a table column for rendering JSON data as tree or table views in inline containers, drawers, or modals.
8+
9+
## Commands
10+
11+
```bash
12+
composer test # Run Pest tests
13+
composer test -- --filter=Name # Run a single test by name
14+
composer analyse # PHPStan static analysis (level 5)
15+
composer lint # Check code style (Pint + PHP CS Fixer)
16+
composer lint-hard # Fix code style
17+
npm run build # Build Tailwind CSS to resources/dist/
18+
```
19+
20+
## Architecture
21+
22+
**JsonColumn** (`src/Columns/JsonColumn.php`) extends Filament's `Column` (not TextColumn). It composes behavior via two traits:
23+
24+
- `HasContainerPresentation` — controls where JSON is displayed: inline, modal, or drawer (`ContainerModeEnum`)
25+
- `HasRenderMode` — controls how JSON is displayed: tree or table (`RenderModeEnum`)
26+
27+
Both traits use backed enums instead of boolean flags. Deprecated v3 methods (`asModal()`, `asDrawer()`, `getAsModal()`, `getAsDrawer()`) delegate to the new enum-based API for backward compatibility.
28+
29+
**DTOs** (`ButtonConfigDto`, `ModalConfigDto`) extend `Pepperfm\Ssd\BaseDto` from `pepperfm/ssd-for-laravel`. They accept `array|Arrayable|\stdClass` with automatic camelCase property mapping. DTOs use Filament v4 typed enums (`Heroicon`, `Width`) rather than raw strings.
30+
31+
**Views** use recursive Blade partials: `json.blade.php``_partials/tree.blade.php``_partials/nested.blade.php`. Interactive features (copy JSON, expand/collapse) use Alpine.js.
32+
33+
**Service Provider** uses `spatie/laravel-package-tools` to register views, config, CSS assets, translations, and commands. CSS is compiled via Tailwind and registered through `FilamentAsset`.
34+
35+
## Testing
36+
37+
Tests use Pest v3 with Orchestra Testbench and Livewire plugin. Test infrastructure:
38+
- `tests/TestCase.php` — registers Filament providers/plugins, configures SQLite in-memory DB, loads test migrations
39+
- `tests/src/Fixtures/` — UserResource, ListUsers, BaseTable, TestPanelProvider for Filament testing
40+
- `tests/src/Models/User.php` — test model with `properties` JSON cast
41+
42+
## Code Style
43+
44+
Two tools enforce style — both must pass:
45+
- **Laravel Pint** (`pint.json`) — Laravel preset
46+
- **PHP CS Fixer** (`.php-cs-fixer.php`) — @Symfony + @PSR12 + @PHP80Migration rules
47+
48+
All source files use `declare(strict_types=1)`.
49+
50+
## Conventions
51+
52+
- New column features follow the pattern: `protected` property → fluent setter returning `static` → getter with `get` prefix
53+
- Multi-state options use backed enums + dedicated traits in `src/Concerns/`, not boolean flags on JsonColumn
54+
- DTOs go in `src/Dto/` and must extend `Pepperfm\Ssd\BaseDto`
55+
- Architecture tests (`tests/ArchTest.php`) forbid `dd`, `dump`, `ray`, and `env()` usage in source

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
"laravel/pint": "^1.0",
3232
"nunomaduro/collision": "^8.0",
3333
"orchestra/testbench": "^10.4",
34-
"pestphp/pest": "^3.0",
35-
"pestphp/pest-plugin-arch": "^3.0",
36-
"pestphp/pest-plugin-laravel": "^3.0",
37-
"pestphp/pest-plugin-livewire": "^3.0",
34+
"pestphp/pest": "^4.0",
35+
"pestphp/pest-plugin-arch": "^4.0",
36+
"pestphp/pest-plugin-laravel": "^4.0",
37+
"pestphp/pest-plugin-livewire": "^4.0",
3838
"phpstan/extension-installer": "^1.1",
3939
"phpstan/phpstan": "^2.1",
4040
"phpstan/phpstan-deprecation-rules": "^2.0",

src/Facades/FilamentJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class FilamentJson extends Facade
1313
{
14-
protected static function getFacadeAccessor()
14+
protected static function getFacadeAccessor(): string
1515
{
1616
return \PepperFM\FilamentJson\FilamentJson::class;
1717
}

src/FilamentJsonServiceProvider.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
namespace PepperFM\FilamentJson;
66

7-
use Filament\Support\Assets\AlpineComponent;
87
use Filament\Support\Assets\Asset;
98
use Filament\Support\Assets\Css;
10-
use Filament\Support\Assets\Js;
119
use Filament\Support\Facades\FilamentAsset;
1210
use Filament\Support\Facades\FilamentIcon;
1311
use Illuminate\Filesystem\Filesystem;
@@ -47,15 +45,12 @@ public function configurePackage(Package $package): void
4745
if (file_exists($package->basePath("/../config/$configFileName.php"))) {
4846
$package->hasConfigFile();
4947
}
50-
5148
if (file_exists($package->basePath('/../database/migrations'))) {
5249
$package->hasMigrations($this->getMigrations());
5350
}
54-
5551
if (file_exists($package->basePath('/../resources/lang'))) {
5652
$package->hasTranslations();
5753
}
58-
5954
if (file_exists($package->basePath('/../resources/views'))) {
6055
$package->hasViews(static::$viewNamespace);
6156
}

0 commit comments

Comments
 (0)