@intlpullhq/cli 0.1.0 → 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.
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/lib/config.ts
|
|
9
2
|
import { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync, chmodSync, renameSync } from "fs";
|
|
10
3
|
import { homedir } from "os";
|
|
@@ -369,7 +362,6 @@ function getEffectiveBranch(cliBranch, dir) {
|
|
|
369
362
|
}
|
|
370
363
|
|
|
371
364
|
export {
|
|
372
|
-
__require,
|
|
373
365
|
writeFileAtomic,
|
|
374
366
|
setCustomEnvFile,
|
|
375
367
|
getCustomEnvFile,
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createApiClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2MCKJWPD.js";
|
|
5
5
|
import {
|
|
6
|
-
__require,
|
|
7
6
|
detectFramework,
|
|
8
7
|
getAuthErrorMessage,
|
|
9
8
|
getEffectiveBranch,
|
|
@@ -15,7 +14,7 @@ import {
|
|
|
15
14
|
resolveOutputDir,
|
|
16
15
|
saveProjectConfig,
|
|
17
16
|
setCustomEnvFile
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GQADIM7O.js";
|
|
19
18
|
|
|
20
19
|
// src/index.tsx
|
|
21
20
|
import { Command as Command2 } from "commander";
|
|
@@ -10150,10 +10149,32 @@ import { Command } from "commander";
|
|
|
10150
10149
|
|
|
10151
10150
|
// src/commands/documents/list.tsx
|
|
10152
10151
|
import { useState as useState22, useEffect as useEffect18 } from "react";
|
|
10153
|
-
import { Box as Box31, Text as Text32, Newline } from "ink";
|
|
10154
|
-
import
|
|
10155
|
-
import Loader from "ink-spinner";
|
|
10152
|
+
import { render as render18, Box as Box31, Text as Text32, Newline } from "ink";
|
|
10153
|
+
import Spinner15 from "ink-spinner";
|
|
10156
10154
|
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10155
|
+
function SimpleTable({ data }) {
|
|
10156
|
+
if (data.length === 0) return null;
|
|
10157
|
+
const headers = Object.keys(data[0]);
|
|
10158
|
+
const colWidths = headers.map(
|
|
10159
|
+
(h) => Math.max(h.length, ...data.map((row) => String(row[h] || "").length))
|
|
10160
|
+
);
|
|
10161
|
+
const separator = "\u2500".repeat(colWidths.reduce((a, b) => a + b + 3, 1));
|
|
10162
|
+
return /* @__PURE__ */ jsxs32(Box31, { flexDirection: "column", children: [
|
|
10163
|
+
/* @__PURE__ */ jsx35(Text32, { children: separator }),
|
|
10164
|
+
/* @__PURE__ */ jsxs32(Text32, { children: [
|
|
10165
|
+
"\u2502 ",
|
|
10166
|
+
headers.map((h, i) => h.padEnd(colWidths[i])).join(" \u2502 "),
|
|
10167
|
+
" \u2502"
|
|
10168
|
+
] }),
|
|
10169
|
+
/* @__PURE__ */ jsx35(Text32, { children: separator }),
|
|
10170
|
+
data.map((row, rowIdx) => /* @__PURE__ */ jsxs32(Text32, { children: [
|
|
10171
|
+
"\u2502 ",
|
|
10172
|
+
headers.map((h, i) => String(row[h] || "").padEnd(colWidths[i])).join(" \u2502 "),
|
|
10173
|
+
" \u2502"
|
|
10174
|
+
] }, rowIdx)),
|
|
10175
|
+
/* @__PURE__ */ jsx35(Text32, { children: separator })
|
|
10176
|
+
] });
|
|
10177
|
+
}
|
|
10157
10178
|
var DocumentsList = ({ project }) => {
|
|
10158
10179
|
const [documents, setDocuments] = useState22([]);
|
|
10159
10180
|
const [isLoading, setIsLoading] = useState22(true);
|
|
@@ -10187,7 +10208,7 @@ var DocumentsList = ({ project }) => {
|
|
|
10187
10208
|
}
|
|
10188
10209
|
if (isLoading) {
|
|
10189
10210
|
return /* @__PURE__ */ jsxs32(Text32, { children: [
|
|
10190
|
-
/* @__PURE__ */ jsx35(Text32, { color: "green", children: /* @__PURE__ */ jsx35(
|
|
10211
|
+
/* @__PURE__ */ jsx35(Text32, { color: "green", children: /* @__PURE__ */ jsx35(Spinner15, { type: "dots" }) }),
|
|
10191
10212
|
" Loading documents..."
|
|
10192
10213
|
] });
|
|
10193
10214
|
}
|
|
@@ -10195,7 +10216,7 @@ var DocumentsList = ({ project }) => {
|
|
|
10195
10216
|
return /* @__PURE__ */ jsx35(Text32, { children: "No documents found." });
|
|
10196
10217
|
}
|
|
10197
10218
|
const data = documents.map((doc) => ({
|
|
10198
|
-
ID: doc.id,
|
|
10219
|
+
ID: doc.id.substring(0, 8) + "...",
|
|
10199
10220
|
Name: doc.name,
|
|
10200
10221
|
Status: doc.status,
|
|
10201
10222
|
Created: new Date(doc.created_at).toLocaleDateString()
|
|
@@ -10206,18 +10227,17 @@ var DocumentsList = ({ project }) => {
|
|
|
10206
10227
|
project || "Current"
|
|
10207
10228
|
] }),
|
|
10208
10229
|
/* @__PURE__ */ jsx35(Newline, {}),
|
|
10209
|
-
/* @__PURE__ */ jsx35(
|
|
10230
|
+
/* @__PURE__ */ jsx35(SimpleTable, { data })
|
|
10210
10231
|
] });
|
|
10211
10232
|
};
|
|
10212
10233
|
function runDocumentsList(options) {
|
|
10213
|
-
const { render: render18 } = __require("ink");
|
|
10214
10234
|
render18(/* @__PURE__ */ jsx35(DocumentsList, { ...options }));
|
|
10215
10235
|
}
|
|
10216
10236
|
|
|
10217
10237
|
// src/commands/documents/upload.tsx
|
|
10218
10238
|
import { useState as useState23, useEffect as useEffect19 } from "react";
|
|
10219
|
-
import { Text as Text33 } from "ink";
|
|
10220
|
-
import
|
|
10239
|
+
import { render as render19, Text as Text33 } from "ink";
|
|
10240
|
+
import Spinner16 from "ink-spinner";
|
|
10221
10241
|
import fs2 from "fs";
|
|
10222
10242
|
import path2 from "path";
|
|
10223
10243
|
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
@@ -10267,20 +10287,19 @@ var DocumentsUpload = ({ file, project, source, target }) => {
|
|
|
10267
10287
|
] });
|
|
10268
10288
|
}
|
|
10269
10289
|
return /* @__PURE__ */ jsxs33(Text33, { children: [
|
|
10270
|
-
/* @__PURE__ */ jsx36(Text33, { color: "green", children: /* @__PURE__ */ jsx36(
|
|
10290
|
+
/* @__PURE__ */ jsx36(Text33, { color: "green", children: /* @__PURE__ */ jsx36(Spinner16, { type: "dots" }) }),
|
|
10271
10291
|
" ",
|
|
10272
10292
|
message
|
|
10273
10293
|
] });
|
|
10274
10294
|
};
|
|
10275
10295
|
function runDocumentsUpload(options) {
|
|
10276
|
-
|
|
10277
|
-
render18(/* @__PURE__ */ jsx36(DocumentsUpload, { ...options }));
|
|
10296
|
+
render19(/* @__PURE__ */ jsx36(DocumentsUpload, { ...options }));
|
|
10278
10297
|
}
|
|
10279
10298
|
|
|
10280
10299
|
// src/commands/documents/download.tsx
|
|
10281
10300
|
import { useState as useState24, useEffect as useEffect20 } from "react";
|
|
10282
|
-
import { Text as Text34 } from "ink";
|
|
10283
|
-
import
|
|
10301
|
+
import { render as render20, Text as Text34 } from "ink";
|
|
10302
|
+
import Spinner17 from "ink-spinner";
|
|
10284
10303
|
import fs3 from "fs";
|
|
10285
10304
|
import path3 from "path";
|
|
10286
10305
|
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
@@ -10329,14 +10348,13 @@ var DocumentsDownload = ({ documentId, language, project, output }) => {
|
|
|
10329
10348
|
] });
|
|
10330
10349
|
}
|
|
10331
10350
|
return /* @__PURE__ */ jsxs34(Text34, { children: [
|
|
10332
|
-
/* @__PURE__ */ jsx37(Text34, { color: "green", children: /* @__PURE__ */ jsx37(
|
|
10351
|
+
/* @__PURE__ */ jsx37(Text34, { color: "green", children: /* @__PURE__ */ jsx37(Spinner17, { type: "dots" }) }),
|
|
10333
10352
|
" ",
|
|
10334
10353
|
message
|
|
10335
10354
|
] });
|
|
10336
10355
|
};
|
|
10337
10356
|
function runDocumentsDownload(options) {
|
|
10338
|
-
|
|
10339
|
-
render18(/* @__PURE__ */ jsx37(DocumentsDownload, { ...options }));
|
|
10357
|
+
render20(/* @__PURE__ */ jsx37(DocumentsDownload, { ...options }));
|
|
10340
10358
|
}
|
|
10341
10359
|
|
|
10342
10360
|
// src/commands/documents/index.tsx
|
|
@@ -10391,7 +10409,7 @@ program.command("login").description("Authenticate with IntlPull").option("--tok
|
|
|
10391
10409
|
if (options.token) {
|
|
10392
10410
|
console.warn("\u26A0\uFE0F Warning: Passing tokens via CLI exposes them in shell history.");
|
|
10393
10411
|
console.warn(" For better security, use: export INTLPULL_API_KEY=your_token\n");
|
|
10394
|
-
const { saveAuthConfig } = await import("./config-
|
|
10412
|
+
const { saveAuthConfig } = await import("./config-DX34FMWV.js");
|
|
10395
10413
|
saveAuthConfig({ apiKey: options.token });
|
|
10396
10414
|
console.log("\u2713 API token saved successfully");
|
|
10397
10415
|
console.log("You can now use IntlPull CLI commands.");
|
|
@@ -10405,7 +10423,7 @@ program.command("login").description("Authenticate with IntlPull").option("--tok
|
|
|
10405
10423
|
rl.question("Token: ", async (token) => {
|
|
10406
10424
|
rl.close();
|
|
10407
10425
|
if (token.trim()) {
|
|
10408
|
-
const { saveAuthConfig } = await import("./config-
|
|
10426
|
+
const { saveAuthConfig } = await import("./config-DX34FMWV.js");
|
|
10409
10427
|
saveAuthConfig({ apiKey: token.trim() });
|
|
10410
10428
|
console.log("\u2713 API token saved successfully");
|
|
10411
10429
|
} else {
|
|
@@ -10417,14 +10435,14 @@ program.command("login").description("Authenticate with IntlPull").option("--tok
|
|
|
10417
10435
|
}
|
|
10418
10436
|
});
|
|
10419
10437
|
program.command("logout").description("Clear stored credentials").action(async () => {
|
|
10420
|
-
const { clearAuthConfig } = await import("./config-
|
|
10438
|
+
const { clearAuthConfig } = await import("./config-DX34FMWV.js");
|
|
10421
10439
|
clearAuthConfig();
|
|
10422
10440
|
console.log("\u2713 Logged out successfully");
|
|
10423
10441
|
});
|
|
10424
10442
|
program.command("whoami").description("Show current authenticated user").action(async () => {
|
|
10425
|
-
const { getResolvedApiKey:
|
|
10426
|
-
const { createApiClient: createApiClient2 } = await import("./api-
|
|
10427
|
-
const resolved =
|
|
10443
|
+
const { getResolvedApiKey: getResolvedApiKey2, getAuthErrorMessage: getAuthErrorMessage2 } = await import("./config-DX34FMWV.js");
|
|
10444
|
+
const { createApiClient: createApiClient2 } = await import("./api-K3AY4VAI.js");
|
|
10445
|
+
const resolved = getResolvedApiKey2();
|
|
10428
10446
|
if (!resolved) {
|
|
10429
10447
|
console.log(getAuthErrorMessage2());
|
|
10430
10448
|
return;
|
|
@@ -10602,12 +10620,12 @@ program.command("diff").description("Show what would change on push/pull").optio
|
|
|
10602
10620
|
});
|
|
10603
10621
|
var projects = program.command("projects").description("Manage projects");
|
|
10604
10622
|
projects.command("list").description("List all projects").action(async () => {
|
|
10605
|
-
const { isAuthenticated } = await import("./config-
|
|
10623
|
+
const { isAuthenticated } = await import("./config-DX34FMWV.js");
|
|
10606
10624
|
if (!isAuthenticated()) {
|
|
10607
10625
|
console.log("Not authenticated. Run `npx @intlpullhq/cli login` first.");
|
|
10608
10626
|
return;
|
|
10609
10627
|
}
|
|
10610
|
-
const { createApiClient: createApiClient2 } = await import("./api-
|
|
10628
|
+
const { createApiClient: createApiClient2 } = await import("./api-K3AY4VAI.js");
|
|
10611
10629
|
try {
|
|
10612
10630
|
const api = createApiClient2();
|
|
10613
10631
|
const { projects: projects2 } = await api.listProjects();
|
|
@@ -10628,12 +10646,12 @@ projects.command("list").description("List all projects").action(async () => {
|
|
|
10628
10646
|
}
|
|
10629
10647
|
});
|
|
10630
10648
|
projects.command("create <name>").description("Create a new project").option("--source-language <lang>", "Source language", "en").option("--languages <langs>", "Supported languages (comma-separated)", "en").action(async (name, options) => {
|
|
10631
|
-
const { isAuthenticated } = await import("./config-
|
|
10649
|
+
const { isAuthenticated } = await import("./config-DX34FMWV.js");
|
|
10632
10650
|
if (!isAuthenticated()) {
|
|
10633
10651
|
console.log("Not authenticated. Run `npx @intlpullhq/cli login` first.");
|
|
10634
10652
|
return;
|
|
10635
10653
|
}
|
|
10636
|
-
const { createApiClient: createApiClient2 } = await import("./api-
|
|
10654
|
+
const { createApiClient: createApiClient2 } = await import("./api-K3AY4VAI.js");
|
|
10637
10655
|
try {
|
|
10638
10656
|
const api = createApiClient2();
|
|
10639
10657
|
const languages = options.languages.split(",").map((l) => l.trim());
|
|
@@ -10652,7 +10670,7 @@ projects.command("create <name>").description("Create a new project").option("--
|
|
|
10652
10670
|
}
|
|
10653
10671
|
});
|
|
10654
10672
|
projects.command("link <id>").description("Link current directory to a project").action(async (id) => {
|
|
10655
|
-
const { getProjectConfig: getProjectConfig2, saveProjectConfig: saveProjectConfig3, detectFramework: detectFramework2 } = await import("./config-
|
|
10673
|
+
const { getProjectConfig: getProjectConfig2, saveProjectConfig: saveProjectConfig3, detectFramework: detectFramework2 } = await import("./config-DX34FMWV.js");
|
|
10656
10674
|
const existing = getProjectConfig2();
|
|
10657
10675
|
const detected = detectFramework2();
|
|
10658
10676
|
const config = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlpullhq/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The official CLI for IntlPull - intelligent i18n for modern apps. Manage translations, sync with cloud, and automate localization workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"ink-gradient": "^3.0.0",
|
|
53
53
|
"ink-select-input": "^6.0.0",
|
|
54
54
|
"ink-spinner": "^5.0.0",
|
|
55
|
-
"ink-table": "^3.1.0",
|
|
56
55
|
"ink-text-input": "^6.0.0",
|
|
57
56
|
"js-yaml": "^4.1.0",
|
|
58
57
|
"open": "^10.1.0",
|