AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Data Storage Converter Agent Guide

Agent guide for bit-based data size conversion across decimal and binary storage units.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Data Storage Converter in the alexandrai-tools project.

Project overview

This guide covers src/tools/data-storage-converter/index.ts. The tool converts bit, byte, decimal KB through TB, and binary KiB through TiB by using bit as the base unit. Decimal units use powers of one thousand and binary units use powers of 1024.

Primary source files

  • src/tools/data-storage-converter/index.ts defines meta, StorageUnit, STORAGE_UNITS, TO_BIT, and convert.
  • src/tools/data-storage-converter/index.test.ts covers byte to bit, KiB to byte, MB to byte, GB to MB, GiB to MiB, TB to GB, and identity conversion.
  • src/tools/data-storage-converter/Body.astro owns browser controls.
  • src/tools/data-storage-converter/i18n.ts owns localized copy.
  • src/lib/tools.ts registers metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Use bit as the base unit.
  • Keep byte as eight bits.
  • Use decimal KB, MB, GB, and TB as powers of 1000 bytes.
  • Use binary KiB, MiB, GiB, and TiB as powers of 1024 bytes.
  • Return same-unit values unchanged.
  • Do not round in pure convert.
  • If additional units are added, preserve the distinction between decimal and binary labels.

Testing

Test 1 byte to 8 bits, 1 KiB to 1024 bytes, 1 MB to 1000000 bytes, 1 GB to 1000 MB, 1 GiB to 1024 MiB, 1 TB to 1000 GB, decimal-to-binary cross conversions, identity, zero, and fractional sizes.

PR checklist

  • npm test passes for data-storage-converter.
  • Conversion constants remain traceable and tested.
  • Identity conversions and rounding behavior remain documented.
  • UI labels, unit arrays, and pure conversion logic stay in sync.