universal-dev-standards 6.14.0-beta.5 → 6.14.0-beta.7

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 (99) hide show
  1. package/README.md +13 -3
  2. package/bin/uds.js +32 -7
  3. package/bundled/ai/options/code-review/pr-review.ai.yaml +20 -1
  4. package/bundled/ai/standards/code-review.ai.yaml +15 -2
  5. package/bundled/ai/standards/commit-message.ai.yaml +6 -2
  6. package/bundled/ai/standards/developer-memory.ai.yaml +12 -2
  7. package/bundled/ai/standards/full-coverage-testing.ai.yaml +44 -6
  8. package/bundled/ai/standards/open-work-tracking.ai.yaml +191 -11
  9. package/bundled/ai/standards/pipeline-security-gates.ai.yaml +48 -3
  10. package/bundled/ai/standards/project-context-memory.ai.yaml +12 -2
  11. package/bundled/core/code-review-checklist.md +20 -2
  12. package/bundled/core/developer-memory.md +12 -2
  13. package/bundled/core/full-coverage-testing.md +44 -4
  14. package/bundled/core/open-work-tracking.md +156 -16
  15. package/bundled/core/pipeline-security-gates.md +63 -0
  16. package/bundled/core/project-context-memory.md +10 -2
  17. package/bundled/locales/zh-CN/CHANGELOG.md +75 -3
  18. package/bundled/locales/zh-CN/README.md +1 -1
  19. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  20. package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +13 -4
  21. package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  22. package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +7 -1
  23. package/bundled/locales/zh-CN/adoption/checklists/minimal.md +13 -3
  24. package/bundled/locales/zh-CN/adoption/checklists/recommended.md +7 -1
  25. package/bundled/locales/zh-CN/core/code-review-checklist.md +17 -0
  26. package/bundled/locales/zh-CN/core/developer-memory.md +9 -0
  27. package/bundled/locales/zh-CN/core/full-coverage-testing.md +48 -8
  28. package/bundled/locales/zh-CN/core/pipeline-security-gates.md +64 -4
  29. package/bundled/locales/zh-CN/core/project-context-memory.md +5 -0
  30. package/bundled/locales/zh-CN/docs/AVAILABLE-STANDARDS.md +70 -0
  31. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +5 -4
  32. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +25 -23
  33. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +15 -12
  34. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +6 -6
  35. package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +7 -1
  36. package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +44 -0
  37. package/bundled/locales/zh-CN/options/code-review/pr-review.md +13 -2
  38. package/bundled/locales/zh-TW/CHANGELOG.md +75 -3
  39. package/bundled/locales/zh-TW/README.md +1 -1
  40. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  41. package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +13 -4
  42. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  43. package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +7 -1
  44. package/bundled/locales/zh-TW/adoption/checklists/minimal.md +13 -3
  45. package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -1
  46. package/bundled/locales/zh-TW/core/code-review-checklist.md +17 -0
  47. package/bundled/locales/zh-TW/core/developer-memory.md +9 -0
  48. package/bundled/locales/zh-TW/core/full-coverage-testing.md +48 -8
  49. package/bundled/locales/zh-TW/core/open-work-tracking.md +90 -14
  50. package/bundled/locales/zh-TW/core/pipeline-security-gates.md +64 -4
  51. package/bundled/locales/zh-TW/core/project-context-memory.md +5 -0
  52. package/bundled/locales/zh-TW/docs/AVAILABLE-STANDARDS.md +70 -0
  53. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +5 -4
  54. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +25 -23
  55. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +15 -12
  56. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +6 -6
  57. package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +7 -1
  58. package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +44 -0
  59. package/bundled/locales/zh-TW/options/code-review/pr-review.md +13 -2
  60. package/bundled/skills/SKILL_NAMING.md +9 -0
  61. package/bundled/templates/gates/check-anti-fake-tests.mjs +305 -5
  62. package/package.json +3 -1
  63. package/src/commands/audit.js +9 -2
  64. package/src/commands/check.js +17 -0
  65. package/src/commands/deps.js +31 -1
  66. package/src/commands/init.js +41 -21
  67. package/src/commands/open-work.js +65 -6
  68. package/src/commands/simulate.js +20 -8
  69. package/src/commands/skills.js +59 -33
  70. package/src/commands/spec.js +14 -8
  71. package/src/commands/update.js +106 -66
  72. package/src/core/manifest.js +12 -10
  73. package/src/core/marketplace-sentinel.js +5 -0
  74. package/src/core/open-work-config.js +103 -0
  75. package/src/core/project-config.js +58 -38
  76. package/src/flows/init-flow.js +10 -0
  77. package/src/i18n/messages.js +264 -60
  78. package/src/installers/skills-installer.js +3 -1
  79. package/src/prompts/init.js +148 -13
  80. package/src/reconciler/backup-locations.js +75 -0
  81. package/src/reconciler/backup-manager.js +29 -45
  82. package/src/reconciler/index.js +62 -8
  83. package/src/utils/available-standards-report.js +144 -0
  84. package/src/utils/available-standards.js +216 -0
  85. package/src/utils/commit-message-judge.js +137 -0
  86. package/src/utils/copier.js +5 -4
  87. package/src/utils/deps-applicability.js +25 -0
  88. package/src/utils/friction-detector.js +27 -0
  89. package/src/utils/installed-names-ownership.js +114 -0
  90. package/src/utils/open-work-tracking.mjs +919 -48
  91. package/src/utils/sdd-header.js +65 -0
  92. package/src/utils/skill-frontmatter.js +102 -0
  93. package/src/utils/skill-name-collision.js +169 -0
  94. package/src/utils/skills-install-paths.js +114 -0
  95. package/src/utils/skills-installer.js +63 -105
  96. package/src/utils/standard-validator.js +98 -27
  97. package/src/utils/transient-fs.js +113 -0
  98. package/src/vibe/micro-spec.js +15 -0
  99. package/standards-registry.json +9 -9
@@ -7,7 +7,11 @@
7
7
  //
8
8
  // What it finds, in the test files of any project (no test framework is assumed):
9
9
  // no-assertion a test whose body contains nothing that can fail
