Skip to content

feat: add alpm registry#10

Merged
oritwoen merged 4 commits intomainfrom
feat/alpm-registry
Mar 6, 2026
Merged

feat: add alpm registry#10
oritwoen merged 4 commits intomainfrom
feat/alpm-registry

Conversation

@aeitwoen
Copy link
Collaborator

@aeitwoen aeitwoen commented Mar 6, 2026

Adds the alpm registry for Arch Linux packages. Namespace picks between official repos (arch/) and AUR (aur/).

Closes #9

Official repos and AUR via PURL type alpm with namespace routing.
Covers package metadata, versions, deps, maintainers, and URLs.
@aeitwoen aeitwoen added this to the v0.2.0 milestone Mar 6, 2026
@aeitwoen aeitwoen self-assigned this Mar 6, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

Adds Arch Linux (ALPM) support: ecosystem-specific PURL name normalization for alpm, a new ALPM registry that routes between official Arch repos and AUR, URL builders, dependency/version/maintainer handling, and comprehensive unit and e2e tests plus registry registration on import.

Changes

Cohort / File(s) Summary
Core PURL Normalization
src/core/purl.ts
Adds conditional lowercasing of parsed package names for alpm PURLs after existing normalization.
ALPM Registry Implementation
src/registries/alpm.ts
New AlpmRegistry with namespace-aware routing (official vs AUR), API models, package/version/dependency/maintainer fetching, URL builders, version epoch handling, dependency parsing across scopes, error mapping, and a factory + self-registration.
Registry Registration
src/registries/index.ts
Adds side-effect import to register the alpm registry on module load.
Tests
test/e2e/smoke.test.ts, test/unit/alpm.test.ts
Updates smoke tests to expect 6 ecosystems; adds e2e checks for official/AUR packages and comprehensive unit tests covering normalization, versions, dependencies, error cases, namespace routing, maintainers, and URL outputs.
Docs / README
README.md
Updates project description, examples, and registries table to include Arch Linux (ALPM) with official and AUR details.

Sequence Diagram(s)

sequenceDiagram
    actor Client
    participant AlpmRegistry
    participant ArchAPI as "Arch Official API"
    participant AURAPI as "AUR API"

    Client->>AlpmRegistry: fetchPackage("arch/pacman" or "aur/yay")
    activate AlpmRegistry
    AlpmRegistry->>AlpmRegistry: parseName(), assertSupportedNamespace(), normalize PURL (alpm lowercasing)

    alt namespace == "arch"
        AlpmRegistry->>ArchAPI: searchOfficial / fetchPackage
        activate ArchAPI
        ArchAPI-->>AlpmRegistry: ArchSearchResponse / package data
        deactivate ArchAPI
        AlpmRegistry->>AlpmRegistry: format versions (epoch), parse deps, merge licenses
        AlpmRegistry-->>Client: Package object
    else namespace == "aur"
        AlpmRegistry->>AURAPI: fetchAurInfo / fetchAurPackage
        activate AURAPI
        AURAPI-->>AlpmRegistry: AurResponse / package data
        deactivate AURAPI
        AlpmRegistry->>AlpmRegistry: parse deps, normalize metadata
        AlpmRegistry-->>Client: Package object
    end
    deactivate AlpmRegistry
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Arch hops in with PURLs aligned,

repos and AUR both well-defined,
Names lowercased where alpm calls,
Dependencies parsed through spacious halls,
A rabbit cheers — new paths combined!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add alpm registry' clearly and concisely summarizes the main change, which is adding support for the Arch Linux Package Manager (ALPM) registry.
Description check ✅ Passed The description is directly related to the changeset, explaining the Arch Linux support via ALPM PURL type with namespace routing and implementation details.
Linked Issues check ✅ Passed The PR fully addresses issue #9 objectives: adds Arch Linux support, covers both official repositories and AUR, and implements PURL specification using the alpm type.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing ALPM registry support. Documentation updates, test additions, and code changes are all within scope of the linked issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/alpm-registry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot requested a review from oritwoen March 6, 2026 12:07
@coderabbitai coderabbitai bot added the enhancement New feature or request label Mar 6, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Architecture diagram
sequenceDiagram
    participant App as Application Code
    participant Core as Core Registry Factory
    participant ALPM as NEW: AlpmRegistry
    participant HTTP as Client (Fetch)
    participant ArchAPI as Arch Linux API
    participant AurAPI as AUR RPC API

    Note over App, AurAPI: ALPM Package Request Flow (Official vs AUR)

    App->>Core: create('alpm')
    Core-->>App: alpm registry instance

    App->>ALPM: fetchPackage(name)
    ALPM->>ALPM: CHANGED: parseName(name)<br/>(Extract namespace 'arch' or 'aur')

    alt namespace == 'arch'
        ALPM->>HTTP: getJSON("/packages/search/json/?name=...")
        HTTP->>ArchAPI: GET /packages/search/json/
        ArchAPI-->>HTTP: JSON (results[])
        HTTP-->>ALPM: ArchSearchResponse
        ALPM->>ALPM: Filter for 'x86_64' architecture
    else namespace == 'aur'
        ALPM->>HTTP: getJSON("/rpc/v5/info/...")
        HTTP->>AurAPI: GET /rpc/v5/info/
        AurAPI-->>HTTP: JSON (results[])
        HTTP-->>ALPM: AurResponse
    end

    ALPM->>ALPM: Normalize to Package type<br/>(licenses, deps, metadata)
    ALPM-->>App: Package Object

    Note over App, ALPM: Dependency Resolution Flow

    App->>ALPM: fetchDependencies(name, version)
    ALPM->>ALPM: Fetch raw package data (Arch or AUR)
    ALPM->>ALPM: NEW: buildDependencies()<br/>(Maps depends, makedepends, optdepends, checkdepends)
    ALPM-->>App: Dependency[]

    Note over App, AurAPI: URL Generation

    App->>ALPM: urls().purl(name, version)
    ALPM-->>App: "pkg:alpm/{namespace}/{name}@{version}"
Loading

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 85-86: The README sentence about Arch Linux packages is ambiguous
about whether the `arch` namespace is required; update the wording around "Arch
Linux packages use a namespace prefix: `pkg:alpm/arch/pacman` for official
repos, `pkg:alpm/aur/paru` for AUR." and the following sentence so it clearly
states that official Arch packages may omit the `arch` namespace (it defaults to
`arch` when omitted) while AUR packages must include the explicit `aur`
namespace; rephrase both sentences to convey that distinction unambiguously.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 15973467-610d-4e45-a6b5-de4825de2d43

📥 Commits

Reviewing files that changed from the base of the PR and between 4f531da and e08695c.

📒 Files selected for processing (1)
  • README.md

@oritwoen oritwoen merged commit 0f80db7 into main Mar 6, 2026
3 checks passed
@oritwoen oritwoen deleted the feat/alpm-registry branch March 6, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Arch Linux package support

2 participants