@detergent-software/conductor 3.0.0-dev.17 → 3.0.0-dev.19

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +26 -6
  3. package/build/cli.js +18 -2
  4. package/build/cli.js.map +1 -1
  5. package/build/code-host-cli.js +65 -10
  6. package/build/code-host-cli.js.map +1 -1
  7. package/build/code-host.js +3 -1
  8. package/build/code-host.js.map +1 -1
  9. package/build/config.js +5 -5
  10. package/build/config.js.map +1 -1
  11. package/build/credentials.js +26 -24
  12. package/build/credentials.js.map +1 -1
  13. package/build/help.js +44 -1
  14. package/build/help.js.map +1 -1
  15. package/build/host/credential-manager.js +109 -0
  16. package/build/host/credential-manager.js.map +1 -0
  17. package/build/host/keychain.js +44 -0
  18. package/build/host/keychain.js.map +1 -0
  19. package/build/host/libsecret.js +40 -0
  20. package/build/host/libsecret.js.map +1 -0
  21. package/build/host/platform.js +4 -0
  22. package/build/host/platform.js.map +1 -0
  23. package/build/host/secrets.js +46 -0
  24. package/build/host/secrets.js.map +1 -0
  25. package/build/lib/providers/ado/pipelines.js +65 -21
  26. package/build/lib/providers/ado/pipelines.js.map +1 -1
  27. package/build/lib/providers/github/actions.js +60 -2
  28. package/build/lib/providers/github/actions.js.map +1 -1
  29. package/build/lib/providers/index.js +1 -0
  30. package/build/lib/providers/index.js.map +1 -1
  31. package/build/lib/providers/timing.js +10 -0
  32. package/build/lib/providers/timing.js.map +1 -0
  33. package/build/project-check.js +2 -2
  34. package/build/project-check.js.map +1 -1
  35. package/build/pushover.js +5 -5
  36. package/build/pushover.js.map +1 -1
  37. package/build/runs.js +31 -30
  38. package/build/runs.js.map +1 -1
  39. package/build/timeline.js +104 -0
  40. package/build/timeline.js.map +1 -0
  41. package/package.json +1 -1
  42. package/plugin/skills/work-item/SKILL.md +1 -0
  43. package/build/credential.js +0 -66
  44. package/build/credential.js.map +0 -1
