agent-recorder 0.0.9 → 0.0.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 (79) hide show
  1. package/package.json +1 -1
  2. package/vendor/node_modules/@agent-recorder/cli/commands/configure-wrap.d.ts.map +1 -1
  3. package/vendor/node_modules/@agent-recorder/cli/commands/configure-wrap.js +5 -31
  4. package/vendor/node_modules/@agent-recorder/cli/commands/configure-wrap.js.map +1 -1
  5. package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts +2 -0
  6. package/vendor/node_modules/@agent-recorder/cli/commands/configure.d.ts.map +1 -1
  7. package/vendor/node_modules/@agent-recorder/cli/commands/configure.js +117 -1
  8. package/vendor/node_modules/@agent-recorder/cli/commands/configure.js.map +1 -1
  9. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.d.ts.map +1 -1
  10. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js +113 -19
  11. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.js.map +1 -1
  12. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.test.d.ts +5 -0
  13. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.test.d.ts.map +1 -0
  14. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.test.js +152 -0
  15. package/vendor/node_modules/@agent-recorder/cli/commands/doctor.test.js.map +1 -0
  16. package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts +7 -1
  17. package/vendor/node_modules/@agent-recorder/cli/commands/install.d.ts.map +1 -1
  18. package/vendor/node_modules/@agent-recorder/cli/commands/install.js +89 -14
  19. package/vendor/node_modules/@agent-recorder/cli/commands/install.js.map +1 -1
  20. package/vendor/node_modules/@agent-recorder/cli/commands/install.test.d.ts +5 -0
  21. package/vendor/node_modules/@agent-recorder/cli/commands/install.test.d.ts.map +1 -0
  22. package/vendor/node_modules/@agent-recorder/cli/commands/install.test.js +173 -0
  23. package/vendor/node_modules/@agent-recorder/cli/commands/install.test.js.map +1 -0
  24. package/vendor/node_modules/@agent-recorder/cli/config/hubify.d.ts +51 -0
  25. package/vendor/node_modules/@agent-recorder/cli/config/hubify.d.ts.map +1 -0
  26. package/vendor/node_modules/@agent-recorder/cli/config/hubify.js +125 -0
  27. package/vendor/node_modules/@agent-recorder/cli/config/hubify.js.map +1 -0
  28. package/vendor/node_modules/@agent-recorder/cli/config/hubify.test.d.ts +5 -0
  29. package/vendor/node_modules/@agent-recorder/cli/config/hubify.test.d.ts.map +1 -0
  30. package/vendor/node_modules/@agent-recorder/cli/config/hubify.test.js +329 -0
  31. package/vendor/node_modules/@agent-recorder/cli/config/hubify.test.js.map +1 -0
  32. package/vendor/node_modules/@agent-recorder/cli/index.js +7 -3
  33. package/vendor/node_modules/@agent-recorder/cli/index.js.map +1 -1
  34. package/vendor/node_modules/@agent-recorder/core/claude-config.d.ts +32 -0
  35. package/vendor/node_modules/@agent-recorder/core/claude-config.d.ts.map +1 -0
  36. package/vendor/node_modules/@agent-recorder/core/claude-config.js +65 -0
  37. package/vendor/node_modules/@agent-recorder/core/claude-config.js.map +1 -0
  38. package/vendor/node_modules/@agent-recorder/core/index.d.ts +3 -0
  39. package/vendor/node_modules/@agent-recorder/core/index.d.ts.map +1 -1
  40. package/vendor/node_modules/@agent-recorder/core/index.js +3 -0
  41. package/vendor/node_modules/@agent-recorder/core/index.js.map +1 -1
  42. package/vendor/node_modules/@agent-recorder/core/providers/index.d.ts +9 -0
  43. package/vendor/node_modules/@agent-recorder/core/providers/index.d.ts.map +1 -0
  44. package/vendor/node_modules/@agent-recorder/core/providers/index.js +9 -0
  45. package/vendor/node_modules/@agent-recorder/core/providers/index.js.map +1 -0
  46. package/vendor/node_modules/@agent-recorder/core/providers/io.d.ts +36 -0
  47. package/vendor/node_modules/@agent-recorder/core/providers/io.d.ts.map +1 -0
  48. package/vendor/node_modules/@agent-recorder/core/providers/io.js +88 -0
  49. package/vendor/node_modules/@agent-recorder/core/providers/io.js.map +1 -0
  50. package/vendor/node_modules/@agent-recorder/core/providers/io.test.d.ts +5 -0
  51. package/vendor/node_modules/@agent-recorder/core/providers/io.test.d.ts.map +1 -0
  52. package/vendor/node_modules/@agent-recorder/core/providers/io.test.js +248 -0
  53. package/vendor/node_modules/@agent-recorder/core/providers/io.test.js.map +1 -0
  54. package/vendor/node_modules/@agent-recorder/core/providers/types.d.ts +36 -0
  55. package/vendor/node_modules/@agent-recorder/core/providers/types.d.ts.map +1 -0
  56. package/vendor/node_modules/@agent-recorder/core/providers/types.js +6 -0
  57. package/vendor/node_modules/@agent-recorder/core/providers/types.js.map +1 -0
  58. package/vendor/node_modules/@agent-recorder/core/wrap-utils.d.ts +42 -0
  59. package/vendor/node_modules/@agent-recorder/core/wrap-utils.d.ts.map +1 -0
  60. package/vendor/node_modules/@agent-recorder/core/wrap-utils.js +80 -0
  61. package/vendor/node_modules/@agent-recorder/core/wrap-utils.js.map +1 -0
  62. package/vendor/node_modules/@agent-recorder/service/index.d.ts.map +1 -1
  63. package/vendor/node_modules/@agent-recorder/service/index.js +19 -0
  64. package/vendor/node_modules/@agent-recorder/service/index.js.map +1 -1
  65. package/vendor/node_modules/@agent-recorder/service/mcp/auto-wrap-manager.d.ts +43 -0
  66. package/vendor/node_modules/@agent-recorder/service/mcp/auto-wrap-manager.d.ts.map +1 -0
  67. package/vendor/node_modules/@agent-recorder/service/mcp/auto-wrap-manager.js +221 -0
  68. package/vendor/node_modules/@agent-recorder/service/mcp/auto-wrap-manager.js.map +1 -0
  69. package/vendor/node_modules/@agent-recorder/service/mcp/hub.test.d.ts +6 -0
  70. package/vendor/node_modules/@agent-recorder/service/mcp/hub.test.d.ts.map +1 -0
  71. package/vendor/node_modules/@agent-recorder/service/mcp/hub.test.js +319 -0
  72. package/vendor/node_modules/@agent-recorder/service/mcp/hub.test.js.map +1 -0
  73. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts +1 -0
  74. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.d.ts.map +1 -1
  75. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js +239 -34
  76. package/vendor/node_modules/@agent-recorder/service/mcp/proxy.js.map +1 -1
  77. package/vendor/node_modules/@agent-recorder/service/routes/events.d.ts.map +1 -1
  78. package/vendor/node_modules/@agent-recorder/service/routes/events.js +1 -0
  79. package/vendor/node_modules/@agent-recorder/service/routes/events.js.map +1 -1
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Tests for doctor command hub mode integration.
3
+ */
4
+ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
5
+ import { doctorCommand } from "./doctor.js";
6
+ import * as fs from "node:fs";
7
+ import * as os from "node:os";
8
+ import * as path from "node:path";
9
+ describe("Doctor Command - Hub Mode", () => {
10
+ let tempDir;
11
+ let originalHome;
12
+ let consoleLogSpy;
13
+ beforeEach(() => {
14
+ // Create temp directory to act as home
15
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ar-doctor-test-"));
16
+ originalHome = process.env.HOME || "";
17
+ process.env.HOME = tempDir;
18
+ // Spy on console.log to capture output
19
+ consoleLogSpy = vi.spyOn(console, "log").mockImplementation(() => { });
20
+ // Create .agent-recorder directory
21
+ const dataDir = path.join(tempDir, ".agent-recorder");
22
+ fs.mkdirSync(dataDir, { recursive: true });
23
+ });
24
+ afterEach(() => {
25
+ // Restore original HOME
26
+ process.env.HOME = originalHome;
27
+ // Restore console.log
28
+ consoleLogSpy.mockRestore();
29
+ // Cleanup temp directory
30
+ if (fs.existsSync(tempDir)) {
31
+ fs.rmSync(tempDir, { recursive: true, force: true });
32
+ }
33
+ });
34
+ it("shows hub mode disabled when no providers exist", async () => {
35
+ // Run doctor command (will exit with error code, but we capture output)
36
+ try {
37
+ await doctorCommand();
38
+ }
39
+ catch {
40
+ // Expected to fail since daemon isn't running
41
+ }
42
+ // Get all console.log calls
43
+ const output = consoleLogSpy.mock.calls.map((call) => call[0]).join("\n");
44
+ // Verify hub mode section exists
45
+ expect(output).toContain("Hub Mode");
46
+ expect(output).toContain("Status: disabled");
47
+ expect(output).toContain("(no HTTP providers configured)");
48
+ });
49
+ it("shows hub mode enabled when HTTP providers exist", async () => {
50
+ // Create providers.json with HTTP providers
51
+ const dataDir = path.join(tempDir, ".agent-recorder");
52
+ const providersPath = path.join(dataDir, "providers.json");
53
+ const providersData = {
54
+ version: 1,
55
+ providers: [
56
+ {
57
+ id: "github",
58
+ type: "http",
59
+ url: "http://127.0.0.1:9999/",
60
+ },
61
+ {
62
+ id: "playwright",
63
+ type: "stdio",
64
+ command: "npx",
65
+ args: ["-y", "@playwright/mcp"],
66
+ },
67
+ ],
68
+ };
69
+ fs.writeFileSync(providersPath, JSON.stringify(providersData, null, 2));
70
+ // Run doctor command
71
+ try {
72
+ await doctorCommand();
73
+ }
74
+ catch {
75
+ // Expected to fail since daemon isn't running
76
+ }
77
+ // Get all console.log calls
78
+ const output = consoleLogSpy.mock.calls.map((call) => call[0]).join("\n");
79
+ // Verify hub mode section shows enabled
80
+ expect(output).toContain("Hub Mode");
81
+ expect(output).toContain("Status: enabled");
82
+ expect(output).toContain("Total: 2");
83
+ expect(output).toContain("HTTP: 1");
84
+ expect(output).toContain("Reachable: 0/1"); // Provider not actually running
85
+ });
86
+ it("suggests hubify when Claude config exists but is not hubified", async () => {
87
+ // Create providers.json
88
+ const dataDir = path.join(tempDir, ".agent-recorder");
89
+ const providersPath = path.join(dataDir, "providers.json");
90
+ fs.writeFileSync(providersPath, JSON.stringify({
91
+ version: 1,
92
+ providers: [
93
+ { id: "github", type: "http", url: "http://127.0.0.1:9999/" },
94
+ ],
95
+ }));
96
+ // Create non-hubified Claude config
97
+ const claudeDir = path.join(tempDir, ".claude");
98
+ fs.mkdirSync(claudeDir, { recursive: true });
99
+ const claudeConfigPath = path.join(claudeDir, "settings.json");
100
+ fs.writeFileSync(claudeConfigPath, JSON.stringify({
101
+ mcpServers: {
102
+ github: { url: "http://127.0.0.1:3000/" },
103
+ playwright: { command: "npx", args: ["@playwright/mcp"] },
104
+ },
105
+ }));
106
+ // Run doctor command
107
+ try {
108
+ await doctorCommand();
109
+ }
110
+ catch {
111
+ // Expected to fail
112
+ }
113
+ // Get all console.log calls
114
+ const output = consoleLogSpy.mock.calls.map((call) => call[0]).join("\n");
115
+ // Verify it shows not hubified
116
+ expect(output).toContain("Claude Config: not hubified");
117
+ expect(output).toContain("Suggested Actions");
118
+ expect(output).toContain("install (or configure claude --hubify)");
119
+ });
120
+ it("does not suggest hubify when Claude config is hubified", async () => {
121
+ // Create providers.json
122
+ const dataDir = path.join(tempDir, ".agent-recorder");
123
+ const providersPath = path.join(dataDir, "providers.json");
124
+ fs.writeFileSync(providersPath, JSON.stringify({
125
+ version: 1,
126
+ providers: [
127
+ { id: "github", type: "http", url: "http://127.0.0.1:9999/" },
128
+ ],
129
+ }));
130
+ // Create hubified Claude config (only agent-recorder entry)
131
+ const claudeDir = path.join(tempDir, ".claude");
132
+ fs.mkdirSync(claudeDir, { recursive: true });
133
+ const claudeConfigPath = path.join(claudeDir, "settings.json");
134
+ fs.writeFileSync(claudeConfigPath, JSON.stringify({
135
+ mcpServers: {
136
+ "agent-recorder": { url: "http://127.0.0.1:8788/" },
137
+ },
138
+ }));
139
+ // Run doctor command
140
+ try {
141
+ await doctorCommand();
142
+ }
143
+ catch {
144
+ // Expected to fail
145
+ }
146
+ // Get all console.log calls
147
+ const output = consoleLogSpy.mock.calls.map((call) => call[0]).join("\n");
148
+ // Verify it does NOT show "not hubified"
149
+ expect(output).not.toContain("Claude Config: not hubified");
150
+ });
151
+ });
152
+ //# sourceMappingURL=doctor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.test.js","sourceRoot":"","sources":["../../src/commands/doctor.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;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C;QAE3D,EAAE,CAAC,aAAa,CACd,aAAa,EACb,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,CAAC;YACV,SAAS,EAAE;gBACT,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,wBAAwB,EAAE;aAC9D;SACF,CAAC,CACH,CAAC;QAEF,4DAA4D;QAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAChD,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7C,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAC/D,EAAE,CAAC,aAAa,CACd,gBAAgB,EAChB,IAAI,CAAC,SAAS,CAAC;YACb,UAAU,EAAE;gBACV,gBAAgB,EAAE,EAAE,GAAG,EAAE,wBAAwB,EAAE;aACpD;SACF,CAAC,CACH,CAAC;QAEF,qBAAqB;QACrB,IAAI,CAAC;YACH,MAAM,aAAa,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,mBAAmB;QACrB,CAAC;QAED,4BAA4B;QAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1E,yCAAyC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,13 +1,19 @@
1
1
  /**
2
2
  * Install command - set up ~/.agent-recorder/ and print configuration.
3
3
  * This command is idempotent - it won't overwrite existing files.
4
+ * Automatically configures Claude Code with hubify mode unless --no-configure is specified.
4
5
  */
