@lovelybunch/core 1.0.3
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/dist/change-proposal.d.ts +71 -0
- package/dist/change-proposal.d.ts.map +1 -0
- package/dist/change-proposal.js +205 -0
- package/dist/change-proposal.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown-storage.d.ts +34 -0
- package/dist/markdown-storage.d.ts.map +1 -0
- package/dist/markdown-storage.js +356 -0
- package/dist/markdown-storage.js.map +1 -0
- package/dist/migration.d.ts +57 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +250 -0
- package/dist/migration.js.map +1 -0
- package/dist/storage.d.ts +57 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +403 -0
- package/dist/storage.js.map +1 -0
- package/dist/unified-storage.d.ts +59 -0
- package/dist/unified-storage.d.ts.map +1 -0
- package/dist/unified-storage.js +199 -0
- package/dist/unified-storage.js.map +1 -0
- package/dist/validation.d.ts +62 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +500 -0
- package/dist/validation.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { FileStorageAdapter } from './storage.js';
|
|
2
|
+
import { MarkdownStorageAdapter } from './markdown-storage.js';
|
|
3
|
+
import { migrationManager } from './migration.js';
|
|
4
|
+
/**
|
|
5
|
+
* Unified storage adapter that automatically detects and handles both JSON and Markdown formats
|
|
6
|
+
* Provides backward compatibility during the migration period
|
|
7
|
+
*/
|
|
8
|
+
export class UnifiedStorageAdapter {
|
|
9
|
+
jsonStorage;
|
|
10
|
+
markdownStorage;
|
|
11
|
+
preferredFormat;
|
|
12
|
+
constructor(basePath = '.gait', preferredFormat = 'markdown') {
|
|
13
|
+
this.jsonStorage = new FileStorageAdapter(basePath);
|
|
14
|
+
this.markdownStorage = new MarkdownStorageAdapter(basePath);
|
|
15
|
+
this.preferredFormat = preferredFormat;
|
|
16
|
+
}
|
|
17
|
+
async init() {
|
|
18
|
+
// Initialize both storage adapters
|
|
19
|
+
await this.jsonStorage.init();
|
|
20
|
+
await this.markdownStorage.init();
|
|
21
|
+
}
|
|
22
|
+
async saveProposal(proposal) {
|
|
23
|
+
// Save using preferred format
|
|
24
|
+
if (this.preferredFormat === 'markdown') {
|
|
25
|
+
await this.markdownStorage.saveProposal(proposal);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
await this.jsonStorage.saveProposal(proposal);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async loadProposal(id) {
|
|
32
|
+
// Try to load from both formats, preferring the configured format
|
|
33
|
+
if (this.preferredFormat === 'markdown') {
|
|
34
|
+
// Try markdown first, then JSON as fallback
|
|
35
|
+
const markdownProposal = await this.markdownStorage.loadProposal(id);
|
|
36
|
+
if (markdownProposal) {
|
|
37
|
+
return markdownProposal;
|
|
38
|
+
}
|
|
39
|
+
return await this.jsonStorage.loadProposal(id);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Try JSON first, then markdown as fallback
|
|
43
|
+
const jsonProposal = await this.jsonStorage.loadProposal(id);
|
|
44
|
+
if (jsonProposal) {
|
|
45
|
+
return jsonProposal;
|
|
46
|
+
}
|
|
47
|
+
return await this.markdownStorage.loadProposal(id);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async loadAllProposals() {
|
|
51
|
+
// Load from both formats and merge, avoiding duplicates
|
|
52
|
+
const [jsonProposals, markdownProposals] = await Promise.all([
|
|
53
|
+
this.jsonStorage.loadAllProposals(),
|
|
54
|
+
this.markdownStorage.loadAllProposals()
|
|
55
|
+
]);
|
|
56
|
+
// Create a map to avoid duplicates (prefer the configured format)
|
|
57
|
+
const proposalMap = new Map();
|
|
58
|
+
// Add proposals from non-preferred format first
|
|
59
|
+
const nonPreferredProposals = this.preferredFormat === 'markdown' ? jsonProposals : markdownProposals;
|
|
60
|
+
const preferredProposals = this.preferredFormat === 'markdown' ? markdownProposals : jsonProposals;
|
|
61
|
+
nonPreferredProposals.forEach(proposal => {
|
|
62
|
+
proposalMap.set(proposal.id, proposal);
|
|
63
|
+
});
|
|
64
|
+
// Add proposals from preferred format (will overwrite duplicates)
|
|
65
|
+
preferredProposals.forEach(proposal => {
|
|
66
|
+
proposalMap.set(proposal.id, proposal);
|
|
67
|
+
});
|
|
68
|
+
return Array.from(proposalMap.values());
|
|
69
|
+
}
|
|
70
|
+
async deleteProposal(id) {
|
|
71
|
+
// Delete from both formats to ensure cleanup
|
|
72
|
+
const [jsonDeleted, markdownDeleted] = await Promise.all([
|
|
73
|
+
this.jsonStorage.deleteProposal(id),
|
|
74
|
+
this.markdownStorage.deleteProposal(id)
|
|
75
|
+
]);
|
|
76
|
+
return jsonDeleted || markdownDeleted;
|
|
77
|
+
}
|
|
78
|
+
async saveConfig(config) {
|
|
79
|
+
// Config is always saved as JSON for now
|
|
80
|
+
await this.jsonStorage.saveConfig(config);
|
|
81
|
+
}
|
|
82
|
+
async loadConfig() {
|
|
83
|
+
return await this.jsonStorage.loadConfig();
|
|
84
|
+
}
|
|
85
|
+
async isInitialized() {
|
|
86
|
+
return await this.jsonStorage.isInitialized();
|
|
87
|
+
}
|
|
88
|
+
getBasePath() {
|
|
89
|
+
return this.jsonStorage.getBasePath();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the current storage format being used
|
|
93
|
+
*/
|
|
94
|
+
async getCurrentFormat() {
|
|
95
|
+
return await migrationManager.detectCurrentFormat();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Set the preferred format for new proposals
|
|
99
|
+
*/
|
|
100
|
+
setPreferredFormat(format) {
|
|
101
|
+
this.preferredFormat = format;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the preferred format
|
|
105
|
+
*/
|
|
106
|
+
getPreferredFormat() {
|
|
107
|
+
return this.preferredFormat;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Auto-migrate to preferred format if needed
|
|
111
|
+
*/
|
|
112
|
+
async autoMigrate(options = {}) {
|
|
113
|
+
const currentFormat = await this.getCurrentFormat();
|
|
114
|
+
// No migration needed if already using preferred format or no proposals exist
|
|
115
|
+
if (currentFormat === this.preferredFormat || currentFormat === 'none') {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
// Don't auto-migrate mixed format without force
|
|
119
|
+
if (currentFormat === 'mixed' && !options.force) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
if (this.preferredFormat === 'markdown') {
|
|
124
|
+
const result = await migrationManager.migrateToMarkdown({
|
|
125
|
+
backupOriginals: true,
|
|
126
|
+
dryRun: false
|
|
127
|
+
});
|
|
128
|
+
return result.success;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const result = await migrationManager.migrateToJson({
|
|
132
|
+
backupOriginals: true,
|
|
133
|
+
dryRun: false
|
|
134
|
+
});
|
|
135
|
+
return result.success;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
console.error('Auto-migration failed:', error);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get storage statistics
|
|
145
|
+
*/
|
|
146
|
+
async getStorageStats() {
|
|
147
|
+
const stats = await migrationManager.getMigrationStats();
|
|
148
|
+
return {
|
|
149
|
+
...stats,
|
|
150
|
+
preferredFormat: this.preferredFormat
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Validate storage integrity
|
|
155
|
+
*/
|
|
156
|
+
async validateStorage() {
|
|
157
|
+
const issues = [];
|
|
158
|
+
const duplicates = [];
|
|
159
|
+
try {
|
|
160
|
+
const [jsonProposals, markdownProposals] = await Promise.all([
|
|
161
|
+
this.jsonStorage.loadAllProposals(),
|
|
162
|
+
this.markdownStorage.loadAllProposals()
|
|
163
|
+
]);
|
|
164
|
+
// Check for duplicates
|
|
165
|
+
const jsonIds = new Set(jsonProposals.map(p => p.id));
|
|
166
|
+
const markdownIds = new Set(markdownProposals.map(p => p.id));
|
|
167
|
+
for (const id of jsonIds) {
|
|
168
|
+
if (markdownIds.has(id)) {
|
|
169
|
+
duplicates.push(id);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (duplicates.length > 0) {
|
|
173
|
+
issues.push(`Found ${duplicates.length} duplicate proposals across formats: ${duplicates.join(', ')}`);
|
|
174
|
+
}
|
|
175
|
+
// Validate each proposal can be loaded
|
|
176
|
+
const allProposals = await this.loadAllProposals();
|
|
177
|
+
for (const proposal of allProposals) {
|
|
178
|
+
if (!proposal.id || !proposal.intent || !proposal.author) {
|
|
179
|
+
issues.push(`Proposal ${proposal.id || 'unknown'} is missing required fields`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
valid: issues.length === 0,
|
|
184
|
+
issues,
|
|
185
|
+
duplicates
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return {
|
|
190
|
+
valid: false,
|
|
191
|
+
issues: [`Storage validation failed: ${error}`],
|
|
192
|
+
duplicates: []
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Export a singleton instance with markdown as preferred format
|
|
198
|
+
export const unifiedStorage = new UnifiedStorageAdapter('.gait', 'markdown');
|
|
199
|
+
//# sourceMappingURL=unified-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-storage.js","sourceRoot":"","sources":["../src/unified-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAA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AqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChangeProposal, Author, PlanStep, Evidence, FeatureFlag, Experiment } from '@lovelybunch/types';
|
|
2
|
+
export interface ValidationError {
|
|
3
|
+
field: string;
|
|
4
|
+
message: string;
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
}
|
|
7
|
+
export interface ValidationResult {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
errors: ValidationError[];
|
|
10
|
+
warnings: ValidationError[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Comprehensive validation utilities for GAIT data structures
|
|
14
|
+
*/
|
|
15
|
+
export declare class ValidationManager {
|
|
16
|
+
/**
|
|
17
|
+
* Validate a Change Proposal
|
|
18
|
+
*/
|
|
19
|
+
validateChangeProposal(proposal: ChangeProposal): ValidationResult;
|
|
20
|
+
/**
|
|
21
|
+
* Validate an Author
|
|
22
|
+
*/
|
|
23
|
+
validateAuthor(author: Author): ValidationResult;
|
|
24
|
+
/**
|
|
25
|
+
* Validate a Plan Step
|
|
26
|
+
*/
|
|
27
|
+
validatePlanStep(step: PlanStep, index: number): ValidationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Validate Evidence
|
|
30
|
+
*/
|
|
31
|
+
validateEvidence(evidence: Evidence, index: number): ValidationResult;
|
|
32
|
+
/**
|
|
33
|
+
* Validate Feature Flag
|
|
34
|
+
*/
|
|
35
|
+
validateFeatureFlag(flag: FeatureFlag, index: number): ValidationResult;
|
|
36
|
+
/**
|
|
37
|
+
* Validate Experiment
|
|
38
|
+
*/
|
|
39
|
+
validateExperiment(experiment: Experiment, index: number): ValidationResult;
|
|
40
|
+
/**
|
|
41
|
+
* Validate YAML frontmatter structure
|
|
42
|
+
*/
|
|
43
|
+
validateYamlFrontmatter(frontmatter: any): ValidationResult;
|
|
44
|
+
/**
|
|
45
|
+
* Validate markdown content structure
|
|
46
|
+
*/
|
|
47
|
+
validateMarkdownContent(content: string): ValidationResult;
|
|
48
|
+
/**
|
|
49
|
+
* Helper method to validate email format
|
|
50
|
+
*/
|
|
51
|
+
private isValidEmail;
|
|
52
|
+
/**
|
|
53
|
+
* Helper method to validate ISO date format
|
|
54
|
+
*/
|
|
55
|
+
private isValidISODate;
|
|
56
|
+
/**
|
|
57
|
+
* Format validation results for display
|
|
58
|
+
*/
|
|
59
|
+
formatValidationResults(result: ValidationResult): string;
|
|
60
|
+
}
|
|
61
|
+
export declare const validationManager: ValidationManager;
|
|
62
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAE5B;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,gBAAgB;IA4HlE;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB;IA2ChD;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAoDjE;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB;IA4CrE;;OAEG;IACH,mBAAm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