Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .agents/skills/prospec-knowledge-generate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,16 @@ If a module's README would exceed the ≤100 line / ≤1000 token budget even af
> Description, and Depends On (via `relationships.depends_on`) — are curated in
> `prospec/ai-knowledge/module-map.yaml`; `prospec/index.md`'s `prospec:auto` block is
> **generated** from it. Curate these fields in `module-map.yaml`, not by hand-editing the index
> table — `/prospec-knowledge-update` regenerates the auto block from `module-map.yaml` (blanking any
> index-only curated cell). Fill the table below only for a first-pass bootstrap; the values belong in
> `module-map.yaml`.
> table.

Fill module table within `prospec:auto-start/end` markers using new format:
The `prospec:auto` block contains two auto-generated sections. Populate them within `prospec:auto-start/end` markers:

1. **Conventions**:
- Scan the `prospec/ai-knowledge/` directory for `.md` files (excluding `_index.md`).
- List them under **Core Conventions (L1)** if they are built-in core files (e.g. `_conventions.md`) or defined in `.prospec.yaml`'s `additional_core_conventions`.
- List the rest under **Load-on-Demand Conventions (L2)**.

2. **Modules**: Fill the module table using the new format:

```
| Module | Keywords | Aliases | Status | Description | Rationale | Depends On |
Expand Down
11 changes: 8 additions & 3 deletions .agents/skills/prospec-knowledge-update/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ NOT by hand-editing the index table (it gets regenerated).
- Preserve each existing module's `category` (do NOT re-guess it); for an ADDED module, derive an ordered `category: [primary, …]` consistent with existing grouping and write it
- Skip if module-map.yaml doesn't exist

#### 3d: prospec/index.md (generated from module-map)
#### 3d: prospec/index.md (generated from module-map and conventions)

The `prospec:auto` block is regenerated from `module-map.yaml` by `updateIndex` using the canonical
column format — you do not hand-fill curated cells:
The `prospec:auto` block contains two auto-generated sections:
1. **Conventions**: Core Conventions (L1) and Load-on-Demand Conventions (L2) lists.
2. **Modules**: The module table regenerated from `module-map.yaml` using the canonical column format.

When updating the auto block manually, **you must preserve and update both sections**.
- **Conventions**: Scan the `prospec/ai-knowledge/` directory for `.md` files (excluding `_index.md`). List them under Core Conventions if they are built-in core files (e.g. `_conventions.md`) or defined in `.prospec.yaml`'s `additional_core_conventions`. Otherwise, list them under Load-on-Demand Conventions.
- **Modules**: Regenerate the table from `module-map.yaml` using the canonical columns. You do not hand-fill curated cells:

```
| Module | Keywords | Aliases | Status | Description | Rationale | Depends On |
Expand Down
34 changes: 18 additions & 16 deletions .agents/skills/prospec-upgrade/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,30 @@ user to run `prospec init` first.
touches an EXISTING one — updating a present doc's format, or enriching a freshly-created doc beyond its
baseline, requires consent. Do that here:

