git-veil
Version:
A CLI tool for synchronizing development activities to a personal GitHub repository discreetly and confidentially.
68 lines (67 loc) • 2.75 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkStatus = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
function findProjectRoot() {
// Find the root of the GitVeil project (where gitveil.config.json is located)
let currentDir = path.resolve(__dirname, "../../");
while (!fs.existsSync(path.join(currentDir, "gitveil.config.json"))) {
const parent = path.dirname(currentDir);
if (parent === currentDir)
break;
currentDir = parent;
}
return currentDir;
}
function checkStatus(options) {
const projectRoot = findProjectRoot();
const recordsDir = path.join(projectRoot, "records-folder");
let readyCount = 0;
if (fs.existsSync(recordsDir)) {
const files = fs.readdirSync(recordsDir);
const filtered = files.filter((f) => f.startsWith("record") && f.endsWith(".json"));
readyCount = filtered.length;
}
else {
console.log(`No records found.`);
console.log();
console.log("Use the command 'gitveil record' on private repositories to create records.");
}
if (readyCount === 0) {
console.log();
console.log("> Synchronization: UP TO DATE ✔️");
console.log("Everything is up to date, nothing to push.");
}
else {
console.log();
console.log("> Synchronization: WAITING ⏳");
console.log(`> Files ready to record: ${readyCount}`);
console.log();
console.log("Use the command 'gitveil push' to synchronize your records.");
}
}
exports.checkStatus = checkStatus;