@smoothbricks/nx-plugin 0.6.1 → 0.6.3-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.
Files changed (104) hide show
  1. package/README.md +264 -55
  2. package/dist/.build-inputs.json +21 -15
  3. package/dist/bin/smoo-nx-publish.d.ts +3 -0
  4. package/dist/bin/smoo-nx-publish.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-publish.js +3 -0
  6. package/dist/cargo-retention-hook.d.ts +14 -3
  7. package/dist/cargo-retention-hook.d.ts.map +1 -1
  8. package/dist/cargo-retention-hook.js +25 -8
  9. package/dist/eslint-file-set.d.ts +4 -1
  10. package/dist/eslint-file-set.d.ts.map +1 -1
  11. package/dist/eslint-sources.d.ts +25 -0
  12. package/dist/eslint-sources.d.ts.map +1 -0
  13. package/dist/eslint-sources.js +99 -0
  14. package/dist/executors/all-verdicts/executor.d.ts +2 -1
  15. package/dist/executors/all-verdicts/executor.d.ts.map +1 -1
  16. package/dist/executors/all-verdicts/executor.js +48 -2
  17. package/dist/executors/all-verdicts/schema.d.ts +13 -0
  18. package/dist/executors/all-verdicts/schema.d.ts.map +1 -1
  19. package/dist/executors/all-verdicts/schema.js +7 -0
  20. package/dist/executors/bounded-exec/bounds.d.ts +57 -8
  21. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  22. package/dist/executors/bounded-exec/bounds.js +100 -11
  23. package/dist/executors/bounded-exec/executor.d.ts +2 -1
  24. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  25. package/dist/executors/bounded-exec/executor.js +270 -27
  26. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +2 -0
  27. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  28. package/dist/executors/bounded-exec/hang-diagnostics.js +27 -3
  29. package/dist/executors/bounded-exec/mbx-pool.d.ts +20 -3
  30. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  31. package/dist/executors/bounded-exec/mbx-pool.js +84 -4
  32. package/dist/executors/bounded-exec/mbx-queue.d.ts +30 -0
  33. package/dist/executors/bounded-exec/mbx-queue.d.ts.map +1 -0
  34. package/dist/executors/bounded-exec/mbx-queue.js +229 -0
  35. package/dist/executors/bounded-exec/progress.d.ts +9 -2
  36. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  37. package/dist/executors/bounded-exec/progress.js +148 -22
  38. package/dist/executors/bounded-exec/test-result-writer.d.ts +30 -0
  39. package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -0
  40. package/dist/executors/bounded-exec/test-result-writer.js +126 -0
  41. package/dist/executors/bounded-exec/test-results.d.ts +33 -0
  42. package/dist/executors/bounded-exec/test-results.d.ts.map +1 -0
  43. package/dist/executors/bounded-exec/test-results.js +33 -0
  44. package/dist/executors/bounded-exec/verdict.d.ts +20 -2
  45. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  46. package/dist/executors/bounded-exec/verdict.js +102 -4
  47. package/dist/index.d.ts +3 -2
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +67 -65
  50. package/dist/managed-files/files.d.ts.map +1 -1
  51. package/dist/managed-files/files.js +6 -0
  52. package/dist/nx-publish.d.ts +24 -0
  53. package/dist/nx-publish.d.ts.map +1 -0
  54. package/dist/nx-publish.js +150 -0
  55. package/dist/runtime-input-policy.d.ts +14 -0
  56. package/dist/runtime-input-policy.d.ts.map +1 -1
  57. package/dist/runtime-input-policy.js +1 -1
  58. package/dist/tool-bins.d.ts +6 -8
  59. package/dist/tool-bins.d.ts.map +1 -1
  60. package/dist/tool-bins.js +7 -5
  61. package/dist/workspace-index.d.ts +7 -0
  62. package/dist/workspace-index.d.ts.map +1 -1
  63. package/dist/workspace-index.js +11 -0
  64. package/executors.json +1 -1
  65. package/managed/raw/envrc +15 -0
  66. package/managed/raw/patches/ttsc@0.34.1.patch +75 -0
  67. package/managed/raw/tooling/devenv +1 -2
  68. package/managed/raw/tooling/direnv/developer-links.ts +15 -1
  69. package/managed/raw/tooling/direnv/devenv.smoo.nix +45 -13
  70. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -10
  71. package/managed/raw/tooling/direnv/linked-snapshots.ts +50 -13
  72. package/managed/raw/tooling/direnv/setup-environment.ts +36 -9
  73. package/managed/raw/tooling/direnv/ttsc-env.sh +8 -6
  74. package/managed/raw/tooling/git-hooks/pre-push.sh +4 -1
  75. package/managed/raw/tooling/git-reword-commit +151 -0
  76. package/managed/templates/github/actions/cache-node-modules/action.yml +1 -1
  77. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +12 -11
  78. package/package.json +226 -10
  79. package/runtime/nx-publish/cache_adapter.js +45 -0
  80. package/runtime/nx-publish/nx_publish.js +60 -0
  81. package/runtime-input.sh +12 -3
  82. package/src/bin/smoo-nx-publish.ts +4 -0
  83. package/src/cargo-retention-hook.ts +28 -11
  84. package/src/eslint-file-set.ts +4 -1
  85. package/src/eslint-sources.ts +134 -0
  86. package/src/executors/all-verdicts/executor.ts +58 -3
  87. package/src/executors/all-verdicts/schema.json +4 -0
  88. package/src/executors/all-verdicts/schema.ts +14 -0
  89. package/src/executors/bounded-exec/bounds.ts +132 -15
  90. package/src/executors/bounded-exec/executor.ts +303 -27
  91. package/src/executors/bounded-exec/hang-diagnostics.ts +31 -3
  92. package/src/executors/bounded-exec/mbx-pool.ts +82 -5
  93. package/src/executors/bounded-exec/mbx-queue.ts +170 -0
  94. package/src/executors/bounded-exec/progress.ts +168 -15
  95. package/src/executors/bounded-exec/test-result-writer.ts +152 -0
  96. package/src/executors/bounded-exec/test-results.ts +39 -0
  97. package/src/executors/bounded-exec/verdict.ts +108 -5
  98. package/src/index.ts +74 -70
  99. package/src/managed-files/files.ts +6 -0
  100. package/src/nx-publish.ts +157 -0
  101. package/src/runtime-input-policy.ts +1 -1
  102. package/src/tool-bins.ts +13 -9
  103. package/src/workspace-index.ts +12 -0
  104. package/test-timings.json +8 -2
