@atlashub/smartstack-cli 1.18.0 → 1.20.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/dist/index.js +92 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/skills/gitflow/steps/step-commit.md +14 -2
- package/templates/skills/gitflow/steps/step-finish.md +26 -0
- package/templates/skills/gitflow/steps/step-merge.md +8 -3
- package/templates/skills/gitflow/steps/step-pr.md +10 -0
- package/templates/skills/gitflow/steps/step-start.md +12 -1
- package/templates/skills/gitflow/steps/step-sync.md +24 -0
package/dist/index.js
CHANGED
|
@@ -117769,6 +117769,7 @@ var import_mssql = __toESM(require_mssql());
|
|
|
117769
117769
|
var import_bcryptjs = __toESM(require_bcryptjs());
|
|
117770
117770
|
var import_fs3 = require("fs");
|
|
117771
117771
|
var import_path7 = require("path");
|
|
117772
|
+
var import_child_process7 = require("child_process");
|
|
117772
117773
|
var DEFAULT_CONFIG = {
|
|
117773
117774
|
schema: "core",
|
|
117774
117775
|
usersTable: "auth_Users",
|
|
@@ -117798,6 +117799,26 @@ function extractConnectionString(filePath) {
|
|
|
117798
117799
|
return null;
|
|
117799
117800
|
}
|
|
117800
117801
|
}
|
|
117802
|
+
function parseConnectionString(connStr) {
|
|
117803
|
+
const parts = connStr.split(";").reduce(
|
|
117804
|
+
(acc, part) => {
|
|
117805
|
+
const [key, value] = part.split("=").map((s) => s.trim());
|
|
117806
|
+
if (key && value) acc[key.toLowerCase()] = value;
|
|
117807
|
+
return acc;
|
|
117808
|
+
},
|
|
117809
|
+
{}
|
|
117810
|
+
);
|
|
117811
|
+
return {
|
|
117812
|
+
server: parts["server"] || parts["data source"] || "localhost",
|
|
117813
|
+
database: parts["database"] || parts["initial catalog"] || "SmartStack",
|
|
117814
|
+
useWindowsAuth: parts["integrated security"]?.toLowerCase() === "true" || parts["trusted_connection"]?.toLowerCase() === "true"
|
|
117815
|
+
};
|
|
117816
|
+
}
|
|
117817
|
+
function executeSqlCmd(server, database, query) {
|
|
117818
|
+
const sqlServer = server === "(local)" ? "." : server;
|
|
117819
|
+
const cmd = `sqlcmd -S "${sqlServer}" -d "${database}" -E -Q "${query.replace(/"/g, '\\"')}" -h -1 -W`;
|
|
117820
|
+
return (0, import_child_process7.execSync)(cmd, { encoding: "utf-8" }).trim();
|
|
117821
|
+
}
|
|
117801
117822
|
function detectSmartStackApp() {
|
|
117802
117823
|
const possiblePaths = [
|
|
117803
117824
|
"D:\\01 - projets\\SmartStack.app\\02-Develop\\src\\SmartStack.Api",
|
|
@@ -117871,56 +117892,85 @@ adminCommand.command("reset").description("Reset the localAdmin account password
|
|
|
117871
117892
|
}
|
|
117872
117893
|
}
|
|
117873
117894
|
const spinner = logger.spinner("Connecting to database...");
|
|
117895
|
+
const connInfo = parseConnectionString(connectionString);
|
|
117874
117896
|
try {
|
|
117875
|
-
|
|
117876
|
-
|
|
117877
|
-
|
|
117878
|
-
|
|
117879
|
-
|
|
117880
|
-
|
|
117881
|
-
|
|
117882
|
-
|
|
117883
|
-
|
|
117884
|
-
|
|
117885
|
-
|
|
117886
|
-
|
|
117887
|
-
|
|
117888
|
-
|
|
117889
|
-
spinner.
|
|
117890
|
-
|
|
117891
|
-
|
|
117897
|
+
if (connInfo.useWindowsAuth) {
|
|
117898
|
+
spinner.text = "Using Windows Authentication (sqlcmd)...";
|
|
117899
|
+
const checkQuery = `SELECT COUNT(*) FROM [core].[auth_Users] WHERE Email = '${adminEmail}'`;
|
|
117900
|
+
const countResult = executeSqlCmd(connInfo.server, connInfo.database, checkQuery);
|
|
117901
|
+
const exists = parseInt(countResult, 10) > 0;
|
|
117902
|
+
if (!exists) {
|
|
117903
|
+
spinner.fail(`Account ${source_default.yellow(adminEmail)} does not exist.`);
|
|
117904
|
+
logger.error("Cannot reset password for non-existent account.");
|
|
117905
|
+
logger.info("Use the application seeding or AdminTool to create the account first.");
|
|
117906
|
+
process.exit(1);
|
|
117907
|
+
}
|
|
117908
|
+
spinner.text = "Generating new password...";
|
|
117909
|
+
const newPassword = generatePassword();
|
|
117910
|
+
const passwordHash = await import_bcryptjs.default.hash(newPassword, 10);
|
|
117911
|
+
spinner.text = "Updating password...";
|
|
117912
|
+
const updateQuery = `UPDATE [core].[auth_Users] SET PasswordHash = '${passwordHash}', UpdatedAt = GETUTCDATE() WHERE Email = '${adminEmail}'`;
|
|
117913
|
+
executeSqlCmd(connInfo.server, connInfo.database, updateQuery);
|
|
117914
|
+
spinner.succeed("Password reset successfully!");
|
|
117915
|
+
console.log();
|
|
117916
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117917
|
+
console.log(source_default.green.bold(" LOCAL ADMINISTRATOR PASSWORD RESET"));
|
|
117918
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117919
|
+
console.log();
|
|
117920
|
+
console.log(source_default.white(" Email: "), source_default.cyan(adminEmail));
|
|
117921
|
+
console.log(source_default.white(" Password: "), source_default.yellow.bold(newPassword));
|
|
117922
|
+
console.log();
|
|
117923
|
+
console.log(source_default.red(" \u26A0 SAVE THIS PASSWORD NOW - IT WILL NOT BE SHOWN AGAIN"));
|
|
117924
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117925
|
+
console.log();
|
|
117926
|
+
} else {
|
|
117927
|
+
await import_mssql.default.connect(connectionString);
|
|
117928
|
+
spinner.text = "Connected. Checking account...";
|
|
117929
|
+
const checkResult = await import_mssql.default.query`
|
|
117930
|
+
SELECT COUNT(*) as count
|
|
117931
|
+
FROM [core].[auth_Users]
|
|
117932
|
+
WHERE Email = ${adminEmail}
|
|
117933
|
+
`;
|
|
117934
|
+
const exists = checkResult.recordset[0].count > 0;
|
|
117935
|
+
if (!exists) {
|
|
117936
|
+
spinner.fail(`Account ${source_default.yellow(adminEmail)} does not exist.`);
|
|
117937
|
+
logger.error("Cannot reset password for non-existent account.");
|
|
117938
|
+
logger.info("Use the application seeding or AdminTool to create the account first.");
|
|
117939
|
+
await import_mssql.default.close();
|
|
117940
|
+
process.exit(1);
|
|
117941
|
+
}
|
|
117942
|
+
spinner.text = "Generating new password...";
|
|
117943
|
+
const newPassword = generatePassword();
|
|
117944
|
+
const passwordHash = await import_bcryptjs.default.hash(newPassword, 10);
|
|
117945
|
+
spinner.text = "Updating password...";
|
|
117946
|
+
await import_mssql.default.query`
|
|
117947
|
+
UPDATE [core].[auth_Users]
|
|
117948
|
+
SET PasswordHash = ${passwordHash},
|
|
117949
|
+
UpdatedAt = ${/* @__PURE__ */ new Date()}
|
|
117950
|
+
WHERE Email = ${adminEmail}
|
|
117951
|
+
`;
|
|
117892
117952
|
await import_mssql.default.close();
|
|
117893
|
-
|
|
117953
|
+
spinner.succeed("Password reset successfully!");
|
|
117954
|
+
console.log();
|
|
117955
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117956
|
+
console.log(source_default.green.bold(" LOCAL ADMINISTRATOR PASSWORD RESET"));
|
|
117957
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117958
|
+
console.log();
|
|
117959
|
+
console.log(source_default.white(" Email: "), source_default.cyan(adminEmail));
|
|
117960
|
+
console.log(source_default.white(" Password: "), source_default.yellow.bold(newPassword));
|
|
117961
|
+
console.log();
|
|
117962
|
+
console.log(source_default.red(" \u26A0 SAVE THIS PASSWORD NOW - IT WILL NOT BE SHOWN AGAIN"));
|
|
117963
|
+
console.log(source_default.green("\u2550".repeat(60)));
|
|
117964
|
+
console.log();
|
|
117894
117965
|
}
|
|
117895
|
-
spinner.text = "Generating new password...";
|
|
117896
|
-
const newPassword = generatePassword();
|
|
117897
|
-
const passwordHash = await import_bcryptjs.default.hash(newPassword, 10);
|
|
117898
|
-
spinner.text = "Updating password...";
|
|
117899
|
-
await import_mssql.default.query`
|
|
117900
|
-
UPDATE [core].[auth_Users]
|
|
117901
|
-
SET PasswordHash = ${passwordHash},
|
|
117902
|
-
UpdatedAt = ${/* @__PURE__ */ new Date()}
|
|
117903
|
-
WHERE Email = ${adminEmail}
|
|
117904
|
-
`;
|
|
117905
|
-
await import_mssql.default.close();
|
|
117906
|
-
spinner.succeed("Password reset successfully!");
|
|
117907
|
-
console.log();
|
|
117908
|
-
console.log(source_default.green("\u2550".repeat(60)));
|
|
117909
|
-
console.log(source_default.green.bold(" LOCAL ADMINISTRATOR PASSWORD RESET"));
|
|
117910
|
-
console.log(source_default.green("\u2550".repeat(60)));
|
|
117911
|
-
console.log();
|
|
117912
|
-
console.log(source_default.white(" Email: "), source_default.cyan(adminEmail));
|
|
117913
|
-
console.log(source_default.white(" Password: "), source_default.yellow.bold(newPassword));
|
|
117914
|
-
console.log();
|
|
117915
|
-
console.log(source_default.red(" \u26A0 SAVE THIS PASSWORD NOW - IT WILL NOT BE SHOWN AGAIN"));
|
|
117916
|
-
console.log(source_default.green("\u2550".repeat(60)));
|
|
117917
|
-
console.log();
|
|
117918
117966
|
} catch (error) {
|
|
117919
117967
|
spinner.fail("Failed to reset password");
|
|
117920
117968
|
if (error instanceof Error) {
|
|
117921
117969
|
logger.error(error.message);
|
|
117922
117970
|
}
|
|
117923
|
-
|
|
117971
|
+
if (!connInfo.useWindowsAuth) {
|
|
117972
|
+
await import_mssql.default.close();
|
|
117973
|
+
}
|
|
117924
117974
|
process.exit(1);
|
|
117925
117975
|
}
|
|
117926
117976
|
});
|