@detergent-software/conductor 1.4.0 → 1.5.0-dev.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/CHANGELOG.md +14 -0
- package/README.md +11 -2
- package/build/checkout-sync.js +3 -2
- package/build/checkout-sync.js.map +1 -1
- package/build/inbox.js +17 -14
- package/build/inbox.js.map +1 -1
- package/build/links.js +70 -0
- package/build/links.js.map +1 -0
- package/build/notes.js +26 -2
- package/build/notes.js.map +1 -1
- package/build/notify.js +1 -1
- package/build/notify.js.map +1 -1
- package/build/store.js +28 -2
- package/build/store.js.map +1 -1
- package/build/train.js +4 -3
- package/build/train.js.map +1 -1
- package/mod/hooks/model.ts +11 -3
- package/mod/hooks/register.tsx +7 -9
- package/mod/types/index.d.ts +7 -1
- package/package.json +1 -1
package/mod/hooks/model.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// the band and pane show, and what each event asks the mod to do. register.tsx does
|
|
3
3
|
// the engine's part (only its top-level functions may take `$`); vitest tests this file in CI
|
|
4
4
|
// (apps/conductor/mod/tests/model.spec.ts).
|
|
5
|
-
import type { ConductorInboxItem, ConductorNotify, ConductorSnapshot, ConductorWorker } from '../types';
|
|
5
|
+
import type { ConductorInboxItem, ConductorLink, ConductorNotify, ConductorSnapshot, ConductorWorker } from '../types';
|
|
6
6
|
|
|
7
7
|
// A daemon API answer: its status and parsed JSON body.
|
|
8
8
|
export type ApiAnswer = { body: unknown; status: number };
|
|
@@ -222,7 +222,7 @@ export function inboxText(inbox: readonly ConductorInboxItem[], now: number): st
|
|
|
222
222
|
`#${i.id} ${i.kind} ${i.item ?? ''}${i.project ? ` (${i.project})` : ''} ${age(i.raisedAt, now)}`,
|
|
223
223
|
` ${i.text}`,
|
|
224
224
|
...i.commands.map((c) => ` $ ${c}`),
|
|
225
|
-
...i.links.map((l) => ` ${l}`),
|
|
225
|
+
...i.links.map((l) => ` ${l.label}: ${l.href}`),
|
|
226
226
|
])
|
|
227
227
|
.join('\n');
|
|
228
228
|
}
|
|
@@ -367,7 +367,7 @@ export function parseInbox(body: unknown): ConductorInboxItem[] | null {
|
|
|
367
367
|
id: i.id,
|
|
368
368
|
item: typeof i.item === 'string' ? i.item : null,
|
|
369
369
|
kind: i.kind,
|
|
370
|
-
links:
|
|
370
|
+
links: links(i.links),
|
|
371
371
|
project: typeof i.project === 'string' ? i.project : null,
|
|
372
372
|
raisedAt: typeof i.raisedAt === 'string' ? i.raisedAt : '',
|
|
373
373
|
text: i.text,
|
|
@@ -627,6 +627,14 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
627
627
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
// An inbox item's named links; one without an href or a label is left out.
|
|
631
|
+
function links(value: unknown): ConductorLink[] {
|
|
632
|
+
if (!Array.isArray(value)) return [];
|
|
633
|
+
return value.flatMap((l: unknown) =>
|
|
634
|
+
isRecord(l) && typeof l.href === 'string' && typeof l.label === 'string' ? [{ href: l.href, label: l.label }] : [],
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
|
|
630
638
|
function strings(value: unknown): string[] {
|
|
631
639
|
return Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : [];
|
|
632
640
|
}
|
package/mod/hooks/register.tsx
CHANGED
|
@@ -809,15 +809,13 @@ export const register: Register = (on) => {
|
|
|
809
809
|
onPress={(press) => copy($, command, press.surface)}
|
|
810
810
|
/>
|
|
811
811
|
))}
|
|
812
|
-
{item.links
|
|
813
|
-
.
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
),
|
|
820
|
-
)}
|
|
812
|
+
{item.links.map(({ href, label }, n) =>
|
|
813
|
+
e.surface === 'terminal' && isWindows && isWebLink(href) ? (
|
|
814
|
+
<Button key={`link-${item.id}-${n}`} label={`open ${label}`} onPress={() => openLink($, href)} />
|
|
815
|
+
) : (
|
|
816
|
+
<Link href={href} key={`link-${item.id}-${n}`} label={`open ${label}`} />
|
|
817
|
+
),
|
|
818
|
+
)}
|
|
821
819
|
{item.kind !== 'plan' && (
|
|
822
820
|
<Button
|
|
823
821
|
key={`done-${item.id}`}
|
package/mod/types/index.d.ts
CHANGED
|
@@ -20,12 +20,18 @@ export type ConductorInboxItem = {
|
|
|
20
20
|
id: number;
|
|
21
21
|
item: string | null;
|
|
22
22
|
kind: string;
|
|
23
|
-
|
|
23
|
+
// Each named by the daemon (ATK-509), such as { label: 'PR 2078', href: 'https://…' }.
|
|
24
|
+
links: ConductorLink[];
|
|
24
25
|
project: string | null;
|
|
25
26
|
raisedAt: string;
|
|
26
27
|
text: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
export type ConductorLink = {
|
|
31
|
+
href: string;
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
29
35
|
// GET /notify as the mod draws it: the profile, the others to switch to, Remote Control's state.
|
|
30
36
|
export type ConductorNotify = {
|
|
31
37
|
held: number;
|
package/package.json
CHANGED