@@ -6,15 +6,17 @@
6
6
  #
7
7
  # Exports ttsc's environment for this workspace: TTSC_TSGO_BINARY, the native
8
8
  # TypeScript compiler (ttsc resolves only the unscoped `typescript` package by
9
- # default, which here is the JavaScript compiler API), and TTSC_CACHE_DIR and
10
- # TTSC_GO_CACHE_DIR, where ttsc keeps the plugin binaries it compiles and the
11
- # Go build cache that compiles them.
9
+ # default, which here is the JavaScript compiler API), TTSC_CACHE_DIR, where ttsc
10
+ # keeps the plugin binaries it compiles (<checkout>/.cache/ttsc-plugins, the path
11
+ # a repository's ttsc plugin build target declares as its output), and
12
+ # TTSC_GO_CACHE_DIR, the Go build cache that compiles them
13
+ # (<checkout>/.cache/ttsc/go-build), a byproduct kept outside that output.
12
14
  #
13
15
  # This checkout is the directory the script is sourced from: devenv.smoo.nix's
14
16
  # enterShell enters the workspace root first, and each git hook enters
15
17
  # `git rev-parse --show-toplevel`. Sourced from any other directory, $PWD names
16
18
  # no checkout, and every cache below would land beside that directory instead:
17
- # a shell in HOME would create ~/.cache/ttsc. That directory is refused.
19
+ # a shell in HOME would create ~/.cache/ttsc-plugins. That directory is refused.
18
20
  if [ ! -f "$PWD/tooling/direnv/ttsc-env.sh" ]; then
19
21
  echo "ttsc-env.sh: not a workspace root (no tooling/direnv/ttsc-env.sh): $PWD; source it from the checkout root" >&2
20
22
  return 1
@@ -43,6 +45,6 @@ if [ -f "$PWD/tooling/direnv/typescript-go.nix" ]; then
43
45
  else
44
46
  export TTSC_TSGO_BINARY="$PWD/node_modules/@typescript/native/bin/tsc"
45
47
  fi
46
- export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc}"
47
- export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$TTSC_CACHE_DIR/go-build}"
48
+ export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc-plugins}"
49
+ export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$PWD/.cache/ttsc/go-build}"
48
50
  mkdir -p "$TTSC_GO_CACHE_DIR"
@@ -70,7 +70,10 @@ while read -r _local_ref local_sha _remote_ref _remote_sha; do
70
70
  esac
71
71
  done
72
72
  if [ "${#pushed[@]}" -gt 0 ]; then
73
- smoo monorepo check-public-denylist --remote "$1" "${pushed[@]}" || exit 1
73
+ smoo monorepo check-public-denylist --remote "$1" "${pushed[@]}" || {
74
+ echo 'pre-push: rewrite a refused commit message in place with tooling/git-reword-commit <commit> (the new message on stdin), then push again' >&2
75
+ exit 1
76
+ }
74
77
  fi
75
78
 
