my-durable 0.0.81 → 0.0.82
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/apps/dpi-backend/src/git.ts +102 -7
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/{index-CkTw4GSI.css → index-CWwzfO2u.css} +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-DVneTCfd.js +82 -0
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/index.html +2 -2
- package/apps/dpi-playground/apps/dpi-playground-fe/src/components/GitPanel.vue +57 -11
- package/apps/dpi-sdk/src/client.ts +7 -0
- package/package.json +1 -1
- package/apps/dpi-playground/apps/dpi-playground-fe/dist/assets/index-CqQCh8Ch.js +0 -82
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<meta name="referrer" content="no-referrer" />
|
|
8
8
|
<link rel="icon" type="image/svg+xml" href="/icons/durable-pi.svg" />
|
|
9
9
|
<title>Durable Pi | Network</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-DVneTCfd.js"></script>
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CWwzfO2u.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="app"></div>
|
|
@@ -130,7 +130,32 @@ const prs = ref<{ n: number; title: string; state: string; draft: boolean; branc
|
|
|
130
130
|
const prsOpen = ref(false);
|
|
131
131
|
const prChecks = ref<Map<number, string>>(new Map());
|
|
132
132
|
const prBusy = ref(false);
|
|
133
|
-
|
|
133
|
+
/** The forge decides which actions exist. `gh` only speaks GitHub; a GitLab
|
|
134
|
+
* origin used to fall through the same regex, so its "list PRs" button ran
|
|
135
|
+
* `gh pr list` and reported nothing. Non-GitHub forges get link-first
|
|
136
|
+
* actions built from the origin URL — no CLI, no login, no assumption. */
|
|
137
|
+
const forge = computed<"github" | "gitlab" | "bitbucket" | "other" | undefined>(() => status.value?.forge);
|
|
138
|
+
const isGitHub = computed(() => forge.value === "github");
|
|
139
|
+
const webUrl = computed(() => status.value?.webUrl ?? "");
|
|
140
|
+
const changeLabel = computed(() =>
|
|
141
|
+
forge.value === "gitlab" ? "merge request" : forge.value === "bitbucket" ? "pull request" : forge.value === "github" ? "pull request" : "change request",
|
|
142
|
+
);
|
|
143
|
+
/** Open a new MR/PR on the forge's own website, source branch prefilled. */
|
|
144
|
+
const newChangeHref = computed(() => {
|
|
145
|
+
const br = status.value?.branch;
|
|
146
|
+
const base = status.value?.upstream?.replace(/^[^/]+\//, "");
|
|
147
|
+
if (!br || !webUrl.value) return "";
|
|
148
|
+
const e = encodeURIComponent(br);
|
|
149
|
+
const b = base ? encodeURIComponent(base) : "";
|
|
150
|
+
if (forge.value === "gitlab")
|
|
151
|
+
return `${webUrl.value}/-/merge_requests/new?merge_request%5Bsource_branch%5D=${e}${b ? `&merge_request%5Btarget_branch%5D=${b}` : ""}`;
|
|
152
|
+
if (forge.value === "bitbucket") return `${webUrl.value}/pull-requests/new?source=${e}${b ? `&dest=${b}` : ""}`;
|
|
153
|
+
if (forge.value === "github") return `${webUrl.value}/compare/${b || "main"}...${e}?expand=1`;
|
|
154
|
+
return "";
|
|
155
|
+
});
|
|
156
|
+
const changesHref = computed(() =>
|
|
157
|
+
forge.value === "gitlab" ? `${webUrl.value}/-/merge_requests` : forge.value === "bitbucket" ? `${webUrl.value}/pull-requests` : `${webUrl.value}/pulls`,
|
|
158
|
+
);
|
|
134
159
|
const loadPRs = async () => {
|
|
135
160
|
if (!devId.value || !cwd.value) return;
|
|
136
161
|
const allowed = gitAllowedFor(devId.value, cwd.value);
|
|
@@ -313,12 +338,15 @@ const isConflict = (f: { x: string; y: string }) => "UAD".includes(f.x) && "UAD"
|
|
|
313
338
|
const conflictFiles = computed(() => files.value.filter(isConflict));
|
|
314
339
|
const atCap = computed(() => files.value.length >= 500);
|
|
315
340
|
const dirty = computed(() => (status.value?.staged ?? 0) + (status.value?.unstaged ?? 0) + (status.value?.untracked ?? 0) > 0);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
341
|
+
/** Only when git ITSELF cannot resolve an author — i.e. a commit would be
|
|
342
|
+
* refused. An empty `git config user.name` is not the test: git also reads
|
|
343
|
+
* the GIT_AUTHOR_ / EMAIL environment and falls back to the OS account
|
|
344
|
+
* (Windows: USERNAME), so the old check told working machines to "set
|
|
345
|
+
* user.name" while their commits were fine. */
|
|
346
|
+
const noIdentity = computed(() => status.value?.repo === true && status.value?.identityComplete === false);
|
|
347
|
+
/** The device parses the origin once (ssh/https/self-hosted/nested GitLab
|
|
348
|
+
* namespaces) and reports the browser URL; a second FE parser drifted from it. */
|
|
349
|
+
const remoteWeb = computed(() => status.value?.webUrl ?? "");
|
|
322
350
|
const toggle = (p: string) => {
|
|
323
351
|
const next = new Set(checked.value);
|
|
324
352
|
if (next.has(p)) next.delete(p);
|
|
@@ -1011,7 +1039,11 @@ const laneX = (lane: number) => lane * 12 + 7;
|
|
|
1011
1039
|
turns
|
|
1012
1040
|
</button>
|
|
1013
1041
|
</div>
|
|
1014
|
-
<p v-if="noIdentity" class="hintbox warn">
|
|
1042
|
+
<p v-if="noIdentity" class="hintbox warn">
|
|
1043
|
+
git on the device cannot resolve an author, so commits would be refused. Set one for the account that runs the device:
|
|
1044
|
+
<code>git config --global user.name "Your Name"</code> and <code>git config --global user.email "you@example.com"</code>
|
|
1045
|
+
(or just this repo: <code>git config user.name …</code>), then restart the device so it picks the new config up.
|
|
1046
|
+
</p>
|
|
1015
1047
|
<div v-if="turnsOpen" class="cps turns">
|
|
1016
1048
|
<p v-if="!turns.length" class="hint">no turns recorded yet for this session.</p>
|
|
1017
1049
|
<div v-for="(t, ti) in turns" :key="ti" class="cp-row">
|
|
@@ -1199,10 +1231,23 @@ const laneX = (lane: number) => lane * 12 + 7;
|
|
|
1199
1231
|
</div>
|
|
1200
1232
|
</section>
|
|
1201
1233
|
|
|
1202
|
-
<!--
|
|
1203
|
-
<section v-if="
|
|
1234
|
+
<!-- CODE REVIEW on ANY forge: gh panel on GitHub, links elsewhere -->
|
|
1235
|
+
<section v-if="webUrl" class="task-section" aria-label="Code review">
|
|
1236
|
+
<div class="panel-heading">
|
|
1237
|
+
<h4><GitMerge :size="16" /> {{ isGitHub ? "Pull requests" : changeLabel + "s" }}</h4>
|
|
1238
|
+
<span class="grow" />
|
|
1239
|
+
<a v-if="!isGitHub && newChangeHref" class="small btn-like" :href="newChangeHref" target="_blank" rel="noopener">new {{ changeLabel }}</a>
|
|
1240
|
+
<a v-if="!isGitHub" class="small btn-like" :href="changesHref" target="_blank" rel="noopener">open {{ changeLabel }}s</a>
|
|
1241
|
+
<a v-if="!isGitHub" class="small btn-like" :href="webUrl" target="_blank" rel="noopener">repo</a>
|
|
1242
|
+
</div>
|
|
1243
|
+
<template v-if="!isGitHub">
|
|
1244
|
+
<p class="hint">
|
|
1245
|
+
{{ forge === "gitlab" ? "GitLab" : forge === "bitbucket" ? "Bitbucket" : "this forge" }} — {{ changeLabel }}s open on the website:
|
|
1246
|
+
review, approve and merge there (the device drives <code>git</code> itself; only GitHub has a CLI it can drive).
|
|
1247
|
+
</p>
|
|
1248
|
+
</template>
|
|
1249
|
+
<template v-else>
|
|
1204
1250
|
<div class="panel-heading">
|
|
1205
|
-
<h4><GitMerge :size="16" /> Pull requests</h4>
|
|
1206
1251
|
<span class="grow" />
|
|
1207
1252
|
<button class="small" :disabled="prBusy || !!busy" @click="prCreate">create PR</button>
|
|
1208
1253
|
<button class="small" :disabled="prBusy" @click="prsOpen = !prsOpen">{{ prsOpen ? "hide" : "list" }}</button>
|
|
@@ -1222,6 +1267,7 @@ const laneX = (lane: number) => lane * 12 + 7;
|
|
|
1222
1267
|
</div>
|
|
1223
1268
|
<pre v-for="[n, text] in prChecks" :key="n" class="pr-checks">#{{ n }} checks:{{ "\n" }}{{ text }}</pre>
|
|
1224
1269
|
</div>
|
|
1270
|
+
</template>
|
|
1225
1271
|
</section>
|
|
1226
1272
|
|
|
1227
1273
|
<pre v-if="out" class="op-out">{{ out.slice(0, 6000) }}</pre>
|
|
@@ -85,7 +85,14 @@ export interface GitStatus {
|
|
|
85
85
|
branches?: { name: string; current?: boolean; upstream?: string }[];
|
|
86
86
|
merge?: boolean;
|
|
87
87
|
conflicts?: number;
|
|
88
|
+
/** The identity a commit would be authored with (git's own resolution). */
|
|
88
89
|
identity?: { name?: string; email?: string };
|
|
90
|
+
/** False ⇔ git itself would refuse to commit here (no resolvable author). */
|
|
91
|
+
identityComplete?: boolean;
|
|
92
|
+
/** Which forge `origin` belongs to — the UI must not assume GitHub. */
|
|
93
|
+
forge?: "github" | "gitlab" | "bitbucket" | "other";
|
|
94
|
+
/** Browser URL of the origin repo (ssh/https/self-hosted/nested namespaces). */
|
|
95
|
+
webUrl?: string;
|
|
89
96
|
remoteUrl?: string;
|
|
90
97
|
}
|
|
91
98
|
export type GitOpName =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-durable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
4
4
|
"description": "Durable Pi — the durable agent network: hub web UI, device backend daemon, TUI admin and the shared SDK, packaged as one runnable monorepo install",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|