anlyx 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/README.md +13 -0
- package/dist/config-loader.d.ts +8 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +53 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/dev-command.d.ts +35 -0
- package/dist/dev-command.d.ts.map +1 -0
- package/dist/dev-command.js +143 -0
- package/dist/dev-command.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +245 -0
- package/dist/index.js.map +1 -0
- package/dist/init-command.d.ts +12 -0
- package/dist/init-command.d.ts.map +1 -0
- package/dist/init-command.js +78 -0
- package/dist/init-command.js.map +1 -0
- package/dist/scan-command.d.ts +45 -0
- package/dist/scan-command.d.ts.map +1 -0
- package/dist/scan-command.js +153 -0
- package/dist/scan-command.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 suhannoh
|
|
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
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type NormalizedAnlyxConfig } from "@anlyx/core";
|
|
2
|
+
export type LoadConfigOptions = {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
configPath?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function findConfigFile(cwd: string): Promise<string | null>;
|
|
7
|
+
export declare function loadConfig(options?: LoadConfigOptions): Promise<NormalizedAnlyxConfig>;
|
|
8
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAU1E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxE;AAED,wBAAsB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgBhG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
import { normalizeConfig } from "@anlyx/core";
|
|
4
|
+
import { createJiti } from "jiti";
|
|
5
|
+
const CONFIG_FILE_NAMES = [
|
|
6
|
+
"anlyx.config.ts",
|
|
7
|
+
"anlyx.config.mjs",
|
|
8
|
+
"anlyx.config.js",
|
|
9
|
+
"anlyx.config.cjs"
|
|
10
|
+
];
|
|
11
|
+
export async function findConfigFile(cwd) {
|
|
12
|
+
for (const fileName of CONFIG_FILE_NAMES) {
|
|
13
|
+
const candidate = join(cwd, fileName);
|
|
14
|
+
if (await fileExists(candidate)) {
|
|
15
|
+
return candidate;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
export async function loadConfig(options = {}) {
|
|
21
|
+
const cwd = options.cwd ?? process.cwd();
|
|
22
|
+
const configPath = options.configPath
|
|
23
|
+
? resolveConfigPath(cwd, options.configPath)
|
|
24
|
+
: await findConfigFile(cwd);
|
|
25
|
+
if (!configPath) {
|
|
26
|
+
throw new Error(`Anlyx config file not found in ${cwd}`);
|
|
27
|
+
}
|
|
28
|
+
if (!(await fileExists(configPath))) {
|
|
29
|
+
throw new Error(`Anlyx config file not found: ${configPath}`);
|
|
30
|
+
}
|
|
31
|
+
const loadedConfig = await importConfigFile(configPath);
|
|
32
|
+
return normalizeConfig(loadedConfig);
|
|
33
|
+
}
|
|
34
|
+
async function fileExists(path) {
|
|
35
|
+
try {
|
|
36
|
+
await access(path);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function resolveConfigPath(cwd, configPath) {
|
|
44
|
+
return isAbsolute(configPath) ? configPath : resolve(cwd, configPath);
|
|
45
|
+
}
|
|
46
|
+
async function importConfigFile(configPath) {
|
|
47
|
+
const jiti = createJiti(import.meta.url, {
|
|
48
|
+
fsCache: false,
|
|
49
|
+
moduleCache: false
|
|
50
|
+
});
|
|
51
|
+
return jiti.import(configPath, { default: true });
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=config-loader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AAK,CAAC,gCAAgC,UAAU,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxD,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW,EAAE,UAAkB;IACxD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IAChD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACvC,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ScanResult } from "@anlyx/core";
|
|
2
|
+
import { loadConfig } from "./config-loader.js";
|
|
3
|
+
export type DevCommandOptions = {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
configPath?: string;
|
|
6
|
+
outputDir?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
dependencies?: DevCommandDependencies;
|
|
10
|
+
};
|
|
11
|
+
export type DevCommandResult = {
|
|
12
|
+
url: string;
|
|
13
|
+
port: number;
|
|
14
|
+
reportDataPath: string;
|
|
15
|
+
};
|
|
16
|
+
export type DevCommandDependencies = {
|
|
17
|
+
loadConfig?: typeof loadConfig;
|
|
18
|
+
readReportData?: (path: string) => Promise<ScanResult>;
|
|
19
|
+
createLocalUiServer?: (options: LocalUiServerOptions) => Promise<LocalUiServer>;
|
|
20
|
+
openBrowser?: (url: string) => Promise<void> | void;
|
|
21
|
+
};
|
|
22
|
+
export type LocalUiServerOptions = {
|
|
23
|
+
port: number;
|
|
24
|
+
reportData: ScanResult;
|
|
25
|
+
viewerRoot: string;
|
|
26
|
+
};
|
|
27
|
+
export type LocalUiServer = {
|
|
28
|
+
url: string;
|
|
29
|
+
close?: () => Promise<void> | void;
|
|
30
|
+
};
|
|
31
|
+
export declare function runDevCommand(options?: DevCommandOptions): Promise<DevCommandResult>;
|
|
32
|
+
export declare function readReportData(path: string): Promise<ScanResult>;
|
|
33
|
+
export declare function createLocalUiServer(options: LocalUiServerOptions): Promise<LocalUiServer>;
|
|
34
|
+
export declare function openBrowser(url: string): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=dev-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-command.d.ts","sourceRoot":"","sources":["../src/dev-command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAG5F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,CAAC,EAAE,OAAO,UAAU,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACvD,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAChF,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACpC,CAAC;AAIF,wBAAsB,aAAa,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0B9F;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAuCtE;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB/F;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ5D"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { scanResultSchema } from "@anlyx/core";
|
|
7
|
+
import { createServer } from "vite";
|
|
8
|
+
import { loadConfig } from "./config-loader.js";
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
export async function runDevCommand(options = {}) {
|
|
11
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
12
|
+
const dependencies = withDefaultDependencies(options.dependencies);
|
|
13
|
+
const config = await dependencies.loadConfig({
|
|
14
|
+
cwd,
|
|
15
|
+
...(options.configPath ? { configPath: options.configPath } : {})
|
|
16
|
+
});
|
|
17
|
+
const reportDataPath = join(resolve(cwd, options.outputDir ?? ".anlyx"), "report-data.json");
|
|
18
|
+
const reportData = await dependencies.readReportData(reportDataPath);
|
|
19
|
+
const port = options.port ?? getConfiguredPort(config);
|
|
20
|
+
const server = await dependencies.createLocalUiServer({
|
|
21
|
+
port,
|
|
22
|
+
reportData,
|
|
23
|
+
viewerRoot: getViewerRoot()
|
|
24
|
+
});
|
|
25
|
+
const shouldOpenBrowser = options.open ?? config.server.openBrowser;
|
|
26
|
+
if (shouldOpenBrowser) {
|
|
27
|
+
await dependencies.openBrowser(server.url);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
url: server.url,
|
|
31
|
+
port,
|
|
32
|
+
reportDataPath
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export async function readReportData(path) {
|
|
36
|
+
let content;
|
|
37
|
+
try {
|
|
38
|
+
content = await readFile(path, "utf8");
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
42
|
+
throw new Error(`Anlyx report data not found: ${path}. Run "anlyx scan" first.`);
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(content);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error(`Failed to parse Anlyx report data JSON at ${path}: ${error instanceof Error ? error.message : "invalid JSON"}`);
|
|
52
|
+
}
|
|
53
|
+
const result = scanResultSchema.safeParse(parsed);
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
const issues = result.error.issues
|
|
56
|
+
.map((issue) => {
|
|
57
|
+
const issuePath = issue.path.length > 0 ? issue.path.join(".") : "report-data";
|
|
58
|
+
return `${issuePath}: ${issue.message}`;
|
|
59
|
+
})
|
|
60
|
+
.join("; ");
|
|
61
|
+
throw new Error(`Invalid Anlyx report data at ${path}: ${issues}`);
|
|
62
|
+
}
|
|
63
|
+
return result.data;
|
|
64
|
+
}
|
|
65
|
+
export async function createLocalUiServer(options) {
|
|
66
|
+
const viteServer = await createServer({
|
|
67
|
+
root: options.viewerRoot,
|
|
68
|
+
appType: "spa",
|
|
69
|
+
server: {
|
|
70
|
+
host: "127.0.0.1",
|
|
71
|
+
port: options.port,
|
|
72
|
+
strictPort: true
|
|
73
|
+
},
|
|
74
|
+
plugins: [createReportDataPlugin(options.reportData)]
|
|
75
|
+
});
|
|
76
|
+
await viteServer.listen();
|
|
77
|
+
return {
|
|
78
|
+
url: `http://localhost:${options.port}`,
|
|
79
|
+
close: () => viteServer.close()
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export async function openBrowser(url) {
|
|
83
|
+
const { command, args } = getOpenBrowserCommand(url);
|
|
84
|
+
const child = spawn(command, args, {
|
|
85
|
+
detached: true,
|
|
86
|
+
stdio: "ignore"
|
|
87
|
+
});
|
|
88
|
+
child.unref();
|
|
89
|
+
}
|
|
90
|
+
function createReportDataPlugin(reportData) {
|
|
91
|
+
return {
|
|
92
|
+
name: "anlyx-report-data",
|
|
93
|
+
configureServer(server) {
|
|
94
|
+
server.middlewares.use((request, response, next) => {
|
|
95
|
+
if (request.method === "GET" && request.url === "/") {
|
|
96
|
+
request.url = "/viewer.html";
|
|
97
|
+
}
|
|
98
|
+
next();
|
|
99
|
+
});
|
|
100
|
+
server.middlewares.use("/api/report-data", (request, response, next) => {
|
|
101
|
+
if (request.method !== "GET") {
|
|
102
|
+
next();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
response.statusCode = 200;
|
|
106
|
+
response.setHeader("content-type", "application/json; charset=utf-8");
|
|
107
|
+
response.end(JSON.stringify(reportData));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function withDefaultDependencies(dependencies) {
|
|
113
|
+
return {
|
|
114
|
+
loadConfig: dependencies?.loadConfig ?? loadConfig,
|
|
115
|
+
readReportData: dependencies?.readReportData ?? readReportData,
|
|
116
|
+
createLocalUiServer: dependencies?.createLocalUiServer ?? createLocalUiServer,
|
|
117
|
+
openBrowser: dependencies?.openBrowser ?? openBrowser
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function getConfiguredPort(config) {
|
|
121
|
+
return config.server.port ?? 4777;
|
|
122
|
+
}
|
|
123
|
+
function getViewerRoot() {
|
|
124
|
+
try {
|
|
125
|
+
return dirname(require.resolve("@anlyx/ui/viewer"));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return dirname(fileURLToPath(new URL("../../ui/dist/viewer/viewer.html", import.meta.url)));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function getOpenBrowserCommand(url) {
|
|
132
|
+
if (process.platform === "darwin") {
|
|
133
|
+
return { command: "open", args: [url] };
|
|
134
|
+
}
|
|
135
|
+
if (process.platform === "win32") {
|
|
136
|
+
return { command: "cmd", args: ["/c", "start", "", url] };
|
|
137
|
+
}
|
|
138
|
+
return { command: "xdg-open", args: [url] };
|
|
139
|
+
}
|
|
140
|
+
function isNodeError(error) {
|
|
141
|
+
return error instanceof Error && "code" in error;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=dev-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-command.js","sourceRoot":"","sources":["../src/dev-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ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ACpC,CAAC;AAED,SAAS,aAAa;IACpB,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,kCAAkC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,GAAW;IACxC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1C,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AACnD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export { defineConfig } from "@anlyx/core";
|
|
3
|
+
export type { AnlyxConfig, NormalizedAnlyxConfig } from "@anlyx/core";
|
|
4
|
+
export { findConfigFile, loadConfig } from "./config-loader.js";
|
|
5
|
+
export type { LoadConfigOptions } from "./config-loader.js";
|
|
6
|
+
export { createLocalUiServer, openBrowser, readReportData, runDevCommand } from "./dev-command.js";
|
|
7
|
+
export type { DevCommandDependencies, DevCommandOptions, DevCommandResult, LocalUiServer, LocalUiServerOptions } from "./dev-command.js";
|
|
8
|
+
export { createDefaultConfigTemplate, runInitCommand } from "./init-command.js";
|
|
9
|
+
export type { InitCommandOptions, InitCommandResult } from "./init-command.js";
|
|
10
|
+
export { runScanCommand } from "./scan-command.js";
|
|
11
|
+
export type { ScanCommandDependencies, ScanCommandOptions, ScanCommandResult } from "./scan-command.js";
|
|
12
|
+
import { type DevCommandDependencies } from "./dev-command.js";
|
|
13
|
+
import { type ScanCommandDependencies } from "./scan-command.js";
|
|
14
|
+
export type CliOptions = {
|
|
15
|
+
cwd?: string;
|
|
16
|
+
write?: (message: string) => void;
|
|
17
|
+
dependencies?: ScanCommandDependencies & DevCommandDependencies;
|
|
18
|
+
};
|
|
19
|
+
export declare function getHelpText(): string;
|
|
20
|
+
export declare function getScanHelpText(): string;
|
|
21
|
+
export declare function getDevHelpText(): string;
|
|
22
|
+
export declare function runCli(args?: string[], options?: CliOptions): Promise<0 | 1>;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnG,YAAY,EACV,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChF,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAiB,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAkB,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,uBAAuB,GAAG,sBAAsB,CAAC;CACjE,CAAC;AAEF,wBAAgB,WAAW,IAAI,MAAM,CAWpC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAWxC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAYvC;AAED,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAA0B,EAAE,OAAO,GAAE,UAAe,kBA4G5F"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
export { defineConfig } from "@anlyx/core";
|
|
5
|
+
export { findConfigFile, loadConfig } from "./config-loader.js";
|
|
6
|
+
export { createLocalUiServer, openBrowser, readReportData, runDevCommand } from "./dev-command.js";
|
|
7
|
+
export { createDefaultConfigTemplate, runInitCommand } from "./init-command.js";
|
|
8
|
+
export { runScanCommand } from "./scan-command.js";
|
|
9
|
+
import { runInitCommand } from "./init-command.js";
|
|
10
|
+
import { runDevCommand } from "./dev-command.js";
|
|
11
|
+
import { runScanCommand } from "./scan-command.js";
|
|
12
|
+
export function getHelpText() {
|
|
13
|
+
return `Anlyx
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
anlyx init [--force]
|
|
17
|
+
anlyx scan [--config <path>] [--out <dir>] [--skip-capture]
|
|
18
|
+
anlyx dev [--config <path>] [--out <dir>] [--port <port>] [--no-open]
|
|
19
|
+
anlyx --help
|
|
20
|
+
|
|
21
|
+
Available commands: init, scan, dev
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
export function getScanHelpText() {
|
|
25
|
+
return `Anlyx scan
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
anlyx scan [--config <path>] [--out <dir>] [--skip-capture]
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
--config <path> Load a specific anlyx config file.
|
|
32
|
+
--out <dir> Write output JSON files to a custom directory.
|
|
33
|
+
--skip-capture Skip Playwright capture and use adapter page data as-is.
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
export function getDevHelpText() {
|
|
37
|
+
return `Anlyx dev
|
|
38
|
+
|
|
39
|
+
Usage:
|
|
40
|
+
anlyx dev [--config <path>] [--out <dir>] [--port <port>] [--no-open]
|
|
41
|
+
|
|
42
|
+
Options:
|
|
43
|
+
--config <path> Load a specific anlyx config file.
|
|
44
|
+
--out <dir> Read report-data.json from a custom output directory.
|
|
45
|
+
--port <port> Serve the local UI on a custom port.
|
|
46
|
+
--no-open Start the UI server without opening a browser.
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
export async function runCli(args = process.argv.slice(2), options = {}) {
|
|
50
|
+
const write = options.write ?? ((message) => process.stdout.write(`${message}\n`));
|
|
51
|
+
const command = args[0];
|
|
52
|
+
if (!command || command === "--help" || command === "-h") {
|
|
53
|
+
write(getHelpText());
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
if (command === "init") {
|
|
57
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
58
|
+
write(getHelpText());
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
const invalidOption = args.slice(1).find((arg) => arg !== "--force" && arg !== "-f");
|
|
62
|
+
if (invalidOption) {
|
|
63
|
+
write(`Unknown option for init: ${invalidOption}`);
|
|
64
|
+
write(getHelpText());
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
const result = await runInitCommand({
|
|
68
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
69
|
+
force: args.includes("--force") || args.includes("-f")
|
|
70
|
+
});
|
|
71
|
+
if (result.skipped) {
|
|
72
|
+
write(`Skipped: ${result.path} already exists. Use --force to overwrite it.`);
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
write(`Created ${result.path}`);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
if (command === "scan") {
|
|
79
|
+
const parsed = parseScanArgs(args.slice(1));
|
|
80
|
+
if (parsed.help) {
|
|
81
|
+
write(getScanHelpText());
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
if (parsed.error) {
|
|
85
|
+
write(parsed.error);
|
|
86
|
+
write(getScanHelpText());
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const result = await runScanCommand({
|
|
91
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
92
|
+
...(parsed.configPath ? { configPath: parsed.configPath } : {}),
|
|
93
|
+
...(parsed.outputDir ? { outputDir: parsed.outputDir } : {}),
|
|
94
|
+
skipCapture: parsed.skipCapture,
|
|
95
|
+
...(options.dependencies ? { dependencies: options.dependencies } : {})
|
|
96
|
+
});
|
|
97
|
+
write(`Wrote ${result.reportDataPath}`);
|
|
98
|
+
if (result.issues.length > 0) {
|
|
99
|
+
write(`Scan completed with ${result.issues.length} aggregation issue(s).`);
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
write(`Scan failed: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (command === "dev") {
|
|
109
|
+
const parsed = parseDevArgs(args.slice(1));
|
|
110
|
+
if (parsed.help) {
|
|
111
|
+
write(getDevHelpText());
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
if (parsed.error) {
|
|
115
|
+
write(parsed.error);
|
|
116
|
+
write(getDevHelpText());
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const result = await runDevCommand({
|
|
121
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
122
|
+
...(parsed.configPath ? { configPath: parsed.configPath } : {}),
|
|
123
|
+
...(parsed.outputDir ? { outputDir: parsed.outputDir } : {}),
|
|
124
|
+
...(parsed.port !== undefined ? { port: parsed.port } : {}),
|
|
125
|
+
...(parsed.noOpen ? { open: false } : {}),
|
|
126
|
+
...(options.dependencies ? { dependencies: options.dependencies } : {})
|
|
127
|
+
});
|
|
128
|
+
write(`Started Anlyx UI at ${result.url}`);
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
write(`Dev server failed: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
133
|
+
return 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
write(`Unknown command: ${command}`);
|
|
137
|
+
write(getHelpText());
|
|
138
|
+
return 1;
|
|
139
|
+
}
|
|
140
|
+
function parseDevArgs(args) {
|
|
141
|
+
const parsed = {
|
|
142
|
+
noOpen: false,
|
|
143
|
+
help: false
|
|
144
|
+
};
|
|
145
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
146
|
+
const arg = args[index];
|
|
147
|
+
if (arg === "--help" || arg === "-h") {
|
|
148
|
+
parsed.help = true;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (arg === "--no-open") {
|
|
152
|
+
parsed.noOpen = true;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (arg === "--config") {
|
|
156
|
+
const value = args[index + 1];
|
|
157
|
+
if (!value || value.startsWith("-")) {
|
|
158
|
+
parsed.error = "Missing value for --config.";
|
|
159
|
+
return parsed;
|
|
160
|
+
}
|
|
161
|
+
parsed.configPath = value;
|
|
162
|
+
index += 1;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (arg === "--out") {
|
|
166
|
+
const value = args[index + 1];
|
|
167
|
+
if (!value || value.startsWith("-")) {
|
|
168
|
+
parsed.error = "Missing value for --out.";
|
|
169
|
+
return parsed;
|
|
170
|
+
}
|
|
171
|
+
parsed.outputDir = value;
|
|
172
|
+
index += 1;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (arg === "--port") {
|
|
176
|
+
const value = args[index + 1];
|
|
177
|
+
if (!value || value.startsWith("-")) {
|
|
178
|
+
parsed.error = "Missing value for --port.";
|
|
179
|
+
return parsed;
|
|
180
|
+
}
|
|
181
|
+
const port = Number.parseInt(value, 10);
|
|
182
|
+
if (!Number.isInteger(port) || port <= 0) {
|
|
183
|
+
parsed.error = "Invalid value for --port.";
|
|
184
|
+
return parsed;
|
|
185
|
+
}
|
|
186
|
+
parsed.port = port;
|
|
187
|
+
index += 1;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
parsed.error = `Unknown option for dev: ${arg ?? ""}`;
|
|
191
|
+
return parsed;
|
|
192
|
+
}
|
|
193
|
+
return parsed;
|
|
194
|
+
}
|
|
195
|
+
if (isCliEntrypoint()) {
|
|
196
|
+
const exitCode = await runCli();
|
|
197
|
+
process.exitCode = exitCode;
|
|
198
|
+
}
|
|
199
|
+
function isCliEntrypoint() {
|
|
200
|
+
if (!process.argv[1]) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
204
|
+
}
|
|
205
|
+
function parseScanArgs(args) {
|
|
206
|
+
const parsed = {
|
|
207
|
+
skipCapture: false,
|
|
208
|
+
help: false
|
|
209
|
+
};
|
|
210
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
211
|
+
const arg = args[index];
|
|
212
|
+
if (arg === "--help" || arg === "-h") {
|
|
213
|
+
parsed.help = true;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (arg === "--skip-capture") {
|
|
217
|
+
parsed.skipCapture = true;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (arg === "--config") {
|
|
221
|
+
const value = args[index + 1];
|
|
222
|
+
if (!value || value.startsWith("-")) {
|
|
223
|
+
parsed.error = "Missing value for --config.";
|
|
224
|
+
return parsed;
|
|
225
|
+
}
|
|
226
|
+
parsed.configPath = value;
|
|
227
|
+
index += 1;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (arg === "--out") {
|
|
231
|
+
const value = args[index + 1];
|
|
232
|
+
if (!value || value.startsWith("-")) {
|
|
233
|
+
parsed.error = "Missing value for --out.";
|
|
234
|
+
return parsed;
|
|
235
|
+
}
|
|
236
|
+
parsed.outputDir = value;
|
|
237
|
+
index += 1;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
parsed.error = `Unknown option for scan: ${arg ?? ""}`;
|
|
241
|
+
return parsed;
|
|
242
|
+
}
|
|
243
|
+
return parsed;
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA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K,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpC,MAAM,CAAC,KAAK,GAAG,0BAA0B,CAAC;gBAC1C,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;YACzB,KAAK,IAAI,CAAC,CAAC;YACX,SAAS;QACX,CAAC;QAED,MAAM,CAAC,KAAK,GAAG,4BAA4B,GAAG,IAAI,EAAE,EAAE,CAAC;QACvD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type InitCommandOptions = {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
force?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type InitCommandResult = {
|
|
6
|
+
created: boolean;
|
|
7
|
+
path: string;
|
|
8
|
+
skipped?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function createDefaultConfigTemplate(): string;
|
|
11
|
+
export declare function runInitCommand(options?: InitCommandOptions): Promise<InitCommandResult>;
|
|
12
|
+
//# sourceMappingURL=init-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-command.d.ts","sourceRoot":"","sources":["../src/init-command.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAIF,wBAAgB,2BAA2B,IAAI,MAAM,CAgDpD;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkBjG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { access, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
const CONFIG_FILE_NAME = "anlyx.config.ts";
|
|
4
|
+
export function createDefaultConfigTemplate() {
|
|
5
|
+
return `import { defineConfig } from "anlyx";
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
projectName: "My Anlyx Project",
|
|
9
|
+
|
|
10
|
+
backend: {
|
|
11
|
+
type: "spring",
|
|
12
|
+
sourceDir: "./backend/src/main/java",
|
|
13
|
+
baseUrl: "http://localhost:8080",
|
|
14
|
+
openApiUrl: "http://localhost:8080/v3/api-docs",
|
|
15
|
+
actuatorMappingsUrl: "http://localhost:8080/actuator/mappings",
|
|
16
|
+
maxMainDepth: 4,
|
|
17
|
+
maxSubDepth: 1,
|
|
18
|
+
includeUtilities: false
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
frontend: {
|
|
22
|
+
type: "next",
|
|
23
|
+
sourceDir: "./frontend",
|
|
24
|
+
baseUrl: "http://localhost:3000",
|
|
25
|
+
router: "app",
|
|
26
|
+
|
|
27
|
+
viewport: {
|
|
28
|
+
width: 1440,
|
|
29
|
+
height: 900
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
capture: {
|
|
33
|
+
mode: "segments",
|
|
34
|
+
segmentHeight: 900,
|
|
35
|
+
storageState: "./.anlyx/auth-state.json"
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
sampleParams: {
|
|
39
|
+
"/benefit/[brandSlug]/[benefitSlugWithId]": {
|
|
40
|
+
brandSlug: "starbucks",
|
|
41
|
+
benefitSlugWithId: "birthday-coupon-123"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
server: {
|
|
47
|
+
port: 4777,
|
|
48
|
+
openBrowser: true
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
export async function runInitCommand(options = {}) {
|
|
54
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
55
|
+
const configPath = join(cwd, CONFIG_FILE_NAME);
|
|
56
|
+
if (!options.force && (await fileExists(configPath))) {
|
|
57
|
+
return {
|
|
58
|
+
created: false,
|
|
59
|
+
path: configPath,
|
|
60
|
+
skipped: true
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
await writeFile(configPath, createDefaultConfigTemplate(), "utf8");
|
|
64
|
+
return {
|
|
65
|
+
created: true,
|
|
66
|
+
path: configPath
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async function fileExists(path) {
|
|
70
|
+
try {
|
|
71
|
+
await access(path);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=init-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-command.js","sourceRoot":"","sources":["../src/init-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAa1C,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,UAAU,2BAA2B;IACzC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CR,CAAC;AACF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAA8B,EAAE;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE/C,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,CAAC,UAAU,EAAE,2BAA2B,EAAE,EAAE,MAAM,CAAC,CAAC;IAEnE,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,UAAU;KACjB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Endpoint, type EndpointFlow, type PageStoryboard, type ReportAggregationIssue } from "@anlyx/core";
|
|
2
|
+
import { createManualFrontendAdapter } from "@anlyx/adapter-manual";
|
|
3
|
+
import { createNextFrontendAdapter } from "@anlyx/adapter-next";
|
|
4
|
+
import { createOpenApiBackendAdapter, type OpenApiDocument } from "@anlyx/adapter-openapi";
|
|
5
|
+
import { createSpringBackendAdapter } from "@anlyx/adapter-spring";
|
|
6
|
+
import { createCaptureAdapter } from "@anlyx/capture";
|
|
7
|
+
import { loadConfig } from "./config-loader.js";
|
|
8
|
+
export type ScanCommandOptions = {
|
|
9
|
+
cwd?: string;
|
|
10
|
+
configPath?: string;
|
|
11
|
+
outputDir?: string;
|
|
12
|
+
skipCapture?: boolean;
|
|
13
|
+
dependencies?: ScanCommandDependencies;
|
|
14
|
+
};
|
|
15
|
+
export type ScanCommandResult = {
|
|
16
|
+
outputDir: string;
|
|
17
|
+
reportDataPath: string;
|
|
18
|
+
endpointsPath: string;
|
|
19
|
+
flowsPath: string;
|
|
20
|
+
pagesPath: string;
|
|
21
|
+
endpointCount: number;
|
|
22
|
+
flowCount: number;
|
|
23
|
+
pageCount: number;
|
|
24
|
+
issues: ReportAggregationIssue[];
|
|
25
|
+
};
|
|
26
|
+
export type BackendAdapter = {
|
|
27
|
+
name: string;
|
|
28
|
+
scanEndpoints(): Promise<Endpoint[]>;
|
|
29
|
+
scanFlows(endpoints: Endpoint[]): Promise<EndpointFlow[]>;
|
|
30
|
+
};
|
|
31
|
+
export type FrontendAdapter = {
|
|
32
|
+
name: string;
|
|
33
|
+
scanPages(): Promise<PageStoryboard[]>;
|
|
34
|
+
};
|
|
35
|
+
export type ScanCommandDependencies = {
|
|
36
|
+
loadConfig?: typeof loadConfig;
|
|
37
|
+
fetchOpenApiDocument?: (url: string) => Promise<OpenApiDocument>;
|
|
38
|
+
createSpringBackendAdapter?: typeof createSpringBackendAdapter;
|
|
39
|
+
createOpenApiBackendAdapter?: typeof createOpenApiBackendAdapter;
|
|
40
|
+
createNextFrontendAdapter?: typeof createNextFrontendAdapter;
|
|
41
|
+
createManualFrontendAdapter?: typeof createManualFrontendAdapter;
|
|
42
|
+
createCaptureAdapter?: typeof createCaptureAdapter;
|
|
43
|
+
};
|
|
44
|
+
export declare function runScanCommand(options?: ScanCommandOptions): Promise<ScanCommandResult>;
|
|
45
|
+
//# sourceMappingURL=scan-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-command.d.ts","sourceRoot":"","sources":["../src/scan-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,2BAA2B,EAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAE3B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBA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AC;IACjE,yBAAyB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IAC7D,2BAA2B,CAAC,EAAE,OAAO,2BAA2B,CAAC;IACjE,oBAAoB,CAAC,EAAE,OAAO,oBAAoB,CAAC;CACpD,CAAC;AAUF,wBAAsB,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoDjG"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { aggregateReportData } from "@anlyx/core";
|
|
4
|
+
import { createManualFrontendAdapter } from "@anlyx/adapter-manual";
|
|
5
|
+
import { createNextFrontendAdapter } from "@anlyx/adapter-next";
|
|
6
|
+
import { createOpenApiBackendAdapter } from "@anlyx/adapter-openapi";
|
|
7
|
+
import { createSpringBackendAdapter } from "@anlyx/adapter-spring";
|
|
8
|
+
import { createCaptureAdapter } from "@anlyx/capture";
|
|
9
|
+
import { loadConfig } from "./config-loader.js";
|
|
10
|
+
export async function runScanCommand(options = {}) {
|
|
11
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
12
|
+
const dependencies = withDefaultDependencies(options.dependencies);
|
|
13
|
+
const config = await dependencies.loadConfig({
|
|
14
|
+
cwd,
|
|
15
|
+
...(options.configPath ? { configPath: options.configPath } : {})
|
|
16
|
+
});
|
|
17
|
+
const outputPaths = buildOutputPaths(cwd, options.outputDir);
|
|
18
|
+
const backendAdapter = await createBackendAdapter(config, cwd, dependencies);
|
|
19
|
+
const frontendAdapter = createFrontendAdapter(config, cwd, dependencies);
|
|
20
|
+
const endpoints = await backendAdapter.scanEndpoints();
|
|
21
|
+
const flows = await backendAdapter.scanFlows(endpoints);
|
|
22
|
+
const scannedPages = await frontendAdapter.scanPages();
|
|
23
|
+
const pages = options.skipCapture
|
|
24
|
+
? scannedPages
|
|
25
|
+
: await createCapture(config, outputPaths.outputDir, dependencies).capturePages(scannedPages);
|
|
26
|
+
const generatedAt = new Date().toISOString();
|
|
27
|
+
const aggregation = aggregateReportData({
|
|
28
|
+
projectName: config.projectName,
|
|
29
|
+
generatedAt,
|
|
30
|
+
endpoints,
|
|
31
|
+
flows,
|
|
32
|
+
pages,
|
|
33
|
+
...(options.skipCapture
|
|
34
|
+
? {}
|
|
35
|
+
: {
|
|
36
|
+
capture: {
|
|
37
|
+
pages,
|
|
38
|
+
capturedAt: generatedAt,
|
|
39
|
+
viewport: config.frontend.viewport,
|
|
40
|
+
...(config.frontend.capture.storageState
|
|
41
|
+
? { storageStateUsed: config.frontend.capture.storageState }
|
|
42
|
+
: {})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
await writeScanOutput(outputPaths, {
|
|
47
|
+
endpoints: aggregation.scanResult.endpoints,
|
|
48
|
+
flows: aggregation.scanResult.flows,
|
|
49
|
+
pages: aggregation.scanResult.pages,
|
|
50
|
+
reportData: aggregation.scanResult
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
...outputPaths,
|
|
54
|
+
endpointCount: aggregation.scanResult.endpoints.length,
|
|
55
|
+
flowCount: aggregation.scanResult.flows.length,
|
|
56
|
+
pageCount: aggregation.scanResult.pages.length,
|
|
57
|
+
issues: aggregation.issues
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function createBackendAdapter(config, cwd, dependencies) {
|
|
61
|
+
if (config.backend.type === "spring") {
|
|
62
|
+
return dependencies.createSpringBackendAdapter({
|
|
63
|
+
sourceDir: resolve(cwd, config.backend.sourceDir),
|
|
64
|
+
maxMainDepth: config.backend.maxMainDepth,
|
|
65
|
+
maxSubDepth: config.backend.maxSubDepth,
|
|
66
|
+
includeUtilities: config.backend.includeUtilities,
|
|
67
|
+
...(config.backend.baseUrl ? { baseUrl: config.backend.baseUrl } : {}),
|
|
68
|
+
...(config.backend.openApiUrl ? { openApiUrl: config.backend.openApiUrl } : {}),
|
|
69
|
+
...(config.backend.actuatorMappingsUrl
|
|
70
|
+
? { actuatorMappingsUrl: config.backend.actuatorMappingsUrl }
|
|
71
|
+
: {})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const document = await dependencies.fetchOpenApiDocument(config.backend.openApiUrl);
|
|
75
|
+
return dependencies.createOpenApiBackendAdapter({
|
|
76
|
+
document,
|
|
77
|
+
openApiUrl: config.backend.openApiUrl,
|
|
78
|
+
...(config.backend.baseUrl ? { baseUrl: config.backend.baseUrl } : {})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function createFrontendAdapter(config, cwd, dependencies) {
|
|
82
|
+
if (config.frontend.type === "next") {
|
|
83
|
+
return dependencies.createNextFrontendAdapter({
|
|
84
|
+
sourceDir: resolve(cwd, config.frontend.sourceDir),
|
|
85
|
+
baseUrl: config.frontend.baseUrl,
|
|
86
|
+
...(config.frontend.sampleParams ? { sampleParams: config.frontend.sampleParams } : {})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return dependencies.createManualFrontendAdapter(config.frontend);
|
|
90
|
+
}
|
|
91
|
+
function createCapture(config, outputDir, dependencies) {
|
|
92
|
+
return dependencies.createCaptureAdapter({
|
|
93
|
+
baseUrl: config.frontend.baseUrl,
|
|
94
|
+
outputDir: join(outputDir, "screenshots"),
|
|
95
|
+
viewport: config.frontend.viewport,
|
|
96
|
+
capture: config.frontend.capture,
|
|
97
|
+
...(config.frontend.type === "next" && config.frontend.sampleParams
|
|
98
|
+
? { sampleParams: config.frontend.sampleParams }
|
|
99
|
+
: {})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function buildOutputPaths(cwd, outputDir) {
|
|
103
|
+
const resolvedOutputDir = resolve(cwd, outputDir ?? ".anlyx");
|
|
104
|
+
return {
|
|
105
|
+
outputDir: resolvedOutputDir,
|
|
106
|
+
reportDataPath: join(resolvedOutputDir, "report-data.json"),
|
|
107
|
+
endpointsPath: join(resolvedOutputDir, "endpoints.json"),
|
|
108
|
+
flowsPath: join(resolvedOutputDir, "flows.json"),
|
|
109
|
+
pagesPath: join(resolvedOutputDir, "pages.json")
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function writeScanOutput(paths, data) {
|
|
113
|
+
await mkdir(paths.outputDir, { recursive: true });
|
|
114
|
+
await Promise.all([
|
|
115
|
+
writeJson(paths.reportDataPath, data.reportData),
|
|
116
|
+
writeJson(paths.endpointsPath, data.endpoints),
|
|
117
|
+
writeJson(paths.flowsPath, data.flows),
|
|
118
|
+
writeJson(paths.pagesPath, data.pages)
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
async function writeJson(path, value) {
|
|
122
|
+
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
123
|
+
}
|
|
124
|
+
async function fetchOpenApiDocument(openApiUrl) {
|
|
125
|
+
let response;
|
|
126
|
+
try {
|
|
127
|
+
response = await fetch(openApiUrl);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
throw new Error(`Failed to fetch OpenAPI document from ${openApiUrl}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
131
|
+
}
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
throw new Error(`Failed to fetch OpenAPI document from ${openApiUrl}: ${response.status} ${response.statusText}`);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
return (await response.json());
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
throw new Error(`Failed to parse OpenAPI document from ${openApiUrl}: ${error instanceof Error ? error.message : "invalid JSON"}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function withDefaultDependencies(dependencies = {}) {
|
|
143
|
+
return {
|
|
144
|
+
loadConfig: dependencies.loadConfig ?? loadConfig,
|
|
145
|
+
fetchOpenApiDocument: dependencies.fetchOpenApiDocument ?? fetchOpenApiDocument,
|
|
146
|
+
createSpringBackendAdapter: dependencies.createSpringBackendAdapter ?? createSpringBackendAdapter,
|
|
147
|
+
createOpenApiBackendAdapter: dependencies.createOpenApiBackendAdapter ?? createOpenApiBackendAdapter,
|
|
148
|
+
createNextFrontendAdapter: dependencies.createNextFrontendAdapter ?? createNextFrontendAdapter,
|
|
149
|
+
createManualFrontendAdapter: dependencies.createManualFrontendAdapter ?? createManualFrontendAdapter,
|
|
150
|
+
createCaptureAdapter: dependencies.createCaptureAdapter ?? createCaptureAdapter
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=scan-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-command.js","sourceRoot":"","sources":["../src/scan-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,mBAAmB,EAMpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,2BAA2B,EAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAG5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmDhD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAA8B,EAAE;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,uBAAuB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC;QAC3C,GAAG;QACH,GAAG,CAAC,OAAO,CAAC,UAAU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Y,CAAC,UAAU,IAAI,UAAU;QACjD,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,IAAI,oBAAoB;QAC/E,0BAA0B,EACxB,YAAY,CAAC,0BAA0B,IAAI,0BAA0B;QACvE,2BAA2B,EACzB,YAAY,CAAC,2BAA2B,IAAI,2BAA2B;QACzE,yBAAyB,EAAE,YAAY,CAAC,yBAAyB,IAAI,yBAAyB;QAC9F,2BAA2B,EACzB,YAAY,CAAC,2BAA2B,IAAI,2BAA2B;QACzE,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,IAAI,oBAAoB;KAChF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "anlyx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for Anlyx, visual flow maps for modern web apps.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "node ../../scripts/clean-package-dist.mjs . && tsc -p tsconfig.build.json"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/suhannoh/anlyx.git",
|
|
20
|
+
"directory": "packages/cli"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/suhannoh/anlyx#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/suhannoh/anlyx/issues"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"anlyx": "dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@anlyx/adapter-manual": "workspace:*",
|
|
37
|
+
"@anlyx/adapter-next": "workspace:*",
|
|
38
|
+
"@anlyx/adapter-openapi": "workspace:*",
|
|
39
|
+
"@anlyx/adapter-spring": "workspace:*",
|
|
40
|
+
"@anlyx/capture": "workspace:*",
|
|
41
|
+
"@anlyx/core": "workspace:*",
|
|
42
|
+
"@anlyx/ui": "workspace:*",
|
|
43
|
+
"jiti": "^2.7.0",
|
|
44
|
+
"vite": "^8.0.16"
|
|
45
|
+
}
|
|
46
|
+
}
|