@@ -5,21 +5,51 @@ Automate GitHub issue workflow with project name as argument.
55## Usage
66
77```
8- /issue-work <project-name>
8+ /issue-work <project-name> [--org <organization>]
9+ /issue-work <organization>/<project-name>
910```
1011
1112** Example** :
1213```
13- /issue-work hospital_erp_system
14- /issue-work messaging_system
15- /issue-work thread_system
14+ /issue-work hospital_erp_system # Auto-detect org from git remote
15+ /issue-work hospital_erp_system --org mycompany # Explicit organization
16+ /issue-work mycompany/hospital_erp_system # Full repo path format
1617```
1718
1819## Arguments
1920
20- - ` $ARGUMENTS ` : Project name (required)
21- - Repository: ` https://github.com/kcenon/$ARGUMENTS `
22- - Source path: ` ./$ARGUMENTS `
21+ - ` $ARGUMENTS ` : Project name or full repository path (required)
22+ - Format 1: ` <project-name> ` - auto-detect organization from git remote
23+ - Format 2: ` <project-name> --org <organization> ` - explicit organization
24+ - Format 3: ` <organization>/<project-name> ` - full repository path
25+
26+ ## Organization Detection
27+
28+ Parse ` $ARGUMENTS ` and determine organization:
29+
30+ ``` bash
31+ # Check if --org flag is provided
32+ if [[ " $ARGUMENTS " == * " --org" * ]]; then
33+ PROJECT=$( echo " $ARGUMENTS " | awk ' {print $1}' )
34+ ORG=$( echo " $ARGUMENTS " | sed -n ' s/.*--org[[:space:]]*\([^[:space:]]*\).*/\1/p' )
35+ # Check if full path format (contains /)
36+ elif [[ " $ARGUMENTS " == * " /" * ]]; then
37+ ORG=$( echo " $ARGUMENTS " | cut -d' /' -f1)
38+ PROJECT=$( echo " $ARGUMENTS " | cut -d' /' -f2)
39+ # Auto-detect from git remote
40+ else
41+ PROJECT=" $ARGUMENTS "
42+ cd " $PROJECT " 2> /dev/null || { echo " Error: Project directory not found: $PROJECT " ; exit 1; }
43+ ORG=$( git remote get-url origin 2> /dev/null | sed -E ' s|.*[:/]([^/]+)/[^/]+\.git$|\1|' | sed -E ' s|.*[:/]([^/]+)/[^/]+$|\1|' )
44+ if [[ -z " $ORG " ]]; then
45+ echo " Error: Cannot detect organization. Use --org flag or full path format."
46+ exit 1
47+ fi
48+ fi
49+ ```
50+
51+ - Repository: ` https://github.com/$ORG/$PROJECT `
52+ - Source path: ` ./$PROJECT `
2353
2454## Instructions
2555
@@ -28,9 +58,9 @@ Execute the following workflow for the specified project:
2858### 1. Issue Selection
2959
3060``` bash
31- gh issue list --repo kcenon/ $ARGUMENTS --label " priority/critical" --state open --limit 1
61+ gh issue list --repo $ORG / $PROJECT --label " priority/critical" --state open --limit 1
3262# If none found:
33- gh issue list --repo kcenon/ $ARGUMENTS --label " priority/high" --state open --limit 1
63+ gh issue list --repo $ORG / $PROJECT --label " priority/high" --state open --limit 1
3464```
3565
3666Select the oldest (first created) issue from the results.
@@ -53,7 +83,7 @@ If splitting required:
5383### 3. Git Environment Setup
5484
5585``` bash
56- cd $ARGUMENTS
86+ cd $PROJECT
5787git fetch origin
5888git checkout main && git pull origin main
5989git checkout -b < type> /issue-< NUMBER> -< short-description>
@@ -68,7 +98,7 @@ Branch naming convention:
6898### 4. Issue Assignment
6999
70100``` bash
71- gh issue edit < NUMBER> --repo kcenon/ $ARGUMENTS --add-assignee @me
101+ gh issue edit < NUMBER> --repo $ORG / $PROJECT --add-assignee @me
72102```
73103
74104### 5. Code Implementation
@@ -122,7 +152,7 @@ docs(scope): update documentation for <feature>
122152``` bash
123153git push -u origin < branch-name>
124154
125- gh pr create --repo kcenon/ $ARGUMENTS \
155+ gh pr create --repo $ORG / $PROJECT \
126156 --title " type(scope): description" \
127157 --body " Closes #<ISSUE_NUMBER>
128158
@@ -141,7 +171,7 @@ gh pr create --repo kcenon/$ARGUMENTS \
141171### 9. Update Original Issue
142172
143173``` bash
144- gh issue comment < NUMBER> --repo kcenon/ $ARGUMENTS \
174+ gh issue comment < NUMBER> --repo $ORG / $PROJECT \
145175 --body " Implementation PR: #<PR_NUMBER>"
146176```
147177
@@ -164,7 +194,7 @@ After completion, provide summary:
164194
165195| Item | Value |
166196| ------| -------|
167- | Project | $ARGUMENTS |
197+ | Repository | $ORG/$PROJECT |
168198| Issue | #NUMBER - Title |
169199| Branch | branch-name |
170200| PR | #PR_NUMBER |
@@ -191,6 +221,7 @@ After completion, provide summary:
191221| gh CLI installed | "GitHub CLI is not installed" | Install from https://cli.github.com |
192222| gh authenticated | "Not authenticated with GitHub" | Run ` gh auth login ` |
193223| Project directory exists | "Project directory not found: [ path] " | Verify project path in configuration |
224+ | Organization detected | "Cannot detect organization" | Use ` --org ` flag or full path format |
194225
195226### Runtime Errors
196227
0 commit comments