@cxtmanager/core 1.0.1 → 1.0.7

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.
package/README.md CHANGED
@@ -1,132 +1,132 @@
1
- # @cxtmanager/core
2
-
3
- Core library for CxtManager - context file management and Git integration.
4
-
5
- ## Philosophy
6
-
7
- **Manager, not Enforcer.** This package provides the infrastructure for managing AI project context files, but never enforces what content goes into them. It's a framework-agnostic library that can be used by CLI tools, IDE extensions, web apps, or any other interface.
8
-
9
- ## What It Does
10
-
11
- - **Context File Management** - Create, read, update context files (context.md, plan.md, guardrail.md)
12
- - **Git Integration** - Version control for context files using Git
13
- - **Branch Awareness** - Automatic switching of plan.md content based on Git branches
14
- - **Validation** - Check context file alignment and consistency
15
- - **Template Generation** - Provide structure templates (you fill the content)
16
- - **Git Hooks** - Manage Git hooks for automatic context synchronization
17
-
18
- ## Core Concepts
19
-
20
- ### Context Files
21
- - `context.md` - High-level project truth (stable, rarely changes)
22
- - `plan.md` - Feature-specific implementation (changes per branch)
23
- - `guardrail.md` - Universal constraints and rules
24
-
25
- ### Branch Awareness
26
- `plan.md` content is branch-specific. When you switch Git branches, CxtManager automatically:
27
- 1. Saves current branch's plan.md to `.plan-history/`
28
- 2. Restores the target branch's plan.md (or creates template if new)
29
-
30
- ### Alignment
31
- Context files should cross-reference each other and tell a consistent story. The validation engine checks for:
32
- - Structural consistency
33
- - Cross-references
34
- - Template-only content warnings
35
- - Drift detection (code changes outpacing context updates)
36
-
37
- ## Installation
38
-
39
- ```bash
40
- npm install @cxtmanager/core
41
- ```
42
-
43
- ## Usage
44
-
45
- ```typescript
46
- import { ContextManager } from '@cxtmanager/core';
47
-
48
- const manager = new ContextManager(projectRoot);
49
-
50
- // Initialize context files
51
- await manager.init({
52
- templateStyle: 'minimal',
53
- autoInstallHooks: true,
54
- updateMode: 'manual'
55
- });
56
-
57
- // Check if initialized
58
- const isInit = await manager.isInitialized();
59
-
60
- // Get status
61
- const status = await manager.getStatus();
62
-
63
- // Validate alignment
64
- const validation = await manager.validate();
65
-
66
- // Sync plan.md for current branch
67
- const result = await manager.syncPlan();
68
- ```
69
-
70
- ## API Overview
71
-
72
- ### ContextManager
73
- Main orchestrator class for context file operations.
74
-
75
- ### GitRepository
76
- Handles all Git operations (commits, diffs, history, etc.).
77
-
78
- ### PlanManager
79
- Manages branch-specific plan.md content and switching.
80
-
81
- ### ValidationEngine
82
- Checks context file alignment, structure, and completeness.
83
-
84
- ### GitHooksManager
85
- Manages Git hook installation and removal.
86
-
87
- ## Configuration
88
-
89
- Configuration is stored in `.cxt/.cxtconfig.json`:
90
-
91
- ```json
92
- {
93
- "version": "1.0.0",
94
- "template_style": "minimal",
95
- "git_integration": {
96
- "auto_install_hooks": true
97
- },
98
- "plan_management": {
99
- "branch_aware": true
100
- },
101
- "context": {
102
- "update_mode": "manual",
103
- "drift_detection": {
104
- "enabled": true,
105
- "warn_threshold": 3
106
- },
107
- "template_thresholds": {
108
- "well_populated": 30,
109
- "mild_warning": 50,
110
- "critical": 70
111
- }
112
- }
113
- }
114
- ```
115
-
116
- ## Development
117
-
118
- ```bash
119
- # Build
120
- npm run build
121
-
122
- # Test
123
- npm test
124
-
125
- # Watch mode
126
- npm run dev
127
- ```
128
-
129
- ## License
130
-
131
- AGPL-3.0
132
-
1
+ # @cxtmanager/core
2
+
3
+ Core library for CxtManager - context file management and Git integration.
4
+
5
+ ## Philosophy
6
+
7
+ **Manager, not Enforcer.** This package provides the infrastructure for managing AI project context files, but never enforces what content goes into them. It's a framework-agnostic library that can be used by CLI tools, IDE extensions, web apps, or any other interface.
8
+
9
+ ## What It Does
10
+
11
+ - **Context File Management** - Create, read, update context files (context.md, plan.md, guardrail.md)
12
+ - **Git Integration** - Version control for context files using Git
13
+ - **Branch Awareness** - Automatic switching of plan.md content based on Git branches
14
+ - **Validation** - Check context file alignment and consistency
15
+ - **Template Generation** - Provide structure templates (you fill the content)
16
+ - **Git Hooks** - Manage Git hooks for automatic context synchronization
17
+
18
+ ## Core Concepts
19
+
20
+ ### Context Files
21
+ - `context.md` - High-level project truth (stable, rarely changes)
22
+ - `plan.md` - Feature-specific implementation (changes per branch)
23
+ - `guardrail.md` - Universal constraints and rules
24
+
25
+ ### Branch Awareness
26
+ `plan.md` content is branch-specific. When you switch Git branches, CxtManager automatically:
27
+ 1. Saves current branch's plan.md to `.plan-history/`
28
+ 2. Restores the target branch's plan.md (or creates template if new)
29
+
30
+ ### Alignment
31
+ Context files should cross-reference each other and tell a consistent story. The validation engine checks for:
32
+ - Structural consistency
33
+ - Cross-references
34
+ - Template-only content warnings
35
+ - Drift detection (code changes outpacing context updates)
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ npm install @cxtmanager/core
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ```typescript
46
+ import { ContextManager } from '@cxtmanager/core';
47
+
48
+ const manager = new ContextManager(projectRoot);
49
+
50
+ // Initialize context files
51
+ await manager.init({
52
+ templateStyle: 'minimal',
53
+ autoInstallHooks: true,
54
+ updateMode: 'manual'
55
+ });
56
+
57
+ // Check if initialized
58
+ const isInit = await manager.isInitialized();
59
+
60
+ // Get status
61
+ const status = await manager.getStatus();
62
+
63
+ // Validate alignment
64
+ const validation = await manager.validate();
65
+
66
+ // Sync plan.md for current branch
67
+ const result = await manager.syncPlan();
68
+ ```
69
+
70
+ ## API Overview
71
+
72
+ ### ContextManager
73
+ Main orchestrator class for context file operations.
74
+
75
+ ### GitRepository
76
+ Handles all Git operations (commits, diffs, history, etc.).
77
+
78
+ ### PlanManager
79
+ Manages branch-specific plan.md content and switching.
80
+
81
+ ### ValidationEngine
82
+ Checks context file alignment, structure, and completeness.
83
+
84
+ ### GitHooksManager
85
+ Manages Git hook installation and removal.
86
+
87
+ ## Configuration
88
+
89
+ Configuration is stored in `.cxt/.cxtconfig.json`:
90
+
91
+ ```json
92
+ {
93
+ "version": "1.0.0",
94
+ "template_style": "minimal",
95
+ "git_integration": {
96
+ "auto_install_hooks": true
97
+ },
98
+ "plan_management": {
99
+ "branch_aware": true
100
+ },
101
+ "context": {
102
+ "update_mode": "manual",
103
+ "drift_detection": {
104
+ "enabled": true,
105
+ "warn_threshold": 3
106
+ },
107
+ "template_thresholds": {
108
+ "well_populated": 30,
109
+ "mild_warning": 50,
110
+ "critical": 70
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## Development
117
+
118
+ ```bash
119
+ # Build
120
+ npm run build
121
+
122
+ # Test
123
+ npm test
124
+
125
+ # Watch mode
126
+ npm run dev
127
+ ```
128
+
129
+ ## License
130
+
131
+ AGPL-3.0
132
+
@@ -1 +1 @@
1
- {"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../src/context-manager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAmB,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1I,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,MAAM,CAA0B;gBAE5B,WAAW,GAAE,MAAsB;IASzC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA6DzC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAMjC,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAiB7B,QAAQ,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAiB7D;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B,QAAQ,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,MAA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