thachvd-kit 1.0.5 → 1.0.6
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/bin/cli.js +26 -11
- package/package.json +1 -1
- package/scripts/init.py +6 -1
package/bin/cli.js
CHANGED
|
@@ -924,6 +924,7 @@ async function main() {
|
|
|
924
924
|
}
|
|
925
925
|
|
|
926
926
|
const scanned = useScan ? scanProject() : null;
|
|
927
|
+
let reviewScannedFields = !useScan;
|
|
927
928
|
|
|
928
929
|
if (useScan) {
|
|
929
930
|
console.log(`${pc.bold(' Scan result:')} ${scanned.primary_language} | ${scanned.frameworks.join(', ') || 'no framework'}`);
|
|
@@ -933,20 +934,34 @@ async function main() {
|
|
|
933
934
|
scanned.scan_evidence.forEach(line => console.log(` · ${line}`));
|
|
934
935
|
console.log('');
|
|
935
936
|
}
|
|
937
|
+
|
|
938
|
+
if (!assumeYes) {
|
|
939
|
+
const scanAction = await askQuestions({
|
|
940
|
+
type: 'select',
|
|
941
|
+
name: 'scan_action',
|
|
942
|
+
message: 'Use detected context as-is or review fields manually?',
|
|
943
|
+
choices: [
|
|
944
|
+
{ title: 'Use detected context', value: 'accept' },
|
|
945
|
+
{ title: 'Review detected fields', value: 'review' }
|
|
946
|
+
],
|
|
947
|
+
initial: 0
|
|
948
|
+
});
|
|
949
|
+
reviewScannedFields = scanAction.scan_action === 'review';
|
|
950
|
+
}
|
|
936
951
|
}
|
|
937
952
|
|
|
938
953
|
const { project_name, description, project_type } = await askQuestions([
|
|
939
|
-
{ type: assumeYes ? null : 'text', name: 'project_name', message: 'Project name:', initial: scanned?.project_name || path.basename(targetDir) },
|
|
940
|
-
{ type: assumeYes ? null : 'text', name: 'description', message: 'Short description:', initial: scanned?.description || 'A software project' },
|
|
954
|
+
{ type: assumeYes || !reviewScannedFields ? null : 'text', name: 'project_name', message: 'Project name:', initial: scanned?.project_name || path.basename(targetDir) },
|
|
955
|
+
{ type: assumeYes || !reviewScannedFields ? null : 'text', name: 'description', message: 'Short description:', initial: scanned?.description || 'A software project' },
|
|
941
956
|
{
|
|
942
|
-
type: assumeYes ? null : 'select', name: 'project_type', message: 'Project type:',
|
|
957
|
+
type: assumeYes || !reviewScannedFields ? null : 'select', name: 'project_type', message: 'Project type:',
|
|
943
958
|
choices: PROJECT_TYPE_CHOICES.map(value => ({ title: value, value })),
|
|
944
959
|
initial: Math.max(PROJECT_TYPE_CHOICES.indexOf(scanned?.project_type || 'web-app'), 0)
|
|
945
960
|
}
|
|
946
961
|
]);
|
|
947
962
|
|
|
948
963
|
const { primary_language } = await askQuestions({
|
|
949
|
-
type: assumeYes ? null : 'select',
|
|
964
|
+
type: assumeYes || !reviewScannedFields ? null : 'select',
|
|
950
965
|
name: 'primary_language',
|
|
951
966
|
message: 'Primary language:',
|
|
952
967
|
choices: LANGUAGE_CHOICES.map(l => ({ title: l, value: l })),
|
|
@@ -954,7 +969,7 @@ async function main() {
|
|
|
954
969
|
});
|
|
955
970
|
|
|
956
971
|
const { frameworks } = await askQuestions({
|
|
957
|
-
type: assumeYes ? null : 'multiselect',
|
|
972
|
+
type: assumeYes || !reviewScannedFields ? null : 'multiselect',
|
|
958
973
|
name: 'frameworks',
|
|
959
974
|
message: 'Frameworks (Space to select, Enter to confirm):',
|
|
960
975
|
choices: FRAMEWORK_CHOICES.map(f => ({ title: f, value: f, selected: (scanned?.frameworks || []).includes(f) })),
|
|
@@ -963,13 +978,13 @@ async function main() {
|
|
|
963
978
|
|
|
964
979
|
const dbAndInfra = await askQuestions([
|
|
965
980
|
{
|
|
966
|
-
type: assumeYes ? null : 'select', name: 'database', message: 'Database / ORM:',
|
|
981
|
+
type: assumeYes || !reviewScannedFields ? null : 'select', name: 'database', message: 'Database / ORM:',
|
|
967
982
|
choices: DATABASE_CHOICES.map(d => ({ title: d, value: d })),
|
|
968
983
|
initial: Math.max(DATABASE_CHOICES.indexOf(scanned?.database || 'none'), 0)
|
|
969
984
|
},
|
|
970
|
-
{ type: assumeYes ? null : 'confirm', name: 'uses_docker', message: 'Uses Docker / Docker Compose?', initial: scanned?.uses_docker ?? true },
|
|
985
|
+
{ type: assumeYes || !reviewScannedFields ? null : 'confirm', name: 'uses_docker', message: 'Uses Docker / Docker Compose?', initial: scanned?.uses_docker ?? true },
|
|
971
986
|
{
|
|
972
|
-
type: assumeYes ? null : 'select', name: 'cloud', message: 'Cloud Provider:',
|
|
987
|
+
type: assumeYes || !reviewScannedFields ? null : 'select', name: 'cloud', message: 'Cloud Provider:',
|
|
973
988
|
choices: CLOUD_CHOICES.map(c => ({ title: c, value: c })),
|
|
974
989
|
initial: Math.max(CLOUD_CHOICES.indexOf(scanned?.cloud || 'none'), 0)
|
|
975
990
|
}
|
|
@@ -977,12 +992,12 @@ async function main() {
|
|
|
977
992
|
|
|
978
993
|
const { package_manager, test_framework, max_file_lines } = await askQuestions([
|
|
979
994
|
{
|
|
980
|
-
type: assumeYes ? null : 'select', name: 'package_manager', message: 'Package Manager:',
|
|
995
|
+
type: assumeYes || !reviewScannedFields ? null : 'select', name: 'package_manager', message: 'Package Manager:',
|
|
981
996
|
choices: PACKAGE_MANAGER_CHOICES.map(p => ({ title: p, value: p })),
|
|
982
997
|
initial: Math.max(PACKAGE_MANAGER_CHOICES.indexOf(scanned?.package_manager || 'auto-detect'), 0)
|
|
983
998
|
},
|
|
984
|
-
{ type: assumeYes ? null : 'text', name: 'test_framework', message: 'Test Framework (jest, phpunit, etc):', initial: scanned?.test_framework || 'auto-detect' },
|
|
985
|
-
{ type: assumeYes ? null : 'text', name: 'max_file_lines', message: 'Max lines per file:', initial: scanned?.max_file_lines || '300' }
|
|
999
|
+
{ type: assumeYes || !reviewScannedFields ? null : 'text', name: 'test_framework', message: 'Test Framework (jest, phpunit, etc):', initial: scanned?.test_framework || 'auto-detect' },
|
|
1000
|
+
{ type: assumeYes || !reviewScannedFields ? null : 'text', name: 'max_file_lines', message: 'Max lines per file:', initial: scanned?.max_file_lines || '300' }
|
|
986
1001
|
]);
|
|
987
1002
|
|
|
988
1003
|
// Combine data
|
package/package.json
CHANGED
package/scripts/init.py
CHANGED
|
@@ -675,6 +675,7 @@ def main():
|
|
|
675
675
|
use_scan = existing_mode == "scan"
|
|
676
676
|
|
|
677
677
|
scanned = scan_project() if use_scan else None
|
|
678
|
+
review_scanned_fields = not use_scan
|
|
678
679
|
if use_scan:
|
|
679
680
|
print(f" {dim('Scan mode: detecting stack from current project files...')}")
|
|
680
681
|
print(f" {bold('Scan result:')} {scanned['primary_language']} | {', '.join(scanned['frameworks']) or 'no framework'}")
|
|
@@ -684,6 +685,10 @@ def main():
|
|
|
684
685
|
for line in scanned["scan_evidence"]:
|
|
685
686
|
print(f" · {line}")
|
|
686
687
|
print()
|
|
688
|
+
if not args.yes:
|
|
689
|
+
scan_action = ask_select("Use detected context as-is or review fields manually",
|
|
690
|
+
["accept", "review"], default="accept")
|
|
691
|
+
review_scanned_fields = scan_action == "review"
|
|
687
692
|
elif not args.yes:
|
|
688
693
|
print(f" {dim('Manual mode: asking for project context explicitly.')}\n")
|
|
689
694
|
|
|
@@ -692,7 +697,7 @@ def main():
|
|
|
692
697
|
else:
|
|
693
698
|
data = {}
|
|
694
699
|
|
|
695
|
-
if not args.yes:
|
|
700
|
+
if not args.yes and review_scanned_fields:
|
|
696
701
|
# ── Project Info ──────────────────────────────────────────────────────
|
|
697
702
|
section("Project Info")
|
|
698
703
|
data["project_name"] = ask("Project name", default=(scanned or {}).get("project_name", Path.cwd().name))
|