@cratis/pi 7.1.5 → 7.2.1
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/README.md +44 -3
- package/package/corpus/agents/coordinator.md +1 -1
- package/package/corpus/agents/orchestrator.md +1 -1
- package/package/corpus/agents/planner.md +1 -1
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/LoadedSkill.ts +9 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/SkillMatch.ts +10 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/SkillTrigger.ts +13 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/ToolName.ts +11 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/index.ts +166 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/skillReads.ts +62 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/skills.ts +72 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/standDown.ts +48 -0
- package/package/corpus/harnesses/pi/extensions/cratis-path-guidance/touchedPaths.ts +52 -0
- package/package/corpus/harnesses/pi/extensions/cratis-rules/index.ts +6 -237
- package/package/corpus/harnesses/pi/extensions/shared/AiConfiguration.ts +8 -0
- package/package/corpus/harnesses/pi/extensions/shared/ManagedRule.ts +13 -0
- package/package/corpus/harnesses/pi/extensions/shared/corpusRoot.ts +12 -0
- package/package/corpus/harnesses/pi/extensions/shared/frontmatter.ts +31 -0
- package/package/corpus/harnesses/pi/extensions/shared/globs.ts +62 -0
- package/package/corpus/harnesses/pi/extensions/shared/rules.ts +98 -0
- package/package/corpus/harnesses/pi/extensions/shared/skillFrontmatter.ts +9 -0
- package/package/corpus/harnesses/pi/extensions/shared/skillSelection.ts +67 -0
- package/package/corpus/prompts/ship-changes.prompt.md +19 -4
- package/package/corpus/rules/pull-requests.md +72 -10
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +3 -0
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +3 -0
- package/package/corpus/skills/cratis-documentation-writing/SKILL.md +5 -3
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +2 -0
- package/package/corpus/skills/cratis-release-notes/SKILL.md +44 -13
- package/package/corpus/skills/cratis-release-notes/verification.json +4 -1
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +2 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +3 -0
- package/package/corpus/skills/cratis-technical-examples/SKILL.md +2 -0
- package/package.json +2 -1
- package/src/index.ts +11 -0
|
@@ -4,19 +4,81 @@ applyTo: "**/*"
|
|
|
4
4
|
|
|
5
5
|
# How to Do Pull Requests
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## The description is the release note
|
|
8
8
|
|
|
9
|
-
**The description is the release
|
|
9
|
+
**The PR description is published verbatim as the GitHub release. In repositories released by `cratis/release-action`, it also closes every issue written as `(#n)`; elsewhere, follow the repository's own release and issue-closing process.** Write the note the person upgrading should read, not a development write-up. The same contract applies to release notes typed into a manual workflow run or written straight into a release. Where it is installed, the `verify-release-notes` check enforces it on every PR into the default branch that carries exactly one of `major`/`minor`/`patch` (it re-runs when the label is added); it skips `no-release` and unlabelled PRs, which should still be written this way because any of them may become releasable. `release-action` does not run for a `no-release` PR, so `(#n)` closes nothing there. Editing the description re-runs the check. HTML comments are not shown on the release page and the check ignores them for headings, keywords and placeholders, but a `(#n)` inside a comment still closes the issue (`release-action` skips only fenced and inline code) and the check fails it, so never put an issue reference in a comment. The template's own comment can stay: its `(#123)` examples are inline code.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Allowed shape
|
|
12
12
|
|
|
13
|
-
- Follow the repository's pull request template (`.github/pull_request_template.md`).
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
13
|
+
- Follow the repository's pull request template (`.github/pull_request_template.md`) within this contract.
|
|
14
|
+
- An optional summary, first, only when one cohesive theme spans the bullets: **either** a `## Summary` section (short, user-facing prose) **or** one unheaded lead paragraph (1–3 sentences), never both. `Summary` is a level-2 heading; `# Summary` is the wrong level. No bullets before the first section.
|
|
15
|
+
- Then only these `##` sections, each at most once, in this order after any `## Summary`: `## Added`, `## Changed`, `## Fixed`, `## Removed`, `## Security`, `## Deprecated`. Keep only the sections that have bullets: a section holding only prose, a code example or `None.` fails the check, so delete it. `###` sub-headings inside a section are fine unless they use a forbidden name; inside a section even `### Added` is only a sub-heading, and a section itself is always level 2.
|
|
16
|
+
- A `major`/`minor`/`patch` PR needs at least one bullet under an allowed section.
|
|
17
|
+
- Bullets are short, self-contained and user-facing: what a consumer compiles against, runs or observes. A user-visible fix may add one sentence of root cause or regression guard, stated as observable behavior. Credit an external contributor by name or handle, unless they asked not to be named.
|
|
18
|
+
- Breaking changes and upgrade actions are bullets in `## Changed` or `## Removed` that state the action. A longer migration story goes in the docs, linked by absolute URL.
|
|
19
|
+
- Do not list internal plumbing (storage, converters, gRPC internals, specs, file lists, refactor narration).
|
|
20
|
+
|
|
21
|
+
### Issue references
|
|
22
|
+
|
|
23
|
+
| Write | Meaning |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `(#351)` at the **end of the bullet that delivers it** | Delivered: in a repository released by `cratis/release-action`, it closes it at release |
|
|
26
|
+
| `(part of #351)` or prose `see #351` | Related, partial or follow-up: never closes |
|
|
27
|
+
| `Cratis/Repo#351` | Other repository: never closed |
|
|
28
|
+
| one `(#351)` per issue, never `(#351, #352)` | `(#351, #352)` closes nothing: write `(#351) (#352)` |
|
|
29
|
+
|
|
30
|
+
- Nothing but more issue references (also `(part of #n)`, `(see #n)` and `(Cratis/Repo#n)`), closing emphasis, `<br>` and sentence punctuation (a `:` may introduce nested bullets) may follow the delivering `(#n)`. Write one `(#n)` per issue: release-action only matches `(#n)`, so `(#56, #57)` closes nothing; write `(#56) (#57)`.
|
|
31
|
+
- Never use a linking or closing keyword before a number, anywhere: `Close`, `Closes`, `Closed`, `Fix`, `Fixes`, `Fixed`, `Resolve`, `Resolves`, `Resolved`, `Refs`, `Ref`, `References`, also as `Keyword: #n`, with `owner/repo#n`, followed by an issue URL, and wrapped in bold, italics or a link (`**Closes** #n`, `Closes [#n](url)`, `[Closes #n](url)`, and `[Closes](url)` where the link starts a clause). A `Refs #93` line closes nothing and is not a delivery marker: write `(#93)` at the end of the delivering bullet, or `(part of #93)` if it must stay open.
|
|
32
|
+
- Comment on or close an issue when the user's request includes that effect; otherwise prepare a bounded post-merge disposition without performing it. In repositories released by `cratis/release-action`, a delivered `(#n)` is closed by release-action at release, so do not close it by hand; for a `no-release` PR release-action does not run, so any disposition follows this same rule. Elsewhere, follow the repository's own release and issue-closing process.
|
|
33
|
+
- Use a bare `(#n)` only for an issue this PR fully delivers. No issue means no reference. Never use a placeholder such as `(#issue)` or the template's `(#123)`, and verify every number exists in the right repository; never guess.
|
|
34
|
+
|
|
35
|
+
### Forbidden anywhere outside code
|
|
36
|
+
|
|
37
|
+
- **Headings** (any level, also written as HTML `<h2>`, `<b>`, `<i>` or a possibly multi-line `<summary>`, or as an `*italic*` line; a heading line is checked like any other, so a keyword, relative link or `(#n)` in one fails too) other than a first `## Summary`, such as Overview, Description, What, Why, How, Context, Changes, What changed, Test plan, Testing, Tests, Verification, Verified, Validation, Quality, Review, Notes, Notes for reviewers, Limitations, Known follow-up, Acceptance, Details, and any `#`/`##` heading not in the allowed list.
|
|
38
|
+
- **Review, verification, testing and provenance notes**: `Review:`, `Reviewed:`, a stand-alone `Reviewed by` line, `Verification:`, `Tested:`, `Testing:`, `Validation:` lines that stand alone or report a result (`Tests: 400 passed`, `Review: approved`); same-provider, cross-provider, Opus-only or Anthropic-only review remarks; the review workflow having passed, returned or run; CI or gate results (`CI green`, `all tests passed`); and a line stating which agent or model wrote the description (`Generated with Claude Code`, `Co-Authored-By:`). A bullet that describes a product change and only mentions review, validation, tests or an AI model (`- Validation: rules now apply to commands (#3)`, `- Reviewed by status is now shown on the dashboard (#4)`) is fine: inside a bullet, a summary or the lead paragraph the check reads a note only when it ends the clause (`- Cross-provider review pending`).
|
|
39
|
+
- **Internal state** that is not a consumer change (for example "npm publication remains disabled").
|
|
40
|
+
- **Relative links** (`](Documentation/x.md)`, `](./x)`, `](Source/...)`): they 404 on the release page. Use `https://github.com/Cratis/<Repo>/blob/main/<path>`, a `#anchor` or `mailto:`.
|
|
41
|
+
- **Placeholders and transcripts**: template text, empty sections, Copilot "Original prompt" blocks, agent transcripts.
|
|
42
|
+
|
|
43
|
+
Reviewer-facing information (test plan, verification, review provenance, notes for reviewers) goes in a **PR comment**, never the description.
|
|
44
|
+
|
|
45
|
+
### Bad to good
|
|
46
|
+
|
|
47
|
+
Bad (Cratis/Arc.TypeScript v0.48.0 as first published, bullets abridged):
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
Arc can now construct Chronicle reactors and reducers through its own dependency injection, one scope per delivered batch, as an opt-in preview. npm publication remains disabled.
|
|
51
|
+
|
|
52
|
+
## Added
|
|
53
|
+
|
|
54
|
+
- Preview option `withChronicle({ ..., activateArtifactsInScopes: true })` ... (#93)
|
|
55
|
+
|
|
56
|
+
See [Activate reactors and reducers in Arc scopes](Documentation/chronicle/reactors/scoped-activation.md).
|
|
57
|
+
|
|
58
|
+
Review: Opus-only (same-provider) review.
|
|
59
|
+
|
|
60
|
+
Refs #93
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Good (as corrected):
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
Arc can now construct Chronicle reactors and reducers through its own dependency injection, one scope per delivered batch, as an opt-in preview.
|
|
67
|
+
|
|
68
|
+
## Added
|
|
69
|
+
|
|
70
|
+
- Preview option `withChronicle({ ..., activateArtifactsInScopes: true })` ... See [Activate reactors and reducers in Arc scopes](https://github.com/Cratis/Arc.TypeScript/blob/main/Documentation/chronicle/reactors/scoped-activation.md). (part of #93)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
"npm publication remains disabled" is internal status, the link was relative (it 404s on the release page), the review line is provenance for reviewers, and `Refs #93` is a keyword line. #93 was only partly delivered by this release, so its bullets say `(part of #93)`; `(#93)` would have closed it.
|
|
74
|
+
|
|
75
|
+
### Before you create or edit a PR
|
|
76
|
+
|
|
77
|
+
1. Read the body against the forbidden list and the issue table above; delete every hit and verify every issue number.
|
|
78
|
+
2. Sections in order, none empty, at most one summary form; every bullet user-facing.
|
|
79
|
+
3. Test plan, verification and review notes are in a PR comment.
|
|
80
|
+
|
|
81
|
+
If `verify-release-notes` fails, fix it by editing the description, not by pushing code.
|
|
20
82
|
|
|
21
83
|
## Commits
|
|
22
84
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
name: cratis-application-react-specifications
|
|
3
3
|
description: Write specifications for the React and TypeScript surface of a Cratis application slice — view models, helpers, command orchestration, and narrow component behavior — using Vitest with Mocha-style describe/it, Sinon, and the Chai should interface. Use when adding or changing frontend behavior in an application that consumes Cratis. Do not use for backend scenarios or for specifications inside a Cratis framework package.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/for_*/**/*.ts"
|
|
7
|
+
- "**/for_*/**/*.tsx"
|
|
5
8
|
---
|
|
6
9
|
|
|
7
10
|
# Cratis application React specifications
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
name: cratis-application-slice-specifications
|
|
3
3
|
description: Specify the backend behavior of an event-sourced Cratis application slice with the in-process scenario family — CommandScenario, EventScenario, ReadModelScenario and ReactorScenario — including what to cover for each slice type and where the specification files live. Use when adding or changing backend behavior in an application built on Cratis. Do not use for framework library specifications and do not use for frontend behavior.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/when_*/**/*.cs"
|
|
7
|
+
- "**/for_*/**/*.cs"
|
|
5
8
|
---
|
|
6
9
|
|
|
7
10
|
# Cratis application slice specifications
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
name: cratis-documentation-writing
|
|
3
3
|
description: Plan, write, and improve user-centered Cratis documentation with a clear reader journey and one primary Diátaxis purpose per page. Use for product docs, tutorials, how-to guides, reference, explanations, and documentation reviews. For executable examples use cratis-technical-examples; for release notes use cratis-release-notes. Do not invent APIs or publish content.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/Documentation/**/*.{md,mdx}"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Documentation writing
|
|
@@ -134,9 +136,9 @@ An AI-drafted narrative is a first draft, not a finished page. Give the model
|
|
|
134
136
|
the reader, the scenario, the terminology and the source evidence up front;
|
|
135
137
|
then revise the result against that evidence and the
|
|
136
138
|
**cratis-writing-voice-and-cadence** constructions before it ships. Tell the
|
|
137
|
-
reviewer the narrative was AI-drafted (in the review request or
|
|
138
|
-
message,
|
|
139
|
-
prose, not only as a diff.
|
|
139
|
+
reviewer the narrative was AI-drafted (in the review request, a PR comment or
|
|
140
|
+
the commit message, never in the PR description, which is published as the
|
|
141
|
+
release note) so they read it as prose, not only as a diff.
|
|
140
142
|
|
|
141
143
|
For machine-readable delivery and retrieval checks, use
|
|
142
144
|
**cratis-llm-friendly-documentation**; publishing `llms-full.txt` alone does
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
name: cratis-engineering-docs-authoring
|
|
3
3
|
description: Draft accurate Cratis product or engineering documentation once the reader's goal, owning source, and product evidence are known. Use for tutorials, how-to guides, explanations, and references; use the owning repository's navigation and visual QA workflows for placement and rendering.
|
|
4
4
|
license: LICENSE
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/Documentation/**/*.{md,mdx}"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Cratis documentation authoring
|
|
@@ -20,10 +20,10 @@ required to draft notes.
|
|
|
20
20
|
Before writing, identify product, tag or candidate version, previous version,
|
|
21
21
|
artifact/package names, supported platforms, and the audience. Inventory
|
|
22
22
|
observable changes from the diff, specs, linked issues/PRs, and authoritative
|
|
23
|
-
product source at that revision. A PR description
|
|
24
|
-
release notes in a Cratis repository; follow its current template and
|
|
25
|
-
that behavior before drafting. Do not turn
|
|
26
|
-
about shipped behavior.
|
|
23
|
+
product source at that revision. A PR description is published verbatim as
|
|
24
|
+
release notes in a Cratis repository; follow its current template and the
|
|
25
|
+
pull-request contract, and confirm that behavior before drafting. Do not turn
|
|
26
|
+
an unreleased draft into a claim about shipped behavior.
|
|
27
27
|
|
|
28
28
|
For each change, ask: who uses this path, what happened before, what happens
|
|
29
29
|
now, is action required, and how would they notice? Check changed defaults,
|
|
@@ -42,15 +42,29 @@ one to add weight.
|
|
|
42
42
|
|
|
43
43
|
## Write for the right channel
|
|
44
44
|
|
|
45
|
-
- **Exact-version release note (GitHub/PR):**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
- **Exact-version release note (GitHub/PR):** in a Cratis repository this is
|
|
46
|
+
the merged PR description, published verbatim, so it follows the contract in
|
|
47
|
+
[pull-requests.md](../../rules/pull-requests.md), which holds the full
|
|
48
|
+
rules. The ones most often broken: no development write-up (no Overview,
|
|
49
|
+
Verification or Test plan headings, no review or provenance notes; those go
|
|
50
|
+
in a PR comment); `(#n)` at the end of the bullet that delivers an issue and
|
|
51
|
+
`(part of #n)` for anything that stays open (in repositories released by
|
|
52
|
+
`cratis/release-action`, `(#n)` is what closes the issue), never `Closes`, `Fixes` or
|
|
53
|
+
`Refs` before a number (also in bold or a link), and no issue reference
|
|
54
|
+
inside an HTML comment, which still closes the issue; and absolute
|
|
55
|
+
`https://` links only. Sections are in
|
|
56
|
+
a fixed order (Added, Changed, Fixed, Removed, Security, Deprecated); within
|
|
57
|
+
a section, put changes requiring action first, then new capabilities and
|
|
58
|
+
fixes. State impact and the user's next action in plain language: state an
|
|
59
|
+
upgrade action in its `## Changed` or `## Removed` bullet (a first
|
|
60
|
+
`## Summary` section or an unheaded lead paragraph, not both, may mention it
|
|
61
|
+
too). Do not list internal
|
|
62
|
+
refactors or specs that change nothing users observe. For a
|
|
63
|
+
user-visible fix, a sentence of root cause and of what now guards against a
|
|
64
|
+
regression, stated as observable behavior rather than a list of specs, is
|
|
65
|
+
user-facing: it tells the reader whether to trust the fix. Credit an
|
|
66
|
+
external contributor by name or handle and say what they did, unless they
|
|
67
|
+
asked not to be named.
|
|
54
68
|
- **Migration guide (durable product docs):** a compact *old behavior → new
|
|
55
69
|
behavior → required action* table for each affected upgrade path, followed
|
|
56
70
|
by source-verified before/after code or commands. Distinguish required
|
|
@@ -75,6 +89,23 @@ boundary that makes a change safe to adopt. One item can follow this shape:
|
|
|
75
89
|
That is a checklist for facts, not a template to repeat word-for-word across
|
|
76
90
|
items. Use descriptive headings, meaningful links, and natural sentence rhythm.
|
|
77
91
|
|
|
92
|
+
## Repair an already-published release
|
|
93
|
+
|
|
94
|
+
Only when asked to fix a release that violates the contract:
|
|
95
|
+
|
|
96
|
+
1. Read the published body (`gh release view TAG --json body`) and the merged
|
|
97
|
+
PR. Keep the facts; remove headings, review and verification lines,
|
|
98
|
+
internal status and closing keywords, and turn relative links into
|
|
99
|
+
`https://` URLs. Do not invent changes, versions or issue numbers.
|
|
100
|
+
2. Publish the corrected text with `gh release edit TAG --notes-file FILE`,
|
|
101
|
+
only when the request authorizes editing that release.
|
|
102
|
+
3. In a repository released by `cratis/release-action`, editing a release
|
|
103
|
+
does not re-run release-action, so an issue that a `(#n)` would have
|
|
104
|
+
closed stays open. For each one, confirm the release
|
|
105
|
+
actually delivered it. Close it by hand with a comment naming the release
|
|
106
|
+
only when the request covers closing issues; otherwise list the issues as a
|
|
107
|
+
proposal. Leave an issue open when the release only partly delivered it.
|
|
108
|
+
|
|
78
109
|
## Verify before handing over
|
|
79
110
|
|
|
80
111
|
1. Reconcile every version, affected range, capability and API against the
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
{ "kind": "skill-contains", "value": "Exact-version release note" },
|
|
7
7
|
{ "kind": "skill-contains", "value": "old behavior → new" },
|
|
8
8
|
{ "kind": "skill-contains", "value": "migration from optional cleanup" },
|
|
9
|
-
{ "kind": "skill-contains", "value": "drafting never authorizes publishing" }
|
|
9
|
+
{ "kind": "skill-contains", "value": "drafting never authorizes publishing" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "`(part of #n)`" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "gh release edit TAG --notes-file" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "does not re-run release-action" }
|
|
10
13
|
]
|
|
11
14
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
name: cratis-specifications-csharp
|
|
3
3
|
description: Write C# specifications with Cratis.Specifications using the Establish/Because/should_ pattern and the for_/when_/and_ folder hierarchy. Use when adding or restructuring C# specs in any Cratis repository, choosing between an isolated unit spec and an in-process scenario spec, or building reusable given/ contexts. Do not use for TypeScript or React specs, and do not use it to decide what a command, projection, or reactor should do.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/for_*/**/*.cs"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Cratis C# specifications
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
name: cratis-specifications-typescript
|
|
3
3
|
description: Write TypeScript specifications in the Cratis BDD style using the given() helper, reusable context classes, Sinon stubbing, and the Chai .should fluent interface. Use when adding or restructuring TypeScript specifications, building a given/ context class, or laying out a for_/when_ specification folder. Do not use for C# specifications, and do not use it to decide what the code under specification should do.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/for_*/**/*.ts"
|
|
7
|
+
- "**/for_*/**/*.tsx"
|
|
5
8
|
---
|
|
6
9
|
|
|
7
10
|
# Cratis TypeScript specifications
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
name: cratis-technical-examples
|
|
3
3
|
description: Design and verify developer-facing code samples, tutorial projects, and documentation snippets against real Cratis APIs. Use when adding or reviewing a runnable example, multi-client snippet, sample app, command/output pair, or migration before/after code. Do not invent API shapes or treat rendering as a compilation check.
|
|
4
4
|
license: MIT
|
|
5
|
+
cratis-hint-paths:
|
|
6
|
+
- "**/Samples/**/*.{cs,ts,tsx}"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Technical examples readers can trust
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/pi",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Configuration-aware Cratis AI integration for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"./src/index.ts",
|
|
42
42
|
"./package/corpus/harnesses/pi/extensions/cratis-hooks/index.ts",
|
|
43
43
|
"./package/corpus/harnesses/pi/extensions/cratis-mcp/index.ts",
|
|
44
|
+
"./package/corpus/harnesses/pi/extensions/cratis-path-guidance/index.ts",
|
|
44
45
|
"./package/corpus/harnesses/pi/extensions/subagent/index.ts"
|
|
45
46
|
]
|
|
46
47
|
}
|
package/src/index.ts
CHANGED
|
@@ -88,6 +88,16 @@ function ruleMatchesConfiguration(path: string, content: string, configuration:
|
|
|
88
88
|
(needsDocumentation && selectedProfiles.includes('cratis/documentation'));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* A rule scoped by `applyTo` to particular files is delivered by the packaged `cratis-path-guidance`
|
|
93
|
+
* extension when such a file is touched, so it stays out of the system prompt. Only rules that apply to
|
|
94
|
+
* every file, or declare no scope, belong there.
|
|
95
|
+
*/
|
|
96
|
+
function isUniversalRule(content: string): boolean {
|
|
97
|
+
const applyTo = (frontmatterValue(content, 'applyTo') ?? '').split(',').map(glob => glob.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
|
|
98
|
+
return applyTo.length === 0 || applyTo.some(glob => ['**', '**/*', '*'].includes(glob));
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
function rules(cwd: string): string {
|
|
92
102
|
const root = join(corpusRoot, 'rules');
|
|
93
103
|
const configurationPath = join(cwd, '.cratis', 'ai.json');
|
|
@@ -99,6 +109,7 @@ function rules(cwd: string): string {
|
|
|
99
109
|
.sort()
|
|
100
110
|
.map(entry => ({ path: join(root, entry), content: readFileSync(join(root, entry), 'utf8') }))
|
|
101
111
|
.filter(rule => !configuration || ruleMatchesConfiguration(rule.path, rule.content, configuration))
|
|
112
|
+
.filter(rule => isUniversalRule(rule.content))
|
|
102
113
|
.map(rule => rule.content)
|
|
103
114
|
.join('\n\n');
|
|
104
115
|
}
|