agent-dealer 0.1.0 → 0.1.1
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/bundle/server/package.json +1 -1
- package/bundle/shared/package.json +1 -1
- package/dist/bin.js +0 -0
- package/dist/doctor.js +15 -6
- package/dist/env.d.ts +11 -0
- package/dist/env.js +39 -0
- package/dist/start.js +13 -2
- package/package.json +1 -1
- package/templates/prod.env.example +8 -7
package/dist/bin.js
CHANGED
|
File without changes
|
package/dist/doctor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import net from "node:net";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
3
|
import { claudeAvailable } from "./cli-check.js";
|
|
5
|
-
import {
|
|
4
|
+
import { loadProdEnvFile, prodEnvFilePath, prodHomeDir, resolveBundledListenPort, shortenHome, } from "./env.js";
|
|
5
|
+
import { resolveServerEntry, resolveUiDist } from "./paths.js";
|
|
6
6
|
export async function runDoctor() {
|
|
7
7
|
let failed = false;
|
|
8
8
|
const major = Number(process.versions.node.split(".")[0]);
|
|
@@ -35,15 +35,24 @@ export async function runDoctor() {
|
|
|
35
35
|
else {
|
|
36
36
|
console.warn("⚠ dashboard bundle missing (API-only)");
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const envFile = path.join(home, ".env");
|
|
38
|
+
const envFile = loadProdEnvFile() ?? prodEnvFilePath();
|
|
40
39
|
if (fs.existsSync(envFile)) {
|
|
41
|
-
console.log(`✓ config ${envFile}`);
|
|
40
|
+
console.log(`✓ config ${shortenHome(envFile)}`);
|
|
41
|
+
if (process.env.LINEAR_API_KEY?.trim()) {
|
|
42
|
+
console.log("✓ LINEAR_API_KEY set");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.warn("⚠ LINEAR_API_KEY not set — Linear inbox disabled");
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
else {
|
|
44
49
|
console.warn(`⚠ no config — run: agent-dealer setup`);
|
|
45
50
|
}
|
|
46
|
-
const
|
|
51
|
+
const home = prodHomeDir();
|
|
52
|
+
if (fs.existsSync(home)) {
|
|
53
|
+
console.log(`✓ data ${shortenHome(home)}`);
|
|
54
|
+
}
|
|
55
|
+
const port = resolveBundledListenPort();
|
|
47
56
|
const free = await isPortFree(port);
|
|
48
57
|
if (free) {
|
|
49
58
|
console.log(`✓ port ${port} available`);
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Production data + config directory (respects AGENT_DEALER_HOME from shell). */
|
|
2
|
+
export declare function prodHomeDir(): string;
|
|
3
|
+
export declare function prodEnvFilePath(): string;
|
|
4
|
+
/** Load ~/.agent-dealer/.env for CLI (Linear keys, port, etc.). Does not override existing env. */
|
|
5
|
+
export declare function loadProdEnvFile(): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Bundled npm start: listen on prod dashboard port (2222).
|
|
8
|
+
* Legacy setups used PORT=2221 for API-only; ignore that when bundling UI.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveBundledListenPort(explicit?: number): number;
|
|
11
|
+
export declare function shortenHome(p: string): string;
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import dotenv from "dotenv";
|
|
5
|
+
/** Production data + config directory (respects AGENT_DEALER_HOME from shell). */
|
|
6
|
+
export function prodHomeDir() {
|
|
7
|
+
return (process.env.AGENT_DEALER_HOME?.trim() ||
|
|
8
|
+
path.join(os.homedir(), ".agent-dealer"));
|
|
9
|
+
}
|
|
10
|
+
export function prodEnvFilePath() {
|
|
11
|
+
return path.join(prodHomeDir(), ".env");
|
|
12
|
+
}
|
|
13
|
+
/** Load ~/.agent-dealer/.env for CLI (Linear keys, port, etc.). Does not override existing env. */
|
|
14
|
+
export function loadProdEnvFile() {
|
|
15
|
+
const envFile = prodEnvFilePath();
|
|
16
|
+
if (fs.existsSync(envFile)) {
|
|
17
|
+
dotenv.config({ path: envFile });
|
|
18
|
+
return envFile;
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Bundled npm start: listen on prod dashboard port (2222).
|
|
24
|
+
* Legacy setups used PORT=2221 for API-only; ignore that when bundling UI.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveBundledListenPort(explicit) {
|
|
27
|
+
if (explicit !== undefined)
|
|
28
|
+
return explicit;
|
|
29
|
+
if (process.env.WEB_PORT)
|
|
30
|
+
return Number(process.env.WEB_PORT);
|
|
31
|
+
const port = process.env.PORT;
|
|
32
|
+
if (port && port !== "2221")
|
|
33
|
+
return Number(port);
|
|
34
|
+
return 2222;
|
|
35
|
+
}
|
|
36
|
+
export function shortenHome(p) {
|
|
37
|
+
const home = os.homedir();
|
|
38
|
+
return p.startsWith(home) ? `~${p.slice(home.length)}` : p;
|
|
39
|
+
}
|
package/dist/start.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { loadProdEnvFile, prodEnvFilePath, prodHomeDir, resolveBundledListenPort, shortenHome, } from "./env.js";
|
|
2
3
|
import { resolveServerEntry, resolveUiDist } from "./paths.js";
|
|
3
4
|
let child = null;
|
|
4
5
|
async function waitForHealth(url, attempts = 40) {
|
|
@@ -16,13 +17,23 @@ async function waitForHealth(url, attempts = 40) {
|
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
18
19
|
export async function runStart(options = {}) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const envFile = loadProdEnvFile();
|
|
21
|
+
const home = prodHomeDir();
|
|
21
22
|
const uiDist = resolveUiDist();
|
|
23
|
+
const port = resolveBundledListenPort(options.port);
|
|
24
|
+
const entry = resolveServerEntry();
|
|
25
|
+
if (envFile) {
|
|
26
|
+
console.log(`Config: ${shortenHome(envFile)}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.warn(`No config at ${shortenHome(prodEnvFilePath())} — run: agent-dealer setup`);
|
|
30
|
+
}
|
|
22
31
|
const env = {
|
|
23
32
|
...process.env,
|
|
24
33
|
AGENT_DEALER_ENV: "production",
|
|
34
|
+
AGENT_DEALER_HOME: home,
|
|
25
35
|
PORT: String(port),
|
|
36
|
+
WEB_PORT: String(port),
|
|
26
37
|
AGENT_DEALER_WEB_URL: `http://localhost:${port}`,
|
|
27
38
|
AGENT_DEALER_API: `http://127.0.0.1:${port}`,
|
|
28
39
|
};
|
package/package.json
CHANGED
|
@@ -6,14 +6,15 @@ AGENT_DEALER_ENV=production
|
|
|
6
6
|
# SQLite data directory (default: ~/.agent-dealer)
|
|
7
7
|
# AGENT_DEALER_HOME=
|
|
8
8
|
|
|
9
|
-
# API + dashboard port when UI is bundled (default:
|
|
10
|
-
PORT=
|
|
11
|
-
AGENT_DEALER_WEB_URL=http://localhost:
|
|
9
|
+
# API + dashboard port when UI is bundled (default: 2222 — prod dashboard port)
|
|
10
|
+
PORT=2222
|
|
11
|
+
AGENT_DEALER_WEB_URL=http://localhost:2222
|
|
12
|
+
AGENT_DEALER_API=http://127.0.0.1:2222
|
|
12
13
|
|
|
13
|
-
# Linear (optional — manual tasks work without)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
# Linear (optional — manual tasks work without; edit after `agent-dealer setup`)
|
|
15
|
+
LINEAR_API_KEY=
|
|
16
|
+
LINEAR_TEAM_ID=
|
|
17
|
+
LINEAR_STATE_FILTER="Todo,Backlog"
|
|
17
18
|
|
|
18
19
|
# Agent Deck UI proxy (optional)
|
|
19
20
|
# AGENT_DECK_API_URL=http://127.0.0.1:1111
|