@tomflow/proflow-dev-tunnel 0.1.8 → 0.1.9
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/CHANGELOG.md +6 -0
- package/SETUP.md +8 -17
- package/dist/deployment/adapter.d.ts +34 -12
- package/dist/deployment/adapter.js +35 -2
- package/dist/deployment/descriptor.d.ts +1 -1
- package/dist/deployment/descriptor.js +1 -1
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +48 -0
- package/package.json +6 -3
- package/proflow.module.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tomflow/proflow-dev-tunnel
|
|
2
2
|
|
|
3
|
+
## 0.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Replace JSON terminal protocols with typed CLI outcomes, add real-time Chinese progress and lifecycle summaries, publish DOCS content, standardize executable setup plans and package-owned setup commands, and preserve only user-owned pnpm policy during uninstall.
|
|
8
|
+
|
|
3
9
|
## 0.1.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/SETUP.md
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
# @tomflow/proflow-dev-tunnel — Module Setup
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Step 2 — Create or select the persistent tunnel
|
|
12
|
-
**Type:** human/external
|
|
13
|
-
**Human action:** Create/select the tunnel and obtain its `tunnelId` and HTTPS public base URL.
|
|
14
|
-
**Verify/commit executable:** `platform setup --module dev-tunnel --workspace <workspace> --input '{"tunnelId":"<id>","publicBaseUrl":"https://<host>"}'`
|
|
15
|
-
|
|
16
|
-
## Step 3 — Verify completion
|
|
17
|
-
**Type:** automatic verification
|
|
18
|
-
**Executable:** `platform status --workspace <workspace>`
|
|
19
|
-
**Success condition:** `dev-tunnel.setupStatus=READY`. Other Modules consume the resulting public URL through shared facts; the user does not copy it into their configs.
|
|
3
|
+
## STEP-DEV-TUNNEL-01 — 选择或创建持久 Tunnel
|
|
4
|
+
|
|
5
|
+
Responsible: USER
|
|
6
|
+
Interactive executable: `proflow-dev-tunnel setup`
|
|
7
|
+
Non-interactive executable: `proflow-dev-tunnel setup --tunnel-id <id> --public-base-url <url>`
|
|
8
|
+
Required inputs: Tunnel ID、公开 HTTPS URL
|
|
9
|
+
Verify: `proflow-dev-tunnel verify`
|
|
10
|
+
Success condition: `dev-tunnel.setupStatus=READY`.
|
|
@@ -6,7 +6,7 @@ export declare const behaviorAdapter: {
|
|
|
6
6
|
readonly ok: true;
|
|
7
7
|
readonly status: "SUCCEEDED";
|
|
8
8
|
readonly moduleRef: "dev-tunnel";
|
|
9
|
-
readonly moduleVersion: "0.1.
|
|
9
|
+
readonly moduleVersion: "0.1.9";
|
|
10
10
|
};
|
|
11
11
|
observedEffects: never[];
|
|
12
12
|
}>;
|
|
@@ -16,14 +16,14 @@ export declare const behaviorAdapter: {
|
|
|
16
16
|
readonly ok: true;
|
|
17
17
|
readonly status: "SUCCEEDED";
|
|
18
18
|
readonly moduleRef: "dev-tunnel";
|
|
19
|
-
readonly moduleVersion: "0.1.
|
|
19
|
+
readonly moduleVersion: "0.1.9";
|
|
20
20
|
};
|
|
21
21
|
observedEffects: string[];
|
|
22
22
|
} | {
|
|
23
23
|
result: {
|
|
24
24
|
contract: "deployment.result.v1";
|
|
25
25
|
moduleRef: "dev-tunnel";
|
|
26
|
-
moduleVersion: "0.1.
|
|
26
|
+
moduleVersion: "0.1.9";
|
|
27
27
|
ok: false;
|
|
28
28
|
status: "FAILED";
|
|
29
29
|
error: {
|
|
@@ -40,7 +40,7 @@ export declare const behaviorAdapter: {
|
|
|
40
40
|
ok: true;
|
|
41
41
|
status: "SUCCEEDED";
|
|
42
42
|
moduleRef: "dev-tunnel";
|
|
43
|
-
moduleVersion: "0.1.
|
|
43
|
+
moduleVersion: "0.1.9";
|
|
44
44
|
data: {
|
|
45
45
|
setupStatus: "ACTION_REQUIRED" | "READY";
|
|
46
46
|
runtimeStatus: "FAILED" | "RUNNING" | "STOPPED";
|
|
@@ -52,9 +52,32 @@ export declare const behaviorAdapter: {
|
|
|
52
52
|
result: {
|
|
53
53
|
contract: "deployment.result.v1";
|
|
54
54
|
moduleRef: "dev-tunnel";
|
|
55
|
-
moduleVersion: "0.1.
|
|
55
|
+
moduleVersion: "0.1.9";
|
|
56
56
|
ok: false;
|
|
57
57
|
status: "ACTION_REQUIRED";
|
|
58
|
+
data: {
|
|
59
|
+
readonly steps: readonly [{
|
|
60
|
+
readonly id: "STEP-DEV-TUNNEL-01";
|
|
61
|
+
readonly title: "选择或创建持久 Tunnel";
|
|
62
|
+
readonly state: "TODO";
|
|
63
|
+
readonly responsible: "USER";
|
|
64
|
+
readonly execution: {
|
|
65
|
+
readonly interactive: "proflow-dev-tunnel setup";
|
|
66
|
+
readonly nonInteractive: "proflow-dev-tunnel setup --tunnel-id <id> --public-base-url <url>";
|
|
67
|
+
};
|
|
68
|
+
readonly requiredInputs: readonly [{
|
|
69
|
+
readonly name: "tunnelId";
|
|
70
|
+
readonly description: "Tunnel ID";
|
|
71
|
+
readonly sensitive: false;
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "publicBaseUrl";
|
|
74
|
+
readonly description: "公开 HTTPS URL";
|
|
75
|
+
readonly sensitive: false;
|
|
76
|
+
}];
|
|
77
|
+
readonly verify: "proflow-dev-tunnel verify";
|
|
78
|
+
readonly successCondition: "配置状态变为“已就绪”";
|
|
79
|
+
}];
|
|
80
|
+
};
|
|
58
81
|
actionRequired: {
|
|
59
82
|
action: string;
|
|
60
83
|
description: string;
|
|
@@ -67,7 +90,7 @@ export declare const behaviorAdapter: {
|
|
|
67
90
|
readonly ok: true;
|
|
68
91
|
readonly status: "SUCCEEDED";
|
|
69
92
|
readonly moduleRef: "dev-tunnel";
|
|
70
|
-
readonly moduleVersion: "0.1.
|
|
93
|
+
readonly moduleVersion: "0.1.9";
|
|
71
94
|
};
|
|
72
95
|
observedEffects: never[];
|
|
73
96
|
}>;
|
|
@@ -77,10 +100,9 @@ export declare const behaviorAdapter: {
|
|
|
77
100
|
ok: true;
|
|
78
101
|
status: "SUCCEEDED";
|
|
79
102
|
moduleRef: "dev-tunnel";
|
|
80
|
-
moduleVersion: "0.1.
|
|
103
|
+
moduleVersion: "0.1.9";
|
|
81
104
|
data: {
|
|
82
105
|
docs: string;
|
|
83
|
-
setup: string;
|
|
84
106
|
};
|
|
85
107
|
};
|
|
86
108
|
observedEffects: never[];
|
|
@@ -89,7 +111,7 @@ export declare const behaviorAdapter: {
|
|
|
89
111
|
result: {
|
|
90
112
|
contract: "deployment.result.v1";
|
|
91
113
|
moduleRef: "dev-tunnel";
|
|
92
|
-
moduleVersion: "0.1.
|
|
114
|
+
moduleVersion: "0.1.9";
|
|
93
115
|
ok: false;
|
|
94
116
|
status: "FAILED";
|
|
95
117
|
error: {
|
|
@@ -105,7 +127,7 @@ export declare const behaviorAdapter: {
|
|
|
105
127
|
ok: true;
|
|
106
128
|
status: "SUCCEEDED";
|
|
107
129
|
moduleRef: "dev-tunnel";
|
|
108
|
-
moduleVersion: "0.1.
|
|
130
|
+
moduleVersion: "0.1.9";
|
|
109
131
|
data: import("../src/resource-adapter.ts").DevTunnelObservation;
|
|
110
132
|
};
|
|
111
133
|
observedEffects: string[];
|
|
@@ -116,14 +138,14 @@ export declare const behaviorAdapter: {
|
|
|
116
138
|
readonly ok: true;
|
|
117
139
|
readonly status: "SUCCEEDED";
|
|
118
140
|
readonly moduleRef: "dev-tunnel";
|
|
119
|
-
readonly moduleVersion: "0.1.
|
|
141
|
+
readonly moduleVersion: "0.1.9";
|
|
120
142
|
};
|
|
121
143
|
observedEffects: string[];
|
|
122
144
|
} | {
|
|
123
145
|
result: {
|
|
124
146
|
contract: "deployment.result.v1";
|
|
125
147
|
moduleRef: "dev-tunnel";
|
|
126
|
-
moduleVersion: "0.1.
|
|
148
|
+
moduleVersion: "0.1.9";
|
|
127
149
|
ok: false;
|
|
128
150
|
status: "FAILED";
|
|
129
151
|
error: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
4
|
import { writeModuleSharedFacts, } from "@tomflow/proflow-module-contract";
|
|
@@ -10,6 +11,30 @@ const base = {
|
|
|
10
11
|
moduleRef: descriptor.moduleRef,
|
|
11
12
|
moduleVersion: descriptor.moduleVersion,
|
|
12
13
|
};
|
|
14
|
+
const setupPlan = {
|
|
15
|
+
steps: [
|
|
16
|
+
{
|
|
17
|
+
id: "STEP-DEV-TUNNEL-01",
|
|
18
|
+
title: "选择或创建持久 Tunnel",
|
|
19
|
+
state: "TODO",
|
|
20
|
+
responsible: "USER",
|
|
21
|
+
execution: {
|
|
22
|
+
interactive: "proflow-dev-tunnel setup",
|
|
23
|
+
nonInteractive: "proflow-dev-tunnel setup --tunnel-id <id> --public-base-url <url>",
|
|
24
|
+
},
|
|
25
|
+
requiredInputs: [
|
|
26
|
+
{ name: "tunnelId", description: "Tunnel ID", sensitive: false },
|
|
27
|
+
{
|
|
28
|
+
name: "publicBaseUrl",
|
|
29
|
+
description: "公开 HTTPS URL",
|
|
30
|
+
sensitive: false,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
verify: "proflow-dev-tunnel verify",
|
|
34
|
+
successCondition: "配置状态变为“已就绪”",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
13
38
|
const processEffect = "Manage the dev-tunnel public ingress process";
|
|
14
39
|
const stateDir = (context) => join(resolve(context.workspaceRoot), ".proflow", "runtime", "external-resources", "dev-tunnel");
|
|
15
40
|
const stateFile = (context) => join(stateDir(context), "setup.json");
|
|
@@ -166,6 +191,7 @@ export const behaviorAdapter = {
|
|
|
166
191
|
...base,
|
|
167
192
|
ok: false,
|
|
168
193
|
status: "ACTION_REQUIRED",
|
|
194
|
+
data: setupPlan,
|
|
169
195
|
actionRequired: {
|
|
170
196
|
action: "complete-tunnel-login",
|
|
171
197
|
description: `Run devtunnel user login, complete Microsoft authentication, then rerun platform setup --module dev-tunnel --workspace ${JSON.stringify(context.workspaceRoot)}.`,
|
|
@@ -180,9 +206,10 @@ export const behaviorAdapter = {
|
|
|
180
206
|
...base,
|
|
181
207
|
ok: false,
|
|
182
208
|
status: "ACTION_REQUIRED",
|
|
209
|
+
data: setupPlan,
|
|
183
210
|
actionRequired: {
|
|
184
211
|
action: "select-or-create-tunnel",
|
|
185
|
-
description:
|
|
212
|
+
description: "Create/select the persistent tunnel, then run proflow-dev-tunnel setup --tunnel-id <id> --public-base-url <url>.",
|
|
186
213
|
},
|
|
187
214
|
},
|
|
188
215
|
observedEffects: [],
|
|
@@ -209,6 +236,7 @@ export const behaviorAdapter = {
|
|
|
209
236
|
...base,
|
|
210
237
|
ok: false,
|
|
211
238
|
status: "ACTION_REQUIRED",
|
|
239
|
+
data: setupPlan,
|
|
212
240
|
actionRequired: {
|
|
213
241
|
action: "correct-tunnel-facts",
|
|
214
242
|
description: error instanceof Error
|
|
@@ -221,7 +249,12 @@ export const behaviorAdapter = {
|
|
|
221
249
|
}
|
|
222
250
|
},
|
|
223
251
|
docs: async (_context) => ({
|
|
224
|
-
result: {
|
|
252
|
+
result: {
|
|
253
|
+
...base,
|
|
254
|
+
data: {
|
|
255
|
+
docs: readFileSync(new URL("../DOCS.md", import.meta.url), "utf8"),
|
|
256
|
+
},
|
|
257
|
+
},
|
|
225
258
|
observedEffects: [],
|
|
226
259
|
}),
|
|
227
260
|
start: async (context) => {
|
|
@@ -3,7 +3,7 @@ export declare const descriptor: {
|
|
|
3
3
|
readonly contractVersion: "1.0.0";
|
|
4
4
|
readonly moduleRef: "dev-tunnel";
|
|
5
5
|
readonly packageName: "@tomflow/proflow-dev-tunnel";
|
|
6
|
-
readonly moduleVersion: "0.1.
|
|
6
|
+
readonly moduleVersion: "0.1.9";
|
|
7
7
|
readonly kind: "external-resource";
|
|
8
8
|
readonly templateVersion: "1.0.0";
|
|
9
9
|
readonly platformCompatibility: ">=1.0.0 <2.0.0";
|
|
@@ -3,7 +3,7 @@ export const descriptor = {
|
|
|
3
3
|
contractVersion: "1.0.0",
|
|
4
4
|
moduleRef: "dev-tunnel",
|
|
5
5
|
packageName: "@tomflow/proflow-dev-tunnel",
|
|
6
|
-
moduleVersion: "0.1.
|
|
6
|
+
moduleVersion: "0.1.9",
|
|
7
7
|
kind: "external-resource",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
3
|
+
import { behaviorAdapter } from "../deployment/adapter.js";
|
|
4
|
+
function option(args, name) {
|
|
5
|
+
const index = args.indexOf(name);
|
|
6
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
7
|
+
}
|
|
8
|
+
async function inputs(args) {
|
|
9
|
+
let tunnelId = option(args, "--tunnel-id"), publicBaseUrl = option(args, "--public-base-url");
|
|
10
|
+
if ((!tunnelId || !publicBaseUrl) && !process.stdin.isTTY)
|
|
11
|
+
throw new Error("非交互环境必须提供 --tunnel-id 和 --public-base-url");
|
|
12
|
+
if (!tunnelId || !publicBaseUrl) {
|
|
13
|
+
const prompt = createInterface({
|
|
14
|
+
input: process.stdin,
|
|
15
|
+
output: process.stdout,
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
tunnelId ||= await prompt.question("Tunnel ID:");
|
|
19
|
+
publicBaseUrl ||= await prompt.question("公开 HTTPS URL:");
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
prompt.close();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { tunnelId, publicBaseUrl };
|
|
26
|
+
}
|
|
27
|
+
const args = process.argv.slice(2), command = args[0] ?? "setup", workspaceRoot = option(args, "--workspace") ?? process.cwd();
|
|
28
|
+
if (args.includes("--json"))
|
|
29
|
+
throw new Error("不支持的选项 --json");
|
|
30
|
+
if (command === "setup") {
|
|
31
|
+
const result = await behaviorAdapter.setup({
|
|
32
|
+
workspaceRoot,
|
|
33
|
+
input: await inputs(args),
|
|
34
|
+
});
|
|
35
|
+
process.stdout.write(result.result.status === "SUCCEEDED"
|
|
36
|
+
? "Tunnel 配置已保存。\n"
|
|
37
|
+
: `Tunnel 尚未就绪:${result.result.actionRequired.description}\n`);
|
|
38
|
+
}
|
|
39
|
+
else if (command === "verify") {
|
|
40
|
+
const result = await behaviorAdapter.status({ workspaceRoot });
|
|
41
|
+
process.stdout.write(result.result.data.setupStatus === "READY"
|
|
42
|
+
? "验证通过。\n"
|
|
43
|
+
: "验证未通过:配置尚未就绪。\n");
|
|
44
|
+
if (result.result.data.setupStatus !== "READY")
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
process.stdout.write("用法:proflow-dev-tunnel setup [--tunnel-id <id> --public-base-url <url>]\n");
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/proflow-dev-tunnel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"bin": {
|
|
9
|
+
"proflow-dev-tunnel": "./dist/src/cli.js"
|
|
10
|
+
},
|
|
8
11
|
"exports": {
|
|
9
12
|
".": "./dist/src/index.js",
|
|
10
13
|
"./deployment/adapter": "./dist/deployment/adapter.js",
|
|
@@ -19,10 +22,10 @@
|
|
|
19
22
|
"SETUP.md"
|
|
20
23
|
],
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@tomflow/proflow-module-contract": "^0.1.
|
|
25
|
+
"@tomflow/proflow-module-contract": "^0.1.8"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
|
-
"@tomflow/proflow-deployment-conformance": "^0.1.
|
|
28
|
+
"@tomflow/proflow-deployment-conformance": "^0.1.6"
|
|
26
29
|
},
|
|
27
30
|
"description": "Governs the Microsoft Dev Tunnel public HTTPS ingress resource and its managed local host process.",
|
|
28
31
|
"keywords": [
|
package/proflow.module.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contractVersion": "1.0.0",
|
|
4
4
|
"moduleRef": "dev-tunnel",
|
|
5
5
|
"packageName": "@tomflow/proflow-dev-tunnel",
|
|
6
|
-
"moduleVersion": "0.1.
|
|
6
|
+
"moduleVersion": "0.1.9",
|
|
7
7
|
"kind": "external-resource",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|