ghostfill 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.
@@ -0,0 +1,65 @@
1
+ /** Configuration options for GhostFill */
2
+ interface GhostFillOptions {
3
+ /** API key (optional — can be set via settings UI) */
4
+ apiKey?: string;
5
+ /** Keyboard shortcut to toggle GhostFill (default: "Alt+G") */
6
+ shortcut?: string;
7
+ /** Custom system prompt to prepend */
8
+ systemPrompt?: string;
9
+ }
10
+ /** A detected form field */
11
+ interface DetectedField {
12
+ /** The DOM element */
13
+ element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
14
+ /** Field type: text, email, number, select, textarea, checkbox, radio, date, etc. */
15
+ type: string;
16
+ /** Field name attribute */
17
+ name: string;
18
+ /** Field label (from <label>, aria-label, or placeholder) */
19
+ label: string;
20
+ /** For <select>, the available options */
21
+ options?: string[];
22
+ /** Whether the field is required */
23
+ required: boolean;
24
+ /** Current value */
25
+ currentValue: string;
26
+ /** Min/max for number/date fields */
27
+ min?: string;
28
+ max?: string;
29
+ /** Pattern attribute */
30
+ pattern?: string;
31
+ }
32
+ /** Field data returned by the AI */
33
+ interface FieldFillData {
34
+ /** Index matching the DetectedField array */
35
+ index: number;
36
+ /** Value to fill */
37
+ value: string;
38
+ /** For checkboxes: whether to check */
39
+ checked?: boolean;
40
+ }
41
+
42
+ /**
43
+ * Initialize GhostFill — adds a floating ghost icon to the page.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import { init } from "ghostfill";
48
+ * init();
49
+ * ```
50
+ */
51
+ declare function init(options?: GhostFillOptions): {
52
+ destroy: () => void;
53
+ };
54
+ /**
55
+ * Programmatic API — detect fields and fill them without the UI.
56
+ */
57
+ declare function fill(params: {
58
+ container: HTMLElement;
59
+ prompt?: string;
60
+ }): Promise<{
61
+ filled: number;
62
+ errors: string[];
63
+ }>;
64
+
65
+ export { type DetectedField, type FieldFillData, type GhostFillOptions, fill, init };
@@ -0,0 +1,65 @@
1
+ /** Configuration options for GhostFill */
2
+ interface GhostFillOptions {
3
+ /** API key (optional — can be set via settings UI) */
4
+ apiKey?: string;
5
+ /** Keyboard shortcut to toggle GhostFill (default: "Alt+G") */
6
+ shortcut?: string;
7
+ /** Custom system prompt to prepend */
8
+ systemPrompt?: string;
9
+ }
10
+ /** A detected form field */
11
+ interface DetectedField {
12
+ /** The DOM element */
13
+ element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
14
+ /** Field type: text, email, number, select, textarea, checkbox, radio, date, etc. */
15
+ type: string;
16
+ /** Field name attribute */
17
+ name: string;
18
+ /** Field label (from <label>, aria-label, or placeholder) */
19
+ label: string;
20
+ /** For <select>, the available options */
21
+ options?: string[];
22
+ /** Whether the field is required */
23
+ required: boolean;
24
+ /** Current value */
25
+ currentValue: string;
26
+ /** Min/max for number/date fields */
27
+ min?: string;
28
+ max?: string;
29
+ /** Pattern attribute */
30
+ pattern?: string;
31
+ }
32
+ /** Field data returned by the AI */
33
+ interface FieldFillData {
34
+ /** Index matching the DetectedField array */
35
+ index: number;
36
+ /** Value to fill */
37
+ value: string;
38
+ /** For checkboxes: whether to check */
39
+ checked?: boolean;
40
+ }
41
+
42
+ /**
43
+ * Initialize GhostFill — adds a floating ghost icon to the page.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import { init } from "ghostfill";
48
+ * init();
49
+ * ```
50
+ */
51
+ declare function init(options?: GhostFillOptions): {
52
+ destroy: () => void;
53
+ };
54
+ /**
55
+ * Programmatic API — detect fields and fill them without the UI.
56
+ */
57
+ declare function fill(params: {
58
+ container: HTMLElement;
59
+ prompt?: string;
60
+ }): Promise<{
61
+ filled: number;
62
+ errors: string[];
63
+ }>;
64
+
65
+ export { type DetectedField, type FieldFillData, type GhostFillOptions, fill, init };