@nalvietnam/avatar-cli 1.3.1 → 1.3.3
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
CHANGED
|
@@ -968,24 +968,8 @@ async function commitWorkspace(workspaceRoot, opts) {
|
|
|
968
968
|
}
|
|
969
969
|
return { sha, pushed };
|
|
970
970
|
}
|
|
971
|
-
function warnIfOtherTargetDirty(workspaceRoot, requestedTarget) {
|
|
972
|
-
if (requestedTarget === "all") return;
|
|
973
|
-
const srcDirty = isDirty(join7(workspaceRoot, "src"));
|
|
974
|
-
const workspaceDirty = isDirty(workspaceRoot);
|
|
975
|
-
if (requestedTarget === "src" && workspaceDirty) {
|
|
976
|
-
log.warn(
|
|
977
|
-
"Workspace c\u0169ng c\xF3 changes ch\u01B0a commit. Ch\u1EA1y 'avatar commit workspace' (ho\u1EB7c 'avatar commit all') \u0111\u1EC3 commit lu\xF4n."
|
|
978
|
-
);
|
|
979
|
-
}
|
|
980
|
-
if (requestedTarget === "workspace" && srcDirty) {
|
|
981
|
-
log.warn(
|
|
982
|
-
"src/ c\u0169ng c\xF3 changes ch\u01B0a commit. Ch\u1EA1y 'avatar commit src' (ho\u1EB7c 'avatar commit all') \u0111\u1EC3 commit lu\xF4n."
|
|
983
|
-
);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
971
|
async function executeCommitWithTargetSelection(args) {
|
|
987
972
|
assertAvatarWorkspaceRoot(args.workspaceRoot);
|
|
988
|
-
warnIfOtherTargetDirty(args.workspaceRoot, args.target);
|
|
989
973
|
const result = { target: args.target, skipped: [] };
|
|
990
974
|
if (args.target === "src" || args.target === "all") {
|
|
991
975
|
const srcOutcome = await commitSrc(args.workspaceRoot, args.options);
|
|
@@ -1004,18 +988,12 @@ async function executeCommitWithTargetSelection(args) {
|
|
|
1004
988
|
|
|
1005
989
|
// src/commands/commit.ts
|
|
1006
990
|
function registerCommitCommand(program2) {
|
|
1007
|
-
const commit = program2.command("commit").description("Commit code
|
|
991
|
+
const commit = program2.command("commit").description("Commit code kh\xE1ch trong src/ (Avatar state do admin sync) (M07)");
|
|
1008
992
|
commit.command("src").description("Commit src/ \u2192 push l\xEAn client repo remote").option("-m, --message <msg>", "Commit message").option("--push", "Auto push sau commit (default: ch\u1EC9 commit)").action(async (opts) => {
|
|
1009
|
-
await
|
|
1010
|
-
});
|
|
1011
|
-
commit.command("workspace").description("Commit workspace root \u2192 push l\xEAn team remote (Avatar state)").option("-m, --message <msg>", "Commit message").option("--push", "Auto push sau commit (default: ch\u1EC9 commit)").action(async (opts) => {
|
|
1012
|
-
await runCommit("workspace", opts);
|
|
1013
|
-
});
|
|
1014
|
-
commit.command("all").description("Commit c\u1EA3 src/ v\xE0 workspace (src tr\u01B0\u1EDBc, gitlink update, workspace sau)").option("-m, --message <msg>", "Commit message").option("--push", "Auto push sau commit (default: ch\u1EC9 commit)").action(async (opts) => {
|
|
1015
|
-
await runCommit("all", opts);
|
|
993
|
+
await runCommitSrc(opts);
|
|
1016
994
|
});
|
|
1017
995
|
}
|
|
1018
|
-
async function
|
|
996
|
+
async function runCommitSrc(opts) {
|
|
1019
997
|
try {
|
|
1020
998
|
const message = opts.message ?? await input2({
|
|
1021
999
|
message: "Commit message:",
|
|
@@ -1023,17 +1001,12 @@ async function runCommit(target, opts) {
|
|
|
1023
1001
|
});
|
|
1024
1002
|
const result = await executeCommitWithTargetSelection({
|
|
1025
1003
|
workspaceRoot: process.cwd(),
|
|
1026
|
-
target,
|
|
1004
|
+
target: "src",
|
|
1027
1005
|
options: { message, push: opts.push }
|
|
1028
1006
|
});
|
|
1029
1007
|
if (result.srcCommitSha) {
|
|
1030
1008
|
log.success(`src/: ${result.srcCommitSha.slice(0, 7)}${result.srcPushed ? " (pushed)" : ""}`);
|
|
1031
1009
|
}
|
|
1032
|
-
if (result.workspaceCommitSha) {
|
|
1033
|
-
log.success(
|
|
1034
|
-
`workspace: ${result.workspaceCommitSha.slice(0, 7)}${result.workspacePushed ? " (pushed)" : ""}`
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
1010
|
if (result.skipped && result.skipped.length > 0) {
|
|
1038
1011
|
log.dim(`Skipped (nothing to commit): ${result.skipped.join(", ")}`);
|
|
1039
1012
|
}
|
|
@@ -1147,14 +1120,7 @@ async function writeWithBackup(path, content, mode) {
|
|
|
1147
1120
|
await writeTextAtomic(path, content, mode);
|
|
1148
1121
|
return backup;
|
|
1149
1122
|
}
|
|
1150
|
-
var CLAUDE_SUBDIRS = ["
|
|
1151
|
-
var PROJECT_KNOWLEDGE_TEMPLATES = [
|
|
1152
|
-
"project/tech-stack.md",
|
|
1153
|
-
"project/conventions.md",
|
|
1154
|
-
"project/architecture.md",
|
|
1155
|
-
"project/domain.md",
|
|
1156
|
-
"project/gotchas.md"
|
|
1157
|
-
];
|
|
1123
|
+
var CLAUDE_SUBDIRS = ["state", "_pending", "_backup"];
|
|
1158
1124
|
async function createClaudeDirTree(projectRoot) {
|
|
1159
1125
|
const claudeRoot = join10(projectRoot, ".claude");
|
|
1160
1126
|
await ensureDir(claudeRoot);
|
|
@@ -1164,39 +1130,8 @@ async function createClaudeDirTree(projectRoot) {
|
|
|
1164
1130
|
await writeTextAtomic(join10(dir, ".gitkeep"), "");
|
|
1165
1131
|
}
|
|
1166
1132
|
}
|
|
1167
|
-
async function writeProjectKnowledgeFiles(
|
|
1168
|
-
|
|
1169
|
-
...vars,
|
|
1170
|
-
primaryLanguage: "(ch\u01B0a scan)",
|
|
1171
|
-
frameworks: "(ch\u01B0a scan)",
|
|
1172
|
-
databases: "(ch\u01B0a scan)",
|
|
1173
|
-
testStack: "(ch\u01B0a scan)",
|
|
1174
|
-
buildStack: "(ch\u01B0a scan)",
|
|
1175
|
-
toolVersions: "(ch\u01B0a scan)",
|
|
1176
|
-
codeStyle: "(ch\u01B0a scan)",
|
|
1177
|
-
namingConvention: "(ch\u01B0a scan)",
|
|
1178
|
-
folderStructure: "(ch\u01B0a scan)",
|
|
1179
|
-
commitConvention: "(ch\u01B0a scan)",
|
|
1180
|
-
linterConfig: "(ch\u01B0a scan)",
|
|
1181
|
-
architectureOverview: "(ch\u01B0a scan)",
|
|
1182
|
-
moduleLayout: "(ch\u01B0a scan)",
|
|
1183
|
-
dataFlow: "(ch\u01B0a scan)",
|
|
1184
|
-
externalIntegrations: "(ch\u01B0a scan)",
|
|
1185
|
-
deploymentTopology: "(ch\u01B0a scan)",
|
|
1186
|
-
domainDescription: "(ch\u01B0a scan)",
|
|
1187
|
-
coreEntities: "(ch\u01B0a scan)",
|
|
1188
|
-
primaryUseCases: "(ch\u01B0a scan)",
|
|
1189
|
-
domainGlossary: "(ch\u01B0a scan)"
|
|
1190
|
-
};
|
|
1191
|
-
const backups = [];
|
|
1192
|
-
for (const tpl of PROJECT_KNOWLEDGE_TEMPLATES) {
|
|
1193
|
-
const content = await renderTemplateByName(tpl, baseVars);
|
|
1194
|
-
const relative4 = tpl.replace(/^project\//, "");
|
|
1195
|
-
const outPath = join10(projectRoot, ".claude", "project", relative4);
|
|
1196
|
-
const backup = await writeWithBackup(outPath, content);
|
|
1197
|
-
if (backup) backups.push(backup);
|
|
1198
|
-
}
|
|
1199
|
-
return backups;
|
|
1133
|
+
async function writeProjectKnowledgeFiles(_projectRoot, _vars) {
|
|
1134
|
+
return [];
|
|
1200
1135
|
}
|
|
1201
1136
|
async function writeRootClaudeMd(projectRoot, vars) {
|
|
1202
1137
|
const content = await renderTemplateByName("CLAUDE.md", vars);
|
|
@@ -3555,7 +3490,7 @@ async function removeSubmoduleEntry(gitmodulesPath, submodulePath) {
|
|
|
3555
3490
|
}
|
|
3556
3491
|
|
|
3557
3492
|
// src/commands/uninstall.ts
|
|
3558
|
-
var CLI_VERSION = "1.3.
|
|
3493
|
+
var CLI_VERSION = "1.3.3";
|
|
3559
3494
|
function registerUninstallCommand(program2) {
|
|
3560
3495
|
program2.command("uninstall").description("G\u1EE1 Avatar kh\u1ECFi project \u2014 backup t\u1EF1 \u0111\u1ED9ng (M11)").option("--yes", "Skip confirm prompt").option("--no-backup", "Kh\xF4ng t\u1EA1o backup tr\u01B0\u1EDBc khi x\xF3a (nguy hi\u1EC3m)").option("--keep-submodule", "Gi\u1EEF submodule .claude/pack/").option("--keep-hooks", "Gi\u1EEF git hooks post-merge, pre-push").option("--dry-run", "Hi\u1EC3n th\u1ECB danh s\xE1ch s\u1EBD x\xF3a, kh\xF4ng th\u1EF1c thi").action(async (opts) => {
|
|
3561
3496
|
try {
|
|
@@ -3637,7 +3572,7 @@ function printUninstallSuccessBox(backupPath) {
|
|
|
3637
3572
|
}
|
|
3638
3573
|
|
|
3639
3574
|
// src/index.ts
|
|
3640
|
-
var CLI_VERSION2 = "1.3.
|
|
3575
|
+
var CLI_VERSION2 = "1.3.3";
|
|
3641
3576
|
var program = new Command();
|
|
3642
3577
|
program.name("avatar").description("AI harness CLI for NAL Vietnam engineering").version(CLI_VERSION2, "-v, --version", "Hi\u1EC3n th\u1ECB phi\xEAn b\u1EA3n Avatar CLI").addHelpText(
|
|
3643
3578
|
"beforeAll",
|