@hiveforge/hivemind-mcp 2.6.1 → 2.7.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.
Files changed (113) hide show
  1. package/dist/cli/fix/fixer.d.ts +100 -0
  2. package/dist/cli/fix/fixer.d.ts.map +1 -0
  3. package/dist/cli/fix/fixer.js +256 -0
  4. package/dist/cli/fix/fixer.js.map +1 -0
  5. package/dist/cli/fix/formatter.d.ts +48 -0
  6. package/dist/cli/fix/formatter.d.ts.map +1 -0
  7. package/dist/cli/fix/formatter.js +159 -0
  8. package/dist/cli/fix/formatter.js.map +1 -0
  9. package/dist/cli/fix/id-generator.d.ts +48 -0
  10. package/dist/cli/fix/id-generator.d.ts.map +1 -0
  11. package/dist/cli/fix/id-generator.js +133 -0
  12. package/dist/cli/fix/id-generator.js.map +1 -0
  13. package/dist/cli/fix/index.d.ts +45 -0
  14. package/dist/cli/fix/index.d.ts.map +1 -0
  15. package/dist/cli/fix/index.js +239 -0
  16. package/dist/cli/fix/index.js.map +1 -0
  17. package/dist/cli/fix/types.d.ts +83 -0
  18. package/dist/cli/fix/types.d.ts.map +1 -0
  19. package/dist/cli/fix/types.js +8 -0
  20. package/dist/cli/fix/types.js.map +1 -0
  21. package/dist/cli/fix/writer.d.ts +44 -0
  22. package/dist/cli/fix/writer.d.ts.map +1 -0
  23. package/dist/cli/fix/writer.js +73 -0
  24. package/dist/cli/fix/writer.js.map +1 -0
  25. package/dist/cli/init/detection.d.ts +18 -0
  26. package/dist/cli/init/detection.d.ts.map +1 -0
  27. package/dist/cli/init/detection.js +40 -0
  28. package/dist/cli/init/detection.js.map +1 -0
  29. package/dist/cli/init/index.d.ts +27 -0
  30. package/dist/cli/init/index.d.ts.map +1 -0
  31. package/dist/cli/init/index.js +115 -0
  32. package/dist/cli/init/index.js.map +1 -0
  33. package/dist/cli/init/output.d.ts +58 -0
  34. package/dist/cli/init/output.d.ts.map +1 -0
  35. package/dist/cli/init/output.js +168 -0
  36. package/dist/cli/init/output.js.map +1 -0
  37. package/dist/cli/init/prompts.d.ts +28 -0
  38. package/dist/cli/init/prompts.d.ts.map +1 -0
  39. package/dist/cli/init/prompts.js +85 -0
  40. package/dist/cli/init/prompts.js.map +1 -0
  41. package/dist/cli/init/validators.d.ts +15 -0
  42. package/dist/cli/init/validators.d.ts.map +1 -0
  43. package/dist/cli/init/validators.js +48 -0
  44. package/dist/cli/init/validators.js.map +1 -0
  45. package/dist/cli/init/wizard.d.ts +22 -0
  46. package/dist/cli/init/wizard.d.ts.map +1 -0
  47. package/dist/cli/init/wizard.js +84 -0
  48. package/dist/cli/init/wizard.js.map +1 -0
  49. package/dist/cli/shared/clipboard.d.ts +2 -0
  50. package/dist/cli/shared/clipboard.d.ts.map +1 -0
  51. package/dist/cli/shared/clipboard.js +12 -0
  52. package/dist/cli/shared/clipboard.js.map +1 -0
  53. package/dist/cli/shared/colors.d.ts +6 -0
  54. package/dist/cli/shared/colors.d.ts.map +1 -0
  55. package/dist/cli/shared/colors.js +7 -0
  56. package/dist/cli/shared/colors.js.map +1 -0
  57. package/dist/cli/validate/formatter.d.ts +25 -0
  58. package/dist/cli/validate/formatter.d.ts.map +1 -0
  59. package/dist/cli/validate/formatter.js +156 -0
  60. package/dist/cli/validate/formatter.js.map +1 -0
  61. package/dist/cli/validate/index.d.ts +12 -0
  62. package/dist/cli/validate/index.d.ts.map +1 -0
  63. package/dist/cli/validate/index.js +105 -0
  64. package/dist/cli/validate/index.js.map +1 -0
  65. package/dist/cli/validate/scanner.d.ts +32 -0
  66. package/dist/cli/validate/scanner.d.ts.map +1 -0
  67. package/dist/cli/validate/scanner.js +114 -0
  68. package/dist/cli/validate/scanner.js.map +1 -0
  69. package/dist/cli/validate/types.d.ts +71 -0
  70. package/dist/cli/validate/types.d.ts.map +1 -0
  71. package/dist/cli/validate/types.js +7 -0
  72. package/dist/cli/validate/types.js.map +1 -0
  73. package/dist/cli/validate/validator.d.ts +24 -0
  74. package/dist/cli/validate/validator.d.ts.map +1 -0
  75. package/dist/cli/validate/validator.js +133 -0
  76. package/dist/cli/validate/validator.js.map +1 -0
  77. package/dist/cli.js +24 -353
  78. package/dist/cli.js.map +1 -1
  79. package/dist/comfyui/client.js +1 -1
  80. package/dist/comfyui/client.js.map +1 -1
  81. package/dist/graph/database.js +1 -1
  82. package/dist/graph/database.js.map +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/search/engine.js +1 -1
  86. package/dist/search/engine.js.map +1 -1
  87. package/dist/templates/builtin/people-management.d.ts.map +1 -1
  88. package/dist/templates/builtin/people-management.js +19 -0
  89. package/dist/templates/builtin/people-management.js.map +1 -1
  90. package/dist/templates/builtin/research.d.ts.map +1 -1
  91. package/dist/templates/builtin/research.js +18 -0
  92. package/dist/templates/builtin/research.js.map +1 -1
  93. package/dist/templates/builtin/worldbuilding.d.ts.map +1 -1
  94. package/dist/templates/builtin/worldbuilding.js +44 -0
  95. package/dist/templates/builtin/worldbuilding.js.map +1 -1
  96. package/dist/templates/folder-mapper.d.ts +61 -36
  97. package/dist/templates/folder-mapper.d.ts.map +1 -1
  98. package/dist/templates/folder-mapper.js +176 -53
  99. package/dist/templates/folder-mapper.js.map +1 -1
  100. package/dist/templates/registry.d.ts +11 -1
  101. package/dist/templates/registry.d.ts.map +1 -1
  102. package/dist/templates/registry.js +16 -0
  103. package/dist/templates/registry.js.map +1 -1
  104. package/dist/templates/types.d.ts +47 -0
  105. package/dist/templates/types.d.ts.map +1 -1
  106. package/dist/templates/validator.d.ts +15 -0
  107. package/dist/templates/validator.d.ts.map +1 -1
  108. package/dist/templates/validator.js +8 -0
  109. package/dist/templates/validator.js.map +1 -1
  110. package/dist/types/index.d.ts +5 -5
  111. package/dist/vault/reader.js +1 -1
  112. package/dist/vault/reader.js.map +1 -1
  113. package/package.json +8 -2
