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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ __pycache__/
.dev.vars*

.reports
.emulate/
.claude/settings.local.json
.claude/worktrees
AGENTS.override.md
Expand Down
4 changes: 4 additions & 0 deletions .oxlintrc.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"no-console": "off",
"no-ternary": "off",
"no-undefined": "off",
"no-underscore-dangle": "off",
"max-lines": "off",
"id-length": "off",
"func-style": [
Expand Down Expand Up @@ -170,13 +171,15 @@
"react/jsx-props-no-spreading": "off",
"react/jsx-max-depth": "off",
"react/no-multi-comp": "off",
"react/forbid-component-props": "off",

"react_perf/jsx-no-jsx-as-prop": "off",
"react_perf/jsx-no-new-object-as-prop": "off",
"react_perf/jsx-no-new-array-as-prop": "off",
"react_perf/jsx-no-new-function-as-prop": "off", // Not a blanket perf win with React Compiler; prefer targeted stabilization at memo/effect boundaries.

"jsx-a11y/no-autofocus": "off",
"jsx-a11y/prefer-tag-over-role": "off",

"sort-keys": "off",
"no-inline-comments": "off",
Expand Down Expand Up @@ -217,6 +220,7 @@
"no-script-url": "off", // TEMP ~1
"no-redeclare": "off", // TEMP ~1
"no-new": "off", // TEMP ~1
"require-unicode-regexp": "off", // TEMP ~100 — add unicode flags to existing regex literals
},
"ignorePatterns": [
"**/node_modules",
Expand Down
16 changes: 8 additions & 8 deletions apps/cli/bin/onequery.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
resolveTargetTripleCandidates,
} from "./package-constants.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const launcherFilePath = fileURLToPath(import.meta.url);
const launcherDir = path.dirname(launcherFilePath);
const require = createRequire(import.meta.url);
const runtimeBundleSpec = readRuntimeBundleSpec(resolveRuntimeBundleSpecPath());

Expand All @@ -27,7 +27,7 @@ const binaryName = binaryNameForPlatform(platform, CLI_BINARY_NAME);

