From ea7ffc0f1c56b154074bced5a1b224347e65bb83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 03:09:31 +0000 Subject: [PATCH 1/4] Initial plan From 6c9234462c5070875d7c6e783af726f278a65de9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 03:11:22 +0000 Subject: [PATCH 2/4] Add .github/copilot-instructions.md with repo overview, structure, commands, and conventions Co-authored-by: kitsonk <1282577+kitsonk@users.noreply.github.com> --- .github/copilot-instructions.md | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..24e0890e --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,55 @@ +# Copilot Instructions for oak + +## Overview + +oak is a middleware framework for Deno's native HTTP server, +[Deno Deploy](https://deno.com/deploy), Node.js, [Bun](https://bun.sh/), and +[Cloudflare Workers](https://workers.cloudflare.com/). It is inspired by +[Koa](https://github.com/koajs/koa/) and includes a middleware router inspired +by [@koa/router](https://github.com/koajs/router/). The package is distributed +via [JSR](https://jsr.io/@oak/oak) and [npm](https://www.npmjs.com/package/@oakserver/oak). + +## Repository Structure + +- **Root-level `.ts` files** — Core framework modules (e.g., `application.ts`, + `router.ts`, `context.ts`, `request.ts`, `response.ts`, `body.ts`, `send.ts`). +- **`middleware/`** — Built-in middleware (etag, proxy, serve). +- **`utils/`** — Internal utility functions and type guards. +- **`*.test.ts`** — Test files co-located with source files. +- **`deps.ts`** — Centralized runtime dependencies (always import shared deps from here). +- **`deps_test.ts`** — Centralized test-only dependencies. +- **`mod.ts`** — Public entry point that re-exports the full public API. +- **`types.ts`** — Shared TypeScript types and interfaces. +- **`examples/`** — Example usage scripts (not published). +- **`fixtures/`** — Test fixtures (not published). +- **`docs/`** — Documentation site source (not published). + +## Development Commands + +All commands use the [Deno](https://deno.com/) toolchain (no `npm` or build step needed). + +| Task | Command | +|---|---| +| Run tests | `deno task test` | +| Run tests with coverage | `deno task test:coverage` | +| Generate lcov report | `deno task coverage` | +| Format code | `deno fmt` | +| Check formatting | `deno fmt --check` | +| Lint code | `deno lint` | + +## Coding Conventions + +- **Language**: TypeScript, targeting Deno-first with cross-runtime support (Node.js, Bun). +- **Copyright header**: Every source file begins with: + ```ts + // Copyright 2018-2025 the oak authors. All rights reserved. MIT license. + ``` +- **Imports**: Use relative imports with `.ts` extensions (e.g., `import { foo } from "./bar.ts"`). + Shared dependencies are imported via `deps.ts`; test-only dependencies via `deps_test.ts`. +- **JSDoc**: Public APIs are documented with JSDoc. Module-level doc comments end with a `@module` tag. +- **Formatting**: Enforced by `deno fmt`. Do not manually adjust whitespace or indentation. +- **Linting**: Enforced by `deno lint`. The `no-import-prefix` rule is disabled (see `deno.json`). +- **Tests**: Co-located `*.test.ts` files. Use `assertEquals`, `assertStrictEquals`, and + `assertRejects` from `deps_test.ts`. Mock helpers are defined locally within test files. +- **Error handling**: Use the `errors` object from `deps.ts` for HTTP error classes. +- **Exports**: All public symbols are re-exported from `mod.ts`. From 3fca3befe3a9e6bf36e0d742d50d416a4ef1823c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 03:16:26 +0000 Subject: [PATCH 3/4] Update copilot-instructions: JSR-only distribution, note deno.json exports Co-authored-by: kitsonk <1282577+kitsonk@users.noreply.github.com> --- .github/copilot-instructions.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 24e0890e..cc0dd1f0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -7,7 +7,7 @@ oak is a middleware framework for Deno's native HTTP server, [Cloudflare Workers](https://workers.cloudflare.com/). It is inspired by [Koa](https://github.com/koajs/koa/) and includes a middleware router inspired by [@koa/router](https://github.com/koajs/router/). The package is distributed -via [JSR](https://jsr.io/@oak/oak) and [npm](https://www.npmjs.com/package/@oakserver/oak). +via [JSR](https://jsr.io/@oak/oak). ## Repository Structure @@ -52,4 +52,5 @@ All commands use the [Deno](https://deno.com/) toolchain (no `npm` or build step - **Tests**: Co-located `*.test.ts` files. Use `assertEquals`, `assertStrictEquals`, and `assertRejects` from `deps_test.ts`. Mock helpers are defined locally within test files. - **Error handling**: Use the `errors` object from `deps.ts` for HTTP error classes. -- **Exports**: All public symbols are re-exported from `mod.ts`. +- **Exports**: All public symbols are re-exported from `mod.ts`. The `deno.json` + `exports` field also defines the package entry points for JSR publishing. From 41b55b877a98eb3bc96d55d82ca45c6fb524641a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 03:22:56 +0000 Subject: [PATCH 4/4] Exclude copilot-instructions.md from deno fmt to fix CI Co-authored-by: kitsonk <1282577+kitsonk@users.noreply.github.com> --- deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno.json b/deno.json index 4d374c20..f8aceeb9 100644 --- a/deno.json +++ b/deno.json @@ -38,7 +38,7 @@ "test:coverage": "deno test --coverage=./cov --junit-path=junit.xml --allow-read --allow-write --allow-net --cert ./examples/tls/RootCA.crt --parallel --ignore=npm" }, "fmt": { - "exclude": ["README.md"] + "exclude": ["README.md", ".github/copilot-instructions.md"] }, "lint": { "rules": {