create-agentlink 0.3.0 → 0.4.0
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/dist/index.js +35 -11
- package/package.json +1 -1
- package/src/index.ts +6 -1
- package/src/scaffold.ts +13 -7
- package/src/utils.ts +23 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
+
import fs3 from "fs";
|
|
4
5
|
import path3 from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
5
7
|
import { Command } from "commander";
|
|
6
8
|
|
|
7
9
|
// src/theme.ts
|
|
@@ -25,7 +27,7 @@ function appendLog(msg) {
|
|
|
25
27
|
function initLog() {
|
|
26
28
|
fs.writeFileSync(LOG_FILE, "");
|
|
27
29
|
}
|
|
28
|
-
function runCommand(cmd, cwd) {
|
|
30
|
+
function runCommand(cmd, cwd, onData) {
|
|
29
31
|
appendLog(`$ ${cmd}${cwd ? ` (in ${cwd})` : ""}`);
|
|
30
32
|
return new Promise((resolve, reject) => {
|
|
31
33
|
const child = spawn("sh", ["-c", cmd], {
|
|
@@ -34,8 +36,24 @@ function runCommand(cmd, cwd) {
|
|
|
34
36
|
});
|
|
35
37
|
const stdout = [];
|
|
36
38
|
const stderr = [];
|
|
37
|
-
child.stdout.on("data", (data) =>
|
|
38
|
-
|
|
39
|
+
child.stdout.on("data", (data) => {
|
|
40
|
+
const text = data.toString();
|
|
41
|
+
stdout.push(text);
|
|
42
|
+
if (onData) {
|
|
43
|
+
for (const line of text.split("\n").filter(Boolean)) {
|
|
44
|
+
onData(line.trim());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
child.stderr.on("data", (data) => {
|
|
49
|
+
const text = data.toString();
|
|
50
|
+
stderr.push(text);
|
|
51
|
+
if (onData) {
|
|
52
|
+
for (const line of text.split("\n").filter(Boolean)) {
|
|
53
|
+
onData(line.trim());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
39
57
|
child.on("close", (code) => {
|
|
40
58
|
const out = stdout.join("").trim();
|
|
41
59
|
const errOut = stderr.join("").trim();
|
|
@@ -161,12 +179,6 @@ var CLAUDE_SETTINGS = {
|
|
|
161
179
|
repo: "agentlinksh/agent"
|
|
162
180
|
}
|
|
163
181
|
}
|
|
164
|
-
},
|
|
165
|
-
mcpServers: {
|
|
166
|
-
supabase: {
|
|
167
|
-
type: "http",
|
|
168
|
-
url: "http://127.0.0.1:54321/mcp"
|
|
169
|
-
}
|
|
170
182
|
}
|
|
171
183
|
};
|
|
172
184
|
var REQUIRED_SKILL = "supabase/agent-skills@supabase-postgres-best-practices";
|
|
@@ -216,7 +228,10 @@ async function scaffold(options) {
|
|
|
216
228
|
},
|
|
217
229
|
{
|
|
218
230
|
title: "Starting Supabase",
|
|
219
|
-
task: () => runCommand("supabase start", projectDir)
|
|
231
|
+
task: (_, task) => runCommand("supabase start", projectDir, (line) => {
|
|
232
|
+
task.output = line;
|
|
233
|
+
}),
|
|
234
|
+
rendererOptions: { persistentOutput: false, bottomBar: 1 }
|
|
220
235
|
},
|
|
221
236
|
{
|
|
222
237
|
title: "Configuring Claude Code",
|
|
@@ -230,6 +245,13 @@ async function scaffold(options) {
|
|
|
230
245
|
await delay(500);
|
|
231
246
|
}
|
|
232
247
|
},
|
|
248
|
+
{
|
|
249
|
+
title: "Installing Supabase MCP",
|
|
250
|
+
task: () => runCommand(
|
|
251
|
+
'claude mcp add --scope project --transport http supabase "http://127.0.0.1:54321/mcp"',
|
|
252
|
+
projectDir
|
|
253
|
+
)
|
|
254
|
+
},
|
|
233
255
|
{
|
|
234
256
|
title: "Installing Agent Link plugin",
|
|
235
257
|
task: () => runCommand("claude plugin install link@agentlink --scope project", projectDir)
|
|
@@ -378,9 +400,11 @@ async function wizard(initialName, initialPrompt) {
|
|
|
378
400
|
}
|
|
379
401
|
|
|
380
402
|
// src/index.ts
|
|
403
|
+
var __dirname = path3.dirname(fileURLToPath(import.meta.url));
|
|
404
|
+
var pkg = JSON.parse(fs3.readFileSync(path3.join(__dirname, "..", "package.json"), "utf-8"));
|
|
381
405
|
var LOG_FILE2 = "agentlink-debug.log";
|
|
382
406
|
var program = new Command();
|
|
383
|
-
program.name("agentlink").description("CLI for scaffolding Supabase apps with AI agents").version(
|
|
407
|
+
program.name("agentlink").description("CLI for scaffolding Supabase apps with AI agents").version(pkg.version).argument("[name]", "Project name").argument("[prompt]", "What do you want to build?").action(async (name, prompt) => {
|
|
384
408
|
initLog();
|
|
385
409
|
try {
|
|
386
410
|
await wizard(name, prompt);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
2
4
|
import { Command } from "commander";
|
|
3
5
|
import { dim, red } from "./theme.js";
|
|
4
6
|
import { initLog } from "./utils.js";
|
|
5
7
|
import { wizard } from "./wizard.js";
|
|
6
8
|
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8"));
|
|
11
|
+
|
|
7
12
|
const LOG_FILE = "agentlink-debug.log";
|
|
8
13
|
|
|
9
14
|
const program = new Command();
|
|
@@ -11,7 +16,7 @@ const program = new Command();
|
|
|
11
16
|
program
|
|
12
17
|
.name("agentlink")
|
|
13
18
|
.description("CLI for scaffolding Supabase apps with AI agents")
|
|
14
|
-
.version(
|
|
19
|
+
.version(pkg.version)
|
|
15
20
|
.argument("[name]", "Project name")
|
|
16
21
|
.argument("[prompt]", "What do you want to build?")
|
|
17
22
|
.action(async (name?: string, prompt?: string) => {
|
package/src/scaffold.ts
CHANGED
|
@@ -55,12 +55,6 @@ const CLAUDE_SETTINGS = {
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
|
-
mcpServers: {
|
|
59
|
-
supabase: {
|
|
60
|
-
type: "http",
|
|
61
|
-
url: "http://127.0.0.1:54321/mcp",
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
58
|
};
|
|
65
59
|
|
|
66
60
|
export const REQUIRED_SKILL =
|
|
@@ -127,7 +121,11 @@ export async function scaffold(options: ScaffoldOptions): Promise<ScaffoldSummar
|
|
|
127
121
|
},
|
|
128
122
|
{
|
|
129
123
|
title: "Starting Supabase",
|
|
130
|
-
task: () =>
|
|
124
|
+
task: (_, task) =>
|
|
125
|
+
runCommand("supabase start", projectDir, (line) => {
|
|
126
|
+
task.output = line;
|
|
127
|
+
}),
|
|
128
|
+
rendererOptions: { persistentOutput: false, bottomBar: 1 },
|
|
131
129
|
},
|
|
132
130
|
{
|
|
133
131
|
title: "Configuring Claude Code",
|
|
@@ -141,6 +139,14 @@ export async function scaffold(options: ScaffoldOptions): Promise<ScaffoldSummar
|
|
|
141
139
|
await delay(500);
|
|
142
140
|
},
|
|
143
141
|
},
|
|
142
|
+
{
|
|
143
|
+
title: "Installing Supabase MCP",
|
|
144
|
+
task: () =>
|
|
145
|
+
runCommand(
|
|
146
|
+
'claude mcp add --scope project --transport http supabase "http://127.0.0.1:54321/mcp"',
|
|
147
|
+
projectDir,
|
|
148
|
+
),
|
|
149
|
+
},
|
|
144
150
|
{
|
|
145
151
|
title: "Installing Agent Link plugin",
|
|
146
152
|
task: () =>
|
package/src/utils.ts
CHANGED
|
@@ -13,7 +13,11 @@ export function initLog() {
|
|
|
13
13
|
fs.writeFileSync(LOG_FILE, "");
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function runCommand(
|
|
16
|
+
export function runCommand(
|
|
17
|
+
cmd: string,
|
|
18
|
+
cwd?: string,
|
|
19
|
+
onData?: (line: string) => void,
|
|
20
|
+
): Promise<string> {
|
|
17
21
|
appendLog(`$ ${cmd}${cwd ? ` (in ${cwd})` : ""}`);
|
|
18
22
|
return new Promise((resolve, reject) => {
|
|
19
23
|
const child = spawn("sh", ["-c", cmd], {
|
|
@@ -24,8 +28,24 @@ export function runCommand(cmd: string, cwd?: string): Promise<string> {
|
|
|
24
28
|
const stdout: string[] = [];
|
|
25
29
|
const stderr: string[] = [];
|
|
26
30
|
|
|
27
|
-
child.stdout.on("data", (data) =>
|
|
28
|
-
|
|
31
|
+
child.stdout.on("data", (data) => {
|
|
32
|
+
const text = data.toString();
|
|
33
|
+
stdout.push(text);
|
|
34
|
+
if (onData) {
|
|
35
|
+
for (const line of text.split("\n").filter(Boolean)) {
|
|
36
|
+
onData(line.trim());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
child.stderr.on("data", (data) => {
|
|
41
|
+
const text = data.toString();
|
|
42
|
+
stderr.push(text);
|
|
43
|
+
if (onData) {
|
|
44
|
+
for (const line of text.split("\n").filter(Boolean)) {
|
|
45
|
+
onData(line.trim());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
29
49
|
|
|
30
50
|
child.on("close", (code) => {
|
|
31
51
|
const out = stdout.join("").trim();
|