fascicle 0.1.13
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/CHANGELOG.md +12 -0
- package/LICENSE +201 -0
- package/README.md +224 -0
- package/dist/index.d.ts +1036 -0
- package/dist/index.js +5532 -0
- package/dist/index.js.map +1 -0
- package/package.json +114 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.1.13 — 2026-04-25
|
|
4
|
+
|
|
5
|
+
Initial public release. Fresh git baseline — prior internal commit history is intentionally not carried forward.
|
|
6
|
+
|
|
7
|
+
The v0.1.13 surface:
|
|
8
|
+
|
|
9
|
+
- Composition layer (`@robmclarty/fascicle` / internal `@repo/core`) — 16 primitives (`step`, `sequence`, `parallel`, `branch`, `map`, `pipe`, `retry`, `fallback`, `timeout`, `adversarial`, `ensemble`, `tournament`, `consensus`, `checkpoint`, `suspend`, `scope`/`stash`/`use`), `run`, `run.stream`, `describe`.
|
|
10
|
+
- AI engine layer (`@repo/engine`) — `create_engine(config)` returning a unified `generate` surface over seven Vercel AI SDK provider adapters: Anthropic, OpenAI, Google, OpenRouter, Ollama, LM Studio, and a `claude_cli` subprocess adapter that drives the Claude Code CLI.
|
|
11
|
+
- Adapter packages — `@repo/observability` (trajectory loggers), `@repo/stores` (checkpoint stores).
|
|
12
|
+
- Check pipeline — `pnpm check` / `pnpm check:all` orchestrate types, lint, struct (ast-grep), dead-code (fallow), tests, docs, spell, and opt-in mutation testing (Stryker).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for acceptance of support, warranty, indemnity, or other liability
|
|
168
|
+
obligations and/or rights consistent with this License. However, in
|
|
169
|
+
accepting such obligations, You may act only on Your own behalf
|
|
170
|
+
and on Your sole responsibility, not on behalf of any other
|
|
171
|
+
Contributor, and only if You agree to indemnify, defend, and hold
|
|
172
|
+
each Contributor harmless for any liability incurred by, or claims
|
|
173
|
+
asserted against, such Contributor by reason of your accepting any
|
|
174
|
+
such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Rob McLarty
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Fascicle
|
|
2
|
+
|
|
3
|
+
**`@robmclarty/fascicle` is a TypeScript library for composing agents out of LLM calls, tool calls, and plain functions.** Everything is a `Step<i, o>`; you wire steps together with 16 primitives (`sequence`, `parallel`, `branch`, `retry`, `ensemble`, `checkpoint`, …) and run them as plain values. One `generate` surface fronts seven provider adapters (Anthropic, OpenAI, Google, OpenRouter, Ollama, LM Studio, and a `claude_cli` subprocess that drives Claude Code itself).
|
|
4
|
+
|
|
5
|
+
No framework lifecycle, no ambient state, no decorators. Adapters get passed in per run, not configured globally. `npm install @robmclarty/fascicle` and you have the whole surface.
|
|
6
|
+
|
|
7
|
+
Two layers:
|
|
8
|
+
|
|
9
|
+
- **Composition (`@repo/core` internal / `@robmclarty/fascicle` public)** — 16 primitives (`step`, `sequence`, `parallel`, `branch`, `map`, `pipe`, `retry`, `fallback`, `timeout`, `adversarial`, `ensemble`, `tournament`, `consensus`, `checkpoint`, `suspend`, `scope`/`stash`/`use`) plus `run`, `run.stream`, and `describe`. Every composable unit is a `Step<i, o>`; every composer returns a `Step<i, o>`. Anywhere a step fits, any composition of steps fits.
|
|
10
|
+
- **AI engine (`@repo/engine`)** — `create_engine(config)` returning a unified `generate` surface over seven AI SDK provider adapters: Anthropic, OpenAI, Google, OpenRouter, Ollama, LM Studio, and a `claude_cli` subprocess adapter that drives the Claude Code CLI.
|
|
11
|
+
|
|
12
|
+
`@robmclarty/fascicle` is a thin umbrella package that re-exports both layers so downstream apps can install one thing. Internally, workspace packages use the `@repo/*` prefix; the published name stays `@robmclarty/fascicle`.
|
|
13
|
+
|
|
14
|
+
## Names
|
|
15
|
+
|
|
16
|
+
- **`@robmclarty/fascicle`** — the one thing you install from npm. Bundles the composition primitives and the engine.
|
|
17
|
+
- **`@repo/core`, `@repo/engine`, `@repo/observability`, `@repo/stores`, `@repo/fascicle`** — workspace-only. Contributors see these internally; they are never published.
|
|
18
|
+
|
|
19
|
+
Only `@robmclarty/fascicle` reaches npm. Contributors work against `@repo/*` symlinks inside this pnpm workspace.
|
|
20
|
+
|
|
21
|
+
The monorepo split is an **architectural boundary enforcement mechanism**, not a distribution strategy. `@repo/core` cannot import from adapter packages; `@repo/engine` cannot reach outside its providers; `packages/config/` is the only place allowed to read `process.env`. Keeping those boundaries as separate workspace packages lets the dependency graph, fallow, and the ast-grep rules in `rules/` police them directly. Consumers still see one package.
|
|
22
|
+
|
|
23
|
+
## Layout
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
├── packages/
|
|
27
|
+
│ ├── fascicle/ umbrella: re-exports core + engine
|
|
28
|
+
│ ├── core/ composition layer (16 primitives, run, describe)
|
|
29
|
+
│ ├── engine/ AI engine layer (create_engine, generate)
|
|
30
|
+
│ │ └── src/providers/ anthropic, openai, google, openrouter, ollama, lmstudio, claude_cli
|
|
31
|
+
│ ├── config/ zod-validated env loader; only package that reads process.env
|
|
32
|
+
│ ├── observability/ TrajectoryLogger adapters (noop, filesystem JSONL)
|
|
33
|
+
│ └── stores/ CheckpointStore adapters (filesystem)
|
|
34
|
+
├── examples/ runnable reference harnesses (hello, streaming, ensemble, suspend, ollama)
|
|
35
|
+
├── rules/ ast-grep structural rules
|
|
36
|
+
├── scripts/check.mjs the check orchestrator
|
|
37
|
+
├── .ridgeline/ ridgeline project constraints, taste, and build dirs
|
|
38
|
+
├── docs/ concepts, providers, configuration, cookbook, CLI, harness guide
|
|
39
|
+
├── fallow.toml vitest.config.ts stryker.config.mjs cspell.json sgconfig.yml
|
|
40
|
+
├── AGENTS.md CLAUDE.md agent contracts
|
|
41
|
+
└── package.json scripts + all devDependencies live here
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Runtime dependencies live in the package that imports them; devDependencies live at the root. Cross-package imports go through workspace names (`@repo/core`), not relative paths.
|
|
45
|
+
|
|
46
|
+
## The check contract
|
|
47
|
+
|
|
48
|
+
`pnpm check:all` is the single source of truth for "is this done?". `pnpm check` runs the same pipeline minus the opt-in `mutation` step and is the command to use during iteration.
|
|
49
|
+
|
|
50
|
+
| Check | Tool | Catches |
|
|
51
|
+
| ---------- | -------------------------------- | ------------------------------------------------------------ |
|
|
52
|
+
| `types` | `tsc` | Type errors (ground truth) |
|
|
53
|
+
| `lint` | `oxlint` + `oxlint-tsgolint` | Syntax rules, floating promises, unsafe any, 50+ type-aware rules |
|
|
54
|
+
| `struct` | `ast-grep` | Project-specific structural rules (see `rules/`) |
|
|
55
|
+
| `dead` | `fallow` | Unused exports/files/deps, circular deps, duplication, complexity, boundary violations |
|
|
56
|
+
| `test` | `vitest` + `@vitest/coverage-v8` | Unit test failures and coverage below thresholds |
|
|
57
|
+
| `docs` | `markdownlint-cli2` | Broken markdown |
|
|
58
|
+
| `spell` | `cspell` | Misspellings in source and docs |
|
|
59
|
+
| `mutation` | `stryker` (opt-in) | Tests that pass trivially (run via `pnpm check:all` or `--include mutation`) |
|
|
60
|
+
|
|
61
|
+
Deeper passes on demand:
|
|
62
|
+
|
|
63
|
+
- `pnpm check:all` — full pipeline including Stryker mutation testing
|
|
64
|
+
- `pnpm check --include mutation` — same as `check:all` but via the flag
|
|
65
|
+
- `pnpm check:mutation` — Stryker only (bypasses the orchestrator)
|
|
66
|
+
- `pnpm check:security` — `pnpm audit --audit-level=high`
|
|
67
|
+
- `pnpm check:fix` — auto-fix oxlint and fallow issues where possible
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm install
|
|
73
|
+
pnpm check
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Output lands in `.check/`:
|
|
77
|
+
|
|
78
|
+
- `.check/summary.json` — aggregate result for agents
|
|
79
|
+
- `.check/lint.json`, `.check/dead.json`, `.check/struct.json`, `.check/test.json` — raw per-tool JSON
|
|
80
|
+
- `.check/coverage/` — vitest coverage report
|
|
81
|
+
|
|
82
|
+
## Using the composition layer
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { run, sequence, step } from '@robmclarty/fascicle';
|
|
86
|
+
|
|
87
|
+
const flow = sequence([
|
|
88
|
+
step('a', (n: number) => n + 1),
|
|
89
|
+
step('b', (n: number) => n * 2),
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
const result = await run(flow, 1); // 4
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Inject adapters per run:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { filesystem_logger } from '@repo/observability';
|
|
99
|
+
import { filesystem_store } from '@repo/stores';
|
|
100
|
+
|
|
101
|
+
await run(flow, input, {
|
|
102
|
+
trajectory: filesystem_logger({ output_path: '/tmp/run.jsonl' }),
|
|
103
|
+
checkpoint_store: filesystem_store({ root_dir: '/tmp/checkpoints' }),
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`run.stream(flow, input)` returns `{ events, result }` for observation. See [`packages/core/README.md`](./packages/core/README.md) for the full surface and [`examples/`](./examples/) for runnable references.
|
|
108
|
+
|
|
109
|
+
## Using the engine layer
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { create_engine } from '@robmclarty/fascicle';
|
|
113
|
+
|
|
114
|
+
const engine = create_engine({
|
|
115
|
+
providers: { anthropic: { api_key: process.env.ANTHROPIC_API_KEY! } },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const result = await engine.generate({
|
|
119
|
+
model: 'claude-sonnet-4-5',
|
|
120
|
+
messages: [{ role: 'user', content: 'hello' }],
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
await engine.dispose();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Provider adapters are wired behind optional peer dependencies; install only the ones you use. See [`docs/providers.md`](./docs/providers.md) for the full provider matrix, [`docs/configuration.md`](./docs/configuration.md) for engine config, and [`docs/cli.md`](./docs/cli.md) for the `claude_cli` adapter.
|
|
127
|
+
|
|
128
|
+
## Agent use
|
|
129
|
+
|
|
130
|
+
The contract: **if `pnpm check` exits 0, the work is done. If it exits non-zero, read `.check/summary.json` for which checks failed, then the corresponding tool JSON for diagnostics.**
|
|
131
|
+
|
|
132
|
+
```jsonc
|
|
133
|
+
// .check/summary.json
|
|
134
|
+
{
|
|
135
|
+
"timestamp": "2026-04-20T...",
|
|
136
|
+
"ok": false,
|
|
137
|
+
"total_duration_ms": 4821,
|
|
138
|
+
"checks": [
|
|
139
|
+
{ "name": "types", "ok": true, "exit_code": 0, "duration_ms": 1200, "output_file": null },
|
|
140
|
+
{ "name": "lint", "ok": false, "exit_code": 1, "duration_ms": 340, "output_file": "lint.json" }
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Flags:
|
|
146
|
+
|
|
147
|
+
- `pnpm check --json` — machine-readable to stdout, no human decoration
|
|
148
|
+
- `pnpm check --bail` — stop at the first failure
|
|
149
|
+
- `pnpm check --only types,lint` — run a subset during iteration
|
|
150
|
+
- `pnpm check --skip spell,docs` — skip slow or noisy checks
|
|
151
|
+
|
|
152
|
+
## Working across packages
|
|
153
|
+
|
|
154
|
+
`pnpm check` always runs over the whole workspace — that's the shipping gate. For tighter per-package loops:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pnpm --filter @repo/core test # run one package's tests
|
|
158
|
+
pnpm --filter @repo/engine add zod # add a runtime dep to one package
|
|
159
|
+
pnpm add -w -D typescript@latest # upgrade a root devDependency
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Inter-package deps use the workspace protocol:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pnpm --filter @repo/fascicle add @repo/core --workspace
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## MCP servers
|
|
169
|
+
|
|
170
|
+
`.mcp.json` wires two servers for agent clients (Claude Code / Cursor / Windsurf):
|
|
171
|
+
|
|
172
|
+
- **`fallow`** — structured codebase analysis (`analyze`, `check_changed`, `find_dupes`, `check_health`, `fix_preview`, `fix_apply`, `project_info`). Use during implementation for real-time dead-code and boundary feedback instead of waiting for the final `pnpm check`.
|
|
173
|
+
- **`ast-grep`** — structural code search and rule testing against the YAML rules in `rules/`.
|
|
174
|
+
|
|
175
|
+
Confirm with `claude mcp list`.
|
|
176
|
+
|
|
177
|
+
## Extending
|
|
178
|
+
|
|
179
|
+
**Add a check.** Edit `scripts/check.mjs` and append to `CHECKS`:
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
{
|
|
183
|
+
name: 'agent',
|
|
184
|
+
description: 'agnix: AI config linting',
|
|
185
|
+
command: 'pnpm',
|
|
186
|
+
args: ['exec', 'agnix', '--format', 'json', '.'],
|
|
187
|
+
output_file: 'agent.json',
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Add a structural rule.** Drop a YAML file into `rules/`. Existing rules enforce no classes, no default exports, snake_case exports, no `process.env` outside `@repo/config`, no provider SDK imports outside `packages/engine/src/providers`, no `child_process` outside the `claude_cli` adapter, and several cross-package import boundaries. ast-grep picks new rules up automatically.
|
|
192
|
+
|
|
193
|
+
**Add an architecture boundary.** Edit `fallow.toml`:
|
|
194
|
+
|
|
195
|
+
```toml
|
|
196
|
+
[[boundaries.rules]]
|
|
197
|
+
from = "packages/*/src/**"
|
|
198
|
+
cannotImport = ["../*/src/**"] # no cross-package relative imports; use workspace names
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Add a package.** Create `packages/<name>/package.json` (name `@repo/<name>`, `type: module`, `private: true`, `exports`) and `packages/<name>/src/index.ts`. Run `pnpm install` to wire the symlink. Root `tsconfig.json`, `vitest.config.ts`, `fallow.toml`, `cspell.json`, `stryker.config.mjs`, and `rules/` already glob across `packages/*/src/**`.
|
|
202
|
+
|
|
203
|
+
## Philosophy
|
|
204
|
+
|
|
205
|
+
1. **The check is the contract.** A single command the agent can trust. No hidden CI gates.
|
|
206
|
+
2. **Structured output over stderr chatter.** Every JSON-capable tool is configured to emit JSON. Agents parse structured data, not colorized text.
|
|
207
|
+
3. **The orchestrator is dumb.** It shells out, captures exit codes, and writes files. It does not parse diagnostics.
|
|
208
|
+
4. **Tools, not frameworks.** Each tool is independently swappable. If something better than oxlint ships next year, you change one line in `CHECKS`.
|
|
209
|
+
5. **Step-as-value.** In the composition layer, every unit is a `Step<i, o>` and every composer returns one. Substitutability, introspectability, and no coupling fall out of that one invariant.
|
|
210
|
+
|
|
211
|
+
## Related docs
|
|
212
|
+
|
|
213
|
+
- [AGENTS.md](./AGENTS.md) — universal contract for any coding agent
|
|
214
|
+
- [CLAUDE.md](./CLAUDE.md) — Claude-specific workflow notes
|
|
215
|
+
- [CHANGELOG.md](./CHANGELOG.md) — version history
|
|
216
|
+
- [docs/getting-started.md](./docs/getting-started.md) — install + first flow
|
|
217
|
+
- [docs/concepts.md](./docs/concepts.md) — step-as-value, composition, trajectories
|
|
218
|
+
- [docs/configuration.md](./docs/configuration.md) — engine config, aliases, provider setup
|
|
219
|
+
- [docs/providers.md](./docs/providers.md) — per-provider adapter notes
|
|
220
|
+
- [docs/cli.md](./docs/cli.md) — `claude_cli` subprocess adapter
|
|
221
|
+
- [docs/cookbook.md](./docs/cookbook.md) — worked patterns (retries, fan-out, judges, HITL)
|
|
222
|
+
- [docs/writing-a-harness.md](./docs/writing-a-harness.md) — building a runner around fascicle
|
|
223
|
+
- [packages/core/README.md](./packages/core/README.md) — composition layer surface
|
|
224
|
+
- [.ridgeline/](./.ridgeline/) — project constraints, taste, and ridgeline build history
|