@blockspool/cli 0.4.1 → 0.4.2

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 (149) hide show
  1. package/dist/bin/blockspool.d.ts +16 -0
  2. package/dist/bin/blockspool.d.ts.map +1 -0
  3. package/dist/bin/blockspool.js +45 -0
  4. package/dist/bin/blockspool.js.map +1 -0
  5. package/dist/commands/solo-auto.d.ts +6 -0
  6. package/dist/commands/solo-auto.d.ts.map +1 -0
  7. package/dist/commands/solo-auto.js +418 -0
  8. package/dist/commands/solo-auto.js.map +1 -0
  9. package/dist/commands/solo-exec.d.ts +6 -0
  10. package/dist/commands/solo-exec.d.ts.map +1 -0
  11. package/dist/commands/solo-exec.js +656 -0
  12. package/dist/commands/solo-exec.js.map +1 -0
  13. package/dist/commands/solo-inspect.d.ts +6 -0
  14. package/dist/commands/solo-inspect.d.ts.map +1 -0
  15. package/dist/commands/solo-inspect.js +690 -0
  16. package/dist/commands/solo-inspect.js.map +1 -0
  17. package/dist/commands/solo-lifecycle.d.ts +6 -0
  18. package/dist/commands/solo-lifecycle.d.ts.map +1 -0
  19. package/dist/commands/solo-lifecycle.js +188 -0
  20. package/dist/commands/solo-lifecycle.js.map +1 -0
  21. package/dist/commands/solo-nudge.d.ts +6 -0
  22. package/dist/commands/solo-nudge.d.ts.map +1 -0
  23. package/dist/commands/solo-nudge.js +49 -0
  24. package/dist/commands/solo-nudge.js.map +1 -0
  25. package/dist/commands/solo-qa.d.ts +6 -0
  26. package/dist/commands/solo-qa.d.ts.map +1 -0
  27. package/dist/commands/solo-qa.js +254 -0
  28. package/dist/commands/solo-qa.js.map +1 -0
  29. package/dist/commands/solo.d.ts +11 -0
  30. package/dist/commands/solo.d.ts.map +1 -0
  31. package/dist/commands/solo.js +43 -0
  32. package/dist/commands/solo.js.map +1 -0
  33. package/dist/index.d.ts +18 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +18 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/lib/artifacts.d.ts +136 -0
  38. package/dist/lib/artifacts.d.ts.map +1 -0
  39. package/dist/lib/artifacts.js +146 -0
  40. package/dist/lib/artifacts.js.map +1 -0
  41. package/dist/lib/doctor.d.ts +45 -0
  42. package/dist/lib/doctor.d.ts.map +1 -0
  43. package/dist/lib/doctor.js +383 -0
  44. package/dist/lib/doctor.js.map +1 -0
  45. package/dist/lib/exec.d.ts +24 -0
  46. package/dist/lib/exec.d.ts.map +1 -0
  47. package/dist/lib/exec.js +295 -0
  48. package/dist/lib/exec.js.map +1 -0
  49. package/dist/lib/formulas.d.ts +78 -0
  50. package/dist/lib/formulas.d.ts.map +1 -0
  51. package/dist/lib/formulas.js +295 -0
  52. package/dist/lib/formulas.js.map +1 -0
  53. package/dist/lib/git.d.ts +9 -0
  54. package/dist/lib/git.d.ts.map +1 -0
  55. package/dist/lib/git.js +60 -0
  56. package/dist/lib/git.js.map +1 -0
  57. package/dist/lib/guidelines.d.ts +43 -0
  58. package/dist/lib/guidelines.d.ts.map +1 -0
  59. package/dist/lib/guidelines.js +195 -0
  60. package/dist/lib/guidelines.js.map +1 -0
  61. package/dist/lib/logger.d.ts +17 -0
  62. package/dist/lib/logger.d.ts.map +1 -0
  63. package/dist/lib/logger.js +42 -0
  64. package/dist/lib/logger.js.map +1 -0
  65. package/dist/lib/retention.d.ts +62 -0
  66. package/dist/lib/retention.d.ts.map +1 -0
  67. package/dist/lib/retention.js +285 -0
  68. package/dist/lib/retention.js.map +1 -0
  69. package/dist/lib/run-history.d.ts +52 -0
  70. package/dist/lib/run-history.d.ts.map +1 -0
  71. package/dist/lib/run-history.js +116 -0
  72. package/dist/lib/run-history.js.map +1 -0
  73. package/dist/lib/run-state.d.ts +58 -0
  74. package/dist/lib/run-state.d.ts.map +1 -0
  75. package/dist/lib/run-state.js +119 -0
  76. package/dist/lib/run-state.js.map +1 -0
  77. package/dist/lib/scope.d.ts +95 -0
  78. package/dist/lib/scope.d.ts.map +1 -0
  79. package/dist/lib/scope.js +291 -0
  80. package/dist/lib/scope.js.map +1 -0
  81. package/dist/lib/selection.d.ts +35 -0
  82. package/dist/lib/selection.d.ts.map +1 -0
  83. package/dist/lib/selection.js +110 -0
  84. package/dist/lib/selection.js.map +1 -0
  85. package/dist/lib/solo-auto.d.ts +87 -0
  86. package/dist/lib/solo-auto.d.ts.map +1 -0
  87. package/dist/lib/solo-auto.js +1230 -0
  88. package/dist/lib/solo-auto.js.map +1 -0
  89. package/dist/lib/solo-ci.d.ts +84 -0
  90. package/dist/lib/solo-ci.d.ts.map +1 -0
  91. package/dist/lib/solo-ci.js +300 -0
  92. package/dist/lib/solo-ci.js.map +1 -0
  93. package/dist/lib/solo-config.d.ts +155 -0
  94. package/dist/lib/solo-config.d.ts.map +1 -0
  95. package/dist/lib/solo-config.js +236 -0
  96. package/dist/lib/solo-config.js.map +1 -0
  97. package/dist/lib/solo-git.d.ts +44 -0
  98. package/dist/lib/solo-git.d.ts.map +1 -0
  99. package/dist/lib/solo-git.js +174 -0
  100. package/dist/lib/solo-git.js.map +1 -0
  101. package/dist/lib/solo-hints.d.ts +32 -0
  102. package/dist/lib/solo-hints.d.ts.map +1 -0
  103. package/dist/lib/solo-hints.js +98 -0
  104. package/dist/lib/solo-hints.js.map +1 -0
  105. package/dist/lib/solo-remote.d.ts +14 -0
  106. package/dist/lib/solo-remote.d.ts.map +1 -0
  107. package/dist/lib/solo-remote.js +48 -0
  108. package/dist/lib/solo-remote.js.map +1 -0
  109. package/dist/lib/solo-stdin.d.ts +13 -0
  110. package/dist/lib/solo-stdin.d.ts.map +1 -0
  111. package/dist/lib/solo-stdin.js +33 -0
  112. package/dist/lib/solo-stdin.js.map +1 -0
  113. package/dist/lib/solo-ticket.d.ts +213 -0
  114. package/dist/lib/solo-ticket.d.ts.map +1 -0
  115. package/dist/lib/solo-ticket.js +850 -0
  116. package/dist/lib/solo-ticket.js.map +1 -0
  117. package/dist/lib/solo-utils.d.ts +133 -0
  118. package/dist/lib/solo-utils.d.ts.map +1 -0
  119. package/dist/lib/solo-utils.js +300 -0
  120. package/dist/lib/solo-utils.js.map +1 -0
  121. package/dist/lib/spindle.d.ts +144 -0
  122. package/dist/lib/spindle.d.ts.map +1 -0
  123. package/dist/lib/spindle.js +388 -0
  124. package/dist/lib/spindle.js.map +1 -0
  125. package/dist/tui/app.d.ts +17 -0
  126. package/dist/tui/app.d.ts.map +1 -0
  127. package/dist/tui/app.js +139 -0
  128. package/dist/tui/app.js.map +1 -0
  129. package/dist/tui/index.d.ts +8 -0
  130. package/dist/tui/index.d.ts.map +1 -0
  131. package/dist/tui/index.js +7 -0
  132. package/dist/tui/index.js.map +1 -0
  133. package/dist/tui/poller.d.ts +42 -0
  134. package/dist/tui/poller.d.ts.map +1 -0
  135. package/dist/tui/poller.js +62 -0
  136. package/dist/tui/poller.js.map +1 -0
  137. package/dist/tui/screens/overview.d.ts +9 -0
  138. package/dist/tui/screens/overview.d.ts.map +1 -0
  139. package/dist/tui/screens/overview.js +189 -0
  140. package/dist/tui/screens/overview.js.map +1 -0
  141. package/dist/tui/state.d.ts +93 -0
  142. package/dist/tui/state.d.ts.map +1 -0
  143. package/dist/tui/state.js +169 -0
  144. package/dist/tui/state.js.map +1 -0
  145. package/dist/tui/types.d.ts +18 -0
  146. package/dist/tui/types.d.ts.map +1 -0
  147. package/dist/tui/types.js +5 -0
  148. package/dist/tui/types.js.map +1 -0
  149. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solo.d.ts","sourceRoot":"","sources":["../../src/commands/solo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,eAAO,MAAM,WAAW,SAqBtB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Solo mode commands - Zero-config local operation
