@azizbekdevuz/schema 1.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.
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ // Conflict block extracted from a file
3
+ export const ConflictBlockSchema = z.object({
4
+ startLine: z.number(),
5
+ endLine: z.number(),
6
+ oursContent: z.string(),
7
+ theirsContent: z.string(),
8
+ context: z.string(), // surrounding lines for context
9
+ });
10
+ // Unmerged file with conflict details
11
+ export const UnmergedFileSchema = z.object({
12
+ path: z.string(),
13
+ stageOurs: z.string().optional(), // mode info
14
+ stageTheirs: z.string().optional(),
15
+ stageBase: z.string().optional(),
16
+ conflictBlocks: z.array(ConflictBlockSchema).max(3), // up to 3 blocks
17
+ });
18
+ // Branch info from porcelain v2
19
+ export const BranchInfoSchema = z.object({
20
+ head: z.string(), // branch name or "(detached)"
21
+ oid: z.string(), // current commit hash
22
+ upstream: z.string().optional(),
23
+ aheadBehind: z.object({
24
+ ahead: z.number(),
25
+ behind: z.number(),
26
+ }).optional(),
27
+ });
28
+ // Reflog entry
29
+ export const ReflogEntrySchema = z.object({
30
+ hash: z.string(),
31
+ selector: z.string(), // e.g., HEAD@{0}
32
+ action: z.string(),
33
+ message: z.string(),
34
+ });
35
+ // Log entry
36
+ export const LogEntrySchema = z.object({
37
+ hash: z.string(),
38
+ refs: z.array(z.string()), // decorations
39
+ message: z.string(),
40
+ });
41
+ // Rebase state info
42
+ export const RebaseStateSchema = z.object({
43
+ inProgress: z.boolean(),
44
+ type: z.enum(['merge', 'apply', 'none']),
45
+ headName: z.string().optional(), // original branch
46
+ onto: z.string().optional(),
47
+ currentStep: z.number().optional(),
48
+ totalSteps: z.number().optional(),
49
+ });
50
+ // Diff stat for a file
51
+ export const DiffStatSchema = z.object({
52
+ path: z.string(),
53
+ additions: z.number(),
54
+ deletions: z.number(),
55
+ binary: z.boolean().optional(),
56
+ });
57
+ // Main snapshot schema
58
+ export const SnapshotV1Schema = z.object({
59
+ version: z.literal(1),
60
+ timestamp: z.string().datetime(),
61
+ platform: z.enum(['win32', 'darwin', 'linux']),
62
+ repoRoot: z.string(),
63
+ gitDir: z.string(),
64
+ // Branch state
65
+ branch: BranchInfoSchema,
66
+ isDetachedHead: z.boolean(),
67
+ // Rebase state
68
+ rebaseState: RebaseStateSchema,
69
+ // Working tree status
70
+ unmergedFiles: z.array(UnmergedFileSchema).max(5), // increased for better conflict exploration
71
+ stagedFiles: z.array(z.string()),
72
+ modifiedFiles: z.array(z.string()),
73
+ untrackedFiles: z.array(z.string()),
74
+ // History
75
+ recentLog: z.array(LogEntrySchema).max(30),
76
+ recentReflog: z.array(ReflogEntrySchema).max(30),
77
+ // NEW: Commit graph for history visualization
78
+ commitGraph: z.string().optional(), // git log --graph --oneline output
79
+ // NEW: Diff stats for file-level summary
80
+ diffStats: z.array(DiffStatSchema).optional(),
81
+ // NEW: Merge metadata
82
+ mergeHead: z.string().optional(), // MERGE_HEAD commit if in merge
83
+ mergeMessage: z.string().optional(), // Default merge commit message
84
+ // Raw outputs for debugging
85
+ rawStatus: z.string(),
86
+ rawBranches: z.string(),
87
+ });
88
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,gCAAgC;CACtD,CAAC,CAAC;AAIH,sCAAsC;AACtC,MAAM,CAAC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0",
4
+ "description": "Shared Zod schemas for GitGuard Agent (SnapshotV1, PlanV1, etc.)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/**/*"
16
+ ],
17
+ "keywords": [
18
+ "git",
19
+ "schema",
20
+ "zod",
21
+ "gitguard"
22
+ ],
23
+ "author": "",
24
+ "license": "MIT",
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "typecheck": "tsc --noEmit",
28
+ "dev": "tsc --watch",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "dependencies": {
32
+ "zod": "^3.24.1"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "^5.7.2"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ }
40
+ }