agor-live 0.3.8 → 0.3.10

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.
Files changed (148) hide show
  1. package/dist/cli/commands/config/get.js +5 -11
  2. package/dist/cli/commands/config/index.d.ts +1 -1
  3. package/dist/cli/commands/config/index.js +4 -25
  4. package/dist/cli/commands/config/set.js +4 -6
  5. package/dist/cli/commands/config/unset.js +7 -9
  6. package/dist/cli/commands/session/load-claude.js +0 -1
  7. package/dist/cli/commands/{repo/worktree → worktree}/add.d.ts +1 -1
  8. package/dist/cli/commands/{repo/worktree → worktree}/add.js +13 -22
  9. package/dist/cli/commands/worktree/env/restart.d.ts +15 -0
  10. package/dist/cli/commands/worktree/env/restart.js +90 -0
  11. package/dist/cli/commands/worktree/env/start.d.ts +15 -0
  12. package/dist/cli/commands/worktree/env/start.js +95 -0
  13. package/dist/cli/commands/worktree/env/status.d.ts +19 -0
  14. package/dist/cli/commands/worktree/env/status.js +155 -0
  15. package/dist/cli/commands/worktree/env/stop.d.ts +15 -0
  16. package/dist/cli/commands/worktree/env/stop.js +83 -0
  17. package/dist/cli/commands/{repo/worktree → worktree}/list.d.ts +2 -6
  18. package/dist/cli/commands/worktree/list.js +133 -0
  19. package/dist/cli/commands/worktree/rm.d.ts +18 -0
  20. package/dist/cli/commands/worktree/rm.js +118 -0
  21. package/dist/cli/commands/worktree/show.d.ts +19 -0
  22. package/dist/cli/commands/worktree/show.js +185 -0
  23. package/dist/cli/commands/worktree/update.d.ts +20 -0
  24. package/dist/cli/commands/worktree/update.js +111 -0
  25. package/dist/core/api/index.d.cts +53 -2
  26. package/dist/core/api/index.d.ts +53 -2
  27. package/dist/core/config/browser.d.cts +3 -24
  28. package/dist/core/config/browser.d.ts +3 -24
  29. package/dist/core/config/index.cjs +16 -107
  30. package/dist/core/config/index.d.cts +3 -85
  31. package/dist/core/config/index.d.ts +3 -85
  32. package/dist/core/config/index.js +15 -98
  33. package/dist/core/db/index.cjs +10 -35
  34. package/dist/core/db/index.d.cts +3 -3
  35. package/dist/core/db/index.d.ts +3 -3
  36. package/dist/core/db/index.js +10 -35
  37. package/dist/core/environment/variable-resolver.d.cts +1 -1
  38. package/dist/core/environment/variable-resolver.d.ts +1 -1
  39. package/dist/core/index.cjs +24 -140
  40. package/dist/core/index.d.cts +5 -5
  41. package/dist/core/index.d.ts +5 -5
  42. package/dist/core/index.js +24 -132
  43. package/dist/core/package.json +50 -94
  44. package/dist/core/{repo-CnvJ0B6-.d.ts → repo-BoA8D6Uf.d.ts} +0 -10
  45. package/dist/core/{repo-3CUrCRbq.d.cts → repo-Dr--T0wp.d.cts} +0 -10
  46. package/dist/core/tools/index.cjs +723 -705
  47. package/dist/core/tools/index.d.cts +2 -17
  48. package/dist/core/tools/index.d.ts +2 -17
  49. package/dist/core/tools/index.js +723 -705
  50. package/dist/core/types/index.d.cts +1 -1
  51. package/dist/core/types/index.d.ts +1 -1
  52. package/dist/core/{dist/worktrees-BzIxB1U6.d.cts → worktrees-04Oos4ql.d.cts} +2 -12
  53. package/dist/core/{dist/worktrees-CYem1ya2.d.ts → worktrees-BK_zQmrd.d.ts} +2 -12
  54. package/dist/daemon/index.js +0 -16
  55. package/dist/daemon/services/mcp-servers.d.ts +2 -7
  56. package/dist/daemon/services/worktrees.d.ts +2 -21
  57. package/dist/daemon/services/worktrees.js +0 -16
  58. package/dist/ui/assets/{index-KfIu8v4V.js → index-BAYihef5.js} +21 -21
  59. package/dist/ui/index.html +1 -1
  60. package/package.json +5 -2
  61. package/scripts/postinstall.js +39 -0
  62. package/dist/cli/commands/config/clear.d.ts +0 -13
  63. package/dist/cli/commands/config/clear.js +0 -21
  64. package/dist/cli/commands/repo/worktree/list.js +0 -136
  65. package/dist/core/dist/agentic-tool-B_gFNpk5.d.ts +0 -33
  66. package/dist/core/dist/agentic-tool-DsyX8diw.d.cts +0 -33
  67. package/dist/core/dist/api/index.cjs +0 -98
  68. package/dist/core/dist/api/index.d.cts +0 -174
  69. package/dist/core/dist/api/index.d.ts +0 -174
  70. package/dist/core/dist/api/index.js +0 -62
  71. package/dist/core/dist/board-comment-BUm0fpmD.d.cts +0 -134
  72. package/dist/core/dist/board-comment-gC_-twPx.d.ts +0 -134
  73. package/dist/core/dist/claude/index.cjs +0 -673
  74. package/dist/core/dist/claude/index.d.cts +0 -124
  75. package/dist/core/dist/claude/index.d.ts +0 -124
  76. package/dist/core/dist/claude/index.js +0 -629
  77. package/dist/core/dist/config/browser.cjs +0 -165
  78. package/dist/core/dist/config/browser.d.cts +0 -289
  79. package/dist/core/dist/config/browser.d.ts +0 -289
  80. package/dist/core/dist/config/browser.js +0 -131
  81. package/dist/core/dist/config/index.cjs +0 -518
  82. package/dist/core/dist/config/index.d.cts +0 -246
  83. package/dist/core/dist/config/index.d.ts +0 -246
  84. package/dist/core/dist/config/index.js +0 -451
  85. package/dist/core/dist/db/index.cjs +0 -3726
  86. package/dist/core/dist/db/index.d.cts +0 -631
  87. package/dist/core/dist/db/index.d.ts +0 -631
  88. package/dist/core/dist/db/index.js +0 -3649
  89. package/dist/core/dist/environment/variable-resolver.cjs +0 -92
  90. package/dist/core/dist/environment/variable-resolver.d.cts +0 -52
  91. package/dist/core/dist/environment/variable-resolver.d.ts +0 -52
  92. package/dist/core/dist/environment/variable-resolver.js +0 -53
  93. package/dist/core/dist/feathers/index.cjs +0 -66
  94. package/dist/core/dist/feathers/index.d.cts +0 -7
  95. package/dist/core/dist/feathers/index.d.ts +0 -7
  96. package/dist/core/dist/feathers/index.js +0 -25
  97. package/dist/core/dist/feathers-BzHEPnpl.d.cts +0 -228
  98. package/dist/core/dist/feathers-BzHEPnpl.d.ts +0 -228
  99. package/dist/core/dist/git/index.cjs +0 -302
  100. package/dist/core/dist/git/index.d.cts +0 -137
  101. package/dist/core/dist/git/index.d.ts +0 -137
  102. package/dist/core/dist/git/index.js +0 -260
  103. package/dist/core/dist/id-DMqyogFB.d.cts +0 -131
  104. package/dist/core/dist/id-DMqyogFB.d.ts +0 -131
  105. package/dist/core/dist/index.cjs +0 -4653
  106. package/dist/core/dist/index.d.cts +0 -23
  107. package/dist/core/dist/index.d.ts +0 -23
  108. package/dist/core/dist/index.js +0 -4509
  109. package/dist/core/dist/message-BoxZISHg.d.cts +0 -120
  110. package/dist/core/dist/message-DvBzHu7V.d.ts +0 -120
  111. package/dist/core/dist/permissions/index.cjs +0 -112
  112. package/dist/core/dist/permissions/index.d.cts +0 -81
  113. package/dist/core/dist/permissions/index.d.ts +0 -81
  114. package/dist/core/dist/permissions/index.js +0 -85
  115. package/dist/core/dist/repo-3CUrCRbq.d.cts +0 -405
  116. package/dist/core/dist/repo-CnvJ0B6-.d.ts +0 -405
  117. package/dist/core/dist/session-BPjJlVdZ.d.cts +0 -429
  118. package/dist/core/dist/session-wAzjHatv.d.ts +0 -429
  119. package/dist/core/dist/task-BIEgT1DK.d.cts +0 -163
  120. package/dist/core/dist/task-DuIfiUbW.d.ts +0 -163
  121. package/dist/core/dist/templates/handlebars-helpers.cjs +0 -156
  122. package/dist/core/dist/templates/handlebars-helpers.d.cts +0 -45
  123. package/dist/core/dist/templates/handlebars-helpers.d.ts +0 -45
  124. package/dist/core/dist/templates/handlebars-helpers.js +0 -119
  125. package/dist/core/dist/tools/claude/models.cjs +0 -70
  126. package/dist/core/dist/tools/claude/models.d.cts +0 -27
  127. package/dist/core/dist/tools/claude/models.d.ts +0 -27
  128. package/dist/core/dist/tools/claude/models.js +0 -44
  129. package/dist/core/dist/tools/index.cjs +0 -3367
  130. package/dist/core/dist/tools/index.d.cts +0 -967
  131. package/dist/core/dist/tools/index.d.ts +0 -967
  132. package/dist/core/dist/tools/index.js +0 -3314
  133. package/dist/core/dist/tools/models.cjs +0 -119
  134. package/dist/core/dist/tools/models.d.cts +0 -47
  135. package/dist/core/dist/tools/models.d.ts +0 -47
  136. package/dist/core/dist/tools/models.js +0 -86
  137. package/dist/core/dist/types/index.cjs +0 -152
  138. package/dist/core/dist/types/index.d.cts +0 -214
  139. package/dist/core/dist/types/index.d.ts +0 -214
  140. package/dist/core/dist/types/index.js +0 -112
  141. package/dist/core/dist/user-BmL3kFol.d.ts +0 -50
  142. package/dist/core/dist/user-eUuKj7yM.d.cts +0 -50
  143. package/dist/core/dist/utils/pricing.cjs +0 -102
  144. package/dist/core/dist/utils/pricing.d.cts +0 -43
  145. package/dist/core/dist/utils/pricing.d.ts +0 -43
  146. package/dist/core/dist/utils/pricing.js +0 -75
  147. package/dist/core/worktrees-BzIxB1U6.d.cts +0 -2745
  148. package/dist/core/worktrees-CYem1ya2.d.ts +0 -2745
