Skip to content

Commit d3fc056

Browse files
dhilipkumarsmnriemCopilot
authored
Add /selftest.extension core extension to test other extensions (#1758)
* test(commands): create extension-commands LLM playground sandbox * update(tests): format LLM evaluation as an automated test runner * test(commands): map extension-commands python script with timestamps * test(commands): map extension-commands python script with timestamps * test(commands): update TESTING.md to evaluate discovery, lint, and deploy explicitly * test(commands): simplify execution expectations and add timestamp calculation * fix(tests): address copilot review comments on prompt formatting and relative paths * fix(tests): resolve copilot PR feedback regarding extension schema structure and argparse mutually exclusive groups * feat(extensions): add core selftest utility and migrate away from manual tests sandbox * fix(selftest): update command name array to match spec-kit validation schema * fix(selftest): wrap arguments in quotes to support multi-word extension names * update the command to be more meaningful * fix: if the extension is discovery only, it should not be installable * Address review comments for selftest documentation * address review comments * address review comments * Update extensions/selftest/commands/selftest.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Manfred Riem <15701806+mnriem@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 58ce653 commit d3fc056

File tree

3 files changed

+103
-3
lines changed

3 files changed

+103
-3
lines changed

extensions/catalog.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
{
22
"schema_version": "1.0",
3-
"updated_at": "2026-02-03T00:00:00Z",
3+
"updated_at": "2026-03-10T00:00:00Z",
44
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/extensions/catalog.json",
5-
"extensions": {}
6-
}
5+
"extensions": {
6+
"selftest": {
7+
"name": "Spec Kit Self-Test Utility",
8+
"id": "selftest",
9+
"version": "1.0.0",
10+
"description": "Verifies catalog extensions by programmatically walking through the discovery, installation, and registration lifecycle.",
11+
"author": "spec-kit-core",
12+
"repository": "https://github.com/github/spec-kit",
13+
"download_url": "https://github.com/github/spec-kit/releases/download/selftest-v1.0.0/selftest.zip",
14+
"tags": [
15+
"testing",
16+
"core",
17+
"utility"
18+
]
19+
}
20+
}
21+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
description: "Validate the lifecycle of an extension from the catalog."
3+
---
4+
5+
# Extension Self-Test: `$ARGUMENTS`
6+
7+
This command drives a self-test simulating the developer experience with the `$ARGUMENTS` extension.
8+
9+
## Goal
10+
11+
Validate the end-to-end lifecycle (discovery, installation, registration) for the extension: `$ARGUMENTS`.
12+
If `$ARGUMENTS` is empty, you must tell the user to provide an extension name, for example: `/speckit.selftest.extension linear`.
13+
14+
## Steps
15+
16+
### Step 1: Catalog Discovery Validation
17+
18+
Check if the extension exists in the Spec Kit catalog.
19+
Execute this command and verify that it completes successfully and that the returned extension ID exactly matches `$ARGUMENTS`. If the command fails or the ID does not match `$ARGUMENTS`, fail the test.
20+
21+
```bash
22+
specify extension info "$ARGUMENTS"
23+
```
24+
25+
### Step 2: Simulate Installation
26+
27+
First, try to add the extension to the current workspace configuration directly. If the catalog provides the extension as `install_allowed: false` (discovery-only), this step is *expected* to fail.
28+
29+
```bash
30+
specify extension add "$ARGUMENTS"
31+
```
32+
33+
Then, simulate adding the extension by installing it from its catalog download URL, which should bypass the restriction.
34+
Obtain the extension's `download_url` from the catalog metadata (for example, via a catalog info command or UI), then run:
35+
36+
```bash
37+
specify extension add "$ARGUMENTS" --from "<download_url>"
38+
```
39+
40+
### Step 3: Registration Verification
41+
42+
Once the `add` command completes, verify the installation by checking the project configuration.
43+
Use terminal tools (like `cat`) to verify that the following file contains a record for `$ARGUMENTS`.
44+
45+
```bash
46+
cat .specify/extensions/.registry/$ARGUMENTS.json
47+
```
48+
49+
### Step 4: Verification Report
50+
51+
Analyze the standard output of the three steps.
52+
Generate a terminal-style test output format detailing the results of discovery, installation, and registration. Return this directly to the user.
53+
54+
Example output format:
55+
```text
56+
============================= test session starts ==============================
57+
collected 3 items
58+
59+
test_selftest_discovery.py::test_catalog_search [PASS/FAIL]
60+
Details: [Provide execution result of specify extension search]
61+
62+
test_selftest_installation.py::test_extension_add [PASS/FAIL]
63+
Details: [Provide execution result of specify extension add]
64+
65+
test_selftest_registration.py::test_config_verification [PASS/FAIL]
66+
Details: [Provide execution result of registry record verification]
67+
68+
============================== [X] passed in ... ==============================
69+
```

extensions/selftest/extension.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
schema_version: "1.0"
2+
extension:
3+
id: selftest
4+
name: Spec Kit Self-Test Utility
5+
version: 1.0.0
6+
description: Verifies catalog extensions by programmatically walking through the discovery, installation, and registration lifecycle.
7+
author: spec-kit-core
8+
repository: https://github.com/github/spec-kit
9+
license: MIT
10+
requires:
11+
speckit_version: ">=0.2.0"
12+
provides:
13+
commands:
14+
- name: speckit.selftest.extension
15+
file: commands/selftest.md
16+
description: Validate the lifecycle of an extension from the catalog.

0 commit comments

Comments
 (0)