@howlil/ez-agents 3.4.2 → 3.5.0
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 +77 -2
- package/agents/ez-observer-agent.md +260 -0
- package/agents/ez-release-agent.md +333 -0
- package/agents/ez-requirements-agent.md +377 -0
- package/agents/ez-scrum-master-agent.md +242 -0
- package/agents/ez-tech-lead-agent.md +267 -0
- package/bin/install.js +3221 -3272
- package/commands/ez/arch-review.md +102 -0
- package/commands/ez/execute-phase.md +11 -0
- package/commands/ez/export-session.md +79 -0
- package/commands/ez/gather-requirements.md +117 -0
- package/commands/ez/git-workflow.md +72 -0
- package/commands/ez/hotfix.md +120 -0
- package/commands/ez/import-session.md +82 -0
- package/commands/ez/list-sessions.md +96 -0
- package/commands/ez/package-manager.md +316 -0
- package/commands/ez/plan-phase.md +9 -1
- package/commands/ez/preflight.md +79 -0
- package/commands/ez/progress.md +13 -1
- package/commands/ez/release.md +153 -0
- package/commands/ez/resume.md +107 -0
- package/commands/ez/standup.md +85 -0
- package/ez-agents/bin/ez-tools.cjs +1095 -716
- package/ez-agents/bin/lib/bdd-validator.cjs +622 -0
- package/ez-agents/bin/lib/content-scanner.cjs +238 -0
- package/ez-agents/bin/lib/context-cache.cjs +154 -0
- package/ez-agents/bin/lib/context-errors.cjs +71 -0
- package/ez-agents/bin/lib/context-manager.cjs +220 -0
- package/ez-agents/bin/lib/discussion-synthesizer.cjs +458 -0
- package/ez-agents/bin/lib/file-access.cjs +207 -0
- package/ez-agents/bin/lib/git-errors.cjs +83 -0
- package/ez-agents/bin/lib/git-utils.cjs +321 -203
- package/ez-agents/bin/lib/git-workflow-engine.cjs +1157 -0
- package/ez-agents/bin/lib/index.cjs +46 -2
- package/ez-agents/bin/lib/lockfile-validator.cjs +227 -0
- package/ez-agents/bin/lib/logger.cjs +124 -154
- package/ez-agents/bin/lib/memory-compression.cjs +256 -0
- package/ez-agents/bin/lib/metrics-tracker.cjs +406 -0
- package/ez-agents/bin/lib/package-manager-detector.cjs +203 -0
- package/ez-agents/bin/lib/package-manager-executor.cjs +385 -0
- package/ez-agents/bin/lib/package-manager-service.cjs +216 -0
- package/ez-agents/bin/lib/release-validator.cjs +614 -0
- package/ez-agents/bin/lib/safe-exec.cjs +128 -214
- package/ez-agents/bin/lib/session-chain.cjs +304 -0
- package/ez-agents/bin/lib/session-errors.cjs +81 -0
- package/ez-agents/bin/lib/session-export.cjs +251 -0
- package/ez-agents/bin/lib/session-import.cjs +262 -0
- package/ez-agents/bin/lib/session-manager.cjs +280 -0
- package/ez-agents/bin/lib/tier-manager.cjs +428 -0
- package/ez-agents/bin/lib/url-fetch.cjs +170 -0
- package/ez-agents/references/metrics-schema.md +118 -0
- package/ez-agents/references/planning-config.md +140 -0
- package/ez-agents/references/tier-strategy.md +103 -0
- package/ez-agents/templates/bdd-feature.md +173 -0
- package/ez-agents/templates/discussion.md +68 -0
- package/ez-agents/templates/incident-runbook.md +205 -0
- package/ez-agents/templates/release-checklist.md +133 -0
- package/ez-agents/templates/rollback-plan.md +201 -0
- package/ez-agents/workflows/arch-review.md +54 -0
- package/ez-agents/workflows/autonomous.md +844 -743
- package/ez-agents/workflows/execute-phase.md +45 -0
- package/ez-agents/workflows/export-session.md +255 -0
- package/ez-agents/workflows/gather-requirements.md +206 -0
- package/ez-agents/workflows/help.md +92 -0
- package/ez-agents/workflows/hotfix.md +291 -0
- package/ez-agents/workflows/import-session.md +303 -0
- package/ez-agents/workflows/new-milestone.md +713 -384
- package/ez-agents/workflows/new-project.md +1107 -1113
- package/ez-agents/workflows/plan-phase.md +22 -0
- package/ez-agents/workflows/progress.md +15 -25
- package/ez-agents/workflows/release.md +253 -0
- package/ez-agents/workflows/resume-session.md +215 -0
- package/ez-agents/workflows/standup.md +64 -0
- package/package.json +9 -2
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Package Manager Service — Unified package manager operations
|
|
5
|
+
*
|
|
6
|
+
* High-level service that integrates detection, execution, and validation:
|
|
7
|
+
* - Automatic package manager detection with priority-based strategy
|
|
8
|
+
* - Lockfile validation before operations
|
|
9
|
+
* - Unified interface for install, add, remove operations
|
|
10
|
+
* - Configuration-driven defaults from .planning/config.json
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* const PackageManagerService = require('./package-manager-service.cjs');
|
|
14
|
+
* const service = new PackageManagerService(cwd);
|
|
15
|
+
* await service.initialize();
|
|
16
|
+
* await service.install({ frozenLockfile: true });
|
|
17
|
+
* await service.add(['lodash'], { dev: true });
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
const Logger = require('./logger.cjs');
|
|
23
|
+
const PackageManagerDetector = require('./package-manager-detector.cjs');
|
|
24
|
+
const PackageManagerExecutor = require('./package-manager-executor.cjs');
|
|
25
|
+
const LockfileValidator = require('./lockfile-validator.cjs');
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Package Manager Service class
|
|
29
|
+
* Provides unified interface for package manager operations
|
|
30
|
+
*/
|
|
31
|
+
class PackageManagerService {
|
|
32
|
+
/**
|
|
33
|
+
* Create a PackageManagerService instance
|
|
34
|
+
* @param {string} cwd - Working directory (default: process.cwd())
|
|
35
|
+
*/
|
|
36
|
+
constructor(cwd = process.cwd()) {
|
|
37
|
+
this.cwd = cwd;
|
|
38
|
+
this.logger = new Logger();
|
|
39
|
+
this.detector = new PackageManagerDetector(cwd);
|
|
40
|
+
this.validator = new LockfileValidator(cwd);
|
|
41
|
+
this.executor = null;
|
|
42
|
+
this.currentManager = null;
|
|
43
|
+
this.detectionSource = null;
|
|
44
|
+
this.initialized = false;
|
|
45
|
+
this.config = this._loadConfig();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initialize the package manager service
|
|
50
|
+
* @param {Object} options - Initialization options
|
|
51
|
+
* @param {string} [options.forceManager] - Force specific package manager
|
|
52
|
+
* @returns {Promise<void>}
|
|
53
|
+
*/
|
|
54
|
+
async initialize(options = {}) {
|
|
55
|
+
const { forceManager } = options;
|
|
56
|
+
|
|
57
|
+
this.logger.info('Initializing package manager service', {
|
|
58
|
+
cwd: this.cwd,
|
|
59
|
+
forceManager
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Detect package manager
|
|
63
|
+
let detection;
|
|
64
|
+
if (forceManager) {
|
|
65
|
+
detection = {
|
|
66
|
+
manager: forceManager,
|
|
67
|
+
source: 'override',
|
|
68
|
+
confidence: 'high'
|
|
69
|
+
};
|
|
70
|
+
this.logger.info('Using forced package manager', { manager: forceManager });
|
|
71
|
+
} else {
|
|
72
|
+
detection = this.detector.detect();
|
|
73
|
+
this.logger.info('Package manager detected', {
|
|
74
|
+
manager: detection.manager,
|
|
75
|
+
source: detection.source,
|
|
76
|
+
confidence: detection.confidence
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Validate detection
|
|
81
|
+
if (!detection.manager) {
|
|
82
|
+
throw new Error('No package manager detected or available');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Create executor
|
|
86
|
+
this.executor = new PackageManagerExecutor(detection.manager, this.cwd);
|
|
87
|
+
this.currentManager = detection.manager;
|
|
88
|
+
this.detectionSource = detection.source;
|
|
89
|
+
|
|
90
|
+
// Validate lockfile if present
|
|
91
|
+
const lockfileValidation = this.validator.validate(detection.manager);
|
|
92
|
+
if (!lockfileValidation.valid) {
|
|
93
|
+
this.logger.warn('Lockfile validation failed', {
|
|
94
|
+
manager: detection.manager,
|
|
95
|
+
reason: lockfileValidation.reason,
|
|
96
|
+
message: lockfileValidation.message
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
this.logger.debug('Lockfile validated', {
|
|
100
|
+
manager: detection.manager,
|
|
101
|
+
lockfileVersion: lockfileValidation.lockfileVersion,
|
|
102
|
+
packageCount: lockfileValidation.packageCount || lockfileValidation.entryCount
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.initialized = true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Ensure service is initialized
|
|
111
|
+
* @private
|
|
112
|
+
* @returns {Promise<void>}
|
|
113
|
+
*/
|
|
114
|
+
async _ensureInitialized() {
|
|
115
|
+
if (!this.initialized) {
|
|
116
|
+
await this.initialize();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Install dependencies
|
|
122
|
+
* @param {Object} options - Install options
|
|
123
|
+
* @param {boolean} [options.production] - Production install (exclude devDependencies)
|
|
124
|
+
* @param {boolean} [options.frozenLockfile] - Use frozen lockfile (CI/CD safe)
|
|
125
|
+
* @param {boolean} [options.preferOffline] - Prefer offline cache
|
|
126
|
+
* @returns {Promise<string>} Command output
|
|
127
|
+
*/
|
|
128
|
+
async install(options = {}) {
|
|
129
|
+
await this._ensureInitialized();
|
|
130
|
+
|
|
131
|
+
this.logger.info('Installing dependencies', {
|
|
132
|
+
manager: this.currentManager,
|
|
133
|
+
options
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return await this.executor.install(options);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Add package(s) to project
|
|
141
|
+
* @param {string|string[]} packages - Package name(s) to add
|
|
142
|
+
* @param {Object} options - Add options
|
|
143
|
+
* @param {boolean} [options.dev] - Add as devDependency
|
|
144
|
+
* @param {boolean} [options.peer] - Add as peerDependency
|
|
145
|
+
* @param {boolean} [options.optional] - Add as optionalDependency
|
|
146
|
+
* @param {boolean} [options.global] - Install globally
|
|
147
|
+
* @returns {Promise<string>} Command output
|
|
148
|
+
*/
|
|
149
|
+
async add(packages, options = {}) {
|
|
150
|
+
await this._ensureInitialized();
|
|
151
|
+
|
|
152
|
+
const packageArray = Array.isArray(packages) ? packages : [packages];
|
|
153
|
+
|
|
154
|
+
this.logger.info('Adding packages', {
|
|
155
|
+
manager: this.currentManager,
|
|
156
|
+
packages: packageArray,
|
|
157
|
+
options
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return await this.executor.add(packageArray, options);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Remove package(s) from project
|
|
165
|
+
* @param {string|string[]} packages - Package name(s) to remove
|
|
166
|
+
* @param {Object} options - Remove options
|
|
167
|
+
* @param {boolean} [options.global] - Remove from global install
|
|
168
|
+
* @returns {Promise<string>} Command output
|
|
169
|
+
*/
|
|
170
|
+
async remove(packages, options = {}) {
|
|
171
|
+
await this._ensureInitialized();
|
|
172
|
+
|
|
173
|
+
const packageArray = Array.isArray(packages) ? packages : [packages];
|
|
174
|
+
|
|
175
|
+
this.logger.info('Removing packages', {
|
|
176
|
+
manager: this.currentManager,
|
|
177
|
+
packages: packageArray,
|
|
178
|
+
options
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return await this.executor.remove(packageArray, options);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get current package manager information
|
|
186
|
+
* @returns {Object} Package manager info
|
|
187
|
+
*/
|
|
188
|
+
getInfo() {
|
|
189
|
+
return {
|
|
190
|
+
manager: this.currentManager,
|
|
191
|
+
source: this.detectionSource,
|
|
192
|
+
cwd: this.cwd,
|
|
193
|
+
lockfile: this.detector.getLockfilePath(this.currentManager)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Load configuration from .planning/config.json
|
|
199
|
+
* @private
|
|
200
|
+
* @returns {Object} Configuration object
|
|
201
|
+
*/
|
|
202
|
+
_loadConfig() {
|
|
203
|
+
const configPath = path.join(this.cwd, '.planning', 'config.json');
|
|
204
|
+
try {
|
|
205
|
+
if (fs.existsSync(configPath)) {
|
|
206
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
207
|
+
return JSON.parse(content);
|
|
208
|
+
}
|
|
209
|
+
} catch (err) {
|
|
210
|
+
this.logger.warn('Failed to load config', { path: configPath, error: err.message });
|
|
211
|
+
}
|
|
212
|
+
return {};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
module.exports = PackageManagerService;
|