agor-live 0.6.7 → 0.6.8

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.
@@ -3,6 +3,8 @@ import { Command } from "@oclif/core";
3
3
  import chalk from "chalk";
4
4
 
5
5
  // src/lib/context.ts
6
+ import { access, constants } from "fs/promises";
7
+ import { homedir } from "os";
6
8
  import path from "path";
7
9
  import { fileURLToPath } from "url";
8
10
  function isInstalledPackage() {
@@ -3,6 +3,8 @@ import { Command, Flags } from "@oclif/core";
3
3
  import chalk from "chalk";
4
4
 
5
5
  // src/lib/context.ts
6
+ import { access, constants } from "fs/promises";
7
+ import { homedir } from "os";
6
8
  import path from "path";
7
9
  import { fileURLToPath } from "url";
8
10
  function isInstalledPackage() {
@@ -5,6 +5,8 @@ import { Command } from "@oclif/core";
5
5
  import chalk from "chalk";
6
6
 
7
7
  // src/lib/context.ts
8
+ import { access, constants } from "fs/promises";
9
+ import { homedir } from "os";
8
10
  import path from "path";
9
11
  import { fileURLToPath } from "url";
10
12
  function isInstalledPackage() {
@@ -5,6 +5,8 @@ import { Command, Flags } from "@oclif/core";
5
5
  import chalk from "chalk";
6
6
 
7
7
  // src/lib/context.ts
8
+ import { access, constants } from "fs/promises";
9
+ import { homedir } from "os";
8
10
  import path from "path";
9
11
  import { fileURLToPath } from "url";
10
12
  function isInstalledPackage() {
@@ -24,6 +26,17 @@ function getDaemonPath() {
24
26
  const packageRoot = dirname.substring(0, cliDistIndex);
25
27
  return path.join(packageRoot, "dist", "daemon", "index.js");
26
28
  }
29
+ async function isAgorInitialized() {
30
+ try {
31
+ const agorDir = path.join(homedir(), ".agor");
32
+ const dbPath = path.join(agorDir, "agor.db");
33
+ await access(agorDir, constants.F_OK);
34
+ await access(dbPath, constants.F_OK);
35
+ return true;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
27
40
 
28
41
  // src/lib/daemon-manager.ts
29
42
  import { spawn } from "child_process";
@@ -105,6 +118,15 @@ var DaemonStart = class _DaemonStart extends Command {
105
118
  this.log("");
106
119
  this.exit(1);
107
120
  }
121
+ const initialized = await isAgorInitialized();
122
+ if (!initialized) {
123
+ this.log(chalk.red("\u2717 Agor is not initialized"));
124
+ this.log("");
125
+ this.log("Initialize Agor first with:");
126
+ this.log(` ${chalk.cyan("agor init")}`);
127
+ this.log("");
128
+ this.exit(1);
129
+ }
108
130
  const daemonPath = getDaemonPath();
109
131
  if (!daemonPath) {
110
132
  this.log(chalk.red("\u2717 Daemon binary not found"));
@@ -5,6 +5,8 @@ import { Command } from "@oclif/core";
5
5
  import chalk from "chalk";
6
6
 
7
7
  // src/lib/context.ts
8
+ import { access, constants } from "fs/promises";
9
+ import { homedir } from "os";
8
10
  import path from "path";
9
11
  import { fileURLToPath } from "url";
10
12
  function isInstalledPackage() {
@@ -12,6 +14,17 @@ function isInstalledPackage() {
12
14
  const isInMonorepoSource = dirname.includes("/apps/agor-cli/") || dirname.includes("\\apps\\agor-cli\\");
13
15
  return !isInMonorepoSource;
14
16
  }
17
+ async function isAgorInitialized() {
18
+ try {
19
+ const agorDir = path.join(homedir(), ".agor");
20
+ const dbPath = path.join(agorDir, "agor.db");
21
+ await access(agorDir, constants.F_OK);
22
+ await access(dbPath, constants.F_OK);
23
+ return true;
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
15
28
 
16
29
  // src/lib/daemon-manager.ts
17
30
  import { spawn } from "child_process";
@@ -51,13 +64,16 @@ var DaemonStatus = class extends Command {
51
64
  static description = "Check daemon status";
52
65
  static examples = ["<%= config.bin %> <%= command.id %>"];
53
66
  async run() {
67
+ const initialized = await isAgorInitialized();
54
68
  const daemonUrl = await getDaemonUrl();
55
69
  const pid = getDaemonPid();
56
- const running = await isDaemonRunning(daemonUrl);
70
+ const running = initialized ? await isDaemonRunning(daemonUrl) : false;
57
71
  this.log(chalk.bold("\nDaemon Status"));
58
72
  this.log(chalk.dim("\u2500".repeat(50)));
59
73
  this.log("");
60
- if (running) {
74
+ if (!initialized) {
75
+ this.log(` Status: ${chalk.yellow("Not Initialized \u26A0")}`);
76
+ } else if (running) {
61
77
  this.log(` Status: ${chalk.green("Running \u2713")}`);
62
78
  } else {
63
79
  this.log(` Status: ${chalk.red("Not Running \u2717")}`);
@@ -76,7 +92,11 @@ var DaemonStatus = class extends Command {
76
92
  this.log(` PID: ${chalk.dim(getPidFilePath())}`);
77
93
  this.log(` Logs: ${chalk.dim(getLogFilePath())}`);
78
94
  this.log("");
79
- if (!running) {
95
+ if (!initialized) {
96
+ this.log(chalk.bold("To initialize Agor:"));
97
+ this.log(` ${chalk.cyan("agor init")}`);
98
+ this.log("");
99
+ } else if (!running) {
80
100
  if (isInstalledPackage()) {
81
101
  this.log(chalk.bold("To start the daemon:"));
82
102
  this.log(` ${chalk.cyan("agor daemon start")}`);
@@ -3,6 +3,8 @@ import { Command } from "@oclif/core";
3
3
  import chalk from "chalk";
4
4
 
5
5
  // src/lib/context.ts
6
+ import { access, constants } from "fs/promises";
7
+ import { homedir } from "os";
6
8
  import path from "path";
7
9
  import { fileURLToPath } from "url";
8
10
  function isInstalledPackage() {
@@ -7,6 +7,8 @@ import { Command } from "@oclif/core";
7
7
  import chalk from "chalk";
8
8
 
9
9
  // src/lib/context.ts
10
+ import { access, constants } from "fs/promises";
11
+ import { homedir } from "os";
10
12
  import path from "path";
11
13
  import { fileURLToPath } from "url";
12
14
  function isInstalledPackage() {
@@ -29,5 +29,15 @@ declare function isCodespaces(): boolean;
29
29
  * @returns UI URL for current context
30
30
  */
31
31
  declare function getUIUrl(): string;
32
+ /**
33
+ * Check if Agor has been initialized
34
+ *
35
+ * A valid Agor initialization requires:
36
+ * 1. ~/.agor/ directory exists
37
+ * 2. ~/.agor/agor.db database file exists
38
+ *
39
+ * @returns true if Agor is initialized, false otherwise
40
+ */
41
+ declare function isAgorInitialized(): Promise<boolean>;
32
42
 
33
- export { getDaemonPath, getUIUrl, isCodespaces, isInstalledPackage };
43
+ export { getDaemonPath, getUIUrl, isAgorInitialized, isCodespaces, isInstalledPackage };
@@ -1,4 +1,6 @@
1
1
  // src/lib/context.ts
2
+ import { access, constants } from "fs/promises";
3
+ import { homedir } from "os";
2
4
  import path from "path";
3
5
  import { fileURLToPath } from "url";
4
6
  function isInstalledPackage() {
@@ -37,9 +39,21 @@ function getUIUrl() {
37
39
  return "http://localhost:5173";
38
40
  }
39
41
  }
42
+ async function isAgorInitialized() {
43
+ try {
44
+ const agorDir = path.join(homedir(), ".agor");
45
+ const dbPath = path.join(agorDir, "agor.db");
46
+ await access(agorDir, constants.F_OK);
47
+ await access(dbPath, constants.F_OK);
48
+ return true;
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
40
53
  export {
41
54
  getDaemonPath,
42
55
  getUIUrl,
56
+ isAgorInitialized,
43
57
  isCodespaces,
44
58
  isInstalledPackage
45
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agor-live",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Multiplayer canvas for orchestrating AI coding sessions",
5
5
  "type": "module",
6
6
  "bin": {