@@ -0,0 +1,100 @@
1
+ /**
2
+ * FileFixer - Core fix logic for generating frontmatter.
3
+ *
4
+ * Analyzes vault files with validation issues and generates operations
5
+ * to fix missing frontmatter. Does NOT modify files - only generates
6
+ * operations for the command handler to apply.
7
+ */
8
+ import type { FixOptions, FileOperation, AmbiguousFile } from './types.js';
9
+ /**
10
+ * FileFixer analyzes vault and generates fix operations.
11
+ *
12
+ * Uses ValidationScanner for file discovery and FolderMapper for type resolution.
13
+ * Preserves existing frontmatter values when adding missing fields.
14
+ */
15
+ export declare class FileFixer {
16
+ private options;
17
+ private folderMapper;
18
+ private existingIds;
19
+ private ambiguousFiles;
20
+ private pendingAmbiguous;
21
+ private typeResolutions;
22
+ constructor(options: FixOptions);
23
+ /**
24
+ * Initialize template registry and folder mapper.
25
+ *
26
+ * Must be called before analyze().
27
+ *
28
+ * @param activeTemplate - Template ID to activate
29
+ */
30
+ initialize(activeTemplate: string): Promise<void>;
31
+ /**
32
+ * Analyze vault and generate fix operations (does not modify files).
33
+ *
34
+ * Scans vault for files with validation issues, resolves entity types
35
+ * using folder mapping, and generates frontmatter for each fixable file.
36
+ *
37
+ * @returns Array of file operations to apply
38
+ */
39
+ analyze(): Promise<FileOperation[]>;
40
+ /**
41
+ * Create a fix operation for a single file.
42
+ *
43
+ * @param result - Validation result for the file
44
+ * @returns FileOperation or null if file can't be fixed
45
+ */
46
+ private createOperation;
47
+ /**
48
+ * Resolve entity type for a file path.
49
+ *
50
+ * Uses --type override if specified, otherwise folder mapping.
51
+ * Returns null if type is ambiguous and not in interactive mode.
52
+ *
53
+ * @param relativePath - Path relative to vault root
54
+ * @param result - Validation result (used to store pending for interactive resolution)
55
+ * @returns Entity type name or null
56
+ */
57
+ private resolveEntityType;
58
+ /**
59
+ * Generate frontmatter for a file.
60
+ *
61
+ * For files with NO frontmatter: generates full template with required fields.
62
+ * For files with partial frontmatter: adds only missing required fields.
63
+ *
64
+ * Required fields: id, type, status, tags, name
65
+ * Default values: status='draft', tags=[]
66
+ *
67
+ * @param filePath - Absolute path to file
68
+ * @param entityType - Resolved entity type
69
+ * @param existingData - Existing frontmatter (empty object if none)
70
+ * @returns Complete frontmatter object
71
+ */
72
+ private generateFrontmatter;
73
+ /**
74
+ * Get list of files with ambiguous type mappings.
75
+ *
76
+ * Returns unique folders with their possible types for prompting.
77
+ *
78
+ * @returns Array of ambiguous files grouped by folder
79
+ */
80
+ getAmbiguousFiles(): AmbiguousFile[];
81
+ /**
82
+ * Resolve ambiguous type for a folder.
83
+ *
84
+ * Stores the user's type selection for all files in that folder.
85
+ *
86
+ * @param folder - Folder path to resolve
87
+ * @param selectedType - Entity type selected by user
88
+ */
89
+ resolveAmbiguousType(folder: string, selectedType: string): void;
90
+ /**
91
+ * Process pending ambiguous files after user has resolved types.
92
+ *
93
+ * Creates operations for files that were skipped during analyze()
94
+ * due to ambiguous type mappings.
95
+ *
96
+ * @returns Array of file operations for resolved files
97
+ */
98
+ processPendingAmbiguous(): Promise<FileOperation[]>;
99
+ }
100
+ //# sourceMappingURL=fixer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixer.d.ts","sourceRoot":"","sources":["../../../src/cli/fix/fixer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3E;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,eAAe,CAAkC;gBAE7C,OAAO,EAAE,UAAU;IAI/B;;;;;;OAMG;IACG,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAkCzC;;;;;OAKG;YACW,eAAe;IAiD7B;;;;;;;;;OASG;YACW,iBAAiB;IAmD/B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,mBAAmB;IAoC3B;;;;;;OAMG;IACH,iBAAiB,IAAI,aAAa,EAAE;IAIpC;;;;;;;OAOG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAIhE;;;;;;;OAOG;IACG,uBAAuB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAe1D"}
@@ -0,0 +1,256 @@
1
+ /**
2
+ * FileFixer - Core fix logic for generating frontmatter.
3
+ *
4
+ * Analyzes vault files with validation issues and generates operations
5
+ * to fix missing frontmatter. Does NOT modify files - only generates
6
+ * operations for the command handler to apply.
7
+ */
8
+ import { promises as fs } from 'fs';
9
+ import { join, basename, dirname } from 'path';
10
+ import matter from 'gray-matter';
11
+ import { ValidationScanner } from '../validate/scanner.js';
12
+ import { templateRegistry } from '../../templates/registry.js';
13
+ import { FolderMapper } from '../../templates/folder-mapper.js';
14
+ import { initializeTemplateRegistry } from '../validate/validator.js';
15
+ import { collectExistingIds, generateUniqueId } from './id-generator.js';
16
+ /**
17
+ * FileFixer analyzes vault and generates fix operations.
18
+ *
19
+ * Uses ValidationScanner for file discovery and FolderMapper for type resolution.
20
+ * Preserves existing frontmatter values when adding missing fields.
21
+ */
22
+ export class FileFixer {
23
+ options;
24
+ folderMapper = null;
25
+ existingIds = new Set();
26
+ ambiguousFiles = [];
27
+ pendingAmbiguous = [];
28
+ typeResolutions = new Map();
29
+ constructor(options) {
30
+ this.options = options;
31
+ }
32
+ /**
33
+ * Initialize template registry and folder mapper.
34
+ *
35
+ * Must be called before analyze().
36
+ *
37
+ * @param activeTemplate - Template ID to activate
38
+ */
39
+ async initialize(activeTemplate) {
40
+ await initializeTemplateRegistry(activeTemplate);
41
+ const template = templateRegistry.getActive();
42
+ this.folderMapper = await FolderMapper.createFromTemplate(template?.folderMappings);
43
+ this.existingIds = await collectExistingIds(this.options.vaultPath);
44
+ }
45
+ /**
46
+ * Analyze vault and generate fix operations (does not modify files).
47
+ *
48
+ * Scans vault for files with validation issues, resolves entity types
49
+ * using folder mapping, and generates frontmatter for each fixable file.
50
+ *
51
+ * @returns Array of file operations to apply
52
+ */
53
+ async analyze() {
54
+ const operations = [];
55
+ // Use ValidationScanner to find files with issues
56
+ const scanner = new ValidationScanner({
57
+ vaultPath: this.options.vaultPath,
58
+ skipMissing: false, // We need to find files without frontmatter
59
+ ignorePatterns: this.options.ignorePatterns,
60
+ });
61
+ const results = await scanner.scan();
62
+ // Filter to files that need fixing
63
+ const fixableResults = results.filter((result) => {
64
+ if (result.valid)
65
+ return false;
66
+ // Only fix 'missing_frontmatter' or 'missing_field' issues
67
+ return result.issues.some((issue) => issue.type === 'missing_frontmatter' || issue.type === 'missing_field');
68
+ });
69
+ // Generate operations for each fixable file
70
+ for (const result of fixableResults) {
71
+ const operation = await this.createOperation(result);
72
+ if (operation) {
73
+ operations.push(operation);
74
+ }
75
+ }
76
+ return operations;
77
+ }
78
+ /**
79
+ * Create a fix operation for a single file.
80
+ *
81
+ * @param result - Validation result for the file
82
+ * @returns FileOperation or null if file can't be fixed
83
+ */
84
+ async createOperation(result) {
85
+ const filePath = join(this.options.vaultPath, result.path);
86
+ // Resolve entity type from folder or explicit override
87
+ const entityType = await this.resolveEntityType(result.path, result);
88
+ if (!entityType) {
89
+ // Ambiguous type and not in interactive mode - skip for now
90
+ return null;
91
+ }
92
+ // Read existing frontmatter
93
+ let existingFrontmatter = {};
94
+ let hasExistingFrontmatter = false;
95
+ try {
96
+ const content = await fs.readFile(filePath, 'utf-8');
97
+ const { data } = matter(content);
98
+ if (data && Object.keys(data).length > 0) {
99
+ existingFrontmatter = data;
100
+ hasExistingFrontmatter = true;
101
+ }
102
+ }
103
+ catch {
104
+ // File read error - skip
105
+ return null;
106
+ }
107
+ // Generate frontmatter
108
+ const frontmatter = this.generateFrontmatter(filePath, entityType, existingFrontmatter);
109
+ // Determine which fields are being added
110
+ const fieldsToAdd = Object.keys(frontmatter).filter((key) => !(key in existingFrontmatter));
111
+ return {
112
+ path: result.path,
113
+ entityType,
114
+ fieldsToAdd,
115
+ hasExistingFrontmatter,
116
+ frontmatter,
117
+ };
118
+ }
119
+ /**
120
+ * Resolve entity type for a file path.
121
+ *
122
+ * Uses --type override if specified, otherwise folder mapping.
123
+ * Returns null if type is ambiguous and not in interactive mode.
124
+ *
125
+ * @param relativePath - Path relative to vault root
126
+ * @param result - Validation result (used to store pending for interactive resolution)
127
+ * @returns Entity type name or null
128
+ */
129
+ async resolveEntityType(relativePath, result) {
130
+ // Explicit type override takes precedence
131
+ if (this.options.type) {
132
+ return this.options.type;
133
+ }
134
+ if (!this.folderMapper) {
135
+ return null;
136
+ }
137
+ // Check if folder has already been resolved by user
138
+ const folder = dirname(relativePath);
139
+ if (this.typeResolutions.has(folder)) {
140
+ return this.typeResolutions.get(folder);
141
+ }
142
+ const resolved = await this.folderMapper.resolveType(relativePath);
143
+ switch (resolved.confidence) {
144
+ case 'exact':
145
+ return resolved.types[0];
146
+ case 'ambiguous':
147
+ // In --yes mode, use first type (per 13-04 decision)
148
+ if (this.options.yes) {
149
+ return resolved.types[0];
150
+ }
151
+ // In interactive mode, store for later prompting
152
+ if (result) {
153
+ this.pendingAmbiguous.push(result);
154
+ // Track unique ambiguous files by folder
155
+ const existingFolder = this.ambiguousFiles.find(af => af.folder === folder);
156
+ if (!existingFolder) {
157
+ this.ambiguousFiles.push({
158
+ path: relativePath,
159
+ folder,
160
+ possibleTypes: resolved.types,
161
+ });
162
+ }
163
+ }
164
+ return null;
165
+ case 'fallback':
166
+ return resolved.types[0];
167
+ case 'none':
168
+ // No mapping - in --yes mode skip, otherwise would prompt
169
+ if (this.options.yes) {
170
+ return null;
171
+ }
172
+ return null;
173
+ }
174
+ }
175
+ /**
176
+ * Generate frontmatter for a file.
177
+ *
178
+ * For files with NO frontmatter: generates full template with required fields.
179
+ * For files with partial frontmatter: adds only missing required fields.
180
+ *
181
+ * Required fields: id, type, status, tags, name
182
+ * Default values: status='draft', tags=[]
183
+ *
184
+ * @param filePath - Absolute path to file
185
+ * @param entityType - Resolved entity type
186
+ * @param existingData - Existing frontmatter (empty object if none)
187
+ * @returns Complete frontmatter object
188
+ */
189
+ generateFrontmatter(filePath, entityType, existingData) {
190
+ const filename = basename(filePath);
191
+ const result = { ...existingData };
192
+ // ID - generate unique if not present
193
+ if (!('id' in result)) {
194
+ result.id = generateUniqueId(filename, entityType, this.existingIds);
195
+ }
196
+ // Type - always set to resolved type
197
+ if (!('type' in result)) {
198
+ result.type = entityType;
199
+ }
200
+ // Status - default to 'draft' per CONTEXT.md
201
+ if (!('status' in result)) {
202
+ result.status = 'draft';
203
+ }
204
+ // Tags - default to empty array
205
+ if (!('tags' in result)) {
206
+ result.tags = [];
207
+ }
208
+ // Name - derive from filename (preserve original case)
209
+ if (!('name' in result)) {
210
+ result.name = filename.replace(/\.md$/i, '');
211
+ }
212
+ return result;
213
+ }
214
+ /**
215
+ * Get list of files with ambiguous type mappings.
216
+ *
217
+ * Returns unique folders with their possible types for prompting.
218
+ *
219
+ * @returns Array of ambiguous files grouped by folder
220
+ */
221
+ getAmbiguousFiles() {
222
+ return this.ambiguousFiles;
223
+ }
224
+ /**
225
+ * Resolve ambiguous type for a folder.
226
+ *
227
+ * Stores the user's type selection for all files in that folder.
228
+ *
229
+ * @param folder - Folder path to resolve
230
+ * @param selectedType - Entity type selected by user
231
+ */
232
+ resolveAmbiguousType(folder, selectedType) {
233
+ this.typeResolutions.set(folder, selectedType);
234
+ }
235
+ /**
236
+ * Process pending ambiguous files after user has resolved types.
237
+ *
238
+ * Creates operations for files that were skipped during analyze()
239
+ * due to ambiguous type mappings.
240
+ *
241
+ * @returns Array of file operations for resolved files
242
+ */
243
+ async processPendingAmbiguous() {
244
+ const operations = [];
245
+ for (const result of this.pendingAmbiguous) {
246
+ const operation = await this.createOperation(result);
247
+ if (operation) {
248
+ operations.push(operation);
249
+ }
250
+ }
251
+ // Clear pending queue
252
+ this.pendingAmbiguous = [];
253
+ return operations;
254
+ }
255
+ }
256
+ //# sourceMappingURL=fixer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixer.js","sourceRoot":"","sources":["../../../src/cli/fix/fixer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIzE;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACZ,OAAO,CAAa;IACpB,YAAY,GAAwB,IAAI,CAAC;IACzC,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,cAAc,GAAoB,EAAE,CAAC;IACrC,gBAAgB,GAAuB,EAAE,CAAC;IAC1C,eAAe,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEzD,YAAY,OAAmB;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CAAC,cAAsB;QACrC,MAAM,0BAA0B,CAAC,cAAc,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACpF,IAAI,CAAC,WAAW,GAAG,M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I,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,oBAAoB,CAAC,MAAc,EAAE,YAAoB;QACvD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,uBAAuB;QAC3B,MAAM,UAAU,GAAoB,EAAE,CAAC;QAEvC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YACrD,IAAI,SAAS,EAAE,CAAC;gBACd,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,sBAAsB;QACtB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Output formatters for fix command.
3
+ *
4
+ * Provides dry-run preview (field names only, not values) and
5
+ * completion summary for --apply operations.
6
+ */
7
+ import type { FileOperation, FixResult, FixSummary } from './types.js';
8
+ import type { WriteResult } from './writer.js';
9
+ /**
10
+ * Format dry-run preview output.
11
+ *
12
+ * Shows field names only (not values) per CONTEXT.md decision.
13
+ * Groups output by entity type for readability.
14
+ *
15
+ * @param operations - File operations to preview
16
+ * @param verbose - Show individual file list (otherwise just counts)
17
+ * @returns Formatted output string
18
+ */
19
+ export declare function formatDryRunOutput(operations: FileOperation[], verbose: boolean): string;
20
+ /**
21
+ * Format completion summary after --apply.
22
+ *
23
+ * Shows count of fixed files and lists any failures.
24
+ *
25
+ * @param summary - Fix summary statistics
26
+ * @param writeResults - Results from file write operations
27
+ * @returns Formatted output string
28
+ */
29
+ export declare function formatApplyOutput(summary: FixSummary, writeResults: WriteResult[]): string;
30
+ /**
31
+ * Format JSON output for CI integration.
32
+ *
33
+ * Returns valid JSON with summary and file details.
34
+ * Grouped by file (not by issue type) per CONTEXT.md.
35
+ *
36
+ * @param result - Complete fix result
37
+ * @returns JSON string
38
+ */
39
+ export declare function formatJsonOutput(result: FixResult): string;
40
+ /**
41
+ * Format JSON output with failure details after --apply.
42
+ *
43
+ * @param result - Complete fix result
44
+ * @param writeResults - Results from file write operations
45
+ * @returns JSON string
46
+ */
47
+ export declare function formatJsonOutputWithResults(result: FixResult, writeResults: WriteResult[]): string;
48
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/cli/fix/formatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,aAAa,EAAE,EAC3B,OAAO,EAAE,OAAO,GACf,MAAM,CA6CR;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,WAAW,EAAE,GAC1B,MAAM,CA0CR;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAoB1D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,WAAW,EAAE,GAC1B,MAAM,CA+BR"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Output formatters for fix command.
3
+ *
4
+ * Provides dry-run preview (field names only, not values) and
5
+ * completion summary for --apply operations.
6
+ */
7
+ import { dim, bold, success, warn, error as errorColor } from '../shared/colors.js';
8
+ /**
9
+ * Format dry-run preview output.
10
+ *
11
+ * Shows field names only (not values) per CONTEXT.md decision.
12
+ * Groups output by entity type for readability.
13
+ *
14
+ * @param operations - File operations to preview
15
+ * @param verbose - Show individual file list (otherwise just counts)
16
+ * @returns Formatted output string
17
+ */
18
+ export function formatDryRunOutput(operations, verbose) {
19
+ if (operations.length === 0) {
20
+ return dim('No files need fixing.');
21
+ }
22
+ const lines = [];
23
+ lines.push(dim('Dry-run preview (no files modified):'));
24
+ lines.push('');
25
+ // Group by entity type
26
+ const byType = new Map();
27
+ for (const op of operations) {
28
+ if (!byType.has(op.entityType)) {
29
+ byType.set(op.entityType, []);
30
+ }
31
+ byType.get(op.entityType).push(op);
32
+ }
33
+ // Output each type group
34
+ for (const [type, ops] of byType) {
35
+ lines.push(`${bold(type)}: ${ops.length} file${ops.length === 1 ? '' : 's'}`);
36
+ if (verbose) {
37
+ // Show individual files in verbose mode
38
+ for (const op of ops) {
39
+ lines.push(` ${op.path}`);
40
+ if (op.fieldsToAdd.length > 0) {
41
+ lines.push(dim(` + ${op.fieldsToAdd.join(', ')}`));
42
+ }
43
+ }
44
+ }
45
+ lines.push('');
46
+ }
47
+ // Summary count
48
+ const totalFiles = operations.length;
49
+ lines.push(dim(`${totalFiles} file${totalFiles === 1 ? '' : 's'} to fix`));
50
+ lines.push('');
51
+ lines.push(dim('Run') + ' hivemind fix --apply ' + dim('to apply changes'));
52
+ return lines.join('\n');
53
+ }
54
+ /**
55
+ * Format completion summary after --apply.
56
+ *
57
+ * Shows count of fixed files and lists any failures.
58
+ *
59
+ * @param summary - Fix summary statistics
60
+ * @param writeResults - Results from file write operations
61
+ * @returns Formatted output string
62
+ */
63
+ export function formatApplyOutput(summary, writeResults) {
64
+ const lines = [];
65
+ // Count actual successes and failures from write results
66
+ const successes = writeResults.filter((r) => r.success);
67
+ const failures = writeResults.filter((r) => !r.success);
68
+ if (failures.length === 0) {
69
+ // All succeeded
70
+ lines.push(success(`Fixed ${successes.length} file${successes.length === 1 ? '' : 's'}.`));
71
+ }
72
+ else if (successes.length === 0) {
73
+ // All failed
74
+ lines.push(errorColor(`Failed to fix all ${failures.length} file${failures.length === 1 ? '' : 's'}:`));
75
+ for (const failure of failures) {
76
+ lines.push(` - ${failure.path}: ${failure.error}`);
77
+ }
78
+ }
79
+ else {
80
+ // Mixed results
81
+ lines.push(warn(`Fixed ${successes.length} file${successes.length === 1 ? '' : 's'}. ` +
82
+ `${failures.length} file${failures.length === 1 ? '' : 's'} could not be fixed:`));
83
+ for (const failure of failures) {
84
+ lines.push(` - ${failure.path}: ${failure.error}`);
85
+ }
86
+ }
87
+ // Add skipped files info if any
88
+ if (summary.skippedFiles > 0) {
89
+ lines.push('');
90
+ lines.push(dim(`${summary.skippedFiles} file${summary.skippedFiles === 1 ? '' : 's'} skipped (ambiguous type)`));
91
+ }
92
+ return lines.join('\n');
93
+ }
94
+ /**
95
+ * Format JSON output for CI integration.
96
+ *
97
+ * Returns valid JSON with summary and file details.
98
+ * Grouped by file (not by issue type) per CONTEXT.md.
99
+ *
100
+ * @param result - Complete fix result
101
+ * @returns JSON string
102
+ */
103
+ export function formatJsonOutput(result) {
104
+ const output = {
105
+ success: result.success,
106
+ applied: result.applied,
107
+ summary: {
108
+ totalFiles: result.summary.totalFiles,
109
+ fixedFiles: result.summary.fixedFiles,
110
+ skippedFiles: result.summary.skippedFiles,
111
+ failedFiles: result.summary.failedFiles,
112
+ byType: result.summary.byType,
113
+ },
114
+ files: result.operations.map((op) => ({
115
+ path: op.path,
116
+ type: op.entityType,
117
+ fieldsAdded: op.fieldsToAdd,
118
+ })),
119
+ failures: [],
120
+ };
121
+ return JSON.stringify(output, null, 2);
122
+ }
123
+ /**
124
+ * Format JSON output with failure details after --apply.
125
+ *
126
+ * @param result - Complete fix result
127
+ * @param writeResults - Results from file write operations
128
+ * @returns JSON string
129
+ */
130
+ export function formatJsonOutputWithResults(result, writeResults) {
131
+ const failures = writeResults
132
+ .filter((r) => !r.success)
133
+ .map((r) => ({
134
+ path: r.path,
135
+ error: r.error || 'Unknown error',
136
+ }));
137
+ const successes = writeResults.filter((r) => r.success);
138
+ const output = {
139
+ success: failures.length === 0,
140
+ applied: result.applied,
141
+ summary: {
142
+ totalFiles: result.summary.totalFiles,
143
+ fixedFiles: successes.length,
144
+ skippedFiles: result.summary.skippedFiles,
145
+ failedFiles: failures.length,
146
+ byType: result.summary.byType,
147
+ },
148
+ files: result.operations
149
+ .filter((op) => writeResults.find((r) => r.path === op.path)?.success)
150
+ .map((op) => ({
151
+ path: op.path,
152
+ type: op.entityType,
153
+ fieldsAdded: op.fieldsToAdd,
154
+ })),
155
+ failures,
156
+ };
157
+ return JSON.stringify(output, null, 2);
158
+ }
159
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../src/cli/fix/formatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIpF;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA2B,EAC3B,OAAgB;IAEhB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAC;IACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,uBAAuB;IACvB,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;IAClD,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAChC,CAA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AAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACZ,IAAI,EAAE,EAAE,CAAC,IAAI;YACb,IAAI,EAAE,EAAE,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,CAAC,WAAW;SAC5B,CAAC,CAAC;QACL,QAAQ;KACT,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ID generation for fix command.
3
+ *
4
+ * Creates unique slugified IDs from filenames with collision detection.
5
+ * Follows CONTEXT.md algorithm: base ID, then type-prefixed, then numbered.
6
+ */
7
+ /**
8
+ * Slugify a filename into a valid ID.
9
+ *
10
+ * Transformation:
11
+ * - Remove .md extension
12
+ * - Lowercase
13
+ * - Replace non-alphanumeric with hyphens
14
+ * - Collapse multiple hyphens
15
+ * - Remove leading/trailing hyphens
16
+ *
17
+ * @param filename - Filename to slugify (e.g., "John Smith.md")
18
+ * @returns Slugified ID (e.g., "john-smith")
19
+ */
20
+ export declare function slugifyFilename(filename: string): string;
21
+ /**
22
+ * Collect all existing IDs from markdown files in the vault.
23
+ *
24
+ * Scans all markdown files and extracts the `id` field from frontmatter.
25
+ * Used for collision detection when generating new IDs.
26
+ *
27
+ * @param vaultPath - Path to vault root
28
+ * @returns Set of existing IDs
29
+ */
30
+ export declare function collectExistingIds(vaultPath: string): Promise<Set<string>>;
31
+ /**
32
+ * Generate a unique ID for a file.
33
+ *
34
+ * Algorithm (per CONTEXT.md):
35
+ * 1. Generate base ID from slugified filename
36
+ * 2. If no collision, return base ID
37
+ * 3. If collision, prepend entity type: `{entityType}-{baseId}`
38
+ * 4. If still collision, add counter: `{entityType}-{baseId}-2`, `-3`, etc.
39
+ *
40
+ * IMPORTANT: Adds generated ID to existingIds set for subsequent calls.
41
+ *
42
+ * @param filename - Filename to generate ID from
43
+ * @param entityType - Entity type for prefix when collision occurs
44
+ * @param existingIds - Set of existing IDs (mutated to add new ID)
45
+ * @returns Unique ID string
46
+ */
47
+ export declare function generateUniqueId(filename: string, entityType: string, existingIds: Set<string>): string;
48
+ //# sourceMappingURL=id-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../../src/cli/fix/id-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcxD;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAoBhF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GACvB,MAAM,CAyBR"}