sugikit 0.0.0-stage → 0.1.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 +29 -0
- package/README.md +44 -2
- package/dist/api/browser.d.ts +5 -0
- package/dist/api/browser.js +5 -0
- package/dist/api/rules.d.ts +12 -0
- package/dist/api/rules.js +14 -0
- package/dist/auth.d.ts +156 -0
- package/dist/auth.js +547 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +120 -0
- package/dist/check.d.ts +21 -0
- package/dist/check.js +89 -0
- package/dist/convert-probe.d.ts +21 -0
- package/dist/convert-probe.js +647 -0
- package/dist/fetch.d.ts +6 -0
- package/dist/fetch.js +22 -0
- package/dist/framework.d.ts +2 -0
- package/dist/framework.js +17 -0
- package/dist/gather.d.ts +48 -0
- package/dist/gather.js +211 -0
- package/dist/html.d.ts +17 -0
- package/dist/html.js +43 -0
- package/dist/http.d.ts +36 -0
- package/dist/http.js +57 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +331 -0
- package/dist/links.d.ts +8 -0
- package/dist/links.js +69 -0
- package/dist/polish-run.d.ts +115 -0
- package/dist/polish-run.js +357 -0
- package/dist/probe.d.ts +14 -0
- package/dist/probe.js +457 -0
- package/dist/psi-scores.d.ts +4 -0
- package/dist/psi-scores.js +7 -0
- package/dist/psi.d.ts +56 -0
- package/dist/psi.js +192 -0
- package/dist/release.d.ts +1 -0
- package/dist/release.js +5 -0
- package/dist/render.d.ts +28 -0
- package/dist/render.js +270 -0
- package/dist/report.d.ts +227 -0
- package/dist/report.js +69 -0
- package/dist/rules/convert-render.d.ts +100 -0
- package/dist/rules/convert-render.js +279 -0
- package/dist/rules/convert.d.ts +15 -0
- package/dist/rules/convert.js +322 -0
- package/dist/rules/fixes.d.ts +16 -0
- package/dist/rules/fixes.js +536 -0
- package/dist/rules/geo.d.ts +15 -0
- package/dist/rules/geo.js +112 -0
- package/dist/rules/polish.d.ts +59 -0
- package/dist/rules/polish.js +223 -0
- package/dist/rules/robots.d.ts +14 -0
- package/dist/rules/robots.js +69 -0
- package/dist/rules/seo.d.ts +31 -0
- package/dist/rules/seo.js +208 -0
- package/dist/rules/types.d.ts +55 -0
- package/dist/rules/types.js +78 -0
- package/dist/score.d.ts +6 -0
- package/dist/score.js +23 -0
- package/dist/skills.d.ts +9 -0
- package/dist/skills.js +22 -0
- package/package.json +63 -3
- package/skills/INSTALL_PROMPT.md +9 -0
- package/skills/sugikit/SKILL.md +147 -0
- package/skills/sugikit/references/convert.md +127 -0
- package/skills/sugikit/references/geo.md +97 -0
- package/skills/sugikit/references/next.md +254 -0
- package/skills/sugikit/references/pagespeed.md +94 -0
- package/skills/sugikit/references/polish.md +123 -0
- package/skills/sugikit/references/seo.md +150 -0
- package/skills/sugikit/references/tanstack-start.md +246 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Sugikit License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vinena LLC. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This license covers the sugikit npm package: the command line tool, the skill
|
|
6
|
+
pack and the documentation that ship with it ("the Software").
|
|
7
|
+
|
|
8
|
+
1. Free use. Anyone may install the Software and use the `sugikit check`,
|
|
9
|
+
`sugikit psi` and `sugikit report` commands on any site, for free.
|
|
10
|
+
|
|
11
|
+
2. Paid features. Commands and features marked as paid (for example the fix
|
|
12
|
+
list, the starter, the generators and insights) may only be used while you
|
|
13
|
+
are signed in with a Sugikit account that has an active paid plan. When the
|
|
14
|
+
plan ends, is refunded or is charged back, the right to use the paid
|
|
15
|
+
features ends.
|
|
16
|
+
|
|
17
|
+
3. Your sites. You may use the Software on your own projects and on projects
|
|
18
|
+
you build for clients. Changes the Software or your coding agent makes to
|
|
19
|
+
your code belong to you.
|
|
20
|
+
|
|
21
|
+
4. Restrictions. You may not resell, sublicense or redistribute the Software,
|
|
22
|
+
publish a modified copy of it, or remove or bypass the account and license
|
|
23
|
+
checks.
|
|
24
|
+
|
|
25
|
+
5. No warranty. The Software is provided "as is", without warranty of any
|
|
26
|
+
kind. To the extent the law allows, Vinena LLC is not liable for any
|
|
27
|
+
damage that comes from using it.
|
|
28
|
+
|
|
29
|
+
Questions: https://sugikit.com
|
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# sugikit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Checks a landing page for polish, SEO and GEO problems and writes a JSON report for coding agents. See the repository README for the CLI.
|
|
4
|
+
|
|
5
|
+
## Library use
|
|
6
|
+
|
|
7
|
+
The same rules the CLI runs are available as two imports, so a server (for example a Cloudflare Worker) can produce the same report JSON.
|
|
8
|
+
|
|
9
|
+
### `sugikit/rules`
|
|
10
|
+
|
|
11
|
+
Static SEO and GEO checks with any `fetch`. Worker-safe: no `node:*`, undici or playwright imports. Bundle with the `worker` or `browser` condition (wrangler does this by default) so cheerio resolves to its entry without undici.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { gatherPage, renderHtml, runStaticRules, toReport } from "sugikit/rules";
|
|
15
|
+
|
|
16
|
+
const url = "https://example.com/";
|
|
17
|
+
const startedAt = new Date().toISOString();
|
|
18
|
+
const page = await gatherPage(url, { fetch: (u, init) => fetch(u, init) });
|
|
19
|
+
const results = runStaticRules(page);
|
|
20
|
+
const report = toReport({ target: url, url: page.url, framework: page.framework, startedAt, results });
|
|
21
|
+
// report matches `sugikit check <url> --no-browser`; checkStatic(url, { fetch }) does the three steps at once.
|
|
22
|
+
const html = renderHtml({ after: { report } });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`gatherPage` also takes `framework`, an already fetched `page`, and `isLocalRun` (defaults to loopback hosts). `renderHtml` reads no files: pass screenshot sizes as `images: { [state]: { src, width, height } }`.
|
|
26
|
+
|
|
27
|
+
### `sugikit/browser`
|
|
28
|
+
|
|
29
|
+
Polish checks on a Playwright-like page (Node `playwright` or `@cloudflare/playwright`). The caller launches and closes the browser and stores the screenshots (PNG bytes). The `PolishPage` type lists the page methods used.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { launch } from "@cloudflare/playwright";
|
|
33
|
+
import { runPolishChecks, stateContextOptions, type PolishState } from "sugikit/browser";
|
|
34
|
+
|
|
35
|
+
const browser = await launch(env.BROWSER);
|
|
36
|
+
const open = async (state: PolishState) => {
|
|
37
|
+
const context = await browser.newContext(stateContextOptions(state));
|
|
38
|
+
return { page: await context.newPage(), close: () => context.close() };
|
|
39
|
+
};
|
|
40
|
+
const run = await runPolishChecks(open, { url: "https://example.com/", screenshots: true });
|
|
41
|
+
// run.results go into toReport({ results: [...staticResults, ...run.results], states: run.states, ... }).
|
|
42
|
+
await browser.close();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Passing one page instead of the `open` factory reuses it for every state through `setViewportSize` and `emulateMedia`; phone states then get only the phone viewport size, not touch or device scale. axe runs in the main frame only.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { NAVIGATION_MS, POLISH_STATES, REDUCED_MOTION, runPolishChecks, stateContextOptions, type OpenedPage, type PolishBudget, type PolishOptions, type PolishPage, type PolishRun, type PolishShot, type PolishSource, type PolishState, type StateContextOptions, } from "../polish-run.js";
|
|
2
|
+
export { REDUCED_MOTION_STATE, STATE_NAMES, polishRules, type StateName } from "../rules/polish.js";
|
|
3
|
+
export { CONVERT_RENDER_RULE_IDS, convertRenderRules, type ConvertRenderData } from "../rules/convert-render.js";
|
|
4
|
+
export type { FetchLike } from "../http.js";
|
|
5
|
+
export type { RuleResult } from "../rules/types.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// `sugikit/browser`: the polish checks on a Playwright-like page. Works with Node Playwright and
|
|
2
|
+
// @cloudflare/playwright; the caller launches and closes the browser and stores the screenshots.
|
|
3
|
+
export { NAVIGATION_MS, POLISH_STATES, REDUCED_MOTION, runPolishChecks, stateContextOptions, } from "../polish-run.js";
|
|
4
|
+
export { REDUCED_MOTION_STATE, STATE_NAMES, polishRules } from "../rules/polish.js";
|
|
5
|
+
export { CONVERT_RENDER_RULE_IDS, convertRenderRules } from "../rules/convert-render.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { BROWSER_USER_AGENT, REQUEST_HEADERS, defaultFetch, fetchTextWith, isBlockedResponse, isChallengePage, isLocalHost, isLoopbackUrl, type FetchLike, type FetchResult, } from "../http.js";
|
|
2
|
+
export { ORIGIN_RULES, checkStatic, gatherPage, httpStatusResult, isPageError, resolveSitemap, runRules, runStaticRules, toFinding, toReport, type GatherOptions, type GatheredPage, type ReportInput, } from "../gather.js";
|
|
3
|
+
export { CONFIDENCE_WEIGHTS, WEIGHTS, resultWeight, scoreCategory } from "../score.js";
|
|
4
|
+
export { checkLinks, internalLinks, LINK_CONCURRENCY, LINK_TIMEOUT_MS, MAX_LINK_CHECKS } from "../links.js";
|
|
5
|
+
export { convertRules, detectPageType, verifyPricingLink } from "../rules/convert.js";
|
|
6
|
+
export { CONVERT_RENDER_RULE_IDS, convertRenderRules, heroLcpResult, type ConvertRenderData, type CtaCheck, type CtaTarget, type HeroProbe, type LcpProbe, type OverlaySample, type PsiLcp, } from "../rules/convert-render.js";
|
|
7
|
+
export { auditFix, fixFor, plainDescription } from "../rules/fixes.js";
|
|
8
|
+
export { POLISH_RULE_IDS, polishRules, type PolishData } from "../rules/polish.js";
|
|
9
|
+
export type { LinkCheck, PageContext, RuleResult, TextResource } from "../rules/types.js";
|
|
10
|
+
export { minScore } from "../psi-scores.js";
|
|
11
|
+
export { escapeHtml, pngSizeFromBytes, polishRan, renderHtml, splitFindings, type FindingSplit, type ImageRef, type RenderInput, type RenderRun, } from "../render.js";
|
|
12
|
+
export * from "../report.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// `sugikit/rules`: the static SEO, GEO and convert checks for any fetch runtime (Node, Cloudflare Workers, browsers).
|
|
2
|
+
// Worker-safe: nothing reachable from here imports node:*, undici, playwright or cheerio's Node entry
|
|
3
|
+
// (bundle with the "browser" or "worker" condition; test/worker-safe.test.ts checks this).
|
|
4
|
+
export { BROWSER_USER_AGENT, REQUEST_HEADERS, defaultFetch, fetchTextWith, isBlockedResponse, isChallengePage, isLocalHost, isLoopbackUrl, } from "../http.js";
|
|
5
|
+
export { ORIGIN_RULES, checkStatic, gatherPage, httpStatusResult, isPageError, resolveSitemap, runRules, runStaticRules, toFinding, toReport, } from "../gather.js";
|
|
6
|
+
export { CONFIDENCE_WEIGHTS, WEIGHTS, resultWeight, scoreCategory } from "../score.js";
|
|
7
|
+
export { checkLinks, internalLinks, LINK_CONCURRENCY, LINK_TIMEOUT_MS, MAX_LINK_CHECKS } from "../links.js";
|
|
8
|
+
export { convertRules, detectPageType, verifyPricingLink } from "../rules/convert.js";
|
|
9
|
+
export { CONVERT_RENDER_RULE_IDS, convertRenderRules, heroLcpResult, } from "../rules/convert-render.js";
|
|
10
|
+
export { auditFix, fixFor, plainDescription } from "../rules/fixes.js";
|
|
11
|
+
export { POLISH_RULE_IDS, polishRules } from "../rules/polish.js";
|
|
12
|
+
export { minScore } from "../psi-scores.js";
|
|
13
|
+
export { escapeHtml, pngSizeFromBytes, polishRan, renderHtml, splitFindings, } from "../render.js";
|
|
14
|
+
export * from "../report.js";
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DEFAULT_API_URL = "https://sugikit.com";
|
|
3
|
+
export declare const CLIENT_ID = "sugikit-cli";
|
|
4
|
+
export declare const DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
5
|
+
export declare const REQUEST_TIMEOUT_MS = 15000;
|
|
6
|
+
export declare const LICENSE_FRESH_MS: number;
|
|
7
|
+
export declare const LICENSE_MAX_AGE_MS: number;
|
|
8
|
+
export declare const PRICING_URL = "https://sugikit.com/#pricing";
|
|
9
|
+
export declare const ACCOUNT_URL = "https://sugikit.com/account";
|
|
10
|
+
export type Plan = "none" | "kit" | "pro" | "cloud";
|
|
11
|
+
export type PaidPlan = "kit" | "pro";
|
|
12
|
+
export declare class AuthError extends Error {
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class NotLoggedInError extends AuthError {
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class SessionExpiredError extends AuthError {
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AuthContext {
|
|
22
|
+
env: Record<string, string | undefined>;
|
|
23
|
+
platform: NodeJS.Platform;
|
|
24
|
+
homedir: string;
|
|
25
|
+
now: () => number;
|
|
26
|
+
sleep: (ms: number) => Promise<void>;
|
|
27
|
+
open: (url: string) => void;
|
|
28
|
+
stdout: (text: string) => void;
|
|
29
|
+
stderr: (text: string) => void;
|
|
30
|
+
uid?: number;
|
|
31
|
+
releaseDate?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare function defaultContext(overrides?: Partial<AuthContext>): AuthContext;
|
|
34
|
+
export declare function openInBrowser(url: string, platform: NodeJS.Platform): void;
|
|
35
|
+
export declare function configDir(ctx: Pick<AuthContext, "env" | "platform" | "homedir">): string;
|
|
36
|
+
export declare const authPath: (ctx: Pick<AuthContext, "env" | "platform" | "homedir">) => string;
|
|
37
|
+
export declare const licensePath: (ctx: Pick<AuthContext, "env" | "platform" | "homedir">) => string;
|
|
38
|
+
declare const authFileSchema: z.ZodObject<{
|
|
39
|
+
access_token: z.ZodString;
|
|
40
|
+
api_url: z.ZodString;
|
|
41
|
+
saved_at: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type AuthFile = z.infer<typeof authFileSchema>;
|
|
44
|
+
declare const entitlementsSchema: z.ZodObject<{
|
|
45
|
+
kit: z.ZodBoolean;
|
|
46
|
+
pro: z.ZodBoolean;
|
|
47
|
+
cloud: z.ZodBoolean;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type Entitlements = z.infer<typeof entitlementsSchema>;
|
|
50
|
+
declare const licenseResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
51
|
+
plan: z.ZodEnum<{
|
|
52
|
+
cloud: "cloud";
|
|
53
|
+
kit: "kit";
|
|
54
|
+
none: "none";
|
|
55
|
+
pro: "pro";
|
|
56
|
+
}>;
|
|
57
|
+
email: z.ZodString;
|
|
58
|
+
checked_at: z.ZodString;
|
|
59
|
+
entitlements: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
kit: z.ZodBoolean;
|
|
61
|
+
pro: z.ZodBoolean;
|
|
62
|
+
cloud: z.ZodBoolean;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
updates_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
cloud_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
67
|
+
plan: "cloud" | "kit" | "none" | "pro";
|
|
68
|
+
email: string;
|
|
69
|
+
checked_at: string;
|
|
70
|
+
entitlements: {
|
|
71
|
+
kit: boolean;
|
|
72
|
+
pro: boolean;
|
|
73
|
+
cloud: boolean;
|
|
74
|
+
};
|
|
75
|
+
updates_until: string | null;
|
|
76
|
+
cloud_until: string | null;
|
|
77
|
+
}, {
|
|
78
|
+
plan: "cloud" | "kit" | "none" | "pro";
|
|
79
|
+
email: string;
|
|
80
|
+
checked_at: string;
|
|
81
|
+
entitlements?: {
|
|
82
|
+
kit: boolean;
|
|
83
|
+
pro: boolean;
|
|
84
|
+
cloud: boolean;
|
|
85
|
+
} | undefined;
|
|
86
|
+
updates_until?: string | null | undefined;
|
|
87
|
+
cloud_until?: string | null | undefined;
|
|
88
|
+
}>>;
|
|
89
|
+
export type LicenseResponse = z.output<typeof licenseResponseSchema>;
|
|
90
|
+
declare const licenseFileSchema: z.ZodIntersection<z.ZodObject<{
|
|
91
|
+
api_url: z.ZodString;
|
|
92
|
+
cached_at: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
94
|
+
plan: z.ZodEnum<{
|
|
95
|
+
cloud: "cloud";
|
|
96
|
+
kit: "kit";
|
|
97
|
+
none: "none";
|
|
98
|
+
pro: "pro";
|
|
99
|
+
}>;
|
|
100
|
+
email: z.ZodString;
|
|
101
|
+
checked_at: z.ZodString;
|
|
102
|
+
entitlements: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
kit: z.ZodBoolean;
|
|
104
|
+
pro: z.ZodBoolean;
|
|
105
|
+
cloud: z.ZodBoolean;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
updates_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
cloud_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
110
|
+
plan: "cloud" | "kit" | "none" | "pro";
|
|
111
|
+
email: string;
|
|
112
|
+
checked_at: string;
|
|
113
|
+
entitlements: {
|
|
114
|
+
kit: boolean;
|
|
115
|
+
pro: boolean;
|
|
116
|
+
cloud: boolean;
|
|
117
|
+
};
|
|
118
|
+
updates_until: string | null;
|
|
119
|
+
cloud_until: string | null;
|
|
120
|
+
}, {
|
|
121
|
+
plan: "cloud" | "kit" | "none" | "pro";
|
|
122
|
+
email: string;
|
|
123
|
+
checked_at: string;
|
|
124
|
+
entitlements?: {
|
|
125
|
+
kit: boolean;
|
|
126
|
+
pro: boolean;
|
|
127
|
+
cloud: boolean;
|
|
128
|
+
} | undefined;
|
|
129
|
+
updates_until?: string | null | undefined;
|
|
130
|
+
cloud_until?: string | null | undefined;
|
|
131
|
+
}>>>;
|
|
132
|
+
export type LicenseFile = z.output<typeof licenseFileSchema>;
|
|
133
|
+
export interface License extends LicenseResponse {
|
|
134
|
+
cached: boolean;
|
|
135
|
+
cachedAt: number;
|
|
136
|
+
}
|
|
137
|
+
export declare function readAuth(ctx: AuthContext): AuthFile | undefined;
|
|
138
|
+
export declare function apiUrl(env: Record<string, string | undefined>): string;
|
|
139
|
+
export declare function assertSafeApiUrl(url: string): void;
|
|
140
|
+
export declare function redact(text: string, secrets: readonly (string | undefined)[]): string;
|
|
141
|
+
type LookupAll = (hostname: string) => Promise<{
|
|
142
|
+
address: string;
|
|
143
|
+
family: number;
|
|
144
|
+
}[]>;
|
|
145
|
+
export declare function laxTlsAllowed(hostname: string, lookup?: LookupAll): Promise<boolean>;
|
|
146
|
+
export declare function login(ctx: AuthContext): Promise<number>;
|
|
147
|
+
export declare function getLicense(ctx: AuthContext, options?: {
|
|
148
|
+
online?: boolean;
|
|
149
|
+
}): Promise<License>;
|
|
150
|
+
export declare function missingPlanMessage(plan: PaidPlan): string;
|
|
151
|
+
export declare function updatesEndedMessage(updatesUntil: string): string;
|
|
152
|
+
export declare function updatesEnded(updatesUntil: string | null, releaseDate: string | undefined): boolean;
|
|
153
|
+
export declare function requirePlan(plan: PaidPlan, ctx?: AuthContext): Promise<License>;
|
|
154
|
+
export declare function whoami(ctx: AuthContext): Promise<number>;
|
|
155
|
+
export declare function logout(ctx: AuthContext): Promise<number>;
|
|
156
|
+
export {};
|