vite-plus 0.1.1 → 0.1.3

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.
Files changed (43) hide show
  1. package/binding/index.cjs +2 -0
  2. package/binding/index.d.cts +32 -0
  3. package/dist/global/{prompts-CAIahN1u.js → agent-BE4Xze8Q.js} +380 -1280
  4. package/dist/global/{browser-CY4NBwxR.js → browser-CBapUTD0.js} +579 -1023
  5. package/dist/global/{browser-DFpJ6sKb.js → browser-EZnNDcaO.js} +2 -3
  6. package/dist/global/{chunk-CtfvYSle.js → chunk-CgnkrU7a.js} +13 -22
  7. package/dist/global/{cli-truncate-BxinOqz5.js → cli-truncate-Da6Y8aM8.js} +25 -74
  8. package/dist/global/config.js +95 -165
  9. package/dist/global/create.js +353 -496
  10. package/dist/global/{terminal-Cb-NuRkb.js → help-BAGHa8fD.js} +22 -54
  11. package/dist/global/{json-Bfvtp2rL.js → json-BRdVJ52a.js} +24 -58
  12. package/dist/global/{lib-CibYHP32.js → lib-DxappLRQ.js} +19 -43
  13. package/dist/global/{log-update-DdU6_LCN.js → log-update-C8WCYCbc.js} +102 -281
  14. package/dist/global/mcp.js +97 -169
  15. package/dist/global/migrate.js +223 -72
  16. package/dist/global/{package-Pq2biU7_.js → package-YAMvX5PJ.js} +6 -13
  17. package/dist/global/{slice-ansi-BhwAwMdF.js → slice-ansi-Fap0ehe9.js} +21 -52
  18. package/dist/global/{src-C6aLHRsS.js → src-DwSJ0s0I.js} +28 -110
  19. package/dist/global/staged.js +654 -1521
  20. package/dist/global/{strip-ansi-BL-dgd7n.js → strip-ansi-CE-VDMdw.js} +20 -67
  21. package/dist/global/version.js +16 -37
  22. package/dist/global/{workspace-De4OKHV7.js → workspace-lRm8huz4.js} +1645 -2806
  23. package/dist/global/wrap-ansi-Ou9oAs-a.js +3 -0
  24. package/dist/global/{wrap-ansi-Iww6Ak1s.js → wrap-ansi-eywLlPVQ.js} +29 -80
  25. package/dist/index.d.ts +1 -1
  26. package/dist/init-config.js +10 -2
  27. package/dist/run-config.d.ts +17 -0
  28. package/dist/utils/agent.d.ts +15 -1
  29. package/dist/utils/agent.js +104 -20
  30. package/dist/utils/constants.d.ts +1 -0
  31. package/dist/utils/constants.js +2 -0
  32. package/dist/utils/editor.d.ts +16 -3
  33. package/dist/utils/editor.js +55 -17
  34. package/dist/utils/prompts.d.ts +32 -3
  35. package/dist/utils/prompts.js +32 -8
  36. package/dist/utils/skills.js +18 -2
  37. package/dist/utils/tsconfig.d.ts +6 -0
  38. package/dist/utils/tsconfig.js +16 -0
  39. package/package.json +13 -13
  40. package/templates/monorepo/package.json +1 -1
  41. package/dist/global/wrap-ansi-BJxjUEQR.js +0 -4
  42. package/dist/oxlint-config.d.ts +0 -498
  43. package/dist/oxlint-config.js +0 -309
@@ -12,7 +12,6 @@ const VSCODE_SETTINGS = {
12
12
  'editor.codeActionsOnSave': {
13
13
  'source.fixAll.oxc': 'explicit',
14
14
  },
15
- 'oxc.typeAware': true,
16
15
  };
17
16
  const VSCODE_EXTENSIONS = {
18
17
  recommendations: ['oxc.oxc-vscode'],
@@ -76,7 +75,31 @@ export function detectExistingEditor(projectRoot) {
76
75
  }
77
76
  return undefined;
78
77
  }
