Skip to content

Commit d6ae9e5

Browse files
committed
chore(mpp-core): re-enable npm publish plugin
Update npm publish configuration with new organization and package details.
1 parent 4aada47 commit d6ae9e5

File tree

14 files changed

+104
-104
lines changed

14 files changed

+104
-104
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
1010
pluginVersion = 2.4.6
1111

1212
# MPP Unified Version (mpp-core, mpp-ui, mpp-server)
13-
mppVersion = 0.0.1
13+
mppVersion =0.0.2
1414

1515
# Supported IDEs: idea, pycharm
1616
baseIDE=idea

mpp-core/build.gradle.kts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88

99
// Temporarily disabled: npm publish plugin doesn't support wasmJs targets
1010
// TODO: Re-enable once plugin supports wasmJs or split into separate modules
11-
// id("dev.petuska.npm.publish") version "3.5.3"
11+
id("dev.petuska.npm.publish") version "3.5.3"
1212
}
1313

1414
repositories {
@@ -282,32 +282,32 @@ kotlin {
282282
}
283283
}
284284

285-
// npmPublish {
286-
// organization.set("autodev")
287-
//
288-
// packages {
289-
// named("js") {
290-
// packageJson {
291-
// name = "@autodev/mpp-core"
292-
// version = project.version.toString()
293-
// main = "autodev-mpp-core.js"
294-
// types = "autodev-mpp-core.d.ts"
295-
// description.set("AutoDev Multiplatform Core - AI Agent and DevIns Compiler")
296-
// author {
297-
// name.set("Unit Mesh")
298-
// email.set("h@phodal.com")
299-
// }
300-
// license.set("MIT")
301-
// private.set(false)
302-
// repository {
303-
// type.set("git")
304-
// url.set("https://github.com/unit-mesh/auto-dev.git")
305-
// }
306-
// keywords.set(listOf("kotlin", "multiplatform", "ai", "llm", "devins"))
307-
// }
308-
// }
309-
// }
310-
// }
285+
npmPublish {
286+
organization.set("xiuper")
287+
288+
packages {
289+
named("js") {
290+
packageJson {
291+
name = "@xiuper/mpp-core"
292+
version = project.version.toString()
293+
main = "xiuper-mpp-core.js"
294+
types = "xiuper-mpp-core.d.ts"
295+
description.set("AutoDev Xiuper Core - One Platform. All Phases. Every Device.")
296+
author {
297+
name.set("Unit Mesh")
298+
email.set("h@phodal.com")
299+
}
300+
license.set("MIT")
301+
private.set(false)
302+
repository {
303+
type.set("git")
304+
url.set("https://github.com/phodal/auto-dev.git")
305+
}
306+
keywords.set(listOf("ai4sdl", "ai", "llm", "agent"))
307+
}
308+
}
309+
}
310+
}
311311

312312
// Disable wasmJs browser tests due to webpack compatibility issues
313313
// See: https://github.com/webpack/webpack/issues/XXX

