@brainervirus/workit-core 0.6.1 → 0.7.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/package.json +3 -7
- package/scripts/doctor-check.ts +20 -0
- package/scripts/install-cursor-plugin.sh +51 -28
- package/scripts/install-opencode-plugin.sh +19 -21
- package/scripts/rewrite-workspace-deps.ts +15 -9
- package/scripts/sync-runtime.sh +71 -19
- package/scripts/vendor-assets.ts +37 -0
- package/skills/wk-implement/SKILL.md +2 -2
- package/skills/wk-pr/SKILL.md +1 -1
- package/src/core/boundary.ts +27 -0
- package/src/core/branch-policy.ts +63 -0
- package/src/core/branch.ts +30 -16
- package/src/core/config.ts +193 -31
- package/src/core/docs-layout.ts +251 -0
- package/src/core/docs-migration.ts +639 -0
- package/src/core/docs-repo.ts +11 -9
- package/src/core/docs-validate.ts +18 -6
- package/src/core/doctor.ts +801 -0
- package/src/core/flow-state.ts +1579 -141
- package/src/core/git.ts +22 -5
- package/src/{tools/handoff.ts → core/handoff-tools.ts} +5 -57
- package/src/core/hygiene.ts +26 -12
- package/src/core/init.ts +43 -11
- package/src/core/logger.ts +321 -0
- package/src/core/package-root.ts +28 -0
- package/src/core/ports/init-toolkit-status.ts +1 -1
- package/src/core/ports/vcs-verify-token.ts +1 -1
- package/src/core/ports/youtrack-api.ts +1 -1
- package/src/core/ports/youtrack-verify-token.ts +1 -1
- package/src/core/pr-create.ts +116 -21
- package/src/core/registration.ts +215 -0
- package/src/core/repo-context.ts +447 -0
- package/src/core/repo-tools.ts +23 -0
- package/src/core/safe-write.ts +22 -0
- package/src/core/scripts.ts +3 -44
- package/src/core/sdd.ts +45 -28
- package/src/core/setup-state.ts +54 -0
- package/src/core/setup.ts +1216 -0
- package/src/core/skill-manifests.ts +95 -0
- package/src/core/support-matrix.ts +12 -0
- package/src/core/sync-runtime.ts +348 -0
- package/src/core/templates.ts +2 -2
- package/src/core/vcs-config.ts +107 -37
- package/src/core/verify-project.ts +181 -0
- package/src/core/workspaces.ts +136 -17
- package/src/core/youtrack-tools.ts +228 -0
- package/src/core/youtrack.ts +125 -67
- package/templates/execution-contract.md +9 -7
- package/templates/superpowers-doc-contract.md +4 -3
- package/scripts/_shared/common.sh +0 -173
- package/scripts/changelog-context.sh +0 -42
- package/scripts/docs-refresh-context.sh +0 -40
- package/scripts/init/apply.sh +0 -5
- package/scripts/init/status.sh +0 -5
- package/scripts/init/toolkit-status.sh +0 -5
- package/scripts/pr-create.sh +0 -5
- package/scripts/pr-ready-context.sh +0 -88
- package/scripts/present/ascii-wireframe.sh +0 -5
- package/scripts/present/flow-diagram.sh +0 -5
- package/scripts/release-notes-context.sh +0 -40
- package/scripts/vcs/config.sh +0 -5
- package/scripts/vcs/merged-style.sh +0 -5
- package/scripts/vcs/token-create-urls.sh +0 -5
- package/scripts/vcs/verify-token.sh +0 -5
- package/scripts/verify-project.sh +0 -140
- package/scripts/youtrack/api.sh +0 -5
- package/scripts/youtrack/config.sh +0 -5
- package/scripts/youtrack/greeting.sh +0 -5
- package/scripts/youtrack/parse-duration.sh +0 -5
- package/scripts/youtrack/token-create-url.sh +0 -5
- package/scripts/youtrack/verify-token.sh +0 -5
- package/scripts/youtrack/work-date-ms.sh +0 -5
- package/src/tools/docs-repo.ts +0 -51
- package/src/tools/flow.ts +0 -99
- package/src/tools/index.ts +0 -22
- package/src/tools/present.ts +0 -49
- package/src/tools/repo.ts +0 -490
- package/src/tools/rules.ts +0 -30
- package/src/tools/sdd.ts +0 -216
- package/src/tools/templates.ts +0 -27
- package/src/tools/youtrack.ts +0 -423
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
repo_root() {
|
|
6
|
-
git rev-parse --show-toplevel 2>/dev/null || pwd
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
current_branch() {
|
|
10
|
-
git rev-parse --abbrev-ref HEAD 2>/dev/null || printf 'unknown'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
default_base() {
|
|
14
|
-
for ref in origin/main main origin/master master origin/develop develop; do
|
|
15
|
-
if git rev-parse --verify "$ref" >/dev/null 2>&1; then
|
|
16
|
-
printf '%s\n' "$ref"
|
|
17
|
-
return 0
|
|
18
|
-
fi
|
|
19
|
-
done
|
|
20
|
-
printf 'HEAD~1\n'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
range_arg_or_default() {
|
|
24
|
-
if [ "${1:-}" != "" ]; then
|
|
25
|
-
printf '%s\n' "$1"
|
|
26
|
-
else
|
|
27
|
-
base=$(default_base)
|
|
28
|
-
printf '%s...HEAD\n' "$base"
|
|
29
|
-
fi
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
pr_range_arg_or_default() {
|
|
33
|
-
if [ "${1:-}" != "" ]; then
|
|
34
|
-
printf '%s\n' "$1"
|
|
35
|
-
return 0
|
|
36
|
-
fi
|
|
37
|
-
resolve_pr_range
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
is_protected_branch() {
|
|
41
|
-
branch=$1
|
|
42
|
-
case "$branch" in
|
|
43
|
-
main|master|develop|prod|production) return 0 ;;
|
|
44
|
-
*) return 1 ;;
|
|
45
|
-
esac
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
is_pr_branch() {
|
|
49
|
-
branch=$1
|
|
50
|
-
case "$branch" in
|
|
51
|
-
feature/*|bugfix/*) return 0 ;;
|
|
52
|
-
*) return 1 ;;
|
|
53
|
-
esac
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
resolve_pr_branch_context() {
|
|
57
|
-
branch=$(current_branch)
|
|
58
|
-
|
|
59
|
-
if is_protected_branch "$branch"; then
|
|
60
|
-
printf 'ERROR: cannot build PR context on protected branch %s — PRs are for feature/* or bugfix/* only\n' "$branch" >&2
|
|
61
|
-
return 1
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
if ! is_pr_branch "$branch"; then
|
|
65
|
-
if [ "$branch" = "unknown" ]; then
|
|
66
|
-
printf 'ERROR: not in a git repository at %s — open the target repository as the OpenCode session directory\n' "$(pwd)" >&2
|
|
67
|
-
else
|
|
68
|
-
printf 'ERROR: branch %s is not feature/* or bugfix/* — checkout a feature branch or pass an explicit git range\n' "$branch" >&2
|
|
69
|
-
fi
|
|
70
|
-
return 1
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
best_ref=""
|
|
74
|
-
best_mb=""
|
|
75
|
-
|
|
76
|
-
resolved=$(bash "$SCRIPT_DIR/vcs/config.sh" resolve 2>/dev/null) || {
|
|
77
|
-
printf 'ERROR: cannot resolve the configured PR target branch\n' >&2
|
|
78
|
-
return 1
|
|
79
|
-
}
|
|
80
|
-
base=$(printf '%s\n' "$resolved" | bun -e '
|
|
81
|
-
const value = JSON.parse(await Bun.stdin.text()).defaultTargetBranch;
|
|
82
|
-
if (typeof value === "string" && value) process.stdout.write(value);
|
|
83
|
-
') || {
|
|
84
|
-
printf 'ERROR: invalid VCS target-branch configuration\n' >&2
|
|
85
|
-
return 1
|
|
86
|
-
}
|
|
87
|
-
if [ "$base" = "" ] || ! git check-ref-format --branch "$base" >/dev/null 2>&1; then
|
|
88
|
-
printf 'ERROR: invalid configured PR target branch %s\n' "$base" >&2
|
|
89
|
-
return 1
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
for ref in "origin/$base" "$base"; do
|
|
93
|
-
git rev-parse --verify "$ref" >/dev/null 2>&1 || continue
|
|
94
|
-
mb=$(git merge-base "$ref" HEAD 2>/dev/null) || continue
|
|
95
|
-
best_ref=$ref
|
|
96
|
-
best_mb=$mb
|
|
97
|
-
break
|
|
98
|
-
done
|
|
99
|
-
|
|
100
|
-
if [ "$best_ref" = "" ] || [ "$best_mb" = "" ]; then
|
|
101
|
-
printf 'ERROR: configured PR target branch %s not found — fetch/checkout it or pass an explicit git range\n' "$base" >&2
|
|
102
|
-
return 1
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
PR_BASE_REF=$best_ref
|
|
106
|
-
PR_MERGE_BASE=$best_mb
|
|
107
|
-
PR_RANGE="${best_ref}..HEAD"
|
|
108
|
-
PR_DIFF_RANGE="${best_mb}..HEAD"
|
|
109
|
-
export PR_BASE_REF PR_MERGE_BASE PR_RANGE PR_DIFF_RANGE
|
|
110
|
-
return 0
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
resolve_pr_range() {
|
|
114
|
-
if ! resolve_pr_branch_context; then
|
|
115
|
-
return 1
|
|
116
|
-
fi
|
|
117
|
-
printf '%s\n' "$PR_RANGE"
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
print_section() {
|
|
121
|
-
printf '\n## %s\n\n' "$1"
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
run_or_note() {
|
|
125
|
-
label=$1
|
|
126
|
-
shift
|
|
127
|
-
print_section "$label"
|
|
128
|
-
"$@" 2>&1 || printf '[command failed: %s]\n' "$*"
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
find_pr_template() {
|
|
132
|
-
for path in \
|
|
133
|
-
.gitlab/merge_request_templates/Default.md \
|
|
134
|
-
.gitlab/merge_request_templates/default.md \
|
|
135
|
-
.gitlab/merge_request_templates/merge_request_template.md \
|
|
136
|
-
.github/PULL_REQUEST_TEMPLATE.md \
|
|
137
|
-
.github/pull_request_template.md \
|
|
138
|
-
.github/PULL_REQUEST_TEMPLATE/pull_request_template.md \
|
|
139
|
-
docs/PULL_REQUEST_TEMPLATE.md \
|
|
140
|
-
PULL_REQUEST_TEMPLATE.md
|
|
141
|
-
do
|
|
142
|
-
if [ -f "$path" ]; then
|
|
143
|
-
printf '%s\n' "$path"
|
|
144
|
-
return 0
|
|
145
|
-
fi
|
|
146
|
-
done
|
|
147
|
-
return 1
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
fallback_pr_template() {
|
|
151
|
-
cat <<'TEMPLATE'
|
|
152
|
-
## Summary
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
## Validation
|
|
156
|
-
- [ ] Not run
|
|
157
|
-
TEMPLATE
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
changed_files_for_range() {
|
|
161
|
-
range=$1
|
|
162
|
-
git diff --name-only "$range" -- 2>/dev/null || git diff --name-only -- 2>/dev/null || true
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
commit_log_for_range() {
|
|
166
|
-
range=$1
|
|
167
|
-
git log --oneline --decorate --no-merges "$range" -- 2>/dev/null || git log --oneline --decorate -10 -- 2>/dev/null || true
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
diff_stat_for_range() {
|
|
171
|
-
range=$1
|
|
172
|
-
git diff --stat "$range" -- 2>/dev/null || git diff --stat -- 2>/dev/null || true
|
|
173
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
6
|
-
. "$SCRIPT_DIR/_shared/common.sh"
|
|
7
|
-
|
|
8
|
-
cd "$(repo_root)" || exit 1
|
|
9
|
-
|
|
10
|
-
range=$(range_arg_or_default "${1:-}")
|
|
11
|
-
|
|
12
|
-
print_section "Repository"
|
|
13
|
-
printf 'root: %s\n' "$(pwd)"
|
|
14
|
-
printf 'branch: %s\n' "$(current_branch)"
|
|
15
|
-
printf 'range: %s\n' "$range"
|
|
16
|
-
|
|
17
|
-
print_section "Keep a Changelog Rules"
|
|
18
|
-
cat <<'RULES'
|
|
19
|
-
- Use an [Unreleased] section.
|
|
20
|
-
- Use Added, Changed, Deprecated, Removed, Fixed, Security.
|
|
21
|
-
- Entries should be human-readable and user-facing.
|
|
22
|
-
- Do not use raw commit messages as changelog bullets.
|
|
23
|
-
- MERGE into existing ### Category under [Unreleased] — never append a second ### Added / ### Fixed block.
|
|
24
|
-
- Apply with the native workflow_changelog_apply tool only (not hand-edits under Unreleased).
|
|
25
|
-
- If Unreleased already has duplicate category headings, normalize_only first.
|
|
26
|
-
RULES
|
|
27
|
-
|
|
28
|
-
print_section "Existing CHANGELOG.md"
|
|
29
|
-
if [ -f CHANGELOG.md ]; then
|
|
30
|
-
sed -n '1,260p' CHANGELOG.md
|
|
31
|
-
else
|
|
32
|
-
printf 'CHANGELOG.md not found.\n'
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
print_section "Commits"
|
|
36
|
-
commit_log_for_range "$range"
|
|
37
|
-
|
|
38
|
-
print_section "Diff Stat"
|
|
39
|
-
diff_stat_for_range "$range"
|
|
40
|
-
|
|
41
|
-
print_section "Changed Files"
|
|
42
|
-
changed_files_for_range "$range"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
6
|
-
. "$SCRIPT_DIR/_shared/common.sh"
|
|
7
|
-
|
|
8
|
-
cd "$(repo_root)" || exit 1
|
|
9
|
-
|
|
10
|
-
range=$(range_arg_or_default "${1:-}")
|
|
11
|
-
|
|
12
|
-
print_section "Repository"
|
|
13
|
-
printf 'root: %s\n' "$(pwd)"
|
|
14
|
-
printf 'branch: %s\n' "$(current_branch)"
|
|
15
|
-
printf 'range: %s\n' "$range"
|
|
16
|
-
|
|
17
|
-
print_section "Changed Files"
|
|
18
|
-
changed_files_for_range "$range"
|
|
19
|
-
|
|
20
|
-
print_section "Documentation Files"
|
|
21
|
-
find . -maxdepth 3 \( -name 'README.md' -o -name '*.md' \) \
|
|
22
|
-
-not -path './.git/*' \
|
|
23
|
-
-not -path './node_modules/*' \
|
|
24
|
-
-not -path './target/*' \
|
|
25
|
-
-not -path './dist/*' \
|
|
26
|
-
| sort | sed -n '1,200p'
|
|
27
|
-
|
|
28
|
-
print_section "README Preview"
|
|
29
|
-
if [ -f README.md ]; then
|
|
30
|
-
sed -n '1,220p' README.md
|
|
31
|
-
else
|
|
32
|
-
printf 'README.md not found.\n'
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
print_section "Package Scripts"
|
|
36
|
-
if [ -f package.json ]; then
|
|
37
|
-
node -e "const p=require('./package.json'); console.log(JSON.stringify({name:p.name,version:p.version,scripts:p.scripts}, null, 2))" 2>/dev/null || true
|
|
38
|
-
else
|
|
39
|
-
printf 'package.json not found.\n'
|
|
40
|
-
fi
|
package/scripts/init/apply.sh
DELETED
package/scripts/init/status.sh
DELETED
package/scripts/pr-create.sh
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
6
|
-
. "$SCRIPT_DIR/_shared/common.sh"
|
|
7
|
-
|
|
8
|
-
cd "$(repo_root)" || exit 1
|
|
9
|
-
|
|
10
|
-
auto_range=false
|
|
11
|
-
if [ "${1:-}" != "" ]; then
|
|
12
|
-
range=$1
|
|
13
|
-
else
|
|
14
|
-
auto_range=true
|
|
15
|
-
if ! resolve_pr_branch_context; then
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
range=$PR_RANGE
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
print_section "Repository"
|
|
22
|
-
printf 'root: %s\n' "$(pwd)"
|
|
23
|
-
printf 'branch: %s\n' "$(current_branch)"
|
|
24
|
-
printf 'range: %s\n' "$range"
|
|
25
|
-
if [ "$auto_range" = true ]; then
|
|
26
|
-
printf 'base_ref: %s\n' "$PR_BASE_REF"
|
|
27
|
-
printf 'merge_base: %s\n' "$PR_MERGE_BASE"
|
|
28
|
-
printf 'diff_range: %s\n' "$PR_DIFF_RANGE"
|
|
29
|
-
printf 'range_mode: branch-exclusive\n'
|
|
30
|
-
if [ "${PR_SYNC_NOTES:-}" != "" ]; then
|
|
31
|
-
printf 'git_sync: %s\n' "$PR_SYNC_NOTES"
|
|
32
|
-
fi
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
print_section "Working Tree"
|
|
36
|
-
git status --short 2>&1 || true
|
|
37
|
-
|
|
38
|
-
print_section "Commits"
|
|
39
|
-
commit_log_for_range "$range"
|
|
40
|
-
|
|
41
|
-
diff_range=$range
|
|
42
|
-
if [ "$auto_range" = true ]; then
|
|
43
|
-
diff_range=$PR_DIFF_RANGE
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
print_section "Diff Stat"
|
|
47
|
-
diff_stat_for_range "$diff_range"
|
|
48
|
-
|
|
49
|
-
print_section "Changed Files"
|
|
50
|
-
changed_files_for_range "$diff_range"
|
|
51
|
-
|
|
52
|
-
print_section "PR Template"
|
|
53
|
-
template=$(find_pr_template || true)
|
|
54
|
-
if [ "$template" != "" ]; then
|
|
55
|
-
printf 'template_path: %s\n\n' "$template"
|
|
56
|
-
sed -n '1,220p' "$template"
|
|
57
|
-
else
|
|
58
|
-
printf 'template_path: none\n\n'
|
|
59
|
-
fallback_pr_template
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
print_section "Recent Validation Signals"
|
|
63
|
-
if [ -f package.json ]; then
|
|
64
|
-
printf 'package.json detected. Common scripts:\n'
|
|
65
|
-
node -e "const p=require('./package.json'); for (const k of ['lint','format:check','test','build']) if (p.scripts&&p.scripts[k]) console.log(k+': '+p.scripts[k])" 2>/dev/null || true
|
|
66
|
-
fi
|
|
67
|
-
if [ -f Cargo.toml ] || [ -f src-tauri/Cargo.toml ]; then
|
|
68
|
-
printf 'Rust project detected.\n'
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
print_section "VCS Config"
|
|
72
|
-
RES=$(bash "$SCRIPT_DIR/vcs/config.sh" resolve 2>/dev/null || true)
|
|
73
|
-
if [ -n "$RES" ]; then
|
|
74
|
-
printf '%s\n' "$RES" | bun -e 'const r = JSON.parse(await Bun.stdin.text()); console.log("workspace: " + String(r.workspace_name || "none")); console.log("provider: " + String(r.provider || "gitlab"))'
|
|
75
|
-
fi
|
|
76
|
-
if bash "$SCRIPT_DIR/vcs/config.sh" summary 2>/dev/null; then
|
|
77
|
-
:
|
|
78
|
-
else
|
|
79
|
-
printf 'vcs: not configured — run /wk-init action vcs_scaffold\n'
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
print_section "Merged PR Style"
|
|
83
|
-
STYLE=$(bash "$SCRIPT_DIR/vcs/merged-style.sh" 6 2>/dev/null || true)
|
|
84
|
-
if [ -n "$STYLE" ]; then
|
|
85
|
-
printf '%s\n' "$STYLE"
|
|
86
|
-
else
|
|
87
|
-
printf 'style_hints: Configure VCS token to load your recent merged MR/PR examples\n'
|
|
88
|
-
fi
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
6
|
-
. "$SCRIPT_DIR/_shared/common.sh"
|
|
7
|
-
|
|
8
|
-
cd "$(repo_root)" || exit 1
|
|
9
|
-
|
|
10
|
-
requested="${1:-}"
|
|
11
|
-
if [ -z "$requested" ]; then
|
|
12
|
-
printf 'ERROR: release tag or range required\n' >&2
|
|
13
|
-
exit 1
|
|
14
|
-
fi
|
|
15
|
-
range=$(range_arg_or_default "$requested")
|
|
16
|
-
|
|
17
|
-
print_section "Repository"
|
|
18
|
-
printf 'root: %s\n' "$(pwd)"
|
|
19
|
-
printf 'branch: %s\n' "$(current_branch)"
|
|
20
|
-
printf 'requested: %s\n' "${requested:-none}"
|
|
21
|
-
printf 'range: %s\n' "$range"
|
|
22
|
-
|
|
23
|
-
print_section "Tags"
|
|
24
|
-
git tag --sort=-creatordate 2>/dev/null | sed -n '1,20p' || true
|
|
25
|
-
|
|
26
|
-
print_section "Commits"
|
|
27
|
-
commit_log_for_range "$range"
|
|
28
|
-
|
|
29
|
-
print_section "Diff Stat"
|
|
30
|
-
diff_stat_for_range "$range"
|
|
31
|
-
|
|
32
|
-
print_section "Changed Files"
|
|
33
|
-
changed_files_for_range "$range"
|
|
34
|
-
|
|
35
|
-
print_section "Existing Release Files"
|
|
36
|
-
for path in CHANGELOG.md RELEASE_NOTES.md .github/releases.md; do
|
|
37
|
-
if [ -f "$path" ]; then
|
|
38
|
-
printf '%s\n' "$path"
|
|
39
|
-
fi
|
|
40
|
-
done
|
package/scripts/vcs/config.sh
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -u
|
|
4
|
-
|
|
5
|
-
root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
6
|
-
cd "$root" || exit 1
|
|
7
|
-
|
|
8
|
-
dry_run=false
|
|
9
|
-
case " ${*:-} " in
|
|
10
|
-
*" --dry-run "*) dry_run=true ;;
|
|
11
|
-
*" dry-run "*) dry_run=true ;;
|
|
12
|
-
esac
|
|
13
|
-
|
|
14
|
-
passed=0
|
|
15
|
-
failed=0
|
|
16
|
-
skipped=0
|
|
17
|
-
|
|
18
|
-
run_check() {
|
|
19
|
-
label=$1
|
|
20
|
-
shift
|
|
21
|
-
printf '\n## %s\n\n' "$label"
|
|
22
|
-
printf 'command: %s\n\n' "$*"
|
|
23
|
-
if [ "$dry_run" = true ]; then
|
|
24
|
-
printf 'status: skipped (dry run)\n'
|
|
25
|
-
skipped=$((skipped + 1))
|
|
26
|
-
return 0
|
|
27
|
-
fi
|
|
28
|
-
"$@"
|
|
29
|
-
code=$?
|
|
30
|
-
if [ "$code" -eq 0 ]; then
|
|
31
|
-
printf '\nstatus: pass\n'
|
|
32
|
-
passed=$((passed + 1))
|
|
33
|
-
else
|
|
34
|
-
printf '\nstatus: fail (exit %s)\n' "$code"
|
|
35
|
-
failed=$((failed + 1))
|
|
36
|
-
fi
|
|
37
|
-
return 0
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
skip_check() {
|
|
41
|
-
label=$1
|
|
42
|
-
reason=$2
|
|
43
|
-
printf '\n## %s\n\nstatus: skipped (%s)\n' "$label" "$reason"
|
|
44
|
-
skipped=$((skipped + 1))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
has_script() {
|
|
48
|
-
name=$1
|
|
49
|
-
[ -f package.json ] || return 1
|
|
50
|
-
node -e "const p=require('./package.json'); process.exit(p.scripts && p.scripts['$name'] ? 0 : 1)" >/dev/null 2>&1
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
package_runner() {
|
|
54
|
-
if [ -f pnpm-lock.yaml ] || grep -q '"packageManager"[[:space:]]*:[[:space:]]*"pnpm' package.json 2>/dev/null; then
|
|
55
|
-
printf 'pnpm'
|
|
56
|
-
elif [ -f yarn.lock ]; then
|
|
57
|
-
printf 'yarn'
|
|
58
|
-
elif [ -f package-lock.json ]; then
|
|
59
|
-
printf 'npm'
|
|
60
|
-
else
|
|
61
|
-
printf 'npm'
|
|
62
|
-
fi
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
printf '# Verification Context\n'
|
|
66
|
-
printf '\nroot: %s\n' "$root"
|
|
67
|
-
printf 'dry_run: %s\n' "$dry_run"
|
|
68
|
-
|
|
69
|
-
if [ -f package.json ]; then
|
|
70
|
-
runner=$(package_runner)
|
|
71
|
-
for script in lint format:check test build; do
|
|
72
|
-
if has_script "$script"; then
|
|
73
|
-
if [ "$runner" = "npm" ]; then
|
|
74
|
-
run_check "$script" npm run "$script"
|
|
75
|
-
else
|
|
76
|
-
run_check "$script" "$runner" "$script"
|
|
77
|
-
fi
|
|
78
|
-
else
|
|
79
|
-
skip_check "$script" "package.json has no $script script"
|
|
80
|
-
fi
|
|
81
|
-
done
|
|
82
|
-
else
|
|
83
|
-
skip_check "javascript" "package.json not found"
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
cargo_manifest=""
|
|
87
|
-
if [ -f Cargo.toml ]; then
|
|
88
|
-
cargo_manifest="Cargo.toml"
|
|
89
|
-
elif [ -f src-tauri/Cargo.toml ]; then
|
|
90
|
-
cargo_manifest="src-tauri/Cargo.toml"
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
if [ "$cargo_manifest" != "" ]; then
|
|
94
|
-
run_check "cargo fmt" cargo fmt --manifest-path "$cargo_manifest" -- --check
|
|
95
|
-
run_check "cargo clippy" cargo clippy --manifest-path "$cargo_manifest" --all-targets -- -D warnings
|
|
96
|
-
run_check "cargo test" cargo test --manifest-path "$cargo_manifest" --all-targets
|
|
97
|
-
else
|
|
98
|
-
skip_check "rust" "Cargo.toml not found"
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
if [ -f pyproject.toml ] || [ -f pytest.ini ] || [ -d tests ]; then
|
|
102
|
-
if command -v pytest >/dev/null 2>&1; then
|
|
103
|
-
run_check "pytest" pytest
|
|
104
|
-
else
|
|
105
|
-
skip_check "pytest" "pytest not available"
|
|
106
|
-
fi
|
|
107
|
-
if command -v ruff >/dev/null 2>&1; then
|
|
108
|
-
run_check "ruff check" ruff check .
|
|
109
|
-
else
|
|
110
|
-
skip_check "ruff check" "ruff not available"
|
|
111
|
-
fi
|
|
112
|
-
fi
|
|
113
|
-
|
|
114
|
-
printf '\n## CHANGELOG.md format\n\n'
|
|
115
|
-
printf 'command: grep -qi "## [Unreleased]" CHANGELOG.md\n\n'
|
|
116
|
-
|
|
117
|
-
if [ "$dry_run" = true ]; then
|
|
118
|
-
printf 'status: skipped (dry run)\n'
|
|
119
|
-
skipped=$((skipped + 1))
|
|
120
|
-
elif [ -f CHANGELOG.md ]; then
|
|
121
|
-
if grep -qi '## \[Unreleased\]' CHANGELOG.md; then
|
|
122
|
-
printf 'status: pass\n'
|
|
123
|
-
passed=$((passed + 1))
|
|
124
|
-
else
|
|
125
|
-
printf 'status: fail (missing ## [Unreleased])\n'
|
|
126
|
-
failed=$((failed + 1))
|
|
127
|
-
fi
|
|
128
|
-
else
|
|
129
|
-
printf 'status: fail (missing CHANGELOG.md)\n'
|
|
130
|
-
failed=$((failed + 1))
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
printf '\n# Summary\n\n'
|
|
134
|
-
printf 'passed: %s\n' "$passed"
|
|
135
|
-
printf 'failed: %s\n' "$failed"
|
|
136
|
-
printf 'skipped: %s\n' "$skipped"
|
|
137
|
-
|
|
138
|
-
if [ "$failed" -gt 0 ]; then
|
|
139
|
-
exit 1
|
|
140
|
-
fi
|
package/scripts/youtrack/api.sh
DELETED