ReviewOS

also looking at this

stacks/buddy

fix(deps-file): anchor the dependency regex to a key, and rewrite each match from its own captures

#1454
Merged glennmichael123 wants to merge fix/deps-file-anchored-key-regex into main
3 files +216 -41
test/respect-latest.test.tsmodified+12-5
Changes to test/respect-latest.test.ts
@@ -126,13 +126,20 @@ devDependencies:
126126 // Pass the content directly to avoid file system corruption
127127 const updatedContent = await updateDependencyFile(depsPath, depsYaml, updates)
128128
129 // python.org should not be updated because it uses "*"
129 // The result has to be YAML before any of the assertions below mean
130 // anything. Without this, `toContain('python.org: "*"')` was satisfied by
131 // the corrupt line `python.org: "*"3.13.5`, so this test passed for months
132 // against output that `Bun.YAML.parse` rejects (stacksjs/buddy#1453).
133 expect(() => Bun.YAML.parse(updatedContent)).not.toThrow()
134
135 // python.org should not be updated because it uses "*", quoted or not
130136 expect(updatedContent).toContain('python.org: "*"')
131 expect(updatedContent).not.toContain('python.org: "3.13.5"')
137 expect(updatedContent).not.toContain('3.13.5')
132138
133 // typescript should be updated because it uses a specific version
134 expect(updatedContent).toContain('typescript: ^5.1.0')
135 expect(updatedContent).not.toContain('typescript: ^5.0.0')
139 // typescript should be updated because it uses a specific version, and the
140 // author's quoting survives the rewrite
141 expect(updatedContent).toContain('typescript: "^5.1.0"')
142 expect(updatedContent).not.toContain('5.0.0')
136143 })
137144
138145 it('should test CLI respectLatest flag override', async () => {