binder-cli 1.1.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/LICENSE +21 -0
- package/README.md +177 -0
- package/bin/binder.js +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +119 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/context.d.ts +12 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +105 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +119 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/pull.d.ts +5 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +47 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/status.d.ts +5 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +116 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/core/config/parser.d.ts +24 -0
- package/dist/core/config/parser.d.ts.map +1 -0
- package/dist/core/config/parser.js +116 -0
- package/dist/core/config/parser.js.map +1 -0
- package/dist/core/config/types.d.ts +142 -0
- package/dist/core/config/types.d.ts.map +1 -0
- package/dist/core/config/types.js +71 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/generator/context-map.d.ts +6 -0
- package/dist/core/generator/context-map.d.ts.map +1 -0
- package/dist/core/generator/context-map.js +124 -0
- package/dist/core/generator/context-map.js.map +1 -0
- package/dist/core/generator/injection-content.d.ts +9 -0
- package/dist/core/generator/injection-content.d.ts.map +1 -0
- package/dist/core/generator/injection-content.js +38 -0
- package/dist/core/generator/injection-content.js.map +1 -0
- package/dist/core/generator/rule-injector.d.ts +33 -0
- package/dist/core/generator/rule-injector.d.ts.map +1 -0
- package/dist/core/generator/rule-injector.js +208 -0
- package/dist/core/generator/rule-injector.js.map +1 -0
- package/dist/core/git/operations.d.ts +52 -0
- package/dist/core/git/operations.d.ts.map +1 -0
- package/dist/core/git/operations.js +221 -0
- package/dist/core/git/operations.js.map +1 -0
- package/dist/core/workspace/orchestrator.d.ts +28 -0
- package/dist/core/workspace/orchestrator.d.ts.map +1 -0
- package/dist/core/workspace/orchestrator.js +151 -0
- package/dist/core/workspace/orchestrator.js.map +1 -0
- package/dist/core/workspace/status.d.ts +45 -0
- package/dist/core/workspace/status.d.ts.map +1 -0
- package/dist/core/workspace/status.js +142 -0
- package/dist/core/workspace/status.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/errors.d.ts +45 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +83 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/filesystem.d.ts +42 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +152 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +118 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +79 -0
- package/templates/binder.yaml.template +52 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.orchestrate = orchestrate;
|
|
4
|
+
const operations_1 = require("../git/operations");
|
|
5
|
+
const filesystem_1 = require("../../utils/filesystem");
|
|
6
|
+
const logger_1 = require("../../utils/logger");
|
|
7
|
+
/**
|
|
8
|
+
* Get the resolved path for a repository
|
|
9
|
+
*/
|
|
10
|
+
function getRepoPath(repo, basePath) {
|
|
11
|
+
const repoPath = repo.path ?? (0, filesystem_1.getDefaultRepoPath)(repo.name);
|
|
12
|
+
return (0, filesystem_1.resolvePath)(repoPath, basePath);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if this repo references the current directory
|
|
16
|
+
*/
|
|
17
|
+
function isCurrentDirectoryRepo(repo) {
|
|
18
|
+
return repo.path === '.';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Orchestrate a single repository
|
|
22
|
+
*/
|
|
23
|
+
async function orchestrateRepo(repo, basePath, spin) {
|
|
24
|
+
const repoPath = getRepoPath(repo, basePath);
|
|
25
|
+
const result = {
|
|
26
|
+
name: repo.name,
|
|
27
|
+
path: repoPath,
|
|
28
|
+
action: 'up-to-date',
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
// Handle current directory repos (path: '.')
|
|
32
|
+
if (isCurrentDirectoryRepo(repo)) {
|
|
33
|
+
const repoExists = await (0, operations_1.isGitRepo)(repoPath);
|
|
34
|
+
if (!repoExists) {
|
|
35
|
+
result.action = 'error';
|
|
36
|
+
result.error = 'Current directory is not a git repository';
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
// Handle branch checkout if specified
|
|
40
|
+
if (repo.branch) {
|
|
41
|
+
const currentBranch = await (0, operations_1.getCurrentBranch)(repoPath);
|
|
42
|
+
if (currentBranch !== repo.branch) {
|
|
43
|
+
spin.text = `Checking out ${repo.branch} for ${repo.name}...`;
|
|
44
|
+
(0, logger_1.debug)(`Switching ${repo.name} from ${currentBranch} to ${repo.branch}`);
|
|
45
|
+
await (0, operations_1.checkoutBranch)(repoPath, repo.branch, repo.name);
|
|
46
|
+
result.action = 'checkout';
|
|
47
|
+
result.branch = repo.branch;
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
result.branch = (await (0, operations_1.getCurrentBranch)(repoPath)) ?? undefined;
|
|
52
|
+
result.action = 'skipped';
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
// Handle remote repos
|
|
56
|
+
const repoExists = await (0, operations_1.isGitRepo)(repoPath);
|
|
57
|
+
if (!repoExists) {
|
|
58
|
+
// Clone the repository
|
|
59
|
+
spin.text = `Cloning ${repo.name}...`;
|
|
60
|
+
(0, logger_1.debug)(`Cloning ${repo.url} to ${repoPath}`);
|
|
61
|
+
await (0, operations_1.cloneRepository)(repo.url, repoPath, {
|
|
62
|
+
depth: repo.depth,
|
|
63
|
+
branch: repo.branch,
|
|
64
|
+
});
|
|
65
|
+
result.action = 'cloned';
|
|
66
|
+
result.branch = repo.branch ?? (await (0, operations_1.getCurrentBranch)(repoPath)) ?? undefined;
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
// Repository exists, check if we need to checkout a different branch
|
|
70
|
+
if (repo.branch) {
|
|
71
|
+
const currentBranch = await (0, operations_1.getCurrentBranch)(repoPath);
|
|
72
|
+
if (currentBranch !== repo.branch) {
|
|
73
|
+
spin.text = `Checking out ${repo.branch} for ${repo.name}...`;
|
|
74
|
+
(0, logger_1.debug)(`Switching ${repo.name} from ${currentBranch} to ${repo.branch}`);
|
|
75
|
+
await (0, operations_1.checkoutBranch)(repoPath, repo.branch, repo.name);
|
|
76
|
+
result.action = 'checkout';
|
|
77
|
+
result.branch = repo.branch;
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Already on correct branch (or no branch specified)
|
|
82
|
+
result.branch = (await (0, operations_1.getCurrentBranch)(repoPath)) ?? undefined;
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
87
|
+
result.action = 'error';
|
|
88
|
+
result.error = message;
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Orchestrate all repositories according to the configuration
|
|
94
|
+
* This is the main entry point for the `binder pull` command
|
|
95
|
+
*/
|
|
96
|
+
async function orchestrate(config, basePath) {
|
|
97
|
+
const resolvedBasePath = basePath ?? process.cwd();
|
|
98
|
+
const results = [];
|
|
99
|
+
let cloned = 0;
|
|
100
|
+
let checkedOut = 0;
|
|
101
|
+
let skipped = 0;
|
|
102
|
+
let errors = 0;
|
|
103
|
+
const spin = (0, logger_1.spinner)(`Orchestrating ${config.repos.length} repositories...`);
|
|
104
|
+
spin.start();
|
|
105
|
+
for (const repo of config.repos) {
|
|
106
|
+
const result = await orchestrateRepo(repo, resolvedBasePath, spin);
|
|
107
|
+
results.push(result);
|
|
108
|
+
switch (result.action) {
|
|
109
|
+
case 'cloned':
|
|
110
|
+
cloned++;
|
|
111
|
+
break;
|
|
112
|
+
case 'checkout':
|
|
113
|
+
checkedOut++;
|
|
114
|
+
break;
|
|
115
|
+
case 'skipped':
|
|
116
|
+
case 'up-to-date':
|
|
117
|
+
skipped++;
|
|
118
|
+
break;
|
|
119
|
+
case 'error':
|
|
120
|
+
errors++;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
spin.stop();
|
|
125
|
+
// Log results
|
|
126
|
+
for (const result of results) {
|
|
127
|
+
switch (result.action) {
|
|
128
|
+
case 'cloned':
|
|
129
|
+
(0, logger_1.success)(`Cloned ${result.name}${result.branch ? ` (${result.branch})` : ''}`);
|
|
130
|
+
break;
|
|
131
|
+
case 'checkout':
|
|
132
|
+
(0, logger_1.success)(`Checked out ${result.branch} for ${result.name}`);
|
|
133
|
+
break;
|
|
134
|
+
case 'up-to-date':
|
|
135
|
+
(0, logger_1.debug)(`${result.name} is up to date`);
|
|
136
|
+
break;
|
|
137
|
+
case 'error':
|
|
138
|
+
(0, logger_1.error)(`Failed ${result.name}: ${result.error}`);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
success: errors === 0,
|
|
144
|
+
repos: results,
|
|
145
|
+
cloned,
|
|
146
|
+
checkedOut,
|
|
147
|
+
skipped,
|
|
148
|
+
errors,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AM,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC3D,MAAM;YACR,KAAK,YAAY;gBACf,IAAA,cAAK,EAAC,GAAG,MAAM,CAAC,IAAI,gBAAgB,CAAC,CAAC;gBACtC,MAAM;YACR,KAAK,OAAO;gBACV,IAAA,cAAK,EAAC,UAAU,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBAChD,MAAM;QACV,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,KAAK,CAAC;QACrB,KAAK,EAAE,OAAO;QACd,MAAM;QACN,UAAU;QACV,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BinderConfig, Scope } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* Status of a single repository
|
|
4
|
+
*/
|
|
5
|
+
export interface RepoStatusInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
scope: Scope;
|
|
9
|
+
exists: boolean;
|
|
10
|
+
isGitRepo: boolean;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
currentBranch: string | null;
|
|
13
|
+
expectedBranch: string | null;
|
|
14
|
+
branchMismatch: boolean;
|
|
15
|
+
notes?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Orphaned repository (on disk but not in config)
|
|
19
|
+
*/
|
|
20
|
+
export interface OrphanedRepo {
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Complete workspace status
|
|
26
|
+
*/
|
|
27
|
+
export interface WorkspaceStatus {
|
|
28
|
+
workspaceName: string;
|
|
29
|
+
repos: RepoStatusInfo[];
|
|
30
|
+
orphanedRepos: OrphanedRepo[];
|
|
31
|
+
summary: {
|
|
32
|
+
total: number;
|
|
33
|
+
existing: number;
|
|
34
|
+
missing: number;
|
|
35
|
+
dirty: number;
|
|
36
|
+
branchMismatches: number;
|
|
37
|
+
orphaned: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get complete workspace status
|
|
42
|
+
* This is the main entry point for the `binder status` command
|
|
43
|
+
*/
|
|
44
|
+
export declare function getWorkspaceStatus(config: BinderConfig, basePath?: string): Promise<WorkspaceStatus>;
|
|
45
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/core/workspace/status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKvE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAiFD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAgC1B"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getWorkspaceStatus = getWorkspaceStatus;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const operations_1 = require("../git/operations");
|
|
39
|
+
const filesystem_1 = require("../../utils/filesystem");
|
|
40
|
+
const filesystem_2 = require("../../utils/filesystem");
|
|
41
|
+
/**
|
|
42
|
+
* Get the resolved path for a repository
|
|
43
|
+
*/
|
|
44
|
+
function getRepoPath(repo, basePath) {
|
|
45
|
+
const repoPath = repo.path ?? (0, filesystem_2.getDefaultRepoPath)(repo.name);
|
|
46
|
+
return (0, filesystem_1.resolvePath)(repoPath, basePath);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get status for a single repository
|
|
50
|
+
*/
|
|
51
|
+
async function getRepoStatusInfo(repo, basePath) {
|
|
52
|
+
const repoPath = getRepoPath(repo, basePath);
|
|
53
|
+
const pathExists = await (0, filesystem_1.exists)(repoPath);
|
|
54
|
+
const isRepo = pathExists ? await (0, operations_1.isGitRepo)(repoPath) : false;
|
|
55
|
+
if (!isRepo) {
|
|
56
|
+
return {
|
|
57
|
+
name: repo.name,
|
|
58
|
+
path: repoPath,
|
|
59
|
+
scope: repo.scope,
|
|
60
|
+
exists: pathExists,
|
|
61
|
+
isGitRepo: false,
|
|
62
|
+
isDirty: false,
|
|
63
|
+
currentBranch: null,
|
|
64
|
+
expectedBranch: repo.branch ?? null,
|
|
65
|
+
branchMismatch: false,
|
|
66
|
+
notes: repo.notes,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const status = await (0, operations_1.getRepoStatus)(repoPath);
|
|
70
|
+
const currentBranch = status.currentBranch;
|
|
71
|
+
const expectedBranch = repo.branch ?? null;
|
|
72
|
+
const branchMismatch = expectedBranch !== null && currentBranch !== expectedBranch;
|
|
73
|
+
return {
|
|
74
|
+
name: repo.name,
|
|
75
|
+
path: repoPath,
|
|
76
|
+
scope: repo.scope,
|
|
77
|
+
exists: true,
|
|
78
|
+
isGitRepo: true,
|
|
79
|
+
isDirty: status.isDirty,
|
|
80
|
+
currentBranch,
|
|
81
|
+
expectedBranch,
|
|
82
|
+
branchMismatch,
|
|
83
|
+
notes: repo.notes,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Find directories that look like repos but aren't in the config
|
|
88
|
+
*/
|
|
89
|
+
async function findOrphanedRepos(config, basePath) {
|
|
90
|
+
const orphaned = [];
|
|
91
|
+
// Get all configured repo paths
|
|
92
|
+
const configuredPaths = new Set(config.repos.map((repo) => getRepoPath(repo, basePath)));
|
|
93
|
+
// Check the default repos directory
|
|
94
|
+
const reposDir = (0, filesystem_1.resolvePath)('./repos', basePath);
|
|
95
|
+
if ((await (0, filesystem_1.exists)(reposDir)) && (await (0, filesystem_1.isDirectory)(reposDir))) {
|
|
96
|
+
const dirs = await (0, filesystem_1.listDirectories)(reposDir);
|
|
97
|
+
for (const dir of dirs) {
|
|
98
|
+
const fullPath = path.join(reposDir, dir);
|
|
99
|
+
if ((await (0, operations_1.isGitRepo)(fullPath)) && !configuredPaths.has(fullPath)) {
|
|
100
|
+
orphaned.push({
|
|
101
|
+
name: dir,
|
|
102
|
+
path: fullPath,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return orphaned;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get complete workspace status
|
|
111
|
+
* This is the main entry point for the `binder status` command
|
|
112
|
+
*/
|
|
113
|
+
async function getWorkspaceStatus(config, basePath) {
|
|
114
|
+
const resolvedBasePath = basePath ?? process.cwd();
|
|
115
|
+
// Get status for all configured repos
|
|
116
|
+
const repoStatuses = [];
|
|
117
|
+
for (const repo of config.repos) {
|
|
118
|
+
const status = await getRepoStatusInfo(repo, resolvedBasePath);
|
|
119
|
+
repoStatuses.push(status);
|
|
120
|
+
}
|
|
121
|
+
// Find orphaned repos
|
|
122
|
+
const orphanedRepos = await findOrphanedRepos(config, resolvedBasePath);
|
|
123
|
+
// Calculate summary
|
|
124
|
+
const existing = repoStatuses.filter((r) => r.exists && r.isGitRepo).length;
|
|
125
|
+
const missing = repoStatuses.filter((r) => !r.exists || !r.isGitRepo).length;
|
|
126
|
+
const dirty = repoStatuses.filter((r) => r.isDirty).length;
|
|
127
|
+
const branchMismatches = repoStatuses.filter((r) => r.branchMismatch).length;
|
|
128
|
+
return {
|
|
129
|
+
workspaceName: config.name,
|
|
130
|
+
repos: repoStatuses,
|
|
131
|
+
orphanedRepos,
|
|
132
|
+
summary: {
|
|
133
|
+
total: repoStatuses.length,
|
|
134
|
+
existing,
|
|
135
|
+
missing,
|
|
136
|
+
dirty,
|
|
137
|
+
branchMismatches,
|
|
138
|
+
orphaned: orphanedRepos.length,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/core/workspace/status.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,gDAmCC;AArKD,2CAA6B;AAE7B,kDAA6D;AAC7D,uDAA2F;AAC3F,uDAA4D;AA2C5D;;GAEG;AACH,SAAS,WAAW,CAAC,IAAgB,EAAE,QAAgB;IACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,+BAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,IAAA,wBAAW,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,iBAAiB,CAAC,IAAgB,EAAE,QAAgB;IACjE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE7C,MAAM,UAAU,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ED,sBAAsB;IACtB,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAExE,oBAAoB;IACpB,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAC5E,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IAC7E,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC3D,MAAM,gBAAgB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC;IAE7E,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,IAAI;QAC1B,KAAK,EAAE,YAAY;QACnB,aAAa;QACb,OAAO,EAAE;YACP,KAAK,EAAE,YAAY,CAAC,MAAM;YAC1B,QAAQ;YACR,OAAO;YACP,KAAK;YACL,gBAAgB;YAChB,QAAQ,EAAE,aAAa,CAAC,MAAM;SAC/B;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { parseConfig, loadConfig, ConfigError } from './core/config/parser';
|
|
2
|
+
export { BinderConfigSchema, RepositorySchema, ScopeSchema } from './core/config/types';
|
|
3
|
+
export type { BinderConfig, Repository, Scope } from './core/config/types';
|
|
4
|
+
export { generateContextMap } from './core/generator/context-map';
|
|
5
|
+
export { orchestrate } from './core/workspace/orchestrator';
|
|
6
|
+
export type { OrchestrationResult, RepoOrchestrationResult } from './core/workspace/orchestrator';
|
|
7
|
+
export { getWorkspaceStatus } from './core/workspace/status';
|
|
8
|
+
export type { WorkspaceStatus, RepoStatusInfo, OrphanedRepo } from './core/workspace/status';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACxF,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceStatus = exports.orchestrate = exports.generateContextMap = exports.ScopeSchema = exports.RepositorySchema = exports.BinderConfigSchema = exports.ConfigError = exports.loadConfig = exports.parseConfig = void 0;
|
|
4
|
+
// Main entry point for programmatic usage
|
|
5
|
+
var parser_1 = require("./core/config/parser");
|
|
6
|
+
Object.defineProperty(exports, "parseConfig", { enumerable: true, get: function () { return parser_1.parseConfig; } });
|
|
7
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return parser_1.loadConfig; } });
|
|
8
|
+
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return parser_1.ConfigError; } });
|
|
9
|
+
var types_1 = require("./core/config/types");
|
|
10
|
+
Object.defineProperty(exports, "BinderConfigSchema", { enumerable: true, get: function () { return types_1.BinderConfigSchema; } });
|
|
11
|
+
Object.defineProperty(exports, "RepositorySchema", { enumerable: true, get: function () { return types_1.RepositorySchema; } });
|
|
12
|
+
Object.defineProperty(exports, "ScopeSchema", { enumerable: true, get: function () { return types_1.ScopeSchema; } });
|
|
13
|
+
var context_map_1 = require("./core/generator/context-map");
|
|
14
|
+
Object.defineProperty(exports, "generateContextMap", { enumerable: true, get: function () { return context_map_1.generateContextMap; } });
|
|
15
|
+
var orchestrator_1 = require("./core/workspace/orchestrator");
|
|
16
|
+
Object.defineProperty(exports, "orchestrate", { enumerable: true, get: function () { return orchestrator_1.orchestrate; } });
|
|
17
|
+
var status_1 = require("./core/workspace/status");
|
|
18
|
+
Object.defineProperty(exports, "getWorkspaceStatus", { enumerable: true, get: function () { return status_1.getWorkspaceStatus; } });
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,+CAA4E;AAAnE,qGAAA,WAAW,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,qGAAA,WAAW,OAAA;AAC7C,6CAAwF;AAA/E,2GAAA,kBAAkB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,oGAAA,WAAW,OAAA;AAE1D,4DAAkE;AAAzD,iHAAA,kBAAkB,OAAA;AAC3B,8DAA4D;AAAnD,2GAAA,WAAW,OAAA;AAEpB,kDAA6D;AAApD,4GAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Binder errors
|
|
3
|
+
*/
|
|
4
|
+
export declare class BinderError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(message: string, code: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when git operations fail
|
|
10
|
+
*/
|
|
11
|
+
export declare class GitError extends BinderError {
|
|
12
|
+
readonly repoName?: string | undefined;
|
|
13
|
+
constructor(message: string, repoName?: string | undefined);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when a repository has uncommitted changes
|
|
17
|
+
*/
|
|
18
|
+
export declare class DirtyRepositoryError extends BinderError {
|
|
19
|
+
readonly repoName: string;
|
|
20
|
+
constructor(repoName: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when a branch doesn't exist
|
|
24
|
+
*/
|
|
25
|
+
export declare class BranchNotFoundError extends BinderError {
|
|
26
|
+
readonly branchName: string;
|
|
27
|
+
readonly repoName: string;
|
|
28
|
+
constructor(branchName: string, repoName: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Error thrown when clone fails
|
|
32
|
+
*/
|
|
33
|
+
export declare class CloneError extends BinderError {
|
|
34
|
+
readonly repoUrl: string;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
constructor(repoUrl: string, reason: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Error thrown when file system operations fail
|
|
40
|
+
*/
|
|
41
|
+
export declare class FileSystemError extends BinderError {
|
|
42
|
+
readonly path: string;
|
|
43
|
+
constructor(message: string, path: string);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;aAGlB,IAAI,EAAE,MAAM;gBAD5B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM;CAQ/B;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,WAAW;aAGrB,QAAQ,CAAC,EAAE,MAAM;gBADjC,OAAO,EAAE,MAAM,EACC,QAAQ,CAAC,EAAE,MAAM,YAAA;CAKpC;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;aACvB,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM;CAO7C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;aAEhC,UAAU,EAAE,MAAM;aAClB,QAAQ,EAAE,MAAM;gBADhB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM;CAKnC;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAW;aAEvB,OAAO,EAAE,MAAM;aACf,MAAM,EAAE,MAAM;gBADd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM;CAKjC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;aAG5B,IAAI,EAAE,MAAM;gBAD5B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM;CAK/B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileSystemError = exports.CloneError = exports.BranchNotFoundError = exports.DirtyRepositoryError = exports.GitError = exports.BinderError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all Binder errors
|
|
6
|
+
*/
|
|
7
|
+
class BinderError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
constructor(message, code) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.name = 'BinderError';
|
|
13
|
+
if (Error.captureStackTrace) {
|
|
14
|
+
Error.captureStackTrace(this, BinderError);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.BinderError = BinderError;
|
|
19
|
+
/**
|
|
20
|
+
* Error thrown when git operations fail
|
|
21
|
+
*/
|
|
22
|
+
class GitError extends BinderError {
|
|
23
|
+
repoName;
|
|
24
|
+
constructor(message, repoName) {
|
|
25
|
+
super(message, 'GIT_ERROR');
|
|
26
|
+
this.repoName = repoName;
|
|
27
|
+
this.name = 'GitError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.GitError = GitError;
|
|
31
|
+
/**
|
|
32
|
+
* Error thrown when a repository has uncommitted changes
|
|
33
|
+
*/
|
|
34
|
+
class DirtyRepositoryError extends BinderError {
|
|
35
|
+
repoName;
|
|
36
|
+
constructor(repoName) {
|
|
37
|
+
super(`Repository "${repoName}" has uncommitted changes. Commit or stash changes before switching branches.`, 'DIRTY_REPOSITORY');
|
|
38
|
+
this.repoName = repoName;
|
|
39
|
+
this.name = 'DirtyRepositoryError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DirtyRepositoryError = DirtyRepositoryError;
|
|
43
|
+
/**
|
|
44
|
+
* Error thrown when a branch doesn't exist
|
|
45
|
+
*/
|
|
46
|
+
class BranchNotFoundError extends BinderError {
|
|
47
|
+
branchName;
|
|
48
|
+
repoName;
|
|
49
|
+
constructor(branchName, repoName) {
|
|
50
|
+
super(`Branch "${branchName}" not found in repository "${repoName}".`, 'BRANCH_NOT_FOUND');
|
|
51
|
+
this.branchName = branchName;
|
|
52
|
+
this.repoName = repoName;
|
|
53
|
+
this.name = 'BranchNotFoundError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.BranchNotFoundError = BranchNotFoundError;
|
|
57
|
+
/**
|
|
58
|
+
* Error thrown when clone fails
|
|
59
|
+
*/
|
|
60
|
+
class CloneError extends BinderError {
|
|
61
|
+
repoUrl;
|
|
62
|
+
reason;
|
|
63
|
+
constructor(repoUrl, reason) {
|
|
64
|
+
super(`Failed to clone ${repoUrl}: ${reason}`, 'CLONE_ERROR');
|
|
65
|
+
this.repoUrl = repoUrl;
|
|
66
|
+
this.reason = reason;
|
|
67
|
+
this.name = 'CloneError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.CloneError = CloneError;
|
|
71
|
+
/**
|
|
72
|
+
* Error thrown when file system operations fail
|
|
73
|
+
*/
|
|
74
|
+
class FileSystemError extends BinderError {
|
|
75
|
+
path;
|
|
76
|
+
constructor(message, path) {
|
|
77
|
+
super(message, 'FILESYSTEM_ERROR');
|
|
78
|
+
this.path = path;
|
|
79
|
+
this.name = 'FileSystemError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.FileSystemError = FileSystemError;
|
|
83
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IAGlB;IAFlB,YACE,OAAe,EACC,IAAY;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF;AAXD,kCAWC;AAED;;GAEG;AACH,MAAa,QAAS,SAAQ,WAAW;IAGrB;IAFlB,YACE,OAAe,EACC,QAAiB;QAEjC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAFZ,aAAQ,GAAR,QAAQ,CAAS;QAGjC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AARD,4BAQC;AAED;;GAEG;AACH,MAAa,oBAAqB,SAAQ,WAAW;IACvB;IAA5B,YAA4B,QAAgB;QAC1C,KAAK,CACH,eAAe,QAAQ,+EAA+E,EACtG,kBAAkB,CACnB,CAAC;QAJwB,aAAQ,GAAR,QAAQ,CAAQ;QAK1C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AARD,oDAQC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,WAAW;IAEhC;IACA;IAFlB,YACkB,UAAkB,EAClB,QAAgB;QAEhC,KAAK,CAAC,WAAW,UAAU,8BAA8B,QAAQ,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAH3E,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAGhC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AARD,kDAQC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,WAAW;IAEvB;IACA;IAFlB,YACkB,OAAe,EACf,MAAc;QAE9B,KAAK,CAAC,mBAAmB,OAAO,KAAK,MAAM,EAAE,EAAE,aAAa,CAAC,CAAC;QAH9C,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AARD,gCAQC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,WAAW;IAG5B;IAFlB,YACE,OAAe,EACC,IAAY;QAE5B,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAFnB,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AARD,0CAQC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a path relative to the current working directory
|
|
3
|
+
* Handles both absolute and relative paths
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolvePath(inputPath: string, basePath?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a path exists
|
|
8
|
+
*/
|
|
9
|
+
export declare function exists(targetPath: string): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a path is a directory
|
|
12
|
+
*/
|
|
13
|
+
export declare function isDirectory(targetPath: string): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a path is a git repository (contains .git directory)
|
|
16
|
+
*/
|
|
17
|
+
export declare function isGitRepository(targetPath: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Ensure a directory exists, creating it if necessary
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Write content to a file, creating directories if needed
|
|
24
|
+
*/
|
|
25
|
+
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Read a file's content
|
|
28
|
+
*/
|
|
29
|
+
export declare function readFile(filePath: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Remove a directory and its contents
|
|
32
|
+
*/
|
|
33
|
+
export declare function removeDir(dirPath: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* List directories in a path
|
|
36
|
+
*/
|
|
37
|
+
export declare function listDirectories(dirPath: string): Promise<string[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the default repository path based on repo name
|
|
40
|
+
*/
|
|
41
|
+
export declare function getDefaultRepoPath(repoName: string): string;
|
|
42
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/utils/filesystem.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOtE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG1E;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9D;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9D;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOxE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|