@miadi/inquiry-weave 0.8.2 → 0.9.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/README.md +14 -0
- package/dist/attention.d.ts +75 -0
- package/dist/attention.d.ts.map +1 -0
- package/dist/attention.js +356 -0
- package/dist/attention.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/closing.d.ts +60 -0
- package/dist/closing.d.ts.map +1 -0
- package/dist/closing.js +199 -0
- package/dist/closing.js.map +1 -0
- package/dist/episode.d.ts +2 -0
- package/dist/episode.d.ts.map +1 -1
- package/dist/episode.js +19 -2
- package/dist/episode.js.map +1 -1
- package/dist/git-landing.d.ts +119 -0
- package/dist/git-landing.d.ts.map +1 -0
- package/dist/git-landing.js +280 -0
- package/dist/git-landing.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +13 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +326 -4
- package/dist/mcp-server.js.map +1 -1
- package/dist/mint.d.ts +243 -0
- package/dist/mint.d.ts.map +1 -0
- package/dist/mint.js +743 -0
- package/dist/mint.js.map +1 -0
- package/dist/skill.js +1 -1
- package/package.json +1 -1
- package/rispecs/README.rise.md +5 -0
- package/rispecs/RISPEC.md +9 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git landing for a Chronicle vessel — fetch, integrate, path-limited add,
|
|
3
|
+
* commit, push — on a working tree other seats are editing at the same time.
|
|
4
|
+
*
|
|
5
|
+
* Rules this module keeps, each paid for in /srv/miadi/episodes:
|
|
6
|
+
*
|
|
7
|
+
* - `main` only moves forward. `.githooks/reference-transaction` refuses any
|
|
8
|
+
* non-fast-forward move of `refs/heads/main`, so a rebase (which moves main
|
|
9
|
+
* sideways) is never attempted. Divergence is integrated with a merge, or
|
|
10
|
+
* refused; never with a rewind.
|
|
11
|
+
* - Nothing here runs `stash`, `reset`, `checkout --`, `clean`, or `add .`.
|
|
12
|
+
* Another seat's dirty files are either untouched or the reason the door
|
|
13
|
+
* stops; git itself refuses a merge that would overwrite a dirty file,
|
|
14
|
+
* before touching anything.
|
|
15
|
+
* - The commit is path-limited twice: `git add -- <paths>` stages only the
|
|
16
|
+
* vessel files, and `git commit -- <paths>` commits only those, leaving any
|
|
17
|
+
* path another seat had staged exactly as staged.
|
|
18
|
+
* - Every step reports what git actually said (`observed`), the way
|
|
19
|
+
* voice-mcp's closing.ts `observe()` does. A refusal is data, not a throw.
|
|
20
|
+
*
|
|
21
|
+
* Ref: jgwill/Miadi#621, jgwill/Miadi#501.
|
|
22
|
+
*/
|
|
23
|
+
export declare const GIT_TIMEOUT_MS = 30000;
|
|
24
|
+
export interface GitObservation {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
/** stdout, or stderr when stdout is empty, trimmed and capped at 500 chars. */
|
|
27
|
+
out: string;
|
|
28
|
+
}
|
|
29
|
+
/** Run one git command under `gitRoot` and report what it said. Never throws. */
|
|
30
|
+
export declare function observeGit(gitRoot: string, args: string[], options?: {
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
env?: NodeJS.ProcessEnv;
|
|
33
|
+
}): Promise<GitObservation>;
|
|
34
|
+
/** The git root that holds the chronicle — measured, never assumed one level up. */
|
|
35
|
+
export declare function chronicleGitRoot(chronicleRoot: string): Promise<string>;
|
|
36
|
+
export type ChroniclePreflightCode = "chronicle_not_main" | "chronicle_busy";
|
|
37
|
+
export interface ChroniclePreflight {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
branch: string;
|
|
40
|
+
code?: ChroniclePreflightCode;
|
|
41
|
+
message?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tree must be on `main` with no merge or rebase in flight. A tree in the
|
|
45
|
+
* middle of someone else's operation is theirs to finish; the door reports and
|
|
46
|
+
* waits.
|
|
47
|
+
*/
|
|
48
|
+
export declare function preflightChronicle(gitRoot: string): Promise<ChroniclePreflight>;
|
|
49
|
+
export type IntegrationState = "up-to-date" | "fast-forwarded" | "merged" | "refused" | "fetch-failed" | "would-integrate";
|
|
50
|
+
export interface IntegrationResult {
|
|
51
|
+
state: IntegrationState;
|
|
52
|
+
/** What git said, step by step. */
|
|
53
|
+
observed: string;
|
|
54
|
+
/** Commits on origin/main not on main before integration. */
|
|
55
|
+
behind: number;
|
|
56
|
+
/** Commits on main not on origin/main before integration. */
|
|
57
|
+
ahead: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Fetch origin/main and bring it into main without ever rewinding.
|
|
61
|
+
*
|
|
62
|
+
* origin/main ⊆ main → up-to-date
|
|
63
|
+
* main ⊆ origin/main → merge --ff-only
|
|
64
|
+
* diverged → merge --no-edit (a merge commit is the
|
|
65
|
+
* price of a tree that forbids rewinds)
|
|
66
|
+
*
|
|
67
|
+
* `dryRun` fetches and measures but moves nothing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function integrateOrigin(gitRoot: string, options?: {
|
|
70
|
+
dryRun?: boolean;
|
|
71
|
+
allowMerge?: boolean;
|
|
72
|
+
}): Promise<IntegrationResult>;
|
|
73
|
+
/** Directory names origin/main holds under `subdir` — what other hosts have pushed. */
|
|
74
|
+
export declare function originTreeNames(gitRoot: string, subdir: string): Promise<{
|
|
75
|
+
ok: boolean;
|
|
76
|
+
names: string[];
|
|
77
|
+
observed: string;
|
|
78
|
+
}>;
|
|
79
|
+
export interface CommitOutcome {
|
|
80
|
+
state: "committed" | "owed" | "would-commit";
|
|
81
|
+
subject: string;
|
|
82
|
+
sha?: string;
|
|
83
|
+
observed: string;
|
|
84
|
+
}
|
|
85
|
+
export interface PushOutcome {
|
|
86
|
+
state: "pushed" | "rejected" | "owed" | "would-push";
|
|
87
|
+
observed: string;
|
|
88
|
+
/** Present when a rejected push led to a second integration attempt. */
|
|
89
|
+
retryIntegration?: IntegrationResult;
|
|
90
|
+
}
|
|
91
|
+
export interface LandPathsInput {
|
|
92
|
+
gitRoot: string;
|
|
93
|
+
/** Paths relative to gitRoot. Missing ones are skipped and reported. */
|
|
94
|
+
paths: string[];
|
|
95
|
+
subject: string;
|
|
96
|
+
body: string;
|
|
97
|
+
dryRun?: boolean;
|
|
98
|
+
/** Skip the push (commit only). */
|
|
99
|
+
push?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface LandPathsResult {
|
|
102
|
+
integration: IntegrationResult;
|
|
103
|
+
staged: string[];
|
|
104
|
+
skipped: string[];
|
|
105
|
+
commit: CommitOutcome;
|
|
106
|
+
push: PushOutcome;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Integrate, stage exactly `paths`, commit exactly `paths`, push main.
|
|
110
|
+
*
|
|
111
|
+
* A rejected push is a stop: fetch once more, integrate once more (the merge
|
|
112
|
+
* touches only what the remote added), push once more, then report whatever
|
|
113
|
+
* the last push said. Nothing is undone on the way out.
|
|
114
|
+
*/
|
|
115
|
+
export declare function landPaths(input: LandPathsInput): Promise<LandPathsResult>;
|
|
116
|
+
/** Push main; on a rejected push, integrate once and push once more. */
|
|
117
|
+
export declare function pushMain(gitRoot: string): Promise<PushOutcome>;
|
|
118
|
+
export declare function withChronicleLock<T>(gitRoot: string, fn: () => Promise<T>): Promise<T>;
|
|
119
|
+
//# sourceMappingURL=git-landing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-landing.d.ts","sourceRoot":"","sources":["../src/git-landing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAA;IACX,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,iFAAiF;AACjF,wBAAsB,UAAU,CAC9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OAAO,CAAC,CAAC,CAAC,CAS5F"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git landing for a Chronicle vessel — fetch, integrate, path-limited add,
|
|
3
|
+
* commit, push — on a working tree other seats are editing at the same time.
|
|
4
|
+
*
|
|
5
|
+
* Rules this module keeps, each paid for in /srv/miadi/episodes:
|
|
6
|
+
*
|
|
7
|
+
* - `main` only moves forward. `.githooks/reference-transaction` refuses any
|
|
8
|
+
* non-fast-forward move of `refs/heads/main`, so a rebase (which moves main
|
|
9
|
+
* sideways) is never attempted. Divergence is integrated with a merge, or
|
|
10
|
+
* refused; never with a rewind.
|
|
11
|
+
* - Nothing here runs `stash`, `reset`, `checkout --`, `clean`, or `add .`.
|
|
12
|
+
* Another seat's dirty files are either untouched or the reason the door
|
|
13
|
+
* stops; git itself refuses a merge that would overwrite a dirty file,
|
|
14
|
+
* before touching anything.
|
|
15
|
+
* - The commit is path-limited twice: `git add -- <paths>` stages only the
|
|
16
|
+
* vessel files, and `git commit -- <paths>` commits only those, leaving any
|
|
17
|
+
* path another seat had staged exactly as staged.
|
|
18
|
+
* - Every step reports what git actually said (`observed`), the way
|
|
19
|
+
* voice-mcp's closing.ts `observe()` does. A refusal is data, not a throw.
|
|
20
|
+
*
|
|
21
|
+
* Ref: jgwill/Miadi#621, jgwill/Miadi#501.
|
|
22
|
+
*/
|
|
23
|
+
import { execFile } from "node:child_process";
|
|
24
|
+
import { existsSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
import { promisify } from "node:util";
|
|
27
|
+
const exec = promisify(execFile);
|
|
28
|
+
export const GIT_TIMEOUT_MS = 30_000;
|
|
29
|
+
/** Run one git command under `gitRoot` and report what it said. Never throws. */
|
|
30
|
+
export async function observeGit(gitRoot, args, options = {}) {
|
|
31
|
+
try {
|
|
32
|
+
const { stdout, stderr } = await exec("git", ["-C", gitRoot, ...args], {
|
|
33
|
+
env: { ...(options.env ?? process.env), GIT_TERMINAL_PROMPT: "0" },
|
|
34
|
+
timeout: options.timeoutMs ?? GIT_TIMEOUT_MS,
|
|
35
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
36
|
+
});
|
|
37
|
+
return { ok: true, out: (stdout.trim() || stderr.trim()).slice(0, 500) };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const err = error;
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
out: (err.stderr?.trim() || err.stdout?.trim() || err.message || String(error)).slice(0, 500),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The git root that holds the chronicle — measured, never assumed one level up. */
|
|
48
|
+
export async function chronicleGitRoot(chronicleRoot) {
|
|
49
|
+
const top = await observeGit(chronicleRoot, ["rev-parse", "--show-toplevel"]);
|
|
50
|
+
if (!top.ok || !top.out) {
|
|
51
|
+
throw new Error(`${chronicleRoot} is not inside a git repository: ${top.out}`);
|
|
52
|
+
}
|
|
53
|
+
return top.out;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The tree must be on `main` with no merge or rebase in flight. A tree in the
|
|
57
|
+
* middle of someone else's operation is theirs to finish; the door reports and
|
|
58
|
+
* waits.
|
|
59
|
+
*/
|
|
60
|
+
export async function preflightChronicle(gitRoot) {
|
|
61
|
+
const branch = await observeGit(gitRoot, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
62
|
+
if (!branch.ok) {
|
|
63
|
+
return { ok: false, branch: "", code: "chronicle_busy", message: `git cannot read HEAD: ${branch.out}` };
|
|
64
|
+
}
|
|
65
|
+
if (branch.out !== "main") {
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
branch: branch.out,
|
|
69
|
+
code: "chronicle_not_main",
|
|
70
|
+
message: `the chronicle checkout is on '${branch.out}', not main — the door only lands on main`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const gitDir = await observeGit(gitRoot, ["rev-parse", "--git-dir"]);
|
|
74
|
+
const dir = gitDir.ok ? (gitDir.out.startsWith("/") ? gitDir.out : join(gitRoot, gitDir.out)) : join(gitRoot, ".git");
|
|
75
|
+
for (const marker of ["rebase-merge", "rebase-apply", "MERGE_HEAD", "CHERRY_PICK_HEAD"]) {
|
|
76
|
+
if (existsSync(join(dir, marker))) {
|
|
77
|
+
return {
|
|
78
|
+
ok: false,
|
|
79
|
+
branch: branch.out,
|
|
80
|
+
code: "chronicle_busy",
|
|
81
|
+
message: `${marker} is present under ${dir} — another operation is in flight; the door does not resolve it`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { ok: true, branch: branch.out };
|
|
86
|
+
}
|
|
87
|
+
async function count(gitRoot, range) {
|
|
88
|
+
const result = await observeGit(gitRoot, ["rev-list", "--count", range]);
|
|
89
|
+
return result.ok && /^\d+$/.test(result.out) ? Number(result.out) : -1;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Fetch origin/main and bring it into main without ever rewinding.
|
|
93
|
+
*
|
|
94
|
+
* origin/main ⊆ main → up-to-date
|
|
95
|
+
* main ⊆ origin/main → merge --ff-only
|
|
96
|
+
* diverged → merge --no-edit (a merge commit is the
|
|
97
|
+
* price of a tree that forbids rewinds)
|
|
98
|
+
*
|
|
99
|
+
* `dryRun` fetches and measures but moves nothing.
|
|
100
|
+
*/
|
|
101
|
+
export async function integrateOrigin(gitRoot, options = {}) {
|
|
102
|
+
const fetched = await observeGit(gitRoot, ["fetch", "origin", "main", "--quiet"]);
|
|
103
|
+
if (!fetched.ok) {
|
|
104
|
+
return { state: "fetch-failed", observed: `git fetch origin main: ${fetched.out}`, behind: -1, ahead: -1 };
|
|
105
|
+
}
|
|
106
|
+
const behind = await count(gitRoot, "main..origin/main");
|
|
107
|
+
const ahead = await count(gitRoot, "origin/main..main");
|
|
108
|
+
if (behind === 0) {
|
|
109
|
+
return { state: "up-to-date", observed: `main is up to date with origin/main (ahead ${ahead})`, behind, ahead };
|
|
110
|
+
}
|
|
111
|
+
if (options.dryRun) {
|
|
112
|
+
return {
|
|
113
|
+
state: "would-integrate",
|
|
114
|
+
observed: `main is behind origin/main by ${behind} (ahead ${ahead}); would ${ahead === 0 ? "fast-forward" : "merge"}`,
|
|
115
|
+
behind,
|
|
116
|
+
ahead,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (ahead === 0) {
|
|
120
|
+
const ff = await observeGit(gitRoot, ["merge", "--ff-only", "origin/main"]);
|
|
121
|
+
return ff.ok
|
|
122
|
+
? { state: "fast-forwarded", observed: `git merge --ff-only origin/main: ${ff.out}`, behind, ahead }
|
|
123
|
+
: { state: "refused", observed: `git merge --ff-only origin/main refused: ${ff.out}`, behind, ahead };
|
|
124
|
+
}
|
|
125
|
+
if (options.allowMerge === false) {
|
|
126
|
+
return {
|
|
127
|
+
state: "refused",
|
|
128
|
+
observed: `main and origin/main have diverged (behind ${behind}, ahead ${ahead}) and merging is disabled`,
|
|
129
|
+
behind,
|
|
130
|
+
ahead,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const merged = await observeGit(gitRoot, ["merge", "--no-edit", "origin/main"]);
|
|
134
|
+
return merged.ok
|
|
135
|
+
? { state: "merged", observed: `git merge --no-edit origin/main: ${merged.out}`, behind, ahead }
|
|
136
|
+
: { state: "refused", observed: `git merge --no-edit origin/main refused: ${merged.out}`, behind, ahead };
|
|
137
|
+
}
|
|
138
|
+
/** Directory names origin/main holds under `subdir` — what other hosts have pushed. */
|
|
139
|
+
export async function originTreeNames(gitRoot, subdir) {
|
|
140
|
+
const result = await observeGit(gitRoot, ["ls-tree", "--name-only", `origin/main:${subdir}`]);
|
|
141
|
+
if (!result.ok)
|
|
142
|
+
return { ok: false, names: [], observed: `git ls-tree origin/main:${subdir}: ${result.out}` };
|
|
143
|
+
return { ok: true, names: result.out.split("\n").filter(Boolean), observed: `origin/main:${subdir} read` };
|
|
144
|
+
}
|
|
145
|
+
const NOTHING_STAGED = /nothing to commit|no changes added to commit|nothing added to commit/i;
|
|
146
|
+
const PUSH_REJECTED = /rejected|non-fast-forward|fetch first|failed to push/i;
|
|
147
|
+
/**
|
|
148
|
+
* Integrate, stage exactly `paths`, commit exactly `paths`, push main.
|
|
149
|
+
*
|
|
150
|
+
* A rejected push is a stop: fetch once more, integrate once more (the merge
|
|
151
|
+
* touches only what the remote added), push once more, then report whatever
|
|
152
|
+
* the last push said. Nothing is undone on the way out.
|
|
153
|
+
*/
|
|
154
|
+
export async function landPaths(input) {
|
|
155
|
+
const { gitRoot } = input;
|
|
156
|
+
const dryRun = input.dryRun === true;
|
|
157
|
+
const wantPush = input.push !== false;
|
|
158
|
+
const integration = await integrateOrigin(gitRoot, { dryRun });
|
|
159
|
+
const staged = [];
|
|
160
|
+
const skipped = [];
|
|
161
|
+
for (const path of input.paths) {
|
|
162
|
+
if (existsSync(join(gitRoot, path)))
|
|
163
|
+
staged.push(path);
|
|
164
|
+
else
|
|
165
|
+
skipped.push(path);
|
|
166
|
+
}
|
|
167
|
+
if (dryRun) {
|
|
168
|
+
return {
|
|
169
|
+
integration,
|
|
170
|
+
staged,
|
|
171
|
+
skipped,
|
|
172
|
+
commit: { state: "would-commit", subject: input.subject, observed: `would git add -- ${staged.join(" ")} and commit "${input.subject}"` },
|
|
173
|
+
push: { state: wantPush ? "would-push" : "owed", observed: wantPush ? "would git push origin main" : "push not requested" },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (integration.state === "refused" || integration.state === "fetch-failed") {
|
|
177
|
+
// A fetch that failed is not a reason to refuse a commit — the number check
|
|
178
|
+
// already said what it could see. A refused integration is: main cannot be
|
|
179
|
+
// pushed until it is, so the vessel would be committed onto a branch that
|
|
180
|
+
// cannot land. Commit anyway (the files are real and a commit is safer than
|
|
181
|
+
// uncommitted files on a shared tree), and let the push report the truth.
|
|
182
|
+
}
|
|
183
|
+
if (staged.length === 0) {
|
|
184
|
+
return {
|
|
185
|
+
integration,
|
|
186
|
+
staged,
|
|
187
|
+
skipped,
|
|
188
|
+
commit: { state: "owed", subject: input.subject, observed: `none of the named paths exist: ${input.paths.join(" ")}` },
|
|
189
|
+
push: { state: "owed", observed: "nothing to push" },
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const added = await observeGit(gitRoot, ["add", "--", ...staged]);
|
|
193
|
+
if (!added.ok) {
|
|
194
|
+
return {
|
|
195
|
+
integration,
|
|
196
|
+
staged,
|
|
197
|
+
skipped,
|
|
198
|
+
commit: { state: "owed", subject: input.subject, observed: `git add -- ${staged.join(" ")}: ${added.out}` },
|
|
199
|
+
push: { state: "owed", observed: "not attempted: nothing was committed" },
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const committed = await observeGit(gitRoot, [
|
|
203
|
+
"commit",
|
|
204
|
+
"--quiet",
|
|
205
|
+
"-m",
|
|
206
|
+
input.subject,
|
|
207
|
+
"-m",
|
|
208
|
+
input.body,
|
|
209
|
+
"--",
|
|
210
|
+
...staged,
|
|
211
|
+
]);
|
|
212
|
+
let commit;
|
|
213
|
+
if (committed.ok) {
|
|
214
|
+
const sha = await observeGit(gitRoot, ["rev-parse", "--short", "HEAD"]);
|
|
215
|
+
commit = {
|
|
216
|
+
state: "committed",
|
|
217
|
+
subject: input.subject,
|
|
218
|
+
sha: sha.ok ? sha.out : undefined,
|
|
219
|
+
observed: `git commit -- ${staged.join(" ")}: ${sha.ok ? sha.out : committed.out || "committed"}`,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
else if (NOTHING_STAGED.test(committed.out)) {
|
|
223
|
+
commit = { state: "owed", subject: input.subject, observed: `nothing to commit for ${staged.join(" ")} (already committed)` };
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return {
|
|
227
|
+
integration,
|
|
228
|
+
staged,
|
|
229
|
+
skipped,
|
|
230
|
+
commit: { state: "owed", subject: input.subject, observed: `git commit refused: ${committed.out}` },
|
|
231
|
+
push: { state: "owed", observed: "not attempted: nothing was committed" },
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (!wantPush) {
|
|
235
|
+
return { integration, staged, skipped, commit, push: { state: "owed", observed: "push not requested" } };
|
|
236
|
+
}
|
|
237
|
+
const push = await pushMain(gitRoot);
|
|
238
|
+
return { integration, staged, skipped, commit, push };
|
|
239
|
+
}
|
|
240
|
+
/** Push main; on a rejected push, integrate once and push once more. */
|
|
241
|
+
export async function pushMain(gitRoot) {
|
|
242
|
+
const unpushed = await count(gitRoot, "origin/main..main");
|
|
243
|
+
if (unpushed === 0)
|
|
244
|
+
return { state: "pushed", observed: "origin/main already holds main (nothing to push)" };
|
|
245
|
+
const first = await observeGit(gitRoot, ["push", "origin", "main"]);
|
|
246
|
+
if (first.ok)
|
|
247
|
+
return { state: "pushed", observed: `git push origin main: ${first.out || "ok"}` };
|
|
248
|
+
if (!PUSH_REJECTED.test(first.out)) {
|
|
249
|
+
return { state: "rejected", observed: `git push origin main: ${first.out}` };
|
|
250
|
+
}
|
|
251
|
+
const retryIntegration = await integrateOrigin(gitRoot);
|
|
252
|
+
if (retryIntegration.state === "refused" || retryIntegration.state === "fetch-failed") {
|
|
253
|
+
return {
|
|
254
|
+
state: "rejected",
|
|
255
|
+
observed: `git push origin main rejected (${first.out}); integration then ${retryIntegration.state}: ${retryIntegration.observed}`,
|
|
256
|
+
retryIntegration,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const second = await observeGit(gitRoot, ["push", "origin", "main"]);
|
|
260
|
+
return second.ok
|
|
261
|
+
? { state: "pushed", observed: `git push origin main (after ${retryIntegration.state}): ${second.out || "ok"}`, retryIntegration }
|
|
262
|
+
: { state: "rejected", observed: `git push origin main rejected twice: ${second.out}`, retryIntegration };
|
|
263
|
+
}
|
|
264
|
+
// One door, one landing at a time per git root. Two mints racing inside one
|
|
265
|
+
// process would otherwise both allocate the same number between the check and
|
|
266
|
+
// the mkdir. Across processes the guard is mkdir's EEXIST and git's index lock.
|
|
267
|
+
const locks = new Map();
|
|
268
|
+
export async function withChronicleLock(gitRoot, fn) {
|
|
269
|
+
const previous = locks.get(gitRoot) ?? Promise.resolve();
|
|
270
|
+
const next = previous.catch(() => undefined).then(fn);
|
|
271
|
+
locks.set(gitRoot, next);
|
|
272
|
+
try {
|
|
273
|
+
return await next;
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
if (locks.get(gitRoot) === next)
|
|
277
|
+
locks.delete(gitRoot);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=git-landing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-landing.js","sourceRoot":"","sources":["../src/git-landing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AAQpC,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,IAAc,EACd,UAA2D,EAAE;IAE7D,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE;YACrE,GAAG,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,mBAAmB,EAAE,GAAG,EAAE;YAClE,OAAO,EAAE,OAAO,CAAC,SAAS,IAAI,cAAc;YAC5C,SAAS,EAAE,CAAC,GAAG,IAAI,GAA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B,CAAC;YAAS,CAAC;QACT,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI;YAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACxD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export * from "./status.js";
|
|
|
13
13
|
export * from "./register.js";
|
|
14
14
|
export * from "./episode-node.js";
|
|
15
15
|
export * from "./attention-node.js";
|
|
16
|
+
export * from "./attention.js";
|
|
16
17
|
export * from "./catalog.js";
|
|
17
18
|
export * from "./story-library.js";
|
|
19
|
+
export * from "./git-landing.js";
|
|
20
|
+
export * from "./closing.js";
|
|
21
|
+
export * from "./mint.js";
|
|
18
22
|
export { runCli, type RunCliOptions, type CliStreams } from "./cli.js";
|
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,11 @@ export * from "./status.js";
|
|
|
13
13
|
export * from "./register.js";
|
|
14
14
|
export * from "./episode-node.js";
|
|
15
15
|
export * from "./attention-node.js";
|
|
16
|
+
export * from "./attention.js";
|
|
16
17
|
export * from "./catalog.js";
|
|
17
18
|
export * from "./story-library.js";
|
|
19
|
+
export * from "./git-landing.js";
|
|
20
|
+
export * from "./closing.js";
|
|
21
|
+
export * from "./mint.js";
|
|
18
22
|
export { runCli } from "./cli.js";
|
|
19
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,MAAM,EAAuC,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,MAAM,EAAuC,MAAM,UAAU,CAAA"}
|
package/dist/mcp-server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* inquiry-weave-mcp —
|
|
4
|
-
*
|
|
3
|
+
* inquiry-weave-mcp — inquiry threads and the Chronicle relations/actions
|
|
4
|
+
* around them.
|
|
5
5
|
*
|
|
6
6
|
* Feeds on the token-free HTTP surface (`/api/inquiry`, Etuaptmumk-RSM#259):
|
|
7
7
|
* no GitHub token exists in this process, by construction — the anonymity is
|
|
@@ -12,7 +12,17 @@
|
|
|
12
12
|
* Env:
|
|
13
13
|
* MIADI_INQUIRY_API_BASE required — e.g. http://localhost:3000 or the
|
|
14
14
|
* deployed app origin. No default is invented.
|
|
15
|
-
* MIADI_CHRONICLE_ROOT optional — enables inquiry_weave_kin
|
|
15
|
+
* MIADI_CHRONICLE_ROOT optional — enables inquiry_weave_kin and the
|
|
16
|
+
* Chronicle ATTENTION tools.
|
|
17
|
+
* MIADI_CHRONICLE_MW_URL optional — the one Chronicle wheel; without it
|
|
18
|
+
* an answer remains file-first and reports pending.
|
|
19
|
+
* MIADI_API_TOKEN_WRITER optional — presented to the app when the episode
|
|
20
|
+
* tools forward over HTTP (see below).
|
|
21
|
+
*
|
|
22
|
+
* The episode tools (chronicle_episode_*) speak to the library when
|
|
23
|
+
* MIADI_CHRONICLE_ROOT names a chronicle on this host, and otherwise forward to
|
|
24
|
+
* the app's /api/chronicle/episodes door at MIADI_INQUIRY_API_BASE — so an agent
|
|
25
|
+
* whose MCP host has no chronicle still has the verbs. Ref: jgwill/Miadi#621.
|
|
16
26
|
*
|
|
17
27
|
* Zero new dependencies: raw newline-delimited JSON-RPC over stdio.
|
|
18
28
|
*/
|
package/dist/mcp-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|