@xyleapp/cli 0.4.1 → 0.4.3
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/bin/xyle.mjs +1 -1
- package/package.json +1 -1
- package/src/commands.mjs +10 -3
- package/src/seed.mjs +18 -9
package/bin/xyle.mjs
CHANGED
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -267,6 +267,7 @@ export function registerCommands(program) {
|
|
|
267
267
|
} else {
|
|
268
268
|
console.log("\x1b[32mLogin successful! Credentials saved.\x1b[0m");
|
|
269
269
|
}
|
|
270
|
+
process.exit(0);
|
|
270
271
|
} else {
|
|
271
272
|
process.stderr.write("\x1b[31mLogin failed.\x1b[0m\n");
|
|
272
273
|
process.exit(1);
|
|
@@ -349,7 +350,7 @@ export function registerCommands(program) {
|
|
|
349
350
|
toolNames = selected;
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
const { created, skipped } = seedInstructions(opts.dir, toolNames);
|
|
353
|
+
const { created, appended, skipped } = seedInstructions(opts.dir, toolNames);
|
|
353
354
|
|
|
354
355
|
if (created.length) {
|
|
355
356
|
console.log("\x1b[32mCreated:\x1b[0m");
|
|
@@ -357,16 +358,22 @@ export function registerCommands(program) {
|
|
|
357
358
|
console.log(` + ${f}`);
|
|
358
359
|
}
|
|
359
360
|
}
|
|
361
|
+
if (appended.length) {
|
|
362
|
+
console.log("\x1b[32mAppended:\x1b[0m");
|
|
363
|
+
for (const f of appended) {
|
|
364
|
+
console.log(` ~ ${f}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
360
367
|
if (skipped.length) {
|
|
361
368
|
console.log("\x1b[33mSkipped:\x1b[0m");
|
|
362
369
|
for (const f of skipped) {
|
|
363
370
|
console.log(` - ${f}`);
|
|
364
371
|
}
|
|
365
372
|
}
|
|
366
|
-
if (!created.length && !skipped.length) {
|
|
373
|
+
if (!created.length && !appended.length && !skipped.length) {
|
|
367
374
|
console.log("Nothing to do.");
|
|
368
375
|
}
|
|
369
|
-
if (created.length) {
|
|
376
|
+
if (created.length || appended.length) {
|
|
370
377
|
console.log(
|
|
371
378
|
`\n\x1b[32mDone!\x1b[0m Your AI coding tools will now know about xyle.`
|
|
372
379
|
);
|
package/src/seed.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Each tool reads from a specific file path to learn about xyle.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
6
|
+
import { writeFileSync, readFileSync, appendFileSync, mkdirSync, existsSync } from "node:fs";
|
|
7
7
|
import { join, dirname } from "node:path";
|
|
8
8
|
|
|
9
9
|
const INSTRUCTIONS = `# Xyle — SEO Intelligence Engine
|
|
@@ -80,7 +80,7 @@ npx @xyleapp/cli sync --site <url> [--json]
|
|
|
80
80
|
|
|
81
81
|
| Variable | Default | Description |
|
|
82
82
|
|----------|---------|-------------|
|
|
83
|
-
| \`SEO_BASE\` | \`
|
|
83
|
+
| \`SEO_BASE\` | \`https://api.xyle.app\` | API base URL |
|
|
84
84
|
| \`AGENT_API_KEY\` | — | Fallback API key (when not using Google OAuth) |
|
|
85
85
|
|
|
86
86
|
## Workflows
|
|
@@ -185,24 +185,33 @@ export function seedInstructions(targetDir, toolNames) {
|
|
|
185
185
|
const tools = toolNames
|
|
186
186
|
? Object.fromEntries(toolNames.map((n) => [n, TOOLS[n]]))
|
|
187
187
|
: TOOLS;
|
|
188
|
+
const MARKER = "# Xyle — SEO Intelligence Engine";
|
|
188
189
|
const created = [];
|
|
190
|
+
const appended = [];
|
|
189
191
|
const skipped = [];
|
|
190
192
|
|
|
191
193
|
for (const [name, tool] of Object.entries(tools)) {
|
|
192
194
|
const filePath = join(targetDir, tool.path);
|
|
193
|
-
if (existsSync(filePath)) {
|
|
194
|
-
skipped.push(`${tool.label} (${tool.path}) — already exists`);
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
195
|
const dir = dirname(filePath);
|
|
198
196
|
if (!existsSync(dir)) {
|
|
199
197
|
mkdirSync(dir, { recursive: true });
|
|
200
198
|
}
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
|
|
200
|
+
if (existsSync(filePath)) {
|
|
201
|
+
const existing = readFileSync(filePath, "utf-8");
|
|
202
|
+
if (existing.includes(MARKER)) {
|
|
203
|
+
skipped.push(`${tool.label} (${tool.path}) — xyle instructions already present`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
appendFileSync(filePath, "\n\n" + INSTRUCTIONS, "utf-8");
|
|
207
|
+
appended.push(`${tool.label} (${tool.path})`);
|
|
208
|
+
} else {
|
|
209
|
+
writeFileSync(filePath, INSTRUCTIONS, "utf-8");
|
|
210
|
+
created.push(`${tool.label} (${tool.path})`);
|
|
211
|
+
}
|
|
203
212
|
}
|
|
204
213
|
|
|
205
|
-
return { created, skipped };
|
|
214
|
+
return { created, appended, skipped };
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
/**
|