lagora-cli 1.1.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 (52) hide show
  1. package/README.md +138 -0
  2. package/dist/help.txt +70 -0
  3. package/dist/lagora.js +342 -0
  4. package/dist/report-help.txt +5 -0
  5. package/dist/scripts/agora_playground_harness.py +263 -0
  6. package/dist/scripts/announce.js +41 -0
  7. package/dist/scripts/check-kernel-submission.py +90 -0
  8. package/dist/scripts/chunk-2EAJVB5D.js +100 -0
  9. package/dist/scripts/chunk-2KTLCUFI.js +29 -0
  10. package/dist/scripts/chunk-AZ3EEBVD.js +137 -0
  11. package/dist/scripts/chunk-NBJMYAOA.js +2128 -0
  12. package/dist/scripts/chunk-NCJMUBTG.js +125 -0
  13. package/dist/scripts/chunk-QJPQHKIO.js +23 -0
  14. package/dist/scripts/chunk-RIR5KGHC.js +33 -0
  15. package/dist/scripts/chunk-TJZVQYBL.js +8 -0
  16. package/dist/scripts/chunk-UHJXD4TG.js +18 -0
  17. package/dist/scripts/chunk-UQ6I6VTY.js +117 -0
  18. package/dist/scripts/cli-auth.js +348 -0
  19. package/dist/scripts/cli-config-IA7EOSYD.js +7 -0
  20. package/dist/scripts/install-skill.js +199 -0
  21. package/dist/scripts/issue-local-client-DZUXZOKY.js +22 -0
  22. package/dist/scripts/issue-search.js +1823 -0
  23. package/dist/scripts/issue.js +386 -0
  24. package/dist/scripts/keycloak-provision.js +986 -0
  25. package/dist/scripts/legato-fsim-runner.py +126 -0
  26. package/dist/scripts/legato-lowering-runner.py +156 -0
  27. package/dist/scripts/legato_runner_annotations.py +235 -0
  28. package/dist/scripts/legato_runner_env.py +91 -0
  29. package/dist/scripts/legato_runner_launchers.py +287 -0
  30. package/dist/scripts/legato_runner_script_wrapper.py +193 -0
  31. package/dist/scripts/notifications-EU43SIEV.js +624 -0
  32. package/dist/scripts/playground.js +408 -0
  33. package/dist/scripts/report-bundle-sync-3U7QTP4Z.js +215 -0
  34. package/dist/scripts/report.js +104 -0
  35. package/dist/scripts/resolve-sdk-package-version.py +151 -0
  36. package/dist/scripts/sdk-runtime-JE6H2PB2.js +992 -0
  37. package/dist/scripts/sdk-runtime-kubernetes-job-KOWL4ITV.js +479 -0
  38. package/dist/scripts/sdk-runtime-smoke.py +168 -0
  39. package/dist/scripts/sdk.js +256 -0
  40. package/dist/scripts/site-feedback-CAPE5MPX.js +136 -0
  41. package/dist/scripts/site-feedback-rate-limit-5BU2WSFE.js +86 -0
  42. package/dist/scripts/site-feedback.js +117 -0
  43. package/dist/scripts/storage-234FBH54.js +67 -0
  44. package/dist/scripts/submit-issue.sh +489 -0
  45. package/dist/scripts/verification-3QCY66QW.js +772 -0
  46. package/dist/scripts/verify-issue.js +144 -0
  47. package/dist/skills/legato-agora-cli/SKILL.md +556 -0
  48. package/dist/skills/legato-agora-cli/agents/openai.yaml +7 -0
  49. package/dist/skills/legato-agora-cli/reference/kernel-with-golden.py +84 -0
  50. package/dist/skills/legato-site-feedback/SKILL.md +49 -0
  51. package/dist/skills/legato-site-feedback/agents/openai.yaml +7 -0
  52. package/package.json +16 -0