@@ -0,0 +1,104 @@
1
+ import { ConductorError } from "./errors.js";
2
+ import { NotFound, pipelinesNamed, ProviderError, stem, } from "./lib/providers/index.js";
3
+ import { grepRun } from "./runs.js";
4
+ // The most runs --count reads: each is a timeline and, with --grep, a log per named task.
5
+ export const MAX_RUNS = 20;
6
+ // How many runs are read at once.
7
+ const BATCH = 4;
8
+ // A run in these states hasn't run all its tasks yet.
9
+ const UNFINISHED = new Set(['queued', 'running', 'waiting-for-approval']);
10
+ // The last finished runs of the pipeline `name` (a YAML file, its stem or the pipeline's name) on a
11
+ // branch, newest first, each with its timeline. A name no pipeline, or more than one, answers to
12
+ // is refused with the repo's pipelines.
13
+ export async function pipelineTimelines(ci, request) {
14
+ const pipelines = await ci.pipelines();
15
+ let named;
16
+ try {
17
+ named = pipelinesNamed([request.name], pipelines);
18
+ }
19
+ catch (error) {
20
+ throw new ConductorError(error instanceof Error ? error.message : String(error));
21
+ }
22
+ const [pipeline] = named;
23
+ if (pipeline === undefined)
24
+ throw new ConductorError(`--for ${request.name}: no pipeline answers to it`);
25
+ const runs = await ci.recentRuns(pipeline, { branch: request.branch, count: request.count });
26
+ const label = stem(pipeline.file) || pipeline.name;
27
+ // A few at a time: each run is a timeline and a log per named task, and a burst of them draws the
28
+ // host's throttling.
29
+ const reports = [];
30
+ const listed = runs.flatMap((r) => (r.run === null ? [] : [{ ...r, run: r.run }]));
31
+ for (let i = 0; i < listed.length; i += BATCH) {
32
+ const batch = listed.slice(i, i + BATCH).map(async (r) => {
33
+ try {
34
+ return await runTimeline(ci, r.run, request, label);
35
+ }
36
+ catch (error) {
37
+ // One run whose timeline the provider won't give doesn't hide the others.
38
+ if (!(error instanceof NotFound || (error instanceof ProviderError && !error.transient)))
39
+ throw error;
40
+ return {
41
+ finished: null,
42
+ note: `its timeline can't be read: ${error.message}`,
43
+ pipeline: label,
44
+ result: r.result ?? null,
45
+ run: r.run,
46
+ seconds: null,
47
+ sourceVersion: r.sourceVersion ?? null,
48
+ started: null,
49
+ state: r.state,
50
+ tasks: [],
51
+ url: r.url,
52
+ };
53
+ }
54
+ });
55
+ reports.push(...(await Promise.all(batch)));
56
+ }
57
+ return { branch: request.branch, count: runs.length, pipeline, runs: reports };
58
+ }
59
+ // One run's timeline: its tasks (those --task names, else all) and, with --grep, their log lines
60
+ // that match.
61
+ export async function runTimeline(ci, run, filter, pipeline) {
62
+ const timeline = await ci.timeline(run);
63
+ const named = (task) => filter.task === null || filter.task.test(task);
64
+ const tasks = timeline.tasks.filter((t) => named(t.task));
65
+ const state = timeline.run.state;
66
+ const notes = [
67
+ UNFINISHED.has(state) ? `the run is ${state}: its tasks and their logs may be partial` : null,
68
+ filter.task !== null && tasks.length === 0 ? noTask(filter.task, timeline) : null,
69
+ ].filter((n) => n !== null);
70
+ const grep = filter.grep === null || tasks.length === 0
71
+ ? null
72
+ : unread(tasks, await grepRun(ci, run, filter.grep, filter.task === null ? undefined : named));
73
+ return {
74
+ finished: timeline.finished,
75
+ ...(grep === null ? {} : { grep }),
76
+ ...(notes.length > 0 ? { note: notes.join('; ') } : {}),
77
+ pipeline: pipeline ?? timeline.run.pipeline.name,
78
+ result: timeline.run.result ?? null,
79
+ run,
80
+ seconds: timeline.seconds,
81
+ sourceVersion: timeline.run.sourceVersion ?? null,
82
+ started: timeline.started,
83
+ state: timeline.run.state,
84
+ tasks,
85
+ url: timeline.run.url,
86
+ };
87
+ }
88
+ // Why --task kept nothing, with the run's task names, so nobody takes it for a run without them.
89
+ function noTask(task, timeline) {
90
+ const names = [...new Set(timeline.tasks.map((t) => t.task))];
91
+ return `no task matches --task ${task.source}; its tasks: ${names.join(', ') || 'none'}`;
92
+ }
93
+ // The grep, with a note naming each kept task whose log it never read (one that was skipped or never
94
+ // ran has none, and GitHub's log can name a step differently), so no match there isn't taken for a
95
+ // task that printed nothing.
96
+ function unread(tasks, grep) {
97
+ const read = new Set(grep.searched.map((s) => s.task));
98
+ const missing = [...new Set(tasks.map((t) => t.task))].filter((task) => !read.has(task));
99
+ if (missing.length === 0)
100
+ return grep;
101
+ const note = `no log read for ${missing.join(', ')}: skipped, never run, or not in the CI's log by that name`;
102
+ return { ...grep, note: grep.note === undefined ? note : `${grep.note}; ${note}` };
103
+ }
104
+ //# sourceMappingURL=timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,QAAQ,EAER,cAAc,EACd,aAAa,EAGb,IAAI,GAEL,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAgB,OAAO,EAAiB,MAAM,WAAW,CAAC;AA8BjE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B,kCAAkC;AAClC,MAAM,KAAK,GAAG,CAAC,CAAC;AAEhB,sDAAsD;AACtD,MAAM,UAAU,GAA0B,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC;AAEjG,oGAAoG;AACpG,iGAAiG;AACjG,wCAAwC;AACxC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,EAAuE,EACvE,OAAyE;IAEzE,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;IACvC,IAAI,KAAiB,CAAC;IACtB,IAAI,CAAC;QACH,KAAK,GAAG,cAAc,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,cAAc,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IACzB,IAAI,QAAQ,KAAK,SAAS;QAAE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AC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;AACrF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@detergent-software/conductor",
3
- "version": "3.0.0-dev.17",
3
+ "version": "3.0.0-dev.19",
4
4
  "description": "Conductor: the local daemon that runs conducted projects' work loops (conduct serve) and its conduct CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,6 +30,7 @@ This skill is the order of work. **Conductor does the rest**: every read and wri
30
30
  | Arm the landing and read its verdict; wait for it | `conduct land <pr> …`; `conduct wait pr <pr>` |
31
31
  | A merge's runs, failed logs and npm stages; wait for them | `conduct runs <sha> [--for …]`; `conduct wait merge <sha> [--for …]` |
32
32
  | What a merge's run printed, or never printed, succeeded or not (a dev proof) | `conduct runs <sha> --for <pipeline> --grep <pattern>` |
