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,152 @@
|
|
|
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.resolvePath = resolvePath;
|
|
37
|
+
exports.exists = exists;
|
|
38
|
+
exports.isDirectory = isDirectory;
|
|
39
|
+
exports.isGitRepository = isGitRepository;
|
|
40
|
+
exports.ensureDir = ensureDir;
|
|
41
|
+
exports.writeFile = writeFile;
|
|
42
|
+
exports.readFile = readFile;
|
|
43
|
+
exports.removeDir = removeDir;
|
|
44
|
+
exports.listDirectories = listDirectories;
|
|
45
|
+
exports.getDefaultRepoPath = getDefaultRepoPath;
|
|
46
|
+
const fs = __importStar(require("fs-extra"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const errors_1 = require("./errors");
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a path relative to the current working directory
|
|
51
|
+
* Handles both absolute and relative paths
|
|
52
|
+
*/
|
|
53
|
+
function resolvePath(inputPath, basePath) {
|
|
54
|
+
const base = basePath ?? process.cwd();
|
|
55
|
+
if (path.isAbsolute(inputPath)) {
|
|
56
|
+
return inputPath;
|
|
57
|
+
}
|
|
58
|
+
return path.resolve(base, inputPath);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if a path exists
|
|
62
|
+
*/
|
|
63
|
+
async function exists(targetPath) {
|
|
64
|
+
return fs.pathExists(targetPath);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if a path is a directory
|
|
68
|
+
*/
|
|
69
|
+
async function isDirectory(targetPath) {
|
|
70
|
+
try {
|
|
71
|
+
const stat = await fs.stat(targetPath);
|
|
72
|
+
return stat.isDirectory();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if a path is a git repository (contains .git directory)
|
|
80
|
+
*/
|
|
81
|
+
async function isGitRepository(targetPath) {
|
|
82
|
+
const gitDir = path.join(targetPath, '.git');
|
|
83
|
+
return isDirectory(gitDir);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Ensure a directory exists, creating it if necessary
|
|
87
|
+
*/
|
|
88
|
+
async function ensureDir(dirPath) {
|
|
89
|
+
try {
|
|
90
|
+
await fs.ensureDir(dirPath);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
94
|
+
throw new errors_1.FileSystemError(`Failed to create directory: ${message}`, dirPath);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Write content to a file, creating directories if needed
|
|
99
|
+
*/
|
|
100
|
+
async function writeFile(filePath, content) {
|
|
101
|
+
try {
|
|
102
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
103
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
107
|
+
throw new errors_1.FileSystemError(`Failed to write file: ${message}`, filePath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Read a file's content
|
|
112
|
+
*/
|
|
113
|
+
async function readFile(filePath) {
|
|
114
|
+
try {
|
|
115
|
+
return await fs.readFile(filePath, 'utf-8');
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
119
|
+
throw new errors_1.FileSystemError(`Failed to read file: ${message}`, filePath);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Remove a directory and its contents
|
|
124
|
+
*/
|
|
125
|
+
async function removeDir(dirPath) {
|
|
126
|
+
try {
|
|
127
|
+
await fs.remove(dirPath);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
131
|
+
throw new errors_1.FileSystemError(`Failed to remove directory: ${message}`, dirPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List directories in a path
|
|
136
|
+
*/
|
|
137
|
+
async function listDirectories(dirPath) {
|
|
138
|
+
try {
|
|
139
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
140
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the default repository path based on repo name
|
|
148
|
+
*/
|
|
149
|
+
function getDefaultRepoPath(repoName) {
|
|
150
|
+
return `./repos/${repoName}`;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/utils/filesystem.ts"],"names":[],"mappings":";;;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AAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,MAAM,IAAI,wBAAe,CAAC,+BAA+B,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Ora } from 'ora';
|
|
2
|
+
export interface Logger {
|
|
3
|
+
info(message: string): void;
|
|
4
|
+
success(message: string): void;
|
|
5
|
+
warning(message: string): void;
|
|
6
|
+
error(message: string): void;
|
|
7
|
+
debug(message: string): void;
|
|
8
|
+
spinner(message: string): Ora;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Enable or disable verbose/debug logging
|
|
12
|
+
*/
|
|
13
|
+
export declare function setVerbose(enabled: boolean): void;
|
|
14
|
+
/**
|
|
15
|
+
* Check if verbose mode is enabled
|
|
16
|
+
*/
|
|
17
|
+
export declare function isVerbose(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Log an info message
|
|
20
|
+
*/
|
|
21
|
+
export declare function info(message: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Log a success message
|
|
24
|
+
*/
|
|
25
|
+
export declare function success(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Log a warning message
|
|
28
|
+
*/
|
|
29
|
+
export declare function warning(message: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Log an error message
|
|
32
|
+
*/
|
|
33
|
+
export declare function error(message: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Log a debug message (only in verbose mode)
|
|
36
|
+
*/
|
|
37
|
+
export declare function debug(message: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Create a spinner for long-running operations
|
|
40
|
+
*/
|
|
41
|
+
export declare function spinner(message: string): Ora;
|
|
42
|
+
/**
|
|
43
|
+
* Log a blank line
|
|
44
|
+
*/
|
|
45
|
+
export declare function newline(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Log a header/title
|
|
48
|
+
*/
|
|
49
|
+
export declare function header(title: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Log a list item
|
|
52
|
+
*/
|
|
53
|
+
export declare function listItem(text: string, indent?: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* Format a scope for display
|
|
56
|
+
*/
|
|
57
|
+
export declare function formatScope(scope: 'owner' | 'platform' | 'reference'): string;
|
|
58
|
+
export declare const logger: Logger;
|
|
59
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;CAC/B;AAID;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI3C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAK5C;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAE9B;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI1C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,IAAI,CAGvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAS7E;AAGD,eAAO,MAAM,MAAM,EAAE,MAOpB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logger = void 0;
|
|
7
|
+
exports.setVerbose = setVerbose;
|
|
8
|
+
exports.isVerbose = isVerbose;
|
|
9
|
+
exports.info = info;
|
|
10
|
+
exports.success = success;
|
|
11
|
+
exports.warning = warning;
|
|
12
|
+
exports.error = error;
|
|
13
|
+
exports.debug = debug;
|
|
14
|
+
exports.spinner = spinner;
|
|
15
|
+
exports.newline = newline;
|
|
16
|
+
exports.header = header;
|
|
17
|
+
exports.listItem = listItem;
|
|
18
|
+
exports.formatScope = formatScope;
|
|
19
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
+
const ora_1 = __importDefault(require("ora"));
|
|
21
|
+
let verboseMode = false;
|
|
22
|
+
/**
|
|
23
|
+
* Enable or disable verbose/debug logging
|
|
24
|
+
*/
|
|
25
|
+
function setVerbose(enabled) {
|
|
26
|
+
verboseMode = enabled;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if verbose mode is enabled
|
|
30
|
+
*/
|
|
31
|
+
function isVerbose() {
|
|
32
|
+
return verboseMode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Log an info message
|
|
36
|
+
*/
|
|
37
|
+
function info(message) {
|
|
38
|
+
console.log(chalk_1.default.blue('info'), message);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Log a success message
|
|
42
|
+
*/
|
|
43
|
+
function success(message) {
|
|
44
|
+
console.log(chalk_1.default.green('✓'), message);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Log a warning message
|
|
48
|
+
*/
|
|
49
|
+
function warning(message) {
|
|
50
|
+
console.log(chalk_1.default.yellow('⚠'), message);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Log an error message
|
|
54
|
+
*/
|
|
55
|
+
function error(message) {
|
|
56
|
+
console.error(chalk_1.default.red('✗'), message);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Log a debug message (only in verbose mode)
|
|
60
|
+
*/
|
|
61
|
+
function debug(message) {
|
|
62
|
+
if (verboseMode) {
|
|
63
|
+
console.log(chalk_1.default.gray('debug'), message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a spinner for long-running operations
|
|
68
|
+
*/
|
|
69
|
+
function spinner(message) {
|
|
70
|
+
return (0, ora_1.default)({
|
|
71
|
+
text: message,
|
|
72
|
+
color: 'cyan',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Log a blank line
|
|
77
|
+
*/
|
|
78
|
+
function newline() {
|
|
79
|
+
console.log();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Log a header/title
|
|
83
|
+
*/
|
|
84
|
+
function header(title) {
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk_1.default.bold.underline(title));
|
|
87
|
+
console.log();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Log a list item
|
|
91
|
+
*/
|
|
92
|
+
function listItem(text, indent = 0) {
|
|
93
|
+
const padding = ' '.repeat(indent);
|
|
94
|
+
console.log(`${padding}${chalk_1.default.dim('•')} ${text}`);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Format a scope for display
|
|
98
|
+
*/
|
|
99
|
+
function formatScope(scope) {
|
|
100
|
+
switch (scope) {
|
|
101
|
+
case 'owner':
|
|
102
|
+
return chalk_1.default.green('owner');
|
|
103
|
+
case 'platform':
|
|
104
|
+
return chalk_1.default.yellow('platform');
|
|
105
|
+
case 'reference':
|
|
106
|
+
return chalk_1.default.red('reference');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Export a logger object for convenience
|
|
110
|
+
exports.logger = {
|
|
111
|
+
info,
|
|
112
|
+
success,
|
|
113
|
+
warning,
|
|
114
|
+
error,
|
|
115
|
+
debug,
|
|
116
|
+
spinner,
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;;;;AAkBA,gCAEC;AAKD,8BAEC;AAKD,oBAEC;AAKD,0BAEC;AAKD,0BAEC;AAKD,sBAEC;AAKD,sBAIC;AAKD,0BAKC;AAKD,0BAEC;AAKD,wBAIC;AAKD,4BAGC;AAKD,kCASC;AAhHD,kDAA0B;AAC1B,8CAAsB;AAYtB,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB;;GAEG;AACH,SAAgB,UAAU,CAAC,OAAgB;IACzC,WAAW,GAAG,OAAO,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS;IACvB,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAA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 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "binder-cli",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Orchestrate Virtual Monoliths from distributed repositories and define semantic boundaries for AI agents",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"binder": "./bin/binder.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/",
|
|
12
|
+
"bin/",
|
|
13
|
+
"templates/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.build.json",
|
|
19
|
+
"dev": "ts-node src/cli.ts",
|
|
20
|
+
"binder": "node dist/cli.js",
|
|
21
|
+
"package": "npm run build && npm pack",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:watch": "jest --watch",
|
|
24
|
+
"test:coverage": "jest --coverage",
|
|
25
|
+
"lint": "eslint src --ext .ts && prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
26
|
+
"lint:fix": "eslint src --ext .ts --fix && prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
27
|
+
"clean": "rimraf dist",
|
|
28
|
+
"prepublishOnly": "npm run clean && npm run build && npm test",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"cli",
|
|
33
|
+
"git",
|
|
34
|
+
"workspace",
|
|
35
|
+
"monorepo",
|
|
36
|
+
"ai",
|
|
37
|
+
"orchestration",
|
|
38
|
+
"virtual-monolith"
|
|
39
|
+
],
|
|
40
|
+
"author": "Corrjo",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/corrjo/binder.git"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org",
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"commander": "^12.1.0",
|
|
55
|
+
"yaml": "^2.6.1",
|
|
56
|
+
"zod": "^3.24.1",
|
|
57
|
+
"simple-git": "^3.27.0",
|
|
58
|
+
"chalk": "^4.1.2",
|
|
59
|
+
"ora": "^5.4.1",
|
|
60
|
+
"fs-extra": "^11.2.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
64
|
+
"@semantic-release/git": "^10.0.1",
|
|
65
|
+
"semantic-release": "^24.2.0",
|
|
66
|
+
"@types/node": "^22.10.2",
|
|
67
|
+
"@types/fs-extra": "^11.0.4",
|
|
68
|
+
"@types/jest": "^29.5.14",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
70
|
+
"@typescript-eslint/parser": "^8.18.2",
|
|
71
|
+
"eslint": "^8.57.1",
|
|
72
|
+
"jest": "^29.7.0",
|
|
73
|
+
"prettier": "^3.4.2",
|
|
74
|
+
"rimraf": "^6.0.1",
|
|
75
|
+
"ts-jest": "^29.2.5",
|
|
76
|
+
"ts-node": "^10.9.2",
|
|
77
|
+
"typescript": "^5.7.2"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# Binder Configuration
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# This file defines your workspace topology and repository scopes.
|
|
5
|
+
# Run 'binder pull' to clone/checkout repositories.
|
|
6
|
+
# Run 'binder context' to generate CONTEXT_MAP.md for AI agents.
|
|
7
|
+
# Run 'binder status' to see workspace state.
|
|
8
|
+
# ============================================================================
|
|
9
|
+
|
|
10
|
+
# Workspace name (used in CONTEXT_MAP.md header)
|
|
11
|
+
name: my-workspace
|
|
12
|
+
|
|
13
|
+
# Repository definitions
|
|
14
|
+
# Each repo defines a git repository and its scope in this workspace
|
|
15
|
+
repos:
|
|
16
|
+
# --------------------------------------------------------------------------
|
|
17
|
+
# OWNER SCOPE - Full Authority
|
|
18
|
+
# --------------------------------------------------------------------------
|
|
19
|
+
# Repositories you own and have full control over.
|
|
20
|
+
# AI agents can read, write, refactor, and restructure freely.
|
|
21
|
+
#
|
|
22
|
+
- name: my-service
|
|
23
|
+
url: git@github.com:org/my-service.git
|
|
24
|
+
# path: ./services/my-service # Optional: local path (defaults to ./repos/{name})
|
|
25
|
+
scope: owner
|
|
26
|
+
# branch: main # Optional: branch to checkout
|
|
27
|
+
# notes: "Core service" # Optional: context for AI agents
|
|
28
|
+
|
|
29
|
+
# --------------------------------------------------------------------------
|
|
30
|
+
# PLATFORM SCOPE - Restricted Contributor
|
|
31
|
+
# --------------------------------------------------------------------------
|
|
32
|
+
# Repositories where you are a guest contributor.
|
|
33
|
+
# AI agents should only make minimal changes when necessary to support
|
|
34
|
+
# the owner scope. Must follow existing patterns strictly.
|
|
35
|
+
#
|
|
36
|
+
# - name: shared-platform
|
|
37
|
+
# url: https://github.com/org/platform.git
|
|
38
|
+
# scope: platform
|
|
39
|
+
# notes: "Shared infrastructure - minimal changes only"
|
|
40
|
+
|
|
41
|
+
# --------------------------------------------------------------------------
|
|
42
|
+
# REFERENCE SCOPE - Read Only
|
|
43
|
+
# --------------------------------------------------------------------------
|
|
44
|
+
# Repositories used for reference and validation only.
|
|
45
|
+
# AI agents must NOT suggest modifications to these repos.
|
|
46
|
+
# Useful for documentation, legacy code, or external dependencies.
|
|
47
|
+
#
|
|
48
|
+
# - name: legacy-api
|
|
49
|
+
# url: git@github.com:org/legacy-api.git
|
|
50
|
+
# scope: reference
|
|
51
|
+
# depth: 1 # Optional: shallow clone
|
|
52
|
+
# notes: "Reference only - historical context"
|