@xyleapp/cli 0.4.2 → 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 +9 -3
- package/src/seed.mjs +18 -9
package/bin/xyle.mjs
CHANGED
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -350,7 +350,7 @@ export function registerCommands(program) {
|
|
|
350
350
|
toolNames = selected;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
const { created, skipped } = seedInstructions(opts.dir, toolNames);
|
|
353
|
+
const { created, appended, skipped } = seedInstructions(opts.dir, toolNames);
|
|
354
354
|
|
|
355
355
|
if (created.length) {
|
|
356
356
|
console.log("\x1b[32mCreated:\x1b[0m");
|
|
@@ -358,16 +358,22 @@ export function registerCommands(program) {
|
|
|
358
358
|
console.log(` + ${f}`);
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
+
if (appended.length) {
|
|
362
|
+
console.log("\x1b[32mAppended:\x1b[0m");
|
|
363
|
+
for (const f of appended) {
|
|
364
|
+
console.log(` ~ ${f}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
361
367
|
if (skipped.length) {
|
|
362
368
|
console.log("\x1b[33mSkipped:\x1b[0m");
|
|
363
369
|
for (const f of skipped) {
|
|
364
370
|
console.log(` - ${f}`);
|
|
365
371
|
}
|
|
366
372
|
}
|
|
367
|
-
if (!created.length && !skipped.length) {
|
|
373
|
+
if (!created.length && !appended.length && !skipped.length) {
|
|
368
374
|
console.log("Nothing to do.");
|
|
369
375
|
}
|
|
370
|
-
if (created.length) {
|
|
376
|
+
if (created.length || appended.length) {
|
|
371
377
|
console.log(
|
|
372
378
|
`\n\x1b[32mDone!\x1b[0m Your AI coding tools will now know about xyle.`
|
|
373
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
|
/**
|