plain-forge 1.0.18 → 1.0.19
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 +15 -8
- package/bin/cli.mjs +53 -24
- package/forge/rules/bullet-continuation.md +59 -0
- package/forge/rules/definitions.md +15 -0
- package/forge/rules/func-specs.md +52 -7
- package/forge/rules/integration-embedded-testing.md +4 -1
- package/forge/rules/linked-resources.md +7 -6
- package/forge/skills/add-acceptance-test/SKILL.md +3 -25
- package/forge/skills/add-concept/SKILL.md +3 -22
- package/forge/skills/add-feature/SKILL.md +71 -67
- package/forge/skills/add-feature/references/checklist.md +38 -0
- package/forge/skills/add-feature/references/phase-0-intent.md +29 -0
- package/forge/skills/add-functional-spec/SKILL.md +3 -23
- package/forge/skills/add-functional-specs/SKILL.md +3 -24
- package/forge/skills/add-implementation-requirement/SKILL.md +4 -23
- package/forge/skills/add-resource/SKILL.md +7 -8
- package/forge/skills/add-test-requirement/SKILL.md +4 -21
- package/forge/skills/analyze-2-func-specs/SKILL.md +10 -10
- package/forge/skills/analyze-func-specs/SKILL.md +10 -10
- package/forge/skills/analyze-if-func-spec-too-complex/SKILL.md +93 -31
- package/forge/skills/break-down-func-spec/SKILL.md +78 -29
- package/forge/skills/create-import-module/SKILL.md +7 -0
- package/forge/skills/create-requires-module/SKILL.md +2 -1
- package/forge/skills/forge-plain/SKILL.md +80 -299
- package/forge/skills/forge-plain/references/checklist.md +66 -0
- package/forge/skills/forge-plain/references/phase-0-intent.md +29 -0
- package/forge/skills/forge-plain/references/phase-1-product.md +40 -0
- package/forge/skills/forge-plain/references/phase-2-tech.md +24 -0
- package/forge/skills/forge-plain/references/phase-3-testing.md +66 -0
- package/forge/skills/forge-plain/references/phase-4-validate-handoff.md +49 -0
- package/forge/skills/init-config-file/SKILL.md +2 -0
- package/forge/skills/init-plain-project/SKILL.md +4 -0
- package/forge/skills/init-plain-project/references/checklist.md +31 -0
- package/forge/skills/load-codeplain-reference/SKILL.md +188 -0
- package/forge/skills/load-plain-reference/SKILL.md +48 -678
- package/forge/skills/load-plain-reference/references/project-model.md +47 -0
- package/forge/skills/load-plain-reference/references/rendering-and-testing.md +57 -0
- package/forge/skills/plain-healthcheck/SKILL.md +2 -2
- package/forge/skills/resolve-spec-conflict/SKILL.md +13 -5
- package/forge/skills/run-codeplain/SKILL.md +1 -1
- package/package.json +1 -1
- package/forge/rules/line-length.md +0 -45
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ***plain project model
|
|
2
|
+
|
|
3
|
+
Use this reference for project structure and language features not owned by a section-specific
|
|
4
|
+
authoring rule.
|
|
5
|
+
|
|
6
|
+
## Source-of-truth model
|
|
7
|
+
|
|
8
|
+
`.plain` files are the source of truth. They describe observable behavior, implementation choices,
|
|
9
|
+
and testing requirements. The renderer produces generated implementation and test artifacts from
|
|
10
|
+
those specifications.
|
|
11
|
+
|
|
12
|
+
## Typical repository structure
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
*.plain # Root specification modules
|
|
16
|
+
template/*.plain # Reusable import modules
|
|
17
|
+
resources/ # Linked text artifacts such as schemas and fixtures
|
|
18
|
+
plain_modules/ # Generated implementation and unit tests
|
|
19
|
+
conformance_tests/ # Generated conformance tests, grouped by module and functionality
|
|
20
|
+
test_scripts/ # Unit, environment-preparation, and conformance runners
|
|
21
|
+
config.yaml # codeplain CLI configuration
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The exact template directory can be configured. Follow the module and linked-resource rules for
|
|
25
|
+
what these directories may contain and how a spec refers to them.
|
|
26
|
+
|
|
27
|
+
## Template inclusion
|
|
28
|
+
|
|
29
|
+
In addition to frontmatter `import`, ***plain supports parameterized template inclusion:
|
|
30
|
+
|
|
31
|
+
```plain
|
|
32
|
+
{% include "python-console-app-template.plain", main_executable_file_name: "my_app.py" %}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Parameters are key-value pairs. Templates access them with `{{ variable_name }}`. Only variable
|
|
36
|
+
substitution is supported; conditionals, loops, and other Liquid features are not available.
|
|
37
|
+
|
|
38
|
+
## Comments
|
|
39
|
+
|
|
40
|
+
Lines beginning with `>` are ignored during rendering:
|
|
41
|
+
|
|
42
|
+
```plain
|
|
43
|
+
> This is a comment in ***plain.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Comments explain the specification to human authors. Do not use comments to carry requirements the
|
|
47
|
+
renderer must implement.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Rendering and testing workflow
|
|
2
|
+
|
|
3
|
+
## Incremental rendering
|
|
4
|
+
|
|
5
|
+
Functional specs render from top to bottom. When rendering one functional spec, the renderer knows
|
|
6
|
+
the previous specs but not future specs. A required module's functional specs also count as previous
|
|
7
|
+
specs according to the module rules.
|
|
8
|
+
|
|
9
|
+
Each functional spec receives its own conformance-test folder. After a new spec renders, the
|
|
10
|
+
renderer runs conformance tests for previous specs to detect regressions. A new failure can mean:
|
|
11
|
+
|
|
12
|
+
1. The generated implementation does not satisfy the specification.
|
|
13
|
+
2. The generated conformance test does not accurately test the specification.
|
|
14
|
+
3. The new and previous specifications conflict.
|
|
15
|
+
|
|
16
|
+
Diagnose which case applies, then correct the `.plain` source. Use the dedicated conflict-analysis
|
|
17
|
+
and debugging skills rather than editing generated output.
|
|
18
|
+
|
|
19
|
+
## Generated artifacts are read-only
|
|
20
|
+
|
|
21
|
+
Everything under `plain_modules/` and `conformance_tests/` is generated. It may be read, executed,
|
|
22
|
+
and debugged, but never edited directly. Apply fixes as follows:
|
|
23
|
+
|
|
24
|
+
- Behavior or implementation/unit-test guidance: edit definitions, functional specs, or
|
|
25
|
+
implementation requirements as appropriate.
|
|
26
|
+
- Conformance-test guidance: edit test requirements.
|
|
27
|
+
- Acceptance-test guidance: edit the acceptance tests nested under their owning functional spec.
|
|
28
|
+
|
|
29
|
+
Re-render after correcting the source specification.
|
|
30
|
+
|
|
31
|
+
## Test-script roles
|
|
32
|
+
|
|
33
|
+
Test scripts are renderer entry points as well as developer utilities:
|
|
34
|
+
|
|
35
|
+
- `run_unittests_<lang>` receives the generated build folder and runs the complete generated unit
|
|
36
|
+
suite. It is self-contained and does not depend on environment preparation.
|
|
37
|
+
- `prepare_environment_<lang>` optionally prepares a reusable system-temporary environment for
|
|
38
|
+
conformance testing once per render.
|
|
39
|
+
- `run_conformance_tests_<lang>` receives the generated build folder and one functionality's
|
|
40
|
+
conformance-test folder. It may run repeatedly during a render.
|
|
41
|
+
|
|
42
|
+
Invoke the corresponding `implement-*-script` skill when creating or changing a test script. Those
|
|
43
|
+
skills own exact staging, cleanup, dependency-installation, shell, and exit-code contracts.
|
|
44
|
+
|
|
45
|
+
## Common invocation shape
|
|
46
|
+
|
|
47
|
+
Run project scripts from the repository root, using the filenames configured for that project:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
./test_scripts/run_unittests.sh plain_modules/<module_name>
|
|
51
|
+
./test_scripts/prepare_environment.sh plain_modules/<module_name>
|
|
52
|
+
./test_scripts/run_conformance_tests.sh \
|
|
53
|
+
plain_modules/<module_name> conformance_tests/<module_name>/<functionality>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The renderer resolves script arguments to absolute paths. Test scripts must treat input directories
|
|
57
|
+
as read-only and stage writes in their designated system-temporary working directory.
|
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
|
|
14
14
|
# Plain Healthcheck
|
|
15
15
|
|
|
16
|
-
Always use the skill `load-plain-reference` to retrieve the ***plain syntax rules — but only if you haven't done so yet.
|
|
16
|
+
Always use the skill `load-codeplain-reference` to retrieve the full `codeplain` CLI reference (every flag, path-resolution rules, `config.yaml` mapping, render banners, exit codes), and the skill `load-plain-reference` to retrieve the ***plain syntax rules — but only if you haven't done so yet. This skill runs `codeplain … --dry-run` and validates every `config.yaml`, so the CLI reference is required.
|
|
17
17
|
|
|
18
18
|
## When to run
|
|
19
19
|
|
|
@@ -54,7 +54,7 @@ For each `config.yaml` in the inventory, check **all** of the following. Collect
|
|
|
54
54
|
- The path is a string ending in `.sh` (macOS/Linux) or `.ps1` (Windows). The extension must match the rest of the project — do not mix `.sh` and `.ps1` in a single config.
|
|
55
55
|
- The referenced file actually exists on disk, resolved the way the renderer resolves it: absolute / `~` paths as-is, relative paths against the **config file's directory** (typically landing under `test_scripts/`). There is no other fallback — the renderer fails fast with a `FileNotFoundError` on a script path that doesn't resolve, so a path that only "works" from some other directory is a failure here.
|
|
56
56
|
- On Unix, the script has the executable bit set (`-x`). If not, that is a fixable failure.
|
|
57
|
-
4. **No mixed stacks per config.** Every script referenced from a single `config.yaml` must target the same language/stack. For example, `backend/config.yaml` should not reference `run_unittests_js.sh`. If a config crosses stacks, that is a failure — the project should have been split into multiple configs per the
|
|
57
|
+
4. **No mixed stacks per config.** Every script referenced from a single `config.yaml` must target the same language/stack. For example, `backend/config.yaml` should not reference `run_unittests_js.sh`. If a config crosses stacks, that is a failure — the project should have been split into multiple configs per the applicable module rules loaded by `load-plain-reference`.
|
|
58
58
|
5. **No dangling fields.** Any `*-script` field whose target file does not exist is a failure.
|
|
59
59
|
6. **`prepare-environment-script` implies `conformance-tests-script`.** A `prepare-environment-script` only makes sense in service of conformance tests — the environment is what those tests run against. If a `config.yaml` declares `prepare-environment-script` but does **not** declare `conformance-tests-script`, that is a failure. Surface it to the user and offer to either (a) invoke `implement-conformance-testing-script` to add the missing script, or (b) remove the `prepare-environment-script` field if it was added in error. Do not auto-pick.
|
|
60
60
|
7. **No orphan scripts.** Every script under `test_scripts/` should be referenced by *some* `config.yaml`. If a script is never referenced, surface it as a **warning** (not a hard failure — the user may be in the middle of authoring).
|
|
@@ -45,14 +45,22 @@ When the requirements truly conflict, choose a resolution strategy:
|
|
|
45
45
|
|
|
46
46
|
**Strategy A: Add detail to disambiguate.** Often the specs aren't contradictory — they're just ambiguous enough that the renderer picks a conflicting interpretation. Adding explicit context to one or both specs eliminates the ambiguity.
|
|
47
47
|
|
|
48
|
-
```
|
|
49
48
|
Before (ambiguous):
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
```plain
|
|
50
|
+
***functional specs***
|
|
51
|
+
|
|
52
|
+
- All :Resource: items are returned.
|
|
53
|
+
|
|
54
|
+
- Only active :Resource: items are returned.
|
|
55
|
+
```
|
|
52
56
|
|
|
53
57
|
After (disambiguated):
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
```plain
|
|
59
|
+
***functional specs***
|
|
60
|
+
|
|
61
|
+
- All :Resource: items are returned when no filter is specified.
|
|
62
|
+
|
|
63
|
+
- When the "active" filter is specified, only active :Resource: items are returned.
|
|
56
64
|
```
|
|
57
65
|
|
|
58
66
|
**Strategy B: Revise the newer spec.** If the new spec introduced the conflict, rewrite it to be compatible with the established behavior from earlier specs.
|
|
@@ -12,7 +12,7 @@ description: >-
|
|
|
12
12
|
|
|
13
13
|
# Run Codeplain
|
|
14
14
|
|
|
15
|
-
Always use the skill `load-plain-reference` to retrieve the ***plain syntax rules — but only if you haven't done so yet.
|
|
15
|
+
Always use the skill `load-codeplain-reference` to retrieve the full `codeplain` CLI reference (every flag, path-resolution rules, `config.yaml` mapping, render banners, exit codes), and the skill `load-plain-reference` to retrieve the ***plain syntax rules — but only if you haven't done so yet. This skill drives the `codeplain` CLI, so the CLI reference is required before launching or resuming any render.
|
|
16
16
|
|
|
17
17
|
## What this skill is
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Line-length and bullet-continuation rules for every section in .plain files
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Rules for line length in `.plain` files
|
|
6
|
-
|
|
7
|
-
These rules apply to **every** section — `***definitions***`, `***implementation reqs***`, `***test reqs***`, `***functional specs***`, `***acceptance tests***` — and to concept explanations alike.
|
|
8
|
-
|
|
9
|
-
## Hard limit: 120 characters per line
|
|
10
|
-
- If a line exceeds 120 characters, split it at a natural clause boundary into nested `- ` bullets
|
|
11
|
-
- Concision is in service of clarity, never the other way around — wordy-but-precise always beats terse-but-ambiguous
|
|
12
|
-
- Prefer short, direct sentences and plain words; if a 10-cent word and a 50-cent word say the same thing, use the 10-cent one
|
|
13
|
-
|
|
14
|
-
## Never use bare continuation lines (invalid ***plain syntax)
|
|
15
|
-
- ***plain syntax requires every line inside a section to be its own list item starting with `- `
|
|
16
|
-
- Indented continuation lines without a leading `- ` are syntactically invalid — they look reasonable to a human reader but the renderer cannot parse them
|
|
17
|
-
- When a sentence is too long, **break it into multiple bullet items**, each on its own line, nested under the parent bullet so the meaning stays grouped
|
|
18
|
-
|
|
19
|
-
## Examples
|
|
20
|
-
|
|
21
|
-
BAD — line is too long:
|
|
22
|
-
|
|
23
|
-
```plain
|
|
24
|
-
- :GatewayWebhook: should hand off :StripeRequest: to :StripeIntegration:.handle(), which returns a list of :EventEnvelope: dicts conforming to the gateway's contract.
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
WRONG SYNTAX (AVOID AT ALL COSTS) — bare indented continuation without a leading `- `:
|
|
28
|
-
|
|
29
|
-
```plain
|
|
30
|
-
- :GatewayWebhook: should hand off :StripeRequest: to :StripeIntegration:.handle(),
|
|
31
|
-
which returns a list of :EventEnvelope: dicts conforming to the gateway's
|
|
32
|
-
contract.
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
GOOD — split at a natural clause boundary into nested `- ` bullets:
|
|
36
|
-
|
|
37
|
-
```plain
|
|
38
|
-
- :GatewayWebhook: should hand off :StripeRequest: to :StripeIntegration:.handle()
|
|
39
|
-
- The method returns a list of :EventEnvelope: dicts.
|
|
40
|
-
- The dicts must conform to the gateway's :EventEnvelope: contract.
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## What never goes inline
|
|
44
|
-
- Long URLs, schema fragments, or example payloads — those belong in `resources/` per [`linked-resources.md`](linked-resources.md)
|
|
45
|
-
- If you find yourself pasting a multi-line block into a spec line, stop and link the file instead
|