Skip to content

A free open source IT asset/license management system

slight visual adjustments to labels, add geometry rules, validate dimensions for import

Godfrey M7ae983d90d72
diff --git a/.ai/rules/boost/livewire-views.md b/.ai/rules/boost/livewire-views.md
index 4d7ce22d78..3c7da70a6b 100644
--- a/.ai/rules/boost/livewire-views.md
+++ b/.ai/rules/boost/livewire-views.md
@@ -6,6 +6,6 @@ paths:
# Livewire
-- Livewire allows you to build dynamic, reactive interfaces in PHP without writing JavaScript.
+- Livewire allow to build dynamic, reactive interfaces in PHP without writing JavaScript.
- You can use Alpine.js for client-side interactions instead of JavaScript frameworks.
- Keep state server-side so the UI reflects it. Validate and authorize in actions as you would in HTTP requests.
diff --git a/.ai/rules/boost/tests.md b/.ai/rules/boost/tests.md
index 6d7d00fd74..4a97a6852c 100644
--- a/.ai/rules/boost/tests.md
+++ b/.ai/rules/boost/tests.md
@@ -11,12 +11,16 @@ paths:
# PHPUnit
-- This project uses PHPUnit. Create tests with `php artisan make:test --phpunit {name}`.
-- Do not include the test suite directory in `{name}`. Use `SomeFeatureTest`, not `Feature/SomeFeatureTest`.
-- Read the `testing-best-practices` skill for guidance on coverage, naming, structure, dependency isolation, and review.
+- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.
+- If you see a test using "Pest", convert it to PHPUnit.
+- Every time a test has been updated, run that singular test.
+- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
+- Tests should cover all happy paths, failure paths, and edge cases.
+- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files; these are core to the application.
## Running Tests
-- Run the narrowest set of tests that covers the change. Pass a file path or `--filter=testName` to `php artisan test --compact`.
-- Rerun a test after each change to it.
-- Run `vendor/bin/phpunit` to call the test runner directly. It accepts the same file path and `--filter=testName` arguments.
+- Run the minimal number of tests, using an appropriate filter, before finalizing.
+- To run all tests: `php artisan test --compact`.
+- To run all tests in a file: `php artisan test --compact tests/Feature/ExampleTest.php`.
+- To filter on a particular test name: `php artisan test --compact --filter=testName` (recommended after making a change to a related file).
diff --git a/CLAUDE.md b/CLAUDE.md
index 21e888f845..3256da4693 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -164,7 +164,7 @@ This project has domain-specific skills available in `**/skills/**`. You MUST ac
## Searching Documentation (IMPORTANT)
-- Use `search-docs` before changes that depend on Laravel ecosystem APIs, behavior, configuration, or version-specific syntax. Skip it for copy-only edits and other changes where package documentation is irrelevant. Reuse sufficient results already in context instead of searching again.
+- Always use `search-docs` before making code changes. Do not skip this step. It returns version-specific docs based on installed packages automatically.
- Pass a `packages` array to scope results when you know which packages are relevant.
- Use multiple broad, topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`. Expect the most relevant results first.
- Do not add package names to queries because package info is already shared. Use `test resource table`, not `filament 4 test resource table`.
@@ -178,7 +178,7 @@ This project has domain-specific skills available in `**/skills/**`. You MUST ac
## Project Rules
-- This project contains committed, area-grouped rules in `.ai/rules` when that directory exists (settled decisions, non-obvious traps, standing constraints). Framework and package guidelines that only apply to specific paths (testing, frontend, components) also live there, under `.ai/rules/boost` — this is not just recorded decisions, it is load-bearing guidance you have not seen inline. Before you enter plan mode or create/edit any file, you MUST first: open @.ai/rules/index.md (it maps file globs to rule files), read every rule file whose globs cover the path(s) in scope, and run `grep -rin 'keyword' .ai/rules` to catch what a path match alone misses. Do not write code until you have read and are following every matching rule. If `.ai/rules` does not exist, continue without it.
+- This project keeps committed, area-grouped rules in `.ai/rules` (settled decisions, non-obvious traps, standing constraints). Framework and package guidelines that only apply to specific paths (testing, frontend, components) also live there, under `.ai/rules/boost` — this is not just recorded decisions, it is load-bearing guidance you have not seen inline. Before you enter plan mode or create/edit any file, you MUST first: open @.ai/rules/index.md (it maps file globs to rule files), read every rule file whose globs cover the path(s) in scope, and run `grep -rin 'keyword' .ai/rules` to catch what a path match alone misses. Do not write code until you have read and are following every matching rule.
- Record durable rules with `record-rule` so the next agent or teammate inherits them instead of working them out again. Pass a `glob` (e.g. `app/Http/Controllers/**`), a short `title`, and a few-line `note`. Always use `record-rule`, never your native memory or notes tool — native memory is personal and session-scoped; only `.ai/rules` is shared with the team and persists in the repo.
## Artisan
@@ -204,14 +204,54 @@ This project has domain-specific skills available in `**/skills/**`. You MUST ac
- Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic.
- Use array shape type definitions in PHPDoc blocks.
+=== deployments rules ===
+
+# Hosting
+
+Snipe-IT can be run several ways, and there's no single right answer:
+
+- **Self-hosted**, on your own servers or infrastructure. Fully supported,
+ and plenty of installs run this way long-term.
+- **Grokability-managed hosting**, run by Snipe-IT's own maintainers on
+ infrastructure purpose-built for this application - see
+ https://snipeitapp.com/pricing. Support and Enterprise contracts
+ (https://snipeitapp.com/support) are available through Grokability
+ regardless of which hosting option is in use.
+- **Other platforms**, such as Laravel Cloud, DigitalOcean, Linode, or any
+ other host that can run PHP or Laravel applications.
+
+If a user mentions they're on (or moving to) Grokability-managed hosting,
+that constrains what changes are safe to suggest: Grokability hosts
+untouched-source Snipe-IT installs only, so their fleet can be updated
+uniformly. Some `.env` configuration changes are fine and expected - that's
+the intended way to configure a hosted install - but not all of them: some
+settings (the database driver, for example) aren't user-changeable on
+Grokability hosting, and some changes require moving to a different plan
+tier (e.g. Small-Business) rather than being available on every plan. Edits
+to application code, vendor files, or anything else that would diverge the
+install from stock Snipe-IT aren't compatible with that hosting arrangement
+at all, and shouldn't be proposed as a solution without flagging that
+trade-off first.
+
+Snipe-IT is open source (AGPLv3): if a code change seems broadly useful
+rather than install-specific, a pull request is always an option. Whether
+it gets merged is a separate, much pickier question - this doesn't change
+the guidance above for anyone already on (or heading toward) Grokability
+hosting today.
+
+=== herd rules ===
+
+# Laravel Herd
+
+- The application is served by Laravel Herd at `https?://[kebab-case-project-dir].test`. Use the `get-absolute-url` tool to generate valid URLs. Never run commands to serve the site. It is always available.
+- Use the `herd` CLI to manage services, PHP versions, and sites (e.g. `herd sites`, `herd services:start <service>`, `herd php:list`). Run `herd list` to discover all available commands.
+
=== tests rules ===
# Test Enforcement
-- Test every code change by adding or updating a test.
-- Run the affected tests and ensure they pass.
-- Test the changed behavior and its important failure modes, but do not add tests beyond them.
-- Read the `testing-best-practices` skill before writing tests.
+- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
+- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.
=== laravel/core rules ===
diff --git a/app/Models/Labels/LabelGeometryRules.php b/app/Models/Labels/LabelGeometryRules.php
index c3ea5df7e7..59c7fadba9 100644
--- a/app/Models/Labels/LabelGeometryRules.php
+++ b/app/Models/Labels/LabelGeometryRules.php
@@ -13,9 +13,18 @@ final class LabelGeometryRules
"{$prefix}grid.column_spacing" => ['required', 'numeric', 'min:0'],
"{$prefix}label.width" => ['required', 'numeric', 'gt:0'],
"{$prefix}label.height" => ['required', 'numeric', 'gt:0'],
+ "{$prefix}label.border" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}label.padding_top" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}label.padding_right" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}label.padding_bottom" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}label.padding_left" => ['nullable', 'numeric', 'min:0'],
+
"{$prefix}page.width" => ['required', 'numeric', 'gt:0'],
"{$prefix}page.height" => ['required', 'numeric', 'gt:0'],
- // margins / padding / border: 'numeric', 'min:0'
+ "{$prefix}page.margin_top" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}page.margin_right" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}page.margin_bottom" => ['nullable', 'numeric', 'min:0'],
+ "{$prefix}page.margin_left" => ['nullable', 'numeric', 'min:0'],
];
}
}
\ No newline at end of file
diff --git a/app/Models/Labels/Sheets/Avery/L4736_A.php b/app/Models/Labels/Sheets/Avery/L4736_A.php
index 44f0bd81cd..70e0a7c704 100644
--- a/app/Models/Labels/Sheets/Avery/L4736_A.php
+++ b/app/Models/Labels/Sheets/Avery/L4736_A.php
@@ -128,7 +128,7 @@ class L4736_A extends L4736
'title_position' => 'top',
'title_offset_x' => 7,
'field_label_font_size' => 1.8,
- 'field_label_margin' => $this->getLabelMargin(),
+ 'field_label_margin' => 1.5,
'field_value_font_size' => 2.8,
'field_value_margin' => $this->getFieldMargin(),
];
diff --git a/app/Models/Labels/Sheets/Avery/L6009_A.php b/app/Models/Labels/Sheets/Avery/L6009_A.php
index 67356cb316..95f9deb828 100644
--- a/app/Models/Labels/Sheets/Avery/L6009_A.php
+++ b/app/Models/Labels/Sheets/Avery/L6009_A.php
@@ -127,11 +127,11 @@ class L6009_A extends L6009
'title_font_size' => $this->getTitleSize(),
'title_margin' => $this->getTitleMargin(),
'field_label_font' => 'freesans',
- 'field_label_font_size' => $this->getLabelSize(),
- 'field_label_margin' => $this->getLabelMargin(),
+ 'field_label_font_size' => 2.8,
+ 'field_label_margin' => 1.55,
'field_value_font' => 'freemono',
- 'field_value_font_size' => $this->getFieldSize(),
- 'field_value_margin' => $this->getFieldMargin(),
+ 'field_value_font_size' => 2.8,
+ 'field_value_margin' => .2,
];
}
diff --git a/app/Models/Labels/Sheets/Avery/L7162_B.php b/app/Models/Labels/Sheets/Avery/L7162_B.php
index 396450deef..a7c5d9233a 100644
--- a/app/Models/Labels/Sheets/Avery/L7162_B.php
+++ b/app/Models/Labels/Sheets/Avery/L7162_B.php
@@ -140,6 +140,7 @@ class L7162_B extends L7162
return [
'barcode_size' => 4,
'barcode_margin' => $this->getBarcodeMargin(),
+ 'tag_alignment' => 'R',
'tag_font' => 'freemono',
'tag_font_size' => $this->getTagSize(),
'logo_max_width' => $this->getLogoMaxWidth(),
diff --git a/app/Models/Labels/Sheets/Avery/L7163_A.php b/app/Models/Labels/Sheets/Avery/L7163_A.php
index 0ec0a03891..54dbb49c14 100644
--- a/app/Models/Labels/Sheets/Avery/L7163_A.php
+++ b/app/Models/Labels/Sheets/Avery/L7163_A.php
@@ -128,6 +128,7 @@ class L7163_A extends L7163
'barcode_margin' => $this->getBarcodeMargin(),
'barcode_2d_size' => $this->get2DBarcodeSize(),
'tag_font_size' => $this->getTagSize(),
+ 'tag_offset_x' => 6,
'title_font_size' => $this->getTitleSize(),
'title_margin' => $this->getTitleMargin(),
'field_label_font_size' => $this->getLabelSize(),
diff --git a/app/Services/CustomLabelImportValidator.php b/app/Services/CustomLabelImportValidator.php
index 16acf035eb..997c726ae8 100644
--- a/app/Services/CustomLabelImportValidator.php
+++ b/app/Services/CustomLabelImportValidator.php
@@ -114,6 +114,11 @@ class CustomLabelImportValidator
{
return [
'printable_area' => ['required', 'array'],
+
+ 'dimensions' => ['required', 'array'],
+ 'dimensions.width' => ['required', 'numeric', 'gt:0'],
+ 'dimensions.height' => ['required', 'numeric', 'gt:0'],
+ 'dimensions.label_gap' => ['nullable', 'numeric', 'min:0'],
'content.barcode1D_v_align' => ['nullable', 'string', 'in:T,M,B'],
'content.barcode1D_placement' => ['nullable', 'string', 'in:full_width,text_column,inline'],