aminet-mirror

$npx mdskill add Tibsfox/gsd-skill-creator/aminet-mirror

Mirrors Aminet packages with integrity checks and state tracking.

  • Fetches single packages with ordered mirror fallback.
  • Uses HTTP requests and SHA-256 verification.
  • Selects mirrors based on a priority list and state.
  • Delivers verified packages and persistent mirror state.

SKILL.md

.github/skills/aminet-mirrorView on GitHub ↗
---
name: aminet-mirror
description: "Selective Aminet package mirroring: single-package fetch, integrity verification, mirror state tracking, bulk download, and sync detection. Use when downloading, verifying, or managing mirrored packages."
metadata:
  extensions:
    gsd-skill-creator:
      triggers:
        intents:
          - "aminet.*fetch"
          - "aminet.*download"
          - "mirror.*state"
          - "integrity.*verif"
        files:
          - "src/aminet/package-fetcher.ts"
          - "src/aminet/mirror-state.ts"
          - "src/aminet/integrity.ts"
          - "src/aminet/bulk-downloader.ts"
          - "src/aminet/sync-detector.ts"
        contexts:
          - "aminet mirroring"
          - "package download"
        threshold: 0.7
      token_budget: "1.0%"
      version: 1
      enabled: true
      plan_origin: "242-aminet-integration"
      phase_origin: "242"
---

# Aminet Mirror

## Purpose

Manages selective mirroring of Aminet packages to the local filesystem. Handles single-package fetching with ordered mirror fallback, SHA-256 integrity verification, persistent mirror state tracking with 7-state status enum, concurrent bulk downloads with rate limiting, and sync detection comparing local state against the INDEX.

## Capabilities

- Single-package fetch with ordered mirror fallback
- Directory hierarchy preservation matching Aminet structure
- Non-fatal .readme download (best-effort alongside archive)
- User-Agent header on all HTTP requests
- SHA-256 integrity verification via node:crypto
- Size verification with +/-1 KB tolerance for Aminet metadata rounding
- Combined integrity result (hash + size) in single check
- 7-state PackageStatus enum tracking full lifecycle
- Atomic write-then-rename for mirror state persistence
- Immutable updateEntry pattern for safe concurrent access
- Bulk download with async semaphore concurrency control
- Global rate limiting gate between requests
- Resume from interruption (skips already-mirrored packages)
- Serialized state writes via Promise chain mutex
- Sync detection comparing mirror state vs INDEX by sizeKb
- O(1) Map lookup for efficient change detection
- Only change-eligible statuses compared (mirrored+)

## Key Modules

| Module | Purpose |
|--------|---------|
| `src/aminet/package-fetcher.ts` | Single-package fetch with ordered mirror fallback and .readme |
| `src/aminet/mirror-state.ts` | 7-state status enum, atomic persistence, immutable updateEntry |
| `src/aminet/integrity.ts` | SHA-256 hash and size verification with combined IntegrityResult |
| `src/aminet/bulk-downloader.ts` | Concurrent downloads with semaphore, rate limiting, resume support |
| `src/aminet/sync-detector.ts` | Detects INDEX changes against local mirror state via Map lookup |

## Usage Examples

**Fetch a single package:**
```typescript
import { fetchPackage } from './package-fetcher.js';

const result = await fetchPackage({
  entry: indexEntry,
  mirrors: ['https://aminet.net', 'https://de.aminet.net'],
  outputDir: './mirror',
});
// Downloads archive + .readme, preserves directory structure
```

**Verify integrity:**
```typescript
import { verifyIntegrity } from './integrity.js';

const result = await verifyIntegrity(filePath, { expectedSha256: hash, expectedSizeKb: 42 });
// result.valid, result.hashMatch, result.sizeMatch
```

**Bulk download with concurrency:**
```typescript
import { bulkDownload } from './bulk-downloader.js';

await bulkDownload({
  entries: selectedPackages,
  mirrors,
  outputDir: './mirror',
  concurrency: 4,
  rateLimit: 500, // ms between requests
  onProgress: (completed, total) => console.log(`${completed}/${total}`),
});
```

