@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/bin/nasl.mjs
CHANGED
|
@@ -29125,7 +29125,7 @@ async function generateCompleteHeaders(options) {
|
|
|
29125
29125
|
async function createAxios(options) {
|
|
29126
29126
|
// 如果需要鉴权,拼接 /openapi/v3/nasl;否则使用原始 URL
|
|
29127
29127
|
const serverBaseURL = new URL(options.serverBaseURL).origin;
|
|
29128
|
-
const baseURL = options.useOPENAPI ? `${serverBaseURL}/openapi/v3/nasl` : `${serverBaseURL}/api/v1/nasl`;
|
|
29128
|
+
const baseURL = options.serverBaseURL.endsWith('app-ai-creator') ? options.serverBaseURL : options.useOPENAPI ? `${serverBaseURL}/openapi/v3/nasl` : `${serverBaseURL}/api/v1/nasl`;
|
|
29129
29129
|
// 如果需要鉴权,生成完整的认证头;否则只使用基础 headers
|
|
29130
29130
|
const headers = options.useOPENAPI ? await generateCompleteHeaders(options) : { 'Content-Type': 'application/json' };
|
|
29131
29131
|
console.log('本次服务调用方为:', baseURL);
|
|
@@ -29138,7 +29138,7 @@ async function createAxios(options) {
|
|
|
29138
29138
|
instance.post = async (url, data, config) => {
|
|
29139
29139
|
return oldPost(url, data, config).then((res) => {
|
|
29140
29140
|
const data = res.data;
|
|
29141
|
-
if (data.code !== 200)
|
|
29141
|
+
if (data.code !== 200 && data.success !== true)
|
|
29142
29142
|
throw new Error(JSON.stringify(data));
|
|
29143
29143
|
return res;
|
|
29144
29144
|
}).catch((err) => {
|
|
@@ -38342,6 +38342,8 @@ async function check(entry, options) {
|
|
|
38342
38342
|
fastLogToFile(entry || '*', `check_${checkResult.success ? 'success' : 'error'}.log`, result + '\n================================================\n\n================================================\n' + fullNaturalTS);
|
|
38343
38343
|
if (!checkResult.success)
|
|
38344
38344
|
logger.error('\n' + checkResult.result);
|
|
38345
|
+
else
|
|
38346
|
+
logger.success('发现 0 个错误,检查通过!');
|
|
38345
38347
|
return checkResult;
|
|
38346
38348
|
}
|
|
38347
38349
|
|
|
@@ -38630,10 +38632,10 @@ async function createAppInIde(entry, options) {
|
|
|
38630
38632
|
const projectRoot = getProjectRoot();
|
|
38631
38633
|
const firstSpecFolderName = getFirstSpecFolderName(projectRoot);
|
|
38632
38634
|
const suffix = dayjs().format('MMDDHHmmss');
|
|
38633
|
-
|
|
38634
|
-
let cleaned = firstSpecFolderName.replace(/[^a-zA-Z0-9]/g, '').replace(/^\d+/, '');
|
|
38635
|
+
let cleaned = firstSpecFolderName.replace(/[^a-zA-Z0-9]/g, '').replace(/^\d+/, '').slice(0, 12);
|
|
38635
38636
|
if (!cleaned)
|
|
38636
38637
|
cleaned = 'app';
|
|
38638
|
+
const appName = `${cleaned}_${suffix}`;
|
|
38637
38639
|
const packageName = `${cleaned}${suffix}`;
|
|
38638
38640
|
logger.info(`应用名称: ${appName}`);
|
|
38639
38641
|
logger.info(`包名: ${packageName}`);
|
|
@@ -38763,7 +38765,7 @@ async function transform(transformType, entry, options) {
|
|
|
38763
38765
|
await transformFn(entry, options);
|
|
38764
38766
|
}
|
|
38765
38767
|
|
|
38766
|
-
var version = "0.2.
|
|
38768
|
+
var version = "0.2.2";
|
|
38767
38769
|
var pkg = {
|
|
38768
38770
|
version: version};
|
|
38769
38771
|
|
|
@@ -38780,7 +38782,7 @@ function askForConfirmation(question) {
|
|
|
38780
38782
|
rl.question(question, (answer) => {
|
|
38781
38783
|
rl.close();
|
|
38782
38784
|
const normalizedAnswer = answer.trim().toLowerCase();
|
|
38783
|
-
resolve(normalizedAnswer === 'y' || normalizedAnswer === 'yes' || normalizedAnswer === '是');
|
|
38785
|
+
resolve(!normalizedAnswer || normalizedAnswer === 'y' || normalizedAnswer === 'yes' || normalizedAnswer === '是');
|
|
38784
38786
|
});
|
|
38785
38787
|
});
|
|
38786
38788
|
}
|
|
@@ -38873,7 +38875,7 @@ program
|
|
|
38873
38875
|
if (!options?.quiet) {
|
|
38874
38876
|
defaultLogger.newLine();
|
|
38875
38877
|
defaultLogger.info('即将在 IDE 中创建新的应用,此操作将调用远程接口。');
|
|
38876
|
-
const confirmed = await askForConfirmation('请确认是否继续?(
|
|
38878
|
+
const confirmed = await askForConfirmation('请确认是否继续?(Y/n): ');
|
|
38877
38879
|
if (!confirmed) {
|
|
38878
38880
|
defaultLogger.info('已取消操作');
|
|
38879
38881
|
process.exit(0);
|