#!/usr/bin/env node const path = require('path'); class This { constructor() { this.version = '0.0.1'; // Default version, can be overridden in subclasses this.scriptName = path.parse(process.argv[1]).base; } getClassName() { return this.constructor.name; } listMethods() { const methods = Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter( (prop) => typeof this[prop] === 'function' && prop !== 'constructor' && !prop.startsWith('_') ); return methods; } listProperties() { const properties = Object.keys(this).filter((prop) => typeof this[prop] !== 'function'); return properties; } discovery() { console.log(`My name is '${this.getClassName()}' and I have the version: ${this.version}`); console.log(`My methods are:`, this.listMethods()); console.log(`My properties are:`, this.listProperties()); } // Method to create a context manager for this instance withContext(callback) { callback(this); } } module.exports = This;