@medicine-wheel/github-ceremony 0.5.1
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/README.md +48 -0
- package/dist/detect.d.ts +24 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +112 -0
- package/dist/detect.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/process.d.ts +36 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +151 -0
- package/dist/process.js.map +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @medicine-wheel/github-ceremony
|
|
2
|
+
|
|
3
|
+
Witness GitHub webhook events through a ceremonial lens and record them as
|
|
4
|
+
relational ceremony beads. This domain came home from Miadi (`jgwill/Miadi#506`)
|
|
5
|
+
as a reusable, framework-free package.
|
|
6
|
+
|
|
7
|
+
- **`build*`** functions are pure — a parsed payload in, a `CeremonyEventRecord`
|
|
8
|
+
out. No storage, no Next.js, no network.
|
|
9
|
+
- **`process*`** functions additionally persist through
|
|
10
|
+
[`@medicine-wheel/storage-provider`](../storage-provider), where jsonl and neon
|
|
11
|
+
are first-class equals.
|
|
12
|
+
|
|
13
|
+
Each phase bridges onto the Four Directions (reusing `ontology-core`'s
|
|
14
|
+
`DirectionName`) while preserving the original ceremonial phase name.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createProvider } from '@medicine-wheel/storage-provider';
|
|
20
|
+
import {
|
|
21
|
+
processGitHubEvent,
|
|
22
|
+
buildIssueCeremony,
|
|
23
|
+
isCeremonialEvent,
|
|
24
|
+
} from '@medicine-wheel/github-ceremony';
|
|
25
|
+
|
|
26
|
+
// Pure — no storage:
|
|
27
|
+
const record = buildIssueCeremony({ issue }, 'jgwill/medicine-wheel');
|
|
28
|
+
|
|
29
|
+
// Persisting:
|
|
30
|
+
const store = await createProvider();
|
|
31
|
+
const result = await processGitHubEvent(
|
|
32
|
+
{ type: 'issues', payload: { action: 'opened', issue } },
|
|
33
|
+
'jgwill/medicine-wheel',
|
|
34
|
+
store,
|
|
35
|
+
);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## What stays local to Miadi
|
|
39
|
+
|
|
40
|
+
Consensus building (`pull_request_review` → agreement tracking) and the
|
|
41
|
+
Upstash-Redis ceremonial spiral are entangled with Miadi-specific
|
|
42
|
+
infrastructure. `processGitHubEvent` returns `null` for review events; the
|
|
43
|
+
spiral key is preserved as a deterministic identifier (`Ceremony.<kind>.<phase>.<millis>`)
|
|
44
|
+
without any Redis dependency.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT — IAIP Collaborative, Shawinigan, QC.
|
package/dist/detect.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceremony detection and extraction — pure functions over parsed webhook
|
|
3
|
+
* payloads. No storage, no framework, no network. Ported from Miadi's
|
|
4
|
+
* github-ceremony-processor, preserving its ceremonial semantics.
|
|
5
|
+
*/
|
|
6
|
+
import type { DirectionName } from '@medicine-wheel/ontology-core';
|
|
7
|
+
import type { CeremonialPhase, CeremonyEventKind, CeremonyEventParticipant, GitHubIssue, GitHubLabel, GitHubPullRequest, GitHubWebhookEvent } from './types.js';
|
|
8
|
+
/** Map a ceremonial phase to a Four-Directions value. */
|
|
9
|
+
export declare function phaseToDirection(phase: CeremonialPhase): DirectionName;
|
|
10
|
+
/** Determine whether a GitHub event should be witnessed ceremonially. */
|
|
11
|
+
export declare function isCeremonialEvent(event: GitHubWebhookEvent): boolean;
|
|
12
|
+
/** Extract the ceremonial phase from labels or content, defaulting to research. */
|
|
13
|
+
export declare function extractCeremonialPhase(labels: GitHubLabel[], content?: string): CeremonialPhase;
|
|
14
|
+
/** Extract participants from an issue or PR, optionally including mentions. */
|
|
15
|
+
export declare function extractParticipants(issue: GitHubIssue | GitHubPullRequest, mentions?: string[]): CeremonyEventParticipant[];
|
|
16
|
+
/** Extract relationship impacts from free text via markers, then heuristics. */
|
|
17
|
+
export declare function extractRelationshipImpacts(content: string): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Deterministic spiral key preserving Miadi's `Ceremony.<kind>.<phase>.<millis>`
|
|
20
|
+
* shape without any Redis dependency (the Upstash-backed spiral lives local to
|
|
21
|
+
* Miadi). The key is a stable identifier, not a storage handle.
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateSpiralKey(kind: CeremonyEventKind, phase: CeremonialPhase, timestamp: Date | string): string;
|
|
24
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAYpB,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,CAEtE;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAiCpE;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,EAAE,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,eAAe,CAqBjB;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,GAAG,iBAAiB,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,wBAAwB,EAAE,CAc5B;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA6BpE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,IAAI,GAAG,MAAM,GACvB,MAAM,CAGR"}
|
package/dist/detect.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceremony detection and extraction — pure functions over parsed webhook
|
|
3
|
+
* payloads. No storage, no framework, no network. Ported from Miadi's
|
|
4
|
+
* github-ceremony-processor, preserving its ceremonial semantics.
|
|
5
|
+
*/
|
|
6
|
+
import { PHASE_TO_DIRECTION } from './types.js';
|
|
7
|
+
const CEREMONIAL_KEYWORDS = [
|
|
8
|
+
'ceremony',
|
|
9
|
+
'consensus',
|
|
10
|
+
'relational',
|
|
11
|
+
'community',
|
|
12
|
+
'indigenous',
|
|
13
|
+
'migwech',
|
|
14
|
+
];
|
|
15
|
+
/** Map a ceremonial phase to a Four-Directions value. */
|
|
16
|
+
export function phaseToDirection(phase) {
|
|
17
|
+
return PHASE_TO_DIRECTION[phase];
|
|
18
|
+
}
|
|
19
|
+
/** Determine whether a GitHub event should be witnessed ceremonially. */
|
|
20
|
+
export function isCeremonialEvent(event) {
|
|
21
|
+
const { type, payload } = event;
|
|
22
|
+
if (type === 'issues' || type === 'pull_request') {
|
|
23
|
+
const labels = payload.issue?.labels || payload.pull_request?.labels || [];
|
|
24
|
+
const hasCeremonialLabel = labels.some((label) => label.name.includes('ceremony') ||
|
|
25
|
+
label.name.includes('consensus') ||
|
|
26
|
+
label.name.includes('ceremonial'));
|
|
27
|
+
if (hasCeremonialLabel)
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
// A push is ceremonial when any commit names a ceremony; processCommits then
|
|
31
|
+
// filters commit-by-commit. (Miadi gated push behind issue/PR-only checks,
|
|
32
|
+
// leaving its push path unreachable — this restores the intended behavior.)
|
|
33
|
+
if (type === 'push') {
|
|
34
|
+
const commits = payload.commits || [];
|
|
35
|
+
return commits.some((commit) => typeof commit?.message === 'string' &&
|
|
36
|
+
commit.message.toLowerCase().includes('ceremony'));
|
|
37
|
+
}
|
|
38
|
+
const title = payload.issue?.title || payload.pull_request?.title || '';
|
|
39
|
+
const body = payload.issue?.body || payload.pull_request?.body || '';
|
|
40
|
+
return CEREMONIAL_KEYWORDS.some((keyword) => title.toLowerCase().includes(keyword) || body.toLowerCase().includes(keyword));
|
|
41
|
+
}
|
|
42
|
+
/** Extract the ceremonial phase from labels or content, defaulting to research. */
|
|
43
|
+
export function extractCeremonialPhase(labels, content) {
|
|
44
|
+
const labelNames = labels.map((l) => l.name.toLowerCase());
|
|
45
|
+
const contentLower = content?.toLowerCase() ?? '';
|
|
46
|
+
if (labelNames.includes('miigwechiwendam') || contentLower.includes('sacred space')) {
|
|
47
|
+
return 'miigwechiwendam';
|
|
48
|
+
}
|
|
49
|
+
if (labelNames.includes('nindokendaan') || contentLower.includes('research')) {
|
|
50
|
+
return 'nindokendaan';
|
|
51
|
+
}
|
|
52
|
+
if (labelNames.includes('ningwaab') || contentLower.includes('integration')) {
|
|
53
|
+
return 'ningwaab';
|
|
54
|
+
}
|
|
55
|
+
if (labelNames.includes('nindoodam') || contentLower.includes('creative')) {
|
|
56
|
+
return 'nindoodam';
|
|
57
|
+
}
|
|
58
|
+
if (labelNames.includes('migwech') || contentLower.includes('closing')) {
|
|
59
|
+
return 'migwech';
|
|
60
|
+
}
|
|
61
|
+
return 'nindokendaan';
|
|
62
|
+
}
|
|
63
|
+
/** Extract participants from an issue or PR, optionally including mentions. */
|
|
64
|
+
export function extractParticipants(issue, mentions) {
|
|
65
|
+
const participants = [
|
|
66
|
+
{ name: issue.user.login, role: 'Creator', perspective: 'both' },
|
|
67
|
+
];
|
|
68
|
+
if (mentions) {
|
|
69
|
+
for (const username of mentions) {
|
|
70
|
+
if (!participants.find((p) => p.name === username)) {
|
|
71
|
+
participants.push({ name: username, role: 'Participant', perspective: 'both' });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return participants;
|
|
76
|
+
}
|
|
77
|
+
/** Extract relationship impacts from free text via markers, then heuristics. */
|
|
78
|
+
export function extractRelationshipImpacts(content) {
|
|
79
|
+
const impacts = [];
|
|
80
|
+
const impactMarkers = ['affects:', 'impacts:', 'relates to:', 'influences:'];
|
|
81
|
+
for (const marker of impactMarkers) {
|
|
82
|
+
const regex = new RegExp(`${marker}\\s*([^\\n]+)`, 'gi');
|
|
83
|
+
const matches = content.match(regex);
|
|
84
|
+
if (matches) {
|
|
85
|
+
for (const match of matches) {
|
|
86
|
+
const replaceRegex = new RegExp(`${marker}\\s*([^\\n]+)`, 'i');
|
|
87
|
+
const impact = match.replace(replaceRegex, '$1').trim();
|
|
88
|
+
if (impact)
|
|
89
|
+
impacts.push(impact);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (impacts.length === 0) {
|
|
94
|
+
const impactLines = content
|
|
95
|
+
.split('\n')
|
|
96
|
+
.filter((line) => line.toLowerCase().includes('affect') ||
|
|
97
|
+
line.toLowerCase().includes('impact') ||
|
|
98
|
+
line.toLowerCase().includes('relationship'));
|
|
99
|
+
impacts.push(...impactLines.slice(0, 3));
|
|
100
|
+
}
|
|
101
|
+
return impacts.length > 0 ? impacts : ['General system impact'];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Deterministic spiral key preserving Miadi's `Ceremony.<kind>.<phase>.<millis>`
|
|
105
|
+
* shape without any Redis dependency (the Upstash-backed spiral lives local to
|
|
106
|
+
* Miadi). The key is a stable identifier, not a storage handle.
|
|
107
|
+
*/
|
|
108
|
+
export function generateSpiralKey(kind, phase, timestamp) {
|
|
109
|
+
const millis = timestamp instanceof Date ? timestamp.getTime() : Date.parse(timestamp);
|
|
110
|
+
return `Ceremony.${kind}.${phase}.${Number.isNaN(millis) ? Date.now() : millis}`;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,mBAAmB,GAAG;IAC1B,UAAU;IACV,WAAW;IACX,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,SAAS;CACV,CAAC;AAEF,yDAAyD;AACzD,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IACzD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAEhC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;QACjD,MAAM,MAAM,GAAkB,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC;QAC1F,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CACpC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CACpC,CAAC;QACF,IAAI,kBAAkB;YAAE,OAAO,IAAI,CAAC;IACtC,CAAC;IAED,6EAA6E;IAC7E,2EAA2E;IAC3E,4EAA4E;IAC5E,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,MAAM,OAAO,GAAgC,OAAO,CAAC,OAAO,IAAI,EAAE,C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AC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvF,OAAO,YAAY,IAAI,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACnF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/github-ceremony
|
|
3
|
+
*
|
|
4
|
+
* Witness GitHub webhook events — issues, pull requests, merges, commits —
|
|
5
|
+
* through a ceremonial lens, and record them as relational ceremony beads.
|
|
6
|
+
* Framework-free: `build*` functions are pure; `process*` functions persist
|
|
7
|
+
* through @medicine-wheel/storage-provider (jsonl and neon alike).
|
|
8
|
+
*
|
|
9
|
+
* Consensus workflows and the Upstash spiral remain local to Miadi; this
|
|
10
|
+
* package ports the reusable, storage-neutral core.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { createProvider } from '@medicine-wheel/storage-provider';
|
|
15
|
+
* import { processGitHubEvent } from '@medicine-wheel/github-ceremony';
|
|
16
|
+
*
|
|
17
|
+
* const store = await createProvider();
|
|
18
|
+
* const record = await processGitHubEvent(
|
|
19
|
+
* { type: 'issues', payload: { action: 'opened', issue } },
|
|
20
|
+
* 'jgwill/medicine-wheel',
|
|
21
|
+
* store,
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export * from './types.js';
|
|
26
|
+
export * from './detect.js';
|
|
27
|
+
export * from './process.js';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/github-ceremony
|
|
3
|
+
*
|
|
4
|
+
* Witness GitHub webhook events — issues, pull requests, merges, commits —
|
|
5
|
+
* through a ceremonial lens, and record them as relational ceremony beads.
|
|
6
|
+
* Framework-free: `build*` functions are pure; `process*` functions persist
|
|
7
|
+
* through @medicine-wheel/storage-provider (jsonl and neon alike).
|
|
8
|
+
*
|
|
9
|
+
* Consensus workflows and the Upstash spiral remain local to Miadi; this
|
|
10
|
+
* package ports the reusable, storage-neutral core.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { createProvider } from '@medicine-wheel/storage-provider';
|
|
15
|
+
* import { processGitHubEvent } from '@medicine-wheel/github-ceremony';
|
|
16
|
+
*
|
|
17
|
+
* const store = await createProvider();
|
|
18
|
+
* const record = await processGitHubEvent(
|
|
19
|
+
* { type: 'issues', payload: { action: 'opened', issue } },
|
|
20
|
+
* 'jgwill/medicine-wheel',
|
|
21
|
+
* store,
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export * from './types.js';
|
|
26
|
+
export * from './detect.js';
|
|
27
|
+
export * from './process.js';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceremony-event processing.
|
|
3
|
+
*
|
|
4
|
+
* `build*` functions are pure: they turn a parsed payload into a
|
|
5
|
+
* CeremonyEventRecord. `process*` functions additionally persist through a
|
|
6
|
+
* StorageProvider. Consensus workflows (`pull_request_review`) and the Upstash
|
|
7
|
+
* spiral remain local to Miadi and are intentionally not ported here.
|
|
8
|
+
*/
|
|
9
|
+
import type { StorageProvider } from '@medicine-wheel/storage-provider';
|
|
10
|
+
import type { CeremonyEventRecord, GitHubWebhookEvent } from './types.js';
|
|
11
|
+
/** Build a ceremony record from an opened issue (pure). */
|
|
12
|
+
export declare function buildIssueCeremony(payload: any, repository?: string): CeremonyEventRecord;
|
|
13
|
+
/** Build a ceremony record from an opened pull request (pure). */
|
|
14
|
+
export declare function buildPRCeremony(payload: any, repository?: string): CeremonyEventRecord;
|
|
15
|
+
/** Build a ceremony record from a merged pull request (pure, closing phase). */
|
|
16
|
+
export declare function buildMergeCeremony(payload: any, repository?: string): CeremonyEventRecord;
|
|
17
|
+
/**
|
|
18
|
+
* Build ceremony records from push commits (pure). Only commits whose message
|
|
19
|
+
* mentions "ceremony" are witnessed, matching Miadi's semantics.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildCommitCeremonies(payload: any, repository?: string): CeremonyEventRecord[];
|
|
22
|
+
/** Build and persist an issue-opened ceremony. */
|
|
23
|
+
export declare function processIssueOpened(payload: any, repository: string, store: StorageProvider): Promise<CeremonyEventRecord>;
|
|
24
|
+
/** Build and persist a PR-opened ceremony. */
|
|
25
|
+
export declare function processPROpened(payload: any, repository: string, store: StorageProvider): Promise<CeremonyEventRecord>;
|
|
26
|
+
/** Build and persist a PR-merged ceremony. */
|
|
27
|
+
export declare function processPRMerged(payload: any, repository: string, store: StorageProvider): Promise<CeremonyEventRecord>;
|
|
28
|
+
/** Build and persist ceremonies for ceremonial commits in a push. */
|
|
29
|
+
export declare function processCommits(payload: any, repository: string, store: StorageProvider): Promise<CeremonyEventRecord[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Main entry point. Returns the ceremony record(s) produced, or null when the
|
|
32
|
+
* event is not ceremonial or produces no new ceremony (e.g. a review, whose
|
|
33
|
+
* consensus workflow stays local to Miadi).
|
|
34
|
+
*/
|
|
35
|
+
export declare function processGitHubEvent(event: GitHubWebhookEvent, repository: string, store: StorageProvider): Promise<CeremonyEventRecord | CeremonyEventRecord[] | null>;
|
|
36
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAGV,mBAAmB,EAGnB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAuCpB,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAazF;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAatF;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAYzF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA6B9F;AAED,kDAAkD;AAClD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,8CAA8C;AAC9C,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,8CAA8C;AAC9C,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,qEAAqE;AACrE,wBAAsB,cAAc,CAClC,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAOhC;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,kBAAkB,EACzB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,mBAAmB,GAAG,mBAAmB,EAAE,GAAG,IAAI,CAAC,CA4B7D"}
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceremony-event processing.
|
|
3
|
+
*
|
|
4
|
+
* `build*` functions are pure: they turn a parsed payload into a
|
|
5
|
+
* CeremonyEventRecord. `process*` functions additionally persist through a
|
|
6
|
+
* StorageProvider. Consensus workflows (`pull_request_review`) and the Upstash
|
|
7
|
+
* spiral remain local to Miadi and are intentionally not ported here.
|
|
8
|
+
*/
|
|
9
|
+
import { extractCeremonialPhase, extractParticipants, extractRelationshipImpacts, generateSpiralKey, isCeremonialEvent, phaseToDirection, } from './detect.js';
|
|
10
|
+
function buildRecord(args) {
|
|
11
|
+
return {
|
|
12
|
+
id: args.id,
|
|
13
|
+
source: 'github',
|
|
14
|
+
kind: args.kind,
|
|
15
|
+
phase: args.phase,
|
|
16
|
+
direction: phaseToDirection(args.phase),
|
|
17
|
+
participants: args.participants,
|
|
18
|
+
relationshipImpacts: args.relationshipImpacts,
|
|
19
|
+
spiralKey: generateSpiralKey(args.kind, args.phase, args.timestamp),
|
|
20
|
+
timestamp: args.timestamp.toISOString(),
|
|
21
|
+
...(args.repository !== undefined ? { repository: args.repository } : {}),
|
|
22
|
+
...(args.reference !== undefined ? { reference: args.reference } : {}),
|
|
23
|
+
...(args.metadata !== undefined ? { metadata: args.metadata } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Build a ceremony record from an opened issue (pure). */
|
|
27
|
+
export function buildIssueCeremony(payload, repository) {
|
|
28
|
+
const issue = payload.issue;
|
|
29
|
+
const phase = extractCeremonialPhase(issue.labels, issue.body);
|
|
30
|
+
return buildRecord({
|
|
31
|
+
id: `issue-${issue.number}`,
|
|
32
|
+
kind: 'issue',
|
|
33
|
+
phase,
|
|
34
|
+
participants: extractParticipants(issue),
|
|
35
|
+
relationshipImpacts: extractRelationshipImpacts(issue.body || ''),
|
|
36
|
+
timestamp: new Date(),
|
|
37
|
+
repository,
|
|
38
|
+
reference: issue.number,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Build a ceremony record from an opened pull request (pure). */
|
|
42
|
+
export function buildPRCeremony(payload, repository) {
|
|
43
|
+
const pr = payload.pull_request;
|
|
44
|
+
const phase = extractCeremonialPhase(pr.labels || [], `${pr.title}\n${pr.body}`);
|
|
45
|
+
return buildRecord({
|
|
46
|
+
id: `pr-${pr.number}`,
|
|
47
|
+
kind: 'pr',
|
|
48
|
+
phase,
|
|
49
|
+
participants: extractParticipants(pr),
|
|
50
|
+
relationshipImpacts: extractRelationshipImpacts(pr.body || ''),
|
|
51
|
+
timestamp: new Date(),
|
|
52
|
+
repository,
|
|
53
|
+
reference: pr.number,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Build a ceremony record from a merged pull request (pure, closing phase). */
|
|
57
|
+
export function buildMergeCeremony(payload, repository) {
|
|
58
|
+
const pr = payload.pull_request;
|
|
59
|
+
return buildRecord({
|
|
60
|
+
id: `merge-${pr.number}`,
|
|
61
|
+
kind: 'merge',
|
|
62
|
+
phase: 'migwech',
|
|
63
|
+
participants: extractParticipants(pr),
|
|
64
|
+
relationshipImpacts: extractRelationshipImpacts(pr.body || ''),
|
|
65
|
+
timestamp: new Date(),
|
|
66
|
+
repository,
|
|
67
|
+
reference: pr.number,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build ceremony records from push commits (pure). Only commits whose message
|
|
72
|
+
* mentions "ceremony" are witnessed, matching Miadi's semantics.
|
|
73
|
+
*/
|
|
74
|
+
export function buildCommitCeremonies(payload, repository) {
|
|
75
|
+
const commits = payload.commits || [];
|
|
76
|
+
const records = [];
|
|
77
|
+
for (const commit of commits) {
|
|
78
|
+
if (!commit.message.toLowerCase().includes('ceremony'))
|
|
79
|
+
continue;
|
|
80
|
+
const shortSha = String(commit.id).substring(0, 7);
|
|
81
|
+
records.push(buildRecord({
|
|
82
|
+
id: `commit-${shortSha}`,
|
|
83
|
+
kind: 'commit',
|
|
84
|
+
phase: 'nindoodam',
|
|
85
|
+
participants: [
|
|
86
|
+
{
|
|
87
|
+
name: commit.author?.username || commit.author?.name || 'unknown',
|
|
88
|
+
role: 'Author',
|
|
89
|
+
perspective: 'both',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
relationshipImpacts: extractRelationshipImpacts(commit.message),
|
|
93
|
+
timestamp: commit.timestamp ? new Date(commit.timestamp) : new Date(),
|
|
94
|
+
repository,
|
|
95
|
+
reference: shortSha,
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
return records;
|
|
99
|
+
}
|
|
100
|
+
/** Build and persist an issue-opened ceremony. */
|
|
101
|
+
export async function processIssueOpened(payload, repository, store) {
|
|
102
|
+
return store.registerCeremonyEvent(buildIssueCeremony(payload, repository));
|
|
103
|
+
}
|
|
104
|
+
/** Build and persist a PR-opened ceremony. */
|
|
105
|
+
export async function processPROpened(payload, repository, store) {
|
|
106
|
+
return store.registerCeremonyEvent(buildPRCeremony(payload, repository));
|
|
107
|
+
}
|
|
108
|
+
/** Build and persist a PR-merged ceremony. */
|
|
109
|
+
export async function processPRMerged(payload, repository, store) {
|
|
110
|
+
return store.registerCeremonyEvent(buildMergeCeremony(payload, repository));
|
|
111
|
+
}
|
|
112
|
+
/** Build and persist ceremonies for ceremonial commits in a push. */
|
|
113
|
+
export async function processCommits(payload, repository, store) {
|
|
114
|
+
const records = buildCommitCeremonies(payload, repository);
|
|
115
|
+
const stored = [];
|
|
116
|
+
for (const record of records) {
|
|
117
|
+
stored.push(await store.registerCeremonyEvent(record));
|
|
118
|
+
}
|
|
119
|
+
return stored;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Main entry point. Returns the ceremony record(s) produced, or null when the
|
|
123
|
+
* event is not ceremonial or produces no new ceremony (e.g. a review, whose
|
|
124
|
+
* consensus workflow stays local to Miadi).
|
|
125
|
+
*/
|
|
126
|
+
export async function processGitHubEvent(event, repository, store) {
|
|
127
|
+
if (!isCeremonialEvent(event))
|
|
128
|
+
return null;
|
|
129
|
+
const { type, payload } = event;
|
|
130
|
+
switch (type) {
|
|
131
|
+
case 'issues':
|
|
132
|
+
if (payload.action === 'opened') {
|
|
133
|
+
return processIssueOpened(payload, repository, store);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
case 'pull_request':
|
|
137
|
+
if (payload.action === 'opened') {
|
|
138
|
+
return processPROpened(payload, repository, store);
|
|
139
|
+
}
|
|
140
|
+
if (payload.action === 'closed' && payload.pull_request?.merged) {
|
|
141
|
+
return processPRMerged(payload, repository, store);
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
case 'push':
|
|
145
|
+
return processCommits(payload, repository, store);
|
|
146
|
+
default:
|
|
147
|
+
// pull_request_review and other events: consensus handling remains local.
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACj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C,CAAC;YACxD,CAAC;YACD,OAAO,IAAI,CAAC;QAEd,KAAK,cAAc;YACjB,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;YACrD,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;gBAChE,OAAO,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,IAAI,CAAC;QAEd,KAAK,MAAM;YACT,OAAO,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAEpD;YACE,0EAA0E;YAC1E,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub webhook payload shapes and re-exported ceremony record types.
|
|
3
|
+
*
|
|
4
|
+
* The CeremonyEventRecord shape (and its phase/kind/participant vocabulary) is
|
|
5
|
+
* owned by @medicine-wheel/storage-provider so both jsonl and neon persist the
|
|
6
|
+
* same shape. This package owns detection and processing.
|
|
7
|
+
*/
|
|
8
|
+
import type { DirectionName } from '@medicine-wheel/ontology-core';
|
|
9
|
+
import type { CeremonialPhase, CeremonyEventKind, CeremonyEventParticipant, CeremonyEventRecord, CeremonyEventFilters } from '@medicine-wheel/storage-provider';
|
|
10
|
+
export type { CeremonialPhase, CeremonyEventKind, CeremonyEventParticipant, CeremonyEventRecord, CeremonyEventFilters, };
|
|
11
|
+
export interface GitHubWebhookEvent {
|
|
12
|
+
type: string;
|
|
13
|
+
payload: any;
|
|
14
|
+
}
|
|
15
|
+
export interface GitHubLabel {
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GitHubIssue {
|
|
19
|
+
number: number;
|
|
20
|
+
title: string;
|
|
21
|
+
body: string;
|
|
22
|
+
labels: GitHubLabel[];
|
|
23
|
+
user: {
|
|
24
|
+
login: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface GitHubPullRequest {
|
|
28
|
+
number: number;
|
|
29
|
+
title: string;
|
|
30
|
+
body: string;
|
|
31
|
+
head: {
|
|
32
|
+
ref: string;
|
|
33
|
+
};
|
|
34
|
+
base: {
|
|
35
|
+
ref: string;
|
|
36
|
+
};
|
|
37
|
+
labels?: GitHubLabel[];
|
|
38
|
+
user: {
|
|
39
|
+
login: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Bridge each ceremonial phase onto the Four Directions, reusing ontology-core's
|
|
44
|
+
* DirectionName. Kept in step with @medicine-wheel/ceremonial-diary's mapping.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PHASE_TO_DIRECTION: Record<CeremonialPhase, DirectionName>;
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACtB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,aAAa,CAMrE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub webhook payload shapes and re-exported ceremony record types.
|
|
3
|
+
*
|
|
4
|
+
* The CeremonyEventRecord shape (and its phase/kind/participant vocabulary) is
|
|
5
|
+
* owned by @medicine-wheel/storage-provider so both jsonl and neon persist the
|
|
6
|
+
* same shape. This package owns detection and processing.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Bridge each ceremonial phase onto the Four Directions, reusing ontology-core's
|
|
10
|
+
* DirectionName. Kept in step with @medicine-wheel/ceremonial-diary's mapping.
|
|
11
|
+
*/
|
|
12
|
+
export const PHASE_TO_DIRECTION = {
|
|
13
|
+
miigwechiwendam: 'east',
|
|
14
|
+
nindokendaan: 'south',
|
|
15
|
+
ningwaab: 'west',
|
|
16
|
+
nindoodam: 'west',
|
|
17
|
+
migwech: 'north',
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2C;IACxE,eAAe,EAAE,MAAM;IACvB,YAAY,EAAE,OAAO;IACrB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@medicine-wheel/github-ceremony",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "GitHub-ceremony processing — witness GitHub webhook events (issues, pull requests, merges, commits) through a ceremonial lens and record them as relational ceremony beads. Pure, framework-free functions that take a parsed payload and a @medicine-wheel/storage-provider",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./detect": {
|
|
15
|
+
"types": "./dist/detect.d.ts",
|
|
16
|
+
"import": "./dist/detect.js",
|
|
17
|
+
"default": "./dist/detect.js"
|
|
18
|
+
},
|
|
19
|
+
"./process": {
|
|
20
|
+
"types": "./dist/process.d.ts",
|
|
21
|
+
"import": "./dist/process.js",
|
|
22
|
+
"default": "./dist/process.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"lint": "tsc --noEmit",
|
|
34
|
+
"clean": "rm -rf dist",
|
|
35
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"medicine-wheel",
|
|
39
|
+
"github-ceremony",
|
|
40
|
+
"webhook",
|
|
41
|
+
"ceremony",
|
|
42
|
+
"relational-accountability",
|
|
43
|
+
"indigenous-research",
|
|
44
|
+
"four-directions"
|
|
45
|
+
],
|
|
46
|
+
"author": "IAIP Collaborative - Shawinigan, QC",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@medicine-wheel/ontology-core": "^0.5.1",
|
|
50
|
+
"@medicine-wheel/storage-provider": "^0.5.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^20.10.0",
|
|
54
|
+
"typescript": "^5.7.0"
|
|
55
|
+
}
|
|
56
|
+
}
|