Closed github-actions[bot] closed 1 month ago
This issue has been reviewed and marked as 'ready'. The description has been updated with testable acceptance criteria, and relevant library documents ([], 0 in total) have been added as comments.
Integrate HTTP server feature for --serve flag with /health and /options endpoints
Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15266016596 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/d118bdb9179875af5d0afa2338e0dc6416d7d23d
Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15266552810 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/93c1a50b8fd101df3e2028c9812103bd432e49f9
Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15267220800 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f9010d53f28494e4bd098022a062fd8289cded2e
agentic-lib-issue-2296 has Reached the limit of 2 attempts with 2 attempts.
Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15268055189 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/dc95a0ab0f31d19b4c490a2d649cbe5560d3643f
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15268609173 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/cd4efec625f890d7646ef125abefeee8f3a38aaa
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15268627573 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/cd4efec625f890d7646ef125abefeee8f3a38aaa
Workflow name: flow-feature-maintenance Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15268644121 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/3c3bca52d056c6fdcafe571eb7c49db2ec36888d
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269074711 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/3c3bca52d056c6fdcafe571eb7c49db2ec36888d
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269195844 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269214401 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269225752 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Workflow name: flow-maintenance-activity-to-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269405565 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Workflow name: flow-maintenance-activity-to-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269405565 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Workflow name: flow-maintenance-activity-to-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15269405565 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/f1d690ac44e975262ad82052570775de4b37f175
Reached the limit of 1 attempts with 2 attempts.
Title: Integrate HTTP server for --serve flag with /health and /options endpoints
Description: Extend the existing CLI to start an HTTP server when the
--serve
flag is provided. Implement a new functionstartHttpServer(options, port = process.env.PORT || 3000)
insrc/lib/main.js
that:http
module./health
→ respond 200 with JSON{ "status": "ok" }
. • GET/options
→ respond 200 with JSON of the passedoptions
object. • All other paths → respond 404 with JSON{ "error": "Not Found" }
.port
and logsServer listening on port <port>
.http.Server
instance.main(args)
function: parse CLI arguments intooptions
(using the existing parser orzod
schema), and ifoptions.serve === true
, invokestartHttpServer(options)
and keep the process alive.Acceptance Criteria:
AC1: startHttpServer Function • Given valid
options
and no explicit port, whenstartHttpServer(options)
is called,http.Server
.Server listening on port 3000
(or the value of environment variablePORT
).AC2: /health Endpoint • Given a running server, when a client sends
GET /health
,Content-Type
isapplication/json
{ "status": "ok" }
.AC3: /options Endpoint • Given a running server started with
options = { serve: true, foo: "bar" }
, when a client sendsGET /options
,Content-Type
isapplication/json
options
object.AC4: Unknown Route Handling • Given a running server, when a client requests any other path (e.g.,
GET /foo
),Content-Type
isapplication/json
{ "error": "Not Found" }
.AC5: Integration in main() • Given CLI args
--serve
, whennpm run serve
is executed,startHttpServer
is invoked.AC6: Tests and Documentation • Unit tests in
tests/unit/main.test.js
cover all above behaviors using spies or direct invocation of the request handler. • README.md is updated with an HTTP Server section describing the--serve
flag, default port, endpoints, andcurl
examples:Verification:
npm test
.npm run serve
, verifying endpoints usingcurl
or a browser.