3
+ *
4
+ * These commands work without any external infrastructure.
5
+ * State is stored in SQLite at ~/.blockspool/data.db or .blockspool/state.sqlite
6
+ */
7
+ import { Command } from 'commander';
8
+ import { registerLifecycleCommands } from './solo-lifecycle.js';
9
+ import { registerInspectCommands } from './solo-inspect.js';
10
+ import { registerExecCommands } from './solo-exec.js';
11
+ import { registerQaCommands } from './solo-qa.js';
12
+ import { registerAutoCommands } from './solo-auto.js';
13
+ import { registerNudgeCommands } from './solo-nudge.js';
14
+ export { EXIT_CODES } from '../lib/solo-ticket.js';
15
+ export const soloCommand = new Command('solo')
16
+ .description('Zero-config local mode - works without any external services')
17
+ .addHelpText('after', `
18
+ Running 'blockspool solo' without a subcommand starts auto mode.
19
+
20
+ Examples:
21
+ blockspool solo Run auto mode (scout → fix → PR)
22
+ blockspool solo --codex Full Codex mode (no Anthropic key needed)
23
+ blockspool solo init Initialize local state in current repo
24
+ blockspool solo doctor Check prerequisites and environment health
25
+ blockspool solo ci Fix CI failures automatically
26
+ blockspool solo scout . Scan for improvement opportunities
27
+ blockspool solo approve 1-3 Convert proposals 1-3 to tickets
28
+ blockspool solo run tkt_abc123 Execute a ticket using Claude
29
+ blockspool solo retry tkt_abc123 Reset a blocked ticket to ready
30
+ blockspool solo qa Run QA commands (lint, test, etc.)
31
+ blockspool solo status Show local state and active tickets
32
+ blockspool solo nudge "..." Steer a running auto session with a hint
33
+ blockspool solo tui Launch interactive terminal UI
34
+ blockspool solo reset Clear all local state
35
+ blockspool solo export Export state for debugging
36
+ `);
37
+ registerLifecycleCommands(soloCommand);
38
+ registerInspectCommands(soloCommand);
39
+ registerExecCommands(soloCommand);
40
+ registerQaCommands(soloCommand);
41
+ registerAutoCommands(soloCommand);
42
+ registerNudgeCommands(soloCommand);
43
+ //# sourceMappingURL=solo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solo.js","sourceRoot":"","sources":["../../src/commands/solo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,8DAA8D,CAAC;KAC3E,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;CAmBvB,CAAC,CAAC;AAEH,yBAAyB,CAAC,WAAW,CAAC,CAAC;AACvC,uBAAuB,CAAC,WAAW,CAAC,CAAC;AACrC,oBAAoB,CAAC,WAAW,CAAC,CAAC;AAClC,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAChC,oBAAoB,CAAC,WAAW,CAAC,CAAC;AAClC,qBAAqB,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export {};
2
+ /**
3
+ * @blockspool/cli
4
+ *
5
+ * BlockSpool command-line interface.
6
+ *
7
+ * This package is a CLI tool only - it has no public API exports.
8
+ * Use it via the command line:
9
+ *
10
+ * npx @blockspool/cli solo scout .
11
+ *
12
+ * Or installed globally:
13
+ * npm install -g @blockspool/cli
14
+ * blockspool solo scout .
15
+ *
16
+ * The CLI entry point is src/bin/blockspool.ts
17
+ */
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ export {};
2
+ /**
3
+ * @blockspool/cli
4
+ *
5
+ * BlockSpool command-line interface.
6
+ *
7
+ * This package is a CLI tool only - it has no public API exports.
8
+ * Use it via the command line:
9
+ *
10
+ * npx @blockspool/cli solo scout .
11
+ *
12
+ * Or installed globally:
13
+ * npm install -g @blockspool/cli
14
+ * blockspool solo scout .
15
+ *
16
+ * The CLI entry point is src/bin/blockspool.ts
17
+ */
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Artifact persistence helpers
3
+ *
4
+ * Writes structured data as JSON files in .blockspool/artifacts/
5
+ * Used for proposals, run outputs, and other debugging data.
6
+ *
7
+ * Artifact Types:
8
+ * - proposals: Scout proposals before approval
9
+ * - executions: Agent execution logs (stdout, stderr, prompt)
10
+ * - diffs: Git diff snapshots
11
+ * - runs: Complete run summaries with all steps
12
+ * - violations: Scope violation details
13
+ */
14
+ /**
15
+ * Known artifact types - single source of truth
16
+ */
17
+ export declare const ARTIFACT_TYPES: readonly ["proposals", "executions", "diffs", "runs", "violations", "spindle"];
18
+ /**
19
+ * Known artifact types for type safety
20
+ */
21
+ export type ArtifactType = (typeof ARTIFACT_TYPES)[number];
22
+ /**
23
+ * Run summary artifact structure
24
+ */
25
+ export interface RunSummaryArtifact {
26
+ runId: string;
27
+ ticketId: string;
28
+ ticketTitle: string;
29
+ projectId: string;
30
+ success: boolean;
31
+ startedAt: string;
32
+ completedAt: string;
33
+ durationMs: number;
34
+ branchName?: string;
35
+ prUrl?: string;
36
+ error?: string;
37
+ steps: Array<{
38
+ name: string;
39
+ status: 'success' | 'failed' | 'skipped';
40
+ durationMs?: number;
41
+ errorMessage?: string;
42
+ artifactPath?: string;
43
+ }>;
44
+ artifacts: {
45
+ execution?: string;
46
+ diff?: string;
47
+ violations?: string;
48
+ };
49
+ }
50
+ /**
51
+ * Scope violations artifact structure
52
+ */
53
+ export interface ViolationsArtifact {
54
+ runId: string;
55
+ ticketId: string;
56
+ changedFiles: string[];
57
+ allowedPaths: string[];
58
+ forbiddenPaths: string[];
59
+ violations: Array<{
60
+ file: string;
61
+ violation: 'not_in_allowed' | 'in_forbidden';
62
+ pattern?: string;
63
+ }>;
64
+ }
65
+ /**
66
+ * Options for writing an artifact
67
+ */
68
+ interface WriteArtifactOptions {
69
+ /** Base directory (usually .blockspool) */
70
+ baseDir: string;
71
+ /** Artifact type (creates subfolder) */
72
+ type: string;
73
+ /** Unique identifier (used in filename) */
74
+ id: string;
75
+ /** Data to serialize */
76
+ data: unknown;
77
+ /** Optional timestamp suffix (default: true) */
78
+ timestamp?: boolean;
79
+ }
80
+ /**
81
+ * Write a JSON artifact file
82
+ *
83
+ * Creates: {baseDir}/artifacts/{type}/{id}[-timestamp].json
84
+ *
85
+ * @returns The full path to the written file
86
+ */
87
+ export declare function writeJsonArtifact(opts: WriteArtifactOptions): string;
88
+ /**
89
+ * Read a JSON artifact file
90
+ *
91
+ * @returns Parsed data or null if file doesn't exist
92
+ */
93
+ export declare function readJsonArtifact<T = unknown>(filePath: string): T | null;
94
+ /**
95
+ * List artifacts of a given type
96
+ *
97
+ * @returns Array of { path, id, timestamp } sorted by timestamp desc
98
+ */
99
+ export declare function listArtifacts(baseDir: string, type: string): Array<{
100
+ path: string;
101
+ id: string;
102
+ timestamp: number;
103
+ }>;
104
+ /**
105
+ * Get the most recent artifact of a given type
106
+ */
107
+ export declare function getLatestArtifact<T = unknown>(baseDir: string, type: string): {
108
+ path: string;
109
+ data: T;
110
+ } | null;
111
+ /**
112
+ * Get all artifacts for a specific run ID
113
+ *
114
+ * Searches across all artifact types for files matching the run ID.
115
+ */
116
+ export declare function getArtifactsForRun(baseDir: string, runId: string): Record<ArtifactType, {
117
+ path: string;
118
+ data: unknown;
119
+ } | null>;
120
+ /**
121
+ * Get artifact by run ID and type
122
+ */
123
+ export declare function getArtifactByRunId<T = unknown>(baseDir: string, runId: string, type: ArtifactType): {
124
+ path: string;
125
+ data: T;
126
+ } | null;
127
+ /**
128
+ * Get all artifacts in the base directory, grouped by type
129
+ */
130
+ export declare function getAllArtifacts(baseDir: string): Record<ArtifactType, Array<{
131
+ path: string;
132
+ id: string;
133
+ timestamp: number;
134
+ }>>;
135
+ export {};
136
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/lib/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;GAEG;AACH,eAAO,MAAM,cAAc,gFAOjB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;QACzC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH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AG,OAAO,EAC3C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG,IAAI,CASlC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,CAgB9D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAC5C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,YAAY,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG,IAAI,CAQlC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAQ9E"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Artifact persistence helpers
3
+ *
4
+ * Writes structured data as JSON files in .blockspool/artifacts/
5
+ * Used for proposals, run outputs, and other debugging data.
6
+ *
7
+ * Artifact Types:
8
+ * - proposals: Scout proposals before approval
9
+ * - executions: Agent execution logs (stdout, stderr, prompt)
10
+ * - diffs: Git diff snapshots
11
+ * - runs: Complete run summaries with all steps
12
+ * - violations: Scope violation details
13
+ */
14
+ import * as fs from 'node:fs';
15
+ import * as path from 'node:path';
16
+ /**
17
+ * Known artifact types - single source of truth
18
+ */
19
+ export const ARTIFACT_TYPES = [
20
+ 'proposals',
21
+ 'executions',
22
+ 'diffs',
23
+ 'runs',
24
+ 'violations',
25
+ 'spindle',
26
+ ];
27
+ /**
28
+ * Write a JSON artifact file
29
+ *
30
+ * Creates: {baseDir}/artifacts/{type}/{id}[-timestamp].json
31
+ *
32
+ * @returns The full path to the written file
33
+ */
34
+ export function writeJsonArtifact(opts) {
35
+ const { baseDir, type, id, data, timestamp = true } = opts;
36
+ const artifactsDir = path.join(baseDir, 'artifacts', type);
37
+ // Ensure directory exists
38
+ if (!fs.existsSync(artifactsDir)) {
39
+ fs.mkdirSync(artifactsDir, { recursive: true });
40
+ }
41
+ // Build filename
42
+ const ts = timestamp ? `-${Date.now()}` : '';
43
+ const filename = `${id}${ts}.json`;
44
+ const filePath = path.join(artifactsDir, filename);
45
+ // Write atomically (write to temp, then rename)
46
+ const tempPath = `${filePath}.tmp`;
47
+ fs.writeFileSync(tempPath, JSON.stringify(data, null, 2));
48
+ fs.renameSync(tempPath, filePath);
49
+ return filePath;
50
+ }
51
+ /**
52
+ * Read a JSON artifact file
53
+ *
54
+ * @returns Parsed data or null if file doesn't exist
55
+ */
56
+ export function readJsonArtifact(filePath) {
57
+ if (!fs.existsSync(filePath)) {
58
+ return null;
59
+ }
60
+ const content = fs.readFileSync(filePath, 'utf-8');
61
+ return JSON.parse(content);
62
+ }
63
+ /**
64
+ * List artifacts of a given type
65
+ *
66
+ * @returns Array of { path, id, timestamp } sorted by timestamp desc
67
+ */
68
+ export function listArtifacts(baseDir, type) {
69
+ const artifactsDir = path.join(baseDir, 'artifacts', type);
70
+ if (!fs.existsSync(artifactsDir)) {
71
+ return [];
72
+ }
73
+ const files = fs.readdirSync(artifactsDir)
74
+ .filter(f => f.endsWith('.json'))
75
+ .map(f => {
76
+ // eslint-disable-next-line security/detect-unsafe-regex
77
+ const match = f.match(/^(.+?)(?:-(\d+))?\.json$/);
78
+ if (!match)
79
+ return null;
80
+ const filePath = path.join(artifactsDir, f);
81
+ const stat = fs.statSync(filePath);
82
+ return {
83
+ path: filePath,
84
+ id: match[1],
85
+ timestamp: match[2] ? parseInt(match[2], 10) : stat.mtimeMs,
86
+ };
87
+ })
88
+ .filter((x) => x !== null);
89
+ // Sort by timestamp descending (most recent first)
90
+ return files.sort((a, b) => b.timestamp - a.timestamp);
91
+ }
92
+ /**
93
+ * Get the most recent artifact of a given type
94
+ */
95
+ export function getLatestArtifact(baseDir, type) {
96
+ const artifacts = listArtifacts(baseDir, type);
97
+ if (artifacts.length === 0)
98
+ return null;
99
+ const latest = artifacts[0];
100
+ const data = readJsonArtifact(latest.path);
101
+ if (data === null)
102
+ return null;
103
+ return { path: latest.path, data };
104
+ }
105
+ /**
106
+ * Get all artifacts for a specific run ID
107
+ *
108
+ * Searches across all artifact types for files matching the run ID.
109
+ */
110
+ export function getArtifactsForRun(baseDir, runId) {
111
+ const result = {};
112
+ for (const type of ARTIFACT_TYPES) {
113
+ const artifacts = listArtifacts(baseDir, type);
114
+ const match = artifacts.find(a => a.id === runId || a.id.startsWith(runId));
115
+ if (match) {
116
+ const data = readJsonArtifact(match.path);
117
+ result[type] = data ? { path: match.path, data } : null;
118
+ }
119
+ else {
120
+ result[type] = null;
121
+ }
122
+ }
123
+ return result;
124
+ }
125
+ /**
126
+ * Get artifact by run ID and type
127
+ */
128
+ export function getArtifactByRunId(baseDir, runId, type) {
129
+ const artifacts = listArtifacts(baseDir, type);
130
+ const match = artifacts.find(a => a.id === runId || a.id.startsWith(runId));
131
+ if (!match)
132
+ return null;
133
+ const data = readJsonArtifact(match.path);
134
+ return data ? { path: match.path, data } : null;
135
+ }
136
+ /**
137
+ * Get all artifacts in the base directory, grouped by type
138
+ */
139
+ export function getAllArtifacts(baseDir) {
140
+ const result = {};
141
+ for (const type of ARTIFACT_TYPES) {
142
+ result[type] = listArtifacts(baseDir, type);
143
+ }
144
+ return result;
145
+ }
146
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/lib/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH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AG,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAsE,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,KAAa,EACb,IAAkB;IAElB,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,IAAI,GAAG,gBAAgB,CAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe;IAEf,MAAM,MAAM,GAA2E,EAAE,CAAC;IAE1F,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,MAAsF,CAAC;AAChG,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Doctor checks for BlockSpool prerequisites
3
+ *
4
+ * Detects missing tools, auth issues, and configuration problems
5
+ * before users hit cryptic errors mid-workflow.
6
+ */
7
+ /**
8
+ * Check status
9
+ */
10
+ export type CheckStatus = 'pass' | 'warn' | 'fail';
11
+ /**
12
+ * Individual check result
13
+ */
14
+ export interface CheckResult {
15
+ name: string;
16
+ status: CheckStatus;
17
+ message: string;
18
+ fix?: string;
19
+ details?: string;
20
+ }
21
+ /**
22
+ * Full doctor report
23
+ */
24
+ export interface DoctorReport {
25
+ checks: CheckResult[];
26
+ canScout: boolean;
27
+ canRun: boolean;
28
+ canPr: boolean;
29
+ }
30
+ /**
31
+ * Run all doctor checks
32
+ */
33
+ export declare function runDoctorChecks(options: {
34
+ repoRoot?: string;
35
+ verbose?: boolean;
36
+ }): Promise<DoctorReport>;
37
+ /**
38
+ * Format doctor report for human-readable output
39
+ */
40
+ export declare function formatDoctorReport(report: DoctorReport): string;
41
+ /**
42
+ * Format doctor report as JSON
43
+ */
44
+ export declare function formatDoctorReportJson(report: DoctorReport): string;
45
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/lib/doctor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB;AAiBD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiDxB;AAuRD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAwD/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAenE"}