lula2 0.5.0-nightly.5 → 0.5.0-nightly.7

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.
@@ -107,6 +107,10 @@ function getChangedBlocks(oldText, newText) {
107
107
  }
108
108
  return changed;
109
109
  }
110
+ function containsLulaAnnotations(text) {
111
+ const lines = text.split("\n");
112
+ return lines.some((line) => line.includes("@lulaStart") || line.includes("@lulaEnd"));
113
+ }
110
114
  function crawlCommand() {
111
115
  return new Command().command("crawl").description("Detect compliance-related changes between @lulaStart and @lulaEnd in PR files").addOption(
112
116
  new Option("--post-mode <mode>", "How to post findings").choices(["review", "comment"]).default("review")
@@ -128,8 +132,55 @@ Please review the changes to ensure they meet compliance standards.
128
132
  Lula reviewed ${files.length} files changed that affect compliance.
129
133
 
130
134
  `;
135
+ const deletedFilesWithAnnotations = [];
136
+ for (const file of files) {
137
+ if (file.status === "removed") {
138
+ try {
139
+ const oldText = await fetchRawFileViaAPI({
140
+ octokit,
141
+ owner,
142
+ repo,
143
+ path: file.filename,
144
+ ref: "main"
145
+ });
146
+ if (containsLulaAnnotations(oldText)) {
147
+ deletedFilesWithAnnotations.push(file.filename);
148
+ }
149
+ } catch (err) {
150
+ console.error(`Error checking deleted file ${file.filename}: ${err}`);
151
+ }
152
+ }
153
+ }
154
+ if (deletedFilesWithAnnotations.length > 0) {
155
+ leavePost = true;
156
+ commentBody += `
157
+
158
+ **Compliance Warning: Files with Lula annotations were deleted**
159
+
160
+ `;
161
+ commentBody += `The following files contained compliance annotations (\`@lulaStart\`/\`@lulaEnd\`) and were deleted in this PR. This may affect compliance coverage:
162
+
163
+ `;
164
+ for (const filename of deletedFilesWithAnnotations) {
165
+ commentBody += `- \`${filename}\`
166
+ `;
167
+ }
168
+ commentBody += `
169
+ Please review whether:
170
+ `;
171
+ commentBody += `- The compliance coverage provided by these files is still needed
172
+ `;
173
+ commentBody += `- Alternative compliance measures have been implemented
174
+ `;
175
+ commentBody += `- The deletion is intentional and compliance-approved
176
+
177
+ `;
178
+ commentBody += `---
179
+
180
+ `;
181
+ }
131
182
  for (const file of files) {
132
- if (file.status === "added") continue;
183
+ if (file.status === "added" || file.status === "removed") continue;
133
184
  try {
134
185
  const [oldText, newText] = await Promise.all([
135
186
  fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: "main" }),
@@ -270,6 +321,7 @@ async function dismissOldReviews({
270
321
  }
271
322
  export {
272
323
  LULA_SIGNATURE,
324
+ containsLulaAnnotations,
273
325
  crawlCommand,
274
326
  deleteOldIssueComments,
275
327
  deleteOldReviewComments,
package/dist/index.html CHANGED
@@ -6,10 +6,10 @@
6
6
  <link rel="icon" href="/lula.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1" />
8
8
 
9
- <link rel="modulepreload" href="/_app/immutable/entry/start.DpNVetJ9.js">
10
- <link rel="modulepreload" href="/_app/immutable/chunks/sFmgqS5x.js">
9
+ <link rel="modulepreload" href="/_app/immutable/entry/start.BphI6kcE.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/B3xI9zvL.js">
11
11
  <link rel="modulepreload" href="/_app/immutable/chunks/Bvop-7hR.js">
12
- <link rel="modulepreload" href="/_app/immutable/entry/app.BV9tvuYW.js">
12
+ <link rel="modulepreload" href="/_app/immutable/entry/app.C1I3J0sK.js">
13
13
  <link rel="modulepreload" href="/_app/immutable/chunks/DsnmJJEf.js">
14
14
  <link rel="modulepreload" href="/_app/immutable/chunks/R1gz3SOr.js">
15
15
  <link rel="modulepreload" href="/_app/immutable/chunks/zYrdvxnm.js">
@@ -19,15 +19,15 @@
19
19
  <div style="display: contents">
20
20
  <script>
21
21
  {
22
- __sveltekit_1uu1q7q = {
22
+ __sveltekit_1ft4gm4 = {
23
23
  base: ""
24
24
  };
25
25
 
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("/_app/immutable/entry/start.DpNVetJ9.js"),
30
- import("/_app/immutable/entry/app.BV9tvuYW.js")
29
+ import("/_app/immutable/entry/start.BphI6kcE.js"),
30
+ import("/_app/immutable/entry/app.C1I3J0sK.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });
package/dist/index.js CHANGED
@@ -5628,6 +5628,10 @@ function getChangedBlocks(oldText, newText) {
5628
5628
  }
5629
5629
  return changed;
5630
5630
  }
5631
+ function containsLulaAnnotations(text) {
5632
+ const lines = text.split("\n");
5633
+ return lines.some((line) => line.includes("@lulaStart") || line.includes("@lulaEnd"));
5634
+ }
5631
5635
  function crawlCommand() {
5632
5636
  return new Command().command("crawl").description("Detect compliance-related changes between @lulaStart and @lulaEnd in PR files").addOption(
5633
5637
  new Option("--post-mode <mode>", "How to post findings").choices(["review", "comment"]).default("review")
@@ -5649,8 +5653,55 @@ Please review the changes to ensure they meet compliance standards.
5649
5653
  Lula reviewed ${files.length} files changed that affect compliance.
5650
5654
 
5651
5655
  `;
5656
+ const deletedFilesWithAnnotations = [];
5657
+ for (const file of files) {
5658
+ if (file.status === "removed") {
5659
+ try {
5660
+ const oldText = await fetchRawFileViaAPI({
5661
+ octokit,
5662
+ owner,
5663
+ repo,
5664
+ path: file.filename,
5665
+ ref: "main"
5666
+ });
5667
+ if (containsLulaAnnotations(oldText)) {
5668
+ deletedFilesWithAnnotations.push(file.filename);
5669
+ }
5670
+ } catch (err) {
5671
+ console.error(`Error checking deleted file ${file.filename}: ${err}`);
5672
+ }
5673
+ }
5674
+ }
5675
+ if (deletedFilesWithAnnotations.length > 0) {
5676
+ leavePost = true;
5677
+ commentBody += `
5678
+
5679
+ **Compliance Warning: Files with Lula annotations were deleted**
5680
+
5681
+ `;
5682
+ commentBody += `The following files contained compliance annotations (\`@lulaStart\`/\`@lulaEnd\`) and were deleted in this PR. This may affect compliance coverage:
5683
+
5684
+ `;
5685
+ for (const filename of deletedFilesWithAnnotations) {
5686
+ commentBody += `- \`${filename}\`
5687
+ `;
5688
+ }
5689
+ commentBody += `
5690
+ Please review whether:
5691
+ `;
5692
+ commentBody += `- The compliance coverage provided by these files is still needed
5693
+ `;
5694
+ commentBody += `- Alternative compliance measures have been implemented
5695
+ `;
5696
+ commentBody += `- The deletion is intentional and compliance-approved
5697
+
5698
+ `;
5699
+ commentBody += `---
5700
+
5701
+ `;
5702
+ }
5652
5703
  for (const file of files) {
5653
- if (file.status === "added") continue;
5704
+ if (file.status === "added" || file.status === "removed") continue;
5654
5705
  try {
5655
5706
  const [oldText, newText] = await Promise.all([
5656
5707
  fetchRawFileViaAPI({ octokit, owner, repo, path: file.filename, ref: "main" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lula2",
3
- "version": "0.5.0-nightly.5",
3
+ "version": "0.5.0-nightly.7",
4
4
  "description": "A tool for managing compliance as code in your GitHub repositories.",
5
5
  "bin": {
6
6
  "lula2": "./dist/lula2"
@@ -1 +0,0 @@
1
- import{l as o,a as r}from"../chunks/sFmgqS5x.js";export{o as load_css,r as start};