@1aboveio/engineering-skills 0.1.8 → 0.1.9

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 (89) hide show
  1. package/package.json +2 -2
  2. package/skills/better-review/SKILL.md +1 -1
  3. package/skills/better-review/release-check.mjs +3 -1
  4. package/skills/contributing/SKILL.md +1 -1
  5. package/skills/contributing/release-check.mjs +3 -1
  6. package/skills/e2e-test/SKILL.md +1 -1
  7. package/skills/e2e-test/release-check.mjs +3 -1
  8. package/skills/engineering-runtime/SKILL.md +1 -1
  9. package/skills/engineering-runtime/coherence/workflow.json +13 -13
  10. package/skills/engineering-runtime/release-check.mjs +3 -1
  11. package/skills/engineering-runtime/scripts/installation-resolver.mjs +191 -0
  12. package/skills/engineering-runtime/scripts/workflow-coherence.mjs +51 -10
  13. package/skills/ensure-coverage/SKILL.md +1 -1
  14. package/skills/ensure-coverage/release-check.mjs +3 -1
  15. package/skills/golden-path/SKILL.md +1 -1
  16. package/skills/golden-path/release-check.mjs +3 -1
  17. package/skills/harness-runtime/SKILL.md +1 -1
  18. package/skills/harness-runtime/release-check.mjs +3 -1
  19. package/skills/resolve-issues/SKILL.md +1 -1
  20. package/skills/resolve-issues/references/preflight.md +7 -0
  21. package/skills/resolve-issues/references/shared-modules.md +27 -0
  22. package/skills/resolve-issues/references/task-plan.md +5 -1
  23. package/skills/resolve-issues/release-check.mjs +3 -1
  24. package/skills/resolve-issues/scripts/active-installation.mjs +32 -0
  25. package/skills/resolve-issues/scripts/install-hooks.mjs +3 -0
  26. package/skills/resolve-issues/scripts/rehydrate.mjs +17 -1
  27. package/skills/resolve-release/SKILL.md +1 -1
  28. package/skills/resolve-release/release-check.mjs +3 -1
  29. package/skills/rush-issues/SKILL.md +1 -1
  30. package/skills/rush-issues/release-check.mjs +3 -1
  31. package/skills/rush-release/SKILL.md +1 -1
  32. package/skills/rush-release/release-check.mjs +3 -1
  33. package/skills/test-quality/SKILL.md +1 -1
  34. package/skills/test-quality/release-check.mjs +3 -1
  35. package/skills/better-review/scripts/pr-context.test.mjs +0 -168
  36. package/skills/better-review/scripts/rereview-scope.test.mjs +0 -587
  37. package/skills/better-review/scripts/scan-diff.test.mjs +0 -414
  38. package/skills/better-review/scripts/vendor-sync.test.mjs +0 -96
  39. package/skills/contributing/scripts/persist-conventions.test.mjs +0 -118
  40. package/skills/e2e-test/scripts/presentation-checks.test.mjs +0 -106
  41. package/skills/e2e-test/scripts/presentation-perceivability.test.mjs +0 -117
  42. package/skills/e2e-test/scripts/presentation-reachability.test.mjs +0 -69
  43. package/skills/e2e-test/scripts/presentation-render-health.test.mjs +0 -98
  44. package/skills/e2e-test/scripts/presentation-sweep.test.mjs +0 -71
  45. package/skills/e2e-test/scripts/presentation-temporal.test.mjs +0 -59
  46. package/skills/e2e-test/scripts/project-route-manifest.test.mjs +0 -76
  47. package/skills/engineering-runtime/engineering-runtime.test.mjs +0 -68
  48. package/skills/engineering-runtime/scripts/invocation-policy.test.mjs +0 -95
  49. package/skills/engineering-runtime/scripts/main-module.test.mjs +0 -288
  50. package/skills/engineering-runtime/scripts/required-check-plan.test.mjs +0 -96
  51. package/skills/ensure-coverage/scripts/adapters/nextjs-inventory.test.mjs +0 -96
  52. package/skills/ensure-coverage/scripts/check-quarantine-expiry.test.mjs +0 -47
  53. package/skills/ensure-coverage/scripts/ci-audit.test.mjs +0 -86
  54. package/skills/ensure-coverage/scripts/coverage-ledger.test.mjs +0 -447
  55. package/skills/ensure-coverage/scripts/design-parity.test.mjs +0 -552
  56. package/skills/ensure-coverage/scripts/lint-tests.test.mjs +0 -289
  57. package/skills/ensure-coverage/scripts/mock-policy-config.test.mjs +0 -119
  58. package/skills/golden-path/scripts/golden-path.test.mjs +0 -1457
  59. package/skills/harness-runtime/discover-models.test.mjs +0 -363
  60. package/skills/harness-runtime/harness-runtime.test.mjs +0 -967
  61. package/skills/harness-runtime/model-catalog-seed.test.mjs +0 -829
  62. package/skills/harness-runtime/model-catalog.test.mjs +0 -366
  63. package/skills/resolve-issues/scripts/cleanup-runs.test.mjs +0 -280
  64. package/skills/resolve-issues/scripts/dropbox.test.mjs +0 -346
  65. package/skills/resolve-issues/scripts/findings-reuse.test.mjs +0 -88
  66. package/skills/resolve-issues/scripts/github-reviews.test.mjs +0 -264
  67. package/skills/resolve-issues/scripts/install-hooks.test.mjs +0 -79
  68. package/skills/resolve-issues/scripts/issue-tree.test.mjs +0 -107
  69. package/skills/resolve-issues/scripts/manual-invocation.test.mjs +0 -14
  70. package/skills/resolve-issues/scripts/next-actions-capacity.test.mjs +0 -149
  71. package/skills/resolve-issues/scripts/next-actions.test.mjs +0 -915
  72. package/skills/resolve-issues/scripts/plan-sync.test.mjs +0 -156
  73. package/skills/resolve-issues/scripts/preflight-models.test.mjs +0 -448
  74. package/skills/resolve-issues/scripts/ready-check.test.mjs +0 -217
  75. package/skills/resolve-issues/scripts/rehydrate.test.mjs +0 -91
  76. package/skills/resolve-issues/scripts/review-verdict.test.mjs +0 -1060
  77. package/skills/resolve-issues/scripts/size-check.test.mjs +0 -458
  78. package/skills/resolve-release/scripts/apply.test.mjs +0 -99
  79. package/skills/resolve-release/scripts/dark-flags.test.mjs +0 -100
  80. package/skills/resolve-release/scripts/flow.test.mjs +0 -340
  81. package/skills/resolve-release/scripts/green-head.test.mjs +0 -101
  82. package/skills/resolve-release/scripts/npm-version-absence.test.mjs +0 -426
  83. package/skills/resolve-release/scripts/plan-npm.test.mjs +0 -659
  84. package/skills/resolve-release/scripts/plan-toml-boundary.test.mjs +0 -317
  85. package/skills/resolve-release/scripts/plan-uv.test.mjs +0 -291
  86. package/skills/resolve-release/scripts/plan.test.mjs +0 -428
  87. package/skills/test-quality/scripts/lint-tests.test.mjs +0 -591
  88. package/skills/test-quality/scripts/mock-policy-config.test.mjs +0 -119
  89. package/skills/test-quality/scripts/persist-conventions.test.mjs +0 -104
