From 25b87e772a1d54f2f73b94f50a83f0a8856d4f73 Mon Sep 17 00:00:00 2001 From: Farhan Yahaya Date: Tue, 24 Mar 2026 16:11:37 +0000 Subject: [PATCH 1/4] chore: update default repo-dir --- packages/cli/src/constants.ts | 6 +++++- packages/cli/src/options.ts | 12 ------------ packages/engine-multi/src/api.ts | 5 +++-- packages/runtime/src/modules/repo.ts | 4 +++- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index 7c7ffa98f..cd1a39930 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -1 +1,5 @@ -export const DEFAULT_REPO_DIR = '/tmp/openfn/repo'; +import * as os from 'node:os'; +import * as path from 'node:path'; +const homeDir = os.homedir(); + +export const DEFAULT_REPO_DIR = path.join(homeDir, '/.openfn/repo'); diff --git a/packages/cli/src/options.ts b/packages/cli/src/options.ts index 4f214c02f..a9b890038 100644 --- a/packages/cli/src/options.ts +++ b/packages/cli/src/options.ts @@ -492,18 +492,6 @@ export const repoDir: CLIOption = { description: 'Provide a path to the repo root dir', default: process.env.OPENFN_REPO_DIR || DEFAULT_REPO_DIR, }), - ensure: (opts) => { - if (opts.repoDir === DEFAULT_REPO_DIR) { - // Note that we don't use the logger here - it's not been created yet - console.warn( - 'WARNING: no repo module dir found! Using the default (/tmp/repo)' - ); - console.warn( - 'You should set OPENFN_REPO_DIR or pass --repoDir=some/path in to the CLI' - ); - console.log(); - } - }, }; export const start: CLIOption = { diff --git a/packages/engine-multi/src/api.ts b/packages/engine-multi/src/api.ts index ef537832f..367aa92c3 100644 --- a/packages/engine-multi/src/api.ts +++ b/packages/engine-multi/src/api.ts @@ -1,6 +1,8 @@ // Creates the public/external API to the runtime // Basically a thin wrapper, with validation, around the engine +import path from 'node:path'; +import os from 'node:os'; import createLogger from '@openfn/logger'; import whitelist from './whitelist'; @@ -23,7 +25,7 @@ export type LazyResolvers = { export type APIOptions = Partial>; -const DEFAULT_REPO_DIR = '/tmp/openfn/worker/repo'; +const DEFAULT_REPO_DIR = path.join(os.homedir(), '.openfn/repo'); const DEFAULT_MEMORY_LIMIT = 500; @@ -38,7 +40,6 @@ const createAPI = async function ( if (!repoDir) { repoDir = DEFAULT_REPO_DIR; - logger.warn('Using default repo directory: ', DEFAULT_REPO_DIR); } logger.info('repoDir set to ', repoDir); diff --git a/packages/runtime/src/modules/repo.ts b/packages/runtime/src/modules/repo.ts index d2c2d0ecd..7eab83f26 100644 --- a/packages/runtime/src/modules/repo.ts +++ b/packages/runtime/src/modules/repo.ts @@ -2,6 +2,8 @@ import path from 'node:path'; import { readFile, writeFile, mkdir } from 'node:fs/promises'; import { defaultLogger, Logger } from '@openfn/logger'; import exec from '../util/exec'; +import * as os from 'node:os'; +const homeDir = os.homedir(); const defaultPkg = { name: 'openfn-repo', @@ -12,7 +14,7 @@ const defaultPkg = { dependencies: {}, }; -export const defaultRepoPath = '/tmp/openfn/repo'; +export const defaultRepoPath = path.join(homeDir, '/.openfn/repo'); type InstallList = Array<{ name: string; version: string }>; From b578d4f6d995584a407177faca74960f7f03ad09 Mon Sep 17 00:00:00 2001 From: Farhan Yahaya Date: Wed, 25 Mar 2026 15:24:50 +0000 Subject: [PATCH 2/4] chore: engine multi different repo --- packages/engine-multi/src/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/engine-multi/src/api.ts b/packages/engine-multi/src/api.ts index 367aa92c3..29450b16a 100644 --- a/packages/engine-multi/src/api.ts +++ b/packages/engine-multi/src/api.ts @@ -25,7 +25,7 @@ export type LazyResolvers = { export type APIOptions = Partial>; -const DEFAULT_REPO_DIR = path.join(os.homedir(), '.openfn/repo'); +const DEFAULT_REPO_DIR = path.join(os.homedir(), '.openfn/worker/repo'); const DEFAULT_MEMORY_LIMIT = 500; From 9a44a269e7fa89c3a7530348d9751cba236f8ac8 Mon Sep 17 00:00:00 2001 From: Farhan Yahaya Date: Mon, 30 Mar 2026 08:19:09 +0000 Subject: [PATCH 3/4] chore: update changelog --- .changeset/gentle-goats-poke.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/gentle-goats-poke.md diff --git a/.changeset/gentle-goats-poke.md b/.changeset/gentle-goats-poke.md new file mode 100644 index 000000000..88a8476d1 --- /dev/null +++ b/.changeset/gentle-goats-poke.md @@ -0,0 +1,7 @@ +--- +'@openfn/engine-multi': minor +'@openfn/runtime': minor +'@openfn/cli': minor +--- + +Update default repo directory to be relative to homedir From 36de393144db3533f3fb814bc84e9ae4eb3dcee3 Mon Sep 17 00:00:00 2001 From: Farhan Yahaya Date: Mon, 30 Mar 2026 12:17:52 +0000 Subject: [PATCH 4/4] feat: update default repo path --- packages/cli/src/constants.ts | 5 ----- packages/cli/src/options.ts | 4 ++-- packages/cli/test/options/repo.test.ts | 4 ++-- packages/runtime/src/modules/repo.ts | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) delete mode 100644 packages/cli/src/constants.ts diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts deleted file mode 100644 index cd1a39930..000000000 --- a/packages/cli/src/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as os from 'node:os'; -import * as path from 'node:path'; -const homeDir = os.homedir(); - -export const DEFAULT_REPO_DIR = path.join(homeDir, '/.openfn/repo'); diff --git a/packages/cli/src/options.ts b/packages/cli/src/options.ts index a9b890038..ae8bd3f82 100644 --- a/packages/cli/src/options.ts +++ b/packages/cli/src/options.ts @@ -2,13 +2,13 @@ import nodePath from 'node:path'; import yargs from 'yargs'; import type { CommandList } from './commands'; -import { DEFAULT_REPO_DIR } from './constants'; import { expandAdaptors as doExpandAdaptors, ensureLogOpts, LogLevel, } from './util'; import { existsSync } from 'node:fs'; +import { defaultRepoPath } from '@openfn/runtime'; // Central type definition for the main options // This represents the types coming out of yargs, @@ -490,7 +490,7 @@ export const repoDir: CLIOption = { name: 'repo-dir', yargs: () => ({ description: 'Provide a path to the repo root dir', - default: process.env.OPENFN_REPO_DIR || DEFAULT_REPO_DIR, + default: process.env.OPENFN_REPO_DIR || defaultRepoPath, }), }; diff --git a/packages/cli/test/options/repo.test.ts b/packages/cli/test/options/repo.test.ts index abe51675a..bffb8deb9 100644 --- a/packages/cli/test/options/repo.test.ts +++ b/packages/cli/test/options/repo.test.ts @@ -4,7 +4,7 @@ import yargs from 'yargs'; import { repo } from '../../src/repo/command'; import type { Opts } from '../../src/options'; -import { DEFAULT_REPO_DIR } from '../../src/constants'; +import { defaultRepoPath } from '@openfn/runtime'; // Build the repo command and test the options it returns // Note that this will re-parse the command each time, so env vars will be re-calculated @@ -17,7 +17,7 @@ test('repoDir: use the built-in default if no env var', (t) => { const options = parse('repo'); - t.is(options.repoDir, DEFAULT_REPO_DIR); + t.is(options.repoDir, defaultRepoPath); process.env.OPENFN_REPO_DIR = dir; }); diff --git a/packages/runtime/src/modules/repo.ts b/packages/runtime/src/modules/repo.ts index 7eab83f26..a66ae23e9 100644 --- a/packages/runtime/src/modules/repo.ts +++ b/packages/runtime/src/modules/repo.ts @@ -14,7 +14,7 @@ const defaultPkg = { dependencies: {}, }; -export const defaultRepoPath = path.join(homeDir, '/.openfn/repo'); +export const defaultRepoPath = path.join(homeDir, './openfn/repo/cli'); type InstallList = Array<{ name: string; version: string }>;