@onlooker-community/ecosystem 0.10.0 → 0.14.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/.claude-plugin/marketplace.json +39 -1
- package/.claude-plugin/plugin.json +2 -2
- package/.github/copilot-instructions.md +46 -0
- package/.github/workflows/coverage.yml +78 -0
- package/.github/workflows/release.yml +24 -8
- package/.github/workflows/test.yml +3 -0
- package/.markdownlintignore +3 -0
- package/.release-please-manifest.json +4 -1
- package/CHANGELOG.md +37 -0
- package/README.md +57 -13
- package/config.json +6 -1
- package/docs/adr/001-claude-code-hooks-as-integration-surface.md +43 -0
- package/docs/adr/002-centralized-jsonl-event-log.md +39 -0
- package/docs/adr/003-ulid-over-uuid.md +40 -0
- package/docs/adr/004-plugin-config-with-settings-overlay.md +34 -0
- package/docs/architecture.md +117 -0
- package/hooks/hooks.json +4 -0
- package/package.json +13 -7
- package/plugins/archivist/.claude-plugin/plugin.json +14 -0
- package/plugins/archivist/CHANGELOG.md +8 -0
- package/plugins/archivist/README.md +105 -0
- package/plugins/archivist/config.json +18 -0
- package/plugins/archivist/hooks/hooks.json +35 -0
- package/plugins/archivist/scripts/hooks/archivist-extract.sh +238 -0
- package/plugins/archivist/scripts/hooks/archivist-inject.sh +159 -0
- package/plugins/archivist/scripts/lib/archivist-config.sh +66 -0
- package/plugins/archivist/scripts/lib/archivist-project-key.sh +91 -0
- package/plugins/archivist/scripts/lib/archivist-storage.sh +215 -0
- package/plugins/archivist/scripts/lib/archivist-ulid.sh +52 -0
- package/plugins/echo/.claude-plugin/plugin.json +14 -0
- package/plugins/echo/CHANGELOG.md +24 -0
- package/plugins/echo/README.md +110 -0
- package/plugins/echo/config.json +15 -0
- package/plugins/echo/docs/adr/001-echo-as-separate-plugin.md +33 -0
- package/plugins/echo/docs/adr/002-direct-evaluation-vs-tribunal-pipeline.md +35 -0
- package/plugins/echo/docs/adr/003-stop-hook-trigger.md +40 -0
- package/plugins/echo/hooks/hooks.json +15 -0
- package/plugins/echo/scripts/hooks/echo-stop-gate.sh +366 -0
- package/plugins/echo/scripts/lib/echo-config.sh +108 -0
- package/plugins/echo/scripts/lib/echo-events.sh +74 -0
- package/plugins/echo/scripts/lib/echo-project-key.sh +81 -0
- package/plugins/echo/scripts/lib/echo-ulid.sh +46 -0
- package/plugins/tribunal/.claude-plugin/plugin.json +20 -0
- package/plugins/tribunal/CHANGELOG.md +10 -0
- package/plugins/tribunal/README.md +134 -0
- package/plugins/tribunal/agents/tribunal-actor.md +35 -0
- package/plugins/tribunal/agents/tribunal-judge-adversarial.md +51 -0
- package/plugins/tribunal/agents/tribunal-judge-security.md +47 -0
- package/plugins/tribunal/agents/tribunal-judge-standard.md +47 -0
- package/plugins/tribunal/agents/tribunal-meta-judge.md +61 -0
- package/plugins/tribunal/config.json +50 -0
- package/plugins/tribunal/docs/adr/001-actor-jury-meta-gate-loop.md +40 -0
- package/plugins/tribunal/docs/adr/002-majority-gate-policy.md +48 -0
- package/plugins/tribunal/hooks/hooks.json +15 -0
- package/plugins/tribunal/scripts/hooks/tribunal-stop-gate.sh +267 -0
- package/plugins/tribunal/scripts/lib/tribunal-aggregate.sh +65 -0
- package/plugins/tribunal/scripts/lib/tribunal-config.sh +101 -0
- package/plugins/tribunal/scripts/lib/tribunal-events.sh +97 -0
- package/plugins/tribunal/scripts/lib/tribunal-gate.sh +111 -0
- package/plugins/tribunal/scripts/lib/tribunal-jury.sh +102 -0
- package/plugins/tribunal/scripts/lib/tribunal-project-key.sh +84 -0
- package/plugins/tribunal/scripts/lib/tribunal-rubric.sh +153 -0
- package/plugins/tribunal/scripts/lib/tribunal-ulid.sh +50 -0
- package/plugins/tribunal/scripts/lib/tribunal-verdict.sh +127 -0
- package/plugins/tribunal/skills/tribunal/SKILL.md +129 -0
- package/release-please-config.json +43 -5
- package/scripts/coverage/bash-coverage.mjs +169 -0
- package/scripts/coverage/format-comment.mjs +120 -0
- package/scripts/coverage/run-coverage.mjs +151 -0
- package/scripts/hooks/agent-spawn-tracker.sh +4 -4
- package/scripts/hooks/prompt-rule-injector.sh +122 -0
- package/scripts/lib/portable-lock.sh +48 -0
- package/scripts/lib/prompt-rules.sh +207 -0
- package/scripts/lib/tool-history.sh +7 -8
- package/scripts/lib/validate-path.sh +4 -0
- package/scripts/lint/check-manifests.mjs +314 -0
- package/scripts/lint/check-references.mjs +311 -0
- package/skills/list-prompt-rules/SKILL.md +15 -0
- package/test/bats/archivist-config-files.bats +60 -0
- package/test/bats/archivist-config.bats +54 -0
- package/test/bats/archivist-inject.bats +73 -0
- package/test/bats/archivist-project-key.bats +75 -0
- package/test/bats/archivist-storage.bats +119 -0
- package/test/bats/archivist-ulid.bats +36 -0
- package/test/bats/config.bats +10 -10
- package/test/bats/echo-config.bats +90 -0
- package/test/bats/echo-events.bats +121 -0
- package/test/bats/echo-project-key.bats +115 -0
- package/test/bats/echo-stop-hook.bats +101 -0
- package/test/bats/echo-ulid.bats +38 -0
- package/test/bats/portable-lock.bats +62 -0
- package/test/bats/prompt-rules.bats +269 -0
- package/test/bats/tribunal-aggregate.bats +77 -0
- package/test/bats/tribunal-config.bats +86 -0
- package/test/bats/tribunal-events.bats +209 -0
- package/test/bats/tribunal-gate.bats +95 -0
- package/test/bats/tribunal-jury.bats +80 -0
- package/test/bats/tribunal-rubric.bats +119 -0
- package/test/bats/tribunal-stop-hook.bats +73 -0
- package/test/bats/tribunal-verdict.bats +71 -0
- package/test/fixtures/hook-inputs/user-prompt-submit-rule-match.json +8 -0
- package/test/fixtures/hook-inputs/user-prompt-submit-rule-nomatch.json +8 -0
- package/test/helpers/setup.bash +9 -0
- package/test/node/check-manifests.test.mjs +173 -0
- package/test/node/check-references.test.mjs +279 -0
- package/test/node/coverage.test.mjs +143 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { describe, it } from 'node:test';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const REPO_ROOT = resolve(HERE, '..', '..');
|
|
11
|
+
|
|
12
|
+
function runJson(script, root, ...args) {
|
|
13
|
+
const r = spawnSync('node', [join(REPO_ROOT, script), '--root', root, '--json', ...args], {
|
|
14
|
+
encoding: 'utf8',
|
|
15
|
+
});
|
|
16
|
+
if (r.status !== 0) {
|
|
17
|
+
throw new Error(`${script} exited ${r.status}\nstdout:\n${r.stdout}\nstderr:\n${r.stderr}`);
|
|
18
|
+
}
|
|
19
|
+
return JSON.parse(r.stdout);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function scaffoldMarketplace() {
|
|
23
|
+
const root = mkdtempSync(join(tmpdir(), 'coverage-'));
|
|
24
|
+
mkdirSync(join(root, '.claude-plugin'), { recursive: true });
|
|
25
|
+
writeFileSync(
|
|
26
|
+
join(root, '.claude-plugin', 'marketplace.json'),
|
|
27
|
+
JSON.stringify({ name: 't', plugins: [{ name: 's', source: './' }] }),
|
|
28
|
+
);
|
|
29
|
+
return root;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function writeFile(path, content) {
|
|
33
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
34
|
+
writeFileSync(path, content);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('bash-coverage', () => {
|
|
38
|
+
it('returns 100% when every public function is referenced in tests', () => {
|
|
39
|
+
const root = scaffoldMarketplace();
|
|
40
|
+
writeFile(join(root, 'scripts/lib/foo.sh'), `#!/usr/bin/env bash\nfoo() { echo 1; }\nbar() { echo 2; }\n`);
|
|
41
|
+
writeFile(join(root, 'test/bats/foo.bats'), `@test "covers" { foo; bar; }\n`);
|
|
42
|
+
const report = runJson('scripts/coverage/bash-coverage.mjs', root);
|
|
43
|
+
assert.equal(report.overall.total, 2);
|
|
44
|
+
assert.equal(report.overall.tested, 2);
|
|
45
|
+
assert.equal(report.overall.ratio, 1);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('drops untested public functions into the untested list', () => {
|
|
49
|
+
const root = scaffoldMarketplace();
|
|
50
|
+
writeFile(join(root, 'scripts/lib/foo.sh'), `#!/usr/bin/env bash\nfoo() { :; }\nbar() { :; }\nbaz() { :; }\n`);
|
|
51
|
+
writeFile(join(root, 'test/bats/foo.bats'), `@test "covers" { foo; }\n`);
|
|
52
|
+
const report = runJson('scripts/coverage/bash-coverage.mjs', root);
|
|
53
|
+
assert.equal(report.overall.tested, 1);
|
|
54
|
+
assert.equal(report.overall.total, 3);
|
|
55
|
+
const untestedNames = report.untested.map((u) => u.name).sort();
|
|
56
|
+
assert.deepEqual(untestedNames, ['bar', 'baz']);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('skips private (underscore-prefixed) helpers', () => {
|
|
60
|
+
const root = scaffoldMarketplace();
|
|
61
|
+
writeFile(join(root, 'scripts/lib/foo.sh'), `#!/usr/bin/env bash\nfoo() { :; }\n_internal() { :; }\n`);
|
|
62
|
+
writeFile(join(root, 'test/bats/foo.bats'), `@test "covers foo" { foo; }\n`);
|
|
63
|
+
const report = runJson('scripts/coverage/bash-coverage.mjs', root);
|
|
64
|
+
assert.equal(report.overall.total, 1, JSON.stringify(report));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('does not count indented function-looking lines as definitions', () => {
|
|
68
|
+
const root = scaffoldMarketplace();
|
|
69
|
+
writeFile(
|
|
70
|
+
join(root, 'scripts/lib/foo.sh'),
|
|
71
|
+
`#!/usr/bin/env bash\nfoo() {\n inner() { :; } # nested, should NOT count\n}\n`,
|
|
72
|
+
);
|
|
73
|
+
writeFile(join(root, 'test/bats/foo.bats'), `@test "covers" { foo; }\n`);
|
|
74
|
+
const report = runJson('scripts/coverage/bash-coverage.mjs', root);
|
|
75
|
+
assert.equal(report.overall.total, 1);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('handles repos with no .sh files at all', () => {
|
|
79
|
+
const root = scaffoldMarketplace();
|
|
80
|
+
const report = runJson('scripts/coverage/bash-coverage.mjs', root);
|
|
81
|
+
assert.equal(report.overall.total, 0);
|
|
82
|
+
assert.equal(report.overall.ratio, 1);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('format-comment', () => {
|
|
87
|
+
function render(nodeReport, bashReport, sha = 'abcdef0123456789') {
|
|
88
|
+
const tmp = mkdtempSync(join(tmpdir(), 'cov-fmt-'));
|
|
89
|
+
const nPath = join(tmp, 'node.json');
|
|
90
|
+
const bPath = join(tmp, 'bash.json');
|
|
91
|
+
writeFileSync(nPath, JSON.stringify(nodeReport));
|
|
92
|
+
writeFileSync(bPath, JSON.stringify(bashReport));
|
|
93
|
+
const r = spawnSync(
|
|
94
|
+
'node',
|
|
95
|
+
[join(REPO_ROOT, 'scripts', 'coverage', 'format-comment.mjs'), '--node', nPath, '--bash', bPath, '--sha', sha],
|
|
96
|
+
{ encoding: 'utf8' },
|
|
97
|
+
);
|
|
98
|
+
if (r.status !== 0) throw new Error(`format-comment failed: ${r.stderr}`);
|
|
99
|
+
return r.stdout;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
it('emits the sentinel comment so the upsert logic can find it', () => {
|
|
103
|
+
const out = render(
|
|
104
|
+
{ overall: null, files: [] },
|
|
105
|
+
{ overall: { total: 0, tested: 0, ratio: 1 }, files: [], untested: [] },
|
|
106
|
+
);
|
|
107
|
+
assert.ok(out.startsWith('<!-- onlooker-coverage-comment -->'));
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('renders node coverage rows in the markdown table', () => {
|
|
111
|
+
const out = render(
|
|
112
|
+
{
|
|
113
|
+
overall: { file: 'all files', line: 75, branch: 55, funcs: 90, uncoveredLines: '' },
|
|
114
|
+
files: [{ file: 'foo.mjs', line: 75, branch: 50, funcs: 80, uncoveredLines: '12-14' }],
|
|
115
|
+
},
|
|
116
|
+
{ overall: { total: 1, tested: 1, ratio: 1 }, files: [], untested: [] },
|
|
117
|
+
);
|
|
118
|
+
assert.match(out, /\| `foo\.mjs` \| 75\.0% \| 50\.0% \| 80\.0% \|/);
|
|
119
|
+
// 75% lines → yellow (60–79 inclusive).
|
|
120
|
+
assert.match(out, /\*\*Overall:\*\* 🟡 75\.0% lines/);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('marks bash overall red when below 50%', () => {
|
|
124
|
+
const out = render(
|
|
125
|
+
{ overall: null, files: [] },
|
|
126
|
+
{ overall: { total: 10, tested: 3, ratio: 0.3 }, files: [], untested: [] },
|
|
127
|
+
);
|
|
128
|
+
assert.match(out, /🔴 3\/10 public functions/);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('lists untested functions inside a collapsed details block', () => {
|
|
132
|
+
const out = render(
|
|
133
|
+
{ overall: null, files: [] },
|
|
134
|
+
{
|
|
135
|
+
overall: { total: 2, tested: 1, ratio: 0.5 },
|
|
136
|
+
files: [{ file: 'a.sh', total: 2, tested: 1, ratio: 0.5, untested: ['bar'] }],
|
|
137
|
+
untested: [{ file: 'a.sh', name: 'bar' }],
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
assert.match(out, /<details><summary>Untested public functions<\/summary>/);
|
|
141
|
+
assert.match(out, /`a\.sh` — `bar`/);
|
|
142
|
+
});
|
|
143
|
+
});
|