Skip to content

Latest commit

 

History

History
135 lines (100 loc) · 5.06 KB

File metadata and controls

135 lines (100 loc) · 5.06 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Artex is a single lightweight ASP.NET Core service hosting NuGet V3 and Maven repositories

Build & Test Commands

# Restore, build, test
dotnet restore Artex.sln
dotnet build Artex.sln
dotnet test Artex.sln --no-restore --no-build --verbosity normal

# Run a single test project
dotnet test Artex.Tests/Artex.Tests.csproj --no-restore --no-build --verbosity normal

# Run a single test by name
dotnet test Artex.sln --no-restore --no-build --filter "FullyQualifiedName~TestClassName.TestMethodName"

# Build with CI flag (used in GitHub Actions)
dotnet build --no-restore /p:ContinuousIntegrationBuild=true

# Test with coverage
dotnet test Artex.sln --no-restore --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput="../CoverageResults/" /p:MergeWith="../CoverageResults/coverage.json" /p:CoverletOutputFormat=\"opencover,json\"

Test framework: NUnit 4.x. Both Artex and Artex.Tests target .NET 10.0 (net10.0).

Architecture

Project Structure

Project Purpose
Artex Carter-based REST endpoints providing minimal lightweight NuGet V3 and Maven repositories
Artex.Tests NUnit test fixtures for the Artex service

Namespaces

Root namespace is PackageRegistry (set in .csproj). Sub-namespaces follow a layer convention:

Namespace Contents
PackageRegistry.Models MavenArtifact, NuGetPackage, PackageSearchResult
PackageRegistry.Storage IPackageStorage, FileSystemPackageStorage
PackageRegistry.Services IMavenService, MavenService, INuGetService, NuGetService
PackageRegistry.Modules ApiModule, MavenModule, NuGetModule
Artex.Tests Test fixtures

Key Dependencies

Package Version Used in
Carter 10.0.0 Artex (module routing)
System.IO.Compression 4.3.0 Artex (package handling)
NUnit 4.5.0 Artex.Tests
coverlet 8.0.0 Artex.Tests (coverage)

Configuration

Settings live in appsettings.json:

Key Default Purpose
Storage:Path ./packages Root directory for stored packages
Auth:NuGetApiKey API key for NuGet push authentication
Auth:MavenToken Bearer token for Maven push authentication

All three services (FileSystemPackageStorage, MavenService, NuGetService) are registered as singletons in Program.cs. The storage abstraction (IPackageStorage) can be swapped for S3/Blob implementations without changing service code.

HTTP API Surface

Module Base path Purpose
NuGetModule /v3/ NuGet V3 protocol endpoints
MavenModule /maven/ Maven repository endpoints
ApiModule /api/ General API endpoints

Non-API routes fall back to a SPA frontend served via app.UseStaticFiles() and app.MapFallbackToFile("index.html").

Code Style

  • 4 spaces indentation, no tabs
  • No _ prefix on member names; use this. for instance members
  • Use var unless the type is ambiguous
  • Use C# type aliases (int, string, not Int32, String)
  • Always wrap blocks in curly braces, even single-line
  • using statements go inside the namespace
  • System.* namespaces go first, then other namespaces shall be sorted alphabeticaly
  • No #region directives
  • All public members require XML documentation (///)

Code Quality

  • We use SonarQube with a quality gate that expects at least 80% code coverage on new code.
  • When writing new code, always add or update unit tests to meet this coverage threshold.
  • Run coverage locally with the dotnet test coverage command in Build & Test Commands above.

File Header

Every .cs file must have the Apache 2.0 copyright header:

// -------------------------------------------------------------------------------------------------
// <copyright file="FileName.cs" company="Starion Group S.A.">
//
//   Copyright (C) 2026 Starion Group S.A.
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

Git Workflow

  • Default branch: development (never work directly on main)
  • Create feature branches from development
  • Rebase before submitting PRs

Local do's and dont's

  • This is a C# codebase, refrain from using Python to verify the correctness of the implementation.