javi-forge 1.0.0 → 1.1.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/lib/common.sh ADDED
@@ -0,0 +1,183 @@
1
+ #!/bin/bash
2
+ # =============================================================================
3
+ # lib/common.sh - Shared functions for project-starter-framework
4
+ # =============================================================================
5
+ # Source from scripts: source "$(dirname "$0")/../lib/common.sh"
6
+ # Source from ci-local: source "$(dirname "$0")/../lib/common.sh"
7
+ # Source from hooks: source "$(dirname "$0")/../../lib/common.sh"
8
+ # =============================================================================
9
+
10
+ # Guard against double-sourcing
11
+ if [[ -n "${_COMMON_SH_LOADED:-}" ]]; then
12
+ return 0 2>/dev/null || true
13
+ fi
14
+ _COMMON_SH_LOADED=1
15
+
16
+ # =============================================================================
17
+ # Colors (exported for callers via source)
18
+ # =============================================================================
19
+ # shellcheck disable=SC2034
20
+ RED='\033[0;31m'
21
+ # shellcheck disable=SC2034
22
+ GREEN='\033[0;32m'
23
+ # shellcheck disable=SC2034
24
+ YELLOW='\033[1;33m'
25
+ # shellcheck disable=SC2034
26
+ CYAN='\033[0;36m'
27
+ # shellcheck disable=SC2034
28
+ BLUE='\033[0;34m'
29
+ # shellcheck disable=SC2034
30
+ NC='\033[0m'
31
+
32
+ # =============================================================================
33
+ # Shared logging helpers
34
+ # =============================================================================
35
+ log_ok() { echo -e " ${GREEN}[OK]${NC} $1"; }
36
+ log_warn() { echo -e " ${YELLOW}[WARN]${NC} $1"; }
37
+ log_fail() { echo -e " ${RED}[FAIL]${NC} $1"; }
38
+ log_info() { echo -e " ${CYAN}[INFO]${NC} $1"; }
39
+ log_step() { echo -e "${YELLOW}$1${NC}"; }
40
+
41
+ # =============================================================================
42
+ # sed_inplace - Portable sed -i (works on both GNU and BSD/macOS sed)
43
+ # =============================================================================
44
+ # Usage: sed_inplace "s/foo/bar/" file.txt
45
+ # =============================================================================
46
+ sed_inplace() {
47
+ if sed --version 2>/dev/null | grep -q GNU; then
48
+ sed -i "$@"
49
+ else
50
+ sed -i '' "$@"
51
+ fi
52
+ }
53
+
54
+ # =============================================================================
55
+ # escape_sed - Escape special characters for safe use in sed replacement
56
+ # =============================================================================
57
+ # Usage: escaped=$(escape_sed "$raw_string")
58
+ # Note: This escapes replacement-side characters (backslash, ampersand, slash).
59
+ # =============================================================================
60
+ escape_sed() {
61
+ printf '%s\n' "$1" | sed -e 's/[\\&/]/\\&/g'
62
+ }
63
+
64
+ # =============================================================================
65
+ # backup_if_exists - Create a .bak copy of a file before overwriting
66
+ # =============================================================================
67
+ # Usage: backup_if_exists "path/to/file"
68
+ # =============================================================================
69
+ backup_if_exists() {
70
+ local file="$1"
71
+ if [[ -f "$file" ]]; then
72
+ cp "$file" "${file}.bak"
73
+ echo -e "${YELLOW} Backed up existing ${file}${NC}"
74
+ fi
75
+ }
76
+
77
+ # =============================================================================
78
+ # detect_stack - Auto-detect project technology stack
79
+ # =============================================================================
80
+ # Sets: STACK_TYPE, BUILD_TOOL, JAVA_VERSION
81
+ # Detects: java-gradle, java-maven, node, python, go, rust
82
+ #
83
+ # Usage:
84
+ # detect_stack # Detects from current directory
85
+ # detect_stack "/path/to/project" # Detects from given directory
86
+ #
87
+ # NOTE: Does NOT set LINT_CMD/COMPILE_CMD/TEST_CMD. Those are CI-specific
88
+ # and should be configured by the caller (e.g., ci-local.sh).
89
+ # =============================================================================
90
+ # shellcheck disable=SC2034 # STACK_TYPE, BUILD_TOOL, JAVA_VERSION used by callers
91
+ detect_stack() {
92
+ local project_dir="${1:-.}"
93
+
94
+ STACK_TYPE="unknown"
95
+ BUILD_TOOL=""
96
+ JAVA_VERSION="21"
97
+
98
+ # Java + Gradle
99
+ if [[ -f "$project_dir/build.gradle" || -f "$project_dir/build.gradle.kts" ]]; then
100
+ STACK_TYPE="java-gradle"
101
+ BUILD_TOOL="gradle"
102
+
103
+ # Detect Java version from build files (compatible with macOS and Linux)
104
+ if [[ -f "$project_dir/build.gradle.kts" ]]; then
105
+ JAVA_VERSION=$(grep -E 'languageVersion\s*=\s*JavaLanguageVersion\.of\(' "$project_dir/build.gradle.kts" 2>/dev/null | grep -o '[0-9]\+' | head -1 || echo "21")
106
+ elif [[ -f "$project_dir/build.gradle" ]]; then
107
+ JAVA_VERSION=$(grep -E 'sourceCompatibility\s*=' "$project_dir/build.gradle" 2>/dev/null | grep -o '[0-9]\+' | head -1 || echo "21")
108
+ fi
109
+ [[ -z "$JAVA_VERSION" ]] && JAVA_VERSION="21"
110
+ return
111
+ fi
112
+
113
+ # Java + Maven
114
+ if [[ -f "$project_dir/pom.xml" ]]; then
115
+ STACK_TYPE="java-maven"
116
+ BUILD_TOOL="maven"
117
+ return
118
+ fi
119
+
120
+ # Node.js
121
+ if [[ -f "$project_dir/package.json" ]]; then
122
+ STACK_TYPE="node"
123
+ if [[ -f "$project_dir/pnpm-lock.yaml" ]]; then
124
+ BUILD_TOOL="pnpm"
125
+ elif [[ -f "$project_dir/yarn.lock" ]]; then
126
+ BUILD_TOOL="yarn"
127
+ else
128
+ BUILD_TOOL="npm"
129
+ fi
130
+ return
131
+ fi
132
+
133
+ # Python (detection order: uv > poetry > pipenv > pip)
134
+ if [[ -f "$project_dir/pyproject.toml" || -f "$project_dir/setup.py" || -f "$project_dir/requirements.txt" ]]; then
135
+ STACK_TYPE="python"
136
+ if [[ -f "$project_dir/uv.lock" ]]; then
137
+ BUILD_TOOL="uv"
138
+ elif [[ -f "$project_dir/poetry.lock" ]]; then
139
+ BUILD_TOOL="poetry"
140
+ elif [[ -f "$project_dir/Pipfile" ]]; then
141
+ BUILD_TOOL="pipenv"
142
+ else
143
+ BUILD_TOOL="pip"
144
+ fi
145
+ return
146
+ fi
147
+
148
+ # Go
149
+ if [[ -f "$project_dir/go.mod" ]]; then
150
+ STACK_TYPE="go"
151
+ BUILD_TOOL="go"
152
+ return
153
+ fi
154
+
155
+ # Rust
156
+ if [[ -f "$project_dir/Cargo.toml" ]]; then
157
+ STACK_TYPE="rust"
158
+ BUILD_TOOL="cargo"
159
+ return
160
+ fi
161
+ }
162
+
163
+ # =============================================================================
164
+ # detect_framework - Locate the project-starter-framework directory
165
+ # =============================================================================
166
+ # Sets: FRAMEWORK_DIR (path to framework root, or empty string)
167
+ # HAS_OPTIONAL (true/false if optional/ dir exists)
168
+ #
169
+ # Usage: detect_framework
170
+ # =============================================================================
171
+ # shellcheck disable=SC2034 # FRAMEWORK_DIR, HAS_OPTIONAL used by callers
172
+ detect_framework() {
173
+ FRAMEWORK_DIR=""
174
+ HAS_OPTIONAL=false
175
+ if [[ -d "templates" && -d ".ai-config" ]]; then
176
+ FRAMEWORK_DIR="."
177
+ elif [[ -d "../templates" && -d "../.ai-config" ]]; then
178
+ FRAMEWORK_DIR=".."
179
+ fi
180
+ if [[ -n "$FRAMEWORK_DIR" && -d "$FRAMEWORK_DIR/optional" ]]; then
181
+ HAS_OPTIONAL=true
182
+ fi
183
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "renderNullAs": "\\-",
3
+ "taskCompletionTracking": true,
4
+ "taskCompletionUseEmojiShorthand": false,
5
+ "taskCompletionText": "completion",
6
+ "taskCompletionDateFormat": "yyyy-MM-dd",
7
+ "recursiveSubTaskCompletion": false,
8
+ "warnOnEmptyResult": true,
9
+ "refreshEnabled": true,
10
+ "refreshInterval": 2500,
11
+ "defaultDateFormat": "MMMM dd, yyyy",
12
+ "defaultDateTimeFormat": "h:mm a - MMMM dd, yyyy",
13
+ "maxRecursiveRenderDepth": 4,
14
+ "tableIdColumnName": "File",
15
+ "tableGroupColumnName": "Group",
16
+ "showResultCount": true,
17
+ "allowHtml": false,
18
+ "inlineQueryPrefix": "=",
19
+ "inlineJsQueryPrefix": "$=",
20
+ "inlineQueriesInCodeblocks": true,
21
+ "enableDataviewJs": false,
22
+ "enableInlineDataviewJs": false,
23
+ "prettyRenderInlineFields": true,
24
+ "prettyRenderInlineFieldsInLivePreview": true
25
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "new-card-insertion-method": "prepend-compact",
3
+ "show-checkboxes": true,
4
+ "prepend-archive-separator": "---",
5
+ "prepend-archive-format": "",
6
+ "date-format": "YYYY-MM-DD",
7
+ "time-format": "HH:mm",
8
+ "link-date-to-daily-note": false,
9
+ "hide-card-count": false,
10
+ "hide-date-display": false,
11
+ "tag-colors": [
12
+ {
13
+ "tagKey": "#blocker",
14
+ "color": "var(--text-error)",
15
+ "backgroundColor": "rgba(var(--color-red-rgb), 0.2)"
16
+ },
17
+ {
18
+ "tagKey": "#wave",
19
+ "color": "var(--text-accent)",
20
+ "backgroundColor": "rgba(var(--color-blue-rgb), 0.2)"
21
+ },
22
+ {
23
+ "tagKey": "#review",
24
+ "color": "var(--text-faint)",
25
+ "backgroundColor": "rgba(var(--color-yellow-rgb), 0.2)"
26
+ }
27
+ ],
28
+ "tag-sort": []
29
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "command_timeout": 5,
3
+ "templates_folder": ".project/Templates",
4
+ "templates_pairs": [
5
+ ["", ""]
6
+ ],
7
+ "trigger_on_file_creation": false,
8
+ "auto_jump_to_cursor": true,
9
+ "enable_system_commands": false,
10
+ "shell_path": "",
11
+ "user_scripts_folder": "",
12
+ "enable_folder_templates": false,
13
+ "folder_templates": [],
14
+ "syntax_highlighting": true,
15
+ "syntax_highlighting_mobile": false,
16
+ "enabled_templates_hotkeys": [],
17
+ "startup_templates": []
18
+ }
package/package.json CHANGED
@@ -1,21 +1,11 @@
1
1
  {
2
2
  "name": "javi-forge",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Project scaffolding and AI-ready CI bootstrap",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "javi-forge": "./dist/index.js"
8
8
  },
9
- "scripts": {
10
- "build": "tsc",
11
- "dev": "tsx watch src/index.tsx",
12
- "start": "node dist/index.js",
13
- "typecheck": "tsc --noEmit",
14
- "test": "vitest run",
15
- "test:watch": "vitest",
16
- "test:coverage": "vitest run --coverage",
17
- "test:mutation": "stryker run"
18
- },
19
9
  "author": "JNZader",
20
10
  "license": "MIT",
21
11
  "repository": {
@@ -47,5 +37,15 @@
47
37
  "tsx": "^4.21.0",
48
38
  "typescript": "^5.9.3",
49
39
  "vitest": "^4.1.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc",
43
+ "dev": "tsx watch src/index.tsx",
44
+ "start": "node dist/index.js",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run",
47
+ "test:watch": "vitest",
48
+ "test:coverage": "vitest run --coverage",
49
+ "test:mutation": "stryker run"
50
50
  }
51
- }
51
+ }