-
Notifications
You must be signed in to change notification settings - Fork 345
Expand file tree
/
Copy pathbasic-usage.ts
More file actions
72 lines (58 loc) · 1.93 KB
/
basic-usage.ts
File metadata and controls
72 lines (58 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Agentic-Jujutsu Basic Usage Example
*
* Demonstrates fundamental operations:
* - Repository initialization
* - Creating commits
* - Branch management
* - Basic version control workflows
*/
// Note: This is a reference implementation for testing purposes
// Actual implementation would use: import { JjWrapper } from 'agentic-jujutsu';
interface JjWrapper {
status(): Promise<JjResult>;
newCommit(message: string): Promise<JjResult>;
log(limit: number): Promise<JjCommit[]>;
branchCreate(name: string, rev?: string): Promise<JjResult>;
diff(from: string, to: string): Promise<JjDiff>;
}
interface JjResult {
success: boolean;
stdout: string;
stderr: string;
}
interface JjCommit {
id: string;
message: string;
author: string;
timestamp: string;
}
interface JjDiff {
changes: string;
filesModified: number;
}
async function basicUsageExample() {
console.log('=== Agentic-Jujutsu Basic Usage ===\n');
// In actual usage:
// const { JjWrapper } = require('agentic-jujutsu');
// const jj = new JjWrapper();
console.log('1. Check repository status');
console.log(' const result = await jj.status();');
console.log(' Output: Working directory status\n');
console.log('2. Create a new commit');
console.log(' const commit = await jj.newCommit("Add new feature");');
console.log(' Output: Created commit with message\n');
console.log('3. View commit history');
console.log(' const log = await jj.log(10);');
console.log(' Output: Last 10 commits\n');
console.log('4. Create a branch');
console.log(' await jj.branchCreate("feature/new-feature");');
console.log(' Output: Created new branch\n');
console.log('5. View differences');
console.log(' const diff = await jj.diff("@", "@-");');
console.log(' Output: Changes between current and previous commit\n');
}
if (require.main === module) {
basicUsageExample().catch(console.error);
}
export { basicUsageExample };