1. **Locate the latest templates** shipped with the installed prospec version. **Source-repo
1. **Retrieve the latest templates** shipped with the installed prospec version. **Source-repo
short-circuit first**: if the project's own `package.json` `name` equals the prospec package name
(`@benwu95/prospec`), the working directory IS the package root — use `.` and skip the resolution
below. This is the dogfooding case; `require.resolve('@benwu95/prospec/package.json')` fails here
because the package is absent from its own `node_modules` and the package has no `exports` field
to enable Node self-referencing. Otherwise resolve the package root (e.g.
`node -e "console.log(require.resolve('@benwu95/prospec/package.json'))"`, or check
`node_modules/@benwu95/prospec`, or a global install via `npm root -g`). If `require.resolve`
fails — a `pnpm link`/globally-linked install keeps the package outside the project's
`node_modules` — derive the root from the running CLI instead: follow `$(which prospec)` (a
shim/symlink to `<package-root>/dist/cli/index.js`) back up to `<package-root>`. All doc
templates are language-neutral `.hbs` files under `src/templates/` (the package ships and
loads them from `src/templates/`, not a root-level `templates/` — `tsc` does not copy `.hbs` into
`dist/`). If the templates cannot be located, say so and SKIP this step (do not guess the latest
format).
(`@benwu95/prospec`), the working directory IS the package root — read the templates directly from
`src/templates/` and skip the CLI call below (dogfooding case). Otherwise, retrieve the template
content directly by running the CLI command:
`prospec print-template <template_path>` (Bash).
For example, to get the template for `init/constitution.md.hbs`, run `prospec print-template init/constitution.md.hbs`.
If the template cannot be retrieved, say so and SKIP this step (do not guess the latest format).
2. **Take the scan scope from Step 1's `Docs inventory:` section** — every line names an init-created
doc, its present/MISSING status, and its source template path. That list is the ONLY scan scope:
do not keep, reconstruct, or fall back to a file list written into this skill. If the report has
no `Docs inventory:` section, the installed CLI predates it (CLI/skill version mismatch) — STOP
this step and tell the user to re-run `prospec upgrade` (which re-syncs this skill to match the
CLI), then re-run `/prospec-upgrade`.
3. **Index enrichment / migration**: `prospec upgrade` back-fills `prospec/index.md` as a BASELINE — its module table is empty. Offer to populate that table from the current modules, and if `prospec/ai-knowledge/_index.md` exists (a project from before the hierarchical-index move), migrate its curated content into that baseline: preserve any user notes in the `<!-- prospec:user-start -->` block, and **copy the curated `Modules` table rows verbatim** into the `prospec:auto` block — the Keywords / Aliases / Rationale / Depends On columns are human-curated and exist nowhere else. Do NOT run `prospec knowledge update` to rebuild the table: it fills only Module / Status / Description from `module-map.yaml` and blanks every curated column to `—`. Delete the old `prospec/ai-knowledge/_index.md` after a successful migration.
3. **Index enrichment / migration**: `prospec upgrade` back-fills `prospec/index.md` as a
BASELINE — its module table is empty. Offer to populate that table from the current modules,
and if `prospec/ai-knowledge/_index.md` exists (a project from before the hierarchical-index
move), migrate its curated content into that baseline: preserve any user notes in the
`<!-- prospec:user-start -->` block, and **copy both the Core/Demand Conventions lists and the
curated `Modules` table rows verbatim** into the `prospec:auto` block — the Keywords / Aliases /
Rationale / Depends On columns are human-curated and exist nowhere else. Do NOT run
`prospec knowledge update` to rebuild the table: it fills only Module / Status / Description from
`module-map.yaml` and blanks every curated column to `—`. Delete the old
`prospec/ai-knowledge/_index.md` after a successful migration.
4. **Back-fill safety net** — `prospec upgrade` already created every doc it could (the report's
`created …` line), so the inventory should show them present. For any doc the inventory **still
marks MISSING** (its back-fill failed), offer to create it by rendering its listed template.
Expand Down Expand Up @@ -164,7 +166,7 @@ Emit one line: `Met N/M | Unmet: <items> | Overall: PASS|WARN|FAIL | Next: <one-
|----------|--------|
| `prospec` CLI unavailable | Stop; tell the user to install/rebuild prospec, then re-run — do not proceed silently |
| `prospec upgrade` reports `ConfigNotFound` | Project not initialized — stop and instruct the user to run `prospec init` first |
| prospec templates cannot be located | Skip Step 2 with a note; still do Step 3 (artifact language) and Step 4 (trigger localization) |
| `prospec print-template` fails to retrieve a template | Skip Step 2 with a note; still do Step 3 (artifact language) and Step 4 (trigger localization) |
| report has no `Docs inventory:` section | CLI/skill version mismatch — skip Step 2 with a note telling the user to re-run `prospec upgrade` (it re-syncs this skill), then re-run `/prospec-upgrade` |
| User declines creating a still-MISSING doc | Leave it uncreated; the next `prospec upgrade` will attempt to back-fill it again |
| `prospec agent sync` reports no configured agent | Stop and instruct the user to re-run `prospec init` or add an agent to `.prospec.yaml` |
Expand Down
13 changes: 9 additions & 4 deletions .claude/skills/prospec-knowledge-generate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,16 @@ If a module's README would exceed the ≤100 line / ≤1000 token budget even af
> Description, and Depends On (via `relationships.depends_on`) — are curated in
> `prospec/ai-knowledge/module-map.yaml`; `prospec/index.md`'s `prospec:auto` block is
> **generated** from it. Curate these fields in `module-map.yaml`, not by hand-editing the index
> table — `/prospec-knowledge-update` regenerates the auto block from `module-map.yaml` (blanking any
> index-only curated cell). Fill the table below only for a first-pass bootstrap; the values belong in
> `module-map.yaml`.
> table.

Fill module table within `prospec:auto-start/end` markers using new format:
The `prospec:auto` block contains two auto-generated sections. Populate them within `prospec:auto-start/end` markers:

1. **Conventions**:
- Scan the `prospec/ai-knowledge/` directory for `.md` files (excluding `_index.md`).
- List them under **Core Conventions (L1)** if they are built-in core files (e.g. `_conventions.md`) or defined in `.prospec.yaml`'s `additional_core_conventions`.
- List the rest under **Load-on-Demand Conventions (L2)**.

2. **Modules**: Fill the module table using the new format:

```
| Module | Keywords | Aliases | Status | Description | Rationale | Depends On |
Expand Down
11 changes: 8 additions & 3 deletions .claude/skills/prospec-knowledge-update/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ NOT by hand-editing the index table (it gets regenerated).
- Preserve each existing module's `category` (do NOT re-guess it); for an ADDED module, derive an ordered `category: [primary, …]` consistent with existing grouping and write it
- Skip if module-map.yaml doesn't exist

