Skip to content

feat(routes-f): caesar cipher encode/decode endpoint #588

@davedumto

Description

@davedumto

Summary

Add a Caesar cipher endpoint at app/api/routes-f/caesar/route.ts. Encode and decode text with a configurable shift value.

⚠️ Scope Constraint — READ BEFORE STARTING

All files for this task must live inside app/api/routes-f/. This includes:

  • The route handler (e.g. app/api/routes-f/<feature>/route.ts)
  • Any helpers/utilities (e.g. app/api/routes-f/<feature>/_lib/helpers.ts)
  • Any types (e.g. app/api/routes-f/<feature>/_lib/types.ts)
  • Any tests (e.g. app/api/routes-f/<feature>/__tests__/route.test.ts)

Do not modify, import from, or add files to lib/, utils/, types/, components/, or anywhere else outside app/api/routes-f/. If you need shared logic, duplicate it inside your subfolder. Keeping everything scoped to this folder is intentional — it keeps these tasks independent and mergeable in any order.

Requirements

  • POST /api/routes-f/caesar body { text: string, shift: number, mode: "encode"|"decode" }
  • Return { result: string, shift_used: number }
  • Preserve case (A -> D, a -> d)
  • Preserve non-alphabetic characters unchanged (digits, spaces, punctuation)
  • Normalize shift value modulo 26
  • Response includes a warning if text is detectably English and shift is unchanged (i.e., shift % 26 === 0)
  • Include unit tests, including a round-trip test

Acceptance Criteria

  • Encode/decode round-trip is lossless
  • Case and non-alpha chars preserved
  • Shift modulo normalized
  • Tests cover positive, negative, and large shifts
  • All files inside app/api/routes-f/caesar/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions