@karmaniverous/stan-core 0.4.1 → 0.4.3
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/dist/cjs/index.js +1 -1
- package/dist/mjs/index.js +1 -1
- package/dist/stan.system.md +113 -1
- package/package.json +21 -20
package/dist/stan.system.md
CHANGED
|
@@ -643,7 +643,8 @@ This is a HARD GATE: the composition MUST fail when a required documentation pat
|
|
|
643
643
|
|
|
644
644
|
- Append‑only logging for Completed:
|
|
645
645
|
- Do NOT modify or rewrite a previously logged Completed item.
|
|
646
|
-
- If follow‑on context is needed (e.g., clarifications/corrections), log it as a new list entry appended at the bottom of the Completed section (i.e., an amendment to the list, not to
|
|
646
|
+
- If follow‑on context is needed (e.g., clarifications/corrections), log it as a new list entry appended at the bottom of the Completed section (i.e., an amendment to the list, not edits to prior items). Keep the original entries intact.
|
|
647
|
+
- These rules are enforced by pre‑send validation (see Response Format). A composition that edits prior Completed entries MUST fail and be re‑emitted as an end‑append only change.
|
|
647
648
|
|
|
648
649
|
- Prune for relevance:
|
|
649
650
|
- Remove Completed items that are not needed to understand the work in flight (“Next up” and any active follow‑through). Retain only minimal context that prevents ambiguity.
|
|
@@ -801,6 +802,57 @@ diff --git a/new/path/to/file/a.ts b/new/path/to/file/a.ts
|
|
|
801
802
|
- When attaching artifacts for chat, prefer attaching `<stanPath>/output/archive.tar` (and `<stanPath>/output/archive.diff.tar` when present). If `--combine` was not used, you may also attach the text outputs individually.
|
|
802
803
|
- Important: Inside any attached archive, contextual files are located in the directory matching the `stanPath` key from `stan.config.*` (default `.stan`). The bootloader resolves this automatically.
|
|
803
804
|
|
|
805
|
+
# Facet overlay (selective views with anchors)
|
|
806
|
+
|
|
807
|
+
This repository supports “facets” — named, selective views over the codebase designed to keep archives small while preserving global context via small anchor documents.
|
|
808
|
+
|
|
809
|
+
Files (under `<stanPath>/system/`)
|
|
810
|
+
- `facet.meta.json` (durable): facet definitions — name → `{ exclude: string[]; include: string[] }`. The `include` list contains anchor files (e.g., README/index docs) that must always be included to preserve breadcrumbs.
|
|
811
|
+
- `facet.state.json` (ephemeral, should always exist): facet activation for the next run — name → `boolean` (`true` = active/no drop; `false` = inactive/apply excludes). Keys mirror `facet.meta.json`.
|
|
812
|
+
|
|
813
|
+
Overlay status for the last run
|
|
814
|
+
- The CLI writes a machine‑readable summary to `<stanPath>/system/.docs.meta.json` in a top‑level `overlay` block that records:
|
|
815
|
+
- `enabled`: whether the overlay was applied this run,
|
|
816
|
+
- per‑run overrides (`activated`/`deactivated`),
|
|
817
|
+
- the final `effective` map used for selection,
|
|
818
|
+
- optional `autosuspended` facets (requested inactive but kept due to missing anchors),
|
|
819
|
+
- optional `anchorsKept` (paths force‑included as anchors).
|
|
820
|
+
- Always read this block when present; treat selection deltas that follow overlay updates as view changes (not code churn).
|
|
821
|
+
|
|
822
|
+
Assistant obligations (every turn)
|
|
823
|
+
1) Read facet files first:
|
|
824
|
+
- Load `facet.meta.json`, `facet.state.json`, and (when present) `.docs.meta.json.overlay`.
|
|
825
|
+
- Treat large selection changes after overlay edits as view expansion.
|
|
826
|
+
2) Design the view (facets & anchors):
|
|
827
|
+
- Propose or refine facet definitions in `facet.meta.json` to carve large areas safely behind small anchors (READMEs, indices, curated summaries).
|
|
828
|
+
- Keep anchor docs useful and current: when code changes public surfaces or invariants, update the relevant anchor docs in the same change set.
|
|
829
|
+
- Do not deactivate a facet unless at least one suitable anchor exists under the area being hidden. If anchors are missing, add them (and record their paths under `include`) before deactivation.
|
|
830
|
+
3) Set the view (next run):
|
|
831
|
+
- Toggle `facet.state.json` (`true`/`false`) to declare the intended default activation for the next run. This is the assistant’s declarative control of perspective across turns.
|
|
832
|
+
4) Response format:
|
|
833
|
+
- Use plain unified diffs to update `facet.meta.json`, anchor docs, and `facet.state.json`. Summarize rationale in the commit message.
|
|
834
|
+
|
|
835
|
+
Effective activation for a run (informational)
|
|
836
|
+
- A facet is effectively active this run if the overlay is enabled and it resolves `true` after applying CLI precedence:
|
|
837
|
+
- `-f` overrides (forces active) > `facet.state.json[name] === true` > `-F` overrides (forces inactive) > default active for facets missing in state.
|
|
838
|
+
- If the overlay is disabled (`--no-facets` or naked `-F`), the state still expresses the next‑run default but does not affect the current run’s selection.
|
|
839
|
+
|
|
840
|
+
Selection precedence (toolchain‑wide; informational)
|
|
841
|
+
- Reserved denials always win; anchors cannot override:
|
|
842
|
+
- `.git/**`
|
|
843
|
+
- `<stanPath>/diff/**`
|
|
844
|
+
- `<stanPath>/patch/**`
|
|
845
|
+
- `<stanPath>/output/archive.tar`, `<stanPath>/output/archive.diff.tar` (and future archive outputs)
|
|
846
|
+
- Binary screening (classifier) remains in effect.
|
|
847
|
+
- Precedence across includes/excludes/anchors:
|
|
848
|
+
- `includes` override `.gitignore` (but not `excludes`).
|
|
849
|
+
- `excludes` override `includes`.
|
|
850
|
+
- `anchors` (from facet meta) override both `excludes` and `.gitignore` (subject to reserved denials and binary screening).
|
|
851
|
+
|
|
852
|
+
Notes
|
|
853
|
+
- Facet files and overlay metadata are included in archives so the assistant can reason about the current view and evolve it. These files do not change Response Format or patch cadence.
|
|
854
|
+
- Keep facets small and purposeful; prefer a few well‑placed anchors over broad patterns.
|
|
855
|
+
|
|
804
856
|
# Facet‑aware editing guard (think beyond the next turn)
|
|
805
857
|
|
|
806
858
|
Purpose
|
|
@@ -850,6 +902,51 @@ Notes
|
|
|
850
902
|
- Turn N: enable the facet + log intent.
|
|
851
903
|
- Turn N+1: deliver the content edits once the target is present in archives.
|
|
852
904
|
|
|
905
|
+
# stanPath discipline (write‑time guardrails)
|
|
906
|
+
|
|
907
|
+
Purpose
|
|
908
|
+
|
|
909
|
+
- Ensure all assistant‑emitted patches and file operations target the correct STAN workspace directory for this repository (the configured `stanPath`).
|
|
910
|
+
- Prevent common errors where patches are written to `stan/…` when the repo uses `.stan/…` (or vice‑versa), or where the literal placeholder `<stanPath>` appears in patch paths.
|
|
911
|
+
|
|
912
|
+
Resolve stanPath first (required)
|
|
913
|
+
|
|
914
|
+
1. Read `stan.config.yml|yaml|json` and extract `stan-core.stanPath`:
|
|
915
|
+
- The value MUST be a non‑empty string; when present, treat it as authoritative.
|
|
916
|
+
2. If the config is not present in the archive, derive from observed layout:
|
|
917
|
+
- Prefer the workspace directory that actually exists in the attached artifacts (e.g., `.stan/system/…`).
|
|
918
|
+
- If both `.stan/…` and `stan/…` appear (unusual), prefer the one that contains `system/stan.system.md` or `system/` docs.
|
|
919
|
+
3. Fallback default (last resort): `.stan`.
|
|
920
|
+
|
|
921
|
+
Write‑time rules (hard)
|
|
922
|
+
|
|
923
|
+
- Always use the resolved `stanPath` for all repo‑relative targets under the STAN workspace:
|
|
924
|
+
- `/<stanPath>/system/**`
|
|
925
|
+
- `/<stanPath>/diff/**`
|
|
926
|
+
- `/<stanPath>/output/**`
|
|
927
|
+
- `/<stanPath>/patch/**`
|
|
928
|
+
- Any other STAN paths (imports, dist, etc.).
|
|
929
|
+
- Never write to `stan/…` unless `stanPath === "stan"`.
|
|
930
|
+
- Never write to `.stan/…` unless `stanPath === ".stan"`.
|
|
931
|
+
- Never leave the literal placeholder `<stanPath>` in any patch path or File Ops argument. Compute concrete POSIX repo‑relative paths before emitting.
|
|
932
|
+
|
|
933
|
+
Pre‑send validation (assistant‑side check)
|
|
934
|
+
|
|
935
|
+
- Fail composition if any Patch path contains the literal `<stanPath>`.
|
|
936
|
+
- Fail composition if any Patch path refers to `stan/…` when `stanPath === ".stan"`, or `.stan/…` when `stanPath === "stan"`.
|
|
937
|
+
- Paths MUST be POSIX (forward slashes) and repo‑relative.
|
|
938
|
+
|
|
939
|
+
Input clarity (optional)
|
|
940
|
+
|
|
941
|
+
- In “Input Data Changes” or the first relevant section of a reply, it is acceptable (not required) to echo the resolved `stanPath` for this run, e.g., “stanPath resolved: `.stan`”. This helps reviewers spot a mismatch early.
|
|
942
|
+
|
|
943
|
+
Notes
|
|
944
|
+
|
|
945
|
+
- These rules apply only to assistant‑emitted content (patches and file ops). The bootloader’s read‑side fallbacks (e.g., probing `.stan` then `stan`) exist for compatibility with older archives and do not affect write‑time discipline.
|
|
946
|
+
- The rules compose with other guards:
|
|
947
|
+
- Reserved denials remain in effect (e.g., do not place content under `/<stanPath>/diff/**`, `/<stanPath>/patch/**`, or archive outputs in `/<stanPath>/output/**`).
|
|
948
|
+
- The facet‑aware editing guard still applies: do not propose edits under an inactive facet this run; enable the facet first and emit patches next turn.
|
|
949
|
+
|
|
853
950
|
# Default Task (when files are provided with no extra prompt)
|
|
854
951
|
|
|
855
952
|
Primary objective — Plan-first
|
|
@@ -1075,6 +1172,13 @@ Before sending a reply, verify all of the following:
|
|
|
1075
1172
|
- Diagnostics replies: Skip Commit Message; listings‑only for the affected files.
|
|
1076
1173
|
6. Nested-code templates (hard gate)
|
|
1077
1174
|
- Any template or example that contains nested fenced code blocks (e.g., the Dependency Bug Report or a patch failure diagnostics envelope) MUST pass the fence‑hygiene scan: compute N = maxInnerBackticks + 1 (min 3), apply that fence, then re‑scan before sending. If any collision remains, STOP and re‑emit. If any check fails, STOP and re‑emit after fixing. Do not send a reply that fails these checks.
|
|
1175
|
+
7. Dev plan “Completed” (append‑only; last)
|
|
1176
|
+
- If `.stan/system/stan.todo.md` is patched:
|
|
1177
|
+
- “Completed” is still the final major section of the document.
|
|
1178
|
+
- Only new lines were appended at the end of “Completed”; no existing lines above the append point were modified or re‑ordered.
|
|
1179
|
+
- Corrections/clarifications, if any, are logged as a new one‑line “Amendment:” entry appended at the bottom (the original entries remain intact).
|
|
1180
|
+
- Lists remain unnumbered.
|
|
1181
|
+
- Violations fail composition.
|
|
1078
1182
|
|
|
1079
1183
|
## Patch policy reference
|
|
1080
1184
|
|
|
@@ -1084,6 +1188,14 @@ Optional Full Listings — Normal replies only: when explicitly requested by the
|
|
|
1084
1188
|
Diagnostics replies (after patch‑failure envelopes) MUST provide Full, post‑patch listings as described above (no patches, union across envelopes, no commit message).
|
|
1085
1189
|
Skip listings for deletions.
|
|
1086
1190
|
|
|
1191
|
+
Dev plan Completed enforcement (pre‑send)
|
|
1192
|
+
- If `<stanPath>/system/stan.todo.md` is patched in this turn, enforce late‑append semantics for the “Completed” section:
|
|
1193
|
+
- “Completed” MUST remain the final major section of the document.
|
|
1194
|
+
- Only append new lines at the end of “Completed”. Do NOT modify existing lines above the final append point (no edits, no insertions, no re‑ordering).
|
|
1195
|
+
- If a correction/clarification is needed for a prior item, append a new one‑line “Amendment:” entry at the bottom instead of editing the original item.
|
|
1196
|
+
- Lists remain unnumbered.
|
|
1197
|
+
- Violations MUST fail composition; re‑emit with an end‑append only change.
|
|
1198
|
+
|
|
1087
1199
|
## File Ops (optional pre‑ops; structural changes)
|
|
1088
1200
|
|
|
1089
1201
|
Use “### File Ops” to declare safe, repo‑relative file and directory operations that run before content patches. File Ops are for structure (moves/renames, creates, deletes), while unified‑diff Patches are for editing file contents.
|
package/package.json
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"url": "https://github.com/karmaniverous/stan-core/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vitest/eslint-plugin": "^1.3.15",
|
|
14
13
|
"diff": "^8.0.2",
|
|
15
14
|
"fast-glob": "^3.3.3",
|
|
16
15
|
"fs-extra": "^11.3.2",
|
|
@@ -19,49 +18,51 @@
|
|
|
19
18
|
"package-directory": "^8.1.0",
|
|
20
19
|
"picomatch": "^4.0.3",
|
|
21
20
|
"yaml": "^2.8.1",
|
|
22
|
-
"zod": "^4.1.
|
|
21
|
+
"zod": "^4.1.12"
|
|
23
22
|
},
|
|
24
23
|
"description": "Engine for STAN — programmatic archiving/diffing/snapshotting, patch application, config loading, selection, and imports staging. No CLI/TTY concerns.",
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@dotenvx/dotenvx": "^1.51.0",
|
|
27
|
-
"@eslint/js": "^9.
|
|
26
|
+
"@eslint/js": "^9.38.0",
|
|
28
27
|
"@rollup/plugin-alias": "^5.1.1",
|
|
29
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
28
|
+
"@rollup/plugin-commonjs": "^28.0.8",
|
|
30
29
|
"@rollup/plugin-json": "^6.1.0",
|
|
31
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
30
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
32
31
|
"@rollup/plugin-terser": "^0.4.4",
|
|
33
|
-
"@rollup/plugin-typescript": "^12.
|
|
32
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
34
33
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
35
34
|
"@types/fs-extra": "^11.0.4",
|
|
36
35
|
"@types/glob-parent": "^5.1.3",
|
|
37
|
-
"@types/node": "^24.
|
|
36
|
+
"@types/node": "^24.9.1",
|
|
38
37
|
"@types/picomatch": "^4.0.2",
|
|
39
|
-
"@vitest/coverage-v8": "^
|
|
38
|
+
"@vitest/coverage-v8": "^4.0.2",
|
|
39
|
+
"@vitest/eslint-plugin": "^1.3.23",
|
|
40
40
|
"auto-changelog": "^2.5.0",
|
|
41
|
-
"
|
|
41
|
+
"cross-env": "^10.1.0",
|
|
42
|
+
"eslint": "^9.38.0",
|
|
42
43
|
"eslint-config-prettier": "^10.1.8",
|
|
43
44
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
44
45
|
"eslint-plugin-prettier": "^5.5.4",
|
|
45
46
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
46
47
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
47
|
-
"happy-dom": "^
|
|
48
|
+
"happy-dom": "^20.0.8",
|
|
48
49
|
"jsonc-eslint-parser": "^2.4.1",
|
|
49
|
-
"knip": "^5.
|
|
50
|
-
"lefthook": "^
|
|
50
|
+
"knip": "^5.66.2",
|
|
51
|
+
"lefthook": "^2.0.0",
|
|
51
52
|
"prettier": "^3.6.2",
|
|
52
53
|
"release-it": "^19.0.5",
|
|
53
54
|
"rimraf": "^6.0.1",
|
|
54
|
-
"rollup": "^4.52.
|
|
55
|
+
"rollup": "^4.52.5",
|
|
55
56
|
"rollup-plugin-dts": "^6.2.3",
|
|
56
57
|
"tar": "^7.5.1",
|
|
57
58
|
"tslib": "^2.8.1",
|
|
58
59
|
"tsx": "^4.20.6",
|
|
59
|
-
"typedoc": "^0.28.
|
|
60
|
-
"typedoc-plugin-mdn-links": "^5.0.
|
|
60
|
+
"typedoc": "^0.28.14",
|
|
61
|
+
"typedoc-plugin-mdn-links": "^5.0.10",
|
|
61
62
|
"typedoc-plugin-replace-text": "^4.2.0",
|
|
62
63
|
"typescript": "^5.9.3",
|
|
63
|
-
"typescript-eslint": "^8.
|
|
64
|
-
"vitest": "^
|
|
64
|
+
"typescript-eslint": "^8.46.2",
|
|
65
|
+
"vitest": "^4.0.2"
|
|
65
66
|
},
|
|
66
67
|
"engines": {
|
|
67
68
|
"node": ">=20"
|
|
@@ -141,15 +142,15 @@
|
|
|
141
142
|
"changelog": "auto-changelog",
|
|
142
143
|
"docs": "typedoc",
|
|
143
144
|
"knip": "knip",
|
|
144
|
-
"lint": "eslint .",
|
|
145
145
|
"lint:fix": "npm run lint -- --fix .",
|
|
146
|
-
"
|
|
146
|
+
"lint": "eslint .",
|
|
147
147
|
"release:pre": "npm run release -- --no-git.requireBranch --github.prerelease --preRelease",
|
|
148
|
+
"release": "dotenvx run -f .env.local -- release-it",
|
|
148
149
|
"relink": "npm uninstall -g @karmaniverous/stan-core && npm run build && npm link",
|
|
149
150
|
"test": "vitest --run --coverage --silent",
|
|
150
151
|
"typecheck": "tsc"
|
|
151
152
|
},
|
|
152
153
|
"type": "module",
|
|
153
154
|
"types": "dist/index.d.ts",
|
|
154
|
-
"version": "0.4.
|
|
155
|
+
"version": "0.4.3"
|
|
155
156
|
}
|