@codapult/cli 0.7.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,11 @@ interface PluginsAddCommandOptions extends ProjectEnvOptions {
4
4
  ci?: boolean;
5
5
  }
6
6
  export declare function pluginsAddCommand(name: string, options?: PluginsAddCommandOptions): Promise<void>;
7
- export declare function pluginsRemoveCommand(name: string, options?: ProjectEnvOptions): Promise<void>;
7
+ interface PluginsRemoveCommandOptions extends ProjectEnvOptions {
8
+ /** Also remove cache in .codapult/ dir */
9
+ clean?: boolean;
10
+ }
11
+ export declare function pluginsRemoveCommand(name: string, options?: PluginsRemoveCommandOptions): Promise<void>;
8
12
  export declare function pluginsMigrateCommand(name: string | undefined, options: {
9
13
  push?: boolean;
10
14
  }): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { execSync, spawnSync } from 'node:child_process';
2
- import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
+ import { existsSync, readFileSync, readdirSync, rmSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
4
  import { findProjectRoot } from '../utils/project.js';
5
5
  import { ENV_FILE_NAME, getProjectEnvSource, } from '../utils/project-env.js';
@@ -200,9 +200,6 @@ export async function pluginsAddCommand(name, options = {}) {
200
200
  dim('Start your dev server: pnpm dev');
201
201
  console.log();
202
202
  }
203
- // ---------------------------------------------------------------------------
204
- // codapult plugins remove <name>
205
- // ---------------------------------------------------------------------------
206
203
  export async function pluginsRemoveCommand(name, options = {}) {
207
204
  const root = findProjectRoot();
208
205
  if (!root) {
@@ -275,11 +272,17 @@ export async function pluginsRemoveCommand(name, options = {}) {
275
272
  success('Environment variables removed');
276
273
  }
277
274
  }
278
- // 8. Remove dependency
275
+ // 8. Remove cache
276
+ if (options.clean && pluginDir) {
277
+ info('Removing cache...');
278
+ rmSync(pluginDir, { recursive: true, force: true });
279
+ success('Cache removed');
280
+ }
281
+ // 9. Remove dependency
279
282
  info('Removing dependency...');
280
283
  patchPackageJson(root, manifest.name, manifest.package, pluginDir, 'remove');
281
284
  success('Dependency removed');
282
- // 9. pnpm install
285
+ // 10. pnpm install
283
286
  info('Updating dependencies...');
284
287
  execQuiet('pnpm install --no-frozen-lockfile', root);
285
288
  success('Dependencies updated');
@@ -154,7 +154,12 @@ const MODULE_REMOVALS = [
154
154
  `${APP}/invite`,
155
155
  'src/app/api/auth',
156
156
  'src/lib/auth/better-auth.ts',
157
+ 'src/lib/auth/better-auth.test.ts',
157
158
  'src/lib/auth/kinde.ts',
159
+ 'src/lib/auth/kinde.test.ts',
160
+ 'src/lib/auth/better-auth-client.ts',
161
+ 'src/lib/auth/kinde-client.ts',
162
+ 'src/lib/auth/client-adapter.test.ts',
158
163
  'src/components/auth',
159
164
  'src/components/dashboard',
160
165
  'src/components/admin',
@@ -458,6 +463,7 @@ const FEATURE_ENV_VARS = {
458
463
  const PRUNE_MARKER_FILES = [
459
464
  'src/app/sitemap.ts',
460
465
  'src/lib/auth/index.ts',
466
+ 'src/lib/auth/client-adapter.ts',
461
467
  'src/lib/jobs/definitions.ts',
462
468
  'src/instrumentation.ts',
463
469
  ];
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ withNoEnvFileOption(plugins
47
47
  .description('install a plugin (local or remote)')
48
48
  .option('--from <url>', 'git URL to clone the plugin from')
49
49
  .option('--ci', 'CI/Vercel mode: skip pnpm install, db:push, env patching, and interactive prompts')).action(pluginsAddCommand);
50
- withNoEnvFileOption(plugins.command('remove <name>').description('uninstall a plugin')).action(pluginsRemoveCommand);
50
+ withNoEnvFileOption(plugins.command('remove <name>').description('uninstall a plugin').option('--clean')).action(pluginsRemoveCommand);
51
51
  plugins
52
52
  .command('migrate [name]')
53
53
  .description('update plugin schema and generate DB migration')
@@ -1,6 +1,7 @@
1
1
  export interface CloneResult {
2
2
  pluginDir: string;
3
3
  }
4
+ export declare function getCacheDir(projectRoot: string): string;
4
5
  /**
5
6
  * Derive a directory name from a git URL.
6
7
  *
package/dist/utils/git.js CHANGED
@@ -2,6 +2,9 @@ import { execSync, spawnSync } from 'node:child_process';
2
2
  import { existsSync, mkdirSync } from 'node:fs';
3
3
  import { resolve, basename } from 'node:path';
4
4
  const ALLOWED_GIT_URL = /^(https?:\/\/|git@)/;
5
+ export function getCacheDir(projectRoot) {
6
+ return resolve(projectRoot, '.codapult', 'plugins');
7
+ }
5
8
  /**
6
9
  * Derive a directory name from a git URL.
7
10
  *
@@ -25,7 +28,7 @@ export function clonePlugin(projectRoot, gitUrl) {
25
28
  throw new Error(`Invalid git URL: "${gitUrl}". Only https:// and git@ URLs are allowed.`);
26
29
  }
27
30
  const dirName = dirNameFromGitUrl(gitUrl);
28
- const cacheDir = resolve(projectRoot, '.codapult', 'plugins');
31
+ const cacheDir = getCacheDir(projectRoot);
29
32
  const pluginDir = resolve(cacheDir, dirName);
30
33
  mkdirSync(cacheDir, { recursive: true });
31
34
  if (existsSync(resolve(pluginDir, '.git'))) {
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve, join, isAbsolute, relative } from 'node:path';
3
+ import { getCacheDir } from './git.js';
3
4
  const MANIFEST_FILENAME = 'codapult-plugin.json';
4
5
  /**
5
6
  * Verifies the resolved directory stays within expected boundaries
@@ -7,7 +8,7 @@ const MANIFEST_FILENAME = 'codapult-plugin.json';
7
8
  */
8
9
  function isWithinAllowedScope(dir, projectRoot) {
9
10
  const parentDir = resolve(projectRoot, '..');
10
- const cacheDir = resolve(projectRoot, '.codapult', 'plugins');
11
+ const cacheDir = getCacheDir(projectRoot);
11
12
  const relToParent = relative(parentDir, dir);
12
13
  const relToCache = relative(cacheDir, dir);
13
14
  const isUnderParent = !relToParent.startsWith('..') && !isAbsolute(relToParent);
@@ -25,7 +26,7 @@ export function resolveManifest(projectRoot, nameOrPath) {
25
26
  }
26
27
  }
27
28
  // 2. Local cache (.codapult/plugins/codapult-plugin-<name>, ../<name>)
28
- const cacheDir = join(projectRoot, '.codapult', 'plugins');
29
+ const cacheDir = getCacheDir(projectRoot);
29
30
  candidates.push(join(cacheDir, `codapult-plugin-${nameOrPath}`), join(cacheDir, `codapult-${nameOrPath}`), join(cacheDir, nameOrPath));
30
31
  // 3. Sibling directories (../codapult-plugin-<name>, ../codapult-<name>, ../<name>)
31
32
  const parentDir = resolve(projectRoot, '..');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codapult/cli",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "description": "Codapult CLI — manage, update, and diagnose your Codapult SaaS project",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@10.33.2",