@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.
- package/README.md +77 -29
- package/package.json +54 -47
- package/src/commands/agents.ts +145 -10
- package/src/commands/down.ts +110 -102
- package/src/commands/feedback.ts +189 -0
- package/src/commands/init.ts +8 -12
- package/src/commands/login.ts +88 -0
- package/src/commands/logout.ts +14 -0
- package/src/commands/logs.ts +21 -0
- package/src/commands/mcp.ts +134 -7
- package/src/commands/new.ts +43 -17
- package/src/commands/open.ts +13 -6
- package/src/commands/projects.ts +269 -143
- package/src/commands/secrets.ts +413 -0
- package/src/commands/services.ts +96 -123
- package/src/commands/ship.ts +5 -1
- package/src/commands/whoami.ts +31 -0
- package/src/index.ts +218 -144
- package/src/lib/agent-files.ts +34 -0
- package/src/lib/agents.ts +390 -22
- package/src/lib/asset-hash.ts +50 -0
- package/src/lib/auth/client.ts +115 -0
- package/src/lib/auth/constants.ts +5 -0
- package/src/lib/auth/guard.ts +57 -0
- package/src/lib/auth/index.ts +18 -0
- package/src/lib/auth/store.ts +54 -0
- package/src/lib/binding-validator.ts +136 -0
- package/src/lib/build-helper.ts +211 -0
- package/src/lib/cloudflare-api.ts +24 -0
- package/src/lib/config.ts +5 -6
- package/src/lib/control-plane.ts +295 -0
- package/src/lib/debug.ts +3 -1
- package/src/lib/deploy-mode.ts +93 -0
- package/src/lib/deploy-upload.ts +92 -0
- package/src/lib/errors.ts +2 -0
- package/src/lib/github.ts +31 -1
- package/src/lib/hooks.ts +4 -12
- package/src/lib/intent.ts +88 -0
- package/src/lib/jsonc.ts +125 -0
- package/src/lib/local-paths.test.ts +902 -0
- package/src/lib/local-paths.ts +258 -0
- package/src/lib/managed-deploy.ts +175 -0
- package/src/lib/managed-down.ts +159 -0
- package/src/lib/mcp-config.ts +55 -34
- package/src/lib/names.ts +9 -29
- package/src/lib/project-operations.ts +676 -249
- package/src/lib/project-resolver.ts +476 -0
- package/src/lib/registry.ts +76 -37
- package/src/lib/resources.ts +196 -0
- package/src/lib/schema.ts +30 -1
- package/src/lib/storage/file-filter.ts +1 -0
- package/src/lib/storage/index.ts +5 -1
- package/src/lib/telemetry.ts +14 -0
- package/src/lib/tty.ts +15 -0
- package/src/lib/zip-packager.ts +255 -0
- package/src/mcp/resources/index.ts +8 -2
- package/src/mcp/server.ts +32 -4
- package/src/mcp/tools/index.ts +35 -13
- package/src/mcp/types.ts +6 -0
- package/src/mcp/utils.ts +1 -1
- package/src/templates/index.ts +42 -4
- package/src/templates/types.ts +13 -0
- package/templates/CLAUDE.md +166 -0
- package/templates/api/.jack.json +4 -0
- package/templates/api/bun.lock +1 -0
- package/templates/api/wrangler.jsonc +5 -0
- package/templates/hello/.jack.json +28 -0
- package/templates/hello/package.json +10 -0
- package/templates/hello/src/index.ts +11 -0
- package/templates/hello/tsconfig.json +11 -0
- package/templates/hello/wrangler.jsonc +5 -0
- package/templates/miniapp/.jack.json +15 -4
- package/templates/miniapp/bun.lock +135 -40
- package/templates/miniapp/index.html +1 -0
- package/templates/miniapp/package.json +3 -1
- package/templates/miniapp/public/.well-known/farcaster.json +7 -5
- package/templates/miniapp/public/icon.png +0 -0
- package/templates/miniapp/public/og.png +0 -0
- package/templates/miniapp/schema.sql +8 -0
- package/templates/miniapp/src/App.tsx +254 -3
- package/templates/miniapp/src/components/ShareSheet.tsx +147 -0
- package/templates/miniapp/src/hooks/useAI.ts +35 -0
- package/templates/miniapp/src/hooks/useGuestbook.ts +11 -1
- package/templates/miniapp/src/hooks/useShare.ts +76 -0
- package/templates/miniapp/src/index.css +15 -0
- package/templates/miniapp/src/lib/api.ts +2 -1
- package/templates/miniapp/src/worker.ts +515 -1
- package/templates/miniapp/wrangler.jsonc +15 -3
- package/LICENSE +0 -190
- package/src/commands/cloud.ts +0 -230
- package/templates/api/wrangler.toml +0 -3
package/src/lib/jsonc.ts
ADDED
|
@@ -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
|
+
}
|