@olegkoval/agent-skills 1.78.1 → 1.79.0
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/adapters/claude/olko-github-pr/skills/lekker-review/scripts/native-dedup.mjs +47 -0
- package/package.json +1 -1
- package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/skills/lekker-review/scripts/native-dedup.mjs +47 -0
- package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { loadDedup } from './validate-lines.mjs'
|
|
6
|
+
|
|
7
|
+
const record = value => value && typeof value === 'object' && !Array.isArray(value)
|
|
8
|
+
|
|
9
|
+
export function deduplicateManifest(manifestPath) {
|
|
10
|
+
const path = resolve(manifestPath)
|
|
11
|
+
const manifest = JSON.parse(readFileSync(path, 'utf8'))
|
|
12
|
+
if (!record(manifest) || !Array.isArray(manifest.dimensions) || manifest.dimensions.length === 0) {
|
|
13
|
+
throw new Error('manifest must contain a non-empty dimensions array')
|
|
14
|
+
}
|
|
15
|
+
const dimensions = manifest.dimensions
|
|
16
|
+
if (!dimensions.every(item => record(item) && typeof item.name === 'string' && item.name.trim()
|
|
17
|
+
&& item.name === item.name.trim() && typeof item.path === 'string' && item.path.trim()
|
|
18
|
+
&& item.path === item.path.trim())) throw new Error('each dimension requires a non-empty name and path')
|
|
19
|
+
if (new Set(dimensions.map(item => item.name)).size !== dimensions.length) throw new Error('dimension names must be unique')
|
|
20
|
+
const findings = dimensions.flatMap(({ name, path: resultPath }) => {
|
|
21
|
+
const document = JSON.parse(readFileSync(resolve(dirname(path), resultPath), 'utf8'))
|
|
22
|
+
if (!record(document) || !Array.isArray(document.findings) || document.findings.some(finding => !record(finding))) {
|
|
23
|
+
throw new Error(`${name} result must contain a findings array of objects`)
|
|
24
|
+
}
|
|
25
|
+
return document.findings.map(finding => ({ ...finding, _dimension: name, agreedBy: [name] }))
|
|
26
|
+
})
|
|
27
|
+
return { findings: loadDedup()(findings) }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function main(args) {
|
|
31
|
+
const [flag, manifestPath, ...extra] = args
|
|
32
|
+
if (flag !== '--manifest' || !manifestPath || manifestPath.startsWith('--') || extra.length) {
|
|
33
|
+
console.error('usage: native-dedup.mjs --manifest <manifest.json>')
|
|
34
|
+
process.exitCode = 2
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
try { console.log(JSON.stringify(deduplicateManifest(manifestPath))) } catch (error) {
|
|
38
|
+
console.error(`native-dedup: ${error.message}`)
|
|
39
|
+
process.exitCode = 2
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function isMain() {
|
|
44
|
+
try { return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url)) } catch { return false }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (isMain()) main(process.argv.slice(2))
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { loadDedup } from './validate-lines.mjs'
|
|
6
|
+
|
|
7
|
+
const record = value => value && typeof value === 'object' && !Array.isArray(value)
|
|
8
|
+
|
|
9
|
+
export function deduplicateManifest(manifestPath) {
|
|
10
|
+
const path = resolve(manifestPath)
|
|
11
|
+
const manifest = JSON.parse(readFileSync(path, 'utf8'))
|
|
12
|
+
if (!record(manifest) || !Array.isArray(manifest.dimensions) || manifest.dimensions.length === 0) {
|
|
13
|
+
throw new Error('manifest must contain a non-empty dimensions array')
|
|
14
|
+
}
|
|
15
|
+
const dimensions = manifest.dimensions
|
|
16
|
+
if (!dimensions.every(item => record(item) && typeof item.name === 'string' && item.name.trim()
|
|
17
|
+
&& item.name === item.name.trim() && typeof item.path === 'string' && item.path.trim()
|
|
18
|
+
&& item.path === item.path.trim())) throw new Error('each dimension requires a non-empty name and path')
|
|
19
|
+
if (new Set(dimensions.map(item => item.name)).size !== dimensions.length) throw new Error('dimension names must be unique')
|
|
20
|
+
const findings = dimensions.flatMap(({ name, path: resultPath }) => {
|
|
21
|
+
const document = JSON.parse(readFileSync(resolve(dirname(path), resultPath), 'utf8'))
|
|
22
|
+
if (!record(document) || !Array.isArray(document.findings) || document.findings.some(finding => !record(finding))) {
|
|
23
|
+
throw new Error(`${name} result must contain a findings array of objects`)
|
|
24
|
+
}
|
|
25
|
+
return document.findings.map(finding => ({ ...finding, _dimension: name, agreedBy: [name] }))
|
|
26
|
+
})
|
|
27
|
+
return { findings: loadDedup()(findings) }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function main(args) {
|
|
31
|
+
const [flag, manifestPath, ...extra] = args
|
|
32
|
+
if (flag !== '--manifest' || !manifestPath || manifestPath.startsWith('--') || extra.length) {
|
|
33
|
+
console.error('usage: native-dedup.mjs --manifest <manifest.json>')
|
|
34
|
+
process.exitCode = 2
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
try { console.log(JSON.stringify(deduplicateManifest(manifestPath))) } catch (error) {
|
|
38
|
+
console.error(`native-dedup: ${error.message}`)
|
|
39
|
+
process.exitCode = 2
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function isMain() {
|
|
44
|
+
try { return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url)) } catch { return false }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (isMain()) main(process.argv.slice(2))
|