@kmlckj/licos-ai-cli 1.0.25 → 1.0.27
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.
|
@@ -193,14 +193,17 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
193
193
|
sourceRoot: 'src',
|
|
194
194
|
outputRoot,
|
|
195
195
|
plugins: ['@tarojs/plugin-generator', ...buildMiniCIPluginConfig()],
|
|
196
|
-
defineConstants: {
|
|
197
|
-
PROJECT_DOMAIN: JSON.stringify(
|
|
198
|
-
process.env.PROJECT_DOMAIN ||
|
|
199
|
-
process.env.LICOS_PROJECT_DOMAIN_DEFAULT ||
|
|
200
|
-
'',
|
|
201
|
-
),
|
|
202
|
-
|
|
203
|
-
|
|
196
|
+
defineConstants: {
|
|
197
|
+
PROJECT_DOMAIN: JSON.stringify(
|
|
198
|
+
process.env.PROJECT_DOMAIN ||
|
|
199
|
+
process.env.LICOS_PROJECT_DOMAIN_DEFAULT ||
|
|
200
|
+
'',
|
|
201
|
+
),
|
|
202
|
+
LICOS_H5_BASE_PATH: JSON.stringify(
|
|
203
|
+
deployBasePath.replace(/\/+$/g, ''),
|
|
204
|
+
),
|
|
205
|
+
LICOS_TARO_ENV: JSON.stringify(process.env.TARO_ENV || ''),
|
|
206
|
+
},
|
|
204
207
|
copy: {
|
|
205
208
|
patterns: [],
|
|
206
209
|
options: {},
|
|
@@ -9,11 +9,36 @@ import Taro from '@tarojs/taro'
|
|
|
9
9
|
* IMPORTANT: 除非你需要添加全局参数,如给所有请求加上 header,否则不能修改此文件
|
|
10
10
|
*/
|
|
11
11
|
export namespace Network {
|
|
12
|
+
const normalizeBase = (value?: string): string => {
|
|
13
|
+
const trimmed = (value || '').trim()
|
|
14
|
+
if (!trimmed || trimmed === '/') {
|
|
15
|
+
return ''
|
|
16
|
+
}
|
|
17
|
+
return trimmed.replace(/\/+$/g, '')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const inferH5BasePath = (): string => {
|
|
21
|
+
if (typeof window === 'undefined') {
|
|
22
|
+
return ''
|
|
23
|
+
}
|
|
24
|
+
const pathname = window.location?.pathname || ''
|
|
25
|
+
const matched = pathname.match(/^(\/p\/[^/]+)(?:\/|$)/)
|
|
26
|
+
return matched ? matched[1] : ''
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const requestBase = (): string => {
|
|
30
|
+
return normalizeBase(PROJECT_DOMAIN)
|
|
31
|
+
|| normalizeBase(LICOS_H5_BASE_PATH)
|
|
32
|
+
|| normalizeBase(inferH5BasePath())
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
const createUrl = (url: string): string => {
|
|
13
36
|
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
14
37
|
return url
|
|
15
38
|
}
|
|
16
|
-
|
|
39
|
+
const path = url.startsWith('/') ? url : `/${url}`
|
|
40
|
+
const base = requestBase()
|
|
41
|
+
return base ? `${base}${path}` : path
|
|
17
42
|
}
|
|
18
43
|
|
|
19
44
|
export const request: typeof Taro.request = option => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tarojs/taro" />
|
|
2
2
|
|
|
3
3
|
declare const PROJECT_DOMAIN: string | undefined;
|
|
4
|
+
declare const LICOS_H5_BASE_PATH: string | undefined;
|
|
4
5
|
declare const LICOS_TARO_ENV: "weapp" | "h5" | "tt" | string | undefined;
|
|
5
6
|
|
|
6
7
|
declare module '*.png';
|
|
@@ -28,4 +29,3 @@ declare namespace NodeJS {
|
|
|
28
29
|
TARO_APP_ID: string
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
|
package/lib/cli.js
CHANGED
|
@@ -2109,7 +2109,7 @@ const EventBuilder = {
|
|
|
2109
2109
|
};
|
|
2110
2110
|
|
|
2111
2111
|
var name = "@kmlckj/licos-ai-cli";
|
|
2112
|
-
var version = "1.0.
|
|
2112
|
+
var version = "1.0.27";
|
|
2113
2113
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2114
2114
|
var license = "MIT";
|
|
2115
2115
|
var author = "kmlckj";
|
|
@@ -9047,26 +9047,24 @@ const readGitConfig = (projectPath, key) => {
|
|
|
9047
9047
|
const ensureGitCommitIdentity = (projectPath) => {
|
|
9048
9048
|
const existingName = readGitConfig(projectPath, 'user.name');
|
|
9049
9049
|
const existingEmail = readGitConfig(projectPath, 'user.email');
|
|
9050
|
+
const userId = (process.env.AGENT_USER_ID || process.env.LICOS_USER_ID || '').trim();
|
|
9051
|
+
const desiredName = userId || process.env.LICOS_GIT_USER_NAME || process.env.GIT_AUTHOR_NAME || '';
|
|
9052
|
+
const desiredEmail = userId
|
|
9053
|
+
? `${userId}@aios.licos.com`
|
|
9054
|
+
: process.env.LICOS_GIT_USER_EMAIL || process.env.GIT_AUTHOR_EMAIL || '';
|
|
9055
|
+
const shouldSetName = desiredName && existingName !== desiredName;
|
|
9056
|
+
const shouldSetEmail = desiredEmail && existingEmail !== desiredEmail;
|
|
9050
9057
|
|
|
9051
|
-
if (
|
|
9058
|
+
if (!shouldSetName && !shouldSetEmail) {
|
|
9052
9059
|
return;
|
|
9053
9060
|
}
|
|
9054
9061
|
|
|
9055
|
-
const fallbackName =
|
|
9056
|
-
process.env.LICOS_GIT_USER_NAME ||
|
|
9057
|
-
process.env.GIT_AUTHOR_NAME ||
|
|
9058
|
-
'LicOS Agent';
|
|
9059
|
-
const fallbackEmail =
|
|
9060
|
-
process.env.LICOS_GIT_USER_EMAIL ||
|
|
9061
|
-
process.env.GIT_AUTHOR_EMAIL ||
|
|
9062
|
-
'agent@licos.local';
|
|
9063
|
-
|
|
9064
9062
|
logger.info('Configuring local git commit identity...');
|
|
9065
|
-
if (
|
|
9066
|
-
runGitCommandArgs(['config', '--local', 'user.name',
|
|
9063
|
+
if (shouldSetName) {
|
|
9064
|
+
runGitCommandArgs(['config', '--local', 'user.name', desiredName], projectPath);
|
|
9067
9065
|
}
|
|
9068
|
-
if (
|
|
9069
|
-
runGitCommandArgs(['config', '--local', 'user.email',
|
|
9066
|
+
if (shouldSetEmail) {
|
|
9067
|
+
runGitCommandArgs(['config', '--local', 'user.email', desiredEmail], projectPath);
|
|
9070
9068
|
}
|
|
9071
9069
|
};
|
|
9072
9070
|
|