76
79
  case "$(uname -s)" in
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # git-reword-commit - Rewrite a commit message without affecting worktree
4
+ #
5
+ # Usage:
6
+ # echo "new message" | git-reword-commit <commit-hash>
7
+ # echo "prepend this" | git-reword-commit <commit-hash> --prepend
8
+ # echo "append this" | git-reword-commit <commit-hash> --append
9
+ # ... | git-reword-commit <commit-hash> --rewrite-published
10
+ #
11
+ # Examples:
12
+ # # Replace the entire commit message
13
+ # echo "feat: new message here" | git-reword-commit abc123
14
+ #
15
+ # # Prepend to existing message (adds newline between)
16
+ # cat msg.txt | git-reword-commit abc123 --prepend
17
+ #
18
+ # # Append to existing message (adds newline between)
19
+ # echo "Co-authored-by: Someone" | git-reword-commit abc123 --append
20
+ #
21
+ # The commit is rebuilt with `git commit-tree` from its own tree, parents, author and
22
+ # committer, and so is every commit between it and HEAD that descends from it; nothing else
23
+ # changes. HEAD -- a branch, or a detached HEAD -- moves once, with `git update-ref`, and only
24
+ # if it still names the commit it named when the rewrite began. The trees are the same, so the
25
+ # worktree and index are untouched, and no backup ref is left behind.
26
+ #
27
+ # A commit any remote-tracking ref already holds is published: rewriting it forks history
28
+ # others have. That is refused unless --rewrite-published says it is meant.
29
+ #
30
+
31
+ set -euo pipefail
32
+
33
+ usage() {
34
+ echo "Usage: <message> | git-reword-commit <commit-hash> [--prepend|--append] [--rewrite-published]"
35
+ echo ""
36
+ echo "Reads new commit message from stdin."
37
+ echo ""
38
+ echo "Modes:"
39
+ echo " (default) Replace the entire commit message"
40
+ echo " --prepend Prepend to existing message (adds newline between)"
41
+ echo " --append Append to existing message (adds newline between)"
42
+ echo " --rewrite-published Rewrite even though a remote-tracking ref holds the commit"
43
+ exit 1
44
+ }
45
+
46
+ if [ $# -lt 1 ]; then
47
+ usage
48
+ fi
49
+
50
+ COMMIT_SHORT="$1"
51
+ shift
52
+
53
+ COMMIT_FULL=$(git rev-parse --verify --quiet "$COMMIT_SHORT^{commit}") || {
54
+ echo "Error: Invalid commit reference: $COMMIT_SHORT" >&2
55
+ exit 1
56
+ }
57
+
58
+ MODE="replace"
59
+ REWRITE_PUBLISHED=0
60
+ for option in "$@"; do
61
+ case "$option" in
62
+ --prepend) MODE="prepend" ;;
63
+ --append) MODE="append" ;;
64
+ --rewrite-published) REWRITE_PUBLISHED=1 ;;
65
+ *)
66
+ echo "Error: Unknown option: $option" >&2
67
+ usage
68
+ ;;
69
+ esac
70
+ done
71
+
72
+ HEAD_BEFORE=$(git rev-parse --verify HEAD)
73
+ if ! git merge-base --is-ancestor "$COMMIT_FULL" "$HEAD_BEFORE"; then
74
+ echo "Error: $COMMIT_SHORT is not an ancestor of HEAD; there is nothing of it to rewrite here" >&2
75
+ exit 1
76
+ fi
77
+
78
+ PUBLISHED=$(git for-each-ref --contains "$COMMIT_FULL" --format='%(refname)' refs/remotes)
79
+ if [ -n "$PUBLISHED" ] && [ "$REWRITE_PUBLISHED" -ne 1 ]; then
80
+ echo "Error: $COMMIT_SHORT is already published; these remote-tracking refs hold it:" >&2
81
+ printf ' %s\n' $PUBLISHED >&2
82
+ echo "Rewriting it forks history others have. Pass --rewrite-published if that is meant." >&2
83
+ exit 1
84
+ fi
85
+
86
+ WORK=$(mktemp -d)
87
+ trap 'rm -rf "$WORK"' EXIT
88
+ cat > "$WORK/new"
89
+ if [ ! -s "$WORK/new" ]; then
90
+ echo "Error: Message cannot be empty (nothing on stdin)" >&2
91
+ usage
92
+ fi
93
+
94
+ # The message bytes of commit $1: everything after the header's terminating blank line.
95
+ # Continuation lines of a multi-line header (a signature) start with a space, never empty.
96
+ message_of() {
97
+ git cat-file commit "$1" | sed '1,/^$/d'
98
+ }
99
+
100
+ case "$MODE" in
101
+ replace) cp "$WORK/new" "$WORK/message" ;;
102
+ prepend) { cat "$WORK/new"; echo ''; echo ''; message_of "$COMMIT_FULL"; } > "$WORK/message" ;;
103
+ append) { message_of "$COMMIT_FULL"; echo ''; echo ''; cat "$WORK/new"; } > "$WORK/message" ;;
104
+ esac
105
+
106
+ # old -> new for every rebuilt commit, one "old new" pair per line; a parent not listed is kept.
107
+ : > "$WORK/map"
108
+ rebuilt() {
109
+ awk -v old="$1" '$1 == old { print $2; found = 1 } END { if (!found) print old }' "$WORK/map"
110
+ }
111
+
112
+ # Rebuild $1 on its rebuilt parents with the message in file $2, keeping tree, author and
113
+ # committer.
114
+ rebuild() {
115
+ local commit="$1" message="$2" parents=() parent listed
116
+ listed=$(git rev-parse "$commit^@")
117
+ for parent in $listed; do
118
+ parents+=(-p "$(rebuilt "$parent")")
119
+ done
120
+ local an ae ad cn ce cd
121
+ {
122
+ IFS= read -r an
123
+ IFS= read -r ae
124
+ IFS= read -r ad
125
+ IFS= read -r cn
126
+ IFS= read -r ce
127
+ IFS= read -r cd
128
+ } < <(git log --no-walk --format='%an%n%ae%n%ad%n%cn%n%ce%n%cd' --date=raw "$commit")
129
+ GIT_AUTHOR_NAME="$an" GIT_AUTHOR_EMAIL="$ae" GIT_AUTHOR_DATE="$ad" \
130
+ GIT_COMMITTER_NAME="$cn" GIT_COMMITTER_EMAIL="$ce" GIT_COMMITTER_DATE="$cd" \
131
+ git commit-tree "$commit^{tree}" ${parents[@]+"${parents[@]}"} < "$message"
132
+ }
133
+
134
+ echo "Rewriting commit $COMMIT_SHORT ($MODE mode)..."
135
+
136
+ NEW_COMMIT=$(rebuild "$COMMIT_FULL" "$WORK/message")
137
+ echo "$COMMIT_FULL $NEW_COMMIT" >> "$WORK/map"
138
+ DESCENDANTS=$(git rev-list --reverse --topo-order --ancestry-path "$COMMIT_FULL..$HEAD_BEFORE")
139
+ for descendant in $DESCENDANTS; do
140
+ message_of "$descendant" > "$WORK/descendant"
141
+ rebuilt_descendant=$(rebuild "$descendant" "$WORK/descendant")
142
+ echo "$descendant $rebuilt_descendant" >> "$WORK/map"
143
+ done
144
+
145
+ HEAD_AFTER=$(rebuilt "$HEAD_BEFORE")
146
+ git update-ref -m "git-reword-commit: reword $COMMIT_FULL" HEAD "$HEAD_AFTER" "$HEAD_BEFORE"
147
+
148
+ echo "Done. Commit message rewritten."
149
+ echo ""
150
+ echo "New commit: $NEW_COMMIT"
151
+ echo "New HEAD: $HEAD_AFTER"
@@ -8,7 +8,7 @@ runs:
8
8
  uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
