raindrop-cli 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 (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +422 -0
  3. package/dist/client.d.ts +7 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/commands/auth.d.ts +3 -0
  6. package/dist/commands/auth.d.ts.map +1 -0
  7. package/dist/commands/bookmarks.d.ts +3 -0
  8. package/dist/commands/bookmarks.d.ts.map +1 -0
  9. package/dist/commands/collections.d.ts +3 -0
  10. package/dist/commands/collections.d.ts.map +1 -0
  11. package/dist/commands/favorites.d.ts +3 -0
  12. package/dist/commands/favorites.d.ts.map +1 -0
  13. package/dist/commands/filters.d.ts +3 -0
  14. package/dist/commands/filters.d.ts.map +1 -0
  15. package/dist/commands/highlights.d.ts +3 -0
  16. package/dist/commands/highlights.d.ts.map +1 -0
  17. package/dist/commands/index.d.ts +9 -0
  18. package/dist/commands/index.d.ts.map +1 -0
  19. package/dist/commands/tags.d.ts +3 -0
  20. package/dist/commands/tags.d.ts.map +1 -0
  21. package/dist/commands/trash.d.ts +3 -0
  22. package/dist/commands/trash.d.ts.map +1 -0
  23. package/dist/config.d.ts +44 -0
  24. package/dist/config.d.ts.map +1 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +28827 -0
  28. package/dist/output/index.d.ts +23 -0
  29. package/dist/output/index.d.ts.map +1 -0
  30. package/dist/output/json.d.ts +6 -0
  31. package/dist/output/json.d.ts.map +1 -0
  32. package/dist/output/plain.d.ts +16 -0
  33. package/dist/output/plain.d.ts.map +1 -0
  34. package/dist/output/table.d.ts +3 -0
  35. package/dist/output/table.d.ts.map +1 -0
  36. package/dist/output/tree.d.ts +23 -0
  37. package/dist/output/tree.d.ts.map +1 -0
  38. package/dist/output/tsv.d.ts +3 -0
  39. package/dist/output/tsv.d.ts.map +1 -0
  40. package/dist/output/utils.d.ts +3 -0
  41. package/dist/output/utils.d.ts.map +1 -0
  42. package/dist/types/index.d.ts +13 -0
  43. package/dist/types/index.d.ts.map +1 -0
  44. package/dist/utils/axios-interceptors.d.ts +44 -0
  45. package/dist/utils/axios-interceptors.d.ts.map +1 -0
  46. package/dist/utils/collections.d.ts +18 -0
  47. package/dist/utils/collections.d.ts.map +1 -0
  48. package/dist/utils/colors.d.ts +61 -0
  49. package/dist/utils/colors.d.ts.map +1 -0
  50. package/dist/utils/command-options.d.ts +15 -0
  51. package/dist/utils/command-options.d.ts.map +1 -0
  52. package/dist/utils/debug.d.ts +45 -0
  53. package/dist/utils/debug.d.ts.map +1 -0
  54. package/dist/utils/errors.d.ts +38 -0
  55. package/dist/utils/errors.d.ts.map +1 -0
  56. package/dist/utils/help-formatter.d.ts +80 -0
  57. package/dist/utils/help-formatter.d.ts.map +1 -0
  58. package/dist/utils/output-streams.d.ts +35 -0
  59. package/dist/utils/output-streams.d.ts.map +1 -0
  60. package/dist/utils/pagination.d.ts +13 -0
  61. package/dist/utils/pagination.d.ts.map +1 -0
  62. package/dist/utils/progress.d.ts +29 -0
  63. package/dist/utils/progress.d.ts.map +1 -0
  64. package/dist/utils/prompt.d.ts +32 -0
  65. package/dist/utils/prompt.d.ts.map +1 -0
  66. package/dist/utils/spinner.d.ts +69 -0
  67. package/dist/utils/spinner.d.ts.map +1 -0
  68. package/dist/utils/stdin.d.ts +31 -0
  69. package/dist/utils/stdin.d.ts.map +1 -0
  70. package/dist/utils/timeout.d.ts +35 -0
  71. package/dist/utils/timeout.d.ts.map +1 -0
  72. package/dist/utils/tree.d.ts +51 -0
  73. package/dist/utils/tree.d.ts.map +1 -0
  74. package/dist/utils/tty.d.ts +32 -0
  75. package/dist/utils/tty.d.ts.map +1 -0
  76. package/dist/utils/validation.d.ts +28 -0
  77. package/dist/utils/validation.d.ts.map +1 -0
  78. package/package.json +87 -0
@@ -0,0 +1,23 @@
1
+ import type { OutputFormat } from "../types/index.js";
2
+ export interface OutputOptions {
3
+ format?: OutputFormat;
4
+ quiet: boolean;
5
+ verbose: boolean;
6
+ debug: boolean;
7
+ }
8
+ /**
9
+ * Style hints for terminal formatters (plain, table).
10
+ * These are ignored by data formats (json, tsv).
11
+ */
12
+ export type ColumnStyle = "bold" | "dim" | "cyan" | "none";
13
+ export interface ColumnConfig {
14
+ key: string;
15
+ header: string;
16
+ width?: number;
17
+ /** If true, display prominently without label (for title/URL in plain format) */
18
+ prominent?: boolean;
19
+ /** Style hint for terminal formatters. Ignored by json/tsv. Default: none */
20
+ style?: ColumnStyle;
21
+ }
22
+ export declare function output<T>(data: T, columns: ColumnConfig[], options: OutputOptions): void;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQtD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA2CxF"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Format data as JSON.
3
+ * Data should be clean (no ANSI codes) - styling is applied only by terminal formatters.
4
+ */
5
+ export declare function formatJson<T>(data: T): string;
6
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/output/json.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,16 @@
1
+ import type { ColumnConfig } from "./index.js";
2
+ /**
3
+ * Format data as styled plain text with labeled fields.
4
+ * Each record is displayed as multi-line with icons, colors, and proper formatting.
5
+ * Records are separated by a styled divider.
6
+ *
7
+ * Features:
8
+ * - Prominent fields (title/URL) displayed without labels, bold/cyan
9
+ * - Emoji icons for regular field types
10
+ * - Bold field labels
11
+ * - Dimmed placeholder for empty values
12
+ * - Proper indentation for multiline content
13
+ * - Newlines around separators for visual breathing room
14
+ */
15
+ export declare function formatPlain<T>(data: T, columns: ColumnConfig[]): string;
16
+ //# sourceMappingURL=plain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../src/output/plain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAqK5D;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CA6EvE"}
@@ -0,0 +1,3 @@
1
+ import type { ColumnConfig } from "./index.js";
2
+ export declare function formatTable<T>(data: T, columns: ColumnConfig[]): string;
3
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/output/table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAuB5D,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAiBvE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Tree-specific output formatting.
3
+ *
4
+ * Trees need special handling because:
5
+ * - Terminal output should show a compact tree structure (not separate cards)
6
+ * - Data formats (JSON/TSV) should output clean structured data (not visual characters)
7
+ */
8
+ import type { OutputFormat } from "../types/index.js";
9
+ import type { TreeNode, TreeItem } from "../utils/tree.js";
10
+ export interface TreeOutputOptions {
11
+ format?: OutputFormat;
12
+ quiet: boolean;
13
+ }
14
+ /**
15
+ * Output tree data with format-appropriate rendering.
16
+ *
17
+ * - quiet: Just output IDs
18
+ * - json: Structured data with title, _id, count, parentId, depth
19
+ * - tsv: Same structured data as TSV
20
+ * - plain/table: Compact tree visualization
21
+ */
22
+ export declare function outputTree<T extends TreeItem>(tree: TreeNode<T>[], options: TreeOutputOptions): void;
23
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/output/tree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK3D,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB;AAoID;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAC3C,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EACnB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CA0CN"}
@@ -0,0 +1,3 @@
1
+ import type { ColumnConfig } from "./index.js";
2
+ export declare function formatTsv<T>(data: T, columns: ColumnConfig[]): string;
3
+ //# sourceMappingURL=tsv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsv.d.ts","sourceRoot":"","sources":["../../src/output/tsv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAmB/C,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAcrE"}
@@ -0,0 +1,3 @@
1
+ export declare function getNestedValue(obj: unknown, path: string): unknown;
2
+ export declare function formatValue(value: unknown): string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/output/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAclE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYlD"}
@@ -0,0 +1,13 @@
1
+ export declare const OUTPUT_FORMATS: readonly ["json", "table", "tsv", "plain"];
2
+ export type OutputFormat = (typeof OUTPUT_FORMATS)[number];
3
+ export interface GlobalOptions {
4
+ format?: OutputFormat;
5
+ json?: boolean;
6
+ quiet: boolean;
7
+ verbose: boolean;
8
+ debug: boolean;
9
+ }
10
+ export interface CommandContext {
11
+ options: GlobalOptions;
12
+ }
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,4CAA6C,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,aAAa,CAAC;CACxB"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Axios interceptors for the Raindrop API client.
3
+ *
4
+ * Provides:
5
+ * - Request/response logging (verbose mode)
6
+ * - Automatic retry with exponential backoff for transient errors
7
+ * - Rate limit detection and RateLimitError throwing
8
+ * - Error transformation to ApiError
9
+ */
10
+ import type { AxiosInstance, AxiosError } from "axios";
11
+ declare const MAX_RETRIES = 3;
12
+ declare const INITIAL_DELAY_MS = 1000;
13
+ declare const MAX_DELAY_MS = 30000;
14
+ /**
15
+ * Check if an error is retryable (transient).
16
+ * Retryable: network errors, 5xx server errors, 408 timeout.
17
+ * NOT retryable: 429 (handled separately), 4xx client errors.
18
+ */
19
+ export declare function isRetryableError(error: AxiosError): boolean;
20
+ /**
21
+ * Calculate exponential backoff delay with jitter.
22
+ * Formula: min(initialDelay * 2^retryCount + jitter, maxDelay)
23
+ */
24
+ export declare function calculateBackoff(retryCount: number): number;
25
+ /**
26
+ * Get the API delay from environment variable.
27
+ * Used to throttle requests during live tests to avoid rate limits.
28
+ */
29
+ declare function getApiDelayMs(): number;
30
+ /**
31
+ * Extract rate limit info from response headers.
32
+ */
33
+ export declare function extractRateLimitInfo(headers: Record<string, string>): {
34
+ limit?: number;
35
+ remaining?: number;
36
+ reset?: number;
37
+ };
38
+ /**
39
+ * Configure Axios interceptors on a Raindrop client instance.
40
+ * Call this after creating the client.
41
+ */
42
+ export declare function setupClientInterceptors(axiosInstance: AxiosInstance): void;
43
+ export { MAX_RETRIES, INITIAL_DELAY_MS, MAX_DELAY_MS, getApiDelayMs };
44
+ //# sourceMappingURL=axios-interceptors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios-interceptors.d.ts","sourceRoot":"","sources":["../../src/utils/axios-interceptors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAA6C,MAAM,OAAO,CAAC;AAWlG,QAAA,MAAM,WAAW,IAAI,CAAC;AACtB,QAAA,MAAM,gBAAgB,OAAO,CAAC;AAC9B,QAAA,MAAM,YAAY,QAAQ,CAAC;AAQ3B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAmB3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK3D;AASD;;;GAGG;AACH,iBAAS,aAAa,IAAI,MAAM,CAS/B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAQA;AA2JD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAG1E;AAGD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared utilities for collection ID parsing and special collections.
3
+ */
4
+ /**
5
+ * Special collection IDs in Raindrop.io
6
+ */
7
+ export declare const SPECIAL_COLLECTIONS: {
8
+ readonly all: 0;
9
+ readonly unsorted: -1;
10
+ readonly trash: -99;
11
+ };
12
+ export type SpecialCollectionName = keyof typeof SPECIAL_COLLECTIONS;
13
+ /**
14
+ * Parse collection ID from string argument.
15
+ * Supports numeric IDs and special names (all, unsorted, trash).
16
+ */
17
+ export declare function parseCollectionId(value: string | undefined): number;
18
+ //# sourceMappingURL=collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/utils/collections.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAErE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAmBnE"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Color utilities for CLI output.
3
+ *
4
+ * Uses picocolors for terminal coloring, with automatic detection
5
+ * of when colors should be disabled (NO_COLOR, --no-color, non-TTY, etc).
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { colors } from "./utils/colors.js";
10
+ * console.log(colors.red("Error!"));
11
+ * console.log(colors.bold(colors.green("Success")));
12
+ * ```
13
+ */
14
+ type ColorFunction = (text: string | number) => string;
15
+ interface Colors {
16
+ reset: ColorFunction;
17
+ bold: ColorFunction;
18
+ dim: ColorFunction;
19
+ italic: ColorFunction;
20
+ underline: ColorFunction;
21
+ inverse: ColorFunction;
22
+ hidden: ColorFunction;
23
+ strikethrough: ColorFunction;
24
+ black: ColorFunction;
25
+ red: ColorFunction;
26
+ green: ColorFunction;
27
+ yellow: ColorFunction;
28
+ blue: ColorFunction;
29
+ magenta: ColorFunction;
30
+ cyan: ColorFunction;
31
+ white: ColorFunction;
32
+ gray: ColorFunction;
33
+ bgBlack: ColorFunction;
34
+ bgRed: ColorFunction;
35
+ bgGreen: ColorFunction;
36
+ bgYellow: ColorFunction;
37
+ bgBlue: ColorFunction;
38
+ bgMagenta: ColorFunction;
39
+ bgCyan: ColorFunction;
40
+ bgWhite: ColorFunction;
41
+ }
42
+ /**
43
+ * Get the colors object, respecting NO_COLOR, --no-color, and TTY detection.
44
+ *
45
+ * Note: This checks shouldUseColor() on each call, so the --no-color flag
46
+ * can be set after import and will still be respected.
47
+ */
48
+ export declare function getColors(): Colors;
49
+ /**
50
+ * Convenience export for direct usage.
51
+ * Use getColors() if you need dynamic color detection after flag parsing.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * import { colors } from "./utils/colors.js";
56
+ * console.log(colors.red("Error"));
57
+ * ```
58
+ */
59
+ export declare const colors: Colors;
60
+ export {};
61
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;AAEvD,UAAU,MAAM;IAEd,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,aAAa,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAG7B,KAAK,EAAE,aAAa,CAAC;IACrB,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;IAGpB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;CACxB;AAkCD;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,QAIjB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Command } from "commander";
2
+ /**
3
+ * Add global output options to a subcommand.
4
+ *
5
+ * Commander.js doesn't automatically make program-level options available
6
+ * when placed after subcommand names. This helper adds the common output
7
+ * options to subcommands so users can write:
8
+ * rdcli bookmarks list -q
9
+ * instead of:
10
+ * rdcli -q bookmarks list
11
+ *
12
+ * The options are still accessed via `this.optsWithGlobals()` in actions.
13
+ */
14
+ export declare function addOutputOptions(cmd: Command): Command;
15
+ //# sourceMappingURL=command-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-options.d.ts","sourceRoot":"","sources":["../../src/utils/command-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAG5C;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQtD"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Debug and verbose output utilities.
3
+ *
4
+ * Per clig.dev guidelines:
5
+ * - --debug: Show stack traces, internal state, detailed error info
6
+ * - --verbose: Show operational details (what's happening, timing, API calls)
7
+ *
8
+ * Both output to stderr to keep stdout clean for data.
9
+ */
10
+ /**
11
+ * Set the debug flag (typically from CLI --debug option)
12
+ */
13
+ export declare function setDebugEnabled(enabled: boolean): void;
14
+ /**
15
+ * Set the verbose flag (typically from CLI --verbose option)
16
+ */
17
+ export declare function setVerboseEnabled(enabled: boolean): void;
18
+ /**
19
+ * Check if debug mode is enabled
20
+ */
21
+ export declare function isDebugEnabled(): boolean;
22
+ /**
23
+ * Check if verbose mode is enabled
24
+ */
25
+ export declare function isVerboseEnabled(): boolean;
26
+ /**
27
+ * Output debug information (stack traces, internal state).
28
+ * Only outputs when --debug flag is set.
29
+ */
30
+ export declare function debug(message: string, data?: unknown): void;
31
+ /**
32
+ * Output verbose operational information (API calls, timing).
33
+ * Only outputs when --verbose flag is set.
34
+ */
35
+ export declare function verbose(message: string): void;
36
+ /**
37
+ * Time an async operation and log it (verbose mode only).
38
+ * Returns the result of the operation.
39
+ */
40
+ export declare function verboseTime<T>(label: string, operation: () => Promise<T>): Promise<T>;
41
+ /**
42
+ * Reset debug/verbose state (useful for testing)
43
+ */
44
+ export declare function resetDebugState(): void;
45
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAe3D;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG7C;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAkB3F;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
@@ -0,0 +1,38 @@
1
+ export declare class RaindropCliError extends Error {
2
+ code: string;
3
+ details?: Record<string, unknown> | undefined;
4
+ exitCode: number;
5
+ constructor(message: string, code: string, details?: Record<string, unknown> | undefined, exitCode?: number);
6
+ toJSON(): object;
7
+ }
8
+ export declare class UsageError extends RaindropCliError {
9
+ constructor(message: string, details?: Record<string, unknown>);
10
+ }
11
+ export declare class ConfigError extends RaindropCliError {
12
+ constructor(message: string, details?: Record<string, unknown>);
13
+ }
14
+ export declare class ApiError extends RaindropCliError {
15
+ statusCode?: number | undefined;
16
+ constructor(message: string, statusCode?: number | undefined, details?: Record<string, unknown>);
17
+ }
18
+ export declare class RateLimitError extends RaindropCliError {
19
+ limit: number;
20
+ resetTime: number;
21
+ constructor(limit: number, resetTime: number);
22
+ }
23
+ export declare class TimeoutError extends RaindropCliError {
24
+ timeoutSeconds: number;
25
+ constructor(timeoutSeconds: number, details?: Record<string, unknown>);
26
+ }
27
+ /**
28
+ * Handle and output an error, then exit.
29
+ *
30
+ * When --debug is enabled:
31
+ * - Shows error details for RaindropCliError
32
+ * - Shows stack traces for all errors
33
+ *
34
+ * @param error - The error to handle
35
+ * @param debugOverride - Override the global debug flag (for testing)
36
+ */
37
+ export declare function handleError(error: unknown, debugOverride?: boolean): never;
38
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAiB,SAAQ,KAAK;IAGhC,IAAI,EAAE,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjC,QAAQ;gBAHf,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA,EACjC,QAAQ,SAAI;IAMrB,MAAM,IAAI,MAAM;CAQjB;AAED,qBAAa,UAAW,SAAQ,gBAAgB;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,WAAY,SAAQ,gBAAgB;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,QAAS,SAAQ,gBAAgB;IAGnC,UAAU,CAAC,EAAE,MAAM;gBAD1B,OAAO,EAAE,MAAM,EACR,UAAU,CAAC,EAAE,MAAM,YAAA,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAKpC;AAED,qBAAa,cAAe,SAAQ,gBAAgB;IAEzC,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;gBADjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;CAU3B;AAED,qBAAa,YAAa,SAAQ,gBAAgB;IAEvC,cAAc,EAAE,MAAM;gBAAtB,cAAc,EAAE,MAAM,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAUpC;AA2DD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,KAAK,CAkC1E"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Styled help formatter for Commander.js
3
+ *
4
+ * Adds color and formatting to help text while respecting TTY detection
5
+ * and NO_COLOR environment variable. Falls back to plain text in non-TTY
6
+ * environments.
7
+ *
8
+ * Styling approach (conservative, per clig.dev recommendations):
9
+ * - Bold: Section headers (Usage:, Options:, Commands:)
10
+ * - Cyan: Command and subcommand names
11
+ * - Yellow: Option flags (-h, --help)
12
+ * - Dim: Metadata like defaults, choices, argument placeholders
13
+ */
14
+ import { Help, Command } from "commander";
15
+ /**
16
+ * Custom Help class that adds styling to Commander's help output.
17
+ * Uses Commander's built-in style methods for consistent formatting.
18
+ */
19
+ export declare class StyledHelp extends Help {
20
+ /**
21
+ * Style section titles like "Usage:", "Options:", "Commands:"
22
+ */
23
+ styleTitle(title: string): string;
24
+ /**
25
+ * Style the usage string (the part after "Usage:")
26
+ * e.g., "rd bookmarks list|ls [options] [collection-id]"
27
+ */
28
+ styleUsage(str: string): string;
29
+ /**
30
+ * Style command name in usage string
31
+ */
32
+ styleCommandText(str: string): string;
33
+ /**
34
+ * Style option flags like "-h, --help" or "--format <format>"
35
+ * The flag part is yellow, argument placeholders are dim.
36
+ */
37
+ styleOptionText(str: string): string;
38
+ /**
39
+ * Style subcommand names in the command list
40
+ */
41
+ styleSubcommandText(str: string): string;
42
+ /**
43
+ * Style argument placeholders like "<id>" or "[collection-id]"
44
+ */
45
+ styleArgumentText(str: string): string;
46
+ /**
47
+ * Style option descriptions, dimming metadata like (default:) and (choices:)
48
+ */
49
+ styleOptionDescription(str: string): string;
50
+ /**
51
+ * Style subcommand descriptions, dimming metadata like (alias:) and (shortcut for:)
52
+ */
53
+ styleSubcommandDescription(str: string): string;
54
+ /**
55
+ * Style argument descriptions
56
+ */
57
+ styleArgumentDescription(str: string): string;
58
+ /**
59
+ * Format a list of items with a heading.
60
+ * Adds a blank line after the heading for better readability.
61
+ */
62
+ formatItemList(heading: string, items: string[], helper: Help): string[];
63
+ }
64
+ /**
65
+ * Configure a Command to use styled help output.
66
+ * Must be called on each command (including subcommands) for styling to apply.
67
+ *
68
+ * The styling automatically respects:
69
+ * - NO_COLOR environment variable
70
+ * - --no-color flag
71
+ * - TTY detection (no colors when piped)
72
+ * - TERM=dumb
73
+ */
74
+ export declare function configureStyledHelp(cmd: Command): void;
75
+ /**
76
+ * Recursively configure styled help on a command and all its subcommands.
77
+ * Call this on your root program after all commands have been added.
78
+ */
79
+ export declare function configureStyledHelpRecursive(program: Command): void;
80
+ //# sourceMappingURL=help-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/help-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAClC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIjC;;;OAGG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IA2B/B;;OAEG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC;;;OAGG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAepC;;OAEG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIxC;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAItC;;OAEG;IACH,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI3C;;OAEG;IACH,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI/C;;OAEG;IACH,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE;CAKzE;AA4CD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAKnE"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Semantic output utilities for proper stdout/stderr separation.
3
+ *
4
+ * Per clig.dev guidelines:
5
+ * - stdout: primary output, machine-readable data
6
+ * - stderr: log messages, errors, warnings, progress
7
+ *
8
+ * This enables proper piping (e.g., `rd raindrops list | jq`).
9
+ */
10
+ /**
11
+ * Output data to stdout. Use for primary output that may be piped.
12
+ * Examples: JSON data, table output, IDs in quiet mode
13
+ */
14
+ export declare function outputData(message: string): void;
15
+ /**
16
+ * Output a message to stderr. Use for informational/status messages.
17
+ * Examples: "Validating token...", "Token saved successfully!"
18
+ */
19
+ export declare function outputMessage(message: string): void;
20
+ /**
21
+ * Output an error to stderr. Use for errors and warnings.
22
+ * Examples: "Invalid token", "Warning: Rate limit approaching"
23
+ */
24
+ export declare function outputError(message: string): void;
25
+ /**
26
+ * Output data without trailing newline. Use for partial output.
27
+ * TODO: Currently unused - reserved for future streaming output (rd-8o9)
28
+ */
29
+ export declare function outputDataRaw(message: string): void;
30
+ /**
31
+ * Output message without trailing newline. Use for progress/spinners.
32
+ * TODO: Currently unused - reserved for future progress indicators (rd-8o9)
33
+ */
34
+ export declare function outputMessageRaw(message: string): void;
35
+ //# sourceMappingURL=output-streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-streams.d.ts","sourceRoot":"","sources":["../../src/utils/output-streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEtD"}
@@ -0,0 +1,13 @@
1
+ export interface PaginationOptions {
2
+ page?: number;
3
+ perPage?: number;
4
+ }
5
+ export interface PaginatedResult<T> {
6
+ items: T[];
7
+ count: number;
8
+ page: number;
9
+ perPage: number;
10
+ hasMore: boolean;
11
+ }
12
+ export declare function createPaginatedResult<T>(items: T[], count: number, page: number, perPage: number): PaginatedResult<T>;
13
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,EAAE,EACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,eAAe,CAAC,CAAC,CAAC,CAQpB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Combined progress utility that provides both verbose timing and spinner feedback.
3
+ *
4
+ * This combines the behavior of verboseTime (for --verbose mode) and withSpinner
5
+ * (for interactive terminal feedback) into a single, unified API.
6
+ *
7
+ * Behavior:
8
+ * - Verbose mode: Shows timing information (via verboseTime)
9
+ * - Normal TTY mode: Shows spinner (via withSpinner)
10
+ * - Non-TTY mode: Silent execution
11
+ */
12
+ /**
13
+ * Execute an async operation with appropriate progress feedback.
14
+ *
15
+ * In verbose mode, shows timing information.
16
+ * In normal TTY mode, shows a spinner.
17
+ * In non-TTY mode (piped/scripted), runs silently.
18
+ *
19
+ * @param message - Message describing the operation (shown in spinner and verbose output)
20
+ * @param operation - Async operation to execute
21
+ * @returns The result of the operation
22
+ *
23
+ * @example
24
+ * const response = await withProgress("Fetching bookmarks", () =>
25
+ * client.raindrop.getRaindrops(collectionId)
26
+ * );
27
+ */
28
+ export declare function withProgress<T>(message: string, operation: () => Promise<T>): Promise<T>;
29
+ //# sourceMappingURL=progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/utils/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAK9F"}
@@ -0,0 +1,32 @@
1
+ import type { Interface as ReadlineInterface } from "node:readline";
2
+ import { UsageError } from "./errors.js";
3
+ /**
4
+ * Error thrown when attempting to prompt in a non-interactive context.
5
+ * Extends UsageError because it's a usage issue (user needs --force in non-interactive mode).
6
+ */
7
+ export declare class NonInteractiveError extends UsageError {
8
+ constructor(message: string);
9
+ }
10
+ /**
11
+ * Check if stdin is a TTY (interactive terminal).
12
+ * Returns false when input is piped or redirected.
13
+ */
14
+ export declare function isStdinTTY(): boolean;
15
+ /**
16
+ * Options for confirmAction, primarily for testing.
17
+ */
18
+ export interface ConfirmActionOptions {
19
+ /** Custom readline interface (for testing) */
20
+ rl?: ReadlineInterface;
21
+ /** Skip TTY check (for testing) */
22
+ skipTTYCheck?: boolean;
23
+ }
24
+ /**
25
+ * Prompt the user for confirmation.
26
+ * Returns true if the user enters 'y', 'yes', 'Y', or 'YES', false otherwise.
27
+ * Returns false if the user sends EOF (Ctrl+D).
28
+ *
29
+ * @throws {NonInteractiveError} if stdin is not a TTY (non-interactive context)
30
+ */
31
+ export declare function confirmAction(message: string, options?: ConfirmActionOptions): Promise<boolean>;
32
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,mCAAmC;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,OAAO,CAAC,CAkClB"}