Parse git status

From maslennikov-ig/claude-code-orchestrator-kit · View interactive version

Parse git status is an AI agent skill from the GitHub repository maslennikov-ig/claude-code-orchestrator-kit. Parse git status output into structured data showing staged, modified, and untracked files. Use for pre-flight validation, checking clean working directory, or listing changed files before commits.

How to use this skill

Skill file

Parse Git Status

Parse git status command output into structured JSON for programmatic analysis.

When to Use

Instructions

Step 1: Receive Git Status Output

Accept raw git status output as input.

Expected Input:

Step 2: Parse Branch Information

Extract current branch and tracking information.

Patterns:

Step 3: Categorize Files

Parse file status indicators and categorize.

Status Indicators (porcelain format):

Step 4: Return Structured Data

Return parsed data as JSON object.

Expected Output:

{
  "branch": "main",
  "tracking": "origin/main",
  "ahead": 0,
  "behind": 0,
  "staged": ["file1.ts", "file2.ts"],
  "modified": ["file3.ts"],
  "deleted": [],
  "renamed": [],
  "untracked": ["file4.ts"],
  "clean": false
}

Error Handling

Examples

Example 1: Clean Working Directory

Input:

On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

Output:

{
  "branch": "main",
  "tracking": "origin/main",
  "ahead": 0,
  "behind": 0,
  "staged": [],
  "modified": [],
  "deleted": [],
  "renamed": [],
  "untracked": [],
  "clean": true
}

Example 2: Modified Files

Input (porcelain format):

## main...origin/main [ahead 2]
M  src/utils.ts
 M src/types.ts
A  src/new-feature.ts
?? temp-file.js

Output:

{
  "branch": "main",
  "tracking": "origin/main",
  "ahead": 2,
  "behind": 0,
  "staged": ["src/utils.ts", "src/new-feature.ts"],
  "modified": ["src/types.ts"],
  "deleted": [],
  "renamed": [],
  "untracked": ["temp-file.js"],
  "clean": false
}

Example 3: Detached HEAD

Input:

## HEAD (no branch)
 M README.md

Output:

{
  "branch": "HEAD (detached)",
  "tracking": null,
  "ahead": 0,
  "behind": 0,
  "staged": [],
  "modified": ["README.md"],
  "deleted": [],
  "renamed": [],
  "untracked": [],
  "clean": false
}

Validation

Supporting Files

None required - pure parsing logic.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.