@getjack/jack 0.1.2 → 0.1.4

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 (91) hide show
  1. package/README.md +77 -29
  2. package/package.json +54 -47
  3. package/src/commands/agents.ts +145 -10
  4. package/src/commands/down.ts +110 -102
  5. package/src/commands/feedback.ts +189 -0
  6. package/src/commands/init.ts +8 -12
  7. package/src/commands/login.ts +88 -0
  8. package/src/commands/logout.ts +14 -0
  9. package/src/commands/logs.ts +21 -0
  10. package/src/commands/mcp.ts +134 -7
  11. package/src/commands/new.ts +43 -17
  12. package/src/commands/open.ts +13 -6
  13. package/src/commands/projects.ts +269 -143
  14. package/src/commands/secrets.ts +413 -0
  15. package/src/commands/services.ts +96 -123
  16. package/src/commands/ship.ts +5 -1
  17. package/src/commands/whoami.ts +31 -0
  18. package/src/index.ts +218 -144
  19. package/src/lib/agent-files.ts +34 -0
  20. package/src/lib/agents.ts +390 -22
  21. package/src/lib/asset-hash.ts +50 -0
  22. package/src/lib/auth/client.ts +115 -0
  23. package/src/lib/auth/constants.ts +5 -0
  24. package/src/lib/auth/guard.ts +57 -0
  25. package/src/lib/auth/index.ts +18 -0
  26. package/src/lib/auth/store.ts +54 -0
  27. package/src/lib/binding-validator.ts +136 -0
  28. package/src/lib/build-helper.ts +211 -0
  29. package/src/lib/cloudflare-api.ts +24 -0
  30. package/src/lib/config.ts +5 -6
  31. package/src/lib/control-plane.ts +295 -0
  32. package/src/lib/debug.ts +3 -1
  33. package/src/lib/deploy-mode.ts +93 -0
  34. package/src/lib/deploy-upload.ts +92 -0
  35. package/src/lib/errors.ts +2 -0
  36. package/src/lib/github.ts +31 -1
  37. package/src/lib/hooks.ts +4 -12
  38. package/src/lib/intent.ts +88 -0
  39. package/src/lib/jsonc.ts +125 -0
  40. package/src/lib/local-paths.test.ts +902 -0
  41. package/src/lib/local-paths.ts +258 -0
  42. package/src/lib/managed-deploy.ts +175 -0
  43. package/src/lib/managed-down.ts +159 -0
  44. package/src/lib/mcp-config.ts +55 -34
  45. package/src/lib/names.ts +9 -29
  46. package/src/lib/project-operations.ts +676 -249
  47. package/src/lib/project-resolver.ts +476 -0
  48. package/src/lib/registry.ts +76 -37
  49. package/src/lib/resources.ts +196 -0
  50. package/src/lib/schema.ts +30 -1
  51. package/src/lib/storage/file-filter.ts +1 -0
  52. package/src/lib/storage/index.ts +5 -1
  53. package/src/lib/telemetry.ts +14 -0
  54. package/src/lib/tty.ts +15 -0
  55. package/src/lib/zip-packager.ts +255 -0
  56. package/src/mcp/resources/index.ts +8 -2
  57. package/src/mcp/server.ts +32 -4
  58. package/src/mcp/tools/index.ts +35 -13
  59. package/src/mcp/types.ts +6 -0
  60. package/src/mcp/utils.ts +1 -1
  61. package/src/templates/index.ts +42 -4
  62. package/src/templates/types.ts +13 -0
  63. package/templates/CLAUDE.md +166 -0
  64. package/templates/api/.jack.json +4 -0
  65. package/templates/api/bun.lock +1 -0
  66. package/templates/api/wrangler.jsonc +5 -0
  67. package/templates/hello/.jack.json +28 -0
  68. package/templates/hello/package.json +10 -0
  69. package/templates/hello/src/index.ts +11 -0
  70. package/templates/hello/tsconfig.json +11 -0
  71. package/templates/hello/wrangler.jsonc +5 -0
  72. package/templates/miniapp/.jack.json +15 -4
  73. package/templates/miniapp/bun.lock +135 -40
  74. package/templates/miniapp/index.html +1 -0
  75. package/templates/miniapp/package.json +3 -1
  76. package/templates/miniapp/public/.well-known/farcaster.json +7 -5
  77. package/templates/miniapp/public/icon.png +0 -0
  78. package/templates/miniapp/public/og.png +0 -0
  79. package/templates/miniapp/schema.sql +8 -0
  80. package/templates/miniapp/src/App.tsx +254 -3
  81. package/templates/miniapp/src/components/ShareSheet.tsx +147 -0
  82. package/templates/miniapp/src/hooks/useAI.ts +35 -0
  83. package/templates/miniapp/src/hooks/useGuestbook.ts +11 -1
  84. package/templates/miniapp/src/hooks/useShare.ts +76 -0
  85. package/templates/miniapp/src/index.css +15 -0
  86. package/templates/miniapp/src/lib/api.ts +2 -1
  87. package/templates/miniapp/src/worker.ts +515 -1
  88. package/templates/miniapp/wrangler.jsonc +15 -3
  89. package/LICENSE +0 -190
  90. package/src/commands/cloud.ts +0 -230
  91. package/templates/api/wrangler.toml +0 -3
@@ -0,0 +1,125 @@
1
+ function stripJsonc(input: string): string {
2
+ let output = "";
3
+ let inString = false;
4
+ let stringChar = "";
5
+ let escaped = false;
6
+ let inLineComment = false;
7
+ let inBlockComment = false;
8
+
9
+ for (let i = 0; i < input.length; i++) {
10
+ const char = input[i] ?? "";
11
+ const next = input[i + 1] ?? "";
12
+
13
+ if (inLineComment) {
14
+ if (char === "\n") {
15
+ inLineComment = false;
16
+ output += char;
17
+ }
18
+ continue;
19
+ }
20
+
21
+ if (inBlockComment) {
22
+ if (char === "*" && next === "/") {
23
+ inBlockComment = false;
24
+ i++;
25
+ }
26
+ continue;
27
+ }
28
+
29
+ if (inString) {
30
+ output += char;
31
+ if (escaped) {
32
+ escaped = false;
33
+ continue;
34
+ }
35
+ if (char === "\\") {
36
+ escaped = true;
37
+ continue;
38
+ }
39
+ if (char === stringChar) {
40
+ inString = false;
41
+ stringChar = "";
42
+ }
43
+ continue;
44
+ }
45
+
46
+ if (char === '"' || char === "'") {
47
+ inString = true;
48
+ stringChar = char;
49
+ output += char;
50
+ continue;
51
+ }
52
+
53
+ if (char === "/" && next === "/") {
54
+ inLineComment = true;
55
+ i++;
56
+ continue;
57
+ }
58
+
59
+ if (char === "/" && next === "*") {
60
+ inBlockComment = true;
61
+ i++;
62
+ continue;
63
+ }
64
+
65
+ output += char;
66
+ }
67
+
68
+ return output;
69
+ }
70
+
71
+ function removeTrailingCommas(input: string): string {
72
+ let output = "";
73
+ let inString = false;
74
+ let stringChar = "";
75
+ let escaped = false;
76
+
77
+ for (let i = 0; i < input.length; i++) {
78
+ const char = input[i] ?? "";
79
+
80
+ if (inString) {
81
+ output += char;
82
+ if (escaped) {
83
+ escaped = false;
84
+ continue;
85
+ }
86
+ if (char === "\\") {
87
+ escaped = true;
88
+ continue;
89
+ }
90
+ if (char === stringChar) {
91
+ inString = false;
92
+ stringChar = "";
93
+ }
94
+ continue;
95
+ }
96
+
97
+ if (char === '"' || char === "'") {
98
+ inString = true;
99
+ stringChar = char;
100
+ output += char;
101
+ continue;
102
+ }
103
+
104
+ if (char === ",") {
105
+ let nextIndex = i + 1;
106
+ while (nextIndex < input.length && /\s/.test(input[nextIndex] ?? "")) {
107
+ nextIndex++;
108
+ }
109
+ const nextChar = input[nextIndex] ?? "";
110
+ if (nextChar === "}" || nextChar === "]") {
111
+ continue;
112
+ }
113
+ }
114
+
115
+ output += char;
116
+ }
117
+
118
+ return output;
119
+ }
120
+
121
+ export function parseJsonc<T = unknown>(input: string): T {
122
+ const withoutComments = stripJsonc(input);
123
+ const withoutTrailingCommas = removeTrailingCommas(withoutComments);
124
+ return JSON.parse(withoutTrailingCommas) as T;
125
+ }