@nasl/cli 0.2.1 → 0.2.2
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/bin/nasl.mjs +9 -7
- package/dist/bin/nasl.mjs.map +1 -1
- package/dist/bin/naslc.mjs +3 -3
- package/dist/bin/naslc.mjs.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/out/apis/createAxios.js +2 -2
- package/out/apis/createAxios.js.map +1 -1
- package/out/bin/nasl.js +2 -2
- package/out/bin/nasl.js.map +1 -1
- package/out/commands/check.d.ts.map +1 -1
- package/out/commands/check.js +2 -0
- package/out/commands/check.js.map +1 -1
- package/out/commands/createAppInIde.js +2 -2
- package/out/commands/createAppInIde.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -34817,7 +34817,7 @@ async function generateCompleteHeaders(options) {
|
|
|
34817
34817
|
async function createAxios(options) {
|
|
34818
34818
|
// 如果需要鉴权,拼接 /openapi/v3/nasl;否则使用原始 URL
|
|
34819
34819
|
const serverBaseURL = new URL(options.serverBaseURL).origin;
|
|
34820
|
-
const baseURL = options.useOPENAPI ? `${serverBaseURL}/openapi/v3/nasl` : `${serverBaseURL}/api/v1/nasl`;
|
|
34820
|
+
const baseURL = options.serverBaseURL.endsWith('app-ai-creator') ? options.serverBaseURL : options.useOPENAPI ? `${serverBaseURL}/openapi/v3/nasl` : `${serverBaseURL}/api/v1/nasl`;
|
|
34821
34821
|
// 如果需要鉴权,生成完整的认证头;否则只使用基础 headers
|
|
34822
34822
|
const headers = options.useOPENAPI ? await generateCompleteHeaders(options) : { 'Content-Type': 'application/json' };
|
|
34823
34823
|
console.log('本次服务调用方为:', baseURL);
|
|
@@ -34830,7 +34830,7 @@ async function createAxios(options) {
|
|
|
34830
34830
|
instance.post = async (url, data, config) => {
|
|
34831
34831
|
return oldPost(url, data, config).then((res) => {
|
|
34832
34832
|
const data = res.data;
|
|
34833
|
-
if (data.code !== 200)
|
|
34833
|
+
if (data.code !== 200 && data.success !== true)
|
|
34834
34834
|
throw new Error(JSON.stringify(data));
|
|
34835
34835
|
return res;
|
|
34836
34836
|
}).catch((err) => {
|
|
@@ -35012,6 +35012,8 @@ async function check(entry, options) {
|
|
|
35012
35012
|
fastLogToFile(entry || '*', `check_${checkResult.success ? 'success' : 'error'}.log`, result + '\n================================================\n\n================================================\n' + fullNaturalTS);
|
|
35013
35013
|
if (!checkResult.success)
|
|
35014
35014
|
logger.error('\n' + checkResult.result);
|
|
35015
|
+
else
|
|
35016
|
+
logger.success('发现 0 个错误,检查通过!');
|
|
35015
35017
|
return checkResult;
|
|
35016
35018
|
}
|
|
35017
35019
|
|
|
@@ -35300,10 +35302,10 @@ async function createAppInIde(entry, options) {
|
|
|
35300
35302
|
const projectRoot = getProjectRoot();
|
|
35301
35303
|
const firstSpecFolderName = getFirstSpecFolderName(projectRoot);
|
|
35302
35304
|
const suffix = dayjs().format('MMDDHHmmss');
|
|
35303
|
-
|
|
35304
|
-
let cleaned = firstSpecFolderName.replace(/[^a-zA-Z0-9]/g, '').replace(/^\d+/, '');
|
|
35305
|
+
let cleaned = firstSpecFolderName.replace(/[^a-zA-Z0-9]/g, '').replace(/^\d+/, '').slice(0, 12);
|
|
35305
35306
|
if (!cleaned)
|
|
35306
35307
|
cleaned = 'app';
|
|
35308
|
+
const appName = `${cleaned}_${suffix}`;
|
|
35307
35309
|
const packageName = `${cleaned}${suffix}`;
|
|
35308
35310
|
logger.info(`应用名称: ${appName}`);
|
|
35309
35311
|
logger.info(`包名: ${packageName}`);
|