79
- export async function writeEditorConfigs({ projectRoot, editorId, interactive, }) {
78
+ /**
79
+ * Detect editor config files that would conflict (already exist).
80
+ * Read-only — does not write or modify any files.
81
+ */
82
+ export function detectEditorConflicts({ projectRoot, editorId, }) {
83
+ if (!editorId) {
84
+ return [];
85
+ }
86
+ const editorConfig = EDITORS.find((e) => e.id === editorId);
87
+ if (!editorConfig) {
88
+ return [];
89
+ }
90
+ const conflicts = [];
91
+ for (const fileName of Object.keys(editorConfig.files)) {
92
+ const filePath = path.join(projectRoot, editorConfig.targetDir, fileName);
93
+ if (fs.existsSync(filePath)) {
94
+ conflicts.push({
95
+ fileName,
96
+ displayPath: `${editorConfig.targetDir}/${fileName}`,
97
+ });
98
+ }
99
+ }
100
+ return conflicts;
101
+ }
102
+ export async function writeEditorConfigs({ projectRoot, editorId, interactive, conflictDecisions, silent = false, }) {
80
103
  if (!editorId) {
81
104
  return;
82
105
  }
@@ -89,9 +112,16 @@ export async function writeEditorConfigs({ projectRoot, editorId, interactive, }
89
112
  for (const [fileName, incoming] of Object.entries(editorConfig.files)) {
90
113
  const filePath = path.join(targetDir, fileName);
91
114
  if (fs.existsSync(filePath)) {
92
- if (interactive) {
115
+ const displayPath = `${editorConfig.targetDir}/${fileName}`;
116
+ // Determine conflict action from pre-resolved decisions, interactive prompt, or default
117
+ let conflictAction;
118
+ const preResolved = conflictDecisions?.get(fileName);
119
+ if (preResolved) {
120
+ conflictAction = preResolved;
121
+ }
122
+ else if (interactive) {
93
123
  const action = await prompts.select({
94
- message: `${editorConfig.targetDir}/${fileName} already exists.`,
124
+ message: `${displayPath} already exists.`,
95
125
  options: [
96
126
  {
97
127
  label: 'Merge',
@@ -106,26 +136,34 @@ export async function writeEditorConfigs({ projectRoot, editorId, interactive, }
106
136
  ],
107
137
  initialValue: 'skip',
108
138
  });
109
- if (prompts.isCancel(action) || action === 'skip') {
110
- prompts.log.info(`Skipped writing ${editorConfig.targetDir}/${fileName}`);
111
- continue;
112
- }
113
- const existing = readJsonFile(filePath);
114
- const merged = mergeEditorConfigs(existing, incoming, fileName);
115
- writeJsonFile(filePath, merged);
116
- prompts.log.success(`Merged editor config into ${editorConfig.targetDir}/${fileName}`);
139
+ conflictAction = prompts.isCancel(action) || action === 'skip' ? 'skip' : 'merge';
117
140
  }
118
141
  else {
119
142
  // Non-interactive: always merge (safe because existing keys are never overwritten)
120
- const existing = readJsonFile(filePath);
121
- const merged = mergeEditorConfigs(existing, incoming, fileName);
122
- writeJsonFile(filePath, merged);
123
- prompts.log.success(`Merged editor config into ${editorConfig.targetDir}/${fileName}`);
143
+ conflictAction = 'merge';
144
+ }
145
+ if (conflictAction === 'merge') {
146
+ mergeAndWriteEditorConfig(filePath, incoming, fileName, displayPath, silent);
147
+ }
148
+ else {
149
+ if (!silent) {
150
+ prompts.log.info(`Skipped writing ${displayPath}`);
151
+ }
124
152
  }
125
153
  continue;
126
154
  }
127
155
  writeJsonFile(filePath, incoming);
128
- prompts.log.success(`Wrote editor config to ${editorConfig.targetDir}/${fileName}`);
156
+ if (!silent) {
157
+ prompts.log.success(`Wrote editor config to ${editorConfig.targetDir}/${fileName}`);
158
+ }
159
+ }
160
+ }
161
+ function mergeAndWriteEditorConfig(filePath, incoming, fileName, displayPath, silent = false) {
162
+ const existing = readJsonFile(filePath);
163
+ const merged = mergeEditorConfigs(existing, incoming, fileName);
164
+ writeJsonFile(filePath, merged);
165
+ if (!silent) {
166
+ prompts.log.success(`Merged editor config into ${displayPath}`);
129
167
  }
130
168
  }
131
169
  function mergeEditorConfigs(existing, incoming, fileName) {
@@ -1,10 +1,39 @@
1
1
  import * as prompts from '@voidzero-dev/vite-plus-prompts';
2
2
  import { PackageManager } from '../types/index.js';
3
+ export interface CommandRunSummary {
4
+ durationMs: number;
5
+ exitCode?: number;
6
+ status: 'installed' | 'formatted' | 'failed' | 'skipped';
7
+ }
3
8
  export declare function cancelAndExit(message?: string, exitCode?: number): never;
4
- export declare function selectPackageManager(interactive?: boolean): Promise<"pnpm" | "npm" | "yarn">;
9
+ export declare function selectPackageManager(interactive?: boolean, silent?: boolean): Promise<"pnpm" | "npm" | "yarn">;
5
10
  export declare function downloadPackageManager(packageManager: PackageManager, version: string, interactive?: boolean, silent?: boolean): Promise<import("../../binding/index.cjs").DownloadPackageManagerResult>;
6
- export declare function runViteInstall(cwd: string, interactive?: boolean, extraArgs?: string[]): Promise<void>;
7
- export declare function runViteFmt(cwd: string, interactive?: boolean, paths?: string[]): Promise<void>;
11
+ export declare function runViteInstall(cwd: string, interactive?: boolean, extraArgs?: string[], options?: {
12
+ silent?: boolean;
13
+ }): Promise<{
14
+ durationMs: number;
15
+ status: "skipped";
16
+ exitCode?: undefined;
17
+ } | {
18
+ durationMs: number;
19
+ exitCode: number;
20
+ status: "installed";
21
+ } | {
22
+ durationMs: number;
23
+ exitCode: number;
24
+ status: "failed";
25
+ }>;
26
+ export declare function runViteFmt(cwd: string, interactive?: boolean, paths?: string[], options?: {
27
+ silent?: boolean;
28
+ }): Promise<{
29
+ durationMs: number;
30
+ exitCode: number;
31
+ status: "formatted";
32
+ } | {
33
+ durationMs: number;
34
+ exitCode: number;
35
+ status: "failed";
36
+ }>;
8
37
  export declare function upgradeYarn(cwd: string, interactive?: boolean): Promise<void>;
9
38
  export declare function promptGitHooks(options: {
10
39
  hooks?: boolean;
@@ -8,7 +8,7 @@ export function cancelAndExit(message = 'Operation cancelled', exitCode = 0) {
8
8
  prompts.cancel(message);
9
9
  process.exit(exitCode);
10
10
  }
11
- export async function selectPackageManager(interactive) {
11
+ export async function selectPackageManager(interactive, silent = false) {
12
12
  if (interactive) {
13
13
  const selected = await prompts.select({
14
14
  message: 'Which package manager would you like to use?',
@@ -26,7 +26,9 @@ export async function selectPackageManager(interactive) {
26
26
  }
27
27
  else {
28
28
  // --no-interactive: use pnpm as default
29
- prompts.log.info(`Using default package manager: ${accent(PackageManager.pnpm)}`);
29
+ if (!silent) {
30
+ prompts.log.info(`Using default package manager: ${accent(PackageManager.pnpm)}`);
31
+ }
30
32
  return PackageManager.pnpm;
31
33
  }
32
34
  }
@@ -40,12 +42,13 @@ export async function downloadPackageManager(packageManager, version, interactiv
40
42
  spinner.stop(`${packageManager}@${downloadResult.version} installed`);
41
43
  return downloadResult;
42
44
  }
43
- export async function runViteInstall(cwd, interactive, extraArgs) {
45
+ export async function runViteInstall(cwd, interactive, extraArgs, options) {
44
46
  // install dependencies on non-CI environment
45
- if (process.env.CI) {
46
- return;
47
+ if (process.env.VITE_PLUS_SKIP_INSTALL) {
48
+ return { durationMs: 0, status: 'skipped' };
47
49
  }
48
- const spinner = getSpinner(interactive);
50
+ const spinner = options?.silent ? getSilentSpinner() : getSpinner(interactive);
51
+ const startTime = Date.now();
49
52
  spinner.start(`Installing dependencies...`);
50
53
  const { exitCode, stderr, stdout } = await runCommandSilently({
51
54
  command: process.env.VITE_PLUS_CLI_BIN ?? 'vp',
@@ -55,16 +58,27 @@ export async function runViteInstall(cwd, interactive, extraArgs) {
55
58
  });
56
59
  if (exitCode === 0) {
57
60
  spinner.stop(`Dependencies installed`);
61
+ return {
62
+ durationMs: Date.now() - startTime,
63
+ exitCode,
64
+ status: 'installed',
65
+ };
58
66
  }
59
67
  else {
60
68
  spinner.stop(`Install failed`);
61
69
  prompts.log.info(stdout.toString());
62
70
  prompts.log.error(stderr.toString());
63
71
  prompts.log.info(`You may need to run "vp install" manually in ${cwd}`);
72
+ return {
73
+ durationMs: Date.now() - startTime,
74
+ exitCode,
75
+ status: 'failed',
76
+ };
64
77
  }
65
78
  }
66
- export async function runViteFmt(cwd, interactive, paths) {
67
- const spinner = getSpinner(interactive);
79
+ export async function runViteFmt(cwd, interactive, paths, options) {
80
+ const spinner = options?.silent ? getSilentSpinner() : getSpinner(interactive);
81
+ const startTime = Date.now();
68
82
  spinner.start(`Formatting code...`);
69
83
  const { binPath, envs } = await resolveFmt();
70
84
  const { exitCode, stderr, stdout } = await runCommandSilently({
@@ -78,6 +92,11 @@ export async function runViteFmt(cwd, interactive, paths) {
78
92
  });
79
93
  if (exitCode === 0) {
80
94
  spinner.stop(`Code formatted`);
95
+ return {
96
+ durationMs: Date.now() - startTime,
97
+ exitCode,
98
+ status: 'formatted',
99
+ };
81
100
  }
82
101
  else {
83
102
  spinner.stop(`Format failed`);
@@ -85,6 +104,11 @@ export async function runViteFmt(cwd, interactive, paths) {
85
104
  prompts.log.error(stderr.toString());
86
105
  const relativePaths = (paths ?? []).length > 0 ? ` ${(paths ?? []).join(' ')}` : '';
87
106
  prompts.log.info(`You may need to run "vp fmt --write${relativePaths}" manually in ${cwd}`);
107
+ return {
108
+ durationMs: Date.now() - startTime,
109
+ exitCode,
110
+ status: 'failed',
111
+ };
88
112
  }
89
113
  }
90
114
  export async function upgradeYarn(cwd, interactive) {
@@ -1,7 +1,8 @@
1
- import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, } from 'node:fs';
1
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, symlinkSync, } from 'node:fs';
2
2
  import { join, relative } from 'node:path';
3
3
  import * as prompts from '@voidzero-dev/vite-plus-prompts';
4
4
  import {} from './agent.js';
5
+ import { VITE_PLUS_NAME } from './constants.js';
5
6
  import { pkgRoot } from './path.js';
6
7
  export function parseSkills(skillsDir) {
7
8
  if (!existsSync(skillsDir)) {
@@ -82,8 +83,23 @@ function linkSkills(root, skillsDir, skills, agentSkillsDir) {
82
83
  }
83
84
  return linked;
84
85
  }
86
+ function getStableSkillsDir(root) {
87
+ const resolvedSkillsDir = join(pkgRoot, 'skills');
88
+ // Prefer the logical node_modules path for a cleaner, stable symlink
89
+ // (avoids pnpm's versioned .pnpm/pkg@version/... real path)
90
+ const logicalSkillsDir = join(root, 'node_modules', VITE_PLUS_NAME, 'skills');
91
+ try {
92
+ if (realpathSync(logicalSkillsDir) === realpathSync(resolvedSkillsDir)) {
93
+ return logicalSkillsDir;
94
+ }
95
+ }
96
+ catch {
97
+ // Fall through to resolved path
98
+ }
99
+ return resolvedSkillsDir;
100
+ }
85
101
  export function linkSkillsForSpecificAgents(root, agentConfigs) {
86
- const skillsDir = join(pkgRoot, 'skills');
102
+ const skillsDir = getStableSkillsDir(root);
87
103
  const skills = parseSkills(skillsDir);
88
104
  if (skills.length === 0) {
89
105
  return 0;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Check if tsconfig.json has compilerOptions.baseUrl set.
3
+ * oxlint's TypeScript checker (tsgolint) does not support baseUrl,
4
+ * so typeAware/typeCheck must be disabled when it is present.
5
+ */
6
+ export declare function hasBaseUrlInTsconfig(projectPath: string): boolean;
@@ -0,0 +1,16 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ /**
4
+ * Check if tsconfig.json has compilerOptions.baseUrl set.
5
+ * oxlint's TypeScript checker (tsgolint) does not support baseUrl,
6
+ * so typeAware/typeCheck must be disabled when it is present.
7
+ */
8
+ export function hasBaseUrlInTsconfig(projectPath) {
9
+ try {
10
+ const tsconfig = JSON.parse(fs.readFileSync(path.join(projectPath, 'tsconfig.json'), 'utf-8'));
11
+ return tsconfig?.compilerOptions?.baseUrl !== undefined;
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "oxfmt": "./bin/oxfmt",
@@ -299,10 +299,10 @@
299
299
  "cross-spawn": "^7.0.5",
300
300
  "oxfmt": "^0.36.0",
301
301
  "oxlint": "^1.51.0",
302
- "oxlint-tsgolint": "^0.15.0",
302
+ "oxlint-tsgolint": "^0.16.0",
303
303
  "picocolors": "^1.1.1",
304
- "@voidzero-dev/vite-plus-core": "0.1.1",
305
- "@voidzero-dev/vite-plus-test": "0.1.1"
304
+ "@voidzero-dev/vite-plus-test": "0.1.3",
305
+ "@voidzero-dev/vite-plus-core": "0.1.3"
306
306
  },
307
307
  "devDependencies": {
308
308
  "@napi-rs/cli": "^3.4.1",
@@ -320,12 +320,12 @@
320
320
  "mri": "^1.2.0",
321
321
  "rolldown-plugin-dts": "^0.22.0",
322
322
  "semver": "^7.7.3",
323
- "tsdown": "^0.21.0-beta.2",
323
+ "tsdown": "^0.21.0",
324
324
  "validate-npm-package-name": "^7.0.2",
325
325
  "yaml": "^2.8.1",
326
326
  "@voidzero-dev/vite-plus-prompts": "0.0.0",
327
- "rolldown": "1.0.0-rc.6",
328
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.1"
327
+ "rolldown": "1.0.0-rc.7",
328
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.3"
329
329
  },
330
330
  "napi": {
331
331
  "binaryName": "vite-plus",
@@ -343,12 +343,12 @@
343
343
  "node": "^20.19.0 || >=22.12.0"
344
344
  },
345
345
  "optionalDependencies": {
346
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.1",
347
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.1",
348
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.1",
349
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.1",
350
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.1",
351
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.1"
346
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.3",
347
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.3",
348
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.3",
349
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.3",
350
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.3",
351
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.3"
352
352
  },
353
353
  "scripts": {
354
354
  "build": "oxnode -C dev ./build.ts",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "type": "module",
11
11
  "scripts": {
12
- "ready": "vp fmt && vp lint --type-aware && vp run test -r && vp run build -r",
12
+ "ready": "vp fmt && vp lint && vp run test -r && vp run build -r",
13
13
  "dev": "vp run website#dev"
14
14
  },
15
15
  "engines": {
@@ -1,4 +0,0 @@
1
- import "./strip-ansi-BL-dgd7n.js";
2
- import { t as wrapAnsi } from "./wrap-ansi-Iww6Ak1s.js";
3
-
4
- export { wrapAnsi as default };