thepopebot 1.2.7 → 1.2.8

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 CHANGED
@@ -137,6 +137,23 @@ function init() {
137
137
  console.log('\nInstalling dependencies...\n');
138
138
  execSync('npm install', { stdio: 'inherit', cwd });
139
139
 
140
+ // Update THEPOPEBOT_VERSION in .env if it exists
141
+ const envPath = path.join(cwd, '.env');
142
+ if (fs.existsSync(envPath)) {
143
+ try {
144
+ const thepopebotPkg = JSON.parse(fs.readFileSync(path.join(cwd, 'node_modules', 'thepopebot', 'package.json'), 'utf8'));
145
+ const version = thepopebotPkg.version;
146
+ let envContent = fs.readFileSync(envPath, 'utf8');
147
+ if (envContent.match(/^THEPOPEBOT_VERSION=.*/m)) {
148
+ envContent = envContent.replace(/^THEPOPEBOT_VERSION=.*/m, `THEPOPEBOT_VERSION=${version}`);
149
+ } else {
150
+ envContent = envContent.trimEnd() + `\nTHEPOPEBOT_VERSION=${version}\n`;
151
+ }
152
+ fs.writeFileSync(envPath, envContent);
153
+ console.log(` Updated THEPOPEBOT_VERSION to ${version}`);
154
+ } catch {}
155
+ }
156
+
140
157
  console.log('\nDone! Run: npm run setup\n');
141
158
  }
142
159
 
@@ -38,23 +38,6 @@ function walk(dir) {
38
38
  return files;
39
39
  }
40
40
 
41
- // Write THEPOPEBOT_VERSION to .env so docker-compose can pin the image tag
42
- const envPath = path.join(projectRoot, '.env');
43
- if (fs.existsSync(envPath)) {
44
- const ownPkgPath = path.join(__dirname, '..', 'package.json');
45
- try {
46
- const ownPkg = JSON.parse(fs.readFileSync(ownPkgPath, 'utf8'));
47
- const version = ownPkg.version;
48
- let envContent = fs.readFileSync(envPath, 'utf8');
49
- if (envContent.match(/^THEPOPEBOT_VERSION=.*/m)) {
50
- envContent = envContent.replace(/^THEPOPEBOT_VERSION=.*/m, `THEPOPEBOT_VERSION=${version}`);
51
- } else {
52
- envContent = envContent.trimEnd() + `\nTHEPOPEBOT_VERSION=${version}\n`;
53
- }
54
- fs.writeFileSync(envPath, envContent);
55
- } catch {}
56
- }
57
-
58
41
  const changed = [];
59
42
  for (const relPath of walk(templatesDir)) {
60
43
  const src = path.join(templatesDir, relPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thepopebot",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "type": "module",
5
5
  "description": "Create autonomous AI agents with a two-layer architecture: Next.js Event Handler + Docker Agent.",
6
6
  "bin": {
@@ -157,6 +157,9 @@ TELEGRAM_VERIFICATION=${telegramVerification || ''}
157
157
  GH_WEBHOOK_SECRET=${ghWebhookSecret}
158
158
 
159
159
  ${apiKeyLines}
160
+
161
+ # thepopebot version (used by docker-compose and run-job for image tags)
162
+ THEPOPEBOT_VERSION=${getThepopebotVersion()}
160
163
  `;
161
164
 
162
165
  const envPath = join(ROOT_DIR, '.env');
@@ -164,6 +167,16 @@ ${apiKeyLines}
164
167
  return envPath;
165
168
  }
166
169
 
170
+ function getThepopebotVersion() {
171
+ try {
172
+ const pkgPath = join(ROOT_DIR, 'node_modules', 'thepopebot', 'package.json');
173
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
174
+ return pkg.version;
175
+ } catch {
176
+ return 'latest';
177
+ }
178
+ }
179
+
167
180
  /**
168
181
  * Update a single variable in an existing .env file
169
182
  */