feat: add companion API and Android APK shell

This commit is contained in:
Hermes Agent
2026-07-09 04:43:00 +00:00
parent bd0cf34aa3
commit 7eb9648eb7
92 changed files with 7907 additions and 877 deletions
+27
View File
@@ -0,0 +1,27 @@
import { isAbsolute, relative, resolve, sep } from 'node:path';
const ignoredPathSegments = new Set(['.git', '.dev', 'node_modules', 'dist', 'android']);
export function toSafeAbsolutePath(workspaceRoot: string, requestedPath = '.'): string {
const root = resolve(workspaceRoot);
const target = resolve(root, requestedPath || '.');
const relativePath = relative(root, target);
if (relativePath === '' || (!relativePath.startsWith('..') && !relativePath.includes(`..${sep}`) && !isAbsolute(relativePath))) {
return target;
}
throw new Error('Path is outside the configured workspace root');
}
export function toWorkspacePath(workspaceRoot: string, absolutePath: string): string {
const relativePath = relative(resolve(workspaceRoot), resolve(absolutePath));
return relativePath === '' ? '.' : relativePath.split(sep).join('/');
}
export function isIgnoredWorkspacePath(workspacePath: string): boolean {
return workspacePath
.split('/')
.filter(Boolean)
.some((segment) => ignoredPathSegments.has(segment));
}