geopilot 0.0.0-stage → 0.0.1-bootstrap.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/LICENSE +202 -0
- package/README.md +72 -2
- package/dist/agent/install.d.ts +23 -0
- package/dist/agent/install.js +75 -0
- package/dist/agent/install.js.map +1 -0
- package/dist/cache/runs.d.ts +18 -0
- package/dist/cache/runs.js +91 -0
- package/dist/cache/runs.js.map +1 -0
- package/dist/cli/args.d.ts +20 -0
- package/dist/cli/args.js +116 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +2 -0
- package/dist/cli/commands/agent.js +48 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/fix.d.ts +2 -0
- package/dist/cli/commands/fix.js +284 -0
- package/dist/cli/commands/fix.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +62 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/insights.d.ts +17 -0
- package/dist/cli/commands/insights.js +143 -0
- package/dist/cli/commands/insights.js.map +1 -0
- package/dist/cli/commands/rules.d.ts +5 -0
- package/dist/cli/commands/rules.js +86 -0
- package/dist/cli/commands/rules.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +14 -0
- package/dist/cli/commands/scan.js +127 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands-list.d.ts +6 -0
- package/dist/cli/commands-list.js +15 -0
- package/dist/cli/commands-list.js.map +1 -0
- package/dist/cli/context.d.ts +26 -0
- package/dist/cli/context.js +108 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/io.d.ts +16 -0
- package/dist/cli/io.js +28 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/main.d.ts +15 -0
- package/dist/cli/main.js +118 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/collect/crawl.d.ts +51 -0
- package/dist/collect/crawl.js +187 -0
- package/dist/collect/crawl.js.map +1 -0
- package/dist/config/config.d.ts +86 -0
- package/dist/config/config.js +396 -0
- package/dist/config/config.js.map +1 -0
- package/dist/core/errors.d.ts +20 -0
- package/dist/core/errors.js +32 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/hash.d.ts +7 -0
- package/dist/core/hash.js +28 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/redact.d.ts +3 -0
- package/dist/core/redact.js +23 -0
- package/dist/core/redact.js.map +1 -0
- package/dist/core/tty.d.ts +12 -0
- package/dist/core/tty.js +33 -0
- package/dist/core/tty.js.map +1 -0
- package/dist/core/version.d.ts +6 -0
- package/dist/core/version.js +10 -0
- package/dist/core/version.js.map +1 -0
- package/dist/fix/apply.d.ts +119 -0
- package/dist/fix/apply.js +334 -0
- package/dist/fix/apply.js.map +1 -0
- package/dist/fix/diff.d.ts +1 -0
- package/dist/fix/diff.js +35 -0
- package/dist/fix/diff.js.map +1 -0
- package/dist/fix/plan.d.ts +42 -0
- package/dist/fix/plan.js +385 -0
- package/dist/fix/plan.js.map +1 -0
- package/dist/fix/serve.d.ts +13 -0
- package/dist/fix/serve.js +112 -0
- package/dist/fix/serve.js.map +1 -0
- package/dist/fix/variants.d.ts +13 -0
- package/dist/fix/variants.js +8 -0
- package/dist/fix/variants.js.map +1 -0
- package/dist/frameworks/ast.d.ts +84 -0
- package/dist/frameworks/ast.js +231 -0
- package/dist/frameworks/ast.js.map +1 -0
- package/dist/frameworks/nextjs-app/analyze.d.ts +92 -0
- package/dist/frameworks/nextjs-app/analyze.js +350 -0
- package/dist/frameworks/nextjs-app/analyze.js.map +1 -0
- package/dist/frameworks/static/analyze.d.ts +18 -0
- package/dist/frameworks/static/analyze.js +66 -0
- package/dist/frameworks/static/analyze.js.map +1 -0
- package/dist/html/parse.d.ts +50 -0
- package/dist/html/parse.js +205 -0
- package/dist/html/parse.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/validate.d.ts +74 -0
- package/dist/insights/validate.js +213 -0
- package/dist/insights/validate.js.map +1 -0
- package/dist/net/address.d.ts +10 -0
- package/dist/net/address.js +116 -0
- package/dist/net/address.js.map +1 -0
- package/dist/net/fetch.d.ts +53 -0
- package/dist/net/fetch.js +281 -0
- package/dist/net/fetch.js.map +1 -0
- package/dist/repo/detect.d.ts +3 -0
- package/dist/repo/detect.js +92 -0
- package/dist/repo/detect.js.map +1 -0
- package/dist/repo/reader.d.ts +12 -0
- package/dist/repo/reader.js +97 -0
- package/dist/repo/reader.js.map +1 -0
- package/dist/report/render.d.ts +20 -0
- package/dist/report/render.js +176 -0
- package/dist/report/render.js.map +1 -0
- package/dist/robots/crawlers.d.ts +10 -0
- package/dist/robots/crawlers.js +20 -0
- package/dist/robots/crawlers.js.map +1 -0
- package/dist/robots/robots.d.ts +33 -0
- package/dist/robots/robots.js +133 -0
- package/dist/robots/robots.js.map +1 -0
- package/dist/rules/catalogue.d.ts +43 -0
- package/dist/rules/catalogue.js +361 -0
- package/dist/rules/catalogue.js.map +1 -0
- package/dist/rules/context.d.ts +36 -0
- package/dist/rules/context.js +129 -0
- package/dist/rules/context.js.map +1 -0
- package/dist/rules/evaluate.d.ts +11 -0
- package/dist/rules/evaluate.js +1070 -0
- package/dist/rules/evaluate.js.map +1 -0
- package/dist/rules/finalize.d.ts +34 -0
- package/dist/rules/finalize.js +93 -0
- package/dist/rules/finalize.js.map +1 -0
- package/dist/scan.d.ts +27 -0
- package/dist/scan.js +147 -0
- package/dist/scan.js.map +1 -0
- package/dist/scoring/compare.d.ts +21 -0
- package/dist/scoring/compare.js +47 -0
- package/dist/scoring/compare.js.map +1 -0
- package/dist/scoring/score.d.ts +21 -0
- package/dist/scoring/score.js +112 -0
- package/dist/scoring/score.js.map +1 -0
- package/dist/sitemap/sitemap.d.ts +10 -0
- package/dist/sitemap/sitemap.js +48 -0
- package/dist/sitemap/sitemap.js.map +1 -0
- package/dist/types.d.ts +155 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/hosts/claude-project/.claude/agents/geopilot-explainer.md +36 -0
- package/hosts/claude-project/.claude/agents/geopilot-fixer.md +42 -0
- package/hosts/claude-project/.claude/agents/geopilot-investigator.md +45 -0
- package/hosts/claude-project/.claude/agents/geopilot-reviewer.md +41 -0
- package/hosts/claude-project/.claude/agents/geopilot-scanner.md +47 -0
- package/hosts/claude-project/.claude/skills/geo/SKILL.md +95 -0
- package/hosts/claude-project/.claude/skills/geo/references/frameworks.md +20 -0
- package/hosts/claude-project/.claude/skills/geo/references/insight-contract.md +42 -0
- package/hosts/claude-project/.claude/skills/geo/references/safety.md +30 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-init.md +6 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-review.md +8 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/claude-project/.claude/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/claude-project/.claude/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/claude-project/.claude/skills/geo/scripts/geo.sh +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-explain/SKILL.md +9 -0
- package/hosts/claude-project/.claude/skills/geopilot-fix/SKILL.md +12 -0
- package/hosts/claude-project/.claude/skills/geopilot-init/SKILL.md +15 -0
- package/hosts/claude-project/.claude/skills/geopilot-insights/SKILL.md +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-review/SKILL.md +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-scan/SKILL.md +11 -0
- package/hosts/geopilot/.claude-plugin/plugin.json +22 -0
- package/hosts/geopilot/README.md +25 -0
- package/hosts/geopilot/agents/explainer.agent.md +36 -0
- package/hosts/geopilot/agents/fixer.agent.md +42 -0
- package/hosts/geopilot/agents/investigator.agent.md +45 -0
- package/hosts/geopilot/agents/reviewer.agent.md +41 -0
- package/hosts/geopilot/agents/scanner.agent.md +47 -0
- package/hosts/geopilot/assets/icon.png +0 -0
- package/hosts/geopilot/skills/explain/SKILL.md +9 -0
- package/hosts/geopilot/skills/fix/SKILL.md +12 -0
- package/hosts/geopilot/skills/geo/SKILL.md +95 -0
- package/hosts/geopilot/skills/geo/references/frameworks.md +20 -0
- package/hosts/geopilot/skills/geo/references/insight-contract.md +42 -0
- package/hosts/geopilot/skills/geo/references/safety.md +30 -0
- package/hosts/geopilot/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/geopilot/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/geopilot/skills/geo/references/workflow-init.md +6 -0
- package/hosts/geopilot/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/geopilot/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/geopilot/skills/geo/references/workflow-review.md +8 -0
- package/hosts/geopilot/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/geopilot/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/geopilot/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/geopilot/skills/geo/scripts/geo.sh +11 -0
- package/hosts/geopilot/skills/init/SKILL.md +15 -0
- package/hosts/geopilot/skills/insights/SKILL.md +11 -0
- package/hosts/geopilot/skills/review/SKILL.md +11 -0
- package/hosts/geopilot/skills/scan/SKILL.md +11 -0
- package/hosts/opencode/.opencode/agents/geopilot-explainer.md +39 -0
- package/hosts/opencode/.opencode/agents/geopilot-fixer.md +45 -0
- package/hosts/opencode/.opencode/agents/geopilot-investigator.md +48 -0
- package/hosts/opencode/.opencode/agents/geopilot-reviewer.md +44 -0
- package/hosts/opencode/.opencode/agents/geopilot-scanner.md +50 -0
- package/hosts/opencode/.opencode/commands/geopilot-explain.md +8 -0
- package/hosts/opencode/.opencode/commands/geopilot-fix.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-init.md +12 -0
- package/hosts/opencode/.opencode/commands/geopilot-insights.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-review.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-scan.md +10 -0
- package/hosts/opencode/.opencode/skills/geo/SKILL.md +95 -0
- package/hosts/opencode/.opencode/skills/geo/references/frameworks.md +20 -0
- package/hosts/opencode/.opencode/skills/geo/references/insight-contract.md +42 -0
- package/hosts/opencode/.opencode/skills/geo/references/safety.md +30 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-init.md +6 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-review.md +8 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/opencode/.opencode/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/opencode/.opencode/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/opencode/.opencode/skills/geo/scripts/geo.sh +11 -0
- package/package.json +65 -4
- package/schemas/config-v1.json +392 -0
- package/schemas/insights-v1.json +255 -0
- package/schemas/merged-v1.json +71 -0
- package/schemas/report-v1.json +836 -0
- package/skill/geo/SKILL.md +95 -0
- package/skill/geo/references/frameworks.md +20 -0
- package/skill/geo/references/insight-contract.md +42 -0
- package/skill/geo/references/safety.md +30 -0
- package/skill/geo/references/workflow-explain.md +8 -0
- package/skill/geo/references/workflow-fix.md +20 -0
- package/skill/geo/references/workflow-init.md +6 -0
- package/skill/geo/references/workflow-insights.md +13 -0
- package/skill/geo/references/workflow-plan.md +13 -0
- package/skill/geo/references/workflow-review.md +8 -0
- package/skill/geo/references/workflow-scan.md +18 -0
- package/skill/geo/schemas/insights.schema.json +255 -0
- package/skill/geo/scripts/geo.ps1 +11 -0
- package/skill/geo/scripts/geo.sh +11 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { GeoError } from "../core/errors.js";
|
|
4
|
+
import { sha256, canonicalJson } from "../core/hash.js";
|
|
5
|
+
export const DEFAULT_CONFIG = {
|
|
6
|
+
version: 1,
|
|
7
|
+
framework: 'auto',
|
|
8
|
+
profile: 'web',
|
|
9
|
+
site: { origin: null, language: null },
|
|
10
|
+
routes: { include: ['/**'], exclude: [] },
|
|
11
|
+
crawl: { maxPages: null, maxDepth: 3, render: 'auto', requestTimeoutMs: 10_000 },
|
|
12
|
+
policy: { aiSearchCrawlers: 'allow', aiTrainingCrawlers: 'undecided', userTriggeredFetchers: 'allow' },
|
|
13
|
+
appLinks: { ios: null, android: null },
|
|
14
|
+
rules: {},
|
|
15
|
+
suppress: [],
|
|
16
|
+
fix: { verifyCommands: [], runtimeTimeoutSeconds: 60, serve: { command: null, url: null, readyTimeoutSeconds: 120 } },
|
|
17
|
+
thresholds: { failOn: null, minReadiness: null, minCoverage: 80 },
|
|
18
|
+
hook: { failOn: null, timeoutSeconds: 5 },
|
|
19
|
+
experimental: false,
|
|
20
|
+
};
|
|
21
|
+
export const CONFIG_FILE = 'geo.config.json';
|
|
22
|
+
const RULE_IDS = new Set(['GEO-002', 'GEO-003', 'GEO-004', 'GEO-009', 'GEO-010', 'GEO-011', 'GEO-012', 'GEO-013', 'GEO-014', 'GEO-015', 'GEO-016', 'GEO-017', 'GEO-101', 'GEO-102']);
|
|
23
|
+
const SEVERITIES = new Set(['high', 'medium', 'low', 'info']);
|
|
24
|
+
class Problems {
|
|
25
|
+
list = [];
|
|
26
|
+
add(path, msg) {
|
|
27
|
+
this.list.push(`${path}: ${msg}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
31
|
+
function keys(p, path, value, allowed) {
|
|
32
|
+
for (const k of Object.keys(value))
|
|
33
|
+
if (!allowed.includes(k))
|
|
34
|
+
p.add(`${path}.${k}`, 'unknown key');
|
|
35
|
+
}
|
|
36
|
+
function oneOf(p, path, v, options) {
|
|
37
|
+
if (typeof v === 'string' && options.includes(v))
|
|
38
|
+
return true;
|
|
39
|
+
p.add(path, `must be one of ${options.join(', ')}`);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function int(p, path, v, min, max) {
|
|
43
|
+
if (typeof v === 'number' && Number.isInteger(v) && v >= min && v <= max)
|
|
44
|
+
return true;
|
|
45
|
+
p.add(path, `must be an integer from ${min} to ${max}`);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
function strArray(p, path, v) {
|
|
49
|
+
if (Array.isArray(v) && v.every((x) => typeof x === 'string'))
|
|
50
|
+
return true;
|
|
51
|
+
p.add(path, 'must be an array of strings');
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function isLoopbackHttpUrl(value) {
|
|
55
|
+
try {
|
|
56
|
+
const u = new URL(value);
|
|
57
|
+
const h = u.hostname.replace(/^\[|\]$/g, '');
|
|
58
|
+
return (u.protocol === 'http:' || u.protocol === 'https:') && (h === 'localhost' || h === '::1' || /^127\./.test(h));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Validate a parsed geo.config.json and merge it over `base`. Unknown keys are
|
|
66
|
+
* errors (spec 6): a typo in a policy key must not silently fall back to a
|
|
67
|
+
* default the owner did not choose.
|
|
68
|
+
*/
|
|
69
|
+
export function validateConfig(raw, base = DEFAULT_CONFIG, source = CONFIG_FILE) {
|
|
70
|
+
const p = new Problems();
|
|
71
|
+
if (!isObj(raw))
|
|
72
|
+
throw new GeoError('config', `${source}: must be a JSON object`);
|
|
73
|
+
keys(p, '$', raw, ['$schema', 'version', 'framework', 'profile', 'site', 'routes', 'crawl', 'policy', 'appLinks', 'rules', 'suppress', 'fix', 'thresholds', 'hook', 'experimental']);
|
|
74
|
+
if (raw.version !== 1)
|
|
75
|
+
p.add('$.version', 'must be 1');
|
|
76
|
+
const c = structuredClone(base);
|
|
77
|
+
if (raw.framework !== undefined && oneOf(p, '$.framework', raw.framework, ['auto', 'nextjs-app', 'static', 'generic']))
|
|
78
|
+
c.framework = raw.framework;
|
|
79
|
+
if (raw.profile !== undefined && oneOf(p, '$.profile', raw.profile, ['web', 'app']))
|
|
80
|
+
c.profile = raw.profile;
|
|
81
|
+
if (raw.experimental !== undefined) {
|
|
82
|
+
if (typeof raw.experimental === 'boolean')
|
|
83
|
+
c.experimental = raw.experimental;
|
|
84
|
+
else
|
|
85
|
+
p.add('$.experimental', 'must be a boolean');
|
|
86
|
+
}
|
|
87
|
+
if (raw.site !== undefined) {
|
|
88
|
+
if (!isObj(raw.site))
|
|
89
|
+
p.add('$.site', 'must be an object');
|
|
90
|
+
else {
|
|
91
|
+
keys(p, '$.site', raw.site, ['origin', 'language']);
|
|
92
|
+
const site = { ...c.site };
|
|
93
|
+
if (raw.site.origin !== undefined) {
|
|
94
|
+
if (raw.site.origin === null)
|
|
95
|
+
site.origin = null;
|
|
96
|
+
else if (typeof raw.site.origin === 'string') {
|
|
97
|
+
try {
|
|
98
|
+
const u = new URL(raw.site.origin);
|
|
99
|
+
if ((u.protocol !== 'https:' && u.protocol !== 'http:') || u.pathname !== '/' || u.search || u.hash)
|
|
100
|
+
throw new Error('shape');
|
|
101
|
+
site.origin = u.origin;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
p.add('$.site.origin', 'must be an http(s) origin such as https://www.example.com');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
p.add('$.site.origin', 'must be a string or null');
|
|
109
|
+
}
|
|
110
|
+
if (raw.site.language !== undefined) {
|
|
111
|
+
if (raw.site.language === null)
|
|
112
|
+
site.language = null;
|
|
113
|
+
else if (typeof raw.site.language === 'string' && /^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/.test(raw.site.language))
|
|
114
|
+
site.language = raw.site.language;
|
|
115
|
+
else
|
|
116
|
+
p.add('$.site.language', 'must be a BCP 47 language tag such as en or en-GB');
|
|
117
|
+
}
|
|
118
|
+
c.site = site;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (raw.routes !== undefined) {
|
|
122
|
+
if (!isObj(raw.routes))
|
|
123
|
+
p.add('$.routes', 'must be an object');
|
|
124
|
+
else {
|
|
125
|
+
keys(p, '$.routes', raw.routes, ['include', 'exclude']);
|
|
126
|
+
const routes = { ...c.routes };
|
|
127
|
+
if (raw.routes.include !== undefined && strArray(p, '$.routes.include', raw.routes.include))
|
|
128
|
+
routes.include = raw.routes.include;
|
|
129
|
+
if (raw.routes.exclude !== undefined && strArray(p, '$.routes.exclude', raw.routes.exclude))
|
|
130
|
+
routes.exclude = raw.routes.exclude;
|
|
131
|
+
c.routes = routes;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (raw.crawl !== undefined) {
|
|
135
|
+
if (!isObj(raw.crawl))
|
|
136
|
+
p.add('$.crawl', 'must be an object');
|
|
137
|
+
else {
|
|
138
|
+
keys(p, '$.crawl', raw.crawl, ['maxPages', 'maxDepth', 'render', 'requestTimeoutMs']);
|
|
139
|
+
const crawl = { ...c.crawl };
|
|
140
|
+
if (raw.crawl.maxPages !== undefined && int(p, '$.crawl.maxPages', raw.crawl.maxPages, 1, 200))
|
|
141
|
+
crawl.maxPages = raw.crawl.maxPages;
|
|
142
|
+
if (raw.crawl.maxDepth !== undefined && int(p, '$.crawl.maxDepth', raw.crawl.maxDepth, 0, 10))
|
|
143
|
+
crawl.maxDepth = raw.crawl.maxDepth;
|
|
144
|
+
if (raw.crawl.render !== undefined && oneOf(p, '$.crawl.render', raw.crawl.render, ['auto', 'always', 'never']))
|
|
145
|
+
crawl.render = raw.crawl.render;
|
|
146
|
+
if (raw.crawl.requestTimeoutMs !== undefined && int(p, '$.crawl.requestTimeoutMs', raw.crawl.requestTimeoutMs, 1000, 10_000))
|
|
147
|
+
crawl.requestTimeoutMs = raw.crawl.requestTimeoutMs;
|
|
148
|
+
c.crawl = crawl;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (raw.policy !== undefined) {
|
|
152
|
+
if (!isObj(raw.policy))
|
|
153
|
+
p.add('$.policy', 'must be an object');
|
|
154
|
+
else {
|
|
155
|
+
keys(p, '$.policy', raw.policy, ['aiSearchCrawlers', 'aiTrainingCrawlers', 'userTriggeredFetchers']);
|
|
156
|
+
const policy = { ...c.policy };
|
|
157
|
+
const opts = ['allow', 'block', 'undecided'];
|
|
158
|
+
if (raw.policy.aiSearchCrawlers !== undefined && oneOf(p, '$.policy.aiSearchCrawlers', raw.policy.aiSearchCrawlers, opts))
|
|
159
|
+
policy.aiSearchCrawlers = raw.policy.aiSearchCrawlers;
|
|
160
|
+
if (raw.policy.aiTrainingCrawlers !== undefined && oneOf(p, '$.policy.aiTrainingCrawlers', raw.policy.aiTrainingCrawlers, opts))
|
|
161
|
+
policy.aiTrainingCrawlers = raw.policy.aiTrainingCrawlers;
|
|
162
|
+
if (raw.policy.userTriggeredFetchers !== undefined && oneOf(p, '$.policy.userTriggeredFetchers', raw.policy.userTriggeredFetchers, opts))
|
|
163
|
+
policy.userTriggeredFetchers = raw.policy.userTriggeredFetchers;
|
|
164
|
+
c.policy = policy;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (raw.appLinks !== undefined) {
|
|
168
|
+
if (!isObj(raw.appLinks))
|
|
169
|
+
p.add('$.appLinks', 'must be an object');
|
|
170
|
+
else {
|
|
171
|
+
keys(p, '$.appLinks', raw.appLinks, ['ios', 'android']);
|
|
172
|
+
const appLinks = { ...c.appLinks };
|
|
173
|
+
const ios = raw.appLinks.ios;
|
|
174
|
+
if (ios !== undefined) {
|
|
175
|
+
if (ios === null)
|
|
176
|
+
appLinks.ios = null;
|
|
177
|
+
else if (isObj(ios) && strArray(p, '$.appLinks.ios.appIds', ios.appIds)) {
|
|
178
|
+
keys(p, '$.appLinks.ios', ios, ['appIds']);
|
|
179
|
+
appLinks.ios = { appIds: ios.appIds };
|
|
180
|
+
}
|
|
181
|
+
else if (!isObj(ios))
|
|
182
|
+
p.add('$.appLinks.ios', 'must be null or { appIds: [...] }');
|
|
183
|
+
}
|
|
184
|
+
const android = raw.appLinks.android;
|
|
185
|
+
if (android !== undefined) {
|
|
186
|
+
if (android === null)
|
|
187
|
+
appLinks.android = null;
|
|
188
|
+
else if (isObj(android) && typeof android.packageName === 'string' && strArray(p, '$.appLinks.android.sha256CertFingerprints', android.sha256CertFingerprints)) {
|
|
189
|
+
keys(p, '$.appLinks.android', android, ['packageName', 'sha256CertFingerprints']);
|
|
190
|
+
appLinks.android = { packageName: android.packageName, sha256CertFingerprints: android.sha256CertFingerprints };
|
|
191
|
+
}
|
|
192
|
+
else
|
|
193
|
+
p.add('$.appLinks.android', 'must be null or { packageName, sha256CertFingerprints }');
|
|
194
|
+
}
|
|
195
|
+
c.appLinks = appLinks;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (raw.rules !== undefined) {
|
|
199
|
+
if (!isObj(raw.rules))
|
|
200
|
+
p.add('$.rules', 'must be an object');
|
|
201
|
+
else {
|
|
202
|
+
const rules = { ...c.rules };
|
|
203
|
+
for (const [id, v] of Object.entries(raw.rules)) {
|
|
204
|
+
if (!RULE_IDS.has(id)) {
|
|
205
|
+
p.add(`$.rules.${id}`, 'unknown rule id');
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (v === 'off')
|
|
209
|
+
rules[id] = 'off';
|
|
210
|
+
else if (isObj(v) && typeof v.severity === 'string' && SEVERITIES.has(v.severity) && Object.keys(v).length === 1) {
|
|
211
|
+
rules[id] = { severity: v.severity };
|
|
212
|
+
}
|
|
213
|
+
else
|
|
214
|
+
p.add(`$.rules.${id}`, 'must be "off" or { "severity": "high" | "medium" | "low" | "info" }');
|
|
215
|
+
}
|
|
216
|
+
c.rules = rules;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (raw.suppress !== undefined) {
|
|
220
|
+
if (!Array.isArray(raw.suppress))
|
|
221
|
+
p.add('$.suppress', 'must be an array');
|
|
222
|
+
else {
|
|
223
|
+
const out = [];
|
|
224
|
+
raw.suppress.forEach((s, i) => {
|
|
225
|
+
const path = `$.suppress[${i}]`;
|
|
226
|
+
if (!isObj(s))
|
|
227
|
+
return p.add(path, 'must be an object');
|
|
228
|
+
keys(p, path, s, ['rule', 'routes', 'reason', 'expires']);
|
|
229
|
+
if (typeof s.rule !== 'string' || !RULE_IDS.has(s.rule))
|
|
230
|
+
return p.add(`${path}.rule`, 'unknown rule id');
|
|
231
|
+
if (typeof s.reason !== 'string' || s.reason.trim() === '')
|
|
232
|
+
return p.add(`${path}.reason`, 'a reason is required');
|
|
233
|
+
const routes = s.routes === undefined ? ['/**'] : s.routes;
|
|
234
|
+
if (!strArray(p, `${path}.routes`, routes))
|
|
235
|
+
return;
|
|
236
|
+
let expires = null;
|
|
237
|
+
if (s.expires !== undefined && s.expires !== null) {
|
|
238
|
+
if (typeof s.expires !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(s.expires) || Number.isNaN(Date.parse(`${s.expires}T00:00:00Z`))) {
|
|
239
|
+
return p.add(`${path}.expires`, 'must be a YYYY-MM-DD date');
|
|
240
|
+
}
|
|
241
|
+
expires = s.expires;
|
|
242
|
+
}
|
|
243
|
+
out.push({ rule: s.rule, routes, reason: s.reason, expires });
|
|
244
|
+
});
|
|
245
|
+
c.suppress = out;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (raw.fix !== undefined) {
|
|
249
|
+
if (!isObj(raw.fix))
|
|
250
|
+
p.add('$.fix', 'must be an object');
|
|
251
|
+
else {
|
|
252
|
+
keys(p, '$.fix', raw.fix, ['verifyCommands', 'runtimeTimeoutSeconds', 'serve']);
|
|
253
|
+
const fix = { ...c.fix, serve: { ...c.fix.serve } };
|
|
254
|
+
if (raw.fix.verifyCommands !== undefined) {
|
|
255
|
+
if (Array.isArray(raw.fix.verifyCommands) && raw.fix.verifyCommands.every((cmd) => Array.isArray(cmd) && cmd.length > 0 && cmd.every((x) => typeof x === 'string'))) {
|
|
256
|
+
fix.verifyCommands = raw.fix.verifyCommands;
|
|
257
|
+
}
|
|
258
|
+
else
|
|
259
|
+
p.add('$.fix.verifyCommands', 'must be an array of argv arrays, e.g. [["pnpm", "test"]]');
|
|
260
|
+
}
|
|
261
|
+
if (raw.fix.runtimeTimeoutSeconds !== undefined && int(p, '$.fix.runtimeTimeoutSeconds', raw.fix.runtimeTimeoutSeconds, 5, 600))
|
|
262
|
+
fix.runtimeTimeoutSeconds = raw.fix.runtimeTimeoutSeconds;
|
|
263
|
+
const serve = raw.fix.serve;
|
|
264
|
+
if (serve !== undefined) {
|
|
265
|
+
if (!isObj(serve))
|
|
266
|
+
p.add('$.fix.serve', 'must be an object');
|
|
267
|
+
else {
|
|
268
|
+
keys(p, '$.fix.serve', serve, ['command', 'url', 'readyTimeoutSeconds']);
|
|
269
|
+
if (serve.command !== undefined) {
|
|
270
|
+
if (serve.command === null)
|
|
271
|
+
fix.serve.command = null;
|
|
272
|
+
else if (Array.isArray(serve.command) && serve.command.length > 0 && serve.command.every((x) => typeof x === 'string'))
|
|
273
|
+
fix.serve.command = serve.command;
|
|
274
|
+
else
|
|
275
|
+
p.add('$.fix.serve.command', 'must be null or an argv array; it is never passed to a shell');
|
|
276
|
+
}
|
|
277
|
+
if (serve.url !== undefined) {
|
|
278
|
+
if (serve.url === null)
|
|
279
|
+
fix.serve.url = null;
|
|
280
|
+
else if (typeof serve.url === 'string' && isLoopbackHttpUrl(serve.url))
|
|
281
|
+
fix.serve.url = serve.url;
|
|
282
|
+
else
|
|
283
|
+
p.add('$.fix.serve.url', 'must be null or a loopback URL such as http://127.0.0.1:3100');
|
|
284
|
+
}
|
|
285
|
+
if (serve.readyTimeoutSeconds !== undefined && int(p, '$.fix.serve.readyTimeoutSeconds', serve.readyTimeoutSeconds, 5, 600))
|
|
286
|
+
fix.serve.readyTimeoutSeconds = serve.readyTimeoutSeconds;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
c.fix = fix;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (raw.thresholds !== undefined) {
|
|
293
|
+
if (!isObj(raw.thresholds))
|
|
294
|
+
p.add('$.thresholds', 'must be an object');
|
|
295
|
+
else {
|
|
296
|
+
keys(p, '$.thresholds', raw.thresholds, ['failOn', 'minReadiness', 'minCoverage']);
|
|
297
|
+
const t = { ...c.thresholds };
|
|
298
|
+
if (raw.thresholds.failOn !== undefined) {
|
|
299
|
+
if (raw.thresholds.failOn === null)
|
|
300
|
+
t.failOn = null;
|
|
301
|
+
else if (oneOf(p, '$.thresholds.failOn', raw.thresholds.failOn, ['high', 'medium', 'low', 'info']))
|
|
302
|
+
t.failOn = raw.thresholds.failOn;
|
|
303
|
+
}
|
|
304
|
+
if (raw.thresholds.minReadiness !== undefined) {
|
|
305
|
+
if (raw.thresholds.minReadiness === null)
|
|
306
|
+
t.minReadiness = null;
|
|
307
|
+
else if (int(p, '$.thresholds.minReadiness', raw.thresholds.minReadiness, 0, 100))
|
|
308
|
+
t.minReadiness = raw.thresholds.minReadiness;
|
|
309
|
+
}
|
|
310
|
+
if (raw.thresholds.minCoverage !== undefined && int(p, '$.thresholds.minCoverage', raw.thresholds.minCoverage, 0, 100))
|
|
311
|
+
t.minCoverage = raw.thresholds.minCoverage;
|
|
312
|
+
c.thresholds = t;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (raw.hook !== undefined) {
|
|
316
|
+
if (!isObj(raw.hook))
|
|
317
|
+
p.add('$.hook', 'must be an object');
|
|
318
|
+
else {
|
|
319
|
+
keys(p, '$.hook', raw.hook, ['failOn', 'timeoutSeconds']);
|
|
320
|
+
const h = { ...c.hook };
|
|
321
|
+
if (raw.hook.failOn !== undefined) {
|
|
322
|
+
if (raw.hook.failOn === null)
|
|
323
|
+
h.failOn = null;
|
|
324
|
+
else if (oneOf(p, '$.hook.failOn', raw.hook.failOn, ['high', 'medium', 'low', 'info']))
|
|
325
|
+
h.failOn = raw.hook.failOn;
|
|
326
|
+
}
|
|
327
|
+
if (raw.hook.timeoutSeconds !== undefined && int(p, '$.hook.timeoutSeconds', raw.hook.timeoutSeconds, 1, 60))
|
|
328
|
+
h.timeoutSeconds = raw.hook.timeoutSeconds;
|
|
329
|
+
c.hook = h;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (p.list.length > 0) {
|
|
333
|
+
throw new GeoError('config', `${source} is invalid:\n ${p.list.join('\n ')}`, 'See https://moelzanaty3.github.io/geopilot/docs/configuration');
|
|
334
|
+
}
|
|
335
|
+
return c;
|
|
336
|
+
}
|
|
337
|
+
export function readConfigFile(path, base) {
|
|
338
|
+
let raw;
|
|
339
|
+
try {
|
|
340
|
+
raw = JSON.parse(readFileSync(path, 'utf8'));
|
|
341
|
+
}
|
|
342
|
+
catch (e) {
|
|
343
|
+
throw new GeoError('config', `${path}: not valid JSON (${e.message})`);
|
|
344
|
+
}
|
|
345
|
+
return validateConfig(raw, base, path);
|
|
346
|
+
}
|
|
347
|
+
/** Overrides applied after files: documented GEO_* variables. */
|
|
348
|
+
export function envOverrides(env, c) {
|
|
349
|
+
const out = structuredClone(c);
|
|
350
|
+
if (env.GEO_MAX_PAGES !== undefined) {
|
|
351
|
+
const n = Number(env.GEO_MAX_PAGES);
|
|
352
|
+
if (!Number.isInteger(n) || n < 1 || n > 200)
|
|
353
|
+
throw new GeoError('config', 'GEO_MAX_PAGES must be an integer from 1 to 200');
|
|
354
|
+
out.crawl = { ...out.crawl, maxPages: n };
|
|
355
|
+
}
|
|
356
|
+
if (env.GEO_RENDER !== undefined) {
|
|
357
|
+
if (!['auto', 'always', 'never'].includes(env.GEO_RENDER))
|
|
358
|
+
throw new GeoError('config', 'GEO_RENDER must be auto, always or never');
|
|
359
|
+
out.crawl = { ...out.crawl, render: env.GEO_RENDER };
|
|
360
|
+
}
|
|
361
|
+
if (env.GEO_SITE_ORIGIN !== undefined) {
|
|
362
|
+
out.site = validateConfig({ version: 1, site: { origin: env.GEO_SITE_ORIGIN } }, out, 'GEO_SITE_ORIGIN').site;
|
|
363
|
+
}
|
|
364
|
+
return out;
|
|
365
|
+
}
|
|
366
|
+
/** Root config first, then the workspace config in `cwd`, then environment. */
|
|
367
|
+
export function loadConfig(cwd, repoRoot, explicit, env) {
|
|
368
|
+
const files = [];
|
|
369
|
+
let c = DEFAULT_CONFIG;
|
|
370
|
+
if (explicit) {
|
|
371
|
+
const path = resolve(cwd, explicit);
|
|
372
|
+
if (!existsSync(path))
|
|
373
|
+
throw new GeoError('config', `config file not found: ${path}`);
|
|
374
|
+
c = readConfigFile(path, c);
|
|
375
|
+
files.push(path);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
const rootFile = repoRoot ? join(repoRoot, CONFIG_FILE) : null;
|
|
379
|
+
const localFile = join(cwd, CONFIG_FILE);
|
|
380
|
+
if (rootFile && existsSync(rootFile) && resolve(dirname(rootFile)) !== resolve(cwd)) {
|
|
381
|
+
c = readConfigFile(rootFile, c);
|
|
382
|
+
files.push(rootFile);
|
|
383
|
+
}
|
|
384
|
+
if (existsSync(localFile)) {
|
|
385
|
+
c = readConfigFile(localFile, c);
|
|
386
|
+
files.push(localFile);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
c = envOverrides(env, c);
|
|
390
|
+
return { config: c, files, hash: `sha256:${sha256(canonicalJson(c)).slice(0, 16)}` };
|
|
391
|
+
}
|
|
392
|
+
/** The effective configuration for --print-config. It holds no secrets by construction. */
|
|
393
|
+
export function printableConfig(c) {
|
|
394
|
+
return canonicalJson({ $schema: 'https://moelzanaty3.github.io/geopilot/schema/config/v1.json', ...c });
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA+CxD,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE;IAChF,MAAM,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE;IACtG,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,GAAG,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,EAAE;IACrH,UAAU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,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;AACvF,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,eAAe,CAAC,CAAY;IAC1C,OAAO,aAAa,CAAC,EAAE,OAAO,EAAE,8DAA8D,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAC1G,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const EXIT: {
|
|
2
|
+
readonly ok: 0;
|
|
3
|
+
readonly gate: 1;
|
|
4
|
+
readonly usage: 2;
|
|
5
|
+
readonly config: 3;
|
|
6
|
+
readonly incomplete: 4;
|
|
7
|
+
readonly rolledBack: 5;
|
|
8
|
+
readonly unverified: 6;
|
|
9
|
+
readonly internal: 70;
|
|
10
|
+
};
|
|
11
|
+
export type ExitKind = keyof typeof EXIT;
|
|
12
|
+
export type ExitCode = (typeof EXIT)[ExitKind];
|
|
13
|
+
export declare class GeoError extends Error {
|
|
14
|
+
readonly kind: ExitKind;
|
|
15
|
+
readonly hint: string | undefined;
|
|
16
|
+
constructor(kind: ExitKind, message: string, hint?: string);
|
|
17
|
+
get exitCode(): ExitCode;
|
|
18
|
+
}
|
|
19
|
+
export declare function isGeoError(e: unknown): e is GeoError;
|
|
20
|
+
export declare function usage(message: string, hint?: string): GeoError;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Exit codes are a contract (spec 5.1). Scripts and CI branch on them, so each
|
|
2
|
+
// kind maps to exactly one number and nothing else in the tree picks a number.
|
|
3
|
+
export const EXIT = {
|
|
4
|
+
ok: 0,
|
|
5
|
+
gate: 1,
|
|
6
|
+
usage: 2,
|
|
7
|
+
config: 3,
|
|
8
|
+
incomplete: 4,
|
|
9
|
+
rolledBack: 5,
|
|
10
|
+
unverified: 6,
|
|
11
|
+
internal: 70,
|
|
12
|
+
};
|
|
13
|
+
export class GeoError extends Error {
|
|
14
|
+
kind;
|
|
15
|
+
hint;
|
|
16
|
+
constructor(kind, message, hint) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = 'GeoError';
|
|
19
|
+
this.kind = kind;
|
|
20
|
+
this.hint = hint;
|
|
21
|
+
}
|
|
22
|
+
get exitCode() {
|
|
23
|
+
return EXIT[this.kind];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function isGeoError(e) {
|
|
27
|
+
return e instanceof GeoError;
|
|
28
|
+
}
|
|
29
|
+
export function usage(message, hint) {
|
|
30
|
+
return new GeoError('usage', message, hint);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,EAAE;CACJ,CAAC;AAKX,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAW;IACf,IAAI,CAAqB;IAElC,YAAY,IAAc,EAAE,OAAe,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,CAAC,YAAY,QAAQ,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,IAAa;IAClD,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function sha256(input: string | Uint8Array): string;
|
|
2
|
+
export type Json = null | boolean | number | string | Json[] | {
|
|
3
|
+
[key: string]: Json;
|
|
4
|
+
};
|
|
5
|
+
export declare function canonicalize(value: unknown): unknown;
|
|
6
|
+
export declare function canonicalJson(value: unknown, indent?: number): string;
|
|
7
|
+
export declare function newRunId(now?: Date): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
export function sha256(input) {
|
|
3
|
+
return createHash('sha256').update(input).digest('hex');
|
|
4
|
+
}
|
|
5
|
+
// Sorted keys, no whitespace variance: two runs over the same input serialise to
|
|
6
|
+
// the same bytes, which is what makes reportSha256 and golden files meaningful.
|
|
7
|
+
export function canonicalize(value) {
|
|
8
|
+
if (Array.isArray(value))
|
|
9
|
+
return value.map(canonicalize);
|
|
10
|
+
if (value !== null && typeof value === 'object') {
|
|
11
|
+
const out = {};
|
|
12
|
+
for (const key of Object.keys(value).sort()) {
|
|
13
|
+
const v = value[key];
|
|
14
|
+
if (v !== undefined)
|
|
15
|
+
out[key] = canonicalize(v);
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
export function canonicalJson(value, indent = 2) {
|
|
22
|
+
return `${JSON.stringify(canonicalize(value), null, indent)}\n`;
|
|
23
|
+
}
|
|
24
|
+
export function newRunId(now = new Date()) {
|
|
25
|
+
const stamp = now.toISOString().replace(/[-:.]/g, '');
|
|
26
|
+
return `r-${stamp}-${randomBytes(3).toString('hex')}`;
|
|
27
|
+
}
|
|
28
|
+
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OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACtD,OAAO,KAAK,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Evidence leaves the machine in reports and PR comments, so anything that
|
|
2
|
+
// looks like a credential is masked before it is stored, and snippets are
|
|
3
|
+
// capped at 300 characters (spec 14).
|
|
4
|
+
const PATTERNS = [
|
|
5
|
+
/\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{20,}\b/g,
|
|
6
|
+
/\bsk-[A-Za-z0-9_-]{20,}\b/g,
|
|
7
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
8
|
+
/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
9
|
+
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,
|
|
10
|
+
/(?<=(?:api[_-]?key|token|secret|password|passwd|authorization)["'\s:=]+)[^\s"'&]{8,}/gi,
|
|
11
|
+
];
|
|
12
|
+
export const SNIPPET_LIMIT = 300;
|
|
13
|
+
export function redact(text) {
|
|
14
|
+
let out = text;
|
|
15
|
+
for (const pattern of PATTERNS)
|
|
16
|
+
out = out.replace(pattern, '[redacted]');
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
export function snippet(text, limit = SNIPPET_LIMIT) {
|
|
20
|
+
const clean = redact(text.replace(/\s+/g, ' ').trim());
|
|
21
|
+
return clean.length > limit ? `${clean.slice(0, limit - 1)}…` : clean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/core/redact.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,sCAAsC;AACtC,MAAM,QAAQ,GAAsB;IAClC,2DAA2D;IAC3D,4BAA4B;IAC5B,uBAAuB;IACvB,mCAAmC;IACnC,oEAAoE;IACpE,wFAAwF;CACzF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,OAAO,IAAI,QAAQ;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,KAAK,GAAG,aAAa;IACzD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function colorEnabled(env: NodeJS.ProcessEnv, isTty: boolean): boolean;
|
|
2
|
+
type Paint = (text: string) => string;
|
|
3
|
+
export interface Palette {
|
|
4
|
+
brand: Paint;
|
|
5
|
+
red: Paint;
|
|
6
|
+
green: Paint;
|
|
7
|
+
yellow: Paint;
|
|
8
|
+
dim: Paint;
|
|
9
|
+
bold: Paint;
|
|
10
|
+
}
|
|
11
|
+
export declare function palette(enabled: boolean, env?: NodeJS.ProcessEnv): Palette;
|
|
12
|
+
export {};
|
package/dist/core/tty.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// NO_COLOR is presence-based (no-color.org); FORCE_COLOR overrides both ways.
|
|
2
|
+
export function colorEnabled(env, isTty) {
|
|
3
|
+
if (env.NO_COLOR !== undefined)
|
|
4
|
+
return false;
|
|
5
|
+
if (env.FORCE_COLOR !== undefined)
|
|
6
|
+
return env.FORCE_COLOR !== '0';
|
|
7
|
+
if (env.TERM === 'dumb')
|
|
8
|
+
return false;
|
|
9
|
+
return isTty;
|
|
10
|
+
}
|
|
11
|
+
const wrap = (open, close) => (text) => `\x1b[${open}m${text}\x1b[${close}m`;
|
|
12
|
+
const plain = (text) => text;
|
|
13
|
+
// #1d9bf0 — the same value web/ calls --accent.
|
|
14
|
+
function brandOpen(env) {
|
|
15
|
+
if (/truecolor|24bit/i.test(env.COLORTERM ?? ''))
|
|
16
|
+
return '38;2;29;155;240';
|
|
17
|
+
if (/-256(color)?$/.test(env.TERM ?? ''))
|
|
18
|
+
return '38;5;33';
|
|
19
|
+
return '34';
|
|
20
|
+
}
|
|
21
|
+
export function palette(enabled, env = process.env) {
|
|
22
|
+
if (!enabled)
|
|
23
|
+
return { brand: plain, red: plain, green: plain, yellow: plain, dim: plain, bold: plain };
|
|
24
|
+
return {
|
|
25
|
+
brand: wrap(brandOpen(env), '39'),
|
|
26
|
+
red: wrap('31', '39'),
|
|
27
|
+
green: wrap('32', '39'),
|
|
28
|
+
yellow: wrap('33', '39'),
|
|
29
|
+
dim: wrap('2', '22'),
|
|
30
|
+
bold: wrap('1', '22'),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty.js","sourceRoot":"","sources":["../../src/core/tty.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,GAAsB,EAAE,KAAc;IACjE,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,GAAG,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC;IAClE,IAAI,GAAG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+1,6 @@
|
|
|
1
|
+
export declare const TOOL_NAME: string;
|
|
2
|
+
export declare const TOOL_VERSION: string;
|
|
3
|
+
export declare const RULESET_VERSION = "1.0.0";
|
|
4
|
+
export declare const SCORING_VERSION = "1.0.0";
|
|
5
|
+
export declare const USER_AGENT: string;
|
|
6
|
+
export declare const DISCLAIMER = "Technical readiness only. GEO does not measure or predict citations, rankings, traffic or inclusion in any AI or search product.";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
// Resolved relative to this file so it holds for src/ (tests) and dist/ (published).
|
|
3
|
+
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
|
|
4
|
+
export const TOOL_NAME = pkg.name;
|
|
5
|
+
export const TOOL_VERSION = pkg.version;
|
|
6
|
+
export const RULESET_VERSION = '1.0.0';
|
|
7
|
+
export const SCORING_VERSION = '1.0.0';
|
|
8
|
+
export const USER_AGENT = `geopilot/${TOOL_VERSION} (+https://moelzanaty3.github.io/geopilot/docs/crawler)`;
|
|
9
|
+
export const DISCLAIMER = 'Technical readiness only. GEO does not measure or predict citations, rankings, traffic or inclusion in any AI or search product.';
|
|
10
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/core/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qFAAqF;AACrF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAG1F,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,YAAY,yDAAyD,CAAC;AAC5G,MAAM,CAAC,MAAM,UAAU,GACrB,kIAAkI,CAAC"}
|