minutework 0.1.3 → 0.1.5

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.
package/EXTERNAL_ALPHA.md CHANGED
@@ -2,21 +2,71 @@
2
2
 
3
3
  This document is the operator-facing onboarding contract for the first external MinuteWork CLI alpha.
4
4
 
5
- ## Success path
5
+ ## Supported paths
6
6
 
7
- The supported path is:
7
+ Every supported external path starts with the same workspace/bootstrap flow:
8
8
 
9
9
  ```bash
10
10
  npx minutework init my-site --starter tenant-app
11
11
  cd my-site
12
12
  npx minutework login
13
13
  npx minutework link
14
- npx minutework dev
15
- npx minutework test
16
- npx minutework deploy --preview
17
14
  ```
18
15
 
19
- Anything outside that path is intentionally deferred.
16
+ From there, the current external alpha supports two post-link lanes.
17
+
18
+ ### Developer-local broker lane
19
+
20
+ Use `minutework session` when you want MinuteWork to assemble the workspace
21
+ snapshot, choose a local workflow mode, and optionally launch the first shipped
22
+ local coding engine.
23
+
24
+ ```bash
25
+ minutework session start --mode human
26
+ minutework session start --mode ai --engine claude
27
+ minutework session status
28
+ minutework session resume
29
+ ```
30
+
31
+ - `start` stores or updates the workspace preference, writes a bounded context
32
+ pack, and launches Claude when `--mode ai --engine claude` is selected.
33
+ - `status` prints the stored preference, current-session summary, and live lock
34
+ state as JSON.
35
+ - `resume` reuses the stored workspace preference and launches a fresh broker
36
+ session without accepting mode or engine overrides.
37
+ - `human` and `ai` are alternative start modes, not a required sequence.
38
+ - Claude is the only supported local coding engine today.
39
+ - AI mode now auto-installs and auto-updates managed Claude Code under the
40
+ machine-local MinuteWork CLI state root and prefers that managed binary over
41
+ any `claude` already on `PATH`.
42
+ - Claude authentication still happens outside MinuteWork. If Claude needs local
43
+ login or approval, complete that in Claude itself and rerun the MinuteWork
44
+ broker command.
45
+
46
+ The broker state model is intentionally split:
47
+
48
+ - repo-local pointer and lock state under `.minutework/` tracks the current
49
+ workspace session
50
+ - machine-local preferences, per-session context packs, transcripts, and
51
+ session history stay under the MinuteWork CLI state root
52
+
53
+ The broker fails closed when a live session is already active, the selected
54
+ engine is missing, a prior running record has gone stale, or the launch is
55
+ interrupted or fails mid-session.
56
+
57
+ ### Local preview and deploy lane
58
+
59
+ Use the existing local preview/test loop and hosted preview deploy lane when
60
+ you want to run the generated app locally or submit a hosted preview:
61
+
62
+ ```bash
63
+ minutework dev
64
+ minutework test
65
+ minutework deploy --preview
66
+ ```
67
+
68
+ Anything outside these lanes remains deferred, including `--live`,
69
+ runtime-backed deploy targets, and additional local coding engines.
20
70
 
21
71
  If you run `minutework init` **without** `--starter` in an interactive terminal, the CLI prompts for tenant-app, sidecar, both, or base-only. In CI or scripts, use `--starter` or set `MW_CLI_NONINTERACTIVE=1` to skip the prompt (base-only scaffold).
22
72
 
@@ -63,6 +113,9 @@ The CLI does not fabricate success. If the backend cannot materialize a hosted p
63
113
 
64
114
  - Missing auth: run `minutework login`
65
115
  - Missing binding: run `minutework link`
116
+ - Missing stored broker preference before resume: run `minutework session start --mode <human|ai>`
117
+ - Missing Claude binary or local Claude auth for AI mode: let MinuteWork retry the managed install when network access is available, or complete Claude authentication locally, then rerun `minutework session start --mode ai --engine claude`
118
+ - Live or stale local broker session state: inspect `minutework session status`, let the live process exit, or rerun `minutework session resume`
66
119
  - Missing property-scoped release metadata: fix `tenant-app/.env.example` and re-run `minutework compile`
67
120
  - Unsupported release class: external alpha only supports hosted `ssr_container`
68
121
  - Missing provider/receipt substrate: deploy returns a typed failure receipt
package/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # `minutework`
2
2
 
3
- MinuteWork CLI for initializing a workspace, authenticating against a MinuteWork platform, linking a repo to a tenant-scoped public-site property, running local preview/test loops, and submitting hosted preview deploys.
3
+ MinuteWork CLI for initializing a workspace, authenticating against a MinuteWork platform, linking a repo to a tenant-scoped public-site property, launching developer-local session broker flows, running local preview/test loops, and submitting hosted preview deploys.
4
4
 
5
5
  ## External alpha scope
6
6
 
7
7
  The current external alpha is intentionally narrow:
8
8
 
9
9
  - Starter: `tenant-app`
10
+ - Developer-local broker surface: `minutework session start|resume|status`
10
11
  - Hosted release class: `ssr_container`
11
12
  - Deploy surface: `minutework deploy --preview`
12
- - Deferred: `--live`, sidecar/runtime-backed deploys, marketplace publish flows
13
+ - Deferred: `--live`, additional local coding engines, sidecar/runtime-backed deploys, marketplace publish flows
13
14
 
