chronicle-ai 0.0.1

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 (155) hide show
  1. package/README.md +132 -0
  2. package/package.json +86 -0
  3. package/packages/README.md +139 -0
  4. package/packages/cli/README.md +92 -0
  5. package/packages/cli/bin/chronicle.js +2 -0
  6. package/packages/cli/dist/commands/add.d.ts +2 -0
  7. package/packages/cli/dist/commands/add.d.ts.map +1 -0
  8. package/packages/cli/dist/commands/add.js +82 -0
  9. package/packages/cli/dist/commands/add.js.map +1 -0
  10. package/packages/cli/dist/commands/diff.d.ts +11 -0
  11. package/packages/cli/dist/commands/diff.d.ts.map +1 -0
  12. package/packages/cli/dist/commands/diff.js +164 -0
  13. package/packages/cli/dist/commands/diff.js.map +1 -0
  14. package/packages/cli/dist/commands/init.d.ts +2 -0
  15. package/packages/cli/dist/commands/init.d.ts.map +1 -0
  16. package/packages/cli/dist/commands/init.js +54 -0
  17. package/packages/cli/dist/commands/init.js.map +1 -0
  18. package/packages/cli/dist/commands/list.d.ts +2 -0
  19. package/packages/cli/dist/commands/list.d.ts.map +1 -0
  20. package/packages/cli/dist/commands/list.js +62 -0
  21. package/packages/cli/dist/commands/list.js.map +1 -0
  22. package/packages/cli/dist/commands/log.d.ts +4 -0
  23. package/packages/cli/dist/commands/log.d.ts.map +1 -0
  24. package/packages/cli/dist/commands/log.js +223 -0
  25. package/packages/cli/dist/commands/log.js.map +1 -0
  26. package/packages/cli/dist/commands/pause.d.ts +3 -0
  27. package/packages/cli/dist/commands/pause.d.ts.map +1 -0
  28. package/packages/cli/dist/commands/pause.js +49 -0
  29. package/packages/cli/dist/commands/pause.js.map +1 -0
  30. package/packages/cli/dist/commands/queue.d.ts +2 -0
  31. package/packages/cli/dist/commands/queue.d.ts.map +1 -0
  32. package/packages/cli/dist/commands/queue.js +96 -0
  33. package/packages/cli/dist/commands/queue.js.map +1 -0
  34. package/packages/cli/dist/commands/remove.d.ts +2 -0
  35. package/packages/cli/dist/commands/remove.d.ts.map +1 -0
  36. package/packages/cli/dist/commands/remove.js +80 -0
  37. package/packages/cli/dist/commands/remove.js.map +1 -0
  38. package/packages/cli/dist/commands/reset.d.ts +5 -0
  39. package/packages/cli/dist/commands/reset.d.ts.map +1 -0
  40. package/packages/cli/dist/commands/reset.js +90 -0
  41. package/packages/cli/dist/commands/reset.js.map +1 -0
  42. package/packages/cli/dist/commands/restart.d.ts +2 -0
  43. package/packages/cli/dist/commands/restart.d.ts.map +1 -0
  44. package/packages/cli/dist/commands/restart.js +72 -0
  45. package/packages/cli/dist/commands/restart.js.map +1 -0
  46. package/packages/cli/dist/commands/start.d.ts +2 -0
  47. package/packages/cli/dist/commands/start.d.ts.map +1 -0
  48. package/packages/cli/dist/commands/start.js +127 -0
  49. package/packages/cli/dist/commands/start.js.map +1 -0
  50. package/packages/cli/dist/commands/status.d.ts +2 -0
  51. package/packages/cli/dist/commands/status.d.ts.map +1 -0
  52. package/packages/cli/dist/commands/status.js +181 -0
  53. package/packages/cli/dist/commands/status.js.map +1 -0
  54. package/packages/cli/dist/commands/stop.d.ts +2 -0
  55. package/packages/cli/dist/commands/stop.d.ts.map +1 -0
  56. package/packages/cli/dist/commands/stop.js +64 -0
  57. package/packages/cli/dist/commands/stop.js.map +1 -0
  58. package/packages/cli/dist/index.d.ts +2 -0
  59. package/packages/cli/dist/index.d.ts.map +1 -0
  60. package/packages/cli/dist/index.js +85 -0
  61. package/packages/cli/dist/index.js.map +1 -0
  62. package/packages/cli/dist/utils/paths.d.ts +26 -0
  63. package/packages/cli/dist/utils/paths.d.ts.map +1 -0
  64. package/packages/cli/dist/utils/paths.js +183 -0
  65. package/packages/cli/dist/utils/paths.js.map +1 -0
  66. package/packages/cli/package.json +25 -0
  67. package/packages/daemon/README.md +83 -0
  68. package/packages/daemon/dist/ai_test.d.ts +2 -0
  69. package/packages/daemon/dist/ai_test.d.ts.map +1 -0
  70. package/packages/daemon/dist/ai_test.js +4 -0
  71. package/packages/daemon/dist/ai_test.js.map +1 -0
  72. package/packages/daemon/dist/index.d.ts +2 -0
  73. package/packages/daemon/dist/index.d.ts.map +1 -0
  74. package/packages/daemon/dist/index.js +147 -0
  75. package/packages/daemon/dist/index.js.map +1 -0
  76. package/packages/daemon/dist/jobs/AIProcessor.d.ts +6 -0
  77. package/packages/daemon/dist/jobs/AIProcessor.d.ts.map +1 -0
  78. package/packages/daemon/dist/jobs/AIProcessor.js +58 -0
  79. package/packages/daemon/dist/jobs/AIProcessor.js.map +1 -0
  80. package/packages/daemon/dist/jobs/DocProcessor.d.ts +8 -0
  81. package/packages/daemon/dist/jobs/DocProcessor.d.ts.map +1 -0
  82. package/packages/daemon/dist/jobs/DocProcessor.js +336 -0
  83. package/packages/daemon/dist/jobs/DocProcessor.js.map +1 -0
  84. package/packages/daemon/dist/jobs/FileProcessor.d.ts +7 -0
  85. package/packages/daemon/dist/jobs/FileProcessor.d.ts.map +1 -0
  86. package/packages/daemon/dist/jobs/FileProcessor.js +29 -0
  87. package/packages/daemon/dist/jobs/FileProcessor.js.map +1 -0
  88. package/packages/daemon/dist/jobs/SystemProcessor.d.ts +13 -0
  89. package/packages/daemon/dist/jobs/SystemProcessor.d.ts.map +1 -0
  90. package/packages/daemon/dist/jobs/SystemProcessor.js +38 -0
  91. package/packages/daemon/dist/jobs/SystemProcessor.js.map +1 -0
  92. package/packages/daemon/dist/jobs/UpdateProcessor.d.ts +21 -0
  93. package/packages/daemon/dist/jobs/UpdateProcessor.d.ts.map +1 -0
  94. package/packages/daemon/dist/jobs/UpdateProcessor.js +222 -0
  95. package/packages/daemon/dist/jobs/UpdateProcessor.js.map +1 -0
  96. package/packages/daemon/dist/services/AIService.d.ts +90 -0
  97. package/packages/daemon/dist/services/AIService.d.ts.map +1 -0
  98. package/packages/daemon/dist/services/AIService.js +451 -0
  99. package/packages/daemon/dist/services/AIService.js.map +1 -0
  100. package/packages/daemon/dist/services/ConfigService.d.ts +30 -0
  101. package/packages/daemon/dist/services/ConfigService.d.ts.map +1 -0
  102. package/packages/daemon/dist/services/ConfigService.js +69 -0
  103. package/packages/daemon/dist/services/ConfigService.js.map +1 -0
  104. package/packages/daemon/dist/services/DatabaseService.d.ts +204 -0
  105. package/packages/daemon/dist/services/DatabaseService.d.ts.map +1 -0
  106. package/packages/daemon/dist/services/DatabaseService.js +692 -0
  107. package/packages/daemon/dist/services/DatabaseService.js.map +1 -0
  108. package/packages/daemon/dist/services/GitService.d.ts +12 -0
  109. package/packages/daemon/dist/services/GitService.d.ts.map +1 -0
  110. package/packages/daemon/dist/services/GitService.js +68 -0
  111. package/packages/daemon/dist/services/GitService.js.map +1 -0
  112. package/packages/daemon/dist/services/QueueService.d.ts +16 -0
  113. package/packages/daemon/dist/services/QueueService.d.ts.map +1 -0
  114. package/packages/daemon/dist/services/QueueService.js +87 -0
  115. package/packages/daemon/dist/services/QueueService.js.map +1 -0
  116. package/packages/daemon/dist/services/TriggerService.d.ts +37 -0
  117. package/packages/daemon/dist/services/TriggerService.d.ts.map +1 -0
  118. package/packages/daemon/dist/services/TriggerService.js +150 -0
  119. package/packages/daemon/dist/services/TriggerService.js.map +1 -0
  120. package/packages/daemon/dist/services/WatcherService.d.ts +12 -0
  121. package/packages/daemon/dist/services/WatcherService.d.ts.map +1 -0
  122. package/packages/daemon/dist/services/WatcherService.js +77 -0
  123. package/packages/daemon/dist/services/WatcherService.js.map +1 -0
  124. package/packages/daemon/dist/services/index.d.ts +2 -0
  125. package/packages/daemon/dist/services/index.d.ts.map +1 -0
  126. package/packages/daemon/dist/services/index.js +18 -0
  127. package/packages/daemon/dist/services/index.js.map +1 -0
  128. package/packages/daemon/dist/test-ignore.js +0 -0
  129. package/packages/daemon/package.json +28 -0
  130. package/packages/ui/app/actions.ts +73 -0
  131. package/packages/ui/app/api/ai-activity/route.ts +14 -0
  132. package/packages/ui/app/globals.css +98 -0
  133. package/packages/ui/app/layout.tsx +29 -0
  134. package/packages/ui/app/page.tsx +109 -0
  135. package/packages/ui/components/AutoRefresh.tsx +18 -0
  136. package/packages/ui/components/DocumentationViewer.tsx +276 -0
  137. package/packages/ui/components/FileList.tsx +69 -0
  138. package/packages/ui/components/HeaderWithThinking.tsx +102 -0
  139. package/packages/ui/components/JobQueue.tsx +194 -0
  140. package/packages/ui/components/JobQueueWrapper.tsx +31 -0
  141. package/packages/ui/components/MermaidInit.tsx +24 -0
  142. package/packages/ui/components/ProjectContentArea.tsx +186 -0
  143. package/packages/ui/components/ProjectList.tsx +136 -0
  144. package/packages/ui/components/ThinkingDrawer.tsx +377 -0
  145. package/packages/ui/components/ThinkingPanel.tsx +63 -0
  146. package/packages/ui/components/TriggerSettings.tsx +185 -0
  147. package/packages/ui/components/VersionSelector.tsx +132 -0
  148. package/packages/ui/lib/db.ts +521 -0
  149. package/packages/ui/next-env.d.ts +5 -0
  150. package/packages/ui/next.config.js +4 -0
  151. package/packages/ui/package.json +32 -0
  152. package/packages/ui/postcss.config.js +6 -0
  153. package/packages/ui/public/logo.png +0 -0
  154. package/packages/ui/tailwind.config.ts +32 -0
  155. package/packages/ui/tsconfig.json +40 -0
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # Chronicle
2
+
3
+ **Automated "Living Documentation" Platform Powered by AI**
4
+
5
+ Chronicle is a modern monorepo solution designed to keep project documentation seamlessly in sync with code evolution. By employing a background daemon that watches file system changes and Git history, Chronicle leverages the Google Gemini API to generate, update, and visualize architecture and logic documentation in real-time.
6
+
7
+ ## 🚀 Key Features
8
+
9
+ - **Automated Observation**: A background daemon watches for file changes and git commits to trigger documentation updates.
10
+ - **AI-Driven Insights**: Utilizes Google Gemini API to analyze code differences and generate human-readable explanations.
11
+ - **Web Dashboard**: A Next.js + Tailwind CSS interface for visualizing project architecture, job queues, and documentation status.
12
+ - **Transparent Reasoning**: View "Thinking" logs to understand how the AI analyzes code and makes documentation decisions.
13
+ - **CLI Management**: A dedicated CLI tool to manage tracked projects and manual triggers.
14
+
15
+ ## 🛠 Tech Stack
16
+
17
+ - **Language**: TypeScript, Node.js
18
+ - **Frontend**: Next.js, React, Tailwind CSS
19
+ - **AI Integration**: Google Gemini API
20
+ - **Visualizations**: Mermaid.js (via UI components)
21
+ - **Architecture**: Monorepo (Workspace)
22
+
23
+ ## 📂 Project Structure
24
+
25
+ Chronicle is organized as a monorepo with the following core packages:
26
+
27
+ ```text
28
+ chronicle/
29
+ ├── packages/
30
+ │ ├── cli/ # Command-line interface for project management
31
+ │ │ ├── bin/ # Executables
32
+ │ │ └── src/ # CLI logic (add, diff, etc.)
33
+ │ ├── daemon/ # Background service & AI processing logic
34
+ │ │ ├── src/ # Watcher and Gemini integration
35
+ │ │ └── scripts/ # Testing scripts for AI generation
36
+ │ └── ui/ # Next.js Web Dashboard
37
+ │ ├── app/ # App router pages and layouts
38
+ │ └── components/ # UI components (JobQueue, ThinkingPanel, etc.)
39
+ ├── package.json # Root workspace configuration
40
+ └── tsconfig.base.json
41
+ ```
42
+
43
+ ## 🏁 Getting Started
44
+
45
+ ### Prerequisites
46
+
47
+ - Node.js (v20+ recommended)
48
+ - npm or pnpm
49
+ - A Google Gemini API Key
50
+
51
+ ### Installation
52
+
53
+ 1. **Clone the repository:**
54
+ ```bash
55
+ git clone https://github.com/your-org/chronicle.git
56
+ cd chronicle
57
+ ```
58
+
59
+ 2. **Install dependencies (Root):**
60
+ ```bash
61
+ npm install
62
+ ```
63
+
64
+ 3. **Build the packages:**
65
+ ```bash
66
+ npm run build
67
+ ```
68
+
69
+ ### Configuration
70
+
71
+ Chronicle now uses a key file at:
72
+
73
+ `packages/daemon/.chronicle/.gemini-key`
74
+
75
+ When you run `chronicle start`, Chronicle auto-creates this file if missing.
76
+ If the file is empty, startup fails with a clear error.
77
+
78
+ Add your Gemini key as a single line:
79
+
80
+ ```text
81
+ AIza...
82
+ ```
83
+
84
+ ### Usage
85
+
86
+ Chronicle consists of three moving parts: the Daemon (backend), the UI (frontend), and the CLI (management).
87
+
88
+ #### 1. Start the Daemon
89
+ The daemon monitors the file system and processes the job queue.
90
+ ```bash
91
+ cd packages/daemon
92
+ npm run start
93
+ ```
94
+
95
+ #### 2. Launch the Dashboard
96
+ Run the web interface to view logs, queues, and documentation.
97
+ ```bash
98
+ cd packages/ui
99
+ npm run dev
100
+ ```
101
+ Access the dashboard at `http://localhost:3000`.
102
+
103
+ #### 3. Manage Projects via CLI
104
+ Use the CLI to add new projects to the watchlist or trigger manual updates.
105
+ ```bash
106
+ # Build and link globally from this repo
107
+ npm run build
108
+ npm link
109
+
110
+ # Use the CLI
111
+ chronicle add /path/to/target/project
112
+ chronicle diff
113
+ ```
114
+
115
+ ### Install as npm package
116
+
117
+ After publishing, users can install globally with:
118
+
119
+ ```bash
120
+ npm install -g chronicle
121
+ chronicle --version
122
+ ```
123
+
124
+ ## 🧩 Components Overview
125
+
126
+ - **Job Queue**: Manages the flow of documentation generation tasks.
127
+ - **Thinking Drawer**: A unique UI component that reveals the AI's internal reasoning process during documentation generation.
128
+ - **Project Content Area**: Renders the generated markdown and architectural diagrams.
129
+
130
+ ## 📄 License
131
+
132
+ [MIT](LICENSE)
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "chronicle-ai",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Chronicle - Living Docs: Autonomous Documentation Agent",
6
+ "bin": {
7
+ "chronicle": "./packages/cli/bin/chronicle.js"
8
+ },
9
+ "files": [
10
+ "packages/cli/bin",
11
+ "packages/cli/dist",
12
+ "packages/cli/package.json",
13
+ "packages/daemon/dist",
14
+ "packages/daemon/package.json",
15
+ "packages/ui/app",
16
+ "packages/ui/components",
17
+ "packages/ui/lib",
18
+ "packages/ui/public",
19
+ "packages/ui/next-env.d.ts",
20
+ "packages/ui/next.config.js",
21
+ "packages/ui/package.json",
22
+ "packages/ui/postcss.config.js",
23
+ "packages/ui/tailwind.config.ts",
24
+ "packages/ui/tsconfig.json",
25
+ "README.md",
26
+ "PROJECT_STORY.md"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "workspaces": [
35
+ "packages/*"
36
+ ],
37
+ "scripts": {
38
+ "dev": "concurrently \"npm run dev:daemon\" \"npm run dev:ui\"",
39
+ "dev:daemon": "npm run dev --workspace=@chronicle/daemon",
40
+ "dev:cli": "npm run dev --workspace=@chronicle/cli",
41
+ "dev:ui": "npm run dev --workspace=@chronicle/ui",
42
+ "build": "npm run build --workspaces",
43
+ "test": "npm run test --workspaces",
44
+ "prepack": "npm run build"
45
+ },
46
+ "dependencies": {
47
+ "@google/genai": "^1.35.0",
48
+ "@google/generative-ai": "^0.24.1",
49
+ "@types/marked": "^5.0.2",
50
+ "@types/prompts": "^2.4.9",
51
+ "better-sqlite3": "^11.10.0",
52
+ "bullmq": "^5.1.0",
53
+ "chalk": "^5.3.0",
54
+ "chokidar": "^4.0.1",
55
+ "clsx": "^2.1.1",
56
+ "commander": "^11.1.0",
57
+ "date-fns": "^2.30.0",
58
+ "detect-port": "^2.1.0",
59
+ "dotenv": "^16.3.1",
60
+ "globby": "^16.1.0",
61
+ "google-auth-library": "^9.14.1",
62
+ "lucide-react": "^0.562.0",
63
+ "marked": "^17.0.1",
64
+ "next": "14.0.3",
65
+ "ora": "^7.0.1",
66
+ "plainjob": "^0.0.14",
67
+ "prompts": "^2.4.2",
68
+ "react": "^18",
69
+ "react-dom": "^18",
70
+ "simple-git": "^3.30.0",
71
+ "sqlite-vec": "^0.1.7-alpha.2",
72
+ "tailwind-merge": "^3.4.0"
73
+ },
74
+ "devDependencies": {
75
+ "@types/better-sqlite3": "^7.6.8",
76
+ "concurrently": "^8.2.0",
77
+ "tsx": "^4.20.6",
78
+ "typescript": "^5.3.3",
79
+ "@types/node": "^20.10.0",
80
+ "@types/react": "^18",
81
+ "@types/react-dom": "^18",
82
+ "autoprefixer": "^10.0.1",
83
+ "postcss": "^8",
84
+ "tailwindcss": "^3.3.0"
85
+ }
86
+ }
@@ -0,0 +1,139 @@
1
+ # Chronicle
2
+
3
+ **Chronicle** is a comprehensive developer tool designed to automate documentation and track project evolution through Generative AI. By combining a powerful CLI, a background daemon, and a modern web dashboard, Chronicle turns your codebase into "living documentation" that evolves alongside your Git history.
4
+
5
+ ## 🚀 Overview
6
+
7
+ Chronicle monitors your file system and Git changes to generate context-aware documentation updates. It employs an asynchronous job queue system to process code differentials, analyze logical flows, and visualize project architecture without manual intervention.
8
+
9
+ ### Key Features
10
+
11
+ - **Automated Documentation:** Leverages GenAI to write and update documentation based on code changes.
12
+ - **Evolution Tracking:** Visualizes how your project grows and changes over time using Git history.
13
+ - **Architecture Visualization:** Auto-generates Mermaid diagrams to map out project structure.
14
+ - **"Thinking" Process:** View the AI's reasoning and generation process in real-time via the UI.
15
+ - **Background Processing:** A daemon handles heavy lifting (file watching, AI API calls) to keep the developer experience smooth.
16
+
17
+ ## 🛠 Tech Stack
18
+
19
+ - **Core:** TypeScript, Node.js
20
+ - **Frontend:** Next.js, React, Tailwind CSS
21
+ - **AI Integration:** GenAI SDK
22
+ - **System:** Git, File System Watchers
23
+ - **Architecture:** Monorepo (CLI, Daemon, UI)
24
+
25
+ ## 📂 Project Structure
26
+
27
+ The project is organized as a monorepo with three primary packages:
28
+
29
+ ```text
30
+ Chronicle/
31
+ ├── cli/ # Command Line Interface tool
32
+ │ ├── src/
33
+ │ │ └── commands/ # init, add, diff, log, queue, etc.
34
+ │ └── bin/
35
+ ├── daemon/ # Background service & GenAI logic
36
+ │ ├── src/
37
+ │ │ └── index.ts # Entry point for the daemon
38
+ │ └── scripts/ # AI testing scripts
39
+ └── ui/ # Next.js Web Dashboard
40
+ ├── app/ # App router pages
41
+ ├── components/ # React components (ThinkingPanel, JobQueue, etc.)
42
+ └── public/
43
+ ```
44
+
45
+ ## 🏁 Getting Started
46
+
47
+ ### Prerequisites
48
+
49
+ - Node.js (v18+ recommended)
50
+ - Git installed and initialized in your target project
51
+ - Valid API credentials for the GenAI provider
52
+
53
+ ### Installation
54
+
55
+ 1. **Clone the repository:**
56
+ ```bash
57
+ git clone https://github.com/your-org/chronicle.git
58
+ cd chronicle
59
+ ```
60
+
61
+ 2. **Install dependencies:**
62
+ Chronicle uses a monorepo structure. You can install dependencies from the root if a workspace manager is configured, or install individually.
63
+ ```bash
64
+ # Example for root installation
65
+ npm install
66
+ # OR
67
+ pnpm install
68
+ ```
69
+
70
+ 3. **Environment Setup:**
71
+ Ensure you configure your AI API keys. Check `daemon/src/` or `daemon/test_ai_key.ts` for expected environment variables (typically `.env` files in the `daemon` and `ui` directories).
72
+
73
+ ### Running the System
74
+
75
+ To run Chronicle effectively, you need to run the Daemon and the UI, then control it via the CLI.
76
+
77
+ #### 1. Start the Daemon
78
+ The daemon watches files and processes the job queue.
79
+ ```bash
80
+ cd daemon
81
+ npm run dev
82
+ ```
83
+
84
+ #### 2. Start the UI Dashboard
85
+ Launch the web interface to view documentation and job status.
86
+ ```bash
87
+ cd ui
88
+ npm run dev
89
+ # Dashboard usually runs at http://localhost:3000
90
+ ```
91
+
92
+ #### 3. Use the CLI
93
+ Use the CLI to manage the chronicle instance within your target project.
94
+ ```bash
95
+ # Link the CLI globally (optional for development)
96
+ cd cli
97
+ npm link
98
+
99
+ # Initialize in a project
100
+ chronicle init
101
+
102
+ # Add files to be tracked
103
+ chronicle add .
104
+
105
+ # View the queue
106
+ chronicle queue
107
+ ```
108
+
109
+ ## 🖥 Usage
110
+
111
+ ### CLI Commands
112
+
113
+ - `chronicle init`: Initialize Chronicle in the current directory.
114
+ - `chronicle add [pattern]`: Add files or directories to the watch list.
115
+ - `chronicle diff`: Manually trigger a diff analysis.
116
+ - `chronicle log`: View the chronicle event log.
117
+ - `chronicle queue`: Check the status of the background job queue.
118
+ - `chronicle pause`: Temporarily pause file watching.
119
+
120
+ ### Web Dashboard
121
+
122
+ - **Project Content Area:** View generated documentation.
123
+ - **Thinking Panel:** Watch the GenAI analyze your code in real-time.
124
+ - **Job Queue:** Monitor pending and completed background tasks.
125
+ - **Diagrams:** View auto-generated Mermaid charts of your architecture.
126
+
127
+ ## 🤝 Contributing
128
+
129
+ Contributions are welcome! Please ensure you respect the monorepo structure and add types for any new features.
130
+
131
+ 1. Fork the repository.
132
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`).
133
+ 3. Commit your changes.
134
+ 4. Push to the branch.
135
+ 5. Open a Pull Request.
136
+
137
+ ## 📄 License
138
+
139
+ [MIT License](LICENSE)
@@ -0,0 +1,92 @@
1
+ # Chronicle
2
+
3
+ ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
4
+ ![Node.js](https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
5
+ ![License](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)
6
+
7
+ Chronicle is a high-performance command-line interface (CLI) utility built with TypeScript. It provides a robust framework for managing lifecycle operations and tracking tasks through a modular command pattern. Designed for efficiency, Chronicle allows users to initialize environments, control processes, and manage resources through a clean, intuitive command set.
8
+
9
+ ## 🚀 Key Features
10
+
11
+ - **Modular Command Architecture:** Easily extendable command structure.
12
+ - **Lifecycle Management:** Dedicated controls for starting, stopping, and initializing processes.
13
+ - **Resource Tracking:** Add and remove tasks or resources seamlessly.
14
+ - **Type-Safe:** Built entirely in TypeScript for reliable execution and developer experience.
15
+
16
+ ## 🛠 Tech Stack
17
+
18
+ - **Language:** TypeScript
19
+ - **Runtime:** Node.js
20
+ - **Pattern:** Modular Command Pattern
21
+
22
+ ## 📂 Project Structure
23
+
24
+ The project follows a clean, organized directory structure optimized for CLI development:
25
+
26
+ ```text
27
+ chronicle/
28
+ ├── bin/ # Compiled executable wrappers
29
+ ├── src/ # Source code
30
+ │ ├── commands/ # Modular command implementations
31
+ │ │ ├── add.ts # Logic for adding tasks/resources
32
+ │ │ ├── init.ts # Environment initialization logic
33
+ │ │ ├── remove.ts # Logic for removing resources
34
+ │ │ ├── start.ts # Process/Lifecycle initiation
35
+ │ │ └── stop.ts # Process/Lifecycle termination
36
+ │ └── index.ts # CLI entry point and dispatcher
37
+ ├── package.json # Project metadata and dependencies
38
+ └── tsconfig.json # TypeScript configuration
39
+ ```
40
+
41
+ ## 🏁 Getting Started
42
+
43
+ ### Prerequisites
44
+
45
+ - [Node.js](https://nodejs.org/) (v14.x or higher recommended)
46
+ - [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/)
47
+
48
+ ### Installation
49
+
50
+ 1. **Clone the repository:**
51
+ ```bash
52
+ git clone https://github.com/your-username/chronicle.git
53
+ cd chronicle
54
+ ```
55
+
56
+ 2. **Install dependencies:**
57
+ ```bash
58
+ npm install
59
+ ```
60
+
61
+ 3. **Build the project:**
62
+ ```bash
63
+ npm run build
64
+ ```
65
+
66
+ ### Usage
67
+
68
+ Once built, you can run the CLI directly or link it globally:
69
+
70
+ ```bash
71
+ # Link globally to use the 'chronicle' command
72
+ npm link
73
+
74
+ # Available Commands
75
+ chronicle init # Initialize the environment
76
+ chronicle add [task] # Add a new task to tracking
77
+ chronicle start # Start the lifecycle process
78
+ chronicle stop # Stop the lifecycle process
79
+ chronicle remove [task] # Remove a specific task
80
+ ```
81
+
82
+ ## 🏗 Development
83
+
84
+ To run the project in development mode using `ts-node`:
85
+
86
+ ```bash
87
+ npx ts-node src/index.ts [command]
88
+ ```
89
+
90
+ ## 📄 License
91
+
92
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/index.js');
@@ -0,0 +1,2 @@
1
+ export declare function add(projectPath?: string): Promise<void>;
2
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AASA,wBAAsB,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,iBAsE7C"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.add = add;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
10
+ const simple_git_1 = __importDefault(require("simple-git"));
11
+ const prompts_1 = __importDefault(require("prompts"));
12
+ const chalk_1 = __importDefault(require("chalk"));
13
+ const ora_1 = __importDefault(require("ora"));
14
+ const paths_1 = require("../utils/paths");
15
+ async function add(projectPath) {
16
+ // Resolve absolute path from arg or cwd
17
+ const targetDir = projectPath ? path_1.default.resolve(process.cwd(), projectPath) : process.cwd();
18
+ // Check if path exists
19
+ if (!fs_1.default.existsSync(targetDir)) {
20
+ console.error(chalk_1.default.red(`Directory not found: ${targetDir}`));
21
+ return;
22
+ }
23
+ const git = (0, simple_git_1.default)(targetDir);
24
+ const spinner = (0, ora_1.default)(`Checking project at ${targetDir}...`).start();
25
+ // 1. Check for Git
26
+ let isRepo = false;
27
+ try {
28
+ isRepo = await git.checkIsRepo();
29
+ }
30
+ catch (e) {
31
+ // simple-git might throw if dir is invalid, though fs check above handles mostly
32
+ isRepo = false;
33
+ }
34
+ if (!isRepo) {
35
+ spinner.stop();
36
+ console.log(chalk_1.default.yellow(`Directory ${targetDir} is not a git repository.`));
37
+ const response = await (0, prompts_1.default)({
38
+ type: 'confirm',
39
+ name: 'shouldInit',
40
+ message: 'Do you want to initialize a git repository here?',
41
+ initial: true
42
+ });
43
+ if (response.shouldInit) {
44
+ spinner.start('Initializing git repository...');
45
+ await git.init();
46
+ spinner.succeed('Git repository initialized.');
47
+ }
48
+ else {
49
+ console.log(chalk_1.default.red('Operation cancelled. Chronicle only monitors git repositories.'));
50
+ return;
51
+ }
52
+ }
53
+ else {
54
+ spinner.succeed('Git repository detected.');
55
+ }
56
+ // 2. Connect to Daemon DB
57
+ let dbPath;
58
+ try {
59
+ dbPath = (0, paths_1.getDaemonDbPath)();
60
+ }
61
+ catch (error) {
62
+ spinner.fail(chalk_1.default.red(error.message));
63
+ return;
64
+ }
65
+ const db = new better_sqlite3_1.default(dbPath);
66
+ // 3. Enqueue Job
67
+ try {
68
+ const stmt = db.prepare(`
69
+ INSERT INTO jobs (name, data, status)
70
+ VALUES (?, ?, 'pending')
71
+ `);
72
+ stmt.run('system:project_add', JSON.stringify({ path: targetDir, action: 'add' }));
73
+ console.log(chalk_1.default.green(`Added "${targetDir}" to monitoring queue.`));
74
+ }
75
+ catch (e) {
76
+ console.error(chalk_1.default.red(`Failed to add project: ${e.message}`));
77
+ }
78
+ finally {
79
+ db.close();
80
+ }
81
+ }
82
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";;;;;AASA,kBAsEC;AA/ED,gDAAwB;AACxB,4CAAoB;AACpB,oEAAsC;AACtC,4DAAmC;AACnC,sDAA8B;AAC9B,kDAA0B;AAC1B,8CAAsB;AACtB,0CAAiD;AAE1C,KAAK,UAAU,GAAG,CAAC,WAAoB;IAC1C,wCAAwC;IACxC,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAEzF,uBAAuB;IACvB,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC;QAC9D,OAAO;IACX,CAAC;IAED,MAAM,GAAG,GAAG,IAAA,oBAAS,EAAC,SAAS,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,uBAAuB,SAAS,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;IAEnE,mBAAmB;IACnB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC;QACD,MAAM,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;IACrC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,iFAAiF;QACjF,MAAM,GAAG,KAAK,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,aAAa,SAAS,2BAA2B,CAAC,CAAC,CAAC;QAE7E,MAAM,QAAQ,GAAG,MAAM,IAAA,iBAAO,EAAC;YAC3B,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,kDAAkD;YAC3D,OAAO,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;YACzF,OAAO;QACX,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;IAED,0BAA0B;IAC1B,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACD,MAAM,GAAG,IAAA,uBAAe,GAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACvC,OAAO;IACX,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,wBAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,iBAAiB;IACjB,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;;;SAGvB,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,UAAU,SAAS,wBAAwB,CAAC,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,0BAA2B,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;YAAS,CAAC;QACP,EAAE,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Trigger an incremental documentation update.
3
+ * This analyzes what changed since the last doc version and updates only affected docs.
4
+ * Similar to what happens when a commit is made or trigger conditions are met.
5
+ */
6
+ export declare function diff(projectPath?: string): Promise<void>;
7
+ /**
8
+ * View documentation version history and differences.
9
+ */
10
+ export declare function versions(projectPath?: string): Promise<void>;
11
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,iBAiD9C;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,iBAgHlD"}