@a16njs/plugin-a16n 0.2.0 → 0.4.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 +2 -18
- 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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -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
|
|
|
@@ -97,22 +97,6 @@ Use this ID with CLI commands:
|
|
|
97
97
|
- `--from a16n`: Read from `.a16n/` directory
|
|
98
98
|
- `--to a16n`: Write to `.a16n/` directory
|
|
99
99
|
|
|
100
|
-
## Development Status
|
|
101
|
-
|
|
102
|
-
**Current Version**: 0.1.0 (Phase 9 in progress)
|
|
103
|
-
|
|
104
|
-
- ✅ M1: IR Model Versioning & Extensions (complete)
|
|
105
|
-
- ✅ M2: Plugin Package Setup (complete)
|
|
106
|
-
- 🚧 M3: Frontmatter Parsing & Formatting (upcoming)
|
|
107
|
-
- 🚧 M4: IR Emission (upcoming)
|
|
108
|
-
- 🚧 M5: IR Discovery (upcoming)
|
|
109
|
-
- 🚧 M6: CLI Integration (upcoming)
|
|
110
|
-
- 🚧 M7: Integration Testing & Documentation (upcoming)
|
|
111
|
-
|
|
112
|
-
## License
|
|
113
|
-
|
|
114
|
-
AGPL-3.0
|
|
115
|
-
|
|
116
100
|
## Links
|
|
117
101
|
|
|
118
102
|
- [Homepage](https://texarkanine.github.io/a16n/plugin-a16n)
|
|
@@ -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;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAY;IACzC,MAAM,KAAK,GAAyB,EAAE,CAAC;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AC,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/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { parseIRFile, type ParseIRFileResult } from './parse.js';
|
|
|
14
14
|
export { formatIRFile } from './format.js';
|
|
15
15
|
export { extractRelativeDir, slugify, getNameWithoutExtension } from './utils.js';
|
|
16
16
|
export { emit } from './emit.js';
|
|
17
|
+
export { discover } from './discover.js';
|
|
17
18
|
/**
|
|
18
19
|
* The a16n IR plugin.
|
|
19
20
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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
CHANGED
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { CustomizationType } from '@a16njs/models';
|
|
13
13
|
import { emit as emitImpl } from './emit.js';
|
|
14
|
+
import { discover as discoverImpl } from './discover.js';
|
|
14
15
|
// Export utility functions and types
|
|
15
16
|
export { parseIRFile } from './parse.js';
|
|
16
17
|
export { formatIRFile } from './format.js';
|
|
17
18
|
export { extractRelativeDir, slugify, getNameWithoutExtension } from './utils.js';
|
|
18
19
|
export { emit } from './emit.js';
|
|
20
|
+
export { discover } from './discover.js';
|
|
19
21
|
/**
|
|
20
22
|
* The a16n IR plugin.
|
|
21
23
|
*
|
|
@@ -40,13 +42,7 @@ const plugin = {
|
|
|
40
42
|
* @param root - Project root directory
|
|
41
43
|
* @returns Discovery result with parsed IR items
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
// TODO: Implement in Milestone 5
|
|
45
|
-
return {
|
|
46
|
-
items: [],
|
|
47
|
-
warnings: [],
|
|
48
|
-
};
|
|
49
|
-
},
|
|
45
|
+
discover: discoverImpl,
|
|
50
46
|
/**
|
|
51
47
|
* Emit IR files to .a16n/ directory.
|
|
52
48
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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;
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a16njs/plugin-a16n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "a16n Intermediate Representation (IR) plugin for a16n",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "Texarkanine",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"gray-matter": "^4.0.3",
|
|
36
36
|
"yaml": "^2.8.2",
|
|
37
|
-
"@a16njs/models": "0.
|
|
37
|
+
"@a16njs/models": "0.8.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^20.0.0",
|