@interf/compiler 0.9.3 → 0.9.5
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 +93 -0
- package/README.md +2 -1
- package/agent-skills/interf-actions/SKILL.md +17 -11
- package/agent-skills/interf-actions/references/cli.md +8 -22
- package/dist/cli/commands/action-input-cli.d.ts +25 -0
- package/dist/cli/commands/action-input-cli.js +73 -0
- package/dist/cli/commands/compile.d.ts +3 -8
- package/dist/cli/commands/compile.js +13 -41
- package/dist/cli/commands/create-method-wizard.d.ts +0 -12
- package/dist/cli/commands/create-method-wizard.js +95 -126
- package/dist/cli/commands/create.d.ts +0 -2
- package/dist/cli/commands/create.js +16 -22
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +16 -1
- package/dist/cli/commands/init.js +40 -53
- package/dist/cli/commands/list.js +1 -1
- package/dist/cli/commands/preparation-action.d.ts +8 -0
- package/dist/cli/commands/preparation-action.js +29 -0
- package/dist/cli/commands/preparation-picker.d.ts +5 -0
- package/dist/cli/commands/preparation-picker.js +36 -0
- package/dist/cli/commands/preparation-selection.js +2 -2
- package/dist/cli/commands/reset.js +15 -4
- package/dist/cli/commands/service-action-flow.d.ts +9 -0
- package/dist/cli/commands/service-action-flow.js +19 -0
- package/dist/cli/commands/source-config-wizard.d.ts +0 -1
- package/dist/cli/commands/source-config-wizard.js +43 -53
- package/dist/cli/commands/status.js +7 -123
- package/dist/cli/commands/test.d.ts +1 -2
- package/dist/cli/commands/test.js +40 -203
- package/dist/cli/commands/web.js +8 -262
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
- package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -16
- package/dist/packages/agents/lib/shells.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +1 -1
- package/dist/packages/compiler/lib/schema.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +0 -1
- package/dist/packages/contracts/lib/schema.js +0 -1
- package/dist/packages/execution/lib/schema.d.ts +0 -7
- package/dist/packages/execution/lib/schema.js +0 -1
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1148 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +134 -0
- package/dist/packages/local-service/action-values.d.ts +1 -22
- package/dist/packages/local-service/action-values.js +1 -30
- package/dist/packages/local-service/client.d.ts +48 -17
- package/dist/packages/local-service/client.js +95 -52
- package/dist/packages/local-service/index.d.ts +8 -5
- package/dist/packages/local-service/index.js +5 -3
- package/dist/packages/local-service/lib/schema.d.ts +302 -292
- package/dist/packages/local-service/lib/schema.js +115 -39
- package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
- package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
- package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
- package/dist/packages/local-service/routes.d.ts +6 -1
- package/dist/packages/local-service/routes.js +7 -2
- package/dist/packages/local-service/run-observability.js +15 -17
- package/dist/packages/local-service/runtime.d.ts +10 -7
- package/dist/packages/local-service/runtime.js +430 -286
- package/dist/packages/local-service/server.js +94 -44
- package/dist/packages/method-package/method-review-paths.d.ts +1 -1
- package/dist/packages/method-package/method-review-paths.js +5 -5
- package/dist/packages/project-model/index.d.ts +1 -0
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/preparation-entries.d.ts +11 -0
- package/dist/packages/project-model/preparation-entries.js +49 -0
- package/dist/packages/project-model/source-config.d.ts +1 -0
- package/dist/packages/project-model/source-config.js +12 -1
- package/dist/packages/testing/lib/schema.d.ts +2 -3
- package/dist/packages/testing/lib/schema.js +2 -3
- package/dist/packages/testing/readiness-check-run.d.ts +3 -3
- package/dist/packages/testing/readiness-check-run.js +12 -17
- package/package.json +5 -24
- package/dist/cli/commands/compile-controller.d.ts +0 -17
- package/dist/cli/commands/compiled-flow.d.ts +0 -25
- package/dist/cli/commands/compiled-flow.js +0 -112
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css +0 -3
- package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +0 -118
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
- /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Interf follows practical release notes: what changed, why it matters, and what
|
|
4
|
+
still needs cleanup. Dates use the local release date.
|
|
5
|
+
|
|
6
|
+
## 0.9.5 - 2026-05-02
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- Made the local service the execution gate for observable work. Prepare runs,
|
|
11
|
+
readiness-check runs, and agent-backed work now route through service-owned
|
|
12
|
+
run resources so CLI and UI see the same status.
|
|
13
|
+
- Centralized user action definitions under the local-service package. UI
|
|
14
|
+
dialogs and CLI flows should render the same TypeScript/Zod-backed action
|
|
15
|
+
contract instead of carrying duplicate labels, prompts, and request fields.
|
|
16
|
+
- Separated structured UI controls from freeform chat. Buttons submit typed
|
|
17
|
+
service requests; chat remains an explicit proposal surface.
|
|
18
|
+
- Tightened Method removal. Removing a Method clears stale saved Preparation
|
|
19
|
+
selections instead of blocking on old references; preparing still requires an
|
|
20
|
+
explicit Method.
|
|
21
|
+
- Expanded smoke coverage around CLI behavior, service-backed actions,
|
|
22
|
+
Method mutations, run visibility, and package boundary rules.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Removed the UI path that pasted prepare prompts into chat instead of running
|
|
27
|
+
the typed prepare action.
|
|
28
|
+
- Fixed action dialog/menu event handling so form input focus does not close the
|
|
29
|
+
parent row menu.
|
|
30
|
+
- Fixed service and CLI behavior that could hide observable work in package
|
|
31
|
+
calls instead of a visible run.
|
|
32
|
+
|
|
33
|
+
### Still To Watch
|
|
34
|
+
|
|
35
|
+
- `apps/compiler-ui/app/page.tsx` and `src/packages/local-service/runtime.ts`
|
|
36
|
+
are still too large. Future cleanup should split them only when it reduces
|
|
37
|
+
reader trace depth or state in memory.
|
|
38
|
+
- Some lower-level tests and package helpers still call package primitives
|
|
39
|
+
directly. That is correct for unit tests and package oracles; it is wrong for
|
|
40
|
+
user-visible prepare/check/Method actions.
|
|
41
|
+
- Any remaining compatibility path for old product nouns should be listed for
|
|
42
|
+
founder review before removal. Do not add new compatibility shims unless the
|
|
43
|
+
current product contract requires them.
|
|
44
|
+
|
|
45
|
+
## 0.9.4 - 2026-05-01
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Kept setup separate from prepare runs. Creating or editing a Preparation is a
|
|
50
|
+
deterministic config action; preparing files is a visible run.
|
|
51
|
+
- Simplified retry behavior by removing the partial stage-retry path. A prepare
|
|
52
|
+
run should be understandable from one run record and one filesystem state.
|
|
53
|
+
- Stabilized trace rendering for active and failed runs, including failed-stage
|
|
54
|
+
layout and pending-run navigation.
|
|
55
|
+
- Improved portable-context status and expected-output display so the UI
|
|
56
|
+
distinguishes current output from Method-planned output.
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- Repaired missing local Method packages before prepare runs when the selected
|
|
61
|
+
Method can be reseeded from the current Interf Workspace.
|
|
62
|
+
- Fixed packaged UI availability after local builds.
|
|
63
|
+
- Accepted relative portable-context wikilinks and markdown-source summary links
|
|
64
|
+
during validation.
|
|
65
|
+
- Stabilized the publish smoke gate environment.
|
|
66
|
+
|
|
67
|
+
## 0.9.3 - 2026-04-30
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- Completed the public Preparation/Method vocabulary pass across CLI, service,
|
|
72
|
+
UI state, runtime records, docs, and tests.
|
|
73
|
+
- Removed legacy 0.8 compatibility surfaces and project-model compiler shims
|
|
74
|
+
that forced readers to translate old product terms.
|
|
75
|
+
- Moved package boundaries toward one owner per primitive: contracts for shared
|
|
76
|
+
schemas, project-model for Interf Workspace config, compiler for portable
|
|
77
|
+
context writes, testing for readiness-check runs, and local-service for read
|
|
78
|
+
models.
|
|
79
|
+
- Added the source reader map in `src/README.md` so contributors can trace
|
|
80
|
+
`interf compile` without grepping through the whole repo first.
|
|
81
|
+
- Expanded public CLI smoke coverage and release acceptance checks.
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
- Fixed release readiness blockers around CLI parsing, status output,
|
|
86
|
+
verification, UI layout, executor acceptance, and package metadata.
|
|
87
|
+
- Served Interf Compiler UI from the static export used by `interf web`.
|
|
88
|
+
|
|
89
|
+
### Cleanup Principle
|
|
90
|
+
|
|
91
|
+
Every 0.9 patch is judged by one rubric: reduce the number of files a reader
|
|
92
|
+
must trace, or reduce the number of facts a reader must hold in memory. If a
|
|
93
|
+
change does neither, it should not be part of the cleanup.
|
package/README.md
CHANGED
|
@@ -244,7 +244,7 @@ A maintained public test example in this repo stores them like this:
|
|
|
244
244
|
## Useful Commands
|
|
245
245
|
|
|
246
246
|
- `interf` or `interf init` — set up the Interf Workspace or manage Preparations
|
|
247
|
-
- `interf web` — start Interf Compiler UI and the local
|
|
247
|
+
- `interf web` — start Interf Compiler UI and the local service for this Workspace
|
|
248
248
|
- `interf compile` — build portable context agents can use
|
|
249
249
|
- `interf test` — run readiness checks against source files and/or portable context
|
|
250
250
|
- `interf create method` — draft a reusable Method
|
|
@@ -252,6 +252,7 @@ A maintained public test example in this repo stores them like this:
|
|
|
252
252
|
|
|
253
253
|
## Maintainer Docs
|
|
254
254
|
|
|
255
|
+
- [CHANGELOG.md](./CHANGELOG.md) - 0.9 release notes and cleanup status
|
|
255
256
|
- [src/packages/README.md](./src/packages/README.md) - package boundaries
|
|
256
257
|
- [src/cli/README.md](./src/cli/README.md) - CLI orchestration
|
|
257
258
|
- [apps/compiler-ui/README.md](./apps/compiler-ui/README.md) - Interf Compiler UI
|
|
@@ -7,7 +7,7 @@ description: Use when an agent needs to operate Interf from natural language: in
|
|
|
7
7
|
|
|
8
8
|
Interf prepares data for agent work. It runs locally, processes source files, shows evidence that the data is ready, and writes portable context: a local folder with verifiable outputs agents can use.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The Interf local service owns the typed action contract and run observability. For agents, the installed CLI is the supported facade over that contract. Outside Interf Compiler UI freeform proposal mode, inspect the current command surface when needed:
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
13
|
interf --help
|
|
@@ -18,32 +18,39 @@ interf doctor
|
|
|
18
18
|
|
|
19
19
|
For command-specific flags, run `interf <command> --help`.
|
|
20
20
|
|
|
21
|
-
In Interf Compiler UI proposal mode, do not run CLI commands. Use `references/cli.md` instead. It is a generated snapshot of the current Interf CLI help and is checked against the built package in the repo test suite.
|
|
21
|
+
In Interf Compiler UI freeform proposal mode, do not run CLI commands. Use `references/cli.md` instead. It is a generated snapshot of the current Interf CLI help and is checked against the built package in the repo test suite.
|
|
22
22
|
|
|
23
23
|
## Operating Rules
|
|
24
24
|
|
|
25
25
|
- Use exact Preparation ids from `interf list` or `interf/interf.json`.
|
|
26
26
|
- Prefer the selected Preparation only when it is explicit or there is one obvious Preparation.
|
|
27
27
|
- Do not invent readiness checks, Method ids, paths, or executor names.
|
|
28
|
-
-
|
|
28
|
+
- Interf CLI actions should run through a connected local service so status and runs are visible in Interf. If the service is not running, tell the user to start `interf web` for the Workspace before running write actions.
|
|
29
|
+
- Do not call the local HTTP API directly unless Interf explicitly gives an API integration task. Use CLI commands for normal agent work.
|
|
29
30
|
- Propose the command first and wait for approval before running commands that write files, start runs, create Method packages, build portable context, or run readiness checks.
|
|
30
31
|
- If the request names an existing Preparation and asks to prepare, build, or refresh portable context, use `interf compile --preparation <name>`. The saved Preparation and selected Method are the source of truth.
|
|
31
32
|
- If the request is ambiguous, ask one concise clarification instead of guessing.
|
|
32
33
|
|
|
33
|
-
## Interf Compiler UI Proposal Mode
|
|
34
|
+
## Interf Compiler UI Freeform Proposal Mode
|
|
34
35
|
|
|
35
|
-
When Interf Compiler UI asks for a proposal, do not run CLI commands. Write a
|
|
36
|
+
When Interf Compiler UI asks for a proposal, do not run CLI commands. Write a
|
|
37
|
+
single JSON object to the requested output path. Structured UI controls call the
|
|
38
|
+
local service directly; this mode is only for freeform planning.
|
|
36
39
|
|
|
37
40
|
Use these action types:
|
|
38
41
|
|
|
39
|
-
- `preparation-setup`
|
|
40
42
|
- `compile`
|
|
41
43
|
- `test`
|
|
42
44
|
- `readiness-check-draft`
|
|
43
45
|
- `method-authoring`
|
|
46
|
+
- `method-improvement`
|
|
44
47
|
- `clarification`
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
Do not propose deterministic Preparation or Method mutations from this mode.
|
|
50
|
+
Create, select, duplicate, and remove actions go through direct service
|
|
51
|
+
endpoints in the UI or through the CLI for agent work. If freeform chat asks for
|
|
52
|
+
one of those actions, return `clarification` and tell the caller to use the
|
|
53
|
+
direct page control or CLI.
|
|
47
54
|
|
|
48
55
|
Use `compile` when the user asks to prepare, build, or refresh portable context for an existing Preparation. Do not ask what "prepare" means when the Preparation exists. Set `preparation` to the selected or mentioned Preparation id. CLI equivalent: `interf compile --preparation <name>`.
|
|
49
56
|
|
|
@@ -57,17 +64,16 @@ Return this shape:
|
|
|
57
64
|
|
|
58
65
|
```json
|
|
59
66
|
{
|
|
60
|
-
"action_type": "
|
|
67
|
+
"action_type": "compile",
|
|
61
68
|
"preparation": "preparation-id",
|
|
62
69
|
"method": "method-id if applicable",
|
|
63
70
|
"values": {
|
|
64
|
-
"
|
|
65
|
-
"about": "agent work this source folder should support"
|
|
71
|
+
"mode": "both if applicable"
|
|
66
72
|
},
|
|
67
73
|
"title": "short approval card title",
|
|
68
74
|
"summary": "one sentence describing what will run",
|
|
69
75
|
"assistant_message": "concise explanation for the user",
|
|
70
|
-
"command_preview": "interf
|
|
76
|
+
"command_preview": "interf compile --preparation preparation-id"
|
|
71
77
|
}
|
|
72
78
|
```
|
|
73
79
|
|
|
@@ -18,7 +18,7 @@ Commands:
|
|
|
18
18
|
interf list List saved Preparations in this Source Folder
|
|
19
19
|
interf status Show deterministic health for the Portable Context agents use
|
|
20
20
|
interf verify <check> [stageId] Run deterministic verification checks
|
|
21
|
-
interf web Start Interf UI and the local Interf
|
|
21
|
+
interf web Start Interf Compiler UI and the local Interf service
|
|
22
22
|
interf reset <scope> Reset generated Portable Context state while keeping source files and the local Method package
|
|
23
23
|
|
|
24
24
|
Options:
|
|
@@ -49,12 +49,8 @@ Positionals:
|
|
|
49
49
|
type Type to create (`preparation` or `method`) [string]
|
|
50
50
|
|
|
51
51
|
Options:
|
|
52
|
-
--help
|
|
53
|
-
--version
|
|
54
|
-
--model Override the local executor model for this run [string]
|
|
55
|
-
--profile Executor-specific profile override for this run [string]
|
|
56
|
-
--effort Override the model reasoning effort for this run [string]
|
|
57
|
-
--timeout-ms Interrupt the local executor after this much inactivity [number]
|
|
52
|
+
--help Show help [boolean]
|
|
53
|
+
--version Show version number [boolean]
|
|
58
54
|
```
|
|
59
55
|
|
|
60
56
|
## interf compile
|
|
@@ -67,10 +63,6 @@ Prepare files and write Portable Context agents can use
|
|
|
67
63
|
Options:
|
|
68
64
|
--help Show help [boolean]
|
|
69
65
|
--version Show version number [boolean]
|
|
70
|
-
--model Override the local executor model for this run [string]
|
|
71
|
-
--profile Executor-specific profile override for this run [string]
|
|
72
|
-
--effort Override the model reasoning effort for this run [string]
|
|
73
|
-
--timeout-ms Interrupt the local executor after this much inactivity [number]
|
|
74
66
|
--preparation Preparation id to compile when this Source Folder has more than one Preparation [string]
|
|
75
67
|
--max-attempts Retry the prepare run and run saved readiness checks with the same Method until the Preparation is ready or reaches this total attempt li
|
|
76
68
|
mit [number]
|
|
@@ -88,17 +80,11 @@ interf test
|
|
|
88
80
|
Run readiness checks against source files and Portable Context
|
|
89
81
|
|
|
90
82
|
Options:
|
|
91
|
-
--help
|
|
92
|
-
--version
|
|
93
|
-
--
|
|
94
|
-
--
|
|
95
|
-
--effort Override the model reasoning effort for this run [string]
|
|
96
|
-
--timeout-ms Interrupt the local executor after this much inactivity [number]
|
|
97
|
-
--preparation Preparation id to check when this Source Folder has more than one Preparation [string]
|
|
98
|
-
--target Check source files, Portable Context, or both. Default: both when Portable Context exists, otherwise source files.
|
|
83
|
+
--help Show help [boolean]
|
|
84
|
+
--version Show version number [boolean]
|
|
85
|
+
--preparation Preparation id to check when this Source Folder has more than one Preparation [string]
|
|
86
|
+
--target Check source files, Portable Context, or both. Default: both when Portable Context exists, otherwise source files.
|
|
99
87
|
[choices: "both", "source-files", "portable-context"]
|
|
100
|
-
--keep-sandboxes Keep every readiness-check sandbox for review instead of pruning successful ones [boolean] [default: false]
|
|
101
|
-
--agents Comma-separated local agents to use for readiness checks, or `all`. Example: --agents claude-code,codex [string]
|
|
102
88
|
```
|
|
103
89
|
|
|
104
90
|
## interf web
|
|
@@ -106,7 +92,7 @@ Options:
|
|
|
106
92
|
```text
|
|
107
93
|
interf web
|
|
108
94
|
|
|
109
|
-
Start Interf UI and the local Interf
|
|
95
|
+
Start Interf Compiler UI and the local Interf service
|
|
110
96
|
|
|
111
97
|
Options:
|
|
112
98
|
--help Show help [boolean]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ActionInputDefinition, ActionInputValues } from "../../packages/local-service/action-definitions.js";
|
|
2
|
+
export interface ActionInputPrompts {
|
|
3
|
+
select(options: {
|
|
4
|
+
message: string;
|
|
5
|
+
options: Array<{
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
hint?: string;
|
|
9
|
+
}>;
|
|
10
|
+
initialValue?: string;
|
|
11
|
+
}): Promise<string | symbol>;
|
|
12
|
+
text(options: {
|
|
13
|
+
message: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
initialValue?: string;
|
|
16
|
+
validate?: (value: string) => string | undefined;
|
|
17
|
+
}): Promise<string | symbol>;
|
|
18
|
+
isCancel(value: unknown): value is symbol;
|
|
19
|
+
}
|
|
20
|
+
export declare const clackActionInputPrompts: ActionInputPrompts;
|
|
21
|
+
export declare function promptActionInputValues(definition: ActionInputDefinition, options?: {
|
|
22
|
+
includeAdvanced?: boolean;
|
|
23
|
+
omitFields?: Set<string>;
|
|
24
|
+
prompts?: ActionInputPrompts;
|
|
25
|
+
}): Promise<ActionInputValues | null>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
export const clackActionInputPrompts = {
|
|
3
|
+
select: (options) => p.select(options),
|
|
4
|
+
text: (options) => p.text(options),
|
|
5
|
+
isCancel: p.isCancel,
|
|
6
|
+
};
|
|
7
|
+
function fieldInitialValue(values, field) {
|
|
8
|
+
return values[field.name] ?? "";
|
|
9
|
+
}
|
|
10
|
+
function fieldPromptMessage(field) {
|
|
11
|
+
return field.label;
|
|
12
|
+
}
|
|
13
|
+
export async function promptActionInputValues(definition, options = {}) {
|
|
14
|
+
const prompts = options.prompts ?? clackActionInputPrompts;
|
|
15
|
+
let values = { ...definition.initialValues };
|
|
16
|
+
const fields = definition.fields.filter((field) => {
|
|
17
|
+
if (field.readOnly)
|
|
18
|
+
return false;
|
|
19
|
+
if (options.omitFields?.has(field.name))
|
|
20
|
+
return false;
|
|
21
|
+
if (field.advanced && options.includeAdvanced !== true)
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
});
|
|
25
|
+
for (const field of fields) {
|
|
26
|
+
const initialValue = fieldInitialValue(values, field);
|
|
27
|
+
const validate = (value) => {
|
|
28
|
+
const nextValues = {
|
|
29
|
+
...values,
|
|
30
|
+
[field.name]: value,
|
|
31
|
+
};
|
|
32
|
+
const normalizedValues = definition.normalizeValues?.(nextValues) ?? nextValues;
|
|
33
|
+
const parsed = definition.schema.safeParse(normalizedValues);
|
|
34
|
+
if (!parsed.success) {
|
|
35
|
+
const issue = parsed.error.issues.find((candidate) => candidate.path[0] === field.name);
|
|
36
|
+
if (issue)
|
|
37
|
+
return issue.message;
|
|
38
|
+
}
|
|
39
|
+
const requestErrors = definition.validateRequest?.(normalizedValues) ?? {};
|
|
40
|
+
return requestErrors[field.name];
|
|
41
|
+
};
|
|
42
|
+
const answer = field.type === "select"
|
|
43
|
+
? await prompts.select({
|
|
44
|
+
message: fieldPromptMessage(field),
|
|
45
|
+
options: field.options ?? [],
|
|
46
|
+
...(initialValue ? { initialValue } : {}),
|
|
47
|
+
})
|
|
48
|
+
: await prompts.text({
|
|
49
|
+
message: fieldPromptMessage(field),
|
|
50
|
+
placeholder: field.placeholder,
|
|
51
|
+
initialValue,
|
|
52
|
+
validate,
|
|
53
|
+
});
|
|
54
|
+
if (prompts.isCancel(answer))
|
|
55
|
+
return null;
|
|
56
|
+
values = {
|
|
57
|
+
...values,
|
|
58
|
+
[field.name]: String(answer),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const normalizedValues = definition.normalizeValues?.(values) ?? values;
|
|
62
|
+
const parsed = definition.schema.safeParse(normalizedValues);
|
|
63
|
+
if (!parsed.success) {
|
|
64
|
+
const issue = parsed.error.issues[0];
|
|
65
|
+
throw new Error(issue?.message ?? `${definition.title} input is invalid.`);
|
|
66
|
+
}
|
|
67
|
+
const requestErrors = definition.validateRequest?.(parsed.data) ?? {};
|
|
68
|
+
const firstRequestError = Object.values(requestErrors)[0];
|
|
69
|
+
if (firstRequestError) {
|
|
70
|
+
throw new Error(firstRequestError);
|
|
71
|
+
}
|
|
72
|
+
return parsed.data;
|
|
73
|
+
}
|
|
@@ -2,19 +2,13 @@ import * as p from "@clack/prompts";
|
|
|
2
2
|
import { detectInterf } from "../../packages/project-model/interf.js";
|
|
3
3
|
import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
|
|
4
4
|
import type { CommandModule } from "yargs";
|
|
5
|
-
import {
|
|
6
|
-
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
7
|
-
import { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
8
|
-
export { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
5
|
+
import { choosePreparationConfig } from "./preparation-picker.js";
|
|
9
6
|
export declare const compileCommand: CommandModule;
|
|
10
7
|
interface CompileCommandDeps {
|
|
11
|
-
|
|
8
|
+
choosePreparationConfig: typeof choosePreparationConfig;
|
|
12
9
|
confirm: typeof p.confirm;
|
|
13
10
|
detectInterf: typeof detectInterf;
|
|
14
|
-
ensureCompiledFromConfig: typeof ensureCompiledFromConfig;
|
|
15
11
|
resolveInteractiveCompileLoopOverrides: typeof resolveInteractiveCompileLoopOverrides;
|
|
16
|
-
resolveOrConfigureLocalExecutor: typeof resolveOrConfigureLocalExecutor;
|
|
17
|
-
runConfiguredCompiledCompile: typeof runConfiguredCompiledCompile;
|
|
18
12
|
}
|
|
19
13
|
export interface CompileCommandResult {
|
|
20
14
|
compiledPath: string;
|
|
@@ -31,3 +25,4 @@ export declare function resolveInteractiveCompileLoopOverrides(options: {
|
|
|
31
25
|
maxAttemptsOverride: number | null;
|
|
32
26
|
maxLoopsOverride: number | null;
|
|
33
27
|
} | null>;
|
|
28
|
+
export {};
|
|
@@ -2,20 +2,17 @@ import chalk from "chalk";
|
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
3
|
import { detectInterf, readInterfConfig, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
|
|
4
4
|
import { loadCompiledPreparationConfig, sourcePreparationConfigFromInterfConfig, resolvePreparationCompileMaxAttempts, resolvePreparationCompileMaxLoops, } from "../../packages/project-model/source-config.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { portableContextPath, } from "../../packages/project-model/project-paths.js";
|
|
6
|
+
import { choosePreparationConfig, } from "./preparation-picker.js";
|
|
7
7
|
import { resolveConfiguredPreparationSelection } from "./preparation-selection.js";
|
|
8
8
|
import { promptCompileLoopSelection, } from "./source-config-wizard.js";
|
|
9
|
-
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
10
|
-
import { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
11
9
|
import { submitCompileRunToLocalService, waitForLocalCompileRun, } from "../../packages/local-service/index.js";
|
|
12
10
|
import { resolveCommandControlPath } from "./control-path.js";
|
|
13
11
|
import { resolveMethodId } from "../../packages/methods/method-resolution.js";
|
|
14
|
-
export { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
15
12
|
export const compileCommand = {
|
|
16
13
|
command: "compile",
|
|
17
14
|
describe: "Prepare files and write Portable Context agents can use",
|
|
18
|
-
builder: (yargs) =>
|
|
15
|
+
builder: (yargs) => yargs.option("preparation", {
|
|
19
16
|
type: "string",
|
|
20
17
|
describe: "Preparation id to compile when this Source Folder has more than one Preparation",
|
|
21
18
|
}).option("max-attempts", {
|
|
@@ -34,13 +31,10 @@ export const compileCommand = {
|
|
|
34
31
|
},
|
|
35
32
|
};
|
|
36
33
|
const defaultCompileCommandDeps = {
|
|
37
|
-
|
|
34
|
+
choosePreparationConfig,
|
|
38
35
|
confirm: p.confirm,
|
|
39
36
|
detectInterf,
|
|
40
|
-
ensureCompiledFromConfig,
|
|
41
37
|
resolveInteractiveCompileLoopOverrides,
|
|
42
|
-
resolveOrConfigureLocalExecutor,
|
|
43
|
-
runConfiguredCompiledCompile,
|
|
44
38
|
};
|
|
45
39
|
function readHintedSourcePath(argv) {
|
|
46
40
|
return typeof argv.sourcePath === "string" && argv.sourcePath.trim().length > 0
|
|
@@ -103,7 +97,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
103
97
|
requestedPreparationName,
|
|
104
98
|
hintedPreparationConfig,
|
|
105
99
|
})
|
|
106
|
-
: await helpers.
|
|
100
|
+
: await helpers.choosePreparationConfig({
|
|
107
101
|
sourcePath,
|
|
108
102
|
selectMessage: "Which saved Preparation do you want to compile?",
|
|
109
103
|
});
|
|
@@ -130,7 +124,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
130
124
|
return null;
|
|
131
125
|
}
|
|
132
126
|
compiledConfig = selectedCompiled;
|
|
133
|
-
compiledPath =
|
|
127
|
+
compiledPath = portableContextPath(sourcePath, selectedCompiled.name);
|
|
134
128
|
if (!skipPreparationBanner) {
|
|
135
129
|
console.log(chalk.dim(` Preparation: ${selectedCompiled.name}`));
|
|
136
130
|
}
|
|
@@ -162,7 +156,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
162
156
|
maxAttemptsOverride,
|
|
163
157
|
maxLoopsOverride,
|
|
164
158
|
});
|
|
165
|
-
if (
|
|
159
|
+
if (compiledConfig) {
|
|
166
160
|
const submitted = await submitCompileRunToLocalService({
|
|
167
161
|
projectPath: sourcePath,
|
|
168
162
|
request: {
|
|
@@ -211,37 +205,15 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
211
205
|
testedDuringCompile,
|
|
212
206
|
};
|
|
213
207
|
}
|
|
214
|
-
}
|
|
215
|
-
const executionProfile = executionProfileFromArgv(argv);
|
|
216
|
-
const { executor, error } = await helpers.resolveOrConfigureLocalExecutor({
|
|
217
|
-
executionProfile,
|
|
218
|
-
purpose: "compile",
|
|
219
|
-
});
|
|
220
|
-
if (!executor && !error)
|
|
221
|
-
return null;
|
|
222
|
-
if (!executor) {
|
|
223
208
|
process.exitCode = 1;
|
|
224
|
-
console.log(chalk.red(
|
|
209
|
+
console.log(chalk.red(" Interf local service is not running for this Workspace."));
|
|
210
|
+
console.log(chalk.dim(" Start it with `interf web`, then rerun `interf compile` so the prepare run is visible in Interf."));
|
|
225
211
|
return null;
|
|
226
212
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
sourcePath,
|
|
232
|
-
compiledConfig,
|
|
233
|
-
executionProfile,
|
|
234
|
-
maxAttemptsOverride,
|
|
235
|
-
maxLoopsOverride,
|
|
236
|
-
preserveStageShells: readStageShellRetentionMode(argv),
|
|
237
|
-
});
|
|
238
|
-
if (!compiled) {
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
compiledPath,
|
|
243
|
-
testedDuringCompile,
|
|
244
|
-
};
|
|
213
|
+
process.exitCode = 1;
|
|
214
|
+
console.log(chalk.red(" Interf could not resolve a saved Preparation for this prepare run."));
|
|
215
|
+
console.log(chalk.dim(" Run `interf list` to inspect saved Preparations, then rerun `interf compile --preparation <id>`."));
|
|
216
|
+
return null;
|
|
245
217
|
}
|
|
246
218
|
export async function resolveInteractiveCompileLoopOverrides(options) {
|
|
247
219
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
2
|
-
import { runMethodAuthoringDraft } from "../../packages/method-authoring/method-authoring.js";
|
|
3
1
|
import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
|
|
4
|
-
import type { MethodExecutionProfile } from "../../packages/agents/lib/executors.js";
|
|
5
2
|
export interface MethodWizardPrompts {
|
|
6
3
|
intro(message: string): void;
|
|
7
4
|
select(options: {
|
|
@@ -51,26 +48,17 @@ export declare function chooseCompiledMethod(sourcePath: string, options?: {
|
|
|
51
48
|
}): Promise<string | symbol>;
|
|
52
49
|
export declare function chooseOrCreateCompiledMethodForPreparation(sourcePath: string, preparationConfig: SourcePreparationConfig, options?: {
|
|
53
50
|
currentMethodId?: string;
|
|
54
|
-
executionProfile?: MethodExecutionProfile;
|
|
55
|
-
resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
|
|
56
|
-
runDraft?: typeof runMethodAuthoringDraft;
|
|
57
51
|
}, prompts?: MethodWizardPrompts): Promise<string | symbol | null>;
|
|
58
52
|
export declare function createMethodWizard(options?: {
|
|
59
53
|
intro?: boolean;
|
|
60
54
|
sourcePath?: string;
|
|
61
|
-
executionProfile?: MethodExecutionProfile;
|
|
62
55
|
baseMethodId?: string;
|
|
63
56
|
creationMode?: MethodCreationMode;
|
|
64
57
|
preparationContext?: MethodWizardPreparationContext;
|
|
65
|
-
resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
|
|
66
|
-
runDraft?: typeof runMethodAuthoringDraft;
|
|
67
58
|
}, prompts?: MethodWizardPrompts): Promise<string | symbol | null>;
|
|
68
59
|
export declare function createCompiledMethodWizard(sourcePath: string, prompts?: MethodWizardPrompts, options?: {
|
|
69
|
-
executionProfile?: MethodExecutionProfile;
|
|
70
60
|
baseMethodId?: string;
|
|
71
61
|
creationMode?: MethodCreationMode;
|
|
72
62
|
preparationContext?: MethodWizardPreparationContext;
|
|
73
|
-
resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
|
|
74
|
-
runDraft?: typeof runMethodAuthoringDraft;
|
|
75
63
|
}): Promise<string | symbol | null>;
|
|
76
64
|
export {};
|