@ebowwa/terminal 0.2.1 → 0.3.1

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,102 @@
1
+ /**
2
+ * SSH Key Manager - Single Source of Truth
3
+ *
4
+ * Consolidates SSH key creation, upload, and management for Hetzner.
5
+ * Replaces duplicate ensureSSHKey() functions in api.ts and crud.ts.
6
+ *
7
+ * FEATURES:
8
+ * - Create or reuse local SSH key pairs
9
+ * - Upload public key to Hetzner if not exists
10
+ * - Handle fingerprint format conversion (SHA256 <-> MD5)
11
+ * - Provide consistent API for all SSH key operations
12
+ * - OS-specific user data directory for portable key storage
13
+ *
14
+ * ENVIRONMENT VARIABLES:
15
+ * - HETZNER_SSH_KEYS_DIR: Override default SSH keys directory
16
+ */
17
+ import type { HetznerClient } from "../lib/hetzner/client";
18
+ declare module "bun" {
19
+ interface Env {
20
+ HETZNER_SSH_KEYS_DIR?: string;
21
+ }
22
+ }
23
+ /**
24
+ * Get OS-specific user data directory for SSH keys
25
+ * - macOS: ~/Library/Application Support/com.hetzner.codespaces/ssh-keys/
26
+ * - Linux: ~/.config/com.hetzner.codespaces/ssh-keys/
27
+ * - Windows: %APPDATA%\com.hetzner.codespaces\ssh-keys\
28
+ *
29
+ * Can be overridden via .env file:
30
+ * HETZNER_SSH_KEYS_DIR=/custom/path
31
+ */
32
+ export declare function getDefaultKeysDir(): string;
33
+ /**
34
+ * SSH Key information returned by the manager
35
+ */
36
+ export interface SSHKeyInfo {
37
+ keyId: number;
38
+ keyPath: string;
39
+ fingerprint: string;
40
+ name: string;
41
+ }
42
+ /**
43
+ * Configuration for SSH key manager
44
+ */
45
+ export interface SSHKeyManagerConfig {
46
+ keyName?: string;
47
+ keysDir?: string;
48
+ }
49
+ /**
50
+ * Fingerprint format types
51
+ */
52
+ export type FingerprintFormat = "md5" | "sha256";
53
+ /**
54
+ * Convert SSH key fingerprint between formats
55
+ * Hetzner uses MD5 with colons, modern tools use SHA256
56
+ */
57
+ export declare function convertFingerprintFormat(publicKeyPath: string, format: FingerprintFormat): Promise<string>;
58
+ /**
59
+ * SSH Key Manager - Main class for managing SSH keys
60
+ */
61
+ export declare class SSHKeyManager {
62
+ private keyName;
63
+ private keysDir;
64
+ constructor(config?: SSHKeyManagerConfig);
65
+ /**
66
+ * Get the absolute path to the SSH keys directory
67
+ */
68
+ private getKeysDirPath;
69
+ /**
70
+ * Get the full path to the SSH key files (absolute path)
71
+ */
72
+ private getKeyPath;
73
+ /**
74
+ * Ensure SSH key exists locally and on Hetzner
75
+ * This is the main entry point - replaces duplicate ensureSSHKey() functions
76
+ *
77
+ * @param hetznerClient - Hetzner API client
78
+ * @returns SSH key information for server creation
79
+ */
80
+ ensureSSHKey(hetznerClient: HetznerClient): Promise<SSHKeyInfo>;
81
+ /**
82
+ * Get local key fingerprint in SHA256 format
83
+ */
84
+ getLocalFingerprint(): Promise<string | null>;
85
+ /**
86
+ * Get local key fingerprint in MD5 format (for Hetzner comparison)
87
+ */
88
+ getHetznerFingerprint(): Promise<string>;
89
+ /**
90
+ * Get the key path
91
+ */
92
+ getKeyPathValue(): string;
93
+ }
94
+ /**
95
+ * Convenience function - creates default manager and ensures SSH key
96
+ * This is a drop-in replacement for the old ensureSSHKey() functions
97
+ *
98
+ * @param hetznerClient - Hetzner API client
99
+ * @param config - Optional configuration
100
+ * @returns SSH key information
101
+ */
102
+ export declare function ensureSSHKey(hetznerClient: HetznerClient, config?: SSHKeyManagerConfig): Promise<SSHKeyInfo>;
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Terminal MCP Server
4
+ *
5
+ * Exposes terminal session management via Model Context Protocol
6
+ * Integrates with tmux, SSH, PTY, and file operations
7
+ */
8
+ export {};