@karmaniverous/stan-core 0.5.1 → 0.6.0
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 +29 -21
- package/dist/mjs/index-BZb9wX8Y.js +1 -0
- package/dist/mjs/index-C6LlXnuq.js +1 -0
- package/dist/mjs/index-WrHikElU.js +1 -0
- package/dist/mjs/index.js +1 -1
- package/dist/mjs/typescript-B-hfOtw1.js +6 -0
- package/dist/stan.system.md +387 -437
- package/dist/types/index.d.ts +722 -74
- package/package.json +30 -25
- package/dist/cjs/classifier-ClvtQeTy.js +0 -1
- package/dist/cjs/index-B7xvXIws.js +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/mjs/index-CQYvnMvw.js +0 -1
package/README.md
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# @karmaniverous/stan-core (engine)
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@karmaniverous/stan-core)  <!-- TYPEDOC_EXCLUDE --> [](https://docs.karmanivero.us/stan-core) [](https://github.com/karmaniverous/stan-core/tree/main/CHANGELOG.md)<!-- /TYPEDOC_EXCLUDE --> [](https://github.com/karmaniverous/stan-core/tree/main/LICENSE
|
|
5
|
+
[](https://www.npmjs.com/package/@karmaniverous/stan-core)  <!-- TYPEDOC_EXCLUDE --> [](https://docs.karmanivero.us/stan-core) [](https://github.com/karmaniverous/stan-core/tree/main/CHANGELOG.md)<!-- /TYPEDOC_EXCLUDE --> [](https://github.com/karmaniverous/stan-core/tree/main/LICENSE)
|
|
6
6
|
|
|
7
7
|
This package exposes the STAN engine as a library:
|
|
8
8
|
|
|
9
9
|
- File selection (gitignore + includes/excludes + reserved workspace rules)
|
|
10
10
|
- Archiving: full archive.tar and diff archive.diff.tar (binary screening)
|
|
11
11
|
- Patch engine: worktree‑first git apply cascade with jsdiff fallback
|
|
12
|
-
- File Ops: safe mv/rm/rmdir/mkdirp block as “pre‑ops”
|
|
12
|
+
- File Ops: safe mv/cp/rm/rmdir/mkdirp block as “pre‑ops”
|
|
13
13
|
- Config loading/validation (top‑level `stan-core` in stan.config.yml|json)
|
|
14
14
|
- Imports staging under <stanPath>/imports/<label>/…
|
|
15
|
+
- Imports safety: patch + File Ops refuse to modify <stanPath>/imports/** when the correct stanPath is provided
|
|
15
16
|
- Response‑format validator (optional)
|
|
16
17
|
|
|
17
18
|
For the CLI and TTY runner, see @karmaniverous/stan-cli.
|
|
@@ -25,13 +26,14 @@ pnpm add @karmaniverous/stan-core
|
|
|
25
26
|
|
|
26
27
|
Node: >= 20
|
|
27
28
|
|
|
29
|
+
This package is ESM-only (no CommonJS `require()` entrypoint).
|
|
30
|
+
|
|
28
31
|
## Quick examples
|
|
29
32
|
|
|
30
33
|
Create a full archive (binary‑safe) and a diff archive:
|
|
31
34
|
|
|
32
35
|
```ts
|
|
33
|
-
import { createArchive } from '@karmaniverous/stan-core
|
|
34
|
-
import { createArchiveDiff } from '@karmaniverous/stan-core/stan/diff';
|
|
36
|
+
import { createArchive, createArchiveDiff } from '@karmaniverous/stan-core';
|
|
35
37
|
|
|
36
38
|
const cwd = process.cwd();
|
|
37
39
|
const stanPath = '.stan';
|
|
@@ -57,7 +59,7 @@ import {
|
|
|
57
59
|
detectAndCleanPatch,
|
|
58
60
|
executeFileOps,
|
|
59
61
|
parseFileOpsBlock,
|
|
60
|
-
} from '@karmaniverous/stan-core
|
|
62
|
+
} from '@karmaniverous/stan-core';
|
|
61
63
|
|
|
62
64
|
const cwd = process.cwd();
|
|
63
65
|
|
|
@@ -111,7 +113,7 @@ stan-core:
|
|
|
111
113
|
TypeScript:
|
|
112
114
|
|
|
113
115
|
```ts
|
|
114
|
-
import { loadConfig } from '@karmaniverous/stan-core
|
|
116
|
+
import { loadConfig } from '@karmaniverous/stan-core';
|
|
115
117
|
|
|
116
118
|
const cfg = await loadConfig(process.cwd());
|
|
117
119
|
// cfg has the minimal engine shape:
|
|
@@ -124,7 +126,7 @@ const cfg = await loadConfig(process.cwd());
|
|
|
124
126
|
Stage external imports under <stanPath>/imports/<label>/… before archiving:
|
|
125
127
|
|
|
126
128
|
```ts
|
|
127
|
-
import { prepareImports } from '@karmaniverous/stan-core
|
|
129
|
+
import { prepareImports } from '@karmaniverous/stan-core';
|
|
128
130
|
await prepareImports({
|
|
129
131
|
cwd: process.cwd(),
|
|
130
132
|
stanPath: '.stan',
|
|
@@ -137,14 +139,14 @@ await prepareImports({
|
|
|
137
139
|
Validate assistant responses (optional utility):
|
|
138
140
|
|
|
139
141
|
```ts
|
|
140
|
-
import { validateResponseMessage } from '@karmaniverous/stan-core
|
|
142
|
+
import { validateResponseMessage } from '@karmaniverous/stan-core';
|
|
141
143
|
const res = validateResponseMessage(replyBody);
|
|
142
144
|
if (!res.ok) console.error(res.errors.join('\n'));
|
|
143
145
|
```
|
|
144
146
|
|
|
145
147
|
## API surface
|
|
146
148
|
|
|
147
|
-
Top‑level (via `import '@karmaniverous/stan-core
|
|
149
|
+
Top‑level (via `import '@karmaniverous/stan-core'`):
|
|
148
150
|
|
|
149
151
|
- Archiving/diff/snapshot: `createArchive`, `createArchiveDiff`, `writeArchiveSnapshot`
|
|
150
152
|
- Selection/FS: `listFiles`, `filterFiles`
|
|
@@ -155,7 +157,7 @@ Top‑level (via `import '@karmaniverous/stan-core/stan'`):
|
|
|
155
157
|
|
|
156
158
|
See CHANGELOG for behavior changes. Typedoc site is generated from source.
|
|
157
159
|
|
|
158
|
-
## Selection precedence
|
|
160
|
+
## Selection precedence
|
|
159
161
|
|
|
160
162
|
Core file selection applies in this order:
|
|
161
163
|
|
|
@@ -163,17 +165,19 @@ Core file selection applies in this order:
|
|
|
163
165
|
- `.git/**`, `<stanPath>/diff/**`, `<stanPath>/patch/**`,
|
|
164
166
|
- archive outputs under `<stanPath>/output/…`,
|
|
165
167
|
- binary screening during archive classification.
|
|
166
|
-
- `includes`
|
|
167
|
-
- `excludes` override `includes`.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
-
|
|
174
|
-
- `
|
|
175
|
-
- `
|
|
176
|
-
|
|
168
|
+
- `includes` are additive and can re-include paths ignored by `.gitignore`.
|
|
169
|
+
- `excludes` are hard denials and override `includes`.
|
|
170
|
+
|
|
171
|
+
## Meta archive (context-mode thread opener)
|
|
172
|
+
|
|
173
|
+
When dependency graph mode is enabled, the engine can create a small `archive.meta.tar` (via `createMetaArchive`) intended as a thread opener:
|
|
174
|
+
|
|
175
|
+
- Includes `<stanPath>/system/**` (excluding `<stanPath>/system/.docs.meta.json`)
|
|
176
|
+
- Includes `<stanPath>/context/dependency.meta.json` (required)
|
|
177
|
+
- Includes `<stanPath>/context/dependency.state.json` when present
|
|
178
|
+
- Includes repo-root (top-level) base files selected by current selection config
|
|
179
|
+
- Excludes staged payloads under `<stanPath>/context/{npm,abs}/**` by omission
|
|
180
|
+
|
|
177
181
|
## Environment variables
|
|
178
182
|
|
|
179
183
|
See [Env Vars](./guides/env-vars.md) for a complete list of environment variable switches observed by the engine, tests, and release scripts.
|
|
@@ -189,3 +193,7 @@ stan init # offers to refactor legacy → namespaced; supports --dry-run and ba
|
|
|
189
193
|
## License
|
|
190
194
|
|
|
191
195
|
BSD‑3‑Clause
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Built for you with ❤️ on Bali! Find more great tools & templates on [my GitHub Profile](https://github.com/karmaniverous).
|