mpp-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@xiuper/cli",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "AutoDev Xiuper CLI - Terminal UI for AI-powered development assistant",
55
"type": "module",
66
"bin": {
77
"xiuper": "./dist/jsMain/typescript/index.js",
88
"autodev": "./dist/jsMain/typescript/index.js"
99
},
1010
"scripts": {
11-
"build:kotlin": "cd .. && ./gradlew :mpp-core:jsNodeProductionLibraryDistribution",
11+
"build:kotlin": "cd .. && ./gradlew :mpp-core:jsNodeProductionLibraryDistribution && cd mpp-core && node scripts/fix-package-json.js",
1212
"build:kotlin-deps": "cd ../mpp-core/build/dist/js/productionLibrary && npm install --ignore-scripts",
1313
"build:ts": "cd .. && ./gradlew :mpp-ui:compileKotlinJs && cd mpp-ui && tsc && chmod +x dist/jsMain/typescript/index.js",
1414
"build": "npm run build:kotlin && npm run build:kotlin-deps && npm run build:ts",

mpp-ui/scripts/publish-local.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@ try {
2323
console.log('1️⃣ Checking mpp-core build...');
2424
const mppCorePath = resolve(rootDir, '../mpp-core/build/packages/js/autodev-mpp-core.js');
2525
const mppCorePackageJson = resolve(rootDir, '../mpp-core/build/packages/js/package.json');
26-
26+
2727
if (!existsSync(mppCorePath) || !existsSync(mppCorePackageJson)) {
2828
console.error('❌ mpp-core not built!');
2929
console.error(' Run: npm run build:kotlin');
3030
process.exit(1);
3131
}
3232
console.log('✅ mpp-core build found\n');
33-
33+
3434
// Step 2: Verify package.json has local dependency
3535
console.log('2️⃣ Verifying package.json...');
3636
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
37-
const mppCoreDep = packageJson.dependencies['@autodev/mpp-core'];
38-
37+
const mppCoreDep = packageJson.dependencies['@xiuper/mpp-core'];
38+
3939
if (!mppCoreDep || !mppCoreDep.startsWith('file:../mpp-core/build/packages/js')) {
4040
console.error('❌ package.json should use local file: dependency');
4141
console.error(' Expected: "file:../mpp-core/build/packages/js"');
4242
console.error(' Found:', mppCoreDep);
4343
process.exit(1);
4444
}
4545
console.log('✅ Using local mpp-core dependency\n');
46-
46+
4747
// Step 3: Build TypeScript
4848
console.log('3️⃣ Building TypeScript...');
4949
execSync('npm run build:ts', { cwd: rootDir, stdio: 'inherit' });
5050
console.log('✅ TypeScript build complete\n');
51-
51+
5252
// Step 4: Run tests
5353
console.log('4️⃣ Running tests...');
5454
try {
@@ -57,19 +57,19 @@ try {
5757
} catch (error) {
5858
console.warn('⚠️ Some tests failed, continuing anyway...\n');
5959
}
60-
60+
6161
// Step 5: Create local package
6262
console.log('5️⃣ Creating local package...');
6363
execSync('npm pack', { cwd: rootDir, stdio: 'inherit' });
6464
console.log('✅ Package created\n');
65-
65+
6666
console.log('🎉 Local publish complete!\n');
6767
console.log('To install globally for testing:');
6868
console.log(' npm link');
6969
console.log(' autodev --help');
7070
console.log('\nOr install the .tgz file:');
7171
console.log(' npm install -g autodev-cli-' + packageJson.version + '.tgz');
72-
72+
7373
} catch (error) {
7474
console.error('❌ Local publish failed:', error.message);
7575
process.exit(1);

mpp-ui/scripts/publish-remote.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
/**
44
* Remote publish script
55
* This publishes both mpp-core and mpp-ui to npm registry
6-
*
6+
*
77
* Steps:
8-
* 1. Build and publish @autodev/mpp-core to npm
8+
* 1. Build and publish @xiuper/mpp-core to npm
99
* 2. Update package.json to use published version
1010
* 3. Build and publish @autodev/cli
1111
* 4. Restore package.json to use local file: dependency
@@ -33,7 +33,7 @@ function askConfirmation(question) {
3333
input: process.stdin,
3434
output: process.stdout
3535
});
36-
36+
3737
rl.question(question + ' (y/N): ', (answer) => {
3838
rl.close();
3939
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
@@ -43,46 +43,46 @@ function askConfirmation(question) {
4343

4444
async function main() {
4545
console.log('🚀 Remote Publish Script for @xiuper/cli\n');
46-
46+
4747
// Read current package.json
4848
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
4949
const currentVersion = packageJson.version;
50-
50+
5151
console.log('📦 Current package info:');
5252
console.log(' Name:', packageJson.name);
5353
console.log(' Version:', currentVersion);
5454
console.log(' mpp-core dependency:', packageJson.dependencies['@xiuper/mpp-core']);
5555
console.log();
56-
56+
5757
// Confirm publish
5858
const shouldContinue = await askConfirmation('Do you want to continue with remote publish?');
5959
if (!shouldContinue) {
6060
console.log('❌ Publish cancelled');
6161
process.exit(0);
6262
}
63-
64-
// Step 1: Build mpp-core
63+
64+
// Step 1: Build mpp-core (includes automatic package.json fix)
6565
console.log('\n1️⃣ Building mpp-core...');
6666
try {
6767
execSync('npm run build:kotlin', { cwd: rootDir, stdio: 'inherit' });
68-
console.log('✅ mpp-core build complete\n');
68+
console.log('✅ mpp-core build complete (package.json fixed automatically)\n');
6969
} catch (error) {
7070
console.error('❌ mpp-core build failed');
7171
process.exit(1);
7272
}
73-
73+
7474
// Step 2: Check if mpp-core package exists
7575
console.log('2️⃣ Checking mpp-core package...');
7676
const mppCorePackageJsonPath = resolve(mppCorePackageDir, 'package.json');
7777
if (!existsSync(mppCorePackageJsonPath)) {
7878
console.error('❌ mpp-core package.json not found at:', mppCorePackageJsonPath);
7979
process.exit(1);
8080
}
81-
81+
8282
const mppCorePackageJson = JSON.parse(readFileSync(mppCorePackageJsonPath, 'utf-8'));
8383
const mppCoreVersion = mppCorePackageJson.version;
8484
console.log('✅ mpp-core package found (v' + mppCoreVersion + ')\n');
85-
85+
8686
// Step 3: Publish mpp-core to npm
8787
console.log('3️⃣ Publishing @xiuper/mpp-core...');
8888
const shouldPublishCore = await askConfirmation('Publish @xiuper/mpp-core v' + mppCoreVersion + ' to npm?');
@@ -92,11 +92,11 @@ async function main() {
9292
try {
9393
// Check if user is logged in
9494
execSync('npm whoami', { cwd: mppCorePackageDir, stdio: 'pipe' });
95-
95+
9696
// Publish
9797
execSync('npm publish --access public', { cwd: mppCorePackageDir, stdio: 'inherit' });
9898
console.log('✅ mpp-core published successfully\n');
99-
99+
100100
// Wait a bit for npm registry to update
101101
console.log('⏳ Waiting for npm registry to update (5 seconds)...');
102102
await new Promise(resolve => setTimeout(resolve, 5000));
@@ -107,15 +107,15 @@ async function main() {
107107
process.exit(1);
108108
}
109109
}
110-
110+
111111
// Step 4: Backup and update package.json
112112
console.log('4️⃣ Updating package.json for remote dependency...');
113113
copyFileSync(packageJsonPath, packageJsonBackupPath);
114-
114+
115115
packageJson.dependencies['@xiuper/mpp-core'] = '^' + mppCoreVersion;
116116
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
117117
console.log('✅ Updated to use @xiuper/mpp-core@^' + mppCoreVersion + '\n');
118-
118+
119119
// Step 5: Install dependencies with remote version
120120
console.log('5️⃣ Installing dependencies...');
121121
try {
@@ -127,7 +127,7 @@ async function main() {
127127
copyFileSync(packageJsonBackupPath, packageJsonPath);
128128
process.exit(1);
129129
}
130-
130+
131131
// Step 6: Build TypeScript
132132
console.log('6️⃣ Building TypeScript...');
133133
try {
@@ -139,7 +139,7 @@ async function main() {
139139
copyFileSync(packageJsonBackupPath, packageJsonPath);
140140
process.exit(1);
141141
}
142-
142+
143143
// Step 7: Publish @xiuper/cli
144144
console.log('7️⃣ Publishing @xiuper/cli...');
145145
const shouldPublishCli = await askConfirmation('Publish @xiuper/cli v' + currentVersion + ' to npm?');
@@ -149,7 +149,7 @@ async function main() {
149149
copyFileSync(packageJsonBackupPath, packageJsonPath);
150150
process.exit(0);
151151
}
152-
152+
153153
try {
154154
execSync('npm publish --access public', { cwd: rootDir, stdio: 'inherit' });
155155
console.log('✅ @xiuper/cli published successfully\n');
@@ -159,12 +159,12 @@ async function main() {
159159
copyFileSync(packageJsonBackupPath, packageJsonPath);
160160
process.exit(1);
161161
}
162-
162+
163163
// Step 8: Restore package.json for local development
164164
console.log('8️⃣ Restoring package.json for local development...');
165165
copyFileSync(packageJsonBackupPath, packageJsonPath);
166166
console.log('✅ package.json restored\n');
167-
167+
168168
// Step 9: Reinstall with local file: dependency
169169
console.log('9️⃣ Reinstalling local dependencies...');
170170
try {
@@ -173,7 +173,7 @@ async function main() {
173173
} catch (error) {
174174
console.warn('⚠️ npm install failed, you may need to run it manually\n');
175175
}
176-
176+
177177
console.log('🎉 Remote publish complete!\n');
178178
console.log('📦 Published packages:');
179179
console.log(' @xiuper/mpp-core@' + mppCoreVersion);
@@ -186,12 +186,12 @@ async function main() {
186186

187187
main().catch(error => {
188188
console.error('❌ Unexpected error:', error);
189-
189+
190190
// Try to restore package.json
191191
if (existsSync(packageJsonBackupPath)) {
192192
console.log('🔄 Restoring package.json...');
193193
copyFileSync(packageJsonBackupPath, packageJsonPath);
194194
}
195-
195+
196196
process.exit(1);
197197
});

mpp-ui/src/jsMain/typescript/__tests__/AgentMode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ vi.mock('../config/ConfigManager.js', () => ({
2323
}
2424
}));
2525

26-
vi.mock('@autodev/mpp-core', () => ({
26+
vi.mock('@xiuper/mpp-core', () => ({
2727
default: {
2828
cc: {
2929
unitmesh: {

mpp-ui/src/jsMain/typescript/__tests__/DomainDictService.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
66
import { DomainDictService, getCurrentProjectPath, isValidProjectPath } from '../utils/domainDictUtils.js';
77

88
// Mock mpp-core
9-
vi.mock('@autodev/mpp-core', () => ({
9+
vi.mock('@xiuper/mpp-core', () => ({
1010
default: {
1111
cc: {
1212
unitmesh: {
@@ -98,7 +98,7 @@ describe('DomainDictService', () => {
9898
});
9999

100100
// Mock the generator to return exists = true
101-
const mppCore = await import('@autodev/mpp-core');
101+
const mppCore = await import('@xiuper/mpp-core');
102102
const mockGenerator = vi.mocked(mppCore.default.cc.unitmesh.llm.JsDomainDictGenerator);
103103
mockGenerator.mockImplementation(() => ({
104104
generateAndSave: vi.fn().mockResolvedValue({
@@ -125,7 +125,7 @@ describe('DomainDictService', () => {
125125
});
126126

127127
// Mock the generator to return exists = false
128-
const mppCore = await import('@autodev/mpp-core');
128+
const mppCore = await import('@xiuper/mpp-core');
129129
const mockGenerator = vi.mocked(mppCore.default.cc.unitmesh.llm.JsDomainDictGenerator);
130130
mockGenerator.mockImplementation(() => ({
131131
generateAndSave: vi.fn().mockResolvedValue({
@@ -171,7 +171,7 @@ describe('DomainDictService', () => {
171171
});
172172

173173
// Mock the generator to throw an error
174-
const mppCore = await import('@autodev/mpp-core');
174+
const mppCore = await import('@xiuper/mpp-core');
175175
const mockGenerator = vi.mocked(mppCore.default.cc.unitmesh.llm.JsDomainDictGenerator);
176176
mockGenerator.mockImplementation(() => ({
177177
generateAndSave: vi.fn().mockResolvedValue({
@@ -258,7 +258,7 @@ describe('Project Path Utils', () => {
258258
});
259259

260260
// Mock the generator for successful generation
261-
const mppCore = await import('@autodev/mpp-core');
261+
const mppCore = await import('@xiuper/mpp-core');
262262
const mockGenerator = vi.mocked(mppCore.default.cc.unitmesh.llm.JsDomainDictGenerator);
263263
mockGenerator.mockImplementation(() => ({
264264
generateAndSave: vi.fn().mockResolvedValue({
@@ -287,7 +287,7 @@ describe('Project Path Utils', () => {
287287
});
288288

289289
// Mock the generator for force flag behavior
290-
const mppCore = await import('@autodev/mpp-core');
290+
const mppCore = await import('@xiuper/mpp-core');
291291
const mockGenerator = vi.mocked(mppCore.default.cc.unitmesh.llm.JsDomainDictGenerator);
292292
mockGenerator.mockImplementation(() => ({
293293
generateAndSave: vi.fn().mockResolvedValue({

0 commit comments

Comments
 (0)