Here's a summary of the recent changes:
-
New Files and Dependencies:
- Added
.envto.gitignore. - Introduced
.shadow-lockfile for storing state. - Added
dotenvdependency topackage.json. - Created new JavaScript and TypeScript files for
synccommand (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).
- Added
-
Sync Command Enhancements:
- The
syncCommandnow initializes and usesGitManager,Store, andAIManager. - 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
AIManagerto generate documentation summaries from the diff. - The generated summary is logged to the console.
- The current Git hash is saved to
.shadow-lockafter successful processing.
- The
-
AI Manager Implementation:
- The
AIManageris responsible for interacting with the Google Generative AI API. - It requires the
GOOGLE_GEMINI_API_KEYto be set in the.envfile. - The
generateDocsmethod takes a Git diff as input and returns a generated documentation summary.
- The
-
Git Manager Improvements:
- The
GitManagernow handles the execution of Git commands. ensureCleanTreenow explicitly exits with an error message if uncommitted changes are found.getDiffhas 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.getCurrentHashtrims whitespace from the returned hash.
- The
-
Store Management:
- The
Storeclass handles reading from and writing to the.shadow-lockfile. - It stores the
lastHashandupdatedAttimestamp. - It gracefully handles cases where the
.shadow-lockfile doesn't exist yet.
- The
-
Project Structure and Configuration:
.envand.dist/are now ignored by Git.- A new
.shadow-lockfile is added to.gitignore.
--
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
.envconfiguration. - 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 theREADME.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
chalkfor colored console output. - The
syncCommandnow explicitly useschalk.greenfor success messages andchalk.yellowfor informational messages. - Introduced the concept of "Context" by fetching the project structure using
git.getProjectStructure(). - Added functionality to read existing documentation from
STRUCTURE.mdusingstore.getCurrentDocs(). - The prompt sent to the AI now includes the project structure and existing documentation.
- The generated summary is now appended to
STRUCTURE.mdusingstore.updateDocs().
- Added
- Modified
src/index.ts:- This file has been refactored to use the
commanderlibrary for CLI argument parsing. - It now defines a
synccommand that triggers thesyncCommandfunction. - Error handling for the
syncCommandhas been added.
- This file has been refactored to use the
- Modified
src/lib/ai.ts:- The
generateDocsmethod now returnsresponse.text()instead of the rawresponseobject, providing just the generated text.
- The
- Modified
src/lib/git.ts:- Added a new method
getProjectStructure()which usesgit ls-files --exclude-standard -cto get a list of files in the repository, excluding those from.gitignore.
- Added a new method
- Modified
src/utils/store.ts:- Added
chalkfor colored output. - Introduced a new constant
DOCS_FILEfor the documentation file name (STRUCTURE.md). - Added
existsSyncto check for the existence ofSTRUCTURE.md. - Implemented
getCurrentDocs()to read the content ofSTRUCTURE.md. - Implemented
updateDocs(summary: string)to append new documentation entries with a date toSTRUCTURE.md. - Uses
appendFilefor writing to the documentation file.
- Added
- Modified
tsconfig.json:- Updated
moduleto"esnext"andmoduleResolutionto"bundler"for better compatibility with modern Node.js and build tools.
- Updated
--