vite-plus 0.1.13-alpha.3 → 0.1.13-alpha.5
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.
- package/dist/config/bin.js +17 -16
- package/dist/global/agent-gbykY0o2.js +4608 -0
- package/dist/global/{browser-CBapUTD0.js → browser-09BZLUYM.js} +1 -1
- package/dist/global/{browser-EZnNDcaO.js → browser-C-E79Nt0.js} +1 -1
- package/dist/global/{chunk-CgnkrU7a.js → chunk-BoAXSpZd.js} +1 -7
- package/dist/global/{cli-truncate-Da6Y8aM8.js → cli-truncate-BmIULUG7.js} +2 -2
- package/dist/global/config.js +15 -241
- package/dist/global/create.js +10 -8
- package/dist/global/{log-update-C8WCYCbc.js → log-update-Beldo2tV.js} +3 -3
- package/dist/global/migrate.js +6 -7
- package/dist/global/package-D0VpX-8d.js +934 -0
- package/dist/global/{slice-ansi-Fap0ehe9.js → slice-ansi-1i6Zdm-R.js} +1 -1
- package/dist/global/staged.js +307 -1749
- package/dist/global/version.js +2 -3
- package/dist/global/{workspace-De-IM1Br.js → workspace-BUJYxGAP.js} +9 -2600
- package/dist/global/{wrap-ansi-eywLlPVQ.js → wrap-ansi-CnYUWev2.js} +1 -1
- package/dist/global/wrap-ansi-DAqB-SZm.js +3 -0
- package/dist/migration/detector.d.ts +14 -0
- package/dist/migration/detector.js +158 -0
- package/dist/migration/migrator.d.ts +101 -0
- package/dist/migration/migrator.js +1526 -0
- package/dist/migration/report.d.ts +21 -0
- package/dist/migration/report.js +29 -0
- package/dist/pack-bin.js +42 -1
- package/dist/pack.d.ts +1 -2
- package/dist/pack.js +1 -1
- package/dist/resolve-vite.d.ts +1 -1
- package/dist/resolve-vite.js +1 -1
- package/dist/utils/agent.d.ts +12 -0
- package/dist/utils/agent.js +32 -0
- package/dist/utils/editor.js +1 -1
- package/dist/utils/json.d.ts +1 -1
- package/dist/utils/json.js +4 -2
- package/package.json +13 -12
- package/dist/config/agent.d.ts +0 -9
- package/dist/config/agent.js +0 -157
- package/dist/global/agent-CyKninQe.js +0 -2157
- package/dist/global/json-Cb66925x.js +0 -149
- package/dist/global/package-C5aXF8Gs.js +0 -40
- package/dist/global/wrap-ansi-Ou9oAs-a.js +0 -3
- /package/dist/global/{help-CbTzUdXc.js → help-HviKaKAU.js} +0 -0
- /package/dist/global/{src-B-pcmd0F.js → src-FkMgH-SM.js} +0 -0
- /package/dist/global/{strip-ansi-CE-VDMdw.js → strip-ansi-DbamwI77.js} +0 -0
package/dist/config/bin.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// Unified `vp config` command —
|
|
2
|
-
// `vp init` (agent integration) into a single entry point.
|
|
1
|
+
// Unified `vp config` command — hooks setup + agent instruction updates.
|
|
3
2
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// Hooks: interactive mode prompts on first run; non-interactive installs by default.
|
|
4
|
+
// Agent instructions: silently updates existing files with Vite+ markers.
|
|
5
|
+
// Never creates new agent files. Same behavior for prepare and manual runs.
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
7
|
import { join } from 'node:path';
|
|
8
8
|
import mri from 'mri';
|
|
9
9
|
import { vitePlusHeader } from '../../binding/index.js';
|
|
10
|
+
import { ensurePreCommitHook } from '../migration/migrator.js';
|
|
11
|
+
import { updateExistingAgentInstructions } from '../utils/agent.js';
|
|
10
12
|
import { renderCliDoc } from '../utils/help.js';
|
|
11
13
|
import { defaultInteractive, promptGitHooks } from '../utils/prompts.js';
|
|
12
|
-
import { linkSkillsForSpecificAgents } from '../utils/skills.js';
|
|
13
14
|
import { log } from '../utils/terminal.js';
|
|
14
|
-
import { resolveAgentSetup, hasExistingAgentInstructions, injectAgentBlock, setupMcpConfig, } from './agent.js';
|
|
15
15
|
import { install } from './hooks.js';
|
|
16
16
|
async function main() {
|
|
17
17
|
const args = mri(process.argv.slice(3), {
|
|
@@ -48,13 +48,15 @@ async function main() {
|
|
|
48
48
|
const dir = args['hooks-dir'];
|
|
49
49
|
const hooksOnly = args['hooks-only'];
|
|
50
50
|
const interactive = defaultInteractive();
|
|
51
|
+
const isPrepareScript = process.env.npm_lifecycle_event === 'prepare';
|
|
51
52
|
const root = process.cwd();
|
|
52
53
|
// --- Step 1: Hooks setup ---
|
|
53
54
|
const hooksDir = dir ?? '.vite-hooks';
|
|
54
55
|
const isFirstHooksRun = !existsSync(join(root, hooksDir, '_', 'pre-commit'));
|
|
55
56
|
let shouldSetupHooks = true;
|
|
56
|
-
if (interactive && isFirstHooksRun && !dir) {
|
|
57
|
+
if (interactive && isFirstHooksRun && !dir && !isPrepareScript) {
|
|
57
58
|
// --hooks-dir implies agreement; only prompt when using default dir on first run
|
|
59
|
+
// prepare script implies the project opted into hooks — install automatically
|
|
58
60
|
shouldSetupHooks = await promptGitHooks({ interactive });
|
|
59
61
|
}
|
|
60
62
|
if (shouldSetupHooks) {
|
|
@@ -65,16 +67,15 @@ async function main() {
|
|
|
65
67
|
process.exit(1);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const agentSetup = await resolveAgentSetup(root, interactive && isFirstAgentRun);
|
|
73
|
-
injectAgentBlock(root, agentSetup.instructionFilePath);
|
|
74
|
-
setupMcpConfig(root, agentSetup.agents);
|
|
75
|
-
if (agentSetup.agents.length > 0) {
|
|
76
|
-
linkSkillsForSpecificAgents(root, agentSetup.agents);
|
|
70
|
+
// Only create pre-commit hook when install() succeeded (empty message).
|
|
71
|
+
// Skip when hooks were disabled or git is unavailable.
|
|
72
|
+
if (!message) {
|
|
73
|
+
ensurePreCommitHook(root, hooksDir);
|
|
77
74
|
}
|
|
78
75
|
}
|
|
76
|
+
// --- Step 2: Update agent instructions if Vite+ header exists and is outdated ---
|
|
77
|
+
if (!hooksOnly) {
|
|
78
|
+
updateExistingAgentInstructions(root);
|
|
79
|
+
}
|
|
79
80
|
}
|
|
80
81
|
void main();
|