@boyingliu01/xp-gate 0.38.73 → 0.38.75
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/bin/xp-gate.js +17 -1
- package/lib/__tests__/doctor-signature-stability.test.js +55 -0
- package/lib/__tests__/doctor.test.js +6 -1
- package/lib/__tests__/gate2-verdict.test.js +126 -0
- package/lib/__tests__/issue-566-sync-hooks-backup.test.js +23 -16
- package/lib/__tests__/jscpd-entry-resolution.test.js +143 -0
- package/lib/__tests__/tsx-resolution.test.js +89 -0
- package/lib/doctor.js +99 -3
- package/lib/gate-runner.js +275 -41
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/tsx-resolve.js +48 -0
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/principles/adapters/php.ts +407 -5
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
package/lib/gate-runner.js
CHANGED
|
@@ -600,30 +600,7 @@ const GATE_REGISTRY = {
|
|
|
600
600
|
description: 'jscpd duplicate code detection',
|
|
601
601
|
aliases: ['duplicates', 'dup', '2'],
|
|
602
602
|
run: (targetPath) => {
|
|
603
|
-
const
|
|
604
|
-
// The scan root is '.' whenever we are running inside the target.
|
|
605
|
-
//
|
|
606
|
-
// jscpd 4.x does not apply its glob ignore rules to an ABSOLUTE scan path:
|
|
607
|
-
// measured on a fixture with three byte-identical files, one of them under
|
|
608
|
-
// .xp-gate/, `jscpd <abs-path> --ignore "**/.xp-gate/**,..."` reported 0
|
|
609
|
-
// clones while `jscpd . --ignore <same>` reported 2 (the copy excluded, the
|
|
610
|
-
// real duplicate kept). Passing '.' and running with cwd = target keeps both
|
|
611
|
-
// the ignore rules and the discovery working.
|
|
612
|
-
const scanRoot = !targetPath || path.resolve(targetPath) === path.resolve(process.cwd()) ? '.' : targetPath;
|
|
613
|
-
const args = [scanRoot];
|
|
614
|
-
if (jscpdConfig) args.push('--config', jscpdConfig);
|
|
615
|
-
// The ignore set is passed ONLY when the project has no config of its own.
|
|
616
|
-
//
|
|
617
|
-
// jscpd's --ignore is a REGEX while jscpd.conf.json's ignore is GLOB. Passing
|
|
618
|
-
// both does not merge them -- the CLI value replaces the config's list, so the
|
|
619
|
-
// scan lost "**/node_modules/**" and "**/.worktrees/**" and started walking
|
|
620
|
-
// .worktrees/sprint-*/plugins/opencode/node_modules (measured: 300 s timeout,
|
|
621
|
-
// down from 49 s, with the run still failing). The config is authoritative
|
|
622
|
-
// when it exists; the built-in set is a fallback for projects without one.
|
|
623
|
-
if (!jscpdConfig) {
|
|
624
|
-
const ignore = jscpdDefaultIgnorePatterns();
|
|
625
|
-
if (ignore) args.push('--ignore', ignore);
|
|
626
|
-
}
|
|
603
|
+
const args = buildJscpdArgs({ targetPath });
|
|
627
604
|
runJscpd(args, targetPath);
|
|
628
605
|
},
|
|
629
606
|
},
|
|
@@ -838,6 +815,197 @@ function jscpdDefaultIgnorePatterns() {
|
|
|
838
815
|
].join(',');
|
|
839
816
|
}
|
|
840
817
|
|
|
818
|
+
/**
|
|
819
|
+
* Resolve jscpd's JS entry point without assuming a filename.
|
|
820
|
+
*
|
|
821
|
+
* Two defects are fixed here at once (#853):
|
|
822
|
+
*
|
|
823
|
+
* 1. **Doubled `node_modules`.** Roots were probed as
|
|
824
|
+
* `path.join(root, 'node_modules', 'jscpd', ...)`, but a global npm prefix
|
|
825
|
+
* already ends in `node_modules`, so the probe became
|
|
826
|
+
* `<prefix>/node_modules/node_modules/jscpd`. `hasNodeModules()` decides per
|
|
827
|
+
* root whether to append the segment.
|
|
828
|
+
*
|
|
829
|
+
* 2. **Hardcoded `bin/jscpd`.** jscpd 5.x declares its entry as
|
|
830
|
+
* `{"jscpd": "./run-jscpd.js"}` and ships no `bin/jscpd` at all. The bin field
|
|
831
|
+
* is now read from the installed package.json, so an upstream rename cannot
|
|
832
|
+
* silently disable the gate again -- which is precisely how 5.x broke it.
|
|
833
|
+
*
|
|
834
|
+
* @param {{searchRoots?: Array<string|undefined>}} [opts]
|
|
835
|
+
* @returns {string|null} absolute path to jscpd's JS entry, or null when absent
|
|
836
|
+
*/
|
|
837
|
+
function findJscpdEntry(opts = {}) {
|
|
838
|
+
const roots = (opts.searchRoots || []).filter((r) => typeof r === 'string' && r.length > 0);
|
|
839
|
+
for (const root of roots) {
|
|
840
|
+
const candidate = jscpdEntryUnder(root);
|
|
841
|
+
if (candidate) return candidate;
|
|
842
|
+
}
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Look for an installed jscpd beneath one root, treating the root as either a
|
|
848
|
+
* project directory (whose `node_modules` we must enter) or a node_modules
|
|
849
|
+
* directory already.
|
|
850
|
+
*
|
|
851
|
+
* @param {string} root
|
|
852
|
+
* @returns {string|null}
|
|
853
|
+
*/
|
|
854
|
+
function jscpdEntryUnder(root) {
|
|
855
|
+
const bases = [path.join(root, 'node_modules')];
|
|
856
|
+
// A global npm prefix (`<...>/npm/node_modules`) is itself a node_modules dir.
|
|
857
|
+
if (path.basename(path.resolve(root)) === 'node_modules') bases.unshift(root);
|
|
858
|
+
// POSIX global installs put packages in `<prefix>/lib/node_modules`, while
|
|
859
|
+
// `path.dirname(process.execPath)` is `<prefix>/bin`. Without this, #853's fix
|
|
860
|
+
// would work on Windows and leave the same bug on every Linux/macOS install.
|
|
861
|
+
bases.push(path.join(root, 'lib', 'node_modules'));
|
|
862
|
+
for (const base of bases) {
|
|
863
|
+
const entry = jscpdEntryIn(path.join(base, 'jscpd'));
|
|
864
|
+
if (entry) return entry;
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Read `package.json`'s bin field from `packageDir` and return the entry that
|
|
871
|
+
* actually exists on disk, or null when the package is absent or half-written.
|
|
872
|
+
*
|
|
873
|
+
* @param {string} packageDir
|
|
874
|
+
* @returns {string|null}
|
|
875
|
+
*/
|
|
876
|
+
function jscpdEntryIn(packageDir) {
|
|
877
|
+
const pkgJson = path.join(packageDir, 'package.json');
|
|
878
|
+
let bin;
|
|
879
|
+
try {
|
|
880
|
+
bin = JSON.parse(fs.readFileSync(pkgJson, 'utf8')).bin;
|
|
881
|
+
} catch {
|
|
882
|
+
// No package.json, unreadable, or invalid JSON: not an installed package.
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
const rel = typeof bin === 'string' ? bin : bin && (bin.jscpd || Object.values(bin)[0]);
|
|
886
|
+
if (!rel) return null;
|
|
887
|
+
const entry = path.join(packageDir, rel);
|
|
888
|
+
return fs.existsSync(entry) ? entry : null;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Default duplicate-ratio ceiling for Gate 2.
|
|
893
|
+
*
|
|
894
|
+
* Must match the `code-duplication` principle rule's threshold. Two gates judging
|
|
895
|
+
* "how much duplication is too much" with different numbers teach the user that
|
|
896
|
+
* the gates disagree, and a user who sees Gate 4 fail while Gate 2 passes
|
|
897
|
+
* concludes the gates are unreliable.
|
|
898
|
+
*/
|
|
899
|
+
const JSCPD_THRESHOLD = 15;
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Build the jscpd argv for Gate 2.
|
|
903
|
+
*
|
|
904
|
+
* Extracted from the gate's `run` so the threshold decision is testable without
|
|
905
|
+
* spawning jscpd. The threshold is the part that was missing: jscpd returns 0
|
|
906
|
+
* regardless of findings when no `--threshold` is given, so forwarding its exit
|
|
907
|
+
* code made Gate 2 unconditionally pass. Measured on a fixture with 66.7%
|
|
908
|
+
* duplication: `jscpd .` exit 0, `jscpd . --threshold 5` exit 1.
|
|
909
|
+
*
|
|
910
|
+
* @param {{targetPath?: string}} opts
|
|
911
|
+
* @returns {string[]}
|
|
912
|
+
*/
|
|
913
|
+
function buildJscpdArgs(opts = {}) {
|
|
914
|
+
const targetPath = opts.targetPath;
|
|
915
|
+
const jscpdConfig = findJscpdConfig(targetPath);
|
|
916
|
+
// The scan root is '.' whenever we are running inside the target.
|
|
917
|
+
//
|
|
918
|
+
// jscpd 4.x does not apply its glob ignore rules to an ABSOLUTE scan path:
|
|
919
|
+
// measured on a fixture with three byte-identical files, one of them under
|
|
920
|
+
// .xp-gate/, `jscpd <abs-path> --ignore "**/.xp-gate/**,..."` reported 0
|
|
921
|
+
// clones while `jscpd . --ignore <same>` reported 2 (the copy excluded, the
|
|
922
|
+
// real duplicate kept). Passing '.' and running with cwd = target keeps both
|
|
923
|
+
// the ignore rules and the discovery working.
|
|
924
|
+
const scanRoot = !targetPath || path.resolve(targetPath) === path.resolve(process.cwd()) ? '.' : targetPath;
|
|
925
|
+
const args = [scanRoot];
|
|
926
|
+
// A config is passed only when jscpd can actually parse it. Measured on
|
|
927
|
+
// jscpd 5.4.3: `--config <corrupt>` exits 1 with "key must be a string at line 1
|
|
928
|
+
// column 3", which the gate forwards as a verdict -- so a typo in the project's
|
|
929
|
+
// config would be reported as "duplicate code found". An unreadable config is
|
|
930
|
+
// treated as absent, and the default threshold still applies.
|
|
931
|
+
const parsedConfig = jscpdConfig ? readJscpdConfig(jscpdConfig) : null;
|
|
932
|
+
if (parsedConfig) {
|
|
933
|
+
args.push('--config', jscpdConfig);
|
|
934
|
+
// A config that declares its own `threshold` owns the decision. Passing ours
|
|
935
|
+
// as well would override the project's number -- the same config-vs-CLI
|
|
936
|
+
// conflict that already cost the ignore list its entries.
|
|
937
|
+
if (!isFiniteNumber(parsedConfig.threshold)) args.push('--threshold', String(JSCPD_THRESHOLD));
|
|
938
|
+
return args;
|
|
939
|
+
}
|
|
940
|
+
if (jscpdConfig) {
|
|
941
|
+
// The config exists but cannot be used. Saying so is not optional: silently
|
|
942
|
+
// dropping the project's ignore/min-tokens rules changes what gets scanned,
|
|
943
|
+
// and the operator would have no way to tell that from a real result. The
|
|
944
|
+
// gate still runs (fail-open on the config, fail-closed on the threshold).
|
|
945
|
+
process.stderr.write(
|
|
946
|
+
`[gate-2] ignoring unreadable jscpd config ${jscpdConfig}; `
|
|
947
|
+
+ `using the built-in ignore set and --threshold ${JSCPD_THRESHOLD}\n`,
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
// The ignore set is passed ONLY when the project has no config of its own.
|
|
951
|
+
//
|
|
952
|
+
// jscpd's --ignore is a REGEX while jscpd.conf.json's ignore is GLOB. Passing
|
|
953
|
+
// both does not merge them -- the CLI value replaces the config's list, so the
|
|
954
|
+
// scan lost "**/node_modules/**" and "**/.worktrees/**" and started walking
|
|
955
|
+
// .worktrees/sprint-*/plugins/opencode/node_modules (measured: 300 s timeout,
|
|
956
|
+
// down from 49 s, with the run still failing). The config is authoritative
|
|
957
|
+
// when it exists; the built-in set is a fallback for projects without one.
|
|
958
|
+
const ignore = jscpdDefaultIgnorePatterns();
|
|
959
|
+
if (ignore) args.push('--ignore', ignore);
|
|
960
|
+
args.push('--threshold', String(JSCPD_THRESHOLD));
|
|
961
|
+
return args;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Parse a jscpd config file.
|
|
966
|
+
*
|
|
967
|
+
* @param {string} configPath
|
|
968
|
+
* @returns {object|null} the parsed object, or null when unreadable or invalid
|
|
969
|
+
*/
|
|
970
|
+
function readJscpdConfig(configPath) {
|
|
971
|
+
try {
|
|
972
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
973
|
+
return parsed && typeof parsed === 'object' ? parsed : null;
|
|
974
|
+
} catch {
|
|
975
|
+
return null;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* @param {unknown} value
|
|
981
|
+
* @returns {boolean}
|
|
982
|
+
*/
|
|
983
|
+
function isFiniteNumber(value) {
|
|
984
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* The npm global prefixes worth probing for an installed tool.
|
|
989
|
+
*
|
|
990
|
+
* Built conditionally because `path.join('', 'npm')` yields the RELATIVE path
|
|
991
|
+
* `npm`, which `findJscpdEntry` would then resolve against the current directory:
|
|
992
|
+
* an unset APPDATA/HOME would silently point the search at `./npm` and
|
|
993
|
+
* `./.npm-global`. A candidate is only included when its base variable exists.
|
|
994
|
+
*
|
|
995
|
+
* @param {{binDir: string, appData?: string, home?: string}} env
|
|
996
|
+
* @returns {string[]} absolute prefixes, most likely first
|
|
997
|
+
*/
|
|
998
|
+
function buildGlobalPrefixes(env) {
|
|
999
|
+
const prefixes = [env.binDir];
|
|
1000
|
+
// A POSIX global prefix puts the binary in <prefix>/bin, so its parent is the
|
|
1001
|
+
// prefix packages hang off. Walking up avoids hardcoding "/usr".
|
|
1002
|
+
if (env.binDir) prefixes.push(path.dirname(env.binDir));
|
|
1003
|
+
if (env.appData) prefixes.push(path.join(env.appData, 'npm'));
|
|
1004
|
+
if (env.home) prefixes.push(path.join(env.home, '.npm-global'));
|
|
1005
|
+
// Only absolute results are usable as prefixes.
|
|
1006
|
+
return prefixes.filter((p) => typeof p === 'string' && p.length > 0 && path.isAbsolute(p));
|
|
1007
|
+
}
|
|
1008
|
+
|
|
841
1009
|
function runJscpd(args, targetPath) {
|
|
842
1010
|
// Invoke jscpd's JS entry through `node` rather than going through .bin/.
|
|
843
1011
|
//
|
|
@@ -853,24 +1021,29 @@ function runJscpd(args, targetPath) {
|
|
|
853
1021
|
// 1. the project under check
|
|
854
1022
|
// 2. this package own dependency tree
|
|
855
1023
|
// 3. the global install tree
|
|
1024
|
+
//
|
|
1025
|
+
// The global trees are passed as PREFIXES, not as `.../node_modules` paths,
|
|
1026
|
+
// because a global npm prefix already contains `node_modules`. Treating the two
|
|
1027
|
+
// the same is #853: the old code appended `node_modules/jscpd/bin/jscpd` to an
|
|
1028
|
+
// already-`node_modules`-terminated root, probing
|
|
1029
|
+
// `<prefix>/node_modules/node_modules/jscpd/bin/jscpd`, which can never exist.
|
|
1030
|
+
// `entry` was therefore always undefined and every lookup fell through to `npx`,
|
|
1031
|
+
// which on Windows reported `spawnSync npx ENOENT` -- a working tool reported as
|
|
1032
|
+
// missing, with an exit code indistinguishable from "duplicate code found".
|
|
1033
|
+
//
|
|
856
1034
|
// process.execPath is the node BINARY location, not the npm global prefix; both
|
|
857
1035
|
// are probed along with the APPDATA npm tree, because a global package lives in
|
|
858
|
-
// a directory that varies by platform and by install method.
|
|
859
|
-
//
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
process.
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
...npmGlobalRoots,
|
|
870
|
-
];
|
|
871
|
-
const entry = roots
|
|
872
|
-
.map((r) => path.join(r, 'node_modules', 'jscpd', 'bin', 'jscpd'))
|
|
873
|
-
.find((c) => fs.existsSync(c));
|
|
1036
|
+
// a directory that varies by platform and by install method.
|
|
1037
|
+
// Each entry is a PREFIX, not a node_modules directory: findJscpdEntry probes
|
|
1038
|
+
// `<prefix>/node_modules`, `<prefix>/lib/node_modules` (POSIX global installs)
|
|
1039
|
+
// and, when the prefix is itself named node_modules, the prefix directly.
|
|
1040
|
+
const nodeBinDir = path.dirname(process.execPath);
|
|
1041
|
+
const globalPrefixes = buildGlobalPrefixes({
|
|
1042
|
+
binDir: nodeBinDir,
|
|
1043
|
+
appData: process.env.APPDATA,
|
|
1044
|
+
home: process.env.USERPROFILE || process.env.HOME,
|
|
1045
|
+
});
|
|
1046
|
+
const entry = findJscpdEntry({ searchRoots: [targetPath, process.cwd(), ...globalPrefixes] });
|
|
874
1047
|
let lastErr = null;
|
|
875
1048
|
// Third fallback is deliberately `--no-install`: a global jscpd is on PATH on the
|
|
876
1049
|
// dev machine (/c/Users/think/AppData/Roaming/npm/jscpd) but `npx` here was
|
|
@@ -911,6 +1084,67 @@ function findConfig(basePath, fileName) {
|
|
|
911
1084
|
return null;
|
|
912
1085
|
}
|
|
913
1086
|
|
|
1087
|
+
/**
|
|
1088
|
+
* Config filenames jscpd itself reads, in the order it prefers them.
|
|
1089
|
+
*
|
|
1090
|
+
* Only `jscpd.conf.json` used to be looked for. Measured on jscpd 5.4.3 against a
|
|
1091
|
+
* fixture at 66.7% duplication, a project setting `{"threshold": 90}` in
|
|
1092
|
+
* `.jscpd.json`:
|
|
1093
|
+
* `jscpd .` -> exit 0 (project's 90 respected)
|
|
1094
|
+
* `jscpd . --threshold 15` -> exit 1 (our CLI value overrode it)
|
|
1095
|
+
* So a project that declared its own threshold in `.jscpd.json` had the gate
|
|
1096
|
+
* impose 15 instead -- taking the decision away from the project that made it.
|
|
1097
|
+
* `.jscpdrc` is NOT read by jscpd (verified: still exit 0), so it is excluded
|
|
1098
|
+
* rather than pretended to work.
|
|
1099
|
+
*/
|
|
1100
|
+
const JSCPD_CONFIG_FILENAMES = ['jscpd.conf.json', '.jscpd.json'];
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Locate a jscpd config the tool will actually honour.
|
|
1104
|
+
*
|
|
1105
|
+
* Discovery follows ONE root, chosen by whether the caller named a target:
|
|
1106
|
+
*
|
|
1107
|
+
* - An explicit target means that target: its config decides. Falling back to the
|
|
1108
|
+
* working directory would let `xp-gate check 2 /other/repo` judge that repo by
|
|
1109
|
+
* THIS repo's ignore list and threshold. Measured before this rule existed:
|
|
1110
|
+
* with only this repo holding a jscpd.conf.json, a target with no config of its
|
|
1111
|
+
* own still received `--config <this repo>/jscpd.conf.json`.
|
|
1112
|
+
* - No target means the working directory, which is the tree the scan covers.
|
|
1113
|
+
*
|
|
1114
|
+
* Every supported filename is tried in the chosen root before giving up; trying
|
|
1115
|
+
* one name across both roots first let a `jscpd.conf.json` in the cwd shadow a
|
|
1116
|
+
* `.jscpd.json` in the project being checked.
|
|
1117
|
+
*
|
|
1118
|
+
* @param {string} [basePath] the explicit target, if the caller gave one
|
|
1119
|
+
* @returns {string|null}
|
|
1120
|
+
*/
|
|
1121
|
+
function findJscpdConfig(basePath) {
|
|
1122
|
+
const root = basePath || process.cwd();
|
|
1123
|
+
for (const name of JSCPD_CONFIG_FILENAMES) {
|
|
1124
|
+
const candidate = path.join(root, name);
|
|
1125
|
+
if (isRegularFile(candidate)) return candidate;
|
|
1126
|
+
}
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* True only for an existing REGULAR FILE.
|
|
1132
|
+
*
|
|
1133
|
+
* `fs.existsSync` is also true for a directory, and a directory named
|
|
1134
|
+
* `.jscpd.json` would be handed to jscpd as `--config <dir>`, failing the gate for
|
|
1135
|
+
* a reason unrelated to duplication.
|
|
1136
|
+
*
|
|
1137
|
+
* @param {string} candidate
|
|
1138
|
+
* @returns {boolean}
|
|
1139
|
+
*/
|
|
1140
|
+
function isRegularFile(candidate) {
|
|
1141
|
+
try {
|
|
1142
|
+
return fs.statSync(candidate).isFile();
|
|
1143
|
+
} catch {
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
914
1148
|
/**
|
|
915
1149
|
* The basename of the first `gate-<num>-*.sh` in a directory, or null.
|
|
916
1150
|
*
|
|
@@ -1063,7 +1297,7 @@ async function invokeGateHandler(gateId, gate, targetPath, opts) {
|
|
|
1063
1297
|
}
|
|
1064
1298
|
}
|
|
1065
1299
|
|
|
1066
|
-
module.exports = { findConsumerGateVariant, GATE_REGISTRY, GATE_NOT_RUN, getGateInfo, getAllGates, runGate, resolveAlias, getAliases, runGateAdapter, findTsGateEntry, resolveGateScript, resolveTsxInvocation, findTsxCli, SOURCE_FILE_EXTENSIONS, resolveAllModeChangedFiles, describeEmptyChangedFiles, describeChangedFilesScope,
|
|
1300
|
+
module.exports = { findConsumerGateVariant, GATE_REGISTRY, GATE_NOT_RUN, getGateInfo, getAllGates, runGate, resolveAlias, getAliases, runGateAdapter, findTsGateEntry, resolveGateScript, resolveTsxInvocation, findTsxCli, findJscpdEntry, buildJscpdArgs, JSCPD_THRESHOLD, buildGlobalPrefixes, SOURCE_FILE_EXTENSIONS, resolveAllModeChangedFiles, describeEmptyChangedFiles, describeChangedFilesScope,
|
|
1067
1301
|
// AC-670-03 asserts the --all preamble END-TO-END: that an all-mode run hands
|
|
1068
1302
|
// the security gates a non-empty file population sourced from the list file and
|
|
1069
1303
|
// sets GATE_SCOPE="all". With these unexported, the case could only take its
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Locate tsx's CLI entry by searching UPWARD for node_modules.
|
|
5
|
+
*
|
|
6
|
+
* Why not a fixed number of `..` segments: the depth from a call site to the
|
|
7
|
+
* package root differs between a global install, a local install and a monorepo
|
|
8
|
+
* checkout, and it changes whenever the file moves. #817 was exactly that --
|
|
9
|
+
* `bin/xp-gate.js` used three `..` segments from `bin/`, which already reached
|
|
10
|
+
* `<global>/node_modules`, then appended `node_modules/tsx` again, producing
|
|
11
|
+
* `<global>/node_modules/node_modules/tsx/dist/cli.mjs`. That path can never
|
|
12
|
+
* exist, so `xp-gate audit --check` reported MODULE_NOT_FOUND on every global
|
|
13
|
+
* install.
|
|
14
|
+
*
|
|
15
|
+
* Searching upward is what Node's own resolver does, so it is correct by
|
|
16
|
+
* construction for every layout: the first directory whose `node_modules`
|
|
17
|
+
* contains `tsx/dist/cli.mjs` is the one that wins.
|
|
18
|
+
*
|
|
19
|
+
* A `tsx/` directory without `dist/cli.mjs` counts as "not installed" -- the same
|
|
20
|
+
* convention `gate-runner.js` already uses. A half-written install would
|
|
21
|
+
* otherwise be spawned and fail with a message about missing files, which reads
|
|
22
|
+
* like a defect in the gate rather than an incomplete install.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** How many ancestor directories to inspect before giving up. */
|
|
26
|
+
const MAX_SEARCH_DEPTH = 12;
|
|
27
|
+
|
|
28
|
+
const fs = require('node:fs');
|
|
29
|
+
const path = require('node:path');
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} startDir directory to start searching from
|
|
33
|
+
* @returns {string|null} absolute path to tsx's cli.mjs, or null when absent
|
|
34
|
+
*/
|
|
35
|
+
function findTsxCliFrom(startDir) {
|
|
36
|
+
let dir = path.resolve(startDir);
|
|
37
|
+
for (let depth = 0; depth < MAX_SEARCH_DEPTH; depth += 1) {
|
|
38
|
+
const candidate = path.join(dir, 'node_modules', 'tsx', 'dist', 'cli.mjs');
|
|
39
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
40
|
+
const parent = path.dirname(dir);
|
|
41
|
+
// Reached the filesystem root; `dirname(root) === root`.
|
|
42
|
+
if (parent === dir) break;
|
|
43
|
+
dir = parent;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = { findTsxCliFrom, MAX_SEARCH_DEPTH };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.75",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
|
|
6
6
|
"author": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
package/plugins/dsh/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boyingliu01/dsh-plugin-xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.75",
|
|
4
4
|
"description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xp-gate",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.75",
|
|
4
4
|
"displayName": "XP-Gate",
|
|
5
5
|
"description": "Extreme Programming quality gates + AI workflow skills for Qoder. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
|
|
6
6
|
"author": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
**6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Generated:** 2026-11-04
|
|
4
4
|
**Commit:** eb2097b0
|
|
5
5
|
**Branch:** sprint/2026-11-03-02
|
|
6
|
-
**Version:** 0.38.
|
|
6
|
+
**Version:** 0.38.75.0
|
|
7
7
|
|
|
8
8
|
## OVERVIEW
|
|
9
9
|
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|