@codyswann/lisa 2.235.0 → 2.236.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.
Files changed (105) hide show
  1. package/dist/cli/ui-automations-adapters.d.ts +50 -0
  2. package/dist/cli/ui-automations-adapters.d.ts.map +1 -0
  3. package/dist/cli/ui-automations-adapters.js +162 -0
  4. package/dist/cli/ui-automations-adapters.js.map +1 -0
  5. package/dist/cli/ui-automations.d.ts +89 -0
  6. package/dist/cli/ui-automations.d.ts.map +1 -0
  7. package/dist/cli/ui-automations.js +148 -0
  8. package/dist/cli/ui-automations.js.map +1 -0
  9. package/dist/cli/ui-cmd.d.ts +5 -0
  10. package/dist/cli/ui-cmd.d.ts.map +1 -1
  11. package/dist/cli/ui-cmd.js +17 -0
  12. package/dist/cli/ui-cmd.js.map +1 -1
  13. package/dist/cli/ui-deploy-pipeline-model.d.ts +70 -0
  14. package/dist/cli/ui-deploy-pipeline-model.d.ts.map +1 -0
  15. package/dist/cli/ui-deploy-pipeline-model.js +127 -0
  16. package/dist/cli/ui-deploy-pipeline-model.js.map +1 -0
  17. package/dist/cli/ui-deploy-pipeline.d.ts +25 -0
  18. package/dist/cli/ui-deploy-pipeline.d.ts.map +1 -0
  19. package/dist/cli/ui-deploy-pipeline.js +192 -0
  20. package/dist/cli/ui-deploy-pipeline.js.map +1 -0
  21. package/dist/cli/ui-detected-stacks.d.ts +20 -0
  22. package/dist/cli/ui-detected-stacks.d.ts.map +1 -0
  23. package/dist/cli/ui-detected-stacks.js +28 -0
  24. package/dist/cli/ui-detected-stacks.js.map +1 -0
  25. package/dist/cli/ui-enabled-plugins.d.ts +52 -0
  26. package/dist/cli/ui-enabled-plugins.d.ts.map +1 -0
  27. package/dist/cli/ui-enabled-plugins.js +253 -0
  28. package/dist/cli/ui-enabled-plugins.js.map +1 -0
  29. package/dist/cli/ui-github-repo-expected.d.ts +36 -0
  30. package/dist/cli/ui-github-repo-expected.d.ts.map +1 -0
  31. package/dist/cli/ui-github-repo-expected.js +118 -0
  32. package/dist/cli/ui-github-repo-expected.js.map +1 -0
  33. package/dist/cli/ui-github-repo-gh.d.ts +36 -0
  34. package/dist/cli/ui-github-repo-gh.d.ts.map +1 -0
  35. package/dist/cli/ui-github-repo-gh.js +112 -0
  36. package/dist/cli/ui-github-repo-gh.js.map +1 -0
  37. package/dist/cli/ui-github-repo-map.d.ts +25 -0
  38. package/dist/cli/ui-github-repo-map.d.ts.map +1 -0
  39. package/dist/cli/ui-github-repo-map.js +150 -0
  40. package/dist/cli/ui-github-repo-map.js.map +1 -0
  41. package/dist/cli/ui-github-repo.d.ts +51 -0
  42. package/dist/cli/ui-github-repo.d.ts.map +1 -0
  43. package/dist/cli/ui-github-repo.js +117 -0
  44. package/dist/cli/ui-github-repo.js.map +1 -0
  45. package/dist/cli/ui-observability-checks.d.ts +23 -0
  46. package/dist/cli/ui-observability-checks.d.ts.map +1 -0
  47. package/dist/cli/ui-observability-checks.js +156 -0
  48. package/dist/cli/ui-observability-checks.js.map +1 -0
  49. package/dist/cli/ui-observability-providers.d.ts +69 -0
  50. package/dist/cli/ui-observability-providers.d.ts.map +1 -0
  51. package/dist/cli/ui-observability-providers.js +99 -0
  52. package/dist/cli/ui-observability-providers.js.map +1 -0
  53. package/package.json +1 -1
  54. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  56. package/plugins/lisa-agy/plugin.json +1 -1
  57. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  60. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  66. package/plugins/lisa-expo-agy/plugin.json +1 -1
  67. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  71. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  72. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  76. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  77. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  81. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  82. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  86. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  87. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  91. package/plugins/lisa-rails-agy/plugin.json +1 -1
  92. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  96. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  97. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  100. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  101. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  102. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  104. package/ui/README.md +5 -3
  105. package/ui/index.html +1097 -432
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Require a boolean field from a plain object.
3
+ * @param record - Source object
4
+ * @param key - Property name
5
+ * @returns Boolean value
6
+ */
7
+ function requireBoolean(record, key) {
8
+ const value = Reflect.get(record, key);
9
+ if (typeof value !== "boolean") {
10
+ throw new TypeError(`Repository settings omitted boolean ${key}`);
11
+ }
12
+ return value;
13
+ }
14
+ /**
15
+ * Require a string field from a plain object.
16
+ * @param record - Source object
17
+ * @param key - Property name
18
+ * @returns String value
19
+ */
20
+ function requireString(record, key) {
21
+ const value = Reflect.get(record, key);
22
+ if (typeof value !== "string" || value.trim().length === 0) {
23
+ throw new TypeError(`Repository settings omitted string ${key}`);
24
+ }
25
+ return value;
26
+ }
27
+ /**
28
+ * Derive secret-scanning enabled from the security_and_analysis payload.
29
+ * @param record - Repository API object
30
+ * @returns Whether secret scanning is enabled
31
+ */
32
+ function secretScanningEnabled(record) {
33
+ const security = Reflect.get(record, "security_and_analysis");
34
+ if (security === null || typeof security !== "object") {
35
+ return false;
36
+ }
37
+ const scanning = Reflect.get(security, "secret_scanning");
38
+ if (scanning === null || typeof scanning !== "object") {
39
+ return false;
40
+ }
41
+ return Reflect.get(scanning, "status") === "enabled";
42
+ }
43
+ /**
44
+ * Map repository JSON into the panel settings shape.
45
+ * @param raw - Parsed `gh api repos/{owner}/{repo}` payload
46
+ * @returns Settings for the console
47
+ */
48
+ export function mapRepoSettings(raw) {
49
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
50
+ throw new TypeError("Repository settings response was not an object");
51
+ }
52
+ return {
53
+ allow_merge_commit: requireBoolean(raw, "allow_merge_commit"),
54
+ allow_squash_merge: requireBoolean(raw, "allow_squash_merge"),
55
+ allow_rebase_merge: requireBoolean(raw, "allow_rebase_merge"),
56
+ allow_auto_merge: requireBoolean(raw, "allow_auto_merge"),
57
+ allow_update_branch: requireBoolean(raw, "allow_update_branch"),
58
+ delete_branch_on_merge: requireBoolean(raw, "delete_branch_on_merge"),
59
+ merge_commit_title: requireString(raw, "merge_commit_title"),
60
+ has_issues: requireBoolean(raw, "has_issues"),
61
+ has_wiki: requireBoolean(raw, "has_wiki"),
62
+ secret_scanning: secretScanningEnabled(raw),
63
+ default_branch: requireString(raw, "default_branch"),
64
+ };
65
+ }
66
+ /**
67
+ * Humanize ruleset ref includes for the Applies-to column.
68
+ * @param includes - Ruleset condition include list
69
+ * @returns Display string
70
+ */
71
+ function formatAppliesTo(includes) {
72
+ if (includes.length === 0) {
73
+ return "—";
74
+ }
75
+ return includes
76
+ .map(entry => entry
77
+ .replace(/^refs\/heads\//u, "")
78
+ .replace(/^refs\/tags\//u, "")
79
+ .replace(/^~DEFAULT_BRANCH$/u, "default"))
80
+ .join(" · ");
81
+ }
82
+ /**
83
+ * Extract ref_name.include strings from a ruleset conditions object.
84
+ * @param conditions - Ruleset conditions payload
85
+ * @returns Include list, or empty when absent
86
+ */
87
+ function rulesetIncludes(conditions) {
88
+ if (conditions === null ||
89
+ typeof conditions !== "object" ||
90
+ Array.isArray(conditions)) {
91
+ return [];
92
+ }
93
+ const refName = Reflect.get(conditions, "ref_name");
94
+ if (refName === null ||
95
+ typeof refName !== "object" ||
96
+ Array.isArray(refName)) {
97
+ return [];
98
+ }
99
+ const include = Reflect.get(refName, "include");
100
+ if (!Array.isArray(include)) {
101
+ return [];
102
+ }
103
+ return include.filter((entry) => typeof entry === "string");
104
+ }
105
+ /**
106
+ * Extract rule type names from a ruleset rules array.
107
+ * @param rules - Ruleset rules payload
108
+ * @returns Rule type strings
109
+ */
110
+ function rulesetRuleTypes(rules) {
111
+ if (!Array.isArray(rules)) {
112
+ return [];
113
+ }
114
+ return rules
115
+ .map(rule => {
116
+ if (rule === null || typeof rule !== "object") {
117
+ return undefined;
118
+ }
119
+ const type = Reflect.get(rule, "type");
120
+ return typeof type === "string" ? type : undefined;
121
+ })
122
+ .filter((type) => type !== undefined);
123
+ }
124
+ /**
125
+ * Map a detailed ruleset payload into a panel row.
126
+ * @param raw - One ruleset object from gh api
127
+ * @returns Panel row
128
+ */
129
+ export function mapRulesetRow(raw) {
130
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
131
+ throw new TypeError("Ruleset entry was not an object");
132
+ }
133
+ const ruleTypes = rulesetRuleTypes(Reflect.get(raw, "rules"));
134
+ return {
135
+ name: requireString(raw, "name"),
136
+ appliesTo: formatAppliesTo(rulesetIncludes(Reflect.get(raw, "conditions"))),
137
+ enforces: ruleTypes.length > 0 ? ruleTypes.join(", ") : "—",
138
+ active: Reflect.get(raw, "enforcement") === "active",
139
+ };
140
+ }
141
+ /**
142
+ * Require a non-empty string field (shared by label/secret list parsers).
143
+ * @param record - Source object
144
+ * @param key - Property name
145
+ * @returns String value
146
+ */
147
+ export function requireNamedString(record, key) {
148
+ return requireString(record, key);
149
+ }
150
+ //# sourceMappingURL=ui-github-repo-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-github-repo-map.js","sourceRoot":"","sources":["../../src/cli/ui-github-repo-map.ts"],"names":[],"mappings":"AASA;;;;;GA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,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9D,OAAO;QACL,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC;QAChC,SAAS,EAAE,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC;QAC3E,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;QAC3D,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,QAAQ;KACrD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,GAAW;IAC5D,OAAO,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Live-status probe for the console GitHub repository panel.
3
+ *
4
+ * Every input is `gh`-derived. Unauthenticated `gh` takes the whole panel to
5
+ * unknown — never a partial concrete value. Secret values are never read.
6
+ * @module cli/ui-github-repo
7
+ */
8
+ import type { JsonObject } from "../sync/json-path.js";
9
+ import { type GithubRepoGhReads, type GithubRepoSettings, type GithubRulesetRow } from "./ui-github-repo-gh.js";
10
+ import { type StatusProbe } from "./ui-status.js";
11
+ export type { GithubRepoGhReads } from "./ui-github-repo-gh.js";
12
+ export { expectedLabelsFromConfig } from "./ui-github-repo-expected.js";
13
+ /** Label row for the panel (presence vs config expectation). */
14
+ export interface GithubRepoLabelRow {
15
+ readonly name: string;
16
+ readonly role: string;
17
+ readonly color: string;
18
+ readonly present: boolean;
19
+ }
20
+ /** Secret row — presence only; never a value. */
21
+ export interface GithubRepoSecretRow {
22
+ readonly name: string;
23
+ readonly purpose: string;
24
+ readonly set: boolean;
25
+ }
26
+ /**
27
+ * Structured value emitted by the github-repo live-status probe.
28
+ * Stored as JsonObject for the probe transport; shape is validated in tests.
29
+ */
30
+ export type GithubRepoPanelValue = JsonObject & {
31
+ readonly owner: string;
32
+ readonly repo: string;
33
+ readonly settings: GithubRepoSettings;
34
+ readonly rulesets: readonly GithubRulesetRow[];
35
+ readonly labels: readonly GithubRepoLabelRow[];
36
+ readonly secrets: readonly GithubRepoSecretRow[];
37
+ };
38
+ /** Optional overrides for focused unit tests. */
39
+ export interface GithubRepoProbeDependencies {
40
+ readonly authenticate?: (signal: AbortSignal) => Promise<"authenticated" | "not-authenticated">;
41
+ readonly reads?: Partial<GithubRepoGhReads>;
42
+ }
43
+ /**
44
+ * Create the probe that populates the GitHub repository panel.
45
+ * @param cwd - Project root used as the command working directory
46
+ * @param config - Merged Lisa project config
47
+ * @param dependencies - Injectable auth and gh reads for focused tests
48
+ * @returns Live-status probe for GET /api/status
49
+ */
50
+ export declare function createGithubRepoProbe(cwd: string, config: JsonObject, dependencies?: GithubRepoProbeDependencies): StatusProbe<GithubRepoPanelValue>;
51
+ //# sourceMappingURL=ui-github-repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-github-repo.d.ts","sourceRoot":"","sources":["../../src/cli/ui-github-repo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,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ACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,UAAU,EAClB,YAAY,GAAE,2BAAgC,GAC7C,WAAW,CAAC,oBAAoB,CAAC,CAgEnC"}
@@ -0,0 +1,117 @@
1
+ import { configuredGithubRepo, EXPECTED_GITHUB_SECRETS, expectedLabelsFromConfig, } from "./ui-github-repo-expected.js";
2
+ import { defaultGithubRepoGhReads, } from "./ui-github-repo-gh.js";
3
+ import { createGithubAuthProbe, } from "./ui-status.js";
4
+ export { expectedLabelsFromConfig } from "./ui-github-repo-expected.js";
5
+ const GITHUB_REPO_PROBE_ID = "github-repo";
6
+ const PROBE_TIMEOUT_MS = 15_000;
7
+ const NOT_AUTHENTICATED = "not-authenticated";
8
+ const GITHUB_NOT_AUTHENTICATED = "GitHub CLI is not authenticated";
9
+ /**
10
+ * Compare expected labels against the remote label set.
11
+ * @param expected - Labels from config
12
+ * @param remote - Labels returned by gh
13
+ * @returns Panel rows with present/missing
14
+ */
15
+ function compareLabels(expected, remote) {
16
+ const byName = new Map(remote.map(label => [label.name, label]));
17
+ return expected.map(label => {
18
+ const found = byName.get(label.name);
19
+ return found === undefined
20
+ ? { name: label.name, role: label.role, color: "", present: false }
21
+ : {
22
+ name: label.name,
23
+ role: label.role,
24
+ color: found.color,
25
+ present: true,
26
+ };
27
+ });
28
+ }
29
+ /**
30
+ * Compare expected secrets against names from `gh secret list`.
31
+ * @param presentNames - Secret names that exist on the repo
32
+ * @returns Presence-only rows (no values)
33
+ */
34
+ function compareSecrets(presentNames) {
35
+ const present = new Set(presentNames);
36
+ return EXPECTED_GITHUB_SECRETS.map(secret => ({
37
+ name: secret.name,
38
+ purpose: secret.purpose,
39
+ set: present.has(secret.name),
40
+ }));
41
+ }
42
+ /**
43
+ * Build the panel value after all gh reads succeed.
44
+ * @param owner - github.org
45
+ * @param repo - github.repo
46
+ * @param settings - Live repository settings
47
+ * @param rulesets - Live rulesets
48
+ * @param labels - Compared label rows
49
+ * @param secrets - Presence-only secret rows
50
+ * @returns Probe value payload
51
+ */
52
+ function panelValue(owner, repo, settings, rulesets, labels, secrets) {
53
+ return {
54
+ owner,
55
+ repo,
56
+ settings: { ...settings },
57
+ rulesets: rulesets.map(row => ({ ...row })),
58
+ labels: labels.map(row => ({ ...row })),
59
+ secrets: secrets.map(row => ({ ...row })),
60
+ };
61
+ }
62
+ /**
63
+ * Create the probe that populates the GitHub repository panel.
64
+ * @param cwd - Project root used as the command working directory
65
+ * @param config - Merged Lisa project config
66
+ * @param dependencies - Injectable auth and gh reads for focused tests
67
+ * @returns Live-status probe for GET /api/status
68
+ */
69
+ export function createGithubRepoProbe(cwd, config, dependencies = {}) {
70
+ const reads = {
71
+ ...defaultGithubRepoGhReads,
72
+ ...dependencies.reads,
73
+ };
74
+ const authenticate = dependencies.authenticate ??
75
+ (async (signal) => {
76
+ const auth = await createGithubAuthProbe(cwd).run(signal);
77
+ return auth.state === "value" && auth.value === true
78
+ ? "authenticated"
79
+ : "not-authenticated";
80
+ });
81
+ return {
82
+ id: GITHUB_REPO_PROBE_ID,
83
+ timeoutMs: PROBE_TIMEOUT_MS,
84
+ run: async (signal) => {
85
+ const authState = await authenticate(signal);
86
+ if (authState !== "authenticated") {
87
+ return {
88
+ state: "unknown",
89
+ reason: NOT_AUTHENTICATED,
90
+ message: GITHUB_NOT_AUTHENTICATED,
91
+ };
92
+ }
93
+ const target = configuredGithubRepo(config);
94
+ if (target === undefined) {
95
+ return {
96
+ state: "unknown",
97
+ reason: "repo-not-configured",
98
+ message: "github.org and github.repo must be set in Lisa config",
99
+ };
100
+ }
101
+ const timeoutMs = PROBE_TIMEOUT_MS + 250;
102
+ const [settings, rulesets, remoteLabels, secretNames] = await Promise.all([
103
+ reads.readSettings(target.owner, target.repo, cwd, timeoutMs, signal),
104
+ reads.listRulesets(target.owner, target.repo, cwd, timeoutMs, signal),
105
+ reads.listLabels(target.owner, target.repo, cwd, timeoutMs, signal),
106
+ reads.listSecretNames(target.owner, target.repo, cwd, timeoutMs, signal),
107
+ ]);
108
+ const value = panelValue(target.owner, target.repo, settings, rulesets, compareLabels(expectedLabelsFromConfig(config), remoteLabels), compareSecrets(secretNames));
109
+ const result = {
110
+ state: "value",
111
+ value,
112
+ };
113
+ return result;
114
+ },
115
+ };
116
+ }
117
+ //# sourceMappingURL=ui-github-repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-github-repo.js","sourceRoot":"","sources":["../../src/cli/ui-github-repo.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,GAKzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,GAGtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,iBAAiB,GAAG,mBAA4B,CAAC;AACvD,MAAM,wBAAwB,GAAG,iCAAiC,CAAC;AAsCnE;;;;;GAKG;AACH,SAAS,aAAa,CACpB,QAAqD,EACrD,MAAoC;IAEpC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,KAAK,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,E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CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC;gBACrE,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC;gBACnE,KAAK,CAAC,eAAe,CACnB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,IAAI,EACX,GAAG,EACH,SAAS,EACT,MAAM,CACP;aACF,CACF,CAAC;YACF,MAAM,KAAK,GAAG,UAAU,CACtB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,IAAI,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,EAC7D,cAAc,CAAC,WAAW,CAAC,CAC5B,CAAC;YACF,MAAM,MAAM,GAAsC;gBAChD,KAAK,EAAE,OAAO;gBACd,KAAK;aACN,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { AwsCountCheck, SentryReachabilityCheck } from "./ui-observability-providers.js";
2
+ /**
3
+ * Default Sentry reachability: REST when SENTRY_AUTH_TOKEN is set.
4
+ * @param timeoutMs - Request budget
5
+ * @param signal - Abort signal
6
+ * @returns Reachability outcome
7
+ */
8
+ export declare const defaultSentryCheck: SentryReachabilityCheck;
9
+ /**
10
+ * Count CloudWatch alarms after confirming AWS identity.
11
+ * @param timeoutMs - Command budget
12
+ * @param signal - Abort signal
13
+ * @returns Alarm count, or not-authenticated
14
+ */
15
+ export declare const defaultCloudWatchCheck: AwsCountCheck;
16
+ /**
17
+ * Count recent X-Ray traces after confirming AWS identity.
18
+ * @param timeoutMs - Command budget
19
+ * @param signal - Abort signal
20
+ * @returns Trace count, or not-authenticated
21
+ */
22
+ export declare const defaultXRayCheck: AwsCountCheck;
23
+ //# sourceMappingURL=ui-observability-checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-observability-checks.d.ts","sourceRoot":"","sources":["../../src/cli/ui-observability-checks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACxB,MAAM,iCAAiC,CAAC;AAiGzC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,uBAsBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAyBpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,aA0B9B,CAAC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Shell-out reachability checks for observability provider probes.
3
+ *
4
+ * Reuses the same CLIs/tokens skills already use (SENTRY_AUTH_TOKEN REST,
5
+ * `aws sts` / `cloudwatch` / `xray`) — no second SDK.
6
+ * @module cli/ui-observability-checks
7
+ */
8
+ import { execFile } from "node:child_process";
9
+ const NOT_AUTHENTICATED = "not-authenticated";
10
+ /**
11
+ * Read one env var through a single reviewable process.env exception.
12
+ * @param name - Environment variable name
13
+ * @returns Trimmed value, or undefined when unset/blank
14
+ */
15
+ function readEnv(name) {
16
+ // eslint-disable-next-line no-restricted-syntax -- observability probe must read developer-local auth tokens once
17
+ const value = process.env[name];
18
+ if (typeof value !== "string") {
19
+ return undefined;
20
+ }
21
+ const trimmed = value.trim();
22
+ return trimmed.length > 0 ? trimmed : undefined;
23
+ }
24
+ /**
25
+ * Run a fixed argv via execFile without a shell.
26
+ * @param file - Executable name
27
+ * @param args - Argument vector
28
+ * @param timeoutMs - Child-process timeout
29
+ * @param signal - Probe cancellation signal
30
+ * @returns stdout on success
31
+ */
32
+ async function runCommand(file, args, timeoutMs, signal) {
33
+ return await new Promise((resolve, reject) => {
34
+ execFile(
35
+ // eslint-disable-next-line sonarjs/no-os-command-from-path -- fixed user-installed aws CLI
36
+ file, [...args], { signal, timeout: timeoutMs, encoding: "utf8" }, (error, stdout) => {
37
+ if (error !== null) {
38
+ reject(error);
39
+ return;
40
+ }
41
+ resolve(stdout);
42
+ });
43
+ });
44
+ }
45
+ /**
46
+ * Classify an AWS CLI failure as missing auth vs other probe failure.
47
+ * @param error - Thrown command error
48
+ * @returns Whether the failure indicates missing credentials
49
+ */
50
+ function isAwsAuthFailure(error) {
51
+ const message = error instanceof Error ? error.message : String(error);
52
+ const lowered = message.toLowerCase();
53
+ return (lowered.includes("unable to locate credentials") ||
54
+ lowered.includes("could not load credentials") ||
55
+ lowered.includes("no credentials") ||
56
+ lowered.includes("expiredtoken") ||
57
+ lowered.includes("the security token included in the request is invalid") ||
58
+ lowered.includes("is not authorized to perform") ||
59
+ lowered.includes("accessdenied") ||
60
+ lowered.includes("error loading sso") ||
61
+ lowered.includes("sso session"));
62
+ }
63
+ /**
64
+ * Confirm AWS identity, mapping credential failures to not-authenticated.
65
+ * @param timeoutMs - Command budget
66
+ * @param signal - Abort signal
67
+ * @returns not-authenticated when credentials are missing; otherwise void
68
+ */
69
+ async function requireAwsIdentity(timeoutMs, signal) {
70
+ try {
71
+ await runCommand("aws", ["sts", "get-caller-identity", "--output", "json"], timeoutMs, signal);
72
+ return undefined;
73
+ }
74
+ catch (error) {
75
+ if (isAwsAuthFailure(error)) {
76
+ return NOT_AUTHENTICATED;
77
+ }
78
+ throw error;
79
+ }
80
+ }
81
+ /**
82
+ * Default Sentry reachability: REST when SENTRY_AUTH_TOKEN is set.
83
+ * @param timeoutMs - Request budget
84
+ * @param signal - Abort signal
85
+ * @returns Reachability outcome
86
+ */
87
+ export const defaultSentryCheck = async (timeoutMs, signal) => {
88
+ const token = readEnv("SENTRY_AUTH_TOKEN");
89
+ if (token === undefined) {
90
+ return NOT_AUTHENTICATED;
91
+ }
92
+ const response = await fetch("https://sentry.io/api/0/", {
93
+ headers: {
94
+ accept: "application/json",
95
+ authorization: `Bearer ${token}`,
96
+ },
97
+ signal: AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]),
98
+ });
99
+ if (response.ok) {
100
+ return "reachable";
101
+ }
102
+ if (response.status === 401 || response.status === 403) {
103
+ return NOT_AUTHENTICATED;
104
+ }
105
+ throw new Error(`Sentry API returned HTTP ${String(response.status)}`);
106
+ };
107
+ /**
108
+ * Count CloudWatch alarms after confirming AWS identity.
109
+ * @param timeoutMs - Command budget
110
+ * @param signal - Abort signal
111
+ * @returns Alarm count, or not-authenticated
112
+ */
113
+ export const defaultCloudWatchCheck = async (timeoutMs, signal) => {
114
+ const auth = await requireAwsIdentity(timeoutMs, signal);
115
+ if (auth !== undefined) {
116
+ return auth;
117
+ }
118
+ const stdout = await runCommand("aws", ["cloudwatch", "describe-alarms", "--output", "json"], timeoutMs, signal);
119
+ const parsed = JSON.parse(stdout);
120
+ const metric = Array.isArray(parsed.MetricAlarms)
121
+ ? parsed.MetricAlarms.length
122
+ : 0;
123
+ const composite = Array.isArray(parsed.CompositeAlarms)
124
+ ? parsed.CompositeAlarms.length
125
+ : 0;
126
+ return metric + composite;
127
+ };
128
+ /**
129
+ * Count recent X-Ray traces after confirming AWS identity.
130
+ * @param timeoutMs - Command budget
131
+ * @param signal - Abort signal
132
+ * @returns Trace count, or not-authenticated
133
+ */
134
+ export const defaultXRayCheck = async (timeoutMs, signal) => {
135
+ const auth = await requireAwsIdentity(timeoutMs, signal);
136
+ if (auth !== undefined) {
137
+ return auth;
138
+ }
139
+ const end = new Date();
140
+ const start = new Date(end.getTime() - 60 * 60 * 1000);
141
+ const stdout = await runCommand("aws", [
142
+ "xray",
143
+ "get-trace-summaries",
144
+ "--start-time",
145
+ start.toISOString(),
146
+ "--end-time",
147
+ end.toISOString(),
148
+ "--output",
149
+ "json",
150
+ ], timeoutMs, signal);
151
+ const parsed = JSON.parse(stdout);
152
+ return Array.isArray(parsed.TraceSummaries)
153
+ ? parsed.TraceSummaries.length
154
+ : 0;
155
+ };
156
+ //# sourceMappingURL=ui-observability-checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-observability-checks.js","sourceRoot":"","s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M;QAC/B,CAAC,CAAC,CAAC,CAAC;IACN,OAAO,MAAM,GAAG,SAAS,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,MAAM,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,MAAM,UAAU,CAC7B,KAAK,EACL;QACE,MAAM;QACN,qBAAqB;QACrB,cAAc;QACd,KAAK,CAAC,WAAW,EAAE;QACnB,YAAY;QACZ,GAAG,CAAC,WAAW,EAAE;QACjB,UAAU;QACV,MAAM;KACP,EACD,SAAS,EACT,MAAM,CACP,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAmC,CAAC;IACpE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;QACzC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM;QAC9B,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Live-status probes for connected observability providers.
3
+ *
4
+ * READ-ONLY detection by reachability (Sentry auth, CloudWatch alarms, X-Ray
5
+ * traces). Missing credentials degrade to unknown — never a fabricated
6
+ * "disconnected" claim.
7
+ * @module cli/ui-observability-providers
8
+ */
9
+ import type { JsonValue } from "../sync/json-path.js";
10
+ import type { ProbeResult, StatusProbe } from "./ui-status.js";
11
+ /** Structured value for a reachable observability provider. */
12
+ export type ObservabilityProviderValue = {
13
+ readonly [key: string]: JsonValue;
14
+ readonly status: "connected" | "connected-but-empty";
15
+ readonly emptyKind?: "alarms" | "traces";
16
+ };
17
+ /** Injectable Sentry reachability check. */
18
+ export type SentryReachabilityCheck = (timeoutMs: number, signal: AbortSignal) => Promise<"reachable" | "not-authenticated">;
19
+ /** Injectable AWS count check (alarms or traces), or not-authenticated. */
20
+ export type AwsCountCheck = (timeoutMs: number, signal: AbortSignal) => Promise<number | "not-authenticated">;
21
+ export declare const SENTRY_PROBE_ID = "sentry";
22
+ export declare const CLOUDWATCH_ALARMS_PROBE_ID = "cloudwatch-alarms";
23
+ export declare const XRAY_PROBE_ID = "x-ray";
24
+ /**
25
+ * Map Sentry reachability onto the live-status tri-state.
26
+ * @param outcome - Reachability check result
27
+ * @returns Probe result for the sentry provider
28
+ */
29
+ export declare function mapSentryReachability(outcome: "reachable" | "not-authenticated"): ProbeResult<ObservabilityProviderValue>;
30
+ /**
31
+ * Map an AWS count check onto connected / empty / unknown.
32
+ * @param outcome - Count or not-authenticated
33
+ * @param emptyKind - Whether zero means no alarms or no traces
34
+ * @returns Probe result for CloudWatch or X-Ray
35
+ */
36
+ export declare function mapAwsCountCheck(outcome: number | "not-authenticated", emptyKind: "alarms" | "traces"): ProbeResult<ObservabilityProviderValue>;
37
+ /**
38
+ * Create the Sentry observability probe.
39
+ * @param options - Injectable collaborators
40
+ * @param options.check - Optional reachability check for focused tests
41
+ * @returns Bounded status probe
42
+ */
43
+ export declare function createSentryProbe(options?: {
44
+ readonly check?: SentryReachabilityCheck;
45
+ }): StatusProbe<ObservabilityProviderValue>;
46
+ /**
47
+ * Create the CloudWatch Alarms observability probe.
48
+ * @param options - Injectable collaborators
49
+ * @param options.check - Optional alarm-count check for focused tests
50
+ * @returns Bounded status probe
51
+ */
52
+ export declare function createCloudWatchAlarmsProbe(options?: {
53
+ readonly check?: AwsCountCheck;
54
+ }): StatusProbe<ObservabilityProviderValue>;
55
+ /**
56
+ * Create the X-Ray observability probe.
57
+ * @param options - Injectable collaborators
58
+ * @param options.check - Optional trace-count check for focused tests
59
+ * @returns Bounded status probe
60
+ */
61
+ export declare function createXRayProbe(options?: {
62
+ readonly check?: AwsCountCheck;
63
+ }): StatusProbe<ObservabilityProviderValue>;
64
+ /**
65
+ * Register all three observability provider probes.
66
+ * @returns Sentry, CloudWatch Alarms, and X-Ray probes
67
+ */
68
+ export declare function createObservabilityProviderProbes(): readonly StatusProbe<ObservabilityProviderValue>[];
69
+ //# sourceMappingURL=ui-observability-providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-observability-providers.d.ts","sourceRoot":"","sources":["../../src/cli/ui-observability-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO/D,+DAA+D;AAC/D,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,qBAAqB,CAAC;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC1C,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,WAAW,GAAG,mBAAmB,CAAC,CAAC;AAEhD,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,CAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC;AAE3C,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAC9D,eAAO,MAAM,aAAa,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