@a16njs/plugin-a16n 0.1.0 → 0.3.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/README.md +6 -6
- package/dist/discover.d.ts +35 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +259 -0
- package/dist/discover.js.map +1 -0
- package/dist/emit.d.ts +23 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/emit.js +180 -0
- package/dist/emit.js.map +1 -0
- package/dist/format.d.ts +14 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +45 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/parse.d.ts +19 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +122 -0
- package/dist/parse.js.map +1 -0
- package/dist/utils.d.ts +29 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +51 -0
- package/dist/utils.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @a16njs/plugin-a16n
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@a16njs/plugin-a16n)
|
|
4
|
+
[](https://codecov.io/gh/Texarkanine/a16n)
|
|
4
5
|
|
|
5
6
|
This plugin enables reading and writing the a16n intermediate representation to/from disk in a human-readable, git-friendly format with versioned schema support.
|
|
6
7
|
|
|
@@ -9,7 +10,6 @@ This plugin enables reading and writing the a16n intermediate representation to/
|
|
|
9
10
|
- **Versioned Schema**: Kubernetes-style versioning (e.g., `v1beta1`) for forward compatibility
|
|
10
11
|
- **Human-Readable**: Markdown files with YAML frontmatter
|
|
11
12
|
- **Git-Friendly**: Text-based format optimized for version control
|
|
12
|
-
- **Type-Safe**: Full TypeScript support with validated schemas
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
@@ -103,10 +103,10 @@ Use this ID with CLI commands:
|
|
|
103
103
|
|
|
104
104
|
- ✅ M1: IR Model Versioning & Extensions (complete)
|
|
105
105
|
- ✅ M2: Plugin Package Setup (complete)
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
106
|
+
- ✅ M3: Frontmatter Parsing & Formatting (complete)
|
|
107
|
+
- ✅ M4: IR Emission (complete)
|
|
108
|
+
- ✅ M5: IR Discovery (complete)
|
|
109
|
+
- ✅ M6: E2E Integration Testing (complete)
|
|
110
110
|
- 🚧 M7: Integration Testing & Documentation (upcoming)
|
|
111
111
|
|
|
112
112
|
## License
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IR Discovery - Read intermediate representation from .a16n/ directory
|
|
3
|
+
*
|
|
4
|
+
* This module implements the discover() function for the a16n plugin,
|
|
5
|
+
* which reads IR items from the .a16n/ directory structure on disk.
|
|
6
|
+
*
|
|
7
|
+
* This is the inverse of emit():
|
|
8
|
+
* - Scans type directories in .a16n/
|
|
9
|
+
* - Parses frontmatter files via parseIRFile()
|
|
10
|
+
* - Handles AgentSkillIO verbatim format via readAgentSkillIO()
|
|
11
|
+
* - Validates versions with areVersionsCompatible()
|
|
12
|
+
* - Produces warnings for issues (unknown dirs, bad frontmatter, version mismatch)
|
|
13
|
+
*
|
|
14
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
15
|
+
* - Type directories use kebab-case matching CustomizationType enum values
|
|
16
|
+
* - AgentSkillIO uses subdirectory-per-skill with verbatim AgentSkills.io format
|
|
17
|
+
* - Other types use YAML frontmatter parsed by parseIRFile()
|
|
18
|
+
*/
|
|
19
|
+
import { type DiscoveryResult } from '@a16njs/models';
|
|
20
|
+
/**
|
|
21
|
+
* Discover IR items from .a16n/ directory structure.
|
|
22
|
+
*
|
|
23
|
+
* Scans the .a16n/ directory in the given root, parsing each type subdirectory
|
|
24
|
+
* and returning all discovered IR items with any warnings.
|
|
25
|
+
*
|
|
26
|
+
* @param root - Project root directory containing .a16n/
|
|
27
|
+
* @returns DiscoveryResult with parsed IR items and warnings
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const result = await discover('/path/to/project');
|
|
31
|
+
* // result.items: AgentCustomization[]
|
|
32
|
+
* // result.warnings: Warning[]
|
|
33
|
+
*/
|
|
34
|
+
export declare function discover(root: string): Promise<DiscoveryResult>;
|
|
35
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAGL,KAAK,eAAe,EAQrB,MAAM,gBAAgB,CAAC;AAOxB;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAkErE"}
|
package/dist/discover.js
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IR Discovery - Read intermediate representation from .a16n/ directory
|
|
3
|
+
*
|
|
4
|
+
* This module implements the discover() function for the a16n plugin,
|
|
5
|
+
* which reads IR items from the .a16n/ directory structure on disk.
|
|
6
|
+
*
|
|
7
|
+
* This is the inverse of emit():
|
|
8
|
+
* - Scans type directories in .a16n/
|
|
9
|
+
* - Parses frontmatter files via parseIRFile()
|
|
10
|
+
* - Handles AgentSkillIO verbatim format via readAgentSkillIO()
|
|
11
|
+
* - Validates versions with areVersionsCompatible()
|
|
12
|
+
* - Produces warnings for issues (unknown dirs, bad frontmatter, version mismatch)
|
|
13
|
+
*
|
|
14
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
15
|
+
* - Type directories use kebab-case matching CustomizationType enum values
|
|
16
|
+
* - AgentSkillIO uses subdirectory-per-skill with verbatim AgentSkills.io format
|
|
17
|
+
* - Other types use YAML frontmatter parsed by parseIRFile()
|
|
18
|
+
*/
|
|
19
|
+
import * as fs from 'fs/promises';
|
|
20
|
+
import * as path from 'path';
|
|
21
|
+
import { CustomizationType, WarningCode, CURRENT_IR_VERSION, areVersionsCompatible, readAgentSkillIO, createId, } from '@a16njs/models';
|
|
22
|
+
import { parseIRFile } from './parse.js';
|
|
23
|
+
/** Set of valid CustomizationType enum values for directory name validation */
|
|
24
|
+
const VALID_TYPE_DIRS = new Set(Object.values(CustomizationType));
|
|
25
|
+
/**
|
|
26
|
+
* Discover IR items from .a16n/ directory structure.
|
|
27
|
+
*
|
|
28
|
+
* Scans the .a16n/ directory in the given root, parsing each type subdirectory
|
|
29
|
+
* and returning all discovered IR items with any warnings.
|
|
30
|
+
*
|
|
31
|
+
* @param root - Project root directory containing .a16n/
|
|
32
|
+
* @returns DiscoveryResult with parsed IR items and warnings
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const result = await discover('/path/to/project');
|
|
36
|
+
* // result.items: AgentCustomization[]
|
|
37
|
+
* // result.warnings: Warning[]
|
|
38
|
+
*/
|
|
39
|
+
export async function discover(root) {
|
|
40
|
+
const items = [];
|
|
41
|
+
const warnings = [];
|
|
42
|
+
const a16nDir = path.join(root, '.a16n');
|
|
43
|
+
// Check if .a16n/ directory exists
|
|
44
|
+
try {
|
|
45
|
+
const stat = await fs.stat(a16nDir);
|
|
46
|
+
if (!stat.isDirectory()) {
|
|
47
|
+
return { items, warnings };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// .a16n/ does not exist
|
|
52
|
+
return { items, warnings };
|
|
53
|
+
}
|
|
54
|
+
// Read top-level entries in .a16n/
|
|
55
|
+
let entries;
|
|
56
|
+
try {
|
|
57
|
+
entries = await fs.readdir(a16nDir, { withFileTypes: true });
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
61
|
+
warnings.push({
|
|
62
|
+
code: WarningCode.Skipped,
|
|
63
|
+
message: `Could not read .a16n/ directory: ${message}`,
|
|
64
|
+
sources: ['.a16n'],
|
|
65
|
+
});
|
|
66
|
+
return { items, warnings };
|
|
67
|
+
}
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
// Skip non-directory entries (files directly in .a16n/)
|
|
70
|
+
if (!entry.isDirectory()) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const dirName = entry.name;
|
|
74
|
+
// Validate against known CustomizationType values
|
|
75
|
+
if (!VALID_TYPE_DIRS.has(dirName)) {
|
|
76
|
+
warnings.push({
|
|
77
|
+
code: WarningCode.Skipped,
|
|
78
|
+
message: `Unknown type directory "${dirName}" in .a16n/ — skipping`,
|
|
79
|
+
sources: [`.a16n/${dirName}`],
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const type = dirName;
|
|
84
|
+
const typeDir = path.join(a16nDir, dirName);
|
|
85
|
+
if (type === CustomizationType.AgentSkillIO) {
|
|
86
|
+
// AgentSkillIO uses readAgentSkillIO() (verbatim AgentSkills.io format)
|
|
87
|
+
const result = await discoverAgentSkillIO(typeDir);
|
|
88
|
+
items.push(...result.items);
|
|
89
|
+
warnings.push(...result.warnings);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// All other types use parseIRFile() with YAML frontmatter
|
|
93
|
+
const result = await discoverStandardType(typeDir, type);
|
|
94
|
+
items.push(...result.items);
|
|
95
|
+
warnings.push(...result.warnings);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { items, warnings };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Discover standard IR files (all types except AgentSkillIO) from a type directory.
|
|
102
|
+
*
|
|
103
|
+
* Recursively scans the type directory for .md files, parses each via parseIRFile(),
|
|
104
|
+
* validates version compatibility, and collects warnings for issues.
|
|
105
|
+
*
|
|
106
|
+
* @param typeDir - Absolute path to the type directory (e.g., /project/.a16n/global-prompt/)
|
|
107
|
+
* @param type - The CustomizationType for items in this directory
|
|
108
|
+
* @returns Items and warnings discovered from this type directory
|
|
109
|
+
*/
|
|
110
|
+
async function discoverStandardType(typeDir, type) {
|
|
111
|
+
const items = [];
|
|
112
|
+
const warnings = [];
|
|
113
|
+
// Find all .md files recursively (pass warnings to surface readdir errors)
|
|
114
|
+
const mdFiles = await findMdFiles(typeDir, '', warnings);
|
|
115
|
+
for (const relativeMdPath of mdFiles) {
|
|
116
|
+
const filepath = path.join(typeDir, relativeMdPath);
|
|
117
|
+
const filename = path.basename(relativeMdPath);
|
|
118
|
+
// Compute the relativePath for parseIRFile (path relative to project root's .a16n/)
|
|
119
|
+
// e.g., ".a16n/global-prompt" or ".a16n/global-prompt/shared/company"
|
|
120
|
+
const dirOfFile = path.dirname(filepath);
|
|
121
|
+
const a16nRoot = path.dirname(typeDir); // The .a16n/ directory
|
|
122
|
+
const relativeToA16n = path.relative(a16nRoot, dirOfFile).split(path.sep).join('/');
|
|
123
|
+
const relativePath = `.a16n/${relativeToA16n}`;
|
|
124
|
+
// Parse the IR file
|
|
125
|
+
const result = await parseIRFile(filepath, filename, relativePath);
|
|
126
|
+
if (result.error) {
|
|
127
|
+
warnings.push({
|
|
128
|
+
code: WarningCode.Skipped,
|
|
129
|
+
message: `Skipped "${relativeMdPath}" in ${type}: ${result.error}`,
|
|
130
|
+
sources: [`.a16n/${type}/${relativeMdPath}`],
|
|
131
|
+
});
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!result.item) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const item = result.item;
|
|
138
|
+
// Validate version compatibility
|
|
139
|
+
if (!areVersionsCompatible(CURRENT_IR_VERSION, item.version)) {
|
|
140
|
+
warnings.push({
|
|
141
|
+
code: WarningCode.VersionMismatch,
|
|
142
|
+
message: `Version mismatch in ".a16n/${type}/${relativeMdPath}": file has ${item.version}, reader is ${CURRENT_IR_VERSION}`,
|
|
143
|
+
sources: [`.a16n/${type}/${relativeMdPath}`],
|
|
144
|
+
});
|
|
145
|
+
// Still include the item (per design decision: items with version mismatch are still processed)
|
|
146
|
+
}
|
|
147
|
+
items.push(item);
|
|
148
|
+
}
|
|
149
|
+
return { items, warnings };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Discover AgentSkillIO items from the agent-skill-io type directory.
|
|
153
|
+
*
|
|
154
|
+
* Lists subdirectories in .a16n/agent-skill-io/, reads each via readAgentSkillIO(),
|
|
155
|
+
* and constructs AgentSkillIO IR items.
|
|
156
|
+
*
|
|
157
|
+
* @param agentSkillIODir - Absolute path to .a16n/agent-skill-io/
|
|
158
|
+
* @returns Items and warnings discovered from AgentSkillIO directories
|
|
159
|
+
*/
|
|
160
|
+
async function discoverAgentSkillIO(agentSkillIODir) {
|
|
161
|
+
const items = [];
|
|
162
|
+
const warnings = [];
|
|
163
|
+
let entries;
|
|
164
|
+
try {
|
|
165
|
+
entries = await fs.readdir(agentSkillIODir, { withFileTypes: true });
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
169
|
+
warnings.push({
|
|
170
|
+
code: WarningCode.Skipped,
|
|
171
|
+
message: `Could not read AgentSkillIO directory: ${message}`,
|
|
172
|
+
sources: ['.a16n/agent-skill-io'],
|
|
173
|
+
});
|
|
174
|
+
return { items, warnings };
|
|
175
|
+
}
|
|
176
|
+
for (const entry of entries) {
|
|
177
|
+
// Only process directories (each is a skill)
|
|
178
|
+
if (!entry.isDirectory()) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const skillDirName = entry.name;
|
|
182
|
+
const skillDir = path.join(agentSkillIODir, skillDirName);
|
|
183
|
+
const sourcePath = `.a16n/agent-skill-io/${skillDirName}/SKILL.md`;
|
|
184
|
+
// Read skill using shared readAgentSkillIO utility
|
|
185
|
+
const result = await readAgentSkillIO(skillDir);
|
|
186
|
+
if (!result.success) {
|
|
187
|
+
warnings.push({
|
|
188
|
+
code: WarningCode.Skipped,
|
|
189
|
+
message: `Skipped AgentSkillIO "${skillDirName}": ${result.error}`,
|
|
190
|
+
sources: [`.a16n/agent-skill-io/${skillDirName}`],
|
|
191
|
+
});
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const { skill } = result;
|
|
195
|
+
// Construct AgentSkillIO IR item
|
|
196
|
+
const agentSkillIO = {
|
|
197
|
+
id: createId(CustomizationType.AgentSkillIO, sourcePath),
|
|
198
|
+
type: CustomizationType.AgentSkillIO,
|
|
199
|
+
version: CURRENT_IR_VERSION, // AgentSkills.io format has no version field
|
|
200
|
+
sourcePath,
|
|
201
|
+
content: skill.content,
|
|
202
|
+
name: skill.frontmatter.name,
|
|
203
|
+
description: skill.frontmatter.description,
|
|
204
|
+
disableModelInvocation: skill.frontmatter.disableModelInvocation,
|
|
205
|
+
resources: skill.frontmatter.resources,
|
|
206
|
+
files: skill.files,
|
|
207
|
+
metadata: {},
|
|
208
|
+
};
|
|
209
|
+
items.push(agentSkillIO);
|
|
210
|
+
}
|
|
211
|
+
return { items, warnings };
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Recursively find all .md files in a directory.
|
|
215
|
+
* Returns paths relative to the given base directory.
|
|
216
|
+
*
|
|
217
|
+
* @param dir - Directory to scan
|
|
218
|
+
* @param relativePath - Current relative path (for recursion)
|
|
219
|
+
* @param warnings - Optional warnings array to report readdir failures
|
|
220
|
+
* @returns Array of relative paths to .md files
|
|
221
|
+
*/
|
|
222
|
+
async function findMdFiles(dir, relativePath = '', warnings) {
|
|
223
|
+
const results = [];
|
|
224
|
+
const targetDir = path.join(dir, relativePath);
|
|
225
|
+
try {
|
|
226
|
+
const entries = await fs.readdir(targetDir, { withFileTypes: true });
|
|
227
|
+
for (const entry of entries) {
|
|
228
|
+
const entryRelativePath = relativePath
|
|
229
|
+
? `${relativePath}/${entry.name}`
|
|
230
|
+
: entry.name;
|
|
231
|
+
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
232
|
+
results.push(entryRelativePath);
|
|
233
|
+
}
|
|
234
|
+
else if (entry.isDirectory()) {
|
|
235
|
+
// Recurse into subdirectories
|
|
236
|
+
const subFiles = await findMdFiles(dir, entryRelativePath, warnings);
|
|
237
|
+
results.push(...subFiles);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
// Surface readdir failures as warnings when a warnings accumulator is provided
|
|
243
|
+
if (warnings) {
|
|
244
|
+
const dirLabel = relativePath || path.basename(dir);
|
|
245
|
+
const typeName = path.basename(dir);
|
|
246
|
+
const relativeSource = relativePath
|
|
247
|
+
? `.a16n/${typeName}/${relativePath}`
|
|
248
|
+
: `.a16n/${typeName}`;
|
|
249
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
250
|
+
warnings.push({
|
|
251
|
+
code: WarningCode.Skipped,
|
|
252
|
+
message: `Could not read directory "${dirLabel}": ${message}`,
|
|
253
|
+
sources: [relativeSource],
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return results;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=discover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAKL,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,+EAA+E;AAC/E,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAE1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Q,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,WAAW,CAAC,OAAO;gBACzB,OAAO,EAAE,6BAA6B,QAAQ,MAAM,OAAO,EAAE;gBAC7D,OAAO,EAAE,CAAC,cAAc,CAAC;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/emit.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IR Emission - Write intermediate representation to .a16n/ directory
|
|
3
|
+
*
|
|
4
|
+
* This module implements the emit() function for the a16n plugin,
|
|
5
|
+
* which writes IR items to disk in the .a16n/ directory structure.
|
|
6
|
+
*
|
|
7
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
8
|
+
* - Type directories use kebab-case matching CustomizationType enum values
|
|
9
|
+
* - Files have YAML frontmatter with version, type, and type-specific fields
|
|
10
|
+
* - AgentSkillIO uses verbatim AgentSkills.io format (NO IR frontmatter)
|
|
11
|
+
* - relativeDir field creates subdirectories to preserve structure
|
|
12
|
+
*/
|
|
13
|
+
import { type AgentCustomization, type EmitResult, type EmitOptions } from '@a16njs/models';
|
|
14
|
+
/**
|
|
15
|
+
* Emit IR items to .a16n/ directory structure.
|
|
16
|
+
*
|
|
17
|
+
* @param models - IR items to emit
|
|
18
|
+
* @param root - Project root directory
|
|
19
|
+
* @param options - Emission options (dryRun, etc.)
|
|
20
|
+
* @returns EmitResult with written files and warnings
|
|
21
|
+
*/
|
|
22
|
+
export declare function emit(models: AgentCustomization[], root: string, options?: EmitOptions): Promise<EmitResult>;
|
|
23
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../src/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EACf,KAAK,WAAW,EAQjB,MAAM,gBAAgB,CAAC;AAgBxB;;;;;;;GAOG;AACH,wBAAsB,IAAI,CACxB,MAAM,EAAE,kBAAkB,EAAE,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CA2CrB"}
|
package/dist/emit.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IR Emission - Write intermediate representation to .a16n/ directory
|
|
3
|
+
*
|
|
4
|
+
* This module implements the emit() function for the a16n plugin,
|
|
5
|
+
* which writes IR items to disk in the .a16n/ directory structure.
|
|
6
|
+
*
|
|
7
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
8
|
+
* - Type directories use kebab-case matching CustomizationType enum values
|
|
9
|
+
* - Files have YAML frontmatter with version, type, and type-specific fields
|
|
10
|
+
* - AgentSkillIO uses verbatim AgentSkills.io format (NO IR frontmatter)
|
|
11
|
+
* - relativeDir field creates subdirectories to preserve structure
|
|
12
|
+
*/
|
|
13
|
+
import * as fs from 'fs/promises';
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
import { WarningCode, isAgentSkillIO, isManualPrompt, writeAgentSkillIO, } from '@a16njs/models';
|
|
16
|
+
import { formatIRFile } from './format.js';
|
|
17
|
+
import { slugify } from './utils.js';
|
|
18
|
+
/**
|
|
19
|
+
* Check if a path exists on the filesystem.
|
|
20
|
+
*/
|
|
21
|
+
async function pathExists(p) {
|
|
22
|
+
try {
|
|
23
|
+
await fs.access(p);
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Emit IR items to .a16n/ directory structure.
|
|
32
|
+
*
|
|
33
|
+
* @param models - IR items to emit
|
|
34
|
+
* @param root - Project root directory
|
|
35
|
+
* @param options - Emission options (dryRun, etc.)
|
|
36
|
+
* @returns EmitResult with written files and warnings
|
|
37
|
+
*/
|
|
38
|
+
export async function emit(models, root, options) {
|
|
39
|
+
const written = [];
|
|
40
|
+
const warnings = [];
|
|
41
|
+
const unsupported = [];
|
|
42
|
+
const dryRun = options?.dryRun ?? false;
|
|
43
|
+
// Group items by CustomizationType
|
|
44
|
+
const byType = new Map();
|
|
45
|
+
for (const item of models) {
|
|
46
|
+
const items = byType.get(item.type) || [];
|
|
47
|
+
items.push(item);
|
|
48
|
+
byType.set(item.type, items);
|
|
49
|
+
}
|
|
50
|
+
// Process each type
|
|
51
|
+
for (const [type, items] of byType.entries()) {
|
|
52
|
+
// Base directory for this type (kebab-case matching enum value)
|
|
53
|
+
const baseDir = path.join(root, '.a16n', type);
|
|
54
|
+
for (const item of items) {
|
|
55
|
+
try {
|
|
56
|
+
if (isAgentSkillIO(item)) {
|
|
57
|
+
// AgentSkillIO: use writeAgentSkillIO() for verbatim format
|
|
58
|
+
await emitAgentSkillIO(item, baseDir, written, dryRun);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// All other types: use formatIRFile() for IR frontmatter
|
|
62
|
+
await emitStandardIR(item, baseDir, written, dryRun);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
warnings.push({
|
|
67
|
+
code: WarningCode.Skipped,
|
|
68
|
+
message: `Failed to emit ${item.type} "${item.id}": ${error instanceof Error ? error.message : String(error)}`,
|
|
69
|
+
sources: item.sourcePath ? [item.sourcePath] : [],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
written,
|
|
76
|
+
warnings,
|
|
77
|
+
unsupported,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Emit a standard IR item (all types except AgentSkillIO).
|
|
82
|
+
* Uses formatIRFile() to generate YAML frontmatter + content.
|
|
83
|
+
*/
|
|
84
|
+
async function emitStandardIR(item, baseDir, written, dryRun) {
|
|
85
|
+
// Determine target directory (handle relativeDir subdirectories)
|
|
86
|
+
// Validate that relativeDir doesn't escape baseDir via path traversal
|
|
87
|
+
const baseDirResolved = path.resolve(baseDir);
|
|
88
|
+
const targetDir = item.relativeDir
|
|
89
|
+
? path.resolve(baseDirResolved, item.relativeDir)
|
|
90
|
+
: baseDirResolved;
|
|
91
|
+
const rel = path.relative(baseDirResolved, targetDir);
|
|
92
|
+
if (rel.startsWith('..') || path.isAbsolute(rel)) {
|
|
93
|
+
throw new Error(`Invalid relativeDir "${item.relativeDir}" (escapes ${baseDir})`);
|
|
94
|
+
}
|
|
95
|
+
// Extract name from ID and slugify for filename
|
|
96
|
+
// For ManualPrompt with path separators, extract basename only
|
|
97
|
+
const rawName = extractNameFromId(item.id);
|
|
98
|
+
const name = isManualPrompt(item) ? path.basename(rawName) : rawName;
|
|
99
|
+
const filename = `${slugify(name)}.md`;
|
|
100
|
+
const filePath = path.join(targetDir, filename);
|
|
101
|
+
// Format content with IR frontmatter
|
|
102
|
+
const content = formatIRFile(item);
|
|
103
|
+
// Check if file already exists before writing
|
|
104
|
+
const existed = await pathExists(filePath);
|
|
105
|
+
// Write file (unless dry-run)
|
|
106
|
+
if (!dryRun) {
|
|
107
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
108
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
109
|
+
}
|
|
110
|
+
written.push({
|
|
111
|
+
path: filePath,
|
|
112
|
+
type: item.type,
|
|
113
|
+
itemCount: 1,
|
|
114
|
+
isNewFile: !existed,
|
|
115
|
+
sourceItems: [item],
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Emit an AgentSkillIO item using verbatim AgentSkills.io format.
|
|
120
|
+
* Uses writeAgentSkillIO() from @a16njs/models.
|
|
121
|
+
*
|
|
122
|
+
* NOTE: AgentSkillIO uses a flat directory-per-skill layout. The spec and all
|
|
123
|
+
* current tools (Cursor, Claude Code) only support flat skill directories, so
|
|
124
|
+
* relativeDir is not used here. If the spec or tools add nested skill support
|
|
125
|
+
* in the future, relativeDir handling (with path-traversal validation) would
|
|
126
|
+
* need to be added — see emitStandardIR for the pattern.
|
|
127
|
+
*/
|
|
128
|
+
async function emitAgentSkillIO(item, baseDir, written, dryRun) {
|
|
129
|
+
// Use item.name for directory name — extractNameFromId mangles full source
|
|
130
|
+
// paths (e.g., ".cursor/skills/my-skill/SKILL" → "cursor-skills-my-skill-skill")
|
|
131
|
+
const skillDirName = slugify(item.name);
|
|
132
|
+
const skillDir = path.join(baseDir, skillDirName);
|
|
133
|
+
// Prepare frontmatter (AgentSkills.io format)
|
|
134
|
+
// Use original human-readable name, not the slugified directory name
|
|
135
|
+
const frontmatter = {
|
|
136
|
+
name: item.name,
|
|
137
|
+
description: item.description,
|
|
138
|
+
};
|
|
139
|
+
// Check if skill directory already exists before writing
|
|
140
|
+
const existed = await pathExists(skillDir);
|
|
141
|
+
// Write AgentSkillIO using shared utility (verbatim format)
|
|
142
|
+
if (!dryRun) {
|
|
143
|
+
await fs.mkdir(baseDir, { recursive: true });
|
|
144
|
+
await writeAgentSkillIO(skillDir, frontmatter, item.content, item.files || {});
|
|
145
|
+
}
|
|
146
|
+
written.push({
|
|
147
|
+
path: skillDir,
|
|
148
|
+
type: item.type,
|
|
149
|
+
itemCount: 1,
|
|
150
|
+
isNewFile: !existed,
|
|
151
|
+
sourceItems: [item],
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Extract name from ID and strip file extension.
|
|
156
|
+
* ID format: <type>:<name> or <type>:hash:<hash>
|
|
157
|
+
*
|
|
158
|
+
* Example:
|
|
159
|
+
* - 'global-prompt:.cursor/rules/blogging.mdc' -> '.cursor/rules/blogging'
|
|
160
|
+
* - 'file-rule:typescript.mdc' -> 'typescript'
|
|
161
|
+
*
|
|
162
|
+
* @throws Error if ID is malformed (missing name after type prefix)
|
|
163
|
+
*/
|
|
164
|
+
function extractNameFromId(id) {
|
|
165
|
+
const parts = id.split(':');
|
|
166
|
+
let name = id;
|
|
167
|
+
if (parts.length >= 2) {
|
|
168
|
+
// Skip first part (type) and return rest
|
|
169
|
+
name = parts.slice(1).join(':');
|
|
170
|
+
}
|
|
171
|
+
// Strip file extension (e.g., .mdc, .md, .txt)
|
|
172
|
+
// This ensures slugified names don't include the original extension
|
|
173
|
+
const stripped = name.replace(/\.[^/.]+$/, '');
|
|
174
|
+
// Validate that we have a usable name (not empty after stripping)
|
|
175
|
+
if (!stripped) {
|
|
176
|
+
throw new Error(`Invalid ID "${id}": cannot extract a usable name after type prefix`);
|
|
177
|
+
}
|
|
178
|
+
return stripped;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=emit.js.map
|
package/dist/emit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../src/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAQL,WAAW,EACX,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,CAAS;IACjC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;GAOG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IR item as a markdown file with YAML frontmatter.
|
|
4
|
+
*
|
|
5
|
+
* Format: ---\n{yaml}---\n\n{content}\n
|
|
6
|
+
*
|
|
7
|
+
* Includes: version, type, relativeDir (if present), type-specific fields
|
|
8
|
+
* Excludes: sourcePath (omitted from IR format), metadata (not serialized), name (filename is the identifier)
|
|
9
|
+
*
|
|
10
|
+
* @param item - The IR item to format
|
|
11
|
+
* @returns Formatted markdown string with YAML frontmatter
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatIRFile(item: AgentCustomization): string;
|
|
14
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAYxB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAgC7D"}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as yaml from 'yaml';
|
|
2
|
+
import { isFileRule, isSimpleAgentSkill, isAgentIgnore, } from '@a16njs/models';
|
|
3
|
+
/**
|
|
4
|
+
* Format an IR item as a markdown file with YAML frontmatter.
|
|
5
|
+
*
|
|
6
|
+
* Format: ---\n{yaml}---\n\n{content}\n
|
|
7
|
+
*
|
|
8
|
+
* Includes: version, type, relativeDir (if present), type-specific fields
|
|
9
|
+
* Excludes: sourcePath (omitted from IR format), metadata (not serialized), name (filename is the identifier)
|
|
10
|
+
*
|
|
11
|
+
* @param item - The IR item to format
|
|
12
|
+
* @returns Formatted markdown string with YAML frontmatter
|
|
13
|
+
*/
|
|
14
|
+
export function formatIRFile(item) {
|
|
15
|
+
// Build frontmatter object based on type
|
|
16
|
+
const frontmatter = {
|
|
17
|
+
version: item.version,
|
|
18
|
+
type: item.type,
|
|
19
|
+
};
|
|
20
|
+
// Add relativeDir if present (check undefined, not truthy, to preserve empty strings)
|
|
21
|
+
if (item.relativeDir !== undefined) {
|
|
22
|
+
frontmatter.relativeDir = item.relativeDir;
|
|
23
|
+
}
|
|
24
|
+
// Add type-specific fields (DO NOT include name, sourcePath, or metadata)
|
|
25
|
+
if (isFileRule(item)) {
|
|
26
|
+
frontmatter.globs = item.globs;
|
|
27
|
+
}
|
|
28
|
+
else if (isSimpleAgentSkill(item)) {
|
|
29
|
+
frontmatter.description = item.description;
|
|
30
|
+
}
|
|
31
|
+
else if (isAgentIgnore(item)) {
|
|
32
|
+
frontmatter.patterns = item.patterns;
|
|
33
|
+
}
|
|
34
|
+
// ManualPrompt: DO NOT include promptName (derived from relativeDir + filename)
|
|
35
|
+
// GlobalPrompt: no extra fields
|
|
36
|
+
// Generate YAML frontmatter with clean, readable output
|
|
37
|
+
const yamlStr = yaml.stringify(frontmatter, {
|
|
38
|
+
lineWidth: 0, // Disable line wrapping
|
|
39
|
+
defaultStringType: 'PLAIN', // Use plain strings when possible
|
|
40
|
+
defaultKeyType: 'PLAIN', // Use plain keys (no quotes)
|
|
41
|
+
}).trim();
|
|
42
|
+
// Format as: ---\n{yaml}---\n\n{content}\n
|
|
43
|
+
return `---\n${yamlStr}\n---\n\n${item.content}\n`;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EASL,UAAU,EACV,kBAAkB,EAElB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,IAAwB;IACnD,yCAAyC;IACzC,MAAM,WAAW,GAA4B;QAC3C,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;IAEF,sFAAsF;IACtF,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACnC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IAC7C,CAAC;IAED,0EAA0E;IAC1E,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACjC,CAAC;SAAM,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IAC7C,CAAC;SAAM,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvC,CAAC;IACD,gFAAgF;IAChF,gCAAgC;IAEhC,wDAAwD;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;QAC1C,SAAS,EAAE,CAAC,EAAE,wBAAwB;QACtC,iBAAiB,EAAE,OAAO,EAAE,kCAAkC;QAC9D,cAAc,EAAE,OAAO,EAAE,6BAA6B;KACvD,CAAC,CAAC,IAAI,EAAE,CAAC;IAEV,2CAA2C;IAC3C,OAAO,QAAQ,OAAO,YAAY,IAAI,CAAC,OAAO,IAAI,CAAC;AACrD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @a16njs/plugin-a16n - a16n Intermediate Representation (IR) Plugin
|
|
3
|
+
*
|
|
4
|
+
* This plugin enables reading and writing the a16n intermediate representation
|
|
5
|
+
* to/from disk in a human-readable, git-friendly format with versioned schema support.
|
|
6
|
+
*
|
|
7
|
+
* Plugin ID: 'a16n'
|
|
8
|
+
* CLI usage: --from a16n, --to a16n
|
|
9
|
+
*
|
|
10
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
11
|
+
*/
|
|
12
|
+
import type { A16nPlugin } from '@a16njs/models';
|
|
13
|
+
export { parseIRFile, type ParseIRFileResult } from './parse.js';
|
|
14
|
+
export { formatIRFile } from './format.js';
|
|
15
|
+
export { extractRelativeDir, slugify, getNameWithoutExtension } from './utils.js';
|
|
16
|
+
export { emit } from './emit.js';
|
|
17
|
+
export { discover } from './discover.js';
|
|
18
|
+
/**
|
|
19
|
+
* The a16n IR plugin.
|
|
20
|
+
*
|
|
21
|
+
* Supports reading and writing the a16n intermediate representation format.
|
|
22
|
+
* Files are stored in `.a16n/` directory with YAML frontmatter containing
|
|
23
|
+
* version and type metadata.
|
|
24
|
+
*/
|
|
25
|
+
declare const plugin: A16nPlugin;
|
|
26
|
+
export default plugin;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAmC,MAAM,gBAAgB,CAAC;AAMlF,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;GAMG;AACH,QAAA,MAAM,MAAM,EAAE,UA6Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @a16njs/plugin-a16n - a16n Intermediate Representation (IR) Plugin
|
|
3
|
+
*
|
|
4
|
+
* This plugin enables reading and writing the a16n intermediate representation
|
|
5
|
+
* to/from disk in a human-readable, git-friendly format with versioned schema support.
|
|
6
|
+
*
|
|
7
|
+
* Plugin ID: 'a16n'
|
|
8
|
+
* CLI usage: --from a16n, --to a16n
|
|
9
|
+
*
|
|
10
|
+
* Directory structure: .a16n/<type>/<name>.md
|
|
11
|
+
*/
|
|
12
|
+
import { CustomizationType } from '@a16njs/models';
|
|
13
|
+
import { emit as emitImpl } from './emit.js';
|
|
14
|
+
import { discover as discoverImpl } from './discover.js';
|
|
15
|
+
// Export utility functions and types
|
|
16
|
+
export { parseIRFile } from './parse.js';
|
|
17
|
+
export { formatIRFile } from './format.js';
|
|
18
|
+
export { extractRelativeDir, slugify, getNameWithoutExtension } from './utils.js';
|
|
19
|
+
export { emit } from './emit.js';
|
|
20
|
+
export { discover } from './discover.js';
|
|
21
|
+
/**
|
|
22
|
+
* The a16n IR plugin.
|
|
23
|
+
*
|
|
24
|
+
* Supports reading and writing the a16n intermediate representation format.
|
|
25
|
+
* Files are stored in `.a16n/` directory with YAML frontmatter containing
|
|
26
|
+
* version and type metadata.
|
|
27
|
+
*/
|
|
28
|
+
const plugin = {
|
|
29
|
+
id: 'a16n',
|
|
30
|
+
name: 'a16n Intermediate Representation',
|
|
31
|
+
supports: [
|
|
32
|
+
CustomizationType.GlobalPrompt,
|
|
33
|
+
CustomizationType.FileRule,
|
|
34
|
+
CustomizationType.SimpleAgentSkill,
|
|
35
|
+
CustomizationType.AgentSkillIO,
|
|
36
|
+
CustomizationType.AgentIgnore,
|
|
37
|
+
CustomizationType.ManualPrompt,
|
|
38
|
+
],
|
|
39
|
+
/**
|
|
40
|
+
* Discover IR files from .a16n/ directory.
|
|
41
|
+
*
|
|
42
|
+
* @param root - Project root directory
|
|
43
|
+
* @returns Discovery result with parsed IR items
|
|
44
|
+
*/
|
|
45
|
+
discover: discoverImpl,
|
|
46
|
+
/**
|
|
47
|
+
* Emit IR files to .a16n/ directory.
|
|
48
|
+
*
|
|
49
|
+
* @param models - IR items to emit
|
|
50
|
+
* @param root - Project root directory
|
|
51
|
+
* @param options - Emission options
|
|
52
|
+
* @returns Emit result with written files
|
|
53
|
+
*/
|
|
54
|
+
emit: emitImpl,
|
|
55
|
+
};
|
|
56
|
+
export default plugin;
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAEzD,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAA0B,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,MAAM,GAAe;IACzB,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,kCAAkC;IACxC,QAAQ,EAAE;QACR,iBAAiB,CAAC,YAAY;QAC9B,iBAAiB,CAAC,QAAQ;QAC1B,iBAAiB,CAAC,gBAAgB;QAClC,iBAAiB,CAAC,YAAY;QAC9B,iBAAiB,CAAC,WAAW;QAC7B,iBAAiB,CAAC,YAAY;KAC/B;IAED;;;;;OAKG;IACH,QAAQ,EAAE,YAAY;IAEtB;;;;;;;OAOG;IACH,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/parse.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AgentCustomization } from '@a16njs/models';
|
|
2
|
+
/**
|
|
3
|
+
* Result of parsing an IR file.
|
|
4
|
+
* Either returns a parsed item or an error message.
|
|
5
|
+
*/
|
|
6
|
+
export interface ParseIRFileResult {
|
|
7
|
+
item?: AgentCustomization;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse an IR file from disk.
|
|
12
|
+
*
|
|
13
|
+
* @param filepath - Absolute path to the file
|
|
14
|
+
* @param filename - Filename (used to derive name)
|
|
15
|
+
* @param relativePath - Path relative to .a16n/ directory (e.g., ".a16n/global-prompt/coding-standards.md")
|
|
16
|
+
* @returns ParseIRFileResult with either item or error
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseIRFile(filepath: string, filename: string, relativePath: string): Promise<ParseIRFileResult>;
|
|
19
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,kBAAkB,EAUxB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAiBD;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA2H5B"}
|
package/dist/parse.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import matter from 'gray-matter';
|
|
3
|
+
import { CustomizationType, createId, parseIRVersion, } from '@a16njs/models';
|
|
4
|
+
/**
|
|
5
|
+
* Parse an IR file from disk.
|
|
6
|
+
*
|
|
7
|
+
* @param filepath - Absolute path to the file
|
|
8
|
+
* @param filename - Filename (used to derive name)
|
|
9
|
+
* @param relativePath - Path relative to .a16n/ directory (e.g., ".a16n/global-prompt/coding-standards.md")
|
|
10
|
+
* @returns ParseIRFileResult with either item or error
|
|
11
|
+
*/
|
|
12
|
+
export async function parseIRFile(filepath, filename, relativePath) {
|
|
13
|
+
try {
|
|
14
|
+
// Read file content
|
|
15
|
+
const content = await fs.readFile(filepath, 'utf-8');
|
|
16
|
+
// Parse YAML frontmatter
|
|
17
|
+
let parsed;
|
|
18
|
+
try {
|
|
19
|
+
parsed = matter(content);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
return { error: `Failed to parse YAML frontmatter: ${err.message}` };
|
|
23
|
+
}
|
|
24
|
+
const frontmatter = parsed.data;
|
|
25
|
+
const body = parsed.content;
|
|
26
|
+
// Validate required fields
|
|
27
|
+
if (!frontmatter.version) {
|
|
28
|
+
return { error: 'Missing required field: version' };
|
|
29
|
+
}
|
|
30
|
+
if (!frontmatter.type) {
|
|
31
|
+
return { error: 'Missing required field: type' };
|
|
32
|
+
}
|
|
33
|
+
// Validate version format
|
|
34
|
+
const versionParsed = parseIRVersion(frontmatter.version);
|
|
35
|
+
if (!versionParsed) {
|
|
36
|
+
return { error: `Invalid version format: ${frontmatter.version}` };
|
|
37
|
+
}
|
|
38
|
+
// Validate type
|
|
39
|
+
const type = frontmatter.type;
|
|
40
|
+
if (!Object.values(CustomizationType).includes(type)) {
|
|
41
|
+
return { error: `Invalid type: ${frontmatter.type}` };
|
|
42
|
+
}
|
|
43
|
+
// Extract name from filename (without extension)
|
|
44
|
+
const nameWithoutExt = filename.replace(/\.[^.]+$/, '');
|
|
45
|
+
// Build base IR item
|
|
46
|
+
// metadata is NOT serialized to IR files (transient only), so initialize as empty
|
|
47
|
+
const baseItem = {
|
|
48
|
+
id: createId(type, relativePath),
|
|
49
|
+
type,
|
|
50
|
+
version: frontmatter.version,
|
|
51
|
+
sourcePath: relativePath,
|
|
52
|
+
content: body,
|
|
53
|
+
relativeDir: frontmatter.relativeDir,
|
|
54
|
+
metadata: {},
|
|
55
|
+
};
|
|
56
|
+
// Handle type-specific fields
|
|
57
|
+
switch (type) {
|
|
58
|
+
case CustomizationType.GlobalPrompt: {
|
|
59
|
+
const item = {
|
|
60
|
+
...baseItem,
|
|
61
|
+
type: CustomizationType.GlobalPrompt,
|
|
62
|
+
};
|
|
63
|
+
return { item };
|
|
64
|
+
}
|
|
65
|
+
case CustomizationType.FileRule: {
|
|
66
|
+
if (!frontmatter.globs || !Array.isArray(frontmatter.globs)) {
|
|
67
|
+
return { error: 'FileRule requires globs array in frontmatter' };
|
|
68
|
+
}
|
|
69
|
+
const item = {
|
|
70
|
+
...baseItem,
|
|
71
|
+
type: CustomizationType.FileRule,
|
|
72
|
+
globs: frontmatter.globs,
|
|
73
|
+
};
|
|
74
|
+
return { item };
|
|
75
|
+
}
|
|
76
|
+
case CustomizationType.SimpleAgentSkill: {
|
|
77
|
+
if (!frontmatter.description || typeof frontmatter.description !== 'string') {
|
|
78
|
+
return { error: 'SimpleAgentSkill requires description string in frontmatter' };
|
|
79
|
+
}
|
|
80
|
+
const item = {
|
|
81
|
+
...baseItem,
|
|
82
|
+
type: CustomizationType.SimpleAgentSkill,
|
|
83
|
+
description: frontmatter.description,
|
|
84
|
+
};
|
|
85
|
+
return { item };
|
|
86
|
+
}
|
|
87
|
+
case CustomizationType.ManualPrompt: {
|
|
88
|
+
// Derive promptName from relativeDir + filename
|
|
89
|
+
const promptName = frontmatter.relativeDir
|
|
90
|
+
? `${frontmatter.relativeDir}/${nameWithoutExt}`
|
|
91
|
+
: nameWithoutExt;
|
|
92
|
+
const item = {
|
|
93
|
+
...baseItem,
|
|
94
|
+
type: CustomizationType.ManualPrompt,
|
|
95
|
+
promptName,
|
|
96
|
+
};
|
|
97
|
+
return { item };
|
|
98
|
+
}
|
|
99
|
+
case CustomizationType.AgentIgnore: {
|
|
100
|
+
if (!frontmatter.patterns || !Array.isArray(frontmatter.patterns)) {
|
|
101
|
+
return { error: 'AgentIgnore requires patterns array in frontmatter' };
|
|
102
|
+
}
|
|
103
|
+
const item = {
|
|
104
|
+
...baseItem,
|
|
105
|
+
type: CustomizationType.AgentIgnore,
|
|
106
|
+
patterns: frontmatter.patterns,
|
|
107
|
+
};
|
|
108
|
+
return { item };
|
|
109
|
+
}
|
|
110
|
+
case CustomizationType.AgentSkillIO:
|
|
111
|
+
// AgentSkillIO uses verbatim AgentSkills.io format (NO IR frontmatter)
|
|
112
|
+
// This should be handled by readAgentSkillIO from @a16njs/models
|
|
113
|
+
return { error: 'AgentSkillIO should be parsed using readAgentSkillIO()' };
|
|
114
|
+
default:
|
|
115
|
+
return { error: `Unsupported type: ${type}` };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
return { error: `Failed to read file: ${err.message}` };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAQL,iBAAiB,EACjB,QAAQ,EACR,cAAc,GACf,MAAM,gBAAgB,CAAC;AA0BxB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,QAAgB,EAChB,YAAoB;IAEpB,IAAI,CAAC;QACH,oBAAoB;QACpB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAErD,yBAAyB;QACzB,IAAI,MAAiC,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,EAAE,KAAK,EAAE,qCAAsC,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;Q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;oBACX,IAAI,EAAE,iBAAiB,CAAC,YAAY;oBACpC,UAAU;iBACX,CAAC;gBACF,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,CAAC;YAED,KAAK,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAClE,OAAO,EAAE,KAAK,EAAE,oDAAoD,EAAE,CAAC;gBACzE,CAAC;gBACD,MAAM,IAAI,GAAgB;oBACxB,GAAG,QAAQ;oBACX,IAAI,EAAE,iBAAiB,CAAC,WAAW;oBACnC,QAAQ,EAAE,WAAW,CAAC,QAAQ;iBAC/B,CAAC;gBACF,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,CAAC;YAED,KAAK,iBAAiB,CAAC,YAAY;gBACjC,uEAAuE;gBACvE,iEAAiE;gBACjE,OAAO,EAAE,KAAK,EAAE,wDAAwD,EAAE,CAAC;YAE7E;gBACE,OAAO,EAAE,KAAK,EAAE,qBAAqB,IAAI,EAAE,EAAE,CAAC;QAClD,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,wBAAyB,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;IACrE,CAAC;AACH,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract relative directory from a full path relative to base directory.
|
|
3
|
+
*
|
|
4
|
+
* Example:
|
|
5
|
+
* - extractRelativeDir('.a16n/global-prompt/coding-standards.md', '.a16n') -> undefined
|
|
6
|
+
* - extractRelativeDir('.a16n/global-prompt/shared/company/standards.md', '.a16n/global-prompt') -> 'shared/company'
|
|
7
|
+
*
|
|
8
|
+
* @param fullPath - Full path to the file
|
|
9
|
+
* @param baseDir - Base directory to extract relative path from
|
|
10
|
+
* @returns Relative directory or undefined if file is directly in baseDir
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractRelativeDir(fullPath: string, baseDir: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Slugify a name for use as a filename.
|
|
15
|
+
* Converts to lowercase, replaces spaces and special chars with hyphens.
|
|
16
|
+
*
|
|
17
|
+
* @param name - Name to slugify
|
|
18
|
+
* @returns Slugified name safe for filesystem
|
|
19
|
+
*/
|
|
20
|
+
export declare function slugify(name: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get filename without extension.
|
|
23
|
+
* Uses path.parse().name to properly handle dotfiles (e.g., ".env" -> ".env").
|
|
24
|
+
*
|
|
25
|
+
* @param filename - Filename with extension
|
|
26
|
+
* @returns Filename without extension
|
|
27
|
+
*/
|
|
28
|
+
export declare function getNameWithoutExtension(filename: string): string;
|
|
29
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiBxF;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Extract relative directory from a full path relative to base directory.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* - extractRelativeDir('.a16n/global-prompt/coding-standards.md', '.a16n') -> undefined
|
|
7
|
+
* - extractRelativeDir('.a16n/global-prompt/shared/company/standards.md', '.a16n/global-prompt') -> 'shared/company'
|
|
8
|
+
*
|
|
9
|
+
* @param fullPath - Full path to the file
|
|
10
|
+
* @param baseDir - Base directory to extract relative path from
|
|
11
|
+
* @returns Relative directory or undefined if file is directly in baseDir
|
|
12
|
+
*/
|
|
13
|
+
export function extractRelativeDir(fullPath, baseDir) {
|
|
14
|
+
const normalized = path.normalize(fullPath);
|
|
15
|
+
const normalizedBase = path.normalize(baseDir);
|
|
16
|
+
// Get the directory containing the file
|
|
17
|
+
const fileDir = path.dirname(normalized);
|
|
18
|
+
// Get relative path from base to file directory
|
|
19
|
+
const relative = path.relative(normalizedBase, fileDir);
|
|
20
|
+
// If relative path is empty or goes up directories (..), return undefined
|
|
21
|
+
if (!relative || relative === '.' || relative.startsWith('..')) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
// Normalize to POSIX-style forward slashes for cross-platform consistency
|
|
25
|
+
return relative.split(path.sep).join('/');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Slugify a name for use as a filename.
|
|
29
|
+
* Converts to lowercase, replaces spaces and special chars with hyphens.
|
|
30
|
+
*
|
|
31
|
+
* @param name - Name to slugify
|
|
32
|
+
* @returns Slugified name safe for filesystem
|
|
33
|
+
*/
|
|
34
|
+
export function slugify(name) {
|
|
35
|
+
return name
|
|
36
|
+
.toLowerCase()
|
|
37
|
+
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphens
|
|
38
|
+
.replace(/^-+|-+$/g, '') // Trim leading/trailing hyphens
|
|
39
|
+
|| 'unnamed'; // Fallback if empty
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get filename without extension.
|
|
43
|
+
* Uses path.parse().name to properly handle dotfiles (e.g., ".env" -> ".env").
|
|
44
|
+
*
|
|
45
|
+
* @param filename - Filename with extension
|
|
46
|
+
* @returns Filename without extension
|
|
47
|
+
*/
|
|
48
|
+
export function getNameWithoutExtension(filename) {
|
|
49
|
+
return path.parse(filename).name;
|
|
50
|
+
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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a16njs/plugin-a16n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "a16n Intermediate Representation (IR) plugin for a16n",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "Texarkanine",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"gray-matter": "^4.0.3",
|
|
36
|
-
"
|
|
36
|
+
"yaml": "^2.8.2",
|
|
37
|
+
"@a16njs/models": "0.7.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/node": "^20.0.0",
|