sugikit 0.0.1 → 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.
Files changed (72) hide show
  1. package/LICENSE +29 -21
  2. package/README.md +45 -0
  3. package/dist/api/browser.d.ts +5 -0
  4. package/dist/api/browser.js +5 -0
  5. package/dist/api/rules.d.ts +12 -0
  6. package/dist/api/rules.js +14 -0
  7. package/dist/auth.d.ts +156 -0
  8. package/dist/auth.js +547 -0
  9. package/dist/browser.d.ts +25 -0
  10. package/dist/browser.js +120 -0
  11. package/dist/check.d.ts +21 -0
  12. package/dist/check.js +89 -0
  13. package/dist/convert-probe.d.ts +21 -0
  14. package/dist/convert-probe.js +647 -0
  15. package/dist/fetch.d.ts +6 -0
  16. package/dist/fetch.js +22 -0
  17. package/dist/framework.d.ts +2 -0
  18. package/dist/framework.js +17 -0
  19. package/dist/gather.d.ts +48 -0
  20. package/dist/gather.js +211 -0
  21. package/dist/html.d.ts +17 -0
  22. package/dist/html.js +43 -0
  23. package/dist/http.d.ts +36 -0
  24. package/dist/http.js +57 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +331 -0
  27. package/dist/links.d.ts +8 -0
  28. package/dist/links.js +69 -0
  29. package/dist/polish-run.d.ts +115 -0
  30. package/dist/polish-run.js +357 -0
  31. package/dist/probe.d.ts +14 -0
  32. package/dist/probe.js +457 -0
  33. package/dist/psi-scores.d.ts +4 -0
  34. package/dist/psi-scores.js +7 -0
  35. package/dist/psi.d.ts +56 -0
  36. package/dist/psi.js +192 -0
  37. package/dist/release.d.ts +1 -0
  38. package/dist/release.js +5 -0
  39. package/dist/render.d.ts +28 -0
  40. package/dist/render.js +270 -0
  41. package/dist/report.d.ts +227 -0
  42. package/dist/report.js +69 -0
  43. package/dist/rules/convert-render.d.ts +100 -0
  44. package/dist/rules/convert-render.js +279 -0
  45. package/dist/rules/convert.d.ts +15 -0
  46. package/dist/rules/convert.js +322 -0
  47. package/dist/rules/fixes.d.ts +16 -0
  48. package/dist/rules/fixes.js +536 -0
  49. package/dist/rules/geo.d.ts +15 -0
  50. package/dist/rules/geo.js +112 -0
  51. package/dist/rules/polish.d.ts +59 -0
  52. package/dist/rules/polish.js +223 -0
  53. package/dist/rules/robots.d.ts +14 -0
  54. package/dist/rules/robots.js +69 -0
  55. package/dist/rules/seo.d.ts +31 -0
  56. package/dist/rules/seo.js +208 -0
  57. package/dist/rules/types.d.ts +55 -0
  58. package/dist/rules/types.js +78 -0
  59. package/dist/score.d.ts +6 -0
  60. package/dist/score.js +23 -0
  61. package/dist/skills.d.ts +9 -0
  62. package/dist/skills.js +22 -0
  63. package/package.json +64 -4
  64. package/skills/INSTALL_PROMPT.md +9 -0
  65. package/skills/sugikit/SKILL.md +147 -0
  66. package/skills/sugikit/references/convert.md +127 -0
  67. package/skills/sugikit/references/geo.md +97 -0
  68. package/skills/sugikit/references/next.md +254 -0
  69. package/skills/sugikit/references/pagespeed.md +94 -0
  70. package/skills/sugikit/references/polish.md +123 -0
  71. package/skills/sugikit/references/seo.md +150 -0
  72. package/skills/sugikit/references/tanstack-start.md +246 -0
package/LICENSE CHANGED
@@ -1,21 +1,29 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Mert Düzgün
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
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 ADDED
@@ -0,0 +1,45 @@
1
+ # sugikit
2
+
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 {};