@devobsessed/code-captain 0.0.4 → 0.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.
Files changed (2) hide show
  1. package/bin/install.js +44 -9
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -15,11 +15,16 @@ const __dirname = dirname(__filename);
15
15
 
16
16
  class CodeCaptainInstaller {
17
17
  constructor() {
18
+ // Determine if we're running from npm package or development
19
+ const packageRoot = path.resolve(__dirname, '..');
20
+ const isNpmPackage = fs.existsSync(path.join(packageRoot, 'package.json'));
21
+
18
22
  this.config = {
19
23
  repoUrl: 'https://github.com/devobsessed/code-captain',
20
24
  baseUrl: 'https://raw.githubusercontent.com/devobsessed/code-captain/main',
21
25
  version: 'main',
22
- localSource: process.env.CC_LOCAL_SOURCE || null,
26
+ // Default to local source when running from npm package
27
+ localSource: process.env.CC_LOCAL_SOURCE || (isNpmPackage ? packageRoot : null),
23
28
  versionFile: '.code-captain/.version',
24
29
  manifestFile: '.code-captain/.manifest.json'
25
30
  };
@@ -49,11 +54,14 @@ class CodeCaptainInstaller {
49
54
  }
50
55
 
51
56
  // Display welcome banner
52
- showWelcome() {
57
+ async showWelcome() {
58
+ const version = await this.getPackageVersion();
53
59
  const banner = boxen(
54
- chalk.bold.green('Code Captain 2.0') + '\n' +
55
- chalk.gray('Unified AI Development Agent System') + '\n\n' +
56
- chalk.blue('🚀 Interactive Installation Wizard'),
60
+ chalk.bold.green(`Code Captain ${version}`) + '\n' +
61
+ chalk.gray('AI Development Agent System') + '\n' +
62
+ chalk.dim('brought to you by DevObsessed') + '\n' +
63
+ chalk.dim.blue('https://www.devobsessed.com/') + '\n\n' +
64
+ chalk.blue('⚓ Interactive Installation Wizard'),
57
65
  {
58
66
  padding: 1,
59
67
  margin: 1,
@@ -128,7 +136,23 @@ class CodeCaptainInstaller {
128
136
  return [...new Set(installations)]; // Remove duplicates
129
137
  }
130
138
 
131
- // Calculate SHA256 hash of a local file
139
+ // Get the current package version
140
+ async getPackageVersion() {
141
+ try {
142
+ if (this.config.localSource) {
143
+ const packageJsonPath = path.join(this.config.localSource, 'package.json');
144
+ if (await fs.pathExists(packageJsonPath)) {
145
+ const packageJson = await fs.readJson(packageJsonPath);
146
+ return packageJson.version || 'unknown';
147
+ }
148
+ }
149
+ return 'unknown';
150
+ } catch (error) {
151
+ return 'unknown';
152
+ }
153
+ }
154
+
155
+ // Calculate SHA256 hash of a file
132
156
  async calculateFileHash(filePath) {
133
157
  try {
134
158
  const crypto = await import('crypto');
@@ -201,8 +225,15 @@ class CodeCaptainInstaller {
201
225
 
202
226
  if (!localManifest) {
203
227
  spinner.succeed('No previous manifest found - treating as fresh installation');
228
+
229
+ // Get proper version information for first install
230
+ const currentVersion = this.config.localSource ? await this.getPackageVersion() : 'unknown';
231
+ const availableVersion = remoteManifest.version;
232
+
204
233
  return {
205
234
  isFirstInstall: true,
235
+ localVersion: currentVersion,
236
+ remoteVersion: availableVersion,
206
237
  changes: [],
207
238
  newFiles: [],
208
239
  recommendations: ['Full installation recommended (no change tracking available)']
@@ -276,10 +307,14 @@ class CodeCaptainInstaller {
276
307
 
277
308
  spinner.succeed(`Found ${changes.length} updated files, ${newFiles.length} new files`);
278
309
 
310
+ // Get proper version information
311
+ const currentVersion = this.config.localSource ? await this.getPackageVersion() : 'unknown';
312
+ const availableVersion = remoteManifest.version;
313
+
279
314
  return {
280
315
  isFirstInstall: false,
281
- localVersion: localManifest.version,
282
- remoteVersion: remoteManifest.version,
316
+ localVersion: currentVersion,
317
+ remoteVersion: availableVersion,
283
318
  changes,
284
319
  newFiles,
285
320
  recommendations
@@ -1002,7 +1037,7 @@ class CodeCaptainInstaller {
1002
1037
  async run() {
1003
1038
  try {
1004
1039
  // Show welcome
1005
- this.showWelcome();
1040
+ await this.showWelcome();
1006
1041
 
1007
1042
  // Check compatibility
1008
1043
  const systemInfo = await this.checkCompatibility();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devobsessed/code-captain",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Unified AI Development Agent System with intelligent change detection",
5
5
  "type": "module",
6
6
  "bin": {