clud-bug 0.6.34 → 0.7.0-rc.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.
Files changed (95) hide show
  1. package/bin/clud-bug.js +10 -1353
  2. package/dist/cli/agents-md.d.ts +16 -0
  3. package/dist/cli/agents-md.d.ts.map +1 -0
  4. package/dist/cli/agents-md.js +226 -0
  5. package/dist/cli/agents-md.js.map +1 -0
  6. package/dist/cli/audit.d.ts +13 -0
  7. package/dist/cli/audit.d.ts.map +1 -0
  8. package/dist/cli/audit.js +90 -0
  9. package/dist/cli/audit.js.map +1 -0
  10. package/dist/cli/branch-protection.d.ts +57 -0
  11. package/dist/cli/branch-protection.d.ts.map +1 -0
  12. package/dist/cli/branch-protection.js +118 -0
  13. package/dist/cli/branch-protection.js.map +1 -0
  14. package/dist/cli/edit-workflow.d.ts +18 -0
  15. package/dist/cli/edit-workflow.d.ts.map +1 -0
  16. package/dist/cli/edit-workflow.js +43 -0
  17. package/dist/cli/edit-workflow.js.map +1 -0
  18. package/dist/cli/index.d.ts +8 -0
  19. package/dist/cli/index.d.ts.map +1 -0
  20. package/dist/cli/index.js +18 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/cli/main.d.ts +3 -0
  23. package/dist/cli/main.d.ts.map +1 -0
  24. package/dist/cli/main.js +1336 -0
  25. package/dist/cli/main.js.map +1 -0
  26. package/dist/cli/skill-usage.d.ts +109 -0
  27. package/dist/cli/skill-usage.d.ts.map +1 -0
  28. package/dist/cli/skill-usage.js +380 -0
  29. package/dist/cli/skill-usage.js.map +1 -0
  30. package/dist/cli/skills.d.ts +56 -0
  31. package/dist/cli/skills.d.ts.map +1 -0
  32. package/dist/cli/skills.js +292 -0
  33. package/dist/cli/skills.js.map +1 -0
  34. package/dist/cli/update.d.ts +29 -0
  35. package/dist/cli/update.d.ts.map +1 -0
  36. package/dist/cli/update.js +186 -0
  37. package/dist/cli/update.js.map +1 -0
  38. package/dist/cli/usage.d.ts +142 -0
  39. package/dist/cli/usage.d.ts.map +1 -0
  40. package/dist/cli/usage.js +348 -0
  41. package/dist/cli/usage.js.map +1 -0
  42. package/dist/core/audit.d.ts +8 -0
  43. package/dist/core/audit.d.ts.map +1 -0
  44. package/dist/core/audit.js +47 -0
  45. package/dist/core/audit.js.map +1 -0
  46. package/dist/core/detect.d.ts +77 -0
  47. package/dist/core/detect.d.ts.map +1 -0
  48. package/dist/core/detect.js +262 -0
  49. package/dist/core/detect.js.map +1 -0
  50. package/dist/core/index.d.ts +8 -0
  51. package/dist/core/index.d.ts.map +1 -0
  52. package/dist/core/index.js +14 -0
  53. package/dist/core/index.js.map +1 -0
  54. package/dist/core/prompts.d.ts +9 -0
  55. package/dist/core/prompts.d.ts.map +1 -0
  56. package/dist/core/prompts.js +401 -0
  57. package/dist/core/prompts.js.map +1 -0
  58. package/dist/core/render-review.d.ts +6 -0
  59. package/dist/core/render-review.d.ts.map +1 -0
  60. package/dist/core/render-review.js +219 -0
  61. package/dist/core/render-review.js.map +1 -0
  62. package/dist/core/render.d.ts +13 -0
  63. package/dist/core/render.d.ts.map +1 -0
  64. package/dist/core/render.js +80 -0
  65. package/dist/core/render.js.map +1 -0
  66. package/dist/core/review-schema.d.ts +42 -0
  67. package/dist/core/review-schema.d.ts.map +1 -0
  68. package/dist/core/review-schema.js +156 -0
  69. package/dist/core/review-schema.js.map +1 -0
  70. package/dist/core/skills.d.ts +80 -0
  71. package/dist/core/skills.d.ts.map +1 -0
  72. package/dist/core/skills.js +510 -0
  73. package/dist/core/skills.js.map +1 -0
  74. package/package.json +27 -4
  75. package/{lib/agents-md.js → src/cli/agents-md.ts} +25 -14
  76. package/{lib/audit.js → src/cli/audit.ts} +37 -44
  77. package/{lib/branch-protection.js → src/cli/branch-protection.ts} +75 -11
  78. package/{lib/edit-workflow.js → src/cli/edit-workflow.ts} +32 -11
  79. package/src/cli/index.ts +101 -0
  80. package/src/cli/main.ts +1376 -0
  81. package/{lib/skill-usage.js → src/cli/skill-usage.ts} +168 -94
  82. package/src/cli/skills.ts +386 -0
  83. package/{lib/update.js → src/cli/update.ts} +68 -27
  84. package/{lib/usage.js → src/cli/usage.ts} +167 -76
  85. package/src/core/audit.ts +53 -0
  86. package/{lib/detect.js → src/core/detect.ts} +100 -47
  87. package/src/core/index.ts +70 -0
  88. package/{lib/prompts.js → src/core/prompts.ts} +16 -2
  89. package/{lib/render-review.js → src/core/render-review.ts} +57 -25
  90. package/{lib/render.js → src/core/render.ts} +36 -10
  91. package/{lib/review-schema.js → src/core/review-schema.ts} +68 -5
  92. package/{lib/skills.js → src/core/skills.ts} +172 -343
  93. package/templates/workflow-py.yml.tmpl +2 -2
  94. package/templates/workflow-ts.yml.tmpl +2 -2
  95. package/templates/workflow.yml.tmpl +17 -8