6
+ export interface InstallOptions {
7
+ /** Skip automatic Claude Code configuration (default: false) */
8
+ noConfigure?: boolean;
9
+ }
5
10
  /**
6
11
  * Install Agent Recorder - create data directory and env file template.
7
12
  * This command is idempotent:
8
13
  * - Creates ~/.agent-recorder/ if it doesn't exist
9
14
  * - Creates ~/.agent-recorder/.env ONLY if it doesn't exist
10
15
  * - Never overwrites user files
16
+ * - Automatically configures Claude Code with hubify mode unless --no-configure
11
17
  */
12
- export declare function installCommand(): Promise<void>;
18
+ export declare function installCommand(options?: InstallOptions): Promise<void>;
13
19
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH;;;;;;GAMG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAqDpD"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsCH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAsDf"}
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * Install command - set up ~/.agent-recorder/ and print configuration.
3
3
  * This command is idempotent - it won't overwrite existing files.
4
+ * Automatically configures Claude Code with hubify mode unless --no-configure is specified.
4
5
  */
5
6
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
6
7
  import { homedir } from "node:os";
7
8
  import { join } from "node:path";
8
- import { loadConfig } from "@agent-recorder/core";
9
+ import { loadConfig, readProvidersFile, writeProvidersFile, getDefaultProvidersPath, } from "@agent-recorder/core";
10
+ import { detectClaudeConfig, readJsonFile, writeJsonFileAtomic, createBackup, formatPath, } from "../config/claude-paths.js";
11
+ import { hubifyClaudeConfig, mergeProviders } from "../config/hubify.js";
9
12
  /** Default .env file template */
10
13
  const ENV_TEMPLATE = `# Agent Recorder Configuration
11
14
  # See docs/bootstrap.md for more options
@@ -29,8 +32,9 @@ AR_MCP_PROXY_PORT=8788
29
32
  * - Creates ~/.agent-recorder/ if it doesn't exist
30
33
  * - Creates ~/.agent-recorder/.env ONLY if it doesn't exist
31
34
  * - Never overwrites user files
35
+ * - Automatically configures Claude Code with hubify mode unless --no-configure
32
36
  */
33
- export async function installCommand() {
37
+ export async function installCommand(options = {}) {
34
38
  const config = loadConfig();
35
39
  const dataDir = join(homedir(), ".agent-recorder");
36
40
  const envFile = join(dataDir, ".env");
@@ -59,6 +63,17 @@ export async function installCommand() {
59
63
  else {
60
64
  console.log(`Already exists: ${upstreamsFile}`);
61
65
  }
66
+ console.log("");
67
+ // Automatically configure Claude Code with hubify mode unless --no-configure
68
+ if (!options.noConfigure) {
69
+ await runAutoHubify(config);
70
+ }
71
+ else {
72
+ console.log("Skipped Claude Code configuration (--no-configure specified)");
73
+ console.log("");
74
+ console.log("To configure Claude Code manually, run:");
75
+ console.log(" agent-recorder configure claude --hubify");
76
+ }
62
77
  // Print next steps
63
78
  console.log(`
