@sonordev/site-kit 2.2.9 → 2.5.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/blog/index.d.mts +31 -3
- package/dist/blog/index.d.ts +31 -3
- package/dist/blog/index.js +194 -10
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +183 -4
- package/dist/blog/index.mjs.map +1 -1
- package/dist/blog/server-ui.d.mts +1 -1
- package/dist/blog/server-ui.d.ts +1 -1
- package/dist/blog/server-ui.js +3 -3
- package/dist/blog/server-ui.mjs +1 -1
- package/dist/blog/server.d.mts +79 -7
- package/dist/blog/server.d.ts +79 -7
- package/dist/blog/server.js +64 -32
- package/dist/blog/server.mjs +1 -1
- package/dist/{chunk-WRCX2NKY.mjs → chunk-2NM6RGAV.mjs} +226 -22
- package/dist/chunk-2NM6RGAV.mjs.map +1 -0
- package/dist/chunk-5B4FABFK.js +28 -0
- package/dist/chunk-5B4FABFK.js.map +1 -0
- package/dist/{chunk-DTVZJPVM.mjs → chunk-5SQ4NRPH.mjs} +9 -2
- package/dist/chunk-5SQ4NRPH.mjs.map +1 -0
- package/dist/chunk-ATG4FJY6.js +76 -0
- package/dist/chunk-ATG4FJY6.js.map +1 -0
- package/dist/{chunk-GQKBGL2W.js → chunk-DZKX3GHL.js} +233 -21
- package/dist/chunk-DZKX3GHL.js.map +1 -0
- package/dist/{chunk-LNMI6OMN.js → chunk-F54HGPDM.js} +137 -4
- package/dist/chunk-F54HGPDM.js.map +1 -0
- package/dist/chunk-H23ZT2I2.mjs +67 -0
- package/dist/chunk-H23ZT2I2.mjs.map +1 -0
- package/dist/chunk-H4OBGC43.mjs +26 -0
- package/dist/chunk-H4OBGC43.mjs.map +1 -0
- package/dist/{chunk-Z6EHHJWU.mjs → chunk-MNOVPHL6.mjs} +230 -35
- package/dist/chunk-MNOVPHL6.mjs.map +1 -0
- package/dist/{chunk-ITPVKQB6.js → chunk-MWE2HRPU.js} +229 -34
- package/dist/chunk-MWE2HRPU.js.map +1 -0
- package/dist/{chunk-AWMEH65F.js → chunk-PAF5IGGF.js} +9 -2
- package/dist/chunk-PAF5IGGF.js.map +1 -0
- package/dist/{chunk-OOZCN7AF.mjs → chunk-T5UU7I4V.mjs} +137 -5
- package/dist/chunk-T5UU7I4V.mjs.map +1 -0
- package/dist/cli/index.js +352 -78
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +352 -78
- package/dist/cli/index.mjs.map +1 -1
- package/dist/config/index.d.mts +17 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +43 -3
- package/dist/config/index.js.map +1 -1
- package/dist/config/index.mjs +43 -3
- package/dist/config/index.mjs.map +1 -1
- package/dist/forms/index.js +3 -1
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +3 -1
- package/dist/forms/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/layout/index.d.mts +6 -1
- package/dist/layout/index.d.ts +6 -1
- package/dist/layout/index.js +7 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +7 -3
- package/dist/layout/index.mjs.map +1 -1
- package/dist/llms/contract.d.mts +43 -0
- package/dist/llms/contract.d.ts +43 -0
- package/dist/llms/contract.js +41 -0
- package/dist/llms/contract.js.map +1 -0
- package/dist/llms/contract.mjs +4 -0
- package/dist/llms/contract.mjs.map +1 -0
- package/dist/llms/index.d.mts +67 -5
- package/dist/llms/index.d.ts +67 -5
- package/dist/llms/index.js +154 -36
- package/dist/llms/index.js.map +1 -1
- package/dist/llms/index.mjs +107 -27
- package/dist/llms/index.mjs.map +1 -1
- package/dist/middleware/index.d.mts +13 -1
- package/dist/middleware/index.d.ts +13 -1
- package/dist/middleware/index.js +11 -0
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +11 -0
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/{routing-ccNYbFLU.d.ts → routing-C7gmHWm9.d.ts} +1 -1
- package/dist/{routing-ebQln7wH.d.mts → routing-trNzR1Pz.d.mts} +1 -1
- package/dist/seo/index.d.mts +19 -4
- package/dist/seo/index.d.ts +19 -4
- package/dist/seo/index.js +49 -14
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +42 -8
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/server.d.mts +2 -2
- package/dist/seo/server.d.ts +2 -2
- package/dist/seo/server.js +5 -5
- package/dist/seo/server.mjs +1 -1
- package/dist/sitemap/index.d.mts +8 -1
- package/dist/sitemap/index.d.ts +8 -1
- package/dist/sitemap/index.js +24 -4
- package/dist/sitemap/index.js.map +1 -1
- package/dist/sitemap/index.mjs +23 -3
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/{types-BxzT7yhf.d.mts → types-0NuBL1Gg.d.ts} +34 -0
- package/dist/{types-DWMpAtGy.d.mts → types-5P5B9RgV.d.mts} +57 -1
- package/dist/{types-DWMpAtGy.d.ts → types-5P5B9RgV.d.ts} +57 -1
- package/dist/{types-CGkyylOa.d.mts → types-DYyIAgQg.d.mts} +2 -0
- package/dist/{types-CGkyylOa.d.ts → types-DYyIAgQg.d.ts} +2 -0
- package/dist/{types-BxzT7yhf.d.ts → types-J7Z_FqmV.d.mts} +34 -0
- package/package.json +15 -1
- package/scripts/postinstall.cjs +67 -0
- package/dist/chunk-AWMEH65F.js.map +0 -1
- package/dist/chunk-DTVZJPVM.mjs.map +0 -1
- package/dist/chunk-GQKBGL2W.js.map +0 -1
- package/dist/chunk-ITPVKQB6.js.map +0 -1
- package/dist/chunk-LNMI6OMN.js.map +0 -1
- package/dist/chunk-OOZCN7AF.mjs.map +0 -1
- package/dist/chunk-WRCX2NKY.mjs.map +0 -1
- package/dist/chunk-Z6EHHJWU.mjs.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -947,8 +947,8 @@ var require_command = chunkZSMWDLMK_js.__commonJS({
|
|
|
947
947
|
"node_modules/.pnpm/commander@11.1.0/node_modules/commander/lib/command.js"(exports$1) {
|
|
948
948
|
var EventEmitter = chunkZSMWDLMK_js.__require("events").EventEmitter;
|
|
949
949
|
var childProcess = chunkZSMWDLMK_js.__require("child_process");
|
|
950
|
-
var
|
|
951
|
-
var
|
|
950
|
+
var path19 = chunkZSMWDLMK_js.__require("path");
|
|
951
|
+
var fs15 = chunkZSMWDLMK_js.__require("fs");
|
|
952
952
|
var process11 = chunkZSMWDLMK_js.__require("process");
|
|
953
953
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
954
954
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1770,10 +1770,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1770
1770
|
let launchWithNode = false;
|
|
1771
1771
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1772
1772
|
function findFile(baseDir, baseName) {
|
|
1773
|
-
const localBin =
|
|
1774
|
-
if (
|
|
1775
|
-
if (sourceExt.includes(
|
|
1776
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1773
|
+
const localBin = path19.resolve(baseDir, baseName);
|
|
1774
|
+
if (fs15.existsSync(localBin)) return localBin;
|
|
1775
|
+
if (sourceExt.includes(path19.extname(baseName))) return void 0;
|
|
1776
|
+
const foundExt = sourceExt.find((ext) => fs15.existsSync(`${localBin}${ext}`));
|
|
1777
1777
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1778
1778
|
return void 0;
|
|
1779
1779
|
}
|
|
@@ -1784,23 +1784,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1784
1784
|
if (this._scriptPath) {
|
|
1785
1785
|
let resolvedScriptPath;
|
|
1786
1786
|
try {
|
|
1787
|
-
resolvedScriptPath =
|
|
1787
|
+
resolvedScriptPath = fs15.realpathSync(this._scriptPath);
|
|
1788
1788
|
} catch (err) {
|
|
1789
1789
|
resolvedScriptPath = this._scriptPath;
|
|
1790
1790
|
}
|
|
1791
|
-
executableDir =
|
|
1791
|
+
executableDir = path19.resolve(path19.dirname(resolvedScriptPath), executableDir);
|
|
1792
1792
|
}
|
|
1793
1793
|
if (executableDir) {
|
|
1794
1794
|
let localFile = findFile(executableDir, executableFile);
|
|
1795
1795
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1796
|
-
const legacyName =
|
|
1796
|
+
const legacyName = path19.basename(this._scriptPath, path19.extname(this._scriptPath));
|
|
1797
1797
|
if (legacyName !== this._name) {
|
|
1798
1798
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
1801
|
executableFile = localFile || executableFile;
|
|
1802
1802
|
}
|
|
1803
|
-
launchWithNode = sourceExt.includes(
|
|
1803
|
+
launchWithNode = sourceExt.includes(path19.extname(executableFile));
|
|
1804
1804
|
let proc;
|
|
1805
1805
|
if (process11.platform !== "win32") {
|
|
1806
1806
|
if (launchWithNode) {
|
|
@@ -2583,7 +2583,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2583
2583
|
* @return {Command}
|
|
2584
2584
|
*/
|
|
2585
2585
|
nameFromFilename(filename) {
|
|
2586
|
-
this._name =
|
|
2586
|
+
this._name = path19.basename(filename, path19.extname(filename));
|
|
2587
2587
|
return this;
|
|
2588
2588
|
}
|
|
2589
2589
|
/**
|
|
@@ -2597,9 +2597,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2597
2597
|
* @param {string} [path]
|
|
2598
2598
|
* @return {string|null|Command}
|
|
2599
2599
|
*/
|
|
2600
|
-
executableDir(
|
|
2601
|
-
if (
|
|
2602
|
-
this._executableDir =
|
|
2600
|
+
executableDir(path20) {
|
|
2601
|
+
if (path20 === void 0) return this._executableDir;
|
|
2602
|
+
this._executableDir = path20;
|
|
2603
2603
|
return this;
|
|
2604
2604
|
}
|
|
2605
2605
|
/**
|
|
@@ -14909,15 +14909,15 @@ var require_route = chunkZSMWDLMK_js.__commonJS({
|
|
|
14909
14909
|
};
|
|
14910
14910
|
}
|
|
14911
14911
|
function wrapConversion(toModel, graph) {
|
|
14912
|
-
const
|
|
14912
|
+
const path19 = [graph[toModel].parent, toModel];
|
|
14913
14913
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
14914
14914
|
let cur = graph[toModel].parent;
|
|
14915
14915
|
while (graph[cur].parent) {
|
|
14916
|
-
|
|
14916
|
+
path19.unshift(graph[cur].parent);
|
|
14917
14917
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
14918
14918
|
cur = graph[cur].parent;
|
|
14919
14919
|
}
|
|
14920
|
-
fn.conversion =
|
|
14920
|
+
fn.conversion = path19;
|
|
14921
14921
|
return fn;
|
|
14922
14922
|
}
|
|
14923
14923
|
module.exports = function(fromModel) {
|
|
@@ -25362,10 +25362,10 @@ var require_lib = chunkZSMWDLMK_js.__commonJS({
|
|
|
25362
25362
|
exports$1.analyse = analyse;
|
|
25363
25363
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
25364
25364
|
let fd;
|
|
25365
|
-
const
|
|
25365
|
+
const fs15 = (0, node_1.default)();
|
|
25366
25366
|
const handler = (err, buffer) => {
|
|
25367
25367
|
if (fd) {
|
|
25368
|
-
|
|
25368
|
+
fs15.closeSync(fd);
|
|
25369
25369
|
}
|
|
25370
25370
|
if (err) {
|
|
25371
25371
|
reject(err);
|
|
@@ -25377,9 +25377,9 @@ var require_lib = chunkZSMWDLMK_js.__commonJS({
|
|
|
25377
25377
|
};
|
|
25378
25378
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
25379
25379
|
if (sampleSize > 0) {
|
|
25380
|
-
fd =
|
|
25380
|
+
fd = fs15.openSync(filepath, "r");
|
|
25381
25381
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
25382
|
-
|
|
25382
|
+
fs15.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
25383
25383
|
if (err) {
|
|
25384
25384
|
handler(err, null);
|
|
25385
25385
|
} else {
|
|
@@ -25391,22 +25391,22 @@ var require_lib = chunkZSMWDLMK_js.__commonJS({
|
|
|
25391
25391
|
});
|
|
25392
25392
|
return;
|
|
25393
25393
|
}
|
|
25394
|
-
|
|
25394
|
+
fs15.readFile(filepath, handler);
|
|
25395
25395
|
});
|
|
25396
25396
|
exports$1.detectFile = detectFile;
|
|
25397
25397
|
var detectFileSync = (filepath, opts = {}) => {
|
|
25398
|
-
const
|
|
25398
|
+
const fs15 = (0, node_1.default)();
|
|
25399
25399
|
if (opts && opts.sampleSize) {
|
|
25400
|
-
const fd =
|
|
25400
|
+
const fd = fs15.openSync(filepath, "r");
|
|
25401
25401
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
25402
|
-
const bytesRead =
|
|
25402
|
+
const bytesRead = fs15.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
25403
25403
|
if (bytesRead < opts.sampleSize) {
|
|
25404
25404
|
sample = sample.subarray(0, bytesRead);
|
|
25405
25405
|
}
|
|
25406
|
-
|
|
25406
|
+
fs15.closeSync(fd);
|
|
25407
25407
|
return (0, exports$1.detect)(sample);
|
|
25408
25408
|
}
|
|
25409
|
-
return (0, exports$1.detect)(
|
|
25409
|
+
return (0, exports$1.detect)(fs15.readFileSync(filepath));
|
|
25410
25410
|
};
|
|
25411
25411
|
exports$1.detectFileSync = detectFileSync;
|
|
25412
25412
|
exports$1.default = {
|
|
@@ -46764,9 +46764,9 @@ var fetchAsyncQuestionProperty = function(question, prop, answers) {
|
|
|
46764
46764
|
|
|
46765
46765
|
// node_modules/.pnpm/inquirer@9.3.8_@types+node@25.0.9/node_modules/inquirer/lib/ui/prompt.js
|
|
46766
46766
|
var _ = {
|
|
46767
|
-
set: (obj,
|
|
46767
|
+
set: (obj, path19 = "", value) => {
|
|
46768
46768
|
let pointer = obj;
|
|
46769
|
-
|
|
46769
|
+
path19.split(".").forEach((key, index, arr) => {
|
|
46770
46770
|
if (key === "__proto__" || key === "constructor") return;
|
|
46771
46771
|
if (index === arr.length - 1) {
|
|
46772
46772
|
pointer[key] = value;
|
|
@@ -46776,8 +46776,8 @@ var _ = {
|
|
|
46776
46776
|
pointer = pointer[key];
|
|
46777
46777
|
});
|
|
46778
46778
|
},
|
|
46779
|
-
get: (obj,
|
|
46780
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
46779
|
+
get: (obj, path19 = "", defaultValue) => {
|
|
46780
|
+
const travel = (regexp) => String.prototype.split.call(path19, regexp).filter(Boolean).reduce(
|
|
46781
46781
|
// @ts-expect-error implicit any on res[key]
|
|
46782
46782
|
(res, key) => res !== null && res !== void 0 ? res[key] : res,
|
|
46783
46783
|
obj
|
|
@@ -47026,18 +47026,18 @@ function scanForForms(ast, content, filePath) {
|
|
|
47026
47026
|
const forms = [];
|
|
47027
47027
|
content.split("\n");
|
|
47028
47028
|
traverse__default.default(ast, {
|
|
47029
|
-
JSXElement(
|
|
47030
|
-
const opening =
|
|
47029
|
+
JSXElement(path19) {
|
|
47030
|
+
const opening = path19.node.openingElement;
|
|
47031
47031
|
if (t.isJSXIdentifier(opening.name) && opening.name.name === "form") {
|
|
47032
|
-
const fields = extractFieldsFromForm(
|
|
47032
|
+
const fields = extractFieldsFromForm(path19);
|
|
47033
47033
|
const hasOnSubmit = opening.attributes.some(
|
|
47034
47034
|
(attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "onSubmit"
|
|
47035
47035
|
);
|
|
47036
47036
|
if (hasOnSubmit && fields.length > 0) {
|
|
47037
|
-
const startLine =
|
|
47038
|
-
const endLine =
|
|
47037
|
+
const startLine = path19.node.loc?.start.line || 0;
|
|
47038
|
+
const endLine = path19.node.loc?.end.line || 0;
|
|
47039
47039
|
let componentName = "UnknownForm";
|
|
47040
|
-
let current =
|
|
47040
|
+
let current = path19.parentPath;
|
|
47041
47041
|
while (current) {
|
|
47042
47042
|
if (t.isFunctionDeclaration(current.node) && current.node.id) {
|
|
47043
47043
|
componentName = current.node.id.name;
|
|
@@ -47070,7 +47070,7 @@ function scanForForms(ast, content, filePath) {
|
|
|
47070
47070
|
}
|
|
47071
47071
|
if (t.isJSXIdentifier(opening.name) && opening.name.name === "Form") {
|
|
47072
47072
|
if (content.includes("Formik") || content.includes("formik")) {
|
|
47073
|
-
const fields = extractFieldsFromFormik(
|
|
47073
|
+
const fields = extractFieldsFromFormik(path19);
|
|
47074
47074
|
if (fields.length > 0) {
|
|
47075
47075
|
forms.push({
|
|
47076
47076
|
filePath,
|
|
@@ -47081,8 +47081,8 @@ function scanForForms(ast, content, filePath) {
|
|
|
47081
47081
|
submitsTo: null,
|
|
47082
47082
|
complexity: "moderate",
|
|
47083
47083
|
suggestedAction: "assisted",
|
|
47084
|
-
startLine:
|
|
47085
|
-
endLine:
|
|
47084
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47085
|
+
endLine: path19.node.loc?.end.line || 0
|
|
47086
47086
|
});
|
|
47087
47087
|
}
|
|
47088
47088
|
}
|
|
@@ -47100,8 +47100,8 @@ function extractFieldsFromForm(formPath) {
|
|
|
47100
47100
|
const radioGroups = /* @__PURE__ */ new Map();
|
|
47101
47101
|
const checkboxGroups = /* @__PURE__ */ new Map();
|
|
47102
47102
|
formPath.traverse({
|
|
47103
|
-
JSXElement(
|
|
47104
|
-
const opening =
|
|
47103
|
+
JSXElement(path19) {
|
|
47104
|
+
const opening = path19.node.openingElement;
|
|
47105
47105
|
const tagName = t.isJSXIdentifier(opening.name) ? opening.name.name : null;
|
|
47106
47106
|
if (["input", "textarea", "select"].includes(tagName || "")) {
|
|
47107
47107
|
const attrs = opening.attributes;
|
|
@@ -47148,7 +47148,7 @@ function extractFieldsFromForm(formPath) {
|
|
|
47148
47148
|
}
|
|
47149
47149
|
if (tagName === "select") {
|
|
47150
47150
|
const selectOptions = [];
|
|
47151
|
-
|
|
47151
|
+
path19.traverse({
|
|
47152
47152
|
JSXElement(optionPath) {
|
|
47153
47153
|
const optOpening = optionPath.node.openingElement;
|
|
47154
47154
|
const optTagName = t.isJSXIdentifier(optOpening.name) ? optOpening.name.name : null;
|
|
@@ -47223,8 +47223,8 @@ function extractFieldsFromForm(formPath) {
|
|
|
47223
47223
|
function extractFieldsFromFormik(formPath, content) {
|
|
47224
47224
|
const fields = [];
|
|
47225
47225
|
formPath.traverse({
|
|
47226
|
-
JSXElement(
|
|
47227
|
-
const opening =
|
|
47226
|
+
JSXElement(path19) {
|
|
47227
|
+
const opening = path19.node.openingElement;
|
|
47228
47228
|
const tagName = t.isJSXIdentifier(opening.name) ? opening.name.name : null;
|
|
47229
47229
|
if (tagName === "Field" || tagName === "FastField") {
|
|
47230
47230
|
const attrs = opening.attributes;
|
|
@@ -47343,11 +47343,11 @@ function scanForMetadata(ast, content, filePath) {
|
|
|
47343
47343
|
}
|
|
47344
47344
|
let hasHeadComponent = false;
|
|
47345
47345
|
traverse__default.default(ast, {
|
|
47346
|
-
JSXElement(
|
|
47347
|
-
const opening =
|
|
47346
|
+
JSXElement(path19) {
|
|
47347
|
+
const opening = path19.node.openingElement;
|
|
47348
47348
|
if (t.isJSXIdentifier(opening.name) && opening.name.name === "Head") {
|
|
47349
47349
|
hasHeadComponent = true;
|
|
47350
|
-
|
|
47350
|
+
path19.stop();
|
|
47351
47351
|
}
|
|
47352
47352
|
}
|
|
47353
47353
|
});
|
|
@@ -47382,8 +47382,8 @@ function scanForWidgets(ast, content, filePath) {
|
|
|
47382
47382
|
for (const { pattern, type } of widgetPatterns) {
|
|
47383
47383
|
if (pattern.test(content)) {
|
|
47384
47384
|
traverse__default.default(ast, {
|
|
47385
|
-
JSXElement(
|
|
47386
|
-
const opening =
|
|
47385
|
+
JSXElement(path19) {
|
|
47386
|
+
const opening = path19.node.openingElement;
|
|
47387
47387
|
if (t.isJSXIdentifier(opening.name) && (opening.name.name === "script" || opening.name.name === "Script")) {
|
|
47388
47388
|
const srcAttr = opening.attributes.find(
|
|
47389
47389
|
(attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "src"
|
|
@@ -47398,8 +47398,8 @@ function scanForWidgets(ast, content, filePath) {
|
|
|
47398
47398
|
filePath,
|
|
47399
47399
|
widgetType: type,
|
|
47400
47400
|
scriptTag: src,
|
|
47401
|
-
startLine:
|
|
47402
|
-
endLine:
|
|
47401
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47402
|
+
endLine: path19.node.loc?.end.line || 0
|
|
47403
47403
|
});
|
|
47404
47404
|
}
|
|
47405
47405
|
}
|
|
@@ -47538,8 +47538,8 @@ function scanForSchemas(ast, content, filePath) {
|
|
|
47538
47538
|
return schemas;
|
|
47539
47539
|
}
|
|
47540
47540
|
traverse__default.default(ast, {
|
|
47541
|
-
JSXElement(
|
|
47542
|
-
const opening =
|
|
47541
|
+
JSXElement(path19) {
|
|
47542
|
+
const opening = path19.node.openingElement;
|
|
47543
47543
|
if (t.isJSXIdentifier(opening.name) && (opening.name.name === "script" || opening.name.name === "Script")) {
|
|
47544
47544
|
const typeAttr = opening.attributes.find(
|
|
47545
47545
|
(attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "type"
|
|
@@ -47566,8 +47566,8 @@ function scanForSchemas(ast, content, filePath) {
|
|
|
47566
47566
|
filePath,
|
|
47567
47567
|
type: detectedType,
|
|
47568
47568
|
schemaType,
|
|
47569
|
-
startLine:
|
|
47570
|
-
endLine:
|
|
47569
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47570
|
+
endLine: path19.node.loc?.end.line || 0
|
|
47571
47571
|
});
|
|
47572
47572
|
}
|
|
47573
47573
|
}
|
|
@@ -47600,8 +47600,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
47600
47600
|
/questions?\s*(?:and|&)?\s*answers?/i
|
|
47601
47601
|
];
|
|
47602
47602
|
traverse__default.default(ast, {
|
|
47603
|
-
JSXElement(
|
|
47604
|
-
const opening =
|
|
47603
|
+
JSXElement(path19) {
|
|
47604
|
+
const opening = path19.node.openingElement;
|
|
47605
47605
|
let tagName = "";
|
|
47606
47606
|
if (t.isJSXIdentifier(opening.name)) {
|
|
47607
47607
|
tagName = opening.name.name;
|
|
@@ -47614,8 +47614,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
47614
47614
|
faqs.push({
|
|
47615
47615
|
filePath,
|
|
47616
47616
|
type: "details-summary",
|
|
47617
|
-
startLine:
|
|
47618
|
-
endLine:
|
|
47617
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47618
|
+
endLine: path19.node.loc?.end.line || 0,
|
|
47619
47619
|
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
47620
47620
|
});
|
|
47621
47621
|
return;
|
|
@@ -47623,7 +47623,7 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
47623
47623
|
for (const pattern of faqPatterns) {
|
|
47624
47624
|
if (pattern.test(tagName)) {
|
|
47625
47625
|
let itemCount = 0;
|
|
47626
|
-
|
|
47626
|
+
path19.traverse({
|
|
47627
47627
|
JSXElement(itemPath) {
|
|
47628
47628
|
const itemOpening = itemPath.node.openingElement;
|
|
47629
47629
|
if (t.isJSXIdentifier(itemOpening.name)) {
|
|
@@ -47639,8 +47639,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
47639
47639
|
type: "accordion",
|
|
47640
47640
|
componentName: tagName,
|
|
47641
47641
|
itemCount: itemCount || void 0,
|
|
47642
|
-
startLine:
|
|
47643
|
-
endLine:
|
|
47642
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47643
|
+
endLine: path19.node.loc?.end.line || 0,
|
|
47644
47644
|
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
47645
47645
|
});
|
|
47646
47646
|
return;
|
|
@@ -47763,8 +47763,8 @@ function scanForImages(ast, content, filePath) {
|
|
|
47763
47763
|
return images;
|
|
47764
47764
|
}
|
|
47765
47765
|
traverse__default.default(ast, {
|
|
47766
|
-
JSXElement(
|
|
47767
|
-
const opening =
|
|
47766
|
+
JSXElement(path19) {
|
|
47767
|
+
const opening = path19.node.openingElement;
|
|
47768
47768
|
if (!t.isJSXIdentifier(opening.name)) return;
|
|
47769
47769
|
const tagName = opening.name.name;
|
|
47770
47770
|
if (tagName === "img" || tagName === "Image") {
|
|
@@ -47792,8 +47792,8 @@ function scanForImages(ast, content, filePath) {
|
|
|
47792
47792
|
src: src || void 0,
|
|
47793
47793
|
alt: alt || void 0,
|
|
47794
47794
|
isLocal,
|
|
47795
|
-
startLine:
|
|
47796
|
-
endLine:
|
|
47795
|
+
startLine: path19.node.loc?.start.line || 0,
|
|
47796
|
+
endLine: path19.node.loc?.end.line || 0
|
|
47797
47797
|
});
|
|
47798
47798
|
}
|
|
47799
47799
|
}
|
|
@@ -48707,18 +48707,18 @@ async function migrateFile(filePath, options) {
|
|
|
48707
48707
|
let componentName = "Form";
|
|
48708
48708
|
const traverse3 = (await import('@babel/traverse')).default;
|
|
48709
48709
|
traverse3(ast, {
|
|
48710
|
-
ExportNamedDeclaration(
|
|
48711
|
-
const decl =
|
|
48710
|
+
ExportNamedDeclaration(path19) {
|
|
48711
|
+
const decl = path19.node.declaration;
|
|
48712
48712
|
if (decl && decl.type === "FunctionDeclaration" && decl.id) {
|
|
48713
48713
|
componentName = decl.id.name;
|
|
48714
|
-
|
|
48714
|
+
path19.stop();
|
|
48715
48715
|
}
|
|
48716
48716
|
},
|
|
48717
|
-
ExportDefaultDeclaration(
|
|
48718
|
-
const decl =
|
|
48717
|
+
ExportDefaultDeclaration(path19) {
|
|
48718
|
+
const decl = path19.node.declaration;
|
|
48719
48719
|
if (decl && decl.type === "FunctionDeclaration" && decl.id) {
|
|
48720
48720
|
componentName = decl.id.name;
|
|
48721
|
-
|
|
48721
|
+
path19.stop();
|
|
48722
48722
|
}
|
|
48723
48723
|
}
|
|
48724
48724
|
});
|
|
@@ -50831,8 +50831,8 @@ async function templateCommand(sourcePath, options, config2) {
|
|
|
50831
50831
|
const slots = [];
|
|
50832
50832
|
const componentNames = [];
|
|
50833
50833
|
traverse__default.default(ast, {
|
|
50834
|
-
JSXElement(
|
|
50835
|
-
const openingElement =
|
|
50834
|
+
JSXElement(path19) {
|
|
50835
|
+
const openingElement = path19.node.openingElement;
|
|
50836
50836
|
if (t2.isJSXIdentifier(openingElement.name)) {
|
|
50837
50837
|
const componentName = openingElement.name.name;
|
|
50838
50838
|
if (componentName[0] === componentName[0].toUpperCase()) {
|
|
@@ -52051,13 +52051,15 @@ async function statusCommand(options) {
|
|
|
52051
52051
|
checks.push(layoutCheck);
|
|
52052
52052
|
const sitemapCheck = await checkSitemap();
|
|
52053
52053
|
checks.push(sitemapCheck);
|
|
52054
|
+
const llmsCheck = await checkLlmsTxt();
|
|
52055
|
+
checks.push(llmsCheck);
|
|
52054
52056
|
console.log(source_default.bold(" Environment"));
|
|
52055
52057
|
displayChecks(checks.filter(
|
|
52056
52058
|
(c) => ["SONOR_API_KEY"].includes(c.name)
|
|
52057
52059
|
), options.verbose);
|
|
52058
52060
|
console.log("");
|
|
52059
52061
|
console.log(source_default.bold(" Connectivity"));
|
|
52060
|
-
displayChecks(checks.filter((c) => c.name === "Portal API"), options.verbose);
|
|
52062
|
+
displayChecks(checks.filter((c) => c.name === "Portal API" || c.name === "llms.txt (GEO)"), options.verbose);
|
|
52061
52063
|
console.log("");
|
|
52062
52064
|
console.log(source_default.bold(" Configuration"));
|
|
52063
52065
|
displayChecks(checks.filter(
|
|
@@ -52222,6 +52224,97 @@ async function checkSiteKitLayout() {
|
|
|
52222
52224
|
details: "Add <SiteKitLayout> from '@sonordev/site-kit/layout' to your root layout"
|
|
52223
52225
|
};
|
|
52224
52226
|
}
|
|
52227
|
+
async function checkLlmsTxt() {
|
|
52228
|
+
const base = process.env.NEXT_PUBLIC_SITE_URL || process.env.SITE_BASE_URL || (process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "");
|
|
52229
|
+
if (!base) {
|
|
52230
|
+
return {
|
|
52231
|
+
name: "llms.txt (GEO)",
|
|
52232
|
+
status: "warn",
|
|
52233
|
+
message: "Skipped (set NEXT_PUBLIC_SITE_URL or SITE_BASE_URL)"
|
|
52234
|
+
};
|
|
52235
|
+
}
|
|
52236
|
+
try {
|
|
52237
|
+
const url = `${base.replace(/\/$/, "")}/llms.txt`;
|
|
52238
|
+
const response = await fetch(url, {
|
|
52239
|
+
method: "GET",
|
|
52240
|
+
signal: AbortSignal.timeout(8e3)
|
|
52241
|
+
});
|
|
52242
|
+
if (!response.ok) {
|
|
52243
|
+
return {
|
|
52244
|
+
name: "llms.txt (GEO)",
|
|
52245
|
+
status: "warn",
|
|
52246
|
+
message: `HTTP ${response.status}`,
|
|
52247
|
+
details: url
|
|
52248
|
+
};
|
|
52249
|
+
}
|
|
52250
|
+
const text = await response.text();
|
|
52251
|
+
const findings = [];
|
|
52252
|
+
let hasIssue = false;
|
|
52253
|
+
const hasH1 = text.trimStart().startsWith("#");
|
|
52254
|
+
if (!hasH1) {
|
|
52255
|
+
findings.push("Missing H1 title");
|
|
52256
|
+
hasIssue = true;
|
|
52257
|
+
}
|
|
52258
|
+
const firstLines = text.split("\n").slice(0, 8);
|
|
52259
|
+
const hasBlockquote = firstLines.some((l) => l.trimStart().startsWith("> "));
|
|
52260
|
+
if (!hasBlockquote) findings.push("No blockquote summary");
|
|
52261
|
+
const h2Count = (text.match(/^## /gm) || []).length;
|
|
52262
|
+
findings.push(`${h2Count} sections (## headers)`);
|
|
52263
|
+
if (h2Count < 2) {
|
|
52264
|
+
findings.push("Fewer than 2 sections \u2014 may be incomplete");
|
|
52265
|
+
hasIssue = true;
|
|
52266
|
+
}
|
|
52267
|
+
const ct = response.headers.get("content-type") || "";
|
|
52268
|
+
if (!ct.includes("text/plain") && !ct.includes("text/markdown")) {
|
|
52269
|
+
findings.push(`Content-Type: ${ct} (expected text/plain)`);
|
|
52270
|
+
hasIssue = true;
|
|
52271
|
+
}
|
|
52272
|
+
const cc = response.headers.get("cache-control") || "";
|
|
52273
|
+
if (cc.includes("s-maxage")) {
|
|
52274
|
+
findings.push("Cache-Control: has s-maxage");
|
|
52275
|
+
} else if (cc) {
|
|
52276
|
+
findings.push("Cache-Control: missing s-maxage");
|
|
52277
|
+
hasIssue = true;
|
|
52278
|
+
} else {
|
|
52279
|
+
findings.push("Cache-Control: missing");
|
|
52280
|
+
hasIssue = true;
|
|
52281
|
+
}
|
|
52282
|
+
const etag = response.headers.get("etag");
|
|
52283
|
+
if (etag) {
|
|
52284
|
+
findings.push(`ETag: ${etag.slice(0, 20)}${etag.length > 20 ? "..." : ""}`);
|
|
52285
|
+
} else {
|
|
52286
|
+
findings.push("ETag: missing");
|
|
52287
|
+
hasIssue = true;
|
|
52288
|
+
}
|
|
52289
|
+
const updatedMatch = text.match(/Content index last updated:\s*(.+)/i);
|
|
52290
|
+
if (updatedMatch) {
|
|
52291
|
+
const updated = new Date(updatedMatch[1].trim());
|
|
52292
|
+
if (!isNaN(updated.getTime())) {
|
|
52293
|
+
const daysOld = Math.floor((Date.now() - updated.getTime()) / 864e5);
|
|
52294
|
+
if (daysOld > 7) {
|
|
52295
|
+
findings.push(`Content ${daysOld}d old \u2014 consider regenerating`);
|
|
52296
|
+
hasIssue = true;
|
|
52297
|
+
} else {
|
|
52298
|
+
findings.push(`Content freshness: ${daysOld}d old`);
|
|
52299
|
+
}
|
|
52300
|
+
}
|
|
52301
|
+
}
|
|
52302
|
+
return {
|
|
52303
|
+
name: "llms.txt (GEO)",
|
|
52304
|
+
status: hasIssue ? "warn" : "ok",
|
|
52305
|
+
message: hasIssue ? `Issues found at ${url}` : `Healthy (${url})`,
|
|
52306
|
+
details: findings.join(" | ")
|
|
52307
|
+
};
|
|
52308
|
+
} catch (error) {
|
|
52309
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
52310
|
+
return {
|
|
52311
|
+
name: "llms.txt (GEO)",
|
|
52312
|
+
status: "warn",
|
|
52313
|
+
message: "Fetch failed",
|
|
52314
|
+
details: msg
|
|
52315
|
+
};
|
|
52316
|
+
}
|
|
52317
|
+
}
|
|
52225
52318
|
async function checkSitemap() {
|
|
52226
52319
|
const sitemapPaths = [
|
|
52227
52320
|
path7__default.default.join(process.cwd(), "app", "sitemap.ts"),
|
|
@@ -52920,7 +53013,13 @@ async function installCommand(options) {
|
|
|
52920
53013
|
console.log(source_default.green(" Next steps:"));
|
|
52921
53014
|
console.log(source_default.gray(" 1. Run: npx sonor-setup init"));
|
|
52922
53015
|
console.log(source_default.gray(" 2. Run: npx sonor-setup scaffold (sitemap, robots, llms routes)"));
|
|
52923
|
-
console.log(source_default.gray(" 3.
|
|
53016
|
+
console.log(source_default.gray(" 3. Run: npx sonor-setup geo (verify GEO / discovery wiring)"));
|
|
53017
|
+
console.log(
|
|
53018
|
+
source_default.gray(
|
|
53019
|
+
' Optional: add "postinstall": "sonor-setup geo --for-install" to auto-create llms routes on install'
|
|
53020
|
+
)
|
|
53021
|
+
);
|
|
53022
|
+
console.log(source_default.gray(" 4. Follow the setup wizard"));
|
|
52924
53023
|
console.log("");
|
|
52925
53024
|
} catch (error) {
|
|
52926
53025
|
spinner.fail("Installation failed");
|
|
@@ -53017,6 +53116,10 @@ async function scaffoldCommand(options) {
|
|
|
53017
53116
|
|
|
53018
53117
|
export default createSitemap({
|
|
53019
53118
|
// baseUrl auto-resolved from Portal via API key
|
|
53119
|
+
includeLlmsTxtInSitemap: true,
|
|
53120
|
+
includeLlmsFullTxtInSitemap: true,
|
|
53121
|
+
// optimizedLLMsTxt: true, // optional: static build writes optimized llms (CI)
|
|
53122
|
+
// llmsPublicSummaryOnly: true, // optional: page list from Portal public summaries only
|
|
53020
53123
|
// additionalPaths: async () => [...],
|
|
53021
53124
|
})
|
|
53022
53125
|
`
|
|
@@ -53149,8 +53252,9 @@ SONOR_API_KEY=sonor_your-project-uuid_your-secret-key
|
|
|
53149
53252
|
# Optional \u2014 Override API URL (defaults to https://api.sonor.io)
|
|
53150
53253
|
# SONOR_API_URL=https://api.sonor.io
|
|
53151
53254
|
|
|
53152
|
-
#
|
|
53255
|
+
# Recommended \u2014 canonical origin (llms discovery Link header, sitemap, metadata)
|
|
53153
53256
|
# NEXT_PUBLIC_SITE_URL=https://your-domain.com
|
|
53257
|
+
# SITE_BASE_URL=https://your-domain.com
|
|
53154
53258
|
`
|
|
53155
53259
|
}
|
|
53156
53260
|
);
|
|
@@ -53211,6 +53315,18 @@ SONOR_API_KEY=sonor_your-project-uuid_your-secret-key
|
|
|
53211
53315
|
console.log(source_default.gray(" import { withManagedMetadata } from '@sonordev/site-kit/seo'"));
|
|
53212
53316
|
console.log(source_default.gray(" export const generateMetadata = withManagedMetadata('/your-page')"));
|
|
53213
53317
|
console.log("");
|
|
53318
|
+
console.log(source_default.bold(" GEO / llms.txt (machine discovery):"));
|
|
53319
|
+
console.log("");
|
|
53320
|
+
console.log(source_default.gray(" npx sonor-setup geo # checklist"));
|
|
53321
|
+
console.log(source_default.gray(" npx sonor-setup geo --ensure-routes"));
|
|
53322
|
+
console.log("");
|
|
53323
|
+
console.log(source_default.gray(" // next.config \u2014 Link rel=describedby on all pages:"));
|
|
53324
|
+
console.log(
|
|
53325
|
+
source_default.cyan(
|
|
53326
|
+
" export default withSiteKitConfig({ llmsTxtDiscoveryLink: true })"
|
|
53327
|
+
)
|
|
53328
|
+
);
|
|
53329
|
+
console.log("");
|
|
53214
53330
|
}
|
|
53215
53331
|
}
|
|
53216
53332
|
async function findAppDir3() {
|
|
@@ -53224,6 +53340,160 @@ async function findAppDir3() {
|
|
|
53224
53340
|
}
|
|
53225
53341
|
return null;
|
|
53226
53342
|
}
|
|
53343
|
+
var LLMS_ROUTE = `import { createLLMsTxtHandler } from '@sonordev/site-kit/llms'
|
|
53344
|
+
|
|
53345
|
+
export const GET = createLLMsTxtHandler({ preferStatic: true })
|
|
53346
|
+
`;
|
|
53347
|
+
var LLMS_FULL_ROUTE = `import { createLLMsFullTxtHandler } from '@sonordev/site-kit/llms'
|
|
53348
|
+
|
|
53349
|
+
export const GET = createLLMsFullTxtHandler({ preferStatic: true })
|
|
53350
|
+
`;
|
|
53351
|
+
async function readIfExists(p) {
|
|
53352
|
+
if (!fs.existsSync(p)) return "";
|
|
53353
|
+
try {
|
|
53354
|
+
return await fs2__default.default.readFile(p, "utf-8");
|
|
53355
|
+
} catch {
|
|
53356
|
+
return "";
|
|
53357
|
+
}
|
|
53358
|
+
}
|
|
53359
|
+
async function ensureLlmsRouteFiles(appDir, dryRun) {
|
|
53360
|
+
const llms = path7__default.default.join(appDir, "llms.txt", "route.ts");
|
|
53361
|
+
const llmsFull = path7__default.default.join(appDir, "llms-full.txt", "route.ts");
|
|
53362
|
+
let n = 0;
|
|
53363
|
+
if (dryRun) return 0;
|
|
53364
|
+
if (!fs.existsSync(llms)) {
|
|
53365
|
+
await fs2__default.default.mkdir(path7__default.default.dirname(llms), { recursive: true });
|
|
53366
|
+
await fs2__default.default.writeFile(llms, LLMS_ROUTE, "utf-8");
|
|
53367
|
+
n++;
|
|
53368
|
+
}
|
|
53369
|
+
if (!fs.existsSync(llmsFull)) {
|
|
53370
|
+
await fs2__default.default.mkdir(path7__default.default.dirname(llmsFull), { recursive: true });
|
|
53371
|
+
await fs2__default.default.writeFile(llmsFull, LLMS_FULL_ROUTE, "utf-8");
|
|
53372
|
+
n++;
|
|
53373
|
+
}
|
|
53374
|
+
return n;
|
|
53375
|
+
}
|
|
53376
|
+
async function geoCommand(options) {
|
|
53377
|
+
if (options.forInstall) {
|
|
53378
|
+
const appDir2 = await findAppDir3();
|
|
53379
|
+
if (!appDir2) return;
|
|
53380
|
+
const created = await ensureLlmsRouteFiles(appDir2, options.dryRun);
|
|
53381
|
+
if (created > 0) {
|
|
53382
|
+
console.log(
|
|
53383
|
+
source_default.cyan(
|
|
53384
|
+
`[@sonordev/site-kit] Created ${created} llms route file(s). Set NEXT_PUBLIC_SITE_URL, use createSitemap({ includeLlmsTxtInSitemap: true }), and withSiteKitConfig({ llmsTxtDiscoveryLink: true }) when ready.`
|
|
53385
|
+
)
|
|
53386
|
+
);
|
|
53387
|
+
}
|
|
53388
|
+
return;
|
|
53389
|
+
}
|
|
53390
|
+
const cwd = process.cwd();
|
|
53391
|
+
console.log("");
|
|
53392
|
+
console.log(source_default.bold(" Sonor GEO / llms.txt"));
|
|
53393
|
+
console.log(
|
|
53394
|
+
source_default.gray(
|
|
53395
|
+
" Machine-readable site summary (Portal + optional static build)"
|
|
53396
|
+
)
|
|
53397
|
+
);
|
|
53398
|
+
console.log("");
|
|
53399
|
+
const appDir = await findAppDir3();
|
|
53400
|
+
if (!appDir) {
|
|
53401
|
+
console.log(source_default.red(" \u2717 No app directory (app/ or src/app/)"));
|
|
53402
|
+
process.exit(1);
|
|
53403
|
+
}
|
|
53404
|
+
const llms = path7__default.default.join(appDir, "llms.txt", "route.ts");
|
|
53405
|
+
const llmsFull = path7__default.default.join(appDir, "llms-full.txt", "route.ts");
|
|
53406
|
+
const sitemap = path7__default.default.join(appDir, "sitemap.ts");
|
|
53407
|
+
let allOk = true;
|
|
53408
|
+
const row = (label, pass) => {
|
|
53409
|
+
if (!pass) allOk = false;
|
|
53410
|
+
console.log(
|
|
53411
|
+
(pass ? source_default.green(" \u2713 ") : source_default.red(" \u2717 ")) + label
|
|
53412
|
+
);
|
|
53413
|
+
};
|
|
53414
|
+
row("llms.txt route", fs.existsSync(llms));
|
|
53415
|
+
row("llms-full.txt route", fs.existsSync(llmsFull));
|
|
53416
|
+
let sitemapHasLlms = false;
|
|
53417
|
+
if (fs.existsSync(sitemap)) {
|
|
53418
|
+
const txt = await readIfExists(sitemap);
|
|
53419
|
+
sitemapHasLlms = txt.includes("includeLlmsTxtInSitemap") || txt.includes("includeLlmsFullTxtInSitemap");
|
|
53420
|
+
row("sitemap.ts lists llms URLs", sitemapHasLlms);
|
|
53421
|
+
} else {
|
|
53422
|
+
row("sitemap.ts lists llms URLs", false);
|
|
53423
|
+
}
|
|
53424
|
+
const nextConfigs = [
|
|
53425
|
+
path7__default.default.join(cwd, "next.config.ts"),
|
|
53426
|
+
path7__default.default.join(cwd, "next.config.mjs"),
|
|
53427
|
+
path7__default.default.join(cwd, "next.config.js")
|
|
53428
|
+
];
|
|
53429
|
+
let nextCfg = "";
|
|
53430
|
+
for (const p of nextConfigs) {
|
|
53431
|
+
if (fs.existsSync(p)) {
|
|
53432
|
+
nextCfg = await readIfExists(p);
|
|
53433
|
+
break;
|
|
53434
|
+
}
|
|
53435
|
+
}
|
|
53436
|
+
const layoutCandidates = [
|
|
53437
|
+
path7__default.default.join(appDir, "layout.tsx"),
|
|
53438
|
+
path7__default.default.join(appDir, "layout.jsx"),
|
|
53439
|
+
path7__default.default.join(appDir, "layout.js")
|
|
53440
|
+
];
|
|
53441
|
+
let layoutTxt = "";
|
|
53442
|
+
for (const p of layoutCandidates) {
|
|
53443
|
+
layoutTxt = await readIfExists(p);
|
|
53444
|
+
if (layoutTxt) break;
|
|
53445
|
+
}
|
|
53446
|
+
const hasLayoutDiscovery = layoutTxt.includes("buildAiDiscoveryHeaders") || layoutTxt.includes("llmsTxtDiscoveryLink");
|
|
53447
|
+
const hasConfigDiscovery = nextCfg.includes("llmsTxtDiscoveryLink");
|
|
53448
|
+
row(
|
|
53449
|
+
"discovery header (next.config or root layout)",
|
|
53450
|
+
hasConfigDiscovery || hasLayoutDiscovery
|
|
53451
|
+
);
|
|
53452
|
+
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL?.trim() || process.env.SITE_BASE_URL?.trim() || (process.env.VERCEL_URL?.trim() ? `https://${process.env.VERCEL_URL.replace(/\/$/, "")}` : "");
|
|
53453
|
+
if (siteUrl) {
|
|
53454
|
+
console.log(source_default.gray(` Public origin (env): ${siteUrl}`));
|
|
53455
|
+
} else {
|
|
53456
|
+
console.log(
|
|
53457
|
+
source_default.yellow(
|
|
53458
|
+
" ! Set NEXT_PUBLIC_SITE_URL or SITE_BASE_URL for correct Link hrefs"
|
|
53459
|
+
)
|
|
53460
|
+
);
|
|
53461
|
+
}
|
|
53462
|
+
if (options.ensureRoutes) {
|
|
53463
|
+
if (options.dryRun) {
|
|
53464
|
+
console.log(source_default.yellow(" [DRY RUN] Would create missing llms routes"));
|
|
53465
|
+
} else {
|
|
53466
|
+
const spinner = ora("Ensuring llms routes...").start();
|
|
53467
|
+
const n = await ensureLlmsRouteFiles(appDir, false);
|
|
53468
|
+
spinner.succeed(
|
|
53469
|
+
n ? `Created ${n} missing route file(s)` : "llms routes already present"
|
|
53470
|
+
);
|
|
53471
|
+
}
|
|
53472
|
+
}
|
|
53473
|
+
console.log("");
|
|
53474
|
+
console.log(source_default.bold(" Automation"));
|
|
53475
|
+
console.log("");
|
|
53476
|
+
console.log(
|
|
53477
|
+
source_default.gray(
|
|
53478
|
+
" \u2022 next.config: withSiteKitConfig({ llmsTxtDiscoveryLink: true })"
|
|
53479
|
+
)
|
|
53480
|
+
);
|
|
53481
|
+
console.log(
|
|
53482
|
+
source_default.gray(
|
|
53483
|
+
" (If you define your own headers() on nextConfig, merge Link manually.)"
|
|
53484
|
+
)
|
|
53485
|
+
);
|
|
53486
|
+
console.log(
|
|
53487
|
+
source_default.gray(
|
|
53488
|
+
" \u2022 createSitemap({ includeLlmsTxtInSitemap: true, includeLlmsFullTxtInSitemap: true })"
|
|
53489
|
+
)
|
|
53490
|
+
);
|
|
53491
|
+
console.log(
|
|
53492
|
+
source_default.gray(" \u2022 npx sonor-setup scaffold --minimal (routes + sitemap template)")
|
|
53493
|
+
);
|
|
53494
|
+
console.log("");
|
|
53495
|
+
if (!allOk) process.exitCode = 1;
|
|
53496
|
+
}
|
|
53227
53497
|
|
|
53228
53498
|
// src/cli/index.ts
|
|
53229
53499
|
dotenv.config({ path: ".env.local" });
|
|
@@ -53243,6 +53513,10 @@ program2.command("api-routes").description("Generate API proxy routes").option("
|
|
|
53243
53513
|
program2.command("install").description("Install @sonordev/site-kit in current project").option("-D, --dev", "Install as dev dependency").option("--dry-run", "Show command without running").action(installCommand);
|
|
53244
53514
|
program2.command("upgrade").description("Upgrade @sonordev/site-kit to latest version").option("-v, --version <version>", "Target version (default: latest)").option("--dry-run", "Show command without running").action(upgradeCommand);
|
|
53245
53515
|
program2.command("scaffold").description("Scaffold the full Site-Kit stack (sitemap, robots, llms, middleware, manifest, error pages)").option("--dry-run", "Show what would be created").option("-f, --force", "Overwrite existing files").option("--minimal", "Only create sitemap, robots, llms routes").action(scaffoldCommand);
|
|
53516
|
+
program2.command("geo").description("Check llms.txt / GEO wiring (routes, sitemap, discovery headers)").option("--dry-run", "With --ensure-routes, show actions only").option("--ensure-routes", "Create llms.txt and llms-full.txt routes if missing").option(
|
|
53517
|
+
"--for-install",
|
|
53518
|
+
"Create missing llms routes only (quiet; use from app postinstall)"
|
|
53519
|
+
).action(geoCommand);
|
|
53246
53520
|
if (process.argv.length === 2) {
|
|
53247
53521
|
process.argv.push("init");
|
|
53248
53522
|
}
|