@ordewell/cli 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +31 -38
  2. package/dist/main.js +28 -6
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,56 +1,49 @@
1
1
  # @ordewell/cli
2
2
 
3
- The command line and terminal UI for **[Ordewell](https://ordewell.ai)** — turn one
4
- goal into an ordered plan of coding-agent tasks, each with its own runner, model
5
- and mode, then execute and verify it.
3
+ The command line and terminal UI for **[Ordewell](https://ordewell.ai)**, task
4
+ orchestration for coding agents. One goal becomes an ordered plan of tasks, each on
5
+ its own runner, model and branch. Ordewell executes the plan, verifies every task
6
+ from evidence, and leaves the final merge to you.
6
7
 
7
- ```bash
8
- npm install -g @ordewell/cli # or: npm install -g ordewell
9
-
10
- export OPENROUTER_API_KEY="sk-or-..." # any one provider key — auto-detected
11
-
12
- ordewell # the TUI
13
- ```
14
-
15
- Bare `ordewell` opens the full-screen terminal UI. On first run it tells you
16
- what it still needs — a planner and at least one runner — both settable from
17
- inside it with `/planner`, `/runners` and `/key`. Or drive it as a CLI:
8
+ ## Installation
18
9
 
19
10
  ```bash
20
- ordewell plan --goal "Add rate limiting to the public API"
21
- ordewell run
11
+ npm install -g @ordewell/cli # or: npm install -g ordewell
22
12
  ```
23
13
 
24
- No API key? Plan on a coding agent you already have installed — it's what
25
- executes the tasks anyway:
14
+ **Requirements:** Node.js 20 or newer, at least one of Claude Code, Codex or
15
+ OpenCode, git for task isolation, and tmux for the terminal UI. Linux, macOS and
16
+ Windows are supported; on Windows, run the terminal UI under WSL.
26
17
 
27
- ```bash
28
- export AI_PROVIDER="claude-code" # or codex, or opencode
29
- ordewell plan --goal "Add rate limiting to the public API"
30
- ```
18
+ ## Usage
31
19
 
32
- ## The two surfaces in this package
20
+ Run `ordewell` in your project to open the terminal UI: the conversation on the
21
+ left, the live plan on the right. The first run lets you pick a planner and runners
22
+ with `/planner` and `/runners`, and no API key is needed if you plan with a coding
23
+ agent you already use.
33
24
 
34
- ```bash
35
- ordewell # full-screen terminal UI: chat on the left, plan on the right
36
- ordewell --help # every slash command is also a subcommand
37
- ```
25
+ Every command in the terminal UI is also a subcommand:
38
26
 
39
- `ordewell setup` walks through first-run configuration interactively.
27
+ ```bash
28
+ export AI_PROVIDER=claude-code # plan with Claude Code, Codex or OpenCode
40
29
 
41
- ## Requirements
30
+ ordewell plan --goal "Add rate limiting to the public API"
31
+ ordewell run
32
+ ordewell handoff review # read the diff
33
+ ordewell handoff merge # bring it onto your branch
34
+ ```
42
35
 
43
- Node.js ≥ 20, and **tmux** for the TUI on every platform — it is what backs each
44
- task's live terminal (`apt install tmux`, `brew install tmux`). Linux, macOS and
45
- Windows are all supported; on Windows, run the TUI under WSL.
36
+ Run `ordewell --help` for the full list, or `ordewell setup` for guided
37
+ configuration.
46
38
 
47
- Installing this package also installs `@ordewell/web`, the local API server the
48
- CLI and TUI drive over `127.0.0.1`. It starts on demand — you don't need to run
49
- it yourself.
39
+ This package also installs `@ordewell/web`, the local API server that the CLI and
40
+ terminal UI talk to over `127.0.0.1`. It starts on demand.
50
41
 
51
42
  ## Documentation
52
43
 
53
- Full documentation, including the VS Code extension, is at
54
- **[github.com/ordewell/ordewell](https://github.com/ordewell/ordewell)**.
44
+ Full documentation is at **[ordewell.ai/docs](https://ordewell.ai/docs)**, and the
45
+ source is at **[github.com/ordewell/ordewell](https://github.com/ordewell/ordewell)**.
46
+
47
+ ## License
55
48
 
56
- Licensed under the [Apache License 2.0](./LICENSE).
49
+ [Apache License 2.0](./LICENSE)
package/dist/main.js CHANGED
@@ -390,10 +390,15 @@ var WorkspaceInitNeededError = class extends Error {
390
390
  }
391
391
  workspace;
392
392
  };
393
- var ApiClient = class {
393
+ var SESSION_PATH = /^\/api\/(?:plans|sessions)\/([^/?]+)/;
394
+ var ApiClient = class _ApiClient {
395
+ /** Where a CLI invocation's sessions live, when a client is built without one: `--workspace`, else the cwd. */
396
+ static defaultWorkspace;
394
397
  port;
395
- constructor(port) {
398
+ workspace;
399
+ constructor(port, workspace) {
396
400
  this.port = port || DEFAULT_PORT;
401
+ this.workspace = workspace ?? _ApiClient.defaultWorkspace ?? process.cwd();
397
402
  }
398
403
  /**
399
404
  * Read at call time rather than at construction: a daemon restarted mid-run
@@ -403,7 +408,23 @@ var ApiClient = class {
403
408
  token() {
404
409
  return (0, import_core3.readDaemonToken)(this.port);
405
410
  }
406
- httpRequest(method, urlPath, body) {
411
+ /**
412
+ * A daemon holds only the sessions adopted since it started, so after a
413
+ * restart every session-scoped call answered "Session not found" until the
414
+ * user ran `ordewell sessions load`. The saved session is adopted here
415
+ * instead — idempotent for one the daemon still holds — and the call made
416
+ * once more; a 404 means the first attempt never ran, so the retry cannot
417
+ * act twice.
418
+ */
419
+ async httpRequest(method, urlPath, body) {
420
+ const res = await this.rawRequest(method, urlPath, body);
421
+ const sessionId = urlPath.match(SESSION_PATH)?.[1];
422
+ const missing = res.status === 404 && res.data?.error === "Session not found";
423
+ if (!missing || !sessionId || urlPath.split("?")[0].endsWith("/load")) return res;
424
+ const adopted2 = await this.rawRequest("POST", `/api/sessions/${sessionId}/load?workspace=${encodeURIComponent(this.workspace)}`);
425
+ return adopted2.status === 200 ? this.rawRequest(method, urlPath, body) : res;
426
+ }
427
+ rawRequest(method, urlPath, body) {
407
428
  return new Promise((resolve3, reject) => {
408
429
  const url = new URL(urlPath, `http://127.0.0.1:${this.port}`);
409
430
  const configuredTimeout = Number.parseInt(process.env.ORDEWELL_HTTP_TIMEOUT_MS || "", 10);
@@ -1065,7 +1086,7 @@ function isTransient(event) {
1065
1086
  // src/commands/plan.ts
1066
1087
  var import_core6 = require("@ordewell/core");
1067
1088
  function planTasks(plan) {
1068
- return plan?.tasks || [];
1089
+ return plan ? allTasksOf(plan) : [];
1069
1090
  }
1070
1091
  function hasCommittedPlan(plan) {
1071
1092
  return planTasks(plan).length > 0;
@@ -1133,7 +1154,7 @@ function printPlan(plan, sessionId, runners2, models) {
1133
1154
  return rp ? ` (${task.assignedModel.modelLabel} \xB7 ${label})` : ` (${task.assignedModel.modelLabel})`;
1134
1155
  };
1135
1156
  console.log(`
1136
- Plan: ${tasks.length} tasks (${aiCount} AI, ${manCount} Manual) \u2014 ${(plan.runners || runners2).join(", ")}`);
1157
+ Plan: ${tasks.length} task${tasks.length === 1 ? "" : "s"} (${aiCount} AI, ${manCount} Manual) \u2014 ${(plan.runners || runners2).join(", ")}`);
1137
1158
  console.log(`Session: ${sessionId}
1138
1159
  `);
1139
1160
  for (const t of tasks) {
@@ -7210,7 +7231,7 @@ cd into a directory that exists, or pass --workspace <path> naming one that does
7210
7231
  const targetPort = explicitPort ? resolvePort(subArgs) : await findFreePort();
7211
7232
  const { port, owned: ownedAtLaunch } = await ensureDaemonOwned(targetPort, { detached: false });
7212
7233
  let owned = ownedAtLaunch;
7213
- const api = new ApiClient(port);
7234
+ const api = new ApiClient(port, workspace);
7214
7235
  const conversationQueue = new ConversationQueue();
7215
7236
  let terminal;
7216
7237
  const autoMode = process.env.ORDEWELL_AUTONOMOUS_MODE;
@@ -7358,6 +7379,7 @@ async function main() {
7358
7379
  console.log(cliVersion());
7359
7380
  return;
7360
7381
  }
7382
+ ApiClient.defaultWorkspace = flag(argv, "--workspace") || void 0;
7361
7383
  const sessionAt = argv.indexOf("--session-id");
7362
7384
  if (sessionAt > 0 && argv[sessionAt + 1]) {
7363
7385
  argv[sessionAt + 1] = expandSessionId(argv[sessionAt + 1], flag(argv, "--workspace") || process.cwd());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordewell/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Ordewell CLI and TUI — plan, run and verify coding-agent tasks from the terminal.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Alessandro Costanzo Ciano",
@@ -48,8 +48,8 @@
48
48
  "typecheck": "tsc --noEmit"
49
49
  },
50
50
  "dependencies": {
51
- "@ordewell/core": "^0.5.2",
52
- "@ordewell/web": "^0.5.2",
51
+ "@ordewell/core": "^0.5.4",
52
+ "@ordewell/web": "^0.5.4",
53
53
  "string-width": "^7.2.0",
54
54
  "ws": "^8.18.0"
55
55
  },