**Detect sync changes:**
```typescript
import { detectChanges } from './sync-detector.js';

const changes = detectChanges(mirrorState, currentIndex);
// changes: { added: [], updated: [], removed: [] }
```

## Dependencies

- Node.js `node:crypto` for SHA-256 hashing
- Node.js `node:fs` for mirror state persistence and file I/O
- HTTP client for mirror downloads
- Aminet mirror network (ordered fallback list)

## Token Budget Rationale

1.0% budget reflects the 5 modules covering fetch, state, integrity, bulk download, and sync detection. The concurrency control, rate limiting, and atomic state persistence patterns require moderate context for safe operation.

More from Tibsfox/gsd-skill-creator

SkillDescription
3d-interaction-designDesign heuristics for three-dimensional interaction — input modalities (6DoF controllers, gaze, gesture, voice), selection and manipulation techniques (ray-cast, virtual hand, go-go, world-in-miniature), navigation (teleport, continuous, redirected walking), and feedback loops (haptic, audio, visual). Covers Fitts' law in 3D, discoverability vs affordance, safe-zone design, and comfort/simulator sickness mitigation. Use when designing VR/AR interactions, immersive walkthroughs, or any input system where the user's body is the controller.
accessibility-patternsProvides web accessibility best practices for semantic HTML, ARIA, keyboard navigation, color contrast, and screen reader patterns. Use when building UI components, reviewing accessibility, or when user mentions 'a11y', 'accessibility', 'ARIA', 'screen reader', 'keyboard navigation', 'WCAG'.
active-listeningActive listening techniques for effective communication. Covers attending behaviors, paraphrasing, reflective listening, clarifying questions, empathic response, barriers to listening, listening in conflict, and cross-cultural listening. Use when building listening skills, improving understanding in conversation, mediating disputes, or analyzing communication breakdowns.
adversarial-pr-reviewAdversarial spec-compliance PR review — cross-references diffs against approved specs, verifies runtime claims against source, detects competing PRs, audits scope/convention compliance. Use before merging.
agile-methodsAgile and Lean software development methodologies for iterative, adaptive project execution. Covers Scrum (roles, ceremonies, artifacts), Kanban (WIP limits, flow metrics), XP (TDD, pair programming, CI), SAFe overview, Lean Software Development (Poppendieck's 7 principles), user stories (INVEST criteria), estimation via story points and velocity, and the Agile Manifesto's values and principles. Includes Cynefin framework for methodology selection and GSD's relationship to Agile as a structured Lean variant.
algebraic-reasoningSymbolic manipulation, equation solving, and algebraic structures for mathematical reasoning. Covers distributive law, factoring, completing the square, linear through polynomial equation solving, systems of equations (substitution, elimination, Gaussian elimination, matrix methods), algebraic structures (groups, rings, fields), modular arithmetic, polynomial theory, and inequalities. Use when solving equations, simplifying expressions, working with algebraic structures, or performing symbolic manipulation.
algorithmic-awarenessUnderstanding how algorithmic systems shape what users see, know, and do -- from recommendation feeds to search ranking to credit scoring to hiring software. Covers the mechanics of recommendation systems, algorithmic bias and its sources, personalization's effects on information diets, opacity and accountability, AI limitations (hallucination, confident wrongness), and the human-in-the-loop question. Use when a learner needs to think critically about why particular content reached them.
algorithms-data-structuresAlgorithms and data structures from first principles through advanced analysis. Covers sorting (bubble, insertion, selection, merge, quick, heap, radix), searching (linear, binary, BFS, DFS, Dijkstra, A*), fundamental data structures (arrays, linked lists, stacks, queues, hash tables, trees, heaps, graphs, tries), complexity analysis (Big-O, Big-Omega, Big-Theta, amortized), recurrence relations, and algorithm design paradigms (divide-and-conquer, greedy, dynamic programming, backtracking). Use when analyzing, selecting, implementing, or comparing algorithms and data structures.
aminet-browserAminet search and browse: full-text search, category tree navigation, architecture filtering, package detail, and curated collections. Use when searching, browsing, or managing package collections.
aminet-emulatorFS-UAE emulator configuration and launch: hardware profiles, ROM management, WHDLoad integration, config generation, and state snapshots. Use when configuring emulation, managing ROMs, or launching Amiga software.