@intlayer/cli 9.5.12 → 9.7.0
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/dist/cjs/IntlayerEventListener.cjs.map +1 -1
- package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
- package/dist/cjs/auth/login.cjs +11 -0
- package/dist/cjs/auth/login.cjs.map +1 -1
- package/dist/cjs/auth/setupRepository.cjs +95 -0
- package/dist/cjs/auth/setupRepository.cjs.map +1 -0
- package/dist/cjs/ci.cjs +1 -1
- package/dist/cjs/cli.cjs +59 -14
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/editor.cjs +61 -32
- package/dist/cjs/editor.cjs.map +1 -1
- package/dist/cjs/extract.cjs +1 -1
- package/dist/cjs/fill/fill.cjs +25 -9
- package/dist/cjs/fill/fill.cjs.map +1 -1
- package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
- package/dist/cjs/getTargetDictionary.cjs +1 -1
- package/dist/cjs/index.cjs +29 -1
- package/dist/cjs/init.cjs +261 -36
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initChromeExtension.cjs +26 -3
- package/dist/cjs/initChromeExtension.cjs.map +1 -1
- package/dist/cjs/initInfra.cjs +6 -0
- package/dist/cjs/initInfra.cjs.map +1 -1
- package/dist/cjs/initMCP.cjs +18 -7
- package/dist/cjs/initMCP.cjs.map +1 -1
- package/dist/cjs/initSkills.cjs +37 -34
- package/dist/cjs/initSkills.cjs.map +1 -1
- package/dist/cjs/listContentDeclaration.cjs +1 -1
- package/dist/cjs/listProjects.cjs +1 -1
- package/dist/cjs/liveSync.cjs.map +1 -1
- package/dist/cjs/pull.cjs +1 -1
- package/dist/cjs/push/push.cjs +1 -1
- package/dist/cjs/reviewDoc/reviewDoc.cjs +1 -1
- package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
- package/dist/cjs/translateDoc/translateDoc.cjs +1 -1
- package/dist/cjs/upgrade.cjs +1 -1
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/utils/detectGitRepository.cjs +87 -0
- package/dist/cjs/utils/detectGitRepository.cjs.map +1 -0
- package/dist/cjs/utils/getParentPackageJSON.cjs +1 -1
- package/dist/cjs/utils/isInteractiveTerminal.cjs +12 -0
- package/dist/cjs/utils/isInteractiveTerminal.cjs.map +1 -0
- package/dist/cjs/utils/parseChoice.cjs +21 -0
- package/dist/cjs/utils/parseChoice.cjs.map +1 -0
- package/dist/esm/IntlayerEventListener.mjs.map +1 -1
- package/dist/esm/_virtual/_utils_asset.mjs +1 -1
- package/dist/esm/auth/login.mjs +11 -0
- package/dist/esm/auth/login.mjs.map +1 -1
- package/dist/esm/auth/setupRepository.mjs +90 -0
- package/dist/esm/auth/setupRepository.mjs.map +1 -0
- package/dist/esm/ci.mjs +1 -1
- package/dist/esm/cli.mjs +59 -14
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/editor.mjs +62 -34
- package/dist/esm/editor.mjs.map +1 -1
- package/dist/esm/extract.mjs +1 -1
- package/dist/esm/fill/fill.mjs +25 -9
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/translateDictionary.mjs.map +1 -1
- package/dist/esm/getTargetDictionary.mjs +1 -1
- package/dist/esm/index.mjs +10 -5
- package/dist/esm/init.mjs +253 -38
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initChromeExtension.mjs +24 -4
- package/dist/esm/initChromeExtension.mjs.map +1 -1
- package/dist/esm/initInfra.mjs +6 -0
- package/dist/esm/initInfra.mjs.map +1 -1
- package/dist/esm/initMCP.mjs +21 -11
- package/dist/esm/initMCP.mjs.map +1 -1
- package/dist/esm/initSkills.mjs +37 -36
- package/dist/esm/initSkills.mjs.map +1 -1
- package/dist/esm/listContentDeclaration.mjs +1 -1
- package/dist/esm/listProjects.mjs +1 -1
- package/dist/esm/liveSync.mjs.map +1 -1
- package/dist/esm/pull.mjs +1 -1
- package/dist/esm/push/push.mjs +1 -1
- package/dist/esm/reviewDoc/reviewDoc.mjs +1 -1
- package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
- package/dist/esm/translateDoc/translateDoc.mjs +1 -1
- package/dist/esm/upgrade.mjs +1 -1
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/utils/detectGitRepository.mjs +85 -0
- package/dist/esm/utils/detectGitRepository.mjs.map +1 -0
- package/dist/esm/utils/getParentPackageJSON.mjs +1 -1
- package/dist/esm/utils/isInteractiveTerminal.mjs +11 -0
- package/dist/esm/utils/isInteractiveTerminal.mjs.map +1 -0
- package/dist/esm/utils/parseChoice.mjs +20 -0
- package/dist/esm/utils/parseChoice.mjs.map +1 -0
- package/dist/types/IntlayerEventListener.d.ts +1 -1
- package/dist/types/IntlayerEventListener.d.ts.map +1 -1
- package/dist/types/auth/login.d.ts +5 -0
- package/dist/types/auth/login.d.ts.map +1 -1
- package/dist/types/auth/setupRepository.d.ts +25 -0
- package/dist/types/auth/setupRepository.d.ts.map +1 -0
- package/dist/types/editor.d.ts +10 -0
- package/dist/types/editor.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts +23 -2
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/index.d.ts +2 -2
- package/dist/types/fill/translateDictionary.d.ts +1 -2
- package/dist/types/fill/translateDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -6
- package/dist/types/init.d.ts +55 -2
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initChromeExtension.d.ts +19 -1
- package/dist/types/initChromeExtension.d.ts.map +1 -1
- package/dist/types/initInfra.d.ts.map +1 -1
- package/dist/types/initMCP.d.ts +16 -2
- package/dist/types/initMCP.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +23 -6
- package/dist/types/initSkills.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDoc.d.ts +1 -1
- package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +1 -2
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
- package/dist/types/translateDoc/types.d.ts +1 -1
- package/dist/types/utils/checkAccess.d.ts +2 -1
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/utils/detectGitRepository.d.ts +34 -0
- package/dist/types/utils/detectGitRepository.d.ts.map +1 -0
- package/dist/types/utils/isInteractiveTerminal.d.ts +9 -0
- package/dist/types/utils/isInteractiveTerminal.d.ts.map +1 -0
- package/dist/types/utils/parseChoice.d.ts +13 -0
- package/dist/types/utils/parseChoice.d.ts.map +1 -0
- package/dist/types/utils/selectCmsEnvironment.d.ts +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { relative, sep } from "node:path";
|
|
2
|
+
import { searchConfigurationFile } from "@intlayer/config/node";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/detectGitRepository.ts
|
|
6
|
+
const HOST_PROVIDERS = {
|
|
7
|
+
"github.com": "github",
|
|
8
|
+
"gitlab.com": "gitlab",
|
|
9
|
+
"bitbucket.org": "bitbucket",
|
|
10
|
+
"codeberg.org": "codeberg",
|
|
11
|
+
"gitee.com": "gitee"
|
|
12
|
+
};
|
|
13
|
+
/** Provider of a host; any host naming GitLab is taken as self-managed. */
|
|
14
|
+
const getHostProvider = (host) => HOST_PROVIDERS[host] ?? (host.includes("gitlab") ? "gitlab" : void 0);
|
|
15
|
+
/**
|
|
16
|
+
* Parses an HTTPS, SSH (`ssh://`) or scp-like (`git@host:owner/repo.git`)
|
|
17
|
+
* remote URL. Returns `null` for an unknown host or a malformed URL.
|
|
18
|
+
*/
|
|
19
|
+
const parseGitRemoteUrl = (remoteUrl) => {
|
|
20
|
+
const trimmedUrl = remoteUrl.trim();
|
|
21
|
+
const scpLikeMatch = /^(?:[^@/\s]+@)?([^:/\s]+):(?!\/)(.+)$/.exec(trimmedUrl);
|
|
22
|
+
let host;
|
|
23
|
+
let path;
|
|
24
|
+
if (scpLikeMatch && !trimmedUrl.includes("://")) [, host, path] = scpLikeMatch;
|
|
25
|
+
else try {
|
|
26
|
+
const url = new URL(trimmedUrl);
|
|
27
|
+
host = url.hostname;
|
|
28
|
+
path = url.pathname;
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const provider = getHostProvider(host.toLowerCase());
|
|
33
|
+
const segments = path.replace(/^\/+|\/+$/g, "").replace(/\.git$/, "").split("/").filter(Boolean);
|
|
34
|
+
if (!provider || segments.length < 2) return null;
|
|
35
|
+
if (provider !== "gitlab" && segments.length !== 2) return null;
|
|
36
|
+
const repository = segments[segments.length - 1];
|
|
37
|
+
const owner = segments.slice(0, -1).join("/");
|
|
38
|
+
const isSelfManagedGitLab = provider === "gitlab" && host !== "gitlab.com";
|
|
39
|
+
return {
|
|
40
|
+
provider,
|
|
41
|
+
owner,
|
|
42
|
+
repository,
|
|
43
|
+
url: `https://${host}/${owner}/${repository}`,
|
|
44
|
+
...isSelfManagedGitLab && { instanceUrl: `https://${host}` }
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/** Output of a git command, `undefined` when it fails. */
|
|
48
|
+
const runGit = (cwd, args) => {
|
|
49
|
+
const result = spawnSync("git", args, {
|
|
50
|
+
cwd,
|
|
51
|
+
encoding: "utf-8"
|
|
52
|
+
});
|
|
53
|
+
if (result.status !== 0) return void 0;
|
|
54
|
+
return result.stdout.trim() || void 0;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Detects the hosted repository of the project from its `origin` remote,
|
|
58
|
+
* with the checked-out branch and the config file path in the repository.
|
|
59
|
+
* Returns `null` outside a git repository or for an unsupported host.
|
|
60
|
+
*/
|
|
61
|
+
const detectGitRepository = (projectRoot) => {
|
|
62
|
+
const remoteUrl = runGit(projectRoot, [
|
|
63
|
+
"remote",
|
|
64
|
+
"get-url",
|
|
65
|
+
"origin"
|
|
66
|
+
]);
|
|
67
|
+
const remote = remoteUrl ? parseGitRemoteUrl(remoteUrl) : null;
|
|
68
|
+
if (!remote) return null;
|
|
69
|
+
const branch = runGit(projectRoot, [
|
|
70
|
+
"rev-parse",
|
|
71
|
+
"--abbrev-ref",
|
|
72
|
+
"HEAD"
|
|
73
|
+
]);
|
|
74
|
+
const gitRoot = runGit(projectRoot, ["rev-parse", "--show-toplevel"]);
|
|
75
|
+
const { configurationFilePath } = searchConfigurationFile(projectRoot);
|
|
76
|
+
return {
|
|
77
|
+
...remote,
|
|
78
|
+
branch: branch && branch !== "HEAD" ? branch : void 0,
|
|
79
|
+
configFilePath: gitRoot && configurationFilePath ? relative(gitRoot, configurationFilePath).split(sep).join("/") : void 0
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
export { detectGitRepository, parseGitRemoteUrl };
|
|
85
|
+
//# sourceMappingURL=detectGitRepository.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectGitRepository.mjs","names":[],"sources":["../../../src/utils/detectGitRepository.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { relative, sep } from 'node:path';\nimport { searchConfigurationFile } from '@intlayer/config/node';\n\n/** Git providers the Intlayer CMS can connect a repository from. */\nexport type GitRepositoryProvider =\n | 'github'\n | 'gitlab'\n | 'bitbucket'\n | 'codeberg'\n | 'gitee';\n\n/** Repository a git remote points to. */\nexport type GitRemoteRepository = {\n provider: GitRepositoryProvider;\n /** Owner, group path (GitLab sub-groups included) or workspace */\n owner: string;\n repository: string;\n /** Web URL of the repository */\n url: string;\n /** Self-managed GitLab instance (ex: https://gitlab.company.com) */\n instanceUrl?: string;\n};\n\n/** Local repository of the project, as sent to the CMS login page. */\nexport type DetectedGitRepository = GitRemoteRepository & {\n /** Checked-out branch */\n branch?: string;\n /** Intlayer configuration file, relative to the repository root (posix) */\n configFilePath?: string;\n};\n\nconst HOST_PROVIDERS: Record<string, GitRepositoryProvider> = {\n 'github.com': 'github',\n 'gitlab.com': 'gitlab',\n 'bitbucket.org': 'bitbucket',\n 'codeberg.org': 'codeberg',\n 'gitee.com': 'gitee',\n};\n\n/** Provider of a host; any host naming GitLab is taken as self-managed. */\nconst getHostProvider = (host: string): GitRepositoryProvider | undefined =>\n HOST_PROVIDERS[host] ?? (host.includes('gitlab') ? 'gitlab' : undefined);\n\n/**\n * Parses an HTTPS, SSH (`ssh://`) or scp-like (`git@host:owner/repo.git`)\n * remote URL. Returns `null` for an unknown host or a malformed URL.\n */\nexport const parseGitRemoteUrl = (\n remoteUrl: string\n): GitRemoteRepository | null => {\n const trimmedUrl = remoteUrl.trim();\n const scpLikeMatch = /^(?:[^@/\\s]+@)?([^:/\\s]+):(?!\\/)(.+)$/.exec(trimmedUrl);\n\n let host: string;\n let path: string;\n\n if (scpLikeMatch && !trimmedUrl.includes('://')) {\n [, host, path] = scpLikeMatch as unknown as [string, string, string];\n } else {\n try {\n const url = new URL(trimmedUrl);\n host = url.hostname;\n path = url.pathname;\n } catch {\n return null;\n }\n }\n\n const provider = getHostProvider(host.toLowerCase());\n const segments = path\n .replace(/^\\/+|\\/+$/g, '')\n .replace(/\\.git$/, '')\n .split('/')\n .filter(Boolean);\n\n if (!provider || segments.length < 2) return null;\n\n // Only GitLab nests groups: elsewhere the path is exactly `owner/repo`\n if (provider !== 'gitlab' && segments.length !== 2) return null;\n\n const repository = segments[segments.length - 1] as string;\n const owner = segments.slice(0, -1).join('/');\n const isSelfManagedGitLab = provider === 'gitlab' && host !== 'gitlab.com';\n\n return {\n provider,\n owner,\n repository,\n url: `https://${host}/${owner}/${repository}`,\n ...(isSelfManagedGitLab && { instanceUrl: `https://${host}` }),\n };\n};\n\n/** Output of a git command, `undefined` when it fails. */\nconst runGit = (cwd: string, args: string[]): string | undefined => {\n const result = spawnSync('git', args, { cwd, encoding: 'utf-8' });\n\n if (result.status !== 0) return undefined;\n\n return result.stdout.trim() || undefined;\n};\n\n/**\n * Detects the hosted repository of the project from its `origin` remote,\n * with the checked-out branch and the config file path in the repository.\n * Returns `null` outside a git repository or for an unsupported host.\n */\nexport const detectGitRepository = (\n projectRoot: string\n): DetectedGitRepository | null => {\n const remoteUrl = runGit(projectRoot, ['remote', 'get-url', 'origin']);\n const remote = remoteUrl ? parseGitRemoteUrl(remoteUrl) : null;\n\n if (!remote) return null;\n\n const branch = runGit(projectRoot, ['rev-parse', '--abbrev-ref', 'HEAD']);\n const gitRoot = runGit(projectRoot, ['rev-parse', '--show-toplevel']);\n const { configurationFilePath } = searchConfigurationFile(projectRoot);\n\n return {\n ...remote,\n // A detached HEAD has no branch to connect\n branch: branch && branch !== 'HEAD' ? branch : undefined,\n configFilePath:\n gitRoot && configurationFilePath\n ? relative(gitRoot, configurationFilePath).split(sep).join('/')\n : undefined,\n };\n};\n"],"mappings":";;;;;AAgCA,MAAM,iBAAwD;CAC5D,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,aAAa;AACf;;AAGA,MAAM,mBAAmB,SACvB,eAAe,UAAU,KAAK,SAAS,QAAQ,IAAI,WAAW;;;;;AAMhE,MAAa,qBACX,cAC+B;CAC/B,MAAM,aAAa,UAAU,KAAK;CAClC,MAAM,eAAe,wCAAwC,KAAK,UAAU;CAE5E,IAAI;CACJ,IAAI;CAEJ,IAAI,gBAAgB,CAAC,WAAW,SAAS,KAAK,GAC5C,GAAG,MAAM,QAAQ;MAEjB,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,UAAU;EAC9B,OAAO,IAAI;EACX,OAAO,IAAI;CACb,QAAQ;EACN,OAAO;CACT;CAGF,MAAM,WAAW,gBAAgB,KAAK,YAAY,CAAC;CACnD,MAAM,WAAW,KACd,QAAQ,cAAc,EAAE,CAAC,CACzB,QAAQ,UAAU,EAAE,CAAC,CACrB,MAAM,GAAG,CAAC,CACV,OAAO,OAAO;CAEjB,IAAI,CAAC,YAAY,SAAS,SAAS,GAAG,OAAO;CAG7C,IAAI,aAAa,YAAY,SAAS,WAAW,GAAG,OAAO;CAE3D,MAAM,aAAa,SAAS,SAAS,SAAS;CAC9C,MAAM,QAAQ,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG;CAC5C,MAAM,sBAAsB,aAAa,YAAY,SAAS;CAE9D,OAAO;EACL;EACA;EACA;EACA,KAAK,WAAW,KAAK,GAAG,MAAM,GAAG;EACjC,GAAI,uBAAuB,EAAE,aAAa,WAAW,OAAO;CAC9D;AACF;;AAGA,MAAM,UAAU,KAAa,SAAuC;CAClE,MAAM,SAAS,UAAU,OAAO,MAAM;EAAE;EAAK,UAAU;CAAQ,CAAC;CAEhE,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAO,OAAO,OAAO,KAAK,KAAK;AACjC;;;;;;AAOA,MAAa,uBACX,gBACiC;CACjC,MAAM,YAAY,OAAO,aAAa;EAAC;EAAU;EAAW;CAAQ,CAAC;CACrE,MAAM,SAAS,YAAY,kBAAkB,SAAS,IAAI;CAE1D,IAAI,CAAC,QAAQ,OAAO;CAEpB,MAAM,SAAS,OAAO,aAAa;EAAC;EAAa;EAAgB;CAAM,CAAC;CACxE,MAAM,UAAU,OAAO,aAAa,CAAC,aAAa,iBAAiB,CAAC;CACpE,MAAM,EAAE,0BAA0B,wBAAwB,WAAW;CAErE,OAAO;EACL,GAAG;EAEH,QAAQ,UAAU,WAAW,SAAS,SAAS;EAC/C,gBACE,WAAW,wBACP,SAAS,SAAS,qBAAqB,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IAC5D;CACR;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/isInteractiveTerminal.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether the process can prompt: both stdin and stdout are attached to a
|
|
4
|
+
* terminal. False for AI agents, CI and piped runs, where a prompt would print
|
|
5
|
+
* and exit without an answer.
|
|
6
|
+
*/
|
|
7
|
+
const isInteractiveTerminal = () => Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isInteractiveTerminal };
|
|
11
|
+
//# sourceMappingURL=isInteractiveTerminal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInteractiveTerminal.mjs","names":[],"sources":["../../../src/utils/isInteractiveTerminal.ts"],"sourcesContent":["/**\n * Whether the process can prompt: both stdin and stdout are attached to a\n * terminal. False for AI agents, CI and piped runs, where a prompt would print\n * and exit without an answer.\n */\nexport const isInteractiveTerminal = (): boolean =>\n Boolean(process.stdin.isTTY && process.stdout.isTTY);\n"],"mappings":";;;;;;AAKA,MAAa,8BACX,QAAQ,QAAQ,MAAM,SAAS,QAAQ,OAAO,KAAK"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/utils/parseChoice.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a command-line value against its allowed choices, ignoring case.
|
|
4
|
+
*
|
|
5
|
+
* @param value - Raw value passed on the command line.
|
|
6
|
+
* @param choices - Accepted values, in their canonical spelling.
|
|
7
|
+
* @param optionName - Option name used in the error message (e.g. `--platform`).
|
|
8
|
+
* @returns The matching choice, in its canonical spelling.
|
|
9
|
+
* @throws When the value matches none of the choices.
|
|
10
|
+
*/
|
|
11
|
+
const parseChoice = (value, choices, optionName) => {
|
|
12
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
13
|
+
const choice = choices.find((candidate) => candidate.toLowerCase() === normalizedValue);
|
|
14
|
+
if (!choice) throw new Error(`Invalid ${optionName} value "${value}". Expected one of: ${choices.join(", ")}.`);
|
|
15
|
+
return choice;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { parseChoice };
|
|
20
|
+
//# sourceMappingURL=parseChoice.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseChoice.mjs","names":[],"sources":["../../../src/utils/parseChoice.ts"],"sourcesContent":["/**\n * Resolves a command-line value against its allowed choices, ignoring case.\n *\n * @param value - Raw value passed on the command line.\n * @param choices - Accepted values, in their canonical spelling.\n * @param optionName - Option name used in the error message (e.g. `--platform`).\n * @returns The matching choice, in its canonical spelling.\n * @throws When the value matches none of the choices.\n */\nexport const parseChoice = <Choice extends string>(\n value: string,\n choices: readonly Choice[],\n optionName: string\n): Choice => {\n const normalizedValue = value.trim().toLowerCase();\n const choice = choices.find(\n (candidate) => candidate.toLowerCase() === normalizedValue\n );\n\n if (!choice) {\n throw new Error(\n `Invalid ${optionName} value \"${value}\". Expected one of: ${choices.join(', ')}.`\n );\n }\n\n return choice;\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,eACX,OACA,SACA,eACW;CACX,MAAM,kBAAkB,MAAM,KAAK,CAAC,CAAC,YAAY;CACjD,MAAM,SAAS,QAAQ,MACpB,cAAc,UAAU,YAAY,MAAM,eAC7C;CAEA,IAAI,CAAC,QACH,MAAM,IAAI,MACR,WAAW,WAAW,UAAU,MAAM,sBAAsB,QAAQ,KAAK,IAAI,EAAE,EACjF;CAGF,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEventListener.d.ts","names":[],"sources":["../../src/IntlayerEventListener.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IntlayerEventListener.d.ts","names":[],"sources":["../../src/IntlayerEventListener.ts"],"mappings":";;;YAOY,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;qBA0BtB;UAoCD;UAnCF;UAEA;UACA;UACA;UACA;UACA;UACA;;;;EAKD,qBAAqB,YAAY;;;;EAKjC,sBAAsB,YAAY;;;;EAKlC,uBAAuB,YAAY;;;;EAKnC;;;;EAKA,qBAAqB,OAAO;EAEnC,YACU,iBAAgB,KAAK;;;;;EAYlB,cAAc;;;;UAQb;;;;EAmDP;;;;UAiBC;;;;;UAoCM;;;;UA8CN"}
|
|
@@ -19,6 +19,11 @@ type LoginOptions = {
|
|
|
19
19
|
clientId: string;
|
|
20
20
|
clientSecret: string;
|
|
21
21
|
}) => void | Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Aborts a login still waiting for the browser callback: the callback
|
|
24
|
+
* server is shut down and the returned promise resolves.
|
|
25
|
+
*/
|
|
26
|
+
signal?: AbortSignal;
|
|
22
27
|
};
|
|
23
28
|
export declare const login: (options?: LoginOptions) => Promise<void>;
|
|
24
29
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;KAiEK;EACH;EACA,gBAAgB;;;;;;EAMhB;;;;;;;EAOA,iBAAiB;IACf;IACA;eACW;;
|
|
1
|
+
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;KAiEK;EACH;EACA,gBAAgB;;;;;;EAMhB;;;;;;;EAOA,iBAAiB;IACf;IACA;eACW;;;;;EAKb,SAAS;;qBAGE,QAAK,UAAmB,iBAAY"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DetectedGitRepository } from "../utils/detectGitRepository.js";
|
|
2
|
+
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
3
|
+
//#region src/auth/setupRepository.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Search params pre-filling the repository page with the local repository.
|
|
6
|
+
* Empty when none was detected: the user then picks it in the browser.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getRepositorySearchParams: (detectedRepository: DetectedGitRepository | null | undefined) => URLSearchParams;
|
|
9
|
+
type SetupRepositoryOptions = {
|
|
10
|
+
cmsUrl?: string;
|
|
11
|
+
configOptions?: GetConfigurationOptions;
|
|
12
|
+
/** Local repository pre-filling the page */
|
|
13
|
+
detectedRepository?: DetectedGitRepository | null;
|
|
14
|
+
};
|
|
15
|
+
/** Outcome of the browser step: `provider:owner/repository`, or skipped. */
|
|
16
|
+
export type SetupRepositoryResult = {
|
|
17
|
+
linkedRepository: string | null;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Opens the CMS repository page (`/auth/cli-repository`) and waits for it to
|
|
21
|
+
* call back the local server once the repository and build settings are set.
|
|
22
|
+
*/
|
|
23
|
+
export declare const setupRepository: (options?: SetupRepositoryOptions) => Promise<SetupRepositoryResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=setupRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupRepository.d.ts","names":[],"sources":["../../../src/auth/setupRepository.ts"],"mappings":";;;;;;;qBAqCa,4BAAyB,oBAChB,6CACnB;KAkBE;EACH;EACA,gBAAgB;;EAEhB,qBAAqB;;;YAIX;EACV;;;;;;qBAOW,kBAAe,UACjB,2BACR,QAAQ"}
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -3,6 +3,16 @@ type StartEditorOptions = {
|
|
|
3
3
|
env?: string;
|
|
4
4
|
envFile?: string;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Package runners trying `intlayer-editor` without it being installed. The
|
|
8
|
+
* editor is pinned to the CLI version, so both speak the same protocol.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getRemoteEditorRunners: (cliVersion: string | undefined) => [command: string, args: string[]][];
|
|
11
|
+
/**
|
|
12
|
+
* Starts the visual editor: the installed `intlayer-editor`, else one of the
|
|
13
|
+
* CLI version run by `bun x` or `npx` (the next runner is tried when one is
|
|
14
|
+
* not installed).
|
|
15
|
+
*/
|
|
6
16
|
export declare const startEditor: (options: StartEditorOptions) => void;
|
|
7
17
|
//#endregion
|
|
8
18
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor.ts"],"mappings":";KAYK;EACH;EACA;;;;;;qBAaW,yBAAsB,oCAE/B,iBAAiB;;;;;;qBA8DR,cAAW,SAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetTargetDictionaryOptions } from "../getTargetDictionary.js";
|
|
2
|
-
import { AIOptions } from "@intlayer/
|
|
2
|
+
import { AIOptions } from "@intlayer/ai";
|
|
3
3
|
import { ListGitFilesOptions } from "@intlayer/engine/cli";
|
|
4
4
|
import { Locale } from "@intlayer/types/allLocales";
|
|
5
5
|
//#region src/fill/fill.d.ts
|
|
@@ -15,9 +15,30 @@ export type FillOptions = {
|
|
|
15
15
|
build?: boolean;
|
|
16
16
|
skipMetadata?: boolean;
|
|
17
17
|
} & GetTargetDictionaryOptions;
|
|
18
|
+
/** Outcome of a {@link fill} run. */
|
|
19
|
+
export type FillResult = {
|
|
20
|
+
/** No AI provider is reachable: nothing was translated. */
|
|
21
|
+
status: 'no-ai-access';
|
|
22
|
+
/** Why the AI provider could not be used, when known. */
|
|
23
|
+
error?: string;
|
|
24
|
+
} | {
|
|
25
|
+
/** No dictionary matched the filters: nothing was translated. */
|
|
26
|
+
status: 'no-dictionaries';
|
|
27
|
+
} | {
|
|
28
|
+
status: 'completed';
|
|
29
|
+
/** Keys of the dictionaries processed. */
|
|
30
|
+
dictionaryKeys: string[];
|
|
31
|
+
/** Translation tasks (one per dictionary and locale set) run. */
|
|
32
|
+
taskCount: number;
|
|
33
|
+
/** Tasks whose translation was written. */
|
|
34
|
+
writtenCount: number;
|
|
35
|
+
};
|
|
18
36
|
/**
|
|
19
37
|
* Fill translations based on the provided options.
|
|
38
|
+
*
|
|
39
|
+
* @returns What was done, so callers without a terminal (editor extension,
|
|
40
|
+
* MCP) can tell a completed run from one that translated nothing.
|
|
20
41
|
*/
|
|
21
|
-
export declare const fill: (options?: FillOptions) => Promise<
|
|
42
|
+
export declare const fill: (options?: FillOptions) => Promise<FillResult>;
|
|
22
43
|
//#endregion
|
|
23
44
|
//# sourceMappingURL=fill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"mappings":";;;;;YA2CY;EACV,eAAe;EACf,gBAAgB,SAAS;EACzB;EACA,aAAa;EACb,YAAY;EACZ;EACA;EACA;EACA;EACA;IACE
|
|
1
|
+
{"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"mappings":";;;;;YA2CY;EACV,eAAe;EACf,gBAAgB,SAAS;EACzB;EACA,aAAa;EACb,YAAY;EACZ;EACA;EACA;EACA;EACA;IACE;;YAGQ;;EAGN;;EAEA;;;EAIA;;EAGA;;EAEA;;EAEA;;EAEA;;;;;;;;qBASO,OAAI,UAAoB,gBAAc,QAAQ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FillOptions, fill } from "./fill.js";
|
|
1
|
+
import { FillOptions, FillResult, fill } from "./fill.js";
|
|
2
2
|
import { writeFill } from "./writeFill.js";
|
|
3
|
-
export { FillOptions, fill, writeFill };
|
|
3
|
+
export { FillOptions, FillResult, fill, writeFill };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TranslationTask } from "./listTranslationsTasks.js";
|
|
2
2
|
import { AIClient } from "../utils/setupAI.js";
|
|
3
3
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
4
|
-
import { AIOptions } from "@intlayer/
|
|
4
|
+
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
5
5
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
6
|
-
import { AIConfig } from "@intlayer/ai";
|
|
7
6
|
//#region src/fill/translateDictionary.d.ts
|
|
8
7
|
type TranslateDictionaryResult = TranslationTask & {
|
|
9
8
|
dictionaryOutput: Dictionary | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"mappings":";;;;;;KAuCK,4BAA4B;EAC/B,kBAAkB;;KAGf;EACH;EACA,YAAY;EACZ;EACA,WAAW,mDAC+B;EAE1C;EACA,WAAW;EACX,sBAAsB;EACtB,WAAW;EACX,WAAW;;qBAyCA,sBAAmB,MACxB,iBAAe,eACN,gBAAc,UACnB,+BACT,QAAQ"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { IntlayerEventListener, IntlayerMessageEvent } from "./IntlayerEventListener.js";
|
|
2
|
+
import { login } from "./auth/login.js";
|
|
3
|
+
import { clearCliSessionToken, readCliSessionToken } from "./auth/sessionToken.js";
|
|
1
4
|
import { build } from "./build.js";
|
|
2
5
|
import { bundle } from "./bundle.js";
|
|
3
6
|
import { ConfigurationOptions, dirname, setAPI } from "./cli.js";
|
|
4
|
-
import { startEditor } from "./editor.js";
|
|
7
|
+
import { getRemoteEditorRunners, startEditor } from "./editor.js";
|
|
5
8
|
import { extract } from "./extract.js";
|
|
6
|
-
import { FillOptions, fill } from "./fill/fill.js";
|
|
7
|
-
import { ESLINT_CONFIG_FILES, INIT_STEP_GROUPS, InitStep, InitStepOption, LOCALE_ROUTING_CHOICES, LocaleRoutingChoice, OPT_IN_INIT_STEPS, findProjectRoot, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, isEslintInstalled, parseLocaleRoutingChoice } from "./init.js";
|
|
8
|
-
import { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, MOZILLA_EXTENSION_URL, initChromeExtension } from "./initChromeExtension.js";
|
|
9
|
+
import { FillOptions, FillResult, fill } from "./fill/fill.js";
|
|
10
|
+
import { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, InitStep, InitStepOption, LOCALE_ROUTING_CHOICES, LocaleRoutingChoice, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot } from "./init.js";
|
|
11
|
+
import { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, ExtensionBrowser, InitChromeExtensionOptions, MOZILLA_EXTENSION_URL, initChromeExtension, parseExtensionBrowsers } from "./initChromeExtension.js";
|
|
9
12
|
import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, InfraMode, InitInfraOptions, initInfra, parseInfraMode } from "./initInfra.js";
|
|
10
|
-
import {
|
|
13
|
+
import { InitSkillsOptions, PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.js";
|
|
11
14
|
import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.js";
|
|
12
15
|
import { ListProjectsCommandOptions, listProjectsCommand } from "./listProjects.js";
|
|
13
16
|
import { liveSync } from "./liveSync.js";
|
|
@@ -21,8 +24,10 @@ import { listMissingTranslations, listMissingTranslationsWithConfig } from "./te
|
|
|
21
24
|
import { testMissingTranslations } from "./test/test.js";
|
|
22
25
|
import "./test/index.js";
|
|
23
26
|
import { translateDoc } from "./translateDoc/translateDoc.js";
|
|
27
|
+
import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.js";
|
|
28
|
+
import { checkConfigConsistency } from "./utils/checkConfigConsistency.js";
|
|
24
29
|
export type * from "@intlayer/engine/cli";
|
|
25
30
|
export type * from "@intlayer/engine/build";
|
|
26
31
|
export type * from "@intlayer/engine/utils";
|
|
27
32
|
export type * from "@intlayer/engine/watcher";
|
|
28
|
-
export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, ConfigurationOptions, ESLINT_CONFIG_FILES, FillOptions, INFRA_MODES, INIT_STEP_GROUPS, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, InfraMode, InitInfraOptions, InitStep, InitStepOption, LOCALE_ROUTING_CHOICES, ListProjectsCommandOptions, LocaleRoutingChoice, MOZILLA_EXTENSION_URL, OPT_IN_INIT_STEPS, PLATFORM_OPTIONS, ReviewDocMode, ScanCommandOptions, build, bundle, dirname, extract, fill, findProjectRoot,
|
|
33
|
+
export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, CONTENT_LAYOUT_CHOICES, ConfigurationOptions, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, ExtensionBrowser, FillOptions, FillResult, INFRA_MODES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, InfraMode, InitChromeExtensionOptions, InitInfraOptions, InitSkillsOptions, InitStep, InitStepOption, IntlayerEventListener, IntlayerMessageEvent, LOCALE_ROUTING_CHOICES, ListProjectsCommandOptions, LocaleRoutingChoice, MOZILLA_EXTENSION_URL, OPT_IN_INIT_STEPS, PLATFORM_OPTIONS, ReviewDocMode, ScanCommandOptions, build, bundle, checkCMSAuth, checkConfigConsistency, clearCliSessionToken, dirname, extract, fill, findProjectRoot, getAuthenticatedAPI, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRemoteEditorRunners, getRoutingInitOptions, init, initChromeExtension, initCms, initInfra, initRepository, initSkills, initSteps, isEslintInstalled, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, login, parseContentLayoutChoice, parseExtensionBrowsers, parseInfraMode, parseLocaleRoutingChoice, parsePlatform, parseSkills, promptPlatform, pull, push, pushConfig, readCliSessionToken, resolvePlatformWithoutPrompt, resolveProjectRoot, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
package/dist/types/init.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { InitOptions, RoutingMode } from "@intlayer/engine/cli";
|
|
1
|
+
import { ContentLayout, InitOptions, RoutingMode } from "@intlayer/engine/cli";
|
|
2
2
|
//#region src/init.d.ts
|
|
3
3
|
export declare const findProjectRoot: (startDir: string) => string;
|
|
4
|
+
/** Resolves the project root from `--project-root`, else the working directory. */
|
|
5
|
+
export declare const resolveProjectRoot: (projectRoot?: string) => string;
|
|
4
6
|
/** Individually selectable setup steps exposed by the interactive init flow. */
|
|
5
|
-
export type InitStep = 'packages' | 'githubActions' | 'projectSetup' | 'vscodeExtension' | 'lsp' | 'eslint' | 'skills' | 'mcp' | 'infra' | 'cms' | 'chromeExtension';
|
|
7
|
+
export type InitStep = 'packages' | 'githubActions' | 'projectSetup' | 'vscodeExtension' | 'lsp' | 'eslint' | 'skills' | 'mcp' | 'infra' | 'cms' | 'repository' | 'chromeExtension';
|
|
6
8
|
/** A checkbox entry of the interactive init flow. */
|
|
7
9
|
export type InitStepOption = {
|
|
8
10
|
value: InitStep;
|
|
@@ -15,6 +17,40 @@ export type InitStepOption = {
|
|
|
15
17
|
* rather than modifying the project, so they must be an explicit choice.
|
|
16
18
|
*/
|
|
17
19
|
export declare const OPT_IN_INIT_STEPS: InitStep[];
|
|
20
|
+
/**
|
|
21
|
+
* Steps run by `intlayer init` without `--interactive`: install the packages
|
|
22
|
+
* and set up the framework. Every other step has its own command
|
|
23
|
+
* ({@link INIT_STEP_COMMANDS}), so nothing outside the app code is touched
|
|
24
|
+
* unless asked for.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_INIT_STEPS: InitStep[];
|
|
27
|
+
/**
|
|
28
|
+
* Command running each interactive step on its own, without prompts when every
|
|
29
|
+
* value is passed as a flag. Printed when `--interactive` has no terminal.
|
|
30
|
+
*/
|
|
31
|
+
export declare const INIT_STEP_COMMANDS: Record<InitStep, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Maps setup steps to the {@link initIntlayer} options: every step handled by
|
|
34
|
+
* `initIntlayer` that is not listed is skipped. Explicit `--no-*` flags in
|
|
35
|
+
* `baseOptions` still win over a listed step.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getInitOptionsForSteps: (steps: InitStep[], baseOptions?: InitOptions) => InitOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Runs the given {@link initIntlayer} steps only (packages, project setup, CI,
|
|
40
|
+
* VS Code extension, LSP, lint rules). Backs `intlayer init` and its
|
|
41
|
+
* single-step subcommands.
|
|
42
|
+
*/
|
|
43
|
+
export declare const initSteps: (projectRoot: string | undefined, steps: InitStep[], options?: InitOptions) => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Logs in to the Intlayer CMS through the browser, then stores the access-key
|
|
46
|
+
* credentials in `.env` and enables the editor in the config file.
|
|
47
|
+
*/
|
|
48
|
+
export declare const initCms: (projectRoot?: string) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Connects the git repository of the project to its CMS project (and sets
|
|
51
|
+
* its build settings) in the browser, pre-filled with the `origin` remote.
|
|
52
|
+
*/
|
|
53
|
+
export declare const initRepository: (projectRoot?: string) => Promise<void>;
|
|
18
54
|
/** Grouped checkbox entries of the interactive init flow, in display order. */
|
|
19
55
|
export declare const INIT_STEP_GROUPS: Record<string, InitStepOption[]>;
|
|
20
56
|
/**
|
|
@@ -28,6 +64,18 @@ export declare const LOCALE_ROUTING_CHOICES: LocaleRoutingChoice[];
|
|
|
28
64
|
export declare const parseLocaleRoutingChoice: (value: string) => LocaleRoutingChoice;
|
|
29
65
|
/** Maps a routing choice to the init options it sets. */
|
|
30
66
|
export declare const getRoutingInitOptions: (choice: LocaleRoutingChoice) => Pick<InitOptions, 'routingMode' | 'enableProxy'>;
|
|
67
|
+
/** Content layouts accepted by `--content`. */
|
|
68
|
+
export declare const CONTENT_LAYOUT_CHOICES: ContentLayout[];
|
|
69
|
+
/** Validates a `--content` value, throwing on an unknown layout. */
|
|
70
|
+
export declare const parseContentLayoutChoice: (value: string) => ContentLayout;
|
|
71
|
+
/** Init options set by the content layout questions / flags. */
|
|
72
|
+
type ContentInitOptions = Pick<InitOptions, 'contentLayout' | 'contentFormat' | 'contentMessageFormat'>;
|
|
73
|
+
/**
|
|
74
|
+
* Validates `--content` / `--content-format` / `--message-format` and maps
|
|
75
|
+
* them to the init options. The format must be one the layout accepts, and the
|
|
76
|
+
* message format only applies to JSON catalogs.
|
|
77
|
+
*/
|
|
78
|
+
export declare const getContentInitOptions: (layoutValue?: string, formatValue?: string, messageFormatValue?: string) => ContentInitOptions;
|
|
31
79
|
/** Known ESLint and oxlint configuration file names. */
|
|
32
80
|
export declare const ESLINT_CONFIG_FILES: string[];
|
|
33
81
|
/**
|
|
@@ -43,6 +91,11 @@ export declare const isEslintInstalled: (dependencies: Record<string, string>, r
|
|
|
43
91
|
export declare const getInitialInitSteps: (dependencies: Record<string, string>, root?: string) => InitStep[];
|
|
44
92
|
/** Reads the merged dependencies of the project at `root`. */
|
|
45
93
|
export declare const getProjectDependencies: (root: string) => Record<string, string>;
|
|
94
|
+
/**
|
|
95
|
+
* `intlayer init`: installs the packages and sets up the framework, or, with
|
|
96
|
+
* `interactive`, lets the user pick every setup step. `--interactive` needs a
|
|
97
|
+
* terminal; without one it fails and lists the single-step commands instead.
|
|
98
|
+
*/
|
|
46
99
|
export declare const init: (projectRoot?: string, options?: InitOptions, interactive?: boolean) => Promise<void>;
|
|
47
100
|
//#endregion
|
|
48
101
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/types/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;qBA4Ba,kBAAe;;qBAgBf,qBAAkB;;YAInB;;YAeA;EACV,OAAO;EACP;EACA;;;;;;;qBAQW,mBAAmB;;;;;;;qBAQnB,oBAAoB;;;;;qBAMpB,oBAAoB,OAAO;;;;;;qBAqB3B,yBAAsB,OAC1B,YAAU,cACH,gBACb;;;;;;qBAwBU,YAAS,iCACW,OACxB,YAAU,UACP,gBACT;;;;;qBAWU,UAAO,yBAAiC;;;;;qBAiBxC,iBAAc,yBAAiC;;qBAyB/C,kBAAkB,eAAe;;;;;YA2ElC,sBAAsB;;qBAoCrB,wBAAsB;;qBAKtB,2BAAwB,kBAAoB;;qBAI5C,wBAAqB,QACxB,wBACP,KAAK;;qBAoDK,wBAAsB;;qBAKtB,2BAAwB,kBAAoB;;KAIpD,qBAAqB,KACxB;;;;;;qBAaW,wBAAqB,sBACZ,sBACA,gCAEnB;;qBAwCU;;;;;qBAoBA,oBAAiB,cACd,wBAAsB;;;;;;qBAkBzB,sBAAmB,cAChB,wBAAsB,kBAEnC;;qBAcU,yBAAsB,iBAEhC;;;;;;qBA0MU,OAAI,sBACK,UACV,aAAW,0BACA"}
|
|
@@ -6,6 +6,24 @@ export declare const BROWSER_EXTENSION_OPTIONS: {
|
|
|
6
6
|
label: string;
|
|
7
7
|
hint: string;
|
|
8
8
|
}[];
|
|
9
|
-
|
|
9
|
+
/** Browsers the Intlayer extension is published for. */
|
|
10
|
+
export type ExtensionBrowser = 'chrome' | 'firefox';
|
|
11
|
+
/** Browsers accepted by `intlayer init extension --browser`. */
|
|
12
|
+
export declare const EXTENSION_BROWSERS: ExtensionBrowser[];
|
|
13
|
+
/** Store page of the Intlayer extension, per browser. */
|
|
14
|
+
export declare const EXTENSION_URL_BY_BROWSER: Record<ExtensionBrowser, string>;
|
|
15
|
+
/** Validates the `--browser` values, ignoring case. */
|
|
16
|
+
export declare const parseExtensionBrowsers: (values: string[]) => ExtensionBrowser[];
|
|
17
|
+
/** Options of {@link initChromeExtension}. */
|
|
18
|
+
export type InitChromeExtensionOptions = {
|
|
19
|
+
/** Browsers to open the store page for, skipping the prompt. */
|
|
20
|
+
browsers?: ExtensionBrowser[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Opens the store page of the Intlayer browser extension. The browsers are
|
|
24
|
+
* prompted for unless given; without a terminal (AI agents, CI) the store
|
|
25
|
+
* links are only printed, since the install needs a person anyway.
|
|
26
|
+
*/
|
|
27
|
+
export declare const initChromeExtension: (options?: InitChromeExtensionOptions) => Promise<void>;
|
|
10
28
|
//#endregion
|
|
11
29
|
//# sourceMappingURL=initChromeExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initChromeExtension.d.ts","names":[],"sources":["../../src/initChromeExtension.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"initChromeExtension.d.ts","names":[],"sources":["../../src/initChromeExtension.ts"],"mappings":";qBAKa;qBAGA;qBAGA;;;;;;YAcD;;qBAGC,oBAAoB;;qBAGpB,0BAA0B,OAAO;;qBAMjC,yBAAsB,qBAAuB;;YAO9C;;EAEV,WAAW;;;;;;;qBAQA,sBAAmB,UACrB,+BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initInfra.d.ts","names":[],"sources":["../../src/initInfra.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"initInfra.d.ts","names":[],"sources":["../../src/initInfra.ts"],"mappings":";;qBAQa;YAED,oBAAoB;;;;;;qBAOnB;qBACA;YAED;;EAEV,OAAO;;EAEP;;;;;;;qBA4CW,iBAAc,kBAAoB;;;;;;;qBA8BlC,YAAS,UACX,qBACR"}
|
package/dist/types/initMCP.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { Platform } from "@intlayer/engine/cli";
|
|
1
|
+
import { MCPTransport, Platform } from "@intlayer/engine/cli";
|
|
2
2
|
//#region src/initMCP.d.ts
|
|
3
|
-
|
|
3
|
+
/** Options of {@link initMCP}; anything omitted is prompted for. */
|
|
4
|
+
export type InitMCPOptions = {
|
|
5
|
+
/** AI platform to configure the MCP server for. */
|
|
6
|
+
platform?: Platform;
|
|
7
|
+
/** MCP transport. Defaults to `stdio` without a terminal. */
|
|
8
|
+
transport?: MCPTransport;
|
|
9
|
+
};
|
|
10
|
+
/** Validates a `--transport` value, ignoring case. */
|
|
11
|
+
export declare const parseMCPTransport: (value: string) => MCPTransport;
|
|
12
|
+
/**
|
|
13
|
+
* Configures the Intlayer MCP server for an AI platform. Without a terminal
|
|
14
|
+
* (AI agents, CI), nothing is prompted: the platform defaults to the detected
|
|
15
|
+
* one and the transport to `stdio`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const initMCP: (projectRoot?: string, options?: InitMCPOptions) => Promise<void>;
|
|
4
18
|
//#endregion
|
|
5
19
|
//# sourceMappingURL=initMCP.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMCP.d.ts","names":[],"sources":["../../src/initMCP.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"initMCP.d.ts","names":[],"sources":["../../src/initMCP.ts"],"mappings":";;;YAaY;;EAEV,WAAW;;EAEX,YAAY;;;qBAID,oBAAiB,kBAAoB;;;;;;qBAQrC,UAAO,sBACE,UACX,mBAAc"}
|
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
import { Platform } from "@intlayer/engine/cli";
|
|
1
|
+
import { Platform, Skill } from "@intlayer/engine/cli";
|
|
2
2
|
//#region src/initSkills.d.ts
|
|
3
3
|
export declare const PLATFORM_OPTIONS: Array<{
|
|
4
4
|
value: Platform;
|
|
5
5
|
label: string;
|
|
6
6
|
hint: string;
|
|
7
7
|
}>;
|
|
8
|
-
export declare const getDetectedPlatform: () => Platform | undefined;
|
|
9
8
|
/**
|
|
10
9
|
* Asks which AI platform the user is using, preselecting the detected one.
|
|
11
10
|
* Resolves to `undefined` when the prompt is cancelled.
|
|
12
11
|
*/
|
|
13
|
-
export declare const promptPlatform: () => Promise<Platform | undefined>;
|
|
12
|
+
export declare const promptPlatform: (projectRoot: string) => Promise<Platform | undefined>;
|
|
13
|
+
/** Options of {@link initSkills}; anything omitted is prompted for. */
|
|
14
|
+
export type InitSkillsOptions = {
|
|
15
|
+
/** AI platform to install the skills for. */
|
|
16
|
+
platform?: Platform;
|
|
17
|
+
/** Skills to install. Defaults to the ones matching the project stack. */
|
|
18
|
+
skills?: Skill[];
|
|
19
|
+
};
|
|
20
|
+
/** Validates a `--platform` value, ignoring case. */
|
|
21
|
+
export declare const parsePlatform: (value: string) => Platform;
|
|
22
|
+
/** Validates the `--skills` values, ignoring case. */
|
|
23
|
+
export declare const parseSkills: (values: string[]) => Skill[];
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the platform without prompting: the given one, else the detected
|
|
26
|
+
* one. Logs how to pass it and sets a failing exit code when neither exists.
|
|
27
|
+
*/
|
|
28
|
+
export declare const resolvePlatformWithoutPrompt: (projectRoot: string, platform: Platform | undefined, command: string) => Promise<Platform | undefined>;
|
|
14
29
|
/**
|
|
15
30
|
* Installs the Intlayer documentation skills. The skills are picked first, then
|
|
16
|
-
* the platform
|
|
17
|
-
*
|
|
31
|
+
* the platform. Without a terminal (AI agents, CI), nothing is prompted: the
|
|
32
|
+
* skills default to the project stack and the platform to the detected one.
|
|
33
|
+
* Resolves to the platform used, so a following step (e.g. MCP) can reuse it
|
|
34
|
+
* without asking again.
|
|
18
35
|
*/
|
|
19
|
-
export declare const initSkills: (projectRoot?: string,
|
|
36
|
+
export declare const initSkills: (projectRoot?: string, options?: InitSkillsOptions) => Promise<Platform | undefined>;
|
|
20
37
|
//#endregion
|
|
21
38
|
//# sourceMappingURL=initSkills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;qBAiBa,kBAAkB;EAC7B,OAAO;EACP;EACA;;;;;;qBAWW,iBAAc,wBAExB,QAAQ;;YA0BC;;EAEV,WAAW;;EAEX,SAAS;;;qBAIE,gBAAa,kBAAoB;;qBAIjC,cAAW,qBAAuB;;;;;qBAUlC,+BAA4B,qBACpB,UACT,sBAAoB,oBAE7B,QAAQ;;;;;;;;qBAsBE,aAAU,sBACD,UACX,sBACR,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveSync.d.ts","names":[],"sources":["../../src/liveSync.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"liveSync.d.ts","names":[],"sources":["../../src/liveSync.ts"],"mappings":";;KAiBK;EACH;EACA,gBAAgB;;qBAYL,WAAQ,UAAoB,oBAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReviewFileResult } from "./reviewDocSynthesis.js";
|
|
2
2
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
3
|
-
import { AIOptions } from "@intlayer/
|
|
3
|
+
import { AIOptions } from "@intlayer/ai";
|
|
4
4
|
import { ListGitFilesOptions } from "@intlayer/engine/cli";
|
|
5
5
|
import { Locale } from "@intlayer/types/allLocales";
|
|
6
6
|
//#region src/reviewDoc/reviewDoc.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"mappings":";;;;;;;;;;;;;;;YAkDY;KAEP;EACH;EACA,SAAS;EACT;EACA,YAAY;EACZ,YAAY;EACZ;EACA,gBAAgB;EAChB;EACA,yCAAyC;EACzC,wCAAwC;EACxC;EACA,aAAa;;EAEb,OAAO;;;;;;qBAOI,cAAS,YAAA,SAAA,qBAAA,YAAA,WAAA,6BAAA,eAAA,oBAAA,sBAAA,qBAAA,cAAA,YAAA,QAcnB,qBAAgB,QAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AIClient } from "../utils/setupAI.js";
|
|
2
2
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
3
|
-
import { AIOptions } from "@intlayer/
|
|
3
|
+
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
4
4
|
import { Locale } from "@intlayer/types/allLocales";
|
|
5
|
-
import { AIConfig } from "@intlayer/ai";
|
|
6
5
|
import { ReviewReportSummary } from "@intlayer/engine/docReview";
|
|
7
6
|
//#region src/reviewDoc/reviewDocBlockAware.d.ts
|
|
8
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewDocBlockAware.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDocBlockAware.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"reviewDocBlockAware.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDocBlockAware.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBA8Ca,uBAAoB,sBACX,wBACE,QACd,QAAM,YACF,QAAM,YACN,WAAS,gBACL,yBAAuB,6BACZ,yBACJ,WACZ,UAAQ,WACR,aACV,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AIClient } from "../utils/setupAI.js";
|
|
2
2
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
3
3
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
4
|
+
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
4
5
|
import { ListGitFilesOptions } from "@intlayer/engine/cli";
|
|
5
6
|
import { Locale } from "@intlayer/types/allLocales";
|
|
6
|
-
import { AIConfig, AIOptions } from "@intlayer/ai";
|
|
7
7
|
//#region src/translateDoc/types.d.ts
|
|
8
8
|
export type ErrorState = {
|
|
9
9
|
count: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IntlayerAPIProxy } from "@intlayer/api";
|
|
1
2
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
2
|
-
import { AIOptions
|
|
3
|
+
import { AIOptions } from "@intlayer/ai";
|
|
3
4
|
//#region src/utils/checkAccess.d.ts
|
|
4
5
|
export declare const getAuthenticatedAPI: (configuration?: IntlayerConfig) => Promise<IntlayerAPIProxy>;
|
|
5
6
|
export declare const checkCMSAuth: (configuration: IntlayerConfig, shouldCheckConfigConsistency?: boolean, shouldAutoLogin?: boolean) => Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"mappings":";;;;qBAWa,sBAAmB,gBACd,mBACf,QAAQ;qBAiDE,eAAY,eACR,gBAAc,wCACQ,8BAEpC;qBA4GU,gBAAa,eACT,gBAAc,YACjB,WAAS,2CAEpB"}
|