10
- // tautology a test whose only assertions can never fail (expect(true).toBe(true))
10
+ // tautology a test whose only assertions can never fail (expect(true).toBe(true)), or whose
11
+ // expected value is not independent of the code under test (XSPEC-470): the
12
+ // assertion calls the same function with the same arguments on both sides, or
13
+ // recomputes the expected value from the same input with reduce/map/filter.
14
+ // (JavaScript/TypeScript only; other languages are a reviewer's judgment call.)
11
15
  // all-skipped a test file in which every test is skipped or marked todo
12
16
  //
13
17
  // Written into your project by `uds init` (XSPEC-444 R5). It is YOURS: edit it, or replace
@@ -814,12 +818,254 @@ const countMatches = (re, s) => {
814
818
  return n;
815
819
  };
816
820
 
821
+ // ═══════════════════════════════════════════════════════════════════════════
822
+ // Expected values that are not independent of the code under test (XSPEC-470 R1)
823
+ //
824
+ // An oracle is the source that says what the right answer is (UDS `verification-oracle`).
825
+ // A test whose expected value is produced by the code under test — or by the same logic re-typed
826
+ // in the test — has the implementation as its own oracle, so it cannot disagree with it. Two
827
+ // shapes are mechanical enough to judge from text, and they are the only ones judged here:
828
+ //
829
+ // same-call expect(total(items)).toBe(total(items)) same function, same arguments, both sides
830
+ // recomputed expect(total(items)).toBe(items.reduce(...)) expected value is built from the same
831
+ // input with reduce / map / flatMap / filter
832
+ // by a callback that uses nothing but its own
833
+ // parameters (and pure built-ins), holds no
834
+ // literal and is not just `(x) => x` / `({ ...x })`.
835
+ // Only the text of the assertion is read: a name set
836
+ // on an earlier line is not looked through.
837
+ //
838
+ // Left alone on purpose, because they cannot be told from a sound test by reading the text:
839
+ // a lookup in a fixed table expect(priceOf(ids)).toEqual(ids.map((id) => KNOWN_PRICES[id]))
840
+ // a pick by a literal expect(activeOf(users)).toEqual(users.filter((u) => u.id === 2))
841
+ // a call inside the call expect(render(now())).toBe(render(now())) (two now() are two values)
842
+ // expect(parse(serialize(rows))).toEqual(rows.map((r) => r)) (a round trip)
843
+ // a property of the result expect(sortUsers(users).length).toBe(users.filter((u) => u.name).length)
844
+ // a callback that only returns expect(clone(input)).toEqual(input.map((x) => x)) (a copy, no logic)
845
+ // or shallow-copies its input expect(clone(users)).toEqual(users.map((u) => ({ ...u })))
846
+ // or rebuilds a destructured expect(clone(pairs)).toEqual(pairs.map(([k, v]) => [k, v]))
847
+ // parameter in the same shape
848
+ // a name set on an earlier line const before = items.map((i) => i.price); freezeCart(items);
849
+ // expect(pricesOf(items)).toEqual(before) (before / after)
850
+ // Everything else (a hand-rolled loop, a helper that re-derives the answer, a snapshot taken from
851
+ // the implementation's own output) is a reviewer's question, not this script's: when it cannot be
852
+ // decided from the text, it is NOT reported. A false alarm teaches people to switch the scanner off.
853
+ // Deliberately narrow: JavaScript/TypeScript matchers toBe / toEqual / toStrictEqual, chai
854
+ // to.equal / to.eql, node assert.equal / strictEqual / deepEqual / deepStrictEqual.
855
+ // ═══════════════════════════════════════════════════════════════════════════
856
+
857
+ /** A test named like this compares two calls ON PURPOSE (determinism, caching, identity): not judged. */
858
+ const DELIBERATE_COMPARISON_NAME = /determinis|idempot|\bsame\b|identical|\bstable\b|stability|consisten|\bcach(?:e|es|ed|ing)\b|memo|singleton|twice|repeat|\bagain\b|reuse|reference|identity|\bpure\b|決定|確定性|相同|一致|同一|冪等|快取|重複|兩次|不變/i;
859
+
860
+ const SKIP_WORDS = new Set(['true', 'false', 'null', 'undefined', 'this', 'new', 'typeof', 'void', 'await', 'async', 'function', 'return']);
861
+
862
+ /** Top-level (bracket-depth 0) comma-separated pieces of `ns[from, to)`, as [start, end) pairs. */
863
+ function topLevelPieces(ns, from, to) {
864
+ const out = [];
865
+ let depth = 0;
866
+ let begin = from;
867
+ for (let i = from; i < to; i++) {
868
+ const ch = ns[i];
869
+ if (ch === '(' || ch === '[' || ch === '{') depth++;
870
+ else if (ch === ')' || ch === ']' || ch === '}') depth--;
871
+ else if (ch === ',' && depth === 0) { out.push([begin, i]); begin = i + 1; }
872
+ }
873
+ out.push([begin, to]);
874
+ return out.filter(([a, b]) => ns.slice(a, b).trim() !== '');
875
+ }
876
+
877
+ /** Canonical form for "is this the same expression?": no `await`, no spacing, no trailing comma. */
878
+ const canonicalExpr = (s) => s
879
+ .replace(/^\s*await\s+/, '')
880
+ .replace(/\s+/g, ' ')
881
+ .replace(/\s*([(),.\[\]])\s*/g, '$1')
882
+ .replace(/,\)/g, ')')
883
+ .trim()
884
+ .replace(/,$/, '');
885
+
886
+ /** Does this canonical expression call something with at least one argument (and is not a `new` expression)? */
887
+ const callsWithArguments = (expr) => !/^new\b/.test(expr) && /[A-Za-z_$][\w$]*\(['"`\w$\[{(-]/.test(expr);
888
+
889
+ const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
890
+
891
+ /** If `ns` (canonical, strings blanked) is exactly `callee(args)` (nothing after it), the identifier paths used in args. */
892
+ function callInputs(ns) {
893
+ const m = /^([A-Za-z_$][\w$.]*)\(/.exec(ns);
894
+ if (!m || /^new\b/.test(ns)) return null;
895
+ const open = m[0].length - 1;
896
+ const close = matchClose(ns, open);
897
+ if (close === -1) return null;
898
+ // Something after the call (`.length`, `.name`, `[0]`) means the value under test is a property of the result,
899
+ // not the result: the expected value on the other side is then not "the same computation", and which of the
900
+ // two is right cannot be read from the text. Not judged.
901
+ if (ns.slice(close + 1) !== '') return null;
902
+ const args = ns.slice(open + 1, close);
903
+ const paths = new Set();
904
+ const re = /(?<![\w$.])([A-Za-z_$][\w$]*(?:(?:\?\.|\.)[A-Za-z_$][\w$]*)*)(?!\w|\$)(?!\()/g;
905
+ let p;
906
+ while ((p = re.exec(args)) !== null) if (!SKIP_WORDS.has(p[1])) paths.add(p[1]);
907
+ return [...paths];
908
+ }
909
+
910
+ /** Words that can appear in a callback body without naming anything outside it. */
911
+ const CALLBACK_KEYWORDS = new Set(['return', 'if', 'else', 'typeof', 'void', 'in', 'of', 'instanceof', 'const', 'let', 'var', 'for', 'while', 'do', 'switch', 'case', 'break', 'continue', 'default']);
912
+ /** Built-ins that compute from their arguments only, so using them does not bring in anything from outside the callback. */
913
+ const CALLBACK_GLOBALS = new Set(['Math', 'Number', 'String', 'Boolean', 'Array', 'Object', 'JSON', 'Infinity', 'NaN', 'parseInt', 'parseFloat']);
914
+
915
+ /**
916
+ * Is this callback "the same logic re-typed in the test"? Only when it is self-contained: it uses nothing but
917
+ * its own parameters (so it cannot be looking an answer up in a table, a constant or a helper the test brings in)
918
+ * and it holds no literal (a literal inside the callback is knowledge the test author supplied: `u.id === 2`,
919
+ * `x * 2`, `'abc'`, `/re/`). Anything else is not decidable from text, and what is not decidable is not reported.
920
+ * @param {string} arg the callback as written (strings blanked), e.g. `(s, i) => s + i.price`
921
+ */
922
+ function isSelfContainedCallback(arg) {
923
+ let params;
924
+ let body;
925
+ const arrow = /^(?:async\s*)?(?:\(([^()]*)\)|([A-Za-z_$][\w$]*))\s*=>\s*([\s\S]*)$/.exec(arg.trim());
926
+ const fn = /^(?:async\s*)?function\s*[A-Za-z_$]*\s*\(([^()]*)\)\s*\{([\s\S]*)\}$/.exec(arg.trim());
927
+ if (arrow) {
928
+ params = arrow[1] ?? arrow[2];
929
+ body = arrow[3].trim();
930
+ if (body.startsWith('{')) {
931
+ const close = matchClose(body, 0);
932
+ if (close !== body.length - 1) return false;
933
+ body = body.slice(1, close);
934
+ }
935
+ } else if (fn) {
936
+ params = fn[1];
937
+ body = fn[2];
938
+ } else {
939
+ return false; // a named function, or a shape not understood: not judged
940
+ }
941
+ if (params.includes('=')) return false; // default values can call anything
942
+ // A callback that only hands its parameter back (`(r) => r`, `x => { return x; }`) computes nothing, so
943
+ // there is no logic in it that could be "the same as the implementation".
944
+ const only = body.replace(/^\s*return\b/, '').replace(/[;\s]+$/g, '').replace(/^\s*\(\s*|\s*\)\s*$/g, '').trim();
945
+ // A destructured parameter put straight back into the same shape (`([k, v]) => [k, v]`, `({ a, b }) => ({ a, b })`)
946
+ // is a copy as well: the body is the parameter list itself.
947
+ if (/[{[]/.test(params) && only.replace(/\s+/g, '') === params.replace(/\s+/g, '')) return false;
948
+ if (!/[{[]/.test(params)) {
949
+ // A shallow copy of the parameter (`{ ...u }`, `[...u]`) is a copy, not logic: the same family as the identity callback.
950
+ const copied = /^[{[]\s*\.\.\.\s*([A-Za-z_$][\w$]*)\s*[}\]]$/.exec(only);
951
+ if (copied && new RegExp(`(?<![\\w$])${escapeRe(copied[1])}(?![\\w$])`).test(params)) return false;
952
+ if (/^[A-Za-z_$][\w$]*$/.test(only) && new RegExp(`(?<![\\w$])${escapeRe(only)}(?![\\w$])`).test(params)) return false;
953
+ }
954
+ if (/['"`]/.test(body)) return false; // a string literal (their contents are blanked, their quotes are not)
955
+ if (/(?<![\w$.])\d|(?<=\.)\d/.test(body)) return false; // a number literal
956
+ if (/(?:^|[(,=:[!&|?{};>+\-*%<~^]|\breturn\b)\s*\//.test(body)) return false; // a regex literal
957
+ if (/\b(?:true|false|null|undefined)\b/.test(body)) return false; // a keyword literal
958
+ if (/\b(?:this|arguments|new|await|yield|function)\b|=>/.test(body)) return false; // outside state, or a nested function
959
+ const known = new Set([...params.matchAll(/[A-Za-z_$][\w$]*/g)].map((m) => m[0]));
960
+ for (const d of body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g)) known.add(d[1]);
961
+ for (const id of body.matchAll(/(?<![\w$.])(?<!\?\.)([A-Za-z_$][\w$]*)/g)) {
962
+ const name = id[1];
963
+ if (!known.has(name) && !CALLBACK_KEYWORDS.has(name) && !CALLBACK_GLOBALS.has(name)) return false; // something from outside the callback
964
+ }
965
+ return true;
966
+ }
967
+
968
+ /** Is `rhs` the input `x` run through reduce / map / flatMap / filter by a callback that re-types the logic (see above)? */
969
+ function recomputesFrom(rhs, x) {
970
+ const X = escapeRe(x).replace(/\\\./g, '(?:\\?\\.|\\.)');
971
+ const source = `(?:${X}|\\[\\.\\.\\.${X}\\]|Object\\.(?:values|keys|entries)\\(${X}\\)|Array\\.from\\(${X}\\))`;
972
+ const verb = '(?:reduce|reduceRight|map|flatMap|filter)(?:<[^>()]*>)?\\(';
973
+ const re = new RegExp(`(?<![\\w$.])${source}(?:\\?\\.|\\.)${verb}`, 'g');
974
+ for (const m of rhs.matchAll(re)) {
975
+ const open = m.index + m[0].length - 1;
976
+ const close = matchClose(rhs, open);
977
+ if (close === -1) continue;
978
+ const [callback] = topLevelPieces(rhs, open + 1, close);
979
+ if (callback && isSelfContainedCallback(rhs.slice(callback[0], callback[1]))) return true;
980
+ }
981
+ return false;
982
+ }
983
+
984
+ /**
985
+ * The assertions in one test body whose expected value is not independent.
986
+ * @param {string} ncBody the body with comments blanked (strings intact)
987
+ * @param {string} nsBody the same body with comments AND string contents blanked (same offsets)
988
+ * @param {string} testName
989
+ * @returns {{ form: 'same-call'|'recomputed', offset: number }[]}
990
+ */
991
+ export function findNonIndependentExpectations(ncBody, nsBody, testName = '') {
992
+ const hits = [];
993
+ const judge = (lhsFrom, lhsTo, rhsFrom, rhsTo, offset) => {
994
+ const rawL = canonicalExpr(ncBody.slice(lhsFrom, lhsTo));
995
+ const rawR = canonicalExpr(ncBody.slice(rhsFrom, rhsTo));
996
+ if (rawL === rawR && !callsWithArguments(rawL)) return; // `x` against `x`: the literal rule above counts it
997
+ // same-call is judged on the text as written. A name set earlier (`const before = snapshot(x)`) holds the
998
+ // value from an EARLIER moment: `expect(snapshot(x)).toEqual(before)` after an action asks "did it change?",
999
+ // which is a real question. Only two calls inside one statement cannot differ in time.
1000
+ if (rawL === rawR && callsWithArguments(rawL)) {
1001
+ // Another call inside the expression (`render(now())`, `total(load())`) may return something different the
1002
+ // second time, so the two sides are not known to be the same value: not judged.
1003
+ const callCount = (canonicalExpr(nsBody.slice(lhsFrom, lhsTo)).match(/[A-Za-z_$][\w$]*\(/g) || []).length;
1004
+ const hasNew = /\bnew\b/.test(canonicalExpr(nsBody.slice(lhsFrom, lhsTo)));
1005
+ if (callCount <= 1 && !hasNew && !DELIBERATE_COMPARISON_NAME.test(testName)) hits.push({ form: 'same-call', offset });
1006
+ return;
1007
+ }
1008
+ // Only the text of the assertion itself is read. A name set on an earlier line (`const before = items.map(...)`)
1009
+ // holds a value from an EARLIER moment, and what happened in between (`freezeCart(items)`, `users.push(x)`)
1010
+ // is exactly what such a test is asking about, so a name is never expanded here (same-call reads it the same way).
1011
+ const l = { ns: canonicalExpr(nsBody.slice(lhsFrom, lhsTo)) };
1012
+ const r = { ns: canonicalExpr(nsBody.slice(rhsFrom, rhsTo)) };
1013
+ // Same guard as same-call: another call (or `new`) inside the call under test (`parse(serialize(rows))`) is a
1014
+ // round trip or a pipeline, not the implementation's own arithmetic typed again. Not judged.
1015
+ if ((l.ns.match(/[A-Za-z_$][\w$]*\(/g) || []).length > 1 || /\bnew\b/.test(l.ns)) return;
1016
+ const inputs = callInputs(l.ns);
1017
+ if (inputs && inputs.some((x) => recomputesFrom(r.ns, x))) hits.push({ form: 'recomputed', offset });
1018
+ };
1019
+
1020
+ const expectRe = /(?<![.\w$])expect\s*\(/g;
1021
+ let m;
1022
+ while ((m = expectRe.exec(nsBody)) !== null) {
1023
+ const open = m.index + m[0].length - 1;
1024
+ const close = matchClose(nsBody, open);
1025
+ if (close === -1) continue;
1026
+ const after = /^\s*\.\s*(?:(?:toBe|toEqual|toStrictEqual)|to\s*\.\s*(?:deep\s*\.\s*)?(?:equal|equals|eql))\s*\(/.exec(nsBody.slice(close + 1, close + 60));
1027
+ if (!after) continue; // `.not.`, `.resolves`, `.toThrow`, ... are not judged
1028
+ const mOpen = close + 1 + after[0].length - 1;
1029
+ const mClose = matchClose(nsBody, mOpen);
1030
+ if (mClose === -1) continue;
1031
+ const [first] = topLevelPieces(nsBody, mOpen + 1, mClose);
1032
+ if (!first) continue;
1033
+ judge(open + 1, close, first[0], first[1], m.index);
1034
+ }
1035
+
1036
+ const assertRe = /(?<![.\w$])assert\s*\.\s*(?:equal|strictEqual|deepEqual|deepStrictEqual)\s*\(/g;
1037
+ while ((m = assertRe.exec(nsBody)) !== null) {
1038
+ const open = m.index + m[0].length - 1;
1039
+ const close = matchClose(nsBody, open);
1040
+ if (close === -1) continue;
1041
+ const pieces = topLevelPieces(nsBody, open + 1, close);
1042
+ if (pieces.length < 2) continue;
1043
+ judge(pieces[0][0], pieces[0][1], pieces[1][0], pieces[1][1], m.index);
1044
+ }
1045
+ return hits;
1046
+ }
1047
+
1048
+ /**
1049
+ * The independence detectors, by language family. `count` is what analyzeTestText subtracts from the
1050
+ * assertions it credits; `find` says which assertions and why. Passed in (not read from a global) so a
1051
+ * test can hand the scanner a weakened set and watch the self-test and the samples catch it.
1052
+ */
1053
+ export const INDEPENDENCE_DETECTORS = Object.freeze({
1054
+ count: (family, ncBody, nsBody, testName) => (family === 'js' ? findNonIndependentExpectations(ncBody, nsBody, testName).length : 0),
1055
+ find: (family, ncBody, nsBody, testName) => (family === 'js' ? findNonIndependentExpectations(ncBody, nsBody, testName) : [])
1056
+ });
1057
+
1058
+ const FORM_DETAIL = {
1059
+ 'same-call': 'the expected value is the same call as the code under test (same function, same arguments)',
1060
+ recomputed: 'the expected value is recomputed from the same input as the code under test (reduce/map/filter with a callback that uses only its own parameters), so it is not an independent oracle'
1061
+ };
1062
+
817
1063
  /**
818
1064
  * Analyze one test file's text.
819
1065
  * @returns {{ family: string|null, cases: number, skipped: number, unparsed: number,
820
1066
  * findings: { rule: string, line: number|null, name: string, detail: string }[] }}
821
1067
  */
822
- export function analyzeTestText(text, ext, extraAssertion = []) {
1068
+ export function analyzeTestText(text, ext, extraAssertion = [], detectors = INDEPENDENCE_DETECTORS) {
823
1069
  const family = FAMILY_BY_EXT[ext] || null;
824
1070
  const rules = family && FAMILY_RULES[family];
825
1071
  if (!rules) return { family: null, cases: 0, skipped: 0, unparsed: 0, findings: [] };
@@ -836,11 +1082,25 @@ export function analyzeTestText(text, ext, extraAssertion = []) {
836
1082
  for (const re of extraAssertion) tokens += countMatches(re, nsBody);
837
1083
  let taut = 0;
838
1084
  for (const re of rules.taut) taut += countMatches(re, ncBody);
1085
+ const regexTaut = taut;
1086
+ taut += detectors.count(family, ncBody, nsBody, c.name);
839
1087
  const real = Math.max(0, tokens - taut) + c.credit;
840
1088
  if (real > 0) continue;
841
- findings.push(taut > 0
842
- ? { rule: 'tautology', line: lineOf(c.idx), name: c.name, detail: 'its only assertion(s) can never fail' }
843
- : { rule: 'no-assertion', line: lineOf(c.idx), name: c.name, detail: 'the body contains nothing that can fail an assertion' });
1089
+ if (taut === 0) {
1090
+ findings.push({ rule: 'no-assertion', line: lineOf(c.idx), name: c.name, detail: 'the body contains nothing that can fail an assertion' });
1091
+ continue;
1092
+ }
1093
+ const hits = detectors.find(family, ncBody, nsBody, c.name);
1094
+ const forms = [...new Set(hits.map((h) => h.form))];
1095
+ const finding = { rule: 'tautology', line: lineOf(c.idx), name: c.name, detail: 'its only assertion(s) can never fail' };
1096
+ if (forms.length > 0) {
1097
+ const parts = forms.map((f) => FORM_DETAIL[f]);
1098
+ if (regexTaut > 0) parts.unshift('an assertion that can never fail');
1099
+ finding.detail = `its only assertion(s) are not independent of the code under test: ${parts.join('; ')} (see verification-oracle)`;
1100
+ finding.forms = forms;
1101
+ finding.assertions = hits.map((h) => ({ line: lineOf(c.bodyStart + h.offset), form: h.form }));
1102
+ }
1103
+ findings.push(finding);
844
1104
  }
845
1105
  if (cases.length > 0 && skipped === cases.length) {
846
1106
  findings.push({ rule: 'all-skipped', line: null, name: '(file)', detail: `every test in this file is skipped or todo (${skipped})` });
@@ -860,6 +1120,46 @@ const SELF_TEST = [
860
1120
  { ext: 'js', rules: [], text: "it('adds', () => { expect(add(1, 2)).toBe(3); });\ntest('t', async () => { await expect(f()).rejects.toThrow(); });\n" },
861
1121
  { ext: 'js', rules: ['all-skipped'], text: "it.skip('a', () => { expect(1).toBe(2); });\nit.todo('b');\n" },
862
1122
  { ext: 'js', rules: ['no-assertion'], text: "it('commented out', () => {\n // expect(a).toBe(b);\n const s = \"expect(a).toBe(b)\";\n});\n" },
1123
+ // XSPEC-470: an expected value that is not independent of the code under test.
1124
+ { ext: 'js', rules: ['tautology'], text: "it('totals', () => { expect(calculateTotal(items)).toBe(calculateTotal(items)); });\n" },
1125
+ { ext: 'js', rules: ['tautology'], text: "it('totals', () => { expect(calculateTotal(items)).toBe(items.reduce((s, i) => s + i.price, 0)); });\n" },
1126
+ { ext: 'js', rules: ['tautology'], text: "it('names', () => { expect(namesOf(users)).toEqual(users.map((u) => u.name)); });\n" },
1127
+ // A name set on an earlier line is a value from an earlier moment: never looked through (XSPEC-470, third review).
1128
+ { ext: 'js', rules: [], text: "it('totals', () => {\n const expected = items.reduce((s, i) => s + i.price, 0);\n expect(calculateTotal(items)).toBe(expected);\n});\n" },
1129
+ { ext: 'js', rules: [], text: "it('freezing changes no price', () => {\n const before = items.map((i) => i.price);\n freezeCart(items);\n expect(pricesOf(items)).toEqual(before);\n});\n" },
1130
+ { ext: 'js', rules: [], text: "it('pushing a user keeps the old names', () => {\n const result = users.map((u) => u.name);\n users.push(extra);\n expect(namesOf(users)).toEqual(result);\n});\n" },
1131
+ { ext: 'js', rules: [], text: "it('totals', () => { expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15); });\n" },
1132
+ { ext: 'js', rules: [], text: "it('totals', () => { expect(calculateTotal(a)).toBe(calculateTotal(b)); });\n" },
1133
+ { ext: 'js', rules: [], text: "it('totals', () => { expect(calculateTotal(cart)).toBe(items.reduce((s, i) => s + i.price, 0)); });\n" },
1134
+ { ext: 'js', rules: [], text: "it('is deterministic', () => { expect(calculateTotal(items)).toBe(calculateTotal(items)); });\n" },
1135
+ { ext: 'js', rules: [], text: "it('changes nothing', () => {\n const before = snapshot(dir);\n preview(dir);\n expect(snapshot(dir)).toEqual(before);\n});\n" },
1136
+ { ext: 'js', rules: [], text: "it('totals', () => { expect(calculateTotal(items)).toBe(calculateTotal(items)); expect(calculateTotal([])).toBe(0); });\n" },
1137
+ { ext: 'js', rules: [], text: "it('totals', () => { expect(calculateTotal(first)).not.toBe(calculateTotal(first)); });\n" },
1138
+ // XSPEC-470: look-alikes the rule must let through (the false alarms the first review measured).
1139
+ { ext: 'js', rules: [], text: "it('prices', () => { expect(priceOf(ids)).toEqual(ids.map((id) => KNOWN_PRICES[id])); });\n" },
1140
+ { ext: 'js', rules: [], text: "it('active', () => { expect(activeOf(users)).toEqual(users.filter((u) => u.id === 2)); });\n" },
1141
+ { ext: 'js', rules: [], text: "it('renders', () => { expect(render(now())).toBe(render(now())); });\n" },
1142
+ // XSPEC-470: the second review's false alarms, and the neighbours of both rounds (all must stay silent).
1143
+ { ext: 'js', rules: [], text: "it('round trip', () => { expect(parse(serialize(rows))).toEqual(rows.map((r) => r)); });\n" },
1144
+ { ext: 'js', rules: [], text: "it('round trip, callback computes', () => { expect(parse(serialize(rows))).toEqual(rows.map((r) => r.id)); });\n" },
1145
+ { ext: 'js', rules: [], text: "it('identity callback', () => { expect(clone(input)).toEqual(input.map((x) => x)); });\n" },
1146
+ { ext: 'js', rules: [], text: "it('shallow copy callback', () => { expect(clone(users)).toEqual(users.map((u) => ({ ...u }))); });\n" },
1147
+ { ext: 'js', rules: [], text: "it('pairs put back', () => { expect(clone(pairs)).toEqual(pairs.map(([k, v]) => [k, v])); });\n" },
1148
+ { ext: 'js', rules: [], text: "it('rows put back', () => { expect(clone(rows)).toEqual(rows.map(({ a, b }) => ({ a, b }))); });\n" },
1149
+ { ext: 'js', rules: ['tautology'], text: "it('expected value wrapped', () => { expect(total(items)).toBe(Number(items.reduce((s, i) => s + i.price, 0))); });\n" },
1150
+ { ext: 'js', rules: ['tautology'], text: "it('pairs swapped', () => { expect(flip(pairs)).toEqual(pairs.map(([k, v]) => [v, k])); });\n" },
1151
+ { ext: 'js', rules: [], text: "it('shallow copy callback, block', () => { expect(clone(users)).toEqual(users.map((u) => { return { ...u }; })); });\n" },
1152
+ { ext: 'js', rules: [], text: "it('property of the result', () => { expect(sortUsers(users).length).toBe(users.filter((u) => u.name).length); });\n" },
1153
+ { ext: 'js', rules: [], text: "it('helper outside the callback', () => { expect(calculateTotal(items)).toBe(items.reduce((s, i) => s + priceOf(i), 0)); });\n" },
1154
+ { ext: 'js', rules: [], text: "it('literal in the callback', () => { expect(doubled(xs)).toEqual(xs.map((x) => x * 2)); });\n" },
1155
+ { ext: 'js', rules: [], text: "it('constant outside the callback', () => { expect(calculateTotal(items)).toBe(items.reduce((s, i) => s + i.price * TAX_RATE, 0)); });\n" },
1156
+ { ext: 'js', rules: [], text: "it('new inside the call', () => { expect(render(new Date())).toBe(render(new Date())); });\n" },
1157
+ // ...and what must still be named after the narrowing.
1158
+ { ext: 'js', rules: ['tautology'], text: "it('active', () => { assert.deepStrictEqual(activeOf(accounts), accounts.filter((a) => a.active)); });\n" },
1159
+ { ext: 'js', rules: ['tautology'], text: "it('names', () => { expect(namesOf(users)).toEqual(users.map(({ name }) => name)); });\n" },
1160
+ { ext: 'js', rules: ['tautology'], text: "it('destructured reduce', () => { expect(calculateTotal(items)).toBe(items.reduce((s, { price }) => s + price, 0)); });\n" },
1161
+ { ext: 'js', rules: ['tautology'], text: "it('function expression', () => { expect(calculateTotal(items)).toBe(items.reduce(function (s, i) { return s + i.price; }, 0)); });\n" },
1162
+ { ext: 'js', rules: ['tautology'], text: "it('block arrow', () => { expect(calculateTotal(items)).toBe(items.reduce((s, i) => { return s + i.qty * i.price; }, 0)); });\n" },
863
1163
  { ext: 'py', rules: ['no-assertion'], text: "def test_nothing():\n x = 1\n pass\n" },
864
1164
  { ext: 'py', rules: ['tautology'], text: "def test_true():\n assert True\n" },
865
1165
  { ext: 'py', rules: [], text: "def test_ok():\n assert add(1, 2) == 3\n\n\ndef test_raises():\n with pytest.raises(ValueError):\n f()\n" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-dev-standards",
3
- "version": "6.14.0-beta.5",
3
+ "version": "6.14.0-beta.7",
4
4
  "description": "CLI tool for adopting Universal Development Standards",
5
5
  "keywords": [
6
6
  "documentation",
@@ -58,6 +58,8 @@
58
58
  "check:bundle-parity": "node scripts/check-bundle-parity.mjs",
59
59
  "prepack": "node scripts/prepack.mjs",
60
60
  "check:reachability": "node scripts/check-module-reachability.mjs",
61
+ "check:orphan-matrix": "node scripts/check-standards-orphan-matrix.mjs",
62
+ "check:plugin-manifest": "node scripts/check-plugin-manifest.mjs",
61
63
  "check:command-existence": "node scripts/check-command-existence.mjs",
62
64
  "check:effect-boundary": "node scripts/check-effect-boundary.mjs",
63
65
  "check:effect-boundary:self-test": "node scripts/check-effect-boundary.mjs --self-test"
@@ -298,7 +298,9 @@ function outputTerminal(auditResult, msg) {
298
298
  }
299
299
 
300
300
  // Report hint
301
- if (totalFindings > 0 && !auditResult._isReport) {
301
+ // The available-standards finding is not feedback for UDS (see handleReport), so it alone does not earn the hint.
302
+ const reportable = totalFindings - (auditResult.frictions || []).filter(f => f.type === 'not-installed').length;
303
+ if (reportable > 0 && !auditResult._isReport) {
302
304
  console.log();
303
305
  console.log(chalk.gray('Submit feedback: uds audit --report'));
304
306
  }
@@ -382,6 +384,9 @@ async function handleReport(auditResult, options, msg) {
382
384
 
383
385
  if (auditResult.frictions) {
384
386
  for (const friction of auditResult.frictions) {
387
+ // "N available standards not installed" is this project's choice to make, not a defect in a UDS
388
+ // standard: it is not feedback for the maintainers, and `--report --yes` would file it as one.
389
+ if (friction.type === 'not-installed') continue;
385
390
  findings.push({
386
391
  name: `[Friction] ${friction.standard} — ${friction.type}`,
387
392
  value: { type: 'friction', data: friction },
@@ -391,7 +396,9 @@ async function handleReport(auditResult, options, msg) {
391
396
  }
392
397
 
393
398
  if (findings.length === 0) {
394
- console.log(chalk.gray(msg.noFindings || 'No findings to report.'));
399
+ // Not "no issues": the audit above may have listed the available-standards finding, which is not sent.
400
+ const heldBack = (auditResult.frictions || []).some(f => f.type === 'not-installed');
401
+ console.log(chalk.gray(heldBack ? t().availableStandards.reportHeldBack : (msg.noFindings || 'No findings to report.')));
395
402
  return;
396
403
  }
397
404
 
@@ -50,6 +50,9 @@ import { runTestChangeCheck } from '../utils/test-change-check.js';
50
50
  import { runTestQualityGates } from '../utils/gate-scripts.js';
51
51
  import { pruneForeignSkillHashes, skillIssuesOf } from '../utils/skill-hash-ownership.js';
52
52
  import { pruneForeignCommandHashes, projectCommandHashes, commandIssuesOf } from '../utils/command-hash-ownership.js';
53
+ import { printAvailableStandardsCheckLine } from '../utils/available-standards-report.js';
54
+ import { printDoubleInstallWarning } from '../utils/skills-install-paths.js';
55
+ import { printSkillNameCollisionWarning } from '../utils/skill-name-collision.js';
53
56
 
54
57
  /**
55
58
  * Display the summary of file integrity status
@@ -536,9 +539,23 @@ export async function checkCommand(options = {}) {
536
539
  // Skills status
537
540
  const { missingSkills, missingCommands } = displaySkillsStatus(manifest, projectPath, msg);
538
541
 
542
+ // XSPEC-462 R2: the project has UDS skills AND the UDS plugin is installed, so each skill shows up twice.
543
+ // One warning, information only: it is not part of `allGood` below, so it changes neither the verdict nor
544
+ // the exit code. It says nothing when either side is missing or the plugin record cannot be read.
545
+ printDoubleInstallWarning(projectPath, getMarketplaceSkillsInfo());
546
+
547
+ // XSPEC-465 R1: a personal skill (~/.claude/skills/) with the same name as a UDS skill in this project wins
548
+ // silently. One warning, information only (not part of `allGood`): same verdict and exit code with or without
549
+ // it. It reads the personal folder every run; it cannot see the enterprise level, so no warning is not proof.
550
+ printSkillNameCollisionWarning(projectPath);
551
+
539
552
  // Coverage report
540
553
  displayCoverageReport(manifest, msg, common, projectPath);
541
554
 
555
+ // XSPEC-458 R5: one line about standards UDS ships that this project does not have. Information only:
556
+ // it is not part of `allGood` below, so it can change neither the verdict nor the exit code.
557
+ printAvailableStandardsCheckLine(manifest);
558
+
542
559
  // XSPEC-178: Full coverage compliance check
543
560
  checkFullCoverageCompliance(manifest, projectPath);
544
561
 
@@ -21,6 +21,8 @@
21
21
 
22
22
  import chalk from 'chalk';
23
23
  import { measureResolutionDrift } from '../utils/dependency-resolution.js';
24
+ import { notApplicableReason } from '../utils/deps-applicability.js';
25
+ import { t } from '../i18n/messages.js';
24
26
 
25
27
  /**
26
28
  * Render the human-readable report.
@@ -162,6 +164,23 @@ export function render(result) {
162
164
 
163
165
  export async function depsCommand(options = {}) {
164
166
  const root = options.path ?? process.cwd();
167
+ const msg = t().commands.deps || {};
168
+
169
+ // XSPEC-456 R6: `--if-present` is the explicit way to say "this is a shared script and some of the
170
+ // projects it runs in are not Node projects". Without it nothing changes: no package.json is still
171
+ // exit 1, because a check that examined nothing must not be able to show a pass. With it the run says
172
+ // out loud that nothing was checked and exits 0 - the shell `if [ -f package.json ]` that callers
173
+ // otherwise write around this command, made part of the command and made visible.
174
+ const skip = notApplicableReason(root, Boolean(options.ifPresent));
175
+ if (skip === 'no-package-json') {
176
+ const reason = msg.notApplicableNoPackageJson || 'Not applicable: there is no package.json, so nothing was checked';
177
+ if (options.json) {
178
+ console.log(JSON.stringify({ notApplicable: true, examined: 0, reason, root }, null, 2));
179
+ } else {
180
+ console.log(chalk.yellow(reason));
181
+ }
182
+ return;
183
+ }
165
184
 
166
185
  let result;
167
186
  try {
@@ -174,14 +193,25 @@ export async function depsCommand(options = {}) {
174
193
  return;
175
194
  }
176
195
 
196
+ // A package with no runtime dependencies has nothing to compare. `--if-present` accepts that too (the
197
+ // telemetry SDK publish flow hit exactly this), and says so rather than printing a tick.
198
+ const noRuntimeDeps = Boolean(options.ifPresent) && result.examined === 0 && !result.clean;
199
+ if (noRuntimeDeps) {
200
+ result = { ...result, notApplicable: true };
201
+ }
202
+
177
203
  if (options.json) {
178
204
  console.log(JSON.stringify(result, null, 2));
179
205
  } else {
180
206
  console.log(render(result));
207
+ if (noRuntimeDeps) {
208
+ console.log(chalk.yellow(msg.notApplicableNoRuntimeDeps || 'Not applicable: this package declares no runtime dependencies, so nothing was checked'));
209
+ console.log();
210
+ }
181
211
  }
182
212
 
183
213
  // Drift and unverifiable both fail. Drift is a real divergence; unverifiable
184
214
  // is an unknown, and a check that exits 0 on "I don't know" is a check that
185
215
  // reports success for the case it was built to catch.
186
- if (!result.clean) process.exitCode = 1;
216
+ if (!result.clean && !noRuntimeDeps) process.exitCode = 1;
187
217
  }
@@ -14,10 +14,13 @@ import { runInitFlow } from '../flows/init-flow.js';
14
14
  import { installStandards } from '../installers/standards-installer.js';
15
15
  import { installIntegrations, generateUniversalAgentsMd } from '../installers/integration-installer.js';
16
16
  import { installSkills, installCommands } from '../installers/skills-installer.js';
17
+ import { printSkillNameCollisionWarning } from '../utils/skill-name-collision.js';
18
+ import { printDoubleInstallWarning } from '../utils/skills-install-paths.js';
17
19
  import { writeFinalManifest } from '../installers/manifest-installer.js';
18
20
  import {
19
21
  getInstalledSkillsInfo,
20
22
  getProjectInstalledSkillsInfo,
23
+ getMarketplaceSkillsInfo,
21
24
  getAgentConfig,
22
25
  getAgentDisplayName
23
26
  } from '../utils/github.js';
@@ -364,6 +367,28 @@ export async function initCommand(options) {
364
367
  }
365
368
  persistRecorder(projectPath, installRecorder);
366
369
 
370
+ // 4.9. XSPEC-465 R1: tell the adopter now if a personal skill of theirs has the same name as a UDS skill
371
+ // that was just installed (the personal one wins, with no error). Information only: it does not change
372
+ // what was installed or the exit code.
373
+ if ((combinedResults?.skills?.length ?? 0) > 0) {
374
+ // XSPEC-468 R1: skills now go into the project by default, so a project whose owner already has the UDS
375
+ // plugin would list every skill twice. Same warning `uds check` prints (XSPEC-462 R2); information only,
376
+ // it changes neither what was installed nor the exit code.
377
+ printDoubleInstallWarning(projectPath, getMarketplaceSkillsInfo());
378
+ printSkillNameCollisionWarning(projectPath);
379
+ }
380
+
381
+ // 4.95. XSPEC-468 R1: the adopter asked for the plugin by name, so no skill file was written. Say so at the
382
+ // end, where they look for the skills, and say where they come from and what the other way would do.
383
+ if (config.skillsConfig.location === 'marketplace') {
384
+ console.log();
385
+ console.log(chalk.cyan(msg.skillsFromPluginTitle));
386
+ for (const line of msg.skillsFromPluginLines) {
387
+ console.log(chalk.gray(` ${line}`));
388
+ }
389
+ console.log();
390
+ }
391
+
367
392
  // 5. Setup Pre-commit Hook
368
393
  await setupHuskyHook(projectPath);
369
394
 
@@ -741,30 +766,21 @@ function buildNonInteractiveConfig(options, detected, projectPath) {
741
766
  return Boolean(config?.supportsSkills && config?.skills);
742
767
  });
743
768
  const hasSkillsCompatibleTool = skillsCapableTools.length > 0;
744
- // Marketplace is Claude Code's. A tool reaches it either by having one
745
- // (`supportsMarketplace`) or by reading Claude's directory (`fallbackSkillsPath`).
746
- // ⚠️ Those fallback claims are NOT all verified — `opencode`'s carries the bare
747
- // comment "Can read Claude skills" and no evidence. It is preserved here rather
748
- // than flipped, because changing behaviour on an unverified field in either
749
- // direction is a guess. Codex's identical claim WAS measured, and falsified, so
750
- // its field is now null (see `ai-agent-paths.js`) and it drops out here by data.
751
- // 🔴 The marketplace is all-or-nothing for a repo: it installs into Claude's
752
- // directory, so it serves a tool only if that tool has a marketplace of its own or
753
- // declares Claude's directory as its fallback. If ANY detected tool is not served
754
- // by it, file installs are used instead — every tool then gets its own path, and
755
- // nobody is left with a successful init and an empty directory.
756
- const reachesMarketplace = t => {
757
- const c = getAgentConfig(t);
758
- return Boolean(c?.supportsMarketplace || c?.fallbackSkillsPath);
759
- };
760
- const onlySkillsCompatibleTools =
761
- hasSkillsCompatibleTool && aiToolsNormalized.every(reachesMarketplace);
769
+ // XSPEC-468 R1: with no --skills-location, skills go INTO THE PROJECT (the main path, XSPEC-462).
770
+ // This used to pick 'marketplace' whenever every detected tool could reach Claude's plugin, which left
771
+ // `uds init --yes` with no `.claude/skills/` at all and told a new user to go and install a plugin: the
772
+ // opposite of the recommendation printed by `uds skills`. The plugin is still there for anyone who asks
773
+ // for it by name (`--skills-location marketplace`), and the plugin's limits are printed, not hidden.
774
+ //
775
+ // Two cases keep their old answer, and they are knowledge, not default:
776
+ // - tools were detected and none of them can take skills -> 'none' (nothing to install, said below);
777
+ // - nothing was detected at all -> 'project' with Claude Code's own project folder (the historical
778
+ // guess; see `noToolDetected` below).
779
+ const noToolDetected = aiToolsNormalized.length === 0;
762
780
 
763
781
  let skillsLocationFlag = options.skillsLocation;
764
782
  if (!skillsLocationFlag) {
765
- skillsLocationFlag = hasSkillsCompatibleTool
766
- ? (onlySkillsCompatibleTools ? 'marketplace' : 'project')
767
- : 'none';
783
+ skillsLocationFlag = (noToolDetected || hasSkillsCompatibleTool) ? 'project' : 'none';
768
784
  }
769
785
 
770
786
  // A detected tool that can take skills and is getting none must SAY SO. The worst
@@ -839,6 +855,10 @@ function buildNonInteractiveConfig(options, detected, projectPath) {
839
855
  // `installSkills()` takes its legacy branch, and every tool's skills land in
840
856
  // `.claude/skills/` — see the block above for what that measured.
841
857
  skillsInstallationsForYes = skillsCapableTools.map(agent => ({ agent, level: location }));
858
+ // Nothing detected: name Claude Code's folder explicitly. Leaving the list empty sent the install down
859
+ // the legacy branch of `installSkills()`, which does not take the locale (so `--locale zh-tw` in a
860
+ // project with no tool marker would have installed English and said nothing).
861
+ if (noToolDetected) skillsInstallationsForYes = [{ agent: 'claude-code', level: location }];
842
862
 
843
863
  // 🔴 Detected tools, none of which can take skills, is NOT the same as "no tools
844
864
  // detected". The first is knowledge — install nothing and say why. The second is