git-veil
Version:
A CLI tool for synchronizing development activities to a personal GitHub repository discreetly and confidentially.
41 lines (40 loc) • 1.68 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActivityExtractor = void 0;
class ActivityExtractor {
constructor(email) {
this.email = email;
}
extractCommits(gitLog) {
const commits = [];
const logLines = gitLog.split("\n");
for (const line of logLines) {
if (this.isCommitRelatedToEmail(line)) {
commits.push(line);
}
}
return commits;
}
isCommitRelatedToEmail(commitLine) {
return commitLine.includes(this.email);
}
/**
* Simulate extracting activity for a given email and time range.
* In a real implementation, this would run a git log command.
*/
extractActivity() {
return __awaiter(this, void 0, void 0, function* () {
return [{ date: new Date().toISOString(), email: this.email }];
});
}
}
exports.ActivityExtractor = ActivityExtractor;