bluera-knowledge 0.11.6 → 0.11.8
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.
- package/.claude/settings.local.json.example +5 -0
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +27 -0
- package/README.md +17 -1
- package/dist/index.js +63 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/validate-npm-release.sh +209 -0
- package/src/cli/commands/plugin-api.test.ts +105 -43
- package/src/cli/commands/plugin-api.ts +42 -8
- package/src/plugin/commands.ts +42 -17
- package/src/scripts/validate-npm-release.test.ts +55 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Tests for validate-npm-release.sh script.
|
|
7
|
+
* Ensures the script follows best practices for cross-platform compatibility.
|
|
8
|
+
*/
|
|
9
|
+
describe('validate-npm-release.sh', () => {
|
|
10
|
+
const scriptPath = join(process.cwd(), 'scripts/validate-npm-release.sh');
|
|
11
|
+
const scriptContent = readFileSync(scriptPath, 'utf-8');
|
|
12
|
+
|
|
13
|
+
it('does not use hardcoded /tmp paths', () => {
|
|
14
|
+
// Script should use mktemp -d for temporary directories, not hardcoded /tmp
|
|
15
|
+
// This ensures better cross-platform compatibility and avoids path collisions
|
|
16
|
+
|
|
17
|
+
// Check for hardcoded /tmp assignments (excluding comments)
|
|
18
|
+
const lines = scriptContent.split('\n').filter((line) => !line.trim().startsWith('#'));
|
|
19
|
+
const hasHardcodedTmp = lines.some((line) => /=["']?\/tmp\//.test(line));
|
|
20
|
+
|
|
21
|
+
expect(hasHardcodedTmp).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('uses mktemp for temporary directories', () => {
|
|
25
|
+
// Should use mktemp -d for creating temporary directories
|
|
26
|
+
expect(scriptContent).toContain('mktemp -d');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('cleans up temporary directories on exit', () => {
|
|
30
|
+
// Should have a trap to clean up on exit
|
|
31
|
+
expect(scriptContent).toContain('trap');
|
|
32
|
+
expect(scriptContent).toMatch(/rm -rf/);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('shows real-time output during command execution', () => {
|
|
36
|
+
// Script should use tee to show output on both terminal and log file
|
|
37
|
+
// This prevents the script from appearing "hung" during long-running commands
|
|
38
|
+
expect(scriptContent).toContain('tee -a');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('does not redirect output only to log file in run_test functions', () => {
|
|
42
|
+
// The run_test and run_test_contains functions should not silently redirect
|
|
43
|
+
// all output to log file - they should show progress on terminal
|
|
44
|
+
const lines = scriptContent.split('\n');
|
|
45
|
+
|
|
46
|
+
// Find run_test function and check it doesn't use silent redirection
|
|
47
|
+
// Pattern: >> "$LOG_FILE" 2>&1 without tee means silent execution
|
|
48
|
+
const hasSilentRedirect = lines.some(
|
|
49
|
+
(line) =>
|
|
50
|
+
line.includes('eval "$cmd"') && line.includes('>> "$LOG_FILE"') && !line.includes('tee')
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(hasSilentRedirect).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
});
|