33
+ | How long a run's tasks took, and the named tasks' log lines; the same over a pipeline's last runs on a branch, with no merge commit | `conduct timeline <run> [--task <regex>] [--grep <regex>]`; `conduct timeline --for <pipeline> [--branch <b>] [--count <n>] …` |
33
34
  | A version on npm | `conduct wait npm <version> --tag <dist-tag> --package <name>` |
34
35
  | The browser lock every session shares | `conduct lock acquire\|release chrome` |
35
36
 
@@ -1,66 +0,0 @@
1
- import { run } from "./run.js";
2
- const NOT_FOUND = 3;
3
- // Win32 ERROR_NOT_FOUND: CredRead's "no such credential". Any other failure is a broken read.
4
- const ERROR_NOT_FOUND = 1168;
5
- // Writes the user name, a newline, then the password.
6
- const CRED_READ = `
7
- $ErrorActionPreference = 'Stop'
8
- try {
9
- Add-Type -Namespace AtkConduct -Name Cred -MemberDefinition @'
10
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
11
- public static extern bool CredRead(string target, int type, int flags, out System.IntPtr cred);
12
- [DllImport("advapi32.dll")]
13
- public static extern void CredFree(System.IntPtr cred);
14
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
15
- public struct CREDENTIAL { public int Flags; public int Type; public string TargetName; public string Comment;
16
- public long LastWritten; public int CredentialBlobSize; public System.IntPtr CredentialBlob; public int Persist;
17
- public int AttributeCount; public System.IntPtr Attributes; public string TargetAlias; public string UserName; }
18
- '@
19
- $p = [IntPtr]::Zero
20
- if (-not [AtkConduct.Cred]::CredRead($env:ATK_CONDUCT_CRED_TARGET, 1, 0, [ref]$p)) {
21
- $code = [Runtime.InteropServices.Marshal]::GetLastWin32Error()
22
- if ($code -eq ${ERROR_NOT_FOUND}) { exit ${NOT_FOUND} }
23
- [Console]::Error.WriteLine("CredRead failed with Win32 error $code"); exit 4
24
- }
25
- try {
26
- $c = [Runtime.InteropServices.Marshal]::PtrToStructure($p, [type][AtkConduct.Cred+CREDENTIAL])
27
- [Console]::Out.Write([string]$c.UserName + [char]10)
28
- [Console]::Out.Write([Runtime.InteropServices.Marshal]::PtrToStringUni($c.CredentialBlob, $c.CredentialBlobSize / 2))
29
- } finally { [AtkConduct.Cred]::CredFree($p) }
30
- } catch { [Console]::Error.WriteLine($_.Exception.Message); exit 4 }
31
- `;
32
- export async function credentialSaved(target, env = process.env) {
33
- if (process.platform !== 'win32')
34
- return 'missing';
35
- const result = await run('cmdkey', [`/list:${target}`], { env, timeoutMs: 15_000 });
36
- if (result.code !== 0)
37
- return 'unknown';
38
- if (/\*\s*NONE\s*\*/.test(result.stdout))
39
- return 'missing';
40
- return /^\s*Target:/m.test(result.stdout) ? 'saved' : 'unknown';
41
- }
42
- // Reads the generic credential `target`. Windows only.
43
- export async function readCredential(target, env = process.env) {
44
- if (process.platform !== 'win32')
45
- return { found: false, missing: true, reason: `the ${target} credential is Windows-only` };
46
- const result = await run('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(CRED_READ, 'utf16le').toString('base64')], { env: { ...env, ATK_CONDUCT_CRED_TARGET: target }, timeoutMs: 30_000 });
47
- if (result.code === 0) {
48
- const newline = result.stdout.indexOf('\n');
49
- const secret = result.stdout.slice(newline + 1).trim();
50
- if (newline >= 0 && secret)
51
- return { credential: { secret, user: result.stdout.slice(0, newline).trim() }, found: true };
52
- }
53
- if (result.code === NOT_FOUND)
54
- return { found: false, missing: true, reason: `no credential ${target}` };
55
- // Never echo stdout here: on a partial failure it could hold the secret.
56
- const line = result.stderr
57
- .split(/\r?\n/)
58
- .map((l) => l.trim())
59
- .find((l) => l && !l.startsWith('#< CLIXML') && !l.startsWith('<Objs'));
60
- return {
61
- found: false,
62
- missing: false,
63
- reason: `the credential ${target} couldn't be read (${result.error ?? line ?? `exit ${result.code}`})`,
64
- };
65
- }
66
- //# sourceMappingURL=credential.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential.js","sourceRoot":"","sources":["../src/credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAe/B,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,8FAA8F;AAC9F,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,sDAAsD;AACtD,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;kBAgBA,eAAe,YAAY,SAAS;;;;;;;;;CASrD,CAAC;AAMF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,MAAyB,OAAO,CAAC,GAAG;IACxF,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3D,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC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