#### 3d: prospec/index.md (generated from module-map)
#### 3d: prospec/index.md (generated from module-map and conventions)

The `prospec:auto` block is regenerated from `module-map.yaml` by `updateIndex` using the canonical
column format — you do not hand-fill curated cells:
The `prospec:auto` block contains two auto-generated sections:
1. **Conventions**: Core Conventions (L1) and Load-on-Demand Conventions (L2) lists.
2. **Modules**: The module table regenerated from `module-map.yaml` using the canonical column format.

When updating the auto block manually, **you must preserve and update both sections**.
- **Conventions**: Scan the `prospec/ai-knowledge/` directory for `.md` files (excluding `_index.md`). List them under Core Conventions if they are built-in core files (e.g. `_conventions.md`) or defined in `.prospec.yaml`'s `additional_core_conventions`. Otherwise, list them under Load-on-Demand Conventions.
- **Modules**: Regenerate the table from `module-map.yaml` using the canonical columns. You do not hand-fill curated cells:

```
| Module | Keywords | Aliases | Status | Description | Rationale | Depends On |
Expand Down
34 changes: 18 additions & 16 deletions .claude/skills/prospec-upgrade/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,30 @@ user to run `prospec init` first.
touches an EXISTING one — updating a present doc's format, or enriching a freshly-created doc beyond its
baseline, requires consent. Do that here:

1. **Locate the latest templates** shipped with the installed prospec version. **Source-repo
1. **Retrieve the latest templates** shipped with the installed prospec version. **Source-repo
short-circuit first**: if the project's own `package.json` `name` equals the prospec package name
(`@benwu95/prospec`), the working directory IS the package root — use `.` and skip the resolution
below. This is the dogfooding case; `require.resolve('@benwu95/prospec/package.json')` fails here
because the package is absent from its own `node_modules` and the package has no `exports` field
to enable Node self-referencing. Otherwise resolve the package root (e.g.
`node -e "console.log(require.resolve('@benwu95/prospec/package.json'))"`, or check
`node_modules/@benwu95/prospec`, or a global install via `npm root -g`). If `require.resolve`
fails — a `pnpm link`/globally-linked install keeps the package outside the project's
`node_modules` — derive the root from the running CLI instead: follow `$(which prospec)` (a
shim/symlink to `<package-root>/dist/cli/index.js`) back up to `<package-root>`. All doc
templates are language-neutral `.hbs` files under `src/templates/` (the package ships and
loads them from `src/templates/`, not a root-level `templates/` — `tsc` does not copy `.hbs` into
`dist/`). If the templates cannot be located, say so and SKIP this step (do not guess the latest
format).
(`@benwu95/prospec`), the working directory IS the package root — read the templates directly from
`src/templates/` and skip the CLI call below (dogfooding case). Otherwise, retrieve the template
content directly by running the CLI command:
`prospec print-template <template_path>` (Bash).
For example, to get the template for `init/constitution.md.hbs`, run `prospec print-template init/constitution.md.hbs`.
If the template cannot be retrieved, say so and SKIP this step (do not guess the latest format).
2. **Take the scan scope from Step 1's `Docs inventory:` section** — every line names an init-created
doc, its present/MISSING status, and its source template path. That list is the ONLY scan scope:
do not keep, reconstruct, or fall back to a file list written into this skill. If the report has
no `Docs inventory:` section, the installed CLI predates it (CLI/skill version mismatch) — STOP
this step and tell the user to re-run `prospec upgrade` (which re-syncs this skill to match the
CLI), then re-run `/prospec-upgrade`.
3. **Index enrichment / migration**: `prospec upgrade` back-fills `prospec/index.md` as a BASELINE — its module table is empty. Offer to populate that table from the current modules, and if `prospec/ai-knowledge/_index.md` exists (a project from before the hierarchical-index move), migrate its curated content into that baseline: preserve any user notes in the `<!-- prospec:user-start -->` block, and **copy the curated `Modules` table rows verbatim** into the `prospec:auto` block — the Keywords / Aliases / Rationale / Depends On columns are human-curated and exist nowhere else. Do NOT run `prospec knowledge update` to rebuild the table: it fills only Module / Status / Description from `module-map.yaml` and blanks every curated column to `—`. Delete the old `prospec/ai-knowledge/_index.md` after a successful migration.
3. **Index enrichment / migration**: `prospec upgrade` back-fills `prospec/index.md` as a
BASELINE — its module table is empty. Offer to populate that table from the current modules,
and if `prospec/ai-knowledge/_index.md` exists (a project from before the hierarchical-index
move), migrate its curated content into that baseline: preserve any user notes in the
`<!-- prospec:user-start -->` block, and **copy both the Core/Demand Conventions lists and the
curated `Modules` table rows verbatim** into the `prospec:auto` block — the Keywords / Aliases /
Rationale / Depends On columns are human-curated and exist nowhere else. Do NOT run
`prospec knowledge update` to rebuild the table: it fills only Module / Status / Description from
`module-map.yaml` and blanks every curated column to `—`. Delete the old
`prospec/ai-knowledge/_index.md` after a successful migration.
4. **Back-fill safety net** — `prospec upgrade` already created every doc it could (the report's
`created …` line), so the inventory should show them present. For any doc the inventory **still
marks MISSING** (its back-fill failed), offer to create it by rendering its listed template.
Expand Down Expand Up @@ -164,7 +166,7 @@ Emit one line: `Met N/M | Unmet: <items> | Overall: PASS|WARN|FAIL | Next: <one-
|----------|--------|
| `prospec` CLI unavailable | Stop; tell the user to install/rebuild prospec, then re-run — do not proceed silently |
| `prospec upgrade` reports `ConfigNotFound` | Project not initialized — stop and instruct the user to run `prospec init` first |
| prospec templates cannot be located | Skip Step 2 with a note; still do Step 3 (artifact language) and Step 4 (trigger localization) |
| `prospec print-template` fails to retrieve a template | Skip Step 2 with a note; still do Step 3 (artifact language) and Step 4 (trigger localization) |
| report has no `Docs inventory:` section | CLI/skill version mismatch — skip Step 2 with a note telling the user to re-run `prospec upgrade` (it re-syncs this skill), then re-run `/prospec-upgrade` |
| User declines creating a still-MISSING doc | Leave it uncreated; the next `prospec upgrade` will attempt to back-fill it again |
| `prospec agent sync` reports no configured agent | Stop and instruct the user to re-run `prospec init` or add an agent to `.prospec.yaml` |
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
[![Tests](https://img.shields.io/badge/tests-2092%20passing-success?style=flat-square)](tests/)
[![Tests](https://img.shields.io/badge/tests-2096%20passing-success?style=flat-square)](tests/)
[![Node](https://img.shields.io/badge/node-%3E%3D22.13-brightgreen?style=flat-square&logo=node.js)](https://nodejs.org/)
[![pnpm](https://img.shields.io/badge/pnpm-%3E%3D11-orange?style=flat-square&logo=pnpm)](https://pnpm.io/)

Expand Down Expand Up @@ -483,6 +483,7 @@ the providers' documented prefix-caching semantics, not from a direct before/aft
| `prospec init [options]` | Initialize Prospec project structure (`--language` sets the AI-generated document language; default English) |
| `prospec knowledge init [--depth <n>] [--dry-run] [--raw-scan-only]` | Scan project → generate raw-scan.md + curated skeletons (module-map.yaml / prospec/index.md / _conventions.md, only if absent). `--raw-scan-only` regenerates **only** raw-scan.md (deterministic, no LLM), leaving curated files untouched — run after code changes or before `/prospec-knowledge-generate` to refresh the structure snapshot |
| `prospec agent sync [--cli <name>]` | Sync AI agent configs + generate Skills (reads `skill_triggers` from .prospec.yaml for native-language trigger words) |
| `prospec print-template <path>` | Print the raw content of a bundled template (Offline, Node.js-free template retrieval) |

> **Agent config layout** — `agent sync` writes each detected agent's entry config + Skills:
> - **Claude Code** → `CLAUDE.md` + `.claude/skills/`
Expand Down Expand Up @@ -739,7 +740,7 @@ src/
## Testing

```bash
# Run all tests (2092 tests)
# Run all tests (2096 tests)
pnpm test

# Watch mode
Expand All @@ -752,11 +753,11 @@ pnpm run typecheck
pnpm run lint
```

**Test Coverage**: 2092 tests across 4 categories:
- Unit tests (types + lib + services + cli): 1364 tests
**Test Coverage**: 2096 tests across 4 categories:
- Unit tests (types + lib + services + cli): 1366 tests
- Contract tests (CLI output + Skill format): 647 tests
- Integration tests: 38 tests
- E2E tests: 43 tests
- E2E tests: 45 tests

The suite includes a real `init` + `agent sync` generation contract (`tests/integration/skill-contract.test.ts`) asserting agent-specific reference paths, no dangling references, canonical convention docs, `base_dir`-relative spec paths, and `.agents` convergence.

Expand Down
Loading
Loading