9
9
  with:
10
10
  # Isolated Bun links and their targets are one dependency tree.
11
- # ttsc plugin/GOCACHE stay under $TTSC_CACHE_DIR (.cache/ttsc).
11
+ # ttsc plugins stay under $TTSC_CACHE_DIR (.cache/ttsc-plugins), its Go build cache under .cache/ttsc/go-build.
12
12
  # v2 isolates restore-keys from older Darwin caches with a broken TS dual-package hoist.
13
13
  path: |
14
14
  node_modules
@@ -1,9 +1,10 @@
1
1
  name: Cache ttsc plugins
2
2
  description: >
3
- Restore or save the compiled ttsc native plugin binaries (typia, etc.) under TTSC_CACHE_DIR/plugins. ttsc names every
4
- entry by a hash of what it was compiled from and skips the multi-minute `go build` when one matches. Setup restores
5
- them, and save-nix-devenv saves the entries the job used when the job ends, red or green. The Go object cache
6
- (go-build/) is NOT cached: it is multi-GB and only helps when the plugin key misses.
3
+ Restore or save the compiled ttsc native plugin binaries (typia, etc.) under TTSC_CACHE_DIR/plugins
4
+ (.cache/ttsc-plugins/plugins). ttsc names every entry by a hash of what it was compiled from and skips the
5
+ multi-minute `go build` when one matches. Setup restores them, and save-nix-devenv saves the entries the job used when
6
+ the job ends, red or green. The Go object cache (.cache/ttsc/go-build, outside the plugin root) is NOT cached: it is
7
+ multi-GB and only helps when the plugin key misses.
7
8
 
8
9
  inputs:
9
10
  mode:
@@ -22,8 +23,8 @@ runs:
22
23
  if: inputs.mode == 'restore'
23
24
  shell: bash
24
25
  run: |
