@soleur/opencode 3.359.18 → 3.360.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/agents/product/design/ux-design-lead.md +49 -13
- package/package.json +1 -1
- package/skills/brainstorm/SKILL.md +3 -3
- package/skills/brainstorm/references/brainstorm-brand-workshop.md +17 -10
- package/skills/pencil-setup/SKILL.md +77 -27
- package/skills/pencil-setup/scripts/check_deps.sh +597 -132
- package/skills/pencil-setup/scripts/copy_adapter.sh +79 -11
- package/skills/pencil-setup/scripts/engine-contract-probe.sh +1132 -133
- package/skills/pencil-setup/scripts/pen-cli/package-lock.json +4359 -0
- package/skills/pencil-setup/scripts/pen-cli/package.json +13 -0
- package/skills/pencil-setup/scripts/pencil-error-enrichment.mjs +67 -14
- package/skills/pencil-setup/scripts/pencil-mcp-adapter.mjs +1283 -458
- package/skills/pencil-setup/scripts/pencil-repl-surface.mjs +377 -68
- package/skills/pencil-setup/scripts/pencil-response-classify.mjs +53 -12
- package/skills/pencil-setup/scripts/pencil-save-gate.mjs +484 -75
- package/skills/plan/SKILL.md +1 -1
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
# 0 copy succeeded (or repo already matches install)
|
|
12
12
|
# 1 repo adapter or one of its sibling modules missing (should never happen inside the plugin)
|
|
13
13
|
# 2 install directory not writable
|
|
14
|
+
# 3 the adapter's dependency install (`npm ci`) failed: the installed adapter files and its
|
|
15
|
+
# node_modules were left exactly as they were (the install runs in <dir>.new and is swapped in
|
|
16
|
+
# only on success), so a working older adapter keeps working; re-run, or:
|
|
17
|
+
# bash check_deps.sh --check-adapter-drift --auto
|
|
14
18
|
|
|
15
19
|
set -euo pipefail
|
|
16
20
|
|
|
@@ -50,6 +54,81 @@ mkdir -p "$INSTALL_DIR" || {
|
|
|
50
54
|
exit 2
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
# The adapter also needs its own node_modules for the MCP SDK and zod. They are installed FIRST, into
|
|
58
|
+
# a staging directory beside the install dir (<dir>.new), and swapped in only when `npm ci` succeeded;
|
|
59
|
+
# the adapter files are copied after that. `npm ci` deletes node_modules before it installs, so
|
|
60
|
+
# installing in place (and copying the new files first) would turn a working older adapter into a dead
|
|
61
|
+
# new one whenever the install fails (offline, a registry error): now a failure leaves the old files
|
|
62
|
+
# and the old node_modules exactly as they were.
|
|
63
|
+
#
|
|
64
|
+
# An install is needed when node_modules is missing or was not built from the lockfile now in the repo:
|
|
65
|
+
# the stamp inside node_modules records the sha256 of the package-lock.json it was installed from
|
|
66
|
+
# (node_modules with no stamp counts as unknown and is rebuilt once). Keyed on the hash, not on
|
|
67
|
+
# node_modules existing, so a dependency bump actually reaches the install. The manifests installed
|
|
68
|
+
# from are the REPO's own copies (never a package.json an install dir could have planted), with
|
|
69
|
+
# --ignore-scripts so no pre/postinstall script runs, and the credential names are removed from npm's
|
|
70
|
+
# environment so install-time code never sees them.
|
|
71
|
+
lock_sha() {
|
|
72
|
+
if command -v sha256sum >/dev/null 2>&1; then sha256sum -- "$1" | awk '{print $1}'; else shasum -a 256 -- "$1" | awk '{print $1}'; fi
|
|
73
|
+
}
|
|
74
|
+
INSTALL_DIR="${INSTALL_DIR%/}"
|
|
75
|
+
[[ -n "$INSTALL_DIR" ]] || { echo "ERROR: install dir resolves to the filesystem root" >&2; exit 2; }
|
|
76
|
+
NM="$INSTALL_DIR/node_modules"
|
|
77
|
+
NM_OLD="$INSTALL_DIR/.node_modules.old"
|
|
78
|
+
STAGE="$INSTALL_DIR.new"
|
|
79
|
+
LOCK_STAMP="$NM/.soleur-package-lock.sha256"
|
|
80
|
+
|
|
81
|
+
# A swap interrupted between its two renames leaves no node_modules and the working one in the backup:
|
|
82
|
+
# put it back before anything else (nothing is deleted).
|
|
83
|
+
if [[ ! -e "$NM" && -d "$NM_OLD" ]]; then
|
|
84
|
+
mv -- "$NM_OLD" "$NM" && echo "Restored the previous node_modules from $NM_OLD (an earlier install was interrupted)"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
npm_failed=0
|
|
88
|
+
want_sha=$(lock_sha "$REPO_ADAPTER_DIR/package-lock.json")
|
|
89
|
+
have_sha=""
|
|
90
|
+
[[ -f "$LOCK_STAMP" ]] && have_sha=$(cat "$LOCK_STAMP")
|
|
91
|
+
if [[ ! -d "$NM" ]] || [[ -z "$want_sha" ]] || [[ "$want_sha" != "$have_sha" ]]; then
|
|
92
|
+
echo "Installing adapter dependencies in $INSTALL_DIR..."
|
|
93
|
+
rm -rf -- "$STAGE"
|
|
94
|
+
if ! (umask 022; mkdir -p "$STAGE") || ! cp -- "$REPO_ADAPTER_DIR/package.json" "$REPO_ADAPTER_DIR/package-lock.json" "$STAGE/"; then
|
|
95
|
+
rm -rf -- "$STAGE"
|
|
96
|
+
echo "ERROR: cannot prepare the staging directory $STAGE; the installed adapter was left unchanged" >&2
|
|
97
|
+
exit 2
|
|
98
|
+
fi
|
|
99
|
+
# The exit status is npm's own, captured before the output is trimmed (a pipeline into `tail`
|
|
100
|
+
# would report tail's status and turn a failed install into a success). umask 022 so the
|
|
101
|
+
# packages are never group-writable (a umask of 002 would otherwise do that).
|
|
102
|
+
npm_out=$(umask 022; cd "$STAGE" && env -u PEN_CLI_KEY -u PENCIL_CLI_KEY npm ci --ignore-scripts --silent 2>&1) && npm_rc=0 || npm_rc=$?
|
|
103
|
+
[[ -z "$npm_out" ]] || printf '%s\n' "$npm_out" | tail -5
|
|
104
|
+
if [[ "$npm_rc" -eq 0 && -d "$STAGE/node_modules" ]]; then
|
|
105
|
+
[[ -z "$want_sha" ]] || printf '%s\n' "$want_sha" > "$STAGE/node_modules/.soleur-package-lock.sha256" 2>/dev/null || true
|
|
106
|
+
rm -rf -- "$NM_OLD"
|
|
107
|
+
swap_ok=1
|
|
108
|
+
if [[ -e "$NM" ]]; then mv -- "$NM" "$NM_OLD" || swap_ok=0; fi
|
|
109
|
+
if [[ "$swap_ok" -eq 1 ]] && ! mv -- "$STAGE/node_modules" "$NM"; then
|
|
110
|
+
swap_ok=0
|
|
111
|
+
[[ ! -e "$NM_OLD" ]] || mv -- "$NM_OLD" "$NM"
|
|
112
|
+
fi
|
|
113
|
+
rm -rf -- "$STAGE"
|
|
114
|
+
if [[ "$swap_ok" -eq 1 ]]; then
|
|
115
|
+
rm -rf -- "$NM_OLD"
|
|
116
|
+
else
|
|
117
|
+
echo "ERROR: cannot move the new node_modules into place in $INSTALL_DIR; the installed adapter was left unchanged" >&2
|
|
118
|
+
exit 2
|
|
119
|
+
fi
|
|
120
|
+
else
|
|
121
|
+
rm -rf -- "$STAGE"
|
|
122
|
+
echo "WARN: npm ci failed (exit $npm_rc) for the adapter's dependencies: the installed adapter and its node_modules were left unchanged in $INSTALL_DIR. Re-run, or: bash check_deps.sh --check-adapter-drift --auto" >&2
|
|
123
|
+
npm_failed=1
|
|
124
|
+
fi
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
if [[ "$npm_failed" -ne 0 ]]; then
|
|
128
|
+
echo "ERROR: adapter dependencies were not installed (npm ci failed); nothing was copied" >&2
|
|
129
|
+
exit 3
|
|
130
|
+
fi
|
|
131
|
+
|
|
53
132
|
copied=0
|
|
54
133
|
for file in "${ADAPTER_FILES[@]}"; do
|
|
55
134
|
src="$REPO_ADAPTER_DIR/$file"
|
|
@@ -68,17 +147,6 @@ for file in "${ADAPTER_FILES[@]}"; do
|
|
|
68
147
|
copied=$((copied + 1))
|
|
69
148
|
done
|
|
70
149
|
|
|
71
|
-
# The adapter also needs its own node_modules for the MCP SDK and zod.
|
|
72
|
-
# If the install dir has a package.json but no node_modules, run npm ci
|
|
73
|
-
# with --ignore-scripts so a hostile package.json in a user-supplied
|
|
74
|
-
# PENCIL_ADAPTER_INSTALL_DIR cannot execute pre/postinstall scripts.
|
|
75
|
-
if [[ -f "$INSTALL_DIR/package.json" ]] && [[ ! -d "$INSTALL_DIR/node_modules" ]]; then
|
|
76
|
-
echo "Installing adapter dependencies in $INSTALL_DIR..."
|
|
77
|
-
(cd "$INSTALL_DIR" && npm ci --ignore-scripts --silent 2>&1 | tail -5) || {
|
|
78
|
-
echo "WARN: npm ci failed — run manually in $INSTALL_DIR" >&2
|
|
79
|
-
}
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
150
|
if [[ "$copied" -eq 0 ]]; then
|
|
83
151
|
echo "OK: adapter already in sync at $INSTALL_DIR"
|
|
84
152
|
else
|