@damphuquy/agent-init 3.2.0 → 3.4.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/cli.d.ts.map +1 -1
- package/dist/cli.js +58 -3
- package/dist/cli.js.map +1 -1
- package/dist/scaffolder.d.ts +2 -1
- package/dist/scaffolder.d.ts.map +1 -1
- package/dist/scaffolder.js +331 -26
- package/dist/scaffolder.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +3 -0
- package/dist/theme.js.map +1 -1
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +11 -1
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
- package/templates/en/AGENTS.md +1 -0
- package/templates/en/instruction-version.json +3 -3
- package/templates/en/process/_seeds/_GUIDE.md +1 -0
- package/templates/en/process/_seeds/state-template.md.seed +2 -1
- package/templates/en/process/_seeds/task-lite.md.seed +1 -0
- package/templates/en/process/_seeds/task-template.md.seed +1 -0
- package/templates/en/process/development-protocols/observability-and-evals.md +34 -4
- package/templates/vi/AGENTS.md +1 -0
- package/templates/vi/instruction-version.json +3 -3
- package/templates/vi/process/_seeds/_GUIDE.md +1 -0
- package/templates/vi/process/_seeds/state-template.md.seed +2 -1
- package/templates/vi/process/_seeds/task-lite.md.seed +1 -0
- package/templates/vi/process/_seeds/task-template.md.seed +1 -0
- package/templates/vi/process/development-protocols/observability-and-evals.md +34 -4
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAK9E;AAED,wBAAgB,SAAS,CACvB,IAAI,GAAE,SAAS,MAAM,EAA0B,GAC9C,UAAU,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAK9E;AAED,wBAAgB,SAAS,CACvB,IAAI,GAAE,SAAS,MAAM,EAA0B,GAC9C,UAAU,CA0GZ;AAED,wBAAsB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAgFzC;AAED,wBAAgB,YAAY,CAC1B,KAAK,GAAE,MAAM,GAAG,SAA2B,EAC3C,aAAa,GAAE,MAAwB,GACtC,OAAO,CAST"}
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { getPackageInfo } from './config.js';
|
|
6
|
-
import { scaffold, updateFramework, syncIdeConfigs, verifyGate } from './scaffolder.js';
|
|
6
|
+
import { scaffold, updateFramework, syncIdeConfigs, verifyGate, deleteFramework } from './scaffolder.js';
|
|
7
7
|
import { colors } from './theme.js';
|
|
8
8
|
import { promptLanguage, renderBanner, showHelp } from './ui.js';
|
|
9
9
|
export function normalizeLanguage(value) {
|
|
@@ -22,6 +22,10 @@ export function parseArgs(argv = process.argv.slice(2)) {
|
|
|
22
22
|
let update = false;
|
|
23
23
|
let check = false;
|
|
24
24
|
let sync = false;
|
|
25
|
+
let deleteCmd = false;
|
|
26
|
+
let yes = false;
|
|
27
|
+
let dryRun = false;
|
|
28
|
+
let includeIde = false;
|
|
25
29
|
let verifyGateOpt = undefined;
|
|
26
30
|
let taskFile = undefined;
|
|
27
31
|
let lang = undefined;
|
|
@@ -35,10 +39,34 @@ export function parseArgs(argv = process.argv.slice(2)) {
|
|
|
35
39
|
i++;
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
|
-
else if (item === '
|
|
42
|
+
else if (item === 'delete' ||
|
|
43
|
+
item === 'remove' ||
|
|
44
|
+
item === 'clean' ||
|
|
45
|
+
item === 'uninstall' ||
|
|
46
|
+
item === 'purge' ||
|
|
47
|
+
item === '--delete') {
|
|
48
|
+
deleteCmd = true;
|
|
49
|
+
const nextItem = argv[i + 1];
|
|
50
|
+
if (nextItem && !nextItem.startsWith('-')) {
|
|
51
|
+
targetDir = nextItem;
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (item === '--check' || item === '-c') {
|
|
39
56
|
check = true;
|
|
40
57
|
update = true;
|
|
41
58
|
}
|
|
59
|
+
else if (item === '--dry-run') {
|
|
60
|
+
dryRun = true;
|
|
61
|
+
check = true;
|
|
62
|
+
}
|
|
63
|
+
else if (item === '-y' || item === '--yes') {
|
|
64
|
+
yes = true;
|
|
65
|
+
force = true;
|
|
66
|
+
}
|
|
67
|
+
else if (item === '--include-ide' || item === '--all') {
|
|
68
|
+
includeIde = true;
|
|
69
|
+
}
|
|
42
70
|
else if (item === 'sync' || item === '--sync') {
|
|
43
71
|
sync = true;
|
|
44
72
|
const nextItem = argv[i + 1];
|
|
@@ -86,7 +114,22 @@ export function parseArgs(argv = process.argv.slice(2)) {
|
|
|
86
114
|
targetDir = item;
|
|
87
115
|
}
|
|
88
116
|
}
|
|
89
|
-
return {
|
|
117
|
+
return {
|
|
118
|
+
targetDir,
|
|
119
|
+
force,
|
|
120
|
+
help,
|
|
121
|
+
version,
|
|
122
|
+
update,
|
|
123
|
+
check,
|
|
124
|
+
sync,
|
|
125
|
+
delete: deleteCmd,
|
|
126
|
+
yes,
|
|
127
|
+
dryRun,
|
|
128
|
+
includeIde,
|
|
129
|
+
verifyGate: verifyGateOpt,
|
|
130
|
+
taskFile,
|
|
131
|
+
lang,
|
|
132
|
+
};
|
|
90
133
|
}
|
|
91
134
|
export async function run() {
|
|
92
135
|
const options = parseArgs();
|
|
@@ -99,6 +142,18 @@ export async function run() {
|
|
|
99
142
|
console.log(`${pkgInfo.name} v${pkgInfo.version}`);
|
|
100
143
|
process.exit(0);
|
|
101
144
|
}
|
|
145
|
+
if (options.delete) {
|
|
146
|
+
const res = deleteFramework({
|
|
147
|
+
targetDir: options.targetDir,
|
|
148
|
+
force: options.force || options.yes,
|
|
149
|
+
dryRun: options.dryRun,
|
|
150
|
+
includeIde: options.includeIde,
|
|
151
|
+
});
|
|
152
|
+
if (!res.success) {
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
102
157
|
if (options.update) {
|
|
103
158
|
const res = updateFramework({
|
|
104
159
|
targetDir: options.targetDir,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,MAAM,EAAE,MAA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AAK,CAAC;QACzB,MAAM,WAAW,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACvH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,KAAK,GAAG,EAAE,CAAC;AACb,CAAC"}
|
package/dist/scaffolder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScaffoldOptions, ScaffoldResult, SupportedLanguage, UpdateOptions, UpdateResult, SyncOptions, SyncResult, VerifyGateOptions, VerifyGateResult } from './types.js';
|
|
1
|
+
import { ScaffoldOptions, ScaffoldResult, SupportedLanguage, UpdateOptions, UpdateResult, SyncOptions, SyncResult, VerifyGateOptions, VerifyGateResult, DeleteOptions, DeleteResult } from './types.js';
|
|
2
2
|
export declare function resolveTemplatesDir(baseDir?: string, lang?: SupportedLanguage): string;
|
|
3
3
|
export declare function scaffold(options: ScaffoldOptions): ScaffoldResult;
|
|
4
4
|
export declare function parseSemver(v: string): [number, number, number];
|
|
@@ -9,4 +9,5 @@ export declare function updateFramework(options?: UpdateOptions): UpdateResult;
|
|
|
9
9
|
export declare function syncIdeConfigs(options?: SyncOptions): SyncResult;
|
|
10
10
|
export declare function parseAllowedFiles(taskContent: string): string[];
|
|
11
11
|
export declare function verifyGate(options: VerifyGateOptions): VerifyGateResult;
|
|
12
|
+
export declare function deleteFramework(options?: DeleteOptions): DeleteResult;
|
|
12
13
|
//# sourceMappingURL=scaffolder.d.ts.map
|
package/dist/scaffolder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffolder.d.ts","sourceRoot":"","sources":["../src/scaffolder.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,eAAe,EACf,cAAc,EAEd,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"scaffolder.d.ts","sourceRoot":"","sources":["../src/scaffolder.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,eAAe,EACf,cAAc,EAEd,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAoD,EAC7D,IAAI,GAAE,iBAAwB,GAC7B,MAAM,CAMR;AA6UD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAiFjE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAI/D;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAOzG;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAepE;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,aAAkB,GAAG,YAAY,CA4IzE;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,CAoFpE;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAa/D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyJvE;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,aAAkB,GAAG,YAAY,CA6KzE"}
|
package/dist/scaffolder.js
CHANGED
|
@@ -31,33 +31,49 @@ function printConfiguration(displayTarget, force, lang) {
|
|
|
31
31
|
console.log(` ${colors.dim('Template Language:')} ${colors.yellow(colors.bold('English (en)'))}`);
|
|
32
32
|
console.log();
|
|
33
33
|
}
|
|
34
|
-
function ensureDirectory(dirPath, dirs) {
|
|
35
|
-
if (!fs.existsSync(dirPath)) {
|
|
34
|
+
function ensureDirectory(dirPath, dirs, dryRun = false) {
|
|
35
|
+
if (!dryRun && !fs.existsSync(dirPath)) {
|
|
36
36
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
37
37
|
}
|
|
38
38
|
dirs.add(dirPath);
|
|
39
39
|
}
|
|
40
|
-
function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang, targetVersion) {
|
|
40
|
+
function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang, targetVersion, isUpdate = false, dryRun = false) {
|
|
41
41
|
const srcPath = path.join(templatesDir, item.path);
|
|
42
42
|
const destPath = path.join(resolvedTarget, item.path);
|
|
43
43
|
const destDir = path.dirname(destPath);
|
|
44
|
-
ensureDirectory(destDir, stats.dirs);
|
|
44
|
+
ensureDirectory(destDir, stats.dirs, dryRun);
|
|
45
45
|
if (!fs.existsSync(srcPath)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const displayRelPath = item.path.replace(/\/\.gitkeep$/, '');
|
|
49
49
|
const desc = item.desc ? ` ${colors.comment(`— ${item.desc}`)}` : '';
|
|
50
|
-
|
|
50
|
+
// 1. Destination does not exist: New file (CREATED / ADDED)
|
|
51
|
+
if (!fs.existsSync(destPath)) {
|
|
52
|
+
if (!dryRun) {
|
|
53
|
+
fs.copyFileSync(srcPath, destPath);
|
|
54
|
+
}
|
|
55
|
+
console.log(` ${colors.badgeCreated()} ${colors.fg(colors.bold(displayRelPath))}${desc}`);
|
|
56
|
+
stats.created++;
|
|
57
|
+
if (stats.addedFiles)
|
|
58
|
+
stats.addedFiles.push(item.path);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// 2. Destination exists and force is false (initial scaffold without force)
|
|
62
|
+
if (!force) {
|
|
51
63
|
console.log(` ${colors.badgeSkipped()} ${colors.dim(displayRelPath)}${desc}`);
|
|
52
64
|
stats.skipped++;
|
|
65
|
+
if (stats.unchangedFiles)
|
|
66
|
+
stats.unchangedFiles.push(item.path);
|
|
53
67
|
return;
|
|
54
68
|
}
|
|
69
|
+
// 3. Special handling: instruction-version.json
|
|
55
70
|
if (item.path === 'instruction-version.json') {
|
|
56
71
|
try {
|
|
57
72
|
const raw = fs.readFileSync(srcPath, 'utf8');
|
|
58
73
|
const parsed = JSON.parse(raw);
|
|
59
74
|
const pkgInfo = getPackageInfo();
|
|
60
75
|
parsed.version = targetVersion ?? pkgInfo.version;
|
|
76
|
+
parsed.frameworkVersion = targetVersion ?? pkgInfo.version;
|
|
61
77
|
parsed.language = lang;
|
|
62
78
|
const now = new Date().toISOString();
|
|
63
79
|
if (fs.existsSync(destPath)) {
|
|
@@ -66,6 +82,22 @@ function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang,
|
|
|
66
82
|
if (oldDest.installedAt) {
|
|
67
83
|
parsed.installedAt = oldDest.installedAt;
|
|
68
84
|
}
|
|
85
|
+
if (isUpdate &&
|
|
86
|
+
oldDest.version === parsed.version &&
|
|
87
|
+
oldDest.frameworkVersion === parsed.frameworkVersion &&
|
|
88
|
+
oldDest.language === parsed.language) {
|
|
89
|
+
parsed.updatedAt = oldDest.updatedAt || now;
|
|
90
|
+
const newContent = JSON.stringify(parsed, null, 2) + '\n';
|
|
91
|
+
const oldContent = fs.readFileSync(destPath, 'utf8');
|
|
92
|
+
if (newContent.trim() === oldContent.trim()) {
|
|
93
|
+
stats.unchanged = (stats.unchanged || 0) + 1;
|
|
94
|
+
if (stats.unchangedFiles)
|
|
95
|
+
stats.unchangedFiles.push(item.path);
|
|
96
|
+
const badge = colors.badgeUnchanged ? colors.badgeUnchanged() : colors.badgeSkipped();
|
|
97
|
+
console.log(` ${badge} ${colors.dim(displayRelPath)}${desc}`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
69
101
|
}
|
|
70
102
|
catch {
|
|
71
103
|
// ignore error reading old file
|
|
@@ -75,16 +107,28 @@ function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang,
|
|
|
75
107
|
parsed.installedAt = now;
|
|
76
108
|
}
|
|
77
109
|
parsed.updatedAt = now;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
110
|
+
if (!dryRun) {
|
|
111
|
+
fs.writeFileSync(destPath, JSON.stringify(parsed, null, 2) + '\n', 'utf8');
|
|
112
|
+
}
|
|
113
|
+
if (isUpdate) {
|
|
114
|
+
stats.modified = (stats.modified || 0) + 1;
|
|
115
|
+
if (stats.updatedFiles)
|
|
116
|
+
stats.updatedFiles.push(item.path);
|
|
117
|
+
const badge = colors.badgeModified ? colors.badgeModified() : colors.badgeCreated();
|
|
118
|
+
console.log(` ${badge} ${colors.fg(colors.bold(displayRelPath))}${desc}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
stats.created++;
|
|
122
|
+
console.log(` ${colors.badgeCreated()} ${colors.fg(colors.bold(displayRelPath))}${desc}`);
|
|
123
|
+
}
|
|
81
124
|
return;
|
|
82
125
|
}
|
|
83
126
|
catch {
|
|
84
127
|
// fallback to regular copy if anything fails
|
|
85
128
|
}
|
|
86
129
|
}
|
|
87
|
-
|
|
130
|
+
// 4. Special handling: AGENTS.md
|
|
131
|
+
if (item.path === 'AGENTS.md') {
|
|
88
132
|
try {
|
|
89
133
|
const existingContent = fs.readFileSync(destPath, 'utf8');
|
|
90
134
|
const validationRegex = /<validation_commands>([\s\S]*?)<\/validation_commands>/;
|
|
@@ -92,9 +136,31 @@ function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang,
|
|
|
92
136
|
if (match && match[1]) {
|
|
93
137
|
let newContent = fs.readFileSync(srcPath, 'utf8');
|
|
94
138
|
newContent = newContent.replace(validationRegex, `<validation_commands>${match[1]}</validation_commands>`);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
139
|
+
// Check if content is actually different
|
|
140
|
+
if (existingContent === newContent) {
|
|
141
|
+
if (isUpdate) {
|
|
142
|
+
stats.unchanged = (stats.unchanged || 0) + 1;
|
|
143
|
+
if (stats.unchangedFiles)
|
|
144
|
+
stats.unchangedFiles.push(item.path);
|
|
145
|
+
const badge = colors.badgeUnchanged ? colors.badgeUnchanged() : colors.badgeSkipped();
|
|
146
|
+
console.log(` ${badge} ${colors.dim(displayRelPath)}${desc} ${colors.cyan('(preserved <validation_commands>)')}`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!dryRun) {
|
|
151
|
+
fs.writeFileSync(destPath, newContent, 'utf8');
|
|
152
|
+
}
|
|
153
|
+
if (isUpdate) {
|
|
154
|
+
stats.modified = (stats.modified || 0) + 1;
|
|
155
|
+
if (stats.updatedFiles)
|
|
156
|
+
stats.updatedFiles.push(item.path);
|
|
157
|
+
const badge = colors.badgeModified ? colors.badgeModified() : colors.badgeCreated();
|
|
158
|
+
console.log(` ${badge} ${colors.fg(colors.bold(displayRelPath))}${desc} ${colors.cyan('(preserved <validation_commands>)')}`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
stats.created++;
|
|
162
|
+
console.log(` ${colors.badgeCreated()} ${colors.fg(colors.bold(displayRelPath))}${desc} ${colors.cyan('(preserved <validation_commands>)')}`);
|
|
163
|
+
}
|
|
98
164
|
return;
|
|
99
165
|
}
|
|
100
166
|
}
|
|
@@ -102,20 +168,71 @@ function processFileItem(item, templatesDir, resolvedTarget, force, stats, lang,
|
|
|
102
168
|
// fallback to regular copy if anything fails
|
|
103
169
|
}
|
|
104
170
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
171
|
+
// 5. General template files: Content Comparison
|
|
172
|
+
try {
|
|
173
|
+
const srcBuf = fs.readFileSync(srcPath);
|
|
174
|
+
const destBuf = fs.readFileSync(destPath);
|
|
175
|
+
if (srcBuf.equals(destBuf)) {
|
|
176
|
+
// Content is identical
|
|
177
|
+
if (isUpdate) {
|
|
178
|
+
stats.unchanged = (stats.unchanged || 0) + 1;
|
|
179
|
+
if (stats.unchangedFiles)
|
|
180
|
+
stats.unchangedFiles.push(item.path);
|
|
181
|
+
const badge = colors.badgeUnchanged ? colors.badgeUnchanged() : colors.badgeSkipped();
|
|
182
|
+
console.log(` ${badge} ${colors.dim(displayRelPath)}${desc}`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// If reading fails, proceed to copy
|
|
189
|
+
}
|
|
190
|
+
// File is modified or initial forced scaffold
|
|
191
|
+
if (!dryRun) {
|
|
192
|
+
fs.copyFileSync(srcPath, destPath);
|
|
193
|
+
}
|
|
194
|
+
if (isUpdate) {
|
|
195
|
+
stats.modified = (stats.modified || 0) + 1;
|
|
196
|
+
if (stats.updatedFiles)
|
|
197
|
+
stats.updatedFiles.push(item.path);
|
|
198
|
+
const badge = colors.badgeModified ? colors.badgeModified() : colors.badgeCreated();
|
|
199
|
+
console.log(` ${badge} ${colors.fg(colors.bold(displayRelPath))}${desc}`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
stats.created++;
|
|
203
|
+
console.log(` ${colors.badgeCreated()} ${colors.fg(colors.bold(displayRelPath))}${desc}`);
|
|
204
|
+
}
|
|
108
205
|
}
|
|
109
|
-
function processFileGroups(groups, templatesDir, resolvedTarget, force, stats, lang, targetVersion) {
|
|
206
|
+
function processFileGroups(groups, templatesDir, resolvedTarget, force, stats, lang, targetVersion, isUpdate = false, dryRun = false) {
|
|
110
207
|
for (const group of groups) {
|
|
111
208
|
console.log(` ${colors.teal(colors.bold(group.title))}`);
|
|
112
209
|
for (const item of group.files) {
|
|
113
|
-
processFileItem(item, templatesDir, resolvedTarget, force, stats, lang, targetVersion);
|
|
210
|
+
processFileItem(item, templatesDir, resolvedTarget, force, stats, lang, targetVersion, isUpdate, dryRun);
|
|
114
211
|
}
|
|
115
212
|
console.log();
|
|
116
213
|
}
|
|
117
214
|
}
|
|
118
|
-
function printSummary(stats, lang) {
|
|
215
|
+
function printSummary(stats, lang, isUpdate = false) {
|
|
216
|
+
if (isUpdate) {
|
|
217
|
+
if (lang === 'vi') {
|
|
218
|
+
const summaryLines = [
|
|
219
|
+
` ${colors.dim('Tệp đã cập nhật :')} ${colors.cyan(colors.bold(String(stats.modified ?? 0)))}`,
|
|
220
|
+
` ${colors.dim('Tệp giữ nguyên :')} ${colors.dim(String(stats.unchanged ?? 0))}`,
|
|
221
|
+
` ${colors.dim('Tệp tạo mới :')} ${colors.green(colors.bold(String(stats.created)))}`,
|
|
222
|
+
];
|
|
223
|
+
console.log(renderBox(summaryLines, colors, { title: colors.teal(colors.bold('TỔNG KẾT CẬP NHẬT')) }));
|
|
224
|
+
console.log();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const summaryLines = [
|
|
228
|
+
` ${colors.dim('Files Updated :')} ${colors.cyan(colors.bold(String(stats.modified ?? 0)))}`,
|
|
229
|
+
` ${colors.dim('Files Unchanged :')} ${colors.dim(String(stats.unchanged ?? 0))}`,
|
|
230
|
+
` ${colors.dim('Files Added :')} ${colors.green(colors.bold(String(stats.created)))}`,
|
|
231
|
+
];
|
|
232
|
+
console.log(renderBox(summaryLines, colors, { title: colors.teal(colors.bold('UPDATE SUMMARY')) }));
|
|
233
|
+
console.log();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
119
236
|
if (lang === 'vi') {
|
|
120
237
|
const summaryLines = [
|
|
121
238
|
` ${colors.dim('Tệp đã tạo :')} ${colors.green(colors.bold(String(stats.created)))}`,
|
|
@@ -196,23 +313,41 @@ export function scaffold(options) {
|
|
|
196
313
|
}
|
|
197
314
|
const displayTarget = targetDir === '.' ? cwd : resolvedTarget;
|
|
198
315
|
printConfiguration(displayTarget, force, lang);
|
|
199
|
-
const initTitle =
|
|
316
|
+
const initTitle = options.isUpdate
|
|
317
|
+
? (lang === 'vi' ? ' ĐANG ĐỒNG BỘ CẬP NHẬT QUY CHUẨN' : ' SYNCING FRAMEWORK UPDATES')
|
|
318
|
+
: (lang === 'vi' ? ' ĐANG KHỞI TẠO KHÔNG GIAN LÀM VIỆC' : ' INITIALIZING WORKSPACE');
|
|
200
319
|
console.log(colors.purple(colors.bold(initTitle)));
|
|
201
320
|
console.log();
|
|
202
321
|
const fileGroups = getFileGroups(lang);
|
|
203
|
-
const stats = {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
322
|
+
const stats = {
|
|
323
|
+
created: 0,
|
|
324
|
+
skipped: 0,
|
|
325
|
+
dirs: new Set(),
|
|
326
|
+
modified: 0,
|
|
327
|
+
unchanged: 0,
|
|
328
|
+
updatedFiles: [],
|
|
329
|
+
unchangedFiles: [],
|
|
330
|
+
addedFiles: [],
|
|
331
|
+
};
|
|
332
|
+
processFileGroups(fileGroups, templatesDir, resolvedTarget, force, stats, lang, options.targetVersion, options.isUpdate ?? false, options.dryRun ?? false);
|
|
333
|
+
printSummary(stats, lang, options.isUpdate ?? false);
|
|
334
|
+
if (!options.isUpdate) {
|
|
335
|
+
printNextSteps(targetDir, lang);
|
|
336
|
+
}
|
|
207
337
|
return {
|
|
208
338
|
success: true,
|
|
209
339
|
stats: {
|
|
210
340
|
created: stats.created,
|
|
211
341
|
skipped: stats.skipped,
|
|
212
342
|
directories: stats.dirs.size,
|
|
343
|
+
modified: stats.modified,
|
|
344
|
+
unchanged: stats.unchanged,
|
|
213
345
|
},
|
|
214
346
|
targetPath: resolvedTarget,
|
|
215
347
|
lang,
|
|
348
|
+
filesUpdated: stats.updatedFiles,
|
|
349
|
+
filesUnchanged: stats.unchangedFiles,
|
|
350
|
+
filesAdded: stats.addedFiles,
|
|
216
351
|
};
|
|
217
352
|
}
|
|
218
353
|
export function parseSemver(v) {
|
|
@@ -335,22 +470,28 @@ export function updateFramework(options = {}) {
|
|
|
335
470
|
cwd,
|
|
336
471
|
skipBanner: true,
|
|
337
472
|
targetVersion: latestVersion,
|
|
473
|
+
isUpdate: true,
|
|
474
|
+
dryRun: options.dryRun,
|
|
338
475
|
});
|
|
339
476
|
if (scaffoldRes.success) {
|
|
340
477
|
const bumpLabel = bumpType !== 'none' ? ` [${bumpType.toUpperCase()}]` : '';
|
|
478
|
+
const prefix = options.dryRun ? '[DRY-RUN] ' : '';
|
|
341
479
|
const successMsg = targetLang === 'vi'
|
|
342
|
-
?
|
|
343
|
-
:
|
|
480
|
+
? `${prefix}Đã cập nhật thành công quy chuẩn chỉ dẫn từ v${currentVersion} lên v${latestVersion}${bumpLabel}. Đã bảo tồn AGENTS.md#validation_commands.`
|
|
481
|
+
: `${prefix}Successfully updated instruction framework from v${currentVersion} to v${latestVersion}${bumpLabel}. Preserved AGENTS.md#validation_commands.`;
|
|
344
482
|
console.log(`\n ${colors.green(colors.bold(successMsg))}\n`);
|
|
345
483
|
return {
|
|
346
484
|
success: true,
|
|
347
|
-
updated:
|
|
485
|
+
updated: !options.dryRun,
|
|
348
486
|
updateAvailable: false,
|
|
349
487
|
bumpType,
|
|
350
488
|
currentVersion,
|
|
351
489
|
latestVersion,
|
|
352
490
|
message: successMsg,
|
|
353
491
|
preservedFiles: ['AGENTS.md#validation_commands'],
|
|
492
|
+
filesUpdated: scaffoldRes.filesUpdated ?? [],
|
|
493
|
+
filesUnchanged: scaffoldRes.filesUnchanged ?? [],
|
|
494
|
+
filesAdded: scaffoldRes.filesAdded ?? [],
|
|
354
495
|
};
|
|
355
496
|
}
|
|
356
497
|
return {
|
|
@@ -361,6 +502,9 @@ export function updateFramework(options = {}) {
|
|
|
361
502
|
currentVersion,
|
|
362
503
|
latestVersion,
|
|
363
504
|
message: 'Scaffold update failed',
|
|
505
|
+
filesUpdated: [],
|
|
506
|
+
filesUnchanged: [],
|
|
507
|
+
filesAdded: [],
|
|
364
508
|
};
|
|
365
509
|
}
|
|
366
510
|
const noChangeMsg = 'nothing changed';
|
|
@@ -373,6 +517,9 @@ export function updateFramework(options = {}) {
|
|
|
373
517
|
currentVersion,
|
|
374
518
|
latestVersion,
|
|
375
519
|
message: noChangeMsg,
|
|
520
|
+
filesUpdated: [],
|
|
521
|
+
filesUnchanged: [],
|
|
522
|
+
filesAdded: [],
|
|
376
523
|
};
|
|
377
524
|
}
|
|
378
525
|
export function syncIdeConfigs(options = {}) {
|
|
@@ -609,4 +756,162 @@ export function verifyGate(options) {
|
|
|
609
756
|
message: msg,
|
|
610
757
|
};
|
|
611
758
|
}
|
|
759
|
+
export function deleteFramework(options = {}) {
|
|
760
|
+
const { targetDir = '.', cwd = process.cwd(), force = false, dryRun = false, includeIde = false, } = options;
|
|
761
|
+
const resolvedTarget = path.resolve(cwd, targetDir);
|
|
762
|
+
const versionPath = path.join(resolvedTarget, 'instruction-version.json');
|
|
763
|
+
if (!fs.existsSync(versionPath)) {
|
|
764
|
+
const msg = `No instruction-version.json found at ${resolvedTarget}. Aborting deletion to prevent accidental data loss.`;
|
|
765
|
+
console.error(`\n ${colors.badgeError()} ${colors.red(msg)}\n`);
|
|
766
|
+
return {
|
|
767
|
+
success: false,
|
|
768
|
+
targetPath: resolvedTarget,
|
|
769
|
+
deletedFiles: [],
|
|
770
|
+
deletedDirs: [],
|
|
771
|
+
message: msg,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
// Active task guard: prevent deleting if active tasks are in progress unless forced
|
|
775
|
+
if (!force) {
|
|
776
|
+
const activeFeaturesDir = path.join(resolvedTarget, 'process', 'features', 'active');
|
|
777
|
+
const activePlansDir = path.join(resolvedTarget, 'process', 'general-plans', 'active');
|
|
778
|
+
let hasActiveTasks = false;
|
|
779
|
+
try {
|
|
780
|
+
if (fs.existsSync(activeFeaturesDir)) {
|
|
781
|
+
const entries = fs.readdirSync(activeFeaturesDir).filter((e) => e !== '.gitkeep');
|
|
782
|
+
if (entries.length > 0)
|
|
783
|
+
hasActiveTasks = true;
|
|
784
|
+
}
|
|
785
|
+
if (fs.existsSync(activePlansDir)) {
|
|
786
|
+
const entries = fs.readdirSync(activePlansDir).filter((e) => e !== '.gitkeep');
|
|
787
|
+
if (entries.length > 0)
|
|
788
|
+
hasActiveTasks = true;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
catch {
|
|
792
|
+
// ignore read error
|
|
793
|
+
}
|
|
794
|
+
if (hasActiveTasks) {
|
|
795
|
+
const msg = `Active tasks detected in ${resolvedTarget}/process. Archive or complete tasks, or pass --force (-f) to delete anyway.`;
|
|
796
|
+
console.warn(`\n ${colors.badgeError()} ${colors.yellow(msg)}\n`);
|
|
797
|
+
return {
|
|
798
|
+
success: false,
|
|
799
|
+
targetPath: resolvedTarget,
|
|
800
|
+
deletedFiles: [],
|
|
801
|
+
deletedDirs: [],
|
|
802
|
+
message: msg,
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
const deletedFiles = [];
|
|
807
|
+
const deletedDirs = [];
|
|
808
|
+
const title = dryRun
|
|
809
|
+
? ' PREVIEWING FRAMEWORK DELETION (DRY-RUN)'
|
|
810
|
+
: ' REMOVING INSTRUCTION FRAMEWORK';
|
|
811
|
+
console.log(colors.red(colors.bold(title)));
|
|
812
|
+
console.log();
|
|
813
|
+
// 1. Framework files to delete
|
|
814
|
+
const targetFiles = ['instruction-version.json', 'AGENTS.md'];
|
|
815
|
+
if (includeIde) {
|
|
816
|
+
targetFiles.push('CLAUDE.md', '.windsurfrules', path.join('.cursor', 'rules', 'agent-instructions.mdc'));
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
// Check if IDE files were generated by framework
|
|
820
|
+
const claudePath = path.join(resolvedTarget, 'CLAUDE.md');
|
|
821
|
+
if (fs.existsSync(claudePath)) {
|
|
822
|
+
try {
|
|
823
|
+
const content = fs.readFileSync(claudePath, 'utf8');
|
|
824
|
+
if (content.includes('AGENTS.md') || content.includes('RIPER-5')) {
|
|
825
|
+
targetFiles.push('CLAUDE.md');
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
catch {
|
|
829
|
+
// ignore
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
const windsurfPath = path.join(resolvedTarget, '.windsurfrules');
|
|
833
|
+
if (fs.existsSync(windsurfPath)) {
|
|
834
|
+
try {
|
|
835
|
+
const content = fs.readFileSync(windsurfPath, 'utf8');
|
|
836
|
+
if (content.includes('AGENTS.md')) {
|
|
837
|
+
targetFiles.push('.windsurfrules');
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
catch {
|
|
841
|
+
// ignore
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
const cursorMdcPath = path.join(resolvedTarget, '.cursor', 'rules', 'agent-instructions.mdc');
|
|
845
|
+
if (fs.existsSync(cursorMdcPath)) {
|
|
846
|
+
targetFiles.push(path.join('.cursor', 'rules', 'agent-instructions.mdc'));
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const badge = colors.badgeDeleted ? colors.badgeDeleted() : colors.badgeError();
|
|
850
|
+
for (const relFile of targetFiles) {
|
|
851
|
+
const fullPath = path.join(resolvedTarget, relFile);
|
|
852
|
+
if (fs.existsSync(fullPath)) {
|
|
853
|
+
if (!dryRun) {
|
|
854
|
+
try {
|
|
855
|
+
fs.unlinkSync(fullPath);
|
|
856
|
+
}
|
|
857
|
+
catch {
|
|
858
|
+
// ignore error unlinking
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
deletedFiles.push(relFile);
|
|
862
|
+
console.log(` ${badge} ${colors.fg(colors.bold(relFile))}`);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
// 2. Framework directories to delete
|
|
866
|
+
const targetDirs = ['.agents', 'process'];
|
|
867
|
+
for (const relDir of targetDirs) {
|
|
868
|
+
const fullDir = path.join(resolvedTarget, relDir);
|
|
869
|
+
if (fs.existsSync(fullDir)) {
|
|
870
|
+
if (!dryRun) {
|
|
871
|
+
try {
|
|
872
|
+
fs.rmSync(fullDir, { recursive: true, force: true });
|
|
873
|
+
}
|
|
874
|
+
catch {
|
|
875
|
+
// ignore
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
deletedDirs.push(relDir);
|
|
879
|
+
console.log(` ${badge} ${colors.fg(colors.bold(relDir + '/'))}`);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
// 3. Clean empty .cursor/rules directory if empty
|
|
883
|
+
if (!dryRun) {
|
|
884
|
+
try {
|
|
885
|
+
const cursorRulesDir = path.join(resolvedTarget, '.cursor', 'rules');
|
|
886
|
+
if (fs.existsSync(cursorRulesDir) && fs.readdirSync(cursorRulesDir).length === 0) {
|
|
887
|
+
fs.rmdirSync(cursorRulesDir);
|
|
888
|
+
const cursorDir = path.join(resolvedTarget, '.cursor');
|
|
889
|
+
if (fs.existsSync(cursorDir) && fs.readdirSync(cursorDir).length === 0) {
|
|
890
|
+
fs.rmdirSync(cursorDir);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
catch {
|
|
895
|
+
// ignore
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
console.log();
|
|
899
|
+
const summaryLines = [
|
|
900
|
+
` ${colors.dim('Files Removed :')} ${colors.red(colors.bold(String(deletedFiles.length)))}`,
|
|
901
|
+
` ${colors.dim('Directories Removed:')} ${colors.red(colors.bold(String(deletedDirs.length)))}`,
|
|
902
|
+
];
|
|
903
|
+
console.log(renderBox(summaryLines, colors, { title: colors.red(colors.bold(dryRun ? 'DRY-RUN DELETION' : 'DELETION SUMMARY')) }));
|
|
904
|
+
console.log();
|
|
905
|
+
const successMsg = dryRun
|
|
906
|
+
? `Dry-run: ${deletedFiles.length} file(s) and ${deletedDirs.length} directory(ies) would be removed from ${resolvedTarget}.`
|
|
907
|
+
: `Successfully removed instruction framework (${deletedFiles.length} file(s), ${deletedDirs.length} directory(ies)) from ${resolvedTarget}.`;
|
|
908
|
+
console.log(` ${colors.green(colors.bold(successMsg))}\n`);
|
|
909
|
+
return {
|
|
910
|
+
success: true,
|
|
911
|
+
targetPath: resolvedTarget,
|
|
912
|
+
deletedFiles,
|
|
913
|
+
deletedDirs,
|
|
914
|
+
message: successMsg,
|
|
915
|
+
};
|
|
916
|
+
}
|
|
612
917
|
//# sourceMappingURL=scaffolder.js.map
|