@canonry/canonry 7.51.5 → 7.51.6
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/ads-ABAT3K4K.js +544 -0
- package/dist/agent-5G4DRLYX.js +70 -0
- package/dist/agent-ask-UDVCZRO7.js +139 -0
- package/dist/agent-conversations-5E4JP2QZ.js +52 -0
- package/dist/agent-memory-7IIJ4HGZ.js +92 -0
- package/dist/agent-providers-BOXPUXZ4.js +55 -0
- package/dist/agent-transcript-4O56G6PQ.js +77 -0
- package/dist/analytics-PKMWX5XL.js +240 -0
- package/dist/apply-OK4XEBDA.js +175 -0
- package/dist/backfill-2OT56CX2.js +41 -0
- package/dist/backlinks-547WCHND.js +303 -0
- package/dist/bing-ZVBV4ZD5.js +418 -0
- package/dist/bootstrap-HUB7XQ73.js +326 -0
- package/dist/cdp-KQKQ4PWJ.js +162 -0
- package/dist/chunk-2G6IP3MO.js +517 -0
- package/dist/chunk-42D2LE2B.js +1273 -0
- package/dist/chunk-4MJYGB56.js +124 -0
- package/dist/chunk-63ISSSGX.js +9150 -0
- package/dist/{chunk-PLYJX67A.js → chunk-6G6FTDWC.js} +8080 -13939
- package/dist/chunk-6GO5VVAC.js +15 -0
- package/dist/{chunk-4YCGZGA3.js → chunk-73P65KPW.js} +2 -2
- package/dist/chunk-7B2Q4NJE.js +133 -0
- package/dist/{chunk-JBZZEIM2.js → chunk-7WZ2FPB4.js} +2 -13
- package/dist/chunk-AOJU5LKX.js +8 -0
- package/dist/chunk-B2FR2ZQ4.js +420 -0
- package/dist/{chunk-HAHXPJQ5.js → chunk-B5J675KK.js} +16 -1684
- package/dist/{chunk-SFMWHPMX.js → chunk-D6COIM3U.js} +17128 -17143
- package/dist/{chunk-A3WSAAQS.js → chunk-DGVUTH7W.js} +9086 -34522
- package/dist/chunk-ELCLGWUT.js +83 -0
- package/dist/chunk-GO2J7SYT.js +1034 -0
- package/dist/chunk-HACZUMGM.js +145 -0
- package/dist/chunk-HM4NNKLG.js +94 -0
- package/dist/chunk-I3A56PFP.js +58 -0
- package/dist/chunk-I77PLCWG.js +961 -0
- package/dist/chunk-ISOQPVPY.js +232 -0
- package/dist/chunk-KFT5LOP2.js +610 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-MMEO22MF.js +38 -0
- package/dist/chunk-NHQ2U5I4.js +78 -0
- package/dist/chunk-PCXRFT3N.js +530 -0
- package/dist/chunk-PITHTCAX.js +15376 -0
- package/dist/chunk-QWKPSFGL.js +30 -0
- package/dist/chunk-RKIXES2B.js +609 -0
- package/dist/chunk-TSENU4GG.js +18 -0
- package/dist/{chunk-HLVEB5TB.js → chunk-TUTKNUMV.js} +7 -5
- package/dist/chunk-U3AHE2RT.js +1160 -0
- package/dist/chunk-UQ3MOZGC.js +644 -0
- package/dist/{chunk-AZFPA7JV.js → chunk-VBCE4CLX.js} +6 -4
- package/dist/chunk-VJWDBFSL.js +69 -0
- package/dist/chunk-VYMZ3QXG.js +8264 -0
- package/dist/chunk-WAULJDKO.js +2686 -0
- package/dist/chunk-WDFI5YMD.js +204 -0
- package/dist/chunk-XEBKF4N5.js +8 -0
- package/dist/chunk-Z7IUAJOF.js +13 -0
- package/dist/{chunk-KEATAHXH.js → chunk-ZWJRY5UI.js} +358 -581
- package/dist/chunk-ZXUAWVWM.js +15 -0
- package/dist/citations-UYB2RU5U.js +106 -0
- package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-F6FI7NB2.js} +5 -3
- package/dist/cli-commands-ZG5ILKDA.js +19 -0
- package/dist/cli.js +35 -29
- package/dist/competitor-EKP4R7YY.js +561 -0
- package/dist/content-DREE6JF3.js +257 -0
- package/dist/dashboard-ZALEOLLU.js +71 -0
- package/dist/demo-JG4Y22O4.js +75 -0
- package/dist/{demo-server-GIWDJGJX.js → demo-server-3A4J2C65.js} +22 -9
- package/dist/discover-W6GMD2HS.js +372 -0
- package/dist/discover-eval-CKFZHRBW.js +282 -0
- package/dist/doctor-TNGBSUMA.js +152 -0
- package/dist/evidence-3H2GFQBZ.js +57 -0
- package/dist/export-cmd-WUIKU5GK.js +49 -0
- package/dist/ga-JI6REFO4.js +911 -0
- package/dist/gbp-4ENDM5NS.js +370 -0
- package/dist/google-HKQSCLOC.js +946 -0
- package/dist/google-marketing-KQR5J2S4.js +403 -0
- package/dist/health-cmd-TS7EMMCS.js +64 -0
- package/dist/history-MSD5DK6K.js +90 -0
- package/dist/index.d.ts +47 -47
- package/dist/index.js +29 -6
- package/dist/init-L6WAEOWX.js +432 -0
- package/dist/insights-RTZ3IZTD.js +63 -0
- package/dist/intelligence-service-TH52PCNJ.js +15 -0
- package/dist/keys-625DZBRM.js +116 -0
- package/dist/keyword-CW46RNRR.js +164 -0
- package/dist/logs-V33SHBIW.js +30 -0
- package/dist/mcp-DFEDPSEG.js +14 -0
- package/dist/mcp.js +14 -5
- package/dist/measurement-plan-6W37RUOP.js +42 -0
- package/dist/notify-DSUOT7WO.js +125 -0
- package/dist/organic-evidence-BMN6L4OB.js +53 -0
- package/dist/overview-WRRMBZ6S.js +213 -0
- package/dist/project-2GJIU3FE.js +460 -0
- package/dist/query-3XPMGJUA.js +211 -0
- package/dist/research-V433CKJ4.js +200 -0
- package/dist/results-export-RGBU7QQQ.js +27 -0
- package/dist/run-NIAC6OJN.js +31 -0
- package/dist/schedule-KDWXRIE7.js +177 -0
- package/dist/search-626MPUJN.js +42 -0
- package/dist/serve-73SMMASI.js +557 -0
- package/dist/session-7WWOETZB.js +47 -0
- package/dist/settings-VKFQO6F2.js +107 -0
- package/dist/skills-5HC5H7TE.js +33 -0
- package/dist/snapshot-BSJUHFBC.js +538 -0
- package/dist/src-F6HM73TN.js +316 -0
- package/dist/status-V4OWP7LZ.js +126 -0
- package/dist/support-ARF4HER7.js +24 -0
- package/dist/technical-aeo-TG7CGU3F.js +625 -0
- package/dist/telemetry-O2IUNUBW.js +118 -0
- package/dist/tools-2GJIDKND.js +41 -0
- package/dist/traffic-XV4I3UPH.js +1295 -0
- package/dist/users-VGBLDL5K.js +170 -0
- package/dist/visibility-stats-UKJYJ6PP.js +241 -0
- package/dist/wordpress-JZA7CGC6.js +600 -0
- package/package.json +1 -1
- 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,257 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-B5J675KK.js";
|
|
4
|
+
import "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
isMachineFormat,
|
|
12
|
+
usageError
|
|
13
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
14
|
+
import {
|
|
15
|
+
contentTargetDismissRequestSchema,
|
|
16
|
+
formatPercent
|
|
17
|
+
} from "./chunk-D6COIM3U.js";
|
|
18
|
+
import "./chunk-MLKGABMK.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/content.ts
|
|
21
|
+
var WINNABILITY_COVERAGE_CHECK_ID = "content.winnability.coverage";
|
|
22
|
+
async function listContentDismissals(project, opts) {
|
|
23
|
+
const response = await createApiClient().getContentDismissals(project);
|
|
24
|
+
if (opts.format === "jsonl") {
|
|
25
|
+
emitJsonl(response.dismissals.map((row) => ({ project, ...row })));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (isMachineFormat(opts.format)) {
|
|
29
|
+
console.log(JSON.stringify(response, null, 2));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (response.dismissals.length === 0) {
|
|
33
|
+
console.log("No addressed content targets.");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
for (const row of response.dismissals) {
|
|
37
|
+
console.log(`${row.targetRef} \xB7 ${row.dismissedAt}`);
|
|
38
|
+
if (row.addressedUrl) console.log(` Addressed URL: ${row.addressedUrl}`);
|
|
39
|
+
if (row.note) console.log(` Note: ${row.note}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function dismissContentTarget(project, request, opts) {
|
|
43
|
+
const parsed = contentTargetDismissRequestSchema.safeParse(request);
|
|
44
|
+
if (!parsed.success) throw usageError(parsed.error.issues[0]?.message ?? "Invalid content dismissal.");
|
|
45
|
+
const response = await createApiClient().dismissContentTarget(project, parsed.data);
|
|
46
|
+
if (isMachineFormat(opts.format)) {
|
|
47
|
+
console.log(JSON.stringify(response, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
console.log(`Marked ${response.targetRef} addressed. Restore with canonry content restore ${project} ${response.targetRef}.`);
|
|
51
|
+
}
|
|
52
|
+
async function restoreContentTarget(project, targetRef, opts) {
|
|
53
|
+
await createApiClient().restoreContentTarget(project, targetRef);
|
|
54
|
+
if (isMachineFormat(opts.format)) {
|
|
55
|
+
console.log(JSON.stringify({ targetRef, restored: true }, null, 2));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
console.log(`Restored ${targetRef}. It can appear in content targets when still eligible.`);
|
|
59
|
+
}
|
|
60
|
+
async function listContentTargets(project, opts) {
|
|
61
|
+
const client = createApiClient();
|
|
62
|
+
const response = await client.getContentTargets(project, {
|
|
63
|
+
limit: opts.limit,
|
|
64
|
+
includeInProgress: opts.includeInProgress,
|
|
65
|
+
winnabilityClass: opts.winnabilityClass,
|
|
66
|
+
ownable: opts.ownable
|
|
67
|
+
});
|
|
68
|
+
if (opts.format === "json") {
|
|
69
|
+
console.log(JSON.stringify(response, null, 2));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (opts.format === "jsonl") {
|
|
73
|
+
emitJsonl(
|
|
74
|
+
response.targets.map((target) => ({
|
|
75
|
+
project,
|
|
76
|
+
latestRunId: response.contextMetrics.latestRunId,
|
|
77
|
+
...target
|
|
78
|
+
}))
|
|
79
|
+
);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (response.targets.length === 0) {
|
|
83
|
+
console.log("No content targets surfaced. (Run `canonry run` to generate fresh signal.)");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
console.log(
|
|
87
|
+
`${response.targets.length} target${response.targets.length === 1 ? "" : "s"} (latestRunId=${response.contextMetrics.latestRunId})`
|
|
88
|
+
);
|
|
89
|
+
console.log("");
|
|
90
|
+
for (const target of response.targets) {
|
|
91
|
+
const action = target.action.toUpperCase().padEnd(11);
|
|
92
|
+
const score = target.score.toFixed(1).padStart(6);
|
|
93
|
+
const conf = target.actionConfidence.padEnd(6);
|
|
94
|
+
const surface = target.winnabilityClass === "ceded" ? "CEDED " : "ownable";
|
|
95
|
+
console.log(`${action} ${score} conf=${conf} [${surface}] ${target.query}`);
|
|
96
|
+
console.log(` target ref: ${target.targetRef}`);
|
|
97
|
+
if (target.ourBestPage) {
|
|
98
|
+
const posLabel = target.ourBestPage.gscAvgPosition !== null ? `pos #${target.ourBestPage.gscAvgPosition}` : "no GSC ranking";
|
|
99
|
+
console.log(` our page: ${target.ourBestPage.url} (${posLabel})`);
|
|
100
|
+
}
|
|
101
|
+
if (target.winningCompetitor) {
|
|
102
|
+
console.log(` winning: ${target.winningCompetitor.url} (${target.winningCompetitor.citationCount}\xD7 cited)`);
|
|
103
|
+
}
|
|
104
|
+
if (target.drivers.length > 0) {
|
|
105
|
+
console.log(` why: ${target.drivers.join(" \xB7 ")}`);
|
|
106
|
+
}
|
|
107
|
+
if (target.existingAction) {
|
|
108
|
+
console.log(` in-flight action: ${target.existingAction.actionId} (${target.existingAction.state})`);
|
|
109
|
+
}
|
|
110
|
+
console.log("");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function listContentSources(project, opts) {
|
|
114
|
+
const client = createApiClient();
|
|
115
|
+
const response = await client.getContentSources(project);
|
|
116
|
+
if (opts.format === "json") {
|
|
117
|
+
console.log(JSON.stringify(response, null, 2));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (opts.format === "jsonl") {
|
|
121
|
+
emitJsonl(response.sources.map((row) => ({ project, ...row })));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (response.sources.length === 0) {
|
|
125
|
+
console.log("No grounding sources captured yet.");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
for (const row of response.sources) {
|
|
129
|
+
console.log(`Q: ${row.query}`);
|
|
130
|
+
if (row.groundingSources.length === 0) {
|
|
131
|
+
console.log(" (no grounding sources)");
|
|
132
|
+
} else {
|
|
133
|
+
for (const g of row.groundingSources) {
|
|
134
|
+
const tag = g.isOurDomain ? "OURS " : g.isCompetitor ? "COMP " : "OTHER ";
|
|
135
|
+
console.log(` ${tag} ${g.uri} (${g.citationCount}\xD7)`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
console.log("");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function listContentGaps(project, opts) {
|
|
142
|
+
const client = createApiClient();
|
|
143
|
+
const response = await client.getContentGaps(project);
|
|
144
|
+
if (opts.format === "json") {
|
|
145
|
+
console.log(JSON.stringify(response, null, 2));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (opts.format === "jsonl") {
|
|
149
|
+
emitJsonl(response.gaps.map((gap) => ({ project, ...gap })));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (response.gaps.length === 0) {
|
|
153
|
+
console.log("No competitor-only-cited queries detected.");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
console.log(`${response.gaps.length} gap${response.gaps.length === 1 ? "" : "s"} found`);
|
|
157
|
+
console.log("");
|
|
158
|
+
for (const gap of response.gaps) {
|
|
159
|
+
const missPct = formatPercent(gap.missRate);
|
|
160
|
+
console.log(`${missPct.padStart(6)} ${gap.competitorCount} competitor(s) ${gap.query}`);
|
|
161
|
+
console.log(` competitors: ${gap.competitorDomains.join(", ")}`);
|
|
162
|
+
console.log("");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async function generateContentBrief(project, targetRef, opts) {
|
|
166
|
+
const client = createApiClient();
|
|
167
|
+
await warnIfWinnabilityCoverageIsLow(client, project, opts.format);
|
|
168
|
+
const response = await client.synthesizeContentBrief(project, targetRef, {
|
|
169
|
+
provider: opts.provider,
|
|
170
|
+
model: opts.model,
|
|
171
|
+
forceRefresh: opts.force
|
|
172
|
+
});
|
|
173
|
+
if (isMachineFormat(opts.format)) {
|
|
174
|
+
console.log(JSON.stringify(response, null, 2));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const b = response.brief;
|
|
178
|
+
console.log(`Brief for: ${b.targetQuery}`);
|
|
179
|
+
console.log(`Surface: ${b.winnabilityClass}`);
|
|
180
|
+
console.log(`Provider: ${response.provider} / ${response.model}`);
|
|
181
|
+
console.log("");
|
|
182
|
+
console.log(`Angle: ${b.angle}`);
|
|
183
|
+
console.log(`Why winnable: ${b.whyWinnable}`);
|
|
184
|
+
console.log(`Schema hookup: ${b.schemaHookup}`);
|
|
185
|
+
console.log(`Controllable surface: ${b.controllableSurfaceRationale}`);
|
|
186
|
+
}
|
|
187
|
+
async function tryGetBrief(client, project, targetRef) {
|
|
188
|
+
try {
|
|
189
|
+
return await client.getContentBrief(project, targetRef);
|
|
190
|
+
} catch (err) {
|
|
191
|
+
if (err instanceof CliError && err.code === "NOT_FOUND") return null;
|
|
192
|
+
throw err;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async function contentMap(project, opts) {
|
|
196
|
+
const client = createApiClient();
|
|
197
|
+
await warnIfWinnabilityCoverageIsLow(client, project, opts.format);
|
|
198
|
+
const [classifications, targets] = await Promise.all([
|
|
199
|
+
client.getDomainClassifications(project),
|
|
200
|
+
client.getContentTargets(project, { ownable: true })
|
|
201
|
+
]);
|
|
202
|
+
const ownable = await Promise.all(
|
|
203
|
+
targets.targets.map(async (target) => ({
|
|
204
|
+
...target,
|
|
205
|
+
brief: (await tryGetBrief(client, project, target.targetRef))?.brief ?? null
|
|
206
|
+
}))
|
|
207
|
+
);
|
|
208
|
+
if (opts.format === "json") {
|
|
209
|
+
console.log(JSON.stringify({ classifications: classifications.classifications, ownable }, null, 2));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (opts.format === "jsonl") {
|
|
213
|
+
emitJsonl(ownable.map((row) => ({ project, ...row })));
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const ceded = classifications.classifications.filter(
|
|
217
|
+
(c) => c.competitorType === "ota-aggregator" || c.competitorType === "editorial-media"
|
|
218
|
+
);
|
|
219
|
+
console.log(
|
|
220
|
+
`${classifications.classifications.length} domain(s) classified (${ceded.length} ceded surface${ceded.length === 1 ? "" : "s"}) \xB7 ${ownable.length} ownable target(s)`
|
|
221
|
+
);
|
|
222
|
+
console.log("");
|
|
223
|
+
for (const row of ownable) {
|
|
224
|
+
const score = row.score.toFixed(1).padStart(6);
|
|
225
|
+
const briefMark = row.brief ? "brief \u2713" : "brief \u2014";
|
|
226
|
+
console.log(`${score} ${briefMark} ${row.query}`);
|
|
227
|
+
if (row.brief) {
|
|
228
|
+
console.log(` angle: ${row.brief.angle}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function shouldWarn(check) {
|
|
233
|
+
return check?.status === "warn" || check?.status === "fail";
|
|
234
|
+
}
|
|
235
|
+
async function warnIfWinnabilityCoverageIsLow(client, project, format) {
|
|
236
|
+
if (isMachineFormat(format)) return;
|
|
237
|
+
let check;
|
|
238
|
+
try {
|
|
239
|
+
const report = await client.runDoctor({ project, checkIds: [WINNABILITY_COVERAGE_CHECK_ID] });
|
|
240
|
+
check = report.checks.find((candidate) => candidate.id === WINNABILITY_COVERAGE_CHECK_ID);
|
|
241
|
+
} catch {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (!shouldWarn(check)) return;
|
|
245
|
+
const remediation = check.remediation ? ` ${check.remediation}` : "";
|
|
246
|
+
console.error(`Warning: ${check.summary}${remediation}`);
|
|
247
|
+
}
|
|
248
|
+
export {
|
|
249
|
+
contentMap,
|
|
250
|
+
dismissContentTarget,
|
|
251
|
+
generateContentBrief,
|
|
252
|
+
listContentDismissals,
|
|
253
|
+
listContentGaps,
|
|
254
|
+
listContentSources,
|
|
255
|
+
listContentTargets,
|
|
256
|
+
restoreContentTarget
|
|
257
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearDashboardPassword,
|
|
3
|
+
loadConfigRaw
|
|
4
|
+
} from "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import {
|
|
6
|
+
isMachineFormat
|
|
7
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
8
|
+
import {
|
|
9
|
+
anyUsersExist
|
|
10
|
+
} from "./chunk-DGVUTH7W.js";
|
|
11
|
+
import "./chunk-PITHTCAX.js";
|
|
12
|
+
import "./chunk-7B2Q4NJE.js";
|
|
13
|
+
import {
|
|
14
|
+
createClient
|
|
15
|
+
} from "./chunk-63ISSSGX.js";
|
|
16
|
+
import "./chunk-D6COIM3U.js";
|
|
17
|
+
import "./chunk-MLKGABMK.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/dashboard.ts
|
|
20
|
+
import fs from "fs";
|
|
21
|
+
function namedAccountsInUse() {
|
|
22
|
+
const database = loadConfigRaw()?.database;
|
|
23
|
+
if (typeof database !== "string" || !fs.existsSync(database)) return false;
|
|
24
|
+
try {
|
|
25
|
+
const db = createClient(database);
|
|
26
|
+
try {
|
|
27
|
+
return anyUsersExist(db);
|
|
28
|
+
} finally {
|
|
29
|
+
db.$client.close();
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function nextStepsFor(cleared, namedAccounts) {
|
|
36
|
+
if (namedAccounts) {
|
|
37
|
+
return [
|
|
38
|
+
"This install signs in with named accounts, so the shared dashboard password is not used and clearing it does not change who can sign in.",
|
|
39
|
+
'To restore an account, run "canonry user list", then "canonry user delete <name>" and "canonry user create".'
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
if (!cleared) {
|
|
43
|
+
return ["If the dashboard still asks for a password, restart the server: it keeps the password it started with."];
|
|
44
|
+
}
|
|
45
|
+
return [
|
|
46
|
+
"Restart the server to apply the reset. Until then it still accepts the old password.",
|
|
47
|
+
// First-run setup on a loopback bind takes the password from any process
|
|
48
|
+
// that can open a loopback connection (docs/deployment.md).
|
|
49
|
+
"Then open the dashboard and create the new password right away. Until one is set, a server that listens only on this machine accepts it from any local connection, so stop any port forwarder (ssh -R, ngrok tcp, tailscale serve --tcp) first."
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
async function resetDashboardPassword(opts) {
|
|
53
|
+
const { cleared, configPath } = clearDashboardPassword();
|
|
54
|
+
const namedAccounts = namedAccountsInUse();
|
|
55
|
+
const nextSteps = nextStepsFor(cleared, namedAccounts);
|
|
56
|
+
if (isMachineFormat(opts.format)) {
|
|
57
|
+
console.log(JSON.stringify({
|
|
58
|
+
reset: cleared,
|
|
59
|
+
configPath,
|
|
60
|
+
restartRequired: cleared && !namedAccounts,
|
|
61
|
+
namedAccounts,
|
|
62
|
+
nextSteps
|
|
63
|
+
}, null, 2));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
console.log(cleared ? `Dashboard password cleared from ${configPath}.` : `No dashboard password is set in ${configPath}; nothing to reset.`);
|
|
67
|
+
for (const step of nextSteps) console.log(step);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
resetDashboardPassword
|
|
71
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_DEMO_TRUSTED_PROXIES,
|
|
3
|
+
trustedProxiesProblem,
|
|
4
|
+
trustedProxyProblem
|
|
5
|
+
} from "./chunk-RB2F4D3Z.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError,
|
|
8
|
+
isMachineFormat
|
|
9
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
10
|
+
import "./chunk-MLKGABMK.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/demo.ts
|
|
13
|
+
function parseDemoListenOptions(options) {
|
|
14
|
+
const rawPort = options.port ?? "4188";
|
|
15
|
+
const port = Number(rawPort);
|
|
16
|
+
if (!/^\d+$/.test(rawPort) || !Number.isSafeInteger(port) || port < 1 || port > 65535) {
|
|
17
|
+
throw new CliError({ code: "INVALID_PORT", message: "Demo port must be an integer between 1 and 65535.", exitCode: 1 });
|
|
18
|
+
}
|
|
19
|
+
const host = options.host ?? "127.0.0.1";
|
|
20
|
+
if (!host.trim() || /[\s/]/.test(host)) {
|
|
21
|
+
throw new CliError({ code: "INVALID_HOST", message: "Demo host must be an IP address or hostname.", exitCode: 1 });
|
|
22
|
+
}
|
|
23
|
+
return { host, port };
|
|
24
|
+
}
|
|
25
|
+
function parseDemoTrustedProxies(values) {
|
|
26
|
+
if (!values?.length) return [...DEFAULT_DEMO_TRUSTED_PROXIES];
|
|
27
|
+
for (const value of values) {
|
|
28
|
+
const problem = trustedProxyProblem(value);
|
|
29
|
+
if (problem) {
|
|
30
|
+
throw new CliError({ code: "INVALID_TRUST_PROXY", message: `--trust-proxy ${JSON.stringify(value)} ${problem}.`, details: { value }, exitCode: 1 });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const combined = trustedProxiesProblem(values);
|
|
34
|
+
if (combined) {
|
|
35
|
+
const named = values.map((value) => JSON.stringify(value)).join(", ");
|
|
36
|
+
throw new CliError({ code: "INVALID_TRUST_PROXY", message: `--trust-proxy values ${named} together ${combined}.`, details: { values: [...values] }, exitCode: 1 });
|
|
37
|
+
}
|
|
38
|
+
return [...values];
|
|
39
|
+
}
|
|
40
|
+
async function demoCommand(options) {
|
|
41
|
+
const { host, port } = parseDemoListenOptions(options);
|
|
42
|
+
const trustProxy = parseDemoTrustedProxies(options.trustProxy);
|
|
43
|
+
const { createDemoServer } = await import("./demo-server-3A4J2C65.js");
|
|
44
|
+
const app = await createDemoServer({ trustProxy });
|
|
45
|
+
let stopping = false;
|
|
46
|
+
const stop = () => {
|
|
47
|
+
if (stopping) return;
|
|
48
|
+
stopping = true;
|
|
49
|
+
void app.close().catch(() => {
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
process.once("SIGINT", stop);
|
|
54
|
+
process.once("SIGTERM", stop);
|
|
55
|
+
app.addHook("onClose", async () => {
|
|
56
|
+
process.removeListener("SIGINT", stop);
|
|
57
|
+
process.removeListener("SIGTERM", stop);
|
|
58
|
+
});
|
|
59
|
+
try {
|
|
60
|
+
await app.listen({ host, port });
|
|
61
|
+
} catch (error) {
|
|
62
|
+
await app.close();
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
const url = `http://${host.includes(":") ? `[${host}]` : host}:${port}`;
|
|
66
|
+
const result = { status: "ready", mode: "view-only", sampleData: true, url };
|
|
67
|
+
if (isMachineFormat(options.format ?? "text")) console.log(JSON.stringify(result));
|
|
68
|
+
else console.log(`Canonry view-only demo: ${url}
|
|
69
|
+
Fictional sample data. No provider calls or background runs. Ctrl+C to stop.`);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
demoCommand,
|
|
73
|
+
parseDemoListenOptions,
|
|
74
|
+
parseDemoTrustedProxies
|
|
75
|
+
};
|
|
@@ -5,15 +5,30 @@ import {
|
|
|
5
5
|
computeFactorAverages,
|
|
6
6
|
layoutSiteCrawlGraphInput,
|
|
7
7
|
persistSiteCrawlGraphLayout
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-73P65KPW.js";
|
|
9
9
|
import {
|
|
10
|
-
PACKAGE_VERSION,
|
|
11
10
|
canonryMcpTools
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZWJRY5UI.js";
|
|
12
|
+
import "./chunk-HM4NNKLG.js";
|
|
13
|
+
import "./chunk-HACZUMGM.js";
|
|
14
|
+
import {
|
|
15
|
+
PACKAGE_VERSION
|
|
16
|
+
} from "./chunk-AOJU5LKX.js";
|
|
13
17
|
import "./chunk-HGMYEDAQ.js";
|
|
14
18
|
import {
|
|
15
19
|
HISTORY_WINDOW_RUNS,
|
|
16
|
-
IntelligenceService
|
|
20
|
+
IntelligenceService
|
|
21
|
+
} from "./chunk-GO2J7SYT.js";
|
|
22
|
+
import {
|
|
23
|
+
determineCitationState
|
|
24
|
+
} from "./chunk-MMEO22MF.js";
|
|
25
|
+
import {
|
|
26
|
+
apiRoutes,
|
|
27
|
+
assessConversionTrackingIntegrity
|
|
28
|
+
} from "./chunk-DGVUTH7W.js";
|
|
29
|
+
import "./chunk-PITHTCAX.js";
|
|
30
|
+
import "./chunk-7B2Q4NJE.js";
|
|
31
|
+
import {
|
|
17
32
|
adsAdGroups,
|
|
18
33
|
adsAds,
|
|
19
34
|
adsCampaigns,
|
|
@@ -22,8 +37,6 @@ import {
|
|
|
22
37
|
aiReferralEventsHourly,
|
|
23
38
|
aiUserFetchEventsHourly,
|
|
24
39
|
apiKeys,
|
|
25
|
-
apiRoutes,
|
|
26
|
-
assessConversionTrackingIntegrity,
|
|
27
40
|
auditLog,
|
|
28
41
|
backlinkDomains,
|
|
29
42
|
backlinkSummaries,
|
|
@@ -35,7 +48,6 @@ import {
|
|
|
35
48
|
conversionTrackingContracts,
|
|
36
49
|
crawlerEventsHourly,
|
|
37
50
|
createClient,
|
|
38
|
-
determineCitationState,
|
|
39
51
|
discoveryProbes,
|
|
40
52
|
discoverySessions,
|
|
41
53
|
gaAcquisitionDaily,
|
|
@@ -87,7 +99,7 @@ import {
|
|
|
87
99
|
siteCrawlPages,
|
|
88
100
|
siteCrawlSnapshots,
|
|
89
101
|
trafficSources
|
|
90
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-63ISSSGX.js";
|
|
91
103
|
import {
|
|
92
104
|
AI_ENGINE_DOMAINS,
|
|
93
105
|
RunKinds,
|
|
@@ -119,7 +131,8 @@ import {
|
|
|
119
131
|
roundPreservingTotal,
|
|
120
132
|
siteAuditPageFactorSchema,
|
|
121
133
|
wilsonInterval
|
|
122
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-D6COIM3U.js";
|
|
135
|
+
import "./chunk-MLKGABMK.js";
|
|
123
136
|
|
|
124
137
|
// src/demo-server.ts
|
|
125
138
|
import { dirname, join as join2 } from "path";
|