@@ -0,0 +1,144 @@
1
+ // scripts/verify-issue.ts
2
+ import path from "node:path";
3
+ function parseArgs(argv) {
4
+ const args = {};
5
+ for (let index = 0; index < argv.length; index += 1) {
6
+ const token = argv[index];
7
+ const value = argv[index + 1];
8
+ if (!token.startsWith("--")) continue;
9
+ if (!value || value.startsWith("--")) throw new Error(`${token} requires a value`);
10
+ index += 1;
11
+ if (token === "--issue") args.issue = value;
12
+ if (token === "--kind") {
13
+ if (value !== "lowering" && value !== "fsim") throw new Error(`Unsupported kind: ${value}`);
14
+ args.kind = value;
15
+ }
16
+ if (token === "--mode") {
17
+ if (value !== "real" && value !== "plan") throw new Error(`Unsupported mode: ${value}`);
18
+ args.mode = value;
19
+ }
20
+ if (token === "--store") args.store = value;
21
+ if (token === "--sdk-root") args.sdkRoot = value;
22
+ if (token === "--sdk-runtime-root") args.sdkRoot = value;
23
+ if (token === "--sdk-branch") args.sdkBranch = value;
24
+ if (token === "--sdk-repo-url") args.sdkRepoUrl = value;
25
+ if (token === "--sdk-prepared-root") args.sdkPreparedRoot = value;
26
+ if (token === "--stages") args.stages = value;
27
+ if (token === "--kernel-function") args.kernelFunction = value;
28
+ if (token === "--actor-user-id") args.actorUserId = value;
29
+ if (token === "--run-id") args.runId = value;
30
+ if (token === "--source-artifact-id") args.sourceArtifactId = value;
31
+ }
32
+ return args;
33
+ }
34
+ function sdkRuntimeOverrides(args) {
35
+ const overrides = {
36
+ repoUrl: args.sdkRepoUrl?.trim() || void 0,
37
+ branch: args.sdkBranch?.trim() || void 0,
38
+ runtimeRoot: args.sdkRoot?.trim() ? path.resolve(args.sdkRoot.trim()) : void 0,
39
+ preparedRoot: args.sdkPreparedRoot?.trim() ? path.resolve(args.sdkPreparedRoot.trim()) : void 0
40
+ };
41
+ const compacted = Object.fromEntries(Object.entries(overrides).filter(([, value]) => value !== void 0));
42
+ return Object.values(compacted).length > 0 ? compacted : void 0;
43
+ }
44
+ function shouldPrepareSdkRuntime(args) {
45
+ return Boolean(!args.sdkPreparedRoot?.trim() && (args.sdkBranch?.trim() || args.sdkRepoUrl?.trim() || args.sdkRoot?.trim()));
46
+ }
47
+ async function main() {
48
+ const args = parseArgs(process.argv.slice(2));
49
+ try {
50
+ if (args.store?.trim()) {
51
+ process.env.AGORA_ISSUE_STORE = path.resolve(args.store.trim());
52
+ }
53
+ if (args.stages?.trim()) process.env.AGORA_LOWERING_STAGES = args.stages.trim();
54
+ if (args.kernelFunction?.trim()) process.env.LEGATO_KERNEL_FUNCTION = args.kernelFunction.trim();
55
+ if (!args.issue || !args.kind) {
56
+ console.error("Usage: lagora verify --issue <id> --kind lowering|fsim [--store path] [--mode real|plan] [--sdk-branch branch] [--sdk-repo-url url] [--sdk-runtime-root path] [--sdk-prepared-root path] [--stages MLIR,CORE_IR] [--kernel-function name]");
57
+ process.exit(1);
58
+ }
59
+ const sdkRuntime = sdkRuntimeOverrides(args);
60
+ if ((args.kind === "lowering" || args.kind === "fsim") && args.mode === "real" && shouldPrepareSdkRuntime(args)) {
61
+ const { prepareSdkRuntime } = await import("./sdk-runtime-JE6H2PB2.js");
62
+ const prepared = await prepareSdkRuntime(sdkRuntime);
63
+ console.log(`SDK runtime: ${prepared.status.status}`);
64
+ console.log(`SDK branch: ${prepared.settings.branch}`);
65
+ console.log(`SDK prepared root: ${prepared.settings.preparedRoot}`);
66
+ console.log(`SDK prepare log: ${prepared.logPath}`);
67
+ if (prepared.status.status !== "ready") {
68
+ throw new Error(prepared.status.message ?? "SDK runtime preparation failed");
69
+ }
70
+ }
71
+ const { runIssueVerification } = await import("./verification-3QCY66QW.js");
72
+ const run = await runIssueVerification({
73
+ issueId: args.issue,
74
+ kind: args.kind,
75
+ mode: args.mode,
76
+ actorUserId: args.actorUserId,
77
+ runId: args.runId,
78
+ sourceArtifactId: args.sourceArtifactId,
79
+ sdkRuntime
80
+ });
81
+ console.log(`Recorded verification ${run.id}`);
82
+ console.log(`Issue: ${run.issueId}`);
83
+ console.log(`Kind: ${run.kind}`);
84
+ console.log(`Status: ${run.status}`);
85
+ if (run.completedStage) console.log(`Completed stage: ${run.completedStage}`);
86
+ if (run.failedStage) console.log(`Failed stage: ${run.failedStage}`);
87
+ const { getIssue } = await import("./storage-234FBH54.js");
88
+ const record = await getIssue(run.issueId);
89
+ const logArtifact = record?.artifacts.find((artifact) => artifact.id === run.logArtifactId);
90
+ if (logArtifact) console.log(`Log artifact: ${logArtifact.filename}`);
91
+ } catch (error) {
92
+ await recordFailedRun(args, error);
93
+ throw error;
94
+ }
95
+ }
96
+ async function recordFailedRun(args, error) {
97
+ if (!args.issue || !args.kind || !args.runId) return;
98
+ const message = errorMessage(error);
99
+ const diagnostic = errorDiagnostic(error);
100
+ try {
101
+ const { updateVerificationRunResult } = await import("./storage-234FBH54.js");
102
+ await updateVerificationRunResult({
103
+ issueId: args.issue,
104
+ runId: args.runId,
105
+ kind: args.kind,
106
+ sourceArtifactId: args.sourceArtifactId,
107
+ actorUserId: args.actorUserId,
108
+ status: "failed",
109
+ exitCode: 1,
110
+ completedAt: (/* @__PURE__ */ new Date()).toISOString(),
111
+ logText: failedRunLog(args, diagnostic),
112
+ commentBody: `Backend verification worker failed before recording a final run. ${message}`
113
+ });
114
+ } catch (finalizerError) {
115
+ console.error(`Failed to update verification run ${args.runId}: ${errorMessage(finalizerError)}`);
116
+ }
117
+ }
118
+ function failedRunLog(args, diagnostic) {
119
+ const completedAt = (/* @__PURE__ */ new Date()).toISOString();
120
+ return [
121
+ "Verification worker failed before recording a final run.",
122
+ `issue: ${args.issue ?? "unknown"}`,
123
+ `kind: ${args.kind ?? "unknown"}`,
124
+ `mode: ${args.mode ?? "plan"}`,
125
+ `status: failed`,
126
+ `completedAt: ${completedAt}`,
127
+ `sourceArtifactId: ${args.sourceArtifactId ?? "current bundle kernel"}`,
128
+ `runId: ${args.runId ?? "none"}`,
129
+ "",
130
+ "stderr:",
131
+ diagnostic,
132
+ ""
133
+ ].join("\n");
134
+ }
135
+ function errorMessage(error) {
136
+ return error instanceof Error ? error.message : String(error);
137
+ }
138
+ function errorDiagnostic(error) {
139
+ return error instanceof Error ? error.stack ?? error.message : String(error);
140
+ }
141
+ main().catch((error) => {
142
+ console.error(errorDiagnostic(error));
143
+ process.exit(1);
144
+ });