faf-cli 2.4.21 → 2.5.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.
- package/README.md +244 -129
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/commands/auto.d.ts.map +1 -1
- package/dist/commands/auto.js +63 -2
- package/dist/commands/auto.js.map +1 -1
- package/dist/commands/bi-sync.d.ts +9 -6
- package/dist/commands/bi-sync.d.ts.map +1 -1
- package/dist/commands/bi-sync.js +31 -16
- package/dist/commands/bi-sync.js.map +1 -1
- package/dist/commands/index.js +1 -6
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +8 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/score-v3.d.ts.map +1 -1
- package/dist/commands/score-v3.js +12 -6
- package/dist/commands/score-v3.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +17 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/compiler/faf-compiler.js +1 -1
- package/dist/engines/c-mirror/broadcast/terminal-display.d.ts +23 -0
- package/dist/engines/c-mirror/broadcast/terminal-display.d.ts.map +1 -0
- package/dist/engines/c-mirror/broadcast/terminal-display.js +193 -0
- package/dist/engines/c-mirror/broadcast/terminal-display.js.map +1 -0
- package/dist/engines/c-mirror/core/claude-to-faf.d.ts +28 -0
- package/dist/engines/c-mirror/core/claude-to-faf.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/claude-to-faf.js +222 -0
- package/dist/engines/c-mirror/core/claude-to-faf.js.map +1 -0
- package/dist/engines/c-mirror/core/events/event-emitter.d.ts +36 -0
- package/dist/engines/c-mirror/core/events/event-emitter.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/events/event-emitter.js +71 -0
- package/dist/engines/c-mirror/core/events/event-emitter.js.map +1 -0
- package/dist/engines/c-mirror/core/events/mirror-events.d.ts +103 -0
- package/dist/engines/c-mirror/core/events/mirror-events.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/events/mirror-events.js +65 -0
- package/dist/engines/c-mirror/core/events/mirror-events.js.map +1 -0
- package/dist/engines/c-mirror/core/faf-to-claude.d.ts +18 -0
- package/dist/engines/c-mirror/core/faf-to-claude.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/faf-to-claude.js +195 -0
- package/dist/engines/c-mirror/core/faf-to-claude.js.map +1 -0
- package/dist/engines/c-mirror/core/interfaces.d.ts +153 -0
- package/dist/engines/c-mirror/core/interfaces.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/interfaces.js +8 -0
- package/dist/engines/c-mirror/core/interfaces.js.map +1 -0
- package/dist/engines/c-mirror/core/mirror-engine.d.ts +48 -0
- package/dist/engines/c-mirror/core/mirror-engine.d.ts.map +1 -0
- package/dist/engines/c-mirror/core/mirror-engine.js +273 -0
- package/dist/engines/c-mirror/core/mirror-engine.js.map +1 -0
- package/dist/engines/c-mirror/faf-extensions/faf-mirror.d.ts +31 -0
- package/dist/engines/c-mirror/faf-extensions/faf-mirror.d.ts.map +1 -0
- package/dist/engines/c-mirror/faf-extensions/faf-mirror.js +101 -0
- package/dist/engines/c-mirror/faf-extensions/faf-mirror.js.map +1 -0
- package/dist/engines/c-mirror/strategies/atomic-write.d.ts +34 -0
- package/dist/engines/c-mirror/strategies/atomic-write.d.ts.map +1 -0
- package/dist/engines/c-mirror/strategies/atomic-write.js +132 -0
- package/dist/engines/c-mirror/strategies/atomic-write.js.map +1 -0
- package/dist/engines/faf-dna.d.ts.map +1 -1
- package/dist/engines/faf-dna.js +33 -14
- package/dist/engines/faf-dna.js.map +1 -1
- package/dist/utils/championship-core.d.ts +127 -0
- package/dist/utils/championship-core.d.ts.map +1 -0
- package/dist/utils/championship-core.js +205 -0
- package/dist/utils/championship-core.js.map +1 -0
- package/dist/utils/championship-style.d.ts +2 -2
- package/dist/utils/championship-style.d.ts.map +1 -1
- package/dist/utils/championship-style.js +8 -6
- package/dist/utils/championship-style.js.map +1 -1
- package/dist/utils/color-utils.d.ts.map +1 -1
- package/dist/utils/color-utils.js +29 -11
- package/dist/utils/color-utils.js.map +1 -1
- package/dist/utils/yaml-generator.d.ts.map +1 -1
- package/dist/utils/yaml-generator.js +9 -4
- package/dist/utils/yaml-generator.js.map +1 -1
- package/package.json +18 -3
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🏗️ C-Mirror Core Interfaces
|
|
3
|
+
* TypeScript strict mode - All interfaces for the mirror system
|
|
4
|
+
* Extraction-ready: Generic, reusable, well-defined
|
|
5
|
+
*/
|
|
6
|
+
import { SyncDirection, IntegrityStatus, ScoreData } from './events/mirror-events';
|
|
7
|
+
/**
|
|
8
|
+
* Mirror Configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface IMirrorConfig {
|
|
11
|
+
structuredFile: string;
|
|
12
|
+
readableFile: string;
|
|
13
|
+
projectPath?: string;
|
|
14
|
+
schema?: IYAMLSchema;
|
|
15
|
+
validators?: IValidator[];
|
|
16
|
+
dnaChain?: IDNAChainConfig;
|
|
17
|
+
conflictStrategy?: ConflictStrategy;
|
|
18
|
+
atomicWrites?: boolean;
|
|
19
|
+
selfHealing?: boolean;
|
|
20
|
+
silent?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Mirror Result
|
|
24
|
+
*/
|
|
25
|
+
export interface IMirrorResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
direction: SyncDirection;
|
|
28
|
+
filesChanged: string[];
|
|
29
|
+
conflicts: string[];
|
|
30
|
+
duration: number;
|
|
31
|
+
integrity: IntegrityStatus;
|
|
32
|
+
score?: ScoreData;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* YAML Schema Interface
|
|
37
|
+
*/
|
|
38
|
+
export interface IYAMLSchema {
|
|
39
|
+
requiredFields: string[];
|
|
40
|
+
optionalFields: string[];
|
|
41
|
+
validate(data: any): SchemaValidationResult;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Schema Validation Result
|
|
45
|
+
*/
|
|
46
|
+
export interface SchemaValidationResult {
|
|
47
|
+
valid: boolean;
|
|
48
|
+
errors: string[];
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Validator Interface
|
|
53
|
+
*/
|
|
54
|
+
export interface IValidator {
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
validate(data: any): ValidationResult;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validation Result
|
|
61
|
+
*/
|
|
62
|
+
export interface ValidationResult {
|
|
63
|
+
valid: boolean;
|
|
64
|
+
errors?: string[];
|
|
65
|
+
warnings?: string[];
|
|
66
|
+
metadata?: Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* DNA Chain Configuration
|
|
70
|
+
*/
|
|
71
|
+
export interface IDNAChainConfig {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
path?: string;
|
|
74
|
+
logLevel?: 'minimal' | 'standard' | 'verbose';
|
|
75
|
+
maxEntries?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* DNA Chain Entry
|
|
79
|
+
*/
|
|
80
|
+
export interface IDNAChainEntry {
|
|
81
|
+
timestamp: Date;
|
|
82
|
+
event: string;
|
|
83
|
+
score?: ScoreData;
|
|
84
|
+
integrity: IntegrityStatus;
|
|
85
|
+
filesChanged: string[];
|
|
86
|
+
duration: number;
|
|
87
|
+
metadata?: Record<string, any>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Conflict Resolution Strategy
|
|
91
|
+
*/
|
|
92
|
+
export type ConflictStrategy = 'faf-wins' | 'claude-wins' | 'merge' | 'prompt' | 'abort';
|
|
93
|
+
/**
|
|
94
|
+
* File State (for conflict detection)
|
|
95
|
+
*/
|
|
96
|
+
export interface FileState {
|
|
97
|
+
path: string;
|
|
98
|
+
exists: boolean;
|
|
99
|
+
modified?: Date;
|
|
100
|
+
size?: number;
|
|
101
|
+
hash?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Conflict
|
|
105
|
+
*/
|
|
106
|
+
export interface Conflict {
|
|
107
|
+
type: 'both-modified' | 'missing-file' | 'schema-mismatch' | 'validation-failed';
|
|
108
|
+
file1: FileState;
|
|
109
|
+
file2: FileState;
|
|
110
|
+
message: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Merge Result
|
|
114
|
+
*/
|
|
115
|
+
export interface MergeResult {
|
|
116
|
+
success: boolean;
|
|
117
|
+
merged: any;
|
|
118
|
+
conflicts: string[];
|
|
119
|
+
warnings: string[];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Integrity Status
|
|
123
|
+
*/
|
|
124
|
+
export interface IntegrityCheckResult {
|
|
125
|
+
status: IntegrityStatus;
|
|
126
|
+
checks: {
|
|
127
|
+
yamlValid: boolean;
|
|
128
|
+
markdownValid: boolean;
|
|
129
|
+
roundTripValid: boolean;
|
|
130
|
+
scoreAccurate: boolean;
|
|
131
|
+
};
|
|
132
|
+
errors: string[];
|
|
133
|
+
warnings: string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Restore Options
|
|
137
|
+
*/
|
|
138
|
+
export interface RestoreOptions {
|
|
139
|
+
fromDNA?: boolean;
|
|
140
|
+
timestamp?: Date;
|
|
141
|
+
entryIndex?: number;
|
|
142
|
+
dryRun?: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Restore Result
|
|
146
|
+
*/
|
|
147
|
+
export interface RestoreResult {
|
|
148
|
+
success: boolean;
|
|
149
|
+
filesRestored: string[];
|
|
150
|
+
scoreRestored?: ScoreData;
|
|
151
|
+
error?: string;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0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H,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;IACjF,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,GAAG,CAAC;IACZ,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE;QACN,SAAS,EAAE,OAAO,CAAC;QACnB,aAAa,EAAE,OAAO,CAAC;QACvB,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🏗️ C-Mirror Core Interfaces
|
|
4
|
+
* TypeScript strict mode - All interfaces for the mirror system
|
|
5
|
+
* Extraction-ready: Generic, reusable, well-defined
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/engines/c-mirror/core/interfaces.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔗 Mirror Engine - The Orchestrator
|
|
3
|
+
* Coordinates all C-Mirror operations
|
|
4
|
+
*
|
|
5
|
+
* This is the main engine that:
|
|
6
|
+
* - Detects which files need syncing
|
|
7
|
+
* - Calls the transformation functions
|
|
8
|
+
* - Uses atomic writes for safety
|
|
9
|
+
* - Emits events for broadcasting
|
|
10
|
+
* - Ensures zero slippage
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* const engine = new MirrorEngine(config);
|
|
14
|
+
* const result = await engine.sync();
|
|
15
|
+
*/
|
|
16
|
+
import { IMirrorConfig, IMirrorResult } from './interfaces';
|
|
17
|
+
export declare class MirrorEngine {
|
|
18
|
+
private config;
|
|
19
|
+
private projectPath;
|
|
20
|
+
constructor(config: IMirrorConfig);
|
|
21
|
+
/**
|
|
22
|
+
* Main sync operation
|
|
23
|
+
* Intelligently syncs .faf ↔ CLAUDE.md
|
|
24
|
+
*/
|
|
25
|
+
sync(): Promise<IMirrorResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Analyze file states to determine what needs syncing
|
|
28
|
+
*/
|
|
29
|
+
private analyzeFiles;
|
|
30
|
+
/**
|
|
31
|
+
* Determine sync strategy based on file states
|
|
32
|
+
*/
|
|
33
|
+
private determineSyncStrategy;
|
|
34
|
+
/**
|
|
35
|
+
* Sync .faf → CLAUDE.md
|
|
36
|
+
*/
|
|
37
|
+
private syncFafToClaude;
|
|
38
|
+
/**
|
|
39
|
+
* Sync CLAUDE.md → .faf
|
|
40
|
+
*/
|
|
41
|
+
private syncClaudeToFaf;
|
|
42
|
+
/**
|
|
43
|
+
* Verify integrity after sync
|
|
44
|
+
* Ensures mirror is perfect
|
|
45
|
+
*/
|
|
46
|
+
private verifyIntegrity;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=mirror-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirror-engine.d.ts","sourceRoot":"","sources":["../../../../src/engines/c-mirror/core/mirror-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AAOvE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,aAAa;IASjC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IA2EpC;;OAEG;YACW,YAAY;IA4B1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA4C7B;;OAEG;YACW,eAAe;IAgB7B;;OAEG;YACW,eAAe;IAwB7B;;;OAGG;YACW,eAAe;CAkD9B"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🔗 Mirror Engine - The Orchestrator
|
|
4
|
+
* Coordinates all C-Mirror operations
|
|
5
|
+
*
|
|
6
|
+
* This is the main engine that:
|
|
7
|
+
* - Detects which files need syncing
|
|
8
|
+
* - Calls the transformation functions
|
|
9
|
+
* - Uses atomic writes for safety
|
|
10
|
+
* - Emits events for broadcasting
|
|
11
|
+
* - Ensures zero slippage
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* const engine = new MirrorEngine(config);
|
|
15
|
+
* const result = await engine.sync();
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.MirrorEngine = void 0;
|
|
52
|
+
const YAML = __importStar(require("yaml"));
|
|
53
|
+
const faf_to_claude_1 = require("./faf-to-claude");
|
|
54
|
+
const claude_to_faf_1 = require("./claude-to-faf");
|
|
55
|
+
const atomic_write_1 = require("../strategies/atomic-write");
|
|
56
|
+
const event_emitter_1 = require("./events/event-emitter");
|
|
57
|
+
const mirror_events_1 = require("./events/mirror-events");
|
|
58
|
+
class MirrorEngine {
|
|
59
|
+
config;
|
|
60
|
+
projectPath;
|
|
61
|
+
constructor(config) {
|
|
62
|
+
this.config = {
|
|
63
|
+
atomicWrites: true, // Default to safe writes
|
|
64
|
+
selfHealing: true, // Default to auto-recovery
|
|
65
|
+
...config
|
|
66
|
+
};
|
|
67
|
+
this.projectPath = config.projectPath || process.cwd();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Main sync operation
|
|
71
|
+
* Intelligently syncs .faf ↔ CLAUDE.md
|
|
72
|
+
*/
|
|
73
|
+
async sync() {
|
|
74
|
+
const startTime = Date.now();
|
|
75
|
+
const result = {
|
|
76
|
+
success: false,
|
|
77
|
+
direction: 'none',
|
|
78
|
+
filesChanged: [],
|
|
79
|
+
conflicts: [],
|
|
80
|
+
duration: 0,
|
|
81
|
+
integrity: 'perfect'
|
|
82
|
+
};
|
|
83
|
+
try {
|
|
84
|
+
// Step 1: Analyze file states
|
|
85
|
+
const analysis = await this.analyzeFiles();
|
|
86
|
+
// Step 2: Determine sync strategy
|
|
87
|
+
const strategy = this.determineSyncStrategy(analysis);
|
|
88
|
+
result.direction = strategy;
|
|
89
|
+
// Step 3: Execute sync based on strategy
|
|
90
|
+
if (strategy === 'none') {
|
|
91
|
+
// No sync needed
|
|
92
|
+
result.success = true;
|
|
93
|
+
result.duration = Date.now() - startTime;
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
if (strategy === 'faf-to-claude') {
|
|
97
|
+
await this.syncFafToClaude(analysis);
|
|
98
|
+
result.filesChanged.push(this.config.readableFile);
|
|
99
|
+
}
|
|
100
|
+
else if (strategy === 'claude-to-faf') {
|
|
101
|
+
await this.syncClaudeToFaf(analysis);
|
|
102
|
+
result.filesChanged.push(this.config.structuredFile);
|
|
103
|
+
}
|
|
104
|
+
else if (strategy === 'bidirectional') {
|
|
105
|
+
// Both files changed - attempt intelligent merge
|
|
106
|
+
// For now, faf wins (can be enhanced later)
|
|
107
|
+
await this.syncFafToClaude(analysis);
|
|
108
|
+
result.filesChanged.push(this.config.readableFile);
|
|
109
|
+
result.conflicts.push('Both files modified - .faf took precedence');
|
|
110
|
+
}
|
|
111
|
+
// Step 4: Verify integrity
|
|
112
|
+
const integrityCheck = await this.verifyIntegrity();
|
|
113
|
+
result.integrity = integrityCheck.status;
|
|
114
|
+
// Step 5: Success
|
|
115
|
+
result.success = true;
|
|
116
|
+
result.duration = Date.now() - startTime;
|
|
117
|
+
// EMIT: Score update (if available)
|
|
118
|
+
if (integrityCheck.score) {
|
|
119
|
+
event_emitter_1.mirrorEvents.emitMirrorEvent((0, mirror_events_1.createMirrorEvent)(mirror_events_1.MirrorEventType.SCORE_UPDATE, {
|
|
120
|
+
score: integrityCheck.score
|
|
121
|
+
}, {
|
|
122
|
+
projectPath: this.projectPath,
|
|
123
|
+
score: integrityCheck.score,
|
|
124
|
+
duration: result.duration
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
result.success = false;
|
|
131
|
+
result.error = error instanceof Error ? error.message : String(error);
|
|
132
|
+
result.duration = Date.now() - startTime;
|
|
133
|
+
result.integrity = 'failed';
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Analyze file states to determine what needs syncing
|
|
139
|
+
*/
|
|
140
|
+
async analyzeFiles() {
|
|
141
|
+
const fafPath = this.config.structuredFile;
|
|
142
|
+
const claudePath = this.config.readableFile;
|
|
143
|
+
const fafExists = await (0, atomic_write_1.fileExists)(fafPath);
|
|
144
|
+
const claudeExists = await (0, atomic_write_1.fileExists)(claudePath);
|
|
145
|
+
const fafModified = fafExists ? await (0, atomic_write_1.getFileModifiedTime)(fafPath) : null;
|
|
146
|
+
const claudeModified = claudeExists ? await (0, atomic_write_1.getFileModifiedTime)(claudePath) : null;
|
|
147
|
+
const fafState = {
|
|
148
|
+
path: fafPath,
|
|
149
|
+
exists: fafExists,
|
|
150
|
+
modified: fafModified || undefined
|
|
151
|
+
};
|
|
152
|
+
const claudeState = {
|
|
153
|
+
path: claudePath,
|
|
154
|
+
exists: claudeExists,
|
|
155
|
+
modified: claudeModified || undefined
|
|
156
|
+
};
|
|
157
|
+
return { fafState, claudeState };
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Determine sync strategy based on file states
|
|
161
|
+
*/
|
|
162
|
+
determineSyncStrategy(analysis) {
|
|
163
|
+
const { fafState, claudeState } = analysis;
|
|
164
|
+
// If neither exists, nothing to sync
|
|
165
|
+
if (!fafState.exists && !claudeState.exists) {
|
|
166
|
+
return 'none';
|
|
167
|
+
}
|
|
168
|
+
// If only .faf exists, create CLAUDE.md
|
|
169
|
+
if (fafState.exists && !claudeState.exists) {
|
|
170
|
+
return 'faf-to-claude';
|
|
171
|
+
}
|
|
172
|
+
// If only CLAUDE.md exists, create .faf (unusual but handle it)
|
|
173
|
+
if (!fafState.exists && claudeState.exists) {
|
|
174
|
+
return 'claude-to-faf';
|
|
175
|
+
}
|
|
176
|
+
// Both exist - check modification times
|
|
177
|
+
if (fafState.modified && claudeState.modified) {
|
|
178
|
+
const fafTime = fafState.modified.getTime();
|
|
179
|
+
const claudeTime = claudeState.modified.getTime();
|
|
180
|
+
// If .faf is newer, sync to CLAUDE.md
|
|
181
|
+
if (fafTime > claudeTime) {
|
|
182
|
+
return 'faf-to-claude';
|
|
183
|
+
}
|
|
184
|
+
// If CLAUDE.md is newer, sync to .faf
|
|
185
|
+
if (claudeTime > fafTime) {
|
|
186
|
+
return 'claude-to-faf';
|
|
187
|
+
}
|
|
188
|
+
// If same time, no sync needed
|
|
189
|
+
return 'none';
|
|
190
|
+
}
|
|
191
|
+
// Default: faf to claude
|
|
192
|
+
return 'faf-to-claude';
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Sync .faf → CLAUDE.md
|
|
196
|
+
*/
|
|
197
|
+
async syncFafToClaude(analysis) {
|
|
198
|
+
const fafContent = await (0, atomic_write_1.safeRead)(this.config.structuredFile, this.projectPath);
|
|
199
|
+
const claudeMdContent = await (0, faf_to_claude_1.fafToClaudeMd)(fafContent, this.projectPath);
|
|
200
|
+
if (this.config.atomicWrites) {
|
|
201
|
+
await (0, atomic_write_1.atomicWrite)(this.config.readableFile, claudeMdContent, this.projectPath);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Direct write (not recommended)
|
|
205
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
206
|
+
await fs.writeFile(this.config.readableFile, claudeMdContent, 'utf-8');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Sync CLAUDE.md → .faf
|
|
211
|
+
*/
|
|
212
|
+
async syncClaudeToFaf(analysis) {
|
|
213
|
+
const claudeContent = await (0, atomic_write_1.safeRead)(this.config.readableFile, this.projectPath);
|
|
214
|
+
// Load existing .faf data (or create minimal structure)
|
|
215
|
+
let existingFafData = {};
|
|
216
|
+
if (analysis.fafState.exists) {
|
|
217
|
+
const fafContent = await (0, atomic_write_1.safeRead)(this.config.structuredFile, this.projectPath);
|
|
218
|
+
existingFafData = YAML.parse(fafContent);
|
|
219
|
+
}
|
|
220
|
+
const updatedFafContent = await (0, claude_to_faf_1.claudeMdToFaf)(claudeContent, existingFafData, this.projectPath);
|
|
221
|
+
if (this.config.atomicWrites) {
|
|
222
|
+
await (0, atomic_write_1.atomicWrite)(this.config.structuredFile, updatedFafContent, this.projectPath);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// Direct write (not recommended)
|
|
226
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
227
|
+
await fs.writeFile(this.config.structuredFile, updatedFafContent, 'utf-8');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Verify integrity after sync
|
|
232
|
+
* Ensures mirror is perfect
|
|
233
|
+
*/
|
|
234
|
+
async verifyIntegrity() {
|
|
235
|
+
try {
|
|
236
|
+
// Check both files exist
|
|
237
|
+
const fafExists = await (0, atomic_write_1.fileExists)(this.config.structuredFile);
|
|
238
|
+
const claudeExists = await (0, atomic_write_1.fileExists)(this.config.readableFile);
|
|
239
|
+
if (!fafExists || !claudeExists) {
|
|
240
|
+
return { status: 'failed' };
|
|
241
|
+
}
|
|
242
|
+
// Parse .faf to get score
|
|
243
|
+
const fafContent = await (0, atomic_write_1.safeRead)(this.config.structuredFile, this.projectPath);
|
|
244
|
+
const parsedData = YAML.parse(fafContent);
|
|
245
|
+
const fafData = (!parsedData || typeof parsedData !== 'object') ? {} : parsedData;
|
|
246
|
+
const score = fafData.ai_score !== undefined && fafData.human_score !== undefined ? {
|
|
247
|
+
ai: fafData.ai_score,
|
|
248
|
+
human: fafData.human_score,
|
|
249
|
+
total: fafData.faf_score ? parseInt(fafData.faf_score) : fafData.ai_score + fafData.human_score
|
|
250
|
+
} : undefined;
|
|
251
|
+
// Basic validation passed
|
|
252
|
+
event_emitter_1.mirrorEvents.emitMirrorEvent((0, mirror_events_1.createMirrorEvent)(mirror_events_1.MirrorEventType.INTEGRITY_PERFECT, {
|
|
253
|
+
message: 'Mirror integrity verified'
|
|
254
|
+
}, {
|
|
255
|
+
projectPath: this.projectPath,
|
|
256
|
+
integrity: 'perfect',
|
|
257
|
+
score
|
|
258
|
+
}));
|
|
259
|
+
return { status: 'perfect', score };
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
event_emitter_1.mirrorEvents.emitMirrorEvent((0, mirror_events_1.createMirrorEvent)(mirror_events_1.MirrorEventType.INTEGRITY_FAILED, {
|
|
263
|
+
error: error instanceof Error ? error.message : String(error)
|
|
264
|
+
}, {
|
|
265
|
+
projectPath: this.projectPath,
|
|
266
|
+
integrity: 'failed'
|
|
267
|
+
}));
|
|
268
|
+
return { status: 'failed' };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
exports.MirrorEngine = MirrorEngine;
|
|
273
|
+
//# sourceMappingURL=mirror-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirror-engine.js","sourceRoot":"","sources":["../../../../src/engines/c-mirror/core/mirror-engine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAE7B,mDAAgD;AAChD,mDAAgD;AAChD,6DAAoG;AACpG,0DAAsD;AACtD,0DAA4E;AAE5E,MAAa,YAAY;IACf,MAAM,CAAgB;IACtB,WAAW,CAAS;IAE5B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG;YACZ,YAAY,EAAE,IAAI,EAAG,yBAAyB;YAC9C,WAAW,EAAE,IAAI,EAAI,2BAA2B;YAChD,GAAG,MAAM;SACV,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,MAAM,GAAkB;YAC5B,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,MAAM;YACjB,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,SAAS;SACrB,CAAC;QAEF,IAAI,CAAC;YACH,8BAA8B;YAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAE3C,kCAAkC;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YACtD,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;YAE5B,yCAAyC;YACzC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,iBAA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C1B,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,WAAW;aAChG,CAAC,CAAC,CAAC,SAAS,CAAC;YAEd,0BAA0B;YAC1B,4BAAY,CAAC,eAAe,CAC1B,IAAA,iCAAiB,EAAC,+BAAe,CAAC,iBAAiB,EAAE;gBACnD,OAAO,EAAE,2BAA2B;aACrC,EAAE;gBACD,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS,EAAE,SAAS;gBACpB,KAAK;aACN,CAAC,CACH,CAAC;YAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAEtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,4BAAY,CAAC,eAAe,CAC1B,IAAA,iCAAiB,EAAC,+BAAe,CAAC,gBAAgB,EAAE;gBAClD,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,EAAE;gBACD,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS,EAAE,QAAQ;aACpB,CAAC,CACH,CAAC;YAEF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AA9QD,oCA8QC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🩵 FAF Mirror - Convenience Wrapper
|
|
3
|
+
* Simple FAF-specific interface for C-Mirror
|
|
4
|
+
*
|
|
5
|
+
* This wrapper:
|
|
6
|
+
* - Uses FAF defaults (.faf and CLAUDE.md)
|
|
7
|
+
* - Includes FAF-specific validators
|
|
8
|
+
* - Integrates with FAF DNA chain
|
|
9
|
+
* - Provides championship communication
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* const mirror = new FAFMirror();
|
|
13
|
+
* await mirror.sync();
|
|
14
|
+
*/
|
|
15
|
+
import { IMirrorConfig, IMirrorResult } from '../core/interfaces';
|
|
16
|
+
export declare class FAFMirror {
|
|
17
|
+
private engine;
|
|
18
|
+
private projectPath;
|
|
19
|
+
private displayStarted;
|
|
20
|
+
constructor(projectPath?: string, options?: Partial<IMirrorConfig>);
|
|
21
|
+
/**
|
|
22
|
+
* Sync .faf ↔ CLAUDE.md
|
|
23
|
+
* With championship terminal display
|
|
24
|
+
*/
|
|
25
|
+
sync(): Promise<IMirrorResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop display (cleanup)
|
|
28
|
+
*/
|
|
29
|
+
stop(): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=faf-mirror.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faf-mirror.d.ts","sourceRoot":"","sources":["../../../../src/engines/c-mirror/faf-extensions/faf-mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGlE,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,cAAc,CAAkB;gBAE5B,WAAW,GAAE,MAAsB,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IAqBrF;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IAapC;;OAEG;IACH,IAAI,IAAI,IAAI;CAMb"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🩵 FAF Mirror - Convenience Wrapper
|
|
4
|
+
* Simple FAF-specific interface for C-Mirror
|
|
5
|
+
*
|
|
6
|
+
* This wrapper:
|
|
7
|
+
* - Uses FAF defaults (.faf and CLAUDE.md)
|
|
8
|
+
* - Includes FAF-specific validators
|
|
9
|
+
* - Integrates with FAF DNA chain
|
|
10
|
+
* - Provides championship communication
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* const mirror = new FAFMirror();
|
|
14
|
+
* await mirror.sync();
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.FAFMirror = void 0;
|
|
51
|
+
const path = __importStar(require("path"));
|
|
52
|
+
const mirror_engine_1 = require("../core/mirror-engine");
|
|
53
|
+
const terminal_display_1 = require("../broadcast/terminal-display");
|
|
54
|
+
class FAFMirror {
|
|
55
|
+
engine;
|
|
56
|
+
projectPath;
|
|
57
|
+
displayStarted = false;
|
|
58
|
+
constructor(projectPath = process.cwd(), options = {}) {
|
|
59
|
+
this.projectPath = projectPath;
|
|
60
|
+
// FAF defaults
|
|
61
|
+
const config = {
|
|
62
|
+
structuredFile: path.join(projectPath, '.faf'),
|
|
63
|
+
readableFile: path.join(projectPath, 'CLAUDE.md'),
|
|
64
|
+
projectPath,
|
|
65
|
+
atomicWrites: true, // Always use safe writes
|
|
66
|
+
selfHealing: true, // Always auto-recover
|
|
67
|
+
dnaChain: {
|
|
68
|
+
enabled: true, // DNA logging
|
|
69
|
+
path: path.join(projectPath, '.faf-dna.json'),
|
|
70
|
+
logLevel: 'standard'
|
|
71
|
+
},
|
|
72
|
+
...options
|
|
73
|
+
};
|
|
74
|
+
this.engine = new mirror_engine_1.MirrorEngine(config);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sync .faf ↔ CLAUDE.md
|
|
78
|
+
* With championship terminal display
|
|
79
|
+
*/
|
|
80
|
+
async sync() {
|
|
81
|
+
// Start terminal display (listens to events)
|
|
82
|
+
if (!this.displayStarted) {
|
|
83
|
+
(0, terminal_display_1.startTerminalDisplay)();
|
|
84
|
+
this.displayStarted = true;
|
|
85
|
+
}
|
|
86
|
+
// Run the sync
|
|
87
|
+
const result = await this.engine.sync();
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Stop display (cleanup)
|
|
92
|
+
*/
|
|
93
|
+
stop() {
|
|
94
|
+
if (this.displayStarted) {
|
|
95
|
+
(0, terminal_display_1.stopTerminalDisplay)();
|
|
96
|
+
this.displayStarted = false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.FAFMirror = FAFMirror;
|
|
101
|
+
//# sourceMappingURL=faf-mirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faf-mirror.js","sourceRoot":"","sources":["../../../../src/engines/c-mirror/faf-extensions/faf-mirror.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,yDAAqD;AAErD,oEAA0F;AAE1F,MAAa,SAAS;IACZ,MAAM,CAAe;IACrB,WAAW,CAAS;IACpB,cAAc,GAAY,KAAK,CAAC;IAExC,YAAY,cAAsB,OAAO,CAAC,GAAG,EAAE,EAAE,UAAkC,EAAE;QACnF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,eAAe;QACf,MAAM,MAAM,GAAkB;YAC5B,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;YAC9C,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;YACjD,WAAW;YACX,YAAY,EAAE,IAAI,EAAS,yBAAyB;YACpD,WAAW,EAAE,IAAI,EAAW,sBAAsB;YAClD,QAAQ,EAAE;gBACR,OAAO,EAAE,IAAI,EAAa,cAAc;gBACxC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC;gBAC7C,QAAQ,EAAE,UAAU;aACrB;YACD,GAAG,OAAO;SACX,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,4BAAY,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,6CAA6C;QAC7C,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,IAAA,uCAAoB,G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