25
- mkdir -p .cache/ttsc
26
- grep -E '^ +"(@ttsc/[^"]+|ttsc(/[^"]+)?)": |"ttsc": "' bun.lock > .cache/ttsc/plugin-lock-entries
26
+ mkdir -p .cache/ttsc-plugins
27
+ grep -E '^ +"(@ttsc/[^"]+|ttsc(/[^"]+)?)": |"ttsc": "' bun.lock > .cache/ttsc-plugins/plugin-lock-entries
27
28
 
28
29
  # A prefix hit is safe. ttsc names every entry by a hash of what it was compiled from (the ttsc and tsgo versions,
29
30
  # platform and architecture, the Go toolchain and its build environment, the plugin sources) and runs an entry only
@@ -35,10 +36,10 @@ runs:
35
36
  uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
36
37
  with:
37
38
  # Only the compiled plugin binaries (~30MB each). Path is relative to the
38
- # workspace; devenv sets TTSC_CACHE_DIR to <repo>/.cache/ttsc.
39
- path: .cache/ttsc/plugins
39
+ # workspace; devenv sets TTSC_CACHE_DIR to <repo>/.cache/ttsc-plugins.
40
+ path: .cache/ttsc-plugins/plugins
40
41
  # prettier-ignore
41
- key: ${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-${{ hashFiles('.cache/ttsc/plugin-lock-entries', 'patches/ttsc@*.patch', 'tooling/direnv/devenv.lock', 'tooling/direnv/devenv.smoo.nix') }}
42
+ key: ${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-${{ hashFiles('.cache/ttsc-plugins/plugin-lock-entries', 'patches/ttsc@*.patch', 'tooling/direnv/devenv.lock', 'tooling/direnv/devenv.smoo.nix') }}
42
43
  restore-keys: |
43
44
  ${{ runner.os }}-${{ runner.arch }}-ttsc-plugins-v1-
44
45
 
@@ -73,7 +74,7 @@ runs:
73
74
  shopt -s nullglob
74
75
  : "${SMOO_TTSC_PLUGINS_RESTORED_AT_MS:?the restore of this action records when the job restored the cache}"
75
76
  kept=0
76
- for entry in "$GITHUB_WORKSPACE"/.cache/ttsc/plugins/*/; do
77
+ for entry in "$GITHUB_WORKSPACE"/.cache/ttsc-plugins/plugins/*/; do
77
78
  entry="${entry%/}"
78
79
  case "$entry" in *.lock | *.lock.*) continue ;; esac
79
80
  used=0
@@ -92,5 +93,5 @@ runs:
92
93
  if: inputs.mode == 'save' && steps.prune.outputs.kept > 0
93
94
  uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
94
95
  with:
95
- path: .cache/ttsc/plugins
96
+ path: .cache/ttsc-plugins/plugins
96
97
  key: ${{ env.SMOO_TTSC_PLUGINS_SAVE_KEY }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.6.1",
3
+ "version": "0.6.3-0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -33,6 +33,16 @@
33
33
  "import": "./dist/bounded-test-policy.js",
34
34
  "default": "./dist/bounded-test-policy.js"
35
35
  },
36
+ "./test-results": {
37
+ "types": "./dist/executors/bounded-exec/test-results.d.ts",
38
+ "import": "./dist/executors/bounded-exec/test-results.js",
39
+ "default": "./dist/executors/bounded-exec/test-results.js"
40
+ },
41
+ "./test-results/host": {
42
+ "types": "./dist/executors/bounded-exec/test-result-writer.d.ts",
43
+ "import": "./dist/executors/bounded-exec/test-result-writer.js",
44
+ "default": "./dist/executors/bounded-exec/test-result-writer.js"
45
+ },
36
46
  "./build-state-output-policy": {
37
47
  "types": "./dist/build-state-output-policy.d.ts",
38
48
  "import": "./dist/build-state-output-policy.js",
@@ -138,6 +148,11 @@
138
148
  "import": "./dist/deploy-policy.js",
139
149
  "default": "./dist/deploy-policy.js"
140
150
  },
151
+ "./nx-publish": {
152
+ "types": "./dist/nx-publish.d.ts",
153
+ "import": "./dist/nx-publish.js",
154
+ "default": "./dist/nx-publish.js"
155
+ },
141
156
  "./managed-assets": {
142
157
  "types": "./dist/managed-assets.d.ts",
143
158
  "import": "./dist/managed-assets.js",
@@ -212,6 +227,7 @@
212
227
  "smoo-nx-bound-failures": "./dist/bin/smoo-nx-bound-failures.js",
213
228
  "smoo-nx-test-walks": "./dist/bin/smoo-nx-test-walks.js",
214
229
  "smoo-nx-test-clocks": "./dist/bin/smoo-nx-test-clocks.js",
230
+ "smoo-nx-publish": "./dist/bin/smoo-nx-publish.js",
215
231
  "smoo-nx-forbidden-spellings": "./dist/bin/smoo-nx-forbidden-spellings.js"
216
232
  },
217
233
  "generators": "./generators.json",
@@ -221,6 +237,67 @@
221
237
  },
