brn-toolkit 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.
- package/GEMINI.md +92 -0
- package/README.md +145 -0
- package/cli/brn.ts +301 -0
- package/dist/cli/brn.js +274 -0
- package/dist/lib/utils.js +167 -0
- package/dist/skills/github/scripts/create_pr.js +24 -0
- package/dist/skills/github/scripts/get_repo_info.js +23 -0
- package/dist/skills/github/scripts/list_prs.js +27 -0
- package/dist/skills/github/scripts/list_repos.js +39 -0
- package/dist/skills/jira/scripts/add_comment.js +36 -0
- package/dist/skills/jira/scripts/get_ticket.js +45 -0
- package/dist/skills/jira/scripts/list_tickets.js +42 -0
- package/dist/skills/jira/scripts/update_ticket.js +30 -0
- package/dist/skills/workflow/scripts/start.js +75 -0
- package/dist/skills/workspace-manager/scripts/configure_workspace.js +59 -0
- package/dist/skills/workspace-manager/scripts/create_workspace.js +60 -0
- package/lib/utils.ts +236 -0
- package/package.json +46 -0
- package/skills/git-worktree/SKILL.md +49 -0
- package/skills/git-worktree/scripts/clone_repo.sh +53 -0
- package/skills/git-worktree/scripts/create_worktree.sh +66 -0
- package/skills/git-worktree/scripts/list_worktrees.sh +39 -0
- package/skills/git-worktree/scripts/remove_worktree.sh +47 -0
- package/skills/github/SKILL.md +51 -0
- package/skills/github/references/api_patterns.md +36 -0
- package/skills/github/scripts/create_pr.ts +38 -0
- package/skills/github/scripts/get_repo_info.ts +39 -0
- package/skills/github/scripts/list_prs.ts +45 -0
- package/skills/github/scripts/list_repos.ts +54 -0
- package/skills/jira/SKILL.md +50 -0
- package/skills/jira/references/api_patterns.md +59 -0
- package/skills/jira/scripts/add_comment.ts +41 -0
- package/skills/jira/scripts/get_ticket.ts +71 -0
- package/skills/jira/scripts/list_tickets.ts +64 -0
- package/skills/jira/scripts/update_ticket.ts +50 -0
- package/skills/workflow/SKILL.md +94 -0
- package/skills/workflow/references/coding_workflow.md +88 -0
- package/skills/workflow/references/planning_workflow.md +96 -0
- package/skills/workflow/references/review_workflow.md +104 -0
- package/skills/workflow/scripts/start.ts +93 -0
- package/skills/workspace-manager/SKILL.md +49 -0
- package/skills/workspace-manager/scripts/configure_workspace.sh +87 -0
- package/skills/workspace-manager/scripts/configure_workspace.ts +70 -0
- package/skills/workspace-manager/scripts/create_workspace.sh +66 -0
- package/skills/workspace-manager/scripts/create_workspace.ts +74 -0
- package/skills/workspace-manager/scripts/get_active_workspace.sh +24 -0
- package/skills/workspace-manager/scripts/list_workspaces.sh +31 -0
- package/skills/workspace-manager/scripts/switch_workspace.sh +38 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Create a new workspace in ~/.brn/config.yaml
|
|
3
|
+
# Usage: create_workspace.sh <name> <work_dir>
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
WORKSPACE_NAME="$1"
|
|
8
|
+
WORK_DIR="$2"
|
|
9
|
+
|
|
10
|
+
if [ -z "$WORKSPACE_NAME" ] || [ -z "$WORK_DIR" ]; then
|
|
11
|
+
echo "Usage: create_workspace.sh <name> <work_dir>"
|
|
12
|
+
echo "Example: create_workspace.sh personal ~/dev/personal/auto"
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
CONFIG_DIR="$HOME/.brn"
|
|
17
|
+
CONFIG_FILE="$CONFIG_DIR/config.yaml"
|
|
18
|
+
|
|
19
|
+
# Create config directory if it doesn't exist
|
|
20
|
+
mkdir -p "$CONFIG_DIR"
|
|
21
|
+
|
|
22
|
+
# Expand work_dir path
|
|
23
|
+
WORK_DIR="${WORK_DIR/#\~/$HOME}"
|
|
24
|
+
|
|
25
|
+
# Create initial config if it doesn't exist
|
|
26
|
+
if [ ! -f "$CONFIG_FILE" ]; then
|
|
27
|
+
cat > "$CONFIG_FILE" << EOF
|
|
28
|
+
version: "1.0"
|
|
29
|
+
active_workspace: $WORKSPACE_NAME
|
|
30
|
+
workspaces: {}
|
|
31
|
+
EOF
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Check if yq is available, if not use a simple approach
|
|
35
|
+
if command -v yq &> /dev/null; then
|
|
36
|
+
# Check if workspace already exists
|
|
37
|
+
if yq -e ".workspaces.$WORKSPACE_NAME" "$CONFIG_FILE" &> /dev/null; then
|
|
38
|
+
echo "Error: Workspace '$WORKSPACE_NAME' already exists"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Add the workspace
|
|
43
|
+
yq -i ".workspaces.$WORKSPACE_NAME = {
|
|
44
|
+
\"path\": \"$WORK_DIR\",
|
|
45
|
+
\"github_token\": null,
|
|
46
|
+
\"jira_token\": null,
|
|
47
|
+
\"jira_url\": null
|
|
48
|
+
}" "$CONFIG_FILE"
|
|
49
|
+
else
|
|
50
|
+
echo "Warning: yq not found. Please install yq for YAML manipulation."
|
|
51
|
+
echo "Attempting basic file append..."
|
|
52
|
+
|
|
53
|
+
# Basic approach: append to file (user may need to clean up formatting)
|
|
54
|
+
cat >> "$CONFIG_FILE" << EOF
|
|
55
|
+
$WORKSPACE_NAME:
|
|
56
|
+
path: $WORK_DIR
|
|
57
|
+
github_token: null
|
|
58
|
+
jira_token: null
|
|
59
|
+
jira_url: null
|
|
60
|
+
EOF
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Create the work directory
|
|
64
|
+
mkdir -p "$WORK_DIR"
|
|
65
|
+
|
|
66
|
+
echo "✓ Created workspace '$WORKSPACE_NAME' at $WORK_DIR"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* Create a new workspace
|
|
4
|
+
* Usage: npx tsx create_workspace.ts <name> <work_dir>
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync } from "fs";
|
|
7
|
+
import { join } from "path";
|
|
8
|
+
import { homedir } from "os";
|
|
9
|
+
import YAML from "yaml";
|
|
10
|
+
import { saveBrnConfig } from "../../../lib/utils.js";
|
|
11
|
+
|
|
12
|
+
const workspaceName = process.argv[2];
|
|
13
|
+
let workDir = process.argv[3];
|
|
14
|
+
|
|
15
|
+
if (!workspaceName || !workDir) {
|
|
16
|
+
console.log("Usage: create_workspace.ts <name> <work_dir>");
|
|
17
|
+
console.log("Example: create_workspace.ts personal ~/dev/personal/auto");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const configPath = join(homedir(), ".brn", "config.yaml");
|
|
22
|
+
const configDir = join(homedir(), ".brn");
|
|
23
|
+
|
|
24
|
+
// Create config directory if it doesn't exist
|
|
25
|
+
if (!existsSync(configDir)) {
|
|
26
|
+
mkdirSync(configDir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Expand work_dir path
|
|
30
|
+
if (workDir.startsWith("~")) {
|
|
31
|
+
workDir = join(homedir(), workDir.slice(1));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let config: any = {
|
|
35
|
+
version: "1.0",
|
|
36
|
+
active_workspace: workspaceName,
|
|
37
|
+
workspaces: {}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (existsSync(configPath)) {
|
|
41
|
+
const content = readFileSync(configPath, "utf-8");
|
|
42
|
+
config = YAML.parse(content);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Check if workspace already exists
|
|
46
|
+
if (config.workspaces && config.workspaces[workspaceName]) {
|
|
47
|
+
console.error(`Error: Workspace '${workspaceName}' already exists`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!config.workspaces) {
|
|
52
|
+
config.workspaces = {};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
config.workspaces[workspaceName] = {
|
|
56
|
+
path: workDir,
|
|
57
|
+
github_token: null,
|
|
58
|
+
jira_token: null,
|
|
59
|
+
jira_url: null
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// If no active workspace, set this one
|
|
63
|
+
if (!config.active_workspace) {
|
|
64
|
+
config.active_workspace = workspaceName;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
saveBrnConfig(config);
|
|
68
|
+
|
|
69
|
+
// Create the work directory
|
|
70
|
+
if (!existsSync(workDir)) {
|
|
71
|
+
mkdirSync(workDir, { recursive: true });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log(`✓ Created workspace '${workspaceName}' at ${workDir}`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Get the active workspace name and config
|
|
3
|
+
# Usage: get_active_workspace.sh [--json]
|
|
4
|
+
|
|
5
|
+
CONFIG_FILE="$HOME/.brn/config.yaml"
|
|
6
|
+
|
|
7
|
+
if [ ! -f "$CONFIG_FILE" ]; then
|
|
8
|
+
echo "Error: No config found at $CONFIG_FILE"
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if command -v yq &> /dev/null; then
|
|
13
|
+
ACTIVE=$(yq '.active_workspace' "$CONFIG_FILE")
|
|
14
|
+
|
|
15
|
+
if [ "$1" = "--json" ]; then
|
|
16
|
+
# Output full workspace config as JSON
|
|
17
|
+
yq -o=json ".workspaces.$ACTIVE" "$CONFIG_FILE"
|
|
18
|
+
else
|
|
19
|
+
echo "$ACTIVE"
|
|
20
|
+
fi
|
|
21
|
+
else
|
|
22
|
+
echo "Error: yq required for this operation"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# List all configured workspaces
|
|
3
|
+
# Usage: list_workspaces.sh
|
|
4
|
+
|
|
5
|
+
CONFIG_FILE="$HOME/.brn/config.yaml"
|
|
6
|
+
|
|
7
|
+
if [ ! -f "$CONFIG_FILE" ]; then
|
|
8
|
+
echo "No workspaces configured. Run create_workspace.sh first."
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Get active workspace
|
|
13
|
+
if command -v yq &> /dev/null; then
|
|
14
|
+
ACTIVE=$(yq '.active_workspace' "$CONFIG_FILE")
|
|
15
|
+
|
|
16
|
+
echo "Workspaces:"
|
|
17
|
+
echo "==========="
|
|
18
|
+
|
|
19
|
+
# List all workspaces
|
|
20
|
+
yq -r '.workspaces | keys | .[]' "$CONFIG_FILE" | while read -r ws; do
|
|
21
|
+
path=$(yq -r ".workspaces.$ws.path" "$CONFIG_FILE")
|
|
22
|
+
if [ "$ws" = "$ACTIVE" ]; then
|
|
23
|
+
echo "* $ws ($path) [ACTIVE]"
|
|
24
|
+
else
|
|
25
|
+
echo " $ws ($path)"
|
|
26
|
+
fi
|
|
27
|
+
done
|
|
28
|
+
else
|
|
29
|
+
echo "Warning: yq not found. Showing raw config:"
|
|
30
|
+
cat "$CONFIG_FILE"
|
|
31
|
+
fi
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Switch to a different workspace
|
|
3
|
+
# Usage: switch_workspace.sh <name>
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
WORKSPACE_NAME="$1"
|
|
8
|
+
|
|
9
|
+
if [ -z "$WORKSPACE_NAME" ]; then
|
|
10
|
+
echo "Usage: switch_workspace.sh <name>"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
CONFIG_FILE="$HOME/.brn/config.yaml"
|
|
15
|
+
|
|
16
|
+
if [ ! -f "$CONFIG_FILE" ]; then
|
|
17
|
+
echo "Error: No config found. Create a workspace first."
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if command -v yq &> /dev/null; then
|
|
22
|
+
# Check if workspace exists
|
|
23
|
+
if ! yq -e ".workspaces.$WORKSPACE_NAME" "$CONFIG_FILE" &> /dev/null; then
|
|
24
|
+
echo "Error: Workspace '$WORKSPACE_NAME' not found"
|
|
25
|
+
echo "Available workspaces:"
|
|
26
|
+
yq -r '.workspaces | keys | .[]' "$CONFIG_FILE"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Update active workspace
|
|
31
|
+
yq -i ".active_workspace = \"$WORKSPACE_NAME\"" "$CONFIG_FILE"
|
|
32
|
+
|
|
33
|
+
path=$(yq -r ".workspaces.$WORKSPACE_NAME.path" "$CONFIG_FILE")
|
|
34
|
+
echo "✓ Switched to workspace '$WORKSPACE_NAME' ($path)"
|
|
35
|
+
else
|
|
36
|
+
echo "Error: yq required for this operation"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|