@shisho/plugin-types 0.0.16 → 0.0.18

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/hooks.d.ts CHANGED
@@ -24,37 +24,53 @@ export interface FileParserContext {
24
24
  fileType: string;
25
25
  }
26
26
 
27
- /** Context passed to metadataEnricher.enrich(). */
28
- export interface MetadataEnricherContext {
29
- /** Metadata freshly parsed from the file on disk (e.g., from ComicInfo.xml, OPF, etc.). */
30
- parsedMetadata: {
27
+ /** Context passed to metadataEnricher.search(). */
28
+ export interface SearchContext {
29
+ /** Search query (book title for auto, user input for manual). */
30
+ query: string;
31
+ /** Current book state from the database. */
32
+ book: {
33
+ id?: number;
31
34
  title?: string;
32
35
  subtitle?: string;
33
- series?: string;
34
- seriesNumber?: number;
35
36
  description?: string;
36
- publisher?: string;
37
- imprint?: string;
38
- url?: string;
39
- dataSource?: string;
37
+ series?: Array<{ name: string; number?: number }>;
40
38
  authors?: Array<{ name: string; role?: string }>;
41
- narrators?: string[];
42
39
  genres?: string[];
43
40
  tags?: string[];
44
- releaseDate?: string;
45
41
  identifiers?: Array<{ type: string; value: string }>;
42
+ publisher?: string;
46
43
  };
47
- /** File information from the database. */
44
+ /** File information. */
48
45
  file: {
49
- id?: number;
50
- filepath?: string;
51
46
  fileType?: string;
52
- fileRole?: string;
53
- filesizeBytes?: number;
54
- name?: string;
55
- url?: string;
47
+ filePath?: string;
56
48
  };
57
- /** Current book state from the database, including manually-edited fields. */
49
+ }
50
+
51
+ /** A single search result from metadataEnricher.search(). */
52
+ export interface SearchResult {
53
+ title: string;
54
+ authors?: string[];
55
+ description?: string;
56
+ imageUrl?: string;
57
+ releaseDate?: string;
58
+ publisher?: string;
59
+ identifiers?: Array<{ type: string; value: string }>;
60
+ /** Opaque data passed back to enrich(). Use this to store internal IDs. */
61
+ providerData?: unknown;
62
+ }
63
+
64
+ /** Result returned from metadataEnricher.search(). */
65
+ export interface SearchResponse {
66
+ results: SearchResult[];
67
+ }
68
+
69
+ /** Context passed to metadataEnricher.enrich(). */
70
+ export interface EnrichContext {
71
+ /** The selected search result's providerData. */
72
+ selectedResult: unknown;
73
+ /** Current book state from the database. */
58
74
  book: {
59
75
  id?: number;
60
76
  title?: string;
@@ -67,6 +83,11 @@ export interface MetadataEnricherContext {
67
83
  identifiers?: Array<{ type: string; value: string }>;
68
84
  publisher?: string;
69
85
  };
86
+ /** File information. */
87
+ file: {
88
+ fileType?: string;
89
+ filePath?: string;
90
+ };
70
91
  }
71
92
 
72
93
  /** Result returned from metadataEnricher.enrich(). */
@@ -131,7 +152,10 @@ export interface FileParserHook {
131
152
 
132
153
  /** Metadata enricher hook. */
133
154
  export interface MetadataEnricherHook {
134
- enrich(context: MetadataEnricherContext): EnrichmentResult;
155
+ /** Search for candidate results from external sources. */
156
+ search(context: SearchContext): SearchResponse;
157
+ /** Enrich metadata from a selected search result. */
158
+ enrich(context: EnrichContext): EnrichmentResult;
135
159
  }
136
160
 
137
161
  /** Output generator hook. */
@@ -146,4 +170,11 @@ export interface ShishoPlugin {
146
170
  fileParser?: FileParserHook;
147
171
  metadataEnricher?: MetadataEnricherHook;
148
172
  outputGenerator?: OutputGeneratorHook;
173
+
174
+ /**
175
+ * Optional lifecycle hook called before the plugin is uninstalled.
176
+ * Use this to clean up resources (revoke tokens, delete caches, close connections).
177
+ * Errors in this hook do not prevent uninstall.
178
+ */
179
+ onUninstalling?: () => void;
149
180
  }
package/host-api.d.ts CHANGED
@@ -343,6 +343,8 @@ export interface ShishoShell {
343
343
 
344
344
  /** Top-level host API object available as the global `shisho` variable. */
345
345
  export interface ShishoHostAPI {
346
+ /** Persistent data directory for this plugin. Created lazily on first access. */
347
+ readonly dataDir: string;
346
348
  log: ShishoLog;
347
349
  config: ShishoConfig;
348
350
  http: ShishoHTTP;
package/manifest.d.ts CHANGED
@@ -153,6 +153,8 @@ export interface PluginManifest {
153
153
  name: string;
154
154
  /** Semver version string. */
155
155
  version: string;
156
+ /** Short one-liner overview (separate from longer description). */
157
+ overview?: string;
156
158
  description?: string;
157
159
  author?: string;
158
160
  homepage?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisho/plugin-types",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "TypeScript type definitions for Shisho plugin development",
5
5
  "homepage": "https://github.com/shishobooks/shisho/blob/master/packages/plugin-types/README.md",
6
6
  "types": "index.d.ts",