Skip to content

add-route

Source

add-route.ts

Usage

bash
npm exec saf-workflow kickoff add-route <path>

To run this workflow automatically, tell the agent to:

  1. Navigate to the target package
  2. Run this command
  3. Follow the instructions until done

Checklist

When run, the workflow will:

  • Read the reference documentation for adding routes.
  • Copy template files and rename placeholders.
    • Upsert route-template.test.ts from template
    • Upsert route-template.ts from template
  • Check if the feature router exists at /routes/example-subpath/index.ts. If it doesn't exist, create it with the basic structure to export the new route handler.
  • Update the feature router at /routes/example-subpath/index.ts to include the new route handler.
  • Check if the HTTP app exists at /http.ts or /app.ts. If neither exists, create one to mount your routes.
  • Update the HTTP app to include the feature router.
  • Update example-route.ts to remove TODOs
  • Read the testing guide.
  • Update example-route.test.ts to remove TODOs
  • Run test, make sure it passes.

Help Docs

bash
Usage: saf-workflow kickoff add-route [options] <path>

Add a new route to an Express.js service.

Arguments:
  path        Path of the new route (e.g. 'routes/todos/create')

Options:
  -h, --help  display help for command