49 Commits
Author SHA1 Message Date
ajandClaude Fable 5 7f3beebe85 ci: add Gitea workflow to build and push image on main
Build PepApi image / build-and-push (push) Successful in 21s
Same auto-build setup as CncApi and LaserQuote.Web so all forge
services publish to the Gitea registry on push instead of the
manual docker save/load flow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 11:20:18 -04:00
aj 1d4f64726b fix: resolve 500s on nest-details endpoints under Docker deployment
NestReader opened .pep files with FileStream(path, FileMode.Open), which
defaults to FileAccess.ReadWrite. The forge deployment bind-mounts
/mnt/pep-nest read-only, so every read-only open was rejected with
"Read-only file system" (EROFS) even though the code never writes.
Pass FileAccess.Read/FileShare.Read explicitly, matching DrawingReader
and ZipHelper elsewhere in PepLib.Core.

Once that was fixed, a second pre-existing bug surfaced: GetNestDetailsAsync
matched DB rows by NestName AND a literal Path comparison built from the
container's local mount path. NestHeader.Path stores the original Windows
UNC share path (e.g. \REMCOSRV0\pep nest\) from when PepApi ran directly
against the network share, so the comparison can never match post-Docker.
Match by NestName alone (ordered by most recent), consistent with the
fallback lookup already used elsewhere in NestsController.
2026-06-30 15:00:22 -04:00
ajandClaude Sonnet 4.6 85f6a50f1a feat: improve DXF export and cross-platform file handling
- PepSettings: add DrawingsDirectory property for DXF endpoint config
- DrawingDxfExporter: support subprogram calls, skip non-cut linear moves,
  remove spurious radians-to-degrees conversion on arc angles, set AC1018 DXF version
- DrawingReader: handle .loop-info/.cadsnapshot entries gracefully, derive
  DrawingInfo from loop names when .info entry is absent, use FileShare.Read
- DrawingInfoReader: use TryParse instead of Parse for material number
- Drawing: make GetLoopName public (used by DrawingDxfExporter)
- ZipHelper: use FileShare.Read to allow concurrent readers on Windows/Linux
- NestFilterData: skip status filter when value is "All"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 07:23:12 -04:00
ajandClaude Sonnet 4.6 5e0856b5d1 fix: resolve API route name collisions
- DrawingsController: rename 'name/{name}' to 'by-name/{name}' to
  eliminate ambiguous match with '{name}/dxf' on path /drawings/name/dxf
- NestsController: add regex constraint to '{nestName}/download' and
  '{nestName}/plates' to prevent collision with year-parameterized routes
  when nestName is a 4-digit integer
- PepMcp/PepTools.cs: update GetDrawingByName URL to match renamed route

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 07:20:53 -04:00
aj 9fcc9df209 feat: add Dockerfile for Linux container build 2026-06-25 22:17:43 -04:00
aj b4bdcc160e feat: make PepApi cross-platform for Linux Docker 2026-06-25 22:15:20 -04:00
aj 5a15b552a3 feat: add compare_geometry MCP tool to PepMcp
- Add LaserQuoteBaseUrl config property to PepTools
- Implement CompareGeometry() MCP tool to compare part geometry between PEP and LaserQuote
- Read LaserQuoteBaseUrl from appsettings.json in Program.cs
- Add appsettings.json with LaserQuoteBaseUrl config
- Update PepMcp.csproj to copy appsettings.json to output directory
2026-06-23 07:17:22 -04:00
aj f59c5bd32e feat: add GET /drawings/{name}/dxf endpoint to export PEP drawings as DXF 2026-06-23 06:57:08 -04:00
ajandClaude Sonnet 4.6 7a4a35da55 fix: convert arc angles from radians to degrees in DrawingDxfExporter
ACadSharp Arc.StartAngle/EndAngle store values in degrees (DXF spec groups
50/51). The previous code passed Math.Atan2 results (radians) directly,
causing silent geometry corruption. Also hardened the arc export test to
assert angles are in degree range (0..360).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-23 06:53:17 -04:00
aj af07946a79 feat: add DrawingDxfExporter to convert PEP Drawing to DXF stream 2026-06-23 06:49:50 -04:00
ajandClaude Opus 4.6 617de2e854 docs: add Claude Code MCP server management reference
Reference guide for MCP server CLI commands, installation scopes,
OAuth authentication, and configuration file locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:48:51 -05:00
ajandClaude Opus 4.6 a308b7982b chore: standardize deploy script to match template
Remove unused $PublishTimeoutSeconds param. Add sc.exe description for
service metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 08:14:33 -05:00
ajandClaude Opus 4.6 955fbc5539 fix(nests): use partial matching for customer filter in SearchParts
The customer parameter on the parts search endpoint was doing exact
equality matching against CustomerName/CustID, so partial values like
"sull" would never match "Sullys". Changed to case-insensitive
Contains matching, consistent with how the search term is handled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 12:41:35 -05:00
ajandClaude Opus 4.5 72cdb32750 refactor(PepLib.Core): modernize and deduplicate Program class
- Extract ApplyTransform() to consolidate Rotate/Offset methods
- Add BoundsTracker helper class for bounding box calculations
- Extract ProcessLinearMotion/ProcessCircularMotion helpers
- Use pattern matching instead of type checks and casts
- Use foreach loops instead of indexed for loops
- Use expression-bodied members for simple methods
- Use tuple deconstruction and Math.Min/Max

Reduces code from 368 to 227 lines (~38% reduction).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 09:53:20 -05:00
ajandClaude Opus 4.5 a0c707583d refactor(PepLib.Core): move Node classes to Utilities namespace
Node and KeyNode are INI parsing helpers used by IniConfig,
not geometry types. Move from Geometry/ to Utilities/.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 09:32:43 -05:00
ajandClaude Opus 4.5 9088af52de refactor(PepLib.Core): reorganize files into logical folder structure
Move 38 files from root directory into organized subfolders:
- Enums/ (7 files): StatusType, ApplicationType, DrawingType, etc.
- Geometry/ (5 files): Vector, Box, Size, Spacing, Node
- Models/ (15 files): Nest, Plate, Part, Program, Report, etc.
- Utilities/ (7 files): MathHelper, Tolerance, ZipHelper, etc.
- Extensions/ (2 files): PartListExtensions, PlateListExtensions
- Interfaces/ (1 file): IMovable

Update namespaces to follow folder hierarchy (e.g., PepLib.Models).
Add GlobalUsings.cs for internal backward compatibility.
Update Codes/ and IO/ files with new using statements.
Update PepApi.Core consumers to reference new namespaces.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 09:29:13 -05:00
ajandClaude Opus 4.5 c5be48a807 feat(drawings): add drawings API endpoint with comprehensive filtering
Add new /drawings endpoint with support for filtering by text fields,
date ranges, dimensions, and boolean flags. Includes MCP tools for
integration with Claude Code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 13:11:42 -05:00
ajandClaude Opus 4.5 ecb3ec0838 feat: add PepMcp server for MCP tool integration
Add new MCP (Model Context Protocol) server project that exposes PEP API
functionality as tools for LLM integration. Includes tools for:
- Nest queries (list, details, plates)
- Part search across programs
- Material analytics (usage, plate sizes, thickness breakdown)
- Customer usage analysis
- Stock recommendations
- Materials to order for pending programs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:53:25 -05:00
ajandClaude Opus 4.5 a4fb40e485 style(PepApi.Core): reorder using directives and fix whitespace
Alphabetize using directives in NestsController and remove extra
blank line in Program.cs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:52:50 -05:00
ajandClaude Opus 4.5 1358f0136b style(PepLib.Core): normalize enum value alignment
Remove extra spacing used for column alignment in enum value
declarations to follow standard C# formatting conventions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:52:34 -05:00
ajandClaude Opus 4.5 7c5b4ded5f chore(PepLib.Core): remove unused using directives and clean up formatting
Remove unnecessary System, System.Collections.Generic, System.IO, and
System.Linq using directives that were flagged by IDE analyzers. Also
includes minor whitespace and code style normalization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:52:17 -05:00
ajandClaude Opus 4.5 a1df56f64c feat(nests): add batch part search and material descriptions
- Add POST parts/search/batch endpoint for searching multiple parts at once
- Extract SearchPartsInternalAsync helper method to support batch operations
- Include material description in part search results by looking up MaterialHeaders
- Add BatchPartSearchRequest and BatchPartSearchResponse models
- Add ResultsReturned field to single-part search response for consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 06:56:00 -05:00
ajandClaude Opus 4.5 5c74cb2b4e refactor(analytics): extract helper methods and add programmedBy filter
Extract common patterns into reusable methods (GetDateRange,
BuildNestQuery, GetPlateWeightByNest, BuildMaterialSummaries).
Add programmedBy filter to materials-to-order endpoint.
Introduce record types for cleaner data passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 09:35:37 -05:00
ajandClaude Opus 4.5 336be491ba feat(nests): add year-based routing for nest endpoints
Support /nests/{year}/{nestName} routes to disambiguate older programs
that don't have year digits in the name. Refactor GetNestPathAsync to
handle 2025+ .pep files in flat directory vs older .zip files in year
subdirectories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 09:35:28 -05:00
ajandClaude 1f58354330 chore: remove obsolete HTTP test file
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 19:35:59 -05:00
ajandClaude bcfe557a9d feat(analytics): add materials-to-order endpoint
Add GET /api/analytics/materials-to-order endpoint to retrieve materials
needed for programs with "To Be Cut" status. Returns plate requirements
grouped by material/grade/thickness with associated program names.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 19:35:44 -05:00
ajandClaude 4d2dd6d985 feat(nests): add part search endpoint
Add GET /api/nests/parts/search endpoint to search for parts across nests
by part name. Supports filtering by year and customer, with configurable
result limit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 19:35:27 -05:00
ajandClaude b3ba888c2e feat(analytics): add material usage analytics endpoints
Add AnalyticsController with endpoints for tracking material consumption:
- /analytics/material-usage - usage summary with optional monthly grouping
- /analytics/plate-sizes - commonly used plate size analysis
- /analytics/thickness-breakdown - consumption by material thickness
- /analytics/customer-usage - material breakdown per customer
- /analytics/stock-recommendations - stock level suggestions based on history
- /analytics/top-materials - quick summary of most used materials

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 14:14:48 -05:00
aj bb4ba9c973 Remove obsolete roslyn bridge script 2025-11-04 10:12:23 -05:00
ajandClaude 01d8677384 Update Claude Code tool permissions for git operations
Add auto-approval for common git commands (add, commit, mv) and tree command
to streamline development workflow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:35:44 -05:00
ajandClaude e02ed31535 Enable Swagger UI in production environment
Remove development-only restriction for Swagger UI to allow API documentation
access in all environments. This is safe as the service is local-only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:33:01 -05:00
ajandClaude 5ff189cc7e chore(claude): add Roslyn Bridge skill read permission
Enable auto-approval for reading files from the Roslyn Bridge skill
directory to streamline C# code analysis workflow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:29:38 -04:00
ajandClaude d03eae40e7 chore(config): remove trailing comma in appsettings.json
Clean up JSON formatting by removing unnecessary trailing comma
from PepSettings section.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:29:31 -04:00
ajandClaude c2c7fc2f9d fix(extensions): initialize Application property in NestSummary
Set Application to "N/A" when converting from PepLib.Nest to satisfy
the required property constraint.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:29:23 -04:00
ajandClaude c259035773 fix(core): improve null safety and default values in PepHelper
- Add null-conditional operator for dwg.QtyRequired (dwg?.QtyRequired ?? 0)
- Use string.Empty instead of null for plate names
- Remove unused using statements

