search-visibility 1.2.1 → 1.3.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/CHANGELOG.md +38 -0
- package/README.es.md +36 -1
- package/README.ja.md +36 -1
- package/README.ko.md +42 -6
- package/README.md +42 -6
- package/README.zh.md +36 -1
- package/package.json +2 -1
- package/skills/seo-orchestrator/scripts/ai-performance.mjs +107 -0
- package/skills/seo-orchestrator/scripts/canonical.mjs +175 -0
- package/skills/seo-orchestrator/scripts/command.mjs +6 -0
- package/skills/seo-orchestrator/scripts/comparison-pairs.mjs +89 -0
- package/skills/seo-orchestrator/scripts/crawl-report.mjs +34 -0
- package/skills/seo-orchestrator/scripts/fetch-page.mjs +2 -5
- package/skills/seo-orchestrator/scripts/hreflang.mjs +273 -0
- package/skills/seo-orchestrator/scripts/html.mjs +7 -80
- package/skills/seo-orchestrator/scripts/index-status.mjs +181 -0
- package/skills/seo-orchestrator/scripts/indexing.mjs +28 -39
- package/skills/seo-orchestrator/scripts/internal-crawl.mjs +16 -46
- package/skills/seo-orchestrator/scripts/link-header.mjs +93 -0
- package/skills/seo-orchestrator/scripts/mcp.mjs +45 -8
- package/skills/seo-orchestrator/scripts/naver-advisor.mjs +147 -0
- package/skills/seo-orchestrator/scripts/observations.mjs +42 -8
- package/skills/seo-orchestrator/scripts/report-html.mjs +35 -0
- package/skills/seo-orchestrator/scripts/report-input.mjs +142 -0
- package/skills/seo-orchestrator/scripts/report-sources.mjs +202 -0
- package/skills/seo-orchestrator/scripts/robots.mjs +270 -0
- package/skills/seo-orchestrator/scripts/scope.mjs +185 -0
- package/skills/seo-orchestrator/scripts/search-performance.mjs +1 -1
- package/skills/seo-orchestrator/scripts/seo-check.mjs +199 -269
- package/skills/seo-orchestrator/scripts/site-audit.mjs +102 -46
- package/skills/seo-orchestrator/scripts/structured-data.mjs +316 -0
- package/skills/seo-orchestrator/scripts/url-inspection.mjs +150 -0
- package/skills/seo-orchestrator/scripts/visibility-comparison.mjs +218 -39
- package/skills/seo-orchestrator/scripts/visibility-report.mjs +71 -48
- package/skills/seo-orchestrator/scripts/visibility.mjs +53 -50
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// 실적 자료의 조회 조건(속성·기간·필터·출처)을 한 가지 방식으로 읽고, 표시하고, 비교한다.
|
|
2
|
+
import { t } from "./locale.mjs";
|
|
3
|
+
|
|
4
|
+
const TEXT_FIELDS = ["property", "reportType", "searchType", "aggregation", "timeZone", "recordedAt"];
|
|
5
|
+
export const SCOPE_KEYS = [...TEXT_FIELDS, "filters", "period"];
|
|
6
|
+
|
|
7
|
+
export function requireObject(value, field) {
|
|
8
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(t(`${field}에는 객체를 입력하세요.`, `${field} must be an object.`));
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function rejectUnknownKeys(value, keys, field) {
|
|
13
|
+
for (const key of Object.keys(value)) {
|
|
14
|
+
if (!keys.includes(key)) throw new Error(t(`알 수 없는 설정: ${field}.${key}`, `Unknown setting: ${field}.${key}`));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function optionalText(value, field) {
|
|
19
|
+
if (value === undefined || value === null) return null;
|
|
20
|
+
if (typeof value !== "string" || !value.trim()) throw new Error(t(`${field}에는 문자열을 입력하세요.`, `${field} must be a nonempty string.`));
|
|
21
|
+
return value.trim();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function calendarDate(value, field) {
|
|
25
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
26
|
+
const time = Date.parse(`${text}T00:00:00Z`);
|
|
27
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(text) || !Number.isFinite(time) || new Date(time).toISOString().slice(0, 10) !== text) {
|
|
28
|
+
throw new Error(t(`${field}에는 실제 날짜(YYYY-MM-DD)를 입력하세요.`, `${field} must be a real date (YYYY-MM-DD).`));
|
|
29
|
+
}
|
|
30
|
+
return text;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function parsePeriod(value, field) {
|
|
34
|
+
if (value === undefined || value === null) return null;
|
|
35
|
+
requireObject(value, field);
|
|
36
|
+
rejectUnknownKeys(value, ["start", "end", "complete"], field);
|
|
37
|
+
const start = calendarDate(value.start, `${field}.start`);
|
|
38
|
+
const end = calendarDate(value.end, `${field}.end`);
|
|
39
|
+
if (end < start) throw new Error(t(`${field}.end가 start보다 앞섭니다.`, `${field}.end is before start.`));
|
|
40
|
+
if (value.complete !== undefined && typeof value.complete !== "boolean") throw new Error(t(`${field}.complete는 true 또는 false여야 합니다.`, `${field}.complete must be true or false.`));
|
|
41
|
+
// 시작일과 종료일을 모두 포함한 일수.
|
|
42
|
+
const days = Math.round((Date.parse(`${end}T00:00:00Z`) - Date.parse(`${start}T00:00:00Z`)) / 86_400_000) + 1;
|
|
43
|
+
return { start, end, days, complete: value.complete ?? null };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// filters: {}는 "필터 없음(전체)", 생략은 "필터 정보 미기록"이다.
|
|
47
|
+
export function parseFilters(value, field) {
|
|
48
|
+
if (value === undefined || value === null) return null;
|
|
49
|
+
requireObject(value, field);
|
|
50
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
51
|
+
const text = optionalText(entry, `${field}.${key}`);
|
|
52
|
+
if (text === null) throw new Error(t(`${field}.${key}에는 문자열을 입력하세요.`, `${field}.${key} must be a nonempty string.`));
|
|
53
|
+
return [key.trim().toLowerCase(), text];
|
|
54
|
+
// 국가·기기의 "전체"만 필터 없음으로 본다. 검색어·페이지 필터의 "all"은 실제 값이다.
|
|
55
|
+
}).filter(([key, text]) => !(["country", "device"].includes(key) && ["all", "전체"].includes(text.toLowerCase())))
|
|
56
|
+
.sort(([a], [b]) => a.localeCompare(b)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function parseScope(value, field) {
|
|
60
|
+
requireObject(value, field);
|
|
61
|
+
rejectUnknownKeys(value, SCOPE_KEYS, field);
|
|
62
|
+
return {
|
|
63
|
+
...Object.fromEntries(TEXT_FIELDS.map((key) => [key, optionalText(value[key], `${field}.${key}`)])),
|
|
64
|
+
filters: parseFilters(value.filters, `${field}.filters`),
|
|
65
|
+
period: parsePeriod(value.period, `${field}.period`),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 국가 코드처럼 대소문자만 다른 값은 같게 본다. URL·검색어 필터는 원문을 비교한다.
|
|
70
|
+
export function comparableValue(field, value) {
|
|
71
|
+
if (field === "filters") {
|
|
72
|
+
return JSON.stringify(Object.entries(value).map(([key, text]) => [key, ["country", "device"].includes(key) ? text.toLowerCase() : text]).sort(([a], [b]) => a.localeCompare(b)));
|
|
73
|
+
}
|
|
74
|
+
return field === "property" ? String(value) : String(value).toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function comparisonStatus(reasons) {
|
|
78
|
+
if (reasons.some((reason) => !reason.code.startsWith("missing"))) return "different";
|
|
79
|
+
return reasons.length ? "unverified" : "comparable";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// fields는 양쪽에서 확인돼야 하는 조건이다. period는 같은 길이의 완료된 기간이어야 한다.
|
|
83
|
+
export function compareScopes(before, after, fields) {
|
|
84
|
+
const reasons = [];
|
|
85
|
+
for (const field of fields) {
|
|
86
|
+
const a = before?.[field] ?? null;
|
|
87
|
+
const b = after?.[field] ?? null;
|
|
88
|
+
if (a === null || b === null) reasons.push({ code: "missing", field, before: a, after: b });
|
|
89
|
+
else if (comparableValue(field, a) !== comparableValue(field, b)) reasons.push({ code: "different", field, before: a, after: b });
|
|
90
|
+
}
|
|
91
|
+
const a = before?.period ?? null;
|
|
92
|
+
const b = after?.period ?? null;
|
|
93
|
+
if (!a || !b) reasons.push({ code: "missing", field: "period", before: a, after: b });
|
|
94
|
+
else {
|
|
95
|
+
if (a.days !== b.days) reasons.push({ code: "period-length", field: "period", before: a.days, after: b.days });
|
|
96
|
+
// 같은 기간이나 겹치는 기간은 전후 비교가 아니다.
|
|
97
|
+
if (a.start === b.start && a.end === b.end) reasons.push({ code: "same-period", field: "period" });
|
|
98
|
+
else if (a.start <= b.end && b.start <= a.end) reasons.push({ code: "period-overlap", field: "period" });
|
|
99
|
+
for (const [side, period] of [["before", a], ["after", b]]) {
|
|
100
|
+
if (period.complete === false) reasons.push({ code: "period-incomplete", field: "period.complete", side });
|
|
101
|
+
else if (period.complete !== true) reasons.push({ code: "missing", field: "period.complete", side });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return { status: comparisonStatus(reasons), reasons };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 날짜 차원 표에서 선언한 조회 기간을 벗어난 행의 수. YYYY-MM-DD 라벨만 확인한다.
|
|
108
|
+
export function rowsOutsidePeriod(performance) {
|
|
109
|
+
const period = performance?.scope?.period;
|
|
110
|
+
if (!period || performance.dimension !== "date" || !Array.isArray(performance.rows)) return 0;
|
|
111
|
+
return performance.rows.filter((row) => /^\d{4}-\d{2}-\d{2}$/.test(row?.label) && (row.label < period.start || row.label > period.end)).length;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function fieldLabel(field) {
|
|
115
|
+
return {
|
|
116
|
+
property: t("속성", "Property"), reportType: t("보고서 종류", "Report type"), dimension: t("차원", "Dimension"),
|
|
117
|
+
searchType: t("검색 유형", "Search type"), aggregation: t("집계 단위", "Aggregation"), timeZone: t("시간대", "Time zone"),
|
|
118
|
+
filters: t("필터", "Filters"), period: t("조회 기간", "Period"), "period.complete": t("기간 완료 여부", "Period completeness"),
|
|
119
|
+
recordedAt: t("기록일", "Recorded at"), updatedAt: t("업데이트 기준일", "Updated as of"), report: t("보고서 이름", "Report name"),
|
|
120
|
+
device: t("기기", "Device"),
|
|
121
|
+
}[field] ?? field;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function statusLabel(status) {
|
|
125
|
+
return {
|
|
126
|
+
comparable: t("비교 가능", "Comparable"), different: t("조건 다름", "Conditions differ"), unverified: t("조건 미확인", "Conditions unverified"),
|
|
127
|
+
}[status];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function filtersText(filters) {
|
|
131
|
+
if (filters === null || filters === undefined) return t("미기록", "Not recorded");
|
|
132
|
+
const entries = Object.entries(filters);
|
|
133
|
+
return entries.length ? entries.map(([key, value]) => `${key} = ${value}`).join(", ") : t("없음(전체)", "None (all)");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function periodText(period) {
|
|
137
|
+
if (!period) return t("미기록", "Not recorded");
|
|
138
|
+
const complete = period.complete === true ? t("완료", "complete") : period.complete === false ? t("미완료", "incomplete") : t("완료 여부 미기록", "completeness not recorded");
|
|
139
|
+
return `${period.start} – ${period.end} (${t(`${period.days}일`, `${period.days} days`)}, ${complete})`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function valueText(field, value) {
|
|
143
|
+
if (field === "filters") return filtersText(value);
|
|
144
|
+
if (field === "period" && value && typeof value === "object") return periodText(value);
|
|
145
|
+
return value === null || value === undefined ? t("미기록", "Not recorded") : String(value);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function describeReason(reason) {
|
|
149
|
+
const { code, field, before, after, side, count, fields } = reason;
|
|
150
|
+
const label = field ? fieldLabel(field) : "";
|
|
151
|
+
const sideName = (value) => (value === "before" ? t("변경 전", "before") : t("변경 후", "after"));
|
|
152
|
+
switch (code) {
|
|
153
|
+
case "different": return t(`${label} 다름: ${valueText(field, before)} → ${valueText(field, after)}`, `${label} differs: ${valueText(field, before)} → ${valueText(field, after)}`);
|
|
154
|
+
case "missing": {
|
|
155
|
+
const sides = side ? sideName(side) : [before ?? null, after ?? null].map((value, index) => (value === null ? sideName(index ? "after" : "before") : null)).filter(Boolean).join(", ");
|
|
156
|
+
return t(`${label} 미기록 (${sides})`, `${label} not recorded (${sides})`);
|
|
157
|
+
}
|
|
158
|
+
case "period-length": return t(`기간 길이 다름: ${before}일 → ${after}일`, `Period length differs: ${before} days → ${after} days`);
|
|
159
|
+
case "period-incomplete": return t(`완료되지 않은 기간 (${sideName(side)})`, `Incomplete period (${sideName(side)})`);
|
|
160
|
+
case "missing-data": return t(`실적 자료 없음 (${sideName(side)})`, `No performance data (${sideName(side)})`);
|
|
161
|
+
case "same-period": return t("조회 기간이 같아 두 기간의 비교가 아님", "Both sides cover the same period, so this is not a comparison of two periods");
|
|
162
|
+
case "period-overlap": return t("두 조회 기간이 겹침", "The two periods overlap");
|
|
163
|
+
case "date-outside-period": return t(`선언한 조회 기간 밖의 날짜 ${count}행 (${sideName(side)})`, `${count} date rows fall outside the declared period (${sideName(side)})`);
|
|
164
|
+
case "missing-previous": return t("비교할 이전 수집 기록 없음", "No earlier crawl record to compare");
|
|
165
|
+
case "missing-answers": return t(`답변이 없거나 수집에 실패해 비교할 쌍 없음 (${sideName(side)})`, `No pairs because there are no answers or collection failed (${sideName(side)})`);
|
|
166
|
+
case "targets-differ": return t("점검 대상 URL이 다름", "Audited page targets differ");
|
|
167
|
+
case "incomplete-audit": return t(`수집 오류·잘림이 있거나 점검한 페이지가 없음 (${sideName(side)})`, `Errors, truncation or no audited pages (${sideName(side)})`);
|
|
168
|
+
case "ruleset-differs": return t("점검 규칙 버전이 달라 지적 건수를 비교할 수 없음", "Audit rule versions differ, so finding counts are not comparable");
|
|
169
|
+
case "robots-unread": return t(`robots.txt를 읽지 못한 페이지 ${count}개 (${sideName(side)})`, `${count} pages with unread robots.txt (${sideName(side)})`);
|
|
170
|
+
case "page-unavailable": return t(`HTTP 429·5xx를 반환한 페이지 ${count}개 (${sideName(side)})`, `${count} pages returning HTTP 429 or 5xx (${sideName(side)})`);
|
|
171
|
+
case "intent-differs": return t(`색인 목표 설정이 다른 페이지 ${count}개`, `${count} pages with a different indexing intent`);
|
|
172
|
+
case "missing-records": return t(`답변별 레코드가 없어 조건 확인 불가 (${sideName(side)})`, `Per-answer records are absent, so conditions cannot be checked (${sideName(side)})`);
|
|
173
|
+
case "missing-definition": return t(`브랜드·소유 출처 설정 기록 없음 (${sideName(side)})`, `Brand and ownership settings not recorded (${sideName(side)})`);
|
|
174
|
+
case "definition-changed": {
|
|
175
|
+
const name = { brand: t("브랜드", "Brand"), terms: t("브랜드 별칭", "Brand aliases"), hosts: t("소유 도메인", "Owned domains"), prefixes: t("소유 URL 경로", "Owned URL prefixes") }[field];
|
|
176
|
+
return t(`${name} 설정 다름`, `${name} settings differ`);
|
|
177
|
+
}
|
|
178
|
+
case "no-common-pairs": return t("조건이 같은 공통 관측 쌍 없음", "No observation pairs with matching conditions");
|
|
179
|
+
case "missing-conditions": return t(`수집 조건 미기록 ${count}건 (${fields.join(", ")})`, `${count} records lack collection conditions (${fields.join(", ")})`);
|
|
180
|
+
case "duplicate-runs": return t(`같은 조건·회차가 중복돼 짝짓지 않은 레코드 ${count}건`, `${count} records share conditions and run number, so they were not paired`);
|
|
181
|
+
case "model-differs": return t(`모델이 달라 제외한 쌍 ${count}개`, `${count} pairs excluded because the model differs`);
|
|
182
|
+
case "missing-model": return t(`한쪽에만 모델이 기록돼 제외한 쌍 ${count}개`, `${count} pairs excluded because only one side records a model`);
|
|
183
|
+
default: return code;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t, currentLocale } from "./locale.mjs";
|
|
2
|
-
const HEADER_NAMES = new Map(Object.entries({
|
|
2
|
+
export const HEADER_NAMES = new Map(Object.entries({
|
|
3
3
|
page: ["page", "pages", "top pages", "페이지", "인기 페이지", "상위 페이지", "ページ", "上位のページ", "上位ページ", "seiten", "top-seiten", "beliebteste seiten", "häufigste seiten", "die häufigsten seiten", "pages les plus populaires", "meilleures pages", "página", "páginas", "páginas principales", "páginas con mejor rendimiento"],
|
|
4
4
|
query: ["query", "queries", "top queries", "검색어", "인기 검색어", "상위 검색어", "クエリ", "上位のクエリ", "上位クエリ", "検索キーワード", "suchanfragen", "top-suchanfragen", "beliebteste suchanfragen", "häufigste suchanfragen", "die häufigsten suchanfragen", "requêtes", "requêtes les plus fréquentes", "meilleures requêtes", "consulta", "consultas", "consultas principales", "consultas con mejor rendimiento"],
|
|
5
5
|
date: ["date", "dates", "날짜", "日付", "datum", "fecha", "fechas"],
|