// CONTEXT: platform packages are installed through npm alias names so the
// launcher resolves the alias folder, not the underlying published package id.
const localVendorRoot = path.join(__dirname, "..", "vendor");
const localVendorRoot = path.join(launcherDir, "..", "vendor");
const resolvedVendor = resolveVendorPayload({
binaryName,
localVendorRoot,
Expand Down Expand Up @@ -112,7 +112,7 @@ if (childResult.type === "signal") {

function detectPackageManager() {
const userAgent = process.env.npm_config_user_agent ?? "";
if (/\bbun\//.test(userAgent)) {
if (/\bbun\//u.test(userAgent)) {
return "bun";
}

Expand All @@ -122,8 +122,8 @@ function detectPackageManager() {
}

if (
__dirname.includes(".bun/install/global") ||
__dirname.includes(".bun\\install\\global")
launcherDir.includes(".bun/install/global") ||
launcherDir.includes(".bun\\install\\global")
) {
return "bun";
}
Expand Down Expand Up @@ -196,15 +196,15 @@ function resolveBundlePaths({ binaryName, bundleRoot, runtimeBundleSpec }) {
}

function resolveRuntimeBundleSpecPath() {
const packagedSpecPath = path.join(__dirname, "..", "runtime-bundle.json");
const packagedSpecPath = path.join(launcherDir, "..", "runtime-bundle.json");
if (existsSync(packagedSpecPath)) {
return packagedSpecPath;
}

// Comment: local workspace execution reads the canonical bundle spec from the
// repo; published npm packages ship the same file at the package root.
return path.join(
__dirname,
launcherDir,
"..",
"..",
"..",
Expand Down
4 changes: 4 additions & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "0.0.0-dev",
"private": false,
"description": "OneQuery CLI",
"homepage": "https://onequery.dev",
"bugs": {
"url": "https://github.com/wordbricks/onequery/issues"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/scripts/build-npm-package.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function tarballNameForPackage(
version: string
): string;

export const __internal: {
export const buildNpmPackageInternals: {
indexWorkspacePackageManifestPaths(
workspacePackageManifests: Array<{
name: string;
Expand Down
11 changes: 7 additions & 4 deletions apps/cli/scripts/build-npm-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ import {
binaryNameForTargetTriple,
} from "../bin/package-constants.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const scriptFilePath = fileURLToPath(import.meta.url);
const scriptDir = path.dirname(scriptFilePath);

const CLI_ROOT = path.resolve(__dirname, "..");
const CLI_ROOT = path.resolve(scriptDir, "..");
const WORKSPACE_ROOT = path.resolve(CLI_ROOT, "..", "..");
const WORKSPACE_MANIFEST_PATH = path.join(WORKSPACE_ROOT, "package.json");
const workspacePackageRequireCache = new Map();
Expand Down Expand Up @@ -331,8 +331,10 @@ function createReleasePlatformPackageManifest(
) {
const stagedPlatformPackage = {
cpu: [platformPackage.cpu],
bugs: packageJson.bugs,
description: packageJson.description,
files: ["vendor", "README.md"],
homepage: packageJson.homepage,
license: packageJson.license,
name: CLI_PACKAGE_NAME,
os: [platformPackage.os],
Expand Down Expand Up @@ -663,8 +665,9 @@ function indexWorkspacePackageManifestPaths(workspacePackageManifests) {
return workspacePackageManifestPathIndex;
}

export const __internal = {
export const buildNpmPackageInternals = {
INSTALL_BUNDLE_PACKAGES,
createReleasePlatformPackageManifest,
indexWorkspacePackageManifestPaths,
readCliPackageJson,
restorePackagedExecutableModes,
Expand Down
21 changes: 13 additions & 8 deletions apps/cli/scripts/build-npm-package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";

import { __internal, tarballNameForPackage } from "./build-npm-package.js";
import {
buildNpmPackageInternals,
tarballNameForPackage,
} from "./build-npm-package.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const WORKSPACE_ROOT = path.resolve(__dirname, "..", "..", "..");
const testFilePath = fileURLToPath(import.meta.url);
const testDir = path.dirname(testFilePath);
const WORKSPACE_ROOT = path.resolve(testDir, "..", "..", "..");
const SERVER_PACKAGE_MANIFEST_PATH = path.join(
WORKSPACE_ROOT,
"packages",
Expand All @@ -28,7 +31,9 @@ describe("build-npm-package runtime asset resolution", () => {

it("anchors polyglotSql assets to the declared owner package manifest", async () => {
const sourcePaths =
await __internal.resolveRuntimeAssetSourcePaths("polyglotSql");
await buildNpmPackageInternals.resolveRuntimeAssetSourcePaths(
"polyglotSql"
);
const serverRequire = createRequire(SERVER_PACKAGE_MANIFEST_PATH);

expect(sourcePaths).toEqual([
Expand All @@ -44,7 +49,7 @@ describe("build-npm-package runtime asset resolution", () => {

it("fails clearly when a workspace package is missing", async () => {
try {
await __internal.resolveWorkspacePackageRequire(
await buildNpmPackageInternals.resolveWorkspacePackageRequire(
"@onequery/not-a-package"
);
throw new Error("expected missing workspace package lookup to fail");
Expand All @@ -61,7 +66,7 @@ describe("build-npm-package runtime asset resolution", () => {

it("rejects duplicate workspace package names when indexing manifests", () => {
expect(() =>
__internal.indexWorkspacePackageManifestPaths([
buildNpmPackageInternals.indexWorkspacePackageManifestPaths([
{
name: "@onequery/server",
packageJsonPath: "/tmp/workspace-a/package.json",
Expand Down Expand Up @@ -95,7 +100,7 @@ describe("build-npm-package runtime asset resolution", () => {
})
);

await __internal.restorePackagedExecutableModes({
await buildNpmPackageInternals.restorePackagedExecutableModes({
targetRoot,
targetTriple: "x86_64-unknown-linux-musl",
});
Expand Down
6 changes: 3 additions & 3 deletions apps/cli/scripts/build-server-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { build } from "rolldown";

import { serverBundleFilenameForTargetTriple } from "../bin/package-constants.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const scriptFilePath = fileURLToPath(import.meta.url);
const scriptDir = path.dirname(scriptFilePath);
const require = createRequire(import.meta.url);

const CLI_ROOT = path.resolve(__dirname, "..");
const CLI_ROOT = path.resolve(scriptDir, "..");
const WORKSPACE_ROOT = path.resolve(CLI_ROOT, "..", "..");
// Comment: resolve the packaged server entry through the runtime package's
// declared export surface so CLI packaging does not depend on package-private
Expand Down
10 changes: 5 additions & 5 deletions apps/cli/scripts/generate-homebrew-formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";

const SHA256_PATTERN = /^[a-f0-9]{64}$/i;
const SHA256_PATTERN = /^[a-f0-9]{64}$/iu;
const GENERATE_HOMEBREW_FORMULA_OPTIONS = new Set([
"--version",
"--repo-owner",
Expand Down Expand Up @@ -47,7 +47,7 @@ const PLATFORM_RELEASES = [
];

function versionedReleaseAssetName(assetName, version) {
return assetName.replace(/\.tgz$/, `-${version}.tgz`);
return assetName.replace(/\.tgz$/u, `-${version}.tgz`);
}

function readOptionValue(argv, index, optionName) {
Expand Down Expand Up @@ -266,7 +266,7 @@ export function buildFormula({
"",
"class Onequery < Formula",
' desc "CLI for querying and self-hosting OneQuery"',
` homepage "https://github.com/${repoOwner}/${repoName}"`,
' homepage "https://onequery.dev"',
' license "Apache-2.0"',
` version "${version}"`,
"",
Expand Down Expand Up @@ -326,9 +326,9 @@ export async function writeFormula({ outputPath, formulaText }) {
await writeFile(outputPath, formulaText, "utf8");
}

const __filename = fileURLToPath(import.meta.url);
const currentFilePath = fileURLToPath(import.meta.url);

if (process.argv[1] && path.resolve(process.argv[1]) === __filename) {
if (process.argv[1] && path.resolve(process.argv[1]) === currentFilePath) {
const args = parseArgs(process.argv.slice(2));
const formulaText = buildFormula(args);
await writeFormula({
Expand Down
6 changes: 3 additions & 3 deletions apps/cli/scripts/self-host-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import {
} from "../bin/package-constants.js";
import { stagePackagedRuntime } from "./build-npm-package.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const scriptFilePath = fileURLToPath(import.meta.url);
const scriptDir = dirname(scriptFilePath);

export const cliRootDir = resolve(__dirname, "..");
export const cliRootDir = resolve(scriptDir, "..");
const workspaceRootDir = resolve(cliRootDir, "..", "..");
const cliManifestPath = join(cliRootDir, "Cargo.toml");
const cliBinaryName = binaryNameForPlatform(process.platform, "onequery");
Expand Down
14 changes: 12 additions & 2 deletions apps/landing/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
const BUNDLE_REPORT_TEMPLATES = ["markdown", "list", "raw-data"] as const;
const BUNDLE_REPORT_TEMPLATE_SET = new Set<string>(BUNDLE_REPORT_TEMPLATES);
const REPOSITORY_ROOT = fileURLToPath(new URL("../../", import.meta.url));
const SITE_URL = "https://onequery.dev";

type BundleReportTemplate = (typeof BUNDLE_REPORT_TEMPLATES)[number];

Expand Down Expand Up @@ -93,6 +94,12 @@ export default defineConfig({
}),
},
},
experimental: {
queuedRendering: {
enabled: true,
},
rustCompiler: true,
},
integrations: [
partytown({
config: {
Expand Down Expand Up @@ -162,7 +169,10 @@ export default defineConfig({
title: "OneQuery Docs",
}),
mdx(),
sitemap(),
sitemap({
changefreq: "daily",
priority: 0.7,
}),
agentMarkdown({
content: [
{
Expand All @@ -179,7 +189,7 @@ export default defineConfig({
host: DEV_SERVER_HOST,
port: DEFAULT_DEV_PORT,
},
site: "https://onequery.dev",
site: SITE_URL,
// Cloudflare normalizes extensionless page URLs with trailing slashes in
// production, so keep Astro's generated route shape aligned with the edge.
trailingSlash: "always",
Expand Down
37 changes: 37 additions & 0 deletions apps/landing/docs/local-slack-emulator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Local Slack Emulator

The landing app sends lead-capture notifications through
`LANDING_SLACK_WEBHOOK_URL`. `bun run dev` starts the Slack emulator when that
environment variable is unset, then injects the emulator webhook URL into Astro.

Start local development with:

```bash
rtk bun run dev
```

Submit the product updates form or the contact form in the local landing page,
then inspect the stored Slack messages at the URL printed by the dev server.
The default inspector URL is:

```text
http://localhost:4003/
```

If port 4003 is already in use, `bun run dev` picks another available port and
prints that inspector URL instead.

The default emulator webhook posts to the emulator's `general` channel:

```text
http://localhost:4003/services/T000000001/B000000001/X000000001
```

If `LANDING_SLACK_WEBHOOK_URL` is already configured, `bun run dev` uses that
value and does not start the emulator.

You can still run only the emulator with:

```bash
rtk bun run slack:emulate
```
Loading