### Basic Express.js Server Setup (Node.js) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md This snippet demonstrates the fundamental setup of an Express.js server. It requires the 'express' module, creates an app instance, defines a simple route for the root URL ('/'), and starts the server listening on port 3000. This is a common starting point for building web applications with Express. ```javascript const express = require('express') const app = express() app.get('/', function (req, res) { res.send('Hello World') }) app.listen(3000) ``` -------------------------------- ### Running an Express.js Example (Node.js) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md This command executes a specific example script from the cloned Express.js repository. After cloning the repository and installing dependencies, you can run individual examples to understand specific features or functionalities of Express.js. ```bash $ node examples/content-negotiation ``` -------------------------------- ### Development Environment Setup (Bash) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/COMPREHENSIVE-SPEC.md Commands to clone the repository, install dependencies, set up development containers, initialize configuration, and verify integration health for the project. ```bash # Clone and setup repository git clone https://github.com/user/literally-integrated-humankind-3.0.git cd literally-integrated-humankind-3.0 # Install dependencies npm install # Setup development containers docker-compose up -d # Initialize configuration npm run setup:development # Verify integration health npm run health:check ``` -------------------------------- ### Docker Compose Deployment Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/QUICK-START.md This code snippet shows the commands to navigate to the Docker deployment directory and start the services using Docker Compose. It assumes Docker and Docker Compose are installed and configured on the system. The '-d' flag ensures services run in detached mode. ```bash cd deployment/docker docker-compose up -d ``` -------------------------------- ### Start Server-Side Services Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Starts the mobile trigger processor and the PWA web server. The mobile trigger processor is initiated using Node.js, while the PWA web server requires installation of dependencies and then starting the application. This section also notes optional configuration for WebSocket and push notification services. ```bash # Start mobile trigger processor service cd integration-services/ node mobile-trigger-processor.js # Start PWA web server cd mobile-interface/ npm install npm start ``` -------------------------------- ### Starting an Express Application (Node.js) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md This command starts the Express.js development server. It typically runs a script defined in the 'scripts' section of the 'package.json' file (usually 'start'). This command is used after installing dependencies to launch the web application and make it accessible via a browser. ```bash $ npm start ``` -------------------------------- ### Install side-channel-map package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-map/README.md NPM command to install the side-channel-map package. This is the initial setup step required before using the library in your project. ```shell npm install --save side-channel-map ``` -------------------------------- ### Install Mobile Trigger Processor Dependencies Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Installs necessary npm packages for the mobile trigger processor service. This includes chokidar for file watching, fs-extra for file system operations, express for the web server, and ws for WebSocket communication. Ensure you are in the 'integration-services' directory before running this command. ```bash cd integration-services/ npm install chokidar fs-extra express ws ``` -------------------------------- ### Verify Directory Structure and Test Basic Commands Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/QUICK-START.md This snippet demonstrates how to verify the complete directory structure and test fundamental unified commands. It uses standard shell commands for listing files and executing system-specific commands like '/analyze', '/mobile:test', and '/context:monitor'. No external dependencies are required beyond a standard Unix-like environment. ```bash # Verify all directory structure is in place ls -la .claude/ .taskmaster/ obsidian-vaults/ integration-services/ # Test basic unified commands /analyze implementation-status /mobile:test /context:monitor ``` -------------------------------- ### Usage Example for side-channel-weakmap Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-weakmap/README.md Demonstrates how to initialize and use the side-channel-weakmap. It covers setting, getting, asserting presence, and deleting key-value pairs. The example uses `assert` to verify the expected behavior of the channel operations. ```javascript const assert = require('assert'); const getSideChannelList = require('side-channel-weakmap'); const channel = getSideChannelList(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Creating a New Express Application (Console) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md This command uses the globally installed 'express-generator' to create a new Express application in a specified directory (e.g., '/tmp/foo'). After creation, it navigates into the new project directory. This is the first step after installing the generator to start a new project. ```bash $ express /tmp/foo && cd /tmp/foo ``` -------------------------------- ### Install Obsidian Plugins for Mobile Control Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Lists essential Obsidian plugins required for implementing the mobile remote control system. These plugins facilitate programmatic note creation, dynamic templating, interactive buttons, data queries, rapid content creation, and form elements. ```bash # Essential plugins for mobile control Advanced URI # Enable programmatic note creation and command execution Templater # Dynamic template processing with JavaScript Buttons # Interactive button creation and management Dataview # Dynamic content queries and status displays QuickAdd # Rapid content creation with automation Meta Bind # Interactive form elements and controls ``` -------------------------------- ### Install serve-static using npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/serve-static/README.md This command installs the serve-static module from the npm registry. It is a prerequisite for using the module in a Node.js project. ```sh npm install serve-static ``` -------------------------------- ### Install get-proto Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/get-proto/README.md This command installs the 'get-proto' package as a dependency for your project. It is typically used in Node.js environments for managing project dependencies. ```sh npm install --save get-proto ``` -------------------------------- ### Obsidian Plugin Installation Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Lists the required community plugins for Obsidian to enable advanced functionalities used by the AI Life Assistant integrations. These plugins are essential for features like URI handling, templating, and quick data capture. ```bash # Install required Obsidian plugins # Via Obsidian Community Plugins: # - Advanced URI # - Templater # - Buttons # - Dataview # - QuickAdd # - Meta Bind ``` -------------------------------- ### Install call-bind-apply-helpers Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/call-bind-apply-helpers/README.md Installs the call-bind-apply-helpers package using npm. This command is typically run in the project's root directory. ```sh npm install --save call-bind-apply-helpers ``` -------------------------------- ### /analyze Command - Research Analysis Example Flow Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/UNIFIED-WORKFLOW-REFERENCE.md Illustrates the automatic execution flow for research analysis via the `/analyze` command, including context setup, cross-vault searches in Obsidian, application of research patterns, and web scraping for current information. ```shell /analyze "machine learning deployment patterns" → Automatic Flow: 1. Knowledge sub-agent spawned with research context 2. Cross-vault search in all Obsidian repositories 3. Fabric patterns: research_topic, extract_insights 4. Web search via FireCrawl for current information 5. Synthesized research report with actionable insights ``` -------------------------------- ### Usage Example for side-channel Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel/README.md Demonstrates how to use the 'side-channel' package to set, get, assert presence, and delete keys. It showcases the basic API including `has`, `assert`, `set`, and `delete` methods, along with error handling for missing keys. ```javascript const assert = require('assert'); const getSideChannel = require('side-channel'); const channel = getSideChannel(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install side-channel-list Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-list/README.md This command installs the side-channel-list package as a dependency for your project using npm. ```sh npm install --save side-channel-list ``` -------------------------------- ### Install mime-db Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/mime-db/README.md This command installs the mime-db package using npm. It's the first step to using the MIME type database in your project. ```bash npm install mime-db ``` -------------------------------- ### Install raw-body Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/raw-body/README.md Instructions for installing the 'raw-body' Node.js module using npm. This includes installing the core package and optionally the TypeScript types for better editor support. ```sh npm install raw-body npm install @types/node ``` -------------------------------- ### Install proxy-addr with npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/proxy-addr/README.md Installs the proxy-addr module locally using the npm package manager. This is a standard Node.js package. ```sh npm install proxy-addr ``` -------------------------------- ### Install binary-extensions Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/binary-extensions/readme.md Install the 'binary-extensions' package using npm. This command downloads and installs the package and its dependencies into your project's 'node_modules' directory. ```sh npm install binary-extensions ``` -------------------------------- ### Setup Event Listeners for Commands and Quick Actions - JavaScript Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Attaches click event listeners to command and quick action buttons, modal controls, and keyboard shortcuts. Extracts command/action identifiers from data attributes and triggers appropriate modal display or direct execution methods. ```javascript setupEventListeners() { document.querySelectorAll('.command-btn').forEach(btn => { btn.addEventListener('click', (e) => { const command = e.currentTarget.dataset.command; this.showCommandModal(command); }); }); document.querySelectorAll('.quick-btn').forEach(btn => { btn.addEventListener('click', (e) => { const action = e.currentTarget.dataset.action; this.executeQuickAction(action); }); }); document.querySelector('.modal-close').addEventListener('click', this.closeModal.bind(this)); document.querySelector('.btn-cancel').addEventListener('click', this.closeModal.bind(this)); document.getElementById('command-form').addEventListener('submit', this.executeUnifiedCommand.bind(this)); document.addEventListener('keydown', this.handleKeyboardShortcuts.bind(this)); } ``` -------------------------------- ### Install methods Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/methods/README.md This snippet shows how to install the 'methods' npm package using npm. This is the first step to using the package in a Node.js project. ```bash $ npm install methods ``` -------------------------------- ### Install media-typer Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/media-typer/README.md Install the media-typer package using npm. This is the only external dependency required for using the library. ```sh npm install media-typer ``` -------------------------------- ### Install safe-buffer Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/safe-buffer/README.md Instructions for installing the safe-buffer package using npm. This is a prerequisite for using the package's functionalities. ```bash npm install safe-buffer ``` -------------------------------- ### Installing Express.js via npm (Console) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md This command shows how to install the Express.js framework locally for a project using npm (Node Package Manager). It assumes that Node.js and npm are already installed and a package.json file exists. This is the standard method for adding Express as a project dependency. ```bash $ npm install express ``` -------------------------------- ### Install simple-update-notifier using npm or yarn Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/simple-update-notifier/README.md Instructions for installing the simple-update-notifier package using either npm or yarn. This is the first step before using the package in your project. ```bash npm install simple-update-notifier OR yarn add simple-update-notifier ``` -------------------------------- ### Install content-disposition NPM package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/content-disposition/README.md Install the content-disposition package via npm for HTTP header creation and parsing functionality. ```shell npm install content-disposition ``` -------------------------------- ### Install side-channel-weakmap Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-weakmap/README.md This command installs the side-channel-weakmap package as a dependency for your project. It is a prerequisite for using the library's functionalities. ```sh npm install --save side-channel-weakmap ``` -------------------------------- ### Install uuid Package Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/uuid/README.md Installs the uuid library using npm. This is the first step to begin using the library in your project. ```shell npm install uuid ``` -------------------------------- ### Production Deployment Steps (Bash) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/COMPREHENSIVE-SPEC.md Commands for deploying the project to a production environment, including setting up containers, initializing configuration, enabling monitoring, and testing integrations. ```bash # Production deployment docker-compose -f docker-compose.prod.yml up -d # Initialize production configuration npm run setup:production # Enable monitoring and analytics npm run monitoring:enable # Verify all integrations npm run integration:test-all ``` -------------------------------- ### Generate Documentation with Verb Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/picomatch/README.md Explains how to set up and run the documentation generation process using the 'verb' tool. This involves installing the necessary global packages and then executing the 'verb' command to build the project's README file from a template. ```bash npm install -g verbose/verb#dev verb-generate-readme && verb ``` -------------------------------- ### Install is-extglob via npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/is-extglob/README.md This command installs the 'is-extglob' package as a project dependency using npm. It is typically run once during the project setup phase. ```sh npm install --save is-extglob ``` -------------------------------- ### Optimization Command Examples (General and Specific) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/UNIFIED-WORKFLOW-REFERENCE.md Illustrates the usage of the `/optimize` command for both general system-wide performance enhancement and specific domain optimization, outlining the automatic workflow for each. ```shell /optimize → Automatic Flow: 1. Context Manager analyzes current window usage patterns 2. Quality sub-agent scans for technical debt and performance issues 3. Knowledge sub-agent evaluates vault organization and search efficiency 4. Life Assistant sub-agent reviews productivity metrics and workflows 5. System integration health check across all services 6. Coordinated optimization plan with prioritized recommendations 7. Task Master tasks created for high-impact optimizations 8. Calendar scheduling for optimization implementation ``` ```shell /optimize context_management → Automatic Flow: 1. Deep analysis of sub-agent delegation patterns 2. Context compression efficiency evaluation 3. Session memory optimization via Flashbacker analysis 4. Predictive delegation pattern identification 5. Automated context window management tuning 6. Performance baseline establishment and monitoring setup ``` -------------------------------- ### Initialize Mobile AI Assistant with WebSocket and Event Handlers - JavaScript Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Constructor and initialization method for MobileAIAssistant class that sets up WebSocket connection, event listeners for command and quick action buttons, modal handlers, and keyboard shortcuts. Loads initial system status and recent activity on startup. ```javascript class MobileAIAssistant { constructor() { this.wsConnection = null; this.isOnline = navigator.onLine; this.commandQueue = []; this.metrics = { contextUsage: 0, activeAgents: 0, lastSync: null, responseTime: 0 }; this.initialize(); } async initialize() { this.setupEventListeners(); this.initializeWebSocket(); await this.loadSystemStatus(); this.setupOfflineHandlers(); await this.loadRecentActivity(); console.log('Mobile AI Assistant initialized'); } ``` -------------------------------- ### Get raw body with Koa Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/raw-body/README.md Example of using 'raw-body' with Koa.js using generator functions. It reads the request body, applies specified options, and makes the decoded body available on the Koa context object. This example leverages Promises for asynchronous handling. ```javascript var contentType = require('content-type') var getRawBody = require('raw-body') var koa = require('koa') var app = koa() app.use(function * (next) { this.text = yield getRawBody(this.req, { length: this.req.headers['content-length'], limit: '1mb', encoding: contentType.parse(this.req).parameters.charset }) yield next }) ``` -------------------------------- ### Mobile Setup Commands (Bash) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/COMPREHENSIVE-SPEC.md Commands to generate mobile configuration and initialize the Obsidian vault structure for the project. ```bash # Generate mobile configuration npm run mobile:generate-config # Setup Obsidian vault structure npm run obsidian:initialize-vaults ``` -------------------------------- ### Get Object Prototype Example (JavaScript) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/get-proto/README.md Demonstrates how to use the 'get-proto' function to retrieve the prototype of various objects. It includes assertions to verify the correctness of the returned prototypes, including direct prototypes, inherited prototypes, and objects with null prototypes. ```js const assert = require('assert'); const getProto = require('get-proto'); const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }; const b = { c: 3, __proto__: a }; assert.equal(getProto(b), a); assert.equal(getProto(a), Object.prototype); assert.equal(getProto({ __proto__: null }), null); ``` -------------------------------- ### Get and Set Object Prototype with dunder-proto Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/dunder-proto/README.md Demonstrates how to use the dunder-proto package to retrieve and modify an object's prototype. The example shows getting the __proto__ of an empty object (which returns Object.prototype), then setting it to null to remove inherited properties like 'toString'. This is useful for manipulating prototype chains in a call-bound, safer manner. ```javascript const assert = require('assert'); const getDunder = require('dunder-proto/get'); const setDunder = require('dunder-proto/set'); const obj = {}; assert.equal('toString' in obj, true); assert.equal(getDunder(obj), Object.prototype); setDunder(obj, null); assert.equal('toString' in obj, false); assert.equal(getDunder(obj), null); ``` -------------------------------- ### Usage Example for side-channel-list Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-list/README.md Demonstrates how to use the side-channel-list package to manage data associated with JavaScript keys. It shows setting, getting, asserting the presence of, and deleting keys from the channel, along with error handling for non-existent keys. ```js const assert = require('assert'); const getSideChannelList = require('side-channel-list'); const channel = getSideChannelList(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Nodemon JSON Configuration Example Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/nodemon/doc/cli/config.txt A sample nodemon JSON configuration file demonstrating common options like file extensions, verbosity, and the executable command. This configuration is loaded from local or global files. ```json { "ext": "*.pde", "verbose": true, "exec": "processing --sketch=game --run" } ``` -------------------------------- ### Create and use side-channel-map instance Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/side-channel-map/README.md Demonstrates creating a side-channel map instance and performing operations like has(), set(), get(), assert(), and delete(). The example shows how to store a value (42) associated with an object key and verify its presence and retrieval. ```javascript const assert = require('assert'); const getSideChannelMap = require('side-channel-map'); const channel = getSideChannelMap(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install Dependencies and Run Tests with npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/picomatch/README.md Provides the command to install project dependencies and run the test suite using npm. This is a standard procedure for contributing to or verifying the functionality of Node.js projects. ```bash npm install && npm test ``` -------------------------------- ### Run verb to generate documentation Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/is-extglob/README.md This command installs global tools 'verb' and 'verb-generate-readme', then executes 'verb' to generate the project's documentation. It's part of the development workflow for maintaining the README. ```sh npm install -g verb verb-generate-readme && verb ``` -------------------------------- ### Deprecate Property Access with `depd` Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/depd/Readme.md This JavaScript example demonstrates how to use `depd` to mark property access (gets and sets) as deprecated. It supports both automatically deriving the deprecation message from the property name and providing an explicit message. ```js var deprecate = require('depd')('my-cool-module') exports.oldprop = 'something' // message automatically derives from property name deprecate.property(exports, 'oldprop') // explicit message deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') ``` -------------------------------- ### Usage Example: Bound Array Slice in JavaScript Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/call-bound/README.md Demonstrates how to use the 'call-bound' library to get a bound version of 'Array.prototype.slice'. It then shows how this bound function works even after the original 'slice' method has been deleted from the Array prototype. ```javascript const assert = require('assert'); const callBound = require('call-bound'); const slice = callBound('Array.prototype.slice'); delete Function.prototype.call; delete Function.prototype.bind; delete Array.prototype.slice; assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); ``` -------------------------------- ### Install ee-first using npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/ee-first/README.md This command installs the 'ee-first' package as a project dependency using npm. It is typically run in the terminal within your project's root directory. ```sh #!/bin/bash $ npm install ee-first ``` -------------------------------- ### Get raw body with Express Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/raw-body/README.md Example of using 'raw-body' within an Express.js application middleware. It reads the request body, applying length and limit constraints, and decodes it using the charset from the Content-Type header. The decoded body is then attached to the request object. ```javascript var contentType = require('content-type') var express = require('express') var getRawBody = require('raw-body') var app = express() app.use(function (req, res, next) { getRawBody(req, { length: req.headers['content-length'], limit: '1mb', encoding: contentType.parse(req).parameters.charset }, function (err, string) { if (err) return next(err) req.text = string next() }) }) ``` -------------------------------- ### Installing Project Dependencies (Node.js) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/express/Readme.md After creating a new Express application or cloning an existing one, this command is used to install all the necessary project dependencies defined in the 'package.json' file. This ensures that all required modules, including Express itself, are available for the project to run. ```bash $ npm install ``` -------------------------------- ### Express/Connect Top-Level Generic Body Parsing Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/body-parser/README.md This example shows how to add generic JSON and URL-encoded parsers as top-level middleware in an Express application. This setup parses the bodies of all incoming requests using the default configurations. It requires the 'express' and 'body-parser' modules. ```javascript var express = require('express') var bodyParser = require('body-parser') var app = express() // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // parse application/json app.use(bodyParser.json()) app.use(function (req, res) { res.setHeader('Content-Type', 'text/plain') res.write('you posted:\n') res.end(JSON.stringify(req.body, null, 2)) }) ``` -------------------------------- ### Install anymatch using npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/anymatch/README.md Install the anymatch module using npm. This is the first step to using its string matching functionalities in your Javascript project. ```sh npm install anymatch ``` -------------------------------- ### Research Command Examples in Various Domains Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/UNIFIED-WORKFLOW-REFERENCE.md Demonstrates the usage of the `/research` command for technical, personal development, and cross-domain research. Each example outlines an automatic flow of sub-agent interactions and analysis steps. ```shell /research "microservices architecture patterns for Node.js" → Automatic Flow: 1. Search existing vault knowledge on microservices 2. Knowledge sub-agent spawned with technical context 3. Fabric patterns: research_topic, analyze_architecture 4. Web research for current best practices and tools 5. Cross-reference with current project requirements 6. Synthesized research report with implementation recommendations 7. Task Master tasks created for evaluation and implementation 8. Obsidian note with comprehensive cross-references ``` ```shell /research "ADD-friendly development workflows" → Automatic Flow: 1. Life Assistant sub-agent analyzes personal productivity context 2. Search claudeLifeV2 workflows and existing strategies 3. Web research for current neurodiversity best practices 4. Fabric patterns: productivity_analysis, workflow_optimization 5. Integration with existing calendar and task management 6. Personalized recommendations with implementation timeline 7. Mobile triggers for recommended workflow adjustments ``` ```shell /research "AI-assisted code review tools integration" → Automatic Flow: 1. Parallel sub-agents: Development + Knowledge + Quality 2. Technical analysis of existing code review processes 3. Market research on available AI tools and integrations 4. Security and compliance analysis 5. Cost-benefit analysis with implementation complexity 6. Comprehensive report with phased implementation plan 7. Cross-system integration recommendations ``` -------------------------------- ### iOS Shortcuts for AI Life Assistant Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/MOBILE-INTEGRATION-GUIDE.md Defines various iOS Shortcuts to interact with the AI Life Assistant. These shortcuts use actions like getting location, formatting text with specific commands and context, and opening URLs in Obsidian to trigger different AI-powered workflows. ```yaml shortcuts: analyze_current_work: name: "Analyze Current Work" description: "Analyze current development work using AI Life Assistant" actions: - type: get_location - type: format_text text: | command:analyze target:current_work context:voice_command timestamp:{{current_timestamp}} location:{{location}} - type: open_url url: "obsidian://advanced-uri?vault=mobile-control&filepath=_triggers%2Funified_commands%2Fvoice_analyze.md&mode=new&content={{formatted_text}}" implement_feature: name: "Implement Feature" description: "Start feature implementation workflow" actions: - type: ask_for_input prompt: "What feature should I implement?" input_type: text - type: format_text text: | command:implement feature:{{user_input}} context:voice_command timestamp:{{current_timestamp}} - type: open_url url: "obsidian://advanced-uri?vault=mobile-control&filepath=_triggers%2Funified_commands%2Fvoice_implement.md&mode=new&content={{formatted_text}}" research_topic: name: "Research Topic" description: "Research any topic using AI Life Assistant" actions: - type: ask_for_input prompt: "What would you like me to research?" input_type: text - type: format_text text: | command:research topic:{{user_input}} context:voice_command timestamp:{{current_timestamp}} - type: open_url url: "obsidian://advanced-uri?vault=mobile-control&filepath=_triggers%2Funified_commands%2Fvoice_research.md&mode=new&content={{formatted_text}}" quick_optimize: name: "Optimize Systems" description: "Run system optimization" actions: - type: format_text text: | command:optimize scope:general context:voice_command timestamp:{{current_timestamp}} - type: open_url url: "obsidian://advanced-uri?vault=mobile-control&filepath=_triggers%2Funified_commands%2Fvoice_optimize.md&mode=new&content={{formatted_text}}" plan_session: name: "Plan Work Session" description: "Plan current work session" actions: - type: ask_for_input prompt: "How many hours do you want to plan for?" input_type: number default_answer: "4" - type: format_text text: | command:plan scope:session duration:{{user_input}} context:voice_command timestamp:{{current_timestamp}} - type: open_url url: "obsidian://advanced-uri?vault=mobile-control&filepath=_triggers%2Funified_commands%2Fvoice_plan.md&mode=new&content={{formatted_text}}" ``` -------------------------------- ### Chokidar File System Watching Example Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/chokidar/README.md Demonstrates a typical implementation structure for using chokidar to watch for file and directory changes. It covers initializing the watcher, adding event listeners for various file system operations, handling events with optional stats, adding new paths, retrieving watched paths, unwatching specific files, and closing the watcher. ```javascript // Example of a more typical implementation structure // Initialize watcher. const watcher = chokidar.watch('file, dir, glob, or array', { ignored: /(^|[/\])\..*/, // ignore dotfiles persistent: true }); // Something to use when events are received. const log = console.log.bind(console); // Add event listeners. watcher .on('add', path => log(`File ${path} has been added`)) .on('change', path => log(`File ${path} has been changed`)) .on('unlink', path => log(`File ${path} has been removed`)); // More possible events. watcher .on('addDir', path => log(`Directory ${path} has been added`)) .on('unlinkDir', path => log(`Directory ${path} has been removed`)) .on('error', error => log(`Watcher error: ${error}`)) .on('ready', () => log('Initial scan complete. Ready for changes')) .on('raw', (event, path, details) => { // internal log('Raw event info:', event, path, details); }); // 'add', 'addDir' and 'change' events also receive stat() results as second // argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats watcher.on('change', (path, stats) => { if (stats) console.log(`File ${path} changed size to ${stats.size}`); }); // Watch new files. watcher.add('new-file'); watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); // Get list of actual paths being watched on the filesystem var watchedPaths = watcher.getWatched(); // Un-watch some files. await watcher.unwatch('new-file*'); // Stop watching. // The method is async! watcher.close().then(() => console.log('closed')); // Full list of options. See below for descriptions. // Do not use this example! chokidar.watch('file', { persistent: true, ignored: '*.txt', ignoreInitial: false, followSymlinks: true, cwd: '.', disableGlobbing: false, usePolling: false, interval: 100, binaryInterval: 300, alwaysStat: false, depth: 99, awaitWriteFinish: { stabilityThreshold: 2000, pollInterval: 100 }, ignorePermissionErrors: false, atomic: true // or a custom 'atomicity delay', in milliseconds (default 100) }); ``` -------------------------------- ### Custom expandRange Function for Brace Patterns Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/picomatch/README.md Shows how to use a custom 'expandRange' function with picomatch to define custom behavior for expanding brace patterns. This example utilizes the 'fill-range' library to create a regex that matches a specific numerical range within a path. It requires the 'fill-range' library to be installed. ```javascript const fill = require('fill-range'); const pm = require('picomatch'); // Assuming picomatch is imported as pm const regex = pm.makeRe('foo/{01..25}/bar', { expandRange(a, b) { return `(${fill(a, b, { toRegex: true })})`; } }); console.log(regex); //=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ console.log(regex.test('foo/00/bar')) // false console.log(regex.test('foo/01/bar')) // true console.log(regex.test('foo/10/bar')) // true console.log(regex.test('foo/22/bar')) // true console.log(regex.test('foo/25/bar')) // true console.log(regex.test('foo/26/bar')) // false ``` -------------------------------- ### Install http-errors via npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/http-errors/README.md Install the http-errors module from npm registry using the npm install command. This is a prerequisite for using the module in Node.js applications. ```console npm install http-errors ``` -------------------------------- ### Start Demo Server with Mobile Dashboard - JavaScript Source: https://context7.com/vjspal/literally-integrated-humankind-3.0/llms.txt Initializes and starts the demo server instance for the AI Life Assistant framework. The server exposes a mobile dashboard at /mobile endpoint with real-time status monitoring, provides health check and API status endpoints, and enables command execution through a web-based interface with auto-refreshing system status every 5 seconds. ```javascript // Start the demo server const DemoServer = require('./server'); const server = new DemoServer(); await server.start(); // 🚀 AI Life Assistant Demo Server running on port 3000 // 📱 Mobile Dashboard: http://localhost:3000/mobile // 🔍 Health Check: http://localhost:3000/health // 📊 API Status: http://localhost:3000/api/status // Access mobile dashboard in browser // Provides buttons for: Analyze, Implement, Research, Optimize // Real-time context monitoring // Command execution with result display // Auto-refresh system status every 5 seconds ``` -------------------------------- ### /analyze Command - System Analysis Example Flow Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/UNIFIED-WORKFLOW-REFERENCE.md Outlines the automatic execution flow for system analysis using the `/analyze` command, covering context provision, architecture pattern application, integration point identification, and the generation of optimization recommendations. ```shell /analyze current_architecture → Automatic Flow: 1. Development sub-agent with full codebase context 2. Architecture analysis patterns applied 3. Integration point identification 4. Technical debt assessment 5. Optimization recommendations with implementation roadmap ``` -------------------------------- ### Install CORS Package with npm Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/cors/README.md This command installs the 'cors' package locally for a Node.js project using npm. It requires Node.js and npm to be installed. ```sh npm install cors ``` -------------------------------- ### Install depd Module Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/depd/Readme.md Install the depd deprecation library using npm package manager. This is the standard installation method for adding the module to your Node.js project. ```bash npm install depd ``` -------------------------------- ### SemVer Prerelease Release Example (JavaScript) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/semver/README.md Shows how to exit the prerelease phase of a SemVer version and return to a stable release version using the 'release' option. ```javascript const semver = require('semver'); console.log(semver.inc('1.2.4-beta.1', 'release')); // Expected output: '1.2.4' ``` -------------------------------- ### Install body-parser Middleware Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/body-parser/README.md This command installs the body-parser package using npm, making it available for use in your Node.js project. Ensure you have Node.js and npm installed. ```sh npm install body-parser ``` -------------------------------- ### /analyze Command - Code Analysis Example Flow Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/UNIFIED-WORKFLOW-REFERENCE.md Demonstrates the automatic execution flow for analyzing code using the `/analyze` command, detailing the spawning of the quality sub-agent, application of fabric patterns, and integration with Obsidian for existing knowledge. ```shell /analyze authentication_middleware.js → Automatic Flow: 1. Quality sub-agent spawned with code context 2. Fabric patterns: analyze_code, security_audit applied 3. Obsidian search for existing auth patterns 4. Cross-reference with current project security standards 5. Comprehensive analysis with recommendations ``` -------------------------------- ### Get Raw HTTP Request Body as Promise (TypeScript) Source: https://github.com/vjspal/literally-integrated-humankind-3.0/blob/main/node_modules/raw-body/README.md This TypeScript example shows how to use the 'raw-body' library with async/await and Promises for handling HTTP request bodies. It imports necessary modules and defines a server that processes incoming requests, extracting the raw body and sending back its length or an error message. This approach enhances code readability and maintainability with static typing. ```typescript import * as getRawBody from 'raw-body'; import * as http from 'http'; const server = http.createServer((req, res) => { getRawBody(req) .then((buf) => { res.statusCode = 200; res.end(buf.length + ' bytes submitted'); }) .catch((err) => { res.statusCode = err.statusCode; res.end(err.message); }); }); server.listen(3000); ```