@@ -1,119 +0,0 @@
1
- // Tests for the mock-policy classifier (pure; one fs case via a temp dir).
2
- import { test } from 'node:test'
3
- import assert from 'node:assert/strict'
4
- import fs from 'node:fs'
5
- import os from 'node:os'
6
- import path from 'node:path'
7
-
8
- import {
9
- DEFAULT_MOCK_POLICY,
10
- resolveMockPolicy,
11
- loadMockPolicy,
12
- loadMockPolicyFromFile,
13
- extractMockTarget,
14
- classifyMockTarget,
15
- } from './mock-policy-config.mjs'
16
-
17
- test('default policy is zero-tolerance: default-on, no waiver tag', () => {
18
- assert.equal(DEFAULT_MOCK_POLICY.enabled, true)
19
- // the inline-waiver escape hatch is gone
20
- assert.equal(DEFAULT_MOCK_POLICY.waiverTag, undefined)
21
- })
22
-
23
- test('extractMockTarget pulls the specifier from vi/jest/vitest mock+doMock', () => {
24
- assert.equal(extractMockTarget("vi." + "mock('@/lib/x')"), '@/lib/x')
25
- assert.equal(extractMockTarget('jest.' + 'mock("pkg")'), 'pkg')
26
- assert.equal(extractMockTarget('vi.' + 'doMock(`@/a/b`)'), '@/a/b')
27
- assert.equal(extractMockTarget('vitest.' + 'mock("./rel")'), './rel')
28
- assert.equal(extractMockTarget('const x = mockThing()'), null) // bare mock() is not a module mock
29
- assert.equal(extractMockTarget('expect(x).toBe(1)'), null)
30
- })
31
-
32
- test('classify: first-party alias @/ and ~/ are internal seams (the incident case)', () => {
33
- const p = resolveMockPolicy({})
34
- assert.equal(classifyMockTarget('@/lib/org-allowlist-client', p).internal, true)
35
- assert.equal(classifyMockTarget('~/services/cp', p).internal, true)
36
- })
37
-
38
- test('classify: stdlib and third-party packages are external (exempt)', () => {
39
- const p = resolveMockPolicy({})
40
- assert.equal(classifyMockTarget('node:fs', p).internal, false)
41
- assert.equal(classifyMockTarget('react', p).internal, false)
42
- assert.equal(classifyMockTarget('@playwright/test', p).internal, false)
43
- })
44
-
45
- test('classify: relative import into source is internal; into a test util/fixture is not', () => {
46
- const p = resolveMockPolicy({})
47
- assert.equal(classifyMockTarget('../services/payments', p).internal, true)
48
- assert.equal(classifyMockTarget('./helpers/operator-session-store', p).internal, false)
49
- assert.equal(classifyMockTarget('../__mocks__/cp', p).internal, false)
50
- assert.equal(classifyMockTarget('../fixtures/data', p).internal, false)
51
- })
52
-
53
- test('classify: declared first-party workspace package is internal', () => {
54
- const p = resolveMockPolicy({ firstPartyPackages: ['@acme/'] })
55
- assert.equal(classifyMockTarget('@acme/db', p).internal, true)
56
- assert.equal(classifyMockTarget('@acme', p).internal, true)
57
- assert.equal(classifyMockTarget('@other/db', p).internal, false)
58
- })
59
-
60
- test('classify: declared externals allowlist exempts a first-party-looking target', () => {
61
- const p = resolveMockPolicy({ externals: ['^@/generated/'] })
62
- assert.equal(classifyMockTarget('@/generated/openapi', p).internal, false) // exempted
63
- assert.equal(classifyMockTarget('@/lib/x', p).internal, true) // still flagged
64
- })
65
-
66
- test('compiled _externalsRe is non-enumerable: does not leak into JSON / enumeration', () => {
67
- const p = resolveMockPolicy({ externals: ['^@/generated/'] })
68
- // the compiled RegExp cache works...
69
- assert.equal(classifyMockTarget('@/generated/openapi', p).internal, false)
70
- // ...but is hidden from enumeration and serialization
71
- assert.ok(!Object.keys(p).includes('_externalsRe'))
72
- assert.equal(JSON.parse(JSON.stringify(p))._externalsRe, undefined)
73
- })
74
-
75
- test('loadMockPolicy reads coverage.config.json topology, defaults to on with no config', () => {
76
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'mpc-'))
77
- // no config → zero-tolerance default (on), conventional topology
78
- assert.equal(loadMockPolicy(dir).enabled, true)
79
- // with config → declared topology is merged in (config declares topology, not on/off)
80
- fs.writeFileSync(
81
- path.join(dir, 'coverage.config.json'),
82
- JSON.stringify({ mockPolicy: { firstPartyPackages: ['@acme/'] } }),
83
- )
84
- const p = loadMockPolicy(dir)
85
- assert.equal(p.enabled, true)
86
- assert.deepEqual(p.firstPartyPackages, ['@acme/'])
87
- // inherited default array still present
88
- assert.ok(p.firstPartyAliasPrefixes.includes('@/'))
89
- })
90
-
91
- test('loadMockPolicy never throws on malformed config (and stays on)', () => {
92
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'mpc-'))
93
- fs.writeFileSync(path.join(dir, 'coverage.config.json'), '{ not json')
94
- assert.equal(loadMockPolicy(dir).enabled, true)
95
- })
96
-
97
- test('loadMockPolicyFromFile reads the NAMED file (finding #1: not just its dirname)', () => {
98
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'mpc-'))
99
- const file = path.join(dir, 'team-coverage.json') // deliberately non-standard name
100
- fs.writeFileSync(file, JSON.stringify({ mockPolicy: { enabled: true, externals: ['^@/generated/'] } }))
101
- const p = loadMockPolicyFromFile(file)
102
- assert.equal(p.enabled, true)
103
- // the declared externals must actually apply (proof the file was read, not defaults)
104
- assert.equal(classifyMockTarget('@/generated/openapi', p).internal, false)
105
- assert.equal(classifyMockTarget('@/lib/auth', p).internal, true)
106
- })
107
-
108
- test('loadMockPolicyFromFile falls back to defaults when the named file is missing', () => {
109
- // finding #1: a declared config that does not apply must not look like a clean pass.
110
- // (It warns on stderr; here we assert the zero-tolerance default — gate stays ON.)
111
- const p = loadMockPolicyFromFile(path.join(os.tmpdir(), 'definitely-absent-config-xyz.json'))
112
- assert.equal(p.enabled, true)
113
- })
114
-
115
- test('loadMockPolicyFromFile with no argument discovers coverage.config.json in cwd', () => {
116
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'mpc-'))
117
- fs.writeFileSync(path.join(dir, 'coverage.config.json'), JSON.stringify({ mockPolicy: { enabled: true } }))
118
- assert.equal(loadMockPolicyFromFile(undefined, dir).enabled, true)
119
- })
@@ -1,104 +0,0 @@
1
- // Tests for persist-conventions: the real CLI against real files in a temp repo.
2
- import { test } from 'node:test'
3
- import assert from 'node:assert/strict'
4
- import { spawnSync } from 'node:child_process'
5
- import { existsSync, lstatSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
6
- import { tmpdir } from 'node:os'
7
- import { join } from 'node:path'
8
- import { fileURLToPath } from 'node:url'
9
-
10
- import { markers } from './persist-conventions-core.mjs'
11
-
12
- const CLI = fileURLToPath(new URL('./persist-conventions.mjs', import.meta.url))
13
- const SKILL = readFileSync(fileURLToPath(new URL('../SKILL.md', import.meta.url)), 'utf8')
14
- const TEMPLATE = readFileSync(fileURLToPath(new URL('../references/testing-conventions.md', import.meta.url)), 'utf8')
15
- const [START, END] = markers('testing')
16
-
17
- function withRepo(fn) {
18
- const dir = mkdtempSync(join(tmpdir(), 'persist-conventions-'))
19
- try {
20
- return fn(dir, (name) => readFileSync(join(dir, name), 'utf8'))
21
- } finally {
22
- rmSync(dir, { recursive: true, force: true })
23
- }
24
- }
25
-
26
- function run(dir, ...args) {
27
- const res = spawnSync(process.execPath, [CLI, '--repo-root', dir, ...args], { encoding: 'utf8' })
28
- return { code: res.status, out: res.stdout }
29
- }
30
-
31
- test('the persisted conventions carry one rule per SKILL.md principle, in order', () => {
32
- const fromSkill = [...SKILL.matchAll(/^\| (\d) \| \[/gm)].map((m) => Number(m[1]))
33
- const fromTemplate = [...TEMPLATE.matchAll(/^(\d+)\. /gm)].map((m) => Number(m[1]))
34
- assert.ok(fromSkill.length >= 5, 'principle table not found in SKILL.md')
35
- assert.deepEqual(fromTemplate, fromSkill)
36
- })
37
-
38
- test('without --write it previews and writes nothing', () => {
39
- withRepo((dir) => {
40
- const { code, out } = run(dir)
41
- assert.equal(code, 0)
42
- assert.match(out, /CONTRIBUTING\.md: would create/)
43
- assert.match(out, /re-run with --write to write$/m)
44
- assert.equal(existsSync(join(dir, 'CONTRIBUTING.md')), false)
45
- assert.equal(existsSync(join(dir, 'AGENTS.md')), false)
46
- })
47
- })
48
-
49
- test('--write creates CONTRIBUTING.md and AGENTS.md, links CLAUDE.md to it, and a re-run changes nothing', () => {
50
- withRepo((dir, read) => {
51
- const first = run(dir, '--write')
52
- assert.equal(first.code, 0)
53
- assert.match(first.out, /CONTRIBUTING\.md: created/)
54
- assert.match(first.out, /AGENTS\.md: created/)
55
- assert.match(first.out, /CLAUDE\.md: linked to AGENTS\.md/)
56
- const conventions = read('CONTRIBUTING.md')
57
- assert.ok(conventions.startsWith(`# Contributing\n\n${START}`))
58
- assert.ok(conventions.includes('## Testing conventions'))
59
- assert.ok(conventions.includes("6. Don't test config files"))
60
- assert.match(read('AGENTS.md'), /\[CONTRIBUTING\.md\]\(CONTRIBUTING\.md\)/)
61
-
62
- assert.ok(lstatSync(join(dir, 'CLAUDE.md')).isSymbolicLink())
63
-
64
- const before = [conventions, read('AGENTS.md'), read('CLAUDE.md')]
65
- assert.match(run(dir, '--write').out, /0 file\(s\) written, 3 unchanged$/m)
66
- assert.deepEqual([read('CONTRIBUTING.md'), read('AGENTS.md'), read('CLAUDE.md')], before)
67
- })
68
- })
69
-
70
- test('a stale section is replaced and the rest of each file is kept', () => {
71
- withRepo((dir, read) => {
72
- writeFileSync(join(dir, 'CONTRIBUTING.md'), `# Contributing\n\nUse tabs.\n\n${START}\nold principles\n${END}\n\n## Naming\n\ncamelCase.\n`)
73
- writeFileSync(join(dir, 'AGENTS.md'), '# Agents\n\nRun `pnpm test`.\n')
74
- run(dir, '--write')
75
- const conventions = read('CONTRIBUTING.md')
76
- assert.ok(conventions.startsWith('# Contributing\n\nUse tabs.\n\n'))
77
- assert.ok(conventions.endsWith(`${END}\n\n## Naming\n\ncamelCase.\n`))
78
- assert.ok(!conventions.includes('old principles'))
79
- assert.equal(conventions.split(START).length, 2) // exactly one section
80
- assert.ok(read('AGENTS.md').startsWith('# Agents\n\nRun `pnpm test`.\n\n## Contributing'))
81
- })
82
- })
83
-
84
- test('an AGENTS.md that already names CONTRIBUTING.md is left alone; OLD_CONTRIBUTING.md is not a mention', () => {
85
- withRepo((dir, read) => {
86
- const agents = '# Agents\n\nSee CONTRIBUTING.md.\n'
87
- writeFileSync(join(dir, 'AGENTS.md'), agents)
88
- assert.match(run(dir, '--write').out, /AGENTS\.md: unchanged/)
89
- assert.equal(read('AGENTS.md'), agents)
90
- })
91
- withRepo((dir, read) => {
92
- writeFileSync(join(dir, 'AGENTS.md'), '# Agents\n\nSee OLD_CONTRIBUTING.md.\n')
93
- assert.match(run(dir, '--write').out, /AGENTS\.md: updated/)
94
- assert.match(read('AGENTS.md'), /\[CONTRIBUTING\.md\]\(CONTRIBUTING\.md\)/)
95
- })
96
- })
97
-
98
- test('an unknown argument or a missing repo root is a usage error', () => {
99
- withRepo((dir) => {
100
- assert.equal(run(dir, '--force').code, 2)
101
- assert.equal(run(join(dir, 'missing')).code, 2)
102
- assert.equal(existsSync(join(dir, 'CONTRIBUTING.md')), false)
103
- })
104
- })