@canonry/canonry 7.51.5 → 7.52.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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +8 -0
- package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-CteIuEGI.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-DqJGiLsf.js} +1 -1
- package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-DotWEPQt.js} +1 -1
- package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-aOd198dT.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +4 -0
- package/assets/assets/{ProjectPage-DoY0hftd.js → ProjectPage-O9oufMgi.js} +4 -4
- package/assets/assets/{RunsPage-BPBmuQAS.js → RunsPage-DIXMrc-N.js} +1 -1
- package/assets/assets/{SettingsPage-ClKnP8xy.js → SettingsPage-BuGb6AGa.js} +1 -1
- package/assets/assets/SiteHealthSection-CweaKjCo.js +2 -0
- package/assets/assets/TrafficPage-B7MaQalp.js +40 -0
- package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-BPtjnF9s.js} +1 -1
- package/assets/assets/{card-DYMyvhB9.js → card-DoV-8Txo.js} +1 -1
- package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-DKQJJlZ-.js} +1 -1
- package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-BWnMmkiO.js} +1 -1
- package/assets/assets/index-Z63c4PeO.js +39 -0
- package/assets/assets/{query-client-gRFnU4VF.js → query-client-vB35tVTz.js} +1 -1
- package/assets/assets/{react-query-lH82FULK.js → react-query-BI0567qs.js} +1 -1
- package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-hGyOC4V_.js} +1 -1
- package/assets/assets/{service-Cx0HSnE9.js → service-c4YvpVKX.js} +1 -1
- package/assets/index.html +6 -6
- package/dist/ads-MREK2AGL.js +544 -0
- package/dist/agent-4RUZ3MC4.js +70 -0
- package/dist/agent-ask-YLTYBEYH.js +139 -0
- package/dist/agent-conversations-QA6IKDGR.js +52 -0
- package/dist/agent-memory-MEQAJOB3.js +92 -0
- package/dist/agent-providers-AXYPDJHL.js +55 -0
- package/dist/agent-transcript-SMNQNYCD.js +77 -0
- package/dist/analytics-4OR64IGV.js +240 -0
- package/dist/apply-CQXCFXAH.js +175 -0
- package/dist/backfill-TMXCNVOB.js +41 -0
- package/dist/backlinks-6KFAQGYV.js +303 -0
- package/dist/bing-HFCACTAC.js +418 -0
- package/dist/bootstrap-SQVQXOJC.js +326 -0
- package/dist/cdp-IACL7EXU.js +162 -0
- package/dist/chunk-4MJYGB56.js +124 -0
- package/dist/chunk-5N6245R7.js +1160 -0
- package/dist/chunk-6BPZHNDC.js +617 -0
- package/dist/chunk-6GO5VVAC.js +15 -0
- package/dist/chunk-7244X3K6.js +609 -0
- package/dist/chunk-7XE2IRBG.js +204 -0
- package/dist/chunk-AOJU5LKX.js +8 -0
- package/dist/chunk-AWCWIQAU.js +2686 -0
- package/dist/{chunk-JBZZEIM2.js → chunk-BBOHY2DQ.js} +2 -13
- package/dist/{chunk-AZFPA7JV.js → chunk-BU3VAG5J.js} +6 -4
- package/dist/{chunk-4YCGZGA3.js → chunk-BYOK6Z4F.js} +2 -2
- package/dist/chunk-DSNSD5J3.js +971 -0
- package/dist/chunk-EGIZNSDA.js +94 -0
- package/dist/chunk-ELCLGWUT.js +83 -0
- package/dist/chunk-FC4XND45.js +38 -0
- package/dist/chunk-GNKOBKPW.js +58 -0
- package/dist/chunk-HEGXGCGL.js +524 -0
- package/dist/chunk-I6KNMZ77.js +232 -0
- package/dist/{chunk-HLVEB5TB.js → chunk-IIOEAJTV.js} +7 -5
- package/dist/chunk-ILDT4LPB.js +1273 -0
- package/dist/chunk-JY3RLZGB.js +30 -0
- package/dist/{chunk-PLYJX67A.js → chunk-K5I45PZI.js} +8084 -13939
- package/dist/chunk-KXAOMTXN.js +1034 -0
- package/dist/chunk-LK2BG6EX.js +145 -0
- package/dist/chunk-MJNUSPO4.js +15 -0
- package/dist/chunk-MKAC7HKH.js +9178 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-SFMWHPMX.js → chunk-O4RMPA6H.js} +13765 -13737
- package/dist/chunk-O77IBNVO.js +8264 -0
- package/dist/chunk-OFL4PTYU.js +644 -0
- package/dist/chunk-QLPLENDT.js +133 -0
- package/dist/chunk-R2J4SNKF.js +78 -0
- package/dist/{chunk-KEATAHXH.js → chunk-RVUCY4ZV.js} +358 -581
- package/dist/chunk-SNFBJKAW.js +530 -0
- package/dist/chunk-TALC5DX5.js +420 -0
- package/dist/chunk-TSENU4GG.js +18 -0
- package/dist/{chunk-HAHXPJQ5.js → chunk-V5D4XNWV.js} +16 -1684
- package/dist/chunk-VJWDBFSL.js +69 -0
- package/dist/chunk-XEBKF4N5.js +8 -0
- package/dist/chunk-Y4GK7GCV.js +15376 -0
- package/dist/{chunk-A3WSAAQS.js → chunk-YSEC6TIB.js} +7917 -33199
- package/dist/chunk-Z7IUAJOF.js +13 -0
- package/dist/citations-NSBBWRZ4.js +106 -0
- package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-OFWJMNMD.js} +5 -3
- package/dist/cli-commands-WVBL337U.js +19 -0
- package/dist/cli.js +35 -29
- package/dist/competitor-V4OHORBC.js +561 -0
- package/dist/content-RUXRI5IC.js +257 -0
- package/dist/dashboard-JXB2YAQJ.js +71 -0
- package/dist/demo-55ZNUOXU.js +75 -0
- package/dist/{demo-server-GIWDJGJX.js → demo-server-XO7PHM4I.js} +22 -9
- package/dist/discover-JJQ564HS.js +372 -0
- package/dist/discover-eval-KLEKZ6U4.js +282 -0
- package/dist/doctor-JAMQZCMZ.js +152 -0
- package/dist/evidence-YRSB7GFE.js +57 -0
- package/dist/export-cmd-MHML4OYU.js +49 -0
- package/dist/ga-LSXPE2MN.js +911 -0
- package/dist/gbp-RMKMLOC7.js +370 -0
- package/dist/google-JQ4T6JTQ.js +946 -0
- package/dist/google-marketing-J6SEODYC.js +403 -0
- package/dist/health-cmd-MV2JM2C3.js +64 -0
- package/dist/history-SRRH7A2E.js +90 -0
- package/dist/index.d.ts +43 -4
- package/dist/index.js +29 -6
- package/dist/init-ZJZFUERV.js +432 -0
- package/dist/insights-PMMGNWZH.js +63 -0
- package/dist/intelligence-service-KCSU6ZUJ.js +15 -0
- package/dist/keys-TS7NZANS.js +116 -0
- package/dist/keyword-VNCKDUGC.js +164 -0
- package/dist/logs-VH3WOTZJ.js +30 -0
- package/dist/mcp-DG2RROB3.js +14 -0
- package/dist/mcp.js +14 -5
- package/dist/measurement-plan-4T35TUGG.js +42 -0
- package/dist/notify-BWHUSKL7.js +125 -0
- package/dist/organic-evidence-QX4SXXJP.js +53 -0
- package/dist/overview-7IHUTKUV.js +213 -0
- package/dist/project-JXLSWDE2.js +460 -0
- package/dist/query-S75EL25H.js +211 -0
- package/dist/research-KFTV3IP4.js +200 -0
- package/dist/results-export-GTKVBU34.js +27 -0
- package/dist/run-26HDIRHF.js +31 -0
- package/dist/schedule-N6G4SVHQ.js +177 -0
- package/dist/search-MI32EPYM.js +42 -0
- package/dist/serve-XLGE42AG.js +598 -0
- package/dist/session-W5DXWIYM.js +47 -0
- package/dist/settings-T7WI2UVE.js +107 -0
- package/dist/skills-F3WPKPTK.js +33 -0
- package/dist/snapshot-PD3EAVEX.js +538 -0
- package/dist/src-XDUXMJC3.js +316 -0
- package/dist/status-PUH7JFZ4.js +126 -0
- package/dist/support-ARF4HER7.js +24 -0
- package/dist/technical-aeo-AUFWWJIP.js +625 -0
- package/dist/telemetry-XBYT7G2K.js +118 -0
- package/dist/tools-GVHIRWSN.js +41 -0
- package/dist/traffic-B3HW2ZWG.js +1295 -0
- package/dist/users-M5HNQZYI.js +170 -0
- package/dist/visibility-stats-Y7GJKMHN.js +241 -0
- package/dist/wordpress-GCIURYPN.js +600 -0
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
- package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
- package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
- package/assets/assets/index-CG1Jox52.js +0 -39
- package/dist/chunk-4QQYYRHV.js +0 -23082
- package/dist/cli-commands-FOJR3HHU.js +0 -15
- package/dist/intelligence-service-XQCNWAPL.js +0 -9
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CliError,
|
|
3
|
+
EXIT_SYSTEM_ERROR
|
|
4
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
5
|
+
import {
|
|
6
|
+
describeError
|
|
7
|
+
} from "./chunk-O4RMPA6H.js";
|
|
8
|
+
|
|
9
|
+
// src/gsc-sitemap-submission.ts
|
|
10
|
+
function dedupeGscSitemapUrls(urls) {
|
|
11
|
+
return [...new Set(urls.map((url) => url.trim()).filter(Boolean))];
|
|
12
|
+
}
|
|
13
|
+
async function resolveDiscoveredGscSitemapUrls(client, project, mode) {
|
|
14
|
+
const topLevel = await client.gscSitemaps(project);
|
|
15
|
+
if (mode === "indexes") {
|
|
16
|
+
return dedupeGscSitemapUrls(
|
|
17
|
+
topLevel.preferredSubmissionUrls.length > 0 ? topLevel.preferredSubmissionUrls : topLevel.sitemaps.map((sitemap) => sitemap.path)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const indexes = topLevel.sitemaps.filter((sitemap) => sitemap.isSitemapsIndex).map((sitemap) => sitemap.path);
|
|
21
|
+
const expandedIndexUrls = [];
|
|
22
|
+
for (let offset = 0; offset < indexes.length; offset += 4) {
|
|
23
|
+
const children = await Promise.all(
|
|
24
|
+
indexes.slice(offset, offset + 4).map((sitemapIndex) => client.gscSitemaps(project, { sitemapIndex }))
|
|
25
|
+
);
|
|
26
|
+
children.forEach((result, index) => {
|
|
27
|
+
const sitemapIndex = indexes[offset + index];
|
|
28
|
+
expandedIndexUrls.push(...result.sitemaps.length > 0 ? result.sitemaps.map((sitemap) => sitemap.path) : [sitemapIndex]);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return dedupeGscSitemapUrls([
|
|
32
|
+
...topLevel.sitemaps.filter((sitemap) => !sitemap.isSitemapsIndex).map((sitemap) => sitemap.path),
|
|
33
|
+
...expandedIndexUrls
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
function requireGscSitemapUrls(project, sitemapUrls) {
|
|
37
|
+
if (sitemapUrls.length > 0) return;
|
|
38
|
+
throw new CliError({
|
|
39
|
+
code: "CLI_USAGE_ERROR",
|
|
40
|
+
message: "no GSC sitemaps found; provide a URL or use --configured",
|
|
41
|
+
displayMessage: "Error: no GSC sitemaps found; provide a URL or use --configured",
|
|
42
|
+
details: { command: "google.submit-sitemap", project }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function submitGscSitemapBatches(client, project, sitemapUrls, opts = {}) {
|
|
46
|
+
const batches = Array.from(
|
|
47
|
+
{ length: Math.ceil(sitemapUrls.length / 50) },
|
|
48
|
+
(_, index) => sitemapUrls.slice(index * 50, index * 50 + 50)
|
|
49
|
+
);
|
|
50
|
+
const aggregate = {
|
|
51
|
+
summary: { total: 0, accepted: 0, failed: 0 },
|
|
52
|
+
results: []
|
|
53
|
+
};
|
|
54
|
+
for (const [index, batchSitemapUrls] of batches.entries()) {
|
|
55
|
+
try {
|
|
56
|
+
const result = await client.gscSubmitSitemaps(project, { sitemapUrls: batchSitemapUrls });
|
|
57
|
+
aggregate.summary.total += result.summary.total;
|
|
58
|
+
aggregate.summary.accepted += result.summary.accepted;
|
|
59
|
+
aggregate.summary.failed += result.summary.failed;
|
|
60
|
+
aggregate.results.push(...result.results);
|
|
61
|
+
opts.onProgress?.(index + 1, batches.length);
|
|
62
|
+
} catch (cause) {
|
|
63
|
+
if (index === 0) throw cause;
|
|
64
|
+
const attempted = aggregate.summary.total + batchSitemapUrls.length;
|
|
65
|
+
const remaining = sitemapUrls.length - attempted;
|
|
66
|
+
throw new CliError({
|
|
67
|
+
code: "GOOGLE_SITEMAP_SUBMISSION_PARTIAL",
|
|
68
|
+
message: `Sitemap submission stopped at batch ${index + 1}/${batches.length}; ${aggregate.summary.accepted} accepted, ${aggregate.summary.failed} failed, ${batchSitemapUrls.length} unconfirmed, ${remaining} not attempted.`,
|
|
69
|
+
displayMessage: `Sitemap submission stopped at batch ${index + 1}/${batches.length}; ${aggregate.summary.accepted} accepted, ${aggregate.summary.failed} failed, ${batchSitemapUrls.length} unconfirmed, ${remaining} not attempted. Earlier accepted submissions were not rolled back.`,
|
|
70
|
+
exitCode: cause instanceof CliError && cause.exitCode === 1 ? 1 : EXIT_SYSTEM_ERROR,
|
|
71
|
+
details: {
|
|
72
|
+
project,
|
|
73
|
+
accepted: aggregate.summary.accepted,
|
|
74
|
+
failed: aggregate.summary.failed,
|
|
75
|
+
completed: aggregate.summary.total,
|
|
76
|
+
attempted,
|
|
77
|
+
unconfirmed: batchSitemapUrls.length,
|
|
78
|
+
remaining,
|
|
79
|
+
unconfirmedBatch: { index: index + 1, total: batches.length, sitemapUrls: batchSitemapUrls },
|
|
80
|
+
partialResult: aggregate,
|
|
81
|
+
cause: cause instanceof CliError ? { code: cause.code, message: cause.message, details: cause.details } : { message: describeError(cause) }
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return aggregate;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
dedupeGscSitemapUrls,
|
|
91
|
+
resolveDiscoveredGscSitemapUrls,
|
|
92
|
+
requireGscSitemapUrls,
|
|
93
|
+
submitGscSitemapBatches
|
|
94
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// src/google-config.ts
|
|
2
|
+
function ensureConnections(config) {
|
|
3
|
+
if (!config.google) config.google = {};
|
|
4
|
+
if (!config.google.connections) config.google.connections = [];
|
|
5
|
+
return config.google.connections;
|
|
6
|
+
}
|
|
7
|
+
function getGoogleAuthConfig(config) {
|
|
8
|
+
return {
|
|
9
|
+
clientId: config.google?.clientId,
|
|
10
|
+
clientSecret: config.google?.clientSecret
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function setGoogleAuthConfig(config, auth) {
|
|
14
|
+
const hasValues = Boolean(auth.clientId || auth.clientSecret || config.google?.connections?.length);
|
|
15
|
+
if (!hasValues) {
|
|
16
|
+
delete config.google;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!config.google) config.google = {};
|
|
20
|
+
config.google.clientId = auth.clientId;
|
|
21
|
+
config.google.clientSecret = auth.clientSecret;
|
|
22
|
+
config.google.connections = config.google.connections ?? [];
|
|
23
|
+
}
|
|
24
|
+
function listGoogleConnections(config, domain) {
|
|
25
|
+
return (config.google?.connections ?? []).filter((connection) => connection.domain === domain);
|
|
26
|
+
}
|
|
27
|
+
function getGoogleConnection(config, domain, connectionType) {
|
|
28
|
+
return (config.google?.connections ?? []).find((connection) => connection.domain === domain && connection.connectionType === connectionType);
|
|
29
|
+
}
|
|
30
|
+
function upsertGoogleConnection(config, connection) {
|
|
31
|
+
const connections = ensureConnections(config);
|
|
32
|
+
const index = connections.findIndex((entry) => entry.domain === connection.domain && entry.connectionType === connection.connectionType);
|
|
33
|
+
const normalized = {
|
|
34
|
+
...connection,
|
|
35
|
+
propertyId: connection.propertyId ?? null,
|
|
36
|
+
sitemapUrl: connection.sitemapUrl ?? null,
|
|
37
|
+
refreshToken: connection.refreshToken ?? null,
|
|
38
|
+
tokenExpiresAt: connection.tokenExpiresAt ?? null,
|
|
39
|
+
scopes: connection.scopes ?? [],
|
|
40
|
+
createdByProjectId: connection.createdByProjectId ?? null
|
|
41
|
+
};
|
|
42
|
+
if (index === -1) {
|
|
43
|
+
connections.push(normalized);
|
|
44
|
+
return normalized;
|
|
45
|
+
}
|
|
46
|
+
connections[index] = normalized;
|
|
47
|
+
return normalized;
|
|
48
|
+
}
|
|
49
|
+
function patchGoogleConnection(config, domain, connectionType, patch) {
|
|
50
|
+
const existing = getGoogleConnection(config, domain, connectionType);
|
|
51
|
+
if (!existing) return void 0;
|
|
52
|
+
return upsertGoogleConnection(config, {
|
|
53
|
+
...existing,
|
|
54
|
+
...patch,
|
|
55
|
+
propertyId: Object.prototype.hasOwnProperty.call(patch, "propertyId") ? patch.propertyId ?? null : existing.propertyId ?? null,
|
|
56
|
+
sitemapUrl: Object.prototype.hasOwnProperty.call(patch, "sitemapUrl") ? patch.sitemapUrl ?? null : existing.sitemapUrl ?? null,
|
|
57
|
+
refreshToken: Object.prototype.hasOwnProperty.call(patch, "refreshToken") ? patch.refreshToken ?? null : existing.refreshToken ?? null,
|
|
58
|
+
tokenExpiresAt: Object.prototype.hasOwnProperty.call(patch, "tokenExpiresAt") ? patch.tokenExpiresAt ?? null : existing.tokenExpiresAt ?? null,
|
|
59
|
+
scopes: patch.scopes ?? existing.scopes ?? []
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function removeGoogleConnection(config, domain, connectionType) {
|
|
63
|
+
const connections = config.google?.connections;
|
|
64
|
+
if (!connections?.length) return false;
|
|
65
|
+
const next = connections.filter((connection) => connection.domain !== domain || connection.connectionType !== connectionType);
|
|
66
|
+
if (next.length === connections.length) return false;
|
|
67
|
+
if (!config.google) return false;
|
|
68
|
+
config.google.connections = next;
|
|
69
|
+
if (!config.google.clientId && !config.google.clientSecret && next.length === 0) {
|
|
70
|
+
delete config.google;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
getGoogleAuthConfig,
|
|
77
|
+
setGoogleAuthConfig,
|
|
78
|
+
listGoogleConnections,
|
|
79
|
+
getGoogleConnection,
|
|
80
|
+
upsertGoogleConnection,
|
|
81
|
+
patchGoogleConnection,
|
|
82
|
+
removeGoogleConnection
|
|
83
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hostMatchesDomain
|
|
3
|
+
} from "./chunk-O4RMPA6H.js";
|
|
4
|
+
|
|
5
|
+
// src/citation-utils.ts
|
|
6
|
+
function pickProjectCitedDomain(citedDomains, projectDomains) {
|
|
7
|
+
for (const cited of citedDomains) {
|
|
8
|
+
if (projectDomains.some((pd) => hostMatchesDomain(cited, pd))) return cited;
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
function determineCitationState(normalized, domains) {
|
|
13
|
+
for (const canonicalDomain of domains) {
|
|
14
|
+
if (normalized.citedDomains.some((d) => hostMatchesDomain(d, canonicalDomain))) {
|
|
15
|
+
return "cited";
|
|
16
|
+
}
|
|
17
|
+
for (const source of normalized.groundingSources) {
|
|
18
|
+
if (hostMatchesDomain(source.uri, canonicalDomain)) return "cited";
|
|
19
|
+
if (source.title && hostMatchesDomain(source.title, canonicalDomain)) return "cited";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return "not-cited";
|
|
23
|
+
}
|
|
24
|
+
function computeCitedCompetitorDomains(citedDomains, competitorDomains) {
|
|
25
|
+
const citedCompetitors = /* @__PURE__ */ new Set();
|
|
26
|
+
for (const citedDomain of citedDomains) {
|
|
27
|
+
for (const competitorDomain of competitorDomains) {
|
|
28
|
+
if (hostMatchesDomain(citedDomain, competitorDomain)) citedCompetitors.add(competitorDomain);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [...citedCompetitors];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
pickProjectCitedDomain,
|
|
36
|
+
determineCitationState,
|
|
37
|
+
computeCitedCompetitorDomains
|
|
38
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registeredProviderNames
|
|
3
|
+
} from "./chunk-JY3RLZGB.js";
|
|
4
|
+
import {
|
|
5
|
+
configExists,
|
|
6
|
+
loadConfigRaw
|
|
7
|
+
} from "./chunk-OFL4PTYU.js";
|
|
8
|
+
|
|
9
|
+
// src/setup-state.ts
|
|
10
|
+
import fs from "fs";
|
|
11
|
+
async function buildSetupState() {
|
|
12
|
+
if (!configExists()) return void 0;
|
|
13
|
+
let provider_count = 0;
|
|
14
|
+
let has_keywords = false;
|
|
15
|
+
let project_count = 0;
|
|
16
|
+
let is_first_run = true;
|
|
17
|
+
let dbPath;
|
|
18
|
+
try {
|
|
19
|
+
const raw = loadConfigRaw();
|
|
20
|
+
if (raw) {
|
|
21
|
+
is_first_run = !raw.anonymousId;
|
|
22
|
+
provider_count = registeredProviderNames(raw).length;
|
|
23
|
+
if (typeof raw.database === "string" && raw.database.length > 0) {
|
|
24
|
+
dbPath = raw.database;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
if (dbPath && fs.existsSync(dbPath)) {
|
|
30
|
+
try {
|
|
31
|
+
const { createClient, projects, queries: queriesTable } = await import("./src-XDUXMJC3.js");
|
|
32
|
+
const db = createClient(dbPath);
|
|
33
|
+
project_count = db.select({ id: projects.id }).from(projects).all().length;
|
|
34
|
+
const firstQuery = db.select({ id: queriesTable.id }).from(queriesTable).limit(1).all();
|
|
35
|
+
has_keywords = firstQuery.length > 0;
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { provider_count, has_keywords, project_count, is_first_run };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/serve-handoff.ts
|
|
43
|
+
var pendingServeHandoff = false;
|
|
44
|
+
function queueServeHandoff() {
|
|
45
|
+
pendingServeHandoff = true;
|
|
46
|
+
}
|
|
47
|
+
async function runPendingServeHandoff(format) {
|
|
48
|
+
if (!pendingServeHandoff) return;
|
|
49
|
+
pendingServeHandoff = false;
|
|
50
|
+
const { serveCommand } = await import("./serve-XLGE42AG.js");
|
|
51
|
+
await serveCommand(format);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
buildSetupState,
|
|
56
|
+
queueServeHandoff,
|
|
57
|
+
runPendingServeHandoff
|
|
58
|
+
};
|