@mpfrontend/ai-skills 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # @mpfrontend/ai-skills
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Versioned, product-neutral repository workflows installed explicitly by the MP Frontend CLI.
4
+ The approved catalog has eighteen finite source procedures. The base profile contains fourteen
5
+ implementation, integration, verification, upgrade and release-preparation workflows; the design
6
+ profile adds four import/sync/reconcile/review procedures. Availability means a usable procedure for the implemented finite profile,
7
+ not complete protected scaffolding, schema widgets, arbitrary locales, DLS coverage or agent parity.
8
+ Base installs fourteen; design profile includes all eighteen. Design operations consume a finite reviewed
9
+ local export and hashed evidence, not a Figma extractor or test/visual execution engine. The CLI's
10
+ packaged DESIGN-SYNC.md defines the exact profile and attestation limits.
11
+ The workspace source contract distinguishes a consumer-owned `existing` DLS, a pinned public
12
+ `mpfrontend` release and code-first `none`. Skills inspect and preserve that choice; they never switch
13
+ it merely to make a workflow pass or publish a private design source.
14
+ Installation never runs in npm postinstall and never writes personal/global agent configuration.
15
+
16
+ `mpfrontend skills list|install|update|check --json` uses the same source for Codex and Claude Code
17
+ repository discovery. Installation is idempotent, dry-run performs no writes and locally modified or
18
+ unowned skill files cause a collision. AGENTS.md, CLAUDE.md and unrelated skills are preserved.
19
+ Format/CLI fixture tests do not establish actual Codex/Claude behavioral equivalence.
20
+
21
+ Installation holds an exclusive repository-local `skills-install.lock`; a concurrent or interrupted
22
+ installation fails closed. Rollback preserves files edited by another agent after replacement and
23
+ reports the conflict. This is not a filesystem transaction across a machine crash. If a process dies,
24
+ inspect the exact owned files and skills-lock hashes before manually recovering the marker; never
25
+ delete a marker belonging to a running process or retry with a force-overwrite flag.
@@ -0,0 +1,48 @@
1
+ export declare const SKILLS_VERSION = "0.1.0", SKILLS_CLI_VERSION = "0.1.0";
2
+ export declare class SkillsError extends Error {
3
+ readonly exitCode: number;
4
+ constructor(message: string, exitCode?: number);
5
+ }
6
+ export declare function skillCatalog(): {
7
+ version: string;
8
+ cliVersion: string;
9
+ skills: {
10
+ reason?: string;
11
+ name: string;
12
+ profile: string;
13
+ available: boolean;
14
+ }[];
15
+ };
16
+ type Options = {
17
+ directory: string;
18
+ profile?: 'base' | 'design';
19
+ agent?: 'codex' | 'claude' | 'both';
20
+ dryRun?: boolean;
21
+ update?: boolean;
22
+ };
23
+ export declare function installSkills(options: Options): Promise<{
24
+ ok: boolean;
25
+ version: string;
26
+ profile: "base" | "design";
27
+ agents: ("codex" | "claude")[];
28
+ dryRun: boolean;
29
+ changes: {
30
+ path: string;
31
+ beforeHash: string | null;
32
+ afterHash: string;
33
+ }[];
34
+ installed: string[];
35
+ unavailable: {
36
+ reason?: string;
37
+ name: string;
38
+ profile: string;
39
+ available: boolean;
40
+ }[];
41
+ }>;
42
+ export declare function checkSkills(directory: string): Promise<{
43
+ ok: boolean;
44
+ version: string;
45
+ checked: number;
46
+ agents: ("codex" | "claude")[];
47
+ }>;
48
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,221 @@
1
+ import { readFile, lstat, realpath, mkdir, writeFile, rename, unlink, readdir } from 'node:fs/promises';
2
+ import { resolve, join, dirname } from 'node:path';
3
+ import { createHash, randomUUID } from 'node:crypto';
4
+ export const SKILLS_VERSION = '0.1.0', SKILLS_CLI_VERSION = '0.1.0';
5
+ const names = ['scaffold-app', 'implement-feature', 'integrate-openapi', 'form-from-api', 'table-from-api',
6
+ 'integrate-auth', 'apply-access', 'use-ui', 'configure-i18n', 'configure-theme', 'integrate-realtime',
7
+ 'verify-frontend', 'upgrade-project', 'prepare-release', 'import-design-system', 'sync-design-tokens',
8
+ 'reconcile-design-components', 'review-design-drift'];
9
+ const available = new Set(names);
10
+ const hash = (text) => createHash('sha256').update(text).digest('hex');
11
+ export class SkillsError extends Error {
12
+ exitCode;
13
+ constructor(message, exitCode = 4) {
14
+ super(message);
15
+ this.exitCode = exitCode;
16
+ }
17
+ }
18
+ export function skillCatalog() {
19
+ return { version: SKILLS_VERSION, cliVersion: SKILLS_CLI_VERSION, skills: names.map((name, index) => ({
20
+ name: 'mpfrontend-' + name, profile: index < 14 ? 'base' : 'design', available: available.has(name),
21
+ ...(available.has(name) ? {} : { reason: 'CAPABILITY_AND_BEHAVIORAL_ACCEPTANCE_PENDING' })
22
+ })) };
23
+ }
24
+ const lockPath = '.mpfrontend/skills-lock.json';
25
+ const mutexPath = '.mpfrontend/skills-install.lock';
26
+ async function content(root, path) {
27
+ let current = root;
28
+ for (const part of path.split('/')) {
29
+ current = join(current, part);
30
+ try {
31
+ const info = await lstat(current);
32
+ if (info.isSymbolicLink())
33
+ throw new SkillsError('SKILL_PATH_SYMLINK');
34
+ if (current !== join(root, path) && !info.isDirectory())
35
+ throw new SkillsError('SKILL_PARENT_NOT_DIRECTORY');
36
+ }
37
+ catch (error) {
38
+ if (error.code === 'ENOENT')
39
+ return undefined;
40
+ throw error;
41
+ }
42
+ }
43
+ try {
44
+ return await readFile(current, 'utf8');
45
+ }
46
+ catch (error) {
47
+ if (error.code === 'ENOENT')
48
+ return undefined;
49
+ throw error;
50
+ }
51
+ }
52
+ function parseLock(bytes) {
53
+ if (bytes === undefined)
54
+ return undefined;
55
+ try {
56
+ const value = JSON.parse(bytes);
57
+ if (value.generator !== 'MPFrontendSkills' || value.schemaVersion !== 1 || typeof value.version !== 'string' || typeof value.cliVersion !== 'string' || !['base', 'design'].includes(value.profile) || !Array.isArray(value.agents) || !value.agents.length || value.agents.length > 2 || new Set(value.agents).size !== value.agents.length || value.agents.some(v => !['codex', 'claude'].includes(v)) || !value.files || typeof value.files !== 'object' || Array.isArray(value.files))
58
+ throw new Error();
59
+ for (const [path, digest] of Object.entries(value.files))
60
+ if (!/^\.(?:agents|claude)\/skills\/mpfrontend-[a-z0-9-]+\/SKILL\.md$/.test(path) || !/^([a-f0-9]{64})$/.test(digest))
61
+ throw new Error();
62
+ return value;
63
+ }
64
+ catch {
65
+ throw new SkillsError('INVALID_SKILLS_LOCK');
66
+ }
67
+ }
68
+ /**
69
+ * The `mpfrontend-` prefix is reserved for the catalog. A consumer's own project and domain skills live
70
+ * beside the installed ones under another prefix; the installer never reads, changes or removes them.
71
+ */
72
+ async function refuseReservedNames(root) {
73
+ const catalog = new Set(names.map(name => 'mpfrontend-' + name));
74
+ for (const base of ['.agents/skills', '.claude/skills']) {
75
+ const parent = join(root, base);
76
+ try {
77
+ if (!(await lstat(parent)).isDirectory())
78
+ continue;
79
+ }
80
+ catch (error) {
81
+ if (error.code === 'ENOENT')
82
+ continue;
83
+ throw error;
84
+ }
85
+ for (const entry of await readdir(parent))
86
+ if (entry.startsWith('mpfrontend-') && !catalog.has(entry))
87
+ throw new SkillsError('RESERVED_SKILL_NAME:' + base + '/' + entry, 3);
88
+ }
89
+ }
90
+ export async function installSkills(options) {
91
+ const profile = options.profile ?? 'base', agent = options.agent ?? 'both';
92
+ if (!['base', 'design'].includes(profile) || !['codex', 'claude', 'both'].includes(agent))
93
+ throw new SkillsError('INVALID_SKILL_PROFILE_OR_AGENT', 2);
94
+ const root = await realpath(resolve(options.directory)), previousLock = await content(root, lockPath), lock = parseLock(previousLock);
95
+ if (await content(root, mutexPath) !== undefined)
96
+ throw new SkillsError('SKILLS_INSTALL_BUSY');
97
+ if (options.update && !lock)
98
+ throw new SkillsError('SKILLS_NOT_INSTALLED', 2);
99
+ // Updates preserve the installed selection unless the caller explicitly changes it.
100
+ const selectedProfile = options.profile ?? lock?.profile ?? profile;
101
+ const agents = options.agent ? (agent === 'both' ? ['codex', 'claude'] : [agent]) : lock?.agents ?? ['codex', 'claude'];
102
+ const catalog = skillCatalog(), selected = catalog.skills.filter(s => selectedProfile === 'design' || s.profile === 'base');
103
+ const desired = new Map(), before = new Map();
104
+ const files = { ...lock?.files };
105
+ for (const skill of selected.filter(s => s.available)) {
106
+ const source = await readFile(new URL('../skills/' + skill.name + '/SKILL.md', import.meta.url), 'utf8');
107
+ for (const target of agents) {
108
+ const path = (target === 'codex' ? '.agents' : '.claude') + '/skills/' + skill.name + '/SKILL.md';
109
+ const old = await content(root, path);
110
+ if (old !== undefined && (!lock?.files[path] || hash(old) !== lock.files[path]))
111
+ throw new SkillsError('MODIFIED_OR_UNOWNED_SKILL:' + path);
112
+ before.set(path, old);
113
+ files[path] = hash(source);
114
+ if (old !== source)
115
+ desired.set(path, source);
116
+ }
117
+ }
118
+ await refuseReservedNames(root);
119
+ const next = { generator: 'MPFrontendSkills', schemaVersion: 1, version: SKILLS_VERSION, cliVersion: SKILLS_CLI_VERSION, profile: selectedProfile, agents, files };
120
+ const encoded = JSON.stringify(next, null, 2) + '\n';
121
+ before.set(lockPath, previousLock);
122
+ if (previousLock !== encoded)
123
+ desired.set(lockPath, encoded);
124
+ const changes = [...desired].map(([path, text]) => ({ path, beforeHash: before.get(path) === undefined ? null : hash(before.get(path)), afterHash: hash(text) }));
125
+ if (!options.dryRun) {
126
+ const staged = new Map(), replaced = [];
127
+ const owner = randomUUID();
128
+ let acquired = false;
129
+ try {
130
+ await mkdir(join(root, '.mpfrontend'), { recursive: true });
131
+ await content(root, mutexPath);
132
+ try {
133
+ await writeFile(join(root, mutexPath), owner, { flag: 'wx' });
134
+ acquired = true;
135
+ }
136
+ catch (error) {
137
+ if (error.code === 'EEXIST')
138
+ throw new SkillsError('SKILLS_INSTALL_BUSY');
139
+ throw error;
140
+ }
141
+ for (const [path, text] of desired) {
142
+ if (await content(root, path) !== before.get(path))
143
+ throw new SkillsError('CONCURRENT_SKILL_EDIT:' + path);
144
+ await mkdir(dirname(join(root, path)), { recursive: true });
145
+ const stage = join(dirname(join(root, path)), '.mpfrontend-' + randomUUID());
146
+ await writeFile(stage, text, { flag: 'wx' });
147
+ staged.set(path, stage);
148
+ }
149
+ // Lock is written last. No AGENTS.md, CLAUDE.md or unrelated skill is altered.
150
+ for (const [path, stage] of staged) {
151
+ const current = await content(root, path);
152
+ if (current !== before.get(path))
153
+ throw new SkillsError('CONCURRENT_SKILL_EDIT:' + path);
154
+ await rename(stage, join(root, path));
155
+ staged.delete(path);
156
+ replaced.push(path);
157
+ }
158
+ }
159
+ catch (error) {
160
+ const conflicts = [];
161
+ for (const path of replaced.reverse()) {
162
+ // A second agent's edit is never overwritten by rollback, even on a failed install.
163
+ if (await content(root, path) !== desired.get(path)) {
164
+ conflicts.push(path);
165
+ continue;
166
+ }
167
+ const old = before.get(path);
168
+ if (old === undefined)
169
+ await unlink(join(root, path));
170
+ else
171
+ await writeFile(join(root, path), old);
172
+ }
173
+ if (conflicts.length)
174
+ throw new SkillsError('SKILL_ROLLBACK_CONFLICT:' + conflicts.join(','));
175
+ throw error;
176
+ }
177
+ finally {
178
+ for (const path of staged.values())
179
+ await unlink(path).catch(() => undefined);
180
+ if (acquired && await content(root, mutexPath) === owner)
181
+ await unlink(join(root, mutexPath));
182
+ }
183
+ }
184
+ return { ok: true, version: SKILLS_VERSION, profile: selectedProfile, agents, dryRun: options.dryRun ?? false, changes,
185
+ installed: selected.filter(s => s.available).map(s => s.name), unavailable: selected.filter(s => !s.available) };
186
+ }
187
+ export async function checkSkills(directory) {
188
+ const root = await realpath(resolve(directory));
189
+ if (await content(root, mutexPath) !== undefined)
190
+ throw new SkillsError('SKILLS_INSTALL_BUSY');
191
+ const lock = parseLock(await content(root, lockPath));
192
+ if (!lock)
193
+ throw new SkillsError('SKILLS_NOT_INSTALLED', 2);
194
+ if (lock.version !== SKILLS_VERSION || lock.cliVersion !== SKILLS_CLI_VERSION)
195
+ throw new SkillsError('SKILLS_VERSION_MISMATCH', 3);
196
+ await refuseReservedNames(root);
197
+ const catalog = skillCatalog();
198
+ let checked = 0;
199
+ for (const skill of catalog.skills.filter(s => s.available && (lock.profile === 'design' || s.profile === 'base')))
200
+ for (const agent of lock.agents) {
201
+ const path = (agent === 'codex' ? '.agents' : '.claude') + '/skills/' + skill.name + '/SKILL.md';
202
+ if (!lock.files[path])
203
+ throw new SkillsError('INCOMPLETE_SKILLS_LOCK:' + path, 3);
204
+ }
205
+ for (const [path, digest] of Object.entries(lock.files)) {
206
+ const old = await content(root, path);
207
+ if (old === undefined || hash(old) !== digest)
208
+ throw new SkillsError('INSTALLED_SKILL_DRIFT:' + path, 3);
209
+ const name = path.split('/')[2], skill = catalog.skills.find(s => s.name === name);
210
+ if (!skill?.available)
211
+ throw new SkillsError('UNAVAILABLE_INSTALLED_SKILL:' + name, 3);
212
+ const source = await readFile(new URL('../skills/' + name + '/SKILL.md', import.meta.url), 'utf8');
213
+ if (hash(source) !== digest)
214
+ throw new SkillsError('SKILLS_SOURCE_DRIFT:' + name, 3);
215
+ checked++;
216
+ }
217
+ if (!checked)
218
+ throw new SkillsError('EMPTY_SKILLS_LOCK', 3);
219
+ return { ok: true, version: SKILLS_VERSION, checked, agents: lock.agents };
220
+ }
221
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAC,OAAO,EAAC,kBAAkB,GAAC,OAAO,CAAC;AAC/D,MAAM,KAAK,GAAC,CAAC,cAAc,EAAC,mBAAmB,EAAC,mBAAmB,EAAC,eAAe,EAAC,gBAAgB;IAClG,gBAAgB,EAAC,cAAc,EAA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@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "@mpfrontend/ai-skills",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/panahister/mpfrontend.git",
8
+ "directory": "packages/ai-skills"
9
+ },
10
+ "type": "module",
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "skills",
22
+ "README.md"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "provenance": true
27
+ }
6
28
  }
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: mpfrontend-apply-access
3
+ description: Apply an approved capability and field/action visibility matrix to an MP Frontend consumer while preserving server authority and stale-response safety. Use after roles, resources and grants are defined elsewhere.
4
+ ---
5
+
6
+ # Apply approved access decisions
7
+
8
+ Requires the reviewed MP Frontend CLI `0.1.0` cohort, `@mpfrontend/access-core` and
9
+ `@mpfrontend/access-react`. Read the approved capability catalog, persona/tenant matrix and consumer
10
+ instructions. Do not create roles, resources, permissions or grants and do not infer authority from a sample
11
+ identity.
12
+
13
+ Keep backend or BFF enforcement authoritative. UI guards control presentation only and never turn a hidden
14
+ control into an authorization boundary. The consumer's server resolves its rules into an explicit snapshot (context
15
+ reference, revision, expiry, capabilities, fields); the browser decides no rule, never reads a role name or token
16
+ claim and never calls the identity provider or a policy service. Do not add an "open unless denied" mode in the
17
+ browser: the server resolves such a rule into the snapshot. Do not make the optional `roles` of a Security BFF
18
+ route mandatory.
19
+
20
+ Register each approved page, menu entry, element and field once in the app's page manifest
21
+ (`definePageManifest`): a route with the capability its page and menu entry need, its elements (an element's own
22
+ stable id is its capability key unless it names another) and the field keys its components read. Load the
23
+ snapshot in a server component with `createAccessLoader` of `@mpfrontend/access-react/server` (the consumer's own
24
+ endpoint through the BFF, the request's context reference, `manifestKeys`, an explicit `timeoutMs`) and pass
25
+ `clientSnapshot(result, pageKeys(manifest, page))` to an `AccessProvider`. Present with `AccessGuard`,
26
+ `AccessLink`, `useCapability`, `useFieldState`, `useNavigation` and the `access` property of `ResourceTable` and
27
+ `ResourceForm`. Denied is hidden by default; use a guard's `fallback` or `whenDenied="disabled"` only where the
28
+ approved UX says so, never by guessing.
29
+
30
+ Wrap protected asynchronous reads in `AuthorityFence`: inside a provider, capture with `useAccessCapture()` before
31
+ a request and call `assertCurrent()` before publishing its result. The context identity must distinguish subject,
32
+ tenant, effective capability revision and session, so the server's context reference and revision change with them
33
+ and results captured under an older authority cannot publish into a newer view. On identity/tenant/role changes,
34
+ invalidate protected caches and realtime subscriptions without destroying safe unsaved drafts.
35
+
36
+ Test unauthenticated, forbidden, permitted, tenant-isolated, stale-token, refreshed-token, revoked-role
37
+ and delayed-response cases, an expired snapshot on an idle screen and a revision change during a pending request.
38
+ Run `assertPageManifest(manifest, {routes: await appRoutes('src/app'), ids})` with `appRoutes` from
39
+ `@mpfrontend/access-react/testing`. Include a failing control that proves removing the fence, a guard or the
40
+ server check would expose the defect. Exercise the actual browser surface for every approved persona, check that
41
+ the first paint holds no denied entry, and verify the API still refuses direct unauthorized requests.
42
+
43
+ Report the exact matrix covered, commands/counts and unresolved policy decisions. This skill does not
44
+ authorize identity-administration writes, production policy changes, deployment or publication.