These changes prevent potential null reference exceptions and provide
better default values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:29:08 -04:00
ajandClaude 6971048a6b refactor(models): add required keyword and remove unused imports
- Add required keyword to string properties across all model classes
- Initialize Part.NestedOn array with Array.Empty<int>()
- Remove unused using statements from model files

This improves null safety and code maintainability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:28:52 -04:00
aj 86aa5e16f7 chore: normalize line-endings/whitespace in Program and project file 2025-10-29 11:07:22 -04:00
aj 5c213f9393 chore(scripts): add Roslyn Bridge helper (rb.ps1)
- Provides commands for diagnostics, symbol queries, refs, formatting, and project actions
- Useful for code inspection and maintenance via Roslyn Bridge API
2025-10-29 11:07:22 -04:00
aj 2263ad0575 feat(deploy): support running service under user credentials or LocalSystem
- Add parameters: -RunAsCurrentUser, -ServiceCredential, -DomainUser, -Domain, -User, -UseLocalSystem
- Preflight checks for elevation, service logon right, and directory permissions
- Create service with provided credentials or prompt for current user password by default
- Improve start reliability and status reporting
- Update guidance output to reflect new config
2025-10-29 11:07:22 -04:00
aj 435e6f7313 chore(config,docs): remove MaterialsFile setting and update deployment notes
- Drop PepSettings:MaterialsFile from appsettings.json
- Update DEPLOY.md with guidance on service account and note that materials are sourced from DB
- Remove obsolete reference to material.lfn
2025-10-29 11:07:22 -04:00
aj 0486ebfdbe fix(parts): normalize drawing names for matching
- Strip directories and extensions and compare using ToUpperInvariant
- Improves resilience when sources differ in path/casing/extension formatting
- Ensures accurate QtyNested across plates with duplicates
2025-10-29 11:07:22 -04:00
aj 67d4342e0f feat(api): build Parts from DB PlateDetails (QtyNstd) instead of file inference
- Add GetPartsFromDbAsync(NestHeader) to aggregate quantities and plate indices
- Use NestName + CopyID filter to select correct program set
- Preserve original drawing name case; normalize grouping to avoid duplicates
- Replace PepHelper.GetParts(nest) usage with DB-driven result
2025-10-29 11:07:22 -04:00
aj 61866df17e refactor(pep-lib): replace DotNetZip with System.IO.Compression and refactor readers
- Remove DotNetZip package from PepLib.Core.csproj
- Update DrawingReader, NestReader, and ZipHelper to use System.IO.Compression.ZipArchive
- Simplify stream handling and improve resource disposal
- Keep behavior consistent for loop/plate detection and extraction
2025-10-29 11:07:22 -04:00
aj 2f56a542a8 refactor(materials): query materials from database instead of materials.lfn\n\n- Inject PepDB and project MaterialHeader to API shape (MaterialData).\n- Preserve response shape: Number, Name (from Description), Grade, Density, Thickness.\n- Filter single-material by Material string or ID, then map. 2025-10-29 11:07:22 -04:00
aj 44a2af7429 feat(db): add MaterialHeader EF entity and DbSet mapping\n\n- Map to dbo.MaterialHeader with key and relevant columns.\n- Register DbSet in PepDB and configure string columns as non-Unicode. 2025-10-29 11:07:22 -04:00
ajandClaude 2d051fc48b Fix NestFilterData properties to be nullable for optional filtering
- Make all string properties nullable (Name, Customer, Comments, etc.)
- Fixes "all fields are required" error in Swagger UI and API validation
- Filter properties are optional query parameters, not required fields

All filter logic already checks for null values before applying filters,
so this change aligns the model definition with its actual usage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:34:30 -04:00
ajandClaude d1311ffc74 Move deployment files to scripts folder for better organization
- Move Deploy-PepApi.ps1 to scripts/
- Move DEPLOY.md to scripts/
- Update all script path references to scripts/Deploy-PepApi.ps1
- Update deployment documentation with correct paths
- Add clarification to run from repository root

The deploy script already had logic to detect the scripts subfolder,
this change improves repository organization by separating deployment
tooling from source code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:25:34 -04:00
ajandClaude 029ad2b3ef Add Windows Service support to enable service deployment
- Add Microsoft.Extensions.Hosting.WindowsServices package (v8.0.1)
- Configure host to use Windows Service lifetime management
- Enables proper startup/shutdown when installed via Deploy-PepApi.ps1

Fixes issue where service would fail to start when deployed as Windows Service.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:22:18 -04:00
aj ab916dc82a Added Files 2025-10-27 18:48:23 -04:00