Skip to content

A free open source IT asset/license management system

Update CLAUDE.md with lint commands, Livewire note, and importer/presenter docs

KeplerAeroIT6b97e84f0dd8
diff --git a/CLAUDE.md b/CLAUDE.md
index b526553b3e..4082f8ef9a 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -5,8 +5,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Stack
- **PHP 8.2+** / **Laravel 12** (framework), **Laravel Mix** (webpack) for frontend assets
-- **AdminLTE 2** / **Bootstrap 3** UI — Blade views, no Livewire/Inertia
+- **AdminLTE 2** / **Bootstrap 3** UI — Blade views. Mostly server-rendered; a handful of newer admin-settings screens use **Livewire** components (`app/Livewire/`, e.g. `LdapSettings`, `CustomFieldEditor`, `Importer`) — no Inertia.
- **Chart.js v2.9.4** — bundled at `public/js/dist/Chart.min.js`; use `horizontalBar` type (v2 API, not v3)
+- Snipe-IT is a FOSS IT asset management system (assets, licenses, accessories, consumables, components, kits) — see README.md for product context.
## Common Commands
@@ -22,6 +23,14 @@ php artisan test tests/Feature/Assets/AssetsTest.php
# Run a specific test method
php artisan test --filter testSomeMethod
+# Run/exclude tests by group (e.g. LDAP tests, which need the LDAP extension)
+php artisan test --group=ldap
+php artisan test --exclude-group=ldap
+
+# Lint / static analysis
+vendor/bin/pint # code style (Laravel preset, see pint.json)
+vendor/bin/phpstan analyse # static analysis via Larastan, level 4 (phpstan.neon.dist)
+
# Build frontend assets (dev)
npm run dev
@@ -38,7 +47,9 @@ php artisan tinker
php artisan optimize:clear
```
-Dev server is served via **Laravel Herd** (`herd coverage` for coverage reports).
+Dev server is served via **Laravel Herd** (`herd coverage vendor/bin/phpunit --coverage-html tests/coverage/html` for coverage reports — see `composer.json` scripts).
+
+Before running tests locally, copy `.env.testing.example` to `.env.testing`. Default test config uses in-memory SQLite (`DB_CONNECTION=sqlite_testing`); MySQL is also supported by setting the `DB_*` vars. See TESTING.md for details.
## Architecture
@@ -105,6 +116,18 @@ After checkout, `Helper::getRedirectOption()` reads `$request->redirect_option`.
`$snipeSettings` is injected into all views via a service provider — no need to pass `Setting::getSettings()` from every controller. Use it directly in Blade.
+### CSV Importing
+
+`app/Importer/` holds per-entity importers (`AssetImporter`, `LicenseImporter`, `AccessoryImporter`, `ComponentImporter`, `ConsumableImporter`, `AssetModelImporter`, `CategoryImporter`, `UserImporter`, etc.), all extending `Importer.php`. The `Importer` Livewire component (`app/Livewire/Importer.php`) drives the UI for CSV import.
+
+### Presenters
+
+`app/Presenters/` (e.g. `AssetPresenter`, `AssetModelPresenter`, `AccessoryPresenter`) define the column/field configuration consumed by the Bootstrap Table datatables on index views — check these when adding or changing a column shown in a listing.
+
## Testing
-Tests live in `tests/Feature/` (organized by entity) and `tests/Unit/`. Feature tests hit the database; the test environment uses `array` cache/session/mail drivers. Tests use factories for data setup.
+Tests live in `tests/Feature/` (organized by entity) and `tests/Unit/`. Feature tests hit the database; the test environment uses `array` cache/session/mail drivers. Tests use factories for data setup. Use PHPUnit `#[Group('name')]` attributes to tag tests that need optional extensions/services (e.g. `LdapTest` is tagged `ldap`) so they can be excluded via `--exclude-group`.
+
+## Contribution Policy
+
+Per README.md / the project's AI Contribution Policy: PRs and issues generated by fully-automated tools without human review are not accepted upstream. If producing a PR for the upstream project (not an internal fork), treat Claude's output as a draft for human review, not a submission-ready artifact.