@doubledigit/cli 0.1.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/LICENSE +21 -0
- package/dist/codegen.d.ts +12 -0
- package/dist/codegen.d.ts.map +1 -0
- package/dist/codegen.js +107 -0
- package/dist/commands/add.d.ts +26 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +548 -0
- package/dist/commands/browse.d.ts +8 -0
- package/dist/commands/browse.d.ts.map +1 -0
- package/dist/commands/browse.js +116 -0
- package/dist/commands/create.d.ts +12 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +218 -0
- package/dist/commands/db.d.ts +2 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +64 -0
- package/dist/commands/disable.d.ts +5 -0
- package/dist/commands/disable.d.ts.map +1 -0
- package/dist/commands/disable.js +29 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +88 -0
- package/dist/commands/enable.d.ts +5 -0
- package/dist/commands/enable.d.ts.map +1 -0
- package/dist/commands/enable.js +29 -0
- package/dist/commands/info.d.ts +8 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +84 -0
- package/dist/commands/list.d.ts +5 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +44 -0
- package/dist/commands/marketplace.d.ts +11 -0
- package/dist/commands/marketplace.d.ts.map +1 -0
- package/dist/commands/marketplace.js +205 -0
- package/dist/commands/onboard.d.ts +2 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +58 -0
- package/dist/commands/outdated.d.ts +8 -0
- package/dist/commands/outdated.d.ts.map +1 -0
- package/dist/commands/outdated.js +107 -0
- package/dist/commands/reconcile.d.ts +12 -0
- package/dist/commands/reconcile.d.ts.map +1 -0
- package/dist/commands/reconcile.js +175 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +37 -0
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +34 -0
- package/dist/commands/uninstall.d.ts +14 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +190 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +37 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +181 -0
- package/dist/lib/github-auth.d.ts +8 -0
- package/dist/lib/github-auth.d.ts.map +1 -0
- package/dist/lib/github-auth.js +30 -0
- package/dist/lib/lock-file.d.ts +67 -0
- package/dist/lib/lock-file.d.ts.map +1 -0
- package/dist/lib/lock-file.js +117 -0
- package/dist/lib/marketplace-schema.d.ts +607 -0
- package/dist/lib/marketplace-schema.d.ts.map +1 -0
- package/dist/lib/marketplace-schema.js +111 -0
- package/dist/lib/marketplace.d.ts +57 -0
- package/dist/lib/marketplace.d.ts.map +1 -0
- package/dist/lib/marketplace.js +270 -0
- package/dist/lib/onboarding.d.ts +84 -0
- package/dist/lib/onboarding.d.ts.map +1 -0
- package/dist/lib/onboarding.js +1004 -0
- package/dist/lib/rewrite-extension-tsconfig.d.ts +22 -0
- package/dist/lib/rewrite-extension-tsconfig.d.ts.map +1 -0
- package/dist/lib/rewrite-extension-tsconfig.js +80 -0
- package/dist/lib/source-parser.d.ts +35 -0
- package/dist/lib/source-parser.d.ts.map +1 -0
- package/dist/lib/source-parser.js +121 -0
- package/dist/lib/validators.d.ts +73 -0
- package/dist/lib/validators.d.ts.map +1 -0
- package/dist/lib/validators.js +435 -0
- package/dist/paths.d.ts +46 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +85 -0
- package/dist/scanner.d.ts +41 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +100 -0
- package/package.json +49 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite an extension package's tsconfig.json so its relative references
|
|
3
|
+
* (extends, compilerOptions.paths) remain correct after installation into
|
|
4
|
+
* a deeper directory (extensions/<kind>/<name>/ instead of packages/<name>/).
|
|
5
|
+
*
|
|
6
|
+
* Packages authored against the old `packages/<name>/` depth (2 levels from
|
|
7
|
+
* monorepo root) typically use:
|
|
8
|
+
* - `../../tsconfig.base.json` for `extends`
|
|
9
|
+
* - `../shared/...`, `../auth/...`, `../adapters/...` sibling path aliases
|
|
10
|
+
*
|
|
11
|
+
* Extensions live at depth 3 (`extensions/<kind>/<name>/`), so those legacy
|
|
12
|
+
* sibling aliases need to become `../../../packages/...`.
|
|
13
|
+
*
|
|
14
|
+
* Important: this helper must not re-rewrite already-correct extension paths.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Adjust tsconfig.json relative paths for the actual installation depth.
|
|
18
|
+
* No-op when the package is already at the standard packages/<name>/ depth
|
|
19
|
+
* or when no tsconfig.json exists.
|
|
20
|
+
*/
|
|
21
|
+
export declare function rewriteExtensionTsconfig(packageDir: string, monorepoRoot: string): void;
|
|
22
|
+
//# sourceMappingURL=rewrite-extension-tsconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite-extension-tsconfig.d.ts","sourceRoot":"","sources":["../../src/lib/rewrite-extension-tsconfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,IAAI,CA2DN"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite an extension package's tsconfig.json so its relative references
|
|
3
|
+
* (extends, compilerOptions.paths) remain correct after installation into
|
|
4
|
+
* a deeper directory (extensions/<kind>/<name>/ instead of packages/<name>/).
|
|
5
|
+
*
|
|
6
|
+
* Packages authored against the old `packages/<name>/` depth (2 levels from
|
|
7
|
+
* monorepo root) typically use:
|
|
8
|
+
* - `../../tsconfig.base.json` for `extends`
|
|
9
|
+
* - `../shared/...`, `../auth/...`, `../adapters/...` sibling path aliases
|
|
10
|
+
*
|
|
11
|
+
* Extensions live at depth 3 (`extensions/<kind>/<name>/`), so those legacy
|
|
12
|
+
* sibling aliases need to become `../../../packages/...`.
|
|
13
|
+
*
|
|
14
|
+
* Important: this helper must not re-rewrite already-correct extension paths.
|
|
15
|
+
*/
|
|
16
|
+
import fs from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
/** Depth of the legacy packages/<name>/ layout relative to monorepo root. */
|
|
19
|
+
const LEGACY_DEPTH = 2;
|
|
20
|
+
const LEGACY_EXTENDS_PREFIX = '../'.repeat(LEGACY_DEPTH);
|
|
21
|
+
const LEGACY_SIBLING_PREFIX = '../';
|
|
22
|
+
/**
|
|
23
|
+
* Adjust tsconfig.json relative paths for the actual installation depth.
|
|
24
|
+
* No-op when the package is already at the standard packages/<name>/ depth
|
|
25
|
+
* or when no tsconfig.json exists.
|
|
26
|
+
*/
|
|
27
|
+
export function rewriteExtensionTsconfig(packageDir, monorepoRoot) {
|
|
28
|
+
const tsconfigPath = path.join(packageDir, 'tsconfig.json');
|
|
29
|
+
if (!fs.existsSync(tsconfigPath))
|
|
30
|
+
return;
|
|
31
|
+
let tsconfig;
|
|
32
|
+
try {
|
|
33
|
+
tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, 'utf-8'));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const depth = path.relative(monorepoRoot, packageDir).split(path.sep).length;
|
|
39
|
+
if (depth === LEGACY_DEPTH)
|
|
40
|
+
return;
|
|
41
|
+
const newRootPrefix = '../'.repeat(depth);
|
|
42
|
+
const newPackagesPrefix = `${newRootPrefix}packages/`;
|
|
43
|
+
let changed = false;
|
|
44
|
+
// Fix "extends"
|
|
45
|
+
if (typeof tsconfig.extends === 'string' &&
|
|
46
|
+
!tsconfig.extends.startsWith(newRootPrefix) &&
|
|
47
|
+
tsconfig.extends.startsWith(LEGACY_EXTENDS_PREFIX)) {
|
|
48
|
+
tsconfig.extends =
|
|
49
|
+
newRootPrefix +
|
|
50
|
+
tsconfig.extends.slice(LEGACY_EXTENDS_PREFIX.length);
|
|
51
|
+
changed = true;
|
|
52
|
+
}
|
|
53
|
+
// Fix compilerOptions.paths values
|
|
54
|
+
const co = tsconfig.compilerOptions;
|
|
55
|
+
if (co?.paths && typeof co.paths === 'object') {
|
|
56
|
+
const paths = co.paths;
|
|
57
|
+
for (const [key, value] of Object.entries(paths)) {
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
paths[key] = value.map((v) => {
|
|
60
|
+
if (typeof v !== 'string')
|
|
61
|
+
return v;
|
|
62
|
+
if (v.startsWith(newRootPrefix))
|
|
63
|
+
return v;
|
|
64
|
+
if (v.startsWith(LEGACY_EXTENDS_PREFIX)) {
|
|
65
|
+
changed = true;
|
|
66
|
+
return newRootPrefix + v.slice(LEGACY_EXTENDS_PREFIX.length);
|
|
67
|
+
}
|
|
68
|
+
if (v.startsWith(LEGACY_SIBLING_PREFIX)) {
|
|
69
|
+
changed = true;
|
|
70
|
+
return newPackagesPrefix + v.slice(LEGACY_SIBLING_PREFIX.length);
|
|
71
|
+
}
|
|
72
|
+
return v;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (changed) {
|
|
78
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + '\n', 'utf-8');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse GitHub source URLs into structured objects.
|
|
3
|
+
*
|
|
4
|
+
* Supported formats:
|
|
5
|
+
* gh:owner/repo
|
|
6
|
+
* gh:owner/repo/path/to/subdir
|
|
7
|
+
* gh:owner/repo#branch
|
|
8
|
+
* gh:owner/repo/path#v1.0.0
|
|
9
|
+
* github:owner/repo/path
|
|
10
|
+
* https://github.com/owner/repo/tree/main
|
|
11
|
+
*/
|
|
12
|
+
export interface ParsedSource {
|
|
13
|
+
type: 'github';
|
|
14
|
+
owner: string;
|
|
15
|
+
repo: string;
|
|
16
|
+
subdir?: string;
|
|
17
|
+
ref?: string;
|
|
18
|
+
/** Reconstructed giget-compatible template string */
|
|
19
|
+
templateString: string;
|
|
20
|
+
/** Human-readable display string */
|
|
21
|
+
displayString: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Note on full GitHub URLs with refs containing slashes (e.g. feature/foo):
|
|
25
|
+
* The URL parser assumes the ref is a single path segment. For branches like
|
|
26
|
+
* `feature/foo`, use the shorthand syntax instead:
|
|
27
|
+
* gh:owner/repo/path#feature/foo
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Parse a source string into a structured ParsedSource object.
|
|
31
|
+
*
|
|
32
|
+
* @throws {Error} if the source string is invalid or missing required parts
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseSource(source: string): ParsedSource;
|
|
35
|
+
//# sourceMappingURL=source-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-parser.d.ts","sourceRoot":"","sources":["../../src/lib/source-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB;AAMD;;;;;GAKG;AAEH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA4CxD"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse GitHub source URLs into structured objects.
|
|
3
|
+
*
|
|
4
|
+
* Supported formats:
|
|
5
|
+
* gh:owner/repo
|
|
6
|
+
* gh:owner/repo/path/to/subdir
|
|
7
|
+
* gh:owner/repo#branch
|
|
8
|
+
* gh:owner/repo/path#v1.0.0
|
|
9
|
+
* github:owner/repo/path
|
|
10
|
+
* https://github.com/owner/repo/tree/main
|
|
11
|
+
*/
|
|
12
|
+
const SHORTHAND_RE = /^(?:gh|github):(.+)$/;
|
|
13
|
+
const GITHUB_URL_RE = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/;
|
|
14
|
+
/**
|
|
15
|
+
* Note on full GitHub URLs with refs containing slashes (e.g. feature/foo):
|
|
16
|
+
* The URL parser assumes the ref is a single path segment. For branches like
|
|
17
|
+
* `feature/foo`, use the shorthand syntax instead:
|
|
18
|
+
* gh:owner/repo/path#feature/foo
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Parse a source string into a structured ParsedSource object.
|
|
22
|
+
*
|
|
23
|
+
* @throws {Error} if the source string is invalid or missing required parts
|
|
24
|
+
*/
|
|
25
|
+
export function parseSource(source) {
|
|
26
|
+
if (!source || typeof source !== 'string') {
|
|
27
|
+
throw new Error('Source string is required');
|
|
28
|
+
}
|
|
29
|
+
const trimmed = source.trim();
|
|
30
|
+
// Full GitHub URL: https://github.com/owner/repo/tree/branch
|
|
31
|
+
const urlMatch = trimmed.match(GITHUB_URL_RE);
|
|
32
|
+
if (urlMatch) {
|
|
33
|
+
if (urlMatch[4]) {
|
|
34
|
+
throw new Error('Full GitHub URLs with subdirectories are ambiguous because refs can contain slashes.\n' +
|
|
35
|
+
`Use the shorthand syntax instead:\n gh:${urlMatch[1]}/${urlMatch[2]}/${urlMatch[4]}#${urlMatch[3]}`);
|
|
36
|
+
}
|
|
37
|
+
return buildParsedSource(urlMatch[1], urlMatch[2], undefined, urlMatch[3]);
|
|
38
|
+
}
|
|
39
|
+
// Shorthand: gh:owner/repo/path#ref or github:owner/repo/path#ref
|
|
40
|
+
const shortMatch = trimmed.match(SHORTHAND_RE);
|
|
41
|
+
if (shortMatch) {
|
|
42
|
+
return parseShorthand(shortMatch[1]);
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`Invalid source format: "${trimmed}"\n` +
|
|
45
|
+
'Expected one of:\n' +
|
|
46
|
+
' gh:owner/repo\n' +
|
|
47
|
+
' gh:owner/repo/path/to/subdir\n' +
|
|
48
|
+
' gh:owner/repo#branch\n' +
|
|
49
|
+
' gh:owner/repo/path#v1.0.0\n' +
|
|
50
|
+
' github:owner/repo/path\n' +
|
|
51
|
+
' https://github.com/owner/repo/tree/branch\n' +
|
|
52
|
+
'\n' +
|
|
53
|
+
'Note: For subdirectories or refs with slashes (e.g. feature/foo), use shorthand:\n' +
|
|
54
|
+
' gh:owner/repo/path#feature/foo');
|
|
55
|
+
}
|
|
56
|
+
function parseShorthand(body) {
|
|
57
|
+
// Split off #ref first
|
|
58
|
+
let ref;
|
|
59
|
+
let pathPart = body;
|
|
60
|
+
const hashIdx = body.indexOf('#');
|
|
61
|
+
if (hashIdx !== -1) {
|
|
62
|
+
ref = body.slice(hashIdx + 1);
|
|
63
|
+
pathPart = body.slice(0, hashIdx);
|
|
64
|
+
if (!ref) {
|
|
65
|
+
throw new Error('Empty ref after "#" — specify a branch, tag, or commit SHA');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const segments = pathPart.split('/').filter(Boolean);
|
|
69
|
+
if (segments.length < 2) {
|
|
70
|
+
throw new Error(`Invalid source: expected at least "owner/repo" but got "${pathPart}"`);
|
|
71
|
+
}
|
|
72
|
+
const owner = segments[0];
|
|
73
|
+
const repo = segments[1];
|
|
74
|
+
const subdir = segments.length > 2 ? segments.slice(2).join('/') : undefined;
|
|
75
|
+
return buildParsedSource(owner, repo, subdir, ref);
|
|
76
|
+
}
|
|
77
|
+
const GITHUB_NAME_RE = /^[a-zA-Z0-9._-]+$/;
|
|
78
|
+
function buildParsedSource(owner, repo, subdir, ref) {
|
|
79
|
+
if (!owner || !repo) {
|
|
80
|
+
throw new Error('Owner and repo are required in the source string');
|
|
81
|
+
}
|
|
82
|
+
// Validate owner/repo against GitHub's allowed character set
|
|
83
|
+
if (!GITHUB_NAME_RE.test(owner)) {
|
|
84
|
+
throw new Error(`Invalid GitHub owner: "${owner}" — must match [a-zA-Z0-9._-]`);
|
|
85
|
+
}
|
|
86
|
+
if (!GITHUB_NAME_RE.test(repo)) {
|
|
87
|
+
throw new Error(`Invalid GitHub repo: "${repo}" — must match [a-zA-Z0-9._-]`);
|
|
88
|
+
}
|
|
89
|
+
// Reject `.` and `..` — they pass the regex but are path traversal hazards
|
|
90
|
+
if (owner === '.' || owner === '..') {
|
|
91
|
+
throw new Error(`Invalid GitHub owner: "${owner}" — path traversal not allowed`);
|
|
92
|
+
}
|
|
93
|
+
if (repo === '.' || repo === '..') {
|
|
94
|
+
throw new Error(`Invalid GitHub repo: "${repo}" — path traversal not allowed`);
|
|
95
|
+
}
|
|
96
|
+
// Reject path traversal in subdir
|
|
97
|
+
if (subdir && subdir.split('/').some((seg) => seg === '..' || seg === '.')) {
|
|
98
|
+
throw new Error(`Invalid subdirectory path: "${subdir}" — path traversal not allowed`);
|
|
99
|
+
}
|
|
100
|
+
// Build giget-compatible template string: gh:owner/repo/subdir#ref
|
|
101
|
+
let templateString = `gh:${owner}/${repo}`;
|
|
102
|
+
if (subdir)
|
|
103
|
+
templateString += `/${subdir}`;
|
|
104
|
+
if (ref)
|
|
105
|
+
templateString += `#${ref}`;
|
|
106
|
+
// Human-readable display: owner/repo/subdir@ref or owner/repo/subdir
|
|
107
|
+
let displayString = `${owner}/${repo}`;
|
|
108
|
+
if (subdir)
|
|
109
|
+
displayString += `/${subdir}`;
|
|
110
|
+
if (ref)
|
|
111
|
+
displayString += `@${ref}`;
|
|
112
|
+
return {
|
|
113
|
+
type: 'github',
|
|
114
|
+
owner,
|
|
115
|
+
repo,
|
|
116
|
+
subdir,
|
|
117
|
+
ref,
|
|
118
|
+
templateString,
|
|
119
|
+
displayString,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-install validation checks for `dd install`.
|
|
3
|
+
*
|
|
4
|
+
* Validates local directory conflicts, remote repository existence,
|
|
5
|
+
* downloaded package structure, and slug prefix collisions before
|
|
6
|
+
* (or just after) downloading from GitHub.
|
|
7
|
+
*/
|
|
8
|
+
import type { ParsedSource } from './source-parser.js';
|
|
9
|
+
import type { ExtensionKind } from './marketplace-schema.js';
|
|
10
|
+
export interface ValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
errors: string[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface ManagedPackageMetadata {
|
|
16
|
+
npmName?: string;
|
|
17
|
+
kind?: ExtensionKind;
|
|
18
|
+
isManagedExtension: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a local directory already exists for this app name across
|
|
22
|
+
* all known installation roots (packages/, extensions/micro-apps/,
|
|
23
|
+
* extensions/payload-plugins/).
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateLocalDirectory(scanRoots: string[], appName: string): ValidationResult;
|
|
26
|
+
/**
|
|
27
|
+
* Check if an app with this name already exists in any of the
|
|
28
|
+
* installation roots.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateNoNameCollision(scanRoots: string[], appName: string): ValidationResult;
|
|
31
|
+
/**
|
|
32
|
+
* Validate that the remote GitHub repository exists and the path is accessible.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateRemoteSource(source: ParsedSource): Promise<ValidationResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Detect the extension kind from a downloaded package's package.json.
|
|
37
|
+
* Returns 'payload-plugin' when ddPackageType is set, otherwise 'micro-app'.
|
|
38
|
+
*/
|
|
39
|
+
export declare function detectPackageKind(packageDir: string): ExtensionKind;
|
|
40
|
+
/**
|
|
41
|
+
* Read package.json metadata without importing the package.
|
|
42
|
+
* Returns whether the directory looks like a dd-managed extension.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readManagedPackageMetadata(packageDir: string): ManagedPackageMetadata;
|
|
45
|
+
/**
|
|
46
|
+
* After download: validate the downloaded package has the correct structure.
|
|
47
|
+
* When kind is 'payload-plugin', checks for ddPackageType instead of ddapp.
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateDownloadedPackage(packageDir: string, kind?: ExtensionKind): ValidationResult;
|
|
50
|
+
export declare function resolvePackageEntryPoint(packageDir: string, pkg: Record<string, unknown>): string | null;
|
|
51
|
+
export declare function extractMicroAppMetadata(packageDir: string, pkg: Record<string, unknown>, preferredEntryPoint?: string): {
|
|
52
|
+
key?: string;
|
|
53
|
+
slugPrefix?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Check slug prefix collisions with existing installed dd apps across
|
|
57
|
+
* all known package roots.
|
|
58
|
+
*
|
|
59
|
+
* Scans index files for `slugPrefix: '...'` patterns since we cannot
|
|
60
|
+
* import the modules at CLI time.
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateSlugPrefix(scanRoots: string[], slugPrefix: string, excludeKey?: string): ValidationResult;
|
|
63
|
+
/**
|
|
64
|
+
* Check if another installed workspace package already uses the same npm name.
|
|
65
|
+
* This prevents installing the same payload plugin under multiple folder aliases.
|
|
66
|
+
* Scans all known package roots including extensions/.
|
|
67
|
+
*/
|
|
68
|
+
export declare function validateNoPackageNameCollision(scanRoots: string[], npmName: string, excludeKey?: string): ValidationResult;
|
|
69
|
+
/**
|
|
70
|
+
* Run all pre-install validations (local + remote) in one call.
|
|
71
|
+
*/
|
|
72
|
+
export declare function runPreInstallValidation(scanRoots: string[], appName: string, source: ParsedSource): Promise<ValidationResult>;
|
|
73
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/lib/validators.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AA0BD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,GACd,gBAAgB,CAWlB;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,GACd,gBAAgB,CAgClB;AAMD;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA2E3B;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAEnE;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GACjB,sBAAsB,CAsBxB;AAMD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,aAAa,GACnB,gBAAgB,CA+ClB;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,GAAG,IAAI,CAgCf;AAqDD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,mBAAmB,CAAC,EAAE,MAAM,GAC3B;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAwBvC;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB,CAyClB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB,CAiClB;AAMD;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAY3B"}
|