Skip to content

feat(AGE-46): Add web workspace and API adapter#38

Merged
stepandel merged 3 commits intomainfrom
feature/AGE-46-project-scaffolding-api-adapter
Feb 10, 2026
Merged

feat(AGE-46): Add web workspace and API adapter#38
stepandel merged 3 commits intomainfrom
feature/AGE-46-project-scaffolding-api-adapter

Conversation

@stepandel
Copy link
Owner

@stepandel stepandel commented Feb 10, 2026

Summary

Adds the foundational web workspace package and API adapter for the agent-army web deployment UI.

Changes

  • pnpm-workspace.yaml: Added web/ as workspace package
  • cli/adapters/api-adapter.ts: New APIAdapter implementing UIAdapter, ExecAdapter, LogAdapter interfaces
    • Collects wizard inputs from request body instead of interactive prompts
    • Accumulates responses as structured JSON (fields, logs, messages)
    • Supports text, confirm, select, multiSelect field descriptors
    • Includes typed error classes for flow control (NeedsInput, Validation, Cancel)
  • cli/adapters/index.ts: Exports APIAdapter and related types
  • web/: Next.js 14 + TypeScript scaffolding
    • App router setup with layout and home page
    • /api/health endpoint returning version info
    • Workspace dependency on @agent-army/cli for shared types

Testing

  • CLI typechecks clean (tsc --noEmit passes)
  • pnpm install resolves workspace dependencies correctly

Ticket

Closes AGE-46

Summary by CodeRabbit

  • New Features

    • API-driven runtime adapter for HTTP clients with structured input handling, logging, and response payloads.
    • Web application added with a basic homepage and app layout for managing deployments.
    • Health-check API endpoint returning status, name, version, and timestamp.
  • Chores

    • Workspace updated to include the new web project and basic Next.js configuration.

- Add web/ to pnpm-workspace.yaml as workspace package
- Scaffold Next.js 14 + TypeScript app in web/
- Add /api/health endpoint returning version info
- Implement APIAdapter in cli/adapters/api-adapter.ts
  - Collects wizard inputs from request body instead of prompts
  - Accumulates responses as structured JSON
  - Supports text, confirm, select, multiSelect field descriptors
- Export APIAdapter from cli/adapters/index.ts

Closes AGE-46
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds an HTTP-driven Runtime Adapter (APIExecAdapter + APIUIAdapter) with explicit input/response types and error classes, exposes a createAPIAdapter factory, and scaffolds a new Next.js "web" app with basic pages, health API, and workspace integration.

Changes

Cohort / File(s) Summary
CLI API Adapter
cli/adapters/api-adapter.ts, cli/adapters/index.ts
New API-based Runtime Adapter: FieldDescriptor, LogEntry, APIResponse types; APIExecAdapter, APIUIAdapter; error classes APIAdapterNeedsInputError, APIAdapterValidationError, APIAdapterCancelError; createAPIAdapter exported and re-exported from adapters index.
CLI exec changes
cli/adapters/cli-adapter.ts, cli/lib/exec.ts
Replaced execSync-based command existence check with spawnSync for cross-platform commandExists handling; updated imports.
Workspace config
pnpm-workspace.yaml
Added web package to the pnpm workspace packages list.
Web project manifest & tooling
web/package.json, web/tsconfig.json, web/next.config.js, web/next-env.d.ts, web/.gitignore
New Next.js project files, TypeScript config with path alias, minimal Next config, env types, and .gitignore entries.
Web app source
web/src/app/page.tsx, web/src/app/layout.tsx, web/src/app/api/health/route.ts
Added Home page component, RootLayout with metadata, and /api/health GET route returning status, name, version, and timestamp.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant APIUIAdapter
    participant APIExecAdapter
    participant ChildProcess

    Client->>APIUIAdapter: request input or provide inputs object
    alt Input present & valid
        APIUIAdapter->>APIUIAdapter: validate input
        APIUIAdapter-->>Client: return value
    else Input missing or invalid
        APIUIAdapter->>APIUIAdapter: append FieldDescriptor to response
        APIUIAdapter-->>Client: throw APIAdapterNeedsInputError / APIAdapterValidationError
    end

    Client->>APIExecAdapter: capture(command, args)
    APIExecAdapter->>ChildProcess: spawn/exec command
    ChildProcess-->>APIExecAdapter: stdout/stderr/exitCode
    APIExecAdapter-->>Client: return ExecResult / exit code

    Client->>APIUIAdapter: spinner(message) / log actions
    APIUIAdapter->>APIUIAdapter: append LogEntry(s) to APIResponse
    APIUIAdapter-->>Client: return spinner controller or no-op
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 Hopping through code with a curious cheer,
I stitched APIs and a web root here.
Fields and logs in a tidy array,
Health checks ping and pages display—
A rabbit's small drumroll for deploy day! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding a new web workspace and implementing an API adapter for the CLI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/AGE-46-project-scaffolding-api-adapter

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@cli/adapters/api-adapter.ts`:
- Around line 62-80: The capture method currently builds a shell string and
calls execSync which allows command injection; replace execSync with
execFileSync from "child_process" and call execFileSync(command, args, { cwd,
encoding: "utf-8", stdio: ["pipe","pipe","pipe"] }) so arguments are passed
without a shell, and update the try/catch to handle the returned Buffer/string
and to cast errors to the ExecException shape to read stdout, stderr and status
(use these to populate the returned stdout, stderr and exitCode as before).
Ensure you remove the string join of command and args and keep the function name
capture unchanged.
- Around line 88-96: The commandExists function is vulnerable because it
interpolates the command into a shell string; update every commandExists
implementation (e.g., function commandExists in api-adapter.ts, cli-adapter.ts
and exec.ts) to avoid shell interpolation by invoking the platform check binary
without a shell or by scanning PATH programmatically; use spawnSync/execFileSync
with arguments as an array (e.g., call "which" on POSIX or "where" on Windows)
with shell: false and stdio ignored and return true when status === 0, or
replace the implementation entirely with a pure-Node PATH scan using fs and path
to locate executables.
🧹 Nitpick comments (1)
cli/adapters/api-adapter.ts (1)

244-254: Consider using underscore prefix for intentionally unused parameters.

The stop and message callbacks have unused parameters which may trigger linter warnings. Prefixing with underscore is the TypeScript convention for intentionally unused parameters.

✨ Suggested fix
   spinner(message: string): SpinnerController {
     this.response.logs.push({ level: "info", message: `[spinner] ${message}`, timestamp: Date.now() });
     return {
-      stop(msg?: string) {
+      stop(_msg?: string) {
         // No-op in API mode
       },
-      message(_msg: string) {
+      message(_msg: string) {
         // No-op in API mode (already prefixed)
       },
     };
   }

@stepandel stepandel merged commit c4beaec into main Feb 10, 2026
1 check was pending
@stepandel stepandel deleted the feature/AGE-46-project-scaffolding-api-adapter branch February 10, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant