@mistweaverco/kulala-core 0.1.6 → 0.18.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 (146) hide show
  1. package/dist/cli.js +232 -0
  2. package/dist/index.d.ts +2 -33
  3. package/dist/index.js +236 -14763
  4. package/dist/install-backend.js +202 -0
  5. package/dist/lib/downloader/index.d.ts +15 -0
  6. package/dist/lib/kulala-core/index.d.ts +17 -0
  7. package/dist/lib/kulala-core/types.d.ts +142 -0
  8. package/package.json +15 -22
  9. package/LICENSE +0 -21
  10. package/README.md +0 -84
  11. package/dist/index.d.ts.map +0 -1
  12. package/dist/index.js.map +0 -58
  13. package/dist/lib/auth/oauth2/acquisition.d.ts +0 -39
  14. package/dist/lib/auth/oauth2/acquisition.d.ts.map +0 -1
  15. package/dist/lib/auth/oauth2/browser-flow.d.ts +0 -62
  16. package/dist/lib/auth/oauth2/browser-flow.d.ts.map +0 -1
  17. package/dist/lib/auth/oauth2/config.d.ts +0 -17
  18. package/dist/lib/auth/oauth2/config.d.ts.map +0 -1
  19. package/dist/lib/auth/oauth2/continuation.d.ts +0 -10
  20. package/dist/lib/auth/oauth2/continuation.d.ts.map +0 -1
  21. package/dist/lib/auth/oauth2/manager.d.ts +0 -21
  22. package/dist/lib/auth/oauth2/manager.d.ts.map +0 -1
  23. package/dist/lib/auth/oauth2/prompt-error.d.ts +0 -10
  24. package/dist/lib/auth/oauth2/prompt-error.d.ts.map +0 -1
  25. package/dist/lib/auth/oauth2/prompt-helper.d.ts +0 -16
  26. package/dist/lib/auth/oauth2/prompt-helper.d.ts.map +0 -1
  27. package/dist/lib/auth/oauth2/types.d.ts +0 -60
  28. package/dist/lib/auth/oauth2/types.d.ts.map +0 -1
  29. package/dist/lib/helpers/index.d.ts +0 -2
  30. package/dist/lib/helpers/index.d.ts.map +0 -1
  31. package/dist/lib/parser/at-variables.d.ts +0 -17
  32. package/dist/lib/parser/at-variables.d.ts.map +0 -1
  33. package/dist/lib/parser/body.d.ts +0 -5
  34. package/dist/lib/parser/body.d.ts.map +0 -1
  35. package/dist/lib/parser/comment.d.ts +0 -3
  36. package/dist/lib/parser/comment.d.ts.map +0 -1
  37. package/dist/lib/parser/directive.d.ts +0 -15
  38. package/dist/lib/parser/directive.d.ts.map +0 -1
  39. package/dist/lib/parser/header.d.ts +0 -4
  40. package/dist/lib/parser/header.d.ts.map +0 -1
  41. package/dist/lib/parser/index.d.ts +0 -6
  42. package/dist/lib/parser/index.d.ts.map +0 -1
  43. package/dist/lib/parser/lib/helpers/index.d.ts +0 -10
  44. package/dist/lib/parser/lib/helpers/index.d.ts.map +0 -1
  45. package/dist/lib/parser/operator.d.ts +0 -4
  46. package/dist/lib/parser/operator.d.ts.map +0 -1
  47. package/dist/lib/parser/parser.d.ts +0 -3
  48. package/dist/lib/parser/parser.d.ts.map +0 -1
  49. package/dist/lib/parser/request.d.ts +0 -10
  50. package/dist/lib/parser/request.d.ts.map +0 -1
  51. package/dist/lib/parser/script.d.ts +0 -8
  52. package/dist/lib/parser/script.d.ts.map +0 -1
  53. package/dist/lib/parser/types/block.d.ts +0 -31
  54. package/dist/lib/parser/types/block.d.ts.map +0 -1
  55. package/dist/lib/parser/types/body.d.ts +0 -41
  56. package/dist/lib/parser/types/body.d.ts.map +0 -1
  57. package/dist/lib/parser/types/comment.d.ts +0 -6
  58. package/dist/lib/parser/types/comment.d.ts.map +0 -1
  59. package/dist/lib/parser/types/directive.d.ts +0 -13
  60. package/dist/lib/parser/types/directive.d.ts.map +0 -1
  61. package/dist/lib/parser/types/document.d.ts +0 -17
  62. package/dist/lib/parser/types/document.d.ts.map +0 -1
  63. package/dist/lib/parser/types/error.d.ts +0 -7
  64. package/dist/lib/parser/types/error.d.ts.map +0 -1
  65. package/dist/lib/parser/types/header.d.ts +0 -5
  66. package/dist/lib/parser/types/header.d.ts.map +0 -1
  67. package/dist/lib/parser/types/index.d.ts +0 -4
  68. package/dist/lib/parser/types/index.d.ts.map +0 -1
  69. package/dist/lib/parser/types/operator.d.ts +0 -10
  70. package/dist/lib/parser/types/operator.d.ts.map +0 -1
  71. package/dist/lib/parser/types/parser.d.ts +0 -6
  72. package/dist/lib/parser/types/parser.d.ts.map +0 -1
  73. package/dist/lib/parser/types/request.d.ts +0 -44
  74. package/dist/lib/parser/types/request.d.ts.map +0 -1
  75. package/dist/lib/parser/types/script.d.ts +0 -13
  76. package/dist/lib/parser/types/script.d.ts.map +0 -1
  77. package/dist/lib/parser/types/session.d.ts +0 -27
  78. package/dist/lib/parser/types/session.d.ts.map +0 -1
  79. package/dist/lib/parser/types/stdinparsed.d.ts +0 -31
  80. package/dist/lib/parser/types/stdinparsed.d.ts.map +0 -1
  81. package/dist/lib/parser/types/variable.d.ts +0 -4
  82. package/dist/lib/parser/types/variable.d.ts.map +0 -1
  83. package/dist/lib/persistence/cookie-store.d.ts +0 -13
  84. package/dist/lib/persistence/cookie-store.d.ts.map +0 -1
  85. package/dist/lib/persistence/data-dir.d.ts +0 -12
  86. package/dist/lib/persistence/data-dir.d.ts.map +0 -1
  87. package/dist/lib/persistence/db.d.ts +0 -44
  88. package/dist/lib/persistence/db.d.ts.map +0 -1
  89. package/dist/lib/persistence/document-store.d.ts +0 -15
  90. package/dist/lib/persistence/document-store.d.ts.map +0 -1
  91. package/dist/lib/persistence/encrypted-store.d.ts +0 -17
  92. package/dist/lib/persistence/encrypted-store.d.ts.map +0 -1
  93. package/dist/lib/persistence/history-store.d.ts +0 -26
  94. package/dist/lib/persistence/history-store.d.ts.map +0 -1
  95. package/dist/lib/persistence/index.d.ts +0 -26
  96. package/dist/lib/persistence/index.d.ts.map +0 -1
  97. package/dist/lib/persistence/keychain.d.ts +0 -24
  98. package/dist/lib/persistence/keychain.d.ts.map +0 -1
  99. package/dist/lib/persistence/prompt-store.d.ts +0 -31
  100. package/dist/lib/persistence/prompt-store.d.ts.map +0 -1
  101. package/dist/lib/persistence/replay-store.d.ts +0 -19
  102. package/dist/lib/persistence/replay-store.d.ts.map +0 -1
  103. package/dist/lib/persistence/variable-store.d.ts +0 -34
  104. package/dist/lib/persistence/variable-store.d.ts.map +0 -1
  105. package/dist/lib/runner/block.d.ts +0 -7
  106. package/dist/lib/runner/block.d.ts.map +0 -1
  107. package/dist/lib/runner/body.d.ts +0 -30
  108. package/dist/lib/runner/body.d.ts.map +0 -1
  109. package/dist/lib/runner/curl-transport.d.ts +0 -3
  110. package/dist/lib/runner/curl-transport.d.ts.map +0 -1
  111. package/dist/lib/runner/doRequest.d.ts +0 -5
  112. package/dist/lib/runner/doRequest.d.ts.map +0 -1
  113. package/dist/lib/runner/embedded-curl.d.ts +0 -2
  114. package/dist/lib/runner/embedded-curl.d.ts.map +0 -1
  115. package/dist/lib/runner/headers.d.ts +0 -14
  116. package/dist/lib/runner/headers.d.ts.map +0 -1
  117. package/dist/lib/runner/http-client.d.ts +0 -61
  118. package/dist/lib/runner/http-client.d.ts.map +0 -1
  119. package/dist/lib/runner/http-transport.d.ts +0 -5
  120. package/dist/lib/runner/http-transport.d.ts.map +0 -1
  121. package/dist/lib/runner/index.d.ts +0 -10
  122. package/dist/lib/runner/index.d.ts.map +0 -1
  123. package/dist/lib/runner/scripts.d.ts +0 -14
  124. package/dist/lib/runner/scripts.d.ts.map +0 -1
  125. package/dist/lib/runner/types.d.ts +0 -91
  126. package/dist/lib/runner/types.d.ts.map +0 -1
  127. package/dist/lib/variables/env-files.d.ts +0 -17
  128. package/dist/lib/variables/env-files.d.ts.map +0 -1
  129. package/dist/lib/variables/flatten-json.d.ts +0 -7
  130. package/dist/lib/variables/flatten-json.d.ts.map +0 -1
  131. package/dist/lib/variables/index.d.ts +0 -22
  132. package/dist/lib/variables/index.d.ts.map +0 -1
  133. package/dist/lib/variables/kuba.d.ts +0 -15
  134. package/dist/lib/variables/kuba.d.ts.map +0 -1
  135. package/dist/lib/variables/magic.d.ts +0 -7
  136. package/dist/lib/variables/magic.d.ts.map +0 -1
  137. package/dist/lib/variables/request-vars.d.ts +0 -25
  138. package/dist/lib/variables/request-vars.d.ts.map +0 -1
  139. package/dist/lib/variables/resolve.d.ts +0 -16
  140. package/dist/lib/variables/resolve.d.ts.map +0 -1
  141. package/dist/lib/variables/stable-id.d.ts +0 -6
  142. package/dist/lib/variables/stable-id.d.ts.map +0 -1
  143. package/dist/lib/variables/substitute.d.ts +0 -28
  144. package/dist/lib/variables/substitute.d.ts.map +0 -1
  145. package/scripts/ensure-vendored-curl.ts +0 -223
  146. package/scripts/generate-vendored-curl.ts +0 -108
@@ -0,0 +1,202 @@
1
+ // src/postinstall.ts
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
5
+
6
+ // src/lib/downloader/index.ts
7
+ import fs from "node:fs";
8
+ import path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ import { chmodSync, createWriteStream } from "node:fs";
11
+ import { pipeline } from "node:stream/promises";
12
+
13
+ // src/versions/backend.ts
14
+ var KULALA_CORE_VERSION = "0.18.1";
15
+
16
+ // src/lib/downloader/index.ts
17
+ var PACKAGE_ROOT = path.dirname(fileURLToPath(import.meta.url));
18
+ var BINARY_NAME = "kulala-core";
19
+ var DOWNLOAD_URL = "https://github.com/mistweaverco/kulala-core/releases/download/v%s/%s";
20
+ function platform() {
21
+ const os = process.platform === "darwin" ? "darwin" : process.platform === "win32" ? "windows" : "linux";
22
+ const arch = process.arch;
23
+ let archName = arch;
24
+ if (arch === "x64") {
25
+ archName = "x86_64";
26
+ } else if (arch === "arm64") {
27
+ archName = os === "darwin" ? "arm64" : "aarch64";
28
+ }
29
+ return `${os}-${archName}`;
30
+ }
31
+ function getBinDir() {
32
+ return path.join(PACKAGE_ROOT, "bin");
33
+ }
34
+ function getReleaseBinName() {
35
+ const name = `${BINARY_NAME}-${platform()}`;
36
+ return process.platform === "win32" ? `${name}.exe` : name;
37
+ }
38
+ function getBinName() {
39
+ return process.platform === "win32" ? `${BINARY_NAME}.exe` : BINARY_NAME;
40
+ }
41
+ function getBinPath() {
42
+ return path.join(getBinDir(), getBinName());
43
+ }
44
+ function getVersionPath() {
45
+ return path.join(getBinDir(), "version.txt");
46
+ }
47
+ function getLocalDevBinaryPath() {
48
+ const candidates = [
49
+ path.join(PACKAGE_ROOT, "..", "core", "dist", "kulala-core"),
50
+ path.join(PACKAGE_ROOT, "..", "..", "core", "dist", "kulala-core")
51
+ ];
52
+ for (const candidate of candidates) {
53
+ if (fs.existsSync(candidate)) {
54
+ return candidate;
55
+ }
56
+ }
57
+ return null;
58
+ }
59
+ function binaryExists() {
60
+ return fs.existsSync(getBinPath());
61
+ }
62
+ function getInstalledVersion() {
63
+ const versionPath = getVersionPath();
64
+ if (!fs.existsSync(versionPath)) {
65
+ return null;
66
+ }
67
+ return fs.readFileSync(versionPath, "utf-8").trim();
68
+ }
69
+ function versionMatches() {
70
+ const installed = getInstalledVersion();
71
+ return installed === KULALA_CORE_VERSION;
72
+ }
73
+ function makeExecutable(filePath) {
74
+ if (process.platform !== "win32") {
75
+ chmodSync(filePath, 493);
76
+ }
77
+ }
78
+ var SPINNER_FRAMES = [
79
+ "⠋",
80
+ "⠙",
81
+ "⠹",
82
+ "⠸",
83
+ "⠼",
84
+ "⠴",
85
+ "⠦",
86
+ "⠧",
87
+ "⠇",
88
+ "⠏"
89
+ ];
90
+ function isInteractiveTerminal() {
91
+ return process.stderr.isTTY === true;
92
+ }
93
+ function createDownloadProgress() {
94
+ let timer;
95
+ let frame = 0;
96
+ let message = "";
97
+ const clearLine = () => {
98
+ if (timer) {
99
+ clearInterval(timer);
100
+ timer = undefined;
101
+ }
102
+ if (isInteractiveTerminal()) {
103
+ process.stderr.write("\r\x1B[K");
104
+ }
105
+ };
106
+ return {
107
+ start(msg) {
108
+ message = msg;
109
+ if (!isInteractiveTerminal()) {
110
+ console.error(message);
111
+ return;
112
+ }
113
+ const render = () => {
114
+ process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${message}`);
115
+ frame = (frame + 1) % SPINNER_FRAMES.length;
116
+ };
117
+ render();
118
+ timer = setInterval(render, 80);
119
+ },
120
+ succeed(msg) {
121
+ clearLine();
122
+ console.error(msg);
123
+ },
124
+ fail() {
125
+ clearLine();
126
+ }
127
+ };
128
+ }
129
+ async function downloadFile(url, outputPath) {
130
+ const response = await fetch(url);
131
+ if (!response.ok || !response.body) {
132
+ throw new Error(`Failed to download kulala-core from ${url}: ${response.status} ${response.statusText}`);
133
+ }
134
+ await pipeline(response.body, createWriteStream(outputPath));
135
+ }
136
+ function removeStaleBinary() {
137
+ if (!binaryExists()) {
138
+ return;
139
+ }
140
+ fs.unlinkSync(getBinPath());
141
+ const versionPath = getVersionPath();
142
+ if (fs.existsSync(versionPath)) {
143
+ fs.unlinkSync(versionPath);
144
+ }
145
+ }
146
+ async function installBackend() {
147
+ const binDir = getBinDir();
148
+ fs.mkdirSync(binDir, { recursive: true });
149
+ const releaseName = getReleaseBinName();
150
+ const url = DOWNLOAD_URL.replace("%s", KULALA_CORE_VERSION).replace("%s", releaseName);
151
+ const downloadPath = path.join(binDir, `${releaseName}.download`);
152
+ const binPath = getBinPath();
153
+ const progress = createDownloadProgress();
154
+ progress.start(`Downloading kulala-core v${KULALA_CORE_VERSION}...`);
155
+ try {
156
+ await downloadFile(url, downloadPath);
157
+ makeExecutable(downloadPath);
158
+ fs.renameSync(downloadPath, binPath);
159
+ fs.writeFileSync(getVersionPath(), KULALA_CORE_VERSION, "utf-8");
160
+ progress.succeed(`Installed kulala-core to ${binPath}`);
161
+ } catch (error) {
162
+ progress.fail();
163
+ throw error;
164
+ }
165
+ }
166
+ async function tryInstallBackend() {
167
+ const fromEnv = process.env.KULALA_CORE_PATH;
168
+ if (fromEnv && fromEnv.length > 0) {
169
+ return;
170
+ }
171
+ if (getLocalDevBinaryPath()) {
172
+ return;
173
+ }
174
+ if (binaryExists() && versionMatches()) {
175
+ return;
176
+ }
177
+ if (binaryExists()) {
178
+ removeStaleBinary();
179
+ }
180
+ try {
181
+ await installBackend();
182
+ } catch (error) {
183
+ const message = error instanceof Error ? error.message : String(error);
184
+ console.error(`Warning: failed to download kulala-core during install: ${message}`);
185
+ console.error("@mistweaverco/kulala-core will attempt to download it on first use instead.");
186
+ }
187
+ }
188
+
189
+ // src/postinstall.ts
190
+ var packageRoot = join(dirname(fileURLToPath2(import.meta.url)), "..");
191
+ if (existsSync(join(packageRoot, "scripts", "build.ts"))) {
192
+ process.exit(0);
193
+ }
194
+ try {
195
+ await tryInstallBackend();
196
+ } catch (error) {
197
+ const message = error instanceof Error ? error.message : String(error);
198
+ process.stderr.write(`Warning: kulala-core postinstall failed: ${message}
199
+ `);
200
+ process.stderr.write(`@mistweaverco/kulala-core will attempt to download it on first use instead.
201
+ `);
202
+ }
@@ -0,0 +1,15 @@
1
+ declare function getBinPath(): string;
2
+ export declare function installBackend(): Promise<void>;
3
+ /**
4
+ * Best-effort install for lifecycle scripts (postinstall/prepare).
5
+ * Never throws; logs a warning when download fails so first-use fallback can run.
6
+ */
7
+ export declare function tryInstallBackend(): Promise<void>;
8
+ export declare function ensureInstalled(): Promise<string>;
9
+ export declare const downloader: {
10
+ ensureInstalled: typeof ensureInstalled;
11
+ getBinPath: typeof getBinPath;
12
+ installBackend: typeof installBackend;
13
+ tryInstallBackend: typeof tryInstallBackend;
14
+ };
15
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { KulalaDocument, KulalaFormatInput, KulalaHttpFormatResult, KulalaParseInput, KulalaResponseWrapper, KulalaRunInput } from "./types";
2
+ export type { KulalaDocument, KulalaFormatInput, KulalaHttpFormatResult, KulalaParseInput, KulalaRequestErrorResponse, KulalaRequestSuccessResponse, KulalaResponseItem, KulalaResponseWrapper, KulalaRunInput, RunLimit, } from "./types";
3
+ export type InvokeOptions = {
4
+ cwd?: string;
5
+ };
6
+ export declare function parseDocument(input: KulalaParseInput, options?: InvokeOptions): Promise<KulalaDocument>;
7
+ export declare function formatDocument(input: KulalaFormatInput, options?: InvokeOptions): Promise<KulalaHttpFormatResult>;
8
+ export declare function runDocument(input: KulalaRunInput, options?: InvokeOptions): Promise<{
9
+ doc: KulalaDocument;
10
+ response: KulalaResponseWrapper;
11
+ }>;
12
+ export declare const kulalaCore: {
13
+ parse: typeof parseDocument;
14
+ validate: typeof parseDocument;
15
+ format: typeof formatDocument;
16
+ run: typeof runDocument;
17
+ };
@@ -0,0 +1,142 @@
1
+ export type KulalaResponseBody = {
2
+ type: "text";
3
+ content: string;
4
+ mediaType?: string;
5
+ } | {
6
+ type: "json";
7
+ content: Record<string, unknown>;
8
+ formatted?: string;
9
+ };
10
+ export type KulalaScriptConsoleLine = {
11
+ level: "log" | "error" | "warn" | "info" | "debug";
12
+ message: string;
13
+ origin: {
14
+ type: string;
15
+ name?: string;
16
+ line?: number;
17
+ };
18
+ };
19
+ export type KulalaRequestSuccessResponse = {
20
+ success: true;
21
+ blockName?: string;
22
+ status: number;
23
+ headers: Record<string, string>;
24
+ url: string;
25
+ request?: {
26
+ method: string;
27
+ url: string;
28
+ headers?: Record<string, string>;
29
+ body?: string;
30
+ };
31
+ timings: {
32
+ dns: number;
33
+ tcp: number;
34
+ tls: number;
35
+ request: number;
36
+ redirect: number;
37
+ firstByte: number;
38
+ startTransfer: number;
39
+ total: number;
40
+ };
41
+ body: KulalaResponseBody;
42
+ filteredBody?: KulalaResponseBody;
43
+ scriptConsole?: KulalaScriptConsoleLine[];
44
+ };
45
+ export type KulalaRequestErrorResponse = {
46
+ success: false;
47
+ blockName?: string;
48
+ error: string;
49
+ scriptConsole?: KulalaScriptConsoleLine[];
50
+ httpCompleted?: boolean;
51
+ status?: number;
52
+ headers?: Record<string, string>;
53
+ url?: string;
54
+ request?: {
55
+ method: string;
56
+ url: string;
57
+ headers?: Record<string, string>;
58
+ body?: string;
59
+ };
60
+ body?: KulalaResponseBody;
61
+ };
62
+ export type KulalaPromptResponse = {
63
+ success: false;
64
+ prompt: true;
65
+ promptId: string;
66
+ promptType: string;
67
+ message: string;
68
+ inputs: Array<{
69
+ id: string;
70
+ label: string;
71
+ type: "text" | "password" | "url";
72
+ required?: boolean;
73
+ }>;
74
+ };
75
+ export type KulalaSkippedResponse = {
76
+ success: true;
77
+ skipped: true;
78
+ blockName?: string;
79
+ scriptConsole?: KulalaScriptConsoleLine[];
80
+ };
81
+ export type KulalaWebSocketPlanResponse = {
82
+ success: true;
83
+ protocol: "websocket";
84
+ url: string;
85
+ initialMessage?: string;
86
+ };
87
+ export type KulalaResponseItem = KulalaRequestSuccessResponse | KulalaRequestErrorResponse | KulalaPromptResponse | KulalaSkippedResponse | KulalaWebSocketPlanResponse;
88
+ export type KulalaResponseWrapper = {
89
+ type: "responses";
90
+ data: KulalaResponseItem[];
91
+ } | {
92
+ type: "error";
93
+ data: KulalaRequestErrorResponse[];
94
+ };
95
+ export type RunLimit = {
96
+ filter: "name";
97
+ name: string;
98
+ } | {
99
+ filter: "cursorPosition";
100
+ line: number;
101
+ column: number;
102
+ };
103
+ export type KulalaDocument = {
104
+ hasErrors: boolean;
105
+ blocks: Array<{
106
+ name: string;
107
+ errors?: Array<{
108
+ message: string;
109
+ lineNumber?: number;
110
+ }>;
111
+ }>;
112
+ [key: string]: unknown;
113
+ };
114
+ export type KulalaHttpFormatResult = {
115
+ content: string;
116
+ changed: boolean;
117
+ };
118
+ export type KulalaRunInput = {
119
+ content: string;
120
+ filepath?: string;
121
+ env?: string;
122
+ limit?: RunLimit[];
123
+ haltOnError?: boolean;
124
+ };
125
+ export type KulalaParseInput = {
126
+ content: string;
127
+ filepath?: string;
128
+ };
129
+ export type KulalaFormatInput = {
130
+ content: string;
131
+ filepath?: string;
132
+ formatBody?: boolean;
133
+ bodyFormat?: {
134
+ indent?: number;
135
+ line_width?: number;
136
+ expand_tabs?: boolean;
137
+ };
138
+ defaults?: {
139
+ http_method?: string;
140
+ http_version?: string | false;
141
+ };
142
+ };
package/package.json CHANGED
@@ -1,22 +1,24 @@
1
1
  {
2
2
  "name": "@mistweaverco/kulala-core",
3
- "version": "0.1.6",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
- "private": false,
6
5
  "license": "MIT",
7
6
  "repository": {
8
7
  "type": "git",
9
- "url": "git+https://github.com/mistweaverco/kulala-core.git"
8
+ "url": "git+https://github.com/mistweaverco/kulala-core.git",
9
+ "directory": "packages/core-npm-wrapper"
10
10
  },
11
11
  "homepage": "https://github.com/mistweaverco/kulala-core#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/mistweaverco/kulala-core/issues"
14
14
  },
15
15
  "engines": {
16
- "bun": ">=1.0.0"
16
+ "node": ">=20"
17
+ },
18
+ "bin": {
19
+ "kulala-core": "dist/cli.js"
17
20
  },
18
21
  "main": "./dist/index.js",
19
- "module": "./dist/index.js",
20
22
  "types": "./dist/index.d.ts",
21
23
  "exports": {
22
24
  ".": {
@@ -25,25 +27,16 @@
25
27
  }
26
28
  },
27
29
  "files": [
28
- "dist",
29
- "scripts",
30
- "README.md",
31
- "LICENSE"
30
+ "dist/cli.js",
31
+ "dist/index.js",
32
+ "dist/index.d.ts",
33
+ "dist/install-backend.js",
34
+ "dist/lib"
32
35
  ],
33
36
  "scripts": {
34
- "format": "prettier --write .",
35
- "lint": "prettier --check . && eslint .",
36
- "test": "bun test",
37
- "postinstall": "bun run ./scripts/ensure-vendored-curl.ts",
38
- "build": "bun run build:js && bun run build:types",
39
- "build:js": "bun build src/index.ts --outdir dist --format esm --target bun --sourcemap --define __KULALA_EMBED_CURL__=false",
40
- "build:types": "tsc -p tsconfig.build.json",
41
- "prepack": "cp ./../../README.md . && cp ./../../LICENSE . && bun run build"
42
- },
43
- "pkg": {
44
- "assets": [
45
- "../../vendor/curl/**/*"
46
- ]
37
+ "build": "bun run scripts/build.ts",
38
+ "prepare": "bun run scripts/build.ts || true",
39
+ "postinstall": "node dist/install-backend.js || true"
47
40
  },
48
41
  "publishConfig": {
49
42
  "access": "public"
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025+ mistweaverco
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,84 +0,0 @@
1
- <div align="center">
2
-
3
- ![Kulala Logo](assets/logo.svg)
4
-
5
- # Kulala Core
6
-
7
- [![Made with love](assets/badge-made-with-love.svg)](https://github.com/mistweaverco/kulala-core/graphs/contributors)
8
- [![GitHub release (latest by date)](https://img.shields.io/github/v/release/mistweaverco/kulala-core?style=for-the-badge)](https://github.com/mistweaverco/kulala-core/releases/latest)
9
- [![Development status)](assets/badge-development-status.svg)](https://github.com/orgs/mistweaverco/projects/3/views/1?filterQuery=repo%3Amistweaverco%2Fkulala-core)
10
- [![Discord](assets/badge-discord.svg)](https://discord.gg/QyVQmfY4Rt)
11
-
12
- <p></p>
13
-
14
- Kulala is swahili for "rest" or "relax."
15
-
16
- A straightforwarded, powerful, and extendable HTTP client library.
17
- It powers the [Kulala toolchain](https://getkulala.net),
18
- and can be used as a standalone library.
19
-
20
- <p></p>
21
-
22
- </div>
23
-
24
- ## Overview
25
-
26
- A RESTful API is a web service architecture that adheres to
27
- specific constraints:
28
-
29
- - statelessness,
30
- - uniform interface,
31
- - client-server separation
32
-
33
- Typically using HTTP methods like `GET`, `POST`, `PUT`, and `DELETE`.
34
- It uses standard web protocols to enable interoperability
35
- between distributed systems.
36
-
37
- ## Features
38
-
39
- ### Request types
40
-
41
- - HTTP RESTful (1.0, 1.1, 2, 3)
42
- - GraphQL (queries, mutations)
43
-
44
- ### Variables
45
-
46
- - Host Environment
47
- - Document variables
48
- - Request scoped variables
49
- - `http-client.env` files
50
- - Built-in support for [kuba](https://kuba.mwco.app)
51
-
52
- ### Scripting
53
-
54
- Supports JavaScript, Lua, and TypeScript for:
55
-
56
- - Pre-request
57
- - Post-request
58
- - Conditional
59
- - Inline
60
- - External
61
-
62
- ### Authentication
63
-
64
- - Basic
65
- - Bearer
66
- - OAuth 2.0
67
-
68
- ### Automation and testing
69
-
70
- Assertions, automated testing and reporting
71
- is compatible with the IntelliJ HTTP Client:
72
-
73
- ## Usage
74
-
75
- See the [examples][examples]
76
- directory for usage examples.
77
-
78
- ### Vendored curl
79
-
80
- - **`npm install` / `bun install`**: the `@mistweaverco/kulala-core` package runs `postinstall`, which downloads a pinned static curl for the **installing machine’s** OS and architecture into the user cache (or you can set `KULALA_CURL_PATH` to your own binary).
81
- - **Published library** (`dist/`): the npm build sets `__KULALA_EMBED_CURL__=false`, so the tarball does **not** embed curl from the machine that ran `npm publish`.
82
- - **`bun build --compile`** (your app or the examples): run `packages/core/scripts/generate-vendored-curl.ts` (optionally with `--target=bun-…` for cross-compiles), then compile with `--define __KULALA_EMBED_CURL__=true` so the correct curl is embedded for that build. For cross-compilation you must have the matching curl available under the cache path or under `vendor/curl/<platform>-<arch>/` in this repo.
83
-
84
- [examples]: https://github.com/mistweaverco/kulala-core/tree/main/examples
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASzD,eAAO,MAAM,UAAU;;;;;4BAPK;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,KAAG,OAAO,CAAC,cAAc,CAAC;+BAHC;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,KAAG,OAAO,CAAC,cAAc,CAAC;0BASN;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,yBAAyB,EAAE,CAAC;KACrC,KAAG,OAAO,CAAC;QAAE,GAAG,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,CAAC;CAwB7D,CAAC"}