222
238
  "nx": {
223
239
  "targets": {
240
+ "build": {
241
+ "dependsOn": [
242
+ "...",
243
+ "copy-nx-publish-assets"
244
+ ]
245
+ },
246
+ "copy-nx-publish-assets": {
247
+ "executor": "nx:run-commands",
248
+ "cache": true,
249
+ "inputs": [
250
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/build_volume/cache_adapter.js",
251
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/build_volume/nx_publish.js",
252
+ {
253
+ "externalDependencies": []
254
+ }
255
+ ],
256
+ "outputs": [
257
+ "{projectRoot}/runtime/nx-publish/"
258
+ ],
259
+ "options": {
260
+ "command": "asset_source=../cowshed/crates/cowshed-core/src/build_volume; if [ -e runtime/nx-publish ]; then rm -r runtime/nx-publish; fi && mkdir -p runtime/nx-publish && cp \"$asset_source/cache_adapter.js\" \"$asset_source/nx_publish.js\" runtime/nx-publish/",
261
+ "cwd": "{projectRoot}"
262
+ }
263
+ },
264
+ "test-nx-publish": {
265
+ "executor": "@smoothbricks/nx-plugin:bounded-exec",
266
+ "cache": true,
267
+ "inputs": [
268
+ "...",
269
+ "default",
270
+ "^dependencyDefault",
271
+ "bunToolchain",
272
+ {
273
+ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh node --version"
274
+ },
275
+ {
276
+ "dependentTasksOutputFiles": "**/dist/bin/smoo-nx-publish.js",
277
+ "transitive": true
278
+ },
279
+ {
280
+ "dependentTasksOutputFiles": "**/dist/nx-publish.js",
281
+ "transitive": true
282
+ },
283
+ {
284
+ "dependentTasksOutputFiles": "**/runtime/nx-publish/*.js",
285
+ "transitive": true
286
+ }
287
+ ],
288
+ "dependsOn": [
289
+ "...",
290
+ "tsc-js",
291
+ "copy-nx-publish-assets",
292
+ "typecheck-tests"
293
+ ],
294
+ "options": {
295
+ "command": "bun test --timeout=0 ./src/__tests__/nx-publish.cases.ts ./src/__tests__/nx-publish-bin.cases.ts",
296
+ "cwd": "{projectRoot}",
297
+ "idleTimeoutMs": 180000,
298
+ "killAfterMs": 10000
299
+ }
300
+ },
224
301
  "lint": {},
225
302
  "test": {
226
303
  "executor": "nx:noop",
@@ -230,13 +307,77 @@
230
307
  "test-shard3",
231
308
  "test-shard4",
232
309
  "test-host",
233
- "test-pool-silence"
310
+ "test-pool-silence",
311
+ "test-nx-publish",
312
+ "test-results-runtime"
234
313
  ]
235
314
  },
315
+ "closed-results-runtime-bundle": {
316
+ "executor": "nx:run-commands",
317
+ "cache": true,
318
+ "metadata": {
319
+ "smooTaskKind": "test"
320
+ },
321
+ "dependsOn": [
322
+ "tsc-js",
323
+ "typecheck-tests"
324
+ ],
325
+ "inputs": [
326
+ "{projectRoot}/src/__tests__/test-results-runtime.entry.ts",
327
+ "{projectRoot}/package.json",
328
+ "{projectRoot}/tsconfig.json",
329
+ "{workspaceRoot}/tsconfig.base.json",
330
+ "bunToolchain",
331
+ {
332
+ "externalDependencies": [
333
+ "bun-lock:packages/nx-plugin"
334
+ ]
335
+ },
336
+ {
337
+ "dependentTasksOutputFiles": "**/dist/**/*.js",
338
+ "transitive": false
339
+ }
340
+ ],
341
+ "outputs": [
342
+ "{projectRoot}/.cache/test-results-runtime/"
343
+ ],
344
+ "options": {
345
+ "command": "bun build src/__tests__/test-results-runtime.entry.ts --target=bun --conditions=production --outfile=.cache/test-results-runtime/bundle.mjs",
346
+ "cwd": "{projectRoot}"
347
+ }
348
+ },
349
+ "test-results-runtime": {
350
+ "executor": "@smoothbricks/nx-plugin:bounded-exec",
351
+ "cache": true,
352
+ "dependsOn": [
353
+ "...",
354
+ "closed-results-runtime-bundle"
355
+ ],
356
+ "inputs": [
357
+ "...",
358
+ "bunToolchain",
359
+ {
360
+ "externalDependencies": [
361
+ "bun-lock:packages/nx-plugin"
362
+ ]
363
+ },
364
+ {
365
+ "dependentTasksOutputFiles": "**/test-results-runtime/bundle.mjs",
366
+ "transitive": false
367
+ }
368
+ ],
369
+ "options": {
370
+ "command": "bun .cache/test-results-runtime/bundle.mjs",
371
+ "cwd": "{projectRoot}",
372
+ "idleTimeoutMs": 180000,
373
+ "killAfterMs": 10000
374
+ }
375
+ },
236
376
  "test-pool-silence": {
237
377
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
238
378
  "cache": true,
239
379
  "inputs": [
380
+ "...",
240
381
  "default",
241
382
  "^dependencyDefault",
242
383
  "bunToolchain",
@@ -249,14 +390,49 @@
249
390
  "killAfterMs": 10000
250
391
  }
251
392
  },
393
+ "cargo-stream-archive": {
394
+ "executor": "nx:run-commands",
395
+ "cache": true,
396
+ "metadata": {
397
+ "smooTaskKind": "test"
398
+ },
399
+ "inputs": [
400
+ "{projectRoot}/test-fixtures/stream-witness/**/*",
401
+ "!{projectRoot}/test-fixtures/stream-witness/target/**/*",
402
+ "{workspaceRoot}/.cargo/config",
403
+ "{workspaceRoot}/.cargo/config.toml",
404
+ "cargoToolchain",
405
+ {
406
+ "externalDependencies": []
407
+ }
408
+ ],
409
+ "outputs": [
410
+ "{projectRoot}/.cache/test-stream/archive.tar.zst"
411
+ ],
412
+ "options": {
413
+ "command": "mkdir -p .cache/test-stream && cargo --frozen nextest archive --manifest-path test-fixtures/stream-witness/Cargo.toml --archive-file .cache/test-stream/archive.tar.zst --user-config-file none",
414
+ "cwd": "{projectRoot}"
415
+ }
416
+ },
252
417
  "test-shard1": {
253
418
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
254
419
  "cache": true,
255
420
  "inputs": [
421
+ "...",
256
422
  "default",
257
423
  "^dependencyDefault",
258
424
  "bunToolchain",
259
- "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs"
425
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs",
426
+ {
427
+ "dependentTasksOutputFiles": "**/test-stream/archive.tar.zst",
428
+ "transitive": false
429
+ }
430
+ ],
431
+ "dependsOn": [
432
+ "...",
433
+ "^build",
434
+ "build",
435
+ "cargo-stream-archive"
260
436
  ],
261
437
  "options": {
262
438
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=1/4 --path-ignore-patterns='**/*-host.test.ts'",
@@ -269,10 +445,21 @@
269
445
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
270
446
  "cache": true,
271
447
  "inputs": [
448
+ "...",
272
449
  "default",
273
450
  "^dependencyDefault",
274
451
  "bunToolchain",
275
- "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs"
452
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs",
453
+ {
454
+ "dependentTasksOutputFiles": "**/test-stream/archive.tar.zst",
455
+ "transitive": false
456
+ }
457
+ ],
458
+ "dependsOn": [
459
+ "...",
460
+ "^build",
461
+ "build",
462
+ "cargo-stream-archive"
276
463
  ],
277
464
  "options": {
278
465
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=2/4 --path-ignore-patterns='**/*-host.test.ts'",
@@ -285,10 +472,21 @@
285
472
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
286
473
  "cache": true,
287
474
  "inputs": [
475
+ "...",
288
476
  "default",
289
477
  "^dependencyDefault",
290
478
  "bunToolchain",
291
- "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs"
479
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs",
480
+ {
481
+ "dependentTasksOutputFiles": "**/test-stream/archive.tar.zst",
482
+ "transitive": false
483
+ }
484
+ ],
485
+ "dependsOn": [
486
+ "...",
487
+ "^build",
488
+ "build",
489
+ "cargo-stream-archive"
292
490
  ],
293
491
  "options": {
294
492
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=3/4 --path-ignore-patterns='**/*-host.test.ts'",
@@ -301,10 +499,21 @@
301
499
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
302
500
  "cache": true,
303
501
  "inputs": [
502
+ "...",
304
503
  "default",
305
504
  "^dependencyDefault",
306
505
  "bunToolchain",
307
- "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs"
506
+ "{workspaceRoot}/packages/cowshed/crates/cowshed-core/src/port_zero.cjs",
507
+ {
508
+ "dependentTasksOutputFiles": "**/test-stream/archive.tar.zst",
509
+ "transitive": false
510
+ }
511
+ ],
512
+ "dependsOn": [
513
+ "...",
514
+ "^build",
515
+ "build",
516
+ "cargo-stream-archive"
308
517
  ],
309
518
  "options": {
310
519
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=4/4 --path-ignore-patterns='**/*-host.test.ts'",
@@ -317,6 +526,7 @@
317
526
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
318
527
  "cache": true,
319
528
  "inputs": [
529
+ "...",
320
530
  "default",
321
531
  "^dependencyDefault",
322
532
  "bunToolchain",
@@ -329,6 +539,7 @@
329
539
  }
330
540
  ],
331
541
  "dependsOn": [
542
+ "...",
332
543
  {
333
544
  "projects": [
334
545
  "cowshed"
@@ -356,6 +567,9 @@
356
567
  "tags": [
357
568
  "npm:public"
358
569
  ],
570
+ "implicitDependencies": [
571
+ "!cowshed"
572
+ ],
359
573
  "name": "nx-plugin"
360
574
  },
361
575
  "files": [
@@ -371,7 +585,8 @@
371
585
  "!**/*.tsbuildinfo",
372
586
  "!src/**/*.test.ts",
373
587
  "!src/**/__tests__",
374
- "managed"
588
+ "managed",
589
+ "runtime/nx-publish"
375
590
  ],
376
591
  "license": "MIT",
377
592
  "publishConfig": {
@@ -384,9 +599,10 @@
384
599
  },
385
600
  "dependencies": {
386
601
  "@nx/js": "23.2.1",
387
- "@smoothbricks/build-inputs": "0.0.1-next.0",
388
- "@smoothbricks/cargo-retain": "0.0.1-next.0",
389
- "@smoothbricks/nextest-extract": "0.0.1-next.0",
602
+ "@smoothbricks/build-inputs": "0.0.1",
603
+ "@smoothbricks/cargo-retain": "0.0.1",
604
+ "@smoothbricks/cowshed": "0.4.2",
605
+ "@smoothbricks/nextest-extract": "0.0.1",
390
606
  "jsonc-parser": "^3.3.1",
391
607
  "minimatch": "10.2.5",
392
608
  "nx": "latest",
@@ -0,0 +1,45 @@
1
+ // One version-sensitive boundary for the checkout's own Nx cache (05_gateway.md, "Publication").
2
+ // DbCache and its native cache field are INTERNAL Nx 23.2.1 APIs, not a public stable adapter.
3
+ // biome-ignore lint/correctness/noUnusedVariables: invoked by the bodies cache_adapter::script prefixes (cache_adapter.rs), not from this file.
4
+ function openNxCache(root) {
5
+ const path = require('node:path');
6
+ const { createRequire } = require('node:module');
7
+ if (!root || !path.isAbsolute(root)) {
8
+ throw new Error(`Nx cache adapter requires an absolute checkout root, got ${JSON.stringify(root)}`);
9
+ }
10
+ const requireNx = createRequire(path.join(root, 'package.json'));
11
+ const version = requireNx('nx/package.json').version;
12
+ if (version !== '23.2.1') {
13
+ throw new Error(
14
+ `Nx cache adapter supports exactly Nx 23.2.1, not ${version}; requalify the adapter before upgrading`,
15
+ );
16
+ }
17
+ // Nx fixes these paths at module load. Every root is handled in its own existing job process.
18
+ process.env.NX_WORKSPACE_ROOT_PATH = root;
19
+ process.env.NX_WORKSPACE_DATA_DIRECTORY = path.join(root, '.nx', 'workspace-data');
20
+ process.env.NX_CACHE_DIRECTORY = path.join(root, '.nx', 'cache');
21
+ if (requireNx('nx/src/native').IS_WASM) {
22
+ throw new Error('The Nx cache adapter requires the pinned native database cache, not WASM');
23
+ }
24
+ // Nx resolves its workspace-data directory itself; prove it is this checkout's before any database is opened.
25
+ const { sharedDataDirectory } = requireNx('nx/src/utils/cache-directory');
26
+ const workspaceData = path.join(root, '.nx', 'workspace-data');
27
+ const actualWorkspaceData = sharedDataDirectory(root, 'workspace-data');
28
+ if (path.resolve(actualWorkspaceData) !== path.resolve(workspaceData)) {
29
+ throw new Error(
30
+ `Nx 23.2.1 workspace-data directory changed: expected ${workspaceData}, actual ${actualWorkspaceData}`,
31
+ );
32
+ }
33
+ const { DbCache } = requireNx('nx/src/tasks-runner/cache');
34
+ // Construction, not init(): Nx owns all schema/metadata setup; no remote loader is contacted.
35
+ const cache = new DbCache({ nxCloudRemoteCache: null, skipRemoteCache: true });
36
+ const native = cache.cache;
37
+ if (!native || typeof native.get !== 'function' || typeof native.cacheDirectory !== 'string') {
38
+ throw new Error('Nx 23.2.1 DbCache native cache surface changed; requalify the adapter');
39
+ }
40
+ const expectedCacheDir = path.join(root, '.nx', 'cache');
41
+ if (path.resolve(native.cacheDirectory) !== path.resolve(expectedCacheDir)) {
42
+ throw new Error(`Nx 23.2.1 cache directory changed: expected ${expectedCacheDir}, actual ${native.cacheDirectory}`);
43
+ }
44
+ return { requireNx, cache, cacheDir: native.cacheDirectory, getLocal: (hash) => native.get(hash) };
45
+ }