14
15
  The CLI fails closed when the backend cannot provide typed release metadata, deploy status, receipts, activation state, or rollback state. It does not claim a successful deploy when the provider substrate is unavailable.
15
16
 
@@ -27,16 +28,58 @@ npm install --global minutework@alpha
27
28
 
28
29
  The package currently ships on a `0.x` alpha channel. Publish from this repo with the manual GitHub Actions workflow at `.github/workflows/minutework-cli-alpha-publish.yml`.
29
30
 
30
- ## External alpha path
31
+ ## External alpha paths
32
+
33
+ Start with the shared setup:
31
34
 
32
35
  ```bash
33
36
  npx minutework init my-site --starter tenant-app
34
37
  cd my-site
35
38
  npx minutework login
36
39
  npx minutework link
37
- npx minutework dev
38
- npx minutework test
39
- npx minutework deploy --preview
40
+ ```
41
+
42
+ After `link`, the current alpha has two supported lanes.
43
+
44
+ ### Developer-local broker lane
45
+
46
+ Use this lane when you want MinuteWork to assemble a bounded workspace context,
47
+ persist broker state locally, and either prepare a human-mode session or launch
48
+ the first supported local coding engine.
49
+
50
+ ```bash
51
+ minutework session start --mode human
52
+ minutework session start --mode ai --engine claude
53
+ minutework session status
54
+ minutework session resume
55
+ ```
56
+
57
+ - `human` and `ai` are alternative start modes, not a required sequence.
58
+ - Claude is the only supported local coding engine today.
59
+ - AI mode launches Claude with explicit workspace MCP bootstrap plus a bounded
60
+ MinuteWork context pack instead of relying on implicit shell state.
61
+ - MinuteWork now installs and updates managed Claude Code automatically under
62
+ the machine-local CLI state root when AI mode needs it, and prefers that
63
+ managed Claude binary over any `claude` already on `PATH`.
64
+ - Claude authentication still happens outside MinuteWork. If Claude needs local
65
+ login or account approval, complete that in Claude itself and rerun the
66
+ MinuteWork session command.
67
+ - Current-session coordination stays repo-local under `.minutework/`, while
68
+ preferences, per-session context packs, transcripts, and session history stay
69
+ machine-local under the MinuteWork CLI state root.
70
+ - The broker fails closed on live overlap, missing engine binaries, stale
71
+ session records, interrupts, and launch failures instead of allowing
72
+ overlapping phantom sessions.
73
+
74
+ ### Local preview and deploy lane
75
+
76
+ Use this lane when you want the workspace-local preview/test loop or a hosted
77
+ preview deploy:
78
+
79
+ ```bash
80
+ minutework dev
81
+ minutework test
82
+ minutework deploy --preview
40
83
  ```
41
84
 
42
85
  `link` provisions or resolves the default published-site property for the active tenant and stores that property key in repo-local state. The generated `tenant-app/.env.example` defaults to `MW_PUBLIC_SITE_PROPERTY_KEY=main-site` and `MW_PUBLIC_SITE_ENV=preview`.
@@ -0,0 +1,52 @@
1
+ import type { CliStatePaths, PlatformName } from "./paths.js";
2
+ export declare const MANAGED_CLAUDE_PACKAGE_NAME = "@anthropic-ai/claude-code";
3
+ export declare const MANAGED_CLAUDE_UPDATE_TTL_MS: number;
4
+ export type ManagedEngineSource = "managed" | "path";
5
+ export type ManagedEngineInstallStatus = "current" | "installed" | "missing" | "path_fallback" | "update_failed_reused" | "updated";
6
+ export type EngineCommandRunner = (options: {
7
+ args: readonly string[];
8
+ cwd: string;
9
+ env: NodeJS.ProcessEnv;
10
+ program: string;
11
+ }) => Promise<{
12
+ exitCode: number | null;
13
+ stderr: string;
14
+ stdout: string;
15
+ }>;
16
+ export type ManagedClaudeReadiness = {
17
+ detail: string;
18
+ engineInstallStatus: "missing";
19
+ engineSource: null;
20
+ engineVersion: null;
21
+ executablePath: null;
22
+ status: "missing_binary";
23
+ warnings: string[];
24
+ } | {
25
+ detail: string;
26
+ engineInstallStatus: Exclude<ManagedEngineInstallStatus, "missing">;
27
+ engineSource: ManagedEngineSource;
28
+ engineVersion: string | null;
29
+ executablePath: string;
30
+ status: "ready";
31
+ warnings: string[];
32
+ };
33
+ export type ManagedClaudePaths = {
34
+ executablePath: string;
35
+ lockPath: string;
36
+ metadataPath: string;
37
+ packageJsonPath: string;
38
+ packageRoot: string;
39
+ workspaceRoot: string;
40
+ };
41
+ type ResolveExecutable = (program: string) => Promise<string | null>;
42
+ export declare function resolveManagedClaudePaths(paths: CliStatePaths): ManagedClaudePaths;
43
+ export declare function ensureManagedClaudeReadiness(options: {
44
+ cliStatePaths: CliStatePaths;
45
+ env: NodeJS.ProcessEnv;
46
+ isProcessAlive?: (pid: number) => boolean;
47
+ now?: () => Date;
48
+ platform: PlatformName;
49
+ resolveExecutable: ResolveExecutable;
50
+ runCommand?: EngineCommandRunner;
51
+ }): Promise<ManagedClaudeReadiness>;
52
+ export {};