@@ -23,10 +23,21 @@
23
23
  // keep the model from inventing fields.
24
24
  //
25
25
  // Bumped via deliberate edit; not derived from a TypeScript type. The
26
- // rendering side (lib/render-review.js) treats unknown fields permissively
26
+ // rendering side (./render-review.ts) treats unknown fields permissively
27
27
  // — schema and renderer can drift up to one minor version safely.
28
28
 
29
- const FINDING_ITEM = {
29
+ // The JSON Schema shape is structurally rich (oneOf, enum, conditional
30
+ // required fields) and is consumed as a raw JSON object by Agent SDK
31
+ // validators that have their own runtime semantics. Typing it as
32
+ // `Record<string, unknown>` would erase the literal-property structure
33
+ // callers rely on for IDE navigation; typing each sub-object exactly
34
+ // would tightly couple every test that asserts a specific path. We use
35
+ // a structural alias `JSONSchemaObject` here so the export keeps its
36
+ // rich literal type (caller-visible field names) without forcing a
37
+ // schema-spec round-trip.
38
+ type JSONSchemaObject = Record<string, unknown>;
39
+
40
+ const FINDING_ITEM: JSONSchemaObject = {
30
41
  type: 'object',
31
42
  additionalProperties: false,
32
43
  properties: {
@@ -55,7 +66,7 @@ const FINDING_ITEM = {
55
66
  required: ['skill', 'summary'],
56
67
  };
57
68
 
58
- const PER_SKILL_SCAN_ITEM = {
69
+ const PER_SKILL_SCAN_ITEM: JSONSchemaObject = {
59
70
  type: 'object',
60
71
  additionalProperties: false,
61
72
  properties: {
@@ -68,7 +79,7 @@ const PER_SKILL_SCAN_ITEM = {
68
79
  required: ['skill', 'outcome'],
69
80
  };
70
81
 
71
- export const REVIEW_SCHEMA = {
82
+ export const REVIEW_SCHEMA: JSONSchemaObject = {
72
83
  type: 'object',
73
84
  additionalProperties: false,
74
85
  properties: {
@@ -154,6 +165,58 @@ export const REVIEW_SCHEMA = {
154
165
  // `--json-schema '<JSON>'` argument. Single-line (the workflow YAML uses
155
166
  // the pipe block; single-quoted JSON inside that needs to stay flat to
156
167
  // avoid YAML parser surprises with embedded newlines).
157
- export function serializedReviewSchema() {
168
+ export function serializedReviewSchema(): string {
158
169
  return JSON.stringify(REVIEW_SCHEMA);
159
170
  }
171
+
172
+ // --- Schema-derived runtime types for renderReview() input ---
173
+ //
174
+ // The TypeScript types below mirror the JSON Schema shape above so that
175
+ // render-review.ts can consume the parsed JSON with structural typing.
176
+ // They are intentionally permissive (every field optional except where
177
+ // the schema's `required` list forces it) because the renderer is the
178
+ // last line of defense — malformed JSON should degrade rather than throw.
179
+
180
+ export type FindingSeverity = 'critical' | 'minor' | 'preexisting';
181
+
182
+ export interface ReviewFinding {
183
+ skill: string;
184
+ summary: string;
185
+ file?: string;
186
+ line?: number;
187
+ reasoning?: string;
188
+ }
189
+
190
+ export interface PerSkillScanItem {
191
+ skill: string;
192
+ outcome: string;
193
+ }
194
+
195
+ export interface DedicatedSection {
196
+ section_name: string;
197
+ skill: string;
198
+ findings: ReviewFinding[];
199
+ }
200
+
201
+ export interface ReviewSummaryCounts {
202
+ critical: number;
203
+ minor: number;
204
+ preexisting: number;
205
+ resolved_from_prior: number;
206
+ still_open: number;
207
+ }
208
+
209
+ export type ReviewStatusHeader = 'critical findings' | 'clean' | 'bare';
210
+
211
+ export interface ReviewData {
212
+ status_header: ReviewStatusHeader | string;
213
+ summary_counts: ReviewSummaryCounts;
214
+ per_skill_scan: PerSkillScanItem[];
215
+ critical_findings: ReviewFinding[];
216
+ minor_findings: ReviewFinding[];
217
+ preexisting_findings: ReviewFinding[];
218
+ skills_referenced: string[];
219
+ last_reviewed_sha: string;
220
+ dedicated_sections?: DedicatedSection[];
221
+ diagnostics?: string[];
222
+ }