@birdmichael/ccsync 1.0.1 → 1.0.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/README.md +4 -3
- package/dist/commands/config.js +2 -2
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +2 -2
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/logs.js +1 -1
- package/dist/commands/menu.js +3 -3
- package/dist/commands/setup.js +1 -1
- package/dist/commands/start.js +2 -2
- package/dist/commands/status.js +3 -3
- package/dist/commands/stop.js +2 -2
- package/dist/commands/sync.js +2 -2
- package/dist/commands/toggle.js +2 -2
- package/dist/core/config-manager.js +3 -3
- package/dist/core/launch-agent.js +1 -1
- package/dist/core/permission-manager.js +1 -1
- package/dist/core/service-manager.js +4 -4
- package/dist/core/sync-service.js +6 -6
- package/dist/syncers/mcp-syncer.js +3 -3
- package/dist/syncers/skills-syncer.js +2 -2
- package/dist/ui/config/index.js +1 -1
- package/dist/ui/dashboard/index.js +1 -1
- package/dist/ui/error/index.js +1 -1
- package/dist/utils/error-handler.js +1 -1
- package/dist/utils/file-watcher.js +1 -1
- package/package.json +3 -2
- package/scripts/build-and-test.sh +87 -0
- package/scripts/fix-imports.mjs +56 -0
- package/scripts/quick-release.sh +140 -0
- package/scripts/test-compiled.sh +18 -0
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ ccsync 是一个用于将 ccswitch 的 Skills 和 MCP 服务器自动同步到 O
|
|
|
18
18
|
### 从源码安装
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
21
|
+
git clone https://github.com/birdmichael/ccsync.git
|
|
22
|
+
cd ccsync
|
|
22
23
|
npm install
|
|
23
24
|
npm run build
|
|
24
25
|
npm link
|
|
@@ -27,7 +28,7 @@ npm link
|
|
|
27
28
|
### 使用 NPM 安装(推荐)
|
|
28
29
|
|
|
29
30
|
```bash
|
|
30
|
-
npm install -g ccsync
|
|
31
|
+
npm install -g @birdmichael/ccsync
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
## 使用
|
|
@@ -238,4 +239,4 @@ MIT License
|
|
|
238
239
|
|
|
239
240
|
## 反馈
|
|
240
241
|
|
|
241
|
-
如遇问题,请在 https://github.com/
|
|
242
|
+
如遇问题,请在 https://github.com/birdmichael/ccsync/issues 提交 Issue。
|
package/dist/commands/config.js
CHANGED
|
@@ -4,8 +4,8 @@ import { exec } from 'node:child_process';
|
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { promisify } from 'node:util';
|
|
7
|
-
import { configManager } from '../core/config-manager';
|
|
8
|
-
import { TEXTS } from '../utils/texts';
|
|
7
|
+
import { configManager } from '../core/config-manager.js';
|
|
8
|
+
import { TEXTS } from '../utils/texts.js';
|
|
9
9
|
const execAsync = promisify(exec);
|
|
10
10
|
export default class Config extends Command {
|
|
11
11
|
static description = TEXTS.commands.config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAQtC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,SAAc;IAClC,MAAM,CAAC,QAAQ,WAEX;IACJ,OAAO,CAAC,eAAe,CAA+B;IAE9C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8C3B"}
|
|
@@ -3,8 +3,8 @@ import { Command } from '@oclif/core';
|
|
|
3
3
|
import { render } from 'ink';
|
|
4
4
|
import { clearInterval, setInterval } from 'node:timers';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { configManager } from '../core/config-manager';
|
|
7
|
-
import { Dashboard as DashboardComponent } from '../ui/dashboard';
|
|
6
|
+
import { configManager } from '../core/config-manager.js';
|
|
7
|
+
import { Dashboard as DashboardComponent } from '../ui/dashboard/index.js';
|
|
8
8
|
export default class Dashboard extends Command {
|
|
9
9
|
static description = '打开可视化仪表板';
|
|
10
10
|
static examples = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,MAAM,CAAC,QAAQ,GAAG;QACd,qCAAqC;KACtC,CAAC;IACI,eAAe,GAA0B,IAAI,CAAC;IAEpD,KAAK,CAAC,GAAG;QACP,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;QAEzC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAClC,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;YACtC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC;YAC1B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;YACjC,QAAQ,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;YAChC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,KAAK;YACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC;YACtC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ;YACrC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;SACnC,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;YAC5C,MAAM,aAAa,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;YAEhD,QAAQ,CACN,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;gBACtC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO;gBAC1C,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,CAAC;gBACjC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,QAAQ;gBACxC,QAAQ,EAAE,aAAa,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;gBACvC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,IAAI,KAAK;gBAC/C,WAAW,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC;gBAC7C,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,QAAQ;gBAC5C,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;aAC1C,CAAC,CACH,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtC,CAAC;YAED,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC"}
|
package/dist/commands/logs.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Command, Flags } from '@oclif/core';
|
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
-
import { TEXTS } from '../utils/texts';
|
|
6
|
+
import { TEXTS } from '../utils/texts.js';
|
|
7
7
|
export default class Logs extends Command {
|
|
8
8
|
static description = TEXTS.commands.logs;
|
|
9
9
|
static flags = {
|
package/dist/commands/menu.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { confirm, select } from '@inquirer/prompts';
|
|
3
3
|
import { Command } from '@oclif/core';
|
|
4
|
-
import { configManager } from '../core/config-manager';
|
|
5
|
-
import { serviceManager } from '../core/service-manager';
|
|
6
|
-
import { TEXTS } from '../utils/texts';
|
|
4
|
+
import { configManager } from '../core/config-manager.js';
|
|
5
|
+
import { serviceManager } from '../core/service-manager.js';
|
|
6
|
+
import { TEXTS } from '../utils/texts.js';
|
|
7
7
|
export default class Menu extends Command {
|
|
8
8
|
static description = TEXTS.commands.menu;
|
|
9
9
|
async run() {
|
package/dist/commands/setup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { checkbox, confirm, input, select } from '@inquirer/prompts';
|
|
3
3
|
import { Command } from '@oclif/core';
|
|
4
|
-
import { configManager } from '../core/config-manager';
|
|
4
|
+
import { configManager } from '../core/config-manager.js';
|
|
5
5
|
const TEXTS = {
|
|
6
6
|
commands: {
|
|
7
7
|
config: '管理 ccsync 配置',
|
package/dist/commands/start.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
-
import { serviceManager } from '../core/service-manager';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
3
|
+
import { serviceManager } from '../core/service-manager.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
5
|
export default class Start extends Command {
|
|
6
6
|
static description = TEXTS.commands.start;
|
|
7
7
|
async run() {
|
package/dist/commands/status.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
-
import { configManager } from '../core/config-manager';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
5
|
-
import { formatUptime } from '../utils/time-helper';
|
|
3
|
+
import { configManager } from '../core/config-manager.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
|
+
import { formatUptime } from '../utils/time-helper.js';
|
|
6
6
|
class Status extends Command {
|
|
7
7
|
static description = TEXTS.commands.status;
|
|
8
8
|
async run() {
|
package/dist/commands/stop.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
-
import { serviceManager } from '../core/service-manager';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
3
|
+
import { serviceManager } from '../core/service-manager.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
5
|
export default class Stop extends Command {
|
|
6
6
|
static description = TEXTS.commands.stop;
|
|
7
7
|
async run() {
|
package/dist/commands/sync.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
-
import { serviceManager } from '../core/service-manager';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
3
|
+
import { serviceManager } from '../core/service-manager.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
5
|
export default class Sync extends Command {
|
|
6
6
|
static description = TEXTS.commands.sync;
|
|
7
7
|
async run() {
|
package/dist/commands/toggle.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
|
-
import { serviceManager } from '../core/service-manager';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
3
|
+
import { serviceManager } from '../core/service-manager.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
5
|
export default class Toggle extends Command {
|
|
6
6
|
static description = TEXTS.commands.toggle;
|
|
7
7
|
async run() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import yaml from 'yaml';
|
|
4
|
-
import { DEFAULT_CONFIG } from '../types/config';
|
|
5
|
-
import { logger } from '../utils/logger';
|
|
6
|
-
import { expandPath, getHomeDir } from '../utils/time-helper';
|
|
4
|
+
import { DEFAULT_CONFIG } from '../types/config.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
import { expandPath, getHomeDir } from '../utils/time-helper.js';
|
|
7
7
|
const CONFIG_DIR = path.join(getHomeDir(), '.config', 'ccsync');
|
|
8
8
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.yaml');
|
|
9
9
|
class ConfigManager {
|
|
@@ -3,7 +3,7 @@ import { exec } from 'node:child_process';
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { promisify } from 'node:util';
|
|
6
|
-
import { logger } from '../utils/logger';
|
|
6
|
+
import { logger } from '../utils/logger.js';
|
|
7
7
|
const execAsync = promisify(exec);
|
|
8
8
|
class LaunchAgentManager {
|
|
9
9
|
agentName = 'com.user.ccsync';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logger } from '../utils/logger';
|
|
2
|
-
import { configManager } from './config-manager';
|
|
3
|
-
import { LaunchAgentManager } from './launch-agent';
|
|
4
|
-
import { SyncService } from './sync-service';
|
|
1
|
+
import { logger } from '../utils/logger.js';
|
|
2
|
+
import { configManager } from './config-manager.js';
|
|
3
|
+
import { LaunchAgentManager } from './launch-agent.js';
|
|
4
|
+
import { SyncService } from './sync-service.js';
|
|
5
5
|
class ServiceManager {
|
|
6
6
|
launchAgentManager;
|
|
7
7
|
pid = null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { McpSyncer } from '../syncers/mcp-syncer';
|
|
2
|
-
import { SkillsSyncer } from '../syncers/skills-syncer';
|
|
3
|
-
import { FileWatcher } from '../utils/file-watcher';
|
|
4
|
-
import { logger } from '../utils/logger';
|
|
5
|
-
import { configManager } from './config-manager';
|
|
6
|
-
import { PermissionManager } from './permission-manager';
|
|
1
|
+
import { McpSyncer } from '../syncers/mcp-syncer.js';
|
|
2
|
+
import { SkillsSyncer } from '../syncers/skills-syncer.js';
|
|
3
|
+
import { FileWatcher } from '../utils/file-watcher.js';
|
|
4
|
+
import { logger } from '../utils/logger.js';
|
|
5
|
+
import { configManager } from './config-manager.js';
|
|
6
|
+
import { PermissionManager } from './permission-manager.js';
|
|
7
7
|
class SyncService {
|
|
8
8
|
fileWatcher = null;
|
|
9
9
|
intervalId = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import { logger } from '../utils/logger';
|
|
3
|
-
import { TEXTS } from '../utils/texts';
|
|
4
|
-
import { formatDuration } from '../utils/time-helper';
|
|
2
|
+
import { logger } from '../utils/logger.js';
|
|
3
|
+
import { TEXTS } from '../utils/texts.js';
|
|
4
|
+
import { formatDuration } from '../utils/time-helper.js';
|
|
5
5
|
class McpSyncer {
|
|
6
6
|
cachedMcpServers = [];
|
|
7
7
|
dbPath;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { logger } from '../utils/logger';
|
|
4
|
-
import { TEXTS } from '../utils/texts';
|
|
3
|
+
import { logger } from '../utils/logger.js';
|
|
4
|
+
import { TEXTS } from '../utils/texts.js';
|
|
5
5
|
class SkillsSyncer {
|
|
6
6
|
sourcePaths;
|
|
7
7
|
sources;
|
package/dist/ui/config/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
import { TEXTS } from '../../utils/texts';
|
|
3
|
+
import { TEXTS } from '../../utils/texts.js';
|
|
4
4
|
export function ConfigUI({ skillsClaude, skillsCodex, mcpPlatforms, syncInterval, autostart, logLevel, }) {
|
|
5
5
|
return (React.createElement(Box, { flexDirection: "column", padding: 1 },
|
|
6
6
|
React.createElement(Box, { borderStyle: "double", borderColor: "blue", paddingX: 1 },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
import { TEXTS } from '../../utils/texts';
|
|
3
|
+
import { TEXTS } from '../../utils/texts.js';
|
|
4
4
|
export function Dashboard({ running, skillsCount, mcpCount, errors, uptime, syncInterval, autostart, logLevel, }) {
|
|
5
5
|
const [currentTime, setCurrentTime] = useState(new Date());
|
|
6
6
|
useEffect(() => {
|
package/dist/ui/error/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
import { TEXTS } from '../../utils/texts';
|
|
3
|
+
import { TEXTS } from '../../utils/texts.js';
|
|
4
4
|
export function ErrorUI({ title, message, actions }) {
|
|
5
5
|
return (React.createElement(Box, { flexDirection: "column", padding: 1 },
|
|
6
6
|
React.createElement(Box, { borderStyle: "single", borderColor: "red", paddingX: 1 },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@birdmichael/ccsync",
|
|
3
3
|
"description": "A new CLI generated with oclif",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.5",
|
|
5
5
|
"bin": "./bin/run.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"type": "module",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"files": [
|
|
58
58
|
"./bin",
|
|
59
59
|
"./dist",
|
|
60
|
+
"./scripts",
|
|
60
61
|
"./oclif.manifest.json"
|
|
61
62
|
],
|
|
62
63
|
"homepage": "https://github.com/birdmichael/ccsync",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
],
|
|
66
67
|
"license": "MIT",
|
|
67
68
|
"scripts": {
|
|
68
|
-
"build": "shx rm -rf dist && tsc -b",
|
|
69
|
+
"build": "shx rm -rf dist && tsc -b && node scripts/fix-imports.mjs",
|
|
69
70
|
"dev": "ts-node ./bin/dev",
|
|
70
71
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
71
72
|
"lint": "eslint src/**/*.ts",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ccsync build and test script
|
|
4
|
+
|
|
5
|
+
# Get script directory and cd to it
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
cd "$SCRIPT_DIR"
|
|
8
|
+
|
|
9
|
+
echo "====================================="
|
|
10
|
+
echo "Building and Testing ccsync"
|
|
11
|
+
echo "====================================="
|
|
12
|
+
echo "Working directory: $(pwd)"
|
|
13
|
+
echo ""
|
|
14
|
+
|
|
15
|
+
# Install dependencies
|
|
16
|
+
echo "Step1: Installing dependencies..."
|
|
17
|
+
npm install
|
|
18
|
+
if [ $? -ne 0 ]; then
|
|
19
|
+
echo "❌ Failed to install dependencies"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
echo "✅ Dependencies installed"
|
|
23
|
+
echo ""
|
|
24
|
+
|
|
25
|
+
# Build project
|
|
26
|
+
echo "Step 2: Building project..."
|
|
27
|
+
npm run build
|
|
28
|
+
if [ $? -ne 0 ]; then
|
|
29
|
+
echo "❌ Failed to build project"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
echo "✅ Project built successfully"
|
|
33
|
+
echo ""
|
|
34
|
+
|
|
35
|
+
# Run tests
|
|
36
|
+
echo "Step 3: Running tests..."
|
|
37
|
+
npm test
|
|
38
|
+
if [ $? -ne 0 ]; then
|
|
39
|
+
echo "❌ Tests failed"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
echo "✅ Tests passed"
|
|
43
|
+
echo ""
|
|
44
|
+
|
|
45
|
+
# Run lint
|
|
46
|
+
echo "Step 4: Running lint..."
|
|
47
|
+
npm run lint
|
|
48
|
+
if [ $? -ne 0 ]; then
|
|
49
|
+
echo "⚠️ Lint found issues (warnings only)"
|
|
50
|
+
else
|
|
51
|
+
echo "✅ Lint passed"
|
|
52
|
+
fi
|
|
53
|
+
echo ""
|
|
54
|
+
|
|
55
|
+
# Check dist directory
|
|
56
|
+
echo "Step 5: Checking dist directory..."
|
|
57
|
+
if [ -d "dist" ]; then
|
|
58
|
+
echo "✅ Dist directory exists"
|
|
59
|
+
echo " Files: $(find dist -type f | wc -l)"
|
|
60
|
+
echo " Directories: $(find dist -type d | wc -l)"
|
|
61
|
+
else
|
|
62
|
+
echo "❌ Dist directory not found"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
echo ""
|
|
66
|
+
|
|
67
|
+
# Prepack
|
|
68
|
+
echo "Step 6: Running prepack..."
|
|
69
|
+
npm run prepack
|
|
70
|
+
if [ $? -ne 0 ]; then
|
|
71
|
+
echo "⚠️ Prepack had issues (may be expected for first run)"
|
|
72
|
+
else
|
|
73
|
+
echo "✅ Prepack completed"
|
|
74
|
+
fi
|
|
75
|
+
echo ""
|
|
76
|
+
|
|
77
|
+
echo "====================================="
|
|
78
|
+
echo "✅ All checks passed!"
|
|
79
|
+
echo "====================================="
|
|
80
|
+
echo ""
|
|
81
|
+
echo "Package is ready for release."
|
|
82
|
+
echo "To create a GitHub release, run:"
|
|
83
|
+
echo " gh release create v1.0.0 --notes-file RELEASE_NOTES.md"
|
|
84
|
+
echo ""
|
|
85
|
+
echo "To publish to NPM, run:"
|
|
86
|
+
echo " npm publish --access public"
|
|
87
|
+
echo ""
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'fs';
|
|
2
|
+
import { join, extname, dirname, resolve } from 'path';
|
|
3
|
+
|
|
4
|
+
const distDir = './dist';
|
|
5
|
+
|
|
6
|
+
function fixImports(filePath) {
|
|
7
|
+
const content = readFileSync(filePath, 'utf8');
|
|
8
|
+
|
|
9
|
+
const fixed = content.replace(
|
|
10
|
+
/from ['"](\.[^'"]*?)['"](?!\.js)(?!\.ts)(?!\.tsx)(?!\.json)(?!\.mjs)(?!\.cjs)/g,
|
|
11
|
+
(match, importPath) => {
|
|
12
|
+
if (extname(importPath)) {
|
|
13
|
+
return match;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Resolve the import path relative to the current file
|
|
17
|
+
const fileDir = dirname(filePath);
|
|
18
|
+
const absolutePath = resolve(fileDir, importPath);
|
|
19
|
+
|
|
20
|
+
// Check if it's a directory (no extension, but directory exists)
|
|
21
|
+
if (existsSync(absolutePath) && statSync(absolutePath).isDirectory()) {
|
|
22
|
+
// For directory imports, add /index.js
|
|
23
|
+
return match.replace(importPath, `${importPath}/index.js`);
|
|
24
|
+
} else if (existsSync(`${absolutePath}.js`)) {
|
|
25
|
+
// For file imports, add .js
|
|
26
|
+
return match.replace(importPath, `${importPath}.js`);
|
|
27
|
+
} else {
|
|
28
|
+
// Default to adding .js for unknown cases
|
|
29
|
+
return match.replace(importPath, `${importPath}.js`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (content !== fixed) {
|
|
35
|
+
writeFileSync(filePath, fixed, 'utf8');
|
|
36
|
+
console.log(`Fixed: ${filePath}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function walkDir(dir) {
|
|
41
|
+
const files = readdirSync(dir);
|
|
42
|
+
|
|
43
|
+
for (const file of files) {
|
|
44
|
+
const filePath = join(dir, file);
|
|
45
|
+
const stat = statSync(filePath);
|
|
46
|
+
|
|
47
|
+
if (stat.isDirectory()) {
|
|
48
|
+
walkDir(filePath);
|
|
49
|
+
} else if (file.endsWith('.js')) {
|
|
50
|
+
fixImports(filePath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
walkDir(distDir);
|
|
56
|
+
console.log('Import fixing complete!');
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ccsync 快速发布脚本
|
|
4
|
+
# 使用方法:bash scripts/quick-release.sh
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
echo "====================================="
|
|
9
|
+
echo "ccsync 快速发布流程"
|
|
10
|
+
echo "====================================="
|
|
11
|
+
echo ""
|
|
12
|
+
|
|
13
|
+
# 检查 git 状态
|
|
14
|
+
echo "步骤 1:检查 git 状态..."
|
|
15
|
+
if ! git diff-index --quiet HEAD --; then
|
|
16
|
+
echo "❌ 有未提交的更改"
|
|
17
|
+
echo "请先提交所有更改:"
|
|
18
|
+
echo " git add ."
|
|
19
|
+
echo " git commit -m \"your message\""
|
|
20
|
+
echo " git push"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
echo "✅ Git 状态正常"
|
|
24
|
+
echo ""
|
|
25
|
+
|
|
26
|
+
# 检查当前版本
|
|
27
|
+
echo "步骤 2:检查版本..."
|
|
28
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
29
|
+
echo "当前版本:$VERSION"
|
|
30
|
+
echo ""
|
|
31
|
+
|
|
32
|
+
# 检查是否已有 tag
|
|
33
|
+
echo "步骤 3:检查 tag..."
|
|
34
|
+
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
35
|
+
echo "⚠️ Tag v$VERSION 已存在"
|
|
36
|
+
read -p "是否删除现有 tag 并重新创建?(y/n): " -n 1 -r
|
|
37
|
+
if [ "$REPLY" != "y" ]; then
|
|
38
|
+
echo "取消发布"
|
|
39
|
+
exit 0
|
|
40
|
+
fi
|
|
41
|
+
git tag -d "v$VERSION"
|
|
42
|
+
git push origin ":refs/tags/v$VERSION"
|
|
43
|
+
fi
|
|
44
|
+
echo ""
|
|
45
|
+
|
|
46
|
+
# 创建 tag
|
|
47
|
+
echo "步骤 4:创建 git tag..."
|
|
48
|
+
git tag -a "v$VERSION" -m "Release v$VERSION"
|
|
49
|
+
echo "✅ Tag v$VERSION 已创建"
|
|
50
|
+
echo ""
|
|
51
|
+
|
|
52
|
+
# 推送 tag
|
|
53
|
+
echo "步骤 5:推送 tag 到 GitHub..."
|
|
54
|
+
git push origin "v$VERSION"
|
|
55
|
+
echo "✅ Tag 已推送"
|
|
56
|
+
echo ""
|
|
57
|
+
|
|
58
|
+
# 检查 gh CLI
|
|
59
|
+
echo "步骤 6:检查 GitHub CLI..."
|
|
60
|
+
if ! command -v gh &> /dev/null; then
|
|
61
|
+
echo "❌ gh CLI 未安装"
|
|
62
|
+
echo ""
|
|
63
|
+
echo "请安装 gh CLI:"
|
|
64
|
+
echo " # macOS"
|
|
65
|
+
echo " brew install gh"
|
|
66
|
+
echo ""
|
|
67
|
+
echo " # Linux"
|
|
68
|
+
echo " # 参考 https://cli.github.com/manual/installation"
|
|
69
|
+
exit 1
|
|
70
|
+
fi
|
|
71
|
+
echo "✅ gh CLI 已安装"
|
|
72
|
+
echo ""
|
|
73
|
+
|
|
74
|
+
# 检查是否已登录
|
|
75
|
+
echo "步骤 7:检查 GitHub 登录状态..."
|
|
76
|
+
if ! gh auth status &> /dev/null; then
|
|
77
|
+
echo "⚠️ 未登录 GitHub"
|
|
78
|
+
echo "请登录:"
|
|
79
|
+
echo " gh auth login"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
echo "✅ 已登录 GitHub"
|
|
83
|
+
echo ""
|
|
84
|
+
|
|
85
|
+
# 创建 GitHub Release
|
|
86
|
+
echo "步骤 8:创建 GitHub Release..."
|
|
87
|
+
echo "正在创建 Release v$VERSION..."
|
|
88
|
+
gh release create "v$VERSION" \
|
|
89
|
+
--title "Release v$VERSION" \
|
|
90
|
+
--notes "## 🚀 ccsync v$VERSION
|
|
91
|
+
|
|
92
|
+
### What's New
|
|
93
|
+
- Complete implementation of ccsync
|
|
94
|
+
- Full Chinese interface
|
|
95
|
+
- Skills and MCP synchronization
|
|
96
|
+
- Dashboard UI
|
|
97
|
+
- Service management
|
|
98
|
+
- Configuration management
|
|
99
|
+
- Automatic logging with rotation
|
|
100
|
+
- Auto-start support
|
|
101
|
+
|
|
102
|
+
### Installation
|
|
103
|
+
\`\`\`bash
|
|
104
|
+
npm install -g ccsync
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
### Quick Start
|
|
108
|
+
\`\`\`bash
|
|
109
|
+
ccsync setup
|
|
110
|
+
ccsync start
|
|
111
|
+
ccsync status
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
See [README.md](https://github.com/birdmichael/ccsync/blob/main/README.md) for more details." \
|
|
115
|
+
--target main
|
|
116
|
+
|
|
117
|
+
echo "✅ GitHub Release 已创建"
|
|
118
|
+
echo ""
|
|
119
|
+
|
|
120
|
+
echo "====================================="
|
|
121
|
+
echo "✅ 发布流程完成!"
|
|
122
|
+
echo "====================================="
|
|
123
|
+
echo ""
|
|
124
|
+
echo "下一步:"
|
|
125
|
+
echo ""
|
|
126
|
+
echo "1. 访问 GitHub Release:"
|
|
127
|
+
echo " https://github.com/birdmichael/ccsync/releases/tag/v$VERSION"
|
|
128
|
+
echo ""
|
|
129
|
+
echo "2. 确认 NPM_TOKEN 已配置:"
|
|
130
|
+
echo " https://github.com/birdmichael/ccsync/settings/secrets/actions"
|
|
131
|
+
echo " 检查是否有 NPM_TOKEN secret"
|
|
132
|
+
echo ""
|
|
133
|
+
echo "3. 等待自动发布到 NPM(通常需要 1-2 分钟)"
|
|
134
|
+
echo ""
|
|
135
|
+
echo "4. 验证发布:"
|
|
136
|
+
echo " npm view ccsync"
|
|
137
|
+
echo ""
|
|
138
|
+
echo "如果自动发布失败,请查看:"
|
|
139
|
+
echo " NPM-PUBLISH-GUIDE.md"
|
|
140
|
+
echo ""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
echo "Testing compiled package..."
|
|
4
|
+
|
|
5
|
+
# Temporarily link the compiled version
|
|
6
|
+
npm unlink -g 2>/dev/null || true
|
|
7
|
+
npm link
|
|
8
|
+
|
|
9
|
+
echo "Testing ccsync --version..."
|
|
10
|
+
ccsync --version
|
|
11
|
+
|
|
12
|
+
echo "Testing ccsync status..."
|
|
13
|
+
ccsync status || echo "status command may not work without config"
|
|
14
|
+
|
|
15
|
+
echo "Testing ccsync --help..."
|
|
16
|
+
ccsync --help | head -5
|
|
17
|
+
|
|
18
|
+
echo "✅ Compiled package tests passed!"
|