From b734de3e1a3039b28dbcf48c831fe243c8935afe Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 21:58:26 -0400 Subject: [PATCH 1/8] chore: initialize task harness files --- .gitignore | 1 + design.md | 18 +++++++++ plan.md | 103 +++++++++++++++++++++++++++++++++--------------- progress.json | 51 ++++++++++++++++++++++++ requirements.md | 23 +++++++++++ 5 files changed, 164 insertions(+), 32 deletions(-) create mode 100644 design.md create mode 100644 progress.json create mode 100644 requirements.md diff --git a/.gitignore b/.gitignore index 52dc9c3..0b4f4ed 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ coverage/ .dolt/ *.db .beads-credential-key +AGY.md diff --git a/design.md b/design.md new file mode 100644 index 0000000..61816f4 --- /dev/null +++ b/design.md @@ -0,0 +1,18 @@ +# Design — Multiple Issues (gh-toy-kbk, gh-toy-v6z, gh-toy-4ef) + +## Problem +- The repository is configured as an Express server and lacks a CLI entry point or a `./tool` wrapper. +- There is no help subcommand or version command for the CLI. +- Input validation needs to reject blank or whitespace-only inputs. + +## Solution +- Create a CLI entrypoint `src/cli.ts` that handles command line arguments (`help`, `--help`, `-h`, `--version`, `-v`). +- Create `./tool` (bash script) and `./tool.cmd` (batch script) in the root of the project to allow executing the CLI. +- Enhance validation functions in `src/utils/validation.ts` or write new validation rules to reject empty/whitespace-only input. + +## Data Model +None. + +## What Stays / Adapts +- `src/utils/validation.ts` will be updated to check for blank/empty strings. +- Tests in `tests/validation.test.ts` will be updated to verify the new blank/empty string validation. diff --git a/plan.md b/plan.md index 682b4d7..f7679ad 100644 --- a/plan.md +++ b/plan.md @@ -1,32 +1,71 @@ -# Feature: NoteAPI v2 — Search, Pagination, and Archiving - -## Problem Statement -The API supports basic CRUD but lacks the query features users need for real use: filtering by tag, searching content, paginating large result sets, and archiving old notes without deleting them. - -## Approach -Add four features incrementally. Each feature is independent — no ordering dependencies. All use the existing in-memory store (no database changes). Each feature must have tests before it's considered done. - -## Phases - -### Phase 1: Tag Filtering -- [ ] GET /api/notes?tag=work returns only notes with that tag -- [ ] Tests: single tag, no match, multiple tags on same note -- Integration test: `curl localhost:3000/api/notes?tag=work` - -### Phase 2: Full-Text Search -- [ ] GET /api/notes?q=meeting searches title and content (case-insensitive) -- [ ] Tests: match in title, match in content, no match, empty query returns all -- Integration test: `curl localhost:3000/api/notes?q=meeting` - -### Phase 3: Pagination -- [ ] GET /api/notes?page=1&limit=10 returns paginated results -- [ ] Response format: `{ data: [...], total: N, page: N, limit: N }` -- [ ] Default: page 1, limit 20 -- Integration test: create 25 notes, verify page 1 has 20, page 2 has 5 - -### Phase 4: Note Archiving -- [ ] Add `archived: boolean` field to Note model (default: false) -- [ ] POST /api/notes/:id/archive and /api/notes/:id/unarchive endpoints -- [ ] GET /api/notes excludes archived by default -- [ ] GET /api/notes?include_archived=true includes them -- Integration test: archive a note, verify it's hidden, unarchive, verify it's back +# fleet-e2e-toy — Implementation Plan + +> Add basic CLI behaviors to fleet-e2e-toy including version flag, input validation, and a help system with stubs. + +--- + +## Tasks + +### Phase 1: CLI Interface + +#### Task 1: Add --version / -v flag to CLI and create tool launcher scripts +- **Change:** Create `src/cli.ts` as the CLI entry point. Check process arguments for `--version` or `-v` flags. If found, print `fleet-e2e-toy v1.0.0` to stdout and exit with code 0. Create root launcher scripts `tool` (bash) and `tool.cmd` (batch/Windows command script) to execute `npx ts-node src/cli.ts` forwarding arguments. +- **Files:** `src/cli.ts`, `tool`, `tool.cmd` +- **Tier:** cheap +- **Done when:** Running `./tool --version` and `./tool -v` print `fleet-e2e-toy v1.0.0` to stdout and exit with code 0. +- **Blockers:** None + +#### Task 2: Implement validation for empty or blank strings +- **Change:** In `src/cli.ts`, validate that none of the arguments passed to the tool are empty or contain only whitespace. If any argument is invalid, print a clear, user-friendly error message to stderr (e.g. `Error: Arguments cannot be empty or blank strings.`) and exit with a non-zero code (e.g. `1`). +- **Files:** `src/cli.ts` +- **Tier:** cheap +- **Done when:** Running `./tool ""` and `./tool " "` print a clear error message to stderr and exit with a non-zero code. +- **Blockers:** None + +#### Task 3: Implement help command and help flags +- **Change:** In `src/cli.ts`, handle the `help` subcommand and the `--help` and `-h` flags. When triggered, print CLI usage information listing available subcommands and flags to stdout, and exit with code 0. If an unknown command or flag is provided, print an error message to stderr (e.g., `Unknown command or flag: `) and exit with code 1. +- **Files:** `src/cli.ts` +- **Tier:** standard +- **Done when:** Running `./tool help`, `./tool --help`, and `./tool -h` print CLI usage information to stdout and exit with code 0. +- **Blockers:** None + +#### Task 4: Add CLI unit tests +- **Change:** Create `tests/cli.test.ts` to programmatically run `npx ts-node src/cli.ts` (using `execSync`) and assert the output and exit status for `--version`, `-v`, `--help`, `-h`, `help`, empty/blank string inputs, and unknown commands. +- **Files:** `tests/cli.test.ts` +- **Tier:** standard +- **Done when:** `npm test` runs successfully, including the new `tests/cli.test.ts` suite, with all tests passing. +- **Blockers:** None + +#### VERIFY: CLI Interface +- Run `npm run build` to verify compilation succeeds without TypeScript errors +- Run `npm test` to verify all tests (existing note/validation tests + new CLI tests) pass +- Run manual validation of version, help, validation, and exit codes +- Report: tests passing, any regressions, any issues found +- Push: `git push origin e2e-s8.1-26320347003/sprint` + +--- + +## Risk Register + +| Risk | Impact | Mitigation | +|------|--------|------------| +| Launcher scripts (`tool` and `tool.cmd`) are not executable on target environment | med | Use cross-platform node runner (`npx ts-node`) in launcher scripts and test on both bash and cmd environments | +| Empty string arguments are stripped by shell before being processed | low | Use wrapper test executions in Jest to ensure exact arguments are passed and validated correctly | +| Adding CLI code breaks existing web API server | low | Keep CLI code completely separated in `src/cli.ts` and `tests/cli.test.ts` with no changes to the Express app or router | +| `process.exit()` during Jest tests exits the test process | high | Use `execSync` to run `src/cli.ts` in a separate process in Jest tests to isolate execution, avoiding `process.exit` in the main test process | + +## Phase Sizing Rules + +**Phase boundaries by cohesion, not count.** A phase is a coherent unit of work that produces a reviewable, testable increment. Group tasks into a phase when they share a data model, code path, or design decision — splitting them would produce an incoherent intermediate state or require touching the same code twice. Place a VERIFY at the natural completion boundary of that unit, not at an arbitrary task count. Phases may have 4-5 tasks (a coherent subsystem) or just 1-2 (a genuinely isolated change). + +**Monotonically non-decreasing tiers within a phase.** Within a phase, order tasks cheap → standard → premium. The PM resumes the same session across tasks in a phase — a premium task can build a large context that a cheap model cannot load. The PM may group consecutive same-tier tasks into a single dispatch streak; tier transitions trigger a new dispatch. If a dependency forces a higher-tier task before a lower-tier task within a phase, split the phase at that boundary rather than violating the ordering rule. Cross-phase tier order does not matter — each phase always starts a fresh session. +``` +cheap → cheap → standard → standard → premium → VERIFY [VALID] +cheap → standard → cheap → VERIFY [INVALID] (downgrade within phase — split into two phases) +``` + +## Notes +- Each task should result in a git commit +- Verify tasks are checkpoints — stop and report after each one +- Base branch: main +- Implementation branch: e2e-s8.1-26320347003/sprint diff --git a/progress.json b/progress.json new file mode 100644 index 0000000..f86b3e9 --- /dev/null +++ b/progress.json @@ -0,0 +1,51 @@ +{ + "project": "fleet-e2e-toy", + "plan_file": "PLAN.md", + "created": "2026-05-23T01:59:00Z", + "tasks": [ + { + "id": 1, + "step": "Add --version / -v flag to CLI and create tool launcher scripts", + "type": "work", + "status": "pending", + "tier": "cheap", + "commit": "", + "notes": "" + }, + { + "id": 2, + "step": "Implement validation for empty or blank strings", + "type": "work", + "status": "pending", + "tier": "cheap", + "commit": "", + "notes": "" + }, + { + "id": 3, + "step": "Implement help command and help flags", + "type": "work", + "status": "pending", + "tier": "standard", + "commit": "", + "notes": "" + }, + { + "id": 4, + "step": "Add CLI unit tests", + "type": "work", + "status": "pending", + "tier": "standard", + "commit": "", + "notes": "" + }, + { + "id": 5, + "step": "VERIFY: CLI Interface", + "type": "verify", + "status": "pending", + "commit": "", + "notes": "" + } + ] +} diff --git a/requirements.md b/requirements.md new file mode 100644 index 0000000..958f47d --- /dev/null +++ b/requirements.md @@ -0,0 +1,23 @@ +# Requirements — P1 issues for fleet-e2e-toy + +## Base Branch +`main` + +## Goal +Implement CLI features and bug fixes for fleet-e2e-toy: version flag, help subcommand/flag, and blank/empty string input validation. + +## Scope +- Implement a help command (gh-toy-kbk): Support help subcommand and --help / -h flags to print usage info for all commands/flags. Exit code 0. +- [BUG] Add input validation for empty/blank strings (gh-toy-v6z): Reject empty or whitespace-only arguments with user-friendly error and non-zero exit code. +- Add --version / -v flag (gh-toy-4ef): Print fleet-e2e-toy v1.0.0 and exit 0. + +## Out of Scope +- Config file support or JSON output mode (these are P2). + +## Constraints +- Must run in Windows/Linux, written in TypeScript/JavaScript. + +## Acceptance Criteria +- [ ] ./tool help and ./tool --help / -h prints usage for all commands and exits with 0. +- [ ] ./tool with empty or blank string as argument rejects it with a user-friendly error and exits non-zero. Unit test added. +- [ ] ./tool --version / -v prints fleet-e2e-toy v1.0.0 and exits 0. From 04306931c57830ce25d0bcf4c510f87c2b387be9 Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:00:47 -0400 Subject: [PATCH 2/8] feat: add --version flag and tool launchers (Task 1) --- progress.json | 6 +++--- src/cli.ts | 6 ++++++ tool | 2 ++ tool.cmd | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/cli.ts create mode 100755 tool create mode 100644 tool.cmd diff --git a/progress.json b/progress.json index f86b3e9..7b72720 100644 --- a/progress.json +++ b/progress.json @@ -7,10 +7,10 @@ "id": 1, "step": "Add --version / -v flag to CLI and create tool launcher scripts", "type": "work", - "status": "pending", + "status": "completed", "tier": "cheap", - "commit": "", - "notes": "" + "commit": "feat: add CLI entry point and tool launcher scripts", + "notes": "Added src/cli.ts supporting --version and -v, created tool and tool.cmd launcher scripts." }, { "id": 2, diff --git a/src/cli.ts b/src/cli.ts new file mode 100644 index 0000000..09517d8 --- /dev/null +++ b/src/cli.ts @@ -0,0 +1,6 @@ +const args = process.argv.slice(2); + +if (args.includes('--version') || args.includes('-v')) { + console.log("fleet-e2e-toy v1.0.0"); + process.exit(0); +} diff --git a/tool b/tool new file mode 100755 index 0000000..98b8ead --- /dev/null +++ b/tool @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +npx ts-node src/cli.ts "$@" diff --git a/tool.cmd b/tool.cmd new file mode 100644 index 0000000..1c72f71 --- /dev/null +++ b/tool.cmd @@ -0,0 +1,2 @@ +@echo off +npx ts-node src/cli.ts %* From f237cb37f8fe52ed1a1c9a916b92f1b9f9cff88d Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:02:09 -0400 Subject: [PATCH 3/8] feat: add empty/blank string input validation (Task 2) --- progress.json | 6 +++--- src/cli.ts | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/progress.json b/progress.json index 7b72720..f90f7c5 100644 --- a/progress.json +++ b/progress.json @@ -16,10 +16,10 @@ "id": 2, "step": "Implement validation for empty or blank strings", "type": "work", - "status": "pending", + "status": "completed", "tier": "cheap", - "commit": "", - "notes": "" + "commit": "feat: add empty or blank argument validation (Task 2)", + "notes": "Added validation in src/cli.ts to reject empty or whitespace-only arguments with exit code 1." }, { "id": 3, diff --git a/src/cli.ts b/src/cli.ts index 09517d8..cea6858 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,6 +1,13 @@ const args = process.argv.slice(2); +// Check if any argument is empty or blank +if (args.some(arg => arg.trim() === '')) { + console.error("Error: Arguments cannot be empty or blank strings."); + process.exit(1); +} + if (args.includes('--version') || args.includes('-v')) { console.log("fleet-e2e-toy v1.0.0"); process.exit(0); } + From 346e6f22aeac0930fd031c0c880b707ae9caaa48 Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:13:36 -0400 Subject: [PATCH 4/8] feat: implement help command and help flags (Task 3) --- progress.json | 6 +++--- src/cli.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/progress.json b/progress.json index f90f7c5..ed435a5 100644 --- a/progress.json +++ b/progress.json @@ -25,10 +25,10 @@ "id": 3, "step": "Implement help command and help flags", "type": "work", - "status": "pending", + "status": "completed", "tier": "standard", - "commit": "", - "notes": "" + "commit": "feat: implement help command and help flags (Task 3)", + "notes": "Added help command, --help, and -h flag support. Added unknown argument validation with exit code 1." }, { "id": 4, diff --git a/src/cli.ts b/src/cli.ts index cea6858..57c04b6 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -11,3 +11,21 @@ if (args.includes('--version') || args.includes('-v')) { process.exit(0); } +if (args.includes('--help') || args.includes('-h') || args.includes('help')) { + console.log(`Usage: fleet-e2e-toy [options] [command] + +Options: + -v, --version Show version number + -h, --help Show help + +Commands: + help Show help`); + process.exit(0); +} + +// Reject unknown commands or flags +if (args.length > 0) { + console.error(`Unknown command or flag: ${args[0]}`); + process.exit(1); +} + From 058d507856fb000559fc85821ecef19c2207be1a Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:15:17 -0400 Subject: [PATCH 5/8] test: add CLI unit tests (Task 4) --- progress.json | 6 ++--- tests/cli.test.ts | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 tests/cli.test.ts diff --git a/progress.json b/progress.json index ed435a5..26ed7fb 100644 --- a/progress.json +++ b/progress.json @@ -34,10 +34,10 @@ "id": 4, "step": "Add CLI unit tests", "type": "work", - "status": "pending", + "status": "completed", "tier": "standard", - "commit": "", - "notes": "" + "commit": "test: add CLI unit tests (Task 4)", + "notes": "Created tests/cli.test.ts to programmatically test CLI behaviors, covering version flags, help options, blank string rejection, and unknown commands." }, { "id": 5, diff --git a/tests/cli.test.ts b/tests/cli.test.ts new file mode 100644 index 0000000..ed2f7c4 --- /dev/null +++ b/tests/cli.test.ts @@ -0,0 +1,68 @@ +import { spawnSync } from "child_process"; +import * as path from "path"; + +describe("CLI Tests", () => { + const runCLI = (args: string[]) => { + const cliPath = path.resolve(__dirname, "../src/cli.ts"); + + const result = spawnSync("node", ["-r", "ts-node/register", cliPath, ...args], { + encoding: "utf8", + }); + + return { + stdout: result.stdout || "", + stderr: result.stderr || "", + status: result.status, + }; + }; + + it("prints version with --version flag", () => { + const { stdout, status } = runCLI(["--version"]); + expect(status).toBe(0); + expect(stdout.trim()).toBe("fleet-e2e-toy v1.0.0"); + }); + + it("prints version with -v flag", () => { + const { stdout, status } = runCLI(["-v"]); + expect(status).toBe(0); + expect(stdout.trim()).toBe("fleet-e2e-toy v1.0.0"); + }); + + it("prints usage with help subcommand", () => { + const { stdout, status } = runCLI(["help"]); + expect(status).toBe(0); + expect(stdout).toContain("Usage: fleet-e2e-toy"); + expect(stdout).toContain("Options:"); + expect(stdout).toContain("Commands:"); + }); + + it("prints usage with --help flag", () => { + const { stdout, status } = runCLI(["--help"]); + expect(status).toBe(0); + expect(stdout).toContain("Usage: fleet-e2e-toy"); + }); + + it("prints usage with -h flag", () => { + const { stdout, status } = runCLI(["-h"]); + expect(status).toBe(0); + expect(stdout).toContain("Usage: fleet-e2e-toy"); + }); + + it("rejects empty string argument", () => { + const { stderr, status } = runCLI([""]); + expect(status).toBe(1); + expect(stderr.trim()).toContain("Error: Arguments cannot be empty or blank strings."); + }); + + it("rejects blank string argument", () => { + const { stderr, status } = runCLI([" "]); + expect(status).toBe(1); + expect(stderr.trim()).toContain("Error: Arguments cannot be empty or blank strings."); + }); + + it("rejects unknown command", () => { + const { stderr, status } = runCLI(["unknown_command"]); + expect(status).toBe(1); + expect(stderr.trim()).toContain("Unknown command or flag: unknown_command"); + }); +}); From 4cc454a3f8976120084cec20585766f7f1edcb76 Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:16:48 -0400 Subject: [PATCH 6/8] chore: verify CLI interface (Task 5) --- progress.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/progress.json b/progress.json index 26ed7fb..21c4ab6 100644 --- a/progress.json +++ b/progress.json @@ -43,9 +43,9 @@ "id": 5, "step": "VERIFY: CLI Interface", "type": "verify", - "status": "pending", - "commit": "", - "notes": "" + "status": "completed", + "commit": "058d507", + "notes": "Verified typescript compilation compiles without errors. Ran all 29 tests (including CLI test suite) and they all passed." } ] } From 2d35583466b4ccedab2d3e61e82ed533860f894a Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:19:34 -0400 Subject: [PATCH 7/8] chore: add code review feedback --- feedback.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 feedback.md diff --git a/feedback.md b/feedback.md new file mode 100644 index 0000000..25238e8 --- /dev/null +++ b/feedback.md @@ -0,0 +1,38 @@ +# e2e-s8.1-26320347003 - Code Review + +**Reviewer:** reviewer +**Date:** 2026-05-22 22:20:00-04:00 +**Verdict:** APPROVED + +> See the recent git history of this file to understand the context of this review. + +--- + +## Phase 1: CLI Interface Review + +### Launcher Scripts and Version Flags +- **Status:** PASS +- **Details:** The CLI launcher scripts [tool](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tool) (bash) and [tool.cmd](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tool.cmd) (batch) correctly invoke `src/cli.ts` via `ts-node`. +- **Behavior:** Running `.\tool --version` and `.\tool -v` output `fleet-e2e-toy v1.0.0` and exit with code `0`, as expected. + +### Input Validation +- **Status:** PASS +- **Details:** Arguments passed to the CLI are validated in [cli.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/src/cli.ts) to check if any of them are empty or consist only of whitespace. +- **Behavior:** Invalid inputs correctly fail with a user-friendly error printed to stderr and a non-zero exit code `1`. + +### Help Subcommand and Flags +- **Status:** PASS +- **Details:** Support for the `help` subcommand and `--help` / `-h` flags was implemented in [cli.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/src/cli.ts). +- **Behavior:** These command options print the CLI usage information and exit with code `0`. Unknown commands or flags are correctly rejected with exit code `1`. + +### Testing and Verification +- **Status:** PASS +- **Details:** Comprehensive CLI tests were added in [cli.test.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tests/cli.test.ts) using `spawnSync` to execute the CLI script, avoiding `process.exit()` issues inside the main Jest runner. +- **Verification:** All 29 tests (including the new CLI tests, the note logic, and validations) pass successfully. The TypeScript compiler and ESLint build steps compile without errors. +- **File Hygiene:** The file changes are minimal and correctly align with requirements. `AGY.md` is gitignored. + +--- + +## Summary + +The implementation of the version flags, help options, and input validation is robust, compliant with requirements, and fully tested. All checks pass without regression. From a6e53a7cbffef156a286167ec636ea26071c4f74 Mon Sep 17 00:00:00 2001 From: E2E Tester Date: Fri, 22 May 2026 22:20:43 -0400 Subject: [PATCH 8/8] cleanup: --- design.md | 18 ------------- feedback.md | 38 -------------------------- plan.md | 71 ------------------------------------------------- progress.json | 51 ----------------------------------- requirements.md | 23 ---------------- 5 files changed, 201 deletions(-) delete mode 100644 design.md delete mode 100644 feedback.md delete mode 100644 plan.md delete mode 100644 progress.json delete mode 100644 requirements.md diff --git a/design.md b/design.md deleted file mode 100644 index 61816f4..0000000 --- a/design.md +++ /dev/null @@ -1,18 +0,0 @@ -# Design — Multiple Issues (gh-toy-kbk, gh-toy-v6z, gh-toy-4ef) - -## Problem -- The repository is configured as an Express server and lacks a CLI entry point or a `./tool` wrapper. -- There is no help subcommand or version command for the CLI. -- Input validation needs to reject blank or whitespace-only inputs. - -## Solution -- Create a CLI entrypoint `src/cli.ts` that handles command line arguments (`help`, `--help`, `-h`, `--version`, `-v`). -- Create `./tool` (bash script) and `./tool.cmd` (batch script) in the root of the project to allow executing the CLI. -- Enhance validation functions in `src/utils/validation.ts` or write new validation rules to reject empty/whitespace-only input. - -## Data Model -None. - -## What Stays / Adapts -- `src/utils/validation.ts` will be updated to check for blank/empty strings. -- Tests in `tests/validation.test.ts` will be updated to verify the new blank/empty string validation. diff --git a/feedback.md b/feedback.md deleted file mode 100644 index 25238e8..0000000 --- a/feedback.md +++ /dev/null @@ -1,38 +0,0 @@ -# e2e-s8.1-26320347003 - Code Review - -**Reviewer:** reviewer -**Date:** 2026-05-22 22:20:00-04:00 -**Verdict:** APPROVED - -> See the recent git history of this file to understand the context of this review. - ---- - -## Phase 1: CLI Interface Review - -### Launcher Scripts and Version Flags -- **Status:** PASS -- **Details:** The CLI launcher scripts [tool](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tool) (bash) and [tool.cmd](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tool.cmd) (batch) correctly invoke `src/cli.ts` via `ts-node`. -- **Behavior:** Running `.\tool --version` and `.\tool -v` output `fleet-e2e-toy v1.0.0` and exit with code `0`, as expected. - -### Input Validation -- **Status:** PASS -- **Details:** Arguments passed to the CLI are validated in [cli.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/src/cli.ts) to check if any of them are empty or consist only of whitespace. -- **Behavior:** Invalid inputs correctly fail with a user-friendly error printed to stderr and a non-zero exit code `1`. - -### Help Subcommand and Flags -- **Status:** PASS -- **Details:** Support for the `help` subcommand and `--help` / `-h` flags was implemented in [cli.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/src/cli.ts). -- **Behavior:** These command options print the CLI usage information and exit with code `0`. Unknown commands or flags are correctly rejected with exit code `1`. - -### Testing and Verification -- **Status:** PASS -- **Details:** Comprehensive CLI tests were added in [cli.test.ts](file:///C:/Users/akhil/git/apra-fleet-e2e-rev/tests/cli.test.ts) using `spawnSync` to execute the CLI script, avoiding `process.exit()` issues inside the main Jest runner. -- **Verification:** All 29 tests (including the new CLI tests, the note logic, and validations) pass successfully. The TypeScript compiler and ESLint build steps compile without errors. -- **File Hygiene:** The file changes are minimal and correctly align with requirements. `AGY.md` is gitignored. - ---- - -## Summary - -The implementation of the version flags, help options, and input validation is robust, compliant with requirements, and fully tested. All checks pass without regression. diff --git a/plan.md b/plan.md deleted file mode 100644 index f7679ad..0000000 --- a/plan.md +++ /dev/null @@ -1,71 +0,0 @@ -# fleet-e2e-toy — Implementation Plan - -> Add basic CLI behaviors to fleet-e2e-toy including version flag, input validation, and a help system with stubs. - ---- - -## Tasks - -### Phase 1: CLI Interface - -#### Task 1: Add --version / -v flag to CLI and create tool launcher scripts -- **Change:** Create `src/cli.ts` as the CLI entry point. Check process arguments for `--version` or `-v` flags. If found, print `fleet-e2e-toy v1.0.0` to stdout and exit with code 0. Create root launcher scripts `tool` (bash) and `tool.cmd` (batch/Windows command script) to execute `npx ts-node src/cli.ts` forwarding arguments. -- **Files:** `src/cli.ts`, `tool`, `tool.cmd` -- **Tier:** cheap -- **Done when:** Running `./tool --version` and `./tool -v` print `fleet-e2e-toy v1.0.0` to stdout and exit with code 0. -- **Blockers:** None - -#### Task 2: Implement validation for empty or blank strings -- **Change:** In `src/cli.ts`, validate that none of the arguments passed to the tool are empty or contain only whitespace. If any argument is invalid, print a clear, user-friendly error message to stderr (e.g. `Error: Arguments cannot be empty or blank strings.`) and exit with a non-zero code (e.g. `1`). -- **Files:** `src/cli.ts` -- **Tier:** cheap -- **Done when:** Running `./tool ""` and `./tool " "` print a clear error message to stderr and exit with a non-zero code. -- **Blockers:** None - -#### Task 3: Implement help command and help flags -- **Change:** In `src/cli.ts`, handle the `help` subcommand and the `--help` and `-h` flags. When triggered, print CLI usage information listing available subcommands and flags to stdout, and exit with code 0. If an unknown command or flag is provided, print an error message to stderr (e.g., `Unknown command or flag: `) and exit with code 1. -- **Files:** `src/cli.ts` -- **Tier:** standard -- **Done when:** Running `./tool help`, `./tool --help`, and `./tool -h` print CLI usage information to stdout and exit with code 0. -- **Blockers:** None - -#### Task 4: Add CLI unit tests -- **Change:** Create `tests/cli.test.ts` to programmatically run `npx ts-node src/cli.ts` (using `execSync`) and assert the output and exit status for `--version`, `-v`, `--help`, `-h`, `help`, empty/blank string inputs, and unknown commands. -- **Files:** `tests/cli.test.ts` -- **Tier:** standard -- **Done when:** `npm test` runs successfully, including the new `tests/cli.test.ts` suite, with all tests passing. -- **Blockers:** None - -#### VERIFY: CLI Interface -- Run `npm run build` to verify compilation succeeds without TypeScript errors -- Run `npm test` to verify all tests (existing note/validation tests + new CLI tests) pass -- Run manual validation of version, help, validation, and exit codes -- Report: tests passing, any regressions, any issues found -- Push: `git push origin e2e-s8.1-26320347003/sprint` - ---- - -## Risk Register - -| Risk | Impact | Mitigation | -|------|--------|------------| -| Launcher scripts (`tool` and `tool.cmd`) are not executable on target environment | med | Use cross-platform node runner (`npx ts-node`) in launcher scripts and test on both bash and cmd environments | -| Empty string arguments are stripped by shell before being processed | low | Use wrapper test executions in Jest to ensure exact arguments are passed and validated correctly | -| Adding CLI code breaks existing web API server | low | Keep CLI code completely separated in `src/cli.ts` and `tests/cli.test.ts` with no changes to the Express app or router | -| `process.exit()` during Jest tests exits the test process | high | Use `execSync` to run `src/cli.ts` in a separate process in Jest tests to isolate execution, avoiding `process.exit` in the main test process | - -## Phase Sizing Rules - -**Phase boundaries by cohesion, not count.** A phase is a coherent unit of work that produces a reviewable, testable increment. Group tasks into a phase when they share a data model, code path, or design decision — splitting them would produce an incoherent intermediate state or require touching the same code twice. Place a VERIFY at the natural completion boundary of that unit, not at an arbitrary task count. Phases may have 4-5 tasks (a coherent subsystem) or just 1-2 (a genuinely isolated change). - -**Monotonically non-decreasing tiers within a phase.** Within a phase, order tasks cheap → standard → premium. The PM resumes the same session across tasks in a phase — a premium task can build a large context that a cheap model cannot load. The PM may group consecutive same-tier tasks into a single dispatch streak; tier transitions trigger a new dispatch. If a dependency forces a higher-tier task before a lower-tier task within a phase, split the phase at that boundary rather than violating the ordering rule. Cross-phase tier order does not matter — each phase always starts a fresh session. -``` -cheap → cheap → standard → standard → premium → VERIFY [VALID] -cheap → standard → cheap → VERIFY [INVALID] (downgrade within phase — split into two phases) -``` - -## Notes -- Each task should result in a git commit -- Verify tasks are checkpoints — stop and report after each one -- Base branch: main -- Implementation branch: e2e-s8.1-26320347003/sprint diff --git a/progress.json b/progress.json deleted file mode 100644 index 21c4ab6..0000000 --- a/progress.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "project": "fleet-e2e-toy", - "plan_file": "PLAN.md", - "created": "2026-05-23T01:59:00Z", - "tasks": [ - { - "id": 1, - "step": "Add --version / -v flag to CLI and create tool launcher scripts", - "type": "work", - "status": "completed", - "tier": "cheap", - "commit": "feat: add CLI entry point and tool launcher scripts", - "notes": "Added src/cli.ts supporting --version and -v, created tool and tool.cmd launcher scripts." - }, - { - "id": 2, - "step": "Implement validation for empty or blank strings", - "type": "work", - "status": "completed", - "tier": "cheap", - "commit": "feat: add empty or blank argument validation (Task 2)", - "notes": "Added validation in src/cli.ts to reject empty or whitespace-only arguments with exit code 1." - }, - { - "id": 3, - "step": "Implement help command and help flags", - "type": "work", - "status": "completed", - "tier": "standard", - "commit": "feat: implement help command and help flags (Task 3)", - "notes": "Added help command, --help, and -h flag support. Added unknown argument validation with exit code 1." - }, - { - "id": 4, - "step": "Add CLI unit tests", - "type": "work", - "status": "completed", - "tier": "standard", - "commit": "test: add CLI unit tests (Task 4)", - "notes": "Created tests/cli.test.ts to programmatically test CLI behaviors, covering version flags, help options, blank string rejection, and unknown commands." - }, - { - "id": 5, - "step": "VERIFY: CLI Interface", - "type": "verify", - "status": "completed", - "commit": "058d507", - "notes": "Verified typescript compilation compiles without errors. Ran all 29 tests (including CLI test suite) and they all passed." - } - ] -} diff --git a/requirements.md b/requirements.md deleted file mode 100644 index 958f47d..0000000 --- a/requirements.md +++ /dev/null @@ -1,23 +0,0 @@ -# Requirements — P1 issues for fleet-e2e-toy - -## Base Branch -`main` - -## Goal -Implement CLI features and bug fixes for fleet-e2e-toy: version flag, help subcommand/flag, and blank/empty string input validation. - -## Scope -- Implement a help command (gh-toy-kbk): Support help subcommand and --help / -h flags to print usage info for all commands/flags. Exit code 0. -- [BUG] Add input validation for empty/blank strings (gh-toy-v6z): Reject empty or whitespace-only arguments with user-friendly error and non-zero exit code. -- Add --version / -v flag (gh-toy-4ef): Print fleet-e2e-toy v1.0.0 and exit 0. - -## Out of Scope -- Config file support or JSON output mode (these are P2). - -## Constraints -- Must run in Windows/Linux, written in TypeScript/JavaScript. - -## Acceptance Criteria -- [ ] ./tool help and ./tool --help / -h prints usage for all commands and exits with 0. -- [ ] ./tool with empty or blank string as argument rejects it with a user-friendly error and exits non-zero. Unit test added. -- [ ] ./tool --version / -v prints fleet-e2e-toy v1.0.0 and exits 0.