minutework 0.1.0 → 0.1.2
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 +10 -0
- package/README.md +9 -0
- package/assets/claude-local/bundle.json +1 -13
- package/assets/claude-local/skills/README.md +2 -2
- package/dist/cli.js +0 -0
- package/dist/developer-client.d.ts +36 -0
- package/dist/developer-client.js +37 -4
- package/dist/developer-client.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +117 -50
- package/dist/index.js.map +1 -1
- package/dist/init-prompt.d.ts +11 -0
- package/dist/init-prompt.js +68 -0
- package/dist/init-prompt.js.map +1 -0
- package/dist/init.js +3 -3
- package/dist/init.js.map +1 -1
- package/dist/orchestrator-context.d.ts +13 -0
- package/dist/orchestrator-context.js +32 -0
- package/dist/orchestrator-context.js.map +1 -0
- package/dist/orchestrator-engine.d.ts +36 -0
- package/dist/orchestrator-engine.js +88 -0
- package/dist/orchestrator-engine.js.map +1 -0
- package/dist/orchestrator-state.d.ts +145 -0
- package/dist/orchestrator-state.js +211 -0
- package/dist/orchestrator-state.js.map +1 -0
- package/dist/orchestrator.d.ts +24 -0
- package/dist/orchestrator.js +599 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/paths.d.ts +1 -0
- package/dist/paths.js +1 -0
- package/dist/paths.js.map +1 -1
- package/dist/reporting.d.ts +53 -0
- package/dist/reporting.js +676 -0
- package/dist/reporting.js.map +1 -0
- package/dist/session-prompt.d.ts +11 -0
- package/dist/session-prompt.js +98 -0
- package/dist/session-prompt.js.map +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.js +8 -0
- package/dist/state.js.map +1 -1
- package/package.json +17 -16
package/EXTERNAL_ALPHA.md
CHANGED
|
@@ -18,6 +18,8 @@ npx minutework deploy --preview
|
|
|
18
18
|
|
|
19
19
|
Anything outside that path is intentionally deferred.
|
|
20
20
|
|
|
21
|
+
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
|
+
|
|
21
23
|
## What `link` does
|
|
22
24
|
|
|
23
25
|
`minutework link` is no longer tenant-only. It now:
|
|
@@ -66,6 +68,14 @@ The CLI does not fabricate success. If the backend cannot materialize a hosted p
|
|
|
66
68
|
- Missing provider/receipt substrate: deploy returns a typed failure receipt
|
|
67
69
|
- Failed preview deploy with an existing preview target: the platform reports `rolled_back` with `previous_preview_preserved`
|
|
68
70
|
|
|
71
|
+
## CLI bug reports
|
|
72
|
+
|
|
73
|
+
- The CLI automatically submits a sanitized bug report for failed commands unless `MW_CLI_BUG_REPORTS=never` is set.
|
|
74
|
+
- Automatic reports keep a local JSON bundle under the MinuteWork CLI state root for retry and support follow-up.
|
|
75
|
+
- `minutework report-bug --note "..."` sends a manual report for UX issues or suspicious behavior that did not crash.
|
|
76
|
+
- `minutework report-bug --last --note "..."` resends the last saved bundle with extra context.
|
|
77
|
+
- Support should always ask for the printed `report_id` before requesting extra screenshots or logs.
|
|
78
|
+
|
|
69
79
|
## Release notes for operators
|
|
70
80
|
|
|
71
81
|
- Package versioning stays manual for the first alpha.
|
package/README.md
CHANGED
|
@@ -43,6 +43,15 @@ npx minutework deploy --preview
|
|
|
43
43
|
|
|
44
44
|
`deploy --preview` always revalidates and recompiles before submit, prints a local-vs-remote diff, requires confirmation unless `--yes` is passed, polls typed receipts until a terminal state, and persists the last known preview deploy state under `.minutework/deploy/preview/status.json`.
|
|
45
45
|
|
|
46
|
+
## Bug reporting
|
|
47
|
+
|
|
48
|
+
CLI failures automatically send a sanitized diagnostic report to the MinuteWork platform unless `MW_CLI_BUG_REPORTS=never` is set.
|
|
49
|
+
|
|
50
|
+
- Automatic reports never include raw `.env` contents, tokens, source files, or full local paths.
|
|
51
|
+
- The CLI keeps a local report bundle under the MinuteWork state root so you can retry or inspect what was sent.
|
|
52
|
+
- Use `minutework report-bug --note "what happened"` for manual reports.
|
|
53
|
+
- Use `minutework report-bug --last --note "extra context"` to resend the last saved bundle with more detail.
|
|
54
|
+
|
|
46
55
|
## Requirements
|
|
47
56
|
|
|
48
57
|
- Node.js 18 or newer
|
|
@@ -5,18 +5,6 @@
|
|
|
5
5
|
"output": "CLAUDE.md"
|
|
6
6
|
},
|
|
7
7
|
"directories": {
|
|
8
|
-
"skills": "skills"
|
|
9
|
-
"hooks": "hooks",
|
|
10
|
-
"reference": "reference"
|
|
11
|
-
},
|
|
12
|
-
"local_export": {
|
|
13
|
-
"include": [
|
|
14
|
-
"CLAUDE.md.template",
|
|
15
|
-
"skills/**"
|
|
16
|
-
],
|
|
17
|
-
"exclude": [
|
|
18
|
-
"hooks/**",
|
|
19
|
-
"reference/**"
|
|
20
|
-
]
|
|
8
|
+
"skills": "skills"
|
|
21
9
|
}
|
|
22
10
|
}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
Place focused MinuteWork architecture skills here.
|
|
4
4
|
|
|
5
|
-
These files are part of the canonical Builder bundle and are allowlisted
|
|
6
|
-
developer-local export.
|
|
5
|
+
These files are part of the canonical Builder common bundle and are allowlisted
|
|
6
|
+
for developer-local export. Skills are shared across all engine renderers.
|
package/dist/cli.js
CHANGED
|
File without changes
|
|
@@ -61,6 +61,36 @@ export type DeveloperPublicSitePreviewDeployResponse = {
|
|
|
61
61
|
export type DeveloperClientDependencies = {
|
|
62
62
|
fetchImpl?: typeof fetch;
|
|
63
63
|
};
|
|
64
|
+
export type CliBugReportRequest = {
|
|
65
|
+
auth: Record<string, unknown>;
|
|
66
|
+
cli_version: string;
|
|
67
|
+
command_args_shape: string[];
|
|
68
|
+
command_name: string;
|
|
69
|
+
cwd_kind: string;
|
|
70
|
+
diagnostics: Record<string, unknown>;
|
|
71
|
+
error_code: string;
|
|
72
|
+
error_message: string;
|
|
73
|
+
error_name: string;
|
|
74
|
+
failure_kind: "command_failure" | "crash" | "manual";
|
|
75
|
+
fingerprint: string;
|
|
76
|
+
install_id: string;
|
|
77
|
+
node_version: string;
|
|
78
|
+
os_name: string;
|
|
79
|
+
package_manager: string;
|
|
80
|
+
redacted_stack: string;
|
|
81
|
+
schema_version: string;
|
|
82
|
+
user_note: string;
|
|
83
|
+
workspace: Record<string, unknown>;
|
|
84
|
+
};
|
|
85
|
+
export type CliBugReportResponse = {
|
|
86
|
+
fingerprint: string;
|
|
87
|
+
report_id: string;
|
|
88
|
+
status: string;
|
|
89
|
+
};
|
|
90
|
+
export declare class DeveloperApiRequestError extends Error {
|
|
91
|
+
status: number;
|
|
92
|
+
constructor(message: string, status: number);
|
|
93
|
+
}
|
|
64
94
|
export declare function createDeveloperClient(options: {
|
|
65
95
|
dependencies?: DeveloperClientDependencies;
|
|
66
96
|
profile: StoredAuthProfile;
|
|
@@ -86,3 +116,9 @@ export declare function createDeveloperClient(options: {
|
|
|
86
116
|
workspaceName: string;
|
|
87
117
|
}): Promise<DeveloperPublicSitePreviewDeployResponse>;
|
|
88
118
|
};
|
|
119
|
+
export declare function submitCliBugReport(options: {
|
|
120
|
+
dependencies?: DeveloperClientDependencies;
|
|
121
|
+
payload: CliBugReportRequest;
|
|
122
|
+
platformBaseUrl: string;
|
|
123
|
+
profile?: StoredAuthProfile | null;
|
|
124
|
+
}): Promise<CliBugReportResponse>;
|
package/dist/developer-client.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export class DeveloperApiRequestError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
constructor(message, status) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "DeveloperApiRequestError";
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
1
9
|
export function createDeveloperClient(options) {
|
|
2
10
|
const fetchImpl = options.dependencies?.fetchImpl ?? fetch;
|
|
3
11
|
const tenantId = options.profile.tenantId;
|
|
@@ -62,17 +70,42 @@ export function createDeveloperClient(options) {
|
|
|
62
70
|
},
|
|
63
71
|
};
|
|
64
72
|
}
|
|
73
|
+
export async function submitCliBugReport(options) {
|
|
74
|
+
const fetchImpl = options.dependencies?.fetchImpl ?? fetch;
|
|
75
|
+
const response = await fetchImpl(new URL("/api/v1/developer/cli-bug-reports/", `${options.platformBaseUrl}/`).toString(), {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/json",
|
|
79
|
+
...(options.profile
|
|
80
|
+
? {
|
|
81
|
+
Authorization: `Bearer ${options.profile.token}`,
|
|
82
|
+
"X-Tenant-Id": options.profile.tenantId,
|
|
83
|
+
}
|
|
84
|
+
: {}),
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify(options.payload),
|
|
87
|
+
});
|
|
88
|
+
const payload = (await response.json().catch(() => ({})));
|
|
89
|
+
if (!response.ok) {
|
|
90
|
+
throw developerApiRequestError({
|
|
91
|
+
actionLabel: "submit a CLI bug report",
|
|
92
|
+
detail: String(payload.detail || ""),
|
|
93
|
+
status: response.status,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return payload;
|
|
97
|
+
}
|
|
65
98
|
function developerApiRequestError(options) {
|
|
66
99
|
const detail = options.detail.trim();
|
|
67
100
|
if (options.status === 401) {
|
|
68
|
-
return new
|
|
101
|
+
return new DeveloperApiRequestError(`Authentication failed while attempting to ${options.actionLabel}. Run \`minutework login\` first.`, options.status);
|
|
69
102
|
}
|
|
70
103
|
if (options.status === 403) {
|
|
71
|
-
return new
|
|
104
|
+
return new DeveloperApiRequestError(detail || `You are not allowed to ${options.actionLabel} with the active CLI auth profile.`, options.status);
|
|
72
105
|
}
|
|
73
106
|
if (options.status === 404) {
|
|
74
|
-
return new
|
|
107
|
+
return new DeveloperApiRequestError(detail || `Unable to ${options.actionLabel}: the requested MinuteWork resource was not found.`, options.status);
|
|
75
108
|
}
|
|
76
|
-
return new
|
|
109
|
+
return new DeveloperApiRequestError(detail || `Unable to ${options.actionLabel}.`, options.status);
|
|
77
110
|
}
|
|
78
111
|
//# sourceMappingURL=developer-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"developer-client.js","sourceRoot":"","sources":["../src/developer-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"developer-client.js","sourceRoot":"","sources":["../src/developer-client.ts"],"names":[],"mappings":"AAoGA,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,MAAM,CAAS;IAEf,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,UAAU,qBAAqB,CAAC,OAGrC;IACC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,SAAS,IAAI,KAAK,CAAC;IAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC1C,MAAM,OAAO,GAAG;QACd,aAAa,EAAE,UAAU,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE;QAChD,cAAc,EAAE,kBAAkB;QAClC,aAAa,EAAE,QAAQ;KACxB,CAAC;IAEF,KAAK,UAAU,WAAW,CACxB,WAAmB,EACnB,IAAiB,EACjB,WAAmB;QAEnB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACvG,GAAG,IAAI;YACP,OAAO,EAAE;gBACP,GAAG,OAAO;gBACV,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;aACxB;SACF,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAA4B,CAAC;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AAM,wBAAwB,CAAC;YAC7B,WAAW,EAAE,yBAAyB;YACtC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;YACpC,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAA+B,CAAC;AACzC,CAAC;AAED,SAAS,wBAAwB,CAAC,OAIjC;IACC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC3B,OAAO,IAAI,wBAAwB,CACjC,6CAA6C,OAAO,CAAC,WAAW,mCAAmC,EACnG,OAAO,CAAC,MAAM,CACf,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC3B,OAAO,IAAI,wBAAwB,CACjC,MAAM,IAAI,0BAA0B,OAAO,CAAC,WAAW,oCAAoC,EAC3F,OAAO,CAAC,MAAM,CACf,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC3B,OAAO,IAAI,wBAAwB,CACjC,MAAM,IAAI,aAAa,OAAO,CAAC,WAAW,oDAAoD,EAC9F,OAAO,CAAC,MAAM,CACf,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,wBAAwB,CAAC,MAAM,IAAI,aAAa,OAAO,CAAC,WAAW,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACrG,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type LinkDependencies, type LoginDependencies } from "./auth.js";
|
|
2
2
|
import { type DeployDependencies } from "./deploy.js";
|
|
3
3
|
import { resolveCliStatePaths, type PlatformName } from "./paths.js";
|
|
4
|
+
import { type OrchestratorDependencies } from "./orchestrator.js";
|
|
5
|
+
import { type BugReportDependencies } from "./reporting.js";
|
|
4
6
|
import { type LocalRuntimeDependencies } from "./sandbox.js";
|
|
5
7
|
import { type TokensDependencies } from "./tokens.js";
|
|
6
8
|
export type CliIo = {
|
|
@@ -8,12 +10,14 @@ export type CliIo = {
|
|
|
8
10
|
stderr: (message: string) => void;
|
|
9
11
|
};
|
|
10
12
|
export type RunCliOptions = {
|
|
13
|
+
bugReportDependencies?: BugReportDependencies;
|
|
11
14
|
cwd?: string;
|
|
12
15
|
deployDependencies?: DeployDependencies;
|
|
13
16
|
env?: NodeJS.ProcessEnv;
|
|
14
17
|
linkDependencies?: LinkDependencies;
|
|
15
18
|
loginDependencies?: LoginDependencies;
|
|
16
19
|
localRuntimeDependencies?: LocalRuntimeDependencies;
|
|
20
|
+
orchestratorDependencies?: OrchestratorDependencies;
|
|
17
21
|
mcpCommandRunner?: (options: {
|
|
18
22
|
args?: string[];
|
|
19
23
|
cwd?: string;
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,11 @@ import { runWorkspaceMcpCli } from "@minutework/workspace-mcp";
|
|
|
3
3
|
import { runEnvUseCommand, runLinkCommand, runLoginCommand, } from "./auth.js";
|
|
4
4
|
import { runCodegenCommand, runCompileCommand, runValidateCommand } from "./compile.js";
|
|
5
5
|
import { runDeployCommand } from "./deploy.js";
|
|
6
|
+
import { promptInitStarters, shouldOfferInteractiveStarterPrompt } from "./init-prompt.js";
|
|
6
7
|
import { STARTER_IDS, isStarterId, runInit } from "./init.js";
|
|
7
8
|
import { resolveCliStatePaths } from "./paths.js";
|
|
9
|
+
import { runSessionCommand } from "./orchestrator.js";
|
|
10
|
+
import { createCapturedIo, maybeAutoReportCliFailure, runReportBugCommand, } from "./reporting.js";
|
|
8
11
|
import { runDevCommand, runSandboxCommand, runTestCommand, } from "./sandbox.js";
|
|
9
12
|
import { runTokensCommand } from "./tokens.js";
|
|
10
13
|
export async function runCli(argv, options = {}, io = defaultIo) {
|
|
@@ -12,134 +15,186 @@ export async function runCli(argv, options = {}, io = defaultIo) {
|
|
|
12
15
|
const env = options.env ?? process.env;
|
|
13
16
|
const platform = options.platform ?? process.platform;
|
|
14
17
|
const cliStatePaths = resolveCliStatePaths({ env, platform });
|
|
18
|
+
const capturedIo = createCapturedIo(io);
|
|
15
19
|
const args = [...argv];
|
|
16
20
|
if (args.length === 0 || args[0] === "--help" || args[0] === "-h" || args[0] === "help") {
|
|
17
|
-
io.stdout(renderHelp());
|
|
21
|
+
capturedIo.io.stdout(renderHelp());
|
|
18
22
|
return 0;
|
|
19
23
|
}
|
|
20
24
|
const [command, ...rest] = args;
|
|
25
|
+
let exitCode = 0;
|
|
26
|
+
let failureKind = null;
|
|
27
|
+
let thrownError;
|
|
21
28
|
try {
|
|
22
29
|
if (command === "init") {
|
|
23
|
-
|
|
30
|
+
exitCode = await runInitCommand(rest, { cwd, env }, capturedIo.io);
|
|
24
31
|
}
|
|
25
|
-
if (command === "login") {
|
|
26
|
-
|
|
32
|
+
else if (command === "login") {
|
|
33
|
+
exitCode = await runLoginCommand({
|
|
27
34
|
args: rest,
|
|
28
35
|
cwd,
|
|
29
36
|
dependencies: options.loginDependencies,
|
|
30
37
|
env,
|
|
31
|
-
io,
|
|
38
|
+
io: capturedIo.io,
|
|
32
39
|
paths: cliStatePaths,
|
|
33
40
|
platform,
|
|
34
41
|
});
|
|
35
42
|
}
|
|
36
|
-
if (command === "link") {
|
|
37
|
-
|
|
43
|
+
else if (command === "link") {
|
|
44
|
+
exitCode = await runLinkCommand({
|
|
38
45
|
args: rest,
|
|
39
46
|
cwd,
|
|
40
47
|
dependencies: options.linkDependencies,
|
|
41
48
|
env,
|
|
42
|
-
io,
|
|
49
|
+
io: capturedIo.io,
|
|
43
50
|
paths: cliStatePaths,
|
|
44
51
|
platform,
|
|
45
52
|
});
|
|
46
53
|
}
|
|
47
|
-
if (command === "mcp") {
|
|
48
|
-
|
|
54
|
+
else if (command === "mcp") {
|
|
55
|
+
exitCode = await runMcpCommand(rest, options, capturedIo.io);
|
|
49
56
|
}
|
|
50
|
-
if (command === "
|
|
51
|
-
|
|
57
|
+
else if (command === "session") {
|
|
58
|
+
exitCode = await runSessionCommand({
|
|
59
|
+
args: rest,
|
|
60
|
+
cwd,
|
|
61
|
+
dependencies: options.orchestratorDependencies,
|
|
62
|
+
env,
|
|
63
|
+
io: capturedIo.io,
|
|
64
|
+
paths: cliStatePaths,
|
|
65
|
+
platform,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else if (command === "report-bug") {
|
|
69
|
+
exitCode = await runReportBugCommand({
|
|
70
|
+
args: rest,
|
|
71
|
+
cwd,
|
|
72
|
+
dependencies: options.bugReportDependencies,
|
|
73
|
+
env,
|
|
74
|
+
io: capturedIo.io,
|
|
75
|
+
paths: cliStatePaths,
|
|
76
|
+
platform,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else if (command === "tokens") {
|
|
80
|
+
exitCode = await runTokensCommand({
|
|
52
81
|
args: rest,
|
|
53
82
|
cwd,
|
|
54
83
|
dependencies: options.tokensDependencies,
|
|
55
84
|
env,
|
|
56
|
-
io,
|
|
85
|
+
io: capturedIo.io,
|
|
57
86
|
paths: cliStatePaths,
|
|
58
87
|
platform,
|
|
59
88
|
});
|
|
60
89
|
}
|
|
61
|
-
if (command === "validate") {
|
|
62
|
-
|
|
90
|
+
else if (command === "validate") {
|
|
91
|
+
exitCode = await runValidateCommand({
|
|
63
92
|
args: rest,
|
|
64
93
|
cwd,
|
|
65
|
-
io,
|
|
94
|
+
io: capturedIo.io,
|
|
66
95
|
});
|
|
67
96
|
}
|
|
68
|
-
if (command === "compile") {
|
|
69
|
-
|
|
97
|
+
else if (command === "compile") {
|
|
98
|
+
exitCode = await runCompileCommand({
|
|
70
99
|
args: rest,
|
|
71
100
|
cwd,
|
|
72
|
-
io,
|
|
101
|
+
io: capturedIo.io,
|
|
73
102
|
});
|
|
74
103
|
}
|
|
75
|
-
if (command === "codegen") {
|
|
76
|
-
|
|
104
|
+
else if (command === "codegen") {
|
|
105
|
+
exitCode = await runCodegenCommand({
|
|
77
106
|
args: rest,
|
|
78
107
|
cwd,
|
|
79
|
-
io,
|
|
108
|
+
io: capturedIo.io,
|
|
80
109
|
});
|
|
81
110
|
}
|
|
82
|
-
if (command === "sandbox") {
|
|
83
|
-
|
|
111
|
+
else if (command === "sandbox") {
|
|
112
|
+
exitCode = await runSandboxCommand({
|
|
84
113
|
args: rest,
|
|
85
114
|
cwd,
|
|
86
115
|
env,
|
|
87
|
-
io,
|
|
116
|
+
io: capturedIo.io,
|
|
88
117
|
platform,
|
|
89
118
|
});
|
|
90
119
|
}
|
|
91
|
-
if (command === "dev") {
|
|
92
|
-
|
|
120
|
+
else if (command === "dev") {
|
|
121
|
+
exitCode = await runDevCommand({
|
|
93
122
|
args: rest,
|
|
94
123
|
cwd,
|
|
95
124
|
dependencies: options.localRuntimeDependencies,
|
|
96
125
|
env,
|
|
97
|
-
io,
|
|
126
|
+
io: capturedIo.io,
|
|
98
127
|
platform,
|
|
99
128
|
});
|
|
100
129
|
}
|
|
101
|
-
if (command === "test") {
|
|
102
|
-
|
|
130
|
+
else if (command === "test") {
|
|
131
|
+
exitCode = await runTestCommand({
|
|
103
132
|
args: rest,
|
|
104
133
|
cwd,
|
|
105
134
|
dependencies: options.localRuntimeDependencies,
|
|
106
135
|
env,
|
|
107
|
-
io,
|
|
136
|
+
io: capturedIo.io,
|
|
108
137
|
platform,
|
|
109
138
|
});
|
|
110
139
|
}
|
|
111
|
-
if (command === "deploy") {
|
|
112
|
-
|
|
140
|
+
else if (command === "deploy") {
|
|
141
|
+
exitCode = await runDeployCommand({
|
|
113
142
|
args: rest,
|
|
114
143
|
cwd,
|
|
115
144
|
dependencies: options.deployDependencies,
|
|
116
145
|
env,
|
|
117
|
-
io,
|
|
146
|
+
io: capturedIo.io,
|
|
118
147
|
paths: cliStatePaths,
|
|
119
148
|
platform,
|
|
120
149
|
});
|
|
121
150
|
}
|
|
122
|
-
if (command === "env") {
|
|
151
|
+
else if (command === "env") {
|
|
123
152
|
if (rest[0] === "use") {
|
|
124
|
-
|
|
153
|
+
exitCode = await runEnvUseCommand({
|
|
125
154
|
args: rest.slice(1),
|
|
126
155
|
cwd,
|
|
127
|
-
io,
|
|
156
|
+
io: capturedIo.io,
|
|
128
157
|
platform,
|
|
129
158
|
});
|
|
130
159
|
}
|
|
131
|
-
|
|
132
|
-
|
|
160
|
+
else {
|
|
161
|
+
capturedIo.io.stderr('Unknown "env" subcommand. Reserved surface: minutework env use');
|
|
162
|
+
exitCode = 1;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
capturedIo.io.stderr(`Unknown command: ${command}`);
|
|
167
|
+
capturedIo.io.stderr("");
|
|
168
|
+
capturedIo.io.stderr(renderHelp());
|
|
169
|
+
exitCode = 1;
|
|
133
170
|
}
|
|
134
|
-
io.stderr(`Unknown command: ${command}`);
|
|
135
|
-
io.stderr("");
|
|
136
|
-
io.stderr(renderHelp());
|
|
137
|
-
return 1;
|
|
138
171
|
}
|
|
139
172
|
catch (error) {
|
|
140
|
-
|
|
141
|
-
|
|
173
|
+
thrownError = error;
|
|
174
|
+
failureKind = "crash";
|
|
175
|
+
capturedIo.io.stderr(error instanceof Error ? error.message : String(error));
|
|
176
|
+
exitCode = 1;
|
|
177
|
+
}
|
|
178
|
+
if (exitCode !== 0) {
|
|
179
|
+
if (!failureKind) {
|
|
180
|
+
failureKind = "command_failure";
|
|
181
|
+
}
|
|
182
|
+
await maybeAutoReportCliFailure({
|
|
183
|
+
args: rest,
|
|
184
|
+
command,
|
|
185
|
+
cwd,
|
|
186
|
+
dependencies: options.bugReportDependencies,
|
|
187
|
+
env,
|
|
188
|
+
failureKind,
|
|
189
|
+
io: capturedIo.io,
|
|
190
|
+
paths: cliStatePaths,
|
|
191
|
+
platform,
|
|
192
|
+
stderrLines: capturedIo.stderr,
|
|
193
|
+
stdoutLines: capturedIo.stdout,
|
|
194
|
+
thrownError,
|
|
195
|
+
});
|
|
142
196
|
}
|
|
197
|
+
return exitCode;
|
|
143
198
|
}
|
|
144
199
|
export { resolveCliStatePaths };
|
|
145
200
|
async function runInitCommand(args, options, io) {
|
|
@@ -182,21 +237,25 @@ async function runInitCommand(args, options, io) {
|
|
|
182
237
|
targetDirectory = arg;
|
|
183
238
|
sawTarget = true;
|
|
184
239
|
}
|
|
240
|
+
let startersForInit = selectedStarters;
|
|
241
|
+
if (selectedStarters.size === 0 && shouldOfferInteractiveStarterPrompt(options.env)) {
|
|
242
|
+
startersForInit = await promptInitStarters(io);
|
|
243
|
+
}
|
|
185
244
|
const result = await runInit({
|
|
186
245
|
cwd: options.cwd,
|
|
187
246
|
targetDirectory,
|
|
188
247
|
starters: {
|
|
189
|
-
tenantApp:
|
|
190
|
-
sidecar:
|
|
248
|
+
tenantApp: startersForInit.has("tenant-app"),
|
|
249
|
+
sidecar: startersForInit.has("sidecar"),
|
|
191
250
|
},
|
|
192
251
|
});
|
|
193
252
|
io.stdout(`Initialized MinuteWork workspace in ${path.relative(options.cwd, result.rootDirectory) || "."}.`);
|
|
194
253
|
io.stdout(`Workspace slug: ${result.workspaceSlug}`);
|
|
195
254
|
io.stdout(`Selected starters: ${formatStarters({
|
|
196
|
-
tenantApp:
|
|
197
|
-
sidecar:
|
|
255
|
+
tenantApp: startersForInit.has("tenant-app"),
|
|
256
|
+
sidecar: startersForInit.has("sidecar"),
|
|
198
257
|
})}`);
|
|
199
|
-
if (
|
|
258
|
+
if (startersForInit.size === 0) {
|
|
200
259
|
io.stdout("No app starters were selected. This workspace contains only the base MinuteWork repo contract.");
|
|
201
260
|
}
|
|
202
261
|
return 0;
|
|
@@ -231,9 +290,11 @@ Usage:
|
|
|
231
290
|
minutework test
|
|
232
291
|
minutework deploy --preview
|
|
233
292
|
minutework sandbox status
|
|
293
|
+
minutework session start [--mode <human|ai>] [--engine <claude>]
|
|
234
294
|
minutework env use
|
|
235
295
|
minutework tokens
|
|
236
296
|
minutework mcp
|
|
297
|
+
minutework report-bug
|
|
237
298
|
|
|
238
299
|
Wave 2 status:
|
|
239
300
|
init Available
|
|
@@ -246,9 +307,11 @@ Wave 2 status:
|
|
|
246
307
|
test Available
|
|
247
308
|
deploy Preview available
|
|
248
309
|
sandbox Status available
|
|
310
|
+
session Launcher/broker preview available
|
|
249
311
|
env use Available
|
|
250
312
|
tokens Available
|
|
251
313
|
mcp Available
|
|
314
|
+
report-bug Available
|
|
252
315
|
|
|
253
316
|
Starter notes:
|
|
254
317
|
tenant-app Combined web starter with public root routes and a private /app workspace
|
|
@@ -271,6 +334,10 @@ Options:
|
|
|
271
334
|
--starter Materialize a starter into the generated workspace. Repeat for multiple starters.
|
|
272
335
|
--tenant-app Compatibility alias for "--starter tenant-app"
|
|
273
336
|
--sidecar Compatibility alias for "--starter sidecar"
|
|
337
|
+
|
|
338
|
+
Interactive:
|
|
339
|
+
With no --starter flags, if stdin is a TTY and CI/MW_CLI_NONINTERACTIVE are unset, you will be prompted
|
|
340
|
+
to choose starters. Set MW_CLI_NONINTERACTIVE=1 (or CI=1) to skip the prompt and keep base-only scaffold.
|
|
274
341
|
`;
|
|
275
342
|
}
|
|
276
343
|
function parseStarterId(value) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,GAGhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAqB,MAAM,YAAY,CAA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AG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC;AAC3E,CAAC;AAED,SAAS,UAAU;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCR,CAAC;AACF,CAAC;AAED,SAAS,cAAc;IACrB,OAAO;;;;;;;;;;;;;;;;;;;CAmBR,CAAC;AACF,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,0BAA0B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,SAAS,GAAU;IACvB,MAAM,CAAC,OAAO;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACvC,CAAC;IACD,MAAM,CAAC,OAAO;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACvC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StarterId } from "./init.js";
|
|
2
|
+
export type CliIo = {
|
|
3
|
+
stderr: (message: string) => void;
|
|
4
|
+
stdout: (message: string) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Maps a single-line menu choice to starter ids. Empty string means default (tenant-app only).
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseInitStarterMenuInput(line: string): Set<StarterId>;
|
|
10
|
+
export declare function shouldOfferInteractiveStarterPrompt(env: NodeJS.ProcessEnv): boolean;
|
|
11
|
+
export declare function promptInitStarters(io: CliIo): Promise<Set<StarterId>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
const MENU_LINES = [
|
|
3
|
+
"",
|
|
4
|
+
"Choose starters for this workspace:",
|
|
5
|
+
" 1) Next.js tenant-app — public routes + private /app workspace",
|
|
6
|
+
" 2) FastAPI sidecar",
|
|
7
|
+
" 3) Both tenant-app and sidecar",
|
|
8
|
+
" 4) Base workspace only (schemas + MCP wiring; no app starters)",
|
|
9
|
+
"",
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Maps a single-line menu choice to starter ids. Empty string means default (tenant-app only).
|
|
13
|
+
*/
|
|
14
|
+
export function parseInitStarterMenuInput(line) {
|
|
15
|
+
const key = line.trim() === "" ? "1" : line.trim();
|
|
16
|
+
if (key === "1") {
|
|
17
|
+
return new Set(["tenant-app"]);
|
|
18
|
+
}
|
|
19
|
+
if (key === "2") {
|
|
20
|
+
return new Set(["sidecar"]);
|
|
21
|
+
}
|
|
22
|
+
if (key === "3") {
|
|
23
|
+
return new Set(["tenant-app", "sidecar"]);
|
|
24
|
+
}
|
|
25
|
+
if (key === "4") {
|
|
26
|
+
return new Set();
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`Invalid choice "${line.trim()}". Enter 1, 2, 3, or 4.`);
|
|
29
|
+
}
|
|
30
|
+
export function shouldOfferInteractiveStarterPrompt(env) {
|
|
31
|
+
if (env.MW_CLI_NONINTERACTIVE === "1" || env.MW_CLI_NONINTERACTIVE === "true") {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (env.CI === "1" || env.CI === "true") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
38
|
+
}
|
|
39
|
+
const MAX_ATTEMPTS = 5;
|
|
40
|
+
export async function promptInitStarters(io) {
|
|
41
|
+
const rl = createInterface({
|
|
42
|
+
input: process.stdin,
|
|
43
|
+
output: process.stdout,
|
|
44
|
+
});
|
|
45
|
+
try {
|
|
46
|
+
for (const line of MENU_LINES) {
|
|
47
|
+
io.stdout(line);
|
|
48
|
+
}
|
|
49
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt += 1) {
|
|
50
|
+
const raw = await rl.question("Enter 1–4 [default: 1]: ");
|
|
51
|
+
try {
|
|
52
|
+
return parseInitStarterMenuInput(raw);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
io.stderr(message);
|
|
57
|
+
if (attempt === MAX_ATTEMPTS) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
throw new Error("init starter prompt failed after maximum attempts.");
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
rl.close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=init-prompt.js.map
|