Skip to content

Commit d91380a

Browse files
skulidropekclaude
andcommitted
feat(app): rewrite CLI program to use unified REST API
- CLI is now a thin HTTP client: all business logic delegated to REST API - Extract named handler functions (handleStateX, handleAuthX, etc.) to satisfy max-lines-per-function - Attach and Panes remain local (require tmux/terminal) - Create command: maps config fields → ProjectCreateRequest, conditionally calls attachTmux for openSsh - main.ts: provide FetchHttpClient.layer alongside NodeContext.layer for HttpClient requirement - INVARIANT: ∀ cmd ∈ CLICommands \ {Attach, Panes, Menu}: handler(cmd) = httpCall(apiEndpoint(cmd)) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c9531d0 commit d91380a

2 files changed

Lines changed: 300 additions & 97 deletions

File tree

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#!/usr/bin/env node
22

33
import { NodeContext, NodeRuntime } from "@effect/platform-node"
4-
import { Effect } from "effect"
4+
import * as FetchHttpClient from "@effect/platform/FetchHttpClient"
5+
import { Effect, Layer } from "effect"
56

67
import { program } from "./program.js"
78

8-
// CHANGE: run docker-git CLI through the Node runtime
9-
// WHY: ensure platform services (FS, Path, Command) are available in app CLI
10-
// QUOTE(ТЗ): "CLI (отображение, фронт) это app"
11-
// REF: user-request-2026-01-28-cli-move
12-
// SOURCE: n/a
13-
// FORMAT THEOREM: forall env: runMain(program, env) -> exit
9+
// CHANGE: run docker-git CLI through the Node runtime with FetchHttpClient for API calls
10+
// WHY: FetchHttpClient.layer provides HttpClient.HttpClient service required by api-client.ts
11+
// QUOTE(ТЗ): "CLI → DOCKER_GIT_API_URL → REST API"
1412
// PURITY: SHELL
15-
// EFFECT: Effect<void, unknown, NodeContext>
16-
// INVARIANT: program runs with NodeContext.layer
13+
// EFFECT: Effect<void, unknown, NodeContext | HttpClient>
14+
// INVARIANT: program runs with NodeContext.layer + FetchHttpClient.layer
1715
// COMPLEXITY: O(n)
18-
const main = Effect.provide(program, NodeContext.layer)
16+
const mainLayer = Layer.merge(NodeContext.layer, FetchHttpClient.layer)
17+
const main = Effect.provide(program, mainLayer)
1918

2019
NodeRuntime.runMain(main)

0 commit comments

Comments
 (0)