wangchuan 6.0.3 → 7.0.0
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 +7 -13
- package/README.zh-CN.md +7 -13
- package/dist/bin/wangchuan.d.ts +2 -2
- package/dist/bin/wangchuan.js +20 -19
- package/dist/bin/wangchuan.js.map +1 -1
- package/dist/src/commands/pull.d.ts +9 -1
- package/dist/src/commands/pull.d.ts.map +1 -1
- package/dist/src/commands/pull.js +129 -53
- package/dist/src/commands/pull.js.map +1 -1
- package/dist/src/commands/push.d.ts +12 -5
- package/dist/src/commands/push.d.ts.map +1 -1
- package/dist/src/commands/push.js +152 -80
- package/dist/src/commands/push.js.map +1 -1
- package/dist/src/commands/status.d.ts +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +1 -17
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/core/sync-stage.d.ts.map +1 -1
- package/dist/src/core/sync-stage.js +0 -1
- package/dist/src/core/sync-stage.js.map +1 -1
- package/dist/src/i18n.d.ts.map +1 -1
- package/dist/src/i18n.js +12 -76
- package/dist/src/i18n.js.map +1 -1
- package/dist/src/types.d.ts +3 -8
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +22 -33
- package/skill/references/environment.md +19 -26
- package/skill/references/inspect-status.md +4 -4
- package/skill/references/install-setup.md +17 -25
- package/skill/references/resource-crud.md +11 -11
- package/skill/references/sync-conflict.md +20 -16
- package/skill/wangchuan-skill.sh +9 -11
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Agent: (creates skill, asks which agents to distribute to,
|
|
|
33
33
|
|
|
34
34
|
You: "Switch to work environment"
|
|
35
35
|
Agent: (asks about unsynced changes, switches branch, pulls work env data,
|
|
36
|
-
checks for conflicts
|
|
36
|
+
checks for conflicts)
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
**The agent does everything.** You just talk to it. The skill file (`skill/SKILL.md`) teaches the agent exactly how to manage your memories — no manual CLI needed.
|
|
@@ -56,11 +56,11 @@ The main SKILL.md is kept under 120 lines. When the agent encounters a specific
|
|
|
56
56
|
|
|
57
57
|
### Skill Benchmark
|
|
58
58
|
|
|
59
|
-
Every skill change is validated against **
|
|
59
|
+
Every skill change is validated against **52 test cases** (`test/skill-benchmark.md`) covering:
|
|
60
60
|
|
|
61
61
|
- 29 user instructions (init, CRUD for 4 resource types, push/pull, rollback, env management)
|
|
62
|
-
- 4 environment isolation scenarios (cross-env pull, workspace leakage, env selection on restore
|
|
63
|
-
- Global rules (
|
|
62
|
+
- 4 environment isolation scenarios (cross-env pull, workspace leakage, env selection on restore)
|
|
63
|
+
- Global rules (env-aware push/pull, non-TTY constraints)
|
|
64
64
|
|
|
65
65
|
### Install the Skill
|
|
66
66
|
|
|
@@ -95,9 +95,9 @@ wangchuan restore --repo git@github.com:you/brain.git --key wangchuan_<hex>
|
|
|
95
95
|
|---------|---------|-------------|-----------|
|
|
96
96
|
| `init` | — | Brand new setup — auto-detects agents, auto-creates repo (GitHub CLI), runs first sync | `--repo`, `--force` |
|
|
97
97
|
| `restore` | — | Restore from cloud — imports key, pulls cloud data first, then pushes local additions | `--repo`, `--key` |
|
|
98
|
-
| `
|
|
98
|
+
| `pull` | — | Pull cloud data to local | `-a, --agent`, `-o, --only`, `-x, --exclude` |
|
|
99
|
+
| `push` | `s` | Push local changes to cloud | `-a, --agent`, `-n, --dry-run`, `-y`, `-o, --only`, `-x, --exclude` |
|
|
99
100
|
| `status` | `st` | One-screen summary + health score | `-v, --verbose` |
|
|
100
|
-
| `watch` | — | Pull-only background daemon for continuous cloud sync | `-i, --interval <min>` |
|
|
101
101
|
| `doctor` | — | Diagnose + auto-fix everything | `--key-export`, `--key-rotate`, `--setup` |
|
|
102
102
|
| `memory` | — | Browse/copy memories between agents | `list`, `show`, `copy`, `broadcast` |
|
|
103
103
|
| `env` | — | Multi-environment management | `list`, `create`, `switch`, `current`, `delete` |
|
|
@@ -138,19 +138,13 @@ Agent paths are customizable in `~/.wangchuan/config.json`.
|
|
|
138
138
|
- Automatic conflict resolution for `.md`, `.txt`, `.json`, `.yaml`, `.yml` files
|
|
139
139
|
- Non-overlapping edits → auto-merged silently
|
|
140
140
|
- Overlapping conflicts → conflict markers written for user resolution
|
|
141
|
-
-
|
|
141
|
+
- Unresolvable conflicts recorded to `pending-conflicts.json` for next interactive session
|
|
142
142
|
|
|
143
143
|
### Multi-Environment
|
|
144
144
|
- Create isolated environments: `wangchuan env create work`
|
|
145
145
|
- Switch instantly: `wangchuan env switch work`
|
|
146
146
|
- Git-branch-level isolation; shared local workspace with leakage detection
|
|
147
147
|
|
|
148
|
-
### Watch Daemon (Pull-Only)
|
|
149
|
-
- `wangchuan watch` continuously pulls cloud changes in the background
|
|
150
|
-
- Does **not** push — users must `wangchuan sync` to push manually
|
|
151
|
-
- Auto-started by the skill after every interaction
|
|
152
|
-
- Restarts automatically on environment switch
|
|
153
|
-
|
|
154
148
|
### Snapshot Rollback
|
|
155
149
|
- Auto-snapshots before every sync (safety net)
|
|
156
150
|
- Named snapshots: `wangchuan snapshot save before-refactor`
|
package/README.zh-CN.md
CHANGED
|
@@ -33,7 +33,7 @@ Agent: (创建技能, 询问分发到哪些 Agent,
|
|
|
33
33
|
|
|
34
34
|
用户: "切换到 work 环境"
|
|
35
35
|
Agent: (询问是否先推送未同步变更, 切换分支, 拉取 work 环境数据,
|
|
36
|
-
|
|
36
|
+
检查冲突)
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
**Agent 负责一切。** 你只需要对话。技能文件(`skill/SKILL.md`)教会 Agent 如何管理你的记忆 —— 不需要手动敲 CLI。
|
|
@@ -56,11 +56,11 @@ skill/
|
|
|
56
56
|
|
|
57
57
|
### 技能基准测试
|
|
58
58
|
|
|
59
|
-
每次技能变更都经过 **
|
|
59
|
+
每次技能变更都经过 **52 个测试用例**(`test/skill-benchmark.md`)验证:
|
|
60
60
|
|
|
61
61
|
- 29 条用户指令(初始化、4 种资源的增删改查、推送/拉取、回退、环境管理)
|
|
62
|
-
- 4
|
|
63
|
-
-
|
|
62
|
+
- 4 个环境隔离场景(跨环境拉取、工作空间泄漏、恢复时环境选择)
|
|
63
|
+
- 全局规则(环境感知推送/拉取、非 TTY 约束)
|
|
64
64
|
|
|
65
65
|
### 安装技能
|
|
66
66
|
|
|
@@ -95,9 +95,9 @@ wangchuan restore --repo git@github.com:you/brain.git --key wangchuan_<hex>
|
|
|
95
95
|
|------|------|------|----------|
|
|
96
96
|
| `init` | — | 全新初始化 — 自动检测智能体,支持一键创建仓库(GitHub CLI),执行首次同步 | `--repo`、`--force` |
|
|
97
97
|
| `restore` | — | 恢复云端记忆 — 导入密钥,先拉取云端数据,再推送本地新增内容 | `--repo`、`--key` |
|
|
98
|
-
| `
|
|
98
|
+
| `pull` | — | 拉取云端数据到本地 | `-a, --agent`、`-o, --only`、`-x, --exclude` |
|
|
99
|
+
| `push` | `s` | 推送本地变更到云端 | `-a, --agent`、`-n, --dry-run`、`-y`、`-o, --only`、`-x, --exclude` |
|
|
99
100
|
| `status` | `st` | 一屏总览 + 健康评分 | `-v, --verbose` |
|
|
100
|
-
| `watch` | — | 仅拉取的后台守护进程,持续同步云端变更 | `-i, --interval <分钟>` |
|
|
101
101
|
| `doctor` | — | 诊断 + 自动修复所有问题 | `--key-export`、`--key-rotate`、`--setup` |
|
|
102
102
|
| `memory` | — | 浏览/复制智能体记忆 | `list`、`show`、`copy`、`broadcast` |
|
|
103
103
|
| `env` | — | 多环境管理 | `list`、`create`、`switch`、`current`、`delete` |
|
|
@@ -138,19 +138,13 @@ wangchuan restore --repo git@github.com:you/brain.git --key wangchuan_<hex>
|
|
|
138
138
|
- 自动冲突解决,支持 `.md`、`.txt`、`.json`、`.yaml`、`.yml`
|
|
139
139
|
- 不重叠编辑 → 静默合并
|
|
140
140
|
- 重叠冲突 → 写入冲突标记供用户解决
|
|
141
|
-
-
|
|
141
|
+
- 无法自动解决的冲突记录到 `pending-conflicts.json`,下次交互时提示
|
|
142
142
|
|
|
143
143
|
### 多环境管理
|
|
144
144
|
- 创建隔离环境:`wangchuan env create work`
|
|
145
145
|
- 即时切换:`wangchuan env switch work`
|
|
146
146
|
- Git 分支级隔离;共享本地工作空间,自动检测泄漏
|
|
147
147
|
|
|
148
|
-
### Watch 守护进程(仅拉取)
|
|
149
|
-
- `wangchuan watch` 持续在后台拉取云端变更
|
|
150
|
-
- **不会推送** — 用户需手动 `wangchuan sync` 推送
|
|
151
|
-
- 技能每次交互后自动启动
|
|
152
|
-
- 环境切换时自动重启
|
|
153
|
-
|
|
154
148
|
### 快照回滚
|
|
155
149
|
- 每次同步前自动创建快照(安全网)
|
|
156
150
|
- 命名快照:`wangchuan snapshot save before-refactor`
|
package/dist/bin/wangchuan.d.ts
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* Commands:
|
|
9
9
|
* init — One-time setup (interactive if no --repo)
|
|
10
10
|
* restore — Restore from cloud (import key + clone + pull)
|
|
11
|
-
*
|
|
11
|
+
* pull — Pull remote changes to local workspace
|
|
12
|
+
* push — Push local changes to remote
|
|
12
13
|
* status — Show sync state at a glance (--verbose for full detail)
|
|
13
14
|
* doctor — Diagnose + auto-fix issues (always runs --fix)
|
|
14
15
|
* env — Multi-environment management
|
|
15
|
-
* watch — Background daemon for continuous sync
|
|
16
16
|
* memory — Browse/copy memories across agents
|
|
17
17
|
* snapshot — Manage sync snapshots (save/list/restore/delete)
|
|
18
18
|
* lang — Switch display language
|
package/dist/bin/wangchuan.js
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* Commands:
|
|
9
9
|
* init — One-time setup (interactive if no --repo)
|
|
10
10
|
* restore — Restore from cloud (import key + clone + pull)
|
|
11
|
-
*
|
|
11
|
+
* pull — Pull remote changes to local workspace
|
|
12
|
+
* push — Push local changes to remote
|
|
12
13
|
* status — Show sync state at a glance (--verbose for full detail)
|
|
13
14
|
* doctor — Diagnose + auto-fix issues (always runs --fix)
|
|
14
15
|
* env — Multi-environment management
|
|
15
|
-
* watch — Background daemon for continuous sync
|
|
16
16
|
* memory — Browse/copy memories across agents
|
|
17
17
|
* snapshot — Manage sync snapshots (save/list/restore/delete)
|
|
18
18
|
* lang — Switch display language
|
|
@@ -21,11 +21,11 @@ import { Command } from 'commander';
|
|
|
21
21
|
import { cmdInit } from '../src/commands/init.js';
|
|
22
22
|
import { cmdRestore } from '../src/commands/restore.js';
|
|
23
23
|
import { cmdStatus } from '../src/commands/status.js';
|
|
24
|
-
import {
|
|
24
|
+
import { cmdPull } from '../src/commands/pull.js';
|
|
25
|
+
import { cmdPush } from '../src/commands/push.js';
|
|
25
26
|
import { cmdEnv } from '../src/commands/env.js';
|
|
26
27
|
import { cmdDoctor } from '../src/commands/doctor.js';
|
|
27
28
|
import { cmdLang } from '../src/commands/lang.js';
|
|
28
|
-
import { cmdWatch } from '../src/commands/watch.js';
|
|
29
29
|
import { cmdMemory } from '../src/commands/memory.js';
|
|
30
30
|
import { cmdSnapshot } from '../src/commands/snapshot.js';
|
|
31
31
|
import { config } from '../src/core/config.js';
|
|
@@ -47,7 +47,7 @@ const program = new Command();
|
|
|
47
47
|
program
|
|
48
48
|
.name('wangchuan')
|
|
49
49
|
.description(t('cli.description'))
|
|
50
|
-
.version('
|
|
50
|
+
.version('7.0.0');
|
|
51
51
|
// ── init ────────────────────────────────────────────────────────
|
|
52
52
|
program
|
|
53
53
|
.command('init')
|
|
@@ -66,18 +66,28 @@ program
|
|
|
66
66
|
.action(async (opts) => {
|
|
67
67
|
await run(() => cmdRestore(opts));
|
|
68
68
|
});
|
|
69
|
-
// ──
|
|
69
|
+
// ── pull ────────────────────────────────────────────────────────
|
|
70
70
|
program
|
|
71
|
-
.command('
|
|
72
|
-
.
|
|
73
|
-
.
|
|
71
|
+
.command('pull')
|
|
72
|
+
.description(t('cli.cmd.pull'))
|
|
73
|
+
.option('-a, --agent <name>', t('cli.cmd.agent'), parseAgent)
|
|
74
|
+
.option('-n, --dry-run', t('cli.cmd.dryRun'), false)
|
|
75
|
+
.option('-o, --only <patterns...>', t('cli.cmd.sync.only'))
|
|
76
|
+
.option('-x, --exclude <patterns...>', t('cli.cmd.sync.exclude'))
|
|
77
|
+
.action(async (opts) => {
|
|
78
|
+
await run(() => cmdPull(opts));
|
|
79
|
+
});
|
|
80
|
+
// ── push ────────────────────────────────────────────────────────
|
|
81
|
+
program
|
|
82
|
+
.command('push')
|
|
83
|
+
.description(t('cli.cmd.push'))
|
|
74
84
|
.option('-a, --agent <name>', t('cli.cmd.agent'), parseAgent)
|
|
75
85
|
.option('-n, --dry-run', t('cli.cmd.dryRun'), false)
|
|
76
86
|
.option('-o, --only <patterns...>', t('cli.cmd.sync.only'))
|
|
77
87
|
.option('-x, --exclude <patterns...>', t('cli.cmd.sync.exclude'))
|
|
78
88
|
.option('-y, --yes', t('cli.cmd.sync.yes'), false)
|
|
79
89
|
.action(async (opts) => {
|
|
80
|
-
await run(() =>
|
|
90
|
+
await run(() => cmdPush(opts));
|
|
81
91
|
});
|
|
82
92
|
// ── status ──────────────────────────────────────────────────────
|
|
83
93
|
program
|
|
@@ -107,15 +117,6 @@ program
|
|
|
107
117
|
.action(async (action, name, opts) => {
|
|
108
118
|
await run(() => cmdEnv({ action, name, from: opts.from }));
|
|
109
119
|
});
|
|
110
|
-
// ── watch ───────────────────────────────────────────────────────
|
|
111
|
-
program
|
|
112
|
-
.command('watch')
|
|
113
|
-
.description(t('cli.cmd.watch'))
|
|
114
|
-
.option('-i, --interval <minutes>', t('cli.cmd.watch.interval'), parseFloat)
|
|
115
|
-
.option('-a, --agent <name>', t('cli.cmd.agent'), parseAgent)
|
|
116
|
-
.action(async (opts) => {
|
|
117
|
-
await run(() => cmdWatch(opts));
|
|
118
|
-
});
|
|
119
120
|
// ── memory ──────────────────────────────────────────────────────
|
|
120
121
|
program
|
|
121
122
|
.command('memory <action> [args...]')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wangchuan.js","sourceRoot":"","sources":["../../bin/wangchuan.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAO,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAQ,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAW,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAQ,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wangchuan.js","sourceRoot":"","sources":["../../bin/wangchuan.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAO,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAQ,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAW,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAQ,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAU,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAQ,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAS,uBAAuB,CAAC;AAClD,OA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AC1B,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;KAC9B,MAAM,CAAC,KAAK,EAAE,QAAiB,EAAE,EAAE;IAClC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEL,mEAAmE;AACnE,KAAK,UAAU,GAAG,CAAC,EAA0B;IAC3C,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,CAAC;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,OAAO,EAAE,CAAC;YACnD,OAAO,CAAC,KAAK,CAAE,GAAa,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pull.ts — wangchuan pull command
|
|
3
|
+
*
|
|
4
|
+
* Pull-only operation: fetch remote changes and restore to local workspace.
|
|
5
|
+
* Cloud is the single source of truth — files absent from repo are deleted locally.
|
|
6
|
+
*
|
|
7
|
+
* 1. Fetch remote to check for new commits
|
|
8
|
+
* 2. If remote is ahead, git pull
|
|
9
|
+
* 3. restoreFromRepo (cloud → local)
|
|
10
|
+
* 4. Report results
|
|
3
11
|
*/
|
|
4
12
|
import type { PullOptions, RestoreResult } from '../types.js';
|
|
5
|
-
export declare function cmdPull({ agent, only, exclude }?: PullOptions): Promise<RestoreResult>;
|
|
13
|
+
export declare function cmdPull({ agent, dryRun, only, exclude }?: PullOptions): Promise<RestoreResult | undefined>;
|
|
6
14
|
//# sourceMappingURL=pull.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAiB,MAAM,aAAa,CAAC;AAkC7E,wBAAsB,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAE,WAAgB,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA0BpH"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pull.ts — wangchuan pull command
|
|
3
|
+
*
|
|
4
|
+
* Pull-only operation: fetch remote changes and restore to local workspace.
|
|
5
|
+
* Cloud is the single source of truth — files absent from repo are deleted locally.
|
|
6
|
+
*
|
|
7
|
+
* 1. Fetch remote to check for new commits
|
|
8
|
+
* 2. If remote is ahead, git pull
|
|
9
|
+
* 3. restoreFromRepo (cloud → local)
|
|
10
|
+
* 4. Report results
|
|
3
11
|
*/
|
|
12
|
+
import os from 'os';
|
|
13
|
+
import fs from 'fs';
|
|
14
|
+
import path from 'path';
|
|
4
15
|
import { config } from '../core/config.js';
|
|
5
16
|
import { resolveGitBranch } from '../core/config.js';
|
|
6
17
|
import { ensureMigrated } from '../core/migrate.js';
|
|
@@ -10,92 +21,157 @@ import { syncLock } from '../core/sync-lock.js';
|
|
|
10
21
|
import { appendSyncEvent } from '../core/sync-history.js';
|
|
11
22
|
import { fireWebhooks, buildWebhookPayload } from '../core/webhook.js';
|
|
12
23
|
import { runHooks } from '../core/hooks.js';
|
|
24
|
+
import { copyDirSync } from '../utils/fs.js';
|
|
13
25
|
import { validator } from '../utils/validator.js';
|
|
14
26
|
import { logger } from '../utils/logger.js';
|
|
15
27
|
import { t } from '../i18n.js';
|
|
16
28
|
import chalk from 'chalk';
|
|
17
29
|
import ora from 'ora';
|
|
18
|
-
|
|
30
|
+
const WANGCHUAN_DIR = path.join(os.homedir(), '.wangchuan');
|
|
31
|
+
const SNAPSHOTS_DIR = path.join(WANGCHUAN_DIR, 'snapshots');
|
|
32
|
+
const MAX_AUTO_SNAPSHOTS = 5;
|
|
33
|
+
/** Create an auto-snapshot before pull (silent, no user output) */
|
|
34
|
+
function autoSnapshot(repoPath) {
|
|
35
|
+
try {
|
|
36
|
+
if (!fs.existsSync(repoPath))
|
|
37
|
+
return;
|
|
38
|
+
const snapshotName = `auto-${new Date().toISOString().replace(/[:.]/g, '-')}`;
|
|
39
|
+
const snapshotDir = path.join(SNAPSHOTS_DIR, snapshotName);
|
|
40
|
+
fs.mkdirSync(snapshotDir, { recursive: true });
|
|
41
|
+
copyDirSync(repoPath, snapshotDir);
|
|
42
|
+
pruneAutoSnapshots(MAX_AUTO_SNAPSHOTS);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Silent failure — snapshot is a safety net, not a blocker
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function pruneAutoSnapshots(max) {
|
|
49
|
+
if (!fs.existsSync(SNAPSHOTS_DIR))
|
|
50
|
+
return;
|
|
51
|
+
const autoDirs = fs.readdirSync(SNAPSHOTS_DIR)
|
|
52
|
+
.filter(d => d.startsWith('auto-') && fs.statSync(path.join(SNAPSHOTS_DIR, d)).isDirectory())
|
|
53
|
+
.sort();
|
|
54
|
+
if (autoDirs.length <= max)
|
|
55
|
+
return;
|
|
56
|
+
const toRemove = autoDirs.slice(0, autoDirs.length - max);
|
|
57
|
+
for (const dir of toRemove) {
|
|
58
|
+
fs.rmSync(path.join(SNAPSHOTS_DIR, dir), { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export async function cmdPull({ agent, dryRun, only, exclude } = {}) {
|
|
19
62
|
logger.banner(t('pull.banner'));
|
|
20
63
|
let cfg = config.load();
|
|
21
64
|
validator.requireInit(cfg);
|
|
22
65
|
cfg = ensureMigrated(cfg);
|
|
23
66
|
const repoPath = syncEngine.expandHome(cfg.localRepoPath);
|
|
67
|
+
const hostname = cfg.hostname || os.hostname();
|
|
24
68
|
if (agent)
|
|
25
|
-
logger.info(t('
|
|
69
|
+
logger.info(t('sync.filterAgent', { agent: chalk.cyan(agent) }));
|
|
26
70
|
if (only?.length)
|
|
27
71
|
logger.info(t('filter.only', { patterns: only.join(', ') }));
|
|
28
72
|
if (exclude?.length)
|
|
29
73
|
logger.info(t('filter.exclude', { patterns: exclude.join(', ') }));
|
|
74
|
+
if (dryRun)
|
|
75
|
+
logger.info(chalk.yellow(t('dryRun.enabled')));
|
|
30
76
|
const filter = (only?.length || exclude?.length) ? { only, exclude } : undefined;
|
|
31
|
-
//
|
|
77
|
+
// Auto-snapshot before pull (silent safety net)
|
|
78
|
+
autoSnapshot(repoPath);
|
|
79
|
+
// Acquire sync lock
|
|
32
80
|
await syncLock.acquire(repoPath);
|
|
33
81
|
try {
|
|
34
|
-
return await runPull(cfg, repoPath, agent, filter);
|
|
82
|
+
return await runPull(cfg, repoPath, hostname, agent, dryRun, filter);
|
|
35
83
|
}
|
|
36
84
|
finally {
|
|
37
85
|
syncLock.release();
|
|
38
86
|
}
|
|
39
87
|
}
|
|
40
|
-
async function runPull(cfg, repoPath, agent, filter) {
|
|
41
|
-
|
|
88
|
+
async function runPull(cfg, repoPath, hostname, agent, dryRun, filter) {
|
|
89
|
+
// 1. Fetch remote
|
|
90
|
+
let spinner = ora(t('sync.fetching')).start();
|
|
91
|
+
let remoteAhead = 0;
|
|
42
92
|
try {
|
|
43
|
-
await gitEngine.
|
|
44
|
-
|
|
93
|
+
remoteAhead = await gitEngine.fetchAndCheckRemoteAhead(repoPath, resolveGitBranch(cfg));
|
|
94
|
+
if (remoteAhead > 0) {
|
|
95
|
+
spinner.succeed(t('sync.remoteAhead', { count: remoteAhead }));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
spinner.succeed(t('sync.remoteUpToDate'));
|
|
99
|
+
}
|
|
45
100
|
}
|
|
46
101
|
catch (err) {
|
|
47
|
-
spinner.fail(t('
|
|
48
|
-
throw new Error(t('
|
|
102
|
+
spinner.fail(t('sync.fetchFailed'));
|
|
103
|
+
throw new Error(t('sync.fetchFailedDetail', { error: err.message }));
|
|
49
104
|
}
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
105
|
+
// 2. Git pull if remote ahead
|
|
106
|
+
if (remoteAhead > 0) {
|
|
107
|
+
spinner = ora(t('sync.pulling')).start();
|
|
108
|
+
try {
|
|
109
|
+
await gitEngine.pull(repoPath, resolveGitBranch(cfg));
|
|
110
|
+
spinner.succeed(t('sync.pulled'));
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
spinner.fail(t('sync.pullFailed'));
|
|
114
|
+
throw new Error(t('sync.pullFailedDetail', { error: err.message }));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// 3. Restore repo → local workspace
|
|
118
|
+
let pullResult;
|
|
53
119
|
try {
|
|
54
|
-
|
|
120
|
+
pullResult = await syncEngine.restoreFromRepo(cfg, agent, filter);
|
|
55
121
|
}
|
|
56
122
|
catch (err) {
|
|
57
|
-
throw new Error(t('
|
|
123
|
+
throw new Error(t('sync.restoreFailed', { error: err.message }));
|
|
58
124
|
}
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
console.log();
|
|
74
|
-
logger.warn(t('pull.localOnly', { count: result.localOnly.length }));
|
|
75
|
-
for (const f of result.localOnly) {
|
|
76
|
-
logger.warn(` ${chalk.yellow(f)}`);
|
|
125
|
+
// 4. Report results
|
|
126
|
+
if (dryRun) {
|
|
127
|
+
if (pullResult.synced.length > 0) {
|
|
128
|
+
console.log();
|
|
129
|
+
for (const f of pullResult.synced) {
|
|
130
|
+
logger.ok(` ${chalk.green(f)}`);
|
|
131
|
+
}
|
|
132
|
+
logger.ok('\n' + t('dryRun.wouldSync', {
|
|
133
|
+
count: pullResult.synced.length,
|
|
134
|
+
encrypted: pullResult.decrypted.length,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
logger.ok(t('sync.alreadyInSync'));
|
|
77
139
|
}
|
|
78
|
-
|
|
140
|
+
return pullResult;
|
|
141
|
+
}
|
|
142
|
+
if (pullResult.synced.length > 0) {
|
|
143
|
+
logger.ok(t('sync.pullSummary', {
|
|
144
|
+
count: pullResult.synced.length,
|
|
145
|
+
encrypted: pullResult.decrypted.length,
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
if (pullResult.skippedAgents.length > 0) {
|
|
149
|
+
logger.info(t('sync.skippedAgents', {
|
|
150
|
+
agents: pullResult.skippedAgents.join(', '),
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
// Summary
|
|
154
|
+
console.log();
|
|
155
|
+
if (pullResult.synced.length > 0) {
|
|
156
|
+
logger.ok(t('sync.summaryPull', { count: pullResult.synced.length }));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
logger.ok(t('sync.alreadyInSync'));
|
|
79
160
|
}
|
|
80
|
-
logger.ok('\n' + t('pull.summary', {
|
|
81
|
-
synced: result.synced.length,
|
|
82
|
-
encrypted: result.decrypted.length,
|
|
83
|
-
conflicts: result.conflicts.length,
|
|
84
|
-
}));
|
|
85
161
|
// Record sync history
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return
|
|
162
|
+
if (pullResult.synced.length > 0) {
|
|
163
|
+
appendSyncEvent({
|
|
164
|
+
timestamp: new Date().toISOString(),
|
|
165
|
+
action: 'pull',
|
|
166
|
+
environment: cfg.environment ?? 'default',
|
|
167
|
+
agent,
|
|
168
|
+
fileCount: pullResult.synced.length,
|
|
169
|
+
encrypted: pullResult.decrypted.length,
|
|
170
|
+
hostname,
|
|
171
|
+
});
|
|
172
|
+
await fireWebhooks(cfg, 'pull', buildWebhookPayload(cfg, 'pull', pullResult.synced.length, undefined));
|
|
173
|
+
runHooks('postPull', cfg);
|
|
174
|
+
}
|
|
175
|
+
return pullResult;
|
|
100
176
|
}
|
|
101
177
|
//# sourceMappingURL=pull.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAe,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAO,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAY,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAW,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAa,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAS,gBAAgB,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,CAAC,IAAI,CAAC;SAC5C,CAAC,CAAC,CAAC;IACN,CAAC;IAED,UAAU;IACV,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,sBAAsB;IACtB,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,eAAe,CAAC;YACd,SAAS,EAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,MAAM,EAAO,MAAM;YACnB,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,SAAS;YACzC,KAAK;YACL,SAAS,EAAI,UAAU,CAAC,MAAM,CAAC,MAAM;YACrC,SAAS,EAAI,UAAU,CAAC,SAAS,CAAC,MAAM;YACxC,QAAQ;SACT,CAAC,CAAC;QAEH,MAAM,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,CACjD,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CACjD,CAAC,CAAC;QAEH,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* push.ts — wangchuan push command
|
|
3
|
+
*
|
|
4
|
+
* Push-only operation: stage local changes to repo and push to remote.
|
|
5
|
+
*
|
|
6
|
+
* 1. Process pending distributions and deletions (if interactive)
|
|
7
|
+
* 2. stageToRepo (local → repo)
|
|
8
|
+
* 3. Detect stale files (local deleted = repo stale = prune)
|
|
9
|
+
* 4. commitAndPush
|
|
10
|
+
* 5. Report results
|
|
3
11
|
*/
|
|
4
|
-
import type { PushOptions,
|
|
5
|
-
export
|
|
6
|
-
readonly stageResult?: StageResult;
|
|
7
|
-
}
|
|
8
|
-
export declare function cmdPush({ message, agent, dryRun, only, exclude }?: PushOptions): Promise<PushCommandResult>;
|
|
12
|
+
import type { PushOptions, StageResult, CommitResult } from '../types.js';
|
|
13
|
+
export declare function cmdPush({ agent, dryRun, only, exclude, yes, skipStaleDetection }?: PushOptions): Promise<CommitResult & {
|
|
14
|
+
readonly stageResult?: StageResult | undefined;
|
|
15
|
+
}>;
|
|
9
16
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/commands/push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/commands/push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAiB,MAAM,aAAa,CAAC;AAkCzF,wBAAsB,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,GAAE,WAAgB,GAAG,OAAO,CAAC,YAAY,GAAG;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAAE,CAAC,CAoErL"}
|