happy-coder 0.1.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.
Files changed (50) hide show
  1. package/README.md +38 -0
  2. package/bin/happy +2 -0
  3. package/bin/happy.cmd +2 -0
  4. package/dist/auth/auth.d.ts +38 -0
  5. package/dist/auth/auth.js +76 -0
  6. package/dist/auth/auth.test.d.ts +7 -0
  7. package/dist/auth/auth.test.js +96 -0
  8. package/dist/auth/crypto.d.ts +25 -0
  9. package/dist/auth/crypto.js +36 -0
  10. package/dist/claude/claude.d.ts +54 -0
  11. package/dist/claude/claude.js +170 -0
  12. package/dist/claude/claude.test.d.ts +7 -0
  13. package/dist/claude/claude.test.js +130 -0
  14. package/dist/claude/types.d.ts +37 -0
  15. package/dist/claude/types.js +7 -0
  16. package/dist/commands/start.d.ts +38 -0
  17. package/dist/commands/start.js +161 -0
  18. package/dist/commands/start.test.d.ts +7 -0
  19. package/dist/commands/start.test.js +307 -0
  20. package/dist/handlers/message-handler.d.ts +65 -0
  21. package/dist/handlers/message-handler.js +187 -0
  22. package/dist/index.cjs +603 -0
  23. package/dist/index.d.cts +1 -0
  24. package/dist/index.d.mts +1 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/index.mjs +583 -0
  28. package/dist/session/service.d.ts +27 -0
  29. package/dist/session/service.js +93 -0
  30. package/dist/session/service.test.d.ts +7 -0
  31. package/dist/session/service.test.js +71 -0
  32. package/dist/session/types.d.ts +44 -0
  33. package/dist/session/types.js +4 -0
  34. package/dist/socket/client.d.ts +50 -0
  35. package/dist/socket/client.js +136 -0
  36. package/dist/socket/client.test.d.ts +7 -0
  37. package/dist/socket/client.test.js +74 -0
  38. package/dist/socket/types.d.ts +80 -0
  39. package/dist/socket/types.js +12 -0
  40. package/dist/utils/config.d.ts +22 -0
  41. package/dist/utils/config.js +23 -0
  42. package/dist/utils/logger.d.ts +26 -0
  43. package/dist/utils/logger.js +60 -0
  44. package/dist/utils/paths.d.ts +18 -0
  45. package/dist/utils/paths.js +24 -0
  46. package/dist/utils/qrcode.d.ts +19 -0
  47. package/dist/utils/qrcode.js +37 -0
  48. package/dist/utils/qrcode.test.d.ts +7 -0
  49. package/dist/utils/qrcode.test.js +14 -0
  50. package/package.json +60 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * QR Code utility for handy-cli
3
+ *
4
+ * This module handles QR code generation and terminal display for the handy:// URL.
5
+ *
6
+ * Key responsibilities:
7
+ * - Generate QR codes for terminal display
8
+ * - Format QR codes with proper spacing and borders
9
+ * - Handle errors gracefully
10
+ *
11
+ * Design decisions:
12
+ * - Uses qrcode-terminal for ASCII art QR codes
13
+ * - Displays QR codes with clear instructions
14
+ * - Provides fallback text if QR generation fails
15
+ */
16
+ import qrcode from 'qrcode-terminal';
17
+ import { logger } from './logger.js';
18
+ /**
19
+ * Display a QR code in the terminal for the given URL
20
+ */
21
+ export function displayQRCode(url) {
22
+ try {
23
+ logger.info('\n' + '='.repeat(50));
24
+ logger.info('📱 Scan this QR code with your mobile device:');
25
+ logger.info('='.repeat(50));
26
+ qrcode.generate(url, { small: true }, (qr) => {
27
+ console.log(qr);
28
+ });
29
+ logger.info('='.repeat(50));
30
+ logger.info(`📋 Or copy this URL manually: ${url}`);
31
+ logger.info('='.repeat(50) + '\n');
32
+ }
33
+ catch (error) {
34
+ logger.error('Failed to generate QR code:', error);
35
+ logger.info(`📋 Use this URL to connect: ${url}`);
36
+ }
37
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tests for the QR code utility
3
+ *
4
+ * These tests verify the QR code generation functionality works correctly
5
+ * and handles edge cases gracefully.
6
+ */
7
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Tests for the QR code utility
3
+ *
4
+ * These tests verify the QR code generation functionality works correctly
5
+ * and handles edge cases gracefully.
6
+ */
7
+ import { expect } from 'chai';
8
+ import { displayQRCode } from './qrcode.js';
9
+ describe('QR Code Utility', () => {
10
+ it('should render a small QR code without throwing', () => {
11
+ const testUrl = 'handy://test';
12
+ expect(() => displayQRCode(testUrl)).to.not.throw();
13
+ });
14
+ });
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "happy-coder",
3
+ "version": "0.1.1",
4
+ "description": "Claude Code session sharing CLI",
5
+ "author": "Kirill Dubovitskiy",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "homepage": "https://github.com/bra1ndump/handy-cli",
9
+ "bugs": "https://github.com/bra1ndump/handy-cli/issues",
10
+ "repository": "bra1ndump/handy-cli",
11
+ "bin": {
12
+ "happy": "./bin/happy"
13
+ },
14
+ "main": "./dist/index.cjs",
15
+ "module": "./dist/index.mjs",
16
+ "types": "./dist/index.d.cts",
17
+ "exports": {
18
+ "require": {
19
+ "types": "./dist/index.d.cts",
20
+ "default": "./dist/index.cjs"
21
+ },
22
+ "import": {
23
+ "types": "./dist/index.d.mts",
24
+ "default": "./dist/index.mjs"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "bin"
30
+ ],
31
+ "scripts": {
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "build": "pkgroll",
35
+ "prepublishOnly": "yarn build && yarn test",
36
+ "dev": "yarn build && ./bin/happy"
37
+ },
38
+ "dependencies": {
39
+ "@types/qrcode-terminal": "^0.12.2",
40
+ "axios": "^1.10.0",
41
+ "chalk": "^5.4.1",
42
+ "dotenv": "^17.2.0",
43
+ "qrcode-terminal": "^0.12.0",
44
+ "socket.io-client": "^4.8.1",
45
+ "tweetnacl": "^1.0.3",
46
+ "zod": "^4.0.5"
47
+ },
48
+ "devDependencies": {
49
+ "@eslint/compat": "^1",
50
+ "@types/node": "^18",
51
+ "eslint": "^9",
52
+ "eslint-config-prettier": "^10",
53
+ "pkgroll": "^2.14.2",
54
+ "shx": "^0.3.3",
55
+ "ts-node": "^10",
56
+ "tsx": "^4.20.3",
57
+ "typescript": "^5",
58
+ "vitest": "^3.2.4"
59
+ }
60
+ }