@iamk77/skill-checklist 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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2026 IamK77
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # checklist
2
+
3
+ A CLI that gates a Claude Code skill's phases. A stage cannot open until every check in every prior stage is recorded as passing. It exists so an agent running a multi-stage skill cannot skip ahead or self-certify a stage it did not actually do.
4
+
5
+ Package name `@iamk77/skill-checklist`, version 0.2.0. TypeScript, commander-based.
6
+
7
+ ## What it does
8
+
9
+ `checklist` reads a `.checklist.yml` file from a skill directory. That file is an ordered list of `phases`; each phase has `checks`, and each check has an `id`, a `description`, and an optional `verify` rule. The CLI tracks a pass/fail result per check, per skill directory, in a state file, and enforces sequential gating: before it will let you `verify` or `check` a phase, every check in every earlier phase must already be recorded as `pass`.
10
+
11
+ The gate floor is strict about what "done" means. An item counts toward a phase only when its current recorded result is `pass` — not merely that a row for it exists. A stored `fail`/`error`, or a check that was green on an earlier run and has since regressed, does not satisfy the gate. A failing re-`verify` overwrites the stale pass, so the gate always reflects current state rather than the best state ever seen.
12
+
13
+ There are two ways a check gets a result:
14
+
15
+ - A check with **no** `verify` rule is a manual, human-judgment item. It is cleared by `checklist check <phase> <item-id>`, which records `pass` with the message `confirmed`.
16
+ - A check **with** a `verify` rule is mechanical. It is run (and recorded) by `checklist verify <phase>`. Trying to `check` a mechanical item is rejected with an error pointing you at `verify`.
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ npm install -g @iamk77/skill-checklist
22
+ ```
23
+
24
+ This puts the `checklist` command on `PATH`. To run it without a global install:
25
+
26
+ ```sh
27
+ npx @iamk77/skill-checklist show
28
+ ```
29
+
30
+ The published package ships a compiled `dist/` build, and `bin/checklist.js` runs it through Node directly (`require('../dist/index.js')`) — no `tsx` and no compile step at install time. Its only runtime dependencies are `commander`, `gray-matter`, and `js-yaml`.
31
+
32
+ Requires Node >= 18.
33
+
34
+ ### From source
35
+
36
+ To run it from a clone instead:
37
+
38
+ ```sh
39
+ git clone https://github.com/IamK77/Skill.git
40
+ cd Skill/devtools/checklist
41
+ npm install # dev deps: typescript, vitest, tsx
42
+ npm run build # compile src/ -> dist/
43
+ npm link # put `checklist` on PATH
44
+ ```
45
+
46
+ `npm run dev` (`tsc --watch`) keeps `dist/` current while you edit `src/`. The version string is set in two places — `package.json` and `src/index.ts` (`.version('…')`) — keep them in sync on a bump.
47
+
48
+ In normal use you never pass any flags. The skill calls `checklist init ${CLAUDE_SKILL_DIR} --force`, and later commands resolve the directory from `$CLAUDE_SKILL_DIR` or the active pointer (see How directories are resolved).
49
+
50
+ ## Commands
51
+
52
+ All commands accept the same two flags: `-d, --dir <dir>` (the directory containing `.checklist.yml`) and `-p, --path <path>` (the target directory for builtin checks; defaults to the resolved `--dir`).
53
+
54
+ | Command | What it does |
55
+ | --- | --- |
56
+ | `init [dir] [--force]` | Load `.checklist.yml`, clear any existing state, write the active pointer, print a ready summary. Without `--force` it refuses if a state file already exists. The directory may be given positionally or via `--dir`; a conflicting pair is rejected. |
57
+ | `show [phase]` | Print the checklist overview, or — with a phase argument — that one phase with its recorded readings. |
58
+ | `verify <phase>` | Gate all prior phases, then batch-run that phase's mechanical (`verify`-rule) checks and record their current results. Exits non-zero if any mechanical check fails. |
59
+ | `check <phase> <item-id>` | Manually confirm one human-judgment item (records `pass`). Errors if the item has a `verify` rule (that item belongs to `verify`) or if a prior phase is not complete. |
60
+ | `phases` | List all phases. |
61
+ | `reset` (alias `done`) | End-of-run cleanup: clear this skill's state file and drop the active pointer when it points here. Refuses if the resolved directory has no `.checklist.yml`, so a bare `reset` can't delete an unrelated project's state. |
62
+
63
+ Both `verify` and `check` apply the prior-phase gate before doing anything else. `verify` additionally records results; `check` records a single confirmation.
64
+
65
+ ### A worked example
66
+
67
+ Given a checklist whose first two phases are `charter` (one check, `motivation-identified`) and `survey` (one check, `surface-mapped`):
68
+
69
+ ```sh
70
+ $ checklist init /path/to/skill --force # load config, clear state, set active pointer
71
+
72
+ $ checklist check survey surface-mapped # rejected: charter not complete yet
73
+ gate blocked: PHASE 0 (charter) incomplete # (exits non-zero)
74
+
75
+ $ checklist check charter motivation-identified
76
+ # records charter/motivation-identified = pass
77
+
78
+ $ checklist verify charter # gate passes; charter has no mechanical checks
79
+ $ checklist check survey surface-mapped # now allowed; charter is complete
80
+ # records survey/surface-mapped = pass
81
+
82
+ $ checklist show # review all phases and readings
83
+ $ checklist done # clear state + active pointer
84
+ ```
85
+
86
+ The second line shows the core guarantee: an agent cannot record `survey` before `charter`'s checks are all `pass`.
87
+
88
+ ## How directories are resolved
89
+
90
+ Most commands need no `--dir` because the directory is resolved in this order:
91
+
92
+ 1. an explicit `--dir`
93
+ 2. `$CHECKLIST_DIR`
94
+ 3. `$CLAUDE_SKILL_DIR` (a running skill always knows its own dir; the harness sets this)
95
+ 4. the global **active pointer** file
96
+ 5. the current working directory
97
+
98
+ The active pointer is a single file written by `init` and removed by `reset`/`done`. Its location is `$CHECKLIST_HOME` if set, else `$XDG_CONFIG_HOME/checklist/active`, else `~/.config/checklist/active`. Because `init` writes the pointer from the harness-expanded `${CLAUDE_SKILL_DIR}`, every later command finds the right directory with no flags and regardless of the current working directory.
99
+
100
+ The pointer self-heals, but conservatively: it is removed and the resolver falls through to cwd only when its target is *definitely* gone (a `statSync` of `<target>/.checklist.yml` returns `ENOENT`/`ENOTDIR`). Any other error — `EACCES`, `EIO`, `ELOOP`, an NFS stall — is treated as "can't tell," and a valid pointer is never deleted over a transient read failure.
101
+
102
+ `--path` (the target directory for builtin checks) defaults to the resolved `--dir`.
103
+
104
+ ## verify rules
105
+
106
+ A check's `verify:` value can take one of three forms. The kind is taken from an explicit prefix; without a prefix it is auto-classified (a first token containing `/` or ending in `.sh`/`.bash`/`.ts`/`.js`/`.py` is treated as a script, otherwise as a shell command).
107
+
108
+ - **`builtin:<name>`** — an in-process check. The available builtins are: `frontmatter`, `name-format`, `description-present`, `description-length`, `no-secrets`, `file-refs`, `has-checklist`, `line-count`. An unknown name returns an error listing the valid ones.
109
+ - **`shell:<cmd>`** — run a shell command (via `/bin/bash`) with a 10s timeout. Non-zero exit is a fail; its stderr/message is the recorded detail.
110
+ - **`script:<path>`** — run a script that must live **inside** the checklist directory. The path is checked twice for containment: lexically, and again against the real (symlink-resolved) paths before execution. Paths that escape the directory via `..`, another root, or a symlink are rejected with an error rather than run.
111
+
112
+ A check with no `verify:` is a manual item, cleared by `checklist check`.
113
+
114
+ In practice, **all five shipped skills' checklists use only manual checks** — none defines any `verify` rules. So in those flows the `verify` command does no mechanical work; its job is purely to apply the prior-phase gate. The `builtin`/`shell`/`script` machinery exists and is tested, but no shipped skill currently exercises it.
115
+
116
+ ## .checklist.yml format
117
+
118
+ Top-level `phases:` is an ordered, non-empty list. Each phase has a `name` and a non-empty `checks:` list. Each check has an `id` (unique within its phase) and a `description`, plus an optional `verify`. The loader rejects a missing `phases` array, an empty `phases` array, a phase without a `name` or `checks`, a check without an `id` or `description`, and duplicate `id`s within a phase.
119
+
120
+ ```yaml
121
+ phases:
122
+ - name: charter
123
+ checks:
124
+ - id: motivation-identified
125
+ description: Testing motivation classified and confirmed with the user
126
+ # no verify: -> manual item, cleared by `checklist check charter motivation-identified`
127
+
128
+ - name: build
129
+ checks:
130
+ - id: tests-green
131
+ description: Tests written and the full suite passes
132
+ verify: shell:npm test # mechanical, run by `checklist verify build`
133
+ - id: skill-shape
134
+ description: SKILL.md frontmatter is well-formed
135
+ verify: builtin:frontmatter
136
+ ```
137
+
138
+ A phase is addressed by `name` (case-insensitive) or by 0-based index. Skills typically address stages by name only, so the index never surfaces.
139
+
140
+ ## State and files
141
+
142
+ `checklist` writes two things:
143
+
144
+ - `.checklist.state.json` in the skill directory — the per-phase, per-item results (`{ checked: { "<phaseIndex>": { "<itemId>": { status, message } } } }`). This is gitignored. A corrupt or malformed state file is reported with a hint to run `checklist init --force`.
145
+ - the global `active` pointer file (location described above).
146
+
147
+ `init --force` clears the state file; `reset`/`done` clears the state file and drops the active pointer when it points at this directory.
148
+
149
+ ## Run the tests
150
+
151
+ ```sh
152
+ npm test
153
+ ```
154
+
155
+ Runs the vitest suite. The current run is 434 tests passing (with 15 skipped probe tests for deferred, owner-pending defects), across unit and integration files covering the loader, resolver, runner containment, state semantics, the gate, the builtins, and the command surface.
156
+
157
+ ## License
158
+
159
+ Apache-2.0, Copyright 2026 IamK77. See `LICENSE` and `NOTICE` (shipped with the package; also at the repository root).
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/index.js');
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.descriptionPresentCheck = descriptionPresentCheck;
40
+ exports.descriptionLengthCheck = descriptionLengthCheck;
41
+ const fs = __importStar(require("node:fs"));
42
+ const path = __importStar(require("node:path"));
43
+ const gray_matter_1 = __importDefault(require("gray-matter"));
44
+ const MAX_COMBINED = 1536;
45
+ async function descriptionPresentCheck(targetPath) {
46
+ const filePath = path.resolve(targetPath, 'SKILL.md');
47
+ if (!fs.existsSync(filePath)) {
48
+ return { status: 'fail', message: 'SKILL.md not found' };
49
+ }
50
+ const { data } = (0, gray_matter_1.default)(fs.readFileSync(filePath, 'utf-8'));
51
+ const desc = data.description;
52
+ if (desc !== undefined && typeof desc !== 'string') {
53
+ return { status: 'fail', message: 'description must be a string' };
54
+ }
55
+ if (!desc || desc.trim().length === 0) {
56
+ return { status: 'fail', message: 'description is empty' };
57
+ }
58
+ return { status: 'pass', message: `${desc.length} chars` };
59
+ }
60
+ async function descriptionLengthCheck(targetPath) {
61
+ const filePath = path.resolve(targetPath, 'SKILL.md');
62
+ if (!fs.existsSync(filePath)) {
63
+ return { status: 'fail', message: 'SKILL.md not found' };
64
+ }
65
+ const { data } = (0, gray_matter_1.default)(fs.readFileSync(filePath, 'utf-8'));
66
+ const desc = typeof data.description === 'string' ? data.description : '';
67
+ const whenToUse = typeof data.when_to_use === 'string' ? data.when_to_use : '';
68
+ const total = desc.length + whenToUse.length;
69
+ if (total > MAX_COMBINED) {
70
+ return { status: 'fail', message: `${total}/${MAX_COMBINED} chars` };
71
+ }
72
+ return { status: 'pass', message: `${total}/${MAX_COMBINED} chars` };
73
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.fileRefsCheck = fileRefsCheck;
40
+ const fs = __importStar(require("node:fs"));
41
+ const path = __importStar(require("node:path"));
42
+ const gray_matter_1 = __importDefault(require("gray-matter"));
43
+ const LINK_RE = /\[.*?\]\(((?!https?:\/\/|#|mailto:).*?)\)/g;
44
+ async function fileRefsCheck(targetPath) {
45
+ const filePath = path.resolve(targetPath, 'SKILL.md');
46
+ if (!fs.existsSync(filePath)) {
47
+ return { status: 'fail', message: 'SKILL.md not found' };
48
+ }
49
+ const { content } = (0, gray_matter_1.default)(fs.readFileSync(filePath, 'utf-8'));
50
+ const refs = [];
51
+ let match;
52
+ while ((match = LINK_RE.exec(content)) !== null) {
53
+ let ref = match[1].trim();
54
+ ref = ref.replace(/^<(.*)>$/, '$1'); // <path> angle-bracket form
55
+ ref = ref.replace(/\s+["'][^"']*["']\s*$/, ''); // optional "title" / 'title'
56
+ const hash = ref.indexOf('#'); // strip a #fragment on a local path
57
+ if (hash !== -1)
58
+ ref = ref.slice(0, hash);
59
+ ref = ref.trim();
60
+ if (ref)
61
+ refs.push(ref); // skip pure-fragment / empty targets
62
+ }
63
+ if (refs.length === 0) {
64
+ return { status: 'pass', message: 'no file references' };
65
+ }
66
+ const missing = refs.filter(ref => {
67
+ const resolved = path.resolve(targetPath, ref);
68
+ return !fs.existsSync(resolved);
69
+ });
70
+ if (missing.length > 0) {
71
+ return { status: 'fail', message: `missing: ${missing.join(', ')}` };
72
+ }
73
+ return { status: 'pass', message: `${refs.length} refs valid` };
74
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.frontmatterCheck = frontmatterCheck;
40
+ const fs = __importStar(require("node:fs"));
41
+ const path = __importStar(require("node:path"));
42
+ const gray_matter_1 = __importDefault(require("gray-matter"));
43
+ async function frontmatterCheck(targetPath) {
44
+ const filePath = path.resolve(targetPath, 'SKILL.md');
45
+ if (!fs.existsSync(filePath)) {
46
+ return { status: 'fail', message: 'SKILL.md not found' };
47
+ }
48
+ try {
49
+ const raw = fs.readFileSync(filePath, 'utf-8');
50
+ if (!raw.trimStart().startsWith('---')) {
51
+ return { status: 'fail', message: 'missing --- frontmatter delimiter' };
52
+ }
53
+ const { data } = (0, gray_matter_1.default)(raw);
54
+ const fieldCount = Object.keys(data).length;
55
+ if (fieldCount === 0) {
56
+ return { status: 'fail', message: 'frontmatter is empty' };
57
+ }
58
+ return { status: 'pass', message: `parsed, ${fieldCount} fields` };
59
+ }
60
+ catch (e) {
61
+ const msg = e instanceof Error ? e.message : String(e);
62
+ return { status: 'fail', message: `parse error: ${msg}` };
63
+ }
64
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.hasChecklistCheck = hasChecklistCheck;
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
39
+ const CHECKLIST_RE = /^#+\s*CHECKLIST:/im;
40
+ async function hasChecklistCheck(targetPath) {
41
+ const filePath = path.resolve(targetPath, 'SKILL.md');
42
+ if (!fs.existsSync(filePath)) {
43
+ return { status: 'fail', message: 'SKILL.md not found' };
44
+ }
45
+ const content = fs.readFileSync(filePath, 'utf-8');
46
+ const matches = content.match(new RegExp(CHECKLIST_RE.source, 'gim'));
47
+ const count = matches ? matches.length : 0;
48
+ if (count === 0) {
49
+ return { status: 'fail', message: 'no CHECKLIST section found' };
50
+ }
51
+ return { status: 'pass', message: `${count} checklist sections` };
52
+ }