diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bd32807 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Normalize line endings: everything text is committed with LF and checked +# out as LF on every platform, so Windows clones (core.autocrlf=true) don't +# fail the incremental prettier --check CI gate on CRLF. +* text=auto eol=lf + +# Binary assets — never normalized or diffed as text. +*.docx binary +*.xlsx binary +*.pptx binary +*.pdf binary +*.png binary +*.ico binary +*.icns binary +*.ttf binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..7421ca7 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,6 @@ +# ee/ is the enterprise-license boundary and takes no external contributions +# (see ee/LICENSE); license-related files need a maintainer review. +/ee/ @merrick-2002 +/LICENSE @merrick-2002 +/NOTICE @merrick-2002 +/.github/CODEOWNERS @merrick-2002 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4c2b194 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Keep GitHub Actions fresh: workflow actions are SHA-pinned, so tag moves +# never reach us without a PR bumping the pinned commit here. +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e21274f..a42dc8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,12 +25,12 @@ jobs: timeout-minutes: 45 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 20 cache: npm @@ -82,5 +82,11 @@ jobs: - name: Regenerate test fixtures run: npm run fixtures + # Generation is byte-deterministic (zip entry mtimes are pinned in + # tests/helpers/build-docx.ts); a diff here means the generator and the + # committed fixtures have drifted apart. + - name: Check committed fixtures match the generator + run: git diff --exit-code -- fixtures/generated + - name: Test run: npm test diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b5fb22c..a49f5a5 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -56,9 +56,11 @@ an individual is officially representing the community in public spaces. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement through the -repository's security advisory channel or the contact listed in -[SECURITY.md](SECURITY.md). All complaints will be reviewed and investigated +reported to the community leaders responsible for enforcement through +GitHub's +[private vulnerability reporting](https://github.com/genspark-ai/genoffice/security/advisories/new) +channel on this repository (used here as the private contact channel for +conduct reports as well). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 10c283c..2223700 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,9 +53,12 @@ formatting diff. ## Building installers +Run these from the repository root — they regenerate the third-party +notices and build all five apps before packaging: + ```bash -npm run dist:mac -w @genoffice/shell # dmg + zip -npm run dist:win -w @genoffice/shell # nsis installer +npm run dist:mac # dmg + zip +npm run dist:win # nsis installer ``` Without Apple or Windows signing credentials in the environment these produce diff --git a/README.md b/README.md index 867dbd3..2af0954 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,11 @@ calls through the Genspark service side; no model API key is stored locally. ## Engine packages -All pure TypeScript, unit-tested, no Electron dependency: +All pure TypeScript, no Electron dependency, unit-tested (except the UI kit): -- `packages/docx-engine` — docx parsing → block tree (with `docxIndex` anchors - - passthrough), OOXML fragment generation, byte-level paragraph patching. +- `packages/docx-engine` — docx parsing → block tree (with `docxIndex` + anchors and passthrough), OOXML fragment generation, byte-level paragraph + patching. - `packages/pptx-engine` / `packages/pptx-render` — pptx model and rendering. - `packages/file-parse` — text extraction for AI attachments (office formats, text formats). diff --git a/SECURITY.md b/SECURITY.md index 3338fe5..1a8e12d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,8 +3,8 @@ ## Reporting a Vulnerability Please report suspected vulnerabilities privately via GitHub's -[private vulnerability reporting](../../security/advisories/new) on this -repository. Do not open public issues for security reports. We aim to +[private vulnerability reporting](https://github.com/genspark-ai/genoffice/security/advisories/new) +on this repository. Do not open public issues for security reports. We aim to acknowledge reports within 72 hours. ## Process Security Posture diff --git a/apps/docs/src/main/docs-main.ts b/apps/docs/src/main/docs-main.ts index c363577..8aa6f08 100644 --- a/apps/docs/src/main/docs-main.ts +++ b/apps/docs/src/main/docs-main.ts @@ -11,7 +11,11 @@ import { } from 'node:fs' import { basename, join } from 'node:path' import { BrowserWindow, Menu, WebContentsView, app, dialog, ipcMain, shell } from 'electron' -import { fetchWithSsrfGuard, safeExternalUrl } from '@genoffice/electron-utils' +import { + fetchWithSsrfGuard, + installNavigationGuard, + safeExternalUrl, +} from '@genoffice/electron-utils' import { createI18n, getUiLang, normalizeLang, setUiLang } from '@genoffice/i18n' import { ProjectStore } from '@genoffice/project-store' import type { @@ -3399,6 +3403,7 @@ export function hasDocsWindow(): boolean { // ---- standalone lifecycle (apps/docs running on its own) ---- export function startDocsStandalone(): void { + installNavigationGuard(app) // dev runs must not share the packaged app's userData (recent files, AI settings) // or its single-instance lock — otherwise `npm run dev` silently quits whenever // the installed GenOffice Docs is open and forwards its argv there instead. diff --git a/apps/docs/src/renderer/index.html b/apps/docs/src/renderer/index.html index b3ad57a..6ea72de 100644 --- a/apps/docs/src/renderer/index.html +++ b/apps/docs/src/renderer/index.html @@ -2,6 +2,10 @@ + GenOffice Docs diff --git a/apps/pdf/src/main/pdf-main.ts b/apps/pdf/src/main/pdf-main.ts index 4226efb..a64cfb8 100644 --- a/apps/pdf/src/main/pdf-main.ts +++ b/apps/pdf/src/main/pdf-main.ts @@ -3,7 +3,7 @@ import { readFile, rename, writeFile } from 'node:fs/promises' import { dirname, join } from 'node:path' import { BrowserWindow, WebContentsView, app, dialog, ipcMain, shell } from 'electron' import type { WebContents } from 'electron' -import { safeExternalUrl } from '@genoffice/electron-utils' +import { installNavigationGuard, safeExternalUrl } from '@genoffice/electron-utils' import { createI18n, getUiLang } from '@genoffice/i18n' import { PDF_CHANNELS } from '../shared/ipc' import type { @@ -494,6 +494,7 @@ export function createPdfView(openPath?: string | null): WebContentsView { /** Standalone window mode: `npm run dev -w @genoffice/pdf`, pdf path passed via argv */ export function startPdfStandalone(): void { + installNavigationGuard(app) configurePdfRuntime({ preloadPath: join(__dirname, '../preload/index.js'), rendererUrl: process.env.ELECTRON_RENDERER_URL, diff --git a/apps/pdf/src/renderer/index.html b/apps/pdf/src/renderer/index.html index 1056b4b..e19105a 100644 --- a/apps/pdf/src/renderer/index.html +++ b/apps/pdf/src/renderer/index.html @@ -2,6 +2,11 @@ + + GenOffice PDF diff --git a/apps/sheets/src/main/sheets-main.ts b/apps/sheets/src/main/sheets-main.ts index 67ba8e6..507fa93 100644 --- a/apps/sheets/src/main/sheets-main.ts +++ b/apps/sheets/src/main/sheets-main.ts @@ -31,7 +31,7 @@ import type { WebContents, } from 'electron' import { z } from 'zod' -import { safeExternalUrl } from '@genoffice/electron-utils' +import { installNavigationGuard, safeExternalUrl } from '@genoffice/electron-utils' import { createI18n, getUiLang, type Lang, normalizeLang, setUiLang } from '@genoffice/i18n' import { ProjectStore } from '@genoffice/project-store' @@ -2716,6 +2716,7 @@ async function applyMainProcessProxy(): Promise { } export function startSheetsStandalone(): void { + installNavigationGuard(app) // GENOFFICE_USER_DATA: test drivers point this at a scratch dir so automated // instances get their own userData AND single-instance lock (the lock is scoped // to userData), allowing parallel instances alongside a normal dev run. diff --git a/apps/shell/electron-builder.cjs b/apps/shell/electron-builder.cjs index 41ae8c5..3a3958a 100644 --- a/apps/shell/electron-builder.cjs +++ b/apps/shell/electron-builder.cjs @@ -14,8 +14,27 @@ * app-update.yml into the app and in-app auto-update stays disabled. */ +const { existsSync } = require('node:fs') +const { join } = require('node:path') + const updateUrl = process.env.GENOFFICE_UPDATE_URL +// The gsk CLI tree below is copied verbatim from node_modules, and the +// nested commander path depends on npm's current hoisting layout — fail the +// build with a clear message if an install ever changes it, instead of +// shipping an installer with a broken gsk runtime. +for (const rel of [ + '../../node_modules/@genspark/cli', + '../../node_modules/@genspark/cli/node_modules/commander', + '../../node_modules/ws', +]) { + if (!existsSync(join(__dirname, rel))) { + throw new Error( + `electron-builder extraResources source missing: ${rel} (npm hoisting changed?)`, + ) + } +} + /** @type {import('electron-builder').Configuration} */ const config = { appId: 'com.genoffice.app', diff --git a/apps/shell/package.json b/apps/shell/package.json index ff500b1..2932c97 100644 --- a/apps/shell/package.json +++ b/apps/shell/package.json @@ -21,6 +21,7 @@ "@genoffice/ai-search": "*", "@genoffice/docs": "*", "@genoffice/docx-engine": "*", + "@genoffice/electron-utils": "*", "@genoffice/i18n": "*", "@genoffice/pptx-engine": "*", "@genoffice/pptx-render": "*", diff --git a/apps/shell/src/main/index.ts b/apps/shell/src/main/index.ts index 6d7adcd..3e8c329 100644 --- a/apps/shell/src/main/index.ts +++ b/apps/shell/src/main/index.ts @@ -28,6 +28,7 @@ import menuXlsxIcon2x from './assets/menu-xlsx@2x.png?asset' import menuPptxIcon1x from './assets/menu-pptx.png?asset' import menuPptxIcon2x from './assets/menu-pptx@2x.png?asset' import { createI18n, isLang, normalizeLang, setUiLang, type Lang } from '@genoffice/i18n' +import { installNavigationGuard } from '@genoffice/electron-utils' import { readAppSettings, writeAppSetting } from './app-settings' import { isOnboardingLive } from './onboarding-gate' import { ProjectStore } from '@genoffice/project-store' @@ -1650,6 +1651,7 @@ app.on('second-instance', (_event, argv, _cwd, additionalData) => { if (!file || !openDocumentPath(file)) tabManager?.openHomeTab() }) +installNavigationGuard(app) registerAiIpc() registerProjectIpc() registerDocsIpc() diff --git a/apps/shell/src/renderer/index.html b/apps/shell/src/renderer/index.html index 47b2099..0924243 100644 --- a/apps/shell/src/renderer/index.html +++ b/apps/shell/src/renderer/index.html @@ -2,6 +2,10 @@ + GenOffice diff --git a/apps/shell/src/renderer/update.html b/apps/shell/src/renderer/update.html index acf40bc..1f54fd8 100644 --- a/apps/shell/src/renderer/update.html +++ b/apps/shell/src/renderer/update.html @@ -2,6 +2,10 @@ + GenOffice Update