64
79
  Agent Recorder installed!
@@ -66,21 +81,81 @@ Agent Recorder installed!
66
81
  Data directory: ${dataDir}
67
82
  Env file: ${envFile}
68
83
 
69
- Claude Code v2 (recommended):
70
- Add to ~/.claude/settings.json:
71
-
72
- {
73
- "mcpServers": {
74
- "agent-recorder": {
75
- "url": "http://127.0.0.1:${config.mcpProxyPort}/"
76
- }
77
- }
78
- }
79
-
80
84
  Next steps:
81
85
  1. Edit ${envFile} if needed
82
86
  2. Start the daemon: agent-recorder start --env-file ${envFile}
83
- 3. Restart Claude Code to connect
87
+ 3. Restart Claude Code to apply changes
84
88
  `);
85
89
  }
90
+ /**
91
+ * Automatically configure Claude Code with hubify mode.
92
+ * This is the equivalent of running: agent-recorder configure claude --hubify
93
+ */
94
+ async function runAutoHubify(config) {
95
+ const expectedUrl = `http://127.0.0.1:${config.mcpProxyPort}/`;
96
+ // Detect Claude config
97
+ const detected = detectClaudeConfig();
98
+ if (detected.kind === "none" || !detected.path) {
99
+ console.log("No Claude Code config found.");
100
+ console.log("Claude Code will need to be configured manually.");
101
+ console.log("");
102
+ console.log("To configure later, run:");
103
+ console.log(" agent-recorder configure claude --hubify");
104
+ return;
105
+ }
106
+ const configPath = detected.path;
107
+ // Read existing config
108
+ const existingConfig = readJsonFile(configPath);
109
+ if (existingConfig === null) {
110
+ console.log(`Error: Could not read config at ${formatPath(configPath)}`);
111
+ return;
112
+ }
113
+ // Transform config to hubify mode
114
+ const hubifyResult = hubifyClaudeConfig(existingConfig, expectedUrl);
115
+ // Get mcpServers keys before and after
116
+ const beforeKeys = Object.keys(existingConfig.mcpServers ?? {});
117
+ const afterKeys = ["agent-recorder"];
118
+ // Create backup
119
+ const backupPath = createBackup(configPath);
120
+ // Write updated Claude config
121
+ writeJsonFileAtomic(configPath, hubifyResult.newClaudeConfig);
122
+ // Merge providers into providers.json
123
+ const providersPath = getDefaultProvidersPath();
124
+ const existingProviders = readProvidersFile(providersPath);
125
+ const mergedProviders = mergeProviders(existingProviders, hubifyResult.providers);
126
+ writeProvidersFile(mergedProviders, providersPath);
127
+ // Report results
128
+ console.log("Configured Claude Code with hubify mode");
129
+ console.log("");
130
+ console.log(`Config file: ${formatPath(configPath)} (${detected.kind})`);
131
+ console.log(`Backup: ${formatPath(backupPath)}`);
132
+ console.log("");
133
+ console.log(`Imported ${hubifyResult.importedKeys.length} provider(s):`);
134
+ if (hubifyResult.importedKeys.length === 0) {
135
+ console.log(" (none - no existing MCP servers found)");
136
+ }
137
+ else {
138
+ for (const key of hubifyResult.importedKeys) {
139
+ const provider = hubifyResult.providers.find((p) => p.id === key);
140
+ if (provider) {
141
+ console.log(` - ${key} (${provider.type}${provider.type === "http" ? `: ${provider.url}` : ""})`);
142
+ }
143
+ }
144
+ }
145
+ if (hubifyResult.skippedKeys.length > 0) {
146
+ console.log("");
147
+ console.log(`Skipped ${hubifyResult.skippedKeys.length} key(s):`);
148
+ for (const key of hubifyResult.skippedKeys) {
149
+ console.log(` - ${key} (already agent-recorder)`);
150
+ }
151
+ }
152
+ console.log("");
153
+ console.log("mcpServers updated:");
154
+ console.log(` Before: [${beforeKeys.join(", ") || "empty"}]`);
155
+ console.log(` After: [${afterKeys.join(", ")}]`);
156
+ console.log("");
157
+ console.log(`Providers file: ${formatPath(providersPath)}`);
158
+ console.log(`Total providers: ${mergedProviders.providers.length}`);
159
+ console.log("");
160
+ }
86
161
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,iCAAiC;AACjC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;CAepB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAEtD,mCAAmC;IACnC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,OAA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AAC;IAC/D,OAAO,CAAC,GAAG,CAAC,cAAc,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,CAAC,GAAG,CAAC,mBAAmB,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,oBAAoB,eAAe,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for install command with automatic hubify configuration.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=install.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.test.d.ts","sourceRoot":"","sources":["../../src/commands/install.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Tests for install command with automatic hubify configuration.
3
+ */
4
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
5
+ import { installCommand } from "./install.js";
6
+ import * as fs from "node:fs";
7
+ import * as os from "node:os";
8
+ import * as path from "node:path";
9
+ describe("Install Command", () => {
10
+ let tempDir;
11
+ let originalHome;
12
+ let mockClaudeConfigPath;
13
+ beforeEach(() => {
14
+ // Create temp directory to act as home
15
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ar-install-test-"));
16
+ originalHome = process.env.HOME || "";
17
+ process.env.HOME = tempDir;
18
+ // Create mock Claude config directory
19
+ const claudeDir = path.join(tempDir, ".claude");
20
+ fs.mkdirSync(claudeDir, { recursive: true });
21
+ mockClaudeConfigPath = path.join(claudeDir, "settings.json");
22
+ });
23
+ afterEach(() => {
24
+ // Restore original HOME
25
+ process.env.HOME = originalHome;
26
+ // Cleanup temp directory
27
+ if (fs.existsSync(tempDir)) {
28
+ fs.rmSync(tempDir, { recursive: true, force: true });
29
+ }
30
+ });
31
+ it("creates .agent-recorder directory and files", async () => {
32
+ await installCommand({ noConfigure: true });
33
+ const dataDir = path.join(tempDir, ".agent-recorder");
34
+ const envFile = path.join(dataDir, ".env");
35
+ const upstreamsFile = path.join(dataDir, "upstreams.json");
36
+ expect(fs.existsSync(dataDir)).toBe(true);
37
+ expect(fs.existsSync(envFile)).toBe(true);
38
+ expect(fs.existsSync(upstreamsFile)).toBe(true);
39
+ // Verify .env has expected content
40
+ const envContent = fs.readFileSync(envFile, "utf-8");
41
+ expect(envContent).toContain("AR_LISTEN_PORT=8787");
42
+ expect(envContent).toContain("AR_MCP_PROXY_PORT=8788");
43
+ // Verify upstreams.json is empty object
44
+ const upstreamsContent = fs.readFileSync(upstreamsFile, "utf-8");
45
+ expect(upstreamsContent.trim()).toBe("{}");
46
+ });
47
+ it("is idempotent - does not overwrite existing files", async () => {
48
+ const dataDir = path.join(tempDir, ".agent-recorder");
49
+ const envFile = path.join(dataDir, ".env");
50
+ // First run
51
+ await installCommand({ noConfigure: true });
52
+ // Modify .env file
53
+ fs.writeFileSync(envFile, "# Custom config\nAR_LISTEN_PORT=9999\n");
54
+ // Second run
55
+ await installCommand({ noConfigure: true });
56
+ // Verify .env was NOT overwritten
57
+ const envContent = fs.readFileSync(envFile, "utf-8");
58
+ expect(envContent).toContain("# Custom config");
59
+ expect(envContent).toContain("AR_LISTEN_PORT=9999");
60
+ expect(envContent).not.toContain("AR_LISTEN_PORT=8787");
61
+ });
62
+ it("automatically hubifies Claude config when Claude config exists", async () => {
63
+ // Create mock Claude config with existing MCP servers
64
+ const mockConfig = {
65
+ mcpServers: {
66
+ github: {
67
+ url: "https://api.github.com/mcp",
68
+ },
69
+ playwright: {
70
+ command: "npx",
71
+ args: ["@playwright/mcp"],
72
+ },
73
+ },
74
+ otherSetting: "preserved",
75
+ };
76
+ fs.writeFileSync(mockClaudeConfigPath, JSON.stringify(mockConfig, null, 2));
77
+ // Run install (hubify should run automatically)
78
+ await installCommand();
79
+ // Verify Claude config was updated
80
+ const updatedConfig = JSON.parse(fs.readFileSync(mockClaudeConfigPath, "utf-8"));
81
+ // Should only have agent-recorder entry
82
+ expect(Object.keys(updatedConfig.mcpServers)).toEqual(["agent-recorder"]);
83
+ expect(updatedConfig.mcpServers["agent-recorder"]).toEqual({
84
+ url: "http://127.0.0.1:8788/",
85
+ });
86
+ // Should preserve other settings
87
+ expect(updatedConfig.otherSetting).toBe("preserved");
88
+ // Verify backup was created
89
+ const backupFiles = fs
90
+ .readdirSync(path.join(tempDir, ".claude"))
91
+ .filter((f) => f.startsWith("settings.json") && f.includes(".bak"));
92
+ expect(backupFiles.length).toBeGreaterThan(0);
93
+ // Verify providers.json was created
94
+ const providersPath = path.join(tempDir, ".agent-recorder", "providers.json");
95
+ expect(fs.existsSync(providersPath)).toBe(true);
96
+ const providersFile = JSON.parse(fs.readFileSync(providersPath, "utf-8"));
97
+ // Should have 2 providers (github and playwright)
98
+ expect(providersFile.version).toBe(1);
99
+ expect(providersFile.providers).toHaveLength(2);
100
+ const providerIds = providersFile.providers.map((p) => p.id);
101
+ expect(providerIds).toContain("github");
102
+ expect(providerIds).toContain("playwright");
103
+ // Verify provider types
104
+ const githubProvider = providersFile.providers.find((p) => p.id === "github");
105
+ expect(githubProvider.type).toBe("http");
106
+ expect(githubProvider.url).toBe("https://api.github.com/mcp");
107
+ const playwrightProvider = providersFile.providers.find((p) => p.id === "playwright");
108
+ expect(playwrightProvider.type).toBe("stdio");
109
+ expect(playwrightProvider.command).toBe("npx");
110
+ expect(playwrightProvider.args).toEqual(["@playwright/mcp"]);
111
+ });
112
+ it("skips hubify when --no-configure is specified", async () => {
113
+ // Create mock Claude config
114
+ const mockConfig = {
115
+ mcpServers: {
116
+ github: {
117
+ url: "https://api.github.com/mcp",
118
+ },
119
+ },
120
+ };
121
+ fs.writeFileSync(mockClaudeConfigPath, JSON.stringify(mockConfig, null, 2));
122
+ // Run install with --no-configure
123
+ await installCommand({ noConfigure: true });
124
+ // Verify Claude config was NOT modified
125
+ const config = JSON.parse(fs.readFileSync(mockClaudeConfigPath, "utf-8"));
126
+ expect(config.mcpServers.github).toEqual({
127
+ url: "https://api.github.com/mcp",
128
+ });
129
+ // Should not have agent-recorder entry
130
+ expect(config.mcpServers["agent-recorder"]).toBeUndefined();
131
+ // Verify providers.json was NOT created
132
+ const providersPath = path.join(tempDir, ".agent-recorder", "providers.json");
133
+ expect(fs.existsSync(providersPath)).toBe(false);
134
+ // Verify no backup was created
135
+ const backupFiles = fs
136
+ .readdirSync(path.join(tempDir, ".claude"))
137
+ .filter((f) => f.includes(".bak"));
138
+ expect(backupFiles).toHaveLength(0);
139
+ });
140
+ it("handles case when Claude config does not exist", async () => {
141
+ // Don't create Claude config - it doesn't exist
142
+ // Run install (should handle gracefully)
143
+ await installCommand();
144
+ // Should still create .agent-recorder directory
145
+ const dataDir = path.join(tempDir, ".agent-recorder");
146
+ expect(fs.existsSync(dataDir)).toBe(true);
147
+ // Should not crash or create providers.json
148
+ const providersPath = path.join(dataDir, "providers.json");
149
+ expect(fs.existsSync(providersPath)).toBe(false);
150
+ });
151
+ it("skips already-agent-recorder entries during hubify", async () => {
152
+ // Create mock Claude config that already has agent-recorder
153
+ const mockConfig = {
154
+ mcpServers: {
155
+ "agent-recorder": {
156
+ url: "http://127.0.0.1:8788/",
157
+ },
158
+ github: {
159
+ url: "https://api.github.com/mcp",
160
+ },
161
+ },
162
+ };
163
+ fs.writeFileSync(mockClaudeConfigPath, JSON.stringify(mockConfig, null, 2));
164
+ // Run install
165
+ await installCommand();
166
+ // Verify providers.json has only github (not agent-recorder)
167
+ const providersPath = path.join(tempDir, ".agent-recorder", "providers.json");
168
+ const providersFile = JSON.parse(fs.readFileSync(providersPath, "utf-8"));
169
+ expect(providersFile.providers).toHaveLength(1);
170
+ expect(providersFile.providers[0].id).toBe("github");
171
+ });
172
+ });
173
+ //# sourceMappingURL=install.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.test.js","sourceRo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servers from Claude config and converts to providers.
4
+ */
5
+ import type { Provider, ProvidersFile } from "@agent-recorder/core";
6
+ export interface McpServerEntry {
7
+ url?: string;
8
+ command?: string;
9
+ args?: string[];
10
+ env?: Record<string, string>;
11
+ headers?: Record<string, string>;
12
+ [key: string]: unknown;
13
+ }
14
+ export interface HubifyResult {
15
+ /** New Claude config with only agent-recorder MCP entry */
16
+ newClaudeConfig: Record<string, unknown>;
17
+ /** Providers extracted from original config */
18
+ providers: Provider[];
19
+ /** Keys that were imported as providers */
20
+ importedKeys: string[];
21
+ /** Keys that were skipped (e.g., agent-recorder itself) */
22
+ skippedKeys: string[];
23
+ }
24
+ /**
25
+ * Extract providers from Claude config mcpServers.
26
+ * Converts each MCP server entry to a Provider.
27
+ *
28
+ * @param mcpServers - The mcpServers object from Claude config
29
+ * @returns Array of providers
30
+ */
31
+ export declare function extractProviders(mcpServers: Record<string, unknown>): Provider[];
32
+ /**
33
+ * Transform Claude config for hubify mode.
34
+ * Replaces mcpServers with only agent-recorder entry.
35
+ * Preserves all other Claude config fields.
36
+ *
37
+ * @param claudeConfig - Original Claude config
38
+ * @param agentRecorderUrl - URL for agent-recorder MCP entry
39
+ * @returns Hubify transformation result
40
+ */
41
+ export declare function hubifyClaudeConfig(claudeConfig: Record<string, unknown>, agentRecorderUrl: string): HubifyResult;
42
+ /**
43
+ * Merge providers into providers file.
44
+ * Upserts providers by ID.
45
+ *
46
+ * @param existingFile - Existing providers file
47
+ * @param newProviders - Providers to merge
48
+ * @returns Updated providers file
49
+ */
50
+ export declare function mergeProviders(existingFile: ProvidersFile, newProviders: Provider[]): ProvidersFile;
51
+ //# sourceMappingURL=hubify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubify.d.ts","sourceRoot":"","sources":["../../src/config/hubify.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,+CAA+C;IAC/C,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,QAAQ,EAAE,CAqDZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,gBAAgB,EAAE,MAAM,GACvB,YAAY,CAwCd;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,aAAa,EAC3B,YAAY,EAAE,QAAQ,EAAE,GACvB,aAAa,CAiBf"}