Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion artifacts/governance/status-truth-map.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"generatedAt": "2026-05-29T05:04:33.848Z",
"generatedAt": "2026-05-29T05:05:17.186Z",
"schemaVersion": "1.0.0",
"components": [
{
Expand Down
16 changes: 14 additions & 2 deletions scripts/verify-status-truth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,20 @@ const docs = {
target: readFileSync("docs/architecture/target-state.md", "utf8"),
};

const rawFiles = execSync('find src test docs .github/workflows scripts -type f').toString('utf8').trim();
const files = rawFiles ? rawFiles.split('\n') : [];
let rawFiles = "";
try {
rawFiles = execSync("git ls-files src test docs .github/workflows scripts")
.toString("utf8")
.trim();
} catch (e) {
// fallback if git is not available or path is wrong
try {
rawFiles = execSync("find src test docs .github/workflows scripts -type f")
.toString("utf8")
.trim();
} catch (e2) {}
}
const files = rawFiles ? rawFiles.split("\n") : [];
const hasFile = (pattern: RegExp) => files.some((f) => pattern.test(f));

const components: Component[] = [
Expand Down
30 changes: 12 additions & 18 deletions src/lib/adapters/openshell/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,30 @@ function exitWithCode(code: number): never {

describe("openshell helpers", () => {
describe("stripAnsi", () => {
it("strips basic color codes", () => {
it("strips simple ANSI color codes", () => {
expect(stripAnsi("\u001b[32mConnected\u001b[0m")).toBe("Connected");
});

it("handles empty strings", () => {
expect(stripAnsi("")).toBe("");
});

it("handles strings without ANSI codes", () => {
expect(stripAnsi("Plain text")).toBe("Plain text");
it("strips complex ANSI codes with semicolons", () => {
expect(stripAnsi("\x1b[38;5;206mMagenta text\x1b[0m")).toBe("Magenta text");
expect(stripAnsi("\u001b[1;31mBold red\u001b[0m")).toBe("Bold red");
});

it("handles complex ANSI sequences (e.g., bold, background, rgb)", () => {
// Bold red text on yellow background
expect(stripAnsi("\x1b[1;31;43mWarning\x1b[0m")).toBe("Warning");
// RGB colors
expect(stripAnsi("\x1b[38;2;255;82;197mPink\x1b[0m")).toBe("Pink");
// Complex multi-sequence text
expect(stripAnsi("\x1b[1mBold\x1b[0m and \x1b[4mUnderline\x1b[0m")).toBe("Bold and Underline");
it("strips multiple ANSI codes in a single string", () => {
expect(stripAnsi("\u001b[31mRed\u001b[0m and \u001b[32mGreen\u001b[0m")).toBe("Red and Green");
});

it("handles multiple ANSI sequences sequentially", () => {
expect(stripAnsi("\x1b[31m\x1b[1mRed Bold\x1b[0m\x1b[0m")).toBe("Red Bold");
it("returns the original string if no ANSI codes are present", () => {
expect(stripAnsi("Plain text")).toBe("Plain text");
});

it("handles undefined gracefully by falling back to default parameter", () => {
it("handles undefined and empty inputs", () => {
expect(stripAnsi()).toBe("");
expect(stripAnsi(undefined)).toBe("");
expect(stripAnsi(undefined as any)).toBe("");
expect(stripAnsi("")).toBe("");
});


});

it("parses semantic versions from CLI output", () => {
Expand Down
Loading