SIDDARTHA577/envguard-node / .agents/skills/envguard-mobile-readiness
envguard-mobile-readiness
VerifiedGuides comprehensive, evidence-based mobile application readiness assessments for React Native, Expo, Flutter, Native Android (Kotlin/Java), and Native iOS (Swift) aligned with OWASP MASVS v2.0 standards.
scripts/readiness/remediation/diff-viewer.mjs
View on GitHub/**
* Dependency-free Unified Diff Generator for EnvGuard reviewable fixes.
* Produces standard unidiff strings suitable for CLI preview and patch review.
*
* @param {string} filePath - Relative file path being diffed
* @param {string|null} originalContent - Original file content (or null if new file)
* @param {string} proposedContent - Proposed modified content
* @returns {string} Standard unified diff string
*/
export function generateUnifiedDiff(filePath, originalContent, proposedContent) {
const isNewFile = originalContent === null || originalContent === undefined;
const splitLines = (text) => {
if (text === null || text === undefined || text === '') return [];
const normalized = String(text).replace(/\r\n/g, '\n');
const lines = normalized.split('\n');
if (lines.length > 0 && lines[lines.length - 1] === '') {
lines.pop();
}
return lines;
};
const origLines = isNewFile ? [] : splitLines(originalContent);
const propLines = splitLines(proposedContent);
const oldHeader = isNewFile ? '/dev/null' : `a/${filePath}`;
const newHeader = `b/${filePath}`;
let diff = `--- ${oldHeader}\n+++ ${newHeader}\n`;
if (isNewFile) {
diff += `@@ -0,0 +1,${propLines.length} @@\n`;
for (const line of propLines) {
diff += `+${line}\n`;
}
return diff;
}
// Simple, deterministic unified hunk generation
const hunks = [];
let i = 0;
let j = 0;
// Find differing regions
while (i < origLines.length || j < propLines.length) {
if (i < origLines.length && j < propLines.length && origLines[i] === propLines[j]) {
i++;
j++;
} else {
const startOrig = i;
const startProp = j;
const removed = [];
const added = [];
while (i < origLines.length && (j >= propLines.length || origLines[i] !== propLines[j])) {
removed.push(origLines[i]);
i++;
}
while (j < propLines.length && (i >= origLines.length || origLines[i] !== propLines[j])) {
added.push(propLines[j]);
j++;
}
hunks.push({
origStart: startOrig + 1,
origCount: removed.length,
propStart: startProp + 1,
propCount: added.length,
removed,
added,
});
}
}
if (hunks.length === 0) {
return `${diff}@@ -1 +1 @@\n (No changes)\n`;
}
for (const h of hunks) {
diff += `@@ -${h.origStart},${h.origCount} +${h.propStart},${h.propCount} @@\n`;
for (const r of h.removed) {
diff += `-${r}\n`;
}
for (const a of h.added) {
diff += `+${a}\n`;
}
}
return diff;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |