document360-capture 0.2.9 → 0.2.10
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/package.json +2 -2
- package/dist/annotate/compose.d.ts +0 -7
- package/dist/annotate/svg.d.ts +0 -32
- package/dist/cli.d.ts +0 -2
- package/dist/commands/auth.d.ts +0 -4
- package/dist/commands/capture.d.ts +0 -5
- package/dist/commands/doctor.d.ts +0 -4
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/profile.d.ts +0 -3
- package/dist/commands/status.d.ts +0 -1
- package/dist/config/authState.d.ts +0 -10
- package/dist/config/projectConfig.d.ts +0 -117
- package/dist/config/userConfig.d.ts +0 -6
- package/dist/config/writerConfigDefaults.d.ts +0 -18
- package/dist/helpers/dumpAnnotations.d.ts +0 -3
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers/scope.d.ts +0 -10
- package/dist/helpers/types.d.ts +0 -37
- package/dist/helpers/waitPastLogin.d.ts +0 -2
- package/dist/lib/updateNudge.d.ts +0 -3
- package/dist/runner/expiryDetect.d.ts +0 -1
- package/dist/runner/playwrightConfig.d.ts +0 -15
- package/dist/runner/runSpecs.d.ts +0 -26
- package/dist/scripts/postinstall.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document360-capture",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "CLI that captures product screenshots from Playwright specs. Login once, capture many. Companion to document360-writer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./helpers": "./dist/helpers/index.js"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist",
|
|
15
|
+
"dist/**/*.js",
|
|
16
16
|
"README.md",
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
package/dist/annotate/svg.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Bbox } from '../helpers/types.js';
|
|
2
|
-
export declare function escapeXml(s: string): string;
|
|
3
|
-
export declare function highlightSvg(bbox: Bbox): string;
|
|
4
|
-
export declare function redactSvg(bbox: Bbox): string;
|
|
5
|
-
/**
|
|
6
|
-
* Just the numbered pin, placed on the target's top-left corner (clamped into the image). Pins
|
|
7
|
-
* only MARK targets — the explanation lives in the legend band — so they stay small and never
|
|
8
|
-
* cover the surrounding UI, which is what doomed inline captions on busy screens.
|
|
9
|
-
*/
|
|
10
|
-
export declare function pinSvg(label: string, bbox: Bbox, canvasW: number, canvasH: number): string;
|
|
11
|
-
export type LegendItem = {
|
|
12
|
-
label: string;
|
|
13
|
-
text: string;
|
|
14
|
-
};
|
|
15
|
-
export type LegendLayout = {
|
|
16
|
-
/** Y where the band starts (== original image height). */
|
|
17
|
-
top: number;
|
|
18
|
-
width: number;
|
|
19
|
-
/** Vertical padding above the first / below the last entry. */
|
|
20
|
-
pad: number;
|
|
21
|
-
/** Per-entry row height. */
|
|
22
|
-
lineHeight: number;
|
|
23
|
-
};
|
|
24
|
-
/** Height a legend band needs for `n` entries — the canvas is extended by exactly this much. */
|
|
25
|
-
export declare function legendBandHeight(n: number, layout: Pick<LegendLayout, 'pad' | 'lineHeight'>): number;
|
|
26
|
-
/**
|
|
27
|
-
* The legend band: a numbered list in the appended strip below the screenshot. Deterministic,
|
|
28
|
-
* always-safe placement (the band is added space, so nothing on the page is ever covered) — no
|
|
29
|
-
* collision detection or whitespace-hunting required. Each row reuses the pin's numbered chip so
|
|
30
|
-
* the legend entry and its on-image pin read as the same marker.
|
|
31
|
-
*/
|
|
32
|
-
export declare function legendSvg(items: LegendItem[], layout: LegendLayout): string;
|
package/dist/cli.d.ts
DELETED
package/dist/commands/auth.d.ts
DELETED
package/dist/commands/init.d.ts
DELETED
package/dist/commands/list.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function listCommand(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function statusCommand(): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function authStateDir(): string;
|
|
2
|
-
export declare function authStatePath(projectId: string, profileName: string): string;
|
|
3
|
-
export declare function ensureAuthStateDir(projectId: string): void;
|
|
4
|
-
export type AuthStateInfo = {
|
|
5
|
-
path: string;
|
|
6
|
-
exists: boolean;
|
|
7
|
-
ageMs?: number;
|
|
8
|
-
};
|
|
9
|
-
export declare function getAuthStateInfo(projectId: string, profileName: string): AuthStateInfo;
|
|
10
|
-
export declare function ensureParentDir(path: string): void;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/** How to reach a target deployment for capture. On disk, only `startUrl` is required —
|
|
2
|
-
`authBoundaryUrlPattern` is filled by resolveProfile (host heuristic) when omitted. */
|
|
3
|
-
export type ProfileConnection = {
|
|
4
|
-
startUrl: string;
|
|
5
|
-
authBoundaryUrlPattern?: string;
|
|
6
|
-
};
|
|
7
|
-
/** A named capture profile. `connection` is one aspect; a profile may also override
|
|
8
|
-
the directories/viewport so one repo can target multiple doc-sets/environments. */
|
|
9
|
-
export type Profile = {
|
|
10
|
-
connection: ProfileConnection;
|
|
11
|
-
captureDir?: string;
|
|
12
|
-
outputDir?: string;
|
|
13
|
-
viewport?: {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
/** Visible warning only — capture is read-only (screenshots), so no hard guard. */
|
|
18
|
-
production?: boolean;
|
|
19
|
-
/** The prepared "demo" context a capture run targets, as generic key→value pairs the writer
|
|
20
|
-
recommends per product (NOT hardcoded to one product's notions). FlowForge → {project:"…"};
|
|
21
|
-
Document360 → {project,workspace,language}; others → {org}/{site}/… Injected to specs as
|
|
22
|
-
CAPTURE_SCOPE; specs read it via the captureScope() helper to navigate deterministically. */
|
|
23
|
-
scope?: Record<string, string>;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The on-disk shape: a minimal `.d360-capture.json` need only carry a `profiles` map
|
|
27
|
-
* whose profiles each have a `connection.startUrl`. Everything else is filled at load
|
|
28
|
-
* time (see `DEFAULTS` + `normalizeProjectConfig`), so a 3-line config is valid.
|
|
29
|
-
*/
|
|
30
|
-
export type RawProjectConfig = {
|
|
31
|
-
projectId?: string;
|
|
32
|
-
captureDir?: string;
|
|
33
|
-
outputDir?: string;
|
|
34
|
-
viewport?: {
|
|
35
|
-
width: number;
|
|
36
|
-
height: number;
|
|
37
|
-
};
|
|
38
|
-
loginTimeoutMs?: number;
|
|
39
|
-
annotation?: {
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
};
|
|
42
|
-
profiles: Record<string, Profile>;
|
|
43
|
-
defaultProfile?: string;
|
|
44
|
-
};
|
|
45
|
-
/** A fully-resolved config: every default materialized. What every command sees. */
|
|
46
|
-
export type ProjectConfig = {
|
|
47
|
-
projectId: string;
|
|
48
|
-
/** Defaults inherited by any profile that doesn't override them. */
|
|
49
|
-
captureDir: string;
|
|
50
|
-
outputDir: string;
|
|
51
|
-
viewport: {
|
|
52
|
-
width: number;
|
|
53
|
-
height: number;
|
|
54
|
-
};
|
|
55
|
-
loginTimeoutMs: number;
|
|
56
|
-
annotation: {
|
|
57
|
-
enabled: boolean;
|
|
58
|
-
};
|
|
59
|
-
profiles: Record<string, Profile>;
|
|
60
|
-
defaultProfile: string;
|
|
61
|
-
};
|
|
62
|
-
/** A profile connection with the auth boundary resolved (always a string). */
|
|
63
|
-
export type ResolvedConnection = {
|
|
64
|
-
startUrl: string;
|
|
65
|
-
authBoundaryUrlPattern: string;
|
|
66
|
-
};
|
|
67
|
-
/** A profile with directory/viewport defaults and the auth boundary already merged in. */
|
|
68
|
-
export type ResolvedProfile = {
|
|
69
|
-
name: string;
|
|
70
|
-
connection: ResolvedConnection;
|
|
71
|
-
captureDir: string;
|
|
72
|
-
outputDir: string;
|
|
73
|
-
viewport: {
|
|
74
|
-
width: number;
|
|
75
|
-
height: number;
|
|
76
|
-
};
|
|
77
|
-
production: boolean;
|
|
78
|
-
/** The capture scope (key→value) for this profile; {} when unset. */
|
|
79
|
-
scope: Record<string, string>;
|
|
80
|
-
/** True when the auth boundary was derived (host heuristic) rather than configured —
|
|
81
|
-
doctor surfaces this so a too-loose/tight pattern is refinable before it bites. */
|
|
82
|
-
authBoundaryDefaulted: boolean;
|
|
83
|
-
};
|
|
84
|
-
export declare const PROJECT_CONFIG_FILENAME: string;
|
|
85
|
-
/** Filled in for any field a minimal config omits. Default location lives under .d360-writer/ to
|
|
86
|
-
match the writer's single-footprint layout (the capture dirs derive from the writer's docsDir
|
|
87
|
-
when present; these are the bare fallback). */
|
|
88
|
-
export declare const DEFAULTS: {
|
|
89
|
-
readonly captureDir: ".d360-writer/user-docs/_capture";
|
|
90
|
-
readonly outputDir: ".d360-writer/user-docs/_screenshots";
|
|
91
|
-
readonly viewport: {
|
|
92
|
-
readonly width: 1440;
|
|
93
|
-
readonly height: 900;
|
|
94
|
-
};
|
|
95
|
-
readonly loginTimeoutMs: 0;
|
|
96
|
-
readonly annotation: {
|
|
97
|
-
readonly enabled: true;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
export declare class ProfileConfigError extends Error {
|
|
101
|
-
}
|
|
102
|
-
export declare function findProjectConfigPath(cwd?: string): string;
|
|
103
|
-
export declare function readProjectConfig(path: string): ProjectConfig;
|
|
104
|
-
export declare function writeProjectConfig(path: string, cfg: RawProjectConfig): void;
|
|
105
|
-
/**
|
|
106
|
-
* Derive a permissive post-login auth boundary from the profile's start URL: any URL on the
|
|
107
|
-
* same origin. The login/IdP flow legitimately leaves that origin (SSO redirects) and returns
|
|
108
|
-
* to it once authenticated, so "back on the app origin" is a reasonable logged-in signal —
|
|
109
|
-
* good enough as a default, refinable when it isn't. Falls back to match-anything if the URL
|
|
110
|
-
* can't be parsed.
|
|
111
|
-
*/
|
|
112
|
-
export declare function deriveAuthBoundary(startUrl: string): string;
|
|
113
|
-
/** Fill every optional field from DEFAULTS / the cwd, then validate what can't be defaulted. */
|
|
114
|
-
export declare function normalizeProjectConfig(raw: RawProjectConfig & {
|
|
115
|
-
environments?: unknown;
|
|
116
|
-
}, path: string, cwd?: string): ProjectConfig;
|
|
117
|
-
export declare function resolveProfile(cfg: ProjectConfig, name?: string): ResolvedProfile;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* d360-capture rides on d360-writer's setup: when a repo already has `.d360-writer.json`,
|
|
3
|
-
* `init` inherits its project label + doc directories so the only thing left to ask is the
|
|
4
|
-
* live app URL. This reads that file as PLAIN JSON — never an engine import (the packages are
|
|
5
|
-
* deliberately decoupled; this is file I/O, not a code dependency). Tolerant by design:
|
|
6
|
-
* any parse/shape problem yields {} and init falls back to its own defaults.
|
|
7
|
-
*
|
|
8
|
-
* Field overlap is intentional — `.d360-writer.json` already carries `projectId`
|
|
9
|
-
* (its doc comment: "scopes sessions/screenshots"), `captureDir`, `outputDir`, and `docsDir`.
|
|
10
|
-
*/
|
|
11
|
-
export type WriterConfigDefaults = {
|
|
12
|
-
projectId?: string;
|
|
13
|
-
captureDir?: string;
|
|
14
|
-
outputDir?: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function writerConfigPath(cwd?: string): string;
|
|
17
|
-
export declare function hasWriterConfig(cwd?: string): boolean;
|
|
18
|
-
export declare function readWriterConfigDefaults(cwd?: string): WriterConfigDefaults;
|
package/dist/helpers/index.d.ts
DELETED
package/dist/helpers/scope.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The prepared capture scope — generic key→value pairs (e.g. {project: "Docs Demo"}, or
|
|
3
|
-
* {project, workspace, language} for products that scope that way) that the writer recommends
|
|
4
|
-
* per product and the user fills in. document360-capture injects it to specs as CAPTURE_SCOPE
|
|
5
|
-
* (JSON). Specs read it to navigate into a KNOWN context deterministically instead of grabbing
|
|
6
|
-
* "the first one". Returns {} when unset, so single-context setups keep working.
|
|
7
|
-
*/
|
|
8
|
-
export declare function captureScope(): Record<string, string>;
|
|
9
|
-
/** One scope value, e.g. `scopeValue('project')`. Undefined when not configured. */
|
|
10
|
-
export declare function scopeValue(key: string): string | undefined;
|
package/dist/helpers/types.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type Bbox = {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
};
|
|
7
|
-
export type Annotation = {
|
|
8
|
-
target: string;
|
|
9
|
-
label: string;
|
|
10
|
-
text: string;
|
|
11
|
-
};
|
|
12
|
-
export type Placeholder = {
|
|
13
|
-
id: string;
|
|
14
|
-
saveTo: string;
|
|
15
|
-
highlight?: string[];
|
|
16
|
-
annotations?: Annotation[];
|
|
17
|
-
redact?: string[];
|
|
18
|
-
};
|
|
19
|
-
export type ResolvedAnnotations = {
|
|
20
|
-
id: string;
|
|
21
|
-
rawPath: string;
|
|
22
|
-
finalPath: string;
|
|
23
|
-
highlight: {
|
|
24
|
-
selector: string;
|
|
25
|
-
bbox: Bbox;
|
|
26
|
-
}[];
|
|
27
|
-
annotations: {
|
|
28
|
-
label: string;
|
|
29
|
-
text: string;
|
|
30
|
-
selector: string;
|
|
31
|
-
bbox: Bbox;
|
|
32
|
-
}[];
|
|
33
|
-
redact: {
|
|
34
|
-
selector: string;
|
|
35
|
-
bbox: Bbox;
|
|
36
|
-
}[];
|
|
37
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** Print a one-line update hint (from the cached answer) when a newer d360-capture is published, then
|
|
2
|
-
kick off a background cache refresh for next time. Best-effort; never blocks or throws. */
|
|
3
|
-
export declare function maybeNudgeCaptureUpdate(currentVersion: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function looksLikeSessionExpiry(output: string): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type RuntimeConfigArgs = {
|
|
2
|
-
cwd: string;
|
|
3
|
-
profileName: string;
|
|
4
|
-
captureDir: string;
|
|
5
|
-
viewport: {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
};
|
|
9
|
-
storageStatePath: string;
|
|
10
|
-
};
|
|
11
|
-
export type RuntimeConfigPaths = {
|
|
12
|
-
configPath: string;
|
|
13
|
-
tsconfigPath: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function writeRuntimePlaywrightConfig(args: RuntimeConfigArgs): RuntimeConfigPaths;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export type RunSpecsArgs = {
|
|
2
|
-
cwd: string;
|
|
3
|
-
configPath: string;
|
|
4
|
-
tsconfigPath: string;
|
|
5
|
-
startUrl: string;
|
|
6
|
-
authBoundaryUrlPattern: string;
|
|
7
|
-
specId?: string;
|
|
8
|
-
captureDirAbs: string;
|
|
9
|
-
/** Abort the in-flight Playwright run (hard interrupt) — kills the child process. */
|
|
10
|
-
signal?: AbortSignal;
|
|
11
|
-
/** Prepared capture scope (key→value), passed to specs as CAPTURE_SCOPE (JSON). */
|
|
12
|
-
scope?: Record<string, string>;
|
|
13
|
-
};
|
|
14
|
-
export type RunOutcome = 'passed' | 'failed' | 'skipped';
|
|
15
|
-
export type RunSpecsResult = {
|
|
16
|
-
exitCode: number;
|
|
17
|
-
stdout: string;
|
|
18
|
-
stderr: string;
|
|
19
|
-
/** Distinguishes a skipped spec (exit 0 + "skipped") from a real pass — so a prerequisite
|
|
20
|
-
skip isn't miscounted as a capture. */
|
|
21
|
-
outcome: RunOutcome;
|
|
22
|
-
};
|
|
23
|
-
/** Classify a single-spec run: nonzero → failed; else "skipped" only if Playwright reported a
|
|
24
|
-
skip and no pass; otherwise passed. (Per-spec mode runs exactly one test, so it's unambiguous.) */
|
|
25
|
-
export declare function classifyOutcome(exitCode: number, stdout: string): RunOutcome;
|
|
26
|
-
export declare function runSpecs(args: RunSpecsArgs): Promise<RunSpecsResult>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|