agency-rules 0.4.1 → 0.5.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/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/bin/agency-rules.mjs +17 -6
- package/package.json +1 -1
- package/scripts/list.mjs +48 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.5.0](https://github.com/deuriib/agency-rules/compare/v0.4.1...v0.5.0) (2026-10-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **cli:** add 'list' command to display available rules ([15a7302](https://github.com/deuriib/agency-rules/commit/15a73025cd8ae1f90ab4a8602ac68817306aa128))
|
|
14
|
+
|
|
8
15
|
## [0.4.1](https://github.com/deuriib/agency-rules/compare/v0.4.0...v0.4.1) (2026-10-31)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`agency-rules` compiles a single set of generic Markdown rules into the
|
|
6
6
|
native formats expected by **Google Antigravity**, **pi-agent**,
|
|
7
|
-
**oh-my-pi (omp)**, and **OpenCode** (via the
|
|
7
|
+
**oh-my-pi (omp)**, and **OpenCode** (via the [opencode-rules]("https://github.com/frap129/opencode-rules") plugin).
|
|
8
8
|
|
|
9
9
|
The whole pipeline — toolchain, environment, and tasks — is managed by
|
|
10
10
|
[mise](https://mise.jdx.dev), so every collaborator and CI runner uses the
|
|
@@ -21,7 +21,7 @@ Every coding agent has its own rule format:
|
|
|
21
21
|
| Google Antigravity | YAML frontmatter with `trigger` | `.agents/rules/*.md` |
|
|
22
22
|
| pi-agent | Per-rule directory with `RULES.md` | `.pi/rules/<slug>/RULES.md` |
|
|
23
23
|
| oh-my-pi (omp) | Markdown with frontmatter | `.omp/rules/*.{md,mdc}` |
|
|
24
|
-
| OpenCode | Markdown via
|
|
24
|
+
| OpenCode | Markdown via [opencode-rules]("https://github.com/frap129/opencode-rules") plugin | `.opencode/rules/*.md` |
|
|
25
25
|
|
|
26
26
|
Writing the same rule four times is a maintenance nightmare. `agency-rules`
|
|
27
27
|
lets you write it **once** in a neutral format and compile it to all four
|
package/bin/agency-rules.mjs
CHANGED
|
@@ -29,17 +29,18 @@ Write rules once. Run them in every harness.
|
|
|
29
29
|
$ agency-rules <command> [options]
|
|
30
30
|
|
|
31
31
|
\x1b[33mCommands:\x1b[0m
|
|
32
|
-
\x1b[
|
|
33
|
-
\x1b[
|
|
34
|
-
\x1b[
|
|
32
|
+
\x1b[32mlist\x1b[0m List all available rules
|
|
33
|
+
\x1b[32mconvert\x1b[0m Compile rules/ into each harness's native format
|
|
34
|
+
\x1b[32minstall\x1b[0m Install compiled artifacts into detected harnesses
|
|
35
|
+
\x1b[32mvalidate\x1b[0m Validate each rule's frontmatter against the schema
|
|
35
36
|
|
|
36
37
|
\x1b[33mGlobal Options:\x1b[0m
|
|
37
38
|
-h, --help Show this help message
|
|
38
39
|
-v, --version Show version number
|
|
39
40
|
|
|
40
41
|
\x1b[33mExamples:\x1b[0m
|
|
42
|
+
$ agency-rules list
|
|
41
43
|
$ agency-rules validate
|
|
42
|
-
$ agency-rules convert
|
|
43
44
|
$ agency-rules convert --dry-run
|
|
44
45
|
$ agency-rules install --scope user --harness opencode
|
|
45
46
|
`);
|
|
@@ -47,6 +48,17 @@ Write rules once. Run them in every harness.
|
|
|
47
48
|
|
|
48
49
|
const showCommandHelp = (cmd) => {
|
|
49
50
|
const helps = {
|
|
51
|
+
list: `
|
|
52
|
+
\x1b[36magency-rules list\x1b[0m
|
|
53
|
+
List all available rules and their descriptions.
|
|
54
|
+
|
|
55
|
+
\x1b[33mOptions:\x1b[0m
|
|
56
|
+
--json Output the list in JSON format (useful for scripting)
|
|
57
|
+
|
|
58
|
+
\x1b[33mExamples:\x1b[0m
|
|
59
|
+
$ agency-rules list
|
|
60
|
+
$ agency-rules list --json | jq '.'
|
|
61
|
+
`,
|
|
50
62
|
convert: `
|
|
51
63
|
\x1b[36magency-rules convert\x1b[0m
|
|
52
64
|
Compile rules/ into each harness's native format.
|
|
@@ -101,7 +113,7 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
|
|
|
101
113
|
process.exit(0);
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
if (!['convert', 'install', 'validate'].includes(command)) {
|
|
116
|
+
if (!['list', 'convert', 'install', 'validate'].includes(command)) {
|
|
105
117
|
console.error(`\x1b[31mError:\x1b[0m Unknown command '${command}'`);
|
|
106
118
|
showHelp();
|
|
107
119
|
process.exit(1);
|
|
@@ -114,7 +126,6 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
// ── Execute ───────────────────────────────────────────────────────────
|
|
117
|
-
// Remove the command from argv so the downstream script's parseArgs works cleanly
|
|
118
129
|
process.argv.splice(2, 1);
|
|
119
130
|
|
|
120
131
|
const scriptPath = resolve(import.meta.dirname, '..', 'scripts', `${command}.mjs`);
|
package/package.json
CHANGED
package/scripts/list.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { readRules } from './lib/frontmatter.mjs';
|
|
5
|
+
|
|
6
|
+
const { values: args } = parseArgs({
|
|
7
|
+
options: {
|
|
8
|
+
json: { type: 'boolean', default: false },
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// Resolve paths (local vs package fallback)
|
|
13
|
+
const PACKAGE_ROOT = resolve(import.meta.dirname, '..');
|
|
14
|
+
const localRules = resolve(process.cwd(), 'rules');
|
|
15
|
+
const RULES_DIR =
|
|
16
|
+
process.env.RULES_DIR || (existsSync(localRules) ? localRules : resolve(PACKAGE_ROOT, 'rules'));
|
|
17
|
+
|
|
18
|
+
const rules = await readRules(RULES_DIR);
|
|
19
|
+
|
|
20
|
+
if (rules.length === 0) {
|
|
21
|
+
console.error(`❌ No rules found in ${RULES_DIR}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ── JSON Output ───────────────────────────────────────────────────────
|
|
26
|
+
if (args.json) {
|
|
27
|
+
const output = rules.map((r) => ({
|
|
28
|
+
name: r.slug,
|
|
29
|
+
description: r.data.description || 'No description provided',
|
|
30
|
+
source: r.source,
|
|
31
|
+
}));
|
|
32
|
+
console.log(JSON.stringify(output, null, 2));
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ── Pretty Terminal Output ────────────────────────────────────────────
|
|
37
|
+
// Find the longest name to align the columns perfectly
|
|
38
|
+
const maxSlugLength = Math.max(...rules.map((r) => r.slug.length));
|
|
39
|
+
|
|
40
|
+
console.log(`\n📚 \x1b[1mAvailable Rules\x1b[0m (${rules.length})\n`);
|
|
41
|
+
|
|
42
|
+
for (const rule of rules) {
|
|
43
|
+
const paddedSlug = rule.slug.padEnd(maxSlugLength);
|
|
44
|
+
// Using Cyan for the rule name
|
|
45
|
+
console.log(` \x1b[36m${paddedSlug}\x1b[0m ${rule.data.description || 'No description'}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log('\n');
|