@@ -1,17 +1,17 @@
1
1
  // src/commands/config/get.ts
2
- import { getConfigValue, getContext } from "@agor/core/config";
2
+ import { getConfigValue } from "@agor/core/config";
3
3
  import { Args, Command } from "@oclif/core";
4
4
  var ConfigGet = class _ConfigGet extends Command {
5
5
  static description = "Get a configuration value";
6
6
  static examples = [
7
- "<%= config.bin %> <%= command.id %> board",
8
- "<%= config.bin %> <%= command.id %> session",
7
+ "<%= config.bin %> <%= command.id %> defaults.board",
8
+ "<%= config.bin %> <%= command.id %> defaults.agent",
9
9
  "<%= config.bin %> <%= command.id %> credentials.ANTHROPIC_API_KEY",
10
10
  "<%= config.bin %> <%= command.id %> daemon.port"
11
11
  ];
12
12
  static args = {
13
13
  key: Args.string({
14
- description: "Configuration key (e.g., board, daemon.port, credentials.ANTHROPIC_API_KEY)",
14
+ description: "Configuration key in format: section.key (e.g., daemon.port, credentials.ANTHROPIC_API_KEY)",
15
15
  required: true
16
16
  })
17
17
  };
@@ -19,13 +19,7 @@ var ConfigGet = class _ConfigGet extends Command {
19
19
  const { args } = await this.parse(_ConfigGet);
20
20
  const key = args.key;
21
21
  try {
22
- let value;
23
- const contextKeys = ["board", "session", "repo", "agent"];
24
- if (contextKeys.includes(key)) {
25
- value = await getContext(key);
26
- } else {
27
- value = await getConfigValue(key);
28
- }
22
+ const value = await getConfigValue(key);
29
23
  if (value !== void 0) {
30
24
  this.log(String(value));
31
25
  } else {
@@ -1,7 +1,7 @@
1
1
  import { Command } from '@oclif/core';
2
2
 
3
3
  /**
4
- * `agor config` - Show all configuration and active context
4
+ * `agor config` - Show all configuration
5
5
  */
6
6
 
7
7
  declare class ConfigIndex extends Command {
@@ -1,32 +1,16 @@
1
1
  // src/commands/config/index.ts
2
- import { getConfigPath, getEffectiveConfig, loadConfig } from "@agor/core/config";
2
+ import { getConfigPath, getDefaultConfig, loadConfig } from "@agor/core/config";
3
3
  import { Command } from "@oclif/core";
4
4
  import chalk from "chalk";
5
5
  var ConfigIndex = class extends Command {
6
- static description = "Show current configuration and active context";
6
+ static description = "Show current configuration";
7
7
  static examples = ["<%= config.bin %> <%= command.id %>"];
8
8
  async run() {
9
9
  try {
10
10
  const config = await loadConfig();
11
- const effective = await getEffectiveConfig(config);
11
+ const defaults = getDefaultConfig();
12
12
  this.log(chalk.bold("\nCurrent Configuration"));
13
13
  this.log(chalk.dim("\u2500".repeat(50)));
14
- this.log(chalk.bold("\nActive Context:"));
15
- if (effective.board) {
16
- this.log(` board: ${chalk.cyan(effective.board)}`);
17
- }
18
- if (effective.session) {
19
- this.log(` session: ${chalk.cyan(effective.session)}`);
20
- }
21
- if (effective.repo) {
22
- this.log(` repo: ${chalk.cyan(effective.repo)}`);
23
- }
24
- if (effective.agent) {
25
- this.log(` agent: ${chalk.cyan(effective.agent)}`);
26
- }
27
- if (!effective.board && !effective.session && !effective.repo && !effective.agent) {
28
- this.log(chalk.dim(" (no active context)"));
29
- }
30
14
  this.log(chalk.bold("\nGlobal Defaults:"));
31
15
  if (config.defaults?.board) {
32
16
  this.log(` default board: ${chalk.gray(config.defaults.board)}`);
@@ -54,8 +38,6 @@ var ConfigIndex = class extends Command {
54
38
  }
55
39
  }
56
40
  }
57
- const { getDefaultConfig } = await import("@agor/core/config");
58
- const defaults = getDefaultConfig();
59
41
  const daemonConfig = { ...defaults.daemon, ...config.daemon };
60
42
  if (daemonConfig) {
61
43
  this.log(chalk.bold("\nDaemon Settings:"));
@@ -86,9 +68,6 @@ var ConfigIndex = class extends Command {
86
68
  this.log(chalk.bold("\nAvailable Configuration Keys:"));
87
69
  this.log(chalk.dim(" Use `agor config set <key> <value>` to set any of these:"));
88
70
  this.log("");
89
- this.log(chalk.cyan(" Context (temporary, cleared with `agor config clear`):"));
90
- this.log(" board, session, repo, agent");
91
- this.log("");
92
71
  this.log(chalk.cyan(" Defaults:"));
93
72
  this.log(" defaults.board, defaults.agent");
94
73
  this.log("");
@@ -99,7 +78,7 @@ var ConfigIndex = class extends Command {
99
78
  this.log(" credentials.ANTHROPIC_API_KEY");
100
79
  this.log(" credentials.OPENAI_API_KEY");
101
80
  this.log(" credentials.CURSOR_API_KEY");
102
- this.log(" credentials.GOOGLE_API_KEY");
81
+ this.log(" credentials.GEMINI_API_KEY");
103
82
  this.log("");
104
83
  this.log(chalk.cyan(" Daemon:"));
105
84
  this.log(" daemon.port, daemon.host");
@@ -5,16 +5,14 @@ import chalk from "chalk";
5
5
  var ConfigSet = class _ConfigSet extends Command {
6
6
  static description = "Set a configuration value";
7
7
  static examples = [
8
- "<%= config.bin %> <%= command.id %> board experiments",
9
- "<%= config.bin %> <%= command.id %> session 01933e4a",
10
- "<%= config.bin %> <%= command.id %> repo anthropics/agor:main",
11
- "<%= config.bin %> <%= command.id %> agent claude-code",
8
+ "<%= config.bin %> <%= command.id %> defaults.board experiments",
9
+ "<%= config.bin %> <%= command.id %> defaults.agent claude-code",
12
10
  "<%= config.bin %> <%= command.id %> credentials.ANTHROPIC_API_KEY sk-ant-...",
13
- "<%= config.bin %> <%= command.id %> defaults.agent cursor"
11
+ "<%= config.bin %> <%= command.id %> daemon.port 4000"
14
12
  ];
15
13
  static args = {
16
14
  key: Args.string({
17
- description: "Configuration key (supports dot notation: credentials.ANTHROPIC_API_KEY)",
15
+ description: "Configuration key in format: section.key (e.g., daemon.port, credentials.ANTHROPIC_API_KEY)",
18
16
  required: true
19
17
  }),
20
18
  value: Args.string({
@@ -1,27 +1,25 @@
1
1
  // src/commands/config/unset.ts
2
- import { unsetContext } from "@agor/core/config";
2
+ import { unsetConfigValue } from "@agor/core/config";
3
3
  import { Args, Command } from "@oclif/core";
4
4
  import chalk from "chalk";
5
5
  var ConfigUnset = class _ConfigUnset extends Command {
6
6
  static description = "Unset (clear) a configuration value";
7
7
  static examples = [
8
- "<%= config.bin %> <%= command.id %> board",
9
- "<%= config.bin %> <%= command.id %> session",
10
- "<%= config.bin %> <%= command.id %> repo",
11
- "<%= config.bin %> <%= command.id %> agent"
8
+ "<%= config.bin %> <%= command.id %> defaults.board",
9
+ "<%= config.bin %> <%= command.id %> defaults.agent",
10
+ "<%= config.bin %> <%= command.id %> credentials.ANTHROPIC_API_KEY"
12
11
  ];
13
12
  static args = {
14
13
  key: Args.string({
15
- description: "Configuration key to unset (board, session, repo, agent)",
16
- required: true,
17
- options: ["board", "session", "repo", "agent"]
14
+ description: "Configuration key in format: section.key (e.g., defaults.board)",
15
+ required: true
18
16
  })
19
17
  };
20
18
  async run() {
21
19
  const { args } = await this.parse(_ConfigUnset);
22
20
  const key = args.key;
23
21
  try {
24
- await unsetContext(key);
22
+ await unsetConfigValue(key);
25
23
  this.log(`${chalk.green("\u2713")} Unset ${chalk.cyan(key)}`);
26
24
  } catch (error) {
27
25
  this.error(
@@ -92,7 +92,6 @@ ${chalk.blue("\u25CF")} Loading Claude Code session: ${chalk.cyan(sessionId)}
92
92
  // Will be auto-assigned by service hook
93
93
  path: absoluteProjectDir,
94
94
  new_branch: false,
95
- sessions: [],
96
95
  last_used: (/* @__PURE__ */ new Date()).toISOString(),
97
96
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
98
97
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -5,10 +5,10 @@ declare class WorktreeAdd extends Command {
5
5
  static description: string;
6
6
  static examples: string[];
7
7
  static args: {
8
- repoSlug: _oclif_core_interfaces.Arg<string, Record<string, unknown>>;
9
8
  name: _oclif_core_interfaces.Arg<string, Record<string, unknown>>;
10
9
  };
11
10
  static flags: {
11
+ 'repo-id': _oclif_core_interfaces.OptionFlag<string, _oclif_core_interfaces.CustomOptions>;
12
12
  branch: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
13
13
  checkout: _oclif_core_interfaces.BooleanFlag<boolean>;
14
14
  ref: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
@@ -1,4 +1,4 @@
1
- // src/commands/repo/worktree/add.ts
1
+ // src/commands/worktree/add.ts
2
2
  import { createClient, isDaemonRunning } from "@agor/core/api";
3
3
  import { getDaemonUrl } from "@agor/core/config";
4
4
  import { Args, Command, Flags } from "@oclif/core";
@@ -7,27 +7,27 @@ var WorktreeAdd = class _WorktreeAdd extends Command {
7
7
  static description = "Create a git worktree for isolated development";
8
8
  static examples = [
9
9
  // Case 1: Create new branch (worktree name = branch name)
10
- "<%= config.bin %> <%= command.id %> superset feature-auth",
10
+ "<%= config.bin %> <%= command.id %> feature-auth --repo-id 01933e4a",
11
11
  // Case 2: Create new branch with different name
12
- "<%= config.bin %> <%= command.id %> superset my-experiment --branch feature-x",
12
+ "<%= config.bin %> <%= command.id %> my-experiment --repo-id 01933e4a --branch feature-x",
13
13
  // Case 3: Checkout existing branch
14
- "<%= config.bin %> <%= command.id %> superset fix-api --checkout",
14
+ "<%= config.bin %> <%= command.id %> fix-api --repo-id 01933e4a --checkout",
15
15
  // Case 4: Checkout specific ref
16
- "<%= config.bin %> <%= command.id %> superset debug-session --ref abc123def",
16
+ "<%= config.bin %> <%= command.id %> debug-session --repo-id 01933e4a --ref abc123def",
17
17
  // Case 5: Create branch from specific base
18
- "<%= config.bin %> <%= command.id %> superset feature-y --from develop"
18
+ "<%= config.bin %> <%= command.id %> feature-y --repo-id 01933e4a --from develop"
19
19
  ];
20
20
  static args = {
21
- repoSlug: Args.string({
22
- description: "Repository slug",
23
- required: true
24
- }),
25
21
  name: Args.string({
26
22
  description: "Worktree name (becomes branch name if creating new)",
27
23
  required: true
28
24
  })
29
25
  };
30
26
  static flags = {
27
+ "repo-id": Flags.string({
28
+ description: "Repository ID",
29
+ required: true
30
+ }),
31
31
  branch: Flags.string({
32
32
  char: "b",
33
33
  description: "Branch name (defaults to same as worktree name)"
@@ -62,16 +62,7 @@ var WorktreeAdd = class _WorktreeAdd extends Command {
62
62
  try {
63
63
  const client = createClient(daemonUrl);
64
64
  const reposService = client.service("repos");
65
- const repos = await reposService.find({
66
- query: { slug: args.repoSlug, $limit: 1 }
67
- });
68
- const reposList = Array.isArray(repos) ? repos : repos.data;
69
- if (!reposList || reposList.length === 0) {
70
- this.error(
71
- `Repository '${args.repoSlug}' not found. Use ${chalk.cyan("agor repo list")} to see available repos.`
72
- );
73
- }
74
- const repo = reposList[0];
65
+ const repo = await reposService.get(flags["repo-id"]);
75
66
  const worktreesService = client.service("worktrees");
76
67
  const existingWorktrees = await worktreesService.find({
77
68
  query: {
@@ -86,7 +77,7 @@ var WorktreeAdd = class _WorktreeAdd extends Command {
86
77
  this.log("");
87
78
  this.log(
88
79
  chalk.bold(
89
- `Creating worktree ${chalk.cyan(args.name)} in repository ${chalk.cyan(args.repoSlug)}...`
80
+ `Creating worktree ${chalk.cyan(args.name)} in repository ${chalk.cyan(flags["repo-id"])}...`
90
81
  )
91
82
  );
92
83
  this.log("");
@@ -128,7 +119,7 @@ var WorktreeAdd = class _WorktreeAdd extends Command {
128
119
  this.log(chalk.bold("Next steps:"));
129
120
  this.log(` ${chalk.dim("cd")} ${newWorktree.path}`);
130
121
  this.log(
131
- ` ${chalk.dim("or start session:")} ${chalk.cyan(`agor session start --repo ${args.repoSlug} --worktree ${args.name}`)}`
122
+ ` ${chalk.dim("or start session:")} ${chalk.cyan(`agor session start --repo ${flags["repo-id"]} --worktree ${args.name}`)}`
132
123
  );
133
124
  this.log("");
134
125
  client.io.close();
@@ -0,0 +1,15 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { BaseCommand } from '../../../base-command.js';
3
+ import '@agor/core/api';
4
+ import '@oclif/core';
5
+
6
+ declare class WorktreeEnvRestart extends BaseCommand {
7
+ static description: string;
8
+ static examples: string[];
9
+ static args: {
10
+ worktreeId: _oclif_core_interfaces.Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+
15
+ export { WorktreeEnvRestart as default };
@@ -0,0 +1,90 @@
1
+ // src/commands/worktree/env/restart.ts
2
+ import { formatShortId } from "@agor/core/db";
3
+ import { Args } from "@oclif/core";
4
+ import chalk2 from "chalk";
5
+
6
+ // src/base-command.ts
7
+ import { createClient, isDaemonRunning } from "@agor/core/api";
8
+ import { getDaemonUrl } from "@agor/core/config";
9
+ import { Command } from "@oclif/core";
10
+ import chalk from "chalk";
11
+ var BaseCommand = class extends Command {
12
+ daemonUrl = null;
13
+ /**
14
+ * Connect to daemon (checks if running first)
15
+ *
16
+ * @returns Feathers client instance
17
+ */
18
+ async connectToDaemon() {
19
+ this.daemonUrl = await getDaemonUrl();
20
+ const running = await isDaemonRunning(this.daemonUrl);
21
+ if (!running) {
22
+ this.log(
23
+ chalk.red("\u2717 Daemon not running") + "\n\n" + chalk.bold("To start the daemon:") + "\n " + chalk.cyan("cd apps/agor-daemon && pnpm dev") + "\n\n" + chalk.bold("To configure daemon URL:") + "\n " + chalk.cyan("agor config set daemon.url <url>") + "\n " + chalk.gray(`Current: ${this.daemonUrl}`)
24
+ );
25
+ this.exit(1);
26
+ }
27
+ return createClient(this.daemonUrl, true, { verbose: false });
28
+ }
29
+ /**
30
+ * Cleanup client connection
31
+ *
32
+ * Ensures socket is properly closed to prevent hanging processes
33
+ */
34
+ async cleanupClient(client) {
35
+ await new Promise((resolve) => {
36
+ client.io.once("disconnect", () => resolve());
37
+ client.io.removeAllListeners("connect");
38
+ client.io.removeAllListeners("connect_error");
39
+ client.io.close();
40
+ setTimeout(resolve, 1e3);
41
+ });
42
+ }
43
+ };
44
+
45
+ // src/commands/worktree/env/restart.ts
46
+ var WorktreeEnvRestart = class _WorktreeEnvRestart extends BaseCommand {
47
+ static description = "Restart worktree environment";
48
+ static examples = [
49
+ "<%= config.bin %> <%= command.id %> abc123",
50
+ "<%= config.bin %> <%= command.id %> 01933e4a-b2c1-7890-a456-789012345678"
51
+ ];
52
+ static args = {
53
+ worktreeId: Args.string({
54
+ description: "Worktree ID (full UUID or short ID)",
55
+ required: true
56
+ })
57
+ };
58
+ async run() {
59
+ const { args } = await this.parse(_WorktreeEnvRestart);
60
+ const client = await this.connectToDaemon();
61
+ try {
62
+ const worktreesService = client.service("worktrees");
63
+ const worktree = await worktreesService.get(args.worktreeId);
64
+ this.log("");
65
+ this.log(`Restarting environment for ${chalk2.cyan(worktree.name)}...`);
66
+ this.log(` ID: ${chalk2.dim(formatShortId(worktree.worktree_id))}`);
67
+ this.log("");
68
+ const updated = await worktreesService.restartEnvironment(worktree.worktree_id);
69
+ this.log(`${chalk2.green("\u2713")} Environment restarted`);
70
+ if (updated.environment_instance?.access_urls) {
71
+ this.log("");
72
+ this.log(chalk2.bold("Access URLs:"));
73
+ for (const url of updated.environment_instance.access_urls) {
74
+ this.log(` ${url.name}: ${chalk2.blue(url.url)}`);
75
+ }
76
+ }
77
+ this.log("");
78
+ await this.cleanupClient(client);
79
+ process.exit(0);
80
+ } catch (error) {
81
+ await this.cleanupClient(client);
82
+ this.error(
83
+ `Failed to restart environment: ${error instanceof Error ? error.message : String(error)}`
84
+ );
85
+ }
86
+ }
87
+ };
88
+ export {
89
+ WorktreeEnvRestart as default
90
+ };
@@ -0,0 +1,15 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { BaseCommand } from '../../../base-command.js';
3
+ import '@agor/core/api';
4
+ import '@oclif/core';
5
+
6
+ declare class WorktreeEnvStart extends BaseCommand {
7
+ static description: string;
8
+ static examples: string[];
9
+ static args: {
10
+ worktreeId: _oclif_core_interfaces.Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+
15
+ export { WorktreeEnvStart as default };
@@ -0,0 +1,95 @@
1
+ // src/commands/worktree/env/start.ts
2
+ import { formatShortId } from "@agor/core/db";
3
+ import { Args } from "@oclif/core";
4
+ import chalk2 from "chalk";
5
+
6
+ // src/base-command.ts
7
+ import { createClient, isDaemonRunning } from "@agor/core/api";
8
+ import { getDaemonUrl } from "@agor/core/config";
9
+ import { Command } from "@oclif/core";
10
+ import chalk from "chalk";
11
+ var BaseCommand = class extends Command {
12
+ daemonUrl = null;
13
+ /**
14
+ * Connect to daemon (checks if running first)
15
+ *
16
+ * @returns Feathers client instance
17
+ */
18
+ async connectToDaemon() {
19
+ this.daemonUrl = await getDaemonUrl();
20
+ const running = await isDaemonRunning(this.daemonUrl);
21
+ if (!running) {
22
+ this.log(
23
+ chalk.red("\u2717 Daemon not running") + "\n\n" + chalk.bold("To start the daemon:") + "\n " + chalk.cyan("cd apps/agor-daemon && pnpm dev") + "\n\n" + chalk.bold("To configure daemon URL:") + "\n " + chalk.cyan("agor config set daemon.url <url>") + "\n " + chalk.gray(`Current: ${this.daemonUrl}`)
24
+ );
25
+ this.exit(1);
26
+ }
27
+ return createClient(this.daemonUrl, true, { verbose: false });
28
+ }
29
+ /**
30
+ * Cleanup client connection
31
+ *
32
+ * Ensures socket is properly closed to prevent hanging processes
33
+ */
34
+ async cleanupClient(client) {
35
+ await new Promise((resolve) => {
36
+ client.io.once("disconnect", () => resolve());
37
+ client.io.removeAllListeners("connect");
38
+ client.io.removeAllListeners("connect_error");
39
+ client.io.close();
40
+ setTimeout(resolve, 1e3);
41
+ });
42
+ }
43
+ };
44
+
45
+ // src/commands/worktree/env/start.ts
46
+ var WorktreeEnvStart = class _WorktreeEnvStart extends BaseCommand {
47
+ static description = "Start worktree environment";
48
+ static examples = [
49
+ "<%= config.bin %> <%= command.id %> abc123",
50
+ "<%= config.bin %> <%= command.id %> 01933e4a-b2c1-7890-a456-789012345678"
51
+ ];
52
+ static args = {
53
+ worktreeId: Args.string({
54
+ description: "Worktree ID (full UUID or short ID)",
55
+ required: true
56
+ })
57
+ };
58
+ async run() {
59
+ const { args } = await this.parse(_WorktreeEnvStart);
60
+ const client = await this.connectToDaemon();
61
+ try {
62
+ const worktreesService = client.service("worktrees");
63
+ const worktree = await worktreesService.get(args.worktreeId);
64
+ this.log("");
65
+ this.log(`Starting environment for ${chalk2.cyan(worktree.name)}...`);
66
+ this.log(` ID: ${chalk2.dim(formatShortId(worktree.worktree_id))}`);
67
+ this.log(` Path: ${chalk2.dim(worktree.path)}`);
68
+ this.log("");
69
+ const updated = await worktreesService.startEnvironment(worktree.worktree_id);
70
+ this.log(`${chalk2.green("\u2713")} Environment started`);
71
+ if (updated.environment_instance?.access_urls) {
72
+ this.log("");
73
+ this.log(chalk2.bold("Access URLs:"));
74
+ for (const url of updated.environment_instance.access_urls) {
75
+ this.log(` ${url.name}: ${chalk2.blue(url.url)}`);
76
+ }
77
+ }
78
+ this.log("");
79
+ this.log(
80
+ chalk2.dim(`Check status with: ${chalk2.cyan(`agor worktree env status ${args.worktreeId}`)}`)
81
+ );
82
+ this.log("");
83
+ await this.cleanupClient(client);
84
+ process.exit(0);
85
+ } catch (error) {
86
+ await this.cleanupClient(client);
87
+ this.error(
88
+ `Failed to start environment: ${error instanceof Error ? error.message : String(error)}`
89
+ );
90
+ }
91
+ }
92
+ };
93
+ export {
94
+ WorktreeEnvStart as default
95
+ };
@@ -0,0 +1,19 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { BaseCommand } from '../../../base-command.js';
3
+ import '@agor/core/api';
4
+ import '@oclif/core';
5
+
6
+ declare class WorktreeEnvStatus extends BaseCommand {
7
+ static description: string;
8
+ static examples: string[];
9
+ static args: {
10
+ worktreeId: _oclif_core_interfaces.Arg<string, Record<string, unknown>>;
11
+ };
12
+ /**
13
+ * Format relative time
14
+ */
15
+ private formatRelativeTime;
16
+ run(): Promise<void>;
17
+ }
18
+
19
+ export { WorktreeEnvStatus as default };
@@ -0,0 +1,155 @@
1
+ // src/commands/worktree/env/status.ts
2
+ import { formatShortId } from "@agor/core/db";
3
+ import { Args } from "@oclif/core";
4
+ import chalk2 from "chalk";
5
+
6
+ // src/base-command.ts
7
+ import { createClient, isDaemonRunning } from "@agor/core/api";
8
+ import { getDaemonUrl } from "@agor/core/config";
9
+ import { Command } from "@oclif/core";
10
+ import chalk from "chalk";
11
+ var BaseCommand = class extends Command {
12
+ daemonUrl = null;
13
+ /**
14
+ * Connect to daemon (checks if running first)
15
+ *
16
+ * @returns Feathers client instance
17
+ */
18
+ async connectToDaemon() {
19
+ this.daemonUrl = await getDaemonUrl();
20
+ const running = await isDaemonRunning(this.daemonUrl);
21
+ if (!running) {
22
+ this.log(
23
+ chalk.red("\u2717 Daemon not running") + "\n\n" + chalk.bold("To start the daemon:") + "\n " + chalk.cyan("cd apps/agor-daemon && pnpm dev") + "\n\n" + chalk.bold("To configure daemon URL:") + "\n " + chalk.cyan("agor config set daemon.url <url>") + "\n " + chalk.gray(`Current: ${this.daemonUrl}`)
24
+ );
25
+ this.exit(1);
26
+ }
27
+ return createClient(this.daemonUrl, true, { verbose: false });
28
+ }
29
+ /**
30
+ * Cleanup client connection
31
+ *
32
+ * Ensures socket is properly closed to prevent hanging processes
33
+ */
34
+ async cleanupClient(client) {
35
+ await new Promise((resolve) => {
36
+ client.io.once("disconnect", () => resolve());
37
+ client.io.removeAllListeners("connect");
38
+ client.io.removeAllListeners("connect_error");
39
+ client.io.close();
40
+ setTimeout(resolve, 1e3);
41
+ });
42
+ }
43
+ };
44
+
45
+ // src/commands/worktree/env/status.ts
46
+ var WorktreeEnvStatus = class _WorktreeEnvStatus extends BaseCommand {
47
+ static description = "Check worktree environment status";
48
+ static examples = [
49
+ "<%= config.bin %> <%= command.id %> abc123",
50
+ "<%= config.bin %> <%= command.id %> 01933e4a-b2c1-7890-a456-789012345678"
51
+ ];
52
+ static args = {
53
+ worktreeId: Args.string({
54
+ description: "Worktree ID (full UUID or short ID)",
55
+ required: true
56
+ })
57
+ };
58
+ /**
59
+ * Format relative time
60
+ */
61
+ formatRelativeTime(isoDate) {
62
+ const now = Date.now();
63
+ const date = new Date(isoDate).getTime();
64
+ const diff = now - date;
65
+ const seconds = Math.floor(diff / 1e3);
66
+ const minutes = Math.floor(seconds / 60);
67
+ const hours = Math.floor(minutes / 60);
68
+ const days = Math.floor(hours / 24);
69
+ if (days > 0) return `${days}d ago`;
70
+ if (hours > 0) return `${hours}h ago`;
71
+ if (minutes > 0) return `${minutes}m ago`;
72
+ return `${seconds}s ago`;
73
+ }
74
+ async run() {
75
+ const { args } = await this.parse(_WorktreeEnvStatus);
76
+ const client = await this.connectToDaemon();
77
+ try {
78
+ const worktreesService = client.service("worktrees");
79
+ const worktree = await worktreesService.get(args.worktreeId);
80
+ this.log("");
81
+ this.log(chalk2.bold(`Environment Status: ${chalk2.cyan(worktree.name)}`));
82
+ this.log(` ID: ${chalk2.dim(formatShortId(worktree.worktree_id))}`);
83
+ this.log("");
84
+ if (!worktree.environment_instance) {
85
+ this.log(chalk2.dim(" No environment configured"));
86
+ this.log("");
87
+ await this.cleanupClient(client);
88
+ process.exit(0);
89
+ return;
90
+ }
91
+ const env = worktree.environment_instance;
92
+ const statusColors = {
93
+ running: chalk2.green,
94
+ stopped: chalk2.gray,
95
+ starting: chalk2.yellow,
96
+ stopping: chalk2.yellow,
97
+ error: chalk2.red
98
+ };
99
+ const statusColor = statusColors[env.status] || chalk2.dim;
100
+ this.log(` Status: ${statusColor(env.status.toUpperCase())}`);
101
+ this.log("");
102
+ if (env.access_urls && env.access_urls.length > 0) {
103
+ this.log(chalk2.bold(" Access URLs:"));
104
+ for (const url of env.access_urls) {
105
+ this.log(` ${url.name}: ${chalk2.blue(url.url)}`);
106
+ }
107
+ this.log("");
108
+ }
109
+ if (env.last_health_check) {
110
+ const health = env.last_health_check;
111
+ const healthColor = health.status === "healthy" ? chalk2.green : health.status === "unhealthy" ? chalk2.red : chalk2.dim;
112
+ this.log(chalk2.bold(" Health Check:"));
113
+ this.log(` Status: ${healthColor(health.status)}`);
114
+ this.log(` Message: ${chalk2.dim(health.message)}`);
115
+ this.log(` Checked: ${chalk2.dim(this.formatRelativeTime(health.timestamp))}`);
116
+ this.log("");
117
+ }
118
+ if (env.process?.pid) {
119
+ this.log(chalk2.bold(" Process:"));
120
+ this.log(` PID: ${chalk2.dim(env.process.pid.toString())}`);
121
+ this.log("");
122
+ }
123
+ this.log(chalk2.dim(" Commands:"));
124
+ if (env.status === "running") {
125
+ this.log(
126
+ chalk2.dim(
127
+ ` Stop: ${chalk2.cyan(`agor worktree env stop ${formatShortId(worktree.worktree_id)}`)}`
128
+ )
129
+ );
130
+ this.log(
131
+ chalk2.dim(
132
+ ` Restart: ${chalk2.cyan(`agor worktree env restart ${formatShortId(worktree.worktree_id)}`)}`
133
+ )
134
+ );
135
+ } else {
136
+ this.log(
137
+ chalk2.dim(
138
+ ` Start: ${chalk2.cyan(`agor worktree env start ${formatShortId(worktree.worktree_id)}`)}`
139
+ )
140
+ );
141
+ }
142
+ this.log("");
143
+ await this.cleanupClient(client);
144
+ process.exit(0);
145
+ } catch (error) {
146
+ await this.cleanupClient(client);
147
+ this.error(
148
+ `Failed to check environment status: ${error instanceof Error ? error.message : String(error)}`
149
+ );
150
+ }
151
+ }
152
+ };
153
+ export {
154
+ WorktreeEnvStatus as default
155
+ };