@airframeui/build 0.2.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/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +150 -0
- package/dist/cli.js.map +1 -0
- package/dist/doctor.d.ts +19 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +129 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/init-agents.d.ts +84 -0
- package/dist/init-agents.d.ts.map +1 -0
- package/dist/init-agents.js +302 -0
- package/dist/init-agents.js.map +1 -0
- package/dist/load-config.d.ts +23 -0
- package/dist/load-config.d.ts.map +1 -0
- package/dist/load-config.js +31 -0
- package/dist/load-config.js.map +1 -0
- package/dist/postcss-plugin.d.ts +47 -0
- package/dist/postcss-plugin.d.ts.map +1 -0
- package/dist/postcss-plugin.js +274 -0
- package/dist/postcss-plugin.js.map +1 -0
- package/dist/postcss.d.ts +7 -0
- package/dist/postcss.d.ts.map +1 -0
- package/dist/postcss.js +7 -0
- package/dist/postcss.js.map +1 -0
- package/dist/run-build.d.ts +24 -0
- package/dist/run-build.d.ts.map +1 -0
- package/dist/run-build.js +87 -0
- package/dist/run-build.js.map +1 -0
- package/dist/theme-cli.d.ts +17 -0
- package/dist/theme-cli.d.ts.map +1 -0
- package/dist/theme-cli.js +198 -0
- package/dist/theme-cli.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Airframeui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @airframeui/build
|
|
2
|
+
|
|
3
|
+
Optional Node toolchain for Airframe. **Most apps do not need this package.**
|
|
4
|
+
|
|
5
|
+
Install `@airframeui/core` and import the CSS. Default breakpoints, typography, and `@sm` / `@md` utilities already ship in that stylesheet. Override `--af-*` in CSS at runtime — [Theming](https://airframeui.com/docs/theming).
|
|
6
|
+
|
|
7
|
+
Use `@airframeui/build` when you need a **build step**:
|
|
8
|
+
|
|
9
|
+
- Custom breakpoint **pixels** (media queries cannot read `var(--af-bp-*)`)
|
|
10
|
+
- `@af bp()` / `@af-apply` in your CSS
|
|
11
|
+
- `af theme` to map a foreign token file into `--af-*`
|
|
12
|
+
- `af init --agents` to drop agent bootstrap docs (names from `@airframeui/core/catalog`)
|
|
13
|
+
|
|
14
|
+
See [Build Tool](https://airframeui.com/docs/advanced/build). Working app in the repo: [`examples/build`](../../examples/build).
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -D @airframeui/build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires Node 24+. Same version as `@airframeui/core`. Do not install `postcss-import` — it is already a dependency.
|
|
23
|
+
|
|
24
|
+
## What depends on what
|
|
25
|
+
|
|
26
|
+
| Package | Role |
|
|
27
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `@airframeui/tokens` | Token CSS/JSON. Source for default `--af-bp-*` values. |
|
|
29
|
+
| `@airframeui/core` | Runtime CSS. Ships default `responsive.css`. Exports `buildResponsiveCss` (the **only** responsive-utility generator). |
|
|
30
|
+
| `@airframeui/theme` | Library: map/lint/export tokens. `declsFromConfig` / `emitConfigTokenCss` is the **only** config → `--af-*` mapping. |
|
|
31
|
+
| `@airframeui/build` | Consumer CLI + PostCSS plugin. Calls those two functions. Does not invent a second `responsive.css` or token mapping. |
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
@import "@airframeui/core/core.css"
|
|
35
|
+
│
|
|
36
|
+
└── PostCSS plugin (in memory)
|
|
37
|
+
├── emitConfigTokenCss → patch inlined --af-bp-*
|
|
38
|
+
└── buildResponsiveCss → replace inlined @layer af.responsive
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`af theme` is a CLI facade over `@airframeui/theme`. The library API stays in theme; you can call it without this package.
|
|
42
|
+
|
|
43
|
+
## PostCSS
|
|
44
|
+
|
|
45
|
+
Install `@airframeui/build` only. It depends on `postcss-import` — do not install that package or list it in PostCSS config.
|
|
46
|
+
|
|
47
|
+
Vite, Next.js, Angular, and Webpack pick up `postcss.config.js` automatically. One plugin:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
module.exports = {
|
|
51
|
+
plugins: {
|
|
52
|
+
'@airframeui/build/postcss': {},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The plugin inlines `@import`, compiles `@af` directives, and replaces core’s default `@md` media queries. Keep a single `@import "@airframeui/core/core.css"` — do not add generated CSS on top of `core.css`.
|
|
58
|
+
|
|
59
|
+
`import: false` skips inlining if you already run `postcss-import` yourself. Pass `import: { resolve }` only when you need a custom resolver.
|
|
60
|
+
|
|
61
|
+
The plugin loads `airframe.config.js` from the project root. Pass options inline to override.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
module.exports = {
|
|
65
|
+
breakpoints: {
|
|
66
|
+
md: '900px',
|
|
67
|
+
},
|
|
68
|
+
useDefaultBreakpoints: true, // default; keep xs/sm/lg/… and override md
|
|
69
|
+
// outputDir: '.airframeui', // optional; omit to keep @import core.css only
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
App CSS stays one import:
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
@import '@airframeui/core/core.css';
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `@af bp()`
|
|
80
|
+
|
|
81
|
+
Wraps a local class in a min-width query (HTML still uses `af-grid-2@md`):
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
@af bp(md) {
|
|
85
|
+
.hero {
|
|
86
|
+
padding: var(--af-space-8);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Compiles to `@media (min-width: 900px) { … }` when `md` is `900px` in config.
|
|
92
|
+
|
|
93
|
+
### `@af-apply`
|
|
94
|
+
|
|
95
|
+
Inlines an `af-*` utility into a local class. Import core first so the class is in the tree:
|
|
96
|
+
|
|
97
|
+
```css
|
|
98
|
+
.scroll-demo {
|
|
99
|
+
@af-apply af-scrollbar;
|
|
100
|
+
max-height: 8rem;
|
|
101
|
+
overflow-y: auto;
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Also valid: `@af apply(af-scrollbar)`. Prefer layout recipes in HTML; this is for a local class you cannot put `af-*` on.
|
|
106
|
+
|
|
107
|
+
## CLI
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx af doctor # versions + agent file vs installed core
|
|
111
|
+
npx af init # airframe.config.js
|
|
112
|
+
npx af build # no-op unless outputDir or --input
|
|
113
|
+
npx af build --input src/app.css --output dist/app.css
|
|
114
|
+
npx af theme generate --from ./tokens.json -o theme.css
|
|
115
|
+
npx af theme lint theme.css
|
|
116
|
+
npx af theme export -o .airframeui
|
|
117
|
+
npx af init --agents # AGENTS.md from @airframeui/core/catalog + package.json "af" script
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG;AAOH,eAAO,MAAM,QAAQ,QAqCR,CAAC;AAUd,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwF5D"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI for @airframeui/build
|
|
4
|
+
* Usage: af <build|doctor|init|theme> [options]
|
|
5
|
+
*/
|
|
6
|
+
import { parseInitArgs, runInitAgents } from './init-agents.js';
|
|
7
|
+
import { runDoctor } from './doctor.js';
|
|
8
|
+
import { runBuild, writeDefaultConfig } from './run-build.js';
|
|
9
|
+
import { runThemeCommand } from './theme-cli.js';
|
|
10
|
+
export const CLI_HELP = `
|
|
11
|
+
@airframeui/build CLI
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
af build [options]
|
|
15
|
+
af doctor
|
|
16
|
+
af init
|
|
17
|
+
af init --agents [--agent agents|cursor|claude|codex] [--force]
|
|
18
|
+
af theme <generate|lint|validate|export> [options]
|
|
19
|
+
|
|
20
|
+
Commands:
|
|
21
|
+
build Transform @af directives (--input); write generated CSS only if outputDir is set
|
|
22
|
+
doctor Check Airframe package versions and agent bootstrap freshness
|
|
23
|
+
init Create airframe.config.js, or agent docs with --agents
|
|
24
|
+
theme Generate / lint / validate / export Airframe theme tokens
|
|
25
|
+
|
|
26
|
+
Build options:
|
|
27
|
+
--config <path> Config file path (default: airframe.config.js)
|
|
28
|
+
--input <path> Input CSS to transform (@af directives)
|
|
29
|
+
--output <path> Output CSS file (default: overwrite --input)
|
|
30
|
+
|
|
31
|
+
Init --agents options:
|
|
32
|
+
--agents Write AI agent bootstrap docs (AGENTS.md by default)
|
|
33
|
+
--agent <name> agents | cursor | claude | codex
|
|
34
|
+
--agent-docs-path <path> Custom output path
|
|
35
|
+
--force Overwrite existing docs
|
|
36
|
+
--no-script Do not add package.json "af" script alias
|
|
37
|
+
|
|
38
|
+
Examples:
|
|
39
|
+
af doctor
|
|
40
|
+
af build
|
|
41
|
+
af build --input src/app.css --output dist/app.css
|
|
42
|
+
af init
|
|
43
|
+
af init --agents
|
|
44
|
+
af theme generate --from ./tokens.json -o theme.css
|
|
45
|
+
af theme lint theme.css
|
|
46
|
+
af theme export -o .airframeui
|
|
47
|
+
`.trimStart();
|
|
48
|
+
function takeFlag(args, name) {
|
|
49
|
+
const eq = args.find((a) => a.startsWith(`${name}=`));
|
|
50
|
+
if (eq)
|
|
51
|
+
return eq.slice(name.length + 1);
|
|
52
|
+
const idx = args.indexOf(name);
|
|
53
|
+
if (idx >= 0 && idx + 1 < args.length)
|
|
54
|
+
return args[idx + 1];
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
export async function runCli(argv) {
|
|
58
|
+
const command = argv[0];
|
|
59
|
+
if (command === 'build') {
|
|
60
|
+
const rest = argv.slice(1);
|
|
61
|
+
try {
|
|
62
|
+
const config = takeFlag(rest, '--config');
|
|
63
|
+
const input = takeFlag(rest, '--input');
|
|
64
|
+
const output = takeFlag(rest, '--output');
|
|
65
|
+
const result = await runBuild({
|
|
66
|
+
...(config ? { config } : {}),
|
|
67
|
+
...(input ? { input } : {}),
|
|
68
|
+
...(output ? { output } : {}),
|
|
69
|
+
});
|
|
70
|
+
for (const message of result.messages) {
|
|
71
|
+
if (result.exitCode === 0)
|
|
72
|
+
console.log(`✓ ${message}`);
|
|
73
|
+
else
|
|
74
|
+
console.error(`Error: ${message}`);
|
|
75
|
+
}
|
|
76
|
+
for (const warning of result.warnings) {
|
|
77
|
+
console.warn(`⚠ ${warning}`);
|
|
78
|
+
}
|
|
79
|
+
if (result.exitCode !== 0 && result.messages.some((m) => m.startsWith('Input file'))) {
|
|
80
|
+
console.log('\nTip: omit --input. Prefer the PostCSS plugin with @import "@airframeui/core/core.css", or set outputDir to write generated CSS.');
|
|
81
|
+
}
|
|
82
|
+
return result.exitCode;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error('Error:', error instanceof Error ? error.message : error);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (command === 'doctor' || command === 'check') {
|
|
90
|
+
const result = runDoctor();
|
|
91
|
+
for (const item of result.checks) {
|
|
92
|
+
const mark = item.level === 'ok' ? '✓' : item.level === 'warn' ? '⚠' : '✗';
|
|
93
|
+
const stream = item.level === 'error' ? console.error : console.log;
|
|
94
|
+
stream(`${mark} ${item.message}`);
|
|
95
|
+
}
|
|
96
|
+
if (result.exitCode !== 0) {
|
|
97
|
+
console.log('\nTip: npx af init --agents refreshes the agent file from the installed catalog.');
|
|
98
|
+
}
|
|
99
|
+
return result.exitCode;
|
|
100
|
+
}
|
|
101
|
+
if (command === 'init') {
|
|
102
|
+
const parsed = parseInitArgs(argv.slice(1));
|
|
103
|
+
if (parsed.agents) {
|
|
104
|
+
try {
|
|
105
|
+
const result = runInitAgents({
|
|
106
|
+
agent: parsed.agent,
|
|
107
|
+
...(parsed.agentDocsPath ? { agentDocsPath: parsed.agentDocsPath } : {}),
|
|
108
|
+
force: parsed.force,
|
|
109
|
+
noScript: parsed.noScript,
|
|
110
|
+
});
|
|
111
|
+
for (const message of result.messages) {
|
|
112
|
+
console.log(`✓ ${message}`);
|
|
113
|
+
}
|
|
114
|
+
return result.exitCode;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error('Error:', error instanceof Error ? error.message : error);
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const written = writeDefaultConfig();
|
|
122
|
+
if (written.created) {
|
|
123
|
+
console.log(`✓ Created: ${written.path}`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(`Config file already exists: ${written.path}`);
|
|
127
|
+
}
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
if (command === 'theme') {
|
|
131
|
+
try {
|
|
132
|
+
const result = await runThemeCommand(argv.slice(1));
|
|
133
|
+
return result.exitCode;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error('Error:', error instanceof Error ? error.message : error);
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
console.log(CLI_HELP);
|
|
141
|
+
return command ? 1 : 0;
|
|
142
|
+
}
|
|
143
|
+
const argv1 = process.argv[1] ?? '';
|
|
144
|
+
const invokedDirectly = argv1.endsWith('cli.js') || argv1.endsWith('cli.ts');
|
|
145
|
+
if (invokedDirectly) {
|
|
146
|
+
runCli(process.argv.slice(2)).then((code) => {
|
|
147
|
+
process.exit(code);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAA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,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,MAAM,eAAe,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE7E,IAAI,eAAe,EAAE,CAAC;IACpB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `af doctor` — check installed Airframe versions and agent bootstrap freshness.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ALIGNED_PACKAGES: readonly ["@airframeui/core", "@airframeui/tokens", "@airframeui/theme", "@airframeui/mcp", "@airframeui/build"];
|
|
5
|
+
export type DoctorLevel = 'ok' | 'warn' | 'error';
|
|
6
|
+
export type DoctorCheck = {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
level: DoctorLevel;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type DoctorResult = {
|
|
12
|
+
exitCode: number;
|
|
13
|
+
checks: DoctorCheck[];
|
|
14
|
+
};
|
|
15
|
+
export declare function resolvePackageVersion(cwd: string, name: string): string | null;
|
|
16
|
+
export declare function runDoctor(options?: {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
}): DoctorResult;
|
|
19
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,eAAO,MAAM,gBAAgB,kHAMnB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2B9E;AAMD,wBAAgB,SAAS,CAAC,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CAgItE"}
|
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `af doctor` — check installed Airframe versions and agent bootstrap freshness.
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { AGENT_DOC_CANDIDATES, AGENT_MARKER_START, parsePinnedCoreVersion, } from './init-agents.js';
|
|
8
|
+
export const ALIGNED_PACKAGES = [
|
|
9
|
+
'@airframeui/core',
|
|
10
|
+
'@airframeui/tokens',
|
|
11
|
+
'@airframeui/theme',
|
|
12
|
+
'@airframeui/mcp',
|
|
13
|
+
'@airframeui/build',
|
|
14
|
+
];
|
|
15
|
+
export function resolvePackageVersion(cwd, name) {
|
|
16
|
+
try {
|
|
17
|
+
const require = createRequire(path.join(cwd, 'package.json'));
|
|
18
|
+
const pkgPath = require.resolve(`${name}/package.json`);
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
20
|
+
return pkg.version ?? null;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
const pkgPath = path.join(cwd, 'node_modules', ...name.split('/'), 'package.json');
|
|
24
|
+
if (fs.existsSync(pkgPath)) {
|
|
25
|
+
try {
|
|
26
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
27
|
+
return pkg.version ?? null;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (name === '@airframeui/build') {
|
|
34
|
+
try {
|
|
35
|
+
const pkgPath = createRequire(import.meta.url).resolve('../package.json');
|
|
36
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
37
|
+
return pkg.version ?? null;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function check(level, ok, message) {
|
|
47
|
+
return { ok, level, message };
|
|
48
|
+
}
|
|
49
|
+
export function runDoctor(options = {}) {
|
|
50
|
+
const cwd = options.cwd ?? process.cwd();
|
|
51
|
+
const checks = [];
|
|
52
|
+
const versions = {};
|
|
53
|
+
for (const name of ALIGNED_PACKAGES) {
|
|
54
|
+
versions[name] = resolvePackageVersion(cwd, name);
|
|
55
|
+
}
|
|
56
|
+
const core = versions['@airframeui/core'];
|
|
57
|
+
if (!core) {
|
|
58
|
+
checks.push(check('error', false, '@airframeui/core is not installed. Install it in the app, then re-run af doctor.'));
|
|
59
|
+
return { exitCode: 1, checks };
|
|
60
|
+
}
|
|
61
|
+
checks.push(check('ok', true, `@airframeui/core@${core}`));
|
|
62
|
+
for (const name of ALIGNED_PACKAGES) {
|
|
63
|
+
if (name === '@airframeui/core')
|
|
64
|
+
continue;
|
|
65
|
+
const version = versions[name];
|
|
66
|
+
if (!version) {
|
|
67
|
+
if (name === '@airframeui/mcp') {
|
|
68
|
+
checks.push(check('warn', true, `${name} is not installed (optional). Keep it on ${core} if you add it, or pin npx @airframeui/mcp@${core}.`));
|
|
69
|
+
}
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (version === core) {
|
|
73
|
+
checks.push(check('ok', true, `${name}@${version} matches core`));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
checks.push(check('error', false, `${name}@${version} does not match @airframeui/core@${core}. Public packages share one version.`));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const agentFiles = AGENT_DOC_CANDIDATES.map((rel) => path.join(cwd, rel)).filter((file) => fs.existsSync(file));
|
|
80
|
+
if (agentFiles.length === 0) {
|
|
81
|
+
checks.push(check('warn', true, 'No agent bootstrap file found. Optional: npx af init --agents'));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
for (const file of agentFiles) {
|
|
85
|
+
const rel = path.relative(cwd, file) || file;
|
|
86
|
+
const text = fs.readFileSync(file, 'utf8');
|
|
87
|
+
if (!text.includes(AGENT_MARKER_START)) {
|
|
88
|
+
checks.push(check('warn', true, `${rel} exists but has no Airframe marker. Re-run npx af init --agents --force to replace it.`));
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const pinned = parsePinnedCoreVersion(text);
|
|
92
|
+
if (!pinned) {
|
|
93
|
+
checks.push(check('warn', true, `${rel} has an Airframe block but no pinned @airframeui/core version.`));
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (pinned === core) {
|
|
97
|
+
checks.push(check('ok', true, `${rel} is pinned to @airframeui/core@${pinned}`));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
checks.push(check('error', false, `${rel} is pinned to @airframeui/core@${pinned}, installed is ${core}. Re-run npx af init --agents to refresh the catalog snapshot.`));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const pkgPath = path.join(cwd, 'package.json');
|
|
105
|
+
if (fs.existsSync(pkgPath) && agentFiles.some((file) => {
|
|
106
|
+
try {
|
|
107
|
+
return fs.readFileSync(file, 'utf8').includes(AGENT_MARKER_START);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
})) {
|
|
113
|
+
try {
|
|
114
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
115
|
+
if (pkg.scripts?.['af']) {
|
|
116
|
+
checks.push(check('ok', true, 'package.json script "af" is set'));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
checks.push(check('warn', true, 'package.json has no "af" script. Re-run npx af init --agents (omit --no-script).'));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// ignore invalid package.json
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const exitCode = checks.some((item) => item.level === 'error') ? 1 : 0;
|
|
127
|
+
return { exitCode, checks };
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;CACX,CAAC;AAeX,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,IAAY;IAC7D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC;QACxD,MAAM,GAAG,GAAG,IA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AE,CAAC,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAA6B,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type AgentTarget = 'agents' | 'cursor' | 'claude' | 'codex';
|
|
2
|
+
/** `@airframeui/core/catalog` — same file MCP, ESLint, and IntelliSense read. */
|
|
3
|
+
export type CoreCatalog = {
|
|
4
|
+
meta?: {
|
|
5
|
+
version?: string;
|
|
6
|
+
patternCount?: number;
|
|
7
|
+
};
|
|
8
|
+
components?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
baseClass: string;
|
|
11
|
+
category?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
note?: string;
|
|
14
|
+
parts?: string[];
|
|
15
|
+
}>;
|
|
16
|
+
layoutRecipes?: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
baseClass: string;
|
|
19
|
+
}>;
|
|
20
|
+
classNaming?: {
|
|
21
|
+
prefix?: string;
|
|
22
|
+
modifierPrefix?: string;
|
|
23
|
+
partSeparator?: string;
|
|
24
|
+
responsiveSuffix?: string;
|
|
25
|
+
rules?: string[];
|
|
26
|
+
};
|
|
27
|
+
responsive?: {
|
|
28
|
+
suffix?: string;
|
|
29
|
+
example?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Prefer the project's `@airframeui/core/catalog`, then this package's core
|
|
35
|
+
* (same resolve order as the ESLint plugin).
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadCoreCatalog(cwd?: string): CoreCatalog | null;
|
|
38
|
+
export interface InitAgentsOptions {
|
|
39
|
+
cwd?: string;
|
|
40
|
+
/** Which agent file convention to target. Default: agents (AGENTS.md). */
|
|
41
|
+
agent?: AgentTarget;
|
|
42
|
+
/** Override output path (relative to cwd or absolute). */
|
|
43
|
+
agentDocsPath?: string;
|
|
44
|
+
/** Overwrite existing agent docs. */
|
|
45
|
+
force?: boolean;
|
|
46
|
+
/** Skip adding the `af` npm script alias. */
|
|
47
|
+
noScript?: boolean;
|
|
48
|
+
/** Injected for tests — skip reading package.json for version. */
|
|
49
|
+
coreVersion?: string;
|
|
50
|
+
/** Injected for tests — skip loading `@airframeui/core/catalog`. */
|
|
51
|
+
catalog?: CoreCatalog | null;
|
|
52
|
+
}
|
|
53
|
+
export interface InitAgentsResult {
|
|
54
|
+
exitCode: number;
|
|
55
|
+
docsPath: string;
|
|
56
|
+
wroteDocs: boolean;
|
|
57
|
+
scriptUpdated: boolean;
|
|
58
|
+
messages: string[];
|
|
59
|
+
}
|
|
60
|
+
export declare const AGENT_MARKER_START = "<!-- airframe-agents:start -->";
|
|
61
|
+
export declare const AGENT_MARKER_END = "<!-- airframe-agents:end -->";
|
|
62
|
+
export declare const AGENT_DOC_CANDIDATES: string[];
|
|
63
|
+
export declare function parsePinnedCoreVersion(text: string): string | null;
|
|
64
|
+
export declare function resolveAgentTarget(raw: string | undefined): AgentTarget;
|
|
65
|
+
export declare function defaultDocsPath(agent: AgentTarget): string;
|
|
66
|
+
export declare function resolveCoreVersion(cwd: string): string;
|
|
67
|
+
export declare function renderAgentDocs(options: {
|
|
68
|
+
coreVersion: string;
|
|
69
|
+
agent: AgentTarget;
|
|
70
|
+
catalog?: CoreCatalog | null;
|
|
71
|
+
}): string;
|
|
72
|
+
/**
|
|
73
|
+
* Write agent bootstrap docs into the consumer project.
|
|
74
|
+
*/
|
|
75
|
+
export declare function runInitAgents(options?: InitAgentsOptions): InitAgentsResult;
|
|
76
|
+
/** Parse `af init` argv after the `init` token. */
|
|
77
|
+
export declare function parseInitArgs(args: string[]): {
|
|
78
|
+
agents: boolean;
|
|
79
|
+
agent: AgentTarget;
|
|
80
|
+
agentDocsPath?: string;
|
|
81
|
+
force: boolean;
|
|
82
|
+
noScript: boolean;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=init-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-agents.d.ts","sourceRoot":"","sources":["../src/init-agents.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnE,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC,CAAC;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAA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