agent-eng 0.12.0 → 0.13.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/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -7,7 +7,6 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
7
7
|
const TEMPLATES = join(__dirname, "templates");
|
|
8
8
|
|
|
9
9
|
const STRUCTURE = [
|
|
10
|
-
".github/workflows/notify-site.yml",
|
|
11
10
|
".claude/settings.json",
|
|
12
11
|
".claude/scripts/update-status.sh",
|
|
13
12
|
".claude/agents/architect.md",
|
|
@@ -38,66 +37,118 @@ function prompt(question) {
|
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
|
|
40
|
+
function applyFile(src, dest, action) {
|
|
41
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
42
|
+
if (action === "append") {
|
|
43
|
+
const content = readFileSync(src, "utf8");
|
|
44
|
+
appendFileSync(dest, "\n\n" + content);
|
|
45
|
+
} else {
|
|
46
|
+
cpSync(src, dest);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
export async function init(options) {
|
|
42
51
|
const target = resolve(options.dir);
|
|
43
52
|
const created = [];
|
|
44
53
|
const skipped = [];
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
const allFiles = [
|
|
56
|
+
...STRUCTURE,
|
|
57
|
+
"CLAUDE.md",
|
|
58
|
+
...options.conventions.map((c) => `conventions/${c}.md`),
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const existing = [];
|
|
62
|
+
const fresh = [];
|
|
49
63
|
|
|
64
|
+
for (const file of allFiles) {
|
|
65
|
+
const dest = join(target, file);
|
|
50
66
|
if (existsSync(dest) && !options.force) {
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
existing.push(file);
|
|
68
|
+
} else {
|
|
69
|
+
fresh.push(file);
|
|
53
70
|
}
|
|
71
|
+
}
|
|
54
72
|
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
for (const file of fresh) {
|
|
74
|
+
const src = join(TEMPLATES, file);
|
|
75
|
+
const dest = join(target, file);
|
|
76
|
+
applyFile(src, dest, "replace");
|
|
57
77
|
created.push(file);
|
|
58
78
|
}
|
|
59
79
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
cpSync(claudeSrc, claudeDest);
|
|
67
|
-
created.push("CLAUDE.md");
|
|
68
|
-
} else {
|
|
80
|
+
if (existing.length > 0 && !options.force) {
|
|
81
|
+
console.log("");
|
|
82
|
+
console.log(`${existing.length} file(s) already exist:`);
|
|
83
|
+
for (const f of existing) {
|
|
84
|
+
console.log(` ${f}`);
|
|
85
|
+
}
|
|
69
86
|
console.log("");
|
|
70
|
-
console.log("
|
|
71
|
-
console.log("
|
|
72
|
-
console.log("
|
|
73
|
-
console.log("
|
|
74
|
-
|
|
87
|
+
console.log(" 1) Skip all — keep existing files (default)");
|
|
88
|
+
console.log(" 2) Append all — add agent-eng content to the end of each");
|
|
89
|
+
console.log(" 3) Replace all — overwrite all with agent-eng templates");
|
|
90
|
+
console.log(" 4) Decide per file — choose for each file individually");
|
|
91
|
+
console.log(" 5) Pick files — specify which files to append/replace");
|
|
92
|
+
const answer = await prompt("Choose [1/2/3/4/5] (default: 1): ");
|
|
75
93
|
|
|
76
94
|
if (answer === "2" || answer === "append") {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
for (const file of existing) {
|
|
96
|
+
applyFile(join(TEMPLATES, file), join(target, file), "append");
|
|
97
|
+
created.push(`${file} (appended)`);
|
|
98
|
+
}
|
|
80
99
|
} else if (answer === "3" || answer === "replace") {
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
for (const file of existing) {
|
|
101
|
+
applyFile(join(TEMPLATES, file), join(target, file), "replace");
|
|
102
|
+
created.push(`${file} (replaced)`);
|
|
103
|
+
}
|
|
104
|
+
} else if (answer === "4") {
|
|
105
|
+
for (const file of existing) {
|
|
106
|
+
console.log("");
|
|
107
|
+
console.log(` ${file}:`);
|
|
108
|
+
console.log(" 1) Skip 2) Append 3) Replace");
|
|
109
|
+
const choice = await prompt(" Choose [1/2/3] (default: 1): ");
|
|
110
|
+
if (choice === "2" || choice === "append") {
|
|
111
|
+
applyFile(join(TEMPLATES, file), join(target, file), "append");
|
|
112
|
+
created.push(`${file} (appended)`);
|
|
113
|
+
} else if (choice === "3" || choice === "replace") {
|
|
114
|
+
applyFile(join(TEMPLATES, file), join(target, file), "replace");
|
|
115
|
+
created.push(`${file} (replaced)`);
|
|
116
|
+
} else {
|
|
117
|
+
skipped.push(file);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} else if (answer === "5") {
|
|
121
|
+
console.log("");
|
|
122
|
+
console.log("Enter file numbers to append/replace (comma-separated):");
|
|
123
|
+
for (let i = 0; i < existing.length; i++) {
|
|
124
|
+
console.log(` ${i + 1}) ${existing[i]}`);
|
|
125
|
+
}
|
|
126
|
+
const picks = await prompt("Files to modify (e.g. 1,3): ");
|
|
127
|
+
const indices = picks
|
|
128
|
+
.split(",")
|
|
129
|
+
.map((s) => parseInt(s.trim(), 10) - 1)
|
|
130
|
+
.filter((i) => i >= 0 && i < existing.length);
|
|
131
|
+
|
|
132
|
+
const picked = new Set(indices);
|
|
133
|
+
for (let i = 0; i < existing.length; i++) {
|
|
134
|
+
if (!picked.has(i)) {
|
|
135
|
+
skipped.push(existing[i]);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const file = existing[i];
|
|
139
|
+
console.log(` ${file}: 1) Append 2) Replace`);
|
|
140
|
+
const action = await prompt(" Choose [1/2] (default: 1): ");
|
|
141
|
+
if (action === "2" || action === "replace") {
|
|
142
|
+
applyFile(join(TEMPLATES, file), join(target, file), "replace");
|
|
143
|
+
created.push(`${file} (replaced)`);
|
|
144
|
+
} else {
|
|
145
|
+
applyFile(join(TEMPLATES, file), join(target, file), "append");
|
|
146
|
+
created.push(`${file} (appended)`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
83
149
|
} else {
|
|
84
|
-
skipped.push(
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
for (const convention of options.conventions) {
|
|
89
|
-
const file = `conventions/${convention}.md`;
|
|
90
|
-
const dest = join(target, file);
|
|
91
|
-
const src = join(TEMPLATES, file);
|
|
92
|
-
|
|
93
|
-
if (existsSync(dest) && !options.force) {
|
|
94
|
-
skipped.push(file);
|
|
95
|
-
continue;
|
|
150
|
+
skipped.push(...existing);
|
|
96
151
|
}
|
|
97
|
-
|
|
98
|
-
mkdirSync(dirname(dest), { recursive: true });
|
|
99
|
-
cpSync(src, dest);
|
|
100
|
-
created.push(file);
|
|
101
152
|
}
|
|
102
153
|
|
|
103
154
|
console.log("");
|
|
@@ -113,7 +164,7 @@ export async function init(options) {
|
|
|
113
164
|
|
|
114
165
|
if (skipped.length > 0) {
|
|
115
166
|
console.log("");
|
|
116
|
-
console.log("Skipped (already exist
|
|
167
|
+
console.log("Skipped (already exist):");
|
|
117
168
|
for (const f of skipped) {
|
|
118
169
|
console.log(` ${f}`);
|
|
119
170
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Notify Site of Content Update
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
paths:
|
|
8
|
-
- 'orchestration.yaml'
|
|
9
|
-
- 'architecture.yaml'
|
|
10
|
-
- 'README.md'
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
notify:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- name: Trigger site rebuild
|
|
17
|
-
uses: peter-evans/repository-dispatch@v3
|
|
18
|
-
with:
|
|
19
|
-
token: ${{ secrets.SITE_REBUILD_TOKEN }}
|
|
20
|
-
repository: swarpi/swarpi.github.io
|
|
21
|
-
event-type: showcase-updated
|