d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
const os = require('os');
|
|
|
|
const { createStateStore } = require('../state-store');
|
|
const { DEFAULT_SCHEMA_VERSION, DEFAULT_POLICY } = require('./policy');
|
|
const { normalizeLabels } = require('./gh-api');
|
|
const { slugifySegment, mapStateToWorkItemStatus, summarizeProjectProjection } = require('./state');
|
|
|
|
function epicWorkItemId(repo, issueNumber) {
|
|
return `github-${slugifySegment(repo)}-epic-${issueNumber}`;
|
|
}
|
|
|
|
function upsertCoordinationWorkItem(store, repo, issue, state, action, options = {}) {
|
|
if (!store) {
|
|
return null;
|
|
}
|
|
|
|
const now = new Date().toISOString();
|
|
const metadata = {
|
|
schemaVersion: state.schemaVersion || DEFAULT_SCHEMA_VERSION,
|
|
repo,
|
|
issueNumber: issue.number,
|
|
issueUrl: issue.url || null,
|
|
issueTitle: issue.title || null,
|
|
labels: normalizeLabels(issue.labels),
|
|
coordination: state,
|
|
projectProjection: summarizeProjectProjection(state, options.policy || DEFAULT_POLICY),
|
|
action,
|
|
actionAt: now,
|
|
syncedBy: 'ecc-github-coordination',
|
|
};
|
|
|
|
return store.upsertWorkItem({
|
|
id: epicWorkItemId(repo, issue.number),
|
|
source: 'github-epic',
|
|
sourceId: String(issue.number),
|
|
title: `Epic #${issue.number}: ${issue.title}`,
|
|
status: mapStateToWorkItemStatus(state.status),
|
|
priority: state.status === 'blocked' ? 'high' : 'normal',
|
|
url: issue.url || null,
|
|
owner: state.owner || (issue.author && issue.author.login) || null,
|
|
repoRoot: options.repoRoot || process.cwd(),
|
|
sessionId: options.sessionId || null,
|
|
metadata,
|
|
updatedAt: now,
|
|
});
|
|
}
|
|
|
|
async function openStore(options = {}) {
|
|
if (options.dbPath === false) {
|
|
return null;
|
|
}
|
|
|
|
return createStateStore({
|
|
dbPath: options.dbPath,
|
|
homeDir: options.homeDir || process.env.HOME || os.homedir(),
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
epicWorkItemId,
|
|
openStore,
|
|
upsertCoordinationWorkItem,
|
|
};
|