@agent-workspace/cli 0.8.2 → 0.9.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/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +311 -8
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/schema.d.ts +27 -0
- package/dist/commands/schema.d.ts.map +1 -0
- package/dist/commands/schema.js +256 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/status.d.ts +4 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +130 -84
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts +34 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +238 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/task.d.ts.map +1 -1
- package/dist/commands/task.js +12 -6
- package/dist/commands/task.js.map +1 -1
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* awp status — rich workspace overview
|
|
3
|
+
* Supports --json flag for machine-readable output (agent-friendly)
|
|
3
4
|
*/
|
|
4
|
-
export declare function statusCommand(
|
|
5
|
+
export declare function statusCommand(options?: {
|
|
6
|
+
json?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
5
8
|
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmP/E"}
|
package/dist/commands/status.js
CHANGED
|
@@ -8,39 +8,50 @@ import { listContracts } from "../lib/contract.js";
|
|
|
8
8
|
import { listProjects, listTasks } from "../lib/project.js";
|
|
9
9
|
/**
|
|
10
10
|
* awp status — rich workspace overview
|
|
11
|
+
* Supports --json flag for machine-readable output (agent-friendly)
|
|
11
12
|
*/
|
|
12
|
-
export async function statusCommand() {
|
|
13
|
+
export async function statusCommand(options) {
|
|
13
14
|
const root = await requireWorkspaceRoot();
|
|
14
15
|
const info = await inspectWorkspace(root);
|
|
15
16
|
const now = new Date();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const jsonMode = options?.json ?? false;
|
|
18
|
+
// Initialize structured data
|
|
19
|
+
const statusData = {
|
|
20
|
+
workspace: {
|
|
21
|
+
name: info.manifest.name,
|
|
22
|
+
awp: AWP_VERSION,
|
|
23
|
+
did: info.manifest.agent.did,
|
|
24
|
+
root: info.root,
|
|
25
|
+
},
|
|
26
|
+
projects: [],
|
|
27
|
+
activeTasks: [],
|
|
28
|
+
reputation: [],
|
|
29
|
+
contracts: { total: 0, byStatus: {} },
|
|
30
|
+
knowledge: { artifactCount: 0, memoryLogCount: 0 },
|
|
31
|
+
health: { status: "healthy", warnings: [] },
|
|
32
|
+
};
|
|
33
|
+
// --- Collect Projects ---
|
|
22
34
|
const projects = await listProjects(root);
|
|
23
35
|
const activeProjects = projects.filter((p) => p.frontmatter.status === "active" || p.frontmatter.status === "paused");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//
|
|
36
|
-
const allTasks = [];
|
|
36
|
+
for (const p of activeProjects) {
|
|
37
|
+
const fm = p.frontmatter;
|
|
38
|
+
statusData.projects.push({
|
|
39
|
+
slug: fm.id.replace("project:", ""),
|
|
40
|
+
title: fm.title,
|
|
41
|
+
status: fm.status,
|
|
42
|
+
taskCount: fm.taskCount,
|
|
43
|
+
completedCount: fm.completedCount,
|
|
44
|
+
deadline: fm.deadline,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// --- Collect Active Tasks ---
|
|
37
48
|
for (const p of activeProjects) {
|
|
38
49
|
const pSlug = p.frontmatter.id.replace("project:", "");
|
|
39
50
|
const tasks = await listTasks(root, pSlug);
|
|
40
51
|
for (const t of tasks) {
|
|
41
52
|
const tfm = t.frontmatter;
|
|
42
53
|
if (tfm.status === "in-progress" || tfm.status === "blocked" || tfm.status === "review") {
|
|
43
|
-
|
|
54
|
+
statusData.activeTasks.push({
|
|
44
55
|
projectSlug: pSlug,
|
|
45
56
|
taskSlug: tfm.id.split("/")[1],
|
|
46
57
|
status: tfm.status,
|
|
@@ -51,80 +62,50 @@ export async function statusCommand() {
|
|
|
51
62
|
}
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
|
-
|
|
55
|
-
console.log("");
|
|
56
|
-
console.log("--- Active Tasks ---");
|
|
57
|
-
for (const t of allTasks) {
|
|
58
|
-
const assignee = t.assigneeSlug ? `@${t.assigneeSlug}` : "unassigned";
|
|
59
|
-
const due = t.deadline ? `due ${t.deadline.split("T")[0]}` : "";
|
|
60
|
-
const blocked = t.status === "blocked" && t.blockedBy.length > 0
|
|
61
|
-
? `blocked by: ${t.blockedBy.map((b) => b.split("/").pop()).join(", ")}`
|
|
62
|
-
: "";
|
|
63
|
-
const extra = blocked || due;
|
|
64
|
-
console.log(` ${t.taskSlug.padEnd(24)} ${t.status.toUpperCase().padEnd(14)} ${assignee.padEnd(20)} ${extra}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Reputation
|
|
65
|
+
// --- Collect Reputation ---
|
|
68
66
|
const profiles = await listProfiles(root);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const parts = [];
|
|
76
|
-
// Top dimension scores
|
|
77
|
-
for (const [name, dim] of Object.entries(fm.dimensions || {})) {
|
|
78
|
-
const decayed = computeDecayedScore(dim, now);
|
|
79
|
-
parts.push(`${name}: ${decayed.toFixed(2)}`);
|
|
80
|
-
}
|
|
81
|
-
for (const [name, dim] of Object.entries(fm.domainCompetence || {})) {
|
|
82
|
-
const decayed = computeDecayedScore(dim, now);
|
|
83
|
-
parts.push(`${name}: ${decayed.toFixed(2)}`);
|
|
84
|
-
}
|
|
85
|
-
console.log(` ${slug.padEnd(20)} ${parts.join(" ")}`);
|
|
67
|
+
for (const p of profiles) {
|
|
68
|
+
const fm = p.frontmatter;
|
|
69
|
+
const dimensions = {};
|
|
70
|
+
const domainCompetence = {};
|
|
71
|
+
for (const [name, dim] of Object.entries(fm.dimensions || {})) {
|
|
72
|
+
dimensions[name] = computeDecayedScore(dim, now);
|
|
86
73
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const contracts = await listContracts(root);
|
|
90
|
-
if (contracts.length > 0) {
|
|
91
|
-
const statusCounts = {};
|
|
92
|
-
for (const c of contracts) {
|
|
93
|
-
const s = c.frontmatter.status;
|
|
94
|
-
statusCounts[s] = (statusCounts[s] || 0) + 1;
|
|
74
|
+
for (const [name, dim] of Object.entries(fm.domainCompetence || {})) {
|
|
75
|
+
domainCompetence[name] = computeDecayedScore(dim, now);
|
|
95
76
|
}
|
|
96
|
-
|
|
97
|
-
.
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
statusData.reputation.push({
|
|
78
|
+
slug: fm.id.replace("reputation:", ""),
|
|
79
|
+
agentName: fm.agentName,
|
|
80
|
+
dimensions,
|
|
81
|
+
domainCompetence,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// --- Collect Contracts ---
|
|
85
|
+
const contracts = await listContracts(root);
|
|
86
|
+
statusData.contracts.total = contracts.length;
|
|
87
|
+
for (const c of contracts) {
|
|
88
|
+
const s = c.frontmatter.status;
|
|
89
|
+
statusData.contracts.byStatus[s] = (statusData.contracts.byStatus[s] || 0) + 1;
|
|
102
90
|
}
|
|
103
|
-
// Knowledge
|
|
104
|
-
let artifactCount = 0;
|
|
91
|
+
// --- Collect Knowledge ---
|
|
105
92
|
try {
|
|
106
93
|
const artDir = join(root, ARTIFACTS_DIR);
|
|
107
94
|
const files = await readdir(artDir);
|
|
108
|
-
artifactCount = files.filter((f) => f.endsWith(".md")).length;
|
|
95
|
+
statusData.knowledge.artifactCount = files.filter((f) => f.endsWith(".md")).length;
|
|
109
96
|
}
|
|
110
97
|
catch {
|
|
111
98
|
// no artifacts dir
|
|
112
99
|
}
|
|
113
|
-
let memoryCount = 0;
|
|
114
100
|
try {
|
|
115
101
|
const memDir = join(root, MEMORY_DIR);
|
|
116
102
|
const files = await readdir(memDir);
|
|
117
|
-
|
|
103
|
+
statusData.knowledge.memoryLogCount = files.filter((f) => f.endsWith(".md")).length;
|
|
118
104
|
}
|
|
119
105
|
catch {
|
|
120
106
|
// no memory dir
|
|
121
107
|
}
|
|
122
|
-
|
|
123
|
-
console.log("");
|
|
124
|
-
console.log("--- Knowledge ---");
|
|
125
|
-
console.log(` ${artifactCount} artifact(s), ${memoryCount} memory log(s)`);
|
|
126
|
-
}
|
|
127
|
-
// Health checks
|
|
108
|
+
// --- Health Checks ---
|
|
128
109
|
const warnings = [];
|
|
129
110
|
// Check required files
|
|
130
111
|
const allRequired = info.files.required.every((f) => f.exists && f.valid);
|
|
@@ -154,24 +135,89 @@ export async function statusCommand() {
|
|
|
154
135
|
}
|
|
155
136
|
}
|
|
156
137
|
// Check task deadlines
|
|
157
|
-
for (const t of
|
|
158
|
-
if (t.deadline &&
|
|
159
|
-
t.status !== "completed" &&
|
|
160
|
-
t.status !== "cancelled" &&
|
|
161
|
-
new Date(t.deadline) < now) {
|
|
138
|
+
for (const t of statusData.activeTasks) {
|
|
139
|
+
if (t.deadline && t.status !== "completed" && new Date(t.deadline) < now) {
|
|
162
140
|
warnings.push(`Task "${t.taskSlug}" is past deadline`);
|
|
163
141
|
}
|
|
164
142
|
}
|
|
143
|
+
statusData.health.warnings = warnings;
|
|
144
|
+
statusData.health.status = warnings.length === 0 ? "healthy" : "warnings";
|
|
145
|
+
// --- Output ---
|
|
146
|
+
if (jsonMode) {
|
|
147
|
+
console.log(JSON.stringify(statusData, null, 2));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// Human-readable output
|
|
151
|
+
console.log(`AWP Workspace: ${statusData.workspace.name} (v${statusData.workspace.awp})`);
|
|
152
|
+
if (statusData.workspace.did) {
|
|
153
|
+
console.log(`DID: ${statusData.workspace.did}`);
|
|
154
|
+
}
|
|
155
|
+
console.log(`Root: ${statusData.workspace.root}`);
|
|
156
|
+
// Projects
|
|
157
|
+
if (statusData.projects.length > 0) {
|
|
158
|
+
console.log("");
|
|
159
|
+
console.log("--- Projects ---");
|
|
160
|
+
for (const p of statusData.projects) {
|
|
161
|
+
const tasks = `${p.completedCount}/${p.taskCount} tasks`;
|
|
162
|
+
const deadline = p.deadline ? `deadline: ${p.deadline.split("T")[0]}` : "";
|
|
163
|
+
console.log(` ${p.slug.padEnd(24)} ${p.status.toUpperCase().padEnd(10)} ${tasks.padEnd(14)} ${deadline}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Active tasks
|
|
167
|
+
if (statusData.activeTasks.length > 0) {
|
|
168
|
+
console.log("");
|
|
169
|
+
console.log("--- Active Tasks ---");
|
|
170
|
+
for (const t of statusData.activeTasks) {
|
|
171
|
+
const assignee = t.assigneeSlug ? `@${t.assigneeSlug}` : "unassigned";
|
|
172
|
+
const due = t.deadline ? `due ${t.deadline.split("T")[0]}` : "";
|
|
173
|
+
const blocked = t.status === "blocked" && t.blockedBy.length > 0
|
|
174
|
+
? `blocked by: ${t.blockedBy.map((b) => b.split("/").pop()).join(", ")}`
|
|
175
|
+
: "";
|
|
176
|
+
const extra = blocked || due;
|
|
177
|
+
console.log(` ${t.taskSlug.padEnd(24)} ${t.status.toUpperCase().padEnd(14)} ${assignee.padEnd(20)} ${extra}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Reputation
|
|
181
|
+
if (statusData.reputation.length > 0) {
|
|
182
|
+
console.log("");
|
|
183
|
+
console.log("--- Reputation ---");
|
|
184
|
+
for (const r of statusData.reputation) {
|
|
185
|
+
const parts = [];
|
|
186
|
+
for (const [name, score] of Object.entries(r.dimensions)) {
|
|
187
|
+
parts.push(`${name}: ${score.toFixed(2)}`);
|
|
188
|
+
}
|
|
189
|
+
for (const [name, score] of Object.entries(r.domainCompetence)) {
|
|
190
|
+
parts.push(`${name}: ${score.toFixed(2)}`);
|
|
191
|
+
}
|
|
192
|
+
console.log(` ${r.slug.padEnd(20)} ${parts.join(" ")}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Contracts
|
|
196
|
+
if (statusData.contracts.total > 0) {
|
|
197
|
+
const summary = Object.entries(statusData.contracts.byStatus)
|
|
198
|
+
.map(([s, n]) => `${n} ${s}`)
|
|
199
|
+
.join(", ");
|
|
200
|
+
console.log("");
|
|
201
|
+
console.log("--- Contracts ---");
|
|
202
|
+
console.log(` ${summary}`);
|
|
203
|
+
}
|
|
204
|
+
// Knowledge
|
|
205
|
+
if (statusData.knowledge.artifactCount > 0 || statusData.knowledge.memoryLogCount > 0) {
|
|
206
|
+
console.log("");
|
|
207
|
+
console.log("--- Knowledge ---");
|
|
208
|
+
console.log(` ${statusData.knowledge.artifactCount} artifact(s), ${statusData.knowledge.memoryLogCount} memory log(s)`);
|
|
209
|
+
}
|
|
210
|
+
// Health
|
|
165
211
|
console.log("");
|
|
166
212
|
console.log("--- Health ---");
|
|
167
|
-
if (
|
|
213
|
+
if (statusData.health.status === "healthy") {
|
|
168
214
|
console.log(" [PASS] All systems nominal");
|
|
169
215
|
}
|
|
170
216
|
else {
|
|
171
217
|
if (allRequired) {
|
|
172
218
|
console.log(" [PASS] All required files present");
|
|
173
219
|
}
|
|
174
|
-
for (const w of warnings) {
|
|
220
|
+
for (const w of statusData.health.warnings) {
|
|
175
221
|
console.log(` [WARN] ${w}`);
|
|
176
222
|
}
|
|
177
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC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AAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* awp sync — Workspace synchronization commands.
|
|
3
|
+
*
|
|
4
|
+
* Manages remote workspaces, pulls/pushes artifacts and reputation
|
|
5
|
+
* signals between AWP workspaces.
|
|
6
|
+
*/
|
|
7
|
+
export declare function syncRemoteAddCommand(name: string, url: string, options: {
|
|
8
|
+
transport?: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function syncRemoteListCommand(): Promise<void>;
|
|
11
|
+
export declare function syncRemoteRemoveCommand(name: string): Promise<void>;
|
|
12
|
+
export declare function syncPullCommand(remote: string, options: {
|
|
13
|
+
slug?: string;
|
|
14
|
+
tag?: string;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
noAutoMerge?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
export declare function syncPushCommand(remote: string, options: {
|
|
19
|
+
slug?: string;
|
|
20
|
+
dryRun?: boolean;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare function syncDiffCommand(remote: string, options: {
|
|
23
|
+
direction?: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
export declare function syncStatusCommand(remoteName?: string): Promise<void>;
|
|
26
|
+
export declare function syncPullSignalsCommand(remote: string, options: {
|
|
27
|
+
since?: string;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
export declare function syncPushSignalsCommand(remote: string): Promise<void>;
|
|
30
|
+
export declare function syncConflictsCommand(): Promise<void>;
|
|
31
|
+
export declare function syncResolveCommand(slug: string, options: {
|
|
32
|
+
accept?: string;
|
|
33
|
+
}): Promise<void>;
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GAC1B,OAAO,CAAC,IAAI,CAAC,CAWf;AAID,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW1E;AAID,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAmB1D;AAID,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* awp sync — Workspace synchronization commands.
|
|
3
|
+
*
|
|
4
|
+
* Manages remote workspaces, pulls/pushes artifacts and reputation
|
|
5
|
+
* signals between AWP workspaces.
|
|
6
|
+
*/
|
|
7
|
+
import { SyncEngine, addRemote, removeRemote, listRemotes, loadSyncState, listConflicts, resolveConflict, } from "@agent-workspace/sync";
|
|
8
|
+
import { requireWorkspaceRoot } from "../lib/cli-utils.js";
|
|
9
|
+
// --- awp sync remote add ---
|
|
10
|
+
export async function syncRemoteAddCommand(name, url, options) {
|
|
11
|
+
const root = await requireWorkspaceRoot();
|
|
12
|
+
const transport = (options.transport || "local-fs");
|
|
13
|
+
if (transport !== "local-fs" && transport !== "git-remote") {
|
|
14
|
+
console.error(`Error: Unknown transport "${transport}". Valid: local-fs, git-remote`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
await addRemote(root, name, { url, transport });
|
|
19
|
+
console.log(`Remote "${name}" added (${transport}: ${url})`);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
console.error(`Error: ${err.message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// --- awp sync remote list ---
|
|
27
|
+
export async function syncRemoteListCommand() {
|
|
28
|
+
const root = await requireWorkspaceRoot();
|
|
29
|
+
const remotes = await listRemotes(root);
|
|
30
|
+
if (Object.keys(remotes).length === 0) {
|
|
31
|
+
console.log("No remotes configured. Use 'awp sync remote add <name> <url>' to add one.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
for (const [name, remote] of Object.entries(remotes)) {
|
|
35
|
+
const lastSync = remote.lastSync ? new Date(remote.lastSync).toLocaleString() : "never";
|
|
36
|
+
console.log(` ${name}\t${remote.transport}\t${remote.url}\t(last sync: ${lastSync})`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// --- awp sync remote remove ---
|
|
40
|
+
export async function syncRemoteRemoveCommand(name) {
|
|
41
|
+
const root = await requireWorkspaceRoot();
|
|
42
|
+
try {
|
|
43
|
+
await removeRemote(root, name);
|
|
44
|
+
console.log(`Remote "${name}" removed.`);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.error(`Error: ${err.message}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// --- awp sync pull ---
|
|
52
|
+
export async function syncPullCommand(remote, options) {
|
|
53
|
+
const root = await requireWorkspaceRoot();
|
|
54
|
+
const engine = new SyncEngine(root);
|
|
55
|
+
const syncOptions = {
|
|
56
|
+
slugPattern: options.slug,
|
|
57
|
+
tag: options.tag,
|
|
58
|
+
dryRun: options.dryRun,
|
|
59
|
+
noAutoMerge: options.noAutoMerge,
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
const result = await engine.pull(remote, syncOptions);
|
|
63
|
+
if (options.dryRun) {
|
|
64
|
+
console.log("Dry run — no changes applied:\n");
|
|
65
|
+
}
|
|
66
|
+
if (result.imported.length > 0) {
|
|
67
|
+
console.log(` Imported: ${result.imported.join(", ")}`);
|
|
68
|
+
}
|
|
69
|
+
if (result.updated.length > 0) {
|
|
70
|
+
console.log(` Updated: ${result.updated.join(", ")}`);
|
|
71
|
+
}
|
|
72
|
+
if (result.conflicts.length > 0) {
|
|
73
|
+
console.log(` Conflicts: ${result.conflicts.join(", ")}`);
|
|
74
|
+
}
|
|
75
|
+
if (result.skipped.length > 0) {
|
|
76
|
+
console.log(` Skipped: ${result.skipped.join(", ")}`);
|
|
77
|
+
}
|
|
78
|
+
const total = result.imported.length + result.updated.length;
|
|
79
|
+
if (total === 0 && result.conflicts.length === 0) {
|
|
80
|
+
console.log("Already up to date.");
|
|
81
|
+
}
|
|
82
|
+
else if (!options.dryRun) {
|
|
83
|
+
console.log(`\nPulled ${total} artifact(s) from "${remote}".`);
|
|
84
|
+
if (result.conflicts.length > 0) {
|
|
85
|
+
console.log(`${result.conflicts.length} conflict(s) — use 'awp sync conflicts' to review.`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
console.error(`Error: ${err.message}`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// --- awp sync push ---
|
|
95
|
+
export async function syncPushCommand(remote, options) {
|
|
96
|
+
const root = await requireWorkspaceRoot();
|
|
97
|
+
const engine = new SyncEngine(root);
|
|
98
|
+
const syncOptions = {
|
|
99
|
+
slugPattern: options.slug,
|
|
100
|
+
dryRun: options.dryRun,
|
|
101
|
+
};
|
|
102
|
+
try {
|
|
103
|
+
const result = await engine.push(remote, syncOptions);
|
|
104
|
+
if (options.dryRun) {
|
|
105
|
+
console.log("Dry run — no changes applied:\n");
|
|
106
|
+
}
|
|
107
|
+
if (result.updated.length > 0) {
|
|
108
|
+
console.log(` Pushed: ${result.updated.join(", ")}`);
|
|
109
|
+
}
|
|
110
|
+
if (result.conflicts.length > 0) {
|
|
111
|
+
console.log(` Conflicts: ${result.conflicts.join(", ")}`);
|
|
112
|
+
}
|
|
113
|
+
if (result.skipped.length > 0) {
|
|
114
|
+
console.log(` Skipped: ${result.skipped.join(", ")}`);
|
|
115
|
+
}
|
|
116
|
+
if (result.updated.length === 0 && result.conflicts.length === 0) {
|
|
117
|
+
console.log("Nothing to push.");
|
|
118
|
+
}
|
|
119
|
+
else if (!options.dryRun) {
|
|
120
|
+
console.log(`\nPushed ${result.updated.length} artifact(s) to "${remote}".`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
console.error(`Error: ${err.message}`);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// --- awp sync diff ---
|
|
129
|
+
export async function syncDiffCommand(remote, options) {
|
|
130
|
+
const root = await requireWorkspaceRoot();
|
|
131
|
+
const engine = new SyncEngine(root);
|
|
132
|
+
const direction = (options.direction || "pull");
|
|
133
|
+
try {
|
|
134
|
+
const entries = await engine.diff(remote, direction);
|
|
135
|
+
if (entries.length === 0) {
|
|
136
|
+
console.log(`No differences with "${remote}" (${direction}).`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
for (const entry of entries) {
|
|
140
|
+
const versions = `v${entry.localVersion ?? "?"} → v${entry.remoteVersion ?? "?"}`;
|
|
141
|
+
console.log(` ${entry.action.padEnd(14)} ${entry.slug.padEnd(30)} ${versions}`);
|
|
142
|
+
}
|
|
143
|
+
console.log(`\n${entries.length} difference(s).`);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
console.error(`Error: ${err.message}`);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// --- awp sync status ---
|
|
151
|
+
export async function syncStatusCommand(remoteName) {
|
|
152
|
+
const root = await requireWorkspaceRoot();
|
|
153
|
+
const remotes = await listRemotes(root);
|
|
154
|
+
if (Object.keys(remotes).length === 0) {
|
|
155
|
+
console.log("No remotes configured.");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const names = remoteName ? [remoteName] : Object.keys(remotes);
|
|
159
|
+
for (const name of names) {
|
|
160
|
+
const remote = remotes[name];
|
|
161
|
+
if (!remote) {
|
|
162
|
+
console.error(`Remote "${name}" not found.`);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const state = await loadSyncState(root, name);
|
|
166
|
+
const artifactCount = Object.keys(state.artifacts).length;
|
|
167
|
+
const lastSync = state.lastSync ? new Date(state.lastSync).toLocaleString() : "never";
|
|
168
|
+
console.log(`Remote: ${name}`);
|
|
169
|
+
console.log(` URL: ${remote.url}`);
|
|
170
|
+
console.log(` Transport: ${remote.transport}`);
|
|
171
|
+
console.log(` Last sync: ${lastSync}`);
|
|
172
|
+
console.log(` Artifacts: ${artifactCount} tracked`);
|
|
173
|
+
console.log(` Signals: ${state.signals.signalCount} synced`);
|
|
174
|
+
console.log();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// --- awp sync pull-signals ---
|
|
178
|
+
export async function syncPullSignalsCommand(remote, options) {
|
|
179
|
+
const root = await requireWorkspaceRoot();
|
|
180
|
+
const engine = new SyncEngine(root);
|
|
181
|
+
try {
|
|
182
|
+
const imported = await engine.pullSignals(remote, options.since);
|
|
183
|
+
console.log(`Imported ${imported} reputation signal(s) from "${remote}".`);
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
console.error(`Error: ${err.message}`);
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// --- awp sync push-signals ---
|
|
191
|
+
export async function syncPushSignalsCommand(remote) {
|
|
192
|
+
const root = await requireWorkspaceRoot();
|
|
193
|
+
const engine = new SyncEngine(root);
|
|
194
|
+
try {
|
|
195
|
+
const pushed = await engine.pushSignals(remote);
|
|
196
|
+
console.log(`Pushed ${pushed} reputation signal(s) to "${remote}".`);
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
console.error(`Error: ${err.message}`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// --- awp sync conflicts ---
|
|
204
|
+
export async function syncConflictsCommand() {
|
|
205
|
+
const root = await requireWorkspaceRoot();
|
|
206
|
+
const conflicts = await listConflicts(root);
|
|
207
|
+
if (conflicts.length === 0) {
|
|
208
|
+
console.log("No pending conflicts.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
for (const c of conflicts) {
|
|
212
|
+
console.log(` ${c.artifact}`);
|
|
213
|
+
console.log(` Remote: ${c.remote}`);
|
|
214
|
+
console.log(` Local: v${c.localVersion} Remote: v${c.remoteVersion}`);
|
|
215
|
+
console.log(` Detected: ${new Date(c.detectedAt).toLocaleString()}`);
|
|
216
|
+
console.log(` Reason: ${c.reason}`);
|
|
217
|
+
console.log();
|
|
218
|
+
}
|
|
219
|
+
console.log(`${conflicts.length} conflict(s). Use 'awp sync resolve <slug> --accept <mode>' to resolve.`);
|
|
220
|
+
}
|
|
221
|
+
// --- awp sync resolve ---
|
|
222
|
+
export async function syncResolveCommand(slug, options) {
|
|
223
|
+
const root = await requireWorkspaceRoot();
|
|
224
|
+
const mode = (options.accept || "local");
|
|
225
|
+
if (!["local", "remote", "merged"].includes(mode)) {
|
|
226
|
+
console.error(`Error: Invalid mode "${mode}". Valid: local, remote, merged`);
|
|
227
|
+
process.exit(1);
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
await resolveConflict(root, slug, mode);
|
|
231
|
+
console.log(`Conflict for "${slug}" resolved (${mode}).`);
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
console.error(`Error: ${err.message}`);
|
|
235
|
+
process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=sync.js.map
|