Skip to content

Latest commit

 

History

History
84 lines (73 loc) · 5.42 KB

File metadata and controls

84 lines (73 loc) · 5.42 KB

🗓️ Update: 2026-01-13

Here's a summary of the recent changes:

  • New Files and Dependencies:

    • Added .env to .gitignore.
    • Introduced .shadow-lock file for storing state.
    • Added dotenv dependency to package.json.
    • Created new JavaScript and TypeScript files for sync command (src/commands/sync.js, src/commands/sync.ts).
    • Created new JavaScript and TypeScript files for AI functionality (src/lib/ai.js, src/lib/ai.ts).
    • Created new JavaScript and TypeScript files for Git operations (src/lib/git.js, src/lib/git.ts).
    • Created new JavaScript and TypeScript files for storing state (src/utils/store.js, src/utils/store.ts).
  • Sync Command Enhancements:

    • The syncCommand now initializes and uses GitManager, Store, and AIManager.
    • It ensures a clean Git tree before proceeding.
    • It loads previous state from .shadow-lock.
    • If no previous state exists, it creates a baseline.
    • If previous state exists, it calculates the diff from the last commit.
    • It now uses the AIManager to generate documentation summaries from the diff.
    • The generated summary is logged to the console.
    • The current Git hash is saved to .shadow-lock after successful processing.
  • AI Manager Implementation:

    • The AIManager is responsible for interacting with the Google Generative AI API.
    • It requires the GOOGLE_GEMINI_API_KEY to be set in the .env file.
    • The generateDocs method takes a Git diff as input and returns a generated documentation summary.
  • Git Manager Improvements:

    • The GitManager now handles the execution of Git commands.
    • ensureCleanTree now explicitly exits with an error message if uncommitted changes are found.
    • getDiff has been updated to exclude certain files/directories (node_modules, *.lock, package-lock.json) from the diff and to handle potential errors more gracefully by returning an empty string.
    • getCurrentHash trims whitespace from the returned hash.
  • Store Management:

    • The Store class handles reading from and writing to the .shadow-lock file.
    • It stores the lastHash and updatedAt timestamp.
    • It gracefully handles cases where the .shadow-lock file doesn't exist yet.
  • Project Structure and Configuration:

    • .env and .dist/ are now ignored by Git.
    • A new .shadow-lock file is added to .gitignore.

--

🗓️ Update: 2026-01-14

Here's a summary of the recent changes:

  • Updated .shadow-lock: The file now stores a more detailed Git hash (bfd448f3fae1e1e251ef4bf8bff1dfffc98ffe53) and an updated timestamp.
  • Enhanced README.md:
    • Renamed the project to "Shadow Docs".
    • Added a detailed explanation of what the tool does and its workflow.
    • Provided setup and usage instructions, including .env configuration.
    • Included "How NOT To Use" guidelines to prevent common errors.
    • Updated the "Project Structure" section to reflect current files.
    • Added a "Key Features" list.
  • New STRUCTURE.md: This file now contains the same detailed update summary that was previously present in the README.md.
  • Removed git-lab.ts, index.ts (old), src/commands/sync.js, src/lib/ai.js, src/lib/git.js, src/utils/store.js, test-watcher.ts: These files appear to be older or transitional JavaScript versions and have been removed as the project is now primarily in TypeScript.
  • Modified src/commands/sync.ts:
    • Added chalk for colored console output.
    • The syncCommand now explicitly uses chalk.green for success messages and chalk.yellow for informational messages.
    • Introduced the concept of "Context" by fetching the project structure using git.getProjectStructure().
    • Added functionality to read existing documentation from STRUCTURE.md using store.getCurrentDocs().
    • The prompt sent to the AI now includes the project structure and existing documentation.
    • The generated summary is now appended to STRUCTURE.md using store.updateDocs().
  • Modified src/index.ts:
    • This file has been refactored to use the commander library for CLI argument parsing.
    • It now defines a sync command that triggers the syncCommand function.
    • Error handling for the syncCommand has been added.
  • Modified src/lib/ai.ts:
    • The generateDocs method now returns response.text() instead of the raw response object, providing just the generated text.
  • Modified src/lib/git.ts:
    • Added a new method getProjectStructure() which uses git ls-files --exclude-standard -c to get a list of files in the repository, excluding those from .gitignore.
  • Modified src/utils/store.ts:
    • Added chalk for colored output.
    • Introduced a new constant DOCS_FILE for the documentation file name (STRUCTURE.md).
    • Added existsSync to check for the existence of STRUCTURE.md.
    • Implemented getCurrentDocs() to read the content of STRUCTURE.md.
    • Implemented updateDocs(summary: string) to append new documentation entries with a date to STRUCTURE.md.
    • Uses appendFile for writing to the documentation file.
  • Modified tsconfig.json:
    • Updated module to "esnext" and moduleResolution to "bundler" for better compatibility with modern Node.js and build tools.

--