@dezycro-ai/agent-plugin 2.1.0 → 2.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.
@@ -55,6 +55,7 @@ exports._internals = void 0;
55
55
  exports.pollIfDue = pollIfDue;
56
56
  exports.renderForAgent = renderForAgent;
57
57
  const fs = __importStar(require("fs"));
58
+ const os = __importStar(require("os"));
58
59
  const path = __importStar(require("path"));
59
60
  const logging = __importStar(require("./logging"));
60
61
  const DEFAULT_HOOKS = [
@@ -243,17 +244,27 @@ function readDezycroConfig(repoRoot) {
243
244
  }
244
245
  }
245
246
  function readToken(repoRoot) {
246
- try {
247
- const p = path.join(repoRoot, '.dezycro', 'companion-token.local.json');
248
- if (!fs.existsSync(p))
249
- return null;
250
- const raw = JSON.parse(fs.readFileSync(p, 'utf8'));
251
- const token = raw.token;
252
- return typeof token === 'string' && token.length > 0 ? token : null;
253
- }
254
- catch {
255
- return null;
247
+ // Project-local override first, then the user-global token written by
248
+ // `dezycro-setup` (`~/.dezycro/token.json`). Typical install needs no
249
+ // per-repo file at all.
250
+ const candidates = [
251
+ path.join(repoRoot, '.dezycro', 'companion-token.local.json'),
252
+ path.join(os.homedir(), '.dezycro', 'token.json'),
253
+ ];
254
+ for (const p of candidates) {
255
+ try {
256
+ if (!fs.existsSync(p))
257
+ continue;
258
+ const raw = JSON.parse(fs.readFileSync(p, 'utf8'));
259
+ const token = raw.token;
260
+ if (typeof token === 'string' && token.length > 0)
261
+ return token;
262
+ }
263
+ catch {
264
+ // Try the next candidate.
265
+ }
256
266
  }
267
+ return null;
257
268
  }
258
269
  async function fetchInbox(apiUrl, feature, token, since) {
259
270
  const url = new URL(`${apiUrl}/api/v1/workspaces/${feature.workspaceId}/features/${feature.featureId}/inbox`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dezycro-ai/agent-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Official Dezycro plugin for AI coding agents (Claude Code today, more to come) — reverse-engineer your codebase into features, PRDs, TRDs, and live verification.",
5
5
  "bin": {
6
6
  "dezycro-setup": "./setup.js",
package/setup.js CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { execSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+ const path = require("path");
4
7
  const readline = require("readline");
5
8
 
6
9
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
7
10
 
8
- console.log(`\n Dezycro MCP Setup`);
11
+ console.log(`\n Dezycro Setup`);
9
12
  console.log(` Get your API key from Dezycro → Settings → API Keys\n`);
10
13
 
11
14
  rl.question(" API key (dzy_...): ", (apiKey) => {
@@ -17,19 +20,34 @@ rl.question(" API key (dzy_...): ", (apiKey) => {
17
20
  process.exit(1);
18
21
  }
19
22
 
20
- const apiUrl = "https://mcp.dezycro.ai";
23
+ const mcpUrl = "https://mcp.dezycro.ai";
21
24
 
25
+ // 1. Configure Claude Code MCP server.
22
26
  try {
23
27
  execSync(
24
- `claude mcp add --transport http dezycro "${apiUrl}/mcp" --header "Authorization: Bearer ${apiKey}"`,
28
+ `claude mcp add --transport http dezycro "${mcpUrl}/mcp" --header "Authorization: Bearer ${apiKey}"`,
25
29
  { stdio: "inherit" }
26
30
  );
27
31
  console.log(`\n ✓ Dezycro MCP configured`);
28
- console.log(`\n You're all set! In Claude Code run: /dezycro:import-features\n`);
29
32
  } catch (err) {
30
33
  console.error(`\n Failed to configure MCP. Run manually:`);
31
- console.error(` claude mcp add --transport http dezycro "${apiUrl}/mcp" --header "Authorization: Bearer ${apiKey}"\n`);
34
+ console.error(` claude mcp add --transport http dezycro "${mcpUrl}/mcp" --header "Authorization: Bearer ${apiKey}"\n`);
32
35
  }
33
36
 
37
+ // 2. Save the user-global Companion token so companion-runner can poll the
38
+ // Agent Command Bus without per-repo config. Project-local
39
+ // .dezycro/companion-token.local.json still overrides this.
40
+ try {
41
+ const globalDir = path.join(os.homedir(), ".dezycro");
42
+ const globalTokenPath = path.join(globalDir, "token.json");
43
+ fs.mkdirSync(globalDir, { recursive: true, mode: 0o700 });
44
+ fs.writeFileSync(globalTokenPath, JSON.stringify({ token: apiKey }, null, 2), { mode: 0o600 });
45
+ console.log(` ✓ Companion token saved to ${globalTokenPath}`);
46
+ } catch (err) {
47
+ console.error(` Failed to save companion token: ${err.message}`);
48
+ console.error(` Drop it manually at ~/.dezycro/token.json: {"token": "${apiKey}"}\n`);
49
+ }
50
+
51
+ console.log(`\n You're all set! In Claude Code run: /dezycro:import-features\n`);
34
52
  rl.close();
35
53
  });