@kmlckj/licos-ai-cli 0.0.11 → 0.0.12
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/lib/cli.js +34 -1
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -2107,7 +2107,7 @@ const EventBuilder = {
|
|
|
2107
2107
|
};
|
|
2108
2108
|
|
|
2109
2109
|
var name = "@kmlckj/licos-ai-cli";
|
|
2110
|
-
var version = "0.0.
|
|
2110
|
+
var version = "0.0.12";
|
|
2111
2111
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2112
2112
|
var license = "MIT";
|
|
2113
2113
|
var author = "kmlckj";
|
|
@@ -6831,6 +6831,38 @@ const reportFailureAndExit = (
|
|
|
6831
6831
|
});
|
|
6832
6832
|
};
|
|
6833
6833
|
|
|
6834
|
+
const PROJECT_ENV_JSON_VAR = 'LICOS_PROJECT_ENV_JSON';
|
|
6835
|
+
|
|
6836
|
+
const isValidProjectEnvKey = (key) =>
|
|
6837
|
+
typeof key === 'string' &&
|
|
6838
|
+
/^[A-Za-z_][A-Za-z0-9_]*$/.test(key);
|
|
6839
|
+
|
|
6840
|
+
const buildProjectProgramEnv = () => {
|
|
6841
|
+
const raw = process.env[PROJECT_ENV_JSON_VAR];
|
|
6842
|
+
if (!raw) {
|
|
6843
|
+
return { ...process.env };
|
|
6844
|
+
}
|
|
6845
|
+
|
|
6846
|
+
const env = { ...process.env };
|
|
6847
|
+
delete env[PROJECT_ENV_JSON_VAR];
|
|
6848
|
+
|
|
6849
|
+
try {
|
|
6850
|
+
const parsed = JSON.parse(raw);
|
|
6851
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
6852
|
+
logger.warn(`${PROJECT_ENV_JSON_VAR} must be a JSON object; ignoring project env payload`);
|
|
6853
|
+
return env;
|
|
6854
|
+
}
|
|
6855
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
6856
|
+
if (isValidProjectEnvKey(key)) {
|
|
6857
|
+
env[key] = value == null ? '' : String(value);
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
} catch (error) {
|
|
6861
|
+
logger.warn(`Failed to parse ${PROJECT_ENV_JSON_VAR}; ignoring project env payload: ${error.message}`);
|
|
6862
|
+
}
|
|
6863
|
+
return env;
|
|
6864
|
+
};
|
|
6865
|
+
|
|
6834
6866
|
// eslint-disable-next-line @licos/max-line-per-function, max-lines-per-function -- orchestrates fix+build+reporting
|
|
6835
6867
|
const executeRun = async (
|
|
6836
6868
|
commandName,
|
|
@@ -6886,6 +6918,7 @@ const executeRun = async (
|
|
|
6886
6918
|
const childProcess = shelljs.exec(commandString, {
|
|
6887
6919
|
async: true,
|
|
6888
6920
|
silent: true, // 不自动输出,我们手动处理
|
|
6921
|
+
env: buildProjectProgramEnv(),
|
|
6889
6922
|
});
|
|
6890
6923
|
|
|
6891
6924
|
if (!childProcess) {
|