@smartsoft001/claude-plugins 2.123.0 → 2.125.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 +1 -1
- package/plugins/smart/.claude-plugin/plugin.json +1 -1
- package/plugins/smart/skills/scaffold-nx-workspace/SKILL.md +84 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-app.md +405 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-claude-config.md +188 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/base-shared-lib.md +288 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/patch-delta.md +403 -0
- package/plugins/smart/skills/scaffold-nx-workspace/references/version-resolution.md +83 -0
- package/plugins/smart/skills/scaffold-nx-workspace/scripts/derive-prefix.sh +45 -0
- package/plugins/smart/skills/scaffold-nx-workspace/scripts/verify-scaffold.sh +97 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Version resolution
|
|
2
|
+
|
|
3
|
+
Versions are **never hardcoded**. The Angular version is the anchor; everything else is derived
|
|
4
|
+
from it. Resolve it at run time so a scaffold always matches the smartsoft library it integrates with.
|
|
5
|
+
|
|
6
|
+
Placeholders produced here and consumed by the other references:
|
|
7
|
+
|
|
8
|
+
- `<NG_VERSION>` — the confirmed Angular version (e.g. `21.2.4`).
|
|
9
|
+
- `<NG_MAJOR>` — its major (e.g. `21`).
|
|
10
|
+
- `<NX_LINE>` — the Nx version range to scaffold with (e.g. `^22`).
|
|
11
|
+
- `<NODE_VERSION>` — the Node version for `.nvmrc` (e.g. `24.5.0`).
|
|
12
|
+
|
|
13
|
+
## 1. Detect the Angular version the smartsoft library targets
|
|
14
|
+
|
|
15
|
+
The scaffolded app consumes `@smartsoft001/angular`, so its Angular peer range is the source of truth.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Preferred: the declared Angular peer range
|
|
19
|
+
npm view @smartsoft001/angular peerDependencies.@angular/core
|
|
20
|
+
# Fallbacks
|
|
21
|
+
npm view @smartsoft001/angular dependencies.@angular/core
|
|
22
|
+
# If installed locally in the current environment, read it directly:
|
|
23
|
+
node -p "(p=>p.peerDependencies?.['@angular/core']||p.dependencies?.['@angular/core'])(require('@smartsoft001/angular/package.json'))"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Resolve the range to a concrete version and take its major:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# highest published Angular matching the detected range, e.g. ^21.0.0 -> 21.2.4
|
|
30
|
+
npm view "@angular/core@<detected-range>" version | tail -1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
→ `<NG_VERSION>`, `<NG_MAJOR>`.
|
|
34
|
+
|
|
35
|
+
> If `@smartsoft001/angular` cannot be resolved (offline / not published), ask the user for the
|
|
36
|
+
> Angular version outright — never fall back to a baked-in number.
|
|
37
|
+
|
|
38
|
+
## 2. Confirm with the user
|
|
39
|
+
|
|
40
|
+
Use `AskUserQuestion`:
|
|
41
|
+
|
|
42
|
+
> "Use Angular `<NG_VERSION>` (matches `@smartsoft001/angular`)? — or type another version."
|
|
43
|
+
|
|
44
|
+
Whatever the user confirms becomes `<NG_VERSION>` / `<NG_MAJOR>`. If they override to a different
|
|
45
|
+
major, all derived values below recompute from the new major.
|
|
46
|
+
|
|
47
|
+
## 3. Derive the rest from the Angular major
|
|
48
|
+
|
|
49
|
+
- **Nx line `<NX_LINE>` = `^<NG_MAJOR + 1>`.** Nx's major tracks Angular's major + 1
|
|
50
|
+
(Angular 21 → Nx 22, Angular 20 → Nx 21, Angular 19 → Nx 20, …). Verify the line resolves:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm view "nx@<NX_LINE>" version | tail -1
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`create-nx-workspace@<NX_LINE>` then scaffolds the matching Angular line and a compatible
|
|
57
|
+
jest / eslint / typescript / playwright / swc / esbuild toolchain. **Do not pin those** — keep
|
|
58
|
+
whatever the generator installs.
|
|
59
|
+
|
|
60
|
+
- **Node `<NODE_VERSION>`** = a Node LTS within Angular's engine range:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm view "@angular/core@<NG_VERSION>" engines.node
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Pick the highest LTS that satisfies the range (e.g. `^20.19 || ^22.12 || ^24` → `24.5.0`). Write it
|
|
67
|
+
to `.nvmrc`.
|
|
68
|
+
|
|
69
|
+
- **`@angular/*` alignment.** If the Angular version `create-nx-workspace` installed differs from the
|
|
70
|
+
confirmed `<NG_VERSION>`, set all Angular packages to `<NG_VERSION>` in the patch step:
|
|
71
|
+
`@angular/{core,common,compiler,forms,platform-browser,platform-server,router}`, `@angular/ssr`,
|
|
72
|
+
`@angular/cli`, `@angular/build`, `@angular/compiler-cli`, `@angular/language-service`, and `ng-packagr`
|
|
73
|
+
(resolve `ng-packagr`'s matching version with `npm view "ng-packagr@^<NG_MAJOR>" version | tail -1`).
|
|
74
|
+
|
|
75
|
+
- **`@smartsoft001/claude-plugins`** devDep (so the `.claude` hooks resolve) = the version of the plugin
|
|
76
|
+
that is currently providing this skill (`npm view @smartsoft001/claude-plugins version`, or the locally
|
|
77
|
+
installed one) — not a fixed number.
|
|
78
|
+
|
|
79
|
+
## Summary
|
|
80
|
+
|
|
81
|
+
The only thing this skill decides is the _shape_ (which packages, which conventions). The _numbers_
|
|
82
|
+
come from `@smartsoft001/angular` + the Nx/Angular alignment rule + Angular's own engine range, all at
|
|
83
|
+
run time.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Propose an import-alias prefix from a workspace folder name.
|
|
3
|
+
#
|
|
4
|
+
# This is a PROPOSAL only — the skill must present the candidate to the user
|
|
5
|
+
# via AskUserQuestion and require explicit confirm/override. The prefix
|
|
6
|
+
# permanently shapes every import (e.g. @<prefix>/angular), so it is never
|
|
7
|
+
# applied without confirmation.
|
|
8
|
+
#
|
|
9
|
+
# Usage: derive-prefix.sh [workspace-folder-name]
|
|
10
|
+
# Defaults to the basename of the current directory.
|
|
11
|
+
#
|
|
12
|
+
# Heuristic:
|
|
13
|
+
# - lowercase; non-alphanumeric -> spaces
|
|
14
|
+
# - drop noise tokens (mobilems, muzeum, museum, projekt, project, app, web,
|
|
15
|
+
# www, front, frontend, site, deploy)
|
|
16
|
+
# - multiple remaining tokens -> initials (e.g. "acme art gallery" -> "aag")
|
|
17
|
+
# - single token -> first 3 letters
|
|
18
|
+
# - nothing left -> "app"
|
|
19
|
+
set -euo pipefail
|
|
20
|
+
|
|
21
|
+
raw="${1:-$(basename "$PWD")}"
|
|
22
|
+
|
|
23
|
+
cleaned="$(printf '%s' "$raw" | tr '[:upper:]' '[:lower:]' | tr -c '[:alnum:]' ' ')"
|
|
24
|
+
|
|
25
|
+
noise=" mobilems muzeum museum projekt project app web www front frontend site deploy "
|
|
26
|
+
tokens=()
|
|
27
|
+
for tok in $cleaned; do
|
|
28
|
+
case "$noise" in
|
|
29
|
+
*" $tok "*) continue ;;
|
|
30
|
+
esac
|
|
31
|
+
tokens+=("$tok")
|
|
32
|
+
done
|
|
33
|
+
|
|
34
|
+
if [ "${#tokens[@]}" -eq 0 ]; then
|
|
35
|
+
candidate="app"
|
|
36
|
+
elif [ "${#tokens[@]}" -eq 1 ]; then
|
|
37
|
+
candidate="$(printf '%s' "${tokens[0]}" | cut -c1-3)"
|
|
38
|
+
else
|
|
39
|
+
candidate=""
|
|
40
|
+
for tok in "${tokens[@]}"; do
|
|
41
|
+
candidate="${candidate}$(printf '%s' "$tok" | cut -c1)"
|
|
42
|
+
done
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
printf '%s\n' "$candidate"
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Read-only, install-free structural verification of a scaffolded base workspace.
|
|
3
|
+
# Also reused as the self-validation grader spine.
|
|
4
|
+
#
|
|
5
|
+
# Usage: verify-scaffold.sh <workspace-root> <prefix>
|
|
6
|
+
# Exits non-zero if any check fails; prints a PASS/FAIL checklist.
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
|
|
9
|
+
ROOT="${1:?usage: verify-scaffold.sh <workspace-root> <prefix>}"
|
|
10
|
+
PREFIX="${2:?usage: verify-scaffold.sh <workspace-root> <prefix>}"
|
|
11
|
+
|
|
12
|
+
fail=0
|
|
13
|
+
pass() { printf ' PASS %s\n' "$1"; }
|
|
14
|
+
err() { printf ' FAIL %s\n' "$1"; fail=1; }
|
|
15
|
+
|
|
16
|
+
# exists <relative-path> <label>
|
|
17
|
+
exists() {
|
|
18
|
+
if [ -e "$ROOT/$1" ]; then pass "$2"; else err "$2 (missing: $1)"; fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# contains <relative-path> <pattern> <label>
|
|
22
|
+
contains() {
|
|
23
|
+
if [ -f "$ROOT/$1" ] && grep -qF "$2" "$ROOT/$1"; then
|
|
24
|
+
pass "$3"
|
|
25
|
+
else
|
|
26
|
+
err "$3 (expected '$2' in $1)"
|
|
27
|
+
fi
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# absent <relative-path> <pattern> <label>
|
|
31
|
+
absent() {
|
|
32
|
+
if [ -f "$ROOT/$1" ] && grep -qF "$2" "$ROOT/$1"; then
|
|
33
|
+
err "$3 (unexpected '$2' in $1)"
|
|
34
|
+
else
|
|
35
|
+
pass "$3"
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# json_parses <relative-path>
|
|
40
|
+
json_parses() {
|
|
41
|
+
if [ -f "$ROOT/$1" ]; then
|
|
42
|
+
if node -e "JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'))" "$ROOT/$1" 2>/dev/null; then
|
|
43
|
+
pass "valid JSON: $1"
|
|
44
|
+
else
|
|
45
|
+
err "invalid JSON: $1"
|
|
46
|
+
fi
|
|
47
|
+
fi
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
echo "Verifying scaffold at: $ROOT (prefix: $PREFIX)"
|
|
51
|
+
echo "--- structure ---"
|
|
52
|
+
exists "apps/web/src/main.ts" "apps/web main.ts"
|
|
53
|
+
exists "apps/web/src/main.server.ts" "apps/web main.server.ts"
|
|
54
|
+
exists "apps/web/src/server.ts" "apps/web server.ts"
|
|
55
|
+
exists "apps/web/src/app/app.config.server.ts" "apps/web app.config.server.ts"
|
|
56
|
+
exists "libs/shared/angular/src/index.ts" "shared lib index.ts"
|
|
57
|
+
|
|
58
|
+
echo "--- config ---"
|
|
59
|
+
contains "tsconfig.base.json" "@$PREFIX/angular" "tsconfig path alias @$PREFIX/angular"
|
|
60
|
+
absent "tsconfig.base.json" "/domain" "tsconfig has no feature-lib (domain) path aliases"
|
|
61
|
+
absent "tsconfig.base.json" "/shell/" "tsconfig has no feature-lib (shell) path aliases"
|
|
62
|
+
absent "nx.json" "nxCloudId" "nx.json has no nxCloudId"
|
|
63
|
+
contains "nx.json" "@angular/build:application" "nx.json build targetDefault"
|
|
64
|
+
contains "nx.json" "@nx/eslint:lint" "nx.json lint targetDefault"
|
|
65
|
+
contains "nx.json" "@nx/jest:jest" "nx.json jest targetDefault"
|
|
66
|
+
contains "eslint.config.mjs" "@$PREFIX/**" "eslint pathGroup @$PREFIX/**"
|
|
67
|
+
|
|
68
|
+
echo "--- toolchain ---"
|
|
69
|
+
# .nvmrc must exist and hold a version (the value is derived from Angular, not fixed here)
|
|
70
|
+
if [ -f "$ROOT/.nvmrc" ] && tr -d '[:space:]' < "$ROOT/.nvmrc" | grep -qE '^v?[0-9]+(\.[0-9]+){0,2}$'; then
|
|
71
|
+
pass ".nvmrc holds a Node version ($(tr -d '[:space:]' < "$ROOT/.nvmrc"))"
|
|
72
|
+
else
|
|
73
|
+
err ".nvmrc holds a Node version"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
echo "--- no feature deps ---"
|
|
77
|
+
for dep in "@ngrx/" "@ngx-translate/" "@nestjs/" "leaflet" "openseadragon" \
|
|
78
|
+
"masonry-layout" "@thisissoon/angular-masonry" "mongodb" "typeorm" \
|
|
79
|
+
"tailwindcss" "@smartsoft001/crud-shell-angular" "@smartsoft001-mobilems/"; do
|
|
80
|
+
absent "package.json" "$dep" "package.json excludes $dep"
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
echo "--- JSON validity ---"
|
|
84
|
+
json_parses "nx.json"
|
|
85
|
+
json_parses "tsconfig.base.json"
|
|
86
|
+
json_parses "package.json"
|
|
87
|
+
json_parses "apps/web/project.json"
|
|
88
|
+
json_parses "libs/shared/angular/project.json"
|
|
89
|
+
json_parses ".claude/settings.json"
|
|
90
|
+
|
|
91
|
+
echo "---"
|
|
92
|
+
if [ "$fail" -eq 0 ]; then
|
|
93
|
+
echo "RESULT: PASS"
|
|
94
|
+
else
|
|
95
|
+
echo "RESULT: FAIL"
|
|
96
|
+
fi
|
|
97
|
+
exit "$fail"
|