dsh-plugin-toolkit 0.20.43 → 0.20.44
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/CHANGELOG.md +15 -0
- package/README.md +10 -2
- package/lib/audit.mjs +105 -60
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 0.20.44
|
|
2
|
+
|
|
3
|
+
- **`audit --home` reports a declared bundle whose `package.json` parses but has
|
|
4
|
+
no `dsh` field.** The install scan skipped every package without a `dsh` field
|
|
5
|
+
as an ordinary dependency, even when the profile named it in
|
|
6
|
+
`dsh.profile.bundles`. A profile that mounted one such broken bundle printed
|
|
7
|
+
"no plugins installed in any profile" and exited 0, so CI saw a clean profile
|
|
8
|
+
the loader could not mount. The scan now emits a `no dsh field` row with a
|
|
9
|
+
`dsh field` failure naming the declaring `package.json` and exits 1. Packages
|
|
10
|
+
the profile does not declare keep the old skip, so a profile containing only
|
|
11
|
+
ordinary dependencies still exits 0. `test/audit-home-no-dsh.test.mjs` pins
|
|
12
|
+
the ghost row and its exit status at the CLI beside a valid declared bundle
|
|
13
|
+
and a profile holding only ordinary dependencies, while `test/audit.test.mjs`
|
|
14
|
+
covers the row and the declared-name fallback.
|
|
15
|
+
|
|
1
16
|
## 0.20.43
|
|
2
17
|
|
|
3
18
|
- **A host-aimed repair keeps the floor of a hyphen range that crosses the next
|
package/README.md
CHANGED
|
@@ -327,8 +327,9 @@ directory still exits `0` with that line, and omitting `--home` still scans the
|
|
|
327
327
|
default `~/.dsh`.
|
|
328
328
|
|
|
329
329
|
Without `--host` the loaded column is `?`, because guessing would be worse than
|
|
330
|
-
saying nothing. Only packages that declare a `dsh` field
|
|
331
|
-
`
|
|
330
|
+
saying nothing. Only packages that declare a `dsh` field, plus packages the
|
|
331
|
+
profile names in `dsh.profile.bundles`, are audited — the rest of `node_modules`
|
|
332
|
+
is ordinary dependencies, and auditing those is noise.
|
|
332
333
|
|
|
333
334
|
An installed package whose `package.json` cannot be read is the exception: the
|
|
334
335
|
`dsh` field that would mark it as a plugin is in the file that failed to parse.
|
|
@@ -341,6 +342,13 @@ damaged `package.json` in a package that is neither in `dsh.profile.bundles` nor
|
|
|
341
342
|
readable enough to expose a `dsh` field is still an ordinary dependency and is
|
|
342
343
|
skipped, so one broken transitive install does not fail every audit.
|
|
343
344
|
|
|
345
|
+
A declared bundle can also parse but carry no `dsh` field at all. The profile
|
|
346
|
+
says the loader will mount it, so `audit` prints a `no dsh field` row with a
|
|
347
|
+
`dsh field` failure naming the declaring `package.json` and exits `1`, instead
|
|
348
|
+
of skipping the package and reporting the profile as having no plugins. The
|
|
349
|
+
skip still applies to a package that is not in `dsh.profile.bundles`; a profile
|
|
350
|
+
containing only ordinary dependencies prints no plugin rows and exits `0`.
|
|
351
|
+
|
|
344
352
|
A declared bundle can also be missing entirely. If a name stays in
|
|
345
353
|
`dsh.profile.bundles` after its `node_modules/<name>` folder is removed (an
|
|
346
354
|
interrupted install, or a package deleted by hand), `audit` prints a `missing`
|
package/lib/audit.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import os from 'node:os';
|
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
+
checkDshField,
|
|
15
16
|
checkHostCompatibility,
|
|
16
17
|
doctor,
|
|
17
18
|
hostRange,
|
|
@@ -138,6 +139,26 @@ function missingInstalled({ dir, name, profile }) {
|
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* A declared bundle whose `package.json` parses but has no `dsh` field. The
|
|
144
|
+
* folder is installed and `dsh.profile.bundles` names it, so the loader will
|
|
145
|
+
* look for a plugin definition that is not there. Skipping it as an ordinary
|
|
146
|
+
* dependency made a profile with one broken declared bundle report "no plugins
|
|
147
|
+
* installed" and exit 0, which is the false clean this record prevents.
|
|
148
|
+
*/
|
|
149
|
+
function noDshInstalled({ dir, name, manifest, profile, manifestPath }) {
|
|
150
|
+
return {
|
|
151
|
+
dir,
|
|
152
|
+
// The profile's list is the name the loader will look for, so the row names
|
|
153
|
+
// the declared bundle even if its manifest omits `name` (or disagrees).
|
|
154
|
+
manifest: { ...manifest, name },
|
|
155
|
+
profile,
|
|
156
|
+
manifestPath,
|
|
157
|
+
noDsh: true,
|
|
158
|
+
error: checkDshField(manifest),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
141
162
|
/** Every package folder inside every profile, scoped names included. */
|
|
142
163
|
export function listInstalled({ home = DEFAULT_HOME } = {}) {
|
|
143
164
|
const root = resolvePath(home);
|
|
@@ -221,8 +242,16 @@ export function listInstalled({ home = DEFAULT_HOME } = {}) {
|
|
|
221
242
|
continue;
|
|
222
243
|
}
|
|
223
244
|
// Only packages that declare themselves as plugins. node_modules is full
|
|
224
|
-
// of ordinary dependencies, and auditing those is noise.
|
|
225
|
-
|
|
245
|
+
// of ordinary dependencies, and auditing those is noise. A package the
|
|
246
|
+
// profile lists in `dsh.profile.bundles` is different: the profile says
|
|
247
|
+
// the loader will mount it, so a parsed manifest without a dsh field is
|
|
248
|
+
// a broken declared bundle, not an ordinary dependency to omit.
|
|
249
|
+
if (manifest.dsh === undefined) {
|
|
250
|
+
if (listedInProfile === true) {
|
|
251
|
+
found.push(noDshInstalled({ dir, name, manifest, profile, manifestPath }));
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
226
255
|
found.push({ dir, manifest, profile });
|
|
227
256
|
}
|
|
228
257
|
}
|
|
@@ -823,60 +852,71 @@ export async function audit({
|
|
|
823
852
|
}
|
|
824
853
|
|
|
825
854
|
const profileFiles = new Map();
|
|
826
|
-
const rows = installed.map(
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
failures = [{ check: '
|
|
855
|
+
const rows = installed.map(
|
|
856
|
+
({ dir, manifest, profile, manifestPath, unreadable = false, missing = false, noDsh = false, error }) => {
|
|
857
|
+
let failures;
|
|
858
|
+
if (missing === true) {
|
|
859
|
+
// The folder is gone, so there is no manifest for doctor to read. The
|
|
860
|
+
// profile record is the evidence, and the row must name the absent path.
|
|
861
|
+
failures = [{ check: 'install', message: error }];
|
|
862
|
+
} else if (unreadable === true) {
|
|
863
|
+
// doctor would throw on the same file; keep the read error the install
|
|
864
|
+
// scan already recorded so the row names the unreadable package.json.
|
|
865
|
+
failures = [{ check: 'manifest', message: error }];
|
|
866
|
+
} else if (noDsh === true) {
|
|
867
|
+
// The declared bundle's manifest parses, but there is no `dsh` field for
|
|
868
|
+
// the loader to mount. Say that once, in the same check name doctor uses.
|
|
869
|
+
failures = [{ check: 'dsh field', message: error ?? checkDshField(manifest) }];
|
|
870
|
+
} else {
|
|
871
|
+
try {
|
|
872
|
+
({ failures } = doctor(dir, { installed: true }));
|
|
873
|
+
} catch (caught) {
|
|
874
|
+
failures = [{ check: 'manifest', message: caught.message }];
|
|
875
|
+
}
|
|
841
876
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
877
|
+
const loaded = graph?.ok === true ? graph.ids.has(manifest.name) : null;
|
|
878
|
+
let explanation = null;
|
|
879
|
+
if (missing === true) {
|
|
880
|
+
explanation = {
|
|
881
|
+
reason: `dsh.profile.bundles lists it, but ${dir} is missing, so there is no installed copy to mount`,
|
|
882
|
+
action: `reinstall ${manifest.name} (for example \`dsh plugin add ${manifest.name}\`), then restart the app`,
|
|
883
|
+
};
|
|
884
|
+
} else if (unreadable === true) {
|
|
885
|
+
explanation = {
|
|
886
|
+
reason: `${manifestPath} is unreadable, so the loader cannot tell what to mount`,
|
|
887
|
+
action: `reinstall ${manifest.name} so its package.json is written completely`,
|
|
888
|
+
};
|
|
889
|
+
} else if (noDsh === true) {
|
|
890
|
+
explanation = {
|
|
891
|
+
reason: 'dsh.profile.bundles lists it, but its package.json parses with no "dsh" field, so the loader has nothing to mount',
|
|
892
|
+
action: `add dsh.bundle.patch to ${manifestPath} (and ship the patch file it names), or remove "${manifest.name}" from dsh.profile.bundles, then restart the app`,
|
|
893
|
+
};
|
|
894
|
+
} else if (loaded === false) {
|
|
895
|
+
if (profileFiles.has(profile) === false) {
|
|
896
|
+
profileFiles.set(profile, readProfileBundles({ home, profile }));
|
|
897
|
+
}
|
|
898
|
+
const listed = profileFiles.get(profile);
|
|
899
|
+
explanation = explainNotLoaded({
|
|
900
|
+
manifest,
|
|
901
|
+
name: manifest.name,
|
|
902
|
+
profileFile: listed.file,
|
|
903
|
+
bundles: listed.bundles,
|
|
904
|
+
});
|
|
858
905
|
}
|
|
859
|
-
|
|
860
|
-
explanation = explainNotLoaded({
|
|
861
|
-
manifest,
|
|
906
|
+
return {
|
|
862
907
|
name: manifest.name,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
unreadable: unreadable === true,
|
|
876
|
-
missing: missing === true,
|
|
877
|
-
reason: explanation?.reason ?? null,
|
|
878
|
-
action: explanation?.action ?? null,
|
|
879
|
-
};
|
|
908
|
+
version: manifest.version ?? '?',
|
|
909
|
+
profile,
|
|
910
|
+
dir,
|
|
911
|
+
failures,
|
|
912
|
+
...split(failures),
|
|
913
|
+
loaded,
|
|
914
|
+
unreadable: unreadable === true,
|
|
915
|
+
missing: missing === true,
|
|
916
|
+
noDsh: noDsh === true,
|
|
917
|
+
reason: explanation?.reason ?? null,
|
|
918
|
+
action: explanation?.action ?? null,
|
|
919
|
+
};
|
|
880
920
|
});
|
|
881
921
|
|
|
882
922
|
const width = Math.max(...rows.map((row) => row.name.length), 6);
|
|
@@ -887,15 +927,20 @@ export async function audit({
|
|
|
887
927
|
? 'missing'
|
|
888
928
|
: row.unreadable === true
|
|
889
929
|
? 'unreadable'
|
|
890
|
-
: row.
|
|
891
|
-
? '
|
|
892
|
-
: row.loaded ===
|
|
893
|
-
? '
|
|
894
|
-
:
|
|
895
|
-
|
|
930
|
+
: row.noDsh === true
|
|
931
|
+
? 'no dsh field'
|
|
932
|
+
: row.loaded === null
|
|
933
|
+
? '?'
|
|
934
|
+
: row.loaded === true
|
|
935
|
+
? 'loaded'
|
|
936
|
+
: 'not loaded';
|
|
937
|
+
const reason =
|
|
938
|
+
row.missing === true || row.noDsh === true || row.loaded === false || row.unreadable === true
|
|
939
|
+
? ` — ${row.reason}`
|
|
940
|
+
: '';
|
|
896
941
|
io.log(`${row.name.padEnd(width)} ${String(row.version).padEnd(8)} ${state.padEnd(10)} ${describe(row)}${reason}`);
|
|
897
942
|
for (const failure of row.failures) io.log(`${' '.repeat(width + 22)}${failure.check}: ${failure.message}`);
|
|
898
|
-
if (row.missing === true || row.loaded === false || row.unreadable === true) {
|
|
943
|
+
if (row.missing === true || row.noDsh === true || row.loaded === false || row.unreadable === true) {
|
|
899
944
|
io.log(`${detailIndent}fix: ${row.action}`);
|
|
900
945
|
}
|
|
901
946
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.44",
|
|
4
4
|
"description": "Preflight, release and test DeepSeek Harness plugins: check a folder or any GitHub repository, wait for npm to actually serve the version, and keep the market index honest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|