@creativeintelligence/abbie 0.1.5 → 0.1.7
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/bin/dev.js +1 -49
- package/bin/run.js +42 -49
- package/dist/cli/commands/login.js +26 -0
- package/dist/cli/commands/project/add.d.ts +0 -1
- package/dist/cli/commands/project/add.js +16 -52
- package/dist/cli/commands/project/list.js +13 -93
- package/dist/cli/commands/project/remove.d.ts +0 -2
- package/dist/cli/commands/project/remove.js +11 -28
- package/dist/cli/commands/session/list.js +3 -12
- package/dist/cli/commands/session/mark-done.js +1 -7
- package/dist/cli/commands/session/start.d.ts +0 -1
- package/dist/cli/commands/session/start.js +5 -7
- package/dist/lib/active-sessions.d.ts +0 -12
- package/dist/lib/active-sessions.js +6 -175
- package/dist/lib/project-path.d.ts +6 -0
- package/dist/lib/project-path.js +21 -0
- package/dist/lib.d.ts +1 -2
- package/dist/lib.js +2 -4
- package/oclif.manifest.json +2569 -6368
- package/package.json +1 -1
- package/dist/cli/commands/backlog/add.d.ts +0 -22
- package/dist/cli/commands/backlog/add.js +0 -65
- package/dist/cli/commands/backlog/claim.d.ts +0 -19
- package/dist/cli/commands/backlog/claim.js +0 -45
- package/dist/cli/commands/backlog/complete.d.ts +0 -18
- package/dist/cli/commands/backlog/complete.js +0 -42
- package/dist/cli/commands/backlog/list.d.ts +0 -20
- package/dist/cli/commands/backlog/list.js +0 -91
- package/dist/cli/commands/backlog/pick.d.ts +0 -18
- package/dist/cli/commands/backlog/pick.js +0 -42
- package/dist/cli/commands/backlog/sync.d.ts +0 -24
- package/dist/cli/commands/backlog/sync.js +0 -109
- package/dist/cli/commands/daemon.d.ts +0 -56
- package/dist/cli/commands/daemon.js +0 -1465
- package/dist/cli/commands/docs/lint.d.ts +0 -18
- package/dist/cli/commands/docs/lint.js +0 -82
- package/dist/cli/commands/docs/sync.d.ts +0 -19
- package/dist/cli/commands/docs/sync.js +0 -76
- package/dist/cli/commands/gc.d.ts +0 -29
- package/dist/cli/commands/gc.js +0 -211
- package/dist/cli/commands/index.d.ts +0 -36
- package/dist/cli/commands/index.js +0 -228
- package/dist/cli/commands/panes/broker.d.ts +0 -17
- package/dist/cli/commands/panes/broker.js +0 -57
- package/dist/cli/commands/panes/pipe-sink.d.ts +0 -17
- package/dist/cli/commands/panes/pipe-sink.js +0 -90
- package/dist/cli/commands/panes/snapshot.d.ts +0 -20
- package/dist/cli/commands/panes/snapshot.js +0 -125
- package/dist/cli/commands/preview/init.d.ts +0 -25
- package/dist/cli/commands/preview/init.js +0 -159
- package/dist/cli/commands/preview/sync.d.ts +0 -23
- package/dist/cli/commands/preview/sync.js +0 -144
- package/dist/cli/commands/preview/watch.d.ts +0 -24
- package/dist/cli/commands/preview/watch.js +0 -153
- package/dist/cli/commands/resource/acquire.d.ts +0 -21
- package/dist/cli/commands/resource/acquire.js +0 -90
- package/dist/cli/commands/resource/list.d.ts +0 -15
- package/dist/cli/commands/resource/list.js +0 -61
- package/dist/cli/commands/resource/release.d.ts +0 -18
- package/dist/cli/commands/resource/release.js +0 -50
- package/dist/cli/commands/resource/wait.d.ts +0 -21
- package/dist/cli/commands/resource/wait.js +0 -73
- package/dist/cli/commands/session/view.d.ts +0 -24
- package/dist/cli/commands/session/view.js +0 -145
- package/dist/cli/commands/start.d.ts +0 -37
- package/dist/cli/commands/start.js +0 -234
- package/dist/cli/commands/triage/claim.d.ts +0 -23
- package/dist/cli/commands/triage/claim.js +0 -186
- package/dist/cli/commands/triage/list.d.ts +0 -22
- package/dist/cli/commands/triage/list.js +0 -112
- package/dist/cli/commands/triage/next.d.ts +0 -18
- package/dist/cli/commands/triage/next.js +0 -63
- package/dist/cli/commands/triage/pull.d.ts +0 -19
- package/dist/cli/commands/triage/pull.js +0 -82
- package/dist/cli/commands/triage/stats.d.ts +0 -16
- package/dist/cli/commands/triage/stats.js +0 -69
- package/dist/cli/commands/tunnel/list.d.ts +0 -16
- package/dist/cli/commands/tunnel/list.js +0 -98
- package/dist/cli/commands/tunnel/start.d.ts +0 -24
- package/dist/cli/commands/tunnel/start.js +0 -107
- package/dist/cli/commands/tunnel/stop.d.ts +0 -20
- package/dist/cli/commands/tunnel/stop.js +0 -90
- package/dist/cli/commands/tunnel/url.d.ts +0 -21
- package/dist/cli/commands/tunnel/url.js +0 -70
- package/dist/cli/commands/windows/context.d.ts +0 -18
- package/dist/cli/commands/windows/context.js +0 -326
- package/dist/cli/commands/windows/focus.d.ts +0 -17
- package/dist/cli/commands/windows/focus.js +0 -103
- package/dist/cli/commands/windows/list.d.ts +0 -21
- package/dist/cli/commands/windows/list.js +0 -172
- package/dist/cli/commands/windows/map.d.ts +0 -17
- package/dist/cli/commands/windows/map.js +0 -168
- package/dist/cli/commands/windows/read.d.ts +0 -21
- package/dist/cli/commands/windows/read.js +0 -241
- package/dist/cli/commands/windows/search.d.ts +0 -24
- package/dist/cli/commands/windows/search.js +0 -171
- package/dist/cli/commands/windows/show.d.ts +0 -19
- package/dist/cli/commands/windows/show.js +0 -165
- package/dist/cli/commands/windows/watch.d.ts +0 -19
- package/dist/cli/commands/windows/watch.js +0 -241
- package/dist/lib/managed-session.d.ts +0 -27
- package/dist/lib/managed-session.js +0 -105
- package/dist/lib/panes/broker.d.ts +0 -130
- package/dist/lib/panes/broker.js +0 -97
- package/dist/lib/panes/index.d.ts +0 -2
- package/dist/lib/panes/index.js +0 -1
- package/dist/lib/panes/server.d.ts +0 -17
- package/dist/lib/panes/server.js +0 -308
- package/dist/lib/preview/manager.d.ts +0 -77
- package/dist/lib/preview/manager.js +0 -369
- package/dist/lib/preview/schema.d.ts +0 -2
- package/dist/lib/preview/schema.js +0 -32
- package/dist/lib/preview/sprite.d.ts +0 -85
- package/dist/lib/preview/sprite.js +0 -321
- package/dist/lib/preview/watcher.d.ts +0 -63
- package/dist/lib/preview/watcher.js +0 -185
- package/dist/lib/project-identity.d.ts +0 -16
- package/dist/lib/project-identity.js +0 -75
- package/dist/lib/tmux/bridge.d.ts +0 -133
- package/dist/lib/tmux/bridge.js +0 -315
- package/dist/lib/tmux/context.d.ts +0 -82
- package/dist/lib/tmux/context.js +0 -239
- package/dist/lib/tmux/index.d.ts +0 -8
- package/dist/lib/tmux/index.js +0 -11
- package/dist/lib/tmux/map.d.ts +0 -57
- package/dist/lib/tmux/map.js +0 -198
- package/dist/lib/tmux/panes.d.ts +0 -27
- package/dist/lib/tmux/panes.js +0 -151
- package/dist/lib/tmux/redaction.d.ts +0 -57
- package/dist/lib/tmux/redaction.js +0 -152
- package/dist/lib/web/analytics.d.ts +0 -63
- package/dist/lib/web/analytics.js +0 -168
- package/dist/lib/web/server.d.ts +0 -26
- package/dist/lib/web/server.js +0 -697
- package/dist/lib/web/tmux-bridge.d.ts +0 -7
- package/dist/lib/web/tmux-bridge.js +0 -7
- package/dist/lib/windows/index.d.ts +0 -3
- package/dist/lib/windows/index.js +0 -2
- package/dist/lib/windows/inventory.d.ts +0 -21
- package/dist/lib/windows/inventory.js +0 -263
- package/dist/lib/windows/types.d.ts +0 -46
- package/dist/lib/windows/types.js +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Flags } from "@oclif/core";
|
|
2
|
-
import { createNgrokManager, getAgentStatus, isAgentRunning } from "../../../lib/ngrok.js";
|
|
3
|
-
import { BaseCommand } from "../../base-command.js";
|
|
4
|
-
export default class TunnelList extends BaseCommand {
|
|
5
|
-
static description = "List active ngrok tunnels";
|
|
6
|
-
static hidden = false;
|
|
7
|
-
static examples = [
|
|
8
|
-
"<%= config.bin %> tunnel list",
|
|
9
|
-
"<%= config.bin %> tunnel list --json",
|
|
10
|
-
"<%= config.bin %> tunnel list --urls",
|
|
11
|
-
];
|
|
12
|
-
static flags = {
|
|
13
|
-
...BaseCommand.baseFlags,
|
|
14
|
-
urls: Flags.boolean({
|
|
15
|
-
char: "u",
|
|
16
|
-
description: "Output only URLs (one per line)",
|
|
17
|
-
default: false,
|
|
18
|
-
}),
|
|
19
|
-
status: Flags.boolean({
|
|
20
|
-
description: "Include agent status",
|
|
21
|
-
default: false,
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
async execute() {
|
|
25
|
-
const { flags } = await this.parse(TunnelList);
|
|
26
|
-
this.parsedFlags = flags;
|
|
27
|
-
const ngrok = createNgrokManager();
|
|
28
|
-
// Cleanup stale metadata
|
|
29
|
-
await ngrok.cleanup();
|
|
30
|
-
// Check if agent is running
|
|
31
|
-
const running = await isAgentRunning();
|
|
32
|
-
if (!running) {
|
|
33
|
-
if (flags.json || flags.format === "json") {
|
|
34
|
-
return { agent_running: false, tunnels: [] };
|
|
35
|
-
}
|
|
36
|
-
if (flags.urls) {
|
|
37
|
-
return { tunnels: [] };
|
|
38
|
-
}
|
|
39
|
-
this.logInfo("ngrok agent not running");
|
|
40
|
-
return { tunnels: [] };
|
|
41
|
-
}
|
|
42
|
-
const tunnels = await ngrok.list();
|
|
43
|
-
const agentStatus = flags.status ? await getAgentStatus() : undefined;
|
|
44
|
-
if (flags.json || flags.format === "json") {
|
|
45
|
-
return {
|
|
46
|
-
agent_running: true,
|
|
47
|
-
agent_status: agentStatus,
|
|
48
|
-
tunnels: tunnels.map((t) => ({
|
|
49
|
-
name: t.name,
|
|
50
|
-
public_url: t.public_url,
|
|
51
|
-
port: t.config?.addr,
|
|
52
|
-
session_id: t.metadata?.session_id,
|
|
53
|
-
created_at: t.metadata?.created_at,
|
|
54
|
-
})),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
// NDJSON: one tunnel per line
|
|
58
|
-
if (this.ndjsonEnabled()) {
|
|
59
|
-
const items = tunnels.map((t) => ({
|
|
60
|
-
name: t.name,
|
|
61
|
-
public_url: t.public_url,
|
|
62
|
-
port: t.config?.addr,
|
|
63
|
-
session_id: t.metadata?.session_id,
|
|
64
|
-
created_at: t.metadata?.created_at,
|
|
65
|
-
}));
|
|
66
|
-
this.outputNdjson(items);
|
|
67
|
-
return { tunnels };
|
|
68
|
-
}
|
|
69
|
-
// URLs only (for piping)
|
|
70
|
-
if (flags.urls) {
|
|
71
|
-
for (const tunnel of tunnels) {
|
|
72
|
-
this.log(tunnel.public_url);
|
|
73
|
-
}
|
|
74
|
-
return { tunnels };
|
|
75
|
-
}
|
|
76
|
-
// Human-readable format
|
|
77
|
-
if (tunnels.length === 0) {
|
|
78
|
-
this.logInfo("No active tunnels");
|
|
79
|
-
return { tunnels: [] };
|
|
80
|
-
}
|
|
81
|
-
this.log("");
|
|
82
|
-
if (agentStatus) {
|
|
83
|
-
this.log(`Agent: v${agentStatus.version} (${agentStatus.region})`);
|
|
84
|
-
this.log("");
|
|
85
|
-
}
|
|
86
|
-
for (const tunnel of tunnels) {
|
|
87
|
-
this.log(`${tunnel.name}`);
|
|
88
|
-
this.log(` url: ${tunnel.public_url}`);
|
|
89
|
-
this.log(` port: ${tunnel.config?.addr || "unknown"}`);
|
|
90
|
-
if (tunnel.metadata) {
|
|
91
|
-
this.log(` session: ${tunnel.metadata.session_id}`);
|
|
92
|
-
this.log(` created: ${tunnel.metadata.created_at}`);
|
|
93
|
-
}
|
|
94
|
-
this.log("");
|
|
95
|
-
}
|
|
96
|
-
return { tunnels };
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../base-command.js";
|
|
2
|
-
export default class TunnelStart extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static args: {
|
|
7
|
-
port: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
8
|
-
max?: number;
|
|
9
|
-
min?: number;
|
|
10
|
-
}>;
|
|
11
|
-
};
|
|
12
|
-
static flags: {
|
|
13
|
-
session: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
"skip-resource": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
-
"json-errors": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
-
ndjson: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
-
};
|
|
21
|
-
protected execute(): Promise<unknown>;
|
|
22
|
-
private tryReadStdin;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import { createNgrokManager, ensureAgentRunning } from "../../../lib/ngrok.js";
|
|
3
|
-
import { createResourceManager } from "../../../lib/resources.js";
|
|
4
|
-
import { BaseCommand } from "../../base-command.js";
|
|
5
|
-
export default class TunnelStart extends BaseCommand {
|
|
6
|
-
static description = "Start an ngrok tunnel for a local port";
|
|
7
|
-
static hidden = false;
|
|
8
|
-
static examples = [
|
|
9
|
-
"<%= config.bin %> tunnel start 3000",
|
|
10
|
-
"<%= config.bin %> tunnel start 3000 --session SESSION_ID",
|
|
11
|
-
"<%= config.bin %> tunnel start 8080 --name myapp --json",
|
|
12
|
-
"echo 3000 | <%= config.bin %> tunnel start",
|
|
13
|
-
];
|
|
14
|
-
static args = {
|
|
15
|
-
port: Args.integer({
|
|
16
|
-
description: "Local port to tunnel",
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
static flags = {
|
|
20
|
-
...BaseCommand.baseFlags,
|
|
21
|
-
session: Flags.string({
|
|
22
|
-
char: "s",
|
|
23
|
-
description: "Session ID for resource tracking",
|
|
24
|
-
}),
|
|
25
|
-
name: Flags.string({
|
|
26
|
-
char: "n",
|
|
27
|
-
description: "Tunnel name",
|
|
28
|
-
}),
|
|
29
|
-
"skip-resource": Flags.boolean({
|
|
30
|
-
description: "Skip resource semaphore acquisition",
|
|
31
|
-
default: false,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
async execute() {
|
|
35
|
-
const { args, flags } = await this.parse(TunnelStart);
|
|
36
|
-
this.parsedFlags = flags;
|
|
37
|
-
// Support stdin for port
|
|
38
|
-
let port = args.port;
|
|
39
|
-
if (!port) {
|
|
40
|
-
// Read from stdin if available
|
|
41
|
-
const stdin = await this.tryReadStdin();
|
|
42
|
-
if (stdin) {
|
|
43
|
-
port = parseInt(stdin.trim(), 10);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!port || Number.isNaN(port)) {
|
|
47
|
-
this.error("Port is required. Provide as argument or via stdin.");
|
|
48
|
-
}
|
|
49
|
-
const sessionId = flags.session || `tunnel-${Date.now().toString(36)}`;
|
|
50
|
-
// Acquire ngrok resource slot (unless skipped)
|
|
51
|
-
if (!flags["skip-resource"]) {
|
|
52
|
-
const resources = createResourceManager();
|
|
53
|
-
const lease = resources.acquire("ngrok_tunnel", sessionId, "system");
|
|
54
|
-
if (!lease) {
|
|
55
|
-
if (flags.json || flags.format === "json") {
|
|
56
|
-
return { success: false, reason: "No ngrok slots available" };
|
|
57
|
-
}
|
|
58
|
-
this.error("No ngrok slots available. Use --skip-resource to bypass.");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// Ensure agent is running
|
|
62
|
-
if (!(await ensureAgentRunning())) {
|
|
63
|
-
if (flags.json || flags.format === "json") {
|
|
64
|
-
return { success: false, reason: "Failed to start ngrok agent" };
|
|
65
|
-
}
|
|
66
|
-
this.error("Failed to start ngrok agent");
|
|
67
|
-
}
|
|
68
|
-
const ngrok = createNgrokManager();
|
|
69
|
-
const result = await ngrok.start(port, sessionId, flags.name);
|
|
70
|
-
if (!result) {
|
|
71
|
-
if (flags.json || flags.format === "json") {
|
|
72
|
-
return { success: false, reason: "Failed to create tunnel" };
|
|
73
|
-
}
|
|
74
|
-
this.error("Failed to create tunnel");
|
|
75
|
-
}
|
|
76
|
-
if (flags.json || flags.format === "json") {
|
|
77
|
-
return {
|
|
78
|
-
success: true,
|
|
79
|
-
tunnel: {
|
|
80
|
-
name: result.tunnel.name,
|
|
81
|
-
public_url: result.public_url,
|
|
82
|
-
port,
|
|
83
|
-
session_id: sessionId,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
// Unix pipe output: just the URL
|
|
88
|
-
this.log(result.public_url);
|
|
89
|
-
return { success: true, public_url: result.public_url };
|
|
90
|
-
}
|
|
91
|
-
async tryReadStdin() {
|
|
92
|
-
if (process.stdin.isTTY)
|
|
93
|
-
return undefined;
|
|
94
|
-
return new Promise((resolve) => {
|
|
95
|
-
let data = "";
|
|
96
|
-
process.stdin.setEncoding("utf8");
|
|
97
|
-
process.stdin.on("data", (chunk) => {
|
|
98
|
-
data += chunk;
|
|
99
|
-
});
|
|
100
|
-
process.stdin.on("end", () => {
|
|
101
|
-
resolve(data || undefined);
|
|
102
|
-
});
|
|
103
|
-
// Timeout after 100ms if no stdin
|
|
104
|
-
setTimeout(() => resolve(data || undefined), 100);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../base-command.js";
|
|
2
|
-
export default class TunnelStop extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static args: {
|
|
7
|
-
name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
-
};
|
|
9
|
-
static flags: {
|
|
10
|
-
session: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
kill: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
"json-errors": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
ndjson: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
};
|
|
18
|
-
protected execute(): Promise<unknown>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=stop.d.ts.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import { createNgrokManager, killNgrok, listTunnels, stopTunnel } from "../../../lib/ngrok.js";
|
|
3
|
-
import { createResourceManager } from "../../../lib/resources.js";
|
|
4
|
-
import { BaseCommand } from "../../base-command.js";
|
|
5
|
-
export default class TunnelStop extends BaseCommand {
|
|
6
|
-
static description = "Stop ngrok tunnels";
|
|
7
|
-
static hidden = false;
|
|
8
|
-
static examples = [
|
|
9
|
-
"<%= config.bin %> tunnel stop myapp",
|
|
10
|
-
"<%= config.bin %> tunnel stop --session SESSION_ID",
|
|
11
|
-
"<%= config.bin %> tunnel stop --all",
|
|
12
|
-
"<%= config.bin %> tunnel stop --kill",
|
|
13
|
-
];
|
|
14
|
-
static args = {
|
|
15
|
-
name: Args.string({
|
|
16
|
-
description: "Tunnel name to stop",
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
static flags = {
|
|
20
|
-
...BaseCommand.baseFlags,
|
|
21
|
-
session: Flags.string({
|
|
22
|
-
char: "s",
|
|
23
|
-
description: "Stop all tunnels for a session",
|
|
24
|
-
}),
|
|
25
|
-
all: Flags.boolean({
|
|
26
|
-
description: "Stop all tunnels",
|
|
27
|
-
default: false,
|
|
28
|
-
}),
|
|
29
|
-
kill: Flags.boolean({
|
|
30
|
-
char: "k",
|
|
31
|
-
description: "Kill ngrok agent entirely",
|
|
32
|
-
default: false,
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
async execute() {
|
|
36
|
-
const { args, flags } = await this.parse(TunnelStop);
|
|
37
|
-
this.parsedFlags = flags;
|
|
38
|
-
const ngrok = createNgrokManager();
|
|
39
|
-
const resources = createResourceManager();
|
|
40
|
-
// Kill ngrok agent entirely
|
|
41
|
-
if (flags.kill) {
|
|
42
|
-
killNgrok();
|
|
43
|
-
if (flags.json || flags.format === "json") {
|
|
44
|
-
return { success: true, action: "killed" };
|
|
45
|
-
}
|
|
46
|
-
this.logInfo("Killed ngrok agent");
|
|
47
|
-
return { success: true };
|
|
48
|
-
}
|
|
49
|
-
// Stop all tunnels
|
|
50
|
-
if (flags.all) {
|
|
51
|
-
const tunnels = await listTunnels();
|
|
52
|
-
let stopped = 0;
|
|
53
|
-
for (const tunnel of tunnels) {
|
|
54
|
-
if (await stopTunnel(tunnel.name)) {
|
|
55
|
-
stopped++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (flags.json || flags.format === "json") {
|
|
59
|
-
return { success: true, stopped };
|
|
60
|
-
}
|
|
61
|
-
this.logInfo(`Stopped ${stopped} tunnel(s)`);
|
|
62
|
-
return { success: true, stopped };
|
|
63
|
-
}
|
|
64
|
-
// Stop tunnels for a session
|
|
65
|
-
if (flags.session) {
|
|
66
|
-
const stopped = await ngrok.stopSession(flags.session);
|
|
67
|
-
resources.release("ngrok_tunnel", flags.session);
|
|
68
|
-
if (flags.json || flags.format === "json") {
|
|
69
|
-
return { success: true, stopped };
|
|
70
|
-
}
|
|
71
|
-
this.logInfo(`Stopped ${stopped} tunnel(s) for session ${flags.session}`);
|
|
72
|
-
return { success: true, stopped };
|
|
73
|
-
}
|
|
74
|
-
// Stop specific tunnel by name
|
|
75
|
-
if (!args.name) {
|
|
76
|
-
this.error("Provide tunnel name, --session, --all, or --kill");
|
|
77
|
-
}
|
|
78
|
-
const stopped = await ngrok.stop(args.name);
|
|
79
|
-
if (flags.json || flags.format === "json") {
|
|
80
|
-
return { success: stopped };
|
|
81
|
-
}
|
|
82
|
-
if (stopped) {
|
|
83
|
-
this.logInfo(`Stopped tunnel: ${args.name}`);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.error(`Tunnel not found: ${args.name}`);
|
|
87
|
-
}
|
|
88
|
-
return { success: stopped };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../base-command.js";
|
|
2
|
-
export default class TunnelUrl extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static args: {
|
|
7
|
-
port: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
8
|
-
max?: number;
|
|
9
|
-
min?: number;
|
|
10
|
-
}>;
|
|
11
|
-
};
|
|
12
|
-
static flags: {
|
|
13
|
-
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
"json-errors": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
ndjson: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
};
|
|
18
|
-
protected execute(): Promise<unknown>;
|
|
19
|
-
private tryReadStdin;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Args } from "@oclif/core";
|
|
2
|
-
import { findTunnelByPort, getPublicUrl } from "../../../lib/ngrok.js";
|
|
3
|
-
import { BaseCommand } from "../../base-command.js";
|
|
4
|
-
export default class TunnelUrl extends BaseCommand {
|
|
5
|
-
static description = "Get public URL for a port (creates tunnel if needed)";
|
|
6
|
-
static hidden = false;
|
|
7
|
-
static examples = [
|
|
8
|
-
"<%= config.bin %> tunnel url 3000",
|
|
9
|
-
"<%= config.bin %> tunnel url 3000 | xargs open",
|
|
10
|
-
"<%= config.bin %> tunnel url 3000 | pbcopy",
|
|
11
|
-
"echo 8080 | <%= config.bin %> tunnel url",
|
|
12
|
-
];
|
|
13
|
-
static args = {
|
|
14
|
-
port: Args.integer({
|
|
15
|
-
description: "Local port",
|
|
16
|
-
}),
|
|
17
|
-
};
|
|
18
|
-
static flags = {
|
|
19
|
-
...BaseCommand.baseFlags,
|
|
20
|
-
};
|
|
21
|
-
async execute() {
|
|
22
|
-
const { args, flags } = await this.parse(TunnelUrl);
|
|
23
|
-
this.parsedFlags = flags;
|
|
24
|
-
// Support stdin for port
|
|
25
|
-
let port = args.port;
|
|
26
|
-
if (!port) {
|
|
27
|
-
const stdin = await this.tryReadStdin();
|
|
28
|
-
if (stdin) {
|
|
29
|
-
port = parseInt(stdin.trim(), 10);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (!port || Number.isNaN(port)) {
|
|
33
|
-
this.error("Port is required");
|
|
34
|
-
}
|
|
35
|
-
const url = await getPublicUrl(port);
|
|
36
|
-
if (!url) {
|
|
37
|
-
if (flags.json || flags.format === "json") {
|
|
38
|
-
return { success: false, port };
|
|
39
|
-
}
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
if (flags.json || flags.format === "json") {
|
|
43
|
-
const tunnel = await findTunnelByPort(port);
|
|
44
|
-
return {
|
|
45
|
-
success: true,
|
|
46
|
-
port,
|
|
47
|
-
public_url: url,
|
|
48
|
-
name: tunnel?.name,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// Unix pipe output: just the URL
|
|
52
|
-
this.log(url);
|
|
53
|
-
return { success: true, url };
|
|
54
|
-
}
|
|
55
|
-
async tryReadStdin() {
|
|
56
|
-
if (process.stdin.isTTY)
|
|
57
|
-
return undefined;
|
|
58
|
-
return new Promise((resolve) => {
|
|
59
|
-
let data = "";
|
|
60
|
-
process.stdin.setEncoding("utf8");
|
|
61
|
-
process.stdin.on("data", (chunk) => {
|
|
62
|
-
data += chunk;
|
|
63
|
-
});
|
|
64
|
-
process.stdin.on("end", () => {
|
|
65
|
-
resolve(data || undefined);
|
|
66
|
-
});
|
|
67
|
-
setTimeout(() => resolve(data || undefined), 100);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../base-command.js";
|
|
2
|
-
export default class WindowsContextCommand extends BaseCommand {
|
|
3
|
-
static summary: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static flags: {
|
|
7
|
-
focus: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
"with-buffers": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
"max-bytes": import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
redact: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
"json-errors": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
ndjson: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
};
|
|
16
|
-
execute